mule-2.0.1/0000755000175000017500000000000011351411165012276 5ustar charlescharlesmule-2.0.1/examples/0000755000175000017500000000000011351411173014113 5ustar charlescharlesmule-2.0.1/examples/webapp/0000755000175000017500000000000011351411174015372 5ustar charlescharlesmule-2.0.1/examples/webapp/conf/0000755000175000017500000000000011351411173016316 5ustar charlescharlesmule-2.0.1/examples/webapp/conf/servlet-config.xml0000644000175000017500000000353111006057162021772 0ustar charlescharles mule-2.0.1/examples/webapp/conf/jmx-config.xml0000644000175000017500000000145110757023422021107 0ustar charlescharles mule-2.0.1/examples/webapp/conf/proxy.properties0000644000175000017500000000016510723004310021610 0ustar charlescharles# Set these properties for your HTTP proxy if necessary. proxyHostname= proxyPort=8080 proxyUsername= proxyPassword= mule-2.0.1/examples/webapp/dist/0000755000175000017500000000000011351411173016334 5ustar charlescharlesmule-2.0.1/examples/webapp/dist/build.xml0000644000175000017500000000717610767607640020210 0ustar charlescharles mule-2.0.1/examples/webapp/dist/README.txt0000644000175000017500000000167510747504633020057 0ustar charlescharles+-----------------+ | Web App Example | +-----------------+ The Web App provides a user interface to some of the Mule examples such as the LoanBroker, Hello World and Echo examples. It also provides examples of accessing Mule using REST style service calls and is itself an example of how to embed Mule in a webapp. For more information, refer to http://www.muledocs.org/Examples +---------------------+ | Running the example | +---------------------+ First, make sure you have set the MULE_HOME environment variable as recommended in INSTALL.txt Depending on the build tool you are using (Ant or Maven), you can build the example by simply running "ant" or "mvn". This will generate a WAR file in the "target" directory which can be deployed to any standard JEE web server. By default, the "mvn" build will automatically start up the WAR in Jetty! Just surf to the following URL in your browser and enjoy: http://localhost:8090/mule-examples mule-2.0.1/examples/webapp/dist/pom.xml0000644000175000017500000001734611006063605017664 0ustar charlescharles 4.0.0 org.mule.examples mule-example-webapp 1.0 war Web App Example Is a webapp that provides an interface to some of the examples here such as the LoanBroker, Hello World and Echo examples. It also provides examples of accessing Mule using REST style service calls and is itself an example of how to embed Mule in a webapp. 2.0.1 mule-examples 6.1.6 jetty:run-war conf src/main/resources org.apache.maven.plugins maven-war-plugin ${webappName} org.mortbay.jetty maven-jetty-plugin /${webappName} ${project.build.directory}/${webappName}.war 10 8090 60000 org.apache.maven.plugins maven-surefire-plugin true surefire-it integration-test test false org.mule.examples mule-example-echo ${muleVersion} jetty org.mortbay.jetty org.mule.examples mule-example-hello ${muleVersion} jetty org.mortbay.jetty org.mule.examples mule-example-stockquote ${muleVersion} jetty org.mortbay.jetty org.mule.examples mule-example-loanbroker-esn ${muleVersion} jetty org.mortbay.jetty org.mule.modules mule-module-spring-config ${muleVersion} org.mule.transports mule-transport-http ${muleVersion} jetty org.mortbay.jetty org.mule.transports mule-transport-file ${muleVersion} org.mortbay.jetty jetty ${jettyVersion} test org.mule mule-core ${muleVersion} test test-jar codehaus Codehaus Maven 2.x Release Repository http://repository.codehaus.org false codehaus-snapshots Codehaus Maven 2.x Snapshots Repository http://snapshots.repository.codehaus.org true false java.net Java.net Repository http://download.java.net/maven/1/ legacy apache-plugin-snapshots Apache Maven Plugins Snapshot Repository http://people.apache.org/maven-snapshot-repository true false mule-2.0.1/examples/webapp/src/0000755000175000017500000000000011351411173016160 5ustar charlescharlesmule-2.0.1/examples/webapp/src/main/0000755000175000017500000000000011351411173017104 5ustar charlescharlesmule-2.0.1/examples/webapp/src/main/java/0000755000175000017500000000000011351411173020025 5ustar charlescharlesmule-2.0.1/examples/webapp/src/main/java/org/0000755000175000017500000000000011351411173020614 5ustar charlescharlesmule-2.0.1/examples/webapp/src/main/java/org/mule/0000755000175000017500000000000011351411173021556 5ustar charlescharlesmule-2.0.1/examples/webapp/src/main/java/org/mule/example/0000755000175000017500000000000011351411173023211 5ustar charlescharlesmule-2.0.1/examples/webapp/src/main/java/org/mule/example/rest/0000755000175000017500000000000011351411173024166 5ustar charlescharlesmule-2.0.1/examples/webapp/src/main/java/org/mule/example/rest/RestTester.java0000644000175000017500000000135710754375733027164 0ustar charlescharles/* * $Id: RestTester.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.rest; import org.mule.component.simple.StaticComponent; /** * TODO This is a bogus class that has been put here so that the Corbertura plugin * does not barf, we need to find a way to get this plug in to ignore certain modules */ public class RestTester extends StaticComponent { // nothing here } mule-2.0.1/examples/webapp/src/main/webapp/0000755000175000017500000000000011351411174020363 5ustar charlescharlesmule-2.0.1/examples/webapp/src/main/webapp/footer.html0000644000175000017500000000063010626327574022564 0ustar charlescharles
Mule  Logo
mule-2.0.1/examples/webapp/src/main/webapp/echo.jsp0000644000175000017500000000164610754375733022046 0ustar charlescharles<%@ page import="org.mule.module.client.MuleClient, org.mule.api.MuleMessage"%> <%@ page language="java" contentType="text/html; charset=UTF-8" %> Mule Echo Example <% String echo = request.getParameter("echo"); if(echo!=null) { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://echo", echo, null); %>

You typed <%=message.getPayload()%>!

<%}%> Please enter something:

For more information about Echo example go here.
mule-2.0.1/examples/webapp/src/main/webapp/contents.html0000644000175000017500000000400010631662064023106 0ustar charlescharles Mule Samples
Home
Echo
Hello World
REST Hello World
REST Put/Get
Loan Broker
Stock Quote
JMX Console
Example Docs
 
© MueSource
mule-2.0.1/examples/webapp/src/main/webapp/restputget.html0000644000175000017500000000311510631662064023465 0ustar charlescharles Mule REST Examples This example demostrates dispatching an event to Mule asynchronously using the
Http Put method and then receiving the event using the Http Get method.
This example uses the Servlet Connector which is part of the Http Transport to talk to Mule. When a result is returned there
will be in ascii text form so you'll need to hit the back button to return to this page.

Task for the reader

Http PUT

Http PUT will send an event asynchronously to the Mule server

Please enter something:

Http GET

Get get something back
mule-2.0.1/examples/webapp/src/main/webapp/stockquote.jsp0000644000175000017500000000256410754375733023331 0ustar charlescharles<%@ page import="org.mule.module.client.MuleClient, org.mule.api.MuleMessage"%> <%@ page language="java" contentType="text/html; charset=UTF-8" %> Mule Stock Quote Example <% String symbol = request.getParameter("symbol"); if(symbol!=null) { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://stockquote", symbol, null); if(message!=null) { %> <%if(message.getExceptionPayload()!=null) {%>

A Error occurred: <%=message.getExceptionPayload()%>

<%} else {%>

<%=message.getPayload()%>

<%}%> <%} else {%>

Message returned is null and no error information is available. Check the logs for more information. Note you need an internet connection to invoke this service.

<%} }%> Enter a stock symbol:

For more information about the Stock Quote example go here.
mule-2.0.1/examples/webapp/src/main/webapp/header.html0000644000175000017500000000063010626327574022516 0ustar charlescharles Mule Examples

MuleSource Logo
mule-2.0.1/examples/webapp/src/main/webapp/images/0000755000175000017500000000000011351411174021630 5ustar charlescharlesmule-2.0.1/examples/webapp/src/main/webapp/images/mule-banner.gif0000644000175000017500000001403310626327574024543 0ustar charlescharlesGIF89a`cdfޓٵ}j657GGIUVX㬮O=|~ϥȴpqt)"fSO=ź6*ʘҦC3[Hr_Ċxr_Êxʘ# !,`@pH,Ȥrl:ШtJZجvzxL.zn(2i +tw%"' P "!w)P .%0" g #ȾΡՄ'ڠ"V&#!(* "%HH`!)dt Çǐȶ" 3jeŏvDpIG(E\ɒI)$@͛ ̼ɳfNJzlIK(1zӧPc, U*ڴ?Ѱ SQ'X6jVJ[ @YT4sc rmV*~Pܫ4tX ~1<,OҀrƆ[4i0g֥s`_P;EnԅTG$! xfox z)AV ,gyLo;:wmj{[@0,~<*q롥ZHlVDwՁeXc vE\A u-(%UОXU+fhIm6hIă'|NQVZQ`U2j (PF)K1w c @vuN])Q阤!4jӐMF!x">Ap1hQ=PqbyȆ!΍Umb`% ]pDR[b9!ѨXJт,R"Z.&BFU+pŝN5^JHyF ,UIfHХmJdJETzqWp B0,Y`(N"PqkQ եr/&0 KkEO- EPdk.*d{A#O@ȻL )ýcp,ʺVPŊĬW{.hiH3y@rKZR ,yv jIdKRIn0ȼ:ַ1amBFpJLEbZ= )jvxBoZjd+T$WCT( -,Oo}0yc*LBB`[X5iro*W*5*H@`{M JYtFJnւ  AFf)@MxS,E.rW㰨fNB.G~~}&].θ.TB~/MѪ !(R\BGs4Fcz2@$U*4Z&<{ )cضm ^`^qbaJFرY͑qES1Ru&l;w=m֡Enȵ+}7NVyMBhي5\'1r[L* W!Irx⚚r\x7JM;L@:[frP ]ry^lЩYEBR7ɣmr>Q'پ?"K:`VBFB;MϬ}v! pB|7mo8;sBzy̰}!0*y6{$ WS®<Э"^l Bc'D~gʏ< azjo|񺿊wq./>Hap%{Wa׍QO$\[ ԾQg];R~7ars}yWmB@,ŧ`Q!qegӧzK#XwWKz{:n%Qց#hAvGoS<3W#V]sQPt<\+oq|l*CPq k`62,m;X;Lp`lp̞ u,` ˜2GP\BpŮ {~+`X <\@|ۼ<ψ+̬L l`̹SM|SD~ΫT%[`"nܝ\ɚ֝Ĝ|X[~j^{I mo.{H~۹o Eϡ1uվ{7d[Nyn`D紭@s` T>HM-bߋjNu[a=N3.\^nNC hd-MB`ي 24ҔN3נy= =V5 ݮ{<6%^w^|mpE+ Gٴnێ}ާaBD~ލl<膌g>⹍*m.IB~{}\#V  |ެռD0S[ ]M Ú4]\`,٬,<9 9FѬ.Mj<, ~hOP}иI<Π P }ڜML>,Ip%LI Ϭ]!bo#n > o{ kąe z濿qn\N2hdd&,D\"1)8H-x0 Z<|FֱvR ">ڜ8>e&(6 9e8,Nx0ayw ue"FO3zIMes's>:GZY)v#=:~uk:5$Iw)S{劉$J2m-nAfmGTدtfKWx+AҾ Z԰Iskk /b ̘n(˖iՏ48\ё]ab3F}{WyۣV/WSicw=nxzAnoo*pζk; I qr7ib$QGF<,7u]S4^2RK6b5@Fq~9;ivmNҳ\!\`b+;y<vEm:_</vͻqX \xO^[]Ǫnk`j4a^Q@o|MZ?  +!e G5|to:N5{{Y㹝M&3!9bqxEC⯅ZNvVH sڣn_kO CKT)}ŕdeV yQ@= x|M6 !hڪ n9?Z;K jl `c?(rKXG.[[Qoicm{|H8}+݊1QVG;Fo2-<;>7ñuzQIWtxݵpXg4Q[7hYv_̖mule-2.0.1/examples/webapp/src/main/webapp/welcome.html0000644000175000017500000000045510204257011022702 0ustar charlescharles Mule Samples
 

Welcome to the Mule samples webapp

This applications demonstrates some of the features of Mule as well as providing a
working example of embedding Mule in a webapp.

 

mule-2.0.1/examples/webapp/src/main/webapp/helloworld.jsp0000644000175000017500000000165310754375733023301 0ustar charlescharles<%@ page import="org.mule.module.client.MuleClient, org.mule.api.MuleMessage"%> <%@ page language="java" contentType="text/html; charset=UTF-8" %> Mule Hello World <% String name = request.getParameter("name"); if(name!=null) { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://greeter", name, null); %>

<%=message.getPayload()%>

<%}%> Please enter your name:

For more information about Hello world example go here.
mule-2.0.1/examples/webapp/src/main/webapp/loanbroker.jsp0000644000175000017500000000545510767713007023262 0ustar charlescharles<%@ page import="org.mule.example.loanbroker.esn.LoanBrokerApp, org.mule.example.loanbroker.messages.Customer, org.mule.example.loanbroker.messages.CustomerQuoteRequest, org.mule.module.client.MuleClient, org.mule.api.MuleMessage, java.util.Iterator, java.util.List"%> <%@ page language="java" contentType="text/html; charset=UTF-8" %> Mule Loan Broker Example <% String amountString = request.getParameter("amount"); String durationString = request.getParameter("duration"); String name = request.getParameter("name"); String random = request.getParameter("random"); if(random!=null) { LoanBrokerApp consumer = new LoanBrokerApp(); int requests = Integer.parseInt(random); //to get all the result and print them out List results = consumer.requestSend(requests, "CustomerRequests"); %> You have just made <%=requests%> Loan Requests!

    <% for(Iterator iter = results.iterator(); iter.hasNext();) { %>
  1. <%=iter.next().toString()%>
  2. <% }%>
<% } else if(amountString!=null && durationString!=null && name!=null) { MuleClient client = new MuleClient(); Customer cust = new Customer(name, 1234); double amount = Double.valueOf(amountString).doubleValue(); int duration = Integer.parseInt(durationString); CustomerQuoteRequest loanRequest = new CustomerQuoteRequest(cust, amount, duration); MuleMessage message = client.send("CustomerRequests", loanRequest, null); %>

The best quote was received from:
<%=message.getPayload()%>

<%} else {%>
Send 10 random requests:

- Or -
Please enter your Loan Details:
Name:
Amount:
Duration:
<%}%>

For more information about Loan Broker example go here.
mule-2.0.1/examples/webapp/src/main/webapp/index.html0000644000175000017500000000127110626327574022377 0ustar charlescharles Mule Samples <body> <p>This page uses frames, but your browser doesn't support them.</p> </body> mule-2.0.1/examples/webapp/src/main/webapp/WEB-INF/0000755000175000017500000000000011351411174021412 5ustar charlescharlesmule-2.0.1/examples/webapp/src/main/webapp/WEB-INF/web.xml0000644000175000017500000000411310754375733022730 0ustar charlescharles Mule Mule Web App Samples org.mule.config jmx-config.xml, echo-config.xml, hello-http-config.xml, servlet-config.xml, stockquote-rest-config.xml, loan-broker-sync-config.xml, loan-broker-axis-endpoints-config.xml org.mule.config.builders.MuleXmlBuilderContextListener muleRESTServlet org.mule.transport.http.servlet.MuleRESTReceiverServlet org.mule.servlet.timeout 4000 request timeout readonly false 1 muleServlet org.mule.transport.http.servlet.MuleReceiverServlet 2 muleRESTServlet /rest/* muleServlet /services/* index.html mule-2.0.1/examples/webapp/src/main/webapp/resthelloworld.html0000644000175000017500000000172410631662064024334 0ustar charlescharles Mule Hello World

Http POST

Http POST will send an event to the Mule server and return a result once the request has been
processed. This example uses the Servlet Connector in the Http Transport.

Please enter your name:

mule-2.0.1/examples/webapp/src/main/resources/0000755000175000017500000000000011351411173021116 5ustar charlescharlesmule-2.0.1/examples/webapp/src/main/resources/log4j.properties0000644000175000017500000000050210662703740024260 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=INFO mule-2.0.1/examples/webapp/src/test/0000755000175000017500000000000011351411173017137 5ustar charlescharlesmule-2.0.1/examples/webapp/src/test/java/0000755000175000017500000000000011351411173020060 5ustar charlescharlesmule-2.0.1/examples/webapp/src/test/java/org/0000755000175000017500000000000011351411173020647 5ustar charlescharlesmule-2.0.1/examples/webapp/src/test/java/org/mule/0000755000175000017500000000000011351411173021611 5ustar charlescharlesmule-2.0.1/examples/webapp/src/test/java/org/mule/example/0000755000175000017500000000000011351411173023244 5ustar charlescharlesmule-2.0.1/examples/webapp/src/test/java/org/mule/example/webapp/0000755000175000017500000000000011351411173024522 5ustar charlescharlesmule-2.0.1/examples/webapp/src/test/java/org/mule/example/webapp/AbstractWebappTestCase.java0000644000175000017500000000642410763522057031743 0ustar charlescharles/* * $Id: AbstractWebappTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.webapp; import org.mule.api.MuleMessage; import org.mule.example.loanbroker.messages.Customer; import org.mule.example.loanbroker.messages.CustomerQuoteRequest; import org.mule.example.loanbroker.messages.LoanQuote; import org.mule.module.client.MuleClient; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.StringUtils; public abstract class AbstractWebappTestCase extends AbstractMuleTestCase { public void testSanity() throws Exception { new MuleClient(); } public void testEchoExample() throws Exception { MuleClient client = new MuleClient(); MuleMessage response = client.send("vm://echo", "Is anybody in there?", null); assertEquals("Is anybody in there?", response.getPayload()); } public void testHelloExample() throws Exception { MuleClient client = new MuleClient(); MuleMessage response = client.send("vm://greeter", "Julius Caesar", null); // ATTENTION: thie message is localized, a full comparison cannot be done here assertTrue(response.getPayloadAsString().indexOf("Julius Caesar") > -1); } public void testStockQuoteExample() throws Exception { MuleClient client = new MuleClient(); MuleMessage response = client.send("vm://stockquote", "HRB", null); if (null == response) { fail("No response message."); } else { if (null == response.getExceptionPayload()) { String text = response.getPayloadAsString(); assertNotNull("Null response", text); assertTrue("Stock quote should contain \"BLOCK\": " + text, StringUtils.contains(text, "BLOCK")); assertTrue("Stock quote should start with \"StockQuote[\":" + text, text.startsWith("StockQuote[")); logger.debug("**********"); logger.debug(response.getPayload()); logger.debug(response.getPayloadAsString()); logger.debug("**********"); } else { fail("Exception occurred: " + response.getExceptionPayload()); } } } public void testLoanBrokerExample() throws Exception { MuleClient client = new MuleClient(); CustomerQuoteRequest loanRequest = new CustomerQuoteRequest(new Customer("I.M. Broke", 1234), 50000, 60); MuleMessage response = client.send("CustomerRequests", loanRequest, null); assertNotNull("Result is null", response); assertTrue("Result should be LoanQuote but is " + response.getPayload().getClass().getName(), response.getPayload() instanceof LoanQuote); LoanQuote quote = (LoanQuote) response.getPayload(); assertTrue("Interest rate is missing.", quote.getInterestRate() > 0); } } mule-2.0.1/examples/webapp/src/test/java/org/mule/example/webapp/MockTestCase.java0000644000175000017500000000731710754375733027743 0ustar charlescharles/* * $Id: MockTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.webapp; import org.mule.api.config.ConfigurationBuilder; import org.mule.config.builders.WebappMuleXmlConfigurationBuilder; import com.mockobjects.constraint.IsInstanceOf; import com.mockobjects.dynamic.FullConstraintMatcher; import com.mockobjects.dynamic.Mock; import javax.servlet.ServletContext; /** * This test just basically checks that all the config files used in the webapp example * are valid and can co-exist without any conflicts. */ public class MockTestCase extends AbstractWebappTestCase { //@Override protected String getConfigurationResources() { return "jmx-config.xml," + "echo-config.xml," + "hello-http-config.xml," + "servlet-config.xml," + "stockquote-rest-config.xml," + "loan-broker-sync-config.xml," + "loan-broker-axis-endpoints-config.xml"; } protected ConfigurationBuilder getBuilder() throws Exception { Mock context = new Mock(ServletContext.class); context.expect("getInitParameter",new IsInstanceOf(String.class)); context.expect("getInitParameter",new IsInstanceOf(String.class)); // For some reason spring calls getResourceAsStream on the ServletContext twice for each file. context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); context.expectAndReturn("getResourceAsStream", new FullConstraintMatcher(new IsInstanceOf(String.class)), null); return new WebappMuleXmlConfigurationBuilder((ServletContext) context.proxy(), getConfigurationResources()); } } mule-2.0.1/examples/webapp/src/test/java/org/mule/example/webapp/JettyTestCase.java0000644000175000017500000000453210767505705030143 0ustar charlescharles/* * $Id: JettyTestCase.java 11394 2008-03-17 15:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.webapp; import junit.framework.TestCase; import org.mortbay.jetty.Server; import org.mortbay.jetty.webapp.WebAppContext; /** * This tests runs in Maven's "integration-test" phase, after the .war has been built. * It starts up the .war inside Jetty and runs tests against the Mule instance. * Note that the MuleClient does not work in this case because we have no access to the * MuleContext (which is inside the Jetty container). */ public class JettyTestCase extends TestCase // TODO MULE-2768 { public static final String WEBAPP_WAR_FILE = "./target/mule-example.war"; public static final String WEBAPP_CONTEXT_PATH = "/mule-example"; public static final int JETTY_PORT = 8090; private Server jetty = null; @Override protected void setUp() throws Exception { super.setUp(); if (jetty == null) { jetty = new Server(JETTY_PORT); jetty.addHandler(new WebAppContext(WEBAPP_WAR_FILE, WEBAPP_CONTEXT_PATH)); jetty.start(); } } @Override protected void tearDown() throws Exception { if (jetty != null) { jetty.stop(); } super.tearDown(); } public void testSanity() throws Exception { // empty } // This test fails, I'm not sure how we could get the MuleContext from the Web Container. //public void testMuleContextAvailable() throws Exception //{ // MuleContext mc = MuleServer.getMuleContext(); // assertNotNull("MuleContext should have been set by MuleXmlConfigurationBuilder", mc); // assertTrue("MuleContext not initialised", mc.isInitialised()); // assertTrue("MuleContext not started", mc.isStarted()); //} // TODO Add the tests from AbstractWebappTestCase, but without using the MuleClient because // MuleClient needs the MuleContext (at least for sending to vm endpoints). } mule-2.0.1/examples/webapp/src/test/resources/0000755000175000017500000000000011351411173021151 5ustar charlescharlesmule-2.0.1/examples/webapp/src/test/resources/log4j.properties0000644000175000017500000000050210633357323024313 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/examples/webapp/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006310725274514026034 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/examples/webapp/pom.xml0000644000175000017500000001442211006063605016711 0ustar charlescharles 4.0.0 org.mule.examples mule-examples 2.0.1 mule-example-webapp war Web App Example Is a webapp that provides an interface to some of the examples here such as the LoanBroker, Hello World and Echo examples. It also provides examples of accessing Mule using REST style service calls and is itself an example of how to embed Mule in a webapp. mule-examples 6.1.6 jetty:run-war conf src/main/resources org.apache.maven.plugins maven-war-plugin ${webappName} org.mortbay.jetty maven-jetty-plugin /${webappName} ${project.build.directory}/${webappName}.war 10 8090 60000 org.apache.maven.plugins maven-surefire-plugin true surefire-it integration-test test false org.mule.examples mule-example-echo ${version} jetty org.mortbay.jetty org.mule.examples mule-example-hello ${version} jetty org.mortbay.jetty org.mule.examples mule-example-stockquote ${version} jetty org.mortbay.jetty org.mule.examples mule-example-loanbroker-esn ${version} jetty org.mortbay.jetty org.mule.modules mule-module-spring-config ${version} org.mule.transports mule-transport-http ${version} jetty org.mortbay.jetty org.mule.transports mule-transport-file ${version} org.mortbay.jetty jetty ${jettyVersion} test org.mule mule-core ${version} test test-jar mule-2.0.1/examples/hello-osgi/0000755000175000017500000000000011351411166016157 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/conf/0000755000175000017500000000000011351411166017104 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/conf/hello-spring-config.xml0000644000175000017500000001510210754375733023512 0ustar charlescharles java.lang.String java.lang.String org.mule.example.hello.NameString org.mule.example.hello.ChatString java.lang.String file:///tmp/in?transformers=BytesToString,StringToNameString vm://chitchatter Greeter vm://chitchatter?transformers=NameStringToChatString file:///tmp/out?transformers=ChatStringToString ChitChatter mule-2.0.1/examples/hello-osgi/dist/0000755000175000017500000000000011351411166017122 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/dist/build.xml0000644000175000017500000000650110767604414020757 0ustar charlescharles mule-2.0.1/examples/hello-osgi/dist/pom.xml0000644000175000017500000001072611006063605020443 0ustar charlescharles 4.0.0 org.mule.examples mule-example-hello 1.0 Hello Example Shows how to configure multiple components to interact on a single request and how to manage event transformations. 2.0.1 org.mule mule-core ${muleVersion} org.mule.modules mule-module-spring-extras ${muleVersion} org.mule.transports mule-transport-http ${muleVersion} codehaus Codehaus Maven 2.x Release Repository http://repository.codehaus.org false codehaus-snapshots Codehaus Maven 2.x Snapshots Repository http://snapshots.repository.codehaus.org true false apache-plugin-snapshots Apache Maven Plugins Snapshot Repository http://people.apache.org/maven-snapshot-repository true false install conf src/main/resources org.apache.maven.plugins maven-dependency-plugin 2.0-20060907.213033-3 copy-artifact install copy ${MULE_HOME}/lib/user true true true ${groupId} ${artifactId} ${version} mule-2.0.1/examples/hello-osgi/src/0000755000175000017500000000000011351411166016746 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/src/main/0000755000175000017500000000000011351411166017672 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/src/main/java/0000755000175000017500000000000011351411166020613 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/src/main/java/org/0000755000175000017500000000000011351411166021402 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/src/main/java/org/mule/0000755000175000017500000000000011351411166022344 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/src/main/java/org/mule/example/0000755000175000017500000000000011351411166023777 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/src/main/java/org/mule/example/hello/0000755000175000017500000000000011351411166025102 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/src/main/java/org/mule/example/hello/NameStringToChatString.java0000644000175000017500000000311410754375733032324 0ustar charlescharles/* * $Id: NameStringToChatString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import org.mule.transformers.AbstractTransformer; import org.mule.umo.transformer.TransformerException; /** * NameStringToChatString cnverts from a NameString object to a * ChatString object * * @author Ross Mason * @version $Revision: 10789 $ */ public class NameStringToChatString extends AbstractTransformer { /** * Serial version */ private static final long serialVersionUID = 6223698853238962982L; public NameStringToChatString() { super(); this.registerSourceType(NameString.class); } /* * (non-Javadoc) * * @see org.mule.transformers.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { ChatString string = new ChatString(); NameString ns = (NameString)src; string.append(ns.getGreeting()); String name = ns.getName(); // strip out the new line from the console name = name.replaceAll("\n", ""); string.append(name); return string; } } mule-2.0.1/examples/hello-osgi/src/main/java/org/mule/example/hello/Greeter.java0000644000175000017500000000136710754375733027370 0ustar charlescharles/* * $Id: Greeter.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; /** * Greeter TODO (document class) * * @author Ross Mason * @version $Revision: 10789 $ */ public class Greeter { String greeting = "Hello "; public void greet(NameString person) { person.setGreeting(greeting); } } mule-2.0.1/examples/hello-osgi/src/main/java/org/mule/example/hello/ChatString.java0000644000175000017500000000342010754375733030031 0ustar charlescharles/* * $Id: ChatString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import java.io.Serializable; /** * ChatString TODO (document class) * * @author Ross Mason * @version $Revision: 10789 $ */ public class ChatString implements Serializable { /** * Serial version */ private static final long serialVersionUID = -3140370545357738491L; private StringBuffer string = new StringBuffer(); /** * @param str * @return */ public StringBuffer append(String str) { return string.append(str); } /** * @param sb * @return */ public StringBuffer append(StringBuffer sb) { return string.append(sb); } /** * @param offset * @param str * @return */ public StringBuffer insert(int offset, char[] str) { return string.insert(offset, str); } /** * @param index * @param str * @param offset * @param len * @return */ public StringBuffer insert(int index, char[] str, int offset, int len) { return string.insert(index, str, offset, len); } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ public String toString() { return string.toString(); } public int getSize() { return string.length(); } } mule-2.0.1/examples/hello-osgi/src/main/java/org/mule/example/hello/NameString.java0000644000175000017500000000265210754375733030040 0ustar charlescharles/* * $Id: NameString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import java.io.Serializable; /** * NameString TODO (document class) * * @author Ross Mason * @version $Revision: 10789 $ */ public class NameString implements Serializable { /** * Serial version */ private static final long serialVersionUID = 7010138636008560022L; private String name; private String greeting; public NameString(String name) { this.name = name; } /** * @return Returns the name. */ public String getName() { return name; } /** * @param name The name to set. */ public void setName(String name) { this.name = name; } /** * @return Returns the greeting. */ public String getGreeting() { return greeting; } /** * @param greeting The greeting to set. */ public void setGreeting(String greeting) { this.greeting = greeting; } } mule-2.0.1/examples/hello-osgi/src/main/java/org/mule/example/hello/StringToNameString.java0000644000175000017500000000266410754375733031535 0ustar charlescharles/* * $Id: StringToNameString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import org.mule.transformers.AbstractTransformer; import org.mule.umo.transformer.TransformerException; /** * StringToNameString converts from a String to a NameString object * * @author Ross Mason * @version $Revision: 10789 $ */ public class StringToNameString extends AbstractTransformer { /** * Serial version */ private static final long serialVersionUID = -408128452488674866L; public StringToNameString() { super(); this.registerSourceType(String.class); } /* * (non-Javadoc) * * @see org.mule.transformers.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { String name = (String)src; int i = name.indexOf("\r"); if (i > -1) { name = name.substring(0, i); } return new NameString(name); } } mule-2.0.1/examples/hello-osgi/src/main/java/org/mule/example/hello/ChitChatter.java0000644000175000017500000000140510754375733030166 0ustar charlescharles/* * $Id: ChitChatter.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; /** * ChitChatter TODO (document class) * * @author Ross Mason * @version $Revision: 10789 $ */ public class ChitChatter { String chitchat = ", How are you?"; public void chat(ChatString string) { string.append(chitchat); } } mule-2.0.1/examples/hello-osgi/src/main/java/org/mule/example/hello/ChatStringToString.java0000644000175000017500000000261410754375733031527 0ustar charlescharles/* * $Id: ChatStringToString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import org.mule.transformers.AbstractTransformer; import org.mule.umo.transformer.TransformerException; /** * NameStringToChatString is a dummy transform used in the hello world * application to transform the ChatString object into a string * * @author Ross Mason * @version $Revision: 10789 $ */ public class ChatStringToString extends AbstractTransformer { /** * Serial version */ private static final long serialVersionUID = 8633726064696217003L; public ChatStringToString() { super(); this.registerSourceType(ChatString.class); } /* * (non-Javadoc) * * @see org.mule.transformers.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { ChatString string = (ChatString)src; return string.toString(); } } mule-2.0.1/examples/hello-osgi/src/main/java/org/mule/example/hello/HttpRequestToString.java0000644000175000017500000000450010754375733031745 0ustar charlescharles/* * $Id: HttpRequestToString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import java.io.UnsupportedEncodingException; import org.mule.config.i18n.Message; import org.mule.transformers.AbstractTransformer; import org.mule.umo.transformer.TransformerException; /** * NameStringToChatString This is test class only for use with the * Hello world test application. * * @author Ross Mason * @version $Revision: 10789 $ */ public class HttpRequestToString extends AbstractTransformer { /** * Serial version */ private static final long serialVersionUID = -6438813035354275131L; public HttpRequestToString() { super(); this.registerSourceType(String.class); this.registerSourceType(byte[].class); } /* * (non-Javadoc) * * @see org.mule.transformers.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { String param = null; if (src instanceof byte[]) { if (encoding != null) { try { param = new String((byte[])src, encoding); } catch (UnsupportedEncodingException ex) { param = new String((byte[])src); } } else { param = new String((byte[])src); } } else { param = src.toString(); } int equals = param.indexOf("="); if (equals > -1) { return param.substring(equals + 1); } else { throw new TransformerException(Message.createStaticMessage("Failed to parse param string: " + param), this); } } } mule-2.0.1/examples/hello-osgi/src/main/resources/0000755000175000017500000000000011351411166021704 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/src/main/resources/META-INF/0000755000175000017500000000000011351411166023044 5ustar charlescharlesmule-2.0.1/examples/hello-osgi/src/main/resources/META-INF/MANIFEST.MF0000644000175000017500000000021110553776311024501 0ustar charlescharlesBundle-SymbolicName: org.mule.example.hello Spring-Context: hello-spring-config.xml org-springframework-context: hello-spring-config.xml mule-2.0.1/examples/hello-osgi/pom.xml0000644000175000017500000000415711006063605017501 0ustar charlescharles 4.0.0 org.mule.examples mule-examples 2.0.1 mule-example-hello-osgi bundle Hello Example OSGi Packages the Hello example as OSGi bundles org.apache.felix maven-bundle-plugin hello-spring-config.xml org.mule.config, org.mule.config.i18n, org.mule.impl, org.mule.impl.endpoint, org.mule.module.osgi, org.mule.providers.file, org.mule.providers.http, org.mule.providers.http.transformers, org.mule.providers.service, org.mule.transformers, org.mule.transformers.simple, org.mule.umo.transformer org.mule.example.hello.* mule-2.0.1/examples/hello/0000755000175000017500000000000011351411167015221 5ustar charlescharlesmule-2.0.1/examples/hello/conf/0000755000175000017500000000000011351411167016146 5ustar charlescharlesmule-2.0.1/examples/hello/conf/hello-http-config.xml0000644000175000017500000001457510754375733022245 0ustar charlescharles This configuration is identical to the other Hello World example, except that instead of using the console for I/O, other methods are used. The example demonstrates how easy it is to swap out different transports while never affecting the application. mule-2.0.1/examples/hello/conf/hello-config.xml0000644000175000017500000001440010772265663021253 0ustar charlescharles The hello sample application has two components - 1. The Greeter component that adds a greeting to the event it receives 2. The ChitChater component that adds some additional conversation to the event it receives An event is triggered by input through the system console and the outbound event is aslo written out through the system console. This configuration also demonstrates user and system error handling. User error handling returns an error message to the end user. System error handling logs errors. mule-2.0.1/examples/hello/dist/0000755000175000017500000000000011351411167016164 5ustar charlescharlesmule-2.0.1/examples/hello/dist/hello0000644000175000017500000000210510670313576017220 0ustar charlescharles#! /bin/sh # There is no need to call this if you set the MULE_HOME in your environment # but you must also define MULE_LIB for the example (see below) # or specify the config as a file: URI (see README.txt) if [ -z "$MULE_HOME" ] ; then # find the name of the real MULE_HOME which is two levels up MULE_HOME=`pwd` MULE_HOME=`dirname "$MULE_HOME"` MULE_HOME=`dirname "$MULE_HOME"` export MULE_HOME fi # If MULE_BASE is not set, make it MULE_HOME if [ -z "$MULE_BASE" ] ; then MULE_BASE="$MULE_HOME" export MULE_BASE fi # This extends the classpath to include the configuration directory # Any changes to the files in ./conf will take precedence over those deployed to $MULE_HOME/lib/user MULE_LIB=./conf export MULE_LIB echo "The Hello example is available in two variations:" echo " 1. Simple Configuration" echo " 2. Receive events via HTTP" echo "Select the one you wish to execute and press Enter..." read i if [ 1 = $i ] then exec "$MULE_BASE/bin/mule" -config hello-config.xml elif [ 2 = $i ] then exec "$MULE_BASE/bin/mule" -config hello-http-config.xml fi mule-2.0.1/examples/hello/dist/build.xml0000644000175000017500000000725510672263414020023 0ustar charlescharles mule-2.0.1/examples/hello/dist/README.txt0000644000175000017500000000352710747504633017702 0ustar charlescharles+---------------------+ | Hello World Example | +---------------------+ This example uses two components to create a hello world message. When the example starts it prompts the user at the console to type in their name, the user's name is then passed to the first component which adds something to the string before passes on to the second component that also adds some text before outputting the results back to the console. For more information, refer to http://www.muledocs.org/Examples +---------------------+ | Running the example | +---------------------+ Simply use the shell script (Unix/Linux) or batch file (Windows) provided in this directory to run the example. Alternatively, if you have added Mule to your executable path as recommended in INSTALL.txt, you can run the example from the command line as follows: Linux / Unix ------------ mule -config file:conf/hello-config.xml mule -config file:conf/hello-http-config.xml or export MULE_LIB=./conf mule -config hello-config.xml mule -config hello-http-config.xml Windows ------- mule.bat -config file:conf/hello-config.xml mule.bat -config file:conf/hello-http-config.xml or SET MULE_LIB=.\conf mule.bat -config hello-config.xml mule.bat -config hello-http-config.xml To invoke the hello component over http, hit the following URL http://localhost:8888/?name=Ross +----------------------+ | Building the example | +----------------------+ First, make sure you have set the MULE_HOME environment variable as recommended in INSTALL.txt Depending on the build tool you are using (Ant or Maven), you can build the example by simply running "ant" or "mvn". This will compile the example classes, produce a jar file, and copy everything to $MULE_HOME/lib/user, which is where your custom classes and configuration files should go. mule-2.0.1/examples/hello/dist/pom.xml0000644000175000017500000001215211006063605017477 0ustar charlescharles 4.0.0 org.mule.examples mule-example-hello 1.0 Hello Example Shows how to configure multiple components to interact on a single request and how to manage event transformations. 2.0.1 org.mule mule-core ${muleVersion} org.mule.modules mule-module-spring-config ${muleVersion} org.mule.modules mule-module-spring-extras ${muleVersion} org.mule.transports mule-transport-stdio ${muleVersion} org.mule.transports mule-transport-http ${muleVersion} org.mule.transports mule-transport-vm ${muleVersion} org.mule mule-core ${muleVersion} test test-jar codehaus Codehaus Maven 2.x Release Repository http://repository.codehaus.org false codehaus-snapshots Codehaus Maven 2.x Snapshots Repository http://snapshots.repository.codehaus.org true false apache-plugin-snapshots Apache Maven Plugins Snapshot Repository http://people.apache.org/maven-snapshot-repository true false install ${artifactId} conf src/main/resources org.apache.maven.plugins maven-dependency-plugin copy-artifact install copy ${MULE_HOME}/lib/user true true ${groupId} ${artifactId} ${version} ${artifactId}.jar mule-2.0.1/examples/hello/dist/hello.bat0000644000175000017500000000155010711636636017771 0ustar charlescharles@echo off setlocal REM There is no need to call this if you set the MULE_HOME in your environment properties REM but you must also define MULE_LIB for the example (see below) REM or specify the config as a file: URI (see README.txt) if "%MULE_HOME%" == "" SET MULE_HOME=%~dp0..\.. if "%MULE_BASE%" == "" SET MULE_BASE=%MULE_HOME% REM This extends the classpath to include the configuration directory REM Any changes to the files in .\conf will take precedence over those deployed to %MULE_HOME%\lib\user SET MULE_LIB=.\conf ECHO The Hello example is available in two variations: ECHO 1. Simple Configuration ECHO 2. Receive events via HTTP SET /P Choice=Select the one you wish to execute and press Enter... IF '%Choice%'=='1' call "%MULE_BASE%\bin\mule.bat" -config hello-config.xml IF '%Choice%'=='2' call "%MULE_BASE%\bin\mule.bat" -config hello-http-config.xml mule-2.0.1/examples/hello/src/0000755000175000017500000000000011351411167016010 5ustar charlescharlesmule-2.0.1/examples/hello/src/main/0000755000175000017500000000000011351411167016734 5ustar charlescharlesmule-2.0.1/examples/hello/src/main/java/0000755000175000017500000000000011351411167017655 5ustar charlescharlesmule-2.0.1/examples/hello/src/main/java/org/0000755000175000017500000000000011351411167020444 5ustar charlescharlesmule-2.0.1/examples/hello/src/main/java/org/mule/0000755000175000017500000000000011351411167021406 5ustar charlescharlesmule-2.0.1/examples/hello/src/main/java/org/mule/example/0000755000175000017500000000000011351411167023041 5ustar charlescharlesmule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/0000755000175000017500000000000011351411167024144 5ustar charlescharlesmule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/NameStringToChatString.java0000644000175000017500000000252510754375733031372 0ustar charlescharles/* * $Id: NameStringToChatString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; /** * NameStringToChatString converts from a NameString object to a * ChatString object. */ public class NameStringToChatString extends AbstractTransformer { public NameStringToChatString() { super(); this.registerSourceType(NameString.class); this.setReturnClass(ChatString.class); } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { ChatString chatString = new ChatString(); NameString nameString = (NameString) src; chatString.append(nameString.getGreeting()); chatString.append(nameString.getName()); return chatString; } } mule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/Greeter.java0000644000175000017500000000222010754375733026416 0ustar charlescharles/* * $Id: Greeter.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; /** * Greeter expects a valid NameString object. If invalid, * an exception is created and returned. The outbound router will filter exceptions * as user errors and return the messages to the original requester accordingly. */ public class Greeter { private String greeting = ""; public Greeter() { greeting = LocaleMessage.getGreetingPart1(); } public Object greet(NameString person) { Object payload = person; if (person.isValid()) { person.setGreeting(greeting); } else { payload = new Exception(LocaleMessage.getInvalidUserNameError()); } return payload; } } mule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/HttpRequestToNameString.java0000644000175000017500000000756410765525116031616 0ustar charlescharles/* * $Id: HttpRequestToNameString.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import org.mule.util.IOUtils; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; public class HttpRequestToNameString extends AbstractTransformer { private static final String NAME_REQUEST_PARAMETER = "name="; public HttpRequestToNameString() { super(); this.registerSourceType(String.class); this.registerSourceType(byte[].class); this.registerSourceType(InputStream.class); this.setReturnClass(NameString.class); } public Object doTransform(Object src, String encoding) throws TransformerException { return new NameString(extractNameValue(extractRequestQuery(convertRequestToString(src, encoding)))); } private String convertRequestToString(Object src, String encoding) { String srcAsString = null; if (src instanceof byte[]) { if (encoding != null) { try { srcAsString = new String((byte[])src, encoding); } catch (UnsupportedEncodingException ex) { srcAsString = new String((byte[])src); } } else { srcAsString = new String((byte[])src); } } else if (src instanceof InputStream) { InputStream input = (InputStream) src; try { srcAsString = IOUtils.toString(input); } finally { IOUtils.closeQuietly(input); } } else { srcAsString = src.toString(); } return srcAsString; } private String extractRequestQuery(String request) { String requestQuery = null; if (request != null && request.length() > 0 && request.indexOf('?') != -1) { requestQuery = request.substring(request.indexOf('?') + 1).trim(); } return requestQuery; } private String extractNameValue(String requestQuery) throws TransformerException { String nameValue = null; if (requestQuery != null && requestQuery.length() > 0) { int nameParameterPos = requestQuery.indexOf(NAME_REQUEST_PARAMETER); if (nameParameterPos != -1) { int nextParameterValuePos = requestQuery.indexOf('&'); if (nextParameterValuePos == -1 || nextParameterValuePos < nameParameterPos) { nextParameterValuePos = requestQuery.length(); } nameValue = requestQuery.substring(nameParameterPos + NAME_REQUEST_PARAMETER.length(), nextParameterValuePos); } if (nameValue != null && nameValue.length() > 0) { try { nameValue = URLDecoder.decode(nameValue, "UTF-8"); } catch (UnsupportedEncodingException uee) { logger.error(uee.getMessage()); } } } if (nameValue == null) { nameValue = ""; } return nameValue; } } mule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/ChatString.java0000644000175000017500000000324610754375733027100 0ustar charlescharles/* * $Id: ChatString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import java.io.Serializable; /** * ChatString TODO (document class) */ public class ChatString implements Serializable { /** * Serial version */ private static final long serialVersionUID = -3140370545357738491L; private StringBuffer string = new StringBuffer(); /** * @param str * @return */ public StringBuffer append(String str) { return string.append(str); } /** * @param sb * @return */ public StringBuffer append(StringBuffer sb) { return string.append(sb); } /** * @param offset * @param str * @return */ public StringBuffer insert(int offset, char[] str) { return string.insert(offset, str); } /** * @param index * @param str * @param offset * @param len * @return */ public StringBuffer insert(int index, char[] str, int offset, int len) { return string.insert(index, str, offset, len); } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ public String toString() { return string.toString(); } public int getSize() { return string.length(); } } mule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/NameString.java0000644000175000017500000000274310754375733027102 0ustar charlescharles/* * $Id: NameString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import java.io.Serializable; /** * NameString TODO (document class) */ public class NameString implements Serializable { /** * Serial version */ private static final long serialVersionUID = 7010138636008560022L; private String name; private String greeting; public NameString() { this.name = null; } public NameString(String name) { this.name = name; } /** * @return Returns the name. */ public String getName() { return name; } /** * @param name The name to set. */ public void setName(String name) { this.name = name; } /** * @return Returns the greeting. */ public String getGreeting() { return greeting; } /** * @param greeting The greeting to set. */ public void setGreeting(String greeting) { this.greeting = greeting; } public boolean isValid() { return name != null && name.length() > 0; } } mule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/StringToNameString.java0000644000175000017500000000217310754375733030571 0ustar charlescharles/* * $Id: StringToNameString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; /** * StringToNameString converts from a String to a NameString object. */ public class StringToNameString extends AbstractTransformer { public StringToNameString() { super(); this.registerSourceType(String.class); this.setReturnClass(NameString.class); } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { return new NameString((String) src); } } mule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/ChitChatter.java0000644000175000017500000000136010754375733027227 0ustar charlescharles/* * $Id: ChitChatter.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; /** * ChitChatter TODO (document class) */ public class ChitChatter { private String chitchat = ""; public ChitChatter() { chitchat = LocaleMessage.getGreetingPart2(); } public void chat(ChatString string) { string.append(chitchat); } } mule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/ChatStringToString.java0000644000175000017500000000235110754375733030566 0ustar charlescharles/* * $Id: ChatStringToString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; /** * NameStringToChatString is a dummy transformer used in the hello world * application to transform the ChatString object into a string. */ public class ChatStringToString extends AbstractTransformer { public ChatStringToString() { super(); this.registerSourceType(ChatString.class); this.setReturnClass(String.class); } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { ChatString chatString = (ChatString)src; return chatString.toString(); } } mule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/ExceptionToString.java0000644000175000017500000000225310754375733030457 0ustar charlescharles/* * $Id: ExceptionToString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; /** * ExceptionToString converts an exception to a String, * returning the exception's getMessage() result. */ public class ExceptionToString extends AbstractTransformer { public ExceptionToString() { super(); this.registerSourceType(Exception.class); this.setReturnClass(String.class); } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { return ((Exception) src).getMessage(); } } mule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/LocaleMessage.java0000644000175000017500000000230510754375733027531 0ustar charlescharles/* * $Id: LocaleMessage.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import org.mule.config.i18n.MessageFactory; /** * LocaleMessage is a convenience interface for retrieving * internationalised strings from resource bundles. The actual work is done by * the MessageFactory in core. */ public class LocaleMessage extends MessageFactory { private static final String BUNDLE_PATH = "messages.hello-example-messages"; public static String getGreetingPart2() { return getString(BUNDLE_PATH, 1); } public static String getGreetingPart1() { return getString(BUNDLE_PATH, 2); } public static String getPrompt() { return getString(BUNDLE_PATH, 3); } public static String getInvalidUserNameError() { return getString(BUNDLE_PATH, 4); } } mule-2.0.1/examples/hello/src/main/java/org/mule/example/hello/StdinToNameString.java0000644000175000017500000000254710754375733030411 0ustar charlescharles/* * $Id: StdinToNameString.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; /** * The transformation removes break-lines and newlines from the string, which * potentially could have been added during a stdin input operation. */ public class StdinToNameString extends AbstractTransformer { public StdinToNameString() { super(); this.registerSourceType(String.class); this.setReturnClass(NameString.class); } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { NameString nameString = new NameString(); String name = (String) src; nameString.setName(name.replaceAll("\r", "").replaceAll("\n", "").trim()); return nameString; } } mule-2.0.1/examples/hello/src/main/resources/0000755000175000017500000000000011351411167020746 5ustar charlescharlesmule-2.0.1/examples/hello/src/main/resources/messages/0000755000175000017500000000000011351411167022555 5ustar charlescharlesmule-2.0.1/examples/hello/src/main/resources/messages/hello-example-messages_fr.properties0000644000175000017500000000020410670313576031727 0ustar charlescharles1=, comment allez-vous? 2=Bonjour 3=Entrez votre nom, s'il vous plat: 4=Please provide a valid name with at least one character! mule-2.0.1/examples/hello/src/main/resources/messages/hello-example-messages_hu.properties0000644000175000017500000000017110670313576031737 0ustar charlescharles1=, hogy van? 2=Szervusz 3=K\u00e9rem, megadja a nev\u00e9t: 4=Please provide a valid name with at least one character!mule-2.0.1/examples/hello/src/main/resources/messages/hello-example-messages.properties0000644000175000017500000000015710670313576031247 0ustar charlescharles1=, how are you? 2=Hello 3=Please enter your name: 4=Please provide a valid name with at least one character!mule-2.0.1/examples/hello/src/main/resources/messages/hello-example-messages_de.properties0000644000175000017500000000022010670313576031706 0ustar charlescharles1=, wie geht es Ihnen? 2=Hallo 3=Bitte geben Sie Ihren Namen ein: 4=Bitte geben Sie einen gueltigen Namen mit mindestens einem Buchstaben ein!mule-2.0.1/examples/hello/src/main/resources/messages/hello-example-messages_uk.properties0000644000175000017500000000047310670313576031747 0ustar charlescharles1=, \u044f\u043a \u0441\u043f\u0440\u0430\u0432\u0438? 2=\u0414\u043e\u0431\u0440\u0438\u0439 \u0434\u0435\u043d\u044c 3=\u0411\u0443\u0434\u044c \u043b\u0430\u0441\u043a\u0430, \u0432\u0432\u0435\u0434i\u0442\u044c \u0412\u0430\u0448\u0435 i\u043c'\u044f: 4=Please provide a valid name with at least one character!mule-2.0.1/examples/hello/src/main/resources/messages/hello-example-messages_ru.properties0000644000175000017500000000051610670313576031754 0ustar charlescharles1=, \u043a\u0430\u043a \u0434\u0435\u043b\u0430? 2=\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435 3=\u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0412\u0430\u0448\u0435 \u0438\u043c\u044f: 4=Please provide a valid name with at least one character!mule-2.0.1/examples/hello/src/main/resources/messages/hello-example-messages_es.properties0000644000175000017500000000016310670313576031733 0ustar charlescharles1=, cmo le va? 2=Hola 3=Ingrese su nombre, por favor: 4=Please provide a valid name with at least one character!mule-2.0.1/examples/hello/src/test/0000755000175000017500000000000011351411167016767 5ustar charlescharlesmule-2.0.1/examples/hello/src/test/java/0000755000175000017500000000000011351411167017710 5ustar charlescharlesmule-2.0.1/examples/hello/src/test/java/org/0000755000175000017500000000000011351411167020477 5ustar charlescharlesmule-2.0.1/examples/hello/src/test/java/org/mule/0000755000175000017500000000000011351411167021441 5ustar charlescharlesmule-2.0.1/examples/hello/src/test/java/org/mule/example/0000755000175000017500000000000011351411167023074 5ustar charlescharlesmule-2.0.1/examples/hello/src/test/java/org/mule/example/hello/0000755000175000017500000000000011351411167024177 5ustar charlescharlesmule-2.0.1/examples/hello/src/test/java/org/mule/example/hello/HelloSampleTestCase.java0000644000175000017500000001143710765525116030721 0ustar charlescharles/* * $Id: HelloSampleTestCase.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.hello; import org.mule.tck.AbstractMuleTestCase; import java.io.ByteArrayInputStream; import java.io.InputStream; public class HelloSampleTestCase extends AbstractMuleTestCase { public void testGreeter() { NameString name = new NameString("Fred"); assertNotNull(name.getName()); assertNull(name.getGreeting()); name.setName("Another Fred"); Greeter greeter = new Greeter(); greeter.greet(name); assertNotNull(name.getGreeting()); } public void testChitChatter() { NameString name = new NameString("Barney"); assertNotNull(name.getName()); assertNull(name.getGreeting()); ChatString chat = new ChatString(); assertTrue(chat.getSize() == 0); ChitChatter chitChatter = new ChitChatter(); chitChatter.chat(chat); assertTrue(chat.getSize() > 0); int size = chat.getSize(); chat.append("Blah"); chat.append(new StringBuffer("Blah")); assertTrue(chat.toString().endsWith("BlahBlah")); chat.insert(0, "Blah".toCharArray(), 0, 2); chat.insert(2, "Blah".toCharArray()); assertTrue(chat.toString().startsWith("BlBlah")); assertEquals(size + 4 + 4 + 2 + 4, chat.getSize()); } public void testStringToNameTransformer() throws Exception { String temp = "Wilma"; StringToNameString trans = new StringToNameString(); Object result = trans.transform(temp); assertNotNull(result); assertTrue(result instanceof NameString); NameString name = (NameString)result; assertNotNull(name.getName()); assertNull(name.getGreeting()); result = trans.transform("Another Wilma"); assertNotNull(result); assertTrue(result instanceof NameString); name = (NameString)result; assertNotNull(name.getName()); assertEquals("Another Wilma", name.getName()); } public void testHttpRequestToNameTransformer() throws Exception { String temp = "whateverUrl?name=Wilma"; HttpRequestToNameString trans = new HttpRequestToNameString(); Object result = trans.transform(temp); assertNotNull(result); assertTrue(result instanceof NameString); NameString name = (NameString)result; assertNotNull(name.getName()); assertNull(name.getGreeting()); result = trans.transform("whateverUrl?street=Sonnenstrasse&name=Another%20Wilma"); assertNotNull(result); assertTrue(result instanceof NameString); name = (NameString)result; assertNotNull(name.getName()); assertEquals("Another Wilma", name.getName()); } public void testHttpRequestToNameStreamingTransformer() throws Exception { InputStream in = new ByteArrayInputStream("whateverUrl?name=Wilma".getBytes()); HttpRequestToNameString transformer = new HttpRequestToNameString(); Object result = transformer.transform(in); assertNotNull(result); assertTrue(result instanceof NameString); NameString name = (NameString)result; assertNotNull(name.getName()); assertNull(name.getGreeting()); } public void testStdinToNameTransformer() throws Exception { String temp = "Wilma"; StdinToNameString trans = new StdinToNameString(); Object result = trans.transform(temp); assertNotNull(result); assertTrue(result instanceof NameString); NameString name = (NameString)result; assertNotNull(name.getName()); assertNull(name.getGreeting()); result = trans.transform("Another Wilma\r\n"); assertNotNull(result); assertTrue(result instanceof NameString); name = (NameString)result; assertNotNull(name.getName()); assertEquals("Another Wilma", name.getName()); } public void testNameToChatTransformer() throws Exception { NameString temp = new NameString("the other one"); NameStringToChatString trans = new NameStringToChatString(); trans.setReturnClass(ChatString.class); Object result = trans.transform(temp); assertNotNull(result); assertTrue(result instanceof ChatString); ChatString chat = (ChatString)result; assertTrue(chat.getSize() > 0); } } mule-2.0.1/examples/hello/src/test/resources/0000755000175000017500000000000011351411167021001 5ustar charlescharlesmule-2.0.1/examples/hello/src/test/resources/log4j.properties0000644000175000017500000000050210766201313024132 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/examples/hello/pom.xml0000644000175000017500000000405611006063605016540 0ustar charlescharles 4.0.0 org.mule.examples mule-examples 2.0.1 mule-example-hello Hello Example Shows how to configure multiple components to interact on a single request and how to manage event transformations. conf src/main/resources org.mule.modules mule-module-spring-extras ${version} org.mule.transports mule-transport-stdio ${version} org.mule.transports mule-transport-http ${version} org.mule.transports mule-transport-vm ${version} org.mule mule-core ${version} test test-jar mule-2.0.1/examples/echo/0000755000175000017500000000000011351411170015026 5ustar charlescharlesmule-2.0.1/examples/echo/conf/0000755000175000017500000000000011351411170015753 5ustar charlescharlesmule-2.0.1/examples/echo/conf/echo-cxf-config.xml0000644000175000017500000000325010766463006021452 0ustar charlescharles This config builds a JAX-WS service with CXF. We use a "serviceClass" which is a JAX-WS interface we've defined. It allows us To invoke the EchoUMO hit the following URL - http://localhost:65081/services/EchoUMO?method=echo&param=Is there an echo? (remember to replace the '&' with an ampersand) To view the WSDL for the EchoUMO service go to - http://localhost:65081/services/EchoUMO?wsdl mule-2.0.1/examples/echo/conf/echo-config.xml0000644000175000017500000000545510765212524020701 0ustar charlescharles This is a simple component example that demostrates how to expose a component over multiple transports. mule-2.0.1/examples/echo/conf/echo-axis-config.xml0000644000175000017500000000341210765212524021632 0ustar charlescharles This config is identical to echo-config.xml but exposes the EchoUMO as a SOAP web service. To invoke the EchoUMO hit the following URL - http://localhost:65081/services/EchoUMO?method=echo&param=Is there an echo? (remember to replace the '&' with an ampersand) To view the WSDL for the EchoUMO service go to - http://localhost:65081/services/EchoUMO?wsdl mule-2.0.1/examples/echo/dist/0000755000175000017500000000000011351411170015771 5ustar charlescharlesmule-2.0.1/examples/echo/dist/echo0000755000175000017500000000142610670313576016656 0ustar charlescharles#! /bin/sh # There is no need to call this if you set the MULE_HOME in your environment # but you must also define MULE_LIB for the example (see below) # or specify the config as a file: URI (see README.txt) if [ -z "$MULE_HOME" ] ; then # find the name of the real MULE_HOME which is two levels up MULE_HOME=`pwd` MULE_HOME=`dirname "$MULE_HOME"` MULE_HOME=`dirname "$MULE_HOME"` export MULE_HOME fi # If MULE_BASE is not set, make it MULE_HOME if [ -z "$MULE_BASE" ] ; then MULE_BASE="$MULE_HOME" export MULE_BASE fi # This extends the classpath to include the configuration directory # Any changes to the files in ./conf will take precedence over those deployed to $MULE_HOME/lib/user MULE_LIB=./conf export MULE_LIB exec "$MULE_BASE/bin/mule" -config echo-config.xml mule-2.0.1/examples/echo/dist/echo.bat0000644000175000017500000000112310711636636017413 0ustar charlescharles@echo off setlocal REM There is no need to call this if you set the MULE_HOME in your environment properties REM but you must also define MULE_LIB for the example (see below) REM or specify the config as a file: URI (see README.txt) if "%MULE_HOME%" == "" SET MULE_HOME=%~dp0..\.. if "%MULE_BASE%" == "" SET MULE_BASE=%MULE_HOME% REM This extends the classpath to include the configuration directory REM Any changes to the files in .\conf will take precedence over those deployed to %MULE_HOME%\lib\user SET MULE_LIB=.\conf call "%MULE_BASE%\bin\mule.bat" -config echo-config.xml mule-2.0.1/examples/echo/dist/build.xml0000644000175000017500000000526410672263414017634 0ustar charlescharles mule-2.0.1/examples/echo/dist/README.txt0000644000175000017500000000205610747504633017511 0ustar charlescharles+--------------+ | Echo Example | +--------------+ This example demonstrates how to expose a Mule component over multiple transports, in this case as an Axis web sevice and via System.in (request) and System.out (response). For more information, refer to http://www.muledocs.org/Examples +---------------------+ | Running the example | +---------------------+ Simply use the shell script (Unix/Linux) or batch file (Windows) provided in this directory to run the example. Alternatively, if you have added Mule to your executable path as recommended in INSTALL.txt, you can run the example from the command line as follows: Linux / Unix ------------ mule -config file:conf/echo-config.xml or export MULE_LIB=./conf mule -config echo-config.xml Windows ------- mule.bat -config file:conf/echo-config.xml or SET MULE_LIB=.\conf mule.bat -config echo-config.xml +----------------------+ | Building the example | +----------------------+ This example has no custom classes so there's not much point in building it. mule-2.0.1/examples/echo/dist/pom.xml0000644000175000017500000001207411006063605017315 0ustar charlescharles 4.0.0 org.mule.examples mule-example-echo 1.0 Echo Example Is a simple component example that demostrates how to expose a component over multiple transports (soap and stream). 2.0.1 org.mule.transports mule-transport-vm ${muleVersion} org.mule.transports mule-transport-axis ${muleVersion} org.mule.transports mule-transport-cxf ${muleVersion} xmlunit xmlunit 1.1 test org.mule.tests mule-tests-functional ${muleVersion} test codehaus Codehaus Maven 2.x Release Repository http://repository.codehaus.org false codehaus-snapshots Codehaus Maven 2.x Snapshots Repository http://snapshots.repository.codehaus.org true false java.net Java.net Repository http://download.java.net/maven/1/ legacy apache-plugin-snapshots Apache Maven Plugins Snapshot Repository http://people.apache.org/maven-snapshot-repository true false install ${artifactId} conf src/main/resources org.apache.maven.plugins maven-dependency-plugin copy-artifact install copy ${MULE_HOME}/lib/user true true ${groupId} ${artifactId} ${version} ${artifactId}.jar mule-2.0.1/examples/echo/src/0000755000175000017500000000000011351411170015615 5ustar charlescharlesmule-2.0.1/examples/echo/src/test/0000755000175000017500000000000011351411170016574 5ustar charlescharlesmule-2.0.1/examples/echo/src/test/java/0000755000175000017500000000000011351411170017515 5ustar charlescharlesmule-2.0.1/examples/echo/src/test/java/org/0000755000175000017500000000000011351411170020304 5ustar charlescharlesmule-2.0.1/examples/echo/src/test/java/org/mule/0000755000175000017500000000000011351411170021246 5ustar charlescharlesmule-2.0.1/examples/echo/src/test/java/org/mule/example/0000755000175000017500000000000011351411170022701 5ustar charlescharlesmule-2.0.1/examples/echo/src/test/java/org/mule/example/echo/0000755000175000017500000000000011351411170023617 5ustar charlescharlesmule-2.0.1/examples/echo/src/test/java/org/mule/example/echo/AbstractEchoTestCase.java0000644000175000017500000000601210777664077030512 0ustar charlescharles/* * $Id: AbstractEchoTestCase.java 11569 2008-04-11 13:31:43Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.echo; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.NullPayload; import org.mule.util.IOUtils; import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.custommonkey.xmlunit.XMLAssert; /** * Tests the Echo example using a SOAP transport. */ public abstract class AbstractEchoTestCase extends FunctionalTestCase { protected String expectedGetResponse; protected String expectedPostResponse; protected void doSetUp() throws Exception { try { expectedGetResponse = IOUtils.getResourceAsString(getExpectedGetResponseResource(), this.getClass()); expectedPostResponse = IOUtils.getResourceAsString(getExpectedPostResponseResource(), this.getClass()); } catch (IOException ioex) { fail(ioex.getMessage()); } } protected abstract String getExpectedGetResponseResource(); protected abstract String getExpectedPostResponseResource(); protected abstract String getProtocol(); public void testPostEcho() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send("http://localhost:65081/services/EchoUMO?method=echo", "hello", null); assertNotNull(result); assertNull(result.getExceptionPayload()); assertFalse(result.getPayload() instanceof NullPayload); XMLAssert.assertXMLEqual(expectedPostResponse, result.getPayloadAsString()); } public void testGetEcho() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); props.put("http.method", "GET"); MuleMessage result = client.send("http://localhost:65081/services/EchoUMO?method=echo", "hello", props); assertNotNull(result); assertFalse(result.getPayload() instanceof NullPayload); System.out.println("GOT " + result.getPayloadAsString()); XMLAssert.assertXMLEqual(expectedGetResponse, result.getPayloadAsString()); } public void testSoapPostEcho() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send( getProtocol() + ":http://localhost:65082/services/EchoUMO?method=echo", "hello", null); assertNotNull(result); assertNull(result.getExceptionPayload()); assertFalse(result.getPayload() instanceof NullPayload); assertEquals("hello", result.getPayload()); } } mule-2.0.1/examples/echo/src/test/java/org/mule/example/echo/CxfEchoTestCase.java0000644000175000017500000000365010777664077027474 0ustar charlescharles/* * $Id: CxfEchoTestCase.java 11569 2008-04-11 13:31:43Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.echo; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.transport.NullPayload; import java.util.HashMap; import java.util.Map; import org.custommonkey.xmlunit.XMLAssert; /** * Tests the echo example using CXF. */ public class CxfEchoTestCase extends AbstractEchoTestCase { public void testGetEcho() throws Exception { // CXF has built in support for understanding GET requests. They are of the form: // http://host/service/OPERATION/PARAM_NAME/PARAM_VALUE MuleClient client = new MuleClient(); Map props = new HashMap(); props.put("http.method", "GET"); MuleMessage result = client.send("http://localhost:65082/services/EchoUMO/echo/text/hello", "", props); assertNotNull(result); assertFalse(result.getPayload() instanceof NullPayload); XMLAssert.assertXMLEqual(expectedGetResponse, result.getPayloadAsString()); } public void testPostEcho() throws Exception { // This test doesn't apply to CXF, so we're making it empty. } protected String getConfigResources() { return "echo-cxf-config.xml"; } protected String getExpectedGetResponseResource() { return "echo-cxf-response.xml"; } protected String getExpectedPostResponseResource() { return "echo-cxf-response.xml"; } protected String getProtocol() { return "cxf"; } } mule-2.0.1/examples/echo/src/test/java/org/mule/example/echo/AxisEchoTestCase.java0000644000175000017500000000167710765212645027652 0ustar charlescharles/* * $Id: AxisEchoTestCase.java 11303 2008-03-10 11:04:05Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.echo; /** * Tests the Echo example using Axis. */ public class AxisEchoTestCase extends AbstractEchoTestCase { protected String getExpectedGetResponseResource() { return "echo-axis-get-response.xml"; } protected String getExpectedPostResponseResource() { return "echo-axis-post-response.xml"; } protected String getConfigResources() { return "echo-axis-config.xml"; } protected String getProtocol() { return "axis"; } } mule-2.0.1/examples/echo/src/test/java/org/mule/example/echo/Echo.java0000755000175000017500000000123010766463006025355 0ustar charlescharles/* * $Id: Echo.java 11366 2008-03-14 11:48:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.echo; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; @WebService public interface Echo { @WebResult(name="text") public String echo(@WebParam(name="text") String string); } mule-2.0.1/examples/echo/src/test/resources/0000755000175000017500000000000011351411170020606 5ustar charlescharlesmule-2.0.1/examples/echo/src/test/resources/echo-cxf-response.xml0000644000175000017500000000031610766272451024700 0ustar charlescharleshellomule-2.0.1/examples/echo/src/test/resources/log4j.properties0000644000175000017500000000050210765212435023753 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=INFO mule-2.0.1/examples/echo/src/test/resources/echo-axis-post-response.xml0000644000175000017500000000071210513231523026030 0ustar charlescharles hello mule-2.0.1/examples/echo/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000152410766463006025500 0ustar charlescharles# java.lang.ClassCastException: org.codehaus.xfire.aegis.type.java5.DurationType # at org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.registerIfAvailable(DefaultTypeMappingRegistry.java:415) # at org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.createDefaultMappings(DefaultTypeMappingRegistry.java:388) # at org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.createDefaultMappings(DefaultTypeMappingRegistry.java:287) # at org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.(DefaultTypeMappingRegistry.java:151) # at org.apache.cxf.aegis.type.DefaultTypeMappingRegistry.(DefaultTypeMappingRegistry.java:142) # at org.apache.cxf.aegis.databinding.AegisDatabinding.(AegisDatabinding.java:98) # at org.mule.transport.cxf.CxfMessageReceiver.doInitialise(CxfMessageReceiver.java:103) # org.mule.example.echo.CxfEchoTestCase mule-2.0.1/examples/echo/src/test/resources/echo-axis-get-response.xml0000644000175000017500000000063210513231523025623 0ustar charlescharles hello mule-2.0.1/examples/echo/pom.xml0000644000175000017500000000505611006063605016354 0ustar charlescharles 4.0.0 org.mule.examples mule-examples 2.0.1 mule-example-echo Echo Example Is a simple component example that demostrates how to expose a component over multiple transports (soap and stream). conf src/main/resources org.apache.maven.plugins maven-jar-plugin test-jar org.mule.transports mule-transport-vm ${version} test org.mule.transports mule-transport-cxf ${version} test org.mule.transports mule-transport-axis ${version} test xmlunit xmlunit 1.1 test org.mule.tests mule-tests-functional ${version} test mule-2.0.1/examples/all-examples/0000755000175000017500000000000011351411167016502 5ustar charlescharlesmule-2.0.1/examples/all-examples/pom.xml0000644000175000017500000000635211006063605020022 0ustar charlescharles 4.0.0 org.mule.examples mule-examples 2.0.1 mule-examples-all All Mule examples pom This module does not publish any content itself, it's just a shorthand for referencing all examples at once. This is needed in the various distributions we package where we either nedd to include or exclude all examples. org.mule.examples mule-example-echo ${version} org.mule.examples mule-example-errorhandler ${version} org.mule.examples mule-example-hello ${version} org.mule.examples mule-example-loanbroker-bpm ${version} org.mule.examples mule-example-loanbroker-common ${version} org.mule.examples mule-example-loanbroker-credit-agency ${version} org.mule.examples mule-example-loanbroker-esb ${version} org.mule.examples mule-example-loanbroker-esn ${version} org.mule.examples mule-example-scripting ${version} org.mule.examples mule-example-stockquote ${version} mule-2.0.1/examples/scripting/0000755000175000017500000000000011351411166016117 5ustar charlescharlesmule-2.0.1/examples/scripting/conf/0000755000175000017500000000000011351411166017044 5ustar charlescharlesmule-2.0.1/examples/scripting/conf/scripting-config.xml0000644000175000017500000000377310766654216023063 0ustar charlescharles This example demonstrates invoking a Groovy script as the service component. def msg = eventContext.transformMessageToString() log.boilerPlate("Message Received: ${msg} - class: ${msg.class.name}") return ["Hello", ":-)"]; mule-2.0.1/examples/scripting/dist/0000755000175000017500000000000011351411166017062 5ustar charlescharlesmule-2.0.1/examples/scripting/dist/build.xml0000644000175000017500000000660210664630335020716 0ustar charlescharles mule-2.0.1/examples/scripting/dist/scripting0000755000175000017500000000143210670313576021023 0ustar charlescharles#! /bin/sh # There is no need to call this if you set the MULE_HOME in your environment # but you must also define MULE_LIB for the example (see below) # or specify the config as a file: URI (see README.txt) if [ -z "$MULE_HOME" ] ; then # find the name of the real MULE_HOME which is two levels up MULE_HOME=`pwd` MULE_HOME=`dirname "$MULE_HOME"` MULE_HOME=`dirname "$MULE_HOME"` export MULE_HOME fi # If MULE_BASE is not set, make it MULE_HOME if [ -z "$MULE_BASE" ] ; then MULE_BASE="$MULE_HOME" export MULE_BASE fi # This extends the classpath to include the configuration directory # Any changes to the files in ./conf will take precedence over those deployed to $MULE_HOME/lib/user MULE_LIB=./conf export MULE_LIB exec "$MULE_BASE/bin/mule" -config scripting-config.xml mule-2.0.1/examples/scripting/dist/README.txt0000644000175000017500000000323110747504633020571 0ustar charlescharles+-------------------+ | Scripting Example | +-------------------+ A simple example that demonstrates Mule's JSR-223 Scripting support. For more information, refer to http://www.muledocs.org/Examples +----------------------+ | Building the example | +----------------------+ First, make sure you have set the MULE_HOME environment variable as recommended in INSTALL.txt Depending on the build tool you are using (Ant or Maven), you can build the example by simply running "ant" or "mvn". This will download any additional libraries, compile the example classes, produce a jar file, and copy everything to $MULE_HOME/lib/user, which is where your custom classes and configuration files should go. (If you are unable to download the libraries it may be because you are behind a firewall and have not configured your build tool to use your HTTP proxy. Please refer to the following information.) Ant users: http://ant.apache.org/manual-beta/proxy.html Maven users: http://maven.apache.org/guides/mini/guide-proxies.html +---------------------+ | Running the example | +---------------------+ Simply use the shell script (Unix/Linux) or batch file (Windows) provided in this directory to run the example. Alternatively, if you have added Mule to your executable path as recommended in INSTALL.txt, you can run the example from the command line as follows: Linux / Unix ------------ mule -config file:conf/scripting-config.xml or export MULE_LIB=./conf mule -config scripting-config.xml Windows ------- mule.bat -config file:conf/scripting-config.xml or SET MULE_LIB=.\conf mule.bat -config scripting-config.xml mule-2.0.1/examples/scripting/dist/pom.xml0000644000175000017500000001222111006063605020373 0ustar charlescharles 4.0.0 org.mule.examples mule-example-scripting 1.0 Scripting Example A simple example that demonstrates Mule's JSR-223 Scripting support. 2.0.1 org.mule mule-core ${muleVersion} org.mule.modules mule-module-scripting ${muleVersion} org.mule.modules mule-module-client ${muleVersion} org.mule.transports mule-transport-stdio ${muleVersion} org.mule.tests mule-tests-functional ${muleVersion} test org.mule.transports mule-transport-vm ${muleVersion} test codehaus Codehaus Maven 2.x Release Repository http://repository.codehaus.org false codehaus-snapshots Codehaus Maven 2.x Snapshots Repository http://snapshots.repository.codehaus.org true false mule Mule Dependencies http://dist.codehaus.org/mule/dependencies/maven2 false apache-plugin-snapshots Apache Maven Plugins Snapshot Repository http://people.apache.org/maven-snapshot-repository true false install ${artifactId} conf src/main/resources org.apache.maven.plugins maven-dependency-plugin copy-artifact install copy ${MULE_HOME}/lib/user true true ${groupId} ${artifactId} ${version} ${artifactId}.jar mule-2.0.1/examples/scripting/dist/scripting.bat0000644000175000017500000000112110711636636021561 0ustar charlescharles@echo off setlocal REM There is no need to call this if you set the MULE_HOME in your environment properties REM but you must also define MULE_LIB for the example (see below) REM or specify the config as a file: URI (see README.txt) if "%MULE_HOME%" == "" SET MULE_HOME=%~dp0..\.. if "%MULE_BASE%" == "" SET MULE_BASE=%MULE_HOME% REM This extends the classpath to include the configuration directory REM Any changes to the files in .\conf will take precedence over those deployed to %MULE_HOME%\lib\user SET MULE_LIB=.\conf :mule call "%MULE_BASE%\bin\mule.bat" -config scripting-config.xml mule-2.0.1/examples/scripting/src/0000755000175000017500000000000011351411166016706 5ustar charlescharlesmule-2.0.1/examples/scripting/src/test/0000755000175000017500000000000011351411166017665 5ustar charlescharlesmule-2.0.1/examples/scripting/src/test/java/0000755000175000017500000000000011351411166020606 5ustar charlescharlesmule-2.0.1/examples/scripting/src/test/java/org/0000755000175000017500000000000011351411166021375 5ustar charlescharlesmule-2.0.1/examples/scripting/src/test/java/org/mule/0000755000175000017500000000000011351411166022337 5ustar charlescharlesmule-2.0.1/examples/scripting/src/test/java/org/mule/example/0000755000175000017500000000000011351411166023772 5ustar charlescharlesmule-2.0.1/examples/scripting/src/test/java/org/mule/example/scripting/0000755000175000017500000000000011351411166025774 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/examples/scripting/src/test/java/org/mule/example/scripting/ScriptingExampleTestCase.javamule-2.0.1/examples/scripting/src/test/java/org/mule/example/scripting/ScriptingExampleTestCase.java0000644000175000017500000000217110754375733033571 0ustar charlescharles/* * $Id: ScriptingExampleTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.scripting; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class ScriptingExampleTestCase extends FunctionalTestCase { protected String getConfigResources() { return "scripting-config.xml"; } public void testScriptingExample() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm://scripting", new DefaultMuleMessage("mule")); assertNotNull(reply); assertNotNull(reply.getPayload()); assertEquals("[Hello, :-)]", reply.getPayloadAsString()); } } mule-2.0.1/examples/scripting/pom.xml0000644000175000017500000000402511006063605017433 0ustar charlescharles 4.0.0 org.mule.examples mule-examples 2.0.1 mule-example-scripting Scripting Example A simple example that demonstrates Mule's JSR-223 Scripting support. conf src/main/resources org.mule.modules mule-module-scripting ${version} org.mule.modules mule-module-client ${version} org.mule.transports mule-transport-stdio ${version} org.mule.tests mule-tests-functional ${version} test org.mule.transports mule-transport-vm ${version} test mule-2.0.1/examples/loanbroker/0000755000175000017500000000000011351411173016251 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/0000755000175000017500000000000011351411171017034 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/conf/0000755000175000017500000000000011351411171017761 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/conf/loan-broker-axis-endpoints-config.xml0000644000175000017500000000546310766272451027153 0ustar charlescharles This loan broker example is modeled on the Enterprise integration Patterns book sample. Here we define components and endpoints using the Axis transport. mule-2.0.1/examples/loanbroker/esn/conf/loan-broker-cxf-endpoints-config.xml0000644000175000017500000000614410766272451026764 0ustar charlescharles This loan broker example is modeled on the Enterprise integration Patterns book sample. Here we define components and endpoints using the CXF transport. mule-2.0.1/examples/loanbroker/esn/conf/loan-broker-vm-endpoints-config.xml0000644000175000017500000000463310754375733026633 0ustar charlescharles This loan broker example is modeled on the Enterprise integration Patterns book sample. Here we define components and endpoints using the VM transport. mule-2.0.1/examples/loanbroker/esn/conf/loan-broker-async-config.xml0000644000175000017500000001454410754375733025327 0ustar charlescharles This loan broker example is modeled on the Enterprise integration Patterns book sample. This implementation differs in that this configuration uses an asynchronous model where each component communicates messaging according to its configuration in this file. mule-2.0.1/examples/loanbroker/esn/conf/loan-broker-sync-config.xml0000644000175000017500000001304010766272451025150 0ustar charlescharles This loan broker example is modeled on the Enterprise integration Patterns book sample. This implementation differs in that this configuration uses a synchronous model where each component is invoked from the LoanBroker component. mule-2.0.1/examples/loanbroker/esn/dist/0000755000175000017500000000000011351411171017777 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/dist/build.xml0000755000175000017500000001017110767607640021645 0ustar charlescharles mule-2.0.1/examples/loanbroker/esn/dist/pom.xml0000644000175000017500000001036010767500237021330 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 1.0 mule-example-loanbroker-esn Loan Broker ESN Example The Loan Broker example application is based on the example presented in the Enterprise Integration Patterns book. This chapter of the book is available online so you can see a detailed description of the application here (http://www.eaipatterns.com/ComposedMessagingWS.html). org.mule.examples mule-example-loanbroker-common ${muleVersion} org.mule.examples mule-example-loanbroker-common-tests ${muleVersion} test org.mule.modules mule-module-spring-config ${muleVersion} org.mule.transports mule-transport-axis ${muleVersion} org.mule.transports mule-transport-cxf ${muleVersion} org.mule.transports mule-transport-vm ${muleVersion} org.apache.maven.plugins maven-surefire-plugin pertest org/mule/examples/loanbroker/esn/AxisLoanBrokerSynchronousFunctionalTestCase.java org/mule/examples/loanbroker/esn/XFireLoanBrokerSynchronousFunctionalTestCase.java org.apache.maven.plugins maven-dependency-plugin copy-artifact install copy ${MULE_HOME}/lib/user true true ${groupId} ${artifactId} ${version} ${artifactId}.jar mule-2.0.1/examples/loanbroker/esn/build.xml0000755000175000017500000001016710767607640020707 0ustar charlescharles mule-2.0.1/examples/loanbroker/esn/src/0000755000175000017500000000000011351411171017623 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/main/0000755000175000017500000000000011351411171020547 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/main/java/0000755000175000017500000000000011351411171021470 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/main/java/org/0000755000175000017500000000000011351411171022257 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/main/java/org/mule/0000755000175000017500000000000011351411171023221 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/main/java/org/mule/example/0000755000175000017500000000000011351411171024654 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/main/java/org/mule/example/loanbroker/0000755000175000017500000000000011351411171027012 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/main/java/org/mule/example/loanbroker/esn/0000755000175000017500000000000011351411171027577 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/examples/loanbroker/esn/src/main/java/org/mule/example/loanbroker/esn/SynchronousLoanBroker.javamule-2.0.1/examples/loanbroker/esn/src/main/java/org/mule/example/loanbroker/esn/SynchronousLoanBrok0000644000175000017500000000402110767505705033522 0ustar charlescharles/* * $Id: SynchronousLoanBroker.java 11394 2008-03-17 15:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esn; import org.mule.example.loanbroker.DefaultLoanBroker; import org.mule.example.loanbroker.LoanBrokerException; import org.mule.example.loanbroker.credit.CreditAgencyService; import org.mule.example.loanbroker.messages.CreditProfile; import org.mule.example.loanbroker.messages.CustomerQuoteRequest; import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest; /** * SyncLoanBroker is a synchronous Loan Broker that makes the calls to * various components through the event context synchronously. */ public class SynchronousLoanBroker extends DefaultLoanBroker { //A proxy for this object gets injected via the element configured on this service. //The proxy will then call out to an endpoint and return the result. //The transformers configured on the endpoint control how data is marshalled into and out of the call. private CreditAgencyService creditAgency; @Override public Object getLoanQuote(CustomerQuoteRequest request) throws LoanBrokerException { super.getLoanQuote(request); LoanBrokerQuoteRequest bqr = new LoanBrokerQuoteRequest(); bqr.setCustomerRequest(request); //This calls out to the CreditAgency service (see above) CreditProfile cp = creditAgency.getCreditProfile(request.getCustomer()); bqr.setCreditProfile(cp); return bqr; } public CreditAgencyService getCreditAgency() { return creditAgency; } public void setCreditAgency(CreditAgencyService creditAgency) { this.creditAgency = creditAgency; } } mule-2.0.1/examples/loanbroker/esn/src/main/java/org/mule/example/loanbroker/esn/LoanBrokerApp.java0000644000175000017500000001250210767524553033164 0ustar charlescharles/* * $Id: LoanBrokerApp.java 11398 2008-03-17 17:24:59Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esn; import org.mule.example.loanbroker.AbstractLoanBrokerApp; import org.mule.example.loanbroker.LocaleMessage; import org.mule.example.loanbroker.messages.LoanQuote; import org.mule.util.DateUtils; import org.mule.util.StringMessageUtils; import org.mule.util.StringUtils; import org.mule.util.SystemUtils; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Runs the LoanBroker ESN example application. */ public class LoanBrokerApp extends AbstractLoanBrokerApp { public static final String CLI_OPTIONS[][] = { { "config", "true", "Configuration File(s)" }, { "main", "true", "LoanBrokerApp Class"}, { "req", "true", "Number of loan requests to use"}, { "sync", "true", "Whether to run in synchronous mode or not"} }; private static boolean synchronous = false; // Needed for webapp version! // TODO Travis ... sadly, it doesn't quite work public LoanBrokerApp() throws Exception { super(); } public LoanBrokerApp(String config) throws Exception { super(config); } public static void main(String[] args) throws Exception { LoanBrokerApp loanBrokerApp = null; ///////////////////////////////////////// // Command-line config ///////////////////////////////////////// Map options = SystemUtils.getCommandLineOptions(args, CLI_OPTIONS); String config = (String)options.get("config"); if (StringUtils.isNotBlank(config)) { loanBrokerApp = new LoanBrokerApp(config); int i = 100; String requests = (String)options.get("req"); if (requests != null) { i = Integer.parseInt(requests); } String sync = (String)options.get("sync"); if (sync != null) { synchronous = Boolean.valueOf(sync).booleanValue(); } if (synchronous) { long start = System.currentTimeMillis(); List results = loanBrokerApp.requestSend(i, "CustomerRequests"); System.out.println(LocaleMessage.responseNumQuotes(results.size())); List output = new ArrayList(results.size()); int x = 1; for (Iterator iterator = results.iterator(); iterator.hasNext(); x++) { LoanQuote quote = (LoanQuote)iterator.next(); output.add(x + ". " + quote.toString()); } System.out.println(StringMessageUtils.getBoilerPlate(output, '*', 80)); long cur = System.currentTimeMillis(); System.out.println(DateUtils.getFormattedDuration(cur - start)); System.out.println(LocaleMessage.responseAvgRequest(((cur - start) / x) )); } else { loanBrokerApp.requestDispatch(i, "CustomerRequests"); } } ///////////////////////////////////////// // Interactive config ///////////////////////////////////////// else { loanBrokerApp = new LoanBrokerApp(getInteractiveConfig()); loanBrokerApp.run(synchronous); } } protected static String getInteractiveConfig() throws IOException { System.out.println(StringMessageUtils.getBoilerPlate(LocaleMessage.welcome())); int response = 0; String provider = "axis"; while (response != 'a' && response != 'c') { System.out.println("\n" + LocaleMessage.menuOptionSoap()); response = readCharacter(); switch (response) { case 'a' : { provider = "axis"; break; } case 'c' : { provider = "cxf"; break; } } } response = 0; while (response != 'a' && response != 's') { System.out.println("\n" + LocaleMessage.menuOptionMode()); response = readCharacter(); switch (response) { case 'a' : { System.out.println(LocaleMessage.loadingAsync()); synchronous = false; break; } case 's' : { System.out.println(LocaleMessage.loadingSync()); synchronous = true; break; } } } String config = "loan-broker-" + (synchronous ? "sync" : "async") + "-config.xml"; config += ",loan-broker-" + provider + "-endpoints-config.xml"; return config; } } mule-2.0.1/examples/loanbroker/esn/src/test/0000755000175000017500000000000011351411171020602 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/test/java/0000755000175000017500000000000011351411171021523 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/test/java/org/0000755000175000017500000000000011351411171022312 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/0000755000175000017500000000000011351411171023254 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/0000755000175000017500000000000011351411171024707 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/0000755000175000017500000000000011351411171027045 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/0000755000175000017500000000000011351411171027632 5ustar charlescharles././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootmule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/CxfLoanBrokerAsynchronousFunctionalTestCase.javamule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/CxfLoanBrokerAsynch0000644000175000017500000000203310767505705033441 0ustar charlescharles/* * $Id: CxfLoanBrokerAsynchronousFunctionalTestCase.java 11394 2008-03-17 15:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esn; import org.mule.example.loanbroker.tests.AbstractAsynchronousLoanBrokerTestCase; public class CxfLoanBrokerAsynchronousFunctionalTestCase extends AbstractAsynchronousLoanBrokerTestCase { @Override protected String getConfigResources() { return "loan-broker-async-config.xml, loan-broker-cxf-endpoints-config.xml"; } @Override protected int getNumberOfRequests() { // MULE-3016 return 1; } @Override protected int getWarmUpMessages() { // MULE-3016 return 0; } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootmule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/VMLoanBrokerAsynchronousFunctionalTestCase.javamule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/VMLoanBrokerAsynchr0000644000175000017500000000164010767505705033430 0ustar charlescharles/* * $Id: VMLoanBrokerAsynchronousFunctionalTestCase.java 11394 2008-03-17 15:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esn; import org.mule.example.loanbroker.tests.AbstractAsynchronousLoanBrokerTestCase; public class VMLoanBrokerAsynchronousFunctionalTestCase extends AbstractAsynchronousLoanBrokerTestCase { @Override protected String getConfigResources() { return "loan-broker-async-config.xml, loan-broker-vm-endpoints-config.xml"; } @Override protected int getNumberOfRequests() { return 100; } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootmule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/CxfLoanBrokerSynchronousFunctionalTestCase.javamule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/CxfLoanBrokerSynchr0000644000175000017500000000172710767505705033473 0ustar charlescharles/* * $Id: CxfLoanBrokerSynchronousFunctionalTestCase.java 11394 2008-03-17 15:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esn; import org.mule.example.loanbroker.tests.AbstractLoanBrokerTestCase; public class CxfLoanBrokerSynchronousFunctionalTestCase extends AbstractLoanBrokerTestCase { @Override public void testSingleLoanRequest() throws Exception { // TODO Auto-generated method stub super.testSingleLoanRequest(); } @Override protected String getConfigResources() { return "loan-broker-sync-config.xml, loan-broker-cxf-endpoints-config.xml"; } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootmule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/AxisLoanBrokerSynchronousFunctionalTestCase.javamule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/AxisLoanBrokerSynch0000644000175000017500000000143710754375733033475 0ustar charlescharles/* * $Id: AxisLoanBrokerSynchronousFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esn; import org.mule.example.loanbroker.tests.AbstractLoanBrokerTestCase; public class AxisLoanBrokerSynchronousFunctionalTestCase extends AbstractLoanBrokerTestCase { protected String getConfigResources() { return "loan-broker-sync-config.xml, loan-broker-axis-endpoints-config.xml"; } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootmule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/AxisLoanBrokerAsynchronousFunctionalTestCase.javamule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/AxisLoanBrokerAsync0000644000175000017500000000164110767505705033461 0ustar charlescharles/* * $Id: AxisLoanBrokerAsynchronousFunctionalTestCase.java 11394 2008-03-17 15:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esn; import org.mule.example.loanbroker.tests.AbstractAsynchronousLoanBrokerTestCase; public class AxisLoanBrokerAsynchronousFunctionalTestCase extends AbstractAsynchronousLoanBrokerTestCase { @Override protected String getConfigResources() { return "loan-broker-async-config.xml, loan-broker-axis-endpoints-config.xml"; } @Override protected int getNumberOfRequests() { return 10; } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/VMLoanBrokerSynchronousFunctionalTestCase.javamule-2.0.1/examples/loanbroker/esn/src/test/java/org/mule/example/loanbroker/esn/VMLoanBrokerSynchro0000644000175000017500000000315410767505705033450 0ustar charlescharles/* * $Id: VMLoanBrokerSynchronousFunctionalTestCase.java 11394 2008-03-17 15:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esn; import org.mule.api.service.Service; import org.mule.example.loanbroker.tests.AbstractLoanBrokerTestCase; import org.mule.model.seda.SedaModel; public class VMLoanBrokerSynchronousFunctionalTestCase extends AbstractLoanBrokerTestCase { @Override protected String getConfigResources() { return "loan-broker-sync-config.xml, loan-broker-vm-endpoints-config.xml"; } @Override protected int getNumberOfRequests() { return 1000; } public void testBasicParsing() { Object objModel = muleContext.getRegistry().lookupModel("loan-broker"); assertNotNull(objModel); assertTrue(objModel instanceof SedaModel); SedaModel model = (SedaModel)objModel; assertComponent(model, "TheLoanBroker"); assertComponent(model, "TheCreditAgencyService"); assertComponent(model, "TheLenderService"); assertComponent(model, "TheBankGateway"); } protected void assertComponent(SedaModel model, String name) { Service service = muleContext.getRegistry().lookupService(name); assertNotNull(name + " missing", service); } } mule-2.0.1/examples/loanbroker/esn/src/test/resources/0000755000175000017500000000000011351411171022614 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esn/src/test/resources/log4j.properties0000644000175000017500000000063610745677442026003 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages #log4j.logger.org.mule=DEBUG # debug for tracing copies in request context #log4j.logger.org.mule.RequestContext=DEBUG mule-2.0.1/examples/loanbroker/esn/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006310766306012027473 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/examples/loanbroker/esn/pom.xml0000644000175000017500000000464711006063605020366 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 2.0.1 mule-example-loanbroker-esn Loan Broker ESN Example The Loan Broker example application is based on the example presented in the Enterprise Integration Patterns book. This chapter of the book is available online so you can see a detailed description of the application here (http://www.eaipatterns.com/ComposedMessagingWS.html). org.mule.examples mule-example-loanbroker-common ${version} org.mule.examples mule-example-loanbroker-common-tests ${version} test org.mule.modules mule-module-spring-config ${version} org.mule.transports mule-transport-axis ${version} org.mule.transports mule-transport-cxf ${version} org.mule.transports mule-transport-vm ${version} org.apache.maven.plugins maven-surefire-plugin pertest mule-2.0.1/examples/loanbroker/common-tests/0000755000175000017500000000000011351411172020700 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common-tests/dist/0000755000175000017500000000000011351411172021643 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common-tests/dist/build.xml0000755000175000017500000000775010767607640023521 0ustar charlescharles mule-2.0.1/examples/loanbroker/common-tests/dist/pom.xml0000644000175000017500000000501110621717250023162 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 1.0 mule-example-loanbroker-common-tests jar Loan Broker Example: Shared classes for unit tests org.mule.examples mule-example-loanbroker-common ${muleVersion} org.mule.tests mule-tests-functional ${muleVersion} org.apache.maven.plugins maven-dependency-plugin copy-artifact install copy ${MULE_HOME}/lib/user true true ${groupId} ${artifactId} ${version} ${artifactId}.jar mule-2.0.1/examples/loanbroker/common-tests/build.xml0000755000175000017500000000774410767607640022561 0ustar charlescharles mule-2.0.1/examples/loanbroker/common-tests/src/0000755000175000017500000000000011351411172021467 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common-tests/src/main/0000755000175000017500000000000011351411172022413 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common-tests/src/main/java/0000755000175000017500000000000011351411172023334 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common-tests/src/main/java/org/0000755000175000017500000000000011351411172024123 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common-tests/src/main/java/org/mule/0000755000175000017500000000000011351411172025065 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common-tests/src/main/java/org/mule/example/0000755000175000017500000000000011351411172026520 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common-tests/src/main/java/org/mule/example/loanbroker/0000755000175000017500000000000011351411172030656 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common-tests/src/main/java/org/mule/example/loanbroker/tests/0000755000175000017500000000000011351411172032020 5ustar charlescharles././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootmule-2.0.1/examples/loanbroker/common-tests/src/main/java/org/mule/example/loanbroker/tests/AbstractLoanBrokerTestCase.javamule-2.0.1/examples/loanbroker/common-tests/src/main/java/org/mule/example/loanbroker/tests/Abstract0000644000175000017500000000631410763522057033525 0ustar charlescharles/* * $Id: AbstractLoanBrokerTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.tests; import org.mule.api.MuleMessage; import org.mule.example.loanbroker.messages.Customer; import org.mule.example.loanbroker.messages.CustomerQuoteRequest; import org.mule.example.loanbroker.messages.LoanQuote; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.NullPayload; public abstract class AbstractLoanBrokerTestCase extends FunctionalTestCase { protected int getNumberOfRequests() { return 10; } public void testSingleLoanRequest() throws Exception { MuleClient client = new MuleClient(); Customer c = new Customer("Ross Mason", 1234); CustomerQuoteRequest request = new CustomerQuoteRequest(c, 100000, 48); MuleMessage result = client.send("CustomerRequests", request, null); assertNotNull("Result is null", result); assertFalse("Result is null", result.getPayload() instanceof NullPayload); assertTrue("Result should be LoanQuote but is " + result.getPayload().getClass().getName(), result.getPayload() instanceof LoanQuote); LoanQuote quote = (LoanQuote)result.getPayload(); assertTrue(quote.getInterestRate() > 0); } public void testLotsOfLoanRequests() throws Exception { MuleClient client = new MuleClient(); Customer c = new Customer("Ross Mason", 1234); CustomerQuoteRequest[] requests = new CustomerQuoteRequest[3]; requests[0] = new CustomerQuoteRequest(c, 100000, 48); requests[1] = new CustomerQuoteRequest(c, 1000, 12); requests[2] = new CustomerQuoteRequest(c, 10, 24); long start = System.currentTimeMillis(); int numRequests = getNumberOfRequests(); int i = 0; try { for (; i < numRequests; i++) { CustomerQuoteRequest loanRequest = requests[i % 3]; MuleMessage result = client.send("CustomerRequests", loanRequest, null); assertNotNull(result); assertFalse("received a NullPayload", result.getPayload() instanceof NullPayload); assertTrue("did not receive a LoanQuote but: " + result.getPayload(), result.getPayload() instanceof LoanQuote); LoanQuote quote = (LoanQuote)result.getPayload(); assertTrue(quote.getInterestRate() > 0); } } finally { long el = System.currentTimeMillis() - start; System.out.println("Total running time was: " + el + "ms"); System.out.println("Requests processed was: " + i); int mps = (int)(numRequests/((double)el/(double)1000)); System.out.println("Msg/sec: " + mps + " (no warm up)"); } } }././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootmule-2.0.1/examples/loanbroker/common-tests/src/main/java/org/mule/example/loanbroker/tests/AbstractAsynchronousLoanBrokerTestCase.javamule-2.0.1/examples/loanbroker/common-tests/src/main/java/org/mule/example/loanbroker/tests/Abstract0000644000175000017500000001531110767505460033525 0ustar charlescharles/* * $Id: AbstractAsynchronousLoanBrokerTestCase.java 11393 2008-03-17 15:16:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.tests; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.example.loanbroker.messages.Customer; import org.mule.example.loanbroker.messages.CustomerQuoteRequest; import org.mule.example.loanbroker.messages.LoanQuote; import org.mule.module.client.MuleClient; import org.mule.transport.NullPayload; import org.mule.util.ExceptionHolder; import org.mule.util.StringMessageUtils; import java.beans.ExceptionListener; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import org.apache.commons.lang.time.StopWatch; /** * Tests the Loan Broker application asynchronously. Note that a simple thread delay is used to wait for the * incoming responses to arrive. This may or may not be sufficient depending on external factors (processor * speed, logging detail, etc.). To make the tests reliable, a more accurate mechanism should be employed * (notifications, thread-safe counter, etc.) */ public abstract class AbstractAsynchronousLoanBrokerTestCase extends AbstractLoanBrokerTestCase { @Override protected int getNumberOfRequests() { return 100; } /** Milliseconds to wait after sending each message in order for the thread to "catch up" with the test. */ protected int getDelay() { return 10000; } protected int getWarmUpMessages() { return 50; } @Override public void testSingleLoanRequest() throws Exception { MuleClient client = new MuleClient(); Customer c = new Customer("Ross Mason", 1234); CustomerQuoteRequest request = new CustomerQuoteRequest(c, 100000, 48); // Send asynchronous request client.dispatch("CustomerRequests", request, null); // Wait for asynchronous response MuleMessage result = client.request("CustomerResponses", getDelay()); assertNotNull("Result is null", result); assertFalse("Result is null", result.getPayload() instanceof NullPayload); assertTrue("Result should be LoanQuote but is " + result.getPayload().getClass().getName(), result.getPayload() instanceof LoanQuote); LoanQuote quote = (LoanQuote) result.getPayload(); assertTrue(quote.getInterestRate() > 0); } @Override public void testLotsOfLoanRequests() throws Exception { final MuleClient client = new MuleClient(); Customer c = new Customer("Ross Mason", 1234); CustomerQuoteRequest[] requests = new CustomerQuoteRequest[3]; requests[0] = new CustomerQuoteRequest(c, 100000, 48); requests[1] = new CustomerQuoteRequest(c, 1000, 12); requests[2] = new CustomerQuoteRequest(c, 10, 24); final StopWatch stopWatch = new StopWatch(); final int numRequests = getNumberOfRequests() + getWarmUpMessages(); int i = 0; int numberOfThreads = 1; CountDownLatch latch = new CountDownLatch(numberOfThreads); ExceptionHolder exceptionHolder = new ExceptionHolder(); try { for (int x = 0; x < numberOfThreads; x++) { Thread thread = new Thread(new ClientReceiver(latch, numRequests / numberOfThreads, exceptionHolder)); thread.start(); } for (i = 0; i < numRequests; i++) { if (i == getWarmUpMessages()) { stopWatch.start(); } client.dispatch("CustomerRequests", requests[i % 3], null); } } finally { latch.await(); stopWatch.stop(); System.out.println("Total running time was: " + stopWatch.getTime() + "ms"); System.out.println("Requests processed was: " + i); int mps = (int) (numRequests / ((double) stopWatch.getTime() / (double) 1000)); System.out.println("Msg/sec: " + mps + " (warm up msgs = " + getWarmUpMessages() + ")"); if(exceptionHolder.isExceptionThrown()) { exceptionHolder.print(); fail("Exceptions thrown during async processing"); } } } private class ClientReceiver implements Runnable { private CountDownLatch latch; private int numberOfRequests; private ExceptionListener exListener; public ClientReceiver(CountDownLatch latch, int numberOfRequests, ExceptionListener exListener) { this.latch = latch; this.numberOfRequests = numberOfRequests; this.exListener = exListener; } public void run() { int i = 0; try { MuleClient client = new MuleClient(); MuleMessage result = null; for (i = 0; i < numberOfRequests; i++) { try { result = client.request("CustomerResponses", getDelay()); } catch (MuleException e) { exListener.exceptionThrown(e); break; } //System.out.println("Received: " + i); assertNotNull("Result is null", result); assertFalse("Result is null", result.getPayload() instanceof NullPayload); assertTrue("Result should be LoanQuote but is " + result.getPayload().getClass().getName(), result.getPayload() instanceof LoanQuote); LoanQuote quote = (LoanQuote) result.getPayload(); assertTrue(quote.getInterestRate() > 0); } } catch (Throwable e) { //e.printStackTrace(); System.out.println(StringMessageUtils.getBoilerPlate("Processed Messages=" + i)); if(e instanceof Error) { //throw (Error)e; exListener.exceptionThrown(new Exception(e)); } else { exListener.exceptionThrown((Exception)e); } } finally { latch.countDown(); } } } } mule-2.0.1/examples/loanbroker/common-tests/src/main/resources/0000755000175000017500000000000011351411172024425 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common-tests/src/main/resources/log4j.properties0000644000175000017500000000076310626134307027576 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN # shut up warnings "Narrowing proxy to class xxx - this operation breaks" # during unit tests log4j.logger.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog = ERROR mule-2.0.1/examples/loanbroker/common-tests/pom.xml0000644000175000017500000000204111006063605022213 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 2.0.1 mule-example-loanbroker-common-tests jar Loan Broker Example: Shared classes for unit tests org.mule.examples mule-example-loanbroker-common ${version} org.mule.tests mule-tests-functional ${version} mule-2.0.1/examples/loanbroker/dist/0000755000175000017500000000000011351411171017212 5ustar charlescharlesmule-2.0.1/examples/loanbroker/dist/build.xml0000755000175000017500000000210510665540673021055 0ustar charlescharles mule-2.0.1/examples/loanbroker/dist/loanbroker0000755000175000017500000000465410767745367021342 0ustar charlescharles#! /bin/sh # 3rd party libraries for LoanBroker ESB ACTIVEMQ=activemq-core-4.1.0-incubator.jar OPENEJB=openejb-core-1.0.jar # 3rd party libraries for LoanBroker BPM BSH=bsh-1.3.0.jar DERBYDB=derby-10.3.1.4.jar # The variable is not actually needed to run the example, but it is needed to # build the example, and if you haven't built the example, you can't run it. if [ -z "$MULE_HOME" ] ; then echo "You must set the environment variable MULE_HOME to the location of your Mule install in order to run this example." exit 1 fi # If MULE_BASE is not set, make it MULE_HOME if [ -z "$MULE_BASE" ] ; then MULE_BASE="$MULE_HOME" export MULE_BASE fi # This extends the classpath to include the configuration directory # Any changes to the files in ./conf will take precedence over those deployed # to $MULE_HOME/lib/user MULE_LIB=./conf export MULE_LIB echo "The Loan Broker example is available in three flavors:" echo " 1. Loan Broker ESB" echo " 2. Loan Broker ESN" echo " 3. Loan Broker BPM" echo "Select the one you wish to execute and press Enter..." read i if [ 1 = $i ] then if [ ! -f "$MULE_BASE/lib/user/${ACTIVEMQ}" ]; then if [ ! -f "$MULE_HOME/lib/user/${ACTIVEMQ}" ]; then MISSING_LIB=1 fi fi if [ ! -f "$MULE_BASE/lib/user/${OPENEJB}" ]; then if [ ! -f "$MULE_HOME/lib/user/${OPENEJB}" ]; then MISSING_LIB=1 fi fi if [ -z "$MISSING_LIB" ] then # MULE_HOME_UNIX must be set. This is a workaround for windows but since the config relies # on it we need to implement it here, too exec "$MULE_BASE/bin/mule" -main org.mule.example.loanbroker.esb.LoanBrokerApp -M-Dmule.home.unix="$MULE_HOME" fi elif [ 2 = $i ] then exec "$MULE_BASE/bin/mule" -main org.mule.example.loanbroker.esn.LoanBrokerApp elif [ 3 = $i ] then if [ ! -f "$MULE_BASE/lib/user/${BSH}" ]; then if [ ! -f "$MULE_HOME/lib/user/${BSH}" ]; then MISSING_LIB=1 fi fi if [ ! -f "$MULE_BASE/lib/user/${DERBYDB}" ]; then if [ ! -f "$MULE_HOME/lib/user/${DERBYDB}" ]; then MISSING_LIB=1 fi fi if [ -z "$MISSING_LIB" ] then exec "$MULE_BASE/bin/mule" -main org.mule.example.loanbroker.bpm.LoanBrokerApp fi fi if [ 1 = "$MISSING_LIB" ] then echo "This example requires additional libraries which need to be downloaded by the build script. Please follow the instructions in the README.txt file." fi mule-2.0.1/examples/loanbroker/dist/README.txt0000644000175000017500000000260611003140343020706 0ustar charlescharles+---------------------+ | Loan Broker Example | +---------------------+ This simple application is based on the Loan Broker example presented in the Enterprise Integration Patterns book. There are several variations of the same application which illustrate different architectural styles and Mule constructs. For more information, refer to http://www.muledocs.org/Examples +----------------------+ | Building the example | +----------------------+ First, make sure you have set the MULE_HOME environment variable as recommended in INSTALL.txt Depending on the build tool you are using (Ant or Maven), you can build the example by simply running "ant" or "mvn". This will download any additional libraries, compile the example classes, produce a jar file(s), and copy everything to $MULE_HOME/lib/user, which is where your custom classes and configuration files should go. (If you are unable to download the libraries it may be because you are behind a firewall and have not configured your build tool to use your HTTP proxy. Please refer to the following information.) Ant users: http://ant.apache.org/manual-beta/proxy.html Maven users: http://maven.apache.org/guides/mini/guide-proxies.html +---------------------+ | Running the example | +---------------------+ Simply use the shell script (Unix/Linux) or batch file (Windows) provided in this directory to run the example. mule-2.0.1/examples/loanbroker/dist/loanbroker.bat0000644000175000017500000000422711006073045022046 0ustar charlescharles@echo off setlocal if exist "%MULE_HOME%" goto :continue echo You must set the environment variable MULE_HOME to the location of your Mule install in order to run this example. goto :eof :continue if "%MULE_BASE%" == "" SET MULE_BASE=%MULE_HOME% REM Translate MULE_HOME to unix notation. That's used to create a system property REM mule.home.unix below which is used to configure openejb set MULE_HOME_UNIX="%MULE_HOME:\=/%" REM This extends the classpath to include the configuration directory REM Any changes to the files in .\conf will take precedence over those deployed to %MULE_HOME%\lib\user SET MULE_LIB=.\conf REM 3rd party libraries for LoanBroker ESB SET ACTIVEMQ=activemq-core-4.1.0-incubator.jar SET OPENEJB=openejb-core-1.0.jar REM 3rd party libraries for LoanBroker BPM SET BSH=bsh-1.3.0.jar SET DERBYDB=derby-10.3.1.4.jar :testactivemq if exist "%MULE_BASE%\lib\user\%ACTIVEMQ%" goto :testopenejb if exist "%MULE_HOME%\lib\user\%ACTIVEMQ%" goto :testopenejb goto :missinglibs :testopenejb if exist "%MULE_BASE%\lib\user\%OPENEJB%" goto :testbsh if exist "%MULE_HOME%\lib\user\%OPENEJB%" goto :testbsh goto :missinglibs :testbsh if exist "%MULE_BASE%\lib\user\%BSH%" goto :testderbydb if exist "%MULE_HOME%\lib\user\%BSH%" goto :testderbydb goto :missinglibs :testderbydb if exist "%MULE_BASE%\lib\user\%DERBYDB%" goto :mule if exist "%MULE_HOME%\lib\user\%DERBYDB%" goto :mule :missinglibs echo This example requires additional libraries which need to be downloaded by the build script. Please follow the instructions in the README.txt file. goto :eof :mule ECHO The Loan Broker example is available in three flavors: ECHO 1. Loan Broker ESB ECHO 2. Loan Broker ESN ECHO 3. Loan Broker BPM SET /P Choice=Select the one you wish to execute and press Enter... IF '%Choice%'=='1' call "%MULE_BASE%\bin\mule.bat" -main org.mule.example.loanbroker.esb.LoanBrokerApp -M-Dmule.home.unix="%MULE_HOME_UNIX%" IF '%Choice%'=='2' call "%MULE_BASE%\bin\mule.bat" -main org.mule.example.loanbroker.esn.LoanBrokerApp IF '%Choice%'=='3' call "%MULE_BASE%\bin\mule.bat" -main org.mule.example.loanbroker.bpm.LoanBrokerApp mule-2.0.1/examples/loanbroker/dist/pom.xml0000644000175000017500000001012411006063605020527 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 1.0 pom Loan Broker Example The Loan Broker example application is based on the example presented in the Enterprise Integration Patterns book. This chapter of the book is available online so you can see a detailed description of the application here (http://www.eaipatterns.com/ComposedMessagingWS.html). 2.0.1 common common-tests credit-agency esb esn bpm org.mule mule-core ${muleVersion} org.mule.modules mule-module-client ${muleVersion} codehaus Codehaus Maven 2.x Release Repository http://repository.codehaus.org false codehaus-snapshots Codehaus Maven 2.x Snapshots Repository http://snapshots.repository.codehaus.org true false apache-incubating Apache incubating repository http://people.apache.org/repo/m2-incubating-repository false java.net Java.net Repository http://download.java.net/maven/1/ legacy apache-plugin-snapshots Apache Maven Plugins Snapshot Repository http://people.apache.org/maven-snapshot-repository true false install conf src/main/resources org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 ISO-8859-1 mule-2.0.1/examples/loanbroker/common/0000755000175000017500000000000011351411172017540 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common/dist/0000755000175000017500000000000011351411171020502 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common/dist/build.xml0000755000175000017500000000760010767607640022353 0ustar charlescharles mule-2.0.1/examples/loanbroker/common/dist/pom.xml0000644000175000017500000000407410621717250022032 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 1.0 mule-example-loanbroker-common jar Loan Broker Example: Shared classes org.apache.maven.plugins maven-dependency-plugin copy-artifact install copy ${MULE_HOME}/lib/user true true ${groupId} ${artifactId} ${version} ${artifactId}.jar mule-2.0.1/examples/loanbroker/common/build.xml0000755000175000017500000000760410767607640021414 0ustar charlescharles mule-2.0.1/examples/loanbroker/common/src/0000755000175000017500000000000011351411171020326 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common/src/main/0000755000175000017500000000000011351411172021253 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common/src/main/java/0000755000175000017500000000000011351411171022173 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common/src/main/java/org/0000755000175000017500000000000011351411171022762 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/0000755000175000017500000000000011351411171023724 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/0000755000175000017500000000000011351411171025357 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/0000755000175000017500000000000011351411172027516 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/lender/0000755000175000017500000000000011351411171030766 5ustar charlescharles././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/lender/LenderService.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/lender/LenderService0000644000175000017500000000151010754375733033463 0ustar charlescharles/* * $Id: LenderService.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.lender; import org.mule.example.loanbroker.bank.Bank; import org.mule.example.loanbroker.messages.CreditProfile; public interface LenderService { /** * Returns a list of banks willing to offer a loan based on a customer's credit profile and the amount of * the loan. */ public abstract Bank[] getLenders(CreditProfile creditProfile, Double loanAmount); } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/lender/DefaultLender.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/lender/DefaultLender0000644000175000017500000000403210754375733033451 0ustar charlescharles/* * $Id: DefaultLender.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.lender; import org.mule.example.loanbroker.bank.Bank; import org.mule.example.loanbroker.messages.CreditProfile; import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest; /** * DefaultLenderService is responsible for contacting the relivant * banks depending on the amount of the loan */ public class DefaultLender implements LenderService { /** * Sets the list of lenders on the LoanBrokerQuoteRequest and returns it. */ public void setLenderList(LoanBrokerQuoteRequest request) { Bank[] lenders = getLenders(request.getCreditProfile(), new Double(request.getCustomerRequest() .getLoanAmount())); request.setLenders(lenders); } /** * @inheritDocs */ public Bank[] getLenders(CreditProfile creditProfile, Double loanAmount) { // TODO Add creditProfile info. to the logic below. // TODO Look up the existing banks from the config/registry instead of // creating them programatically here. Bank[] lenders; if ((loanAmount.doubleValue() >= 20000)) { lenders = new Bank[2]; lenders[0] = new Bank("Bank1"); lenders[1] = new Bank("Bank2"); } else if (((loanAmount.doubleValue() >= 10000) && (loanAmount.doubleValue() <= 19999))) { lenders = new Bank[2]; lenders[0] = new Bank("Bank3"); lenders[1] = new Bank("Bank4"); } else { lenders = new Bank[1]; lenders[0] = new Bank("Bank5"); } return lenders; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/AsynchronousLoanBroker.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/AsynchronousLoanBrok0000644000175000017500000000207610767505460033607 0ustar charlescharles/* * $Id: AsynchronousLoanBroker.java 11393 2008-03-17 15:16:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker; import org.mule.example.loanbroker.messages.CustomerQuoteRequest; import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest; /** * LoanBroker is the Service that starts the loan request process. The * broker also receives the final quote. */ public class AsynchronousLoanBroker extends DefaultLoanBroker { @Override public Object getLoanQuote(CustomerQuoteRequest request) throws LoanBrokerException { super.getLoanQuote(request); LoanBrokerQuoteRequest bqr = new LoanBrokerQuoteRequest(); bqr.setCustomerRequest(request); return bqr; } } mule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/transformers/0000755000175000017500000000000011351411171032242 5ustar charlescharles././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/transformers/RestRequestToCustomerRequest.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/transformers/RestReq0000644000175000017500000000411310754375733033574 0ustar charlescharles/* * $Id: RestRequestToCustomerRequest.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.transformers; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.example.loanbroker.messages.Customer; import org.mule.example.loanbroker.messages.CustomerQuoteRequest; import org.mule.transformer.AbstractMessageAwareTransformer; /** * Converts parameters on the message into a CustomerQuoteRequest object */ public class RestRequestToCustomerRequest extends AbstractMessageAwareTransformer { public RestRequestToCustomerRequest() { setReturnClass(CustomerQuoteRequest.class); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { String name; int ssn; double amount; int duration; try { name = getParam(message, "customerName"); ssn = Integer.parseInt(getParam(message, "ssn")); amount = Double.parseDouble(getParam(message, "loanAmount")); duration = Integer.parseInt(getParam(message, "loanDuration")); } catch (Exception e) { throw new TransformerException(this, e); } Customer c = new Customer(name, ssn); CustomerQuoteRequest request = new CustomerQuoteRequest(c, amount, duration); return request; } protected String getParam(MuleMessage message, String name) throws NullPointerException { String value = message.getStringProperty(name, null); if (value == null) { throw new IllegalArgumentException("Parameter '" + name + "' must be set on the request"); } return value; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/transformers/SetLendersAsRecipients.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/transformers/SetLend0000644000175000017500000000337310754375733033554 0ustar charlescharles/* * $Id: SetLendersAsRecipients.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.transformers; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.example.loanbroker.bank.Bank; import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest; import org.mule.routing.outbound.StaticRecipientList; import org.mule.transformer.AbstractMessageAwareTransformer; /** * Set the Recipient List property on the LoanBrokerQuoteRequest message based on the * list of banks in LoanBrokerQuoteRequest.getLenders() */ public class SetLendersAsRecipients extends AbstractMessageAwareTransformer { public SetLendersAsRecipients() { this.registerSourceType(LoanBrokerQuoteRequest.class); this.setReturnClass(MuleMessage.class); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { Object src = message.getPayload(); Bank[] lenders = ((LoanBrokerQuoteRequest) src).getLenders(); String recipients = ""; for (int i = 0; i < lenders.length; i++) { if (i > 0) recipients += ","; recipients += lenders[i].getEndpoint(); } logger.debug("Setting recipients to '" + recipients + "'"); message.setProperty(StaticRecipientList.RECIPIENTS_PROPERTY, recipients); return message; } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/transformers/CreditProfileXmlToCreditProfile.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/transformers/CreditP0000644000175000017500000000346210754375733033547 0ustar charlescharles/* * $Id: CreditProfileXmlToCreditProfile.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.transformers; import org.mule.api.transformer.TransformerException; import org.mule.example.loanbroker.messages.CreditProfile; import org.mule.transformer.AbstractTransformer; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; public class CreditProfileXmlToCreditProfile extends AbstractTransformer { public CreditProfileXmlToCreditProfile() { registerSourceType(String.class); registerSourceType(Document.class); setReturnClass(CreditProfile.class); } public Object doTransform(Object src, String encoding) throws TransformerException { Document doc = null; if (src instanceof Document) { doc = (Document)src; } else { try { doc = DocumentHelper.parseText(src.toString()); } catch (DocumentException e) { throw new TransformerException(this, e); } } String history = doc.valueOf("/credit-profile/customer-history"); String score = doc.valueOf("/credit-profile/credit-score"); CreditProfile cp = new CreditProfile(); cp.setCreditHistory(Integer.valueOf(history).intValue()); cp.setCreditScore(Integer.valueOf(score).intValue()); return cp; } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/transformers/LoanQuoteRequestToCreditProfileArgs.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/transformers/LoanQuo0000644000175000017500000000263510754375733033574 0ustar charlescharles/* * $Id: LoanQuoteRequestToCreditProfileArgs.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.transformers; import org.mule.api.transformer.TransformerException; import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest; import org.mule.transformer.AbstractTransformer; /** * Extracts the customer information from the request into an array of arguments used * to invoke the Credit Agency MuleSession bean */ public class LoanQuoteRequestToCreditProfileArgs extends AbstractTransformer { public LoanQuoteRequestToCreditProfileArgs() { registerSourceType(LoanBrokerQuoteRequest.class); setReturnClass(Object[].class); } public Object doTransform(Object src, String encoding) throws TransformerException { LoanBrokerQuoteRequest request = (LoanBrokerQuoteRequest)src; Object[] args = new Object[2]; args[0] = request.getCustomerRequest().getCustomer().getName(); args[1] = new Integer(request.getCustomerRequest().getCustomer().getSsn()); return args; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/DefaultLoanBroker.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/DefaultLoanBroker.ja0000644000175000017500000000651010754375733033421 0ustar charlescharles/* * $Id: DefaultLoanBroker.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker; import org.mule.example.loanbroker.messages.CreditProfile; import org.mule.example.loanbroker.messages.Customer; import org.mule.example.loanbroker.messages.CustomerQuoteRequest; import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest; import org.mule.example.loanbroker.messages.LoanQuote; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * LoanBroker is the Service that starts the loan request process. The * broker also receives the final quote. */ public class DefaultLoanBroker implements LoanBrokerService { /** * logger used by this class */ protected final Log logger = LogFactory.getLog(getClass()); private final AtomicInteger quotes = new AtomicInteger(0); private final AtomicInteger requests = new AtomicInteger(0); private final AtomicInteger profiles = new AtomicInteger(0); public Object getLoanQuote(CustomerQuoteRequest request) throws LoanBrokerException { int requests = incRequests(); if (logger.isInfoEnabled()) { String[] params = new String[] { String.valueOf(requests), request.getCustomer().getName(), String.valueOf(request.getCustomer().getSsn()), String.valueOf(request.getLoanAmount()), String.valueOf(request.getLoanDuration()) }; logger.info("\n***** " + LocaleMessage.receivedRequest(params)); } return request; } public LoanBrokerQuoteRequest receiveLoanBrokerQuoteRequest(LoanBrokerQuoteRequest request) { // Just pass through return request; } public Customer receiveCustomer(Customer customer) { // Just pass through return customer; } public Object receiveCreditProfile(CreditProfile profile) { int profiles = incProfiles(); if (logger.isInfoEnabled()) { String[] params = new String[] { String.valueOf(profiles), String.valueOf(profile.getCreditScore()), String.valueOf(profile.getCreditHistory()) }; logger.info("\n***** " + LocaleMessage.receivedProfile(params)); } return profile; } public Object receiveQuote(LoanQuote quote) { int quotes = incQuotes(); if (logger.isInfoEnabled()) { String[] params = new String[] { String.valueOf(quotes), quote.toString() }; logger.info("\n***** " + LocaleMessage.receivedQuote(params)); } return quote; } protected int incQuotes() { return quotes.incrementAndGet(); } protected int incRequests() { return requests.incrementAndGet(); } protected int incProfiles() { return profiles.incrementAndGet(); } } mule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/credit/0000755000175000017500000000000011351411172030770 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/credit/DefaultCreditAgency.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/credit/DefaultCredit0000644000175000017500000000253510754375733033461 0ustar charlescharles/* * $Id: DefaultCreditAgency.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.credit; import org.mule.example.loanbroker.messages.CreditProfile; import org.mule.example.loanbroker.messages.Customer; /** * Provides the credit profile for a customer. */ public class DefaultCreditAgency implements CreditAgencyService { public CreditProfile getCreditProfile(Customer customer) { CreditProfile cp = new CreditProfile(); cp.setCreditHistory(getCreditHistoryLength(customer.getSsn())); cp.setCreditScore(getCreditScore(customer.getSsn())); return cp; } protected int getCreditScore(int ssn) { int credit_score; credit_score = (int)(Math.random() * 600 + 300); return credit_score; } protected int getCreditHistoryLength(int ssn) { int credit_history_length; credit_history_length = (int)(Math.random() * 19 + 1); return credit_history_length; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/credit/CreditAgencyService.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/credit/CreditAgencyS0000644000175000017500000000142410754375733033422 0ustar charlescharles/* * $Id: CreditAgencyService.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.credit; import org.mule.example.loanbroker.messages.CreditProfile; import org.mule.example.loanbroker.messages.Customer; /** * CreditAgencyService the service that provides a credit score for a * customer. */ public interface CreditAgencyService { CreditProfile getCreditProfile(Customer customer); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/LoanBrokerService.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/LoanBrokerService.ja0000644000175000017500000000220710754375733033434 0ustar charlescharles/* * $Id: LoanBrokerService.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker; import org.mule.example.loanbroker.messages.CustomerQuoteRequest; import org.mule.example.loanbroker.messages.LoanQuote; /** * LoanBroker is the Service that starts the loan request process. The * broker also receives the final quote. */ public interface LoanBrokerService { /** * Triggered by an incoming customer request for a loan. * @return Outgoing payload will depend on the implementation */ Object getLoanQuote(CustomerQuoteRequest request) throws LoanBrokerException; /** * Triggered by an incoming offer from a bank. * @return Outgoing payload will depend on the implementation */ Object receiveQuote(LoanQuote quote); } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/AbstractLoanBrokerApp.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/AbstractLoanBrokerAp0000644000175000017500000002073010777664077033477 0ustar charlescharles/* * $Id: AbstractLoanBrokerApp.java 11569 2008-04-11 13:31:43Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.context.MuleContextFactory; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.context.DefaultMuleContextFactory; import org.mule.example.loanbroker.messages.Customer; import org.mule.example.loanbroker.messages.CustomerQuoteRequest; import org.mule.module.client.MuleClient; import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Runs the LoanBroker example application. */ public abstract class AbstractLoanBrokerApp { private List customers = new ArrayList(); private MuleClient client = null; private String config; public AbstractLoanBrokerApp() throws Exception { this.config = null; init(); } public AbstractLoanBrokerApp(String config) throws Exception { this.config = config; init(); } protected void init() throws Exception { if (config != null) { MuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); muleContextFactory.createMuleContext(getConfigBuilder()); } client = new MuleClient(); customers.add(new Customer("Jenson Button", 123)); customers.add(new Customer("Michael Schumacker", 456)); customers.add(new Customer("Juan Pablo Montoya", 789)); customers.add(new Customer("David Colthard", 101)); customers.add(new Customer("Rubens Barrichello", 112)); customers.add(new Customer("Mark Webber", 131)); customers.add(new Customer("Takuma Sato", 415)); customers.add(new Customer("Kimi Raikkonen", 161)); customers.add(new Customer("Ralf Schumacher", 718)); customers.add(new Customer("Jarno Trulli", 192)); } protected ConfigurationBuilder getConfigBuilder() throws MuleException { return new SpringXmlConfigurationBuilder(config); } protected void dispose() throws Exception { client.dispose(); } protected void run(boolean synchronous) throws Exception { int response = 0; while (response != 'q') { System.out.println("\n" + LocaleMessage.menu()); response = readCharacter(); switch (response) { case '1' : { CustomerQuoteRequest request = getRequestFromUser(); request(request, synchronous); break; } case '2' : { sendRandomRequests(100, synchronous); break; } case '3' : { System.out.println(LocaleMessage.menuOptionNumberOfRequests()); int number = readInt(); if (number < 1) { System.out.println(LocaleMessage.menuErrorNumberOfRequests()); } else { sendRandomRequests(number, synchronous); } break; } case 'q' : { System.out.println(LocaleMessage.exiting()); dispose(); System.exit(0); } default : { System.out.println(LocaleMessage.menuError()); } } } } public CustomerQuoteRequest createRequest() { int index = new Double(Math.random() * 10).intValue(); Customer c = customers.get(index); return new CustomerQuoteRequest(c, getRandomAmount(), getRandomDuration()); } protected static CustomerQuoteRequest getRequestFromUser() throws IOException { byte[] buf = new byte[128]; System.out.print(LocaleMessage.enterName()); System.in.read(buf); String name = new String(buf).trim(); System.out.print(LocaleMessage.enterLoanAmount()); buf = new byte[16]; System.in.read(buf); String amount = new String(buf).trim(); System.out.print(LocaleMessage.enterLoanDuration()); buf = new byte[16]; System.in.read(buf); String duration = new String(buf).trim(); int d = 0; try { d = Integer.parseInt(duration); } catch (NumberFormatException e) { System.out.println(LocaleMessage.loanDurationError(duration)); d = getRandomDuration(); } double a = 0; try { a = Double.valueOf(amount).doubleValue(); } catch (NumberFormatException e) { System.out.println(LocaleMessage.loanAmountError(amount)); a = getRandomAmount(); } Customer c = new Customer(name, getRandomSsn()); CustomerQuoteRequest request = new CustomerQuoteRequest(c, a, d); return request; } public void request(CustomerQuoteRequest request, boolean sync) throws Exception { if (!sync) { client.dispatch("CustomerRequests", request, null); System.out.println(LocaleMessage.sentAsync()); // let the request catch up Thread.sleep(1500); } else { MuleMessage result = client.send("CustomerRequests", request, null); if (result == null) { System.out.println(LocaleMessage.requestError()); } else { System.out.println(LocaleMessage.requestResponse(result.getPayload())); } } } public void requestDispatch(int number, String endpoint) throws Exception { for (int i = 0; i < number; i++) { client.dispatch(endpoint, createRequest(), null); } } public List requestSend(int number, String endpoint) throws Exception { return requestSend(number, endpoint, null); } public List requestSend(int number, String endpoint, Map properties) throws Exception { List results = new ArrayList(number); MuleMessage result; for (int i = 0; i < number; i++) { result = client.send(endpoint, createRequest(), properties); if (result != null) { results.add(result.getPayload()); } } return results; } protected void sendRandomRequests(int number, boolean synchronous) throws Exception { if (synchronous) { List list = this.requestSend(number, "CustomerRequests"); int i = 1; for (Iterator iterator = list.iterator(); iterator.hasNext(); i++) { System.out.println( LocaleMessage.request(i, iterator.next().toString())); } } else { this.requestDispatch(number, "CustomerRequests"); } } protected static int readCharacter() throws IOException { byte[] buf = new byte[16]; System.in.read(buf); return buf[0]; } protected static String readString() throws IOException { byte[] buf = new byte[80]; System.in.read(buf); return new String(buf).trim(); } protected static int readInt() throws IOException { try { return Integer.parseInt(readString()); } catch (NumberFormatException nfex) { return 0; } } protected static double getRandomAmount() { return Math.round(Math.random() * 18000); } protected static int getRandomDuration() { return new Double(Math.random() * 60).intValue(); } protected static int getRandomSsn() { return new Double(Math.random() * 6000).intValue(); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/LoanBrokerException.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/LoanBrokerException.0000644000175000017500000000154210754375733033460 0ustar charlescharles/* * $Id: LoanBrokerException.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker; import org.mule.api.DefaultMuleException; /** * Exception related to the LoanBroker example app. */ public class LoanBrokerException extends DefaultMuleException { private static final long serialVersionUID = -1669865702115931005L; public LoanBrokerException(String message) { super(message); } public LoanBrokerException(Exception e) { super(e); } } mule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/routers/0000755000175000017500000000000011351411171031220 5ustar charlescharles././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/routers/BankQuotesResponseAggregator.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/routers/BankQuotesRe0000644000175000017500000000277010777661265033542 0ustar charlescharles/* * $Id: BankQuotesResponseAggregator.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.routers; import org.mule.api.MuleMessage; import org.mule.routing.AggregationException; import org.mule.routing.CollectionCorrelatorCallback; import org.mule.routing.EventCorrelatorCallback; import org.mule.routing.inbound.EventGroup; import org.mule.routing.response.ResponseCorrelationAggregator; /** * BankQuotesInboundAggregator receives a number of quotes and selects the * lowest */ public class BankQuotesResponseAggregator extends ResponseCorrelationAggregator { //@Override protected EventCorrelatorCallback getCorrelatorCallback() { return new CollectionCorrelatorCallback() { public MuleMessage aggregateEvents(EventGroup events) throws AggregationException { try { return BankQuotesAggregationLogic.aggregateEvents(events); } catch (Exception e) { throw new AggregationException(events, null, e); } } }; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/routers/BankQuotesAggregationLogic.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/routers/BankQuotesAg0000644000175000017500000000432210754375733033513 0ustar charlescharles/* * $Id: BankQuotesAggregationLogic.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.routers; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.example.loanbroker.LocaleMessage; import org.mule.example.loanbroker.messages.LoanQuote; import org.mule.routing.inbound.EventGroup; import java.util.Iterator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class BankQuotesAggregationLogic { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(BankQuotesAggregationLogic.class); public static MuleMessage aggregateEvents(EventGroup events) throws Exception { LoanQuote lowestQuote = null; LoanQuote quote = null; MuleEvent event = null; for (Iterator iterator = events.iterator(); iterator.hasNext();) { event = (MuleEvent)iterator.next(); Object o = event.transformMessage(); if(o instanceof LoanQuote) { quote = (LoanQuote)o; } else { throw new IllegalArgumentException("Object received by Aggregator is not of expected type. Wanted: " + LoanQuote.class.getName() + " Got: " + o); } logger.info(LocaleMessage.processingQuote(quote)); if (lowestQuote == null) { lowestQuote = quote; } else { if (quote.getInterestRate() < lowestQuote.getInterestRate()) { lowestQuote = quote; } } } logger.info(LocaleMessage.lowestQuote(lowestQuote)); return new DefaultMuleMessage(lowestQuote, event.getMessage()); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/routers/BankQuotesInboundAggregator.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/routers/BankQuotesIn0000644000175000017500000000321110777661265033531 0ustar charlescharles/* * $Id: BankQuotesInboundAggregator.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.routers; import org.mule.api.MuleMessage; import org.mule.routing.AggregationException; import org.mule.routing.inbound.CorrelationAggregator; import org.mule.routing.inbound.EventGroup; /** * BankQuotesInboundAggregator receives a number of quotes and selects the * lowest */ public class BankQuotesInboundAggregator extends CorrelationAggregator { /** * This method is invoked if the shouldAggregate method is called and returns * true. Once this method returns an aggregated message the event group is * removed from the router * * @param events the event group for this request * @return an aggregated message * @throws AggregationException if the aggregation fails. in this scenario the * whole event group is removed and passed to the exception handler * for this componenet */ protected MuleMessage aggregateEvents(EventGroup events) throws AggregationException { try { return BankQuotesAggregationLogic.aggregateEvents(events); } catch (Exception e) { throw new AggregationException(events, null, e); } } } mule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/messages/0000755000175000017500000000000011351411171031324 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/messages/CreditProfile.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/messages/CreditProfi0000644000175000017500000000230710754375733033506 0ustar charlescharles/* * $Id: CreditProfile.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.messages; import java.io.Serializable; /** * CreditProfile is a dummy finance profile for a customer */ public class CreditProfile implements Serializable { /** * Serial version */ private static final long serialVersionUID = -5924690191061177417L; private int creditScore; private int creditHistory; public CreditProfile() { super(); } public int getCreditScore() { return creditScore; } public void setCreditScore(int creditScore) { this.creditScore = creditScore; } public int getCreditHistory() { return creditHistory; } public void setCreditHistory(int creditHistory) { this.creditHistory = creditHistory; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/messages/LoanBrokerQuoteRequest.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/messages/LoanBrokerQ0000644000175000017500000000371610754375733033460 0ustar charlescharles/* * $Id:LoanQuoteRequest.java 2944 2006-09-05 10:38:45 +0000 (Tue, 05 Sep 2006) tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.messages; import org.mule.example.loanbroker.bank.Bank; import java.io.Serializable; /** * LoanQuoteRequest represents a customer request for a loan through a * loan broker */ public class LoanBrokerQuoteRequest implements Serializable { /** * Serial version */ private static final long serialVersionUID = 46866005259682607L; /** The customer request */ private CustomerQuoteRequest customerRequest; /** credit profile for the customer */ private CreditProfile creditProfile; /** A list of lenders for this request */ private Bank[] lenders; /** A loan quote from a bank */ private LoanQuote loanQuote; public LoanBrokerQuoteRequest() { super(); } public Bank[] getLenders() { return lenders; } public void setLenders(Bank[] lenders) { this.lenders = lenders; } public CustomerQuoteRequest getCustomerRequest() { return customerRequest; } public void setCustomerRequest(CustomerQuoteRequest customerRequest) { this.customerRequest = customerRequest; } public CreditProfile getCreditProfile() { return creditProfile; } public void setCreditProfile(CreditProfile creditProfile) { this.creditProfile = creditProfile; } public LoanQuote getLoanQuote() { return loanQuote; } public void setLoanQuote(LoanQuote loanQuote) { this.loanQuote = loanQuote; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/messages/CustomerQuoteRequest.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/messages/CustomerQuo0000644000175000017500000000336410754375733033566 0ustar charlescharles/* * $Id: CustomerQuoteRequest.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.messages; import java.io.Serializable; /** * CustomerQuoteRequest is the request sent by the the LoanBroker */ public class CustomerQuoteRequest implements Serializable { /** * Serial version */ private static final long serialVersionUID = 6365612435470800746L; /** The customer that requested the quote */ private Customer customer; /** The requested loan Amount */ private double loanAmount; /** the duration of the loan */ private int loanDuration; public CustomerQuoteRequest() { super(); } public CustomerQuoteRequest(Customer customer, double loanAmount, int loanDuration) { this.customer = customer; this.loanAmount = loanAmount; this.loanDuration = loanDuration; } public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } public double getLoanAmount() { return loanAmount; } public void setLoanAmount(double loanAmount) { this.loanAmount = loanAmount; } public int getLoanDuration() { return loanDuration; } public void setLoanDuration(int loanDuration) { this.loanDuration = loanDuration; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/messages/Customer.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/messages/Customer.ja0000644000175000017500000000223510754375733033466 0ustar charlescharles/* * $Id: Customer.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.messages; import java.io.Serializable; /** * Customer the loan broker customer */ public class Customer implements Serializable { /** * Serial version */ private static final long serialVersionUID = 4622840173638021051L; private String name; private int ssn; public Customer() { super(); } public Customer(String name, int ssn) { this.name = name; this.ssn = ssn; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getSsn() { return ssn; } public void setSsn(int ssn) { this.ssn = ssn; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/messages/LoanQuote.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/messages/LoanQuote.j0000644000175000017500000000250010754375733033426 0ustar charlescharles/* * $Id: LoanQuote.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.messages; import org.mule.example.loanbroker.LocaleMessage; import java.io.Serializable; /** * LoanQuote is a loan quote from a bank */ public class LoanQuote implements Serializable { /** * Serial version */ private static final long serialVersionUID = -8432932027217141564L; private String bankName; private double interestRate = 0; public LoanQuote() { super(); } public String getBankName() { return bankName; } public void setBankName(String bankName) { this.bankName = bankName; } public double getInterestRate() { return interestRate; } public void setInterestRate(double interestRate) { this.interestRate = interestRate; } public String toString() { return LocaleMessage.loanQuote(bankName, interestRate); } } mule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/bank/0000755000175000017500000000000011351411172030431 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/bank/BankService.javamule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/bank/BankService.jav0000644000175000017500000000141710754375733033354 0ustar charlescharles/* * $Id: BankService.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.bank; import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest; import org.mule.example.loanbroker.messages.LoanQuote; /** * BankService is a representation of a bank form which to obtain loan * quotes. */ public interface BankService { LoanQuote getLoanQuote(LoanBrokerQuoteRequest request); } mule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/bank/Bank.java0000644000175000017500000000675110754403514032167 0ustar charlescharles/* * $Id: Bank.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.bank; import org.mule.api.config.ConfigurationException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.service.Service; import org.mule.api.service.ServiceAware; import org.mule.config.i18n.MessageFactory; import org.mule.example.loanbroker.LocaleMessage; import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest; import org.mule.example.loanbroker.messages.LoanQuote; import java.io.Serializable; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Bank is a representation of a bank from which to obtain loan * quotes. */ public class Bank implements ServiceAware, Serializable, BankService { /** * Serial version */ private static final long serialVersionUID = 4108271137166107769L; /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(Bank.class); private String bankName; private double primeRate; /** * Incoming endpoint for the bank, this is used to create a static recipient list based on a list of banks. */ private String endpoint; public Bank() { this.primeRate = Math.random() * 10; } public Bank(String bankname) { this(); this.bankName = bankname; // For simplicity, the endpoint for the bank is the same as the bank's name. this.endpoint = bankName; } // TODO This method doesn't help us with the Static Recipient list because the list of banks is created // programatically in DefaultLenderService (they should be looked up from the config/registry). public void setService(Service service) throws ConfigurationException { this.bankName = service.getName(); List endpoints = service.getInboundRouter().getEndpoints(); if ((endpoints == null) || (endpoints.size() != 1)) { throw new ConfigurationException(MessageFactory.createStaticMessage("Bank is expected to have exactly 1 incoming endpoint.")); } // TODO This gives us the endpoint the bank is listening on, but the endpoint for sending to the bank // is different in the ESB config ("Bank1In" vs. "Bank1") this.endpoint = ((ImmutableEndpoint) endpoints.get(0)).getName(); } public LoanQuote getLoanQuote(LoanBrokerQuoteRequest request) { LoanQuote quote = new LoanQuote(); quote.setBankName(getBankName()); quote.setInterestRate(primeRate); logger.info(LocaleMessage.receivedRate(quote)); return quote; } public String getBankName() { return bankName; } public void setBankName(String bankName) { this.bankName = bankName; } public double getPrimeRate() { return primeRate; } public void setPrimeRate(double primeRate) { this.primeRate = primeRate; } public String getEndpoint() { return endpoint; } public void setEndpoint(String endpoint) { this.endpoint = endpoint; } } mule-2.0.1/examples/loanbroker/common/src/main/java/org/mule/example/loanbroker/LocaleMessage.java0000644000175000017500000001016310767676526033120 0ustar charlescharles/* * $Id: LocaleMessage.java 11417 2008-03-18 08:29:10Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker; import org.mule.config.i18n.MessageFactory; import org.mule.example.loanbroker.messages.LoanQuote; import org.mule.util.StringMessageUtils; public class LocaleMessage extends MessageFactory { private static final String BUNDLE_PATH = "messages.loanbroker-example-messages"; public static String receivedRequest(String[] params) { return getString(BUNDLE_PATH, 1, params); } public static String receivedQuote(String[] params) { return getString(BUNDLE_PATH, 2, params); } public static String receivedRate(LoanQuote quote) { return getString(BUNDLE_PATH, 3, quote.toString()); } public static String loanQuote(String bankName, double interestRate) { return getString(BUNDLE_PATH, 4, bankName, String.valueOf(interestRate)); } public static String processingQuote(LoanQuote quote) { return getString(BUNDLE_PATH, 5, quote.toString()); } public static String lowestQuote(LoanQuote lowestQuote) { return getString(BUNDLE_PATH, 6, lowestQuote.toString()); } public static String receivedProfile(String[] params) { return getString(BUNDLE_PATH, 7, StringMessageUtils.toString(params)); } public static String responseNumQuotes(int i) { return getString(BUNDLE_PATH, 10, String.valueOf(i)); } public static String responseAvgRequest(long l) { return getString(BUNDLE_PATH, 11, String.valueOf(l)); } public static String requestError() { return getString(BUNDLE_PATH, 12); } public static String requestResponse(Object payload) { return getString(BUNDLE_PATH, 13, payload); } public static String exiting() { return getString(BUNDLE_PATH, 14); } public static String menuError() { return getString(BUNDLE_PATH, 15); } public static String enterName() { return getString(BUNDLE_PATH, 16); } public static String enterLoanAmount() { return getString(BUNDLE_PATH, 17); } public static String enterLoanDuration() { return getString(BUNDLE_PATH, 18); } public static String loanDurationError(String duration) { return getString(BUNDLE_PATH, 19, duration); } public static String loanAmountError(String amount) { return getString(BUNDLE_PATH, 20, amount); } public static String menuOptionNumberOfRequests() { return getString(BUNDLE_PATH, 22); } public static String menuErrorNumberOfRequests() { return getString(BUNDLE_PATH, 23); } public static String request(int i, Object object) { return getString(BUNDLE_PATH, 24, String.valueOf(i), object); } public static String esbWelcome() { return getString(BUNDLE_PATH, 30); } public static String loadingEndpointEjb() { return getString(BUNDLE_PATH, 31); } public static String loadingManagedEjb() { return getString(BUNDLE_PATH, 33); } public static String welcome() { return getString(BUNDLE_PATH, 40); } public static String menu() { return getString(BUNDLE_PATH, 41); } public static String sentAsync() { return getString(BUNDLE_PATH, 42); } public static String menuOptionSoap() { return getString(BUNDLE_PATH, 43); } public static String menuOptionMode() { return getString(BUNDLE_PATH, 44); } public static String loadingAsync() { return getString(BUNDLE_PATH, 45); } public static String loadingSync() { return getString(BUNDLE_PATH, 46); } } mule-2.0.1/examples/loanbroker/common/src/main/resources/0000755000175000017500000000000011351411172023265 5ustar charlescharlesmule-2.0.1/examples/loanbroker/common/src/main/resources/messages/0000755000175000017500000000000011351411172025074 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/resources/messages/loanbroker-example-messages.propertiesmule-2.0.1/examples/loanbroker/common/src/main/resources/messages/loanbroker-example-messages.proper0000644000175000017500000000360010767524553033742 0ustar charlescharles1=Request # {0} received: Client {1} with ssn = {2} requests a loan of amount = {3} for {4} months 2=Quote # {0} received: {1} 3=Returning Rate is: {0} 4={0}, rate: {1} 5=Processing quote: {0} 6=Lowest quote is: {0} 7=Credit profile # {0} received: score = {1}, history = {2} 10=Number or quotes received: {0} 11=Avg request: {0} 12=A result was not received, an error must have occurred. Check the logs. 13=Loan Consumer received a Quote: {0} 14=Exiting now 15=That response is not recognised, try again: 16=Enter your name: 17=Enter loan Amount: 18=Enter loan Duration in months: 19=Failed to parse duration: {0}. Using random default 20=Failed to parse amount: {0}. Using random default 22=Enter number of requests: 23=Number of requests must be at least 1 24=Request {0}: {1} 30=Welcome to the Mule Loan Broker ESB example. This example demonstrates using JMS, Web Services,\n Http/Rest and EJBs using an ESB architecture.\nFor more information see http://www.muledocs.org/LoanBroker.\n\nThe example demonstrates integrating EJB applications in 2 ways -\n 1. Calling out to a remote EJB using a Mule Endpoint.\n 2. Managing an EJB as a Mule component.\n\nBoth have the same behavior but the second method allows a remote EJB to be used as if it were\n a local Mule component, thereby enabling tighter integration.\n\nPlease select [1], [2] or [q] quit: 31=Loading 'Ejb via an Endpoint' version 32=Bye 33=Loading 'Managed Ejb Component' version 34=[1] make a loan request\n[q] quit\n\nPlease make your selection: 40=Welcome to the Mule Loan Broker example 41=[1] make a loan request\n[2] send 100 random requests\n[3] send X random requests\n[q] quit\n\nPlease make your selection: 42=Sent Async request 43=Which SOAP stack would you like to use: [a]xis or [c]xf? 44=Would you like to run the [s]ynchronous or [a]synchronous version? 45=Loading Asynchronous Loan Broker 46=Loading Synchronous Loan Broker ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/resources/messages/loanbroker-example-messages_es.propertiesmule-2.0.1/examples/loanbroker/common/src/main/resources/messages/loanbroker-example-messages_es.pro0000644000175000017500000000373110767524553033727 0ustar charlescharles1=Solicitud # {0} recibida: Cliente {1} con identidad = {2} solicita un prstamo del monto = {3} a pagar en {4} meses 2=Cotizacin # {0} recibida: {1} 3=Tasa de inters es de: {0} 4={0}, tasa: {1} 5=Procesando solicitud: {0} 6=La mejor cotizacin es: {0} 7=Perfil crediticia # {0} recibida: puntaje = {1}, antiguedad = {2} 10=Cantidad de cotizaciones recibidas: {0} 11=Solicitud promedia: {0} 12=Sin resultado, debe haber ocurrido una falla, revise los logs. 13=Cotizacin recibida: {0} 14=Finalizando ahora 15=Respuesta no reconocida, intente de nuevo: 16=Ingrese su nombre: 17=Ingrese el monto del prstamo: 18=Ingrese el plazo del prstamo en meses: 19=Plazo invlido: {0}. Usando plazo aleatorio 20=Monto invlido: {0}. Usando monto aleatorio 22=Ingrese cantidad de cotizaciones: 23=Cantidad mnima de cotizaciones es 1 24=Solicitud {0}: {1} 30=Welcome to the Mule Loan Broker ESB example. This example demonstrates using JMS, Web Services,\n Http/Rest and EJBs using an ESB architecture.\nFor more information see http://www.muledocs.org.LoanBroker.\n\nThe example demonstrates integrating EJB applications in 2 ways -\n 1. Calling out to a remote EJB using a Mule Endpoint.\n 2. Managing an EJB as a Mule component.\n\nBoth have the same behavior but the second method allows a remote EJB to be used as if it were\n a local Mule component, thereby enabling tighter integration.\n\nPlease select [1], [2] or [q] quit: 31=Loading 'Ejb via an Endpoint' version 32=Bye 33=Loading 'Managed Ejb Component' version 34=[1] solicitar un prstamo\n[q] salir\n\nSeleccione por favor: 40=Welcome to the Mule Loan Broker example 41=[1] solicitar un prstamo\n[2] enviar 100 solicitudes aleatorias\n[3] enviar X solicitudes aleatorias\n[q] salir\n\nSeleccione por favor: 42=Solicitud asincrnica enviada 43=Which SOAP stack would you like to use: [a]xis or [c]xf? 44=Would you like to run the [s]ynchronous or [a]synchronous version? 45=Loading Asynchronous Loan Broker 46=Loading Synchronous Loan Broker ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/examples/loanbroker/common/src/main/resources/messages/loanbroker-example-messages_de.propertiesmule-2.0.1/examples/loanbroker/common/src/main/resources/messages/loanbroker-example-messages_de.pro0000644000175000017500000000451410767524553033710 0ustar charlescharles 1 = Anfrage Nr. {0} emfpangen: Klient {1} mit Sozialversicherungsnummer {2} erbittet Kredit \u00FCber {3} mit Laufzeit von {4} Monaten 10 = Anzahl empfangener Angebote: {0} 11 = Durchschnittliche Anfrage: {0} 12 = Es wurde kein Ergebnis empfangen, ein Fehler trat auf. \u00DCberpr\u00FCfen Sie die Logs. 13 = Kreditnehmer hat ein Angebot empfangen: {0} 14 = Beende jetzt 15 = Diese Anfrage wurde nicht erkannt, versuchen Sie es erneut: 16 = Geben Sie Ihren Namen ein: 17 = Geben Sie den Kreditbetrag ein: 18 = Geben Sie die Kreditlaufzeit in Monaten an: 19 = Konnte die Dauer nicht parsen: {0}. Benutze zuf\u00E4lligen Wert 2 = Angebot Nr. {0} empfangen: {1} 20 = Konnte den Betrag nicht parsen: {0}. Benutze zuf\u00E4lligen Wert 22 = Geben Sie die Anzahl der Anfragen ein: 23 = Die Anzahl der Anfragen mu\u00DF mindestens 1 sein 24 = Anfrage {0}: {1} 3 = Zahlungsrate: {0} 30 = Willkommen beim Mule Kredit Broker ESB Beispiel. Dieses Beispiel demonstriert die Benutzung von JMS, Web Services,\nHttp/Rest und EJBs zur Benutzung einer ESB Architektur.\nMehr Informationen unter http://www.muledocs.org/LoanBroker.\n\nDas Beispiel demonstriert die Integration von EJBs auf zwei Arten -\n 1. Aufruf einer entfernten EJB unter Benutzung eines Mule Endpoint.\n 2. Verwaltung einer EJB als Mule-Komponente.\n\nBeide Beispiele implementieren das selbe Verhalten aber die zweite Methode erm\u00F6glicht die Benutzung einer entfernten EJB als\n lokale Mule Komponente, wodurch eine engere Integration erm\u00F6glicht wird.\n\nBitte w\u00E4hlen Sie [1], [2] oder [q] zum Verlassen: 31 = Lade 'Ejb via Endpoint' Version 32 = Auf Wiedersehen 33 = Lade 'Managed Ejb Component' Version 34 = [1] Kreditanfrage stellen\n[q] Beenden\n\nBitte treffen Sie eine Auswahl: 4 = {0}, Rate: {1} 40 = Willkommen zum Mule Loan Broker Beispiel 41 = [1] Kreditanfrage stellen\n[2] 100 zuf\u00E4llige Anfragen senden\n[3] X zuf\u00E4llige Anfragen stellen\n[q] Beenden\n\nBitte treffen Sie eine Auswahl: 42 = Asynchrone Anfrage gesendet 43 = Welche SOAP Bibliothek wollen sie benutzen: [a]xis or [c]xf? 44 = M\u00F6chten Sie die [s]ynchrone or [a]synchrone Version starten? 45 = Lade asynchronen Loan Broker 46 = Lade synchronen Loan Broker 5 = Bearbeite Angebot: {0} 6 = Niedrigstes Angebot ist: {0} 7 = Kreditprofil # {0} emfpangen: Bewertung = {1}, Historie = {2} mule-2.0.1/examples/loanbroker/common/pom.xml0000644000175000017500000000222111006063605021053 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 2.0.1 mule-example-loanbroker-common jar Loan Broker Example: Shared classes org.mule mule-core ${version} org.mule.modules mule-module-spring-config ${version} org.mule.modules mule-module-client ${version} mule-2.0.1/examples/loanbroker/credit-agency/0000755000175000017500000000000011351411173020767 5ustar charlescharlesmule-2.0.1/examples/loanbroker/credit-agency/dist/0000755000175000017500000000000011351411173021732 5ustar charlescharlesmule-2.0.1/examples/loanbroker/credit-agency/dist/build.xml0000755000175000017500000000777310767607640023614 0ustar charlescharles mule-2.0.1/examples/loanbroker/credit-agency/dist/pom.xml0000644000175000017500000000562110743652051023261 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 1.0 mule-example-loanbroker-credit-agency ejb Loan Broker Example: Credit Agency EJB openejb openejb-core 1.0 provided castor castor commons-logging commons-logging xerces xercesImpl org.apache.maven.plugins maven-dependency-plugin copy-artifact install copy ${MULE_HOME}/lib/user true true ${groupId} ${artifactId} ${version} ${artifactId}.jar mule-2.0.1/examples/loanbroker/credit-agency/build.xml0000755000175000017500000000777010767607640022646 0ustar charlescharles mule-2.0.1/examples/loanbroker/credit-agency/src/0000755000175000017500000000000011351411173021556 5ustar charlescharlesmule-2.0.1/examples/loanbroker/credit-agency/src/main/0000755000175000017500000000000011351411173022502 5ustar charlescharlesmule-2.0.1/examples/loanbroker/credit-agency/src/main/java/0000755000175000017500000000000011351411173023423 5ustar charlescharlesmule-2.0.1/examples/loanbroker/credit-agency/src/main/java/org/0000755000175000017500000000000011351411173024212 5ustar charlescharlesmule-2.0.1/examples/loanbroker/credit-agency/src/main/java/org/mule/0000755000175000017500000000000011351411173025154 5ustar charlescharlesmule-2.0.1/examples/loanbroker/credit-agency/src/main/java/org/mule/example/0000755000175000017500000000000011351411173026607 5ustar charlescharlesmule-2.0.1/examples/loanbroker/credit-agency/src/main/java/org/mule/example/loanbroker/0000755000175000017500000000000011351411173030745 5ustar charlescharlesmule-2.0.1/examples/loanbroker/credit-agency/src/main/java/org/mule/example/loanbroker/credit/0000755000175000017500000000000011351411173032217 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/examples/loanbroker/credit-agency/src/main/java/org/mule/example/loanbroker/credit/CreditAgency.javamule-2.0.1/examples/loanbroker/credit-agency/src/main/java/org/mule/example/loanbroker/credit/Credit0000644000175000017500000000136310754375733033400 0ustar charlescharles/* * $Id: CreditAgency.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.credit; import java.rmi.RemoteException; import javax.ejb.EJBObject; /** * CreditAgency defines the interface for the credit agency service */ public interface CreditAgency extends EJBObject { public String getCreditProfile(String name, Integer ssn) throws RemoteException; } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/examples/loanbroker/credit-agency/src/main/java/org/mule/example/loanbroker/credit/CreditAgencyHome.javamule-2.0.1/examples/loanbroker/credit-agency/src/main/java/org/mule/example/loanbroker/credit/Credit0000644000175000017500000000143010754375733033373 0ustar charlescharles/* * $Id: CreditAgencyHome.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.credit; import java.rmi.RemoteException; import javax.ejb.CreateException; import javax.ejb.EJBHome; /** * CreditAgencyHome the home inteface for the credit agency service */ public interface CreditAgencyHome extends EJBHome { public abstract CreditAgency create() throws RemoteException, CreateException; } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/examples/loanbroker/credit-agency/src/main/java/org/mule/example/loanbroker/credit/CreditAgencyBean.javamule-2.0.1/examples/loanbroker/credit-agency/src/main/java/org/mule/example/loanbroker/credit/Credit0000644000175000017500000000433210754375733033377 0ustar charlescharles/* * $Id: CreditAgencyBean.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.credit; import java.text.MessageFormat; import javax.ejb.EJBException; import javax.ejb.SessionBean; import javax.ejb.SessionContext; /** * CreditAgencyBean obtains a credit historey record for a customer. */ public class CreditAgencyBean implements SessionBean { private static final long serialVersionUID = 1546168214387311746L; private static final String MSG = "{0}{1}{2}{3}"; public void ejbActivate() throws EJBException { // nothing to do } public void ejbPassivate() throws EJBException { // nothing to do } public void ejbRemove() throws EJBException { // nothing to do } public void ejbCreate() throws EJBException { // nothing to do } public void setSessionContext(SessionContext sessionContext) throws EJBException { // SessionContext can be ignored } protected int getCreditScore(int ssn) { int credit_score; credit_score = (int)(Math.random() * 600 + 300); return credit_score; } protected int getCreditHistoryLength(int ssn) { int credit_history_length; credit_history_length = (int)(Math.random() * 19 + 1); return credit_history_length; } /** * Used by Ejb Call * * @param name * @param ssn * @return */ public String getCreditProfile(String name, Integer ssn) { String msg = MessageFormat.format(MSG, new Object[]{name, ssn, new Integer(getCreditScore(ssn.intValue())), new Integer(getCreditHistoryLength(ssn.intValue()))}); return msg; } } mule-2.0.1/examples/loanbroker/credit-agency/src/main/resources/0000755000175000017500000000000011351411173024514 5ustar charlescharlesmule-2.0.1/examples/loanbroker/credit-agency/src/main/resources/META-INF/0000755000175000017500000000000011351411173025654 5ustar charlescharlesmule-2.0.1/examples/loanbroker/credit-agency/src/main/resources/META-INF/ejb-jar.xml0000644000175000017500000000123710754375733027734 0ustar charlescharles /local/CreditAgency org.mule.example.loanbroker.credit.CreditAgencyHome org.mule.example.loanbroker.credit.CreditAgency org.mule.example.loanbroker.credit.CreditAgencyBean Stateless Bean mule-2.0.1/examples/loanbroker/credit-agency/src/main/resources/META-INF/openejb-jar.xml0000644000175000017500000000052610577411741030607 0ustar charlescharles mule-2.0.1/examples/loanbroker/credit-agency/pom.xml0000644000175000017500000000400511006063605022303 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 2.0.1 mule-example-loanbroker-credit-agency ejb Loan Broker Example: Credit Agency EJB openejb openejb-core 1.0 provided backport-util-concurrent backport-util-concurrent castor castor commons-logging commons-logging xerces xercesImpl xml-apis xml-apis mule-2.0.1/examples/loanbroker/esb/0000755000175000017500000000000011351411172017021 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/conf/0000755000175000017500000000000011351411172017746 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/conf/loan-broker-esb-mule-config.xml0000644000175000017500000002305510762044052025666 0ustar charlescharles The Loan Broker ESB example implements the Loan Broker Example using an ESB topology. See http://mule.mulesource.org/wiki/display/MULE/LoanBroker+ESB for details. mule-2.0.1/examples/loanbroker/esb/conf/openejb.properties0000644000175000017500000000024410767745367023540 0ustar charlescharlesopenejb.base=${mule.home.unix} openejb.configuration=${openejb.base}/lib/user/openejb.conf logging.conf=${openejb.base}/conf/log4j.properties openejb.nobanner=true mule-2.0.1/examples/loanbroker/esb/conf/loan-broker-esb-mule-config-with-ejb-container.xml0000644000175000017500000002663310762044052031362 0ustar charlescharles The Loan Broker ESB example implements the Loan Broker Example using an ESB topology. See http://mule.mulesource.org/wiki/display/MULE/LoanBroker+ESB for details. java.naming.factory.initial=org.openejb.client.LocalInitialContextFactory java.naming.provider.url=rmi://localhost:1099 openejb.base=${openejb.base} openejb.configuration=${openejb.configuration} logging.conf=${logging.conf} openejb.nobanner=${openejb.nobanner} mule-2.0.1/examples/loanbroker/esb/conf/logging.conf0000644000175000017500000000034410672263414022255 0ustar charlescharleslog4j.rootCategory=ERROR, console # Console log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%-5p %C{1} : %m%n mule-2.0.1/examples/loanbroker/esb/dist/0000755000175000017500000000000011351411172017764 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/dist/build.xml0000755000175000017500000001277110767607640021641 0ustar charlescharles mule-2.0.1/examples/loanbroker/esb/dist/pom.xml0000644000175000017500000002517210767744553021336 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 1.0 mule-example-loanbroker-esb jar Loan Broker ESB Example org.mule.examples mule-example-loanbroker-common ${muleVersion} org.mule.examples mule-example-loanbroker-common-tests ${muleVersion} test org.mule.examples mule-example-loanbroker-credit-agency ${muleVersion} openejb openejb-core 1.0 provided backport-util-concurrent backport-util-concurrent castor castor commons-logging commons-logging xerces xercesImpl xml-apis xml-apis castor castor 1.0 provided org.apache.activemq activemq-core 4.1.0-incubator provided org.apache.geronimo.specs geronimo-jms_1.1_spec org.apache.activemq activemq-jaas commons-pool commons-pool org.apache.derby derby activemq jmdns xalan xalan org.apache.xbean xbean-spring org.springframework spring org.apache.geronimo.specs geronimo-jta_1.0.1B_spec org.apache.geronimo.specs geronimo-j2ee-jacc_1.0_spec backport-util-concurrent backport-util-concurrent commons-logging commons-logging howl howl-logger log4j log4j geronimo geronimo-kernel geronimo geronimo-j2ee activesoap jaxp-api mx4j mx4j-jmx mx4j mx4j-remote mx4j mx4j-tools mx4j mx4j-impl org.mule.modules mule-module-spring-config ${muleVersion} org.mule.transports mule-transport-ejb ${muleVersion} org.mule.transports mule-transport-jms ${muleVersion} org.mule.transports mule-transport-vm ${muleVersion} org.mule.transports mule-transport-axis ${muleVersion} org.mule.modules mule-module-spring-extras ${muleVersion} org.springframework spring-aop 2.0.7 org.apache.maven.plugins maven-dependency-plugin copy-artifact install copy ${MULE_HOME}/lib/user true true ${groupId} ${artifactId} ${version} ${artifactId}.jar org.apache.activemq activemq-core 4.1.0-incubator org.apache.activemq activeio-core 3.0.0-incubator openejb openejb-core 1.0 castor castor 1.0 mule-2.0.1/examples/loanbroker/esb/build.xml0000755000175000017500000001277410767607640020701 0ustar charlescharles mule-2.0.1/examples/loanbroker/esb/src/0000755000175000017500000000000011351411172017610 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/main/0000755000175000017500000000000011351411172020534 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/main/java/0000755000175000017500000000000011351411172021455 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/main/java/org/0000755000175000017500000000000011351411172022244 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/main/java/org/mule/0000755000175000017500000000000011351411172023206 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/main/java/org/mule/example/0000755000175000017500000000000011351411172024641 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/main/java/org/mule/example/loanbroker/0000755000175000017500000000000011351411172026777 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/main/java/org/mule/example/loanbroker/esb/0000755000175000017500000000000011351411172027550 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/main/java/org/mule/example/loanbroker/esb/LoanBrokerApp.java0000644000175000017500000000317210754375733033137 0ustar charlescharles/* * $Id: LoanBrokerApp.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esb; import org.mule.example.loanbroker.AbstractLoanBrokerApp; import org.mule.example.loanbroker.LocaleMessage; import java.io.IOException; /** * Runs the LoanBroker ESB example application. */ public class LoanBrokerApp extends AbstractLoanBrokerApp { public LoanBrokerApp(String config) throws Exception { super(config); } public static void main(String[] args) throws Exception { LoanBrokerApp loanBrokerApp = null; loanBrokerApp = new LoanBrokerApp(getInteractiveConfig()); loanBrokerApp.run(false); } protected static String getInteractiveConfig() throws IOException { int response = 0; System.out.println("******************\n" + LocaleMessage.esbWelcome() + "\n******************"); response = readCharacter(); if (response == '1') { System.out.println(LocaleMessage.loadingEndpointEjb()); return "loan-broker-esb-mule-config.xml"; } else { System.out.println(LocaleMessage.loadingManagedEjb()); return "loan-broker-esb-mule-config-with-ejb-container.xml"; } } } mule-2.0.1/examples/loanbroker/esb/src/main/resources/0000755000175000017500000000000011351411172022546 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/main/resources/castor.properties0000644000175000017500000000045510730610372026166 0ustar charlescharles# # In order to work correctly with JDK 1.5+ we need to UNDO Castor's bizarre idea of # default configuration properties, which just so happen to be hardcoded dependencies # on Xerces. WTF? JAXP has existed for how many years now? # org.exolab.castor.parser= org.exolab.castor.xml.serializer.factory= mule-2.0.1/examples/loanbroker/esb/src/main/resources/security.policy0000644000175000017500000000020710577411741025650 0ustar charlescharles/* AUTOMATICALLY GENERATED ON Tue May 03 13:51:07 CEST 2005*/ /* DO NOT EDIT */ grant { permission java.security.AllPermission; }; mule-2.0.1/examples/loanbroker/esb/src/main/resources/openejb.conf0000644000175000017500000000025010672263414025045 0ustar charlescharles mule-2.0.1/examples/loanbroker/esb/src/test/0000755000175000017500000000000011351411172020567 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/test/java/0000755000175000017500000000000011351411172021510 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/test/java/org/0000755000175000017500000000000011351411172022277 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/0000755000175000017500000000000011351411172023241 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/0000755000175000017500000000000011351411172024674 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/0000755000175000017500000000000011351411172027032 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/esb/0000755000175000017500000000000011351411172027603 5ustar charlescharles././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/esb/LoanBrokerEsbContainerTestCase.javamule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/esb/LoanBrokerEsbContai0000644000175000017500000000136510754375733033403 0ustar charlescharles/* * $Id: LoanBrokerEsbContainerTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esb; import org.mule.example.loanbroker.tests.AbstractLoanBrokerTestCase; public class LoanBrokerEsbContainerTestCase extends AbstractLoanBrokerTestCase { protected String getConfigResources() { return "loan-broker-esb-mule-config-with-ejb-container.xml"; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/esb/LoanBrokerEsbTestCase.javamule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/esb/LoanBrokerEsbTestCa0000644000175000017500000000132010754375733033340 0ustar charlescharles/* * $Id: LoanBrokerEsbTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esb; import org.mule.example.loanbroker.tests.AbstractLoanBrokerTestCase; public class LoanBrokerEsbTestCase extends AbstractLoanBrokerTestCase { protected String getConfigResources() { return "loan-broker-esb-mule-config.xml"; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/esb/LoanBrokerEsbConfigurationBuilder.javamule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/esb/LoanBrokerEsbConfig0000644000175000017500000004111710777664077033401 0ustar charlescharles/* * $Id: LoanBrokerEsbConfigurationBuilder.java 11569 2008-04-11 13:31:43Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esb; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.model.Model; import org.mule.api.registry.Registry; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.routing.OutboundRouterCollection; import org.mule.api.routing.ResponseRouterCollection; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.component.PooledJavaComponent; import org.mule.component.builder.ReflectionMessageBuilder; import org.mule.config.builders.AbstractConfigurationBuilder; import org.mule.config.builders.DefaultsConfigurationBuilder; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.endpoint.URIBuilder; import org.mule.example.loanbroker.AsynchronousLoanBroker; import org.mule.example.loanbroker.bank.Bank; import org.mule.example.loanbroker.lender.DefaultLender; import org.mule.example.loanbroker.routers.BankQuotesResponseAggregator; import org.mule.example.loanbroker.transformers.CreditProfileXmlToCreditProfile; import org.mule.example.loanbroker.transformers.LoanQuoteRequestToCreditProfileArgs; import org.mule.example.loanbroker.transformers.RestRequestToCustomerRequest; import org.mule.example.loanbroker.transformers.SetLendersAsRecipients; import org.mule.model.seda.SedaModel; import org.mule.model.seda.SedaService; import org.mule.object.PrototypeObjectFactory; import org.mule.routing.filters.MessagePropertyFilter; import org.mule.routing.inbound.DefaultInboundRouterCollection; import org.mule.routing.outbound.DefaultOutboundRouterCollection; import org.mule.routing.outbound.FilteringOutboundRouter; import org.mule.routing.outbound.OutboundPassThroughRouter; import org.mule.routing.outbound.StaticRecipientList; import org.mule.routing.response.DefaultResponseRouterCollection; import org.mule.transport.ejb.EjbConnector; import org.mule.transport.jms.activemq.ActiveMQJmsConnector; import org.mule.transport.jms.transformers.ObjectToJMSMessage; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class LoanBrokerEsbConfigurationBuilder extends AbstractConfigurationBuilder implements ConfigurationBuilder { @Override protected void doConfigure(MuleContext muleContext) throws Exception { // Set defaults new DefaultsConfigurationBuilder().configure(muleContext); Registry registry = muleContext.getRegistry(); // Connectors EjbConnector ejbConnector = new EjbConnector(); ejbConnector.setName("ejbConnector"); ejbConnector.setSecurityPolicy("security.policy"); ejbConnector.setJndiInitialFactory("org.openejb.client.LocalInitialContextFactory"); Map jndiProviderProperties = new HashMap(); jndiProviderProperties.put("openejb.base", "${openejb.base}"); jndiProviderProperties.put("openejb.configuration", "${openejb.configuration}"); jndiProviderProperties.put("logging.conf", "${logging.conf}"); jndiProviderProperties.put("openejb.nobanner", "${openejb.nobanner}"); ejbConnector.setJndiProviderProperties(jndiProviderProperties); ActiveMQJmsConnector activeMQJmsConnector = new ActiveMQJmsConnector(); activeMQJmsConnector.setName("activeMQJmsConnector"); registry.registerConnector(activeMQJmsConnector); // Global Transformers Transformer RestRequestToCustomerRequest = new RestRequestToCustomerRequest(); RestRequestToCustomerRequest.setName("RestRequestToCustomerRequest"); registry.registerTransformer(RestRequestToCustomerRequest); Transformer LoanQuoteRequestToCreditProfileArgs = new LoanQuoteRequestToCreditProfileArgs(); registry.registerTransformer(LoanQuoteRequestToCreditProfileArgs); Transformer CreditProfileXmlToCreditProfile = new CreditProfileXmlToCreditProfile(); registry.registerTransformer(CreditProfileXmlToCreditProfile); Transformer SetLendersAsRecipients = new SetLendersAsRecipients(); registry.registerTransformer(SetLendersAsRecipients); Transformer ObjectToJMSMessage = new ObjectToJMSMessage(); registry.registerTransformer(ObjectToJMSMessage); // Global Endpoints EndpointBuilder CustomerRequestsREST = new EndpointURIEndpointBuilder(new URIBuilder( "jetty:rest://localhost:8888/loanbroker"), muleContext); registry.registerEndpointBuilder("CustomerRequestsREST", CustomerRequestsREST); EndpointBuilder CustomerRequests = new EndpointURIEndpointBuilder(new URIBuilder("vm://customer.requests"), muleContext); registry.registerEndpointBuilder("CustomerRequests", CustomerRequests); EndpointBuilder LoanQuotes = new EndpointURIEndpointBuilder(new URIBuilder("axis:http://localhost:10080/mule"), muleContext); registry.registerEndpointBuilder("LoanQuotes", LoanQuotes); EndpointBuilder CustomerResponses = LoanQuotes; registry.registerEndpointBuilder("CustomerResponses", CustomerResponses); EndpointBuilder CreditAgencyGateway = new EndpointURIEndpointBuilder(new URIBuilder("jms://esb.credit.agency"), muleContext); registry.registerEndpointBuilder("CreditAgencyGateway", CreditAgencyGateway); EndpointBuilder CreditAgency = new EndpointURIEndpointBuilder(new URIBuilder( "ejb://localhost:1099/local/CreditAgency?method=getCreditProfile"), muleContext); registry.registerEndpointBuilder("CreditAgency", CreditAgency); EndpointBuilder LenderGateway = new EndpointURIEndpointBuilder(new URIBuilder("jms://esb.lender.service"), muleContext); registry.registerEndpointBuilder("LenderGateway", LenderGateway); EndpointBuilder LenderService = new EndpointURIEndpointBuilder(new URIBuilder("vm://lender.service"), muleContext); registry.registerEndpointBuilder("LenderService", LenderService); EndpointBuilder BankingGateway = new EndpointURIEndpointBuilder(new URIBuilder("jms://esb.banks"), muleContext); EndpointBuilder bank1 = new EndpointURIEndpointBuilder(new URIBuilder( "axis:http://localhost:10080/mule/TheBank1?method=getLoanQuote"), muleContext); registry.registerEndpointBuilder("bank1", bank1); EndpointBuilder bank2 = new EndpointURIEndpointBuilder(new URIBuilder( "axis:http://localhost:20080/mule/TheBank2?method=getLoanQuote"), muleContext); registry.registerEndpointBuilder("bank2", bank2); EndpointBuilder bank3 = new EndpointURIEndpointBuilder(new URIBuilder( "axis:http://localhost:30080/mule/TheBank3?method=getLoanQuote"), muleContext); registry.registerEndpointBuilder("bank3", bank3); EndpointBuilder bank4 = new EndpointURIEndpointBuilder(new URIBuilder( "axis:http://localhost:40080/mule/TheBank4?method=getLoanQuote"), muleContext); registry.registerEndpointBuilder("bank4", bank4); EndpointBuilder bank1In = new EndpointURIEndpointBuilder(new URIBuilder("axis:http://localhost:10080/mule"), muleContext); registry.registerEndpointBuilder("bank1In", bank1In); EndpointBuilder bank2In = new EndpointURIEndpointBuilder(new URIBuilder("axis:http://localhost:20080/mule"), muleContext); registry.registerEndpointBuilder("bank2In", bank2In); EndpointBuilder bank3In = new EndpointURIEndpointBuilder(new URIBuilder("axis:http://localhost:30080/mule"), muleContext); registry.registerEndpointBuilder("bank3In", bank3In); EndpointBuilder bank4In = new EndpointURIEndpointBuilder(new URIBuilder("axis:http://localhost:40080/mule"), muleContext); registry.registerEndpointBuilder("bank4In", bank4In); // Model Model model = new SedaModel(); model.setName("model"); registry.registerModel(model); // LoanBroker Service Service loanBrokerService = new SedaService(); loanBrokerService.setName("LoanBroker"); loanBrokerService.setModel(model); loanBrokerService.setComponent(new PooledJavaComponent(new PrototypeObjectFactory(AsynchronousLoanBroker.class))); // in InboundRouterCollection loanBrokerServiceInbound = new DefaultInboundRouterCollection(); loanBrokerServiceInbound.addEndpoint(CustomerRequestsREST.buildInboundEndpoint()); EndpointBuilder eb = (EndpointBuilder) CustomerRequests.clone(); eb.addTransformer(RestRequestToCustomerRequest); loanBrokerServiceInbound.addEndpoint(eb.buildInboundEndpoint()); loanBrokerService.setInboundRouter(loanBrokerServiceInbound); // out OutboundRouterCollection loanBrokerServiceOutbound = new DefaultOutboundRouterCollection(); OutboundPassThroughRouter outboundPassThroughRouter = new OutboundPassThroughRouter(); outboundPassThroughRouter.addEndpoint(CreditAgency.buildOutboundEndpoint()); loanBrokerServiceOutbound.addRouter(outboundPassThroughRouter); loanBrokerService.setOutboundRouter(loanBrokerServiceOutbound); // reply ResponseRouterCollection responseRouterCollection = new DefaultResponseRouterCollection(); responseRouterCollection.addEndpoint(LoanQuotes.buildInboundEndpoint()); responseRouterCollection.addRouter(new BankQuotesResponseAggregator()); loanBrokerService.setResponseRouter(responseRouterCollection); registry.registerService(loanBrokerService); // CreditAgencyGatewayService Service Service creditAgencyGatewayService = new SedaService(); creditAgencyGatewayService.setName("CreditAgencyGatewayService"); creditAgencyGatewayService.setModel(model); creditAgencyGatewayService.setComponent(new PooledJavaComponent(new PrototypeObjectFactory(ReflectionMessageBuilder.class))); // in InboundRouterCollection creditAgencyGatewayServiceInbound = new DefaultInboundRouterCollection(); creditAgencyGatewayServiceInbound.addEndpoint(CreditAgencyGateway.buildInboundEndpoint()); creditAgencyGatewayService.setInboundRouter(creditAgencyGatewayServiceInbound); // out OutboundRouterCollection creditAgencyGatewayServiceOutbound = new DefaultOutboundRouterCollection(); FilteringOutboundRouter creditAgencyGatewayServiceOutboundRouter = new FilteringOutboundRouter(); EndpointBuilder eb2 = (EndpointBuilder) CreditAgency.clone(); eb2.addTransformer(LoanQuoteRequestToCreditProfileArgs); eb2.setRemoteSync(true); List responseTransformers = new ArrayList(); responseTransformers.add(CreditProfileXmlToCreditProfile); eb2.setResponseTransformers(responseTransformers); creditAgencyGatewayServiceOutboundRouter.addEndpoint(eb2.buildOutboundEndpoint()); creditAgencyGatewayServiceOutboundRouter.addEndpoint(LenderGateway.buildOutboundEndpoint()); creditAgencyGatewayServiceOutbound.addRouter(creditAgencyGatewayServiceOutboundRouter); creditAgencyGatewayService.setOutboundRouter(creditAgencyGatewayServiceOutbound); registry.registerService(creditAgencyGatewayService); // LenderGatewayService Service Service lenderGatewayService = new SedaService(); lenderGatewayService.setName("CreditAgencyGatewayService"); lenderGatewayService.setModel(model); // in InboundRouterCollection lenderGatewayServiceInbound = new DefaultInboundRouterCollection(); lenderGatewayServiceInbound.addEndpoint(LenderGateway.buildInboundEndpoint()); lenderGatewayService.setInboundRouter(lenderGatewayServiceInbound); // out OutboundRouterCollection lenderGatewayServiceInboundOutbound = new DefaultOutboundRouterCollection(); FilteringOutboundRouter lenderGatewayServiceInboundOutboundRouter = new FilteringOutboundRouter(); EndpointBuilder eb3 = (EndpointBuilder) LenderService.clone(); eb3.setRemoteSync(true); lenderGatewayServiceInboundOutboundRouter.addEndpoint(eb3.buildOutboundEndpoint()); EndpointBuilder eb4 = (EndpointBuilder) BankingGateway.clone(); eb4.addTransformer(SetLendersAsRecipients); eb4.addTransformer(ObjectToJMSMessage); lenderGatewayServiceInboundOutboundRouter.addEndpoint(eb4.buildOutboundEndpoint()); lenderGatewayServiceInboundOutbound.addRouter(lenderGatewayServiceInboundOutboundRouter); lenderGatewayService.setOutboundRouter(lenderGatewayServiceInboundOutbound); registry.registerService(lenderGatewayService); // LenderServiceService Service Service lenderServiceService = new SedaService(); lenderServiceService.setName("LenderServiceService"); lenderServiceService.setModel(model); lenderGatewayService.setComponent(new PooledJavaComponent(new PrototypeObjectFactory(DefaultLender.class))); // in InboundRouterCollection lenderServiceServiceInbound = new DefaultInboundRouterCollection(); lenderServiceServiceInbound.addEndpoint(LenderService.buildInboundEndpoint()); lenderServiceService.setInboundRouter(lenderServiceServiceInbound); registry.registerService(lenderGatewayService); // BankingGatewayService Service Service bankingGatewayService = new SedaService(); bankingGatewayService.setName("BankingGatewayService"); bankingGatewayService.setModel(model); // in InboundRouterCollection bankingGatewayServiceInbound = new DefaultInboundRouterCollection(); bankingGatewayServiceInbound.addEndpoint(BankingGateway.buildInboundEndpoint()); bankingGatewayService.setInboundRouter(bankingGatewayServiceInbound); // out OutboundRouterCollection bankingGatewayServiceOutbound = new DefaultOutboundRouterCollection(); StaticRecipientList staticRecipientList = new StaticRecipientList(); staticRecipientList.setReplyTo("LoanQuotes"); staticRecipientList.setFilter(new MessagePropertyFilter("recipients!=null")); registry.registerService(lenderGatewayService); // Bank 1 Service Service bank1Service = new SedaService(); bank1Service.setName("TheBank1"); bank1Service.setModel(model); bank1Service.setComponent(new PooledJavaComponent(new PrototypeObjectFactory(Bank.class))); InboundRouterCollection bank1ServiceInbound = new DefaultInboundRouterCollection(); bank1ServiceInbound.addEndpoint(bank1In.buildInboundEndpoint()); bank1Service.setInboundRouter(bank1ServiceInbound); registry.registerService(bank1Service); // Bank 2 Service Service bank2Service = new SedaService(); bank2Service.setName("TheBank2"); bank2Service.setModel(model); bank2Service.setComponent(new PooledJavaComponent(new PrototypeObjectFactory(Bank.class))); InboundRouterCollection bank2ServiceInbound = new DefaultInboundRouterCollection(); bank2ServiceInbound.addEndpoint(bank2In.buildInboundEndpoint()); bank2Service.setInboundRouter(bank2ServiceInbound); registry.registerService(bank2Service); // Bank 3 Service Service bank3Service = new SedaService(); bank3Service.setName("TheBank3"); bank3Service.setModel(model); bank3Service.setComponent(new PooledJavaComponent(new PrototypeObjectFactory(Bank.class))); InboundRouterCollection bank3ServiceInbound = new DefaultInboundRouterCollection(); bank3ServiceInbound.addEndpoint(bank3In.buildInboundEndpoint()); bank3Service.setInboundRouter(bank3ServiceInbound); registry.registerService(bank3Service); // Bank 4 Service Service bank4Service = new SedaService(); bank4Service.setName("TheBank4"); bank4Service.setModel(model); bank4Service.setComponent(new PooledJavaComponent(new PrototypeObjectFactory(Bank.class))); InboundRouterCollection bank4ServiceInbound = new DefaultInboundRouterCollection(); bank4ServiceInbound.addEndpoint(bank4In.buildInboundEndpoint()); bank4Service.setInboundRouter(bank4ServiceInbound); registry.registerService(bank4Service); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/esb/LoanBrokerEsbProgramaticTestCase.javamule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/esb/LoanBrokerEsbProgra0000644000175000017500000000165710770356575033425 0ustar charlescharles/* * $Id: LoanBrokerEsbProgramaticTestCase.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.esb; import org.mule.api.config.ConfigurationBuilder; import org.mule.example.loanbroker.tests.AbstractLoanBrokerTestCase; public class LoanBrokerEsbProgramaticTestCase extends AbstractLoanBrokerTestCase { protected String getConfigResources() { return "loan-broker-esb-mule-config.xml"; } @Override protected ConfigurationBuilder getBuilder() throws Exception { return new LoanBrokerEsbConfigurationBuilder(); } } mule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/issues/0000755000175000017500000000000011351411172030345 5ustar charlescharles././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/issues/TransformersMule2669TestCase.javamule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/issues/TransformersMule0000644000175000017500000000321410754375733033622 0ustar charlescharles/* * $Id: TransformersMule2669TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.issues; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.example.loanbroker.bank.Bank; import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.Iterator; import java.util.Set; public class TransformersMule2669TestCase extends FunctionalTestCase { protected String getConfigResources() { return "transformers-mule-2669.xml"; } public void testTransformers() throws MuleException { MuleClient client = new MuleClient(); LoanBrokerQuoteRequest request = new LoanBrokerQuoteRequest(); request.setLenders(new Bank[0]); MuleMessage response = client.send("jms://in?connector=default", request, null); assertNotNull(response); assertNull(response.getExceptionPayload()); Set propertyNames = response.getPropertyNames(); assertTrue(propertyNames.size() > 0); Iterator names = propertyNames.iterator(); while (names.hasNext()) { logger.debug(names.next()); } assertTrue(propertyNames.contains("recipients")); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/issues/SimpleEchoComponent.javamule-2.0.1/examples/loanbroker/esb/src/test/java/org/mule/example/loanbroker/issues/SimpleEchoCompon0000644000175000017500000000167510754375733033527 0ustar charlescharles/* * $Id: SimpleEchoComponent.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.issues; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class SimpleEchoComponent implements Callable { private Log logger = LogFactory.getLog(getClass()); public Object onCall(MuleEventContext context) throws Exception { Object message = context.transformMessage(); logger.debug("received " + message); return message; } } mule-2.0.1/examples/loanbroker/esb/src/test/resources/0000755000175000017500000000000011351411172022601 5ustar charlescharlesmule-2.0.1/examples/loanbroker/esb/src/test/resources/transformers-mule-2669.xml0000644000175000017500000000364610754375733027447 0ustar charlescharles mule-2.0.1/examples/loanbroker/esb/src/test/resources/log4j.properties0000644000175000017500000000063610745677442025767 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages #log4j.logger.org.mule=DEBUG # debug for tracing copies in request context #log4j.logger.org.mule.RequestContext=DEBUG mule-2.0.1/examples/loanbroker/esb/src/test/resources/openejb.properties0000644000175000017500000000017610577411741026360 0ustar charlescharlesopenejb.base=. openejb.configuration=src/test/resources/openejb.conf logging.conf=conf/log4j.properties openejb.nobanner=true mule-2.0.1/examples/loanbroker/esb/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000032310754375733027473 0ustar charlescharles# # Test cases listed in this file are not run. # # Fails because it can't find axis transport! Classloading issue when loading axis.properties. org.mule.example.loanbroker.esb.LoanBrokerEsbProgramaticTestCase mule-2.0.1/examples/loanbroker/esb/src/test/resources/openejb.conf0000644000175000017500000000022210577411741025101 0ustar charlescharles mule-2.0.1/examples/loanbroker/esb/pom.xml0000644000175000017500000001056311006063605020344 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 2.0.1 mule-example-loanbroker-esb jar Loan Broker ESB Example org.mule.examples mule-example-loanbroker-common ${version} org.mule.examples mule-example-loanbroker-common-tests ${version} test org.mule.examples mule-example-loanbroker-credit-agency ${version} openejb openejb-core 1.0 provided backport-util-concurrent backport-util-concurrent castor castor commons-logging commons-logging xerces xercesImpl xml-apis xml-apis castor castor 1.0 provided org.apache.activemq activemq-core provided org.mule.modules mule-module-spring-config ${version} org.mule.transports mule-transport-ejb ${version} org.mule.transports mule-transport-jms ${version} org.mule.transports mule-transport-vm ${version} org.mule.transports mule-transport-axis ${version} org.mule.transports mule-transport-cxf ${version} org.mule.modules mule-module-spring-extras ${version} mule-2.0.1/examples/loanbroker/bpm/0000755000175000017500000000000011351411173017027 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/conf/0000755000175000017500000000000011351411173017754 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/conf/loan-broker-process.xml0000644000175000017500000001406510754375733024414 0ustar charlescharles xmlns="http://jbpm.org/3/jpdl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jbpm.org/3/jpdl http://jbpm.org/jpdl-3.1.xsd" CustomerRequests customerRequest customerRequest.customer CreditAgency false CreditProfiles creditProfile = 20000}]]> = 24}]]> = 5}]]> BigBank loanRequest = 10000}]]> = 12}]]> = 3}]]> MediumBank loanRequest = 6}]]> = 1}]]> SmallBank loanRequest org.mule.example.loanbroker.messages.LoanQuote CustomerResponses false mule-2.0.1/examples/loanbroker/bpm/conf/derby.properties0000644000175000017500000000015110676746663023224 0ustar charlescharlesdatabase.name=muleEmbeddedDB database.connection=jdbc:derby:${database.name};sql.enforce_strict_size=truemule-2.0.1/examples/loanbroker/bpm/conf/loan-broker-bpm-mule-config.xml0000644000175000017500000002246610777653124025721 0ustar charlescharles jbpm.cfg.xml loan-broker-process.xml false classpath*:/org/jbpm/**/*.hbm.xml org.hibernate.dialect.DerbyDialect org.hibernate.cache.HashtableCacheProvider update org.apache.derby.jdbc.EmbeddedDriver ${database.connection} string_max org.jbpm.db.hibernate.StringMax mule-2.0.1/examples/loanbroker/bpm/dist/0000755000175000017500000000000011351411172017771 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/dist/build.xml0000755000175000017500000001142110767607640021635 0ustar charlescharles mule-2.0.1/examples/loanbroker/bpm/dist/pom.xml0000644000175000017500000001006510714605712021317 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 1.0 mule-example-loanbroker-bpm jar Loan Broker BPM Example org.mule.examples mule-example-loanbroker-common ${muleVersion} org.mule.examples mule-example-loanbroker-common-tests ${muleVersion} test org.mule.transports mule-transport-jbpm ${muleVersion} org.mule.transports mule-transport-jdbc ${muleVersion} org.mule.transports mule-transport-vm ${muleVersion} bsh bsh 1.3.0 provided org.apache.derby derby 10.3.1.4 test org.apache.maven.plugins maven-dependency-plugin copy-artifact install copy ${MULE_HOME}/lib/user true true ${groupId} ${artifactId} ${version} ${artifactId}.jar org.apache.derby derby 10.3.1.4 bsh bsh 1.3.0 mule-2.0.1/examples/loanbroker/bpm/build.xml0000755000175000017500000001061010767607640020671 0ustar charlescharles mule-2.0.1/examples/loanbroker/bpm/src/0000755000175000017500000000000011351411173017616 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/main/0000755000175000017500000000000011351411173020542 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/main/java/0000755000175000017500000000000011351411173021463 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/main/java/org/0000755000175000017500000000000011351411173022252 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/main/java/org/mule/0000755000175000017500000000000011351411173023214 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/main/java/org/mule/example/0000755000175000017500000000000011351411173024647 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/main/java/org/mule/example/loanbroker/0000755000175000017500000000000011351411173027005 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/main/java/org/mule/example/loanbroker/bpm/0000755000175000017500000000000011351411173027563 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/main/java/org/mule/example/loanbroker/bpm/actions/0000755000175000017500000000000011351411173031223 5ustar charlescharles././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/examples/loanbroker/bpm/src/main/java/org/mule/example/loanbroker/bpm/actions/PrepareLoanQuoteRequest.javamule-2.0.1/examples/loanbroker/bpm/src/main/java/org/mule/example/loanbroker/bpm/actions/PrepareLoan0000644000175000017500000000271210767505705033377 0ustar charlescharles/* * $Id: PrepareLoanQuoteRequest.java 11394 2008-03-17 15:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.bpm.actions; import org.mule.example.loanbroker.messages.CreditProfile; import org.mule.example.loanbroker.messages.CustomerQuoteRequest; import org.mule.example.loanbroker.messages.LoanBrokerQuoteRequest; import org.mule.transport.bpm.jbpm.actions.LoggingActionHandler; import org.jbpm.graph.exe.ExecutionContext; /** * Prepares a loan request for the banks based on the original customer request and the customer's * credit profile. */ public class PrepareLoanQuoteRequest extends LoggingActionHandler { @Override public void execute(ExecutionContext executionContext) throws Exception { super.execute(executionContext); LoanBrokerQuoteRequest loanRequest = new LoanBrokerQuoteRequest(); loanRequest.setCustomerRequest((CustomerQuoteRequest) executionContext.getVariable("customerRequest")); loanRequest.setCreditProfile((CreditProfile) executionContext.getVariable("creditProfile")); executionContext.setVariable("loanRequest", loanRequest); } } mule-2.0.1/examples/loanbroker/bpm/src/main/java/org/mule/example/loanbroker/bpm/LoanBrokerApp.java0000644000175000017500000000233710767505705033151 0ustar charlescharles/* * $Id: LoanBrokerApp.java 11394 2008-03-17 15:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.bpm; import org.mule.example.loanbroker.AbstractLoanBrokerApp; import org.mule.transport.jdbc.util.MuleDerbyUtils; /** * Executes the LoanBroker BPM example. */ public class LoanBrokerApp extends AbstractLoanBrokerApp { public LoanBrokerApp(String config) throws Exception { super(config); } public static void main(String[] args) throws Exception { LoanBrokerApp loanBrokerApp = new LoanBrokerApp("loan-broker-bpm-mule-config.xml"); loanBrokerApp.run(false); } @Override protected void init() throws Exception { // before initialisation occurs, the database must be cleaned and a new one created MuleDerbyUtils.defaultDerbyCleanAndInit("derby.properties", "database.name"); super.init(); } } mule-2.0.1/examples/loanbroker/bpm/src/main/resources/0000755000175000017500000000000011351411173022554 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/main/resources/jbpm.cfg.xml0000644000175000017500000000604510777653124025010 0ustar charlescharles mule-2.0.1/examples/loanbroker/bpm/src/test/0000755000175000017500000000000011351411173020575 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/test/java/0000755000175000017500000000000011351411173021516 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/test/java/org/0000755000175000017500000000000011351411173022305 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/test/java/org/mule/0000755000175000017500000000000011351411173023247 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/test/java/org/mule/example/0000755000175000017500000000000011351411173024702 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/test/java/org/mule/example/loanbroker/0000755000175000017500000000000011351411173027040 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/test/java/org/mule/example/loanbroker/bpm/0000755000175000017500000000000011351411173027616 5ustar charlescharles././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/examples/loanbroker/bpm/src/test/java/org/mule/example/loanbroker/bpm/JBpmFunctionalTestCase.javamule-2.0.1/examples/loanbroker/bpm/src/test/java/org/mule/example/loanbroker/bpm/JBpmFunctionalTestC0000644000175000017500000000546111001223131033350 0ustar charlescharles/* * $Id: JBpmFunctionalTestCase.java 11580 2008-04-15 22:04:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.loanbroker.bpm; import org.mule.api.config.ConfigurationException; import org.mule.config.i18n.MessageFactory; import org.mule.example.loanbroker.tests.AbstractAsynchronousLoanBrokerTestCase; import org.mule.transport.bpm.BPMS; import org.mule.transport.bpm.ProcessConnector; import org.mule.transport.jdbc.util.MuleDerbyUtils; public class JBpmFunctionalTestCase extends AbstractAsynchronousLoanBrokerTestCase { /** For unit tests, we assume a virgin database, therefore the process ID is assumed to be = 1 */ public static final long PROCESS_ID = 1; public JBpmFunctionalTestCase() { super(); setDisposeManagerPerSuite(true); } @Override protected void suitePreSetUp() throws Exception { // set the derby.system.home system property to make sure that all derby databases are // created in maven's target directory MuleDerbyUtils.defaultDerbyCleanAndInit("derby.properties", "database.name"); super.suitePreSetUp(); } @Override protected String getConfigResources() { return "loan-broker-bpm-mule-config.xml"; } @Override public void testSingleLoanRequest() throws Exception { super.testSingleLoanRequest(); ProcessConnector connector = (ProcessConnector) muleContext.getRegistry().lookupConnector("jBpmConnector"); if (connector == null) { throw new ConfigurationException(MessageFactory.createStaticMessage("Unable to look up jBpmConnector from Mule registry.")); } BPMS bpms = connector.getBpms(); // TODO MULE-1558 The following assert is throwing a // org.hibernate.LazyInitializationException: could not initialize proxy - the owning MuleSession was closed // See http://forum.springframework.org/archive/index.php/t-24800.html //assertEquals("loanApproved", bpms.getState(bpms.lookupProcess(new Long(PROCESS_ID)))); } @Override public void testLotsOfLoanRequests() throws Exception { super.testLotsOfLoanRequests(); //without this sleep, the test still succeeds but throws a series of exceptions //probably Spring would not have enough time to close db connections before //database itself is shut down while jvm start disposing Thread.sleep(100); } } mule-2.0.1/examples/loanbroker/bpm/src/test/java/org/mule/util/0000755000175000017500000000000011351411173024224 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/test/java/org/mule/util/.keep0000644000175000017500000000020610703467144025160 0ustar charlescharlesThis empty directory should not be deleted, it is needed for a hack in the full assembly (see distributions/server/full/assembly.xml) mule-2.0.1/examples/loanbroker/bpm/src/test/resources/0000755000175000017500000000000011351411173022607 5ustar charlescharlesmule-2.0.1/examples/loanbroker/bpm/src/test/resources/log4j.properties0000644000175000017500000000114011001223131025723 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # Shuts up the innocuous "Narrowing proxy to class org.jbpm.graph.node.State - this operation breaks ==" messages log4j.logger.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog=ERROR # settings for specific packages log4j.logger.org.mule=DEBUG # debug for tracing copies in request context #log4j.logger.org.mule.RequestContext=DEBUG mule-2.0.1/examples/loanbroker/bpm/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000016611002000301027440 0ustar charlescharles# # Test cases listed in this file are not run. # # MULE-3240 org.mule.example.loanbroker.bpm.JBpmFunctionalTestCase mule-2.0.1/examples/loanbroker/bpm/pom.xml0000644000175000017500000000446611006063605020356 0ustar charlescharles 4.0.0 org.mule.examples mule-example-loanbroker-parent 2.0.1 mule-example-loanbroker-bpm jar Loan Broker BPM Example org.apache.maven.plugins maven-surefire-plugin pertest org.mule.examples mule-example-loanbroker-common ${version} org.mule.examples mule-example-loanbroker-common-tests ${version} test org.mule.transports mule-transport-jbpm ${version} org.mule.transports mule-transport-jdbc ${version} org.mule.transports mule-transport-vm ${version} bsh bsh 1.3.0 provided org.apache.derby derby test mule-2.0.1/examples/loanbroker/pom.xml0000644000175000017500000000160411006063605017567 0ustar charlescharles 4.0.0 org.mule.examples mule-examples 2.0.1 mule-example-loanbroker-parent pom Loan Broker Example Umbrella for different variations of the Loan Broker example. common common-tests credit-agency esb esn bpm mule-2.0.1/examples/errorhandler/0000755000175000017500000000000011351411170016577 5ustar charlescharlesmule-2.0.1/examples/errorhandler/conf/0000755000175000017500000000000011351411167017532 5ustar charlescharlesmule-2.0.1/examples/errorhandler/conf/email.properties0000644000175000017500000000052110705232315022733 0ustar charlescharles# # Properties used to compose a message to the Mule administrator # # Substitute e-mail headers as appropriate email.toAddress=user@domain.com email.fromAddress=mule-alert@localhost email.subject=Mule Alert # Configure properties for your outgoing mail server as needed. smtp.host=localhost smtp.port=25 smtp.username= smtp.password= mule-2.0.1/examples/errorhandler/conf/error-config.xml0000644000175000017500000002043210766654216022666 0ustar charlescharles This example demonstrates how to publish events to multiple outbound endpoints. The example consists of two components: ExceptionManager and BusinessErrorManager. mule-2.0.1/examples/errorhandler/test-data/0000755000175000017500000000000011351411167020473 5ustar charlescharlesmule-2.0.1/examples/errorhandler/test-data/exceptions/0000755000175000017500000000000011351411167022654 5ustar charlescharlesmule-2.0.1/examples/errorhandler/test-data/out/0000755000175000017500000000000011351411167021302 5ustar charlescharlesmule-2.0.1/examples/errorhandler/test-data/out/MuleException.xml0000644000175000017500000000166410754375733024632 0ustar charlescharles Some default exception org.mule.api.DefaultMuleException org.mule.test.samples.errorhandler.ErrorHandlerTestDataGenerator.generateTestData(ErrorHandlerTestCase.java:44) org.mule.test.samples.errorhandler.ErrorHandlerTestDataGenerator.main(ErrorHandlerTestCase.java:69) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.intellij.rt.execution.application.AppMain.main(AppMain.java:78) mule-2.0.1/examples/errorhandler/test-data/out/BusinessException.xml0000644000175000017500000000174210754375733025520 0ustar charlescharles BUSINESS EXCEPTION: Some business exception org.mule.example.errorhandler.exceptions.BusinessException org.mule.test.samples.errorhandler.ErrorHandlerTestDataGenerator.generateTestData(ErrorHandlerTestCase.java:47) org.mule.test.samples.errorhandler.ErrorHandlerTestDataGenerator.main(ErrorHandlerTestCase.java:69) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.intellij.rt.execution.application.AppMain.main(AppMain.java:78) mule-2.0.1/examples/errorhandler/test-data/out/FatalException.xml0000644000175000017500000000246110754375733024753 0ustar charlescharles Some IO exception java.io.IOException org.mule.test.samples.errorhandler.ErrorHandlerTestDataGenerator.generateTestData(ErrorHandlerTestCase.java:46) org.mule.test.samples.errorhandler.ErrorHandlerTestDataGenerator.main(ErrorHandlerTestCase.java:69) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:324) com.intellij.rt.execution.application.AppMain.main(AppMain.java:78) Some fatal exception org.mule.api.lifecycle.FatalException Some fatal exception mule-2.0.1/examples/errorhandler/test-data/in/0000755000175000017500000000000011351411167021101 5ustar charlescharlesmule-2.0.1/examples/errorhandler/dist/0000755000175000017500000000000011351411167017550 5ustar charlescharlesmule-2.0.1/examples/errorhandler/dist/build.xml0000644000175000017500000001164710767607640021417 0ustar charlescharles mule-2.0.1/examples/errorhandler/dist/errorhandler0000755000175000017500000000210310747504633022172 0ustar charlescharles#! /bin/sh # The variable is not actually needed to run the example, but it is needed to # build the example, and if you haven't built the example, you can't run it. if [ -z "$MULE_HOME" ] ; then echo "You must set the environment variable MULE_HOME to the location of your Mule install in order to run this example." exit 1 fi # If MULE_BASE is not set, make it MULE_HOME if [ -z "$MULE_BASE" ] ; then MULE_BASE="$MULE_HOME" export MULE_BASE fi # This extends the classpath to include the configuration directory. # Any changes to the files in ./conf will take precedence over those deployed # to $MULE_HOME/lib/user MULE_LIB=./conf export MULE_LIB ACTIVEMQ=activemq-core-4.1.0-incubator.jar if [ -f "$MULE_BASE/lib/user/${ACTIVEMQ}" ]; then exec "$MULE_BASE/bin/mule" -config error-config.xml elif [ -f "$MULE_HOME/lib/user/${ACTIVEMQ}" ]; then exec "$MULE_BASE/bin/mule" -config error-config.xml else echo "This example requires additional libraries which need to be downloaded by the build script. Please follow the instructions in the README.txt file." fi mule-2.0.1/examples/errorhandler/dist/README.txt0000644000175000017500000000403510747504633021261 0ustar charlescharles+-----------------------+ | Error Handler Example | +-----------------------+ The Error handler example demonstrates using Spring as the container to provide the objects managed by Mule and how to publish events to multiple outbound endpoints. The example consists of two components: ExceptionManager and BusinessErrorManager. For more information, refer to http://www.muledocs.org/Examples +----------------------+ | Building the example | +----------------------+ First, make sure you have set the MULE_HOME environment variable as recommended in INSTALL.txt Depending on the build tool you are using (Ant or Maven), you can build the example by simply running "ant" or "mvn". This will download any additional libraries, compile the example classes, produce a jar file, and copy everything to $MULE_HOME/lib/user, which is where your custom classes and configuration files should go. (If you are unable to download the libraries it may be because you are behind a firewall and have not configured your build tool to use your HTTP proxy. Please refer to the following information.) Ant users: http://ant.apache.org/manual-beta/proxy.html Maven users: http://maven.apache.org/guides/mini/guide-proxies.html +---------------------+ | Running the example | +---------------------+ You will need two shell windows in order to run this application. In the first window, use the shell script (Unix/Linux) or batch file (Windows) provided in this directory to run the example. Alternatively, if you have added Mule to your executable path as recommended in INSTALL.txt, you can run the example from the command line as follows: Linux / Unix ------------ ./errorhandler Windows ------- ./errorhandler.bat In the second window, copy the files (one by one so you can see the results) from the ./test-data/out directory to the ./test-data/in directory. Note that for the FatalException.xml file, Mule will attempt to construct and send an alert email using the SMTP configuration as specified in ./conf/email.properties. mule-2.0.1/examples/errorhandler/dist/errorhandler.bat0000644000175000017500000000152010747514457022743 0ustar charlescharles@echo off setlocal if exist "%MULE_HOME%" goto :continue echo You must set the environment variable MULE_HOME to the location of your Mule install in order to run this example. goto :eof :continue if "%MULE_BASE%" == "" SET MULE_BASE=%MULE_HOME% REM This extends the classpath to include the configuration directory REM Any changes to the files in .\conf will take precedence over those deployed to %MULE_HOME%\lib\user SET MULE_LIB=.\conf SET ACTIVEMQ=activemq-core-4.1.0-incubator.jar if exist "%MULE_BASE%\lib\user\%ACTIVEMQ%" goto :mule if exist "%MULE_HOME%\lib\user\%ACTIVEMQ%" goto :mule echo This example requires additional libraries which need to be downloaded by the build script. Please follow the instructions in the README.txt file. goto :eof :mule call "%MULE_BASE%\bin\mule.bat" -config error-config.xml mule-2.0.1/examples/errorhandler/dist/pom.xml0000644000175000017500000003333711006063605021073 0ustar charlescharles 4.0.0 org.mule.examples mule-example-errorhandler 1.0 Error Handler Example Demonstrates using Spring as the external container to provide the objects managed by Mule and how to publish events to multiple outbound endpoints. The example consists of two components; ExecptionManager and BusinessErrorManager. 2.0.1 4.1.0-incubator org.mule mule-core ${muleVersion} org.mule.modules mule-module-spring-config ${muleVersion} org.mule.modules mule-module-spring-extras ${muleVersion} org.mule.modules mule-module-xml ${muleVersion} org.mule.transports mule-transport-email ${muleVersion} org.mule.transports mule-transport-jms ${muleVersion} org.mule.transports mule-transport-file ${muleVersion} org.mule.tests mule-tests-functional ${muleVersion} test javax.mail 1.4 mail provided javax.activation activation 1.1 provided org.apache.activemq apache-activemq ${activemqVersion} provided org.apache.activemq activemq-console org.apache.activemq activemq-jaas org.apache.activemq activemq-optional org.apache.activemq activemq-web org.apache.activemq activemq-web-demo org.apache.activemq activemq-core-test org.apache.activemq activemq-core activemq jmdns activesoap jaxp-api javacc javacc activecluster activecluster org.apache.derby derby org.apache.derby derbynet org.springframework spring xerces xmlParserAPIs xerces xercesImpl xmlbeans xmlbeans-jsr173-api xstream xstream xmlpull xmlpull mx4j mx4j mx4j mx4j-remote backport-util-concurrent backport-util-concurrent org.apache.geronimo.specs geronimo-jsp_2.0_spec org.apache.geronimo.specs geronimo-j2ee-jacc_1.0_spec org.apache.geronimo.specs geronimo-jms_1.1_spec org.apache.geronimo.specs geronimo-j2ee-connector_1.5_spec org.mortbay.jetty jetty org.mortbay.jetty jetty-util log4j log4j commons-beanutils commons-beanutils commons-logging commons-logging commons-httpclient commons-httpclient cglib cglib-full codehaus Codehaus Maven 2.x Release Repository http://repository.codehaus.org false codehaus-snapshots Codehaus Maven 2.x Snapshots Repository http://snapshots.repository.codehaus.org true false apache-incubating Apache incubating repository http://people.apache.org/repo/m2-incubating-repository false apache-plugin-snapshots Apache Maven Plugins Snapshot Repository http://people.apache.org/maven-snapshot-repository true false install ${artifactId} conf src/main/resources org.apache.maven.plugins maven-dependency-plugin copy-artifact install copy ${MULE_HOME}/lib/user true true ${groupId} ${artifactId} ${version} ${artifactId}.jar org.apache.activemq activemq-core ${activemqVersion} concurrent concurrent 1.3.4 javax.mail mail javax.activation activation mule-2.0.1/examples/errorhandler/src/0000755000175000017500000000000011351411167017374 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/main/0000755000175000017500000000000011351411170020312 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/main/java/0000755000175000017500000000000011351411170021233 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/main/java/org/0000755000175000017500000000000011351411170022022 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/main/java/org/mule/0000755000175000017500000000000011351411170022764 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/0000755000175000017500000000000011351411170024417 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/0000755000175000017500000000000011351411170027106 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/ExceptionBeanToErrorMessage.javamule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/ExceptionBeanToErrorMes0000644000175000017500000000224310754375733033564 0ustar charlescharles/* * $Id: ExceptionBeanToErrorMessage.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; public class ExceptionBeanToErrorMessage extends AbstractTransformer { public ExceptionBeanToErrorMessage() { registerSourceType(ExceptionBean.class); } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { try { return new ErrorMessage((ExceptionBean)src); } catch (InstantiationException e) { throw new TransformerException(this, e); } } } mule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/ExceptionBean.java0000644000175000017500000001042310754375733032521 0ustar charlescharles/* * $Id: ExceptionBean.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import org.mule.util.ClassUtils; /** * The ExceptionBean is a POJO representing the details of a Throwable */ public class ExceptionBean { private static boolean showRootStackOnly = true; /** * Specific details about the Throwable. For example, for * FileNotFoundException, this contains the name of the file that * could not be found. */ private String detailMessage; /** * The throwable that caused this throwable to get thrown, or null if this * throwable was not caused by another throwable, or if the causative throwable * is unknown. */ private ExceptionBean cause = null; /** * The stack trace, as returned by getStackTrace(). */ private String[] stackTrace; private String exceptionClass = null; private Throwable originalException = null; public ExceptionBean() { super(); } public ExceptionBean(Throwable exception) { if (exception == null) throw new IllegalArgumentException("The exception cannot be null"); originalException = exception; exceptionClass = exception.getClass().getName(); setDetailMessage(exception.getMessage()); setStackTrace((showRootStackOnly ? null : getStackAsString(exception.getStackTrace()))); if (exception.getCause() != null) { setCause(new ExceptionBean(exception.getCause())); } else { setStackTrace(exception.getStackTrace()); } } public Throwable toException() throws InstantiationException { if (originalException == null) { Throwable t = null; try { Class aClass = ClassUtils.loadClass(exceptionClass, getClass()); if (cause == null) { t = (Throwable)ClassUtils.instanciateClass(aClass, new Object[]{getDetailMessage()}); } else { t = (Throwable)ClassUtils.instanciateClass(aClass, new Object[]{getDetailMessage(), cause.toException()}); } if (getStackTrace() != null) { // t.setStackTrace( getStackTrace()); } originalException = t; } catch (Exception e) { throw new InstantiationException("Failed to create Exception from ExceptionBean: " + e.getMessage()); } } return originalException; } public String getDetailMessage() { return detailMessage; } public void setDetailMessage(String detailMessage) { this.detailMessage = detailMessage; } public ExceptionBean getCause() { return cause; } public void setCause(ExceptionBean cause) { this.cause = cause; } public String[] /* List */ getStackTrace() { return stackTrace; } // public void addStackTrace(String trace) // { // stackTrace.add(trace); // } public void setStackTrace(StackTraceElement[] stackTrace) { this.stackTrace = getStackAsString(stackTrace); } public void setStackTrace(String[] stackTrace) { this.stackTrace = stackTrace; } public String getExceptionClass() { return exceptionClass; } public void setExceptionClass(String exceptionClass) { this.exceptionClass = exceptionClass; } protected String[] getStackAsString(java.lang.StackTraceElement[] elements) { String[] trace = new String[elements.length]; for (int i = 0; i < elements.length; i++) { trace[i] = elements[i].toString(); } return trace; } } mule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/ExceptionHandler.java0000644000175000017500000000174610754375733033241 0ustar charlescharles/* * $Id: ExceptionHandler.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import java.util.Iterator; /** * ExceptionHandler TODO (document class) */ public interface ExceptionHandler { public ErrorManager getErrorManager(); public void setErrorManager(ErrorManager errorManager); public void onException(ErrorMessage message) throws HandlerException; public void registerException(Class exceptionClass); public void unRegisterException(Class exceptionClass); public Iterator getRegisteredClasses(); public boolean isRegisteredFor(Class exceptionClass); } mule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/ErrorMessage.java0000644000175000017500000000434110754375733032375 0ustar charlescharles/* * $Id: ErrorMessage.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import java.util.HashMap; import java.util.Map; /** * The ErrorMessage represents an exception. */ public class ErrorMessage { // Bean representing the Exception private ExceptionBean exception; // The exception itself, in its primitive state private Throwable throwable; // Properties for this object private Map properties = new HashMap(); /** * */ public ErrorMessage() { super(); } public ErrorMessage(ExceptionBean exception) throws InstantiationException { setException(exception); } public ErrorMessage(Throwable exception) { setThrowable(exception); } public ErrorMessage(Throwable exception, Map props) { setThrowable(exception); setProperties(props); } /** * @return Returns the exception. */ public ExceptionBean getException() { return exception; } /** * @param exception The exception to set. */ public void setException(ExceptionBean exception) throws InstantiationException { this.exception = exception; throwable = exception.toException(); } /** * @return Returns the properties. */ public Map getProperties() { return properties; } /** * @param properties The properties to set. */ public void setProperties(Map properties) { this.properties = properties; } /** * @return Returns the throwable. */ public Throwable getThrowable() { return throwable; } /** * @param throwable The throwable to set. */ public void setThrowable(Throwable throwable) { this.throwable = throwable; exception = new ExceptionBean(throwable); } } mule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/HandlerException.java0000644000175000017500000000171310754375733033233 0ustar charlescharles/* * $Id: HandlerException.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import org.mule.api.MuleException; import org.mule.config.i18n.MessageFactory; public class HandlerException extends MuleException { /** * Serial version */ private static final long serialVersionUID = -1446892313657626797L; public HandlerException(String message) { super(MessageFactory.createStaticMessage(message)); } public HandlerException(String message, Throwable cause) { super(MessageFactory.createStaticMessage(message), cause); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/BusinessErrorManager.javamule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/BusinessErrorManager.ja0000644000175000017500000000340710754375733033552 0ustar charlescharles/* * $Id: BusinessErrorManager.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import org.mule.api.MuleEventContext; import org.mule.api.MuleException; import org.mule.api.lifecycle.Callable; import org.mule.util.StringMessageUtils; import java.util.ArrayList; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * The BusinessErrorManager is the UMO Service that processes * exceptions of type org.mule.example.errorhandler.exceptions.BusinessException. * The business method simply reports the errors and stops any further processing. */ public class BusinessErrorManager implements Callable { /** logger used by this class */ private static final Log logger = LogFactory.getLog(BusinessErrorManager.class); public Object onCall(MuleEventContext context) throws MuleException { ErrorMessage msg = (ErrorMessage)context.transformMessage(); // Do something with the error message List msgs = new ArrayList(); msgs.add(LocaleMessage.businessErrorManagerError()); msgs.add(LocaleMessage.errorDetail(msg.getException().getDetailMessage())); msgs.add(LocaleMessage.errorClass(msg.getException().getClass())); logger.info("\n" + StringMessageUtils.getBoilerPlate(msgs, '*', 80)); context.setStopFurtherProcessing(true); return null; } } mule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/handlers/0000755000175000017500000000000011351411170030706 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/handlers/FatalHandler.javamule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/handlers/FatalHandler.j0000644000175000017500000000262710754375733033441 0ustar charlescharles/* * $Id: FatalHandler.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler.handlers; import org.mule.api.lifecycle.FatalException; import org.mule.example.errorhandler.ErrorMessage; import org.mule.example.errorhandler.HandlerException; import org.mule.example.errorhandler.LocaleMessage; import org.mule.util.StringMessageUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * FatalBehaviour TODO (document class) */ public class FatalHandler extends DefaultHandler { /** logger used by this class */ private static final Log logger = LogFactory.getLog(FatalHandler.class); public FatalHandler() { super(); registerException(FatalException.class); } public void processException(ErrorMessage message, Throwable t) throws HandlerException { String msg = LocaleMessage.fatalHandlerMessage(); System.out.println(StringMessageUtils.getBoilerPlate(msg)); logger.fatal(LocaleMessage.fatalHandlerException(t), t); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/handlers/BusinessHandler.javamule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/handlers/BusinessHandle0000644000175000017500000000235110754375733033565 0ustar charlescharles/* * $Id: BusinessHandler.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler.handlers; import org.mule.example.errorhandler.AbstractExceptionHandler; import org.mule.example.errorhandler.ErrorMessage; import org.mule.example.errorhandler.HandlerException; import org.mule.example.errorhandler.LocaleMessage; import org.mule.example.errorhandler.exceptions.BusinessException; import org.mule.util.StringMessageUtils; /** * BusinessHandler */ public class BusinessHandler extends AbstractExceptionHandler { public BusinessHandler() { super(); registerException(BusinessException.class); } protected void processException(ErrorMessage message, Throwable t) throws HandlerException { String msg = LocaleMessage.businessHandlerMessage(); System.out.println(StringMessageUtils.getBoilerPlate(msg)); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/handlers/DefaultHandler.javamule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/handlers/DefaultHandler0000644000175000017500000000226010754375733033537 0ustar charlescharles/* * $Id: DefaultHandler.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler.handlers; import org.mule.example.errorhandler.AbstractExceptionHandler; import org.mule.example.errorhandler.ErrorMessage; import org.mule.example.errorhandler.HandlerException; import org.mule.example.errorhandler.LocaleMessage; import org.mule.util.StringMessageUtils; /** * DefaultHandler TODO (document class) * */ public class DefaultHandler extends AbstractExceptionHandler { public DefaultHandler() { super(); registerException(Throwable.class); } public void processException(ErrorMessage message, Throwable t) throws HandlerException { String msg = LocaleMessage.defaultHandlerMessage(); System.out.println(StringMessageUtils.getBoilerPlate(msg)); } } mule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/ErrorManager.java0000644000175000017500000000747710754375733032400 0ustar charlescharles/* * $Id: ErrorManager.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import org.mule.MuleServer; import org.mule.api.MuleException; import org.mule.example.errorhandler.handlers.DefaultHandler; import org.mule.example.errorhandler.handlers.FatalHandler; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * ErrorManager TODO (document class) */ public class ErrorManager { /** logger used by this class */ private static final Log logger = LogFactory.getLog(ErrorManager.class); private Map handlers = new HashMap(); private ExceptionHandler defaultHandler = null; public ErrorManager() { defaultHandler = new DefaultHandler(); } public void setHandlers(List handlers) { Iterator handlerIter = handlers.iterator(); while (handlerIter.hasNext()) { ExceptionHandler handler = (ExceptionHandler)handlerIter.next(); this.addHandler(handler); } } public void addHandler(ExceptionHandler eh) { for (Iterator i = eh.getRegisteredClasses(); i.hasNext();) { handlers.put(i.next(), eh); } } public ExceptionHandler getHandler(Class exceptionClass) { Object obj = handlers.get(exceptionClass); if (obj == null) { obj = handlers.get(Throwable.class); } return (ExceptionHandler)obj; } public void onException(ErrorMessage msg) throws MuleException { Class eClass = null; ExceptionHandler eh = null; try { eClass = msg.getException().toException().getClass(); eh = getHandler(eClass); eh.onException(msg); } catch (Exception e) { logger.error(e); if (eh instanceof DefaultHandler) { logger.error(LocaleMessage.defaultFatalHandling(FatalHandler.class)); handleFatal(e); } else if (eh instanceof FatalHandler) { logger.fatal(LocaleMessage.fatalHandling(e)); MuleServer.getMuleContext().dispose(); System.exit(-1); } else { logger.error(LocaleMessage.defaultHandling(DefaultHandler.class, eh, e)); handleDefault(msg, e); } } } private void handleDefault(ErrorMessage msg, Throwable t) { ErrorMessage nestedMsg = null; // Try wrapping the exception and the Exception message that caused the // exception in a new message try { nestedMsg = new ErrorMessage(t); } catch (Exception e) { logger.fatal(LocaleMessage.defaultException(e), e); handleFatal(e); } try { defaultHandler.onException(nestedMsg); } catch (HandlerException e) { logger.fatal(LocaleMessage.defaultHandlerException(e), e); handleFatal(e); } } private void handleFatal(Throwable t) { // If this method has been called, all other handlers failed // this is all we can do logger.fatal(LocaleMessage.fatalException(t), t); MuleServer.getMuleContext().dispose(); System.exit(-1); } } mule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/exceptions/0000755000175000017500000000000011351411170031267 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/exceptions/FatalException.javamule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/exceptions/FatalExcepti0000644000175000017500000000214210754375733033606 0ustar charlescharles/* * $Id: FatalException.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler.exceptions; import org.mule.api.MuleException; import org.mule.config.i18n.MessageFactory; /** * FatalException TODO (document class) */ public class FatalException extends MuleException { /** * Serial version */ private static final long serialVersionUID = -5683879269751770579L; /** * @param message */ public FatalException(String message) { this("FATAL EXCEPTION: " + message, null); } /** * @param message * @param cause */ public FatalException(String message, Throwable cause) { super(MessageFactory.createStaticMessage(message), cause); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/exceptions/BusinessException.javamule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/exceptions/BusinessExce0000644000175000017500000000216310754375733033640 0ustar charlescharles/* * $Id: BusinessException.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler.exceptions; import org.mule.api.MuleException; import org.mule.config.i18n.MessageFactory; /** * BusinessException TODO (document class) */ public class BusinessException extends MuleException { /** * Serial version */ private static final long serialVersionUID = -3650171245608111071L; /** * @param message */ public BusinessException(String message) { this("BUSINESS EXCEPTION: " + message, null); } /** * @param message * @param cause */ public BusinessException(String message, Throwable cause) { super(MessageFactory.createStaticMessage(message), cause); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/ErrorMessageToException.javamule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/ErrorMessageToException0000644000175000017500000000247310754375733033643 0ustar charlescharles/* * $Id: ErrorMessageToException.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; /** * The ErrorMessageToException transformer extracts and returns * the exception encapsulated by the ErrorMessage message payload. */ public class ErrorMessageToException extends AbstractTransformer { public ErrorMessageToException() { registerSourceType(ErrorMessage.class); } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { try { return ((ErrorMessage)src).getException().toException(); } catch (InstantiationException e) { throw new TransformerException(this, e); } } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/ErrorMessageToExceptionBean.javamule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/ErrorMessageToException0000644000175000017500000000223710754375733033641 0ustar charlescharles/* * $Id: ErrorMessageToExceptionBean.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; /** * The ErrorMessageToExceptionBean transformer returns * the exception bean encapsulated by the ErrorMessage message payload. */ public class ErrorMessageToExceptionBean extends AbstractTransformer { public ErrorMessageToExceptionBean() { registerSourceType(ErrorMessage.class); } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { return ((ErrorMessage)src).getException(); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/AbstractExceptionHandler.javamule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/AbstractExceptionHandle0000644000175000017500000000534710754375733033624 0ustar charlescharles/* * $Id: AbstractExceptionHandler.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import java.util.HashMap; import java.util.Iterator; /** * AbstractExceptionListener TODO (document class) * */ public abstract class AbstractExceptionHandler implements ExceptionHandler { protected HashMap registry = new HashMap(); private String endpointName; protected ErrorManager errorManager = null; public void registerException(Class exceptionClass) { registry.put(exceptionClass, exceptionClass); } public Iterator getRegisteredClasses() { return registry.keySet().iterator(); } public void unRegisterException(Class exceptionClass) { registry.remove(exceptionClass); } public boolean isRegisteredFor(Class exceptionClass) { Class aClass = null; for (Iterator i = getRegisteredClasses(); i.hasNext();) { aClass = (Class)i.next(); if (aClass.isAssignableFrom(exceptionClass)) { return true; } } return false; } public void onException(ErrorMessage message) throws HandlerException { Throwable t = null; try { t = message.getException().toException(); } catch (Exception e) { throw new HandlerException(LocaleMessage.unretrievedException(e), e); } if (!isRegisteredFor(t.getClass())) { throw new HandlerException(LocaleMessage.unhandledException(t.getClass(), this.getClass())); } processException(message, t); } protected abstract void processException(ErrorMessage message, Throwable t) throws HandlerException; /** * @return Returns the errorManager. */ public ErrorManager getErrorManager() { return errorManager; } /** * @param errorManager The errorManager to set. */ public void setErrorManager(ErrorManager errorManager) { this.errorManager = errorManager; } /** * @return Returns the endpointName. */ public String getendpointName() { return endpointName; } /** * @param endpointName The endpointName to set. */ public void setEndpointName(String endpointName) { this.endpointName = endpointName; } } mule-2.0.1/examples/errorhandler/src/main/java/org/mule/example/errorhandler/LocaleMessage.java0000644000175000017500000000610510754375733032503 0ustar charlescharles/* * $Id: LocaleMessage.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import org.mule.config.i18n.MessageFactory; import org.mule.util.ObjectUtils; import org.mule.util.StringMessageUtils; /** * LocaleMessage is a convenience interface for retrieving * internationalised strings from resource bundles. The actual work is done by * the MessageFactory in core. */ public class LocaleMessage extends MessageFactory { private static final String BUNDLE_PATH = "messages.errorhandler-example-messages"; public static String unretrievedException(Exception e) { return getString(BUNDLE_PATH, 1, e); } public static String unhandledException(Class class1, Class class2) { return getString(BUNDLE_PATH, 2, StringMessageUtils.toString(class1), StringMessageUtils.toString(class2)); } public static String businessErrorManagerError() { return getString(BUNDLE_PATH, 3); } public static String errorDetail(String detailMessage) { return getString(BUNDLE_PATH, 4, detailMessage); } public static String errorClass(Class class1) { return getString(BUNDLE_PATH, 5, class1.getName()); } public static String handlerFailure(ExceptionHandler eh) { String handlerDescription = ObjectUtils.toString(eh.getClass().getName(), "null"); return getString(BUNDLE_PATH, 6, handlerDescription); } public static String defaultFatalHandling(Class class1) { return getString(BUNDLE_PATH, 7, StringMessageUtils.toString(class1)); } public static String fatalHandling(Exception e) { return getString(BUNDLE_PATH, 8, e); } public static String defaultHandling(Class class1, ExceptionHandler eh, Exception e) { return getString(BUNDLE_PATH, 9, StringMessageUtils.toString(class1), ObjectUtils.toString(eh.getClass().getName() + " : " + e, "null")); } public static String defaultException(Exception e) { return getString(BUNDLE_PATH, 10, e); } public static String defaultHandlerException(HandlerException e) { return getString(BUNDLE_PATH, 11, e); } public static String fatalException(Throwable t) { return getString(BUNDLE_PATH, 12, t); } public static String businessHandlerMessage() { return getString(BUNDLE_PATH, 13); } public static String defaultHandlerMessage() { return getString(BUNDLE_PATH, 14); } public static String fatalHandlerMessage() { return getString(BUNDLE_PATH, 15); } public static String fatalHandlerException(Throwable t) { return getString(BUNDLE_PATH, 16, t); } } mule-2.0.1/examples/errorhandler/src/main/resources/0000755000175000017500000000000011351411170022324 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/main/resources/messages/0000755000175000017500000000000011351411170024133 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/examples/errorhandler/src/main/resources/messages/errorhandler-example-messages.propertiesmule-2.0.1/examples/errorhandler/src/main/resources/messages/errorhandler-example-messages.propertie0000644000175000017500000000231310621717250034021 0ustar charlescharles1=Failed to retrieve exception from exception message: {0} 2=Exception: {0} was received by Exception behaviour: {1}, but the exception is not registered to be handled by this behaviour 3=Received Error Message in the Sample Business Error Manager. 4=Error is: {0} 5=Error class: {0} 6=Failed to handle Exception using handler: {0} 7=As the failure happened in the Default Exception handler, now using Fatal Behaviour {0} which will cause the Exception Manager to shutdown 8=Exception caught handling Fatal exception: {0} 9=Exception Handler resorting to Default Behaviour : {0}, due to exception in configured behavour : {1} 10=Exception happened while handling and exception using the Default behaviour: {0} 11=Exception happened while handling and exception using the Default behaviour: {0} 12=An exception has been caught be the Fatal Exception Behaviour. Exception is {0} 13=Exception received in BUSINESS EXCEPTION HANDLER. Logic could be put in here to enrich the message content. 14=Exception received in DEFAULT EXCEPTION HANDLER. Logic could be put in here to enrich the message content. 15=Exception received in FATAL EXCEPTION HANDLER. Logic could be put in here to enrich the message content. 16=Exception is: {0} mule-2.0.1/examples/errorhandler/src/test/0000755000175000017500000000000011351411167020353 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/test/java/0000755000175000017500000000000011351411167021274 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/test/java/org/0000755000175000017500000000000011351411167022063 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/test/java/org/mule/0000755000175000017500000000000011351411167023025 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/test/java/org/mule/example/0000755000175000017500000000000011351411167024460 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/test/java/org/mule/example/errorhandler/0000755000175000017500000000000011351411167027147 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/examples/errorhandler/src/test/java/org/mule/example/errorhandler/ErrorHandlerTestDataGenerator.javamule-2.0.1/examples/errorhandler/src/test/java/org/mule/example/errorhandler/ErrorHandlerTestDataGen0000644000175000017500000000464410764101307033554 0ustar charlescharles/* * $Id: ErrorHandlerTestDataGenerator.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import org.mule.api.DefaultMuleException; import org.mule.api.lifecycle.FatalException; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.MessageFactory; import org.mule.example.errorhandler.exceptions.BusinessException; import org.mule.module.xml.transformer.ObjectToXml; import org.mule.util.FileUtils; import java.io.IOException; public class ErrorHandlerTestDataGenerator { public static void generateTestData(String targetDir) throws IOException, TransformerException { if (!(targetDir.endsWith("/") || targetDir.endsWith("\\"))) { targetDir += "/"; } ObjectToXml trans = new ObjectToXml(); DefaultMuleException exception = new DefaultMuleException(MessageFactory.createStaticMessage("Some default exception")); FatalException fatal = new FatalException(MessageFactory.createStaticMessage("Some fatal exception"), new IOException("Some IO exception")); BusinessException business = new BusinessException("Some business exception"); ExceptionBean bean = new ExceptionBean(exception); String xml = (String)trans.transform(bean); FileUtils.stringToFile(targetDir + "DefaultMuleException.xml", xml); bean = new ExceptionBean(fatal); xml = (String)trans.transform(bean); FileUtils.stringToFile(targetDir + "FatalException.xml", xml); bean = new ExceptionBean(business); xml = (String)trans.transform(bean); FileUtils.stringToFile(targetDir + "BusinesException.xml", xml); } public static void main(String[] args) { if (args.length == 0) { System.out.println("You must specifiy a target directory for the output files"); System.exit(1); } String path = args[0]; try { generateTestData(path); } catch (Exception e) { e.printStackTrace(); } } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/examples/errorhandler/src/test/java/org/mule/example/errorhandler/ErrorHandlerTestCase.javamule-2.0.1/examples/errorhandler/src/test/java/org/mule/example/errorhandler/ErrorHandlerTestCase.ja0000644000175000017500000000145310754375733033527 0ustar charlescharles/* * $Id: ErrorHandlerTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.errorhandler; import org.mule.tck.FunctionalTestCase; public class ErrorHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "error-config.xml"; } public void testConfigSanity() { // empty } // TODO Create a test to copy files from test-data/out to test-data/in } mule-2.0.1/examples/errorhandler/src/test/resources/0000755000175000017500000000000011351411167022365 5ustar charlescharlesmule-2.0.1/examples/errorhandler/src/test/resources/log4j.properties0000644000175000017500000000050210670313576025527 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=INFO mule-2.0.1/examples/errorhandler/pom.xml0000644000175000017500000000451111006063605020120 0ustar charlescharles 4.0.0 org.mule.examples mule-examples 2.0.1 mule-example-errorhandler Error Handler Example Demonstrates using Spring as the external container to provide the objects managed by Mule and how to publish events to multiple outbound endpoints. The example consists of two components; ExecptionManager and BusinessErrorManager. org.mule.modules mule-module-spring-extras ${version} org.mule.modules mule-module-xml ${version} org.mule.transports mule-transport-email ${version} org.mule.transports mule-transport-jms ${version} org.mule.transports mule-transport-file ${version} org.mule.tests mule-tests-functional ${version} test javax.mail mail provided org.apache.activemq activemq-core provided mule-2.0.1/examples/stockquote/0000755000175000017500000000000011351411166016316 5ustar charlescharlesmule-2.0.1/examples/stockquote/conf/0000755000175000017500000000000011351411165017242 5ustar charlescharlesmule-2.0.1/examples/stockquote/conf/stockquote-rest-config.xml0000644000175000017500000000535510762044052024415 0ustar charlescharles The StockQuote REST example uses the Mule RestServiceWrapper to invoke a remote .Net service Using REST style invocation and displays the result. The example invokes a StockQuote Web Service on www.webservicesx.com, the result is an Xml string that Mule converts to a StockQuote object by first running the result through an Xslt transformer and then using the XmlToObject transformer. mule-2.0.1/examples/stockquote/conf/stockquote-wsdl-config.xml0000644000175000017500000000603310766272451024415 0ustar charlescharles The StockQuote SOAP example uses the Mule RestServiceWrapper to invoke a remote .Net service Using SOAP RPC style invocation and displays the result. The example demostrates how to set named parameters for Web Service invocations and how to invoke a non-java web service using Mule. The example invokes a StockQuote Web Service on www.webservicesx.com, the result is an Xml string that Mule converts to a StockQuote object by first running the result through an Xslt transformer and then using the XmlToObject transformer. mule-2.0.1/examples/stockquote/conf/xsl/0000755000175000017500000000000011351411165020050 5ustar charlescharlesmule-2.0.1/examples/stockquote/conf/xsl/soap-stock.xsl0000644000175000017500000000166710754375733022715 0ustar charlescharles mule-2.0.1/examples/stockquote/conf/xsl/rest-stock.xsl0000644000175000017500000000201710754375733022716 0ustar charlescharles mule-2.0.1/examples/stockquote/conf/stockquote-soap-config.xml0000644000175000017500000000754010762044052024400 0ustar charlescharles The StockQuote SOAP example uses the Mule RestServiceWrapper to invoke a remote .Net service Using SOAP RPC style invocation and displays the result. The example demostrates how to set named parameters for Web Service invocations and how to invoke a non-java web service using Mule. The example invokes a StockQuote Web Service on www.webservicesx.com, the result is an Xml string that Mule converts to a StockQuote object by first running the result through an Xslt transformer and then using the XmlToObject transformer. mule-2.0.1/examples/stockquote/conf/proxy.properties0000644000175000017500000000016510672263414022552 0ustar charlescharles# Set these properties for your HTTP proxy if necessary. proxyHostname= proxyPort=8080 proxyUsername= proxyPassword= mule-2.0.1/examples/stockquote/conf/stdio-config.xml0000644000175000017500000000335010745174725022370 0ustar charlescharles mule-2.0.1/examples/stockquote/dist/0000755000175000017500000000000011351411165017260 5ustar charlescharlesmule-2.0.1/examples/stockquote/dist/build.xml0000644000175000017500000000727210767607640021130 0ustar charlescharles mule-2.0.1/examples/stockquote/dist/stockquote.bat0000644000175000017500000000215010711636636022162 0ustar charlescharles@echo off REM There is no need to call this if you set the MULE_HOME in your environment properties REM but you must also define MULE_LIB for the example (see below) REM or specify the config as a file: URI (see README.txt) if "%MULE_HOME%" == "" SET MULE_HOME=%~dp0..\.. if "%MULE_BASE%" == "" SET MULE_BASE=%MULE_HOME% REM This extends the classpath to include the configuration directory REM Any changes to the files in .\conf will take precedence over those deployed to %MULE_HOME%\lib\user SET MULE_LIB=.\conf ECHO (make sure you have configured your HTTP proxy if behind a firewall - see README.txt) ECHO. ECHO The Stock Quote example is available in three variations: ECHO 1. REST ECHO 2. WSDL ECHO 3. SOAP SET /P Choice=Select the one you wish to execute and press Enter... IF '%Choice%'=='1' call "%MULE_BASE%\bin\mule.bat" -config "stdio-config.xml,stockquote-rest-config.xml" IF '%Choice%'=='2' call "%MULE_BASE%\bin\mule.bat" -config "stdio-config.xml,stockquote-wsdl-config.xml" IF '%Choice%'=='3' call "%MULE_BASE%\bin\mule.bat" -config "stdio-config.xml,stockquote-soap-config.xml" mule-2.0.1/examples/stockquote/dist/stockquote0000755000175000017500000000247410703242067021421 0ustar charlescharles#! /bin/sh # There is no need to call this if you set the MULE_HOME in your environment # but you must also define MULE_LIB for the example (see below) # or specify the config as a file: URI (see README.txt) if [ -z "$MULE_HOME" ] ; then # find the name of the real MULE_HOME which is two levels up MULE_HOME=`pwd` MULE_HOME=`dirname "$MULE_HOME"` MULE_HOME=`dirname "$MULE_HOME"` export MULE_HOME fi # If MULE_BASE is not set, make it MULE_HOME if [ -z "$MULE_BASE" ] ; then MULE_BASE="$MULE_HOME" export MULE_BASE fi # This extends the classpath to include the configuration directory # Any changes to the files in ./conf will take precedence over those deployed to $MULE_HOME/lib/user MULE_LIB=./conf export MULE_LIB echo "(make sure you have configured your HTTP proxy if behind a firewall - see README.txt)" echo echo "The Stock Quote example is available in three variations:" echo " 1. REST" echo " 2. WSDL" echo " 3. SOAP" echo "Select the one you wish to execute and press Enter..." read i if [ 1 = $i ] then exec "$MULE_BASE/bin/mule" -config "stdio-config.xml,stockquote-rest-config.xml" elif [ 2 = $i ] then exec "$MULE_BASE/bin/mule" -config "stdio-config.xml,stockquote-wsdl-config.xml" elif [ 3 = $i ] then exec "$MULE_BASE/bin/mule" -config "stdio-config.xml,stockquote-soap-config.xml" fi mule-2.0.1/examples/stockquote/dist/README.txt0000644000175000017500000000475110747504633021000 0ustar charlescharles+---------------------+ | Stock Quote Example | +---------------------+ This example demonstrates how to invoke an ASPX web service from Mule and transform the result using XSLT and deserialise the result to a StockQuote JavaBean. The example demonstrates using REST and SOAP to invoke the service. For more information, refer to http://www.muledocs.org/Examples +---------------------+ | Running the example | +---------------------+ Simply use the shell script (Unix/Linux) or batch file (Windows) provided in this directory to run the example. Alternatively, if you have added Mule to your executable path as recommended in INSTALL.txt, you can run the example from the command line as follows: Linux / Unix ------------ mule -config file:conf/soap-config.xml mule -config file:conf/wsdl-config.xml mule -config file:conf/rest-config.xml or export MULE_LIB=./conf mule -config soap-config.xml mule -config wsdl-config.xml mule -config rest-config.xml Windows ------- mule.bat -config file:conf/soap-config.xml mule.bat -config file:conf/wsdl-config.xml mule.bat -config file:conf/rest-config.xml or SET MULE_LIB=.\conf mule.bat -config soap-config.xml mule.bat -config wsdl-config.xml mule.bat -config rest-config.xml +-------------------+ | Firewall settings | +-------------------+ If you are behind a firewall, you will need to configure the settings for your HTTP proxy in the ./conf/proxy.properties file. Then you can run the example as follows: Linux / Unix ------------ mule -config file:conf/soap-config.xml -props ./conf/proxy.properties mule -config file:conf/wsdl-config.xml -props ./conf/proxy.properties mule -config file:conf/rest-config.xml -props ./conf/proxy.properties Windows ------- mule.bat -config file:conf/soap-config.xml -props .\conf\proxy.properties mule.bat -config file:conf/wsdl-config.xml -props .\conf\proxy.properties mule.bat -config file:conf/rest-config.xml -props .\conf\proxy.properties +----------------------+ | Building the example | +----------------------+ First, make sure you have set the MULE_HOME environment variable as recommended in INSTALL.txt Depending on the build tool you are using (Ant or Maven), you can build the example by simply running "ant" or "mvn". This will compile the example classes, produce a jar file, and copy everything to $MULE_HOME/lib/user, which is where your custom classes and configuration files should go. mule-2.0.1/examples/stockquote/dist/pom.xml0000644000175000017500000001551511006063605020603 0ustar charlescharles 4.0.0 org.mule.examples mule-example-stockquote 1.0 Stock Quotes Example This example demonstrates how to invoke an ASPX web service from Mule and transform the result using XSLT and deserialise the result to a StockQuote javabean. The examples demonstrates invoking the service using REST and SOAP. 2.0.1 org.mule.transports mule-transport-axis ${muleVersion} org.mule.transports mule-transport-cxf ${muleVersion} org.mule.transports mule-transport-vm ${muleVersion} org.mule.transports mule-transport-stdio ${muleVersion} org.mule.transports mule-transport-http ${muleVersion} org.mule.modules mule-module-spring-extras ${muleVersion} org.springframework spring-core 2.5.1 aopalliance aopalliance commons-logging commons-logging org.mule.tests mule-tests-functional ${muleVersion} test codehaus Codehaus Maven 2.x Release Repository http://repository.codehaus.org false codehaus-snapshots Codehaus Maven 2.x Snapshots Repository http://snapshots.repository.codehaus.org true false java.net Java.net Repository http://download.java.net/maven/1/ legacy apache-plugin-snapshots Apache Maven Plugins Snapshot Repository http://people.apache.org/maven-snapshot-repository true false install ${artifactId} conf src/main/resources org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 ISO-8859-1 org.apache.maven.plugins maven-dependency-plugin copy-artifact install copy ${MULE_HOME}/lib/user true true ${groupId} ${artifactId} ${version} ${artifactId}.jar mule-2.0.1/examples/stockquote/src/0000755000175000017500000000000011351411166017105 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/main/0000755000175000017500000000000011351411166020031 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/main/java/0000755000175000017500000000000011351411166020752 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/main/java/org/0000755000175000017500000000000011351411166021541 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/main/java/org/mule/0000755000175000017500000000000011351411166022503 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/main/java/org/mule/example/0000755000175000017500000000000011351411166024136 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/main/java/org/mule/example/stockquote/0000755000175000017500000000000011351411166026337 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/main/java/org/mule/example/stockquote/StockQuote.java0000644000175000017500000000515310767505705031324 0ustar charlescharles/* * $Id: StockQuote.java 11394 2008-03-17 15:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.stockquote; import java.io.Serializable; /** * A stock Quote object that is crated from the xml returned from the * http://www.webservicex.net/stockquote.asmx service */ public class StockQuote implements Serializable { private static final long serialVersionUID = -3579080716991795218L; private String symbol; private String last; private String change; private String open; private String high; private String low; private String volume; private String previousClose; private String name; private String date; public String getSymbol() { return symbol; } public void setSymbol(String symbol) { this.symbol = symbol; } public String getLast() { return last; } public void setLast(String last) { this.last = last; } public String getChange() { return change; } public void setChange(String change) { this.change = change; } public String getOpen() { return open; } public void setOpen(String open) { this.open = open; } public String getHigh() { return high; } public void setHigh(String high) { this.high = high; } public String getLow() { return low; } public void setLow(String low) { this.low = low; } public String getVolume() { return volume; } public void setVolume(String volume) { this.volume = volume; } public String getPreviousClose() { return previousClose; } public void setPreviousClose(String previousClose) { this.previousClose = previousClose; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } @Override public String toString() { return LocaleMessage.getStockQuoteMessage(symbol, name, date, last, change, open, high, low, volume, previousClose); } } mule-2.0.1/examples/stockquote/src/main/java/org/mule/example/stockquote/LocaleMessage.java0000644000175000017500000000256110754375733031731 0ustar charlescharles/* * $Id: LocaleMessage.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.stockquote; import org.mule.config.i18n.MessageFactory; /** * LocaleMessage is a convenience interface for retrieving * internationalised strings from resource bundles. The actual work is done by * the {@link MessageFactory} in core. */ public class LocaleMessage extends MessageFactory { /** * Note that the messages for this example are not in mule's standard * META-INF/services/org/mule/i18n folder but in a different resource bundle. */ private static final String BUNDLE_PATH = "messages.stockquote-example-messages"; public static String getStockQuoteMessage(String symbol, String name, String date, String last, String change, String open, String high, String low, String volume, String previousClose) { String[] params = { symbol, name, date, last, change, open, high, low, volume, previousClose }; return getString(BUNDLE_PATH, 1, params); } } mule-2.0.1/examples/stockquote/src/main/resources/0000755000175000017500000000000011351411166022043 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/main/resources/messages/0000755000175000017500000000000011351411166023652 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/examples/stockquote/src/main/resources/messages/stockquote-example-messages_de.propertiesmule-2.0.1/examples/stockquote/src/main/resources/messages/stockquote-example-messages_de.properties0000644000175000017500000000045410621717250034104 0ustar charlescharles#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net) 1 = B\u00F6rsennotierung[Symbol={0}, Name={1}, Datum={2}, Letzte={3}, \u00C4nderung={4}, Offen={5}, H\u00F6chststand={6}, Niedrigster Stand={7}, Volumen={8}, Letzer Schlu\u00DF={9}] 2 = Bitte geben Sie ein Aktiensymbol ein: mule-2.0.1/examples/stockquote/src/main/resources/messages/stockquote-example-messages.properties0000644000175000017500000000024510621717250033432 0ustar charlescharles 1 = StockQuote[symbol={0}, name={1}, date={2}, last={3}, change={4}, open={5}, high={6}, low={7}, volume={8}, previousClose={9}] 2 = Please enter a stock symbol: mule-2.0.1/examples/stockquote/src/test/0000755000175000017500000000000011351411166020064 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/test/java/0000755000175000017500000000000011351411165021004 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/test/java/org/0000755000175000017500000000000011351411165021573 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/test/java/org/mule/0000755000175000017500000000000011351411165022535 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/test/java/org/mule/example/0000755000175000017500000000000011351411166024171 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/test/java/org/mule/example/stockquote/0000755000175000017500000000000011351411166026372 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/examples/stockquote/src/test/java/org/mule/example/stockquote/RestStockQuoteFunctionalTestCase.javamule-2.0.1/examples/stockquote/src/test/java/org/mule/example/stockquote/RestStockQuoteFunctionalTes0000644000175000017500000000124210754375733033771 0ustar charlescharles/* * $Id: RestStockQuoteFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.stockquote; public class RestStockQuoteFunctionalTestCase extends AbstractStockQuoteFunctionalTestCase { protected String getConfigResources() { return "stockquote-rest-config.xml"; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/examples/stockquote/src/test/java/org/mule/example/stockquote/AbstractStockQuoteFunctionalTestCase.javamule-2.0.1/examples/stockquote/src/test/java/org/mule/example/stockquote/AbstractStockQuoteFunctiona0000644000175000017500000000374310762044052033761 0ustar charlescharles/* * $Id: AbstractStockQuoteFunctionalTestCase.java 11134 2008-02-29 18:00:10Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.stockquote; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.util.StringUtils; import java.util.Locale; public abstract class AbstractStockQuoteFunctionalTestCase extends FunctionalTestCase { public void testStockQuoteExample() throws Exception { MuleClient client = new MuleClient(); MuleMessage response = client.send("vm://stockquote", "HRB", null); if (null == response) { fail("No response message."); } else { if (null == response.getExceptionPayload()) { String text = response.getPayloadAsString(); assertNotNull("Null response", text); assertTrue("Stock quote should contain \"BLOCK\": " + text, StringUtils.contains(text, "BLOCK")); if (Locale.getDefault().getISO3Language().equalsIgnoreCase("eng")) { // the stockquote message is localized ... assertTrue("Stock quote should start with \"StockQuote[\":" + text, text.startsWith("StockQuote[")); } logger.debug("**********"); logger.debug(response.getPayload()); logger.debug(response.getPayloadAsString()); logger.debug("**********"); } else { fail("Exception occurred: " + response.getExceptionPayload()); } } } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/examples/stockquote/src/test/java/org/mule/example/stockquote/SoapStockQuoteFunctionalTestCase.javamule-2.0.1/examples/stockquote/src/test/java/org/mule/example/stockquote/SoapStockQuoteFunctionalTes0000644000175000017500000000125010754375733033755 0ustar charlescharles/* * $Id: SoapStockQuoteFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.stockquote; public class SoapStockQuoteFunctionalTestCase extends AbstractStockQuoteFunctionalTestCase { protected String getConfigResources() { return "stockquote-soap-config.xml"; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/examples/stockquote/src/test/java/org/mule/example/stockquote/WsdlStockQuoteFunctionalTestCase.javamule-2.0.1/examples/stockquote/src/test/java/org/mule/example/stockquote/WsdlStockQuoteFunctionalTes0000644000175000017500000000124210754375733033765 0ustar charlescharles/* * $Id: WsdlStockQuoteFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.example.stockquote; public class WsdlStockQuoteFunctionalTestCase extends AbstractStockQuoteFunctionalTestCase { protected String getConfigResources() { return "stockquote-wsdl-config.xml"; } } mule-2.0.1/examples/stockquote/src/test/resources/0000755000175000017500000000000011351411166022076 5ustar charlescharlesmule-2.0.1/examples/stockquote/src/test/resources/log4j.properties0000644000175000017500000000050210717401733025234 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/examples/stockquote/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000026410766272451026765 0ustar charlescharles# # Test cases listed in this file are not run. # # Requires tools.jar on the classpath for dynamic client compilation org.mule.example.stockquote.WsdlStockQuoteFunctionalTestCasemule-2.0.1/examples/stockquote/pom.xml0000644000175000017500000000537111006063605017637 0ustar charlescharles 4.0.0 org.mule.examples mule-examples 2.0.1 mule-example-stockquote Stock Quotes Example This example demonstrates how to invoke an ASPX web service from Mule and transform the result using XSLT and deserialise the result to a StockQuote javabean. The examples demonstrates invoking the service using REST and SOAP. conf src/main/resources org.mule.transports mule-transport-axis ${version} org.mule.transports mule-transport-cxf ${version} org.mule.transports mule-transport-vm ${version} org.mule.transports mule-transport-stdio ${version} org.mule.transports mule-transport-http ${version} org.mule.modules mule-module-spring-extras ${version} org.mule.tests mule-tests-functional ${version} test mule-2.0.1/examples/pom.xml0000644000175000017500000000456511006063605015442 0ustar charlescharles 4.0.0 org.mule mule 2.0.1 org.mule.examples mule-examples pom Mule Examples Mule Example Applications all-examples errorhandler hello scripting conf src/main/resources jdk15 1.5 echo loanbroker stockquote webapp osgi hello-osgi org.apache.felix maven-bundle-plugin conf, src/main/resources mule-2.0.1/tests/0000755000175000017500000000000011351411057013440 5ustar charlescharlesmule-2.0.1/tests/manual/0000755000175000017500000000000011351411057014715 5ustar charlescharlesmule-2.0.1/tests/manual/parallel/0000755000175000017500000000000011351411057016511 5ustar charlescharlesmule-2.0.1/tests/manual/parallel/mule-config.xml0000644000175000017500000000143310672263414021450 0ustar charlescharles mule-2.0.1/tests/manual/parallel/parallel.sh0000755000175000017500000000267010524214201020642 0ustar charlescharles#! /bin/sh # Test script for MULE-1152 (java service wrapper w/ support for multiple users/instances) # # 1. Place this script in $MULE_HOME/bin # 2. Place the dummy mule-config.xml in $MULE_HOME/conf/mule-config.xml # 3. Run this script and verify the expected output visually. # Start two Mule apps MULE_APP=mule1 export MULE_APP mule start MULE_APP=mule2 export MULE_APP mule start sleep 5 # Make sure both apps are running MULE_APP=mule1 export MULE_APP echo "mule1 should be running" mule status MULE_APP=mule2 export MULE_APP echo "mule2 should be running" mule status sleep 1 # Stop the first app MULE_APP=mule1 export MULE_APP mule stop sleep 5 # Only the second app should be running MULE_APP=mule1 export MULE_APP echo "mule1 should be stopped" mule status MULE_APP=mule2 export MULE_APP echo "mule2 should be running" mule status sleep 1 # Start the first app again MULE_APP=mule1 export MULE_APP mule start sleep 5 # Make sure both apps are running MULE_APP=mule1 export MULE_APP echo "mule1 should be running" mule status MULE_APP=mule2 export MULE_APP echo "mule2 should be running" mule status sleep 1 # Stop the second app MULE_APP=mule2 export MULE_APP mule stop sleep 5 # Only the first app should be running MULE_APP=mule1 export MULE_APP echo "mule1 should be running" mule status MULE_APP=mule2 export MULE_APP echo "mule2 should be stopped" mule status sleep 1 # Stop the first app MULE_APP=mule1 export MULE_APP mule stop mule-2.0.1/tests/archetypes/0000755000175000017500000000000011351411057015607 5ustar charlescharlesmule-2.0.1/tests/archetypes/project-archetype/0000755000175000017500000000000011351411056021236 5ustar charlescharlesmule-2.0.1/tests/archetypes/project-archetype/pom.xml0000644000175000017500000000374711006063605022566 0ustar charlescharles 4.0.0 org.mule.tests.archetypes mule-tests-archetypes 2.0.1 org.mule.tests.archetypes project-archetype jar Test for Mule Project Archetype foo org.mule.tools:mule-project-archetype -DartifactId=foo org.mule.tools mule-project-archetype ${version} org.mule.modules mule-module-spring-config ${version} org.codehaus.mojo.groovy groovy-maven-plugin org.codehaus.mojo build-helper-maven-plugin mule-2.0.1/tests/archetypes/RunArchetype.groovy0000644000175000017500000000271510776717717021522 0ustar charlescharles import org.apache.commons.io.FileUtils /* * Make sure that the archetype can do its job, i.e. remove any leftovers from * the last invocation of the archetype */ def buildDir = new File(project.build.directory) if (project.properties.outputDir == null) { fail("Specify a property 'outputDir' in the config section of the groovy-maven-plugin that invokes this script") } def existingProjectDir = new File(project.build.directory, project.properties.outputDir) if (existingProjectDir.exists()) { FileUtils.forceDelete(existingProjectDir) } /* * run Maven archetype */ def cmdline = "mvn -o " if (project.properties.archetype == null) { fail("Specify the archetype to be invoked via a property named 'archetype' in the config section of the groovy-maven-plugin that invokes this script") } def archetype = project.properties.archetype if (archetype.endsWith(":") == false) { archetype += ":" } cmdline += archetype + project.version + ":create " if (project.properties.archetypeParams != null) { cmdline += project.properties.archetypeParams } cmdline += " -DmuleVersion=" + project.version cmdline += " -Dinteractive=false" log.info("***** commandline: '" + cmdline + "'") // null means inherit parent's env ... def process = cmdline.execute(null, buildDir) // consume all output of the forked process. Otherwise it won't run. def input = new BufferedReader(new InputStreamReader(process.inputStream)) input.eachLine { log.info(it) } process.waitFor() mule-2.0.1/tests/archetypes/pom.xml0000644000175000017500000000544311006063605017131 0ustar charlescharles 4.0.0 org.mule.tests mule-tests 2.0.1 org.mule.tests.archetypes mule-tests-archetypes pom Mule Tests for Maven Archetypes transport-archetype project-archetype org.codehaus.mojo.groovy groovy-maven-plugin 1.0-beta-3 generate-test-sources execute commons-io commons-io 1.3.1 ${pom.basedir}/../RunArchetype.groovy org.codehaus.mojo build-helper-maven-plugin 1.0 generate-test-sources add-test-source ${project.build.directory}/${outputDir}/src/main/java mule-2.0.1/tests/archetypes/transport-archetype/0000755000175000017500000000000011351411057021625 5ustar charlescharlesmule-2.0.1/tests/archetypes/transport-archetype/pom.xml0000644000175000017500000000376511006063605023154 0ustar charlescharles 4.0.0 org.mule.tests.archetypes mule-tests-archetypes 2.0.1 org.mule.tests.archetypes transport-archetype jar Test for Mule Transport Archetype mule-transport-foo org.mule.tools:mule-transport-archetype -DtransportId=foo org.mule.tools mule-transport-archetype ${version} org.mule.modules mule-module-spring-config ${version} org.codehaus.mojo.groovy groovy-maven-plugin org.codehaus.mojo build-helper-maven-plugin mule-2.0.1/tests/integration-jdk5/0000755000175000017500000000000011351411057016616 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/0000755000175000017500000000000011351411057017405 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/0000755000175000017500000000000011351411057020364 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/java/0000755000175000017500000000000011351411057021305 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/java/org/0000755000175000017500000000000011351411057022074 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/0000755000175000017500000000000011351411057023036 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/0000755000175000017500000000000011351411057024015 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/config/0000755000175000017500000000000011351411057025262 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/config/MuleConfigurationTestCase.java0000644000175000017500000002346510770237302033230 0ustar charlescharles/* * $Id: MuleConfigurationTestCase.java 11428 2008-03-19 16:26:42Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.config; import org.mule.MuleServer; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.config.MuleConfiguration; import org.mule.api.context.MuleContextBuilder; import org.mule.config.DefaultMuleConfiguration; import org.mule.context.DefaultMuleContextBuilder; import org.mule.context.DefaultMuleContextFactory; import junit.framework.TestCase; public class MuleConfigurationTestCase extends TestCase { @Override protected void tearDown() throws Exception { muleContext = null; MuleServer.setMuleContext(null); RegistryContext.setRegistry(null); } private MuleContext muleContext; /** Test for MULE-3092 */ public void testConfigureProgramatically() throws Exception { DefaultMuleConfiguration config = new DefaultMuleConfiguration(); config.setDefaultEncoding("UTF-16"); config.setDefaultSynchronousEndpoints(true); config.setSystemModelType("direct"); config.setDefaultSynchronousEventTimeout(30000); config.setDefaultTransactionTimeout(60000); config.setDefaultRemoteSync(true); config.setWorkingDirectory("/some/directory"); config.setClientMode(true); config.setFailOnMessageScribbling(false); config.setId("MY_SERVER"); config.setClusterId("MY_CLUSTER"); config.setDomainId("MY_DOMAIN"); config.setCacheMessageAsBytes(false); config.setCacheMessageOriginalPayload(false); config.setEnableStreaming(false); config.setAssertMessageAccess(false); config.setAutoWrapMessageAwareTransform(false); MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder(); contextBuilder.setMuleConfiguration(config); muleContext = new DefaultMuleContextFactory().createMuleContext(contextBuilder); muleContext.start(); verifyConfiguration(); } /** Test for MULE-3092 */ public void testConfigureWithSystemProperties() throws Exception { System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "encoding", "UTF-16"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "endpoints.synchronous", "true"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "systemModelType", "direct"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "timeout.synchronous", "30000"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "timeout.transaction", "60000"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "remoteSync", "true"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "workingDirectory", "/some/directory"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "clientMode", "true"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "disable.threadsafemessages", "true"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "serverId", "MY_SERVER"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "clusterId", "MY_CLUSTER"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "domainId", "MY_DOMAIN"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "message.cacheBytes", "false"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "message.cacheOriginal", "false"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "streaming.enable", "false"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "message.assertAccess", "false"); System.setProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "transform.autoWrap", "false"); muleContext = new DefaultMuleContextFactory().createMuleContext(); muleContext.start(); verifyConfiguration(); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "encoding"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "endpoints.synchronous"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "systemModelType"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "timeout.synchronous"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "timeout.transaction"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "remoteSync"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "workingDirectory"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "clientMode"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "disable.threadsafemessages"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "serverId"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "clusterId"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "domainId"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "message.cacheBytes"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "message.cacheOriginal"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "streaming.enable"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "message.assertAccess"); System.clearProperty(MuleConfiguration.SYSTEM_PROPERTY_PREFIX + "transform.autoWrap"); } /** Test for MULE-3110 */ public void testConfigureAfterInitFails() throws Exception { muleContext = new DefaultMuleContextFactory().createMuleContext(); DefaultMuleConfiguration mutableConfig = ((DefaultMuleConfiguration) muleContext.getConfiguration()); // These are OK to change after init but before start mutableConfig.setDefaultSynchronousEndpoints(true); mutableConfig.setSystemModelType("direct"); mutableConfig.setDefaultSynchronousEventTimeout(30000); mutableConfig.setDefaultTransactionTimeout(60000); mutableConfig.setDefaultRemoteSync(true); mutableConfig.setClientMode(true); // These are not OK to change after init mutableConfig.setDefaultEncoding("UTF-16"); mutableConfig.setWorkingDirectory("/some/directory"); mutableConfig.setId("MY_SERVER"); mutableConfig.setClusterId("MY_CLUSTER"); mutableConfig.setDomainId("MY_DOMAIN"); MuleConfiguration config = muleContext.getConfiguration(); // These are OK to change after init but before start assertTrue(config.isDefaultSynchronousEndpoints()); assertEquals("direct", config.getSystemModelType()); assertEquals(30000, config.getDefaultSynchronousEventTimeout()); assertEquals(60000, config.getDefaultTransactionTimeout()); assertTrue(config.isDefaultRemoteSync()); assertTrue(config.isClientMode()); // These are not OK to change after init assertFalse("UTF-16".equals(config.getDefaultEncoding())); assertFalse("/some/directory".equals(config.getWorkingDirectory())); assertFalse("MY_SERVER".equals(config.getId())); assertFalse("MY_CLUSTER".equals(config.getClusterId())); assertFalse("MY_DOMAIN".equals(config.getDomainId())); } /** Test for MULE-3110 */ public void testConfigureAfterStartFails() throws Exception { muleContext = new DefaultMuleContextFactory().createMuleContext(); muleContext.start(); DefaultMuleConfiguration mutableConfig = ((DefaultMuleConfiguration) muleContext.getConfiguration()); mutableConfig.setDefaultSynchronousEndpoints(true); mutableConfig.setSystemModelType("direct"); mutableConfig.setDefaultSynchronousEventTimeout(30000); mutableConfig.setDefaultTransactionTimeout(60000); mutableConfig.setDefaultRemoteSync(true); mutableConfig.setClientMode(true); MuleConfiguration config = muleContext.getConfiguration(); assertFalse(config.isDefaultSynchronousEndpoints()); assertFalse("direct".equals(config.getSystemModelType())); assertFalse(30000 == config.getDefaultSynchronousEventTimeout()); assertFalse(60000 == config.getDefaultTransactionTimeout()); assertFalse(config.isDefaultRemoteSync()); assertFalse(config.isClientMode()); } protected void verifyConfiguration() { MuleConfiguration config = muleContext.getConfiguration(); assertEquals("UTF-16", config.getDefaultEncoding()); assertTrue(config.isDefaultSynchronousEndpoints()); assertEquals("direct", config.getSystemModelType()); assertEquals(30000, config.getDefaultSynchronousEventTimeout()); assertEquals(60000, config.getDefaultTransactionTimeout()); assertTrue(config.isDefaultRemoteSync()); assertEquals("/some/directory", config.getWorkingDirectory()); assertTrue(config.isClientMode()); assertFalse(config.isFailOnMessageScribbling()); assertEquals("MY_SERVER", config.getId()); assertEquals("MY_CLUSTER", config.getClusterId()); assertEquals("MY_DOMAIN", config.getDomainId()); assertFalse(config.isCacheMessageAsBytes()); assertFalse(config.isCacheMessageOriginalPayload()); assertFalse(config.isEnableStreaming()); assertFalse(config.isAssertMessageAccess()); assertFalse(config.isAutoWrapMessageAwareTransform()); } } mule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/usecases/0000755000175000017500000000000011351411057025630 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/usecases/ReplyToTestCase.java0000644000175000017500000000640310770443263031540 0ustar charlescharles/* * $Id: ReplyToTestCase.java 11446 2008-03-20 11:12:51Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.NullPayload; /** * see MULE-2721 */ public class ReplyToTestCase extends FunctionalTestCase { static final long RECEIVE_DELAY = 3000; @Override protected String getConfigResources() { return "org/mule/test/usecases/replyto.xml"; } public void testVm() throws Exception { MuleClient client = new MuleClient(); MuleMessage msg = new DefaultMuleMessage("testing"); msg.setReplyTo("ReplyTo"); // Send asynchronous request client.dispatch("EchoVm", msg, null); // Wait for asynchronous response MuleMessage result = client.request("ReplyTo", RECEIVE_DELAY); assertNotNull("Result is null", result); assertFalse("Result is null", result.getPayload() instanceof NullPayload); assertEquals("testing", result.getPayload()); // Make sure there are no more responses result = client.request("ReplyTo", RECEIVE_DELAY); assertNull("Extra message received at replyTo destination: " + result, result); } public void testAxis() throws Exception { MuleClient client = new MuleClient(); MuleMessage msg = new DefaultMuleMessage("testing"); msg.setReplyTo("ReplyTo"); // Send asynchronous request client.dispatch("EchoAxisSend", msg, null); // Wait for asynchronous response MuleMessage result = client.request("ReplyTo", RECEIVE_DELAY); assertNotNull("Result is null", result); assertFalse("Result is null", result.getPayload() instanceof NullPayload); assertEquals("testing", result.getPayload()); // Make sure there are no more responses result = client.request("ReplyTo", RECEIVE_DELAY); assertNull("Extra message received at replyTo destination: " + result, result); } public void testCxf() throws Exception { MuleClient client = new MuleClient(); MuleMessage msg = new DefaultMuleMessage("testing"); msg.setReplyTo("ReplyTo"); // Send asynchronous request client.dispatch("EchoCxfSend", msg, null); // Wait for asynchronous response MuleMessage result = client.request("ReplyTo", RECEIVE_DELAY); assertNotNull("Result is null", result); assertFalse("Result is null", result.getPayload() instanceof NullPayload); assertEquals("testing", result.getPayload()); // Make sure there are no more responses result = client.request("ReplyTo", RECEIVE_DELAY); assertNull("Extra message received at replyTo destination: " + result, result); } } mule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/integration/0000755000175000017500000000000011351411057026340 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/integration/transformer/0000755000175000017500000000000011351411057030702 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/integration/transformer/response/0000755000175000017500000000000011351411057032540 5ustar charlescharles././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/integration/transformer/response/ResponseTransformerScenariosTestCase.javamule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/integration/transformer/response/Respo0000644000175000017500000001743610770443263033576 0ustar charlescharles/* * $Id: ResponseTransformerScenariosTestCase.java 11446 2008-03-20 11:12:51Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transformer.response; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpMessageAdapter; public class ResponseTransformerScenariosTestCase extends FunctionalTestCase { private static String VM_INBOUND = " inbound"; private static String VM_OUTBOUND = " outbound"; private static String VM_RESPONSE = " response"; private static String VM_OUT_IN_RESP = VM_OUTBOUND + VM_INBOUND + VM_RESPONSE; private static String CUSTOM_RESPONSE = " customResponse"; @Override protected String getConfigResources() { return "org/mule/test/integration/transformer/response/response-transformer-scenarios.xml"; } // ***** RESPONSE ENDPONTS ON INBOUND ENDPOINTS USED FOR SYNC RESPONSE AFTER ROUTING ***** // Applied by DefaultInternalMessageListener // TODO FAILING MULE- 2969 // public void testXfireSyncResponseTransformer() throws Exception // { // MuleClient client = new MuleClient(); // MuleMessage message = client.send("xfire:http://localhost:4444/services/XFireSync?method=echo", // "request", // null); // assertNotNull(message); // assertEquals("request" + "customResponse", message.getPayloadAsString()); // } // TODO Not sure how to implement with axis // public void testAxisSyncResponseTransformer() throws Exception // { // MuleClient client = new MuleClient(); // MuleMessage message = client.send("axis:http://localhost:4445/services/AxisSync?method=echo", // "request", // null); // assertNotNull(message); // assertEquals("request" + "customResponse", message.getPayloadAsString()); // } public void testVmSync() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://sync", "request", null); assertNotNull(message); assertEquals("request" + VM_OUT_IN_RESP, message.getPayloadAsString()); } public void testVmSyncResponseTransformer() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://syncResponseTransformer", "request", null); assertNotNull(message); assertEquals("request" + VM_OUTBOUND + VM_INBOUND + CUSTOM_RESPONSE, message.getPayloadAsString()); } public void testHttpSync() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("http://localhost:4446", "request", null); assertNotNull(message); // Ensure MuleMessageToHttpResponse was used before sending response assertTrue(message.getAdapter() instanceof HttpMessageAdapter); assertEquals("text/plain; charset=UTF-8", ((HttpMessageAdapter) message.getAdapter()).getHeader("Content-Type") .getValue()); assertEquals("request", message.getPayloadAsString()); } public void testHttpSyncResponseTransformer() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("http://localhost:4447", "request", null); assertNotNull(message); // Ensure MuleMessageToHttpResponse was used before sending response // NOTE: With http setting custom response transformer does not replace transport default, becasue // custom transformers are called in DefaultInternalMessageListener and http transformer perform // explict response transformer afterwards in HttpMessageReciever.doRequest(HttpRequest request, // RequestLine requestLine) before returning result to client assertTrue(message.getAdapter() instanceof HttpMessageAdapter); assertEquals("text/plain; charset=UTF-8", ((HttpMessageAdapter) message.getAdapter()).getHeader("Content-Type") .getValue()); assertEquals("request" + CUSTOM_RESPONSE, message.getPayloadAsString()); } // ***** RESPONSE ENDPONTS ON INBOUND ENDPOINTS USED FOR REMOTE-SYNC RESPONSE AFTER ROUTRING ***** // Applied by ReplyToHandler public void testJmsSyncResponseTransformer() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("jms://sync", "request", null); assertNotNull(message); assertEquals("request" + CUSTOM_RESPONSE, message.getPayloadAsString()); } // ***** RESPONSE ENDPONTS ON OUTBOUND ENDPOINT ***** // Applied by DefaultMuleSession once result message is received from remote endpoint. public void testVmSyncOutboundEndpointResponseTransformer() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://syncOutboundEndpointResponseTransformer", "request", null); assertNotNull(message); // TODO Custom response transformer should be applied as response is received, but as remoteSync="false" // no transformation happens // Ross: really, if VM is sync, its remoteSync by default // Ross: I think the vm transport need to automatically set the the reote Sync flag if sync // assertEquals("request" + VM_OUTBOUND + VM_INBOUND + VM_OUT_IN_RESP + CUSTOM_RESPONSE + VM_RESPONSE, // message.getPayloadAsString()); assertEquals("request" + VM_OUTBOUND + VM_INBOUND + VM_OUT_IN_RESP + VM_RESPONSE, message.getPayloadAsString()); } public void testJmsRemoteSync() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://jmsSync", "request", null); assertNotNull(message); assertEquals("request" + VM_OUT_IN_RESP, message.getPayloadAsString()); } public void testJmsSyncOutboundEndpointResponseTransformer() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://jmsSyncOutboundEndpointResponseTransformer", "request", null); assertNotNull(message); assertEquals("request" + VM_OUT_IN_RESP, message.getPayloadAsString()); } public void testJmsRemoteSyncOutboundEndpointResponseTransformer() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://jmsRemoteSyncOutboundEndpointResponseTransformer", "request", null); assertNotNull(message); assertEquals("request" + VM_OUTBOUND + VM_INBOUND + CUSTOM_RESPONSE + VM_RESPONSE, message.getPayloadAsString()); } public void testChainedRouterOutboundEndpointResponseTransformer() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://chainedRouterOutboundEndpointResponseTransformer", "request", null); assertNotNull(message); assertEquals("request" + VM_OUTBOUND + VM_INBOUND + VM_OUT_IN_RESP + VM_OUT_IN_RESP + CUSTOM_RESPONSE + CUSTOM_RESPONSE + VM_RESPONSE, message.getPayloadAsString()); } public void testNestedRouterOutboundEndpointResponseTransformer() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://nestedRouterOutboundEndpointResponseTransformer", "request", null); assertNotNull(message); assertEquals("request" + VM_OUTBOUND + VM_INBOUND + VM_OUT_IN_RESP + CUSTOM_RESPONSE + CUSTOM_RESPONSE + VM_RESPONSE, message.getPayloadAsString()); } } mule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/integration/client/0000755000175000017500000000000011351411057027616 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/integration/client/MuleCxfSoapClientTestCase.javamule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/integration/client/MuleCxfSoapClientTe0000644000175000017500000000144310770462132033365 0ustar charlescharles/* * $Id: MuleCxfSoapClientTestCase.java 11451 2008-03-20 13:19:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; public class MuleCxfSoapClientTestCase extends MuleAxisSoapClientTestCase { @Override public String getSoapProvider() { return "cxf"; } @Override public void testRequestResponseComplex2() throws Exception { // TODO fix: cxf doesn't currently support overloaded methods } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/integration/client/MuleAxisSoapClientTestCase.javamule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/test/integration/client/MuleAxisSoapClientT0000644000175000017500000000562610770462132033413 0ustar charlescharles/* * $Id: MuleAxisSoapClientTestCase.java 11451 2008-03-20 13:19:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.services.Person; public class MuleAxisSoapClientTestCase extends FunctionalTestCase { public String getSoapProvider() { return "axis"; } protected String getConfigResources() { return "org/mule/test/integration/client/" + getSoapProvider() + "-client-test-mule-config.xml"; } public void testRequestResponse() throws Throwable { MuleClient client = new MuleClient(); MuleMessage result = client.send(getSoapProvider() + ":http://localhost:38104/mule/services/mycomponent2?method=echo", "test", null); assertNotNull(result); assertEquals("test", result.getPayloadAsString()); } public void testRequestResponseComplex() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send( getSoapProvider() + ":http://localhost:38104/mule/services/mycomponent3?method=getPerson", "Fred", null); assertNotNull(result); logger.debug(result.getPayload()); assertTrue(result.getPayload() instanceof Person); assertEquals("Fred", ((Person) result.getPayload()).getFirstName()); assertEquals("Flintstone", ((Person) result.getPayload()).getLastName()); } public void testRequestResponseComplex2() throws Exception { MuleClient client = new MuleClient(); String[] args = new String[]{"Betty", "Rubble"}; MuleMessage result = client.send( getSoapProvider() + ":http://localhost:38104/mule/services/mycomponent3?method=addPerson", args, null); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Betty", ((Person) result.getPayload()).getFirstName()); assertEquals("Rubble", ((Person) result.getPayload()).getLastName()); // do a receive result = client.send(getSoapProvider() + ":http://localhost:38104/mule/services/mycomponent3?method=getPerson", "Betty", null); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Betty", ((Person) result.getPayload()).getFirstName()); assertEquals("Rubble", ((Person) result.getPayload()).getLastName()); } } mule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/transport/0000755000175000017500000000000011351411057025072 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/transport/soap/0000755000175000017500000000000011351411057026034 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/transport/soap/axis/0000755000175000017500000000000011351411057027000 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/transport/soap/axis/AxisExceptionTestCase.javamule-2.0.1/tests/integration-jdk5/src/test/java/org/mule/transport/soap/axis/AxisExceptionTestCase.j0000644000175000017500000000475510770237302033410 0ustar charlescharles/* * $Id: AxisExceptionTestCase.java 11428 2008-03-19 16:26:42Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.transport.DispatchException; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.services.TestComponent; import org.mule.tck.testmodels.services.TestComponentException; public class AxisExceptionTestCase extends FunctionalTestCase { protected String getConfigResources() { return "axis-using-cxf-config.xml"; } public void testSuccessCall() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("axis:http://localhost:63381/services/AxisService?method=receive", new DefaultMuleMessage("test")); assertNotNull(reply); assertNotNull(reply.getPayload()); assertTrue(reply.getPayload() instanceof String); assertEquals("Received: test", reply.getPayloadAsString()); } public void testExceptionCall() throws Exception { try { MuleClient client = new MuleClient(); client.send("axis:http://localhost:63381/services/AxisService?method=throwsException", new DefaultMuleMessage("test")); fail("should have thrown exception"); } catch (DispatchException dispatchExc) { Throwable t = dispatchExc.getCause(); assertNotNull(t); assertEquals(TestComponentException.class.getName() + ": " + TestComponentException.MESSAGE_PREFIX + TestComponent.EXCEPTION_MESSAGE, t.getMessage()); } } public void testExceptionBasedRoutingForAxis() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm://localhost.test", new DefaultMuleMessage("test")); assertNotNull(reply); assertNotNull(reply.getPayload()); assertTrue(reply.getPayload() instanceof String); assertEquals("Received: test", reply.getPayloadAsString()); } } mule-2.0.1/tests/integration-jdk5/src/test/resources/0000755000175000017500000000000011351411057022376 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/resources/log4j.properties0000644000175000017500000000050310770402472025536 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/tests/integration-jdk5/src/test/resources/axis-using-cxf-config.xml0000644000175000017500000000454410770237302027242 0ustar charlescharles mule-2.0.1/tests/integration-jdk5/src/test/resources/org/0000755000175000017500000000000011351411057023165 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/0000755000175000017500000000000011351411057024127 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/0000755000175000017500000000000011351411057025106 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/usecases/0000755000175000017500000000000011351411057026721 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/usecases/replyto.xml0000644000175000017500000000356710770443263031164 0ustar charlescharles mule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/integration/0000755000175000017500000000000011351411057027431 5ustar charlescharlesmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/integration/transformer/0000755000175000017500000000000011351411057031773 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/integration/transformer/response/mule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/integration/transformer/response/0000755000175000017500000000000011351411057033631 5ustar charlescharles././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/integration/transformer/response/response-transformer-scenarios.xmlmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/integration/transformer/response/0000644000175000017500000001661010770402472033644 0ustar charlescharles mule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/integration/client/0000755000175000017500000000000011351411057030707 5ustar charlescharles././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/integration/client/axis-client-test-mule-config.xmlmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/integration/client/axis-client-te0000644000175000017500000000412110770462132033462 0ustar charlescharles ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/integration/client/cxf-client-test-mule-config.xmlmule-2.0.1/tests/integration-jdk5/src/test/resources/org/mule/test/integration/client/cxf-client-tes0000644000175000017500000000454410770462132033472 0ustar charlescharles mule-2.0.1/tests/integration-jdk5/pom.xml0000644000175000017500000000671611006063605020144 0ustar charlescharles 4.0.0 org.mule.tests mule-tests 2.0.1 mule-tests-integration-jdk5 Integration Tests that need JDK5 Tests which ensure that Mule sub projects work well together. jar org.apache.maven.plugins maven-surefire-plugin pertest org.mule mule-core ${version} test org.mule.modules mule-module-client ${version} org.mule.transports mule-transport-axis ${version} test org.mule.transports mule-transport-cxf ${version} test org.mule.transports mule-transport-jms ${version} test org.mule.transports mule-transport-tcp ${version} test org.mule.transports mule-transport-vm ${version} test org.mule.tests mule-tests-functional ${version} test org.mule.tests mule-tests-integration ${version} test test-jar org.apache.activemq activemq-core test mule-2.0.1/tests/osgi/0000755000175000017500000000000011351411042014373 5ustar charlescharlesmule-2.0.1/tests/osgi/src/0000755000175000017500000000000011351411042015162 5ustar charlescharlesmule-2.0.1/tests/osgi/src/test/0000755000175000017500000000000011351411042016141 5ustar charlescharlesmule-2.0.1/tests/osgi/src/test/java/0000755000175000017500000000000011351411042017062 5ustar charlescharlesmule-2.0.1/tests/osgi/src/test/java/org/0000755000175000017500000000000011351411042017651 5ustar charlescharlesmule-2.0.1/tests/osgi/src/test/java/org/mule/0000755000175000017500000000000011351411042020613 5ustar charlescharlesmule-2.0.1/tests/osgi/src/test/java/org/mule/osgi/0000755000175000017500000000000011351411042021554 5ustar charlescharlesmule-2.0.1/tests/osgi/src/test/java/org/mule/osgi/MuleBundleTest.java0000644000175000017500000001142710754375733025346 0ustar charlescharles/* * $Id: MuleBundleTest.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.osgi; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.springframework.osgi.test.ConfigurableBundleCreatorTests; /** * The test classes in this project will be turned into a virtual bundle * which is installed and the tests are then run inside the OSGi runtime. */ public class MuleBundleTest extends ConfigurableBundleCreatorTests { protected String getPlatformName() { return KNOPFLERFISH_PLATFORM; } /** * The manifest to use for the "virtual bundle" created * out of the test classes and resources in this project */ protected String getManifestLocation() { return "classpath:org/mule/osgi/test/MANIFEST.MF"; } /** * The location of the packaged OSGi bundles to be installed * for this test. Values are Spring resource paths. The bundles * we want to use are part of the same multi-project maven * build as this project is. Hence we use the localMavenArtifact * helper method to find the bundles produced by the package * phase of the maven build (these tests will run after the * packaging phase, in the integration-test phase). * * JUnit, commons-logging, spring-core and the spring OSGi * test bundle are automatically included so do not need * to be specified here. */ protected String[] getBundleLocations() { return new String[] { // Spring OSGi localMavenArtifact("org.springframework.osgi", "aopalliance.osgi","1.0-SNAPSHOT"), localMavenArtifact("org.springframework.osgi", "spring-context", "2.1-SNAPSHOT"), localMavenArtifact("org.springframework.osgi", "spring-beans","2.1-SNAPSHOT"), localMavenArtifact("org.springframework.osgi", "spring-osgi-core","1.0-SNAPSHOT"), localMavenArtifact("org.springframework.osgi", "spring-osgi-extender","1.0-SNAPSHOT"), localMavenArtifact("org.springframework.osgi", "spring-aop","2.1-SNAPSHOT"), // PAX Logging localMavenArtifact("org.ops4j.pax.logging", "api","0.9.4"), localMavenArtifact("org.ops4j.pax.logging", "service","0.9.4"), localMavenArtifact("org.ops4j.pax.logging", "log4j","0.9.4"), localMavenArtifact("org.ops4j.pax.logging", "slf4j","0.9.4"), localMavenArtifact("org.ops4j.pax.logging", "jcl","0.9.4"), // Mule localMavenArtifact("org.mule", "mule-core","2.0-REGISTRY"), localMavenArtifact("org.mule.module", "mule-module-osgi","2.0-REGISTRY") //localMavenArtifact("org.mule.example", "mule-example-hello-osgi","2.0-REGISTRY") }; } /** * The superclass provides us access to the root bundle * context via the 'getBundleContext' operation */ public void testOSGiStartedOk() { BundleContext bundleContext = getBundleContext(); assertNotNull(bundleContext); } public void testMuleBundlesExported() { BundleContext context = getBundleContext(); assertTrue("Bundle should be loaded in the OSGi framework.", isBundleLoaded(context, "org.mule.core")); assertFalse("Bundle should not be loaded in the OSGi framework.", isBundleLoaded(context, "org.mule.bogus")); } // public void testMuleServiceExported() { // waitOnContextCreation("org.mule.core"); // BundleContext context = getBundleContext(); // ServiceReference ref = context.getServiceReference(MuleSoaManager.class.getName()); // assertNotNull("Service Reference is null", ref); // try { // UMOManager manager = (UMOManager) context.getService(ref); // assertNotNull("Cannot find the service", manager); // // TODO What do we test for? // //assertEquals("something",managementContext.getSomething()); // } finally { // context.ungetService(ref); // } // } // This method is in OsgiUtils, but gives linker errors when called from another bundle, so we repeat it here for now. public static boolean isBundleLoaded(BundleContext context, String symbolicName) { Bundle[] bundles = context.getBundles(); for (int i=0; i 4.0.0 org.mule.tests mule-tests ../pom.xml 2.0.1 mule-tests-osgi OSGi Tests Tests which run inside an OSGi framework jar org.mule.modules mule-module-osgi ${version} provided org.springframework.osgi org.springframework.osgi.test 1.0-SNAPSHOT provided junit junit 3.8.1 test log4j log4j 1.2.13 provided mule-2.0.1/tests/functional/0000755000175000017500000000000011351411047015601 5ustar charlescharlesmule-2.0.1/tests/functional/src/0000755000175000017500000000000011351411045016366 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/0000755000175000017500000000000011351411046017313 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/0000755000175000017500000000000011351411045020233 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/org/0000755000175000017500000000000011351411045021022 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/org/mule/0000755000175000017500000000000011351411046021765 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/org/mule/tck/0000755000175000017500000000000011351411046022546 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/org/mule/tck/jndi/0000755000175000017500000000000011351411046023472 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/org/mule/tck/jndi/InMemoryContext.java0000644000175000017500000001004210664703640027450 0ustar charlescharles/* * $Id: InMemoryContext.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.jndi; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; import javax.naming.Context; import javax.naming.Name; import javax.naming.NameParser; import javax.naming.NamingEnumeration; import javax.naming.NamingException; /** * Simple in-memory JNDI context for unit testing. */ public class InMemoryContext implements Context { private Map context = new HashMap(); public Object lookup(Name name) throws NamingException { return context.get(name); } public Object lookup(String name) throws NamingException { return context.get(name); } public void bind(Name name, Object obj) throws NamingException { context.put(name, obj); } public void bind(String name, Object obj) throws NamingException { context.put(name, obj); } public void unbind(Name name) throws NamingException { context.remove(name); } public void unbind(String name) throws NamingException { context.remove(name); } public void rebind(Name name, Object obj) throws NamingException { unbind(name); bind(name, obj); } public void rebind(String name, Object obj) throws NamingException { unbind(name); bind(name, obj); } ////////////////////////////////////////////////////////////////////// // The remaining methods are not implemented. ////////////////////////////////////////////////////////////////////// public Object addToEnvironment(String propName, Object propVal) throws NamingException { return null; } public void close() throws NamingException { // nop } public Name composeName(Name name, Name prefix) throws NamingException { return null; } public String composeName(String name, String prefix) throws NamingException { return null; } public Context createSubcontext(Name name) throws NamingException { return null; } public Context createSubcontext(String name) throws NamingException { return null; } public void destroySubcontext(Name name) throws NamingException { // nop } public void destroySubcontext(String name) throws NamingException { // nop } public Hashtable getEnvironment() throws NamingException { return null; } public String getNameInNamespace() throws NamingException { return null; } public NameParser getNameParser(Name name) throws NamingException { return null; } public NameParser getNameParser(String name) throws NamingException { return null; } public NamingEnumeration list(Name name) throws NamingException { return null; } public NamingEnumeration list(String name) throws NamingException { return null; } public NamingEnumeration listBindings(Name name) throws NamingException { return null; } public NamingEnumeration listBindings(String name) throws NamingException { return null; } public Object lookupLink(Name name) throws NamingException { return null; } public Object lookupLink(String name) throws NamingException { return null; } public Object removeFromEnvironment(String propName) throws NamingException { return null; } public void rename(Name oldName, Name newName) throws NamingException { // nop } public void rename(String oldName, String newName) throws NamingException { // nop } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/jndi/InMemoryContextFactory.java0000644000175000017500000000173110664703640031005 0ustar charlescharles/* * $Id: InMemoryContextFactory.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.jndi; import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingException; import javax.naming.spi.InitialContextFactory; /** * Simple in-memory JNDI context for unit testing. */ public class InMemoryContextFactory implements InitialContextFactory { public Context getInitialContext() throws NamingException { return getInitialContext(null); } public Context getInitialContext(Hashtable environment) throws NamingException { return new InMemoryContext(); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/jndi/TestContextFactory.java0000644000175000017500000000276610664703640030176 0ustar charlescharles/* * $Id: TestContextFactory.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.jndi; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Banana; import org.mule.tck.testmodels.fruit.Orange; import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingException; /** * Creates an in-memory context and populates it with test data. */ public class TestContextFactory extends InMemoryContextFactory { public Context getInitialContext() throws NamingException { Context context = super.getInitialContext(); populateTestData(context); return context; } public Context getInitialContext(Hashtable environment) throws NamingException { Context context = super.getInitialContext(environment); populateTestData(context); return context; } protected void populateTestData(Context context) throws NamingException { context.bind("fruit/apple", new Apple()); context.bind("fruit/banana", new Banana()); context.bind("fruit/orange", new Orange(new Integer(8), new Double(10), "Florida Sunny")); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/FunctionalTestCase.java0000644000175000017500000000675310770575334027201 0ustar charlescharles/* * $Id: FunctionalTestCase.java 11459 2008-03-21 00:01:32Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck; import org.mule.api.component.JavaComponent; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.registry.RegistrationException; import org.mule.api.service.Service; import org.mule.component.AbstractJavaComponent; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; /** * Is a base tast case for tests that initialise Mule using a configuration file. The * default configuration builder used is the MuleXmlConfigurationBuilder. This you * need to have the mule-modules-builders module/jar on your classpath. If you want * to use a different builder, just overload the getBuilder() method * of this class to return the type of builder you want to use with your test. Note * you can overload the getBuilder() to return an initialised instance * of the QuickConfiguratonBuilder, this allows the developer to programmatically * build a Mule instance and roves the need for additional config files for the test. */ public abstract class FunctionalTestCase extends AbstractMuleTestCase { /** Expected response after the test message has passed through the FunctionalTestComponent. */ public static final String TEST_MESSAGE_RESPONSE = FunctionalTestComponent.received(TEST_MESSAGE); public FunctionalTestCase() { super(); // A functional test case starts up the management context by default. setStartContext(true); } protected ConfigurationBuilder getBuilder() throws Exception { return new SpringXmlConfigurationBuilder(getConfigurationResources()); } //Delegate to an abstract method to ensure that FunctionalTestCases know they need to pass in config resources protected String getConfigurationResources() { return getConfigResources(); } protected abstract String getConfigResources(); protected Object getComponent(String serviceName) throws Exception { Service service = muleContext.getRegistry().lookupService(serviceName); if (service != null) { return getComponent(service); } else { throw new RegistrationException("Service " + serviceName + " not found in Registry"); } } protected Object getComponent(Service service) throws Exception { if (service.getComponent() instanceof JavaComponent) { return ((AbstractJavaComponent) service.getComponent()).getObjectFactory().getInstance(); } else { fail("Componnent is not a JavaComponent and therefore has no component object instance"); return null; } } protected String loadResourceAsString(String name) throws IOException { return IOUtils.getResourceAsString(name, getClass()); } protected InputStream loadResource(String name) throws IOException { return IOUtils.getResourceAsStream(name, getClass()); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/AbstractScriptConfigBuilderTestCase.java0000644000175000017500000003263210777340262032454 0ustar charlescharles/* * $Id: AbstractScriptConfigBuilderTestCase.java 11554 2008-04-10 07:24:34Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck; import org.mule.AbstractExceptionListener; import org.mule.api.MuleException; import org.mule.api.component.JavaComponent; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.model.Model; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.routing.NestedRouter; import org.mule.api.routing.NestedRouterCollection; import org.mule.api.routing.OutboundRouter; import org.mule.api.routing.OutboundRouterCollection; import org.mule.api.routing.ResponseRouter; import org.mule.api.routing.ResponseRouterCollection; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.model.resolvers.LegacyEntryPointResolverSet; import org.mule.routing.ForwardingCatchAllStrategy; import org.mule.routing.filters.MessagePropertyFilter; import org.mule.routing.outbound.OutboundPassThroughRouter; import org.mule.tck.testmodels.fruit.FruitCleaner; import org.mule.tck.testmodels.mule.TestCompressionTransformer; import org.mule.tck.testmodels.mule.TestConnector; import org.mule.tck.testmodels.mule.TestEntryPointResolverSet; import org.mule.tck.testmodels.mule.TestExceptionStrategy; import org.mule.tck.testmodels.mule.TestInboundTransformer; import org.mule.tck.testmodels.mule.TestResponseAggregator; import org.mule.transformer.TransformerUtils; import java.util.List; import java.util.Map; public abstract class AbstractScriptConfigBuilderTestCase extends FunctionalTestCase { // use legacy entry point resolver? private boolean legacy; protected AbstractScriptConfigBuilderTestCase() { this(false); } protected AbstractScriptConfigBuilderTestCase(boolean legacy) { this.legacy = legacy; } public void testManagerConfig() throws Exception { assertEquals("true", muleContext.getRegistry().lookupObject("doCompression")); assertNotNull(muleContext.getTransactionManager()); } public void testConnectorConfig() throws Exception { TestConnector c = (TestConnector) muleContext.getRegistry().lookupConnector("dummyConnector"); assertNotNull(c); assertNotNull(c.getExceptionListener()); assertTrue(c.getExceptionListener() instanceof TestExceptionStrategy); } public void testGlobalEndpointConfig() throws MuleException { ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "fruitBowlEndpoint"); assertNotNull(endpoint); assertEquals(endpoint.getEndpointURI().getAddress(), "fruitBowlPublishQ"); MessagePropertyFilter filter = (MessagePropertyFilter)endpoint.getFilter(); assertNotNull(filter); assertEquals("foo=bar", filter.getExpression()); ImmutableEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("testEPWithCS"); assertNotNull(ep); } public void testEndpointConfig() throws MuleException { // test that endpoints have been resolved on endpoints ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "waterMelonEndpoint"); assertNotNull(endpoint); // aliases no longer possible assertEquals("test.queue", endpoint.getEndpointURI().getAddress()); Service service = muleContext.getRegistry().lookupService("orangeComponent"); ImmutableEndpoint ep = service.getInboundRouter().getEndpoint("Orange"); assertNotNull(ep); final List responseTransformers = ep.getResponseTransformers(); assertNotNull(responseTransformers); assertFalse(responseTransformers.isEmpty()); final Object responseTransformer = responseTransformers.get(0); assertTrue(responseTransformer instanceof TestCompressionTransformer); } public void testExceptionStrategy() { Service service = muleContext.getRegistry().lookupService("orangeComponent"); assertNotNull(muleContext.getRegistry().lookupModel("main").getExceptionListener()); assertNotNull(service.getExceptionListener()); assertTrue(((AbstractExceptionListener) service.getExceptionListener()).getEndpoints().size() > 0); ImmutableEndpoint ep = (ImmutableEndpoint) ((AbstractExceptionListener) service.getExceptionListener()).getEndpoints() .get(0); assertEquals("test://orange.exceptions", ep.getEndpointURI().toString()); } public void testTransformerConfig() { Transformer t = muleContext.getRegistry().lookupTransformer("TestCompressionTransformer"); assertNotNull(t); assertTrue(t instanceof TestCompressionTransformer); assertEquals(t.getReturnClass(), String.class); assertNotNull(((TestCompressionTransformer) t).getContainerProperty()); } public void testModelConfig() throws Exception { Model model = muleContext.getRegistry().lookupModel("main"); assertNotNull(model); assertEquals("main", model.getName()); if (legacy) { assertTrue(model.getEntryPointResolverSet() instanceof LegacyEntryPointResolverSet); } else { assertTrue(model.getEntryPointResolverSet() instanceof TestEntryPointResolverSet); } assertTrue(model.getExceptionListener() instanceof TestExceptionStrategy); assertTrue(((AbstractExceptionListener) model.getExceptionListener()).getEndpoints().size() > 0); ImmutableEndpoint ep = (ImmutableEndpoint) ((AbstractExceptionListener) model.getExceptionListener()).getEndpoints() .get(0); assertEquals("test://component.exceptions", ep.getEndpointURI().toString()); // assertTrue(model.isComponentRegistered("orangeComponent")); } /* * Since MULE-1933, Service no longer has properties and most properties are set on endpoint. * So lets continue to test properties, but on endpoints instead. */ public void testEndpointPropertiesConfig() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "endpointWithProps"); Map props = endpoint.getProperties(); assertNotNull(props); assertEquals("9", props.get("segments")); assertEquals("4.21", props.get("radius")); assertEquals("Juicy Baby!", props.get("brand")); assertNotNull(props.get("listProperties")); List list = (List) props.get("listProperties"); assertEquals(3, list.size()); assertEquals("prop1", list.get(0)); assertEquals("prop2", list.get(1)); assertEquals("prop3", list.get(2)); assertNotNull(props.get("arrayProperties")); list = (List) props.get("arrayProperties"); assertEquals(3, list.size()); assertEquals("prop4", list.get(0)); assertEquals("prop5", list.get(1)); assertEquals("prop6", list.get(2)); assertNotNull(props.get("mapProperties")); props = (Map) props.get("mapProperties"); assertEquals("prop1", props.get("prop1")); assertEquals("prop2", props.get("prop2")); assertEquals(6, endpoint.getProperties().size()); } public void testOutboundRouterConfig() { // test outbound message router Service service = muleContext.getRegistry().lookupService("orangeComponent"); assertNotNull(service.getOutboundRouter()); OutboundRouterCollection router = service.getOutboundRouter(); assertNull(router.getCatchAllStrategy()); assertEquals(1, router.getRouters().size()); // check first Router OutboundRouter route1 = (OutboundRouter) router.getRouters().get(0); assertTrue(route1 instanceof OutboundPassThroughRouter); assertEquals(1, route1.getEndpoints().size()); } public void testNestedRouterConfig() { // test outbound message router Service service = muleContext.getRegistry().lookupService("orangeComponent"); assertNotNull(service.getComponent()); assertTrue(service.getComponent() instanceof JavaComponent); NestedRouterCollection router = ((JavaComponent) service.getComponent()).getNestedRouter(); assertNotNull(router); assertEquals(2, router.getRouters().size()); // check first Router NestedRouter route1 = (NestedRouter) router.getRouters().get(0); assertEquals(FruitCleaner.class, route1.getInterface()); assertEquals("wash", route1.getMethod()); assertNotNull(route1.getEndpoint()); // check second Router NestedRouter route2 = (NestedRouter) router.getRouters().get(1); assertEquals(FruitCleaner.class, route2.getInterface()); assertEquals("polish", route2.getMethod()); assertNotNull(route1.getEndpoint()); } public void testDescriptorEndpoints() { Service service = muleContext.getRegistry().lookupService("orangeComponent"); assertEquals(1, service.getOutboundRouter().getRouters().size()); OutboundRouter router = (OutboundRouter)service.getOutboundRouter().getRouters().get(0); assertEquals(1, router.getEndpoints().size()); ImmutableEndpoint endpoint = (ImmutableEndpoint) router.getEndpoints().get(0); assertNotNull(endpoint); assertEquals("appleInEndpoint", endpoint.getName()); assertNotNull(endpoint.getTransformers()); assertTrue(TransformerUtils.firstOrNull(endpoint.getTransformers()) instanceof TestCompressionTransformer); // check the global endpoint try { endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("appleInEndpoint"); } catch (MuleException e) { e.printStackTrace(); fail(e.getMessage()); } assertNotNull(endpoint); assertEquals(1, endpoint.getTransformers().size()); assertTrue(endpoint.getTransformers().get(0) instanceof TestInboundTransformer); assertEquals(2, service.getInboundRouter().getEndpoints().size()); assertNotNull(service.getInboundRouter().getCatchAllStrategy()); assertTrue(service.getInboundRouter().getCatchAllStrategy() instanceof ForwardingCatchAllStrategy); assertNotNull(service.getInboundRouter().getCatchAllStrategy().getEndpoint()); assertEquals("test://catch.all", service.getInboundRouter() .getCatchAllStrategy() .getEndpoint() .getEndpointURI() .toString()); endpoint = service.getInboundRouter().getEndpoint("orangeEndpoint"); assertNotNull(endpoint); assertEquals("orangeEndpoint", endpoint.getName()); assertEquals("orangeQ", endpoint.getEndpointURI().getAddress()); assertNotNull(endpoint.getTransformers()); assertTrue(TransformerUtils.firstOrNull(endpoint.getTransformers()) instanceof TestCompressionTransformer); // check the global endpoint try { endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("orangeEndpoint"); } catch (MuleException e) { e.printStackTrace(); fail(e.getMessage()); } assertNotNull(endpoint); assertFalse(endpoint.getTransformers().isEmpty()); assertTrue(endpoint.getTransformers().get(0) instanceof TestInboundTransformer); } public void testInboundRouterConfig() { Service service = muleContext.getRegistry().lookupService("orangeComponent"); assertNotNull(service.getInboundRouter()); InboundRouterCollection messageRouter = service.getInboundRouter(); assertNotNull(messageRouter.getCatchAllStrategy()); assertEquals(0, messageRouter.getRouters().size()); assertTrue(messageRouter.getCatchAllStrategy() instanceof ForwardingCatchAllStrategy); assertEquals(2, messageRouter.getEndpoints().size()); } public void testResponseRouterConfig() { Service service = muleContext.getRegistry().lookupService("orangeComponent"); assertNotNull(service.getResponseRouter()); ResponseRouterCollection messageRouter = service.getResponseRouter(); assertNull(messageRouter.getCatchAllStrategy()); assertEquals(10001, messageRouter.getTimeout()); assertEquals(1, messageRouter.getRouters().size()); ResponseRouter router = (ResponseRouter) messageRouter.getRouters().get(0); assertTrue(router instanceof TestResponseAggregator); assertNotNull(messageRouter.getEndpoints()); assertEquals(2, messageRouter.getEndpoints().size()); ImmutableEndpoint ep = (ImmutableEndpoint) messageRouter.getEndpoints().get(0); assertEquals("response1", ep.getEndpointURI().getAddress()); assertTrue(ep instanceof InboundEndpoint); ep = (ImmutableEndpoint) messageRouter.getEndpoints().get(1); assertEquals("AppleResponseQueue", ep.getEndpointURI().getAddress()); assertTrue(ep instanceof InboundEndpoint); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/exceptions/0000755000175000017500000000000011351411046024727 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/org/mule/tck/exceptions/FunctionalTestException.java0000644000175000017500000000136410770772424032435 0ustar charlescharles/* * $Id: FunctionalTestException.java 11464 2008-03-21 17:49:08Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.exceptions; import org.mule.api.DefaultMuleException; public class FunctionalTestException extends DefaultMuleException { public static final String EXCEPTION_MESSAGE = "Functional Test Service Exception"; public FunctionalTestException() { super(EXCEPTION_MESSAGE); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/config/0000755000175000017500000000000011351411046024013 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/org/mule/tck/config/TestNamespaceHandler.java0000644000175000017500000000167510770575334030740 0ustar charlescharles/* * $Id: TestNamespaceHandler.java 11459 2008-03-21 00:01:32Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.tck.testmodels.mule.TestConnector; public class TestNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerConnectorDefinitionParser(TestConnector.class); registerBeanDefinitionParser("component", new TestComponentDefinitionParser()); //This is handled by the TestComponentDefinitionParser registerIgnoredElement("return-data"); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/config/TestComponentDefinitionParser.java0000644000175000017500000001073610777661265032702 0ustar charlescharles/* * $Id: TestComponentDefinitionParser.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.config; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.component.DefaultJavaComponent; import org.mule.config.spring.parsers.specific.ComponentDefinitionParser; import org.mule.object.AbstractObjectFactory; import org.mule.object.SingletonObjectFactory; import org.mule.tck.functional.FunctionalTestComponent2; import org.mule.util.IOUtils; import org.mule.util.StringUtils; import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.GenericBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Configures a FunctionalTestComponent wrapped as a JavaComponent. Theis parser provides a short form way of * configuring a test component in Mule. */ public class TestComponentDefinitionParser extends ComponentDefinitionParser { private static Class OBJECT_FACTORY_TYPE = SingletonObjectFactory.class; private Class componentInstanceClass = FunctionalTestComponent2.class; public TestComponentDefinitionParser() { super(DefaultJavaComponent.class); addIgnored("appendString"); addIgnored("enableMessageHistory"); addIgnored("enableNotifications"); addIgnored("throwException"); addIgnored("exceptionToThrow"); addIgnored("waitTime"); } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Element parent = (Element) element.getParentNode(); String serviceName = parent.getAttribute(ATTRIBUTE_NAME); builder.addPropertyReference("service", serviceName); // Create a BeanDefinition for the nested object factory and set it a // property value for the component AbstractBeanDefinition objectFactoryBeanDefinition = new GenericBeanDefinition(); objectFactoryBeanDefinition.setBeanClass(OBJECT_FACTORY_TYPE); objectFactoryBeanDefinition.getPropertyValues().addPropertyValue(AbstractObjectFactory.ATTRIBUTE_OBJECT_CLASS, componentInstanceClass); objectFactoryBeanDefinition.setInitMethodName(Initialisable.PHASE_NAME); objectFactoryBeanDefinition.setDestroyMethodName(Disposable.PHASE_NAME); Map props = new HashMap(); for (int i = 0; i < element.getAttributes().getLength(); i++) { Node n = element.getAttributes().item(i); props.put(n.getLocalName(), n.getNodeValue()); } String returnData = null; NodeList list = element.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { if ("return-data".equals(list.item(i).getLocalName())) { Element rData = (Element) list.item(i); if (StringUtils.isNotEmpty(rData.getAttribute("file"))) { String file = rData.getAttribute("file"); try { returnData = IOUtils.getResourceAsString(file, getClass()); } catch (IOException e) { throw new BeanCreationException("Failed to load test-data resource: " + file, e); } } else { returnData = rData.getTextContent(); } break; } } if (returnData != null) { props.put("returnData", returnData); } objectFactoryBeanDefinition.getPropertyValues().addPropertyValue("properties", props); builder.addPropertyValue("objectFactory", objectFactoryBeanDefinition); super.parseChild(element, parserContext, builder); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/0000755000175000017500000000000011351411046024710 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/FunctionalTestComponent.java0000644000175000017500000003236210774254333032422 0ustar charlescharles/* * $Id: FunctionalTestComponent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.MuleServer; import org.mule.RequestContext; import org.mule.api.DefaultMuleException; import org.mule.api.MuleContext; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.config.i18n.MessageFactory; import org.mule.tck.exceptions.FunctionalTestException; import org.mule.util.NumberUtils; import org.mule.util.StringMessageUtils; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * FunctionalTestComponent is a service that can be used by * functional tests. This service accepts an EventCallback that can be used to * assert the state of the current event. *

* Also, this service fires {@link FunctionalTestNotification} via Mule for every message received. * Tests can register with Mule to receive these events by implementing * {@link FunctionalTestNotificationListener}. * * @see org.mule.tck.functional.EventCallback * @see org.mule.tck.functional.FunctionalTestNotification * @see org.mule.tck.functional.FunctionalTestNotificationListener */ public class FunctionalTestComponent implements Callable, Initialisable, Disposable { protected transient Log logger = LogFactory.getLog(getClass()); public static final int STREAM_SAMPLE_SIZE = 4; public static final int STREAM_BUFFER_SIZE = 4096; private EventCallback eventCallback; private Object returnMessage = null; private boolean appendComponentName = false; private boolean throwException = false; private boolean enableMessageHistory = true; private boolean addReceived = true; private boolean asString = true; /** * Keeps a list of any messages received on this service. Note that only references * to the messages (objects) are stored, so any subsequent changes to the objects * will change the history. */ private List messageHistory; public void initialise() { if (enableMessageHistory) { messageHistory = new CopyOnWriteArrayList(); } } public void dispose() { // nothing to do } /** {@inheritDoc} */ public Object onCall(MuleEventContext context) throws Exception { if (enableMessageHistory) { messageHistory.add(context.transformMessage()); } String contents = context.transformMessageToString(); String msg = StringMessageUtils.getBoilerPlate("Message Received in service: " + context.getService().getName() + ". Content is: " + StringMessageUtils.truncate(contents, 100, true), '*', 80); logger.info(msg); if (eventCallback != null) { eventCallback.eventReceived(context, this); } Object replyMessage; if (returnMessage != null) { replyMessage = returnMessage; } else { if (isAsString()) { replyMessage = (addReceived ? received(contents) : contents) + (appendComponentName ? " " + context.getService().getName() : ""); } else { replyMessage = context.getMessage().getPayload(); } } MuleContext muleContext = context.getMuleContext(); if (muleContext == null) { logger.warn("No MuleContext available from MuleEventContext"); muleContext = MuleServer.getMuleContext(); } muleContext.fireNotification( new FunctionalTestNotification(context, replyMessage, FunctionalTestNotification.EVENT_RECEIVED)); if (throwException) { throw new FunctionalTestException(); } return replyMessage; } /** * Append " Received" to contents. Exposed as static method so tests can call to * construct string for comparison. * * @param contents * @return Extended message */ public static String received(String contents) { return contents + " Received"; } /** * This method duplicates much of the functionality for the {@link #onCall} method above. This method is currently * used by some WebServices tests where you don' want to be introducing the {@link org.mule.api.MuleEventContext} as * a complex type. * TODO: It would be nice to remove this method or at least refactor the methods so there is little or no duplication * * @param data the event data received * @return the processed message * @throws Exception */ public Object onReceive(Object data) throws Exception { MuleEventContext context = RequestContext.getEventContext(); String contents = data.toString(); String msg = StringMessageUtils.getBoilerPlate("Message Received in service: " + context.getService().getName() + ". Content is: " + StringMessageUtils.truncate(contents, 100, true), '*', 80); logger.info(msg); if (eventCallback != null) { eventCallback.eventReceived(context, this); } Object replyMessage; if (returnMessage != null) { replyMessage = returnMessage; } else { replyMessage = contents + " Received"; } context.getMuleContext().fireNotification( new FunctionalTestNotification(context, replyMessage, FunctionalTestNotification.EVENT_RECEIVED)); if (throwException) { if (returnMessage != null && returnMessage instanceof Exception) { throw (Exception) returnMessage; } else { throw new DefaultMuleException(MessageFactory.createStaticMessage("Functional Test Service Exception")); } } return replyMessage; } /** * An event callback is called when a message is received by the service. * An MuleEvent callback isn't strictly required but it is usfal for performing assertions * on the current message being received. * Note that the FunctionalTestComponent should be made a singleton * {@link org.mule.api.UMODescriptor#setSingleton} when using MuleEvent callbacks *

* Another option is to register a {@link FunctionalTestNotificationListener} with Mule and this * will deleiver a {@link FunctionalTestNotification} for every message received by this service * * @return the callback to call when a message is received * @see org.mule.api.UMODescriptor * @see org.mule.tck.functional.FunctionalTestNotification * @see org.mule.tck.functional.FunctionalTestNotificationListener */ public EventCallback getEventCallback() { return eventCallback; } /** * An event callback is called when a message is received by the service. * An MuleEvent callback isn't strictly required but it is usfal for performing assertions * on the current message being received. * Note that the FunctionalTestComponent should be made a singleton * {@link org.mule.api.UMODescriptor#setSingleton} when using MuleEvent callbacks *

* Another option is to register a {@link FunctionalTestNotificationListener} with Mule and this * will deleiver a {@link FunctionalTestNotification} for every message received by this service * * @param eventCallback the callback to call when a message is received * @see org.mule.api.UMODescriptor * @see org.mule.tck.functional.FunctionalTestNotification * @see org.mule.tck.functional.FunctionalTestNotificationListener */ public void setEventCallback(EventCallback eventCallback) { this.eventCallback = eventCallback; } /** * Often you will may want to return a fixed message payload to simulate and external system call. * This can be done using the 'returnMessage' property. Note that you can return complex objects by * using the element in the Xml configuration. * * @return the message payload to always return from this service instance */ public Object getReturnMessage() { return returnMessage; } /** * Often you will may want to return a fixed message payload to simulate and external system call. * This can be done using the 'returnMessage' property. Note that you can return complex objects by * using the element in the Xml configuration. * * @param returnMessage the message payload to always return from this service instance */ public void setReturnMessage(Object returnMessage) { this.returnMessage = returnMessage; } /** * Sometimes you will want the service to always throw an exception, if this is the case you can * set the 'throwException' property to true. * * @return throwException true if an exception should always be thrown from this instance. * If the {@link #returnMessage} property is set and is of type * java.lang.Exception, that exception will be thrown. */ public boolean isThrowException() { return throwException; } /** * Sometimes you will want the service to always throw an exception, if this is the case you can * set the 'throwException' property to true. * * @param throwException true if an exception should always be thrown from this instance. * If the {@link #returnMessage} property is set and is of type * java.lang.Exception, that exception will be thrown. */ public void setThrowException(boolean throwException) { this.throwException = throwException; } /** * This will cause the service to append the compoent name to the end of the message * returned from this service. This only works when processing String messages. * This feature is useful when processing multiple messages using a pool of FunctionalTestComponents * to determine who processed the resulting message * * @return true if the service name will be appended to the return message */ public boolean isAppendComponentName() { return appendComponentName; } /** * This will cause the service to append the compoent name to the end of the message * returned from this service. This only works when processing String messages. * This feature is useful when processing multiple messages using a pool of FunctionalTestComponents * to determine who processed the resulting message * * @param appendComponentName true if the service name will be appended to the return message */ public void setAppendComponentName(boolean appendComponentName) { this.appendComponentName = appendComponentName; } public boolean isEnableMessageHistory() { return enableMessageHistory; } public void setEnableMessageHistory(boolean enableMessageHistory) { this.enableMessageHistory = enableMessageHistory; } /** If enableMessageHistory = true, returns the number of messages received by this service. */ public int getReceivedMessages() { if (messageHistory != null) { return messageHistory.size(); } else { return NumberUtils.INTEGER_MINUS_ONE.intValue(); } } /** * If enableMessageHistory = true, returns a message received by the service in chronological order. * For example, getReceivedMessage(1) returns the first message received by the service, * getReceivedMessage(2) returns the second message received by the service, etc. */ public Object getReceivedMessage(int number) { Object message = null; if (messageHistory != null) { if (number <= messageHistory.size()) { message = messageHistory.get(number - 1); } } return message; } /** If enableMessageHistory = true, returns the last message received by the service in chronological order. */ public Object getLastReceivedMessage() { if (messageHistory != null) { return messageHistory.get(messageHistory.size() - 1); } else { return null; } } public boolean isAddReceived() { return addReceived; } public void setAddReceived(boolean addReceived) { this.addReceived = addReceived; } public boolean isAsString() { return asString; } public void setAsString(boolean asString) { this.asString = asString; } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/QuietExceptionStrategy.java0000644000175000017500000000253610745677442032276 0ustar charlescharles/* * $Id: QuietExceptionStrategy.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.AbstractExceptionListener; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Restrict exceptions to debug log messages */ public class QuietExceptionStrategy extends AbstractExceptionListener { protected transient Log logger = LogFactory.getLog(getClass()); public void handleMessagingException(MuleMessage message, Throwable e) { logger.debug("Ignoring", e); } public void handleRoutingException(MuleMessage message, ImmutableEndpoint endpoint, Throwable e) { logger.debug("Ignoring", e); } public void handleLifecycleException(Object component, Throwable e) { logger.debug("Ignoring", e); } public void handleStandardException(Throwable e) { logger.debug("Ignoring", e); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/package.html0000644000175000017500000000027110503620563027175 0ustar charlescharles Mule Helper classes and interfaces used by Mule fnctional tests. These include test components and callback interfaces. ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/TransactionalFunctionalTestComponent.javamule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/TransactionalFunctionalTestCompone0000644000175000017500000000434210754365306033661 0ustar charlescharles/* * $Id: TransactionalFunctionalTestComponent.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.api.MuleEventContext; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.MessageFactory; /** * This service is useful for unit tests involving transactionality because it * will roll back the current transaction upon message arrival. */ public class TransactionalFunctionalTestComponent extends FunctionalTestComponent { private boolean expectTransaction = true; private boolean rollback = true; /** {@inheritDoc} */ public Object onCall(MuleEventContext context) throws Exception { Object replyMessage = super.onCall(context); if (expectTransaction) { // Verify transaction has begun. Transaction currentTx = context.getCurrentTransaction(); if (currentTx == null || currentTx.isBegun() == false) { context.setStopFurtherProcessing(true); throw new TransactionException(MessageFactory.createStaticMessage("Trying to roll back transaction but no transaction is underway.")); } if (rollback) { // Mark the transaction for rollback. logger.info("@@@@ Rolling back transaction @@@@"); currentTx.setRollbackOnly(); } } return replyMessage; } public boolean isRollback() { return rollback; } public void setRollback(boolean rollback) { this.rollback = rollback; } public boolean isExpectTransaction() { return expectTransaction; } public void setExpectTransaction(boolean expectTransaction) { this.expectTransaction = expectTransaction; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/FunctionalStreamingTestComponent.javamule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/FunctionalStreamingTestComponent.j0000644000175000017500000001424310746275214033602 0ustar charlescharles/* * $Id: FunctionalStreamingTestComponent.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; import org.mule.util.ClassUtils; import org.mule.util.StringMessageUtils; import java.io.IOException; import java.io.InputStream; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A service that can be used by streaming functional tests. This service accepts an * EventCallback that can be used to assert the state of the current event. To access the * service when embedded in an (XML) model, make sure that the descriptor sets the * singleton attribute true - see uses in TCP and FTP. * * Note that although this implements the full StreamingService interface, nothing is * written to the output stream - this is intended as a final sink. * * @see org.mule.tck.functional.EventCallback */ public class FunctionalStreamingTestComponent implements Callable { protected transient Log logger = LogFactory.getLog(getClass()); private static AtomicInteger count = new AtomicInteger(0); private int number = count.incrementAndGet(); public static final int STREAM_SAMPLE_SIZE = 4; public static final int STREAM_BUFFER_SIZE = 4096; private EventCallback eventCallback; private String summary = null; private long targetSize = -1; public FunctionalStreamingTestComponent() { logger.debug("creating " + toString()); } public void setEventCallback(EventCallback eventCallback, long targetSize) { logger.debug("setting callback: " + eventCallback + " in " + toString()); this.eventCallback = eventCallback; this.targetSize = targetSize; } public String getSummary() { return summary; } public int getNumber() { return number; } public Object onCall(MuleEventContext context) throws Exception { InputStream in = (InputStream) context.getMessage().getPayload(InputStream.class); try { logger.debug("arrived at " + toString()); byte[] startData = new byte[STREAM_SAMPLE_SIZE]; long startDataSize = 0; byte[] endData = new byte[STREAM_SAMPLE_SIZE]; // ring buffer long endDataSize = 0; long endRingPointer = 0; long streamLength = 0; byte[] buffer = new byte[STREAM_BUFFER_SIZE]; // throw data on the floor, but keep a record of size, start and end values long bytesRead = 0; while (bytesRead >= 0) { bytesRead = read(in, buffer); if (bytesRead > 0) { if (logger.isDebugEnabled()) { logger.debug("read " + bytesRead + " bytes"); } streamLength += bytesRead; long startOfEndBytes = 0; for (long i = 0; startDataSize < STREAM_SAMPLE_SIZE && i < bytesRead; ++i) { startData[(int) startDataSize++] = buffer[(int) i]; ++startOfEndBytes; // skip data included in startData } startOfEndBytes = Math.max(startOfEndBytes, bytesRead - STREAM_SAMPLE_SIZE); for (long i = startOfEndBytes; i < bytesRead; ++i) { ++endDataSize; endData[(int) (endRingPointer++ % STREAM_SAMPLE_SIZE)] = buffer[(int) i]; } if (streamLength >= targetSize) { doCallback(startData, startDataSize, endData, endDataSize, endRingPointer, streamLength, context); } } } in.close(); } catch (Exception e) { in.close(); e.printStackTrace(); if (logger.isDebugEnabled()) { logger.debug(e); } throw e; } return null; } protected int read(InputStream in, byte[] buffer) throws IOException { return in.read(buffer); } private void doCallback(byte[] startData, long startDataSize, byte[] endData, long endDataSize, long endRingPointer, long streamLength, MuleEventContext context) throws Exception { // make a nice summary of the data StringBuffer result = new StringBuffer("Received stream"); result.append("; length: "); result.append(streamLength); result.append("; '"); for (long i = 0; i < startDataSize; ++i) { result.append((char) startData[(int) i]); } long endSize = Math.min(endDataSize, STREAM_SAMPLE_SIZE); if (endSize > 0) { result.append("..."); for (long i = 0; i < endSize; ++i) { result.append((char) endData[(int) ((endRingPointer + i) % STREAM_SAMPLE_SIZE)]); } } result.append("'"); summary = result.toString(); String msg = StringMessageUtils.getBoilerPlate("Message Received in service: " + context.getService().getName() + ". " + summary + "\n callback: " + eventCallback, '*', 80); logger.info(msg); if (eventCallback != null) { eventCallback.eventReceived(context, this); } } public String toString() { return ClassUtils.getSimpleName(getClass()) + "/" + number; } }mule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/FunctionalTestComponent2.java0000644000175000017500000003270510774254333032505 0ustar charlescharles/* * $Id: FunctionalTestComponent2.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.MuleServer; import org.mule.RequestContext; import org.mule.api.MuleContext; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.tck.exceptions.FunctionalTestException; import org.mule.util.NumberUtils; import org.mule.util.StringMessageUtils; import org.mule.util.expression.ExpressionEvaluatorManager; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * FunctionalTestComponent is a service that can be used by * functional tests. This service accepts an EventCallback that can be used to * assert the state of the current event. *

* Also, this service fires {@link org.mule.tck.functional.FunctionalTestNotification} via Mule for every message received. * Tests can register with Mule to receive these events by implementing * {@link org.mule.tck.functional.FunctionalTestNotificationListener}. * * @see EventCallback * @see FunctionalTestNotification * @see FunctionalTestNotificationListener */ public class FunctionalTestComponent2 implements Callable, Initialisable, Disposable { protected transient Log logger = LogFactory.getLog(getClass()); public static final int STREAM_SAMPLE_SIZE = 4; public static final int STREAM_BUFFER_SIZE = 4096; private EventCallback eventCallback; private Object returnData = null; private boolean throwException = false; private boolean enableMessageHistory = true; private boolean enableNotifications = true; private String appendString; private Class exceptionToThrow; private long waitTime = 0; /** * Keeps a list of any messages received on this service. Note that only references * to the messages (objects) are stored, so any subsequent changes to the objects * will change the history. */ private List messageHistory; public void initialise() { if (enableMessageHistory) { messageHistory = new CopyOnWriteArrayList(); } } public void dispose() { // nothing to do } /** * {@inheritDoc} */ public Object onCall(MuleEventContext context) throws Exception { if (isThrowException()) { throwException(); } return process(context.transformMessage(), context); } /** * This method is used by some WebServices tests where you don' want to be introducing the {@link org.mule.api.MuleEventContext} as * a complex type. * * @param data the event data received * @return the processed message * @throws Exception */ public Object onReceive(Object data) throws Exception { MuleEventContext context = RequestContext.getEventContext(); if (isThrowException()) { throwException(); } return process(data, context); } /** * Always throws a {@link org.mule.tck.exceptions.FunctionalTestException}. This methodis only called if * {@link #isThrowException()} is true. * * @throws FunctionalTestException or the exception specified in 'exceptionType */ protected void throwException() throws Exception { if (getExceptionToThrow() != null) { throw (Exception)getExceptionToThrow().newInstance(); } else { throw new FunctionalTestException(); } } /** * Will append the value of {@link #getAppendString()} to the contents of the message. This has a side affect * that the inbound message will be converted to a string and the return payload will be a string. * Note that the value of {@link #getAppendString()} can contain expressions. * * @param contents the string vlaue of the current message payload * @param message the current message * @return a concatenated string of the current payload and the appendString */ protected String append(String contents, MuleMessage message) { return contents + ExpressionEvaluatorManager.parse(appendString, message); } /** * The service method that implements the test component logic. This method can be called publically through * either {@link #onCall(org.mule.api.MuleEventContext)} or {@link #onReceive(Object)} * * @param data The message payload * @param context the current {@link org.mule.api.MuleEventContext} * @return a new message payload according to the configuration of the component * @throws Exception if there is a general failure or if {@link #isThrowException()} is true. */ protected Object process(Object data, MuleEventContext context) throws Exception { if (enableMessageHistory) { messageHistory.add(data); } String contents = data.toString(); String msg = StringMessageUtils.getBoilerPlate("Message Received in service: " + context.getService().getName() + ". Content is: " + StringMessageUtils.truncate(contents, 100, true), '*', 80); logger.info(msg); if (eventCallback != null) { eventCallback.eventReceived(context, this); } Object replyMessage; if (returnData != null) { if (returnData instanceof String && ExpressionEvaluatorManager.isValidExpression(returnData.toString())) { replyMessage = ExpressionEvaluatorManager.parse(returnData.toString(), context.getMessage()); } else { replyMessage = returnData; } } else { if (appendString != null) { replyMessage = append(contents, context.getMessage()); } else { replyMessage = contents; } } if (isEnableNotifications()) { MuleContext muleContext = context.getMuleContext(); if (muleContext == null) { logger.warn("No MuleContext available from MuleEventContext"); muleContext = MuleServer.getMuleContext(); } muleContext.fireNotification( new FunctionalTestNotification(context, replyMessage, FunctionalTestNotification.EVENT_RECEIVED)); } //Time to wait before returning if(waitTime > 0) { try { Thread.sleep(waitTime); } catch (InterruptedException e) { logger.info("FunctionalTestComponent waitTime was interrupted"); } } return replyMessage; } /** * An event callback is called when a message is received by the service. * An MuleEvent callback isn't strictly required but it is usfal for performing assertions * on the current message being received. * Note that the FunctionalTestComponent should be made a singleton * {@link org.mule.api.UMODescriptor#setSingleton} when using MuleEvent callbacks *

* Another option is to register a {@link org.mule.tck.functional.FunctionalTestNotificationListener} with Mule and this * will deleiver a {@link org.mule.tck.functional.FunctionalTestNotification} for every message received by this service * * @return the callback to call when a message is received * @see org.mule.api.UMODescriptor * @see FunctionalTestNotification * @see FunctionalTestNotificationListener */ public EventCallback getEventCallback() { return eventCallback; } /** * An event callback is called when a message is received by the service. * An MuleEvent callback isn't strictly required but it is usfal for performing assertions * on the current message being received. * Note that the FunctionalTestComponent should be made a singleton * {@link org.mule.api.UMODescriptor#setSingleton} when using MuleEvent callbacks *

* Another option is to register a {@link org.mule.tck.functional.FunctionalTestNotificationListener} with Mule and this * will deleiver a {@link org.mule.tck.functional.FunctionalTestNotification} for every message received by this service * * @param eventCallback the callback to call when a message is received * @see org.mule.api.UMODescriptor * @see FunctionalTestNotification * @see FunctionalTestNotificationListener */ public void setEventCallback(EventCallback eventCallback) { this.eventCallback = eventCallback; } /** * Often you will may want to return a fixed message payload to simulate and external system call. * This can be done using the 'returnData' property. Note that you can return complex objects by * using the element in the Xml configuration. * * @return the message payload to always return from this service instance */ public Object getReturnData() { return returnData; } /** * Often you will may want to return a fixed message payload to simulate and external system call. * This can be done using the 'returnData' property. Note that you can return complex objects by * using the element in the Xml configuration. * * @param returnData the message payload to always return from this service instance */ public void setReturnData(Object returnData) { this.returnData = returnData; } /** * Sometimes you will want the service to always throw an exception, if this is the case you can * set the 'throwException' property to true. * * @return throwException true if an exception should always be thrown from this instance. * If the {@link #returnData} property is set and is of type * java.lang.Exception, that exception will be thrown. */ public boolean isThrowException() { return throwException; } /** * Sometimes you will want the service to always throw an exception, if this is the case you can * set the 'throwException' property to true. * * @param throwException true if an exception should always be thrown from this instance. * If the {@link #returnData} property is set and is of type * java.lang.Exception, that exception will be thrown. */ public void setThrowException(boolean throwException) { this.throwException = throwException; } public boolean isEnableMessageHistory() { return enableMessageHistory; } public void setEnableMessageHistory(boolean enableMessageHistory) { this.enableMessageHistory = enableMessageHistory; } /** * If enableMessageHistory = true, returns the number of messages received by this service. */ public int getReceivedMessages() { if (messageHistory != null) { return messageHistory.size(); } else { return NumberUtils.INTEGER_MINUS_ONE.intValue(); } } /** * If enableMessageHistory = true, returns a message received by the service in chronological order. * For example, getReceivedMessage(1) returns the first message received by the service, * getReceivedMessage(2) returns the second message received by the service, etc. */ public Object getReceivedMessage(int number) { Object message = null; if (messageHistory != null) { if (number <= messageHistory.size()) { message = messageHistory.get(number - 1); } } return message; } /** * If enableMessageHistory = true, returns the last message received by the service in chronological order. */ public Object getLastReceivedMessage() { if (messageHistory != null) { return messageHistory.get(messageHistory.size() - 1); } else { return null; } } public String getAppendString() { return appendString; } public void setAppendString(String appendString) { this.appendString = appendString; } public boolean isEnableNotifications() { return enableNotifications; } public void setEnableNotifications(boolean enableNotifications) { this.enableNotifications = enableNotifications; } public Class getExceptionToThrow() { return exceptionToThrow; } public void setExceptionToThrow(Class exceptionToThrow) { this.exceptionToThrow = exceptionToThrow; } public long getWaitTime() { return waitTime; } public void setWaitTime(long waitTime) { this.waitTime = waitTime; } }mule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/ResponseWriterCallback.java0000644000175000017500000000334610745677442032215 0ustar charlescharles/* * $Id: ResponseWriterCallback.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.api.MuleEventContext; /** * A test callback that writes the results of a service invocation to the response output stream * of the event * This should only be used when testing Asynchronous calls with the {@link FunctionalTestComponent} otherwise * you will get duplicate messages, since both this class and the {@link FunctionalTestComponent} will write * a return message back to the callee. * * @see org.mule.tck.functional.FunctionalTestComponent */ public class ResponseWriterCallback extends CounterCallback { public void eventReceived(MuleEventContext context, Object component) throws Exception { if (context.isSynchronous()) { throw new IllegalStateException("The ResponseWriterCallback should not be used for synchronous tests as it will cause two copies of the message to be written back to the client"); } super.eventReceived(context, component); String result = context.getMessageAsString() + " Received Async"; if (context.getOutputStream() == null) { throw new IllegalArgumentException("event context does not have an OutputStream associated"); } context.getOutputStream().write(result.getBytes()); context.getOutputStream().flush(); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/CounterCallback.java0000644000175000017500000000235010745677442030633 0ustar charlescharles/* * $Id: CounterCallback.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.api.MuleEventContext; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; /** * A test callback that counts the number of messages received. */ public class CounterCallback implements EventCallback { private AtomicInteger callbackCount; public CounterCallback() { callbackCount = new AtomicInteger(0); } public CounterCallback(AtomicInteger callbackCount) { this.callbackCount = callbackCount; } public void eventReceived(MuleEventContext context, Object Component) throws Exception { incCallbackCount(); } protected void incCallbackCount() { callbackCount.incrementAndGet(); } public int getCallbackCount() { return callbackCount.intValue(); } }mule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/CountdownCallback.java0000644000175000017500000000352510745677442031201 0ustar charlescharles/* * $Id: CountdownCallback.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.MessageFactory; import junit.framework.AssertionFailedError; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class CountdownCallback implements EventCallback { private CountDownLatch countDown; public CountdownCallback(int messagesExpected) { this.countDown = new CountDownLatch(messagesExpected); } public void eventReceived(MuleEventContext context, Object Component) throws Exception { synchronized (this) { if (countDown.getCount() > 0) { countDown.countDown(); } else { throw new AssertionFailedError("Too many messages received"); } } } public long getCount() throws InitialisationException { if (countDown != null) { return countDown.getCount(); } else { throw new InitialisationException(MessageFactory.createStaticMessage("CountDownLatch has not been initialized."), null); } } public boolean await(long timeout) throws InterruptedException { return countDown.await(timeout, TimeUnit.MILLISECONDS); } }mule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/EventCallback.java0000644000175000017500000000166310745677442030303 0ustar charlescharles/* * $Id: EventCallback.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.api.MuleEventContext; /** * The scope of the MuleEvent Callback is to be able to get a the message currently * being processed by the {@link FunctionalTestComponent} and make assertions * on the message payload, headers or attachments or to make changes required * for the test. * * @see org.mule.tck.functional.FunctionalTestComponent */ public interface EventCallback { public void eventReceived(MuleEventContext context, Object component) throws Exception; } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/FunctionalTestNotification.java0000644000175000017500000000516510746275214033107 0ustar charlescharles/* * $Id: FunctionalTestNotification.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.api.MuleEventContext; import org.mule.api.transformer.TransformerException; import org.mule.context.notification.CustomNotification; /** * A FunctionlTestNotification is fired by the {@link org.mule.tck.functional.FunctionalTestComponent} * when it receives an event. Test cases can register a {@link org.mule.tck.functional.FunctionalTestNotificationListener} * with Mule to receive these notifications and make assertions about the number of messages received or the content * of the message. *

* This Notification contains the current MuleEventContext and reply message. The resource Identifier for this event * is the service name that received the message. This means you can register to listen to Notifications from a * selected {@link org.mule.tck.functional.FunctionalTestComponent}. i.e. * * muleContext.registerListener(this, "*JmsTestCompoennt"); * *

* This registration would only receive {@link org.mule.tck.functional.FunctionalTestNotification} objects * from components called 'MyJmsTestComponent' and 'YourJmsTestComponent' but not 'HerFileTestComponent'. * * @see org.mule.tck.functional.FunctionalTestComponent * @see org.mule.tck.functional.FunctionalTestNotificationListener * @see org.mule.api.MuleContext */ public class FunctionalTestNotification extends CustomNotification { /** Serial version */ private static final long serialVersionUID = -3435373745940904597L; public static final int EVENT_RECEIVED = -999999; static { registerAction("event received", EVENT_RECEIVED); } private final Object replyMessage; private final MuleEventContext eventContext; public FunctionalTestNotification(MuleEventContext context, Object replyMessage, int action) throws TransformerException { super(context.transformMessage(), action); resourceIdentifier = context.getService().getName(); this.replyMessage = replyMessage; this.eventContext = context; } public Object getReplyMessage() { return replyMessage; } public MuleEventContext getEventContext() { return eventContext; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/FunctionalTestNotificationListener.javamule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/FunctionalTestNotificationListener0000644000175000017500000000351010746275214033665 0ustar charlescharles/* * $Id: FunctionalTestNotificationListener.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.api.context.notification.CustomNotificationListener; /** * By implementing this listener interface and registering the object with the * {@link org.mule.api.MuleContext#registerListener(org.mule.api.context.ServerNotificationListener)} * You can receive {@link org.mule.tck.functional.FunctionalTestNotification}s from the * {@link org.mule.tck.functional.FunctionalTestComponent}. * * This Notification contains the current MuleEventContext and reply message. The resource Identifier for this event * is the service name that received the message. This means you can register to listen to Notifications from a * selected {@link org.mule.tck.functional.FunctionalTestComponent}. i.e. * * muleContext.registerListener(this, "*JmsTestCompoennt"); * * * This registration would only receive {@link org.mule.tck.functional.FunctionalTestNotification} objects * from components called 'MyJmsTestComponent' and 'YourJmsTestComponent' but not 'HerFileTestComponent'. * * To receive all notifications simply do - * * muleContext.registerListener(this"); * * * @see org.mule.tck.functional.FunctionalTestComponent * @see org.mule.tck.functional.FunctionalTestNotificationListener * @see org.mule.api.MuleContext */ public interface FunctionalTestNotificationListener extends CustomNotificationListener { // no methods } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/StringAppendTestTransformer.java0000644000175000017500000000154210745677442033262 0ustar charlescharles/* * $Id: StringAppendTestTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import org.mule.transformer.simple.StringAppendTransformer; public class StringAppendTestTransformer extends StringAppendTransformer { public static final String DEFAULT_TEXT = " transformed"; public StringAppendTestTransformer() { setMessage(DEFAULT_TEXT); } public static String appendDefault(String msg) { return append(DEFAULT_TEXT, msg); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/FunctionalStreamingEchoComponent.javamule-2.0.1/tests/functional/src/main/java/org/mule/tck/functional/FunctionalStreamingEchoComponent.j0000755000175000017500000000117710754365306033547 0ustar charlescharles/* * $Id: FunctionalStreamingEchoComponent.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.functional; import java.io.InputStream; public class FunctionalStreamingEchoComponent { public InputStream echo(InputStream stream) { return stream; } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/0000755000175000017500000000000011351411046024731 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/fruit/0000755000175000017500000000000011351411046026062 5ustar charlescharles././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/fruit/FloridaSunnyOrangeFactoryBean.javamule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/fruit/FloridaSunnyOrangeFactoryBea0000644000175000017500000000246110754365306033536 0ustar charlescharles/* * $Id: FloridaSunnyOrangeFactoryBean.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import org.springframework.beans.factory.FactoryBean; /** * A Spring FactoryBean implementation for unit testing. */ public class FloridaSunnyOrangeFactoryBean implements FactoryBean { Integer segments = new Integer(10); Double radius = new Double(4.34); public Object getObject() throws Exception { return new Orange(segments, radius, "Florida Sunny"); } public Class getObjectType() { return Orange.class; } public boolean isSingleton() { return false; } public Double getRadius() { return radius; } public void setRadius(Double radius) { this.radius = radius; } public Integer getSegments() { return segments; } public void setSegments(Integer segments) { this.segments = segments; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/fruit/FloridaSunnyOrangeFactory.javamule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/fruit/FloridaSunnyOrangeFactory.ja0000644000175000017500000000131510746074653033517 0ustar charlescharles/* * $Id: FloridaSunnyOrangeFactory.java 10500 2008-01-24 11:42:35Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; /** * A simple object factory for unit testing. */ public class FloridaSunnyOrangeFactory { public static Orange giveMeAnOrange() { Orange o = new Orange(); o.setBrand("Florida Sunny"); return o; } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/0000755000175000017500000000000011351411046026554 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/PeopleService.java0000644000175000017500000000144710664630335032204 0ustar charlescharles/* * $Id: PeopleService.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.services; /** * PeopleService is a test service that returns complex types */ public interface PeopleService { public Person getPerson(String firstName); public Person[] getPeople(); public void addPerson(Person person) throws Exception; public Person addPerson(String firstname, String surname) throws Exception; } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/TestServiceComponent.javamule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/TestServiceComponent.java0000644000175000017500000000601510746275214033560 0ustar charlescharles/* * $Id: TestServiceComponent.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.services; import org.mule.api.component.simple.EchoService; import org.mule.api.lifecycle.Disposable; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.util.StringUtils; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.Map; /** * TestServiceComponent is a test WebServices service. */ public class TestServiceComponent extends FunctionalTestComponent implements EchoService, DateService, PeopleService, Disposable { // we keep two collections - one static for testing the return of complex types // and one for modifying by methods invoked on the TestComponent instance private static final Person[] originalPeople = new Person[]{new Person("Barney", "Rubble"), new Person("Fred", "Flintstone"), new Person("Wilma", "Flintstone")}; private final Map people = Collections.synchronizedMap(new HashMap()); public TestServiceComponent() { super(); people.put("Barney", originalPeople[0]); people.put("Fred", originalPeople[1]); people.put("Wilma", originalPeople[2]); } public String echo(String echo) { return echo; } public String getDate() { return new Date().toString(); } public Person getPerson(String firstName) { if (StringUtils.isEmpty(firstName)) { throw new IllegalArgumentException("Name parameter cannot be null"); } return (Person)people.get(firstName); } public Person[] getPeople() { return originalPeople; } public void addPerson(Person person) throws Exception { if (person == null || person.getFirstName() == null || person.getLastName() == null) { throw new IllegalArgumentException("null person, first name or last name"); } if (person.getFirstName().equals("Ross")) { throw new Exception("Ross is banned"); } people.put(person.getFirstName(), person); logger.debug("Added Person: " + person); } public Person addPerson(String firstname, String surname) throws Exception { Person p = new Person(firstname, surname); addPerson(p); logger.debug("Added Person: " + p); return p; } /** * A lifecycle method where implementor should free up any resources. If an * exception is thrown it should just be logged and processing should continue. * This method should not throw RuntimeExceptions. */ public void dispose() { people.clear(); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/TestComponent.java0000644000175000017500000000274310746275214032243 0ustar charlescharles/* * $Id: TestComponent.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.services; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class TestComponent implements ITestComponent { public static final String EXCEPTION_MESSAGE = "Test Service fired an Exception"; protected static final Log logger = LogFactory.getLog(TestComponent.class); protected AtomicInteger count = new AtomicInteger(0); public String receive(String message) throws Exception { logger.info("Received: " + message + " number: " + inc() + " in thread: " + Thread.currentThread().getName()); return "Received: " + message; } public String receiveBytes(byte[] message) throws Exception { return receive(new String(message)); } public String throwsException(String message) throws Exception { throw new TestComponentException(EXCEPTION_MESSAGE); } protected int inc() { return count.incrementAndGet(); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/ITestComponent.java0000644000175000017500000000131710664630335032346 0ustar charlescharles/* * $Id: ITestComponent.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.services; /** * Interface for TestComponent (to make it easier to host the service on Axis) */ public interface ITestComponent { public String receive(String message) throws Exception; public String throwsException(String message) throws Exception; } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/TestReceiver.java0000644000175000017500000000274210745677442032054 0ustar charlescharles/* * $Id: TestReceiver.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.services; import org.mule.RequestContext; import org.mule.util.StringMessageUtils; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class TestReceiver { protected static final Log logger = LogFactory.getLog(TestComponent.class); protected AtomicInteger count = new AtomicInteger(0); public String receive(String message) throws Exception { if (logger.isDebugEnabled()) { logger.debug(StringMessageUtils.getBoilerPlate("Received: " + message + " Number: " + inc() + " in thread: " + Thread.currentThread().getName())); logger.debug("Message ID is: " + RequestContext.getEventContext().getMessage().getCorrelationId()); } return "Received: " + message; } protected int inc() { return count.incrementAndGet(); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/PersonResponse.java0000644000175000017500000000201310664630335032412 0ustar charlescharles/* * $Id: PersonResponse.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.services; public class PersonResponse { private Person person; private long time; public PersonResponse() { // empty constructor } public PersonResponse(Person person) { this.person = person; this.time = System.currentTimeMillis(); } public Person getPerson() { return person; } public void setPerson(Person person) { this.person = person; } public long getTime() { return time; } public void setTime(long time) { this.time = time; } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/DateService.java0000644000175000017500000000111110664630335031621 0ustar charlescharles/* * $Id: DateService.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.services; /** * DateService defines a Date service */ public interface DateService { public String getDate(); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/TestComponentException.javamule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/TestComponentException.ja0000644000175000017500000000140410664630335033562 0ustar charlescharles/* * $Id: TestComponentException.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.services; public class TestComponentException extends Exception { private static final long serialVersionUID = -3906931231398539327L; public static final String MESSAGE_PREFIX = "Message: "; public TestComponentException(String message) { super(MESSAGE_PREFIX + message); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/Address.java0000644000175000017500000000211110664630335031011 0ustar charlescharles/* * $Id: Address.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.services; /** * Address is a Persons address */ public class Address { private String address; private String postcode; public Address() { super(); } public Address(String address, String postcode) { this.address = address; this.postcode = postcode; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getPostcode() { return postcode; } public void setPostcode(String postcode) { this.postcode = postcode; } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/testmodels/services/Person.java0000644000175000017500000000257510664630335030710 0ustar charlescharles/* * $Id: Person.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.services; /** * Person part of the PeopleService */ public class Person { private String firstName; private String lastName; private Address address = new Address(); public Person() { super(); } public Person(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String toString() { return firstName + " " + lastName; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/util/0000755000175000017500000000000011351411046023523 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/java/org/mule/tck/util/MuleDerbyTestUtils.java0000644000175000017500000001041010763667515030157 0ustar charlescharles/* * $Id: MuleDerbyTestUtils.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.util; import org.mule.util.ClassUtils; import org.mule.util.FileUtils; import java.io.File; import java.io.IOException; import java.lang.reflect.Method; import java.net.URL; import java.sql.Driver; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; /** * NOTE: Don't forget to duplicate all the changes in {@link org.mule.example.loanbroker.bpm.DbUtils} */ public class MuleDerbyTestUtils { private static final String DERBY_DRIVER_CLASS = "org.apache.derby.jdbc.EmbeddedDriver"; //class cannot be instantiated private MuleDerbyTestUtils() { super(); } //by default, set the derby home to the target directory public static String setDerbyHome() { return setDerbyHome("target"); } public static String setDerbyHome(String path) { File derbySystemHome = new File(System.getProperty("user.dir"), path); System.setProperty("derby.system.home", derbySystemHome.getAbsolutePath()); return derbySystemHome.getAbsolutePath(); } /** * Properly shutdown an embedded Derby database * * @throws SQLException * @see Derby docs */ public static void stopDatabase() throws SQLException { try { // force loading the driver so it's available even if no prior connection to the // database was made ClassUtils.instanciateClass(DERBY_DRIVER_CLASS, new Object[0]); DriverManager.getConnection("jdbc:derby:;shutdown=true"); } catch (SQLException sqlex) { // this exception is documented to be thrown upon shutdown if (!"XJ015".equals(sqlex.getSQLState())) { throw sqlex; } } catch (Exception ex) { // this can only happen when the driver class is not in classpath. In this case, just // throw up throw new RuntimeException(ex); } } public static void cleanupDerbyDb(String derbySystemHome, String databaseName) throws IOException, SQLException { stopDatabase(); FileUtils.deleteTree(new File(derbySystemHome + File.separator + databaseName)); } public static void createDataBase(String databaseName) throws SQLException { // Do not use the EmbeddedDriver class here directly to avoid compile time references // on derby.jar try { Driver derbyDriver = (Driver) ClassUtils.instanciateClass(DERBY_DRIVER_CLASS, new Object[0]); Method connectMethod = derbyDriver.getClass().getMethod("connect", new Class[] { String.class, Properties.class }); String connectionName = "jdbc:derby:" + databaseName + ";create=true"; connectMethod.invoke(derbyDriver, new Object[] { connectionName, null }); } catch (Exception ex) { throw new RuntimeException("Error creating the database " + databaseName, ex); } } public static String loadDatabaseName(String propertiesLocation, String propertyName) throws IOException { Properties derbyProperties = new Properties(); URL resource = ClassUtils.getResource(propertiesLocation, MuleDerbyTestUtils.class); derbyProperties.load(resource.openStream()); return derbyProperties.getProperty(propertyName); } public static void defaultDerbyCleanAndInit(String propertiesLocation, String propertyName) throws IOException, SQLException { String derbyHome = setDerbyHome(); String dbName = loadDatabaseName(propertiesLocation, propertyName); cleanupDerbyDb(derbyHome, dbName); createDataBase(dbName); } } mule-2.0.1/tests/functional/src/main/java/org/mule/tck/AbstractConfigBuilderTestCase.java0000644000175000017500000003665710772064773031307 0ustar charlescharles/* * $Id: AbstractConfigBuilderTestCase.java 11494 2008-03-25 02:56:59Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck; import org.mule.DefaultExceptionStrategy; import org.mule.api.DefaultMuleException; import org.mule.api.MuleException; import org.mule.api.component.JavaComponent; import org.mule.api.config.ThreadingProfile; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.InboundRouter; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.routing.NestedRouter; import org.mule.api.routing.OutboundRouter; import org.mule.api.routing.OutboundRouterCollection; import org.mule.api.routing.filter.Filter; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.component.PooledJavaComponent; import org.mule.config.PoolingProfile; import org.mule.config.QueueProfile; import org.mule.model.seda.SedaService; import org.mule.routing.filters.MessagePropertyFilter; import org.mule.routing.filters.PayloadTypeFilter; import org.mule.routing.filters.RegExFilter; import org.mule.routing.filters.logic.AndFilter; import org.mule.routing.inbound.IdempotentReceiver; import org.mule.routing.inbound.SelectiveConsumer; import org.mule.routing.outbound.FilteringOutboundRouter; import org.mule.tck.testmodels.mule.TestCatchAllStrategy; import org.mule.tck.testmodels.mule.TestCompressionTransformer; import org.mule.tck.testmodels.mule.TestConnector; import org.mule.tck.testmodels.mule.TestExceptionStrategy; import org.mule.transformer.TransformerUtils; import org.mule.transport.AbstractConnector; public abstract class AbstractConfigBuilderTestCase extends AbstractScriptConfigBuilderTestCase { public AbstractConfigBuilderTestCase(boolean legacy) { super(legacy); } // @Override public void testManagerConfig() throws Exception { super.testManagerConfig(); assertNotNull(muleContext.getTransactionManager()); } // @Override public void testConnectorConfig() throws Exception { super.testConnectorConfig(); TestConnector c = (TestConnector) muleContext.getRegistry().lookupConnector("dummyConnector"); assertNotNull(c); assertNotNull(c.getExceptionListener()); assertTrue(c.getExceptionListener() instanceof TestExceptionStrategy); } // @Override public void testGlobalEndpointConfig() throws MuleException { super.testGlobalEndpointConfig(); ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("fruitBowlEndpoint"); assertNotNull(endpoint); assertEquals(endpoint.getEndpointURI().getAddress(), "fruitBowlPublishQ"); MessagePropertyFilter filter = (MessagePropertyFilter)endpoint.getFilter(); assertNotNull(filter); assertEquals("foo=bar", filter.getExpression()); } // @Override public void testEndpointConfig() throws MuleException { super.testEndpointConfig(); // test that endpoints have been resolved on endpoints ImmutableEndpoint endpoint = null; try { endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("waterMelonEndpoint"); } catch (MuleException e) { e.printStackTrace(); fail(e.getMessage()); } assertNotNull(endpoint); assertEquals("UTF-8-TEST", endpoint.getEncoding()); assertEquals("test.queue", endpoint.getEndpointURI().getAddress()); Service service = muleContext.getRegistry().lookupService("appleComponent2"); assertNotNull(service); } public void testExceptionStrategy2() { Service service = muleContext.getRegistry().lookupService("appleComponent"); assertNotNull(service.getExceptionListener()); assertTrue(DefaultExceptionStrategy.class.isAssignableFrom(service.getExceptionListener().getClass())); } // @Override public void testTransformerConfig() { super.testTransformerConfig(); Transformer t = muleContext.getRegistry().lookupTransformer("TestCompressionTransformer"); assertNotNull(t); assertTrue(t instanceof TestCompressionTransformer); assertEquals(t.getReturnClass(), java.lang.String.class); assertNotNull(((TestCompressionTransformer) t).getContainerProperty()); } // @Override public void testModelConfig() throws Exception { super.testModelConfig(); assertNotNull(muleContext.getRegistry().lookupService("appleComponent")); assertNotNull(muleContext.getRegistry().lookupService("appleComponent2")); } public void testOutboundRouterConfig2() { // test outbound message router Service service = muleContext.getRegistry().lookupService("appleComponent"); assertNotNull(service.getOutboundRouter()); OutboundRouterCollection router = service.getOutboundRouter(); assertNotNull(router.getCatchAllStrategy()); assertEquals(2, router.getRouters().size()); // check first Router OutboundRouter route1 = (OutboundRouter) router.getRouters().get(0); assertTrue(route1 instanceof FilteringOutboundRouter); assertNotNull(((FilteringOutboundRouter) route1).getTransformers()); assertTrue(TransformerUtils.firstOrNull(((FilteringOutboundRouter) route1).getTransformers()) instanceof TestCompressionTransformer); Filter filter = ((FilteringOutboundRouter) route1).getFilter(); assertNotNull(filter); assertTrue(filter instanceof PayloadTypeFilter); assertEquals(String.class, ((PayloadTypeFilter) filter).getExpectedType()); // check second Router OutboundRouter route2 = (OutboundRouter) router.getRouters().get(1); assertTrue(route2 instanceof FilteringOutboundRouter); Filter filter2 = ((FilteringOutboundRouter) route2).getFilter(); assertNotNull(filter2); assertTrue(filter2 instanceof AndFilter); assertEquals(2, ((AndFilter) filter2).getFilters().size()); Filter left = (Filter) ((AndFilter) filter2).getFilters().get(0); Filter right = (Filter) ((AndFilter) filter2).getFilters().get(1); assertNotNull(left); assertTrue(left instanceof RegExFilter); assertEquals("the quick brown (.*)", ((RegExFilter) left).getPattern()); assertNotNull(right); assertTrue(right instanceof RegExFilter); assertEquals("(.*) brown (.*)", ((RegExFilter) right).getPattern()); assertTrue(router.getCatchAllStrategy() instanceof TestCatchAllStrategy); } public void testInboundRouterConfig2() { Service service = muleContext.getRegistry().lookupService("appleComponent"); assertNotNull(service.getInboundRouter()); InboundRouterCollection messageRouter = service.getInboundRouter(); assertNotNull(messageRouter.getCatchAllStrategy()); assertEquals(2, messageRouter.getRouters().size()); InboundRouter router = (InboundRouter) messageRouter.getRouters().get(0); assertTrue(router instanceof SelectiveConsumer); SelectiveConsumer sc = (SelectiveConsumer) router; assertNotNull(sc.getFilter()); Filter filter = sc.getFilter(); // check first Router assertTrue(filter instanceof PayloadTypeFilter); assertEquals(String.class, ((PayloadTypeFilter) filter).getExpectedType()); InboundRouter router2 = (InboundRouter) messageRouter.getRouters().get(1); assertTrue(router2 instanceof IdempotentReceiver); } public void testThreadingConfig() throws DefaultMuleException { // expected default values from the configuration; // these should differ from the programmatic values! // globals int defaultMaxBufferSize = 42; int defaultMaxThreadsActive = 16; int defaultMaxThreadsIdle = 3; // WAIT is 0, RUN is 4 int defaultThreadPoolExhaustedAction = ThreadingProfile.WHEN_EXHAUSTED_WAIT; int defaultThreadTTL = 60001; // for the connector int connectorMaxBufferSize = 2; // for the service int componentMaxBufferSize = 6; int componentMaxThreadsActive = 12; int componentMaxThreadsIdle = 6; int componentThreadPoolExhaustedAction = ThreadingProfile.WHEN_EXHAUSTED_DISCARD; // test default config ThreadingProfile tp = muleContext.getDefaultThreadingProfile(); assertEquals(defaultMaxBufferSize, tp.getMaxBufferSize()); assertEquals(defaultMaxThreadsActive, tp.getMaxThreadsActive()); assertEquals(defaultMaxThreadsIdle, tp.getMaxThreadsIdle()); assertEquals(defaultThreadPoolExhaustedAction, tp.getPoolExhaustedAction()); assertEquals(defaultThreadTTL, tp.getThreadTTL()); // test service threading profile defaults tp = muleContext.getDefaultComponentThreadingProfile(); assertEquals(defaultMaxBufferSize, tp.getMaxBufferSize()); assertEquals(defaultMaxThreadsActive, tp.getMaxThreadsActive()); assertEquals(defaultMaxThreadsIdle, tp.getMaxThreadsIdle()); assertEquals(defaultThreadPoolExhaustedAction, tp.getPoolExhaustedAction()); assertEquals(defaultThreadTTL, tp.getThreadTTL()); // test that unset values retain a default value AbstractConnector c = (AbstractConnector) muleContext.getRegistry().lookupConnector("dummyConnector"); tp = c.getDispatcherThreadingProfile(); // this value is configured assertEquals(connectorMaxBufferSize, tp.getMaxBufferSize()); // these values are inherited assertEquals(defaultMaxThreadsActive, tp.getMaxThreadsActive()); assertEquals(defaultMaxThreadsIdle, tp.getMaxThreadsIdle()); assertEquals(defaultThreadPoolExhaustedAction, tp.getPoolExhaustedAction()); assertEquals(defaultThreadTTL, tp.getThreadTTL()); // test per-service values Service service = muleContext.getRegistry().lookupService("appleComponent2"); assertTrue("service must be SedaService to get threading profile", service instanceof SedaService); tp = ((SedaService) service).getThreadingProfile(); // these values are configured assertEquals(componentMaxBufferSize, tp.getMaxBufferSize()); assertEquals(componentMaxThreadsActive, tp.getMaxThreadsActive()); assertEquals(componentMaxThreadsIdle, tp.getMaxThreadsIdle()); assertEquals(componentThreadPoolExhaustedAction, tp.getPoolExhaustedAction()); // this value is inherited assertEquals(defaultThreadTTL, tp.getThreadTTL()); } public void testPoolingConfig() { // //TODO RM* test config // PoolingProfile pp = RegistryContext.getConfiguration().getPoolingProfile(); // assertEquals(10, pp.getMaxActive()); // assertEquals(5, pp.getMaxIdle()); // assertEquals(10001, pp.getMaxWait()); // assertEquals(ObjectPool.WHEN_EXHAUSTED_WAIT, pp.getExhaustedAction()); // assertEquals(PoolingProfile.INITIALISE_ONE, pp.getInitialisationPolicy()); // assertTrue(pp.getPoolFactory() instanceof CommonsPoolFactory); // test per-descriptor overrides Service service = muleContext.getRegistry().lookupService("appleComponent2"); PoolingProfile pp = ((PooledJavaComponent)service.getComponent()).getPoolingProfile(); assertEquals(9, pp.getMaxActive()); assertEquals(6, pp.getMaxIdle()); assertEquals(4002, pp.getMaxWait()); assertEquals(PoolingProfile.WHEN_EXHAUSTED_FAIL, pp.getExhaustedAction()); assertEquals(PoolingProfile.INITIALISE_ALL, pp.getInitialisationPolicy()); } public void testQueueProfileConfig() { // // test config // //TODO RM* // QueueProfile qp = RegistryContext.getConfiguration().getQueueProfile(); // assertEquals(100, qp.getMaxOutstandingMessages()); // assertTrue(qp.isPersistent()); // test inherit Service service = muleContext.getRegistry().lookupService("appleComponent2"); QueueProfile qp = ((SedaService)service).getQueueProfile(); assertEquals(102, qp.getMaxOutstandingMessages()); assertTrue(qp.isPersistent()); // test override // descriptor = (MuleDescriptor)muleContext.getModel().getDescriptor("appleComponent2"); // qp = descriptor.getQueueProfile(); // assertEquals(102, qp.getMaxOutstandingMessages()); // assertFalse(qp.isPersistent()); } public void testEndpointProperties() throws Exception { // test transaction config Service service = muleContext.getRegistry().lookupService("appleComponent2"); InboundEndpoint inEndpoint = service.getInboundRouter().getEndpoint( "transactedInboundEndpoint"); assertNotNull(inEndpoint); assertNotNull(inEndpoint.getProperties()); assertEquals("Prop1", inEndpoint.getProperties().get("testEndpointProperty")); } public void testTransactionConfig() throws Exception { // test transaction config Service apple = muleContext.getRegistry().lookupService("appleComponent2"); InboundEndpoint inEndpoint = apple.getInboundRouter().getEndpoint("transactedInboundEndpoint"); assertNotNull(inEndpoint); assertEquals(1, apple.getOutboundRouter().getRouters().size()); assertNotNull(inEndpoint.getTransactionConfig()); // TODO MULE-2185 Transaction config needs some work // assertEquals(TransactionConfig.ACTION_ALWAYS_BEGIN, inEndpoint.getTransactionConfig().getAction()); // assertTrue(inEndpoint.getTransactionConfig().getFactory() instanceof TestTransactionFactory); // assertNull(inEndpoint.getTransactionConfig().getConstraint()); OutboundRouter outRouter = (OutboundRouter) apple.getOutboundRouter().getRouters().get(0); OutboundEndpoint outEndpoint = (OutboundEndpoint) outRouter.getEndpoints().get(0); assertNotNull(outEndpoint); } public void testEnvironmentProperties() { assertEquals("true", muleContext.getRegistry().lookupObject("doCompression")); assertEquals("this was set from the manager properties!", muleContext.getRegistry().lookupObject("beanProperty1")); assertNotNull(muleContext.getRegistry().lookupObject("OS_Version")); } public void testNestedRouterProxyCreation() { //Test that the proxy object was created and set on the service object Service orange = muleContext.getRegistry().lookupService("orangeComponent"); assertNotNull(orange); assertTrue(orange.getComponent() instanceof JavaComponent); NestedRouter r = (NestedRouter) ((JavaComponent) orange.getComponent()).getNestedRouter().getRouters().get(0); assertNotNull(r); //TODO Grab an instance of the service object itself and test that the proxy has been injected } public void testMuleConfiguration() { assertTrue(muleContext.getConfiguration().isDefaultRemoteSync()); assertTrue(muleContext.getConfiguration().isDefaultSynchronousEndpoints()); } } mule-2.0.1/tests/functional/src/main/resources/0000755000175000017500000000000011351411046021325 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/resources/META-INF/0000755000175000017500000000000011351411047022466 5ustar charlescharlesmule-2.0.1/tests/functional/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012510754365306025347 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/test/2.0/mule-test.xsd=META-INF/mule-test.xsd mule-2.0.1/tests/functional/src/main/resources/META-INF/spring.handlers0000644000175000017500000000013110754365306025521 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/test/2.0=org.mule.tck.config.TestNamespaceHandler mule-2.0.1/tests/functional/src/main/resources/META-INF/mule-test.xsd0000644000175000017500000001344410771256603025145 0ustar charlescharles A component that can be used for testing event flows. It is a configurable component. The return data for the component can be set so that users can 'simulate a call to a real service. This component can also track invocation history and fire notifications when events are received. Defines the data to retrn from the service once invoked. This can be located in a file (loaded using the 'file' attribute or the return data can be embeddded directly in the xml file) The location of a file to load as testdata. The file can point to a resource on the classpath or on disk. Will Cause the component to throw an exception before any processing takes place. A fully qualified classname of the exception objct to throw. Used in conjunction with 'throwException'. If this is not specified a FunctionalTestException will be thrown by default. Every messages that is received by the test component is stored and can be retrieved. If the developer does not want this imformation stored it can be turned off. A scenario where you may want to turn this feature off is when running millions of messages through the component would probably cause an OOM eventually) Determines if a FunctionalTestNotification is fired when an event is received by the component. Test cases can register to receive these notifications and make assertions on the current event. A string value that will get appened to every message payload that passes through the component. Note that by setting this property you implicitly select that the message payload will be converted to a String and that a string payload will be returned. A time in milliseconds to wait before returning a result. All processing happens in the component before the waiting happens. mule-2.0.1/tests/functional/src/test/0000755000175000017500000000000011351411044017344 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/0000755000175000017500000000000011351411042020263 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/0000755000175000017500000000000011351411042021052 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/0000755000175000017500000000000011351411044022016 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/transformers/0000755000175000017500000000000011351411044024543 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/transformers/simple/0000755000175000017500000000000011351411044026034 5ustar charlescharles././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/transformers/simple/MessagePropertiesTransformerTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/transformers/simple/MessagePropertiesTransformerT0000644000175000017500000001060410770356575034015 0ustar charlescharles/* * $Id: MessagePropertiesTransformerTestCase.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.simple; import org.mule.DefaultMuleMessage; import org.mule.RegistryContext; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.tck.FunctionalTestCase; import org.mule.transformer.simple.MessagePropertiesTransformer; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class MessagePropertiesTransformerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "message-properties-transformer-config.xml"; } public void testOverwriteFlagEnabledByDefault() throws Exception { MessagePropertiesTransformer t = new MessagePropertiesTransformer(); Map add = new HashMap(); add.put("addedProperty", "overwrittenValue"); t.setAddProperties(add); MuleMessage msg = new DefaultMuleMessage("message"); msg.setProperty("addedProperty", "originalValue"); MuleEventContext ctx = getTestEventContext(msg); // context clones message msg = ctx.getMessage(); DefaultMuleMessage transformed = (DefaultMuleMessage) t.transform(msg, null); assertSame(msg, transformed); assertEquals(msg.getUniqueId(), transformed.getUniqueId()); assertEquals(msg.getPayload(), transformed.getPayload()); // property values will be different assertEquals(msg.getPropertyNames(), transformed.getPropertyNames()); assertEquals("overwrittenValue", transformed.getProperty("addedProperty")); } public void testOverwriteFalsePreservesOriginal() throws Exception { MessagePropertiesTransformer t = new MessagePropertiesTransformer(); Map add = new HashMap(); add.put("addedProperty", "overwrittenValue"); t.setAddProperties(add); t.setOverwrite(false); DefaultMuleMessage msg = new DefaultMuleMessage("message"); msg.setProperty("addedProperty", "originalValue"); DefaultMuleMessage transformed = (DefaultMuleMessage) t.transform(msg, null); assertSame(msg, transformed); assertEquals(msg.getUniqueId(), transformed.getUniqueId()); assertEquals(msg.getPayload(), transformed.getPayload()); assertEquals(msg.getPropertyNames(), transformed.getPropertyNames()); assertEquals("originalValue", transformed.getProperty("addedProperty")); } public void testDelete() throws Exception { MessagePropertiesTransformer t = new MessagePropertiesTransformer(); t.setDeleteProperties(Collections.singletonList("badProperty")); DefaultMuleMessage msg = new DefaultMuleMessage("message"); msg.setProperty("badProperty", "badValue"); DefaultMuleMessage transformed = (DefaultMuleMessage) t.transform(msg, null); assertSame(msg, transformed); assertEquals(msg.getUniqueId(), transformed.getUniqueId()); assertEquals(msg.getPayload(), transformed.getPayload()); assertEquals(msg.getPropertyNames(), transformed.getPropertyNames()); assertFalse(transformed.getPropertyNames().contains("badValue")); } public void testTransformerConfig() throws Exception { MessagePropertiesTransformer transformer = (MessagePropertiesTransformer) RegistryContext.getRegistry().lookupTransformer("testTransformer"); assertNotNull(transformer); assertNotNull(transformer.getAddProperties()); assertNotNull(transformer.getDeleteProperties()); assertEquals(2, transformer.getAddProperties().size()); assertEquals(2, transformer.getDeleteProperties().size()); assertTrue(transformer.isOverwrite()); assertEquals("text/baz;charset=UTF-16BE", transformer.getAddProperties().get("Content-Type")); assertEquals("value", transformer.getAddProperties().get("key")); assertEquals("test-property1", transformer.getDeleteProperties().get(0)); assertEquals("test-property2", transformer.getDeleteProperties().get(1)); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/transformers/simple/ExpressionTransformerTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/transformers/simple/ExpressionTransformerTestCase0000644000175000017500000001340510770356575034025 0ustar charlescharles/* * $Id: ExpressionTransformerTestCase.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.simple; import org.mule.DefaultMuleMessage; import org.mule.RegistryContext; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Banana; import org.mule.tck.testmodels.fruit.FruitBasket; import org.mule.tck.testmodels.fruit.FruitBowl; import org.mule.transformer.simple.ExpressionTransformer; import java.util.List; import java.util.Map; import java.util.Properties; public class ExpressionTransformerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/transformers/expression-transformers-test.xml"; } public void testTransformerConfig() throws Exception { ExpressionTransformer transformer = (ExpressionTransformer) RegistryContext.getRegistry().lookupTransformer("testTransformer"); assertNotNull(transformer); assertNotNull(transformer.getArguments()); assertEquals(2, transformer.getArguments().size()); ExpressionTransformer.Argument arg1 = (ExpressionTransformer.Argument) transformer.getArguments().get(0); assertEquals("payload", arg1.getEvaluator()); assertEquals("org.mule.tck.testmodels.fruit.FruitBasket", arg1.getExpression()); assertFalse(arg1.isOptional()); ExpressionTransformer.Argument arg2 = (ExpressionTransformer.Argument) transformer.getArguments().get(1); assertEquals("headers", arg2.getEvaluator()); assertEquals("foo,bar", arg2.getExpression()); assertTrue(arg2.isOptional()); } public void testExecutionWithCorrectMessage() throws Exception { ExpressionTransformer transformer = (ExpressionTransformer) RegistryContext.getRegistry().lookupTransformer("testTransformer"); Properties props = new Properties(); props.setProperty("foo", "moo"); props.setProperty("bar", "mar"); MuleMessage message = new DefaultMuleMessage(new FruitBowl(new Apple(), new Banana()), props); Object result = transformer.transform(message); assertNotNull(result); assertTrue(result.getClass().isArray()); Object o1 = ((Object[]) result)[0]; assertTrue(o1 instanceof FruitBasket); Object o2 = ((Object[]) result)[1]; assertTrue(o2 instanceof Map); assertEquals(2, ((Map) o2).size()); assertEquals("moo", ((Map) o2).get("foo")); assertEquals("mar", ((Map) o2).get("bar")); } public void testExecutionWithPartialMissingOptionalParams() throws Exception { ExpressionTransformer transformer = (ExpressionTransformer) RegistryContext.getRegistry().lookupTransformer("testTransformer"); Properties props = new Properties(); props.setProperty("foo", "moo"); MuleMessage message = new DefaultMuleMessage(new FruitBowl(new Apple(), new Banana()), props); Object result = transformer.transform(message); assertNotNull(result); assertTrue(result.getClass().isArray()); Object o1 = ((Object[]) result)[0]; assertTrue(o1 instanceof FruitBasket); Object o2 = ((Object[]) result)[1]; assertTrue(o2 instanceof Map); assertEquals(1, ((Map) o2).size()); assertEquals("moo", ((Map) o2).get("foo")); } public void testExecutionWithAllMissingOptionalParams() throws Exception { ExpressionTransformer transformer = (ExpressionTransformer) RegistryContext.getRegistry().lookupTransformer("testTransformer"); Properties props = new Properties(); MuleMessage message = new DefaultMuleMessage(new FruitBowl(new Apple(), new Banana()), props); Object result = transformer.transform(message); assertNotNull(result); assertTrue(result.getClass().isArray()); Object o1 = ((Object[]) result)[0]; assertTrue(o1 instanceof FruitBasket); assertNull(((Object[]) result)[1]); } public void testTransformerConfigWithSingleArgument() throws Exception { ExpressionTransformer transformer = (ExpressionTransformer) RegistryContext.getRegistry().lookupTransformer("testTransformer2"); Properties props = new Properties(); props.setProperty("foo", "moo"); props.setProperty("bar", "mar"); MuleMessage message = new DefaultMuleMessage(new FruitBowl(new Apple(), new Banana()), props); Object result = transformer.transform(message); assertNotNull(result); assertFalse(result.getClass().isArray()); assertTrue(result instanceof List); assertTrue(((List)result).contains("moo")); assertTrue(((List)result).contains("mar")); } public void testExecutionWithInCorrectMessage() throws Exception { ExpressionTransformer transformer = (ExpressionTransformer) RegistryContext.getRegistry().lookupTransformer("testTransformer2"); Properties props = new Properties(); props.setProperty("foo", "moo"); MuleMessage message = new DefaultMuleMessage(new FruitBowl(new Apple(), new Banana()), props); try { transformer.transform(message); fail("Not all headers present, the transform should have failed"); } catch (TransformerException e) { //exprected } } }mule-2.0.1/tests/functional/src/test/java/org/mule/test/0000755000175000017500000000000011351411042022773 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/test/firewall/0000755000175000017500000000000011351411043024601 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/test/firewall/FirewallTestCase.java0000644000175000017500000002013110712110726030646 0ustar charlescharles/* * $Id: FirewallTestCase.java 9516 2007-10-31 14:31:50Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.firewall; import org.mule.config.factories.HostNameFactory; import org.mule.tck.AbstractMuleTestCase; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; import java.security.SecureRandom; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class FirewallTestCase extends AbstractMuleTestCase { public static final String LOCALHOST = "localhost"; public static final String LOCALADDR = "127.0.0.1"; public static final int TEST_COUNT = 1; protected final Log logger = LogFactory.getLog(this.getClass()); private SecureRandom random = new SecureRandom(); public void testLoopback() throws Exception { // this gives localhost.localdomain on sourceforge // consistentAddress(LOCALHOST, true); consistentAddress(LOCALHOST, false); // assertEquals("Strange name for loopback", LOCALHOST, InetAddress.getByName(LOCALADDR).getCanonicalHostName()); } public void testLocalHost() throws Exception { InetAddress aLocalAddress = InetAddress.getLocalHost(); logger.info("Java returns " + addressToString(aLocalAddress) + " as the 'local' address"); assertNotSame("No external address", LOCALADDR, aLocalAddress.getHostAddress()); consistentAddress(aLocalAddress.getHostName(), false); assertEquals("Inconsistent hostname", aLocalAddress.getHostName(), new HostNameFactory().create(null)); } public void testCanonicalHost() throws Exception { InetAddress aLocalAddress = InetAddress.getLocalHost(); assertNotSame("No extrernal name", LOCALHOST, aLocalAddress.getCanonicalHostName()); consistentAddress(aLocalAddress.getCanonicalHostName(), true); } protected void consistentAddress(String name, boolean canonical) throws UnknownHostException { String address = InetAddress.getByName(name).getHostAddress(); logger.debug("Testing relationship between " + name + " and " + address); assertEquals("Name " + name + " is inconsistent", name, name(InetAddress.getByName(name), canonical)); assertEquals("Address " + address + " is inconsistent", address, InetAddress.getByName(address).getHostAddress()); // we cannot expect to go from address to name consistently, but we can expect // names always to resolve to the same address, and for addresses not to change // when going via a name (in other words, any aliases are consistent). assertEquals(name + " -> " + address + " is inconsistent", address, InetAddress.getByName(name).getHostAddress()); assertEquals(name + " -> " + address + " -> " + name + " -> " + address + " is inconsistent", address, InetAddress.getByName( name( InetAddress.getByName( InetAddress.getByName(name).getHostAddress()), canonical)).getHostAddress()); } protected String name(InetAddress address, boolean canonical) { if (canonical) { return address.getCanonicalHostName(); } else { return address.getHostName(); } } public void testLocalhostTcp() throws Exception { for (int i = 0; i < TEST_COUNT; ++i) { doTestTcp(InetAddress.getByName(LOCALHOST), randomPrivatePort()); } } public void testHostnameTcp() throws Exception { for (int i = 0; i < TEST_COUNT; ++i) { doTestTcp(InetAddress.getLocalHost(), randomPrivatePort()); } } public void testLocalhostUdp() throws Exception { for (int i = 0; i < TEST_COUNT; ++i) { doTestUdp(InetAddress.getByName(LOCALHOST), randomPrivatePort()); } } public void testHostnameUdp() throws Exception { for (int i = 0; i < TEST_COUNT; ++i) { doTestUdp(InetAddress.getLocalHost(), randomPrivatePort()); } } protected void doTestTcp(InetAddress address, int port) throws Exception { try { logger.debug("Testing TCP on " + addressToString(address, port)); ServerSocket server = openTcpServer(address, port); Socket client = openTcpClient(address, port); Socket receiver = server.accept(); client.getOutputStream().write(1); assertEquals("Failed to send byte via " + addressToString(address, port), 1, receiver.getInputStream().read()); client.close(); server.close(); } catch (Exception e) { logger.error("Error while attempting TCP message on " + addressToString(address, port)); throw e; } } protected void doTestUdp(InetAddress address, int port) throws Exception { try { logger.debug("Testing UDP on " + addressToString(address, port)); DatagramSocket server = openUdpServer(address, port); DatagramSocket client = openUdpClient(); client.send(new DatagramPacket(new byte[]{1}, 1, address, port)); DatagramPacket packet = new DatagramPacket(new byte[1], 1); server.receive(packet); assertEquals("Failed to send packet via " + addressToString(address, port), 1, packet.getData()[0]); client.close(); server.close(); } catch (Exception e) { logger.error("Error while attempting UDP message on " + addressToString(address, port)); throw e; } } protected Socket openTcpClient(InetAddress address, int port) throws IOException { try { return new Socket(address, port); } catch (IOException e) { logger.error("Could not open TCP client to " + addressToString(address, port)); throw e; } } protected ServerSocket openTcpServer(InetAddress address, int port) throws IOException { try { return new ServerSocket(port, 1, address); } catch (IOException e) { logger.error("Could not open TCP server on " + addressToString(address, port)); throw e; } } protected DatagramSocket openUdpServer(InetAddress address, int port) throws IOException { try { return new DatagramSocket(port, address); } catch (IOException e) { logger.error("Could not open UDP server on " + addressToString(address, port)); throw e; } } protected DatagramSocket openUdpClient() throws IOException { try { return new DatagramSocket(); } catch (IOException e) { logger.error("Could not open UDP client"); throw e; } } protected String addressToString(InetAddress address, int port) { return addressToString(address) + ":" + port; } protected String addressToString(InetAddress address) { return address.getHostName() + "/" + address.getCanonicalHostName() + "/" + address.getHostAddress(); } protected int randomPrivatePort() { return randomPort(49152, 65535); } /** * @param lo * @param hi * @return A number between lo and hi (inclusive) */ protected int randomPort(int lo, int hi) { return lo + random.nextInt(hi - lo + 1); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/0000755000175000017500000000000011351411042024275 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/Nestable.java0000644000175000017500000000104710663120553026710 0ustar charlescharles/* * $Id: Nestable.java 8016 2007-08-22 20:49:47Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; public class Nestable { public void setNestable(Nestable nestable) { // empty } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/DefaultThreadingProfileMule2083TestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/DefaultThreadingProfileMule2083TestCa0000644000175000017500000000147010664703640033237 0ustar charlescharles/* * $Id: DefaultThreadingProfileMule2083TestCase.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import org.mule.tck.FunctionalTestCase; public class DefaultThreadingProfileMule2083TestCase extends FunctionalTestCase { protected String getConfigResources() { return "default-threading-profile-1-mule-2083.xml, default-threading-profile-2-mule-2083.xml"; } public void testStartup() { // no-op } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/MapHolder.java0000644000175000017500000000121510664703640027030 0ustar charlescharles/* * $Id: MapHolder.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import java.util.Map; public class MapHolder { private Map map; public Map getMap() { return map; } public void setMap(Map map) { this.map = map; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/SpringNamespaceConfigBuilderV2TestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/SpringNamespaceConfigBuilderV2TestCas0000644000175000017500000001351110777661265033465 0ustar charlescharles/* * $Id: SpringNamespaceConfigBuilderV2TestCase.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.config.ConfigurationException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.routing.OutboundRouterCollection; import org.mule.api.routing.ResponseRouterCollection; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.routing.ExpressionMessageInfoMapping; import org.mule.routing.outbound.AbstractOutboundRouter; import org.mule.routing.response.AbstractResponseRouter; import org.mule.tck.AbstractConfigBuilderTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.mule.TestCompressionTransformer; import java.util.List; /** * This is an extended version of the same test covered in * {@link org.mule.test.spring.SpringNamespaceConfigBuilderTestCase}. Both are translations of an * earlier (1.X) test. * * I realise this seems rather messy, and I did consider merging the two, but they often test different * things, and we would have lost quite a few tests on merging. So I am afraid we are left with two * rather rambling, parallel tests. But these tests examing "corner cases" no other tests cover, so * are quite valuable... */ public class SpringNamespaceConfigBuilderV2TestCase extends AbstractConfigBuilderTestCase { public SpringNamespaceConfigBuilderV2TestCase() { super(true); } public String getConfigResources() { return "org/mule/test/spring/config2/test-xml-mule2-config.xml," + "org/mule/test/spring/config2/test-xml-mule2-config-split.xml," + "org/mule/test/spring/config2/test-xml-mule2-config-split-properties.xml"; } // @Override public ConfigurationBuilder getBuilder() throws ConfigurationException { return new SpringXmlConfigurationBuilder(getConfigResources()); } public void testMessageInfoMappingConfig() throws Exception { Service d = muleContext.getRegistry().lookupService("msgInfoMappingTestComponent"); assertNotNull(d); OutboundRouterCollection router = d.getOutboundRouter(); assertNotNull(router); List routers = router.getRouters(); assertNotNull(routers); assertEquals(1, routers.size()); AbstractOutboundRouter theRouter = (AbstractOutboundRouter)routers.get(0); // the one we put in the config assertTrue(theRouter.getMessageInfoMapping() instanceof ExpressionMessageInfoMapping); } public void testMessageInfoMappingResponseRouterConfig() throws Exception { Service d = muleContext.getRegistry().lookupService("msgInfoMappingResponseRouterTestComponent"); assertNotNull(d); ResponseRouterCollection router = d.getResponseRouter(); assertNotNull(router); List routers = router.getRouters(); assertNotNull(routers); assertEquals(1, routers.size()); AbstractResponseRouter theRouter = (AbstractResponseRouter)routers.get(0); // the one we put in the config assertTrue(theRouter.getMessageInfoMapping() instanceof ExpressionMessageInfoMapping); } public void testPropertyTypesConfig() throws Exception { Service c = muleContext.getRegistry().lookupService("testPropertiesComponent"); assertNotNull(c); Object obj = getComponent(c); assertNotNull(obj); assertTrue(obj instanceof Apple); assertTrue(((Apple) obj).isBitten()); assertTrue(((Apple) obj).isWashed()); } public void testEndpointURIParamsConfig() { Service d = muleContext.getRegistry().lookupService("testPropertiesComponent"); assertNotNull(d); final InboundRouterCollection router = d.getInboundRouter(); assertNotNull(router); final List endpoints = router.getEndpoints(); assertNotNull(endpoints); assertFalse(endpoints.isEmpty()); final ImmutableEndpoint inboundEndpoint = (ImmutableEndpoint) endpoints.get(0); assertNotNull(inboundEndpoint); final List transformers = inboundEndpoint.getTransformers(); assertFalse(transformers.isEmpty()); assertNotNull(transformers.get(0)); final List responseTransformers = inboundEndpoint.getResponseTransformers(); assertFalse(responseTransformers.isEmpty()); assertNotNull(responseTransformers.get(0)); } // @Override public void testTransformerConfig() { // first of all test generic transformer configuration super.testTransformerConfig(); Transformer t = muleContext.getRegistry().lookupTransformer("TestCompressionTransformer"); assertNotNull(t); assertTrue(t instanceof TestCompressionTransformer); // This will only work with the MuleXml Builder other implementations // will have to set this proerty manually or mimic Mules behaviour assertEquals("this was set from the manager properties!", ((TestCompressionTransformer)t).getBeanProperty1()); assertEquals(12, ((TestCompressionTransformer)t).getBeanProperty2()); assertEquals(t.getReturnClass(), java.lang.String.class); t = muleContext.getRegistry().lookupTransformer("TestTransformer"); assertNotNull(t); assertEquals(t.getReturnClass(), byte[].class); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/SchemaValidationMule2225TestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/SchemaValidationMule2225TestCase.java0000644000175000017500000000405010743652051033157 0ustar charlescharles/* * $Id: SchemaValidationMule2225TestCase.java 10362 2008-01-17 13:12:09Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; import javax.xml.XMLConstants; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import org.xml.sax.SAXException; /** * Note: this test will fail if off-line. */ public class SchemaValidationMule2225TestCase extends AbstractMuleTestCase { /** * This test will fail when run with plain JDK 1.4 or even 1.5 - schema validation * requires a proper JAXP installation in the JDK's endorsed directory. It works fine * with Xerces 2.9.1 (as with mule 1.4.x) or a manually installed JAXP Sun RI on JDK * 1.5; JDK 1.6 works out of the box. */ public void testValidation() throws SAXException, IOException { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schemaFactory.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true); Source muleXsd = new StreamSource(load("META-INF/mule.xsd")); Schema schema = schemaFactory.newSchema(muleXsd); Source muleRootTestXml = new StreamSource(load("org/mule/test/spring/mule-root-test.xml")); schema.newValidator().validate(muleRootTestXml); } protected InputStream load(String name) throws IOException { InputStream stream = IOUtils.getResourceAsStream(name, getClass()); assertNotNull("Cannot load " + name, stream); return stream; } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/MuleRootTestCase.java0000644000175000017500000000230210745677442030367 0ustar charlescharles/* * $Id: MuleRootTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.FunctionalTestCase; public class MuleRootTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/spring/mule-root-test.xml"; } public void testModel() throws MuleException { assertNotNull("No model", muleContext.getRegistry().lookupModel("model")); ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("endpoint"); assertNotNull("No endpoint", endpoint); String address = endpoint.getEndpointURI().getAddress(); assertNotNull("No address", address); assertEquals("value", address); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/PoolingProfileTestCase.java0000644000175000017500000000464410766654216031561 0ustar charlescharles/* * $Id: PoolingProfileTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import org.mule.api.service.Service; import org.mule.component.PooledJavaComponent; import org.mule.config.PoolingProfile; import org.mule.tck.FunctionalTestCase; public class PoolingProfileTestCase extends FunctionalTestCase { protected String getConfigResources() { return "pooling-profile-test.xml"; } public void testDefault() { doTest("default", PoolingProfile.DEFAULT_POOL_EXHAUSTED_ACTION, PoolingProfile.DEFAULT_POOL_INITIALISATION_POLICY, PoolingProfile.DEFAULT_MAX_POOL_ACTIVE, PoolingProfile.DEFAULT_MAX_POOL_IDLE, PoolingProfile.DEFAULT_MAX_POOL_WAIT); } public void testFailAll() { doTest("fail_all", PoolingProfile.WHEN_EXHAUSTED_FAIL, PoolingProfile.INITIALISE_ALL, 1, 2, 3); } public void testGrowOne() { doTest("grow_one", PoolingProfile.WHEN_EXHAUSTED_GROW, PoolingProfile.INITIALISE_ONE, 2, 3, 4); } public void testWaitNone() { doTest("wait_none", PoolingProfile.WHEN_EXHAUSTED_WAIT, PoolingProfile.INITIALISE_NONE, 3, 4, 5); } protected void doTest(String service, int exhausted, int initialisation, int active, int idle, long wait) { Service c = muleContext.getRegistry().lookupService(service); assertNotNull(service, c); assertTrue(c.getComponent() instanceof PooledJavaComponent); PooledJavaComponent pjc = (PooledJavaComponent)c.getComponent(); PoolingProfile profile = pjc.getPoolingProfile(); assertNotNull(profile); assertEquals("exhausted:", exhausted, profile.getExhaustedAction()); assertEquals("initialisation:", initialisation, profile.getInitialisationPolicy()); assertEquals("active:", active, profile.getMaxActive()); assertEquals("idle:", idle, profile.getMaxIdle()); assertEquals("wait:", wait, profile.getMaxWait()); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/NestExampleTestCase.java0000644000175000017500000000131010663120553031025 0ustar charlescharles/* * $Id: NestExampleTestCase.java 8016 2007-08-22 20:49:47Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import org.mule.tck.FunctionalTestCase; public class NestExampleTestCase extends FunctionalTestCase { protected String getConfigResources() { return "nest-example.xml"; } public void testParse() { // empty } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/GlobalPropertiesMule2458TestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/GlobalPropertiesMule2458TestCase.java0000644000175000017500000000250310770364250033233 0ustar charlescharles/* * $Id: GlobalPropertiesMule2458TestCase.java 11435 2008-03-20 04:31:36Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.service.Service; import org.mule.tck.FunctionalTestCase; public class GlobalPropertiesMule2458TestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/spring/global-properties-mule-2458-test.xml"; } public void testProperties() { Service service = muleContext.getRegistry().lookupService("service"); assertNotNull(service); ImmutableEndpoint ep = (ImmutableEndpoint) service.getInboundRouter().getEndpoints().get(0); assertNotNull(ep); assertEquals("local", ep.getProperties().get("local")); assertEquals("global", ep.getProperties().get("global")); assertEquals("local", ep.getProperties().get("override-me")); assertEquals(3, ep.getProperties().size()); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/SpringNamespaceConfigBuilderTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/SpringNamespaceConfigBuilderTestCase.0000644000175000017500000000162010700234706033454 0ustar charlescharles/* * $Id:SpringNamespaceConfigBuilderTestCase.java 5187 2007-02-16 18:00:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import org.mule.tck.AbstractConfigBuilderTestCase; public class SpringNamespaceConfigBuilderTestCase extends AbstractConfigBuilderTestCase { public SpringNamespaceConfigBuilderTestCase() { super(false); } public String getConfigResources() { return "org/mule/test/spring/config1/test-xml-mule2-config.xml," + "org/mule/test/spring/config1/test-xml-mule2-config-split.xml"; } }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/PropertyPlaceholderMule2150TestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/PropertyPlaceholderMule2150TestCase.j0000644000175000017500000000250210745205313033235 0ustar charlescharles/* * $Id: PropertyPlaceholderMule2150TestCase.java 10442 2008-01-21 21:12:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import org.mule.tck.FunctionalTestCase; public class PropertyPlaceholderMule2150TestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/spring/property-placeholder-mule-2150-test.xml"; } protected String getProperty(String name) { MapHolder holder = (MapHolder) muleContext.getRegistry().lookupObject("props"); String value = (String) holder.getMap().get(name); assertNotNull(name, value); return value; } public void testMuleEnvironment() { assertEquals("value1", getProperty("prop1")); } public void testSpringPropertyPlaceholder() { assertEquals("value2", getProperty("prop2")); } public void testJavaEnvironment() { assertEquals(System.getProperty("java.version"), getProperty("prop3")); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/DummyNamespaceHandler.java0000644000175000017500000000225010663124630031356 0ustar charlescharles/* * $Id: DummyNamespaceHandler.java 8019 2007-08-22 21:24:40Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import org.mule.config.spring.handlers.MuleNamespaceHandler; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; public class DummyNamespaceHandler extends MuleNamespaceHandler { public void init() { registerBeanDefinitionParser("root", new OrphanDefinitionParser(Nestable.class, false)); registerBeanDefinitionParser("simple", new OrphanDefinitionParser(Nestable.class, false)); registerBeanDefinitionParser("subclass", new OrphanDefinitionParser(Nestable.class, false)); registerBeanDefinitionParser("random", new OrphanDefinitionParser(Nestable.class, false)); registerBeanDefinitionParser("another", new OrphanDefinitionParser(Nestable.class, false)); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/InheritedPropertiesMule2458TestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/test/spring/InheritedPropertiesMule2458TestCase.j0000644000175000017500000000355710753670035033272 0ustar charlescharles/* * $Id: InheritedPropertiesMule2458TestCase.java 10761 2008-02-10 21:43:57Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.spring; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.service.Service; import org.mule.tck.FunctionalTestCase; public class InheritedPropertiesMule2458TestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/spring/inherited-properties-mule-2458-test.xml"; } public void testProperties() { Service service = muleContext.getRegistry().lookupService("service"); assertNotNull(service); ImmutableEndpoint endpoint = (ImmutableEndpoint) service.getInboundRouter().getEndpoints().get(0); assertNotNull(endpoint); assertProperty(endpoint, "global-only", "global"); assertProperty(endpoint, "local-only", "local"); assertProperty(endpoint, "url-only", "url"); assertProperty(endpoint, "global-and-local", "local"); assertProperty(endpoint, "global-and-url", "global"); assertProperty(endpoint, "local-and-url", "local"); assertProperty(endpoint, "all", "local"); } protected void assertProperty(ImmutableEndpoint endpoint, String name, String value) { Object property = endpoint.getProperty(name); assertNotNull("Property " + name + " is missing", property); String actual = property.toString(); assertEquals("Unexpected value for " + name + ": " + actual + ", not " + value, value, actual); } }mule-2.0.1/tests/functional/src/test/java/org/mule/test/config/0000755000175000017500000000000011351411042024240 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/test/config/EndpointTransformerTestCase.java0000644000175000017500000000320110745677442032566 0ustar charlescharles/* * $Id: EndpointTransformerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.config; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.AbstractMuleTestCase; import org.mule.transformer.NoActionTransformer; import org.mule.transformer.TransformerUtils; public class EndpointTransformerTestCase extends AbstractMuleTestCase { public void testTransformerProperty() throws MuleException { muleContext.getRegistry().registerTransformer(new NoActionTransformer()); ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( "test:///tmp?transformers=NoActionTransformer"); assertEquals("NoActionTransformer", TransformerUtils.firstOrNull(endpoint.getTransformers()).getName()); } public void testResponseTransformerProperty() throws MuleException { muleContext.getRegistry().registerTransformer(new NoActionTransformer()); ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "test:///tmp?responseTransformers=NoActionTransformer"); assertEquals("NoActionTransformer", TransformerUtils.firstOrNull(endpoint.getResponseTransformers()).getName()); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/config/ExpressionFilterConfigTestCase.java0000644000175000017500000000525510771050152033207 0ustar charlescharles/* * $Id: ExpressionFilterConfigTestCase.java 11477 2008-03-22 00:18:50Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.config; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.routing.filters.ExpressionFilter; import org.mule.tck.FunctionalTestCase; public class ExpressionFilterConfigTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/config/expression-filter-config.xml"; } public void testConfig1() throws Exception { EndpointBuilder eb = muleContext.getRegistry().lookupEndpointBuilder("endpoint1"); assertNotNull(eb); InboundEndpoint ep = eb.buildInboundEndpoint(); assertNotNull(ep.getFilter()); assertTrue(ep.getFilter() instanceof ExpressionFilter); ExpressionFilter filter = (ExpressionFilter) ep.getFilter(); assertEquals("payload-type", filter.getEvaluator()); assertEquals("java.lang.String", filter.getExpression()); assertNull(filter.getCustomEvaluator()); assertFalse(filter.isNullReturnsTrue()); } public void testConfig2() throws Exception { EndpointBuilder eb = muleContext.getRegistry().lookupEndpointBuilder("endpoint2"); assertNotNull(eb); InboundEndpoint ep = eb.buildInboundEndpoint(); assertNotNull(ep.getFilter()); assertTrue(ep.getFilter() instanceof ExpressionFilter); ExpressionFilter filter = (ExpressionFilter) ep.getFilter(); assertEquals("header", filter.getEvaluator()); assertEquals("foo=bar", filter.getExpression()); assertNull(filter.getCustomEvaluator()); assertTrue(filter.isNullReturnsTrue()); } public void testConfig3() throws Exception { EndpointBuilder eb = muleContext.getRegistry().lookupEndpointBuilder("endpoint3"); assertNotNull(eb); InboundEndpoint ep = eb.buildInboundEndpoint(); assertNotNull(ep.getFilter()); assertTrue(ep.getFilter() instanceof ExpressionFilter); ExpressionFilter filter = (ExpressionFilter) ep.getFilter(); assertEquals("custom", filter.getEvaluator()); assertEquals("a.b.c", filter.getExpression()); assertEquals("something", filter.getCustomEvaluator()); assertFalse(filter.isNullReturnsTrue()); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/config/InvalidMessageFactory.java0000644000175000017500000000164010664630335031345 0ustar charlescharles/* * $Id: InvalidMessageFactory.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.config; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class InvalidMessageFactory extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("thisdoesnotexist"); public static Message getInvalidMessage() { // the code can safely be ignored. MessageFactory must fail before when // trying to find the inexistent bundle. return createMessage(BUNDLE_PATH, 42); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/config/MessagesTestCase.java0000644000175000017500000000277710664630335030341 0ustar charlescharles/* * $Id: MessagesTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.config; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; import org.mule.tck.AbstractMuleTestCase; import java.util.MissingResourceException; public class MessagesTestCase extends AbstractMuleTestCase { public void testMessageLoading() throws Exception { Message message = CoreMessages.authFailedForUser("Fred"); assertEquals("Authentication failed for principal Fred", message.getMessage()); assertEquals(135, message.getCode()); } public void testBadBundle() { try { InvalidMessageFactory.getInvalidMessage(); fail("should throw resource bundle not found exception"); } catch (MissingResourceException e) { assertTrue(e.getMessage().startsWith("Can't find bundle")); } } public void testGoodBundle() { Message message = TestMessages.testMessage("one", "two", "three"); assertEquals("Testing, Testing, one, two, three", message.getMessage()); assertEquals(1, message.getCode()); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/config/StartupPropertiesTestCase.java0000644000175000017500000000325610777050076032305 0ustar charlescharles/* * $Id: StartupPropertiesTestCase.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.config; import org.mule.tck.FunctionalTestCase; import java.util.Properties; public class StartupPropertiesTestCase extends FunctionalTestCase { private String STARTUP_PROPERTY_1_KEY = "startupProperty1"; private String STARTUP_PROPERTY_2_KEY = "startupProperty2"; private String STARTUP_PROPERTY_1_VALUE = "startupProperty1Value"; private String STARTUP_PROPERTY_2_VALUE = "startupProperty2Value"; protected String getConfigResources() { return "org/mule/test/config/startup-properties-test.xml"; } protected Properties getStartUpProperties() { Properties p = new Properties(); p.setProperty(STARTUP_PROPERTY_1_KEY, STARTUP_PROPERTY_1_VALUE); p.setProperty(STARTUP_PROPERTY_2_KEY, STARTUP_PROPERTY_2_VALUE); return p; } public void testStartProperties() { Object property1 = muleContext.getRegistry().lookupObject(STARTUP_PROPERTY_1_KEY); Object property2 = muleContext.getRegistry().lookupObject(STARTUP_PROPERTY_2_KEY); assertNotNull(property1); assertNotNull(property2); assertEquals(STARTUP_PROPERTY_1_VALUE, property1); assertEquals(STARTUP_PROPERTY_2_VALUE, property2); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/config/TestMessages.java0000644000175000017500000000146110664630335027532 0ustar charlescharles/* * $Id: TestMessages.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.config; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class TestMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("test"); public static Message testMessage(String arg1, String arg2, String arg3) { return createMessage(BUNDLE_PATH, 1, arg1, arg2, arg3); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/config/CustomTransactionTestCase.java0000644000175000017500000000266610770772470032254 0ustar charlescharles/* * $Id: CustomTransactionTestCase.java 11465 2008-03-21 17:49:44Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.config; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transaction.TransactionConfig; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.mule.TestTransactionFactory; public class CustomTransactionTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/config/custom-transaction-config.xml"; } public void testConfig() throws Exception { EndpointBuilder epb = muleContext.getRegistry().lookupEndpointBuilder("testEndpoint1"); assertNotNull(epb); InboundEndpoint iep = epb.buildInboundEndpoint(); assertNotNull(iep.getTransactionConfig()); assertTrue(iep.getTransactionConfig().getFactory() instanceof TestTransactionFactory); assertEquals(TransactionConfig.ACTION_ALWAYS_BEGIN, iep.getTransactionConfig().getAction()); assertEquals(4004, iep.getTransactionConfig().getTimeout()); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/config/JndiFunctionalTestCase.java0000644000175000017500000000241510745205313031460 0ustar charlescharles/* * $Id: JndiFunctionalTestCase.java 10442 2008-01-21 21:12:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.config; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Orange; public class JndiFunctionalTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/spring/jndi-functional-test.xml"; } public void testJndi() { Object obj; obj = muleContext.getRegistry().lookupObject(new String("apple")); assertNotNull(obj); assertEquals(Apple.class, obj.getClass()); obj = muleContext.getRegistry().lookupObject(new String("orange")); assertNotNull(obj); assertEquals(Orange.class, obj.getClass()); assertEquals(new Integer(8), ((Orange) obj).getSegments()); assertEquals("Florida Sunny", ((Orange) obj).getBrand()); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/config/MultipleNamedConnectorsTestCase.java0000644000175000017500000000147310664630335033360 0ustar charlescharles/* * $Id: MultipleNamedConnectorsTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.config; import org.mule.tck.FunctionalTestCase; public class MultipleNamedConnectorsTestCase extends FunctionalTestCase { protected String getConfigResources() { return "multiple-named-connectors-test.xml"; } public void testMultipleNamedConnectors() throws Exception { // no-op, the initialization must not fail. } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/config/ExceptionHelperTestCase.java0000644000175000017500000000332710745677442031672 0ustar charlescharles/* * $Id: ExceptionHelperTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.config; import org.mule.api.DefaultMuleException; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.MessageFactory; import org.mule.tck.AbstractMuleTestCase; import java.util.List; import java.util.Map; public class ExceptionHelperTestCase extends AbstractMuleTestCase { public void testNestedExceptionRetreval() throws Exception { Exception testException = getException(); Throwable t = ExceptionHelper.getRootException(testException); assertNotNull(t); assertEquals("blah", t.getMessage()); assertNull(t.getCause()); t = ExceptionHelper.getRootMuleException(testException); assertNotNull(t); assertEquals("bar", t.getMessage()); assertNotNull(t.getCause()); List l = ExceptionHelper.getExceptionsAsList(testException); assertEquals(3, l.size()); Map info = ExceptionHelper.getExceptionInfo(testException); assertNotNull(info); assertEquals(1, info.size()); assertNotNull(info.get("JavaDoc")); } private Exception getException() { return new DefaultMuleException(MessageFactory.createStaticMessage("foo"), new DefaultMuleException( MessageFactory.createStaticMessage("bar"), new Exception("blah"))); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/tck/0000755000175000017500000000000011351411042023554 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/test/tck/TestNamespaceTestCase.java0000644000175000017500000000470710770772424030641 0ustar charlescharles/* * $Id: TestNamespaceTestCase.java 11464 2008-03-21 17:49:08Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.tck; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent2; import java.io.IOException; public class TestNamespaceTestCase extends FunctionalTestCase { protected String getConfigResources() { return "test-namespace-config.xml"; } public void testComponent1Config() throws Exception { Object object = getComponent("testService1"); assertNotNull(object); assertTrue(object instanceof FunctionalTestComponent2); FunctionalTestComponent2 ftc = (FunctionalTestComponent2 ) object; assertFalse(ftc.isEnableMessageHistory()); assertFalse(ftc.isEnableNotifications()); assertNull(ftc.getAppendString()); assertEquals("Foo Bar Car Jar", ftc.getReturnData()); } public void testComponent2Config() throws Exception { String testData = loadResourceAsString("test-data.txt"); Object object = getComponent("testService2"); assertNotNull(object); assertTrue(object instanceof FunctionalTestComponent2); FunctionalTestComponent2 ftc = (FunctionalTestComponent2) object; assertTrue(ftc.isThrowException()); assertNotNull(ftc.getExceptionToThrow()); assertTrue(ftc.getExceptionToThrow().isAssignableFrom(IOException.class)); assertEquals(testData, ftc.getReturnData()); assertTrue(ftc.isEnableMessageHistory()); assertTrue(ftc.isEnableNotifications()); assertNull(ftc.getAppendString()); } public void testComponent3Config() throws Exception { Object object = getComponent("testService3"); assertNotNull(object); assertTrue(object instanceof FunctionalTestComponent2); FunctionalTestComponent2 ftc = (FunctionalTestComponent2) object; assertFalse(ftc.isEnableMessageHistory()); assertTrue(ftc.isEnableNotifications()); assertEquals(" ${mule:serviceName}", ftc.getAppendString()); assertNull(ftc.getReturnData()); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/components/0000755000175000017500000000000011351411042025160 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/test/components/ComponentPoolingTestCase.java0000644000175000017500000000744610766654216033011 0ustar charlescharles///* // * $Id: ComponentPoolingTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ // * -------------------------------------------------------------------------------------- // * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com // * // * The software in this package is published under the terms of the CPAL v1.0 // * license, a copy of which has been included with this distribution in the // * LICENSE.txt file. // */ // //package org.mule.test.components; // //import org.mule.api.service.Service; //import org.mule.tck.FunctionalTestCase; //import org.mule.tck.services.UniqueComponent; //import org.mule.tck.testmodels.mule.TestSedaService; // //public class ComponentPoolingTestCase extends FunctionalTestCase //{ // protected String getConfigResources() // { // return "org/mule/test/components/component-pooling-functional-test.xml"; // } // // public void testConfigSanity() throws Exception // { // Service c = muleContext.getRegistry().lookupService("unique1"); // assertTrue("Service should be a TestSedaService", c instanceof TestSedaService); // Object component = ((TestSedaService) c).getOrCreateService(); // assertNotNull(component); // assertTrue("Service should be of type UniqueComponent but is of type " + component.getClass(), component instanceof UniqueComponent); // String id1 = ((UniqueComponent) component).getId(); // assertNotNull(id1); // } // // public void testSimpleFactory() throws Exception // { // Service c = muleContext.getRegistry().lookupService("unique1"); // // Object component = ((TestSedaService) c).getOrCreateService(); // String id1 = ((UniqueComponent) component).getId(); // // component = ((TestSedaService) c).getOrCreateService(); // String id2 = ((UniqueComponent) component).getId(); // // assertFalse("Service IDs " + id1 + " and " + id2 + " should be different", id1.equals(id2)); // } // // public void testSingletonFactoryWithClassName() throws Exception // { // Service c = muleContext.getRegistry().lookupService("unique2"); // // Object component = ((TestSedaService) c).getOrCreateService(); // String id1 = ((UniqueComponent) component).getId(); // // component = ((TestSedaService) c).getOrCreateService(); // String id2 = ((UniqueComponent) component).getId(); // // assertTrue("Service IDs " + id1 + " and " + id2 + " should be the same", id1.equals(id2)); // } // // public void testSingletonFactoryWithBean() throws Exception // { // Service c = muleContext.getRegistry().lookupService("unique3"); // // Object component = ((TestSedaService) c).getOrCreateService(); // String id1 = ((UniqueComponent) component).getId(); // // component = ((TestSedaService) c).getOrCreateService(); // String id2 = ((UniqueComponent) component).getId(); // // assertTrue("Service IDs " + id1 + " and " + id2 + " should be the same", id1.equals(id2)); // } // //// public void testPoolingDisabled() throws Exception //// { //// Model model = muleContext.getRegistry().lookupModel("main"); //// Service c = model.getComponent("unique4"); //// //// MuleProxy proxy = ((TestSedaService) c).getProxy(); //// Object service = ((TestMuleProxy) proxy).getComponent(); //// String id1 = ((UniqueComponent) service).getId(); //// //// proxy = ((TestSedaService) c).getProxy(); //// service = ((TestMuleProxy) proxy).getComponent(); //// String id2 = ((UniqueComponent) service).getId(); //// //// assertTrue("Service IDs " + id1 + " and " + id2 + " should be the same", id1.equals(id2)); //// } // //} // // mule-2.0.1/tests/functional/src/test/java/org/mule/test/components/ServiceStateTestCase.java0000644000175000017500000001356510766654216032117 0ustar charlescharles/* * $Id: ServiceStateTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.components; import org.mule.api.MuleException; import org.mule.api.service.Service; import org.mule.api.service.ServiceException; import org.mule.api.transport.MessageReceiver; import org.mule.tck.FunctionalTestCase; import org.mule.transport.AbstractConnector; public class ServiceStateTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/components/component-initial-state.xml"; } public ServiceStateTestCase() { setStartContext(true); } public void testDefaultInitialState() throws Exception { Service c = muleContext.getRegistry().lookupService("defaultComponent"); // Service initially started assertTrue(c.isStarted()); assertFalse(c.isPaused()); // The listeners should be registered and started. AbstractConnector connector = (AbstractConnector)muleContext.getRegistry().lookupConnector("connector.test.0"); assertNotNull(connector); assertTrue(connector.isStarted()); MessageReceiver[] receivers = connector.getReceivers("*default*"); assertEquals(1, receivers.length); assertTrue(receivers[0].isConnected()); } // MULE-494 public void testInitialStateStopped() throws Exception { Service c = muleContext.getRegistry().lookupService("stoppedComponent"); assertEquals("stopped", c.getInitialState()); // Service initially stopped assertFalse(c.isStarted()); // The connector should be started, but with no listeners registered. AbstractConnector connector = (AbstractConnector)muleContext.getRegistry().lookupConnector("connector.test.0"); assertNotNull(connector); assertTrue(connector.isStarted()); MessageReceiver[] receivers = connector.getReceivers("*stopped*"); assertEquals(0, receivers.length); // Start the service. c.start(); assertTrue(c.isStarted()); // The listeners should now be registered and started. assertTrue(connector.isStarted()); receivers = connector.getReceivers("*stopped*"); assertEquals(1, receivers.length); assertTrue(receivers[0].isConnected()); } // MULE-503 public void testStoppingComponentStopsEndpoints() throws Exception { Service c = muleContext.getRegistry().lookupService("startedComponent"); assertTrue(c.isStarted()); // The listeners should be registered and started. AbstractConnector connector = (AbstractConnector)muleContext.getRegistry().lookupConnector("connector.test.0"); assertNotNull(connector); assertTrue(connector.isStarted()); MessageReceiver[] receivers = connector.getReceivers("*started*"); assertEquals(1, receivers.length); assertTrue(receivers[0].isConnected()); // Stop service c.stop(); assertFalse(c.isStarted()); // Connector is still started, but no more receivers. assertTrue(connector.isStarted()); receivers = connector.getReceivers("*started*"); assertEquals(0, receivers.length); } public void testSendToStoppedComponent() throws Exception { Service c = muleContext.getRegistry().lookupService("stoppedComponent"); // Service initially stopped assertFalse(c.isStarted()); try { c.dispatchEvent(getTestEvent("hello", c)); fail(); } catch (ServiceException e) { // expected } try { c.sendEvent(getTestEvent("hello", c)); fail(); } catch (ServiceException e) { // expected } } public void testInitialStatePaused() throws Exception { Service c = muleContext.getRegistry().lookupService("pausedComponent"); // Service initially started but paused. assertTrue(c.isStarted()); assertTrue(c.isPaused()); // The listeners should be registered and started. AbstractConnector connector = (AbstractConnector)muleContext.getRegistry().lookupConnector("connector.test.0"); assertNotNull(connector); assertTrue(connector.isStarted()); MessageReceiver[] receivers = connector.getReceivers("*paused*"); assertEquals(1, receivers.length); assertTrue(receivers[0].isConnected()); } public void testSendToPausedComponent() throws Exception { // TODO MULE-1995 final Service c = muleContext.getRegistry().lookupService("startedComponent"); assertTrue(c.isStarted()); c.pause(); assertTrue(c.isPaused()); new Thread(new Runnable() { public void run() { try { Thread.sleep(2000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } try { c.resume(); } catch (MuleException e) { fail(e.getMessage()); } } }).start(); long t0 = System.currentTimeMillis(); c.sendEvent(getTestInboundEvent("hello")); long t1 = System.currentTimeMillis(); assertTrue(t1 - t0 > 1000); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/components/ServiceDescriptorTestCase.java0000644000175000017500000000667310766654216033157 0ustar charlescharles/* * $Id: ServiceDescriptorTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.components; import org.mule.api.service.Service; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.fruit.Orange; public class ServiceDescriptorTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/components/service-factory-functional-test.xml"; } public void testGenericObjectFactory() throws Exception { Service c = muleContext.getRegistry().lookupService("orange1"); Object service = getComponent(c); assertTrue("Service should be an Orange", service instanceof Orange); // Default values assertEquals(new Integer(10), ((Orange) service).getSegments()); } public void testGenericObjectFactoryWithProperties() throws Exception { Service c = muleContext.getRegistry().lookupService("orange2"); // Create an orange Object service = getComponent(c); assertTrue("Service should be an Orange", service instanceof Orange); assertEquals(new Integer(8), ((Orange) service).getSegments()); assertEquals("Florida Sunny", ((Orange) service).getBrand()); // Create another orange service = getComponent(c); assertTrue("Service should be an Orange", service instanceof Orange); assertEquals(new Integer(8), ((Orange) service).getSegments()); assertEquals("Florida Sunny", ((Orange) service).getBrand()); } public void testSingletonObjectFactory() throws Exception { Service c = muleContext.getRegistry().lookupService("orange3"); Object service = getComponent(c); assertTrue("Service should be an Orange", service instanceof Orange); // Default values assertEquals(new Integer(10), ((Orange) service).getSegments()); } public void testSpringSingleton() throws Exception { Service c = muleContext.getRegistry().lookupService("orange4"); Object service = getComponent(c); assertTrue("Service should be an Orange", service instanceof Orange); // Default values assertEquals(new Integer(10), ((Orange) service).getSegments()); } public void testSpringFactoryBean() throws Exception { Service c = muleContext.getRegistry().lookupService("orange5"); Object service = getComponent(c); assertNotNull(service); assertTrue("Service should be an Orange but is: " + service.getClass(), service instanceof Orange); assertEquals(new Integer(8), ((Orange) service).getSegments()); assertEquals("Florida Sunny", ((Orange) service).getBrand()); } public void testPojoAsFactoryBean() throws Exception { Service c = muleContext.getRegistry().lookupService("orange6"); Object service = getComponent(c); assertNotNull(service); assertTrue("Service should be an Orange but is: " + service.getClass(), service instanceof Orange); assertEquals("Florida Sunny", ((Orange) service).getBrand()); } } mule-2.0.1/tests/functional/src/test/java/org/mule/test/components/ObjectFactoryTestCase.java0000644000175000017500000000432310745677442032247 0ustar charlescharles/* * $Id: ObjectFactoryTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.components; import org.mule.api.registry.Registry; import org.mule.tck.FunctionalTestCase; import org.mule.tck.services.UniqueComponent; public class ObjectFactoryTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/components/object-factory-functional-test.xml"; } public void testDefaultScope() throws Exception { Registry registry = muleContext.getRegistry(); Object bean1 = registry.lookupObject("default"); assertNotNull(bean1); String id1 = ((UniqueComponent) bean1).getId(); Object bean2 = registry.lookupObject("default"); assertNotNull(bean2); String id2 = ((UniqueComponent) bean2).getId(); assertEquals(id1, id2); } public void testSingletonScope() throws Exception { Registry registry = muleContext.getRegistry(); Object bean1 = registry.lookupObject("singleton"); assertNotNull(bean1); String id1 = ((UniqueComponent) bean1).getId(); Object bean2 = registry.lookupObject("singleton"); assertNotNull(bean2); String id2 = ((UniqueComponent) bean2).getId(); assertEquals(id1, id2); } public void testPrototypeScope() throws Exception { Registry registry = muleContext.getRegistry(); Object bean1 = registry.lookupObject("prototype"); assertNotNull(bean1); String id1 = ((UniqueComponent) bean1).getId(); Object bean2 = registry.lookupObject("prototype"); assertNotNull(bean2); String id2 = ((UniqueComponent) bean2).getId(); assertFalse("IDs " + id1 + " and " + id2 + " should be different", id1.equals(id2)); } } mule-2.0.1/tests/functional/src/test/java/org/mule/EmbeddedMuleTestCase.java0000644000175000017500000000235510754365306026655 0ustar charlescharles/* * $Id: EmbeddedMuleTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextFactory; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.context.DefaultMuleContextFactory; import junit.framework.TestCase; public class EmbeddedMuleTestCase extends TestCase { public void testStartup() throws Exception { SpringXmlConfigurationBuilder builder = new SpringXmlConfigurationBuilder( "org/mule/test/spring/mule-root-test.xml"); MuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); MuleContext context = muleContextFactory.createMuleContext(builder); // MuleContext must be started explicitly after MULE-1988 assertFalse(context.isStarted()); context.start(); assertTrue(context.isStarted()); } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/0000755000175000017500000000000011351411043023262 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/0000755000175000017500000000000011351411044024565 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/CoreNamespaceRoutersTestCase.java0000644000175000017500000000441010746275214033172 0ustar charlescharles/* * $Id: CoreNamespaceRoutersTestCase.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.routing.Router; import org.mule.api.service.Service; import org.mule.routing.inbound.ForwardingConsumer; import org.mule.routing.inbound.IdempotentSecureHashReceiver; import org.mule.routing.inbound.InboundPassThroughRouter; import org.mule.routing.inbound.SelectiveConsumer; import org.mule.tck.FunctionalTestCase; import java.util.List; public class CoreNamespaceRoutersTestCase extends FunctionalTestCase { public String getConfigResources() { return "core-namespace-routers.xml"; } public void testForwardingRouter() throws Exception { Router r = lookupInboundRouterFromService("ForwardingRouter"); assertTrue(r instanceof ForwardingConsumer); } public void testIdempotentSecureHashReceiverRouter() throws Exception { Router r = lookupInboundRouterFromService("IdempotentSecureHashReceiverRouter"); assertTrue(r instanceof IdempotentSecureHashReceiver); } public void testInboundPassThroughRouter() throws Exception { Router r = lookupInboundRouterFromService("InboundPassThroughRouter"); assertTrue(r instanceof InboundPassThroughRouter); } public void testSelectiveConsumerRouter() throws Exception { Router r = lookupInboundRouterFromService("SelectiveConsumerRouter"); assertTrue(r instanceof SelectiveConsumer); assertFalse(((SelectiveConsumer) r).isTransformFirst()); } protected Router lookupInboundRouterFromService(String serviceName) throws Exception { Service c = muleContext.getRegistry().lookupService(serviceName); assertNotNull(c); List routers = c.getInboundRouter().getRouters(); assertEquals(1, routers.size()); assertTrue(routers.get(0) instanceof Router); return (Router) routers.get(0); } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/MuleContextAwareTestCase.java0000644000175000017500000000154510745205313032326 0ustar charlescharles/* * $Id: MuleContextAwareTestCase.java 10442 2008-01-21 21:12:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.tck.FunctionalTestCase; /** * This tests that we can have references to management context aware objects within a config */ public class MuleContextAwareTestCase extends FunctionalTestCase { protected String getConfigResources() { return "management-context-aware-test.xml"; } public void testStartup() { // only want startup to succeed } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/DummyComponent.java0000644000175000017500000000115210745677442030433 0ustar charlescharles/* * $Id: DummyComponent.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.context.MuleContextAware; public class DummyComponent { public void setProperty(MuleContextAware dummy) { // empty } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/DummyMuleContextAware.java0000644000175000017500000000351010774254333031710 0ustar charlescharles/* * $Id: DummyMuleContextAware.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextAware; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import java.util.List; public class DummyMuleContextAware implements MuleContextAware, Transformer { public void setMuleContext(MuleContext context) { // empty } public boolean isSourceTypeSupported(Class aClass) { return false; } public List getSourceTypes() { return null; } public boolean isAcceptNull() { return false; } public boolean isIgnoreBadInput() { return false; } public Object transform(Object src) throws TransformerException { return null; } public void setReturnClass(Class theClass) { // empty } public Class getReturnClass() { return null; } public ImmutableEndpoint getEndpoint() { return null; } public void setEndpoint(ImmutableEndpoint endpoint) { // empty } public void initialise() throws InitialisationException { // empty } public void setName(String name) { // empty } public String getName() { return null; } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/RejectOldConfigTestCase.java0000644000175000017500000000225610746114576032113 0ustar charlescharles/* * $Id: RejectOldConfigTestCase.java 10511 2008-01-24 13:58:22Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.tck.FunctionalTestCase; import org.mule.api.MuleContext; public class RejectOldConfigTestCase extends FunctionalTestCase { protected String getConfigResources() { return "old-config.xml"; } public void testParse() { // see overloaded methods } protected MuleContext createMuleContext() throws Exception { try { super.createMuleContext(); fail("Context created with no problems - expected failure"); } catch (Exception e) { String msg = e.getMessage(); assertTrue(msg, msg.indexOf("Unable to locate NamespaceHandler for namespace [null]") > -1); } return null; } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/DefaultModelNames.java0000644000175000017500000000230010767263074030776 0ustar charlescharles/* * $Id: DefaultModelNames.java 11378 2008-03-16 18:26:04Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.model.Model; import org.mule.tck.FunctionalTestCase; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.Set; public class DefaultModelNames extends FunctionalTestCase { protected String getConfigResources() { return "default-model-names.xml"; } public void testNames() { Collection models = muleContext.getRegistry().lookupObjects(Model.class); assertEquals(3, models.size()); // includes system model Set modelNames = new HashSet(); for (Iterator each = models.iterator(); each.hasNext();) { modelNames.add(((Model) each.next()).getName()); } assertEquals(3, modelNames.size()); } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/0000755000175000017500000000000011351411044026244 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/MapEntryCombinerTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/MapEntryCombinerTestCase.ja0000644000175000017500000000361110740737111033442 0ustar charlescharles/* * $Id: MapEntryCombinerTestCase.java 10258 2008-01-08 18:17:45Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.OrphanBean; /** * This constructs a temporary bean whose contents are injected into a parent map by * {@link org.mule.config.spring.parsers.assembly.DefaultBeanAssembler}. Since this occurs * before child elements are processed this will cannot handle nested elements. */ public class MapEntryCombinerTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/map-entry-combiner-test.xml"; } public void testProperties() { OrphanBean bean = (OrphanBean) assertBeanExists("checkProps", OrphanBean.class); logger.info("Map size: " + bean.getMap().size()); assertMapEntryExists(bean.getMap(), "0", 0); } public void testCombinedMap() { OrphanBean bean = (OrphanBean) assertBeanExists("orphan", OrphanBean.class); logger.info("Map size: " + bean.getMap().size()); for (int i = 0; i < 6; ++i) { assertMapEntryExists(bean.getMap(), Integer.toString(i+1), i+1); } } public void testReverersedOrder() { OrphanBean bean = (OrphanBean) assertBeanExists("orphan2", OrphanBean.class); logger.info("Map size: " + bean.getMap().size()); for (int i = 0; i < 2; ++i) { assertMapEntryExists(bean.getMap(), Integer.toString(i+1), i+1); } } }mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/NamedDynamicTestCase.java0000644000175000017500000000212710701267256033112 0ustar charlescharles/* * $Id: NamedDynamicTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; public class NamedDynamicTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/named-dynamic-test.xml"; } public void testDyanmicNamed1() { OrphanBean orphan1 = (OrphanBean) assertBeanExists("orphan1", OrphanBean.class); assertBeanPopulated(orphan1, "orphan1"); ChildBean child1 = (ChildBean) assertContentExists(orphan1.getChild(), ChildBean.class); assertBeanPopulated(child1, "child1"); } }mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/specific/0000755000175000017500000000000011351411043030030 5ustar charlescharles././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/specific/ServerNotificationManagerTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/specific/ServerNotification0000644000175000017500000001221510754365306033611 0ustar charlescharles/* * $Id: ServerNotificationManagerTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.DefaultMuleMessage; import org.mule.api.context.notification.SecurityNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.ServerNotificationListener; import org.mule.api.security.UnauthorisedException; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.SecurityNotification; import org.mule.context.notification.ServerNotificationManager; import org.mule.tck.FunctionalTestCase; import org.mule.transport.NullPayload; import java.util.Collection; public class ServerNotificationManagerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/specific/server-notification-manager-test.xml"; } public void testDynamicAttribute() { ServerNotificationManager manager = muleContext.getNotificationManager(); assertTrue(manager.isNotificationDynamic()); } public void testRoutingConfiguration() { ServerNotificationManager manager = muleContext.getNotificationManager(); assertTrue(manager.getInterfaceToTypes().size() > 2); Object ifaces = manager.getInterfaceToTypes().get(TestInterface.class); assertNotNull(ifaces); assertTrue(ifaces instanceof Collection); assertTrue(((Collection) ifaces).contains(TestEvent.class)); ifaces = manager.getInterfaceToTypes().get(TestInterface2.class); assertNotNull(ifaces); assertTrue(ifaces instanceof Collection); assertTrue(((Collection) ifaces).contains(SecurityNotification.class)); } public void testSimpleNotification() throws InterruptedException { ServerNotificationManager manager = muleContext.getNotificationManager(); Collection listeners = manager.getListeners(); assertEquals(3, listeners.size()); TestListener listener = (TestListener) muleContext.getRegistry().lookupObject("listener"); assertNotNull(listener); assertFalse(listener.isCalled()); manager.fireNotification(new TestEvent()); Thread.sleep(1000); // asynch events assertTrue(listener.isCalled()); } public void testDisabledNotification() throws InterruptedException { ServerNotificationManager manager = muleContext.getNotificationManager(); Collection listeners = manager.getListeners(); assertEquals(3, listeners.size()); TestListener2 listener2 = (TestListener2) muleContext.getRegistry().lookupObject("listener2"); assertNotNull(listener2); assertFalse(listener2.isCalled()); TestSecurityListener adminListener = (TestSecurityListener) muleContext.getRegistry().lookupObject("securityListener"); assertNotNull(adminListener); assertFalse(adminListener.isCalled()); manager.fireNotification(new TestSecurityEvent()); Thread.sleep(1000); // asynch events assertTrue(listener2.isCalled()); assertFalse(adminListener.isCalled()); } protected static interface TestInterface extends ServerNotificationListener { // empty } protected static interface TestInterface2 extends ServerNotificationListener { // empty } protected static class TestListener implements TestInterface { private boolean called = false; public boolean isCalled() { return called; } public void onNotification(ServerNotification notification) { called = true; } } protected static class TestListener2 implements TestInterface2 { private boolean called = false; public boolean isCalled() { return called; } public void onNotification(ServerNotification notification) { called = true; } } protected static class TestSecurityListener implements SecurityNotificationListener { private boolean called = false; public boolean isCalled() { return called; } public void onNotification(ServerNotification notification) { called = true; } } protected static class TestEvent extends ServerNotification { public TestEvent() { super(new Object(), 0); } } protected static class TestSecurityEvent extends SecurityNotification { public TestSecurityEvent() { super(new UnauthorisedException(CoreMessages.createStaticMessage("dummy"), new DefaultMuleMessage(NullPayload.getInstance())), 0); } } }././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/specific/ComponentDefinitionParserTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/specific/ComponentDefinitio0000644000175000017500000003554410767355640033607 0ustar charlescharles/* * $Id: ComponentDefinitionParserTestCase.java 11379 2008-03-17 02:46:56Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.component.JavaComponent; import org.mule.api.component.LifecycleAdapter; import org.mule.api.component.LifecycleAdapterFactory; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.config.ConfigurationException; import org.mule.api.context.MuleContextFactory; import org.mule.api.model.EntryPointResolverSet; import org.mule.api.service.Service; import org.mule.component.AbstractJavaComponent; import org.mule.component.DefaultJavaComponent; import org.mule.component.PooledJavaComponent; import org.mule.component.simple.PassThroughComponent; import org.mule.component.simple.StaticComponent; import org.mule.config.PoolingProfile; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.config.spring.parsers.specific.ComponentDelegatingDefinitionParser.CheckExclusiveClassAttributeObjectFactoryException; import org.mule.config.spring.util.SpringBeanLookup; import org.mule.context.DefaultMuleContextFactory; import org.mule.model.resolvers.ArrayEntryPointResolver; import org.mule.model.resolvers.CallableEntryPointResolver; import org.mule.model.resolvers.DefaultEntryPointResolverSet; import org.mule.model.resolvers.ExplicitMethodEntryPointResolver; import org.mule.model.resolvers.MethodHeaderPropertyEntryPointResolver; import org.mule.model.resolvers.NoArgumentsEntryPointResolver; import org.mule.model.resolvers.ReflectionEntryPointResolver; import org.mule.object.PrototypeObjectFactory; import org.mule.object.SingletonObjectFactory; import org.mule.routing.nested.DefaultNestedRouter; import org.mule.tck.AbstractMuleTestCase; import org.springframework.beans.factory.BeanDefinitionStoreException; public class ComponentDefinitionParserTestCase extends AbstractMuleTestCase { private MuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); public void testDefaultJavaComponentShortcut() throws Exception { ConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder( "org/mule/config/spring/parsers/specific/component-ok-test.xml"); muleContext = muleContextFactory.createMuleContext(configBuilder); Service service = muleContext.getRegistry().lookupService("service1"); validateCorrectServiceCreation(service); assertEquals(DefaultJavaComponent.class, service.getComponent().getClass()); assertEquals(PrototypeObjectFactory.class, ((AbstractJavaComponent) service.getComponent()).getObjectFactory() .getClass()); assertEquals(1, ((JavaComponent) service.getComponent()).getNestedRouter().getRouters().size()); assertNotNull(((JavaComponent) service.getComponent()).getEntryPointResolverSet()); assertEquals( 2, (((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers().size())); assertTrue((((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers() .toArray()[0] instanceof ArrayEntryPointResolver)); assertTrue((((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers() .toArray()[1] instanceof CallableEntryPointResolver)); } public void testDefaultJavaComponentPrototype() throws Exception { ConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder( "org/mule/config/spring/parsers/specific/component-ok-test.xml"); muleContext = muleContextFactory.createMuleContext(configBuilder); Service service = muleContext.getRegistry().lookupService("service2"); validateCorrectServiceCreation(service); assertEquals(DefaultJavaComponent.class, service.getComponent().getClass()); assertEquals(PrototypeObjectFactory.class, ((AbstractJavaComponent) service.getComponent()).getObjectFactory() .getClass()); assertEquals(1, ((JavaComponent) service.getComponent()).getNestedRouter().getRouters().size()); assertNotNull(((JavaComponent) service.getComponent()).getEntryPointResolverSet()); assertEquals( 1, (((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers().size())); assertTrue((((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers() .toArray()[0] instanceof CallableEntryPointResolver)); } public void testDefaultJavaComponentSingleton() throws Exception { ConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder( "org/mule/config/spring/parsers/specific/component-ok-test.xml"); muleContext = muleContextFactory.createMuleContext(configBuilder); Service service = muleContext.getRegistry().lookupService("service3"); validateCorrectServiceCreation(service); assertEquals(DefaultJavaComponent.class, service.getComponent().getClass()); assertEquals(SingletonObjectFactory.class, ((AbstractJavaComponent) service.getComponent()).getObjectFactory() .getClass()); assertEquals(1, ((JavaComponent) service.getComponent()).getNestedRouter().getRouters().size()); assertNotNull(((JavaComponent) service.getComponent()).getEntryPointResolverSet()); assertEquals( 1, (((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers().size())); assertTrue((((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers() .toArray()[0] instanceof ExplicitMethodEntryPointResolver)); } public void testDefaultJavaComponentSpringBean() throws Exception { ConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder( "org/mule/config/spring/parsers/specific/component-ok-test.xml"); muleContext = muleContextFactory.createMuleContext(configBuilder); Service service = muleContext.getRegistry().lookupService("service4"); validateCorrectServiceCreation(service); assertEquals(DefaultJavaComponent.class, service.getComponent().getClass()); assertEquals(SpringBeanLookup.class, ((AbstractJavaComponent) service.getComponent()).getObjectFactory() .getClass()); assertEquals(1, ((JavaComponent) service.getComponent()).getNestedRouter().getRouters().size()); assertNotNull(((JavaComponent) service.getComponent()).getEntryPointResolverSet()); assertEquals( 1, (((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers().size())); assertTrue((((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers() .toArray()[0] instanceof NoArgumentsEntryPointResolver)); } private void validatePoolingProfile(Service service) { assertNotNull(((PooledJavaComponent) service.getComponent()).getPoolingProfile()); assertNotNull(((PooledJavaComponent) service.getComponent()).getPoolingProfile()); PoolingProfile profile = ((PooledJavaComponent) service.getComponent()).getPoolingProfile(); assertNotNull(profile); assertEquals("exhausted:", PoolingProfile.WHEN_EXHAUSTED_FAIL, profile.getExhaustedAction()); assertEquals("initialisation:", PoolingProfile.INITIALISE_ALL, profile.getInitialisationPolicy()); assertEquals("active:", 1, profile.getMaxActive()); assertEquals("idle:", 2, profile.getMaxIdle()); assertEquals("wait:", 3, profile.getMaxWait()); } public void testPooledJavaComponentShortcut() throws Exception { ConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder( "org/mule/config/spring/parsers/specific/component-ok-test.xml"); muleContext = muleContextFactory.createMuleContext(configBuilder); Service service = muleContext.getRegistry().lookupService("service5"); validateCorrectServiceCreation(service); assertEquals(PooledJavaComponent.class, service.getComponent().getClass()); assertEquals(PrototypeObjectFactory.class, ((AbstractJavaComponent) service.getComponent()).getObjectFactory() .getClass()); assertEquals(1, ((JavaComponent) service.getComponent()).getNestedRouter().getRouters().size()); validatePoolingProfile(service); assertNotNull(((JavaComponent) service.getComponent()).getEntryPointResolverSet()); assertEquals( 1, (((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers().size())); assertTrue((((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers() .toArray()[0] instanceof MethodHeaderPropertyEntryPointResolver)); } public void testPooledJavaComponentPrototype() throws Exception { ConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder( "org/mule/config/spring/parsers/specific/component-ok-test.xml"); muleContext = muleContextFactory.createMuleContext(configBuilder); Service service = muleContext.getRegistry().lookupService("service6"); validateCorrectServiceCreation(service); assertEquals(PooledJavaComponent.class, service.getComponent().getClass()); assertEquals(PrototypeObjectFactory.class, ((AbstractJavaComponent) service.getComponent()).getObjectFactory() .getClass()); assertEquals(1, ((JavaComponent) service.getComponent()).getNestedRouter().getRouters().size()); validatePoolingProfile(service); assertNotNull(((JavaComponent) service.getComponent()).getEntryPointResolverSet()); assertEquals( 1, (((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers().size())); assertTrue((((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers() .toArray()[0] instanceof ReflectionEntryPointResolver)); } public void testPooledJavaComponentSingleton() throws Exception { ConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder( "org/mule/config/spring/parsers/specific/component-ok-test.xml"); muleContext = muleContextFactory.createMuleContext(configBuilder); Service service = muleContext.getRegistry().lookupService("service7"); validateCorrectServiceCreation(service); assertEquals(PooledJavaComponent.class, service.getComponent().getClass()); assertEquals(SingletonObjectFactory.class, ((AbstractJavaComponent) service.getComponent()).getObjectFactory() .getClass()); assertEquals(1, ((JavaComponent) service.getComponent()).getNestedRouter().getRouters().size()); validatePoolingProfile(service); assertNotNull(((JavaComponent) service.getComponent()).getEntryPointResolverSet()); assertEquals( 1, (((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers().size())); assertTrue((((DefaultEntryPointResolverSet) ((JavaComponent) service.getComponent()).getEntryPointResolverSet()).getEntryPointResolvers() .toArray()[0] instanceof ReflectionEntryPointResolver)); } public void testPooledJavaComponentSpringBean() throws Exception { ConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder( "org/mule/config/spring/parsers/specific/component-ok-test.xml"); muleContext = muleContextFactory.createMuleContext(configBuilder); Service service = muleContext.getRegistry().lookupService("service8"); validateCorrectServiceCreation(service); assertEquals(PooledJavaComponent.class, service.getComponent().getClass()); assertEquals(SpringBeanLookup.class, ((AbstractJavaComponent) service.getComponent()).getObjectFactory() .getClass()); assertEquals(1, ((JavaComponent) service.getComponent()).getNestedRouter().getRouters().size()); validatePoolingProfile(service); assertNull(((JavaComponent) service.getComponent()).getEntryPointResolverSet()); } public void testClassAttributeAndObjectFactory() throws Exception { try { ConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder( "org/mule/config/spring/parsers/specific/component-bad-test.xml"); muleContextFactory.createMuleContext(configBuilder); throw new IllegalStateException("Expected config to fail"); } catch (Exception e) { assertEquals(ConfigurationException.class, e.getClass()); assertEquals(BeanDefinitionStoreException.class, e.getCause().getClass()); assertEquals(CheckExclusiveClassAttributeObjectFactoryException.class, e.getCause().getCause().getClass()); } } protected void validateCorrectServiceCreation(Service service) throws Exception { assertNotNull(service); assertNotNull(service.getComponent()); assertFalse(service.getComponent() instanceof PassThroughComponent); assertTrue(service.getComponent() instanceof JavaComponent); assertEquals(StaticComponent.class, ((JavaComponent) service.getComponent()).getObjectType()); assertNotNull(((JavaComponent) service.getComponent()).getNestedRouter()); assertTrue(((JavaComponent) service.getComponent()).getNestedRouter().getRouters().get(0) instanceof DefaultNestedRouter); assertTrue(((JavaComponent) service.getComponent()).getLifecycleAdapterFactory() instanceof TestLifecycleAdapterFactory); } protected MuleContext createMuleContext() throws Exception { return null; } } class TestLifecycleAdapterFactory implements LifecycleAdapterFactory { public LifecycleAdapter create(Object pojoService, JavaComponent component, EntryPointResolverSet resolver) throws MuleException { // TODO Auto-generated method stub return null; } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ListElementTestCase.java0000644000175000017500000000352510725254051033004 0ustar charlescharles/* * $Id: ListElementTestCase.java 9972 2007-12-04 13:37:45Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.OrphanBean; public class ListElementTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/list-element-test.xml"; } public void testListElement1() { OrphanBean orphan = (OrphanBean) assertBeanExists("orphan1", OrphanBean.class); assertNotNull(orphan.getKids()); assertTrue(orphan.getKids().size() == 2); assertTrue(orphan.getKids().contains("kid1")); assertTrue(orphan.getKids().contains("kid2")); } public void testListElement2() { OrphanBean orphan = (OrphanBean) assertBeanExists("orphan2", OrphanBean.class); assertNotNull(orphan.getKids()); assertTrue(orphan.getKids().size() == 2); assertTrue(orphan.getKids().contains("kid1")); assertTrue(orphan.getKids().contains("kid2")); } // simpler list element parser doesn't support dynamic attribute // public void testListElement3() // { // OrphanBean orphan = (OrphanBean) assertBeanExists("orphan3", OrphanBean.class); // assertNotNull(orphan.getKids()); // assertTrue(orphan.getKids().size() == 3); // assertTrue(orphan.getKids().contains("kid1")); // assertTrue(orphan.getKids().contains("kid2")); // assertTrue(orphan.getKids().contains("kid3")); // } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ThirdPartyContainerDefinitionParser.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ThirdPartyContainerDefiniti0000644000175000017500000000313210762051625033611 0ustar charlescharles/* * $Id: ThirdPartyContainerDefinitionParser.java 11135 2008-02-29 18:48:53Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; import org.mule.config.spring.parsers.beans.ThirdPartyContainer; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.SimplePropertyConfiguration; import org.mule.config.spring.parsers.assembly.DefaultBeanAssemblerFactory; import org.mule.config.spring.parsers.processors.NamedSetterChildElementIterator; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; public class ThirdPartyContainerDefinitionParser extends OrphanDefinitionParser { public ThirdPartyContainerDefinitionParser() { super(ThirdPartyContainer.class, true); addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE); PropertyConfiguration configuration = new SimplePropertyConfiguration(); registerPostProcessor( new NamedSetterChildElementIterator( "thing", new DefaultBeanAssemblerFactory(), configuration)); } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/endpoint/0000755000175000017500000000000011351411043030063 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/endpoint/AttributeErrorTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/endpoint/AttributeErrorTest0000644000175000017500000000162010671314614033634 0ustar charlescharles/* * $Id: AttributeErrorTestCase.java 8321 2007-09-10 19:22:52Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.endpoint; import org.mule.config.spring.parsers.AbstractBadConfigTestCase; public class AttributeErrorTestCase extends AbstractBadConfigTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/endpoint/attribute-error-test.xml"; } public void testError() throws Exception { assertErrorContains("The attribute 'ref' cannot appear with the attribute 'address'"); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/endpoint/MultipleTransformerRefsTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/endpoint/MultipleTransforme0000644000175000017500000000373110745677442033675 0ustar charlescharles/* * $Id: MultipleTransformerRefsTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.endpoint; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.transformer.Transformer; import java.util.List; /** * This really tests the handling of multiple references in * {@link org.mule.config.spring.parsers.assembly.DefaultBeanAssembler} */ public class MultipleTransformerRefsTestCase extends AbstractEndpointTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/endpoint/multiple-transformer-refs-test.xml"; } public void testMultipleRefs() throws MuleException { ImmutableEndpoint endpoint = doTest("many"); List transformers = endpoint.getTransformers(); assertNotNull(transformers); // this lets us check ordering before size, safely, which is useful on failure assertTrue(transformers.size() > 0); assertEquals("a", ((Transformer) transformers.get(0)).getName()); assertTrue(transformers.size() > 1); assertEquals("b", ((Transformer) transformers.get(1)).getName()); assertEquals(3, transformers.size()); assertEquals("c", ((Transformer) transformers.get(2)).getName()); } public void testSingleRef() throws MuleException { ImmutableEndpoint endpoint = doTest("single"); List transformers = endpoint.getTransformers(); assertNotNull(transformers); assertEquals(1, transformers.size()); assertEquals("a", ((Transformer) transformers.get(0)).getName()); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/endpoint/AbstractEndpointTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/endpoint/AbstractEndpointTe0000644000175000017500000000225210745677442033573 0ustar charlescharles/* * $Id: AbstractEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.endpoint; import org.mule.RegistryContext; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.FunctionalTestCase; public abstract class AbstractEndpointTestCase extends FunctionalTestCase { public ImmutableEndpoint doTest(String name) throws MuleException { ImmutableEndpoint endpoint = RegistryContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(name); assertNotNull(endpoint); EndpointURI uri = endpoint.getEndpointURI(); assertNotNull(uri); assertEquals("foo", uri.getAddress()); assertEquals("test", uri.getScheme()); return endpoint; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/endpoint/ComplexEndpointTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/endpoint/ComplexEndpointTes0000644000175000017500000000215610745677442033625 0ustar charlescharles/* * $Id: ComplexEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.endpoint; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; public class ComplexEndpointTestCase extends AbstractEndpointTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/endpoint/complex-endpoint-test.xml"; } public void testComplex() throws MuleException { ImmutableEndpoint endpoint = doTest("complex"); assertNotNull(endpoint.getProperty("foo")); assertEquals(endpoint.getProperty("foo"), "123"); assertNotNull(endpoint.getProperty("string")); assertEquals(endpoint.getProperty("string"), "hello world"); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/AbstractBadConfigTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/AbstractBadConfigTestCase.j0000644000175000017500000000331210745677442033400 0ustar charlescharles/* * $Id: AbstractBadConfigTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.api.config.ConfigurationBuilder; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.context.DefaultMuleContextFactory; import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A stripped-down version of FunctionalTestCase that allows us to test the parsing of a bad configuration. */ public abstract class AbstractBadConfigTestCase extends TestCase { protected final transient Log logger = LogFactory.getLog(getClass()); public void assertErrorContains(String phrase) throws Exception { try { parseConfig(); fail("expected error"); } catch (Exception e) { logger.debug("Caught " + e); assertTrue("Missing phrase '" + phrase + "' in '" + e.toString() + "'", e.toString().indexOf(phrase) > -1); } } protected void parseConfig() throws Exception { new DefaultMuleContextFactory().createMuleContext(getBuilder()); } protected ConfigurationBuilder getBuilder() throws Exception { return new SpringXmlConfigurationBuilder(getConfigResources()); } protected abstract String getConfigResources(); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/NamedNamespaceTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/NamedNamespaceTestCase.java0000644000175000017500000000174010701267256033422 0ustar charlescharles/* * $Id: NamedNamespaceTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; public class NamedNamespaceTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/parsers-test-namespace-config.xml"; } public void testNamed() { OrphanBean orphan1 = (OrphanBean) assertBeanExists("orphan1", OrphanBean.class); assertContentExists(orphan1.getChild(), ChildBean.class); } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/InheritSimpleTestCase.java0000644000175000017500000000212410701267256033332 0ustar charlescharles/* * $Id: InheritSimpleTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; public class InheritSimpleTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/inherit-simple-test.xml"; } public void testInherit() { OrphanBean orphan1 = (OrphanBean) assertBeanExists("orphan1", OrphanBean.class); assertBeanPopulated(orphan1, "orphan1"); ChildBean child1 = (ChildBean) assertContentExists(orphan1.getChild(), ChildBean.class); assertBeanPopulated(child1, "child1"); } }././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/NestedCollectionTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/NestedCollectionTestCase.ja0000644000175000017500000000200410701267256033462 0ustar charlescharles/* * $Id: NestedCollectionTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.OrphanBean; import java.util.Collection; public class NestedCollectionTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/nested-collection-test.xml"; } public void testAll() { OrphanBean orphan = (OrphanBean) assertBeanExists("orphan1", OrphanBean.class); Collection kids = (Collection) assertContentExists(orphan.getKids(), Collection.class); assertEquals(5, kids.size()); } }mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/MapMule2478TestCase.java0000644000175000017500000000460410767356631032460 0ustar charlescharles/* * $Id: MapMule2478TestCase.java 11380 2008-03-17 02:55:21Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; import java.util.List; import java.util.Map; public class MapMule2478TestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/map-mule-2478-test.xml"; } public void testDirectChild() { OrphanBean orphan = (OrphanBean) assertBeanExists("orphan", OrphanBean.class); ChildBean child1 = (ChildBean) assertContentExists(orphan.getChild(), ChildBean.class); assertEquals("string1", child1.getString()); assertNotNull(child1.getList()); assertEquals("list1", child1.getList().get(0)); } public void testMappedChild() { OrphanBean orphan = (OrphanBean) assertBeanExists("orphan", OrphanBean.class); Map map = orphan.getMap(); assertNotNull(map); assertTrue(map.containsKey("string")); assertEquals("string2", map.get("string")); assertTrue(map.containsKey("name")); assertEquals("child2", map.get("name")); assertTrue(map.containsKey("list")); assertEquals("list2", ((List) map.get("list")).get(0)); } // TODO ComplexComponentDefinitionParser is not longer used, is there any way to rewrite/reuse the "factory" element for testing? // public void testFactory() throws Exception // { // OrphanBean orphan = (OrphanBean) assertBeanExists("orphan", OrphanBean.class); // ObjectFactory factory = (ObjectFactory) orphan.getObject(); // assertNotNull(factory); // Object product = factory.getInstance(); // assertNotNull(product); // assertTrue(product instanceof ChildBean); // ChildBean child3 = (ChildBean) product; // assertEquals("string3", child3.getString()); // assertNotNull(child3.getList()); // assertEquals("list3", child3.getList().get(0)); // } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/NamedSimpleTestCase.java0000644000175000017500000000262110701267256032756 0ustar charlescharles/* * $Id: NamedSimpleTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; public class NamedSimpleTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/named-simple-test.xml"; } public void testNamed1() { OrphanBean orphan1 = (OrphanBean) assertBeanExists("orphan1", OrphanBean.class); assertBeanPopulated(orphan1, "orphan1"); ChildBean child1 = (ChildBean) assertContentExists(orphan1.getChild(), ChildBean.class); assertBeanPopulated(child1, "child1"); } public void testNamed2() { OrphanBean orphan2 = (OrphanBean) assertBeanExists("orphan2", OrphanBean.class); assertBeanPopulated(orphan2, "orphan2"); ChildBean child2 = (ChildBean) assertContentExists(orphan2.getChild(), ChildBean.class); assertBeanPopulated(child2, "child2"); } }mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ParentSimpleTestCase.java0000644000175000017500000000212110701267256033156 0ustar charlescharles/* * $Id: ParentSimpleTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; public class ParentSimpleTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/parent-simple-test.xml"; } public void testParent3() { OrphanBean orphan3 = (OrphanBean) assertBeanExists("orphan3", OrphanBean.class); assertBeanPopulated(orphan3, "orphan3"); ChildBean child3 = (ChildBean) assertContentExists(orphan3.getChild(), ChildBean.class); assertBeanPopulated(child3, "child3"); } }mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ThirdPartyTestCase.java0000644000175000017500000000175210762051625032654 0ustar charlescharles/* * $Id: ThirdPartyTestCase.java 11135 2008-02-29 18:48:53Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.tck.FunctionalTestCase; import org.mule.config.spring.parsers.beans.ThirdPartyContainer; public class ThirdPartyTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/third-party-test.xml"; } public void testContainer() { ThirdPartyContainer container = (ThirdPartyContainer) muleContext.getRegistry().lookupObject("container"); assertNotNull(container); assertNotNull(container.getThing()); } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/IgnoredTestCase.java0000644000175000017500000000252410701267256032151 0ustar charlescharles/* * $Id: IgnoredTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; public class IgnoredTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/ignored-test.xml"; } protected void assertIgnoredFlagUnset(int index) { OrphanBean orphan = (OrphanBean) assertBeanExists("orphan" + index, OrphanBean.class); assertTrue("orphan" + index, orphan.isIgnored()); ChildBean child = (ChildBean) assertContentExists(orphan.getChild(), ChildBean.class); assertTrue("child" + index, child.isIgnored()); } public void testNamed() { assertIgnoredFlagUnset(1); } public void testOrphan() { assertIgnoredFlagUnset(2); } public void testParent() { assertIgnoredFlagUnset(3); } }././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/MuleElementRequiredTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/MuleElementRequiredTestCase0000644000175000017500000000143410665325667033570 0ustar charlescharles/* * $Id: MuleElementRequiredTestCase.java 8106 2007-08-29 17:24:07Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; public class MuleElementRequiredTestCase extends AbstractBadConfigTestCase { protected String getConfigResources() { return "mule-element-required-test.xml"; } public void testHelpfulErrorMessage() throws Exception { assertErrorContains("This element should be embedded"); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/OrphanNamespaceTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/OrphanNamespaceTestCase.jav0000644000175000017500000000174410701267256033470 0ustar charlescharles/* * $Id: OrphanNamespaceTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; public class OrphanNamespaceTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/parsers-test-namespace-config.xml"; } public void testOrphan1() { OrphanBean orphan2 = (OrphanBean) assertBeanExists("orphan2", OrphanBean.class); assertContentExists(orphan2.getChild(), ChildBean.class); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ReferenceCollectionTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ReferenceCollectionTestCase0000644000175000017500000000257110701267256033556 0ustar charlescharles/* * $Id: ReferenceCollectionTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.OrphanBean; import java.util.Collection; /** * References to collections in attributes are currently not handled correctly */ public class ReferenceCollectionTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/reference-collection-test.xml"; } protected void testOffspringRef(int index, int size) { OrphanBean orphan = (OrphanBean) assertBeanExists("orphan" + index, OrphanBean.class); Collection offspring = (Collection) assertContentExists(orphan.getOffspring(), Collection.class); assertEquals(size, offspring.size()); } public void testNamed() { testOffspringRef(1, 2); } public void testOrphan() { testOffspringRef(2, 1); } public void testParent() { testOffspringRef(3, 3); } }mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/MapCombinerTestCase.java0000644000175000017500000000312510742750763032761 0ustar charlescharles/* * $Id: MapCombinerTestCase.java 10319 2008-01-14 21:19:47Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.OrphanBean; public class MapCombinerTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/map-combiner-test.xml"; } public void testProperties() { OrphanBean bean = (OrphanBean) assertBeanExists("checkProps", OrphanBean.class); logger.info("Map size: " + bean.getMap().size()); assertMapEntryExists(bean.getMap(), "0", 0); } public void testCombinedMap() { OrphanBean bean = (OrphanBean) assertBeanExists("orphan", OrphanBean.class); logger.info("Map size: " + bean.getMap().size()); for (int i = 0; i < 6; ++i) { assertMapEntryExists(bean.getMap(), Integer.toString(i+1), i+1); } } public void testReverersedOrder() { OrphanBean bean = (OrphanBean) assertBeanExists("orphan2", OrphanBean.class); logger.info("Map size: " + bean.getMap().size()); for (int i = 0; i < 2; ++i) { assertMapEntryExists(bean.getMap(), Integer.toString(i+1), i+1); } } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ReferenceTestCase.java0000644000175000017500000000237010701267256032457 0ustar charlescharles/* * $Id: ReferenceTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; public class ReferenceTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/reference-test.xml"; } protected void testChildRef(int index) { OrphanBean orphan = (OrphanBean) assertBeanExists("orphan" + index, OrphanBean.class); ChildBean child = (ChildBean) assertContentExists(orphan.getChild(), ChildBean.class); assertEquals("child" + index, child.getName()); } public void testNamed() { testChildRef(1); } public void testOrphan() { testChildRef(2); } public void testParent() { testChildRef(3); } }mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/beans/0000755000175000017500000000000011351411043027333 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/beans/ThirdPartyContainer.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/beans/ThirdPartyContainer.j0000644000175000017500000000125410762051625033460 0ustar charlescharles/* * $Id: ThirdPartyContainer.java 11135 2008-02-29 18:48:53Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.beans; public class ThirdPartyContainer { private Object thing; public Object getThing() { return thing; } public void setThing(Object thing) { this.thing = thing; } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/beans/ChildBean.java0000644000175000017500000000100010701267256032013 0ustar charlescharles/* * $Id: ChildBean.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.beans; public class ChildBean extends AbstractBean { } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/beans/OrphanBean.java0000644000175000017500000000266010745677442032246 0ustar charlescharles/* * $Id: OrphanBean.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.beans; import java.util.Collection; /** * A standalone bean used in testing */ public class OrphanBean extends AbstractBean { // test implicit naming of collection private Collection kids; // test explicit naming of collection private Collection offspring; // test simple setter/getter private ChildBean child; private Object object; public ChildBean getChild() { return child; } public void setChild(ChildBean child) { this.child = child; } public Collection getKids() { return kids; } public void setKids(Collection kids) { this.kids = kids; } public Collection getOffspring() { return offspring; } public void setOffspring(Collection offspring) { this.offspring = offspring; } public Object getObject() { return object; } public void setObject(Object object) { this.object = object; } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/beans/AbstractBean.java0000644000175000017500000000324610701267256032551 0ustar charlescharles/* * $Id: AbstractBean.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.beans; import java.util.List; import java.util.Map; public class AbstractBean { // test explicit list private List list; // test explicit map private Map map; // needed for spring private String name; // test direct attribute private String string; // test aliased attribute (alias as bar) private int foo; // test ignore private boolean ignored = true; public List getList() { return list; } public void setList(List list) { this.list = list; } public Map getMap() { return map; } public void setMap(Map map) { this.map = map; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getString() { return string; } public void setString(String string) { this.string = string; } public int getFoo() { return foo; } public void setFoo(int foo) { this.foo = foo; } public boolean isIgnored() { return ignored; } public void setIgnored(boolean ignored) { this.ignored = ignored; } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/OrphanSimpleTestCase.java0000644000175000017500000000212110701267256033154 0ustar charlescharles/* * $Id: OrphanSimpleTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; public class OrphanSimpleTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/orphan-simple-test.xml"; } public void testOrphan2() { OrphanBean orphan2 = (OrphanBean) assertBeanExists("orphan2", OrphanBean.class); assertBeanPopulated(orphan2, "orphan2"); ChildBean child2 = (ChildBean) assertContentExists(orphan2.getChild(), ChildBean.class); assertBeanPopulated(child2, "child2"); } }././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/CustomTransactionManagerTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/CustomTransactionManagerTes0000644000175000017500000000413710745205313033631 0ustar charlescharles/* * $Id: CustomTransactionManagerTestCase.java 10442 2008-01-21 21:12:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.mule.TestTransactionManagerFactory; import java.lang.reflect.Proxy; import java.util.Map; import javax.transaction.TransactionManager; public class CustomTransactionManagerTestCase extends FunctionalTestCase { public String getConfigResources() { return "test-custom-transaction-manager.xml"; } public void testCustomTransactionManager() throws Exception { TransactionManager transactionManager = muleContext.getTransactionManager(); assertTrue(transactionManager instanceof Proxy); Proxy proxy = (Proxy) transactionManager; TestTransactionManagerFactory.InternalInvocationHandler ihandler = (TestTransactionManagerFactory.InternalInvocationHandler) Proxy.getInvocationHandler(proxy); assertTrue(ihandler.getParent() instanceof TestTransactionManagerFactory); TestTransactionManagerFactory factory = ihandler.getParent(); Map properties = factory.getEnvironment(); assertEquals(properties.size(), 2); assertEquals(properties.get("property1"), "true"); assertEquals(properties.get("property2"), "Test"); } /* public void testWeblogicTransactionManager() throws Exception { TransactionManager transactionManager = muleContext.getTransactionManager(); assertNotNull(transactionManager); transactionManager.begin(); Transaction transaction = transactionManager.getTransaction(); assertNotNull(transaction); transactionManager.rollback(); assertNull(transactionManager.getTransaction()); } */ } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ParsersTestNamespaceHandler.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ParsersTestNamespaceHandler0000644000175000017500000001612210767356631033607 0ustar charlescharles/* * $Id: ParsersTestNamespaceHandler.java 11380 2008-03-17 02:55:21Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.factories.InboundEndpointFactoryBean; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; import org.mule.config.spring.parsers.collection.ChildListEntryDefinitionParser; import org.mule.config.spring.parsers.collection.ChildMapDefinitionParser; import org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser; import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser; import org.mule.config.spring.parsers.delegate.InheritDefinitionParser; import org.mule.config.spring.parsers.delegate.MapDefinitionParserMutator; import org.mule.config.spring.parsers.delegate.SingleParentFamilyDefinitionParser; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.generic.NamedDefinitionParser; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.TransportEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.TransportGlobalEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.support.AddressedEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.support.ChildAddressDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.support.ChildEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.support.OrphanEndpointDefinitionParser; import org.mule.endpoint.EndpointURIEndpointBuilder; /** * Registers a Bean Definition Parser for handling elements. * */ public class ParsersTestNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerMuleBeanDefinitionParser("orphan", new OrphanDefinitionParser(OrphanBean.class, true)).addAlias("bar", "foo").addIgnored("ignored").addCollection("offspring"); registerMuleBeanDefinitionParser("child", new ChildDefinitionParser("child", ChildBean.class)).addAlias("bar", "foo").addIgnored("ignored").addCollection("offspring"); registerMuleBeanDefinitionParser("mapped-child", new MapDefinitionParserMutator("map", new ChildDefinitionParser("child", ChildBean.class))).addAlias("bar", "foo").addIgnored("ignored").addCollection("offspring"); registerMuleBeanDefinitionParser("kid", new ChildDefinitionParser("kid", ChildBean.class)).addAlias("bar", "foo").addIgnored("ignored"); registerMuleBeanDefinitionParser("parent", new ParentDefinitionParser()).addAlias("bar", "foo").addIgnored("ignored").addCollection("offspring"); registerMuleBeanDefinitionParser("orphan1", new NamedDefinitionParser("orphan1")).addAlias("bar", "foo").addIgnored("ignored").addCollection("offspring"); registerMuleBeanDefinitionParser("orphan2", new NamedDefinitionParser("orphan2")).addAlias("bar", "foo").addIgnored("ignored"); registerMuleBeanDefinitionParser("map-entry", new ChildMapEntryDefinitionParser("map", "key", "value")).addCollection("map"); registerMuleBeanDefinitionParser("map-entry-combiner", new ChildSingletonMapDefinitionParser("map")).addCollection("map"); registerMuleBeanDefinitionParser("properties", new ChildMapDefinitionParser("map")).addCollection("map"); registerBeanDefinitionParser("list-entry", new ChildListEntryDefinitionParser("list")); registerMuleBeanDefinitionParser("named", new NamedDefinitionParser()).addAlias("bar", "foo").addIgnored("ignored"); registerMuleBeanDefinitionParser("inherit", new InheritDefinitionParser( new OrphanDefinitionParser(OrphanBean.class, true), new NamedDefinitionParser())).addAlias("bar", "foo").addIgnored("ignored").addCollection("offspring"); registerMuleBeanDefinitionParser("address", new ChildAddressDefinitionParser("test")).addAlias("address", "host"); registerBeanDefinitionParser("orphan-endpoint", new OrphanEndpointDefinitionParser(EndpointURIEndpointBuilder.class)); registerBeanDefinitionParser("child-endpoint", new ChildEndpointDefinitionParser(InboundEndpointFactoryBean.class)); registerBeanDefinitionParser("unaddressed-orphan-endpoint", new OrphanEndpointDefinitionParser(EndpointURIEndpointBuilder.class)); registerBeanDefinitionParser("addressed-orphan-endpoint", new AddressedEndpointDefinitionParser("test", AddressedEndpointDefinitionParser.PROTOCOL, new OrphanEndpointDefinitionParser(EndpointURIEndpointBuilder.class), new String[]{"path"}, new String[]{})); registerBeanDefinitionParser("addressed-child-endpoint", new TransportEndpointDefinitionParser("test", InboundEndpointFactoryBean.class, new String[]{})); registerBeanDefinitionParser("list-element-test-1", new ChildListEntryDefinitionParser("kids", "listAttribute")); registerBeanDefinitionParser("list-element-test-2", new SingleParentFamilyDefinitionParser( new OrphanDefinitionParser(OrphanBean.class, true)) .addChildDelegate("kid1", new ChildListEntryDefinitionParser("kids", "kid1")) .addChildDelegate("kid2", new ChildListEntryDefinitionParser("kids", "kid2"))); // simpler list element parser doesn't support dynamic attribute // registerBeanDefinitionParser("list-element-test-3", new AllAttributeChildDefinitionParser(new ChildListEntryDefinitionParser("kids"))); // TODO ComplexComponentDefinitionParser is not longer used, is there any way to rewrite/reuse the "factory" element for testing? // registerBeanDefinitionParser("factory", // new ComplexComponentDefinitionParser( // new SimpleComponentDefinitionParser(ChildBean.class), // (ChildDefinitionParser) new ChildDefinitionParser("child", ChildBean.class).addAlias("bar", "foo").addIgnored("ignored").addCollection("offspring"))); registerMuleBeanDefinitionParser("complex-endpoint", new TransportGlobalEndpointDefinitionParser( "test", TransportGlobalEndpointDefinitionParser.PROTOCOL, new String[]{"path"}, new String[]{"string", "bar"})).addAlias("bar", "foo"); registerBeanDefinitionParser("no-name", new OrphanDefinitionParser(OrphanBean.class, true)); registerBeanDefinitionParser("no-name-2", new IndependentDefinitionParser()); registerBeanDefinitionParser("container", new ThirdPartyContainerDefinitionParser()); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ReferenceCollectionAutoTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ReferenceCollectionAutoTest0000644000175000017500000000252210701267256033607 0ustar charlescharles/* * $Id: ReferenceCollectionAutoTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.OrphanBean; import java.util.Collection; /** * Automatic plurals currently do not work for attributes */ public class ReferenceCollectionAutoTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/reference-collection-auto-test.xml"; } protected void testChildRef(int index, int size) { OrphanBean orphan = (OrphanBean) assertBeanExists("orphan" + index, OrphanBean.class); Collection kids = (Collection) assertContentExists(orphan.getKids(), Collection.class); assertEquals(size, kids.size()); } public void testNamed() { testChildRef(1, 2); } public void testOrphan() { testChildRef(2, 1); } public void testParent() { testChildRef(3, 3); } }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/AbstractNamespaceTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/AbstractNamespaceTestCase.j0000644000175000017500000000526510745677442033471 0ustar charlescharles/* * $Id: AbstractNamespaceTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.AbstractBean; import org.mule.tck.FunctionalTestCase; import org.mule.util.ClassUtils; import java.util.List; import java.util.Map; public abstract class AbstractNamespaceTestCase extends FunctionalTestCase { public void testParse() { // just parse the config } protected Object assertBeanExists(String name, Class clazz) { Object bean = muleContext.getRegistry().lookupObject(name); assertNotNull(name + " bean missing", bean); assertTrue(bean.getClass().equals(clazz)); logger.debug("found bean " + name + "/" + ClassUtils.getSimpleName(bean.getClass())); return bean; } protected Object assertContentExists(Object object, Class clazz) { assertNotNull(ClassUtils.getSimpleName(clazz) + " content missing", object); assertTrue(clazz.isAssignableFrom(object.getClass())); logger.debug("found content " + ClassUtils.getSimpleName(object.getClass())); return object; } protected void assertBeanPopulated(AbstractBean bean, String name) { assertMapExists(bean.getMap(), name); assertListExists(bean.getList(), name); String string = bean.getString(); assertNotNull("string for " + name, string); assertEquals(name + "String", string); } protected void assertMapExists(Map map, String name) { assertNotNull("map for " + name, map); assertMapEntryExists(map, name, 1); assertMapEntryExists(map, name, 2); } protected void assertMapEntryExists(Map map, String name, int index) { String key = "key" + index; Object value = map.get(key); assertNotNull(key + " returns null", value); assertTrue(value instanceof String); assertEquals(name + "Map" + index, value); } protected void assertListExists(List list, String name) { assertNotNull("list for " + name, list); assertListEntryExists(list, name, 1); assertListEntryExists(list, name, 2); } protected void assertListEntryExists(List list, String name, int index) { String value = name + "List" + index; assertTrue(value, list.contains(value)); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ParentNamespaceTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ParentNamespaceTestCase.jav0000644000175000017500000000174310701267256033471 0ustar charlescharles/* * $Id: ParentNamespaceTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; public class ParentNamespaceTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/parsers-test-namespace-config.xml"; } public void testParent() { OrphanBean orphan3 = (OrphanBean) assertBeanExists("orphan3", OrphanBean.class); assertContentExists(orphan3.getChild(), ChildBean.class); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/NameAndIdEqualMule2795TestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/NameAndIdEqualMule2795TestC0000644000175000017500000000217510745205313033067 0ustar charlescharles/* * $Id: NameAndIdEqualMule2795TestCase.java 10442 2008-01-21 21:12:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.tck.FunctionalTestCase; public class NameAndIdEqualMule2795TestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/name-id-equal-mule-2795-test.xml"; } public void testNames() { assertNotNull(muleContext.getRegistry().lookupObject("id")); assertNull(muleContext.getRegistry().lookupObject(".:no-name")); assertNull(muleContext.getRegistry().lookupObject("org.mule.autogen.bean.1")); assertNotNull(muleContext.getRegistry().lookupObject("id2")); assertNull(muleContext.getRegistry().lookupObject(".:no-name-2")); } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/AliasTestCase.java0000644000175000017500000000276310701267256031620 0ustar charlescharles/* * $Id: AliasTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.AbstractBean; import org.mule.config.spring.parsers.beans.ChildBean; import org.mule.config.spring.parsers.beans.OrphanBean; public class AliasTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/alias-test.xml"; } protected void assertFooExists(int index) { OrphanBean orphan = (OrphanBean) assertBeanExists("orphan" + index, OrphanBean.class); assertFooExists(orphan, 10 * index + 1); ChildBean child = (ChildBean) assertContentExists(orphan.getChild(), ChildBean.class); assertFooExists(child, 10 * index + 2); } protected void assertFooExists(AbstractBean bean, int value) { assertNotNull(bean); assertEquals(value, bean.getFoo()); } public void testNamed() { assertFooExists(1); } public void testOrphan() { assertFooExists(2); } public void testParent() { assertFooExists(3); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/DuplicateBeanNameTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/DuplicateBeanNameTestCase.j0000644000175000017500000000147510664703640033377 0ustar charlescharles/* * $Id: DuplicateBeanNameTestCase.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; public class DuplicateBeanNameTestCase extends AbstractBadConfigTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/duplicate-bean-name-test.xml"; } public void testBeanError() throws Exception { assertErrorContains("Bean name 'child1' is already used in this file"); } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/MissingParserTestCase.java0000644000175000017500000000144410664703640033350 0ustar charlescharles/* * $Id: MissingParserTestCase.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; public class MissingParserTestCase extends AbstractBadConfigTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/missing-parser-test.xml"; } public void testHelpfulErrorMessage() throws Exception { assertErrorContains("Is the module or transport"); } }././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ConstrainedConnectorExceptionStrategyMule2126TestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/ConstrainedConnectorExcepti0000644000175000017500000000166510671756770033673 0ustar charlescharles/* * $Id: ConstrainedConnectorExceptionStrategyMule2126TestCase.java 8346 2007-09-12 12:39:20Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; public class ConstrainedConnectorExceptionStrategyMule2126TestCase extends AbstractBadConfigTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/constrained-connector-exception-strategy-mule-2126-test.xml"; } public void testError() throws Exception { assertErrorContains("Invalid content was found starting with element 'default-connector-exception-strategy'"); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/EndpointServiceConflictTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/EndpointServiceConflictTest0000644000175000017500000000151310746275214033630 0ustar charlescharles/* * $Id: EndpointServiceConflictTestCase.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; public class EndpointServiceConflictTestCase extends AbstractBadConfigTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/endpoint-service-conflict-test.xml"; } public void testBeanError() throws Exception { assertErrorContains("A service named LenderService already exists"); } } mule-2.0.1/tests/functional/src/test/java/org/mule/config/spring/parsers/CollectionTestCase.java0000644000175000017500000000234510701267256032656 0ustar charlescharles/* * $Id: CollectionTestCase.java 8848 2007-10-04 22:52:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.beans.OrphanBean; import java.util.Collection; public class CollectionTestCase extends AbstractNamespaceTestCase { protected String getConfigResources() { return "org/mule/config/spring/parsers/collection-test.xml"; } protected void assertKidsExist(int index) { OrphanBean orphan = (OrphanBean) assertBeanExists("orphan" + index, OrphanBean.class); Collection kids = (Collection) assertContentExists(orphan.getKids(), Collection.class); assertEquals(index + 1, kids.size()); } public void testNamed() { assertKidsExist(1); } public void testOrphan() { assertKidsExist(2); } public void testParent() { assertKidsExist(3); } }mule-2.0.1/tests/functional/src/test/java/org/mule/MuleServerTestCase.java0000644000175000017500000000700010747501743026421 0ustar charlescharles/* * $Id: MuleServerTestCase.java 10590 2008-01-29 01:39:47Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleContext; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.ClassUtils; public class MuleServerTestCase extends AbstractMuleTestCase { // @Override protected MuleContext createMuleContext() throws Exception { return null; } public void testMuleServer() throws Exception { MuleServer muleServer = new MuleServer(); assertEquals(ClassUtils.getResource("mule-config.xml", MuleServer.class).toString(), muleServer.getConfigurationResources()); assertEquals("org.mule.config.builders.AutoConfigurationBuilder", muleServer.getConfigBuilderClassName()); muleServer.initialize(); } public void testMuleServerResource() throws Exception { MuleServer muleServer = new MuleServer("org/mule/test/spring/config1/test-xml-mule2-config.xml"); assertEquals("org/mule/test/spring/config1/test-xml-mule2-config.xml", muleServer.getConfigurationResources()); assertEquals("org.mule.config.builders.AutoConfigurationBuilder", muleServer.getConfigBuilderClassName()); muleServer.initialize(); } public void testMuleServerConfigArg() throws Exception { MuleServer muleServer = new MuleServer(new String[]{"-config", "org/mule/test/spring/config1/test-xml-mule2-config.xml"}); assertEquals("org/mule/test/spring/config1/test-xml-mule2-config.xml", muleServer.getConfigurationResources()); assertEquals("org.mule.config.builders.AutoConfigurationBuilder", muleServer.getConfigBuilderClassName()); muleServer.initialize(); } public void testMuleServerMultipleSpringConfigArgs() throws Exception { MuleServer muleServer = new MuleServer(new String[]{"-config", "mule-config.xml,org/mule/test/spring/config1/test-xml-mule2-config.xml"}); assertEquals("mule-config.xml,org/mule/test/spring/config1/test-xml-mule2-config.xml", muleServer.getConfigurationResources()); assertEquals("org.mule.config.builders.AutoConfigurationBuilder", muleServer.getConfigBuilderClassName()); muleServer.initialize(); } public void testMuleServerBuilerArg() throws Exception { MuleServer muleServer = new MuleServer(new String[]{"-builder", "org.mule.config.spring.SpringXmlConfigurationBuilder"}); assertEquals(ClassUtils.getResource("mule-config.xml", MuleServer.class).toString(), muleServer.getConfigurationResources()); assertEquals("org.mule.config.spring.SpringXmlConfigurationBuilder", muleServer.getConfigBuilderClassName()); muleServer.initialize(); } public void testMuleServerSpringBuilerArg() throws Exception { MuleServer muleServer = new MuleServer(new String[]{"-builder", "spring"}); assertEquals(ClassUtils.getResource("mule-config.xml", MuleServer.class).toString(), muleServer.getConfigurationResources()); assertEquals("org.mule.config.spring.SpringXmlConfigurationBuilder", muleServer.getConfigBuilderClassName()); muleServer.initialize(); } } mule-2.0.1/tests/functional/src/test/java/org/mule/impl/0000755000175000017500000000000011351411043022756 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/impl/config/0000755000175000017500000000000011351411043024223 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/java/org/mule/impl/config/builders/0000755000175000017500000000000011351411043026034 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/test/java/org/mule/impl/config/builders/AutoConfigurationBuilderTestCase.javamule-2.0.1/tests/functional/src/test/java/org/mule/impl/config/builders/AutoConfigurationBuilderTest0000644000175000017500000000544710747501743033617 0ustar charlescharles/* * $Id: AutoConfigurationBuilderTestCase.java 10590 2008-01-29 01:39:47Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.impl.config.builders; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.config.ConfigurationException; import org.mule.api.context.MuleContextFactory; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.builders.AutoConfigurationBuilder; import org.mule.config.builders.SimpleConfigurationBuilder; import org.mule.context.DefaultMuleContextFactory; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.mule.TestConnector; import org.mule.tck.testmodels.mule.TestExceptionStrategy; public class AutoConfigurationBuilderTestCase extends AbstractMuleTestCase { protected MuleContext createMuleContext() throws Exception { MuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); return muleContextFactory.createMuleContext(new SimpleConfigurationBuilder(null)); } public void testConfigureSpring() throws ConfigurationException, InitialisationException { ConfigurationBuilder configurationBuilder = new AutoConfigurationBuilder( "org/mule/test/spring/config1/test-xml-mule2-config.xml"); configurationBuilder.configure(muleContext); // Just a few of the asserts from AbstractConfigBuilderTestCase TestConnector c = (TestConnector) muleContext.getRegistry().lookupConnector("dummyConnector"); assertNotNull(c); assertNotNull(c.getExceptionListener()); assertTrue(c.getExceptionListener() instanceof TestExceptionStrategy); } // public void testConfigureGroovy() // { // // TODO // } // // public void testConfigureGalaxySpring() // { // // TODO // } // // public void testConfigureUnkownExtension() throws ConfigurationException // { // ConfigurationBuilder configurationBuilder = new AutoConfigurationBuilder("my.dtd"); // // try // { // configurationBuilder.configure(muleContext); // } // catch (ConfigurationException ce) // { // assertEquals( // "No suitable configuration builder for resource \"my.dtd\" found. Check you have configuration module // ion your classpath and are using correct file extension.", // ce.getCause().getMessage()); // } // catch (Exception e) // { // fail("Exception unexpected:" + e); // } // } } mule-2.0.1/tests/functional/src/test/resources/0000755000175000017500000000000011351411045021357 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/log4j.properties0000644000175000017500000000075110746140407024527 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages #log4j.logger.org.mule=DEBUG # temporary for bamboo related test #log4j.logger.org.mule.test.firewall.FirewallTestCase=DEBUG log4j.logger.org.mule.config.spring.parsers.MapCombinerTestCase=INFO mule-2.0.1/tests/functional/src/test/resources/test-template.properties0000644000175000017500000000023110503620563026266 0ustar charlescharlesmodel.name=blah retry.count=4 test.inbound.endpoint=test://test.1 test.outbound.endpoint=test://test.2 test.embedded=embedded foo=foo entry bar=bar entrymule-2.0.1/tests/functional/src/test/resources/default-threading-profile-2-mule-2083.xml0000644000175000017500000000110310766460764030637 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/META-INF/0000755000175000017500000000000011351411045022517 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/META-INF/spring.schemas0000644000175000017500000000054010754365306025403 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/parsers-test/2.0/mule-parsers-test.xsd=META-INF/mule-parsers-test.xsd http\://www.mulesource.org/schema/mule/nest-example-base/2.0/nest-example-base.xsd=META-INF/nest-example-base.xsd http\://www.mulesource.org/schema/mule/nest-example-extension/2.0/nest-example-extension.xsd=META-INF/nest-example-extension.xsd mule-2.0.1/tests/functional/src/test/resources/META-INF/spring.handlers0000644000175000017500000000051010754365306025555 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/parsers-test/2.0=org.mule.config.spring.parsers.ParsersTestNamespaceHandler http\://www.mulesource.org/schema/mule/nest-example-base/2.0=org.mule.test.spring.DummyNamespaceHandler http\://www.mulesource.org/schema/mule/nest-example-extension/2.0=org.mule.test.spring.DummyNamespaceHandler mule-2.0.1/tests/functional/src/test/resources/META-INF/services/0000755000175000017500000000000011351411045024342 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/META-INF/services/org/0000755000175000017500000000000011351411045025131 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/META-INF/services/org/mule/0000755000175000017500000000000011351411045026073 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351411045026652 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/META-INF/services/org/mule/i18n/test-messages.propertiesmule-2.0.1/tests/functional/src/test/resources/META-INF/services/org/mule/i18n/test-messages.propert0000644000175000017500000000004110621717250033054 0ustar charlescharles1=Testing, Testing, {0}, {1}, {2}mule-2.0.1/tests/functional/src/test/resources/META-INF/nest-example-extension.xsd0000644000175000017500000000574110663312606027672 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/META-INF/mule-parsers-test.xsd0000644000175000017500000002573110762051625026654 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/META-INF/nest-example-base.xsd0000644000175000017500000000520410663312606026562 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/nest-example.xml0000644000175000017500000000501110663125136024510 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/0000755000175000017500000000000011351411044022145 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/org/mule/0000755000175000017500000000000011351411044023107 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/org/mule/test/0000755000175000017500000000000011351411044024066 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/org/mule/test/transformers/0000755000175000017500000000000011351411044026613 5ustar charlescharles././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/transformers/expression-transformers-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/transformers/expression-transformers-te0000644000175000017500000000220710765042126034100 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/0000755000175000017500000000000011351411044025370 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/global-properties-mule-2458-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/global-properties-mule-2458-test0000644000175000017500000000177510770364250033306 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/mule-root-test.xml0000644000175000017500000000201210770767514031031 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/test-mule2-app-context.xml0000644000175000017500000000505510754375733032404 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/test.properties0000644000175000017500000000001510660420033030461 0ustar charlescharlesprop2=value2 mule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config2/0000755000175000017500000000000011351411044026717 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config2/test-xml-mule2-config-split.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config2/test-xml-mule2-config-sp0000644000175000017500000000747710772064773033366 0ustar charlescharles ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config2/test-xml-mule2-config-split-properties.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config2/test-xml-mule2-config-sp0000644000175000017500000000537110746074653033354 0ustar charlescharles test1 test2 ${os.version} ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config2/test-xml-mule2-config.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config2/test-xml-mule2-config.xm0000644000175000017500000002537510774266536033371 0ustar charlescharles prop1 prop2 prop3 prop4 prop5 prop6 prop1 prop2 prop3 prop4 prop5 prop6 ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/property-placeholder-mule-2150-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/property-placeholder-mule-2150-t0000644000175000017500000000230010770767514033264 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/jndi-functional-test.xml0000644000175000017500000000172510634260430032164 0ustar charlescharles org.mule.tck.jndi.TestContextFactory ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/inherited-properties-mule-2458-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/inherited-properties-mule-2458-t0000644000175000017500000000277310745174725033314 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config1/0000755000175000017500000000000011351411044026716 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config1/test-xml-mule2-config-split.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config1/test-xml-mule2-config-sp0000644000175000017500000000466410772064773033360 0ustar charlescharles ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config1/test-xml-mule2-config.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/config1/test-xml-mule2-config.xm0000644000175000017500000002254410774266536033363 0ustar charlescharles prop1 prop2 prop3 prop4 prop5 prop6 prop1 prop2 prop3 prop4 prop5 prop6 ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/test-mule2-application-context.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/spring/test-mule2-application-context.x0000644000175000017500000000154110565370512033560 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/test/config/0000755000175000017500000000000011351411044025333 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/org/mule/test/config/startup-properties-test.xml0000644000175000017500000000101410726244246032737 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/test/config/custom-transaction-config.xml0000644000175000017500000000203210770773146033174 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/test/config/expression-filter-config.xml0000644000175000017500000000201610771050152033005 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/test/components/0000755000175000017500000000000011351411044026253 5ustar charlescharles././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/components/object-factory-functional-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/components/object-factory-functional-te0000644000175000017500000000156410702553732033677 0ustar charlescharles ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/components/service-factory-functional-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/components/service-factory-functional-t0000644000175000017500000000446210766654216033735 0ustar charlescharles ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/test/components/component-pooling-functional-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/test/components/component-pooling-functional0000644000175000017500000000266010756631035034025 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/test/components/component-initial-state.xml0000644000175000017500000000256010754365306033566 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/config/0000755000175000017500000000000011351411044024354 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/0000755000175000017500000000000011351411045025657 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/0000755000175000017500000000000011351411045027336 5ustar charlescharlesmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/specific/0000755000175000017500000000000011351411045031123 5ustar charlescharles././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/specific/server-notification-manager-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/specific/server-notifi0000644000175000017500000000417710754365306033671 0ustar charlescharles ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/specific/component-ok-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/specific/component-ok-0000644000175000017500000001574010767355640033565 0ustar charlescharles ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/specific/component-bad-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/specific/component-bad0000644000175000017500000000204510745677442033622 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/collection-test.xml0000644000175000017500000000260410637020646033203 0ustar charlescharles ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/name-id-equal-mule-2795-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/name-id-equal-mule-2790000644000175000017500000000142310730000554033156 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/third-party-test.xml0000644000175000017500000000160710762051625033321 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/endpoint/0000755000175000017500000000000011351411045031156 5ustar charlescharles././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/endpoint/multiple-transformer-refs-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/endpoint/multiple-tran0000644000175000017500000000155710744156467033731 0ustar charlescharles ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/endpoint/attribute-error-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/endpoint/attribute-err0000644000175000017500000000165410745174725033721 0ustar charlescharles ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/endpoint/complex-endpoint-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/endpoint/complex-endpo0000644000175000017500000000116010702743757033672 0ustar charlescharles ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/parent-simple-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/parent-simple-test.xml0000644000175000017500000000300710637020646033626 0ustar charlescharles orphan3List1 orphan3List2 child3List1 child3List2 ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/reference-collection-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/reference-collection-t0000644000175000017500000000304610701267256033627 0ustar charlescharles ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/map-mule-2478-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/map-mule-2478-test.xml0000644000175000017500000000262510767356631033204 0ustar charlescharles list1 list2 mule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/named-simple-test.xml0000644000175000017500000000436310637020646033427 0ustar charlescharles orphan1List1 orphan1List2 child1List1 child1List2 orphan2List1 orphan2List2 child2List1 child2List2 ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/duplicate-bean-name-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/duplicate-bean-name-te0000644000175000017500000000155310701267256033501 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/ignored-test.xml0000644000175000017500000000230310637020646032473 0ustar charlescharles ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/missing-parser-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/missing-parser-test.xm0000644000175000017500000000134410660407616033641 0ustar charlescharles ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/reference-collection-auto-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/reference-collection-a0000644000175000017500000000300210701267256033574 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/map-combiner-test.xml0000644000175000017500000000330210740425553033416 0ustar charlescharles ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/inherit-simple-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/inherit-simple-test.xm0000644000175000017500000000301210662313060033610 0ustar charlescharles orphan1List1 orphan1List2 child1List1 child1List2 mule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/alias-test.xml0000644000175000017500000000225710637020646032145 0ustar charlescharles ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/orphan-simple-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/orphan-simple-test.xml0000644000175000017500000000266210636306474033637 0ustar charlescharles orphan2List1 orphan2List2 child2List1 child2List2 ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/named-dynamic-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/named-dynamic-test.xml0000644000175000017500000000273310662313060033552 0ustar charlescharles orphan1List1 orphan1List2 child1List1 child1List2 mule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/list-element-test.xml0000644000175000017500000000237010725254051033447 0ustar charlescharles ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/constrained-connector-exception-strategy-mule-2126-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/constrained-connector-0000644000175000017500000000147710671756770033675 0ustar charlescharles ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/nested-collection-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/nested-collection-test0000644000175000017500000000203410637040727033663 0ustar charlescharles ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/map-entry-combiner-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/map-entry-combiner-tes0000644000175000017500000000334610740737111033576 0ustar charlescharles ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/endpoint-service-conflict-test.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/endpoint-service-confl0000644000175000017500000000201110745174725033651 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/reference-test.xml0000644000175000017500000000257310701267256033015 0ustar charlescharles ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/parsers-test-namespace-config.xmlmule-2.0.1/tests/functional/src/test/resources/org/mule/config/spring/parsers/parsers-test-namespace0000644000175000017500000000217110637020646033661 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/core-namespace-routers.xml0000644000175000017500000002712010745174725026507 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/service-example.xml0000644000175000017500000000226410665301621025203 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/multiple-named-connectors-test.xml0000644000175000017500000000224710745174725030174 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/management-context-aware-test.xml0000644000175000017500000000176710745205313027771 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/default-threading-profile-1-mule-2083.xml0000644000175000017500000000110410766460764030637 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/pooling-profile-test.xml0000644000175000017500000000410210766654216026202 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/mule-element-required-test.xml0000644000175000017500000000105510665325667027313 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/default-model-names.xml0000644000175000017500000000115410767263074025746 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/test-data.txt0000644000175000017500000000003710770575334024026 0ustar charlescharlesSome test data loaded from filemule-2.0.1/tests/functional/src/test/resources/test-dummy.properties0000644000175000017500000000004610624211577025617 0ustar charlescharlesprop1=value1 prop2=value2 prop3=value3mule-2.0.1/tests/functional/src/test/resources/mule-config.xml0000644000175000017500000000111210747501743024316 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000027110771011472026236 0ustar charlescharles# # Test cases listed in this file are not run. # # only works with network connection #org.mule.test.spring.SchemaValidationMule2225TestCase org.mule.test.firewall.FirewallTestCase mule-2.0.1/tests/functional/src/test/resources/message-properties-transformer-config.xml0000644000175000017500000000170010744156467031543 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/test-namespace-config.xml0000644000175000017500000000266310770772424026303 0ustar charlescharles Foo Bar Car Jar mule-2.0.1/tests/functional/src/test/resources/test-custom-transaction-manager.xml0000644000175000017500000000220210700153016030315 0ustar charlescharles mule-2.0.1/tests/functional/src/test/resources/old-config.xml0000644000175000017500000000141210746114576024140 0ustar charlescharles mule-2.0.1/tests/functional/pom.xml0000644000175000017500000000255411006063605017124 0ustar charlescharles 4.0.0 org.mule.tests mule-tests 2.0.1 mule-tests-functional jar Mule Functional Test Framework (TCK) Mule functional test framework (TCK) org.mule mule-core ${version} test-jar org.mule.modules mule-module-builders ${version} test org.mule.modules mule-module-spring-config ${version} mule-2.0.1/tests/integration/0000755000175000017500000000000011351411056015762 5ustar charlescharlesmule-2.0.1/tests/integration/src/0000755000175000017500000000000011351411056016551 5ustar charlescharlesmule-2.0.1/tests/integration/src/main/0000755000175000017500000000000011351411056017475 5ustar charlescharlesmule-2.0.1/tests/integration/src/main/java/0000755000175000017500000000000011351411056020416 5ustar charlescharlesmule-2.0.1/tests/integration/src/main/java/org/0000755000175000017500000000000011351411056021205 5ustar charlescharlesmule-2.0.1/tests/integration/src/main/java/org/mule/0000755000175000017500000000000011351411056022147 5ustar charlescharlesmule-2.0.1/tests/integration/src/main/java/org/mule/test/0000755000175000017500000000000011351411056023126 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/0000755000175000017500000000000011351411052017524 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/0000755000175000017500000000000011351411047020451 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/0000755000175000017500000000000011351411047021240 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/0000755000175000017500000000000011351411052022176 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/0000755000175000017500000000000011351411051023154 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/NoArgsCallWrapperFunctionalTestCase.java0000644000175000017500000000325510754375733033057 0ustar charlescharles/* * $Id: NoArgsCallWrapperFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; /** * This test has been re-written to use entry point resolvers. */ public class NoArgsCallWrapperFunctionalTestCase extends FunctionalTestCase { private static final int RECEIVE_TIMEOUT = 5000; protected String getConfigResources() { return "no-args-call-wrapper-config.xml"; } public void testNoArgsCallWrapper() throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://invoke", "test", null); MuleMessage reply = client.request("vm://out", RECEIVE_TIMEOUT); assertNotNull(reply); assertNull(reply.getExceptionPayload()); assertEquals("Just an apple.", reply.getPayload()); } public void testWithInjectedDelegate() throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://invokeWithInjected", "test", null); MuleMessage reply = client.request("vm://outWithInjected", RECEIVE_TIMEOUT); assertNotNull(reply); assertNull(reply.getExceptionPayload()); // same as original input assertEquals("test", reply.getPayload()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/transformers/0000755000175000017500000000000011351411051025701 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/transformers/FailingRuntimeTransformer.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/transformers/FailingRuntimeTransformer.java0000644000175000017500000000143210745677442033734 0ustar charlescharles/* * $Id: FailingRuntimeTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.transformers; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; public class FailingRuntimeTransformer extends AbstractTransformer { protected Object doTransform(Object src, String encoding) throws TransformerException { throw new RuntimeException("test"); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/transformers/AutoTransformerTestCase.java0000644000175000017500000000311011002221467033331 0ustar charlescharles/* * $Id: AutoTransformerTestCase.java 11604 2008-04-18 22:39:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.transformers; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.fruit.FruitBasket; import org.mule.tck.testmodels.fruit.FruitBowl; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Banana; import org.mule.module.client.MuleClient; import org.mule.util.concurrent.Latch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class AutoTransformerTestCase extends FunctionalTestCase { private static Latch latch; protected String getConfigResources() { return "org/mule/test/integration/transformer/auto-transformer-test.xml"; } public void testInboundAutoTransform() throws Exception { latch = new Latch(); MuleClient client = new MuleClient(); client.dispatch("vm://in", new FruitBowl(new Apple(), new Banana()), null); assertTrue(latch.await(3000, TimeUnit.MILLISECONDS)); } public static class FruitBasketComponent { public void process(FruitBasket fb) { assertTrue(fb.hasApple()); assertTrue(fb.hasBanana()); latch.countDown(); } } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/transformers/FailingTransformer.java0000644000175000017500000000146710745677442032400 0ustar charlescharles/* * $Id: FailingTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.transformers; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; public class FailingTransformer extends AbstractTransformer { protected Object doTransform(Object src, String encoding) throws TransformerException { throw new TransformerException(this, new Exception("Wrapped test exception")); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/0000755000175000017500000000000011351411052024770 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/ReceiverComponent.java0000644000175000017500000000134710745677442031316 0ustar charlescharles/* * $Id: ReceiverComponent.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; public class ReceiverComponent implements Callable { public Object onCall(MuleEventContext eventContext) throws Exception { return "Received: " + eventContext.getMessageAsString(); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/model/0000755000175000017500000000000011351411051026067 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/sync/0000755000175000017500000000000011351411052025744 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/sync/TcpJmsResponseBridgeTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/sync/TcpJmsResponseBridgeTestCase.0000644000175000017500000000210510754375733033460 0ustar charlescharles/* * $Id: TcpJmsResponseBridgeTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.sync; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class TcpJmsResponseBridgeTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/usecases/sync/tcp-jms-response-bridge.xml"; } public void testSyncResponse() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("tcp://localhost:4444", "request", null); assertNotNull(message); assertEquals("Received: request", message.getPayloadAsString()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/sync/HttpTransformTestCase.java0000644000175000017500000000467310756770615033115 0ustar charlescharles/* * $Id: HttpTransformTestCase.java 10896 2008-02-20 09:23:25Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.sync; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transformer.compression.GZipUncompressTransformer; import org.mule.transformer.simple.ByteArrayToSerializable; import java.util.Arrays; public class HttpTransformTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/usecases/sync/http-transform.xml"; } public void testTransform() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("http://localhost:18080/RemoteService", "payload", null); assertNotNull(message); GZipUncompressTransformer gu = new GZipUncompressTransformer(); gu.setReturnClass(String.class); assertNotNull(message.getPayload()); String result = (String)gu.transform(message.getPayloadAsBytes()); assertEquals("payload", result); } public void testBinary() throws Exception { MuleClient client = new MuleClient(); Object payload = Arrays.asList(new Integer[]{new Integer(42)}); MuleMessage message = client.send("http://localhost:18081/RemoteService", payload, null); assertNotNull(message); ByteArrayToSerializable bas = new ByteArrayToSerializable(); assertNotNull(message.getPayload()); Object result = bas.transform(message.getPayload()); assertEquals(payload, result); } public void testBinaryWithBridge() throws Exception { MuleClient client = new MuleClient(); Object payload = Arrays.asList(new Integer[]{new Integer(42)}); MuleMessage message = client.send("vm://LocalService", payload, null); assertNotNull(message); ByteArrayToSerializable bas = new ByteArrayToSerializable(); assertNotNull(message.getPayload()); Object result = bas.transform(message.getPayload()); assertEquals(payload, result); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/sync/TcpJmsResponseTestCase.java0000644000175000017500000000206210754375733033207 0ustar charlescharles/* * $Id: TcpJmsResponseTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.sync; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class TcpJmsResponseTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/usecases/sync/tcp-jms-response.xml"; } public void testSyncResponse() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("tcp://localhost:4444", "request", null); assertNotNull(message); assertEquals("Received: request", message.getPayloadAsString()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/sync/TcpToFileTestCase.java0000644000175000017500000000216110754375733032121 0ustar charlescharles/* * $Id: TcpToFileTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.sync; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class TcpToFileTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/usecases/sync/tcp-to-file.xml"; } public void testSyncResponse() throws Exception { MuleClient client = new MuleClient(); String payload = "payload"; client.sendNoReceive("tcp://localhost:4444", payload, null); MuleMessage msg = client.request("file://temp/tests/mule", 10000); assertNotNull(msg); assertEquals(payload, msg.getPayloadAsString()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/dlq/0000755000175000017500000000000011351411051025547 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/dlq/DLQExceptionHandlerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/dlq/DLQExceptionHandlerTestCase.ja0000644000175000017500000000270610774040205033330 0ustar charlescharles/* * $Id: DLQExceptionHandlerTestCase.java 11516 2008-03-31 01:38:13Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.dlq; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.message.ExceptionMessage; import org.mule.tck.FunctionalTestCase; public class DLQExceptionHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/usecases/dlq/exception-dlq.xml"; } public void testDLQ() throws Exception { MuleClient client = new MuleClient(); client.dispatch("jms://request.queue", "testing 1 2 3", null); MuleMessage message = client.request("jms://out.queue", 3000); assertNull(message); try { message = client.request("jms://DLQ", 20000); } catch (MuleException e) { e.printStackTrace(System.err); } assertNotNull(message); ExceptionMessage em = (ExceptionMessage)message.getPayload(); assertEquals("testing 1 2 3", em.getPayload()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/properties/0000755000175000017500000000000011351411052027164 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/properties/DummyComponent.java0000644000175000017500000000171410745677442033037 0ustar charlescharles/* * $Id: DummyComponent.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.properties; import org.mule.RequestContext; import org.mule.routing.outbound.StaticRecipientList; import java.util.ArrayList; import java.util.List; public class DummyComponent { public void processData(String theData) { List recipients = new ArrayList(); recipients.add("ross.mason@symphonysoft.com"); recipients.add("ross@rossmason.com"); RequestContext.getEventContext().getMessage().setProperty(StaticRecipientList.RECIPIENTS_PROPERTY, recipients); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/properties/PropsComponent.java0000644000175000017500000000445610746275214033045 0ustar charlescharles/* * $Id: PropsComponent.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.properties; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.Callable; import org.mule.tck.testmodels.fruit.Apple; import java.util.HashMap; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class PropsComponent implements Callable { private static final Log logger = LogFactory.getLog(PropsComponent.class); protected static Apple testObjectProperty = new Apple(); public Object onCall(MuleEventContext context) throws Exception { logger.debug("org.mule.test.usecases.props.PropsComponent"); if ("component1".equals(context.getService().getName())) { logger.debug("Adding: " + context.getService().getName()); Map props = new HashMap(); props.put("stringParam", "param1"); props.put("objectParam", testObjectProperty); MuleMessage msg = new DefaultMuleMessage(context.getMessageAsString(), props); logger.debug("Adding done: " + context.getService().getName()); return msg; } else { logger.debug("Verifying: " + context.getService().getName()); assertEquals("param1", context.getMessage().getProperty("stringParam")); assertEquals(testObjectProperty, context.getMessage().getProperty("objectParam")); logger.debug("Verifying done: " + context.getService().getName()); } return context; } static protected void assertEquals(Object theObject, Object theProperty) { if (!theObject.equals(theProperty)) { logger.error(String.valueOf(theObject) + " does not equal:" + String.valueOf(theProperty)); } else { logger.debug("Woohoo!"); } } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/routing/0000755000175000017500000000000011351411051026456 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/routing/response/0000755000175000017500000000000011351411051030314 5ustar charlescharles././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/routing/response/ResponseAggregatorTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/routing/response/ResponseAggregato0000644000175000017500000000437410776760562033716 0ustar charlescharles/* * $Id: ResponseAggregatorTestCase.java 11545 2008-04-08 21:19:46Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.routing.response; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.routing.response.SingleResponseRouter; import org.mule.tck.FunctionalTestCase; import java.util.Map; public class ResponseAggregatorTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/usecases/routing/response/response-router.xml"; } public void testSyncResponse() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("http://localhost:28081", "request", null); assertNotNull(message); assertEquals("Received: request", new String(message.getPayloadAsBytes())); } public void testResponseEventsCleanedUp() throws Exception { // relax access to get to the responseEvents RelaxedResponseAggregator aggregator = new RelaxedResponseAggregator(); MuleEvent event = getTestEvent("message1"); final MuleMessage message = event.getMessage(); final String id = message.getUniqueId(); message.setCorrelationId(id); message.setCorrelationGroupSize(1); aggregator.setMuleContext(muleContext); aggregator.initialise(); aggregator.process(event); aggregator.getResponse(message); Map responseEvents = aggregator.getResponseEvents(); assertTrue("Response events should be cleaned up.", responseEvents.isEmpty()); } /** * This class opens up the access to responseEvents map for testing */ private static final class RelaxedResponseAggregator extends SingleResponseRouter { public Map getResponseEvents() { return this.getEventCorrelator().getResponseMessages(); } } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/routing/ForwardingMessageSplitterTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/routing/ForwardingMessageSplitterT0000644000175000017500000000307110754375733033712 0ustar charlescharles/* * $Id: ForwardingMessageSplitterTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.routing; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.ArrayList; import java.util.List; public class ForwardingMessageSplitterTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/usecases/routing/forwarding-message-splitter.xml"; } public void testSyncResponse() throws Exception { MuleClient client = new MuleClient(); List payload = new ArrayList(); payload.add("hello"); payload.add(new Integer(3)); payload.add(new Exception()); client.send("vm://in.queue", payload, null); MuleMessage m = client.request("vm://component.1", 2000); assertNotNull(m); assertTrue(m.getPayload() instanceof String); m = client.request("vm://component.2", 2000); assertNotNull(m); assertTrue(m.getPayload() instanceof Integer); m = client.request("vm://error.queue", 2000); assertNotNull(m); assertTrue(m.getPayload() instanceof Exception); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/routing/InboundTransformingCatchAllTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/routing/InboundTransformingCatchAl0000644000175000017500000000302410754375733033636 0ustar charlescharles/* * $Id: InboundTransformingCatchAllTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.routing; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; /* * In this Test Case we make use of a Custom Catch All Strategy in order to show how * to send the transformed message instead of the non-transformed message. */ public class InboundTransformingCatchAllTestCase extends FunctionalTestCase { public void testNormal() throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://in1", new DefaultMuleMessage("HELLO!")); MuleMessage msg = client.request("vm://catchall", 3000); assertNotNull(msg); assertTrue(msg.getPayload() instanceof String); client.dispatch("vm://in2", new DefaultMuleMessage("HELLO!")); msg = client.request("vm://catchall", 3000); assertNotNull(msg); assertTrue(msg.getPayload() instanceof byte[]); } protected String getConfigResources() { return "org/mule/test/usecases/routing/inbound-transforming-catchall.xml"; } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/routing/InboundTransformingForwardingCatchAllStrategy.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/routing/InboundTransformingForward0000644000175000017500000000444510757615756033760 0ustar charlescharles/* * $Id: InboundTransformingForwardingCatchAllStrategy.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.routing; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.RoutingException; import org.mule.api.routing.ServiceRoutingException; import org.mule.config.i18n.CoreMessages; import org.mule.routing.AbstractCatchAllStrategy; public class InboundTransformingForwardingCatchAllStrategy extends AbstractCatchAllStrategy { public MuleMessage catchMessage(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { OutboundEndpoint endpoint = this.getEndpoint(); if (endpoint == null) { throw new ServiceRoutingException( CoreMessages.noCatchAllEndpointSet(), message, this.getEndpoint(), session.getService()); } try { message = new DefaultMuleMessage(RequestContext.getEventContext().transformMessage(), message); MuleEvent newEvent = new DefaultMuleEvent(message, endpoint, session, synchronous); if (synchronous) { MuleMessage result = endpoint.send(newEvent); if (statistics != null) { statistics.incrementRoutedMessage(getEndpoint()); } return result; } else { endpoint.dispatch(newEvent); if (statistics != null) { statistics.incrementRoutedMessage(getEndpoint()); } return null; } } catch (Exception e) { throw new RoutingException(message, endpoint, e); } } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/http/0000755000175000017500000000000011351411051025746 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/http/HttpResponseTestCase.java0000644000175000017500000000416410754375733032736 0ustar charlescharles/* * $Id: HttpResponseTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.http; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.NullPayload; import org.mule.transport.http.HttpConnector; public class HttpResponseTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/usecases/http/http-response.xml"; } public void testNullPayloadUsingAsync() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("http://localhost:8990", new DefaultMuleMessage("test")); //TODO RM: What should really be returned when doing an async request? assertNotNull(reply.getPayload()); assertEquals(reply.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0), 200); assertEquals(0, reply.getPayloadAsString().length()); } public void testPayloadIsNotEmptyNoRemoteSynch() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("http://localhost:8999", new DefaultMuleMessage("test")); assertNotNull(reply.getPayload()); assertFalse(reply.getPayload() instanceof NullPayload); assertEquals("test", reply.getPayloadAsString()); } public void testPayloadIsNotEmptyWithRemoteSynch() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("http://localhost:8989", new DefaultMuleMessage("test")); assertNotNull(reply.getPayload()); assertFalse(reply.getPayload() instanceof NullPayload); assertEquals("test", reply.getPayloadAsString()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/http/HttpPostTestCase.java0000644000175000017500000000210710754375733032060 0ustar charlescharles/* * $Id: HttpPostTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.http; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class HttpPostTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/usecases/http/http-post.xml"; } public void testPost() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("httpRequest", "payload", null); assertNotNull(message); assertNotNull(message.getPayloadAsString()); assertEquals("IncidentData=payload", message.getPayloadAsString()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/0000755000175000017500000000000011351411051025733 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/BackOfficeImpl.java0000644000175000017500000000111710664630335031412 0ustar charlescharles/* * $Id: BackOfficeImpl.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis; /** * TODO document */ public interface BackOfficeImpl { public SubmitTradeResponse submitTrade(SubmitTrade parameters); } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/SubmitTrade.java0000644000175000017500000001015210664630335031036 0ustar charlescharles/* * $Id: SubmitTrade.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis; /** * SubmitTrade.java This file was auto-generated from WSDL by the Apache Axis 1.2.1 * Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter. */ public class SubmitTrade implements java.io.Serializable { private static final long serialVersionUID = 6724911620302616166L; private org.mule.test.usecases.axis.Trade arg0; public SubmitTrade() { super(); } public SubmitTrade(org.mule.test.usecases.axis.Trade arg0) { this.arg0 = arg0; } /** * Gets the arg0 value for this SubmitTrade. * * @return arg0 */ public org.mule.test.usecases.axis.Trade getArg0() { return arg0; } /** * Sets the arg0 value for this SubmitTrade. * * @param arg0 */ public void setArg0(org.mule.test.usecases.axis.Trade arg0) { this.arg0 = arg0; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof SubmitTrade)) { return false; } SubmitTrade other = (SubmitTrade)obj; if (this == obj) { return true; } if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.arg0 == null && other.getArg0() == null) || (this.arg0 != null && this.arg0.equals(other.getArg0()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getArg0() != null) { _hashCode += getArg0().hashCode(); } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc( SubmitTrade.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("http://samples.mule.org/hello", "submitTrade")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("arg0"); elemField.setXmlName(new javax.xml.namespace.QName("http://samples.mule.org/hello", "arg0")); elemField.setXmlType(new javax.xml.namespace.QName("http://samples.mule.org/hello", "arg0")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer(java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer(_javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer(java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType, _xmlType, typeDesc); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/BackOfficeImplBindingImpl.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/BackOfficeImplBindingImpl.jav0000644000175000017500000000315510664630335033372 0ustar charlescharles/* * $Id: BackOfficeImplBindingImpl.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis; public class BackOfficeImplBindingImpl implements org.mule.test.usecases.axis.BackOfficeImpl { // Doc Lit test public SubmitTradeResponse submitTrade(SubmitTrade parameters) { TradeStatus ts = new TradeStatus(); Trade trade = parameters.getArg0(); ts.setTradeID(trade.getTradeID()); ts.setStatus("RECEIVED"); SubmitTradeResponse str = new SubmitTradeResponse(ts); return str; } // RPC Enc test public TradeStatus submitTrade(Trade trade) { TradeStatus ts = new TradeStatus(); ts.setTradeID(trade.getTradeID()); ts.setStatus("RECEIVED"); return ts; } // Wrapped Lit test public TradeStatus submitTrade(int accountID, String cusip, int currency, int tradeID, int transaction) { Trade trade = new Trade(); trade.setAccountID(accountID); trade.setCusip(cusip); trade.setCurrency(currency); trade.setTradeID(tradeID); trade.setTransaction(transaction); TradeStatus ts = new TradeStatus(); ts.setTradeID(trade.getTradeID()); ts.setStatus("RECEIVED"); return ts; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/AxisClientWithComplexTypesTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/AxisClientWithComplexTypesTes0000644000175000017500000000512010754375733033632 0ustar charlescharles/* * $Id: AxisClientWithComplexTypesTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.soap.axis.AxisConnector; import java.util.HashMap; import java.util.Map; /** * TODO document */ public class AxisClientWithComplexTypesTestCase extends FunctionalTestCase { private Trade trade = null; private String uri = "axis:http://localhost:8081/services/BackOfficeImplBindingImplUMO?method=submitTrade"; // @Override protected void doSetUp() throws Exception { trade = new Trade(); trade.setAccountID(11); trade.setCusip("33"); trade.setCurrency(22); trade.setTradeID(22); trade.setTransaction(11); } protected String getConfigResources() { return "org/mule/test/usecases/routing/axis/axis-client-test.xml"; } public void testSendComplexDOCLIT() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); props.put(AxisConnector.STYLE, "Document"); props.put(AxisConnector.USE, "Literal"); SubmitTrade submittrade = new SubmitTrade(); submittrade.setArg0(trade); // We need to name the parameters weh using Doc/Lit // SoapMethod method = new SoapMethod(new QName("submitTrade"), // SubmitTradeResponse.class); // method.addNamedParameter(new NamedParameter(new QName("submitTrade"), // NamedParameter.createQName("Object"), ParameterMode.IN)); // props.put(MuleProperties.MULE_SOAP_METHOD, method); MuleMessage result = client.send(uri, submittrade, props); assertNotNull(result); SubmitTradeResponse response = (SubmitTradeResponse)result.getPayload(); assertEquals("RECEIVED", response.get_return().getStatus()); } public void testSendComplexRPCENC() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send(uri, trade, null); assertNotNull(result); TradeStatus status = (TradeStatus)result.getPayload(); assertEquals("RECEIVED", status.getStatus()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/TradeStatus.java0000644000175000017500000000603210664630335031060 0ustar charlescharles/* * $Id: TradeStatus.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis; /** * TradeStatus.java This file was auto-generated from WSDL by the IBM Web services * WSDL2Java emitter. jdk0450.04 v122904173847 */ public class TradeStatus implements java.io.Serializable { private static final long serialVersionUID = 414517174955602939L; private java.lang.String status; private int tradeID; public TradeStatus() { super(); } public java.lang.String getStatus() { return status; } public void setStatus(java.lang.String status) { this.status = status; } public int getTradeID() { return tradeID; } public void setTradeID(int tradeID) { this.tradeID = tradeID; } private transient java.lang.ThreadLocal __history; public boolean equals(java.lang.Object obj) { if (obj == null) { return false; } if (obj.getClass() != this.getClass()) { return false; } TradeStatus other = (TradeStatus)obj; boolean _equals; _equals = true && ((this.status == null && other.getStatus() == null) || (this.status != null && this.status.equals(other.getStatus()))) && this.tradeID == other.getTradeID(); if (!_equals) { return false; } if (__history == null) { synchronized (this) { if (__history == null) { __history = new java.lang.ThreadLocal(); } } } TradeStatus history = (TradeStatus)__history.get(); if (history != null) { return (history == obj); } if (this == obj) { return true; } __history.set(obj); __history.set(null); return true; } private transient java.lang.ThreadLocal __hashHistory; public int hashCode() { if (__hashHistory == null) { synchronized (this) { if (__hashHistory == null) { __hashHistory = new java.lang.ThreadLocal(); } } } TradeStatus history = (TradeStatus)__hashHistory.get(); if (history != null) { return 0; } __hashHistory.set(this); int _hashCode = 1; if (getStatus() != null) { _hashCode += getStatus().hashCode(); } _hashCode += getTradeID(); __hashHistory.set(null); return _hashCode; } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/Trade.java0000644000175000017500000000332510664630335027656 0ustar charlescharles/* * $Id: Trade.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis; /** * TODO document */ public class Trade implements java.io.Serializable { private static final long serialVersionUID = -1225935545079750532L; private int accountID; private java.lang.String cusip; private int currency; private int tradeID; private int transaction; public Trade() { super(); } public int getAccountID() { return accountID; } public void setAccountID(int accountID) { this.accountID = accountID; } public java.lang.String getCusip() { return cusip; } public void setCusip(java.lang.String cusip) { this.cusip = cusip; } public int getCurrency() { return currency; } public void setCurrency(int currency) { this.currency = currency; } // public float getPrice() { // return price; // } // public void setPrice(float price) { // this.price = price; // } public int getTradeID() { return tradeID; } public void setTradeID(int tradeID) { this.tradeID = tradeID; } public int getTransaction() { return transaction; } public void setTransaction(int transaction) { this.transaction = transaction; } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/SubmitTradeResponse.java0000644000175000017500000001047210664630335032562 0ustar charlescharles/* * $Id: SubmitTradeResponse.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis; /** * SubmitTradeResponse.java This file was auto-generated from WSDL by the Apache Axis * 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter. */ public class SubmitTradeResponse implements java.io.Serializable { private static final long serialVersionUID = -1096201474470391609L; private org.mule.test.usecases.axis.TradeStatus _return; public SubmitTradeResponse() { super(); } public SubmitTradeResponse(org.mule.test.usecases.axis.TradeStatus _return) { this._return = _return; } /** * Gets the _return value for this SubmitTradeResponse. * * @return _return */ public org.mule.test.usecases.axis.TradeStatus get_return() { return _return; } /** * Sets the _return value for this SubmitTradeResponse. * * @param _return */ public void set_return(org.mule.test.usecases.axis.TradeStatus _return) { this._return = _return; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof SubmitTradeResponse)) { return false; } SubmitTradeResponse other = (SubmitTradeResponse)obj; if (this == obj) { return true; } if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this._return == null && other.get_return() == null) || (this._return != null && this._return.equals(other.get_return()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (get_return() != null) { _hashCode += get_return().hashCode(); } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc( SubmitTradeResponse.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("http://samples.mule.org/hello", "submitTradeResponse")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("_return"); elemField.setXmlName(new javax.xml.namespace.QName("http://samples.mule.org/hello", "return")); elemField.setXmlType(new javax.xml.namespace.QName("http://samples.mule.org/hello", "tradeStatus")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer(java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer(_javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer(java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType, _xmlType, typeDesc); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/InvalidTradeException.java0000644000175000017500000000171010664630335033040 0ustar charlescharles/* * $Id: InvalidTradeException.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis; /** * TODO document */ public class InvalidTradeException extends Exception { private static final long serialVersionUID = -997233549872918131L; public InvalidTradeException() { super(); } public InvalidTradeException(String message) { super(message); } public InvalidTradeException(Throwable cause) { super(cause); } public InvalidTradeException(String message, Throwable cause) { super(message, cause); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/clientbridge/0000755000175000017500000000000011351411051030366 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/clientbridge/ComplexData.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/clientbridge/ComplexData.java0000644000175000017500000000310410664630335033446 0ustar charlescharles/* * $Id: ComplexData.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis.clientbridge; import java.io.Serializable; public class ComplexData implements Serializable { private String someString = "Default String"; private Integer someInteger = new Integer(13); public ComplexData() { super(); } public ComplexData(String someString, Integer someInteger) { super(); setSomeString(someString); setSomeInteger(someInteger); } public String toString() { try { return "[ComplexData: [someString=" + someString + "][someInteger=" + someInteger + "]]"; } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } public Integer getSomeInteger() { return someInteger; } public void setSomeInteger(Integer someInteger) { this.someInteger = someInteger; } public String getSomeString() { return someString; } public void setSomeString(String someString) { this.someString = someString; } private static final long serialVersionUID = -886414019167115007L; } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/clientbridge/Client.java0000644000175000017500000000536310754375733032504 0ustar charlescharles/* * $Id: Client.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis.clientbridge; import org.mule.api.MuleException; import org.mule.api.MuleContext; import org.mule.api.MuleMessage; import org.mule.api.context.MuleContextFactory; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.context.DefaultMuleContextFactory; import org.mule.module.client.MuleClient; public class Client { private static final String LOCAL_ENDPOINT = "vm://complexRequest"; private static final String AXIS_ENDPOINT = "axis:http://localhost:8002/axisService/doSomeWork"; public static void main(String[] args) throws Exception { MuleContext muleContext = null; try { SpringXmlConfigurationBuilder builder = new SpringXmlConfigurationBuilder("clientbridge/conf/client-mule-config.xml"); MuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); muleContext = muleContextFactory.createMuleContext(builder); Client c = new Client(); c.execute(); } finally { if (muleContext != null) { muleContext.dispose(); } } } private MuleClient client; private void execute() throws MuleException { client = new MuleClient(); try { executeComplexity(); complexRequest(); } finally { if (client != null) { client.dispose(); } } } private void executeComplexity() throws MuleException { System.err.println("\nexecuteComplexity"); Object result = client.send(AXIS_ENDPOINT + "?method=executeComplexity", new ComplexData("Foo", new Integer(42)), null); System.err.println(result); MuleMessage message = (MuleMessage)result; ComplexData data = (ComplexData)message.getPayload(); System.err.println(data); } private void complexRequest() throws MuleException { System.err.println("\ncomplexRequest"); Object result = client.send(LOCAL_ENDPOINT, new ComplexData("Foo", new Integer(84)), null); System.err.println(result); MuleMessage message = (MuleMessage)result; ComplexData data = (ComplexData)message.getPayload(); System.err.println(data); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/clientbridge/WorkInterface.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/clientbridge/WorkInterface.ja0000644000175000017500000000106310664630335033463 0ustar charlescharles/* * $Id: WorkInterface.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis.clientbridge; public interface WorkInterface { ComplexData executeComplexity(ComplexData input); } mule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/clientbridge/DoSomeWork.java0000644000175000017500000000137110746275214033304 0ustar charlescharles/* * $Id: DoSomeWork.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis.clientbridge; /** * A server-side service to receive and process ComplexData. */ public class DoSomeWork implements WorkInterface { public ComplexData executeComplexity(ComplexData input) { System.err.println("DoSomeWork.executeComplexity(" + input + ")"); return input; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/clientbridge/ClientBridgeTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/usecases/axis/clientbridge/ClientBridgeTest0000644000175000017500000000243010754375733033531 0ustar charlescharles/* * $Id: ClientBridgeTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.usecases.axis.clientbridge; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class ClientBridgeTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/usecases/axis/clientbridge/client-mule-config.xml"; } public void testBridgeVMToAxis() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://complexRequest", new ComplexData("Foo", new Integer(84)), null); assertNotNull(message); assertTrue(message.getPayload() instanceof ComplexData); ComplexData result = (ComplexData)message.getPayload(); assertEquals(new Integer(84), result.getSomeInteger()); assertEquals("Foo", result.getSomeString()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/0000755000175000017500000000000011351411050025476 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/streaming/0000755000175000017500000000000011351411050027467 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/streaming/SimpleStreamingBean.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/streaming/SimpleStreamingBean.j0000644000175000017500000000133410777523300033551 0ustar charlescharles/* * $Id: SimpleStreamingBean.java 11562 2008-04-10 23:46:08Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.streaming; import java.io.IOException; import java.io.InputStream; /** * A simple bridge service for testing entry point resolution */ public class SimpleStreamingBean { public InputStream doit(InputStream in) throws IOException { return in; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/streaming/StreamClosingTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/streaming/StreamClosingTestCase0000644000175000017500000000442610767456705033660 0ustar charlescharles/* * $Id: StreamClosingTestCase.java 11383 2008-03-17 12:02:13Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.streaming; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.DefaultMessageAdapter; import org.mule.util.FileUtils; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class StreamClosingTestCase extends FunctionalTestCase { public void testCloseStreamOnException() throws MuleException, InterruptedException, IOException { MuleClient client = new MuleClient(); String text = "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah " + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah " + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah " + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n"; String basepath = muleContext.getConfiguration().getWorkingDirectory() + "/test-data"; FileUtils.stringToFile(basepath + "/in/foo.txt", text); InputStream stream = new FileInputStream(new File(basepath + "/in/foo.txt")); DefaultMessageAdapter adapter = new DefaultMessageAdapter(stream); client.dispatch("tcpEndpoint", new DefaultMuleMessage(adapter)); Thread.sleep(2000); try { stream.read(); fail("STREAM SHOULD HAVE BEEN CLOSED"); } catch (Exception e2) { // expected } } // @Override protected String getConfigResources() { return "org/mule/test/integration/streaming/stream-closing.xml"; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/streaming/FileToTcpStreamingTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/streaming/FileToTcpStreamingTes0000644000175000017500000000355410766204322033613 0ustar charlescharles/* * $Id: FileToTcpStreamingTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.streaming; import org.mule.tck.FunctionalTestCase; import org.mule.util.FileUtils; public class FileToTcpStreamingTestCase extends FunctionalTestCase { // @Override protected void doTearDown() throws Exception { FileUtils.deleteDirectory(FileUtils.newFile(muleContext.getConfiguration().getWorkingDirectory() + "/test-data")); } // @Override protected String getConfigResources() { return "org/mule/test/integration/streaming/file-to-tcp-streaming.xml"; } public void testStreamingFromFileToTcp() throws Exception { String text = "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah " + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah " + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah " + "\nblah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n"; String basepath = muleContext.getConfiguration().getWorkingDirectory() + "/test-data"; FileUtils.stringToFile(basepath + "/in/foo.txt", text); Thread.sleep(3000); String result = FileUtils.readFileToString(FileUtils.newFile(basepath, "out/foo.txt.processed"), "UTF8"); assertEquals(text, result); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/streaming/SimpleExceptionThrowingTestComponent.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/streaming/SimpleExceptionThrowi0000644000175000017500000000172110777130615033740 0ustar charlescharles/* * $Id: SimpleExceptionThrowingTestComponent.java 11551 2008-04-09 12:07:41Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.streaming; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; public class SimpleExceptionThrowingTestComponent implements Callable { public Object onCall(MuleEventContext eventContext) throws Exception { // if (eventContext.getMessage().getPayload() instanceof InputStream) // { // ((InputStream) eventContext.getMessage().getPayload()).close(); // } throw new RuntimeException("Runtim Exception"); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/models/0000755000175000017500000000000011351411047026767 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/models/ConfigureModelTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/models/ConfigureModelTestCase.j0000644000175000017500000000173110745677442033525 0ustar charlescharles/* * $Id: ConfigureModelTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.models; import org.mule.model.direct.DirectModel; import org.mule.tck.FunctionalTestCase; public class ConfigureModelTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/models/direct-pipeline-test-config.xml"; } public void testConfigure() { assertTrue(muleContext.getRegistry().lookupModel("main") instanceof DirectModel); assertEquals("main", muleContext.getRegistry().lookupModel("main").getName()); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/models/OptimisedSedaPipelineTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/models/OptimisedSedaPipelineTes0000644000175000017500000000142210674006563033617 0ustar charlescharles/* * $Id: OptimisedSedaPipelineTestCase.java 8476 2007-09-18 17:40:03Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.models; public class OptimisedSedaPipelineTestCase extends AbstractPipelineTestCase { protected String getConfigResources() { return "org/mule/test/integration/models/optimised-seda-pipeline-test-config.xml," + "org/mule/test/integration/models/pipeline-test-config.xml"; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/models/SedaPipelineTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/models/SedaPipelineTestCase.jav0000644000175000017500000000136610674006563033507 0ustar charlescharles/* * $Id: SedaPipelineTestCase.java 8476 2007-09-18 17:40:03Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.models; public class SedaPipelineTestCase extends AbstractPipelineTestCase { protected String getConfigResources() { return "org/mule/test/integration/models/seda-pipeline-test-config.xml," + "org/mule/test/integration/models/pipeline-test-config.xml"; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/models/DirectPipelineTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/models/DirectPipelineTestCase.j0000644000175000017500000000137410674006563033515 0ustar charlescharles/* * $Id: DirectPipelineTestCase.java 8476 2007-09-18 17:40:03Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.models; public class DirectPipelineTestCase extends AbstractPipelineTestCase { protected String getConfigResources() { return "org/mule/test/integration/models/direct-pipeline-test-config.xml," + "org/mule/test/integration/models/pipeline-test-config.xml"; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/models/AbstractPipelineTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/models/AbstractPipelineTestCase0000644000175000017500000000447110754375733033626 0ustar charlescharles/* * $Id: AbstractPipelineTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.models; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public abstract class AbstractPipelineTestCase extends FunctionalTestCase { protected int getNumberOfMessages() { return 100; } public void testPipelineSynchronous() throws Exception { MuleClient client = new MuleClient(); List results = new ArrayList(); for (int i = 0; i < getNumberOfMessages(); i++) { MuleMessage result = client.send("component1.endpoint", "test", null); assertNotNull(result); results.add(result); } assertEquals(results.size(), getNumberOfMessages()); for (Iterator iterator = results.iterator(); iterator.hasNext();) { MuleMessage umoMessage = (MuleMessage)iterator.next(); assertEquals("request received by service 3", umoMessage.getPayloadAsString()); } } public void testPipelineAsynchronous() throws Exception { MuleClient client = new MuleClient(); List results = new ArrayList(); for (int i = 0; i < getNumberOfMessages(); i++) { client.dispatch("component1.endpoint", "test", null); } for (int i = 0; i < getNumberOfMessages(); i++) { MuleMessage result = client.request("results.endpoint", 1000); assertNotNull(result); results.add(result); } assertEquals(results.size(), getNumberOfMessages()); for (Iterator iterator = results.iterator(); iterator.hasNext();) { MuleMessage umoMessage = (MuleMessage)iterator.next(); assertEquals("request received by service 3", umoMessage.getPayloadAsString()); } } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transformer/0000755000175000017500000000000011351411050030040 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transformer/response/0000755000175000017500000000000011351411050031676 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transformer/response/Binding.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transformer/response/Binding.ja0000644000175000017500000000244010754403514033600 0ustar charlescharles///* // * $Id: Binding.java 10790 2008-02-12 20:53:32Z dfeist $ // * -------------------------------------------------------------------------------------- // * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com // * // * The software in this package is published under the terms of the CPAL v1.0 // * license, a copy of which has been included with this distribution in the // * LICENSE.txt file. // */ //package org.mule.test.integration.transformer.response; // //public class Binding implements BindingInterface //{ // // private String hello1; // private String hello2; // private String hello3; // private String hello4; // private String hello5; // private String hello6; // // public void hello1(String s) // { // hello1 = s; // } // // public void hello2(String s) // { // hello2 = s; // } // // public void hello3(String s) // { // hello3 = s; // } // // public void hello4(String s) // { // hello4 = s; // } // // public void hello5(String s) // { // hello5 = s; // } // // public void hello6(String s) // { // hello6 = s; // } // // public String getMessage() // { // return hello1 + hello2 + hello3 + hello4 + hello5 + hello6; // } // //} ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transformer/response/BindingInterface.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transformer/response/BindingInt0000644000175000017500000000120010754403514033653 0ustar charlescharles/* * $Id: BindingInterface.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transformer.response; public interface BindingInterface { String hello1(String s); String hello2(String s); String hello3(String s); String hello4(String s); } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transformer/response/NestedRouterComponent.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transformer/response/NestedRout0000644000175000017500000000164110754403514033733 0ustar charlescharles/* * $Id: NestedRouterComponent.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transformer.response; public class NestedRouterComponent { BindingInterface binding; public String invoke(String s) { s = binding.hello1(s); s = binding.hello2(s); // s = binding.hello3(s); // s = binding.hello4(s); return s; } public void setBinding(BindingInterface binding) { this.binding = binding; } public BindingInterface getBinding() { return binding; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/MuleEndpointConfigurationTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/MuleEndpointConfigurationTestCa0000644000175000017500000002060010766204322033671 0ustar charlescharles/* * $Id: MuleEndpointConfigurationTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.OutboundRouter; import org.mule.api.routing.OutboundRouterCollection; import org.mule.api.service.Service; import org.mule.module.xml.transformer.ObjectToXml; import org.mule.tck.FunctionalTestCase; import org.mule.tck.MuleTestUtils; import org.mule.transport.tcp.TcpConnector; import org.mule.transport.vm.VMConnector; /** * Test the creation of various endpoints from the service descriptor */ public class MuleEndpointConfigurationTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/test-endpoints-config.xml"; } public void testComponent3RouterEndpoints() throws Exception { // test inbound Service service = muleContext.getRegistry().lookupService("TestComponent3"); assertNotNull(service); OutboundRouterCollection outboundRouter = service.getOutboundRouter(); assertNotNull(outboundRouter); assertEquals(2, outboundRouter.getRouters().size()); // first Router OutboundRouter router1 = (OutboundRouter)outboundRouter.getRouters().get(0); assertEquals(1, router1.getEndpoints().size()); ImmutableEndpoint endpoint = (ImmutableEndpoint)router1.getEndpoints().get(0); assertEquals("tcp", endpoint.getConnector().getProtocol().toLowerCase()); assertEquals("tcp://localhost:60201", endpoint.getEndpointURI().getAddress()); // cannot get this to work and get axis tests to work // (axis seems to use undefined transformers in some strange way) // assertTrue(TransformerUtils.isDefined(endpoint.getTransformers())); // assertTrue(provider.getTransformer() instanceof ObjectToFileMessage); assertTrue(endpoint instanceof OutboundEndpoint); // second Router OutboundRouter router2 = (OutboundRouter)outboundRouter.getRouters().get(1); assertEquals(2, router2.getEndpoints().size()); endpoint = (ImmutableEndpoint)router2.getEndpoints().get(0); assertEquals("udp", endpoint.getConnector().getProtocol().toLowerCase()); assertEquals("udp://localhost:56731", endpoint.getEndpointURI().getAddress()); // cannot get this to work and get axis tests to work // (axis seems to use undefined transformers in some strange way) // assertTrue(TransformerUtils.isDefined(endpoint.getTransformers())); assertTrue(endpoint instanceof OutboundEndpoint); endpoint = (ImmutableEndpoint)router2.getEndpoints().get(1); assertEquals("test", endpoint.getConnector().getProtocol().toLowerCase()); assertEquals("test.queue2", endpoint.getEndpointURI().getAddress()); assertFalse(endpoint.getTransformers().isEmpty()); assertTrue(endpoint instanceof OutboundEndpoint); } public void testComponent4Endpoints() throws Exception { // test inbound Service service = muleContext.getRegistry().lookupService("TestComponent4"); assertNotNull(service); assertNotNull(service.getInboundRouter().getEndpoints()); assertEquals(1, service.getInboundRouter().getEndpoints().size()); ImmutableEndpoint endpoint = (ImmutableEndpoint)service.getInboundRouter().getEndpoints().get(0); assertNotNull(endpoint); assertEquals(VMConnector.VM, endpoint.getConnector().getProtocol().toLowerCase()); assertEquals("queue4", endpoint.getEndpointURI().getAddress()); assertFalse(endpoint.getTransformers().isEmpty()); assertTrue(endpoint.getTransformers().get(0) instanceof ObjectToXml); assertTrue(endpoint instanceof InboundEndpoint); } public void testComponent4RouterEndpoints() throws Exception { // test inbound Service service = muleContext.getRegistry().lookupService("TestComponent4"); assertNotNull(service); OutboundRouterCollection outboundRouter = service.getOutboundRouter(); assertNotNull(outboundRouter); assertEquals(1, outboundRouter.getRouters().size()); // first Router OutboundRouter router = (OutboundRouter)outboundRouter.getRouters().get(0); assertEquals(2, router.getEndpoints().size()); ImmutableEndpoint endpoint = (ImmutableEndpoint)router.getEndpoints().get(0); assertEquals("udp", endpoint.getConnector().getProtocol().toLowerCase()); assertEquals("udp://localhost:56731", endpoint.getEndpointURI().getAddress()); // cannot get this to work and get axis tests to work // (axis seems to use undefined transformers in some strange way) // assertTrue(TransformerUtils.isDefined(endpoint.getTransformers())); assertTrue(endpoint instanceof OutboundEndpoint); endpoint = (ImmutableEndpoint)router.getEndpoints().get(1); assertEquals(VMConnector.VM, endpoint.getConnector().getProtocol().toLowerCase()); assertEquals("yet.another.queue", endpoint.getEndpointURI().getAddress()); assertFalse(endpoint.getTransformers().isEmpty()); assertTrue(endpoint.getTransformers().get(0) instanceof ObjectToXml); assertTrue(endpoint instanceof OutboundEndpoint); } public void testComponent5RouterEndpoints() throws Exception { // test inbound Service service = muleContext.getRegistry().lookupService("TestComponent5"); assertNotNull(service); OutboundRouterCollection outboundRouter = service.getOutboundRouter(); assertNotNull(outboundRouter); assertEquals(1, outboundRouter.getRouters().size()); // first Router OutboundRouter router = (OutboundRouter)outboundRouter.getRouters().get(0); assertEquals(2, router.getEndpoints().size()); ImmutableEndpoint endpoint = (ImmutableEndpoint)router.getEndpoints().get(0); assertEquals(TcpConnector.TCP, endpoint.getConnector().getProtocol().toLowerCase()); assertEquals("tcp://localhost:45431", endpoint.getEndpointURI().getAddress()); // cannot get this to work and get axis tests to work // (axis seems to use undefined transformers in some strange way) // assertTrue(TransformerUtils.isDefined(endpoint.getTransformers())); assertTrue(endpoint instanceof OutboundEndpoint); endpoint = (ImmutableEndpoint)router.getEndpoints().get(1); assertEquals(TcpConnector.TCP, endpoint.getConnector().getProtocol().toLowerCase()); assertEquals("tcp://localhost:45432", endpoint.getEndpointURI().getAddress()); // cannot get this to work and get axis tests to work // (axis seems to use undefined transformers in some strange way) // assertTrue(TransformerUtils.isDefined(endpoint.getTransformers())); assertTrue(endpoint instanceof OutboundEndpoint); } public void testEndpointFromURI() throws Exception { ImmutableEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "test://hello?remoteSync=true&remoteSyncTimeout=2002&connector=testConnector1"); assertTrue(ep.isRemoteSync()); assertEquals(2002, ep.getRemoteSyncTimeout()); assertTrue(ep instanceof InboundEndpoint); // Test MuleEvent timeout proporgation MuleEvent event = new DefaultMuleEvent(new DefaultMuleMessage("hello"), ep, MuleTestUtils.getTestSession(muleContext), false); assertEquals(2002, event.getTimeout()); ImmutableEndpoint ep2 = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "test://hello?connector=testConnector1"); event = new DefaultMuleEvent(new DefaultMuleMessage("hello"), ep2, MuleTestUtils.getTestSession(muleContext), true); // default event timeout set in the test config file assertEquals(1001, event.getTimeout()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/0000755000175000017500000000000011351411047027530 5ustar charlescharles././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/NoArgsEntryPointResolverTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/NoArgsEntryPointResol0000644000175000017500000000170210744121360033706 0ustar charlescharles/* * $Id: NoArgsEntryPointResolverTestCase.java 10386 2008-01-18 13:00:32Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.resolvers; public class NoArgsEntryPointResolverTestCase extends AbstractEntryPointResolverTestCase { protected String getConfigResources() { return "org/mule/test/integration/resolvers/no-args-entry-point-resolver-test.xml"; } public void testIgnored() throws Exception { doTest("not-ignored", new Object(), "notIgnored"); } public void testSelected() throws Exception { doTest("selected", new Object(), "selected"); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/EntryPointResolverTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/EntryPointResolverTes0000644000175000017500000000662210777503705034010 0ustar charlescharles/* * $Id: EntryPointResolverTestCase.java 11560 2008-04-10 21:33:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.resolvers; import java.util.HashMap; import java.util.Map; public class EntryPointResolverTestCase extends AbstractEntryPointResolverTestCase { protected String getConfigResources() { return "org/mule/test/integration/resolvers/entry-point-resolver-test.xml"; } public void testArrayEntryPointResolverOnModel() throws Exception { doTest("array", new String[]{"hello", "world"}, "array"); } public void testArrayEntryPointResolverOnComponent() throws Exception { doTest("array2", new String[]{"hello", "world"}, "array"); } public void testCallableEntryPointResolverOnModel() throws Exception { doTest("callable", new Object(), "callable"); } public void testCallableEntryPointResolverOnComponent() throws Exception { doTest("callable2", new Object(), "callable"); } public void testCustomEntryPointResolverOnModel() throws Exception { doTest("custom", new Object(), "custom"); } public void testCustomEntryPointResolverOnComponent() throws Exception { doTest("custom2", new Object(), "custom"); } public void testMethodEntryPointResolverOnModel() throws Exception { doTest("method", new String(), "methodString"); doTest("method", new Integer(0), "methodInteger"); } public void testMethodEntryPointResolverOnComponent() throws Exception { doTest("method2", new String(), "methodString"); doTest("method2", new Integer(0), "methodInteger"); } public void testNoArgumentsEntryPointResolverOnModel() throws Exception { doTest("no-arguments", new String(), "noArguments"); } public void testNoArgumentsEntryPointResolverOnComponent() throws Exception { doTest("no-arguments2", new String(), "noArguments"); } public void testPropertyEntryPointResolverOnModel() throws Exception { Map properties = new HashMap(); properties.put("propertyName", "property"); doTest("property", new Object(), "property", properties); } public void testPropertyEntryPointResolverOnComponent() throws Exception { Map properties = new HashMap(); properties.put("propertyName", "property"); doTest("property2", new Object(), "property", properties); } public void testReflectionEntryPointResolverOnModel() throws Exception { doTest("reflection", new Object[]{new Integer(0), new String("String")}, "reflection"); } public void testReflectionEntryPointResolverOnComponent() throws Exception { doTest("reflection2", new Object[]{new Integer(0), new String("String")}, "reflection"); } public void testLegacyEntryPointResolversOnModel() throws Exception { doTest("legacy", "hello world", "callable"); } public void testLegacyEntryPointResolversOnComponent() throws Exception { doTest("legacy2", "hello world", "callable"); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/AbstractEntryPointResolverTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/AbstractEntryPointRes0000644000175000017500000000221510754375733033745 0ustar charlescharles/* * $Id: AbstractEntryPointResolverTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.resolvers; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.Map; public abstract class AbstractEntryPointResolverTestCase extends FunctionalTestCase { protected void doTest(String path, Object payload, String result) throws Exception { doTest(path, payload, result, null); } protected void doTest(String path, Object payload, String result, Map properties) throws Exception { MuleClient client = new MuleClient(); MuleMessage response = client.send("vm://" + path, payload, properties); assertEquals(result, response.getPayloadAsString()); } }././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/MethodEntrypointsTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/MethodEntrypointsTest0000644000175000017500000000447210754375733034042 0ustar charlescharles/* * $Id: MethodEntrypointsTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.resolvers; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.model.resolvers.EntryPointNotFoundException; import org.mule.tck.FunctionalTestCase; public class MethodEntrypointsTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/resolvers/method-entrypoints-config.xml"; } public void testTooManySatifiableMethods() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://service", "hello", null); assertNotNull(message.getExceptionPayload()); assertTrue(message.getExceptionPayload().getException().getCause() instanceof EntryPointNotFoundException); assertTrue(message.getExceptionPayload().getException().getCause().getMessage().indexOf("Found too many possible methods on object") > -1); } public void testBadMethodName() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://service?method=foo", "hello", null); assertNotNull(message.getExceptionPayload()); assertTrue(message.getExceptionPayload().getException().getCause() instanceof EntryPointNotFoundException); } public void testValidCallToReverse() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://service?method=reverseString", "hello", null); assertNotNull(message); assertEquals(message.getPayloadAsString(), "olleh"); } public void testValidCallToUpperCase() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://service?method=upperCaseString", "hello", null); assertNotNull(message); assertEquals(message.getPayloadAsString(), "HELLO"); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/Target.java0000644000175000017500000000253710777503705031646 0ustar charlescharles/* * $Id: Target.java 11560 2008-04-10 21:33:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.resolvers; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; public class Target implements Callable { public String array(String[] array) { return "array"; } public String object(Object object) { return "object"; } public Object onCall(MuleEventContext eventContext) throws Exception { return "callable"; } public String custom(Object object) { return "custom"; } public String methodString(String string) { return "methodString"; } public String methodInteger(Integer integer) { return "methodInteger"; } public String noArguments() { return "noArguments"; } public String property(Object object) { return "property"; } public String reflection(Integer integer, String string) { return "reflection"; } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/NoArgsTarget.java0000644000175000017500000000130110744121360032727 0ustar charlescharles/* * $Id: NoArgsTarget.java 10386 2008-01-18 13:00:32Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.resolvers; public class NoArgsTarget { public String notIgnored() { return "notIgnored"; } public String unused() { return "unused"; } public String selected() { return "selected"; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/CustomEntryPointResolver.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/resolvers/CustomEntryPointResol0000644000175000017500000000173110745677442034013 0ustar charlescharles/* * $Id: CustomEntryPointResolver.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.resolvers; import org.mule.api.MuleEventContext; import org.mule.api.model.EntryPointResolver; import org.mule.api.model.InvocationResult; public class CustomEntryPointResolver implements EntryPointResolver { public InvocationResult invoke(Object component, MuleEventContext context) throws Exception { return new InvocationResult( ((Target) component).custom(context.getMessage().getPayload()), Target.class.getMethod("custom", new Class[]{Object.class})); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/management/0000755000175000017500000000000011351411050027612 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/management/ManagementStartupTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/management/ManagementStartupTes0000644000175000017500000000246110764101307033663 0ustar charlescharles/* * $Id: ManagementStartupTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.management; import org.mule.api.MuleException; import org.mule.module.management.agent.JmxAgent; import org.mule.tck.FunctionalTestCase; public class ManagementStartupTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/management/management-startup-test.xml"; } public void testAgentConfiguration() throws MuleException { JmxAgent agent = (JmxAgent)muleContext.getRegistry().lookupAgent("jmx-server"); assertNotNull(agent); assertNotNull(agent.getConnectorServerUrl()); assertEquals("service:jmx:rmi:///jndi/rmi://0.0.0.0:1100/server", agent.getConnectorServerUrl()); assertNotNull(agent.getConnectorServerProperties()); assertEquals("true", agent.getConnectorServerProperties().get("jmx.remote.jndi.rebind")); } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/management/ManagementSimpleStartupTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/management/ManagementSimpleStar0000644000175000017500000000247310764101307033633 0ustar charlescharles/* * $Id: ManagementSimpleStartupTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.management; import org.mule.api.MuleException; import org.mule.module.management.agent.DefaultJmxSupportAgent; import org.mule.tck.FunctionalTestCase; public class ManagementSimpleStartupTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/management/management-simple-startup-test.xml"; } public void testAgentConfiguration() throws MuleException { DefaultJmxSupportAgent agent = (DefaultJmxSupportAgent) muleContext.getRegistry().lookupAgent("jmx-default-config"); assertNotNull(agent); // these values are different from DEFAULT_HOST and DEFAULT_PORT in agent assertNotNull(agent.getHost()); assertEquals("0.0.0.0", agent.getHost()); assertNotNull(agent.getPort()); assertEquals("1100", agent.getPort()); } }mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/0000755000175000017500000000000011351411051026755 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientRemotingTcpTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientRemotingTcpTes0000644000175000017500000000161510754110316033602 0ustar charlescharles/* * $Id: MuleClientRemotingTcpTestCase.java 10776 2008-02-11 18:15:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; public class MuleClientRemotingTcpTestCase extends AbstractClientRemotingTestCase { protected String getConfigResources() { return "org/mule/test/integration/client/client-remote-dispatcher-common-config.xml, " + "org/mule/test/integration/client/test-client-mule-config-remote-tcp.xml"; } public String getRemoteEndpointUri() { return "tcp://localhost:60504"; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientTransactionTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientTransactionTes0000644000175000017500000002013510754375733033652 0ustar charlescharles/* * $Id: MuleClientTransactionTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionCallback; import org.mule.api.transaction.TransactionConfig; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transaction.MuleTransactionConfig; import org.mule.transaction.TransactionCoordination; import org.mule.transaction.TransactionTemplate; import org.mule.transport.jms.JmsTransactionFactory; import java.util.HashMap; import java.util.Map; public class MuleClientTransactionTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/client/test-client-jms-mule-config.xml"; } public void testTransactionsWithSetRollbackOnly() throws Exception { final MuleClient client = new MuleClient(); final Map props = new HashMap(); props.put("JMSReplyTo", "replyTo.queue"); props.put(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, "false"); // Empty reply queue while (client.request("jms://replyTo.queue", 2000) != null) { // slurp } MuleTransactionConfig tc = new MuleTransactionConfig(); tc.setFactory(new JmsTransactionFactory()); tc.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN); // This enpoint needs to be registered prior to use cause we need to set // the transaction config so that the endpoint will "know" it is transacted // and not close the session itself but leave it up to the transaction. EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("jms://test.queue", muleContext); endpointBuilder.setTransactionConfig(tc); endpointBuilder.setName("TransactedTest.Queue"); ImmutableEndpoint inboundEndpoint = muleContext.getRegistry() .lookupEndpointFactory() .getOutboundEndpoint(endpointBuilder); client.getMuleContext().getRegistry().registerEndpoint(inboundEndpoint); TransactionTemplate tt = new TransactionTemplate(tc, null, muleContext); tt.execute(new TransactionCallback() { public Object doInTransaction() throws Exception { for (int i = 0; i < 100; i++) { client.send("TransactedTest.Queue", "Test Client Dispatch message " + i, props); } Transaction tx = TransactionCoordination.getInstance().getTransaction(); assertNotNull(tx); tx.setRollbackOnly(); return null; } }); MuleMessage result = client.request("jms://replyTo.queue", 2000); assertNull(result); } public void testTransactionsWithExceptionThrown() throws Exception { final MuleClient client = new MuleClient(); final Map props = new HashMap(); props.put("JMSReplyTo", "replyTo.queue"); props.put(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, "false"); // Empty reply queue while (client.request("jms://replyTo.queue", 2000) != null) { // hmm..mesages } MuleTransactionConfig tc = new MuleTransactionConfig(); tc.setFactory(new JmsTransactionFactory()); tc.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN); // This enpoint needs to be registered prior to use cause we need to set // the transaction config so that the endpoint will "know" it is transacted // and not close the session itself but leave it up to the transaction. EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("jms://test.queue", muleContext); endpointBuilder.setTransactionConfig(tc); endpointBuilder.setName("TransactedTest.Queue"); ImmutableEndpoint inboundEndpoint = muleContext.getRegistry() .lookupEndpointFactory() .getOutboundEndpoint(endpointBuilder); client.getMuleContext().getRegistry().registerEndpoint(inboundEndpoint); TransactionTemplate tt = new TransactionTemplate(tc, null, muleContext); try { tt.execute(new TransactionCallback() { public Object doInTransaction() throws Exception { for (int i = 0; i < 100; i++) { client.send("TransactedTest.Queue", "Test Client Dispatch message " + i, props); } throw new Exception(); } }); fail(); } catch (Exception e) { // this is ok } MuleMessage result = client.request("jms://replyTo.queue", 2000); assertNull(result); } public void testTransactionsWithCommit() throws Exception { final MuleClient client = new MuleClient(); final Map props = new HashMap(); props.put("JMSReplyTo", "replyTo.queue"); props.put(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, "false"); props.put("transacted", "true"); // Empty reply queue while (client.request("jms://replyTo.queue", 2000) != null) { // yum! } MuleTransactionConfig tc = new MuleTransactionConfig(); tc.setFactory(new JmsTransactionFactory()); tc.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN); // This enpoint needs to be registered prior to use cause we need to set // the transaction config so that the endpoint will "know" it is transacted // and not close the session itself but leave it up to the transaction. EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("jms://test.queue", muleContext); endpointBuilder.setTransactionConfig(tc); endpointBuilder.setName("TransactedTest.Queue"); ImmutableEndpoint inboundEndpoint = muleContext.getRegistry() .lookupEndpointFactory() .getOutboundEndpoint(endpointBuilder); client.getMuleContext().getRegistry().registerEndpoint(inboundEndpoint); TransactionTemplate tt = new TransactionTemplate(tc, null, muleContext); tt.execute(new TransactionCallback() { public Object doInTransaction() throws Exception { for (int i = 0; i < 100; i++) { client.send("TransactedTest.Queue", "Test Client Dispatch message " + i, props); } return null; } }); for (int i = 0; i < 100; i++) { MuleMessage result = client.request("jms://replyTo.queue", 2000); assertNotNull(result); } MuleMessage result = client.request("jms://replyTo.queue", 2000); assertNull(result); } protected void emptyReplyQueue() throws Exception { final MuleClient client = new MuleClient(); MuleTransactionConfig tc = new MuleTransactionConfig(); tc.setFactory(new JmsTransactionFactory()); tc.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN); TransactionTemplate tt = new TransactionTemplate(tc, null, muleContext); tt.execute(new TransactionCallback() { public Object doInTransaction() throws Exception { while (client.request("jms://replyTo.queue", 2000) != null) { // munch.. } return null; } }); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientWsdlSoapExternalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientWsdlSoapExtern0000644000175000017500000000637510754375733033645 0ustar charlescharles/* * $Id: MuleClientWsdlSoapExternalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.ExceptionUtils; import org.mule.util.StringUtils; public class MuleClientWsdlSoapExternalTestCase extends AbstractMuleTestCase { public static final String WSDL_URL = "http://www.dataaccess.com/webservicesserver/conversions.wso?WSDL"; public static final String METHOD = "NumberToWords"; public static final String INPUT = "24"; public static final String OUTPUT = "twenty four"; public void testXFireWsdlRequestResponse() throws Throwable { if (isOffline("org.mule.test.integration.client.MuleClientXFireExternalTestCase.testRequestResponse()")) { return; } String url = "wsdl-xfire:" + WSDL_URL + "&method=" + METHOD; MuleMessage result = null; String resultPayload = StringUtils.EMPTY; try { MuleClient client = new MuleClient(); result = client.send(url, INPUT, null); resultPayload = (result != null ? result.getPayloadAsString() : StringUtils.EMPTY); } catch (MuleException e) { fail(ExceptionUtils.getStackTrace(e)); } assertNotNull(result); assertEquals(OUTPUT, resultPayload); } // This doesn't work as Axis WSDL parser doesn't grab the param names from the // schema for some reason... // public void testAxisWsdlRequestResponseAuto() throws Throwable { // if // (isOffline("org.mule.test.integration.client.MuleClientXFireExternalTestCase.testAxisWsdlRequestResponse()")) // return; // Map properties = new HashMap(); // //properties.put(AxisConnector.SOAP_ACTION_PROPERTY, // "${methodNamespace}#${method}"); // //properties.put(AxisConnector.METHOD_NAMESPACE_PROPERTY, // "urn:xmethods-delayed-quotes"); // // properties.put("style", "document"); // properties.put("use", "literal"); // String url = "wsdl-axis:" + WSDL_URL + "&method=" + METHOD; // MuleClient client = null; // client = new MuleClient(); // MuleMessage result = client.send(url, INPUT, properties); // assertNotNull(result); // assertEquals(OUTPUT, result.getPayload()); // } public void testDiscoveryWsdlRequestResponse() throws Throwable { if (isOffline("org.mule.test.integration.client.MuleClientXFireExternalTestCase.testDiscoveryWsdlRequestResponse()")) { return; } String url = "wsdl:" + WSDL_URL + "&method=" + METHOD; MuleClient client; client = new MuleClient(); MuleMessage result = client.send(url, INPUT, null); assertNotNull(result); assertEquals(OUTPUT, result.getPayload()); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientListenerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientListenerTestCa0000644000175000017500000000512310754375733033602 0ustar charlescharles/* * $Id: MuleClientListenerTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.api.MuleMessage; import org.mule.api.service.Service; import org.mule.api.transport.NoReceiverForEndpointException; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class MuleClientListenerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/client/mule-client-listener-config.xml"; } public void doTestRegisterListener(String component, String endpoint, boolean canSendWithoutReceiver) throws Exception { MuleClient client = new MuleClient(); if (!canSendWithoutReceiver) { try { client.send(endpoint, "Test Client Send message", null); fail("There is no receiver for this endpointUri"); } catch (Exception e) { assertTrue(e.getCause() instanceof NoReceiverForEndpointException); } } Service c = muleContext.getRegistry().lookupService(component); c.start(); MuleMessage message = client.send(endpoint, "Test Client Send message", null); assertNotNull(message); assertEquals("Received: Test Client Send message", message.getPayloadAsString()); // The SpringRegistry is read-only so we can't unregister the service! //muleContext.getRegistry().unregisterComponent("vmComponent"); c.stop(); if (!canSendWithoutReceiver) { try { message = client.send(endpoint, "Test Client Send message", null); fail("There is no receiver for this endpointUri"); } catch (Exception e) { assertTrue(e.getCause() instanceof NoReceiverForEndpointException); } } } public void testRegisterListenerVm() throws Exception { doTestRegisterListener("vmComponent", "vm://test.queue", false); } public void testRegisterListenerTcp() throws Exception { doTestRegisterListener("tcpComponent", "tcp://localhost:56324", true); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/RemoteDispatcherTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/RemoteDispatcherTestCase0000644000175000017500000000246410757057407033630 0ustar charlescharles/* * $Id: RemoteDispatcherTestCase.java 10917 2008-02-20 17:10:31Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.module.client.remoting.RemoteDispatcherAgent; import org.mule.tck.FunctionalTestCase; import org.mule.transformer.wire.SerializedMuleMessageWireFormat; public class RemoteDispatcherTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/client/mule-remote-dispatcher-agent.xml"; } public void testNonEmptyProperties() throws Exception { RemoteDispatcherAgent agent = (RemoteDispatcherAgent) muleContext.getRegistry().lookupAgent("remote-dispatcher-agent"); assertNotNull(agent.getEndpoint()); assertEquals("test://localhost:50608",agent.getEndpoint().getEndpointURI().getUri().toString()); assertNotNull(agent.getWireFormat()); assertTrue(agent.getWireFormat() instanceof SerializedMuleMessageWireFormat); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientJmsTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientJmsTestCase.ja0000644000175000017500000001005010766637211033455 0ustar charlescharles/* * $Id: MuleClientJmsTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jms.JmsConstants; import java.util.HashMap; import java.util.Map; public class MuleClientJmsTestCase extends FunctionalTestCase { public static final int INTERATIONS = 1; protected String getConfigResources() { return "org/mule/test/integration/client/test-client-jms-mule-config.xml"; } public void testClientSendDirect() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.sendDirect("TestReceiverUMO", null, "Test Client Send message", null); assertNotNull(message); assertEquals("Received: Test Client Send message", message.getPayload()); } public void testClientDispatchDirect() throws Exception { MuleClient client = new MuleClient(); client.dispatchDirect("TestReceiverUMO", "Test Client dispatch message", null); } public void testClientSend() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send(getDispatchUrl(), "Test Client Send message", null); assertNotNull(message); assertEquals("Received: Test Client Send message", message.getPayload()); } public void testClientMultiSend() throws Exception { MuleClient client = new MuleClient(); for (int i = 0; i < INTERATIONS; i++) { MuleMessage message = client.send(getDispatchUrl(), "Test Client Send message " + i, null); assertNotNull(message); assertEquals("Received: Test Client Send message " + i, message.getPayload()); } } public void testClientMultiDispatch() throws Exception { MuleClient client = new MuleClient(); int i = 0; // to init client.dispatch(getDispatchUrl(), "Test Client Send message " + i, null); long start = System.currentTimeMillis(); for (i = 0; i < INTERATIONS; i++) { client.dispatch(getDispatchUrl(), "Test Client Send message " + i, null); } long time = System.currentTimeMillis() - start; logger.debug(i + " took " + time + "ms to process"); Thread.sleep(1000); } public void testClientDispatchAndReceiveOnReplyTo() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); props.put(JmsConstants.JMS_REPLY_TO, "replyTo.queue"); long start = System.currentTimeMillis(); int i = 0; for (i = 0; i < INTERATIONS; i++) { logger.debug("Sending message " + i); client.dispatch(getDispatchUrl(), "Test Client Dispatch message " + i, props); } long time = System.currentTimeMillis() - start; logger.debug("It took " + time + " ms to send " + i + " messages"); Thread.sleep(5000); start = System.currentTimeMillis(); for (i = 0; i < INTERATIONS; i++) { MuleMessage message = client.request("jms://replyTo.queue", 5000); assertNotNull("message should not be null from Reply queue", message); logger.debug("Count is " + i); logger.debug("ReplyTo Message is: " + message.getPayloadAsString()); assertTrue(message.getPayloadAsString().startsWith("Received")); } time = System.currentTimeMillis() - start; logger.debug("It took " + time + "ms to receive " + i + " messages"); } public String getDispatchUrl() { return "jms://test.queue"; } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientTestCase.java0000644000175000017500000000574010766637211033344 0ustar charlescharles/* * $Id: MuleClientTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class MuleClientTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/client/test-client-mule-config.xml"; } public void testClientSendDirect() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.sendDirect("TestReceiverUMO", null, "Test Client Send message", null); assertNotNull(message); assertEquals("Test Client Send message Received", message.getPayload()); } public void testClientDispatchDirect() throws Exception { MuleClient client = new MuleClient(); client.dispatchDirect("TestReceiverUMO", "Test Client dispatch message", null); } public void testClientSendGlobalEndpoint() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vmEndpoint", "Test Client Send message", null); assertNotNull(message); assertEquals("Test Client Send message Received", message.getPayload()); } public void testClientSend() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send(getDispatchUrl(), "Test Client Send message", null); assertNotNull(message); assertEquals("Test Client Send message Received", message.getPayload()); } public void testClientMultiSend() throws Exception { MuleClient client = new MuleClient(); for (int i = 0; i < 100; i++) { MuleMessage message = client.send(getDispatchUrl(), "Test Client Send message " + i, null); assertNotNull(message); assertEquals("Test Client Send message " + i + " Received", message.getPayload()); } } public void testClientMultidispatch() throws Exception { MuleClient client = new MuleClient(); int i = 0; // to init client.dispatch(getDispatchUrl(), "Test Client Send message " + i, null); long start = System.currentTimeMillis(); for (i = 0; i < 100; i++) { client.dispatch(getDispatchUrl(), "Test Client Send message " + i, null); } long time = System.currentTimeMillis() - start; logger.debug(i + " took " + time + "ms to process"); Thread.sleep(1000); } public String getDispatchUrl() { return "vm://test.queue"; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientAxisTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientAxisTestCase.j0000644000175000017500000000652010754403514033470 0ustar charlescharles/* * $Id: MuleClientAxisTestCase.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.services.Person; public class MuleClientAxisTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/client/axis-client-test-mule-config.xml"; } public void testRequestResponse() throws Throwable { MuleClient client = new MuleClient(); MuleMessage result = client.send("axis:http://localhost:38104/mule/services/mycomponent2?method=echo", "test", null); assertNotNull(result); assertEquals("test", result.getPayloadAsString()); } public void testRequestResponseComplex() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send( "axis:http://localhost:38104/mule/services/mycomponent3?method=getPerson", "Fred", null); assertNotNull(result); logger.debug(result.getPayload()); assertTrue(result.getPayload() instanceof Person); assertEquals("Fred", ((Person)result.getPayload()).getFirstName()); assertEquals("Flintstone", ((Person)result.getPayload()).getLastName()); } public void testRequestResponseComplex2() throws Exception { MuleClient client = new MuleClient(); String[] args = new String[]{"Betty", "Rubble"}; MuleMessage result = client.send( "axis:http://localhost:38104/mule/services/mycomponent3?method=addPerson", args, null); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Betty", ((Person)result.getPayload()).getFirstName()); assertEquals("Rubble", ((Person)result.getPayload()).getLastName()); // do a receive result = client.send("axis:http://localhost:38104/mule/services/mycomponent3?method=getPerson", "Betty", null); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Betty", ((Person)result.getPayload()).getFirstName()); assertEquals("Rubble", ((Person)result.getPayload()).getLastName()); } public void testRequestWithComplexArg() throws Exception { MuleClient client = new MuleClient(); Person person = new Person("Joe", "Blow"); String uri = "axis:http://localhost:38104/mule/services/mycomponent3?method=addPerson"; client.send(uri, person, null); uri = "axis:http://localhost:38104/mule/services/mycomponent3?method=getPerson"; MuleMessage result = client.send(uri, "Joe", null); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Joe", ((Person)result.getPayload()).getFirstName()); assertEquals("Blow", ((Person)result.getPayload()).getLastName()); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/RemoteDispatcherAgentConfigTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/RemoteDispatcherAgentCon0000644000175000017500000000244310757057407033610 0ustar charlescharles/* * $Id: RemoteDispatcherAgentConfigTestCase.java 10917 2008-02-20 17:10:31Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.module.client.remoting.RemoteDispatcherAgent; import org.mule.tck.FunctionalTestCase; import org.mule.transformer.wire.TransformerPairWireFormat; public class RemoteDispatcherAgentConfigTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/client/mule-admin-agent.xml"; } public void testNonEmptyProperties() throws Exception { RemoteDispatcherAgent agent = (RemoteDispatcherAgent) muleContext.getRegistry().lookupAgent("remote-dispatcher-agent"); assertNotNull(agent.getEndpoint()); assertEquals("test://12345",agent.getEndpoint().getEndpointURI().toString()); assertNotNull(agent.getWireFormat()); assertTrue(agent.getWireFormat() instanceof TransformerPairWireFormat); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/AbstractClientRemotingTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/AbstractClientRemotingTe0000644000175000017500000000550510766637211033626 0ustar charlescharles/* * $Id: AbstractClientRemotingTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.module.client.RemoteDispatcher; import org.mule.tck.FunctionalTestCase; public abstract class AbstractClientRemotingTestCase extends FunctionalTestCase { public abstract String getRemoteEndpointUri(); public void testClientSendToRemoteComponent() throws Exception { // Will connect to the server using remote endpoint MuleClient client = new MuleClient(); RemoteDispatcher dispatcher = client.getRemoteDispatcher(getRemoteEndpointUri()); MuleMessage message = dispatcher.sendToRemoteComponent("TestReceiverUMO", "Test Client Send message", null); assertNotNull(message); assertEquals("Test Client Send message Received", message.getPayload()); } public void testClientRequestResponseOnEndpoint() throws Exception { // Will connect to the server using tcp://localhost:60504 MuleClient client = new MuleClient(); RemoteDispatcher dispatcher = client.getRemoteDispatcher(getRemoteEndpointUri()); MuleMessage message = dispatcher.sendRemote("vm://remote.endpoint?connector=vmRemoteConnector", "foo", null); assertNotNull(message); assertEquals("received from remote component", message.getPayloadAsString()); } /** * A test that writes a message to a remote queue * * @throws Exception */ public void testClientSendAndReceiveRemote() throws Exception { String remoteEndpoint = "vm://remote.queue?connector=vmRemoteQueueConnector"; // Will connect to the server using The Server endpoint MuleClient client = new MuleClient(); RemoteDispatcher dispatcher = client.getRemoteDispatcher(getRemoteEndpointUri()); // Doubling timeout see MULE-3000 MuleMessage message = dispatcher.receiveRemote(remoteEndpoint, RECEIVE_TIMEOUT * 2); assertNull(message); // We do a send instead of a dispatch here so the operation is // synchronous thus eaiser to test dispatcher.sendRemote(remoteEndpoint, "Test Remote Message 2", null); // Doubling timeout see MULE-3000 message = dispatcher.receiveRemote(remoteEndpoint, RECEIVE_TIMEOUT * 2); assertNotNull(message); assertEquals("Test Remote Message 2", message.getPayload()); } }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientRemotingAxisTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientRemotingAxisTe0000644000175000017500000000705710767262171033616 0ustar charlescharles/* * $Id: MuleClientRemotingAxisTestCase.java 11377 2008-03-16 18:18:33Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.module.client.RemoteDispatcher; import org.mule.module.xml.transformer.wire.XStreamWireFormat; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.services.Person; public class MuleClientRemotingAxisTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/client/axis-client-test-mule-config.xml"; } public void testRequestResponse() throws Throwable { MuleClient client = new MuleClient(); RemoteDispatcher dispatcher = client.getRemoteDispatcher("remoteEndpoint"); try { MuleMessage result = dispatcher.sendRemote( "axis:http://localhost:38104/mule/services/mycomponent2?method=echo", "test", null); assertNotNull(result); assertEquals("test", result.getPayloadAsString()); } finally { client.dispose(); } } public void testRequestResponseComplex() throws Exception { MuleClient client = new MuleClient(); RemoteDispatcher dispatcher = client.getRemoteDispatcher("remoteEndpoint"); dispatcher.setWireFormat(new XStreamWireFormat()); try { MuleMessage result = dispatcher.sendRemote( "axis:http://localhost:38104/mule/services/mycomponent3?method=getPerson", "Fred", null); assertNotNull(result); logger.debug(result.getPayload()); assertTrue(result.getPayload() instanceof Person); assertEquals("Fred", ((Person)result.getPayload()).getFirstName()); assertEquals("Flintstone", ((Person)result.getPayload()).getLastName()); } finally { client.dispose(); } } public void testRequestResponseComplex2() throws Exception { MuleClient client = new MuleClient(); RemoteDispatcher dispatcher = client.getRemoteDispatcher("remoteEndpoint"); dispatcher.setWireFormat(new XStreamWireFormat()); try { String[] args = new String[]{"Betty", "Rubble"}; MuleMessage result = dispatcher.sendRemote( "axis:http://localhost:38104/mule/services/mycomponent3?method=addPerson", args, null); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Betty", ((Person)result.getPayload()).getFirstName()); assertEquals("Rubble", ((Person)result.getPayload()).getLastName()); // do a receive result = client.send("axis:http://localhost:38104/mule/services/mycomponent3?method=getPerson", "Betty", null); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Betty", ((Person)result.getPayload()).getFirstName()); assertEquals("Rubble", ((Person)result.getPayload()).getLastName()); } finally { client.dispose(); } } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientWSDLExternalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientWSDLExternalTe0000644000175000017500000000412110754375733033453 0ustar charlescharles/* * $Id: MuleClientWSDLExternalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.soap.SoapConstants; import org.mule.util.ExceptionUtils; import org.mule.util.StringUtils; import java.util.HashMap; import java.util.Map; public class MuleClientWSDLExternalTestCase extends AbstractMuleTestCase { public void testRequestResponse() throws Throwable { if (isOffline("org.mule.test.integration.client.MuleClientAxisExternalTestCase.testRequestResponse()")) { return; } String input = "IBM"; Map properties = new HashMap(); properties.put(SoapConstants.SOAP_ACTION_PROPERTY, "${methodNamespace}${method}"); properties.put(SoapConstants.METHOD_NAMESPACE_PROPERTY, "http://www.webserviceX.NET/"); String url = "wsdl:http://www.webservicex.net/stockquote.asmx?WSDL&method=GetQuote"; MuleMessage result = null; String resultPayload = StringUtils.EMPTY; try { MuleClient client = new MuleClient(); result = client.send(url, input, properties); resultPayload = (result != null ? result.getPayloadAsString() : StringUtils.EMPTY); } catch (MuleException e) { fail(ExceptionUtils.getStackTrace(e)); } if (result != null) { logger.debug("The quote for " + input + " is: " + result.getPayload()); } assertNotNull(result); assertTrue(resultPayload.startsWith("IBM")); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientRemotingJmsTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientRemotingJmsTes0000644000175000017500000000161410754110316033604 0ustar charlescharles/* * $Id: MuleClientRemotingJmsTestCase.java 10776 2008-02-11 18:15:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; public class MuleClientRemotingJmsTestCase extends AbstractClientRemotingTestCase { protected String getConfigResources() { return "org/mule/test/integration/client/client-remote-dispatcher-common-config.xml, " + "org/mule/test/integration/client/test-client-mule-config-remote-jms.xml"; } public String getRemoteEndpointUri() { return "jms://mule.sys.queue"; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientRemotingHttpTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/MuleClientRemotingHttpTe0000644000175000017500000000161610754110316033611 0ustar charlescharles/* * $Id: MuleClientRemotingHttpTestCase.java 10776 2008-02-11 18:15:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; public class MuleClientRemotingHttpTestCase extends AbstractClientRemotingTestCase { protected String getConfigResources() { return "org/mule/test/integration/client/client-remote-dispatcher-common-config.xml, " + "org/mule/test/integration/client/test-client-mule-config-remote-http.xml"; } public String getRemoteEndpointUri() { return "http://localhost:60504"; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/RemoteExceptionTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/client/RemoteExceptionTestCase.0000644000175000017500000000547710754375733033567 0ustar charlescharles/* * $Id: RemoteExceptionTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.client; import org.mule.api.ExceptionPayload; import org.mule.api.DefaultMuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.api.transformer.TransformerException; import org.mule.module.client.MuleClient; import org.mule.module.client.RemoteDispatcher; import org.mule.tck.FunctionalTestCase; import java.util.Date; public class RemoteExceptionTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/client/remote-exception-config.xml"; } public void testClientTransformerException() throws Exception { MuleClient client = new MuleClient(); RemoteDispatcher dispatcher = client.getRemoteDispatcher("tcp://localhost:5555"); MuleMessage result = dispatcher.sendRemote("vm://test.queue.1", new Date(), null); assertNotNull(result); ExceptionPayload exceptionPayload = result.getExceptionPayload(); assertNotNull(exceptionPayload); assertTrue(exceptionPayload.getException().getCause() instanceof TransformerException); assertTrue(exceptionPayload.getRootException() instanceof Exception); } public void testClientMalformedEndpointException() throws Exception { MuleClient client = new MuleClient(); RemoteDispatcher dispatcher = client.getRemoteDispatcher("tcp://localhost:5555"); MuleMessage result = dispatcher.sendRemote("test.queue.2", new Date(), null); assertNotNull(result); ExceptionPayload exceptionPayload = result.getExceptionPayload(); assertNotNull(exceptionPayload); assertTrue(exceptionPayload.getRootException() instanceof MalformedEndpointException); } public void testClientComponentException() throws Exception { MuleClient client = new MuleClient(); RemoteDispatcher dispatcher = client.getRemoteDispatcher("tcp://localhost:5555"); MuleMessage result = dispatcher.sendRemote("vm://test.queue.2", new Date(), null); assertNotNull(result); ExceptionPayload exceptionPayload = result.getExceptionPayload(); assertNotNull(exceptionPayload); assertTrue(exceptionPayload.getRootException() instanceof DefaultMuleException); assertEquals("Functional Test Service Exception", exceptionPayload.getRootException().getMessage()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/exceptions/0000755000175000017500000000000011351411047027665 5ustar charlescharles././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionsWithRouterMule2715TestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionsWithRouter0000644000175000017500000000265210754375733034014 0ustar charlescharles/* * $Id: ExceptionsWithRouterMule2715TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.exceptions; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class ExceptionsWithRouterMule2715TestCase extends FunctionalTestCase { public static final String MESSAGE = "message"; public static final long TIMEOUT = 5000L; public void testWithRouter() throws Exception { doTest("with-router-in"); } public void testWithoutRouter() throws Exception { doTest("without-router-in"); } protected void doTest(String path) throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://" + path, MESSAGE, null); MuleMessage response = client.request("vm://error", TIMEOUT); assertNotNull("exception null", response.getExceptionPayload()); } protected String getConfigResources() { return "org/mule/test/integration/exceptions/exceptions-with-router-mule-2715.xml"; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionRollbackTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionRollbackTes0000644000175000017500000000475710770773146033730 0ustar charlescharles/* * $Id: ExceptionRollbackTestCase.java 11468 2008-03-21 17:54:46Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.exceptions; import org.mule.api.DefaultMuleException; import org.mule.api.transaction.Transaction; import org.mule.config.i18n.CoreMessages; import org.mule.routing.filters.WildcardFilter; import org.mule.service.DefaultServiceExceptionStrategy; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.mule.TestTransaction; import org.mule.transaction.TransactionCoordination; import java.io.FileNotFoundException; public class ExceptionRollbackTestCase extends AbstractMuleTestCase { private DefaultServiceExceptionStrategy strategy; private Transaction tx; //@Override protected void doSetUp() throws Exception { strategy = new DefaultServiceExceptionStrategy(); strategy.setCommitTxFilter(new WildcardFilter("java.io.*")); strategy.setRollbackTxFilter(new WildcardFilter("org.mule.*, javax.*")); tx = new TestTransaction(); TransactionCoordination.getInstance().bindTransaction(tx); } //@Override protected void doTearDown() throws Exception { TransactionCoordination.getInstance().unbindTransaction(tx); } public void testCommit() throws Exception { strategy.exceptionThrown(new FileNotFoundException()); assertFalse(tx.isRollbackOnly()); //There is nothing to actually commit the transaction since we are not running in a real tx //assertTrue(tx.isCommitted()); } public void testRollback() throws Exception { strategy.exceptionThrown(new DefaultMuleException(CoreMessages.agentsRunning())); assertTrue(tx.isRollbackOnly()); //There is nothing to actually commit the transaction since we are not running in a real tx assertFalse(tx.isCommitted()); } public void testRollbackByDefault() throws Exception { strategy.exceptionThrown(new IllegalAccessException()); assertTrue(tx.isRollbackOnly()); //There is nothing to actually commit the transaction since we are not running in a real tx assertFalse(tx.isCommitted()); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionListenerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionListenerTes0000644000175000017500000000505710763522057033751 0ustar charlescharles/* * $Id: ExceptionListenerTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.exceptions; import org.mule.api.MuleMessage; import org.mule.message.ExceptionMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class ExceptionListenerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/exceptions/exception-listener-config.xml"; } public void testExceptionStrategyFromComponent() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.request("vm://error.queue", 2000); assertNull(message); client.send("vm://component.in", "test", null); message = client.request("vm://component.out", 2000); assertNull(message); message = client.request("vm://error.queue", 2000); assertNotNull(message); Object payload = message.getPayload(); assertTrue(payload instanceof ExceptionMessage); } public void testExceptionStrategyForTransformerException() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.request("vm://error.queue", 2000); assertNull(message); client.send("vm://component.in", "test", null); message = client.request("vm://component.out", 2000); assertNull(message); message = client.request("vm://error.queue", 2000); assertNotNull(message); Object payload = message.getPayload(); assertTrue(payload instanceof ExceptionMessage); } public void testExceptionStrategyForTransformerExceptionAsync() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.request("vm://error.queue", 2000); assertNull(message); client.dispatch("vm://component.in", "test", null); message = client.request("vm://service.out", 2000); assertNull(message); message = client.request("vm://error.queue", 2000); assertNotNull(message); Object payload = message.getPayload(); assertTrue(payload instanceof ExceptionMessage); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionStrategyConfigTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/exceptions/ExceptionStrategyCon0000644000175000017500000000305010770773146033746 0ustar charlescharles/* * $Id: ExceptionStrategyConfigTestCase.java 11468 2008-03-21 17:54:46Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.exceptions; import org.mule.api.service.Service; import org.mule.service.DefaultServiceExceptionStrategy; import org.mule.tck.FunctionalTestCase; public class ExceptionStrategyConfigTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/exceptions/exception-strategy-config.xml"; } public void testConfig() throws Exception { Service service = muleContext.getRegistry().lookupService("testService1"); assertNotNull(service); assertNotNull(service.getExceptionListener()); assertTrue(service.getExceptionListener() instanceof DefaultServiceExceptionStrategy); DefaultServiceExceptionStrategy es = (DefaultServiceExceptionStrategy)service.getExceptionListener(); assertFalse(es.isEnableNotifications()); assertNotNull(es.getCommitTxFilter()); assertEquals("java.io.*", es.getCommitTxFilter().getPattern()); assertNotNull(es.getRollbackTxFilter()); assertEquals("org.mule.*, javax.*", es.getRollbackTxFilter().getPattern()); } }mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/0000755000175000017500000000000011351411050027000 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/0000755000175000017500000000000011351411050030304 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/OrderManagerBean.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/OrderManagerBean.0000644000175000017500000000402110754375733033465 0ustar charlescharles/* * $Id: OrderManagerBean.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.spring.events; import org.mule.module.spring.events.MuleApplicationEvent; import org.mule.module.spring.events.MuleSubscriptionEventListener; import org.springframework.context.ApplicationEvent; /** * OrderManagerBean receives Order beans from Mule and dispatches * processed results back through Mule via the applicationContext */ public class OrderManagerBean extends TestMuleEventBean implements OrderManager, MuleSubscriptionEventListener { private String[] subscriptions; public void onApplicationEvent(ApplicationEvent event) { super.onApplicationEvent(event); // Get the order Order order = (Order)event.getSource(); String result = processOrder(order); // Cast the event to a Mule event, we'll use this to get the AppContext MuleApplicationEvent muleEvent = (MuleApplicationEvent)event; // Create a new DefaultMuleEvent. This will be sent to the replyTo // address MuleApplicationEvent returnEvent = null; returnEvent = new MuleApplicationEvent(result, "jms://processed.queue"); // Call publish on the application context, Mule will do the rest muleEvent.getApplicationContext().publishEvent(returnEvent); } public String processOrder(Order order) { // Do some processing... return "Order '" + order.getOrder() + "' Processed"; } public String[] getSubscriptions() { return subscriptions; } public void setSubscriptions(String[] subscriptions) { this.subscriptions = subscriptions; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/StringToOrder.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/StringToOrder.jav0000644000175000017500000000153610745677442033611 0ustar charlescharles/* * $Id: StringToOrder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.spring.events; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; /** * StringToOrder converts a String representation of an Order to an * Order object */ public class StringToOrder extends AbstractTransformer { public Object doTransform(Object src, String encoding) throws TransformerException { return null; } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/async/0000755000175000017500000000000011351411050031421 5ustar charlescharles././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/async/SpringEventsJmsAsyncExampleTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/async/SpringEvent0000644000175000017500000000705210766637211033636 0ustar charlescharles/* * $Id: SpringEventsJmsAsyncExampleTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.spring.events.async; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.EventCallback; import org.mule.test.integration.spring.events.Order; import org.mule.test.integration.spring.events.OrderManagerBean; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; /** * SpringEventsJmsExampleTestCase is a testcase used to test the * example config in the docco. this test is not run when building this module as it * relies on Jms, it's used to verify the example config works. */ public class SpringEventsJmsAsyncExampleTestCase extends FunctionalTestCase { private final AtomicInteger eventCount = new AtomicInteger(0); protected void doSetUp() throws Exception { super.doSetUp(); eventCount.set(0); } protected String getConfigResources() { return "org/mule/test/integration/spring/events/async/mule-events-example-async-app-context.xml"; } public void testReceivingASubscriptionEvent() throws Exception { OrderManagerBean subscriptionBean = (OrderManagerBean) muleContext.getRegistry().lookupObject( "orderManagerBean"); assertNotNull(subscriptionBean); // when an event is received by 'testEventBean1' this callback will be // invoked EventCallback callback = new EventCallback() { public void eventReceived(MuleEventContext context, Object o) throws Exception { eventCount.incrementAndGet(); } }; subscriptionBean.setEventCallback(callback); MuleClient client = new MuleClient(); Order order = new Order("Sausage and Mash"); client.send("jms://orders.queue", order, null); Thread.sleep(1000); assertTrue(eventCount.get() == 1); MuleMessage result = client.request("jms://processed.queue", 10000); assertEquals(1, eventCount.intValue()); assertNotNull(result); assertEquals("Order 'Sausage and Mash' Processed", result.getPayloadAsString()); } public void testReceiveAsWebService() throws Exception { MuleClient client = new MuleClient(); OrderManagerBean orderManager = (OrderManagerBean) muleContext.getRegistry().lookupObject("orderManagerBean"); assertNotNull(orderManager); EventCallback callback = new EventCallback() { public void eventReceived(MuleEventContext context, Object o) throws Exception { eventCount.incrementAndGet(); } }; orderManager.setEventCallback(callback); Order order = new Order("Sausage and Mash"); // Make an async call client.dispatch("axis:http://localhost:44444/mule/orderManager?method=processOrderAsync", order, null); MuleMessage result = client.request("jms://processed.queue", 10000); assertNotNull(result); assertEquals("Order 'Sausage and Mash' Processed Async", result.getPayload()); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/async/AsyncOrderManagerBean.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/async/AsyncOrderM0000644000175000017500000000402410754375733033561 0ustar charlescharles/* * $Id: AsyncOrderManagerBean.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.spring.events.async; import org.mule.module.spring.events.MuleApplicationEvent; import org.mule.test.integration.spring.events.Order; import org.mule.test.integration.spring.events.OrderManagerBean; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; /** * OrderManagerBean receives order beans from Mule and dispatches * process relsults back through Mule via the applicationContext. */ public class AsyncOrderManagerBean extends OrderManagerBean implements AsyncOrderManager, ApplicationContextAware { private ApplicationContext applicationContext; /** * We need the application context to send our asyncronous result somewhere * * @param applicationContext * @throws BeansException */ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } /** * This will be invoked using as a web service. We'll return the result to a * processing queue * * @param order */ public void processOrderAsync(Order order) { // Do some processing... String message = "Order '" + order.getOrder() + "' Processed Async"; MuleApplicationEvent returnEvent = null; returnEvent = new MuleApplicationEvent(message, "jms://processed.queue"); // Call publish on the application context, Mule will do the rest applicationContext.publishEvent(returnEvent); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/async/AsyncOrderManager.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/async/AsyncOrderM0000644000175000017500000000123410664630335033551 0ustar charlescharles/* * $Id: AsyncOrderManager.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.spring.events.async; import org.mule.test.integration.spring.events.Order; /** * OrderManager TODO */ public interface AsyncOrderManager { public void processOrderAsync(Order order); } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/SpringEventsJmsExampleTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/SpringEventsJmsEx0000644000175000017500000000660310761274763033660 0ustar charlescharles/* * $Id: SpringEventsJmsExampleTestCase.java 11074 2008-02-27 14:55:47Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.spring.events; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.EventCallback; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; /** * SpringEventsJmsExampleTestCase is a testcase used to test the * example config in the documentation. This test is not run when building this * module as it relies on JMS; it's used to verify that the example config works. */ public class SpringEventsJmsExampleTestCase extends FunctionalTestCase { private final AtomicInteger eventCount = new AtomicInteger(0); protected String getConfigResources() { return "org/mule/test/integration/spring/events/mule-events-example-app-context.xml"; } public SpringEventsJmsExampleTestCase() { setStartContext(false); } protected void doSetUp() throws Exception { eventCount.set(0); } public void testReceivingASubscriptionEvent() throws Exception { OrderManagerBean subscriptionBean = (OrderManagerBean) muleContext.getRegistry().lookupObject( "orderManagerBean"); assertNotNull(subscriptionBean); // when an event is received by 'testEventBean1' this callback will be // invoked EventCallback callback = new EventCallback() { public void eventReceived(MuleEventContext context, Object o) throws Exception { eventCount.incrementAndGet(); } }; subscriptionBean.setEventCallback(callback); MuleClient client = new MuleClient(); Order order = new Order("Sausage and Mash"); client.dispatch("jms://orders.queue", order, null); Thread.sleep(2000); assertTrue(eventCount.get() == 1); MuleMessage result = client.request("jms://processed.queue", 10000); assertEquals(1, eventCount.get()); assertNotNull(result); assertEquals("Order 'Sausage and Mash' Processed", result.getPayload()); } public void testReceiveAsWebService() throws Exception { MuleClient client = new MuleClient(); OrderManagerBean orderManager = (OrderManagerBean) muleContext.getRegistry().lookupObject("orderManagerBean"); assertNotNull(orderManager); EventCallback callback = new EventCallback() { public void eventReceived(MuleEventContext context, Object o) throws Exception { eventCount.incrementAndGet(); } }; orderManager.setEventCallback(callback); Order order = new Order("Sausage and Mash"); MuleMessage result = client.send("axis:http://localhost:44444/mule/orderManager?method=processOrder", order, null); assertNotNull(result); assertEquals("Order 'Sausage and Mash' Processed", (result.getPayload())); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/Order.java0000644000175000017500000000175610664630335032252 0ustar charlescharles/* * $Id: Order.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.spring.events; import java.io.Serializable; /** * Order is a bean that gets sent back and forth between Mule and * Spring. */ public class Order implements Serializable { private static final long serialVersionUID = -5384677758697949102L; private String order; public Order() { super(); } public Order(String order) { this.order = order; } public String getOrder() { return order; } public void setOrder(String order) { this.order = order; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/TestMuleEventBean.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/TestMuleEventBean0000644000175000017500000000353010754375733033611 0ustar charlescharles/* * $Id: TestMuleEventBean.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.spring.events; import org.mule.module.spring.events.MuleApplicationEvent; import org.mule.module.spring.events.MuleEventListener; import org.mule.tck.functional.EventCallback; import org.mule.util.StringMessageUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationEvent; /** * TestMuleEventBean is a MuleEventBean for testing with the * MuleEventMulticaster. */ public class TestMuleEventBean implements MuleEventListener { private static final Log logger = LogFactory.getLog(TestMuleEventBean.class); private EventCallback eventCallback; public void onApplicationEvent(ApplicationEvent event) { MuleApplicationEvent e = (MuleApplicationEvent)event; logger.debug(StringMessageUtils.getBoilerPlate("Received message on " + e.getEndpoint())); if (eventCallback != null) { try { eventCallback.eventReceived(e.getMuleEventContext(), event); } catch (Exception e1) { throw new RuntimeException("Callback failed: " + e1.getMessage(), e1); } } } public EventCallback getEventCallback() { return eventCallback; } public void setEventCallback(EventCallback eventCallback) { this.eventCallback = eventCallback; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/OrderManager.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/events/OrderManager.java0000644000175000017500000000117710664630335033542 0ustar charlescharles/* * $Id: OrderManager.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.spring.events; /** * OrderManager declares an interface for processing Order beans. */ public interface OrderManager { public String processOrder(Order order); } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/MuleAdminTestCase.java0000644000175000017500000000216410754375733033204 0ustar charlescharles/* * $Id: MuleAdminTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.spring; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.module.client.RemoteDispatcher; import org.mule.tck.FunctionalTestCase; public class MuleAdminTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/spring/mule-admin-spring.xml"; } public void testMuleAdminChannelInSpring() throws Exception { MuleClient mc = new MuleClient(); RemoteDispatcher rd = mc.getRemoteDispatcher("tcp://localhost:60504"); MuleMessage result = rd.sendToRemoteComponent("appleComponent", "string", null); assertNotNull(result); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/transaction/0000755000175000017500000000000011351411050031325 5ustar charlescharles././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/transaction/SpringTransactionFactoryTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/spring/transaction/SpringTransa0000644000175000017500000000451310745677442033717 0ustar charlescharles/* * $Id: SpringTransactionFactoryTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.spring.transaction; import org.mule.api.transaction.Transaction; import org.mule.tck.AbstractMuleTestCase; import org.mule.transaction.TransactionCoordination; public class SpringTransactionFactoryTestCase extends AbstractMuleTestCase { // //@Override protected void doTearDown() throws Exception { Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (tx != null) { TransactionCoordination.getInstance().unbindTransaction(tx); } } public void testTransactionFactoryBinding() throws Exception { // Init a data source // DriverManagerDataSource ds = new DriverManagerDataSource(); // ds.setDriverClassName("org.hsqldb.jdbcDriver"); // ds.setUrl("jdbc:hsqldb:mem:db"); // ds.setUsername("sa"); // // Init hibernate // LocalSessionFactoryBean sfactory = new LocalSessionFactoryBean(); // sfactory.setDataSource(ds); // sfactory.afterPropertiesSet(); // // Init hibernate transaction manager // HibernateTransactionManager tm = new HibernateTransactionManager(); // tm.setDataSource(ds); // SessionFactory sessionFactory = (SessionFactory)sfactory.getObject(); // tm.setSessionFactory(sessionFactory); // // Init spring transaction factory // SpringTransactionFactory factory = new SpringTransactionFactory(); // factory.setManager(tm); // // // Create a new transaction // Transaction tx = factory.beginTransaction(); // TransactionCoordination.getInstance().bindTransaction(tx); // // Check that the jdbc connection is enlisted // assertTrue(tx.hasResource(ds)); // // Check that the hibernate session is enlisted // assertTrue(tx.hasResource(sessionFactory)); // TransactionCoordination.getInstance().unbindTransaction(tx); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/0000755000175000017500000000000011351411047030031 5ustar charlescharles././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/OutboundTransactionsTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/OutboundTransaction0000644000175000017500000000424210754375733034004 0ustar charlescharles/* * $Id: OutboundTransactionsTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transaction; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class OutboundTransactionsTestCase extends FunctionalTestCase { private static final int TIMEOUT = 2000; protected String getConfigResources() { return "org/mule/test/integration/transaction/outbound-transactions.xml"; } public void testOutboundRouterTransactions() throws Exception { MuleClient client = new MuleClient(); while (client.request("jms://my.queue1", TIMEOUT) != null) { // consume messages } while (client.request("jms://my.queue2", TIMEOUT) != null) { // consume messages } client.sendNoReceive("vm://component1", "test", null); assertNotNull(client.request("jms://my.queue1", TIMEOUT)); assertNotNull(client.request("jms://my.queue2", TIMEOUT)); assertNull(client.request("jms://my.queue1", TIMEOUT)); assertNull(client.request("jms://my.queue2", TIMEOUT)); } public void testOutboundRouterTransactions2() throws Exception { MuleClient client = new MuleClient(); while (client.request("jms://my.queue3", TIMEOUT) != null) { // consume messages } while (client.request("jms://my.queue4", TIMEOUT) != null) { // consume messages } client.sendNoReceive("jms://component2", "test", null); assertNotNull(client.request("jms://my.queue3", TIMEOUT)); assertNotNull(client.request("jms://my.queue4", TIMEOUT)); assertNull(client.request("jms://my.queue3", TIMEOUT)); assertNull(client.request("jms://my.queue4", TIMEOUT)); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/XAResourceManagerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/XAResourceManagerTe0000644000175000017500000000535710764101307033574 0ustar charlescharles/* * $Id: XAResourceManagerTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transaction; import org.mule.module.jboss.transaction.JBossArjunaTransactionManagerFactory; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.xa.AbstractTransactionContext; import org.mule.util.xa.AbstractXAResourceManager; import org.mule.util.xa.DefaultXASession; import org.mule.util.xa.ResourceManagerException; import javax.transaction.Transaction; import javax.transaction.TransactionManager; import javax.transaction.xa.XAResource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class XAResourceManagerTestCase extends AbstractMuleTestCase { private TransactionManager tm; protected void doSetUp() throws Exception { tm = new JBossArjunaTransactionManagerFactory().create(); } protected void doTearDown() throws Exception { tm = null; } public void testTxBehaviour() throws Exception { TestXAResourceManager rm = new TestXAResourceManager(); rm.start(); DefaultXASession s = rm.createSession(); tm.begin(); Transaction tx = tm.getTransaction(); tx.enlistResource(s); tx.delistResource(s, XAResource.TMSUCCESS); tx.commit(); } protected static class TestXAResourceManager extends AbstractXAResourceManager { private static Log logger = LogFactory.getLog(TestXAResourceManager.class); public DefaultXASession createSession() { return new DefaultXASession(this); } protected Log getLogger() { return logger; } protected AbstractTransactionContext createTransactionContext(Object session) { return new AbstractTransactionContext(); } protected void doBegin(AbstractTransactionContext context) { // template method } protected int doPrepare(AbstractTransactionContext context) { // template method return 0; } protected void doCommit(AbstractTransactionContext context) throws ResourceManagerException { // template method } protected void doRollback(AbstractTransactionContext context) throws ResourceManagerException { // template method } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/XABridgeComponent.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/XABridgeComponent.j0000644000175000017500000000406210746275214033531 0ustar charlescharles/* * $Id: XABridgeComponent.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transaction; import org.mule.api.transaction.Transaction; import org.mule.transaction.TransactionCoordination; import java.util.Map; /** * Simple service that receives messages from jdbc or jms and just forward the * interesting part. */ public class XABridgeComponent { public static boolean mayRollback = false; /** * If mayRollback has been set to true, the service will mark * the current transaction as rollback only on a 30 percent basis. * * @throws Exception */ protected void mayRollback() throws Exception { if (mayRollback) { Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (tx != null) { if (Math.random() < 0.3) { System.err.println("Marking transaction for rollback"); tx.setRollbackOnly(); } } } } /** * Receive the jdbc message and forward the data part. May mark * the current transaction as rollback only. * * @param msg * @return * @throws Exception */ public Object onJdbcMessage(Map msg) throws Exception { mayRollback(); return msg.get("data").toString(); } /** * Receive the content of the jms message and forward it. May mark the current * transaction as rollback only. * * @param msg * @return * @throws Exception */ public Object onJmsMessage(String msg) throws Exception { mayRollback(); return msg; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/RollbackRoutingExceptionStrategy.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/RollbackRoutingExce0000644000175000017500000000232610770773146033704 0ustar charlescharles/* * $Id: RollbackRoutingExceptionStrategy.java 11468 2008-03-21 17:54:46Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transaction; import org.mule.DefaultExceptionStrategy; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; /** * Will rollback the transaction in case a {@link org.mule.api.routing.RoutingException} * is encountered. Typically used with {@link org.mule.routing.outbound.TransactionJoiningRouter} * and configured on a connector. */ public class RollbackRoutingExceptionStrategy extends DefaultExceptionStrategy { public void handleRoutingException(MuleMessage message, ImmutableEndpoint endpoint, Throwable t) { logger.debug("handleRoutingException: endpoint=" + endpoint + " message=" + message); defaultHandler(t); handleTransaction(t); routeException(message, endpoint, t); } }mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/extras/0000755000175000017500000000000011351411047031337 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/extras/Book.java0000644000175000017500000000252310664630335033107 0ustar charlescharles/* * $Id: Book.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transaction.extras; import java.io.Serializable; public class Book implements Serializable { private static final long serialVersionUID = -2519185601486498262L; int serialNo; String title; String author; public Book() { // empty constructor } public Book(int serialNo, String title, String author) { super(); this.serialNo = serialNo; this.title = title; this.author = author; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public int getSerialNo() { return serialNo; } public void setSerialNo(int serialNo) { this.serialNo = serialNo; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/extras/LibraryDao.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/extras/LibraryDao.j0000644000175000017500000000105710664630335033556 0ustar charlescharles/* * $Id: LibraryDao.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transaction.extras; public interface LibraryDao { boolean insertBook(Book book) throws Exception; } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/extras/MyComponent.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/extras/MyComponent.0000644000175000017500000000146210676602576033635 0ustar charlescharles/* * $Id: MyComponent.java 8639 2007-09-27 01:21:02Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transaction.extras; public class MyComponent { private LibraryDao library; public boolean doInsertTitle(Book book) throws Exception { return library.insertBook(book); } public LibraryDao getLibrary() { return library; } public void setLibrary(LibraryDao library) { this.library = library; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/extras/JdbcLibraryDao.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/extras/JdbcLibraryD0000644000175000017500000000250410664630335033567 0ustar charlescharles/* * $Id: JdbcLibraryDao.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transaction.extras; import java.sql.Types; import org.springframework.jdbc.core.JdbcTemplate; public class JdbcLibraryDao implements LibraryDao { private JdbcTemplate jdbcTemplate; public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } public boolean insertBook(Book book) throws Exception { String sql = "insert into book (id, title, author) values (?,?,?)"; Object args[] = new Object[] {new Integer(book.getSerialNo()), book.getTitle(), book.getAuthor()}; int types[] = new int[] {Types.INTEGER, Types.VARCHAR, Types.VARCHAR}; try { jdbcTemplate.update(sql, args, types); return true; } catch (Exception e) { System.out.println(e.getMessage()); throw e; //return false; } } }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/XAJdbcMule1479TestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/XAJdbcMule1479TestC0000644000175000017500000000664310754375733033214 0ustar charlescharles/* * $Id: XAJdbcMule1479TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transaction; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jdbc.JdbcUtils; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.JmsConstants; import org.mule.transport.jms.activemq.ActiveMQJmsConnector; import java.sql.Connection; import java.sql.DriverManager; import java.util.List; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.ArrayListHandler; public class XAJdbcMule1479TestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/transaction/jdbc-xatransaction-1479.xml"; } protected void doPostFunctionalSetUp() throws Exception { emptyTable(); } protected void emptyTable() throws Exception { try { execSqlUpdate("DELETE FROM TEST"); } catch (Exception e) { execSqlUpdate("CREATE TABLE TEST(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,DATA VARCHAR(255))"); } } protected Connection getConnection() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); return DriverManager.getConnection("jdbc:derby:muleEmbeddedDB;create=true"); } protected List execSqlQuery(String sql) throws Exception { Connection con = null; try { con = getConnection(); return (List)new QueryRunner().query(con, sql, new ArrayListHandler()); } finally { JdbcUtils.close(con); } } protected int execSqlUpdate(String sql) throws Exception { Connection con = null; try { con = getConnection(); return new QueryRunner().update(con, sql); } finally { JdbcUtils.close(con); } } /* public void testJdbcXa() throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://in","test",null); List results = execSqlQuery("SELECT * FROM TEST"); assertEquals(0, results.size()); } */ public void testJmsXa() throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://in1","test",null); logger.debug("########### receiving message"); // MuleMessage res = client.receive("jms://queue.out", 1000); // assertNotNull(res); Thread.sleep(5000000); List results = execSqlQuery("SELECT * FROM TEST"); assertEquals(1, results.size()); } public JmsConnector createConnector() throws Exception { ActiveMQJmsConnector connector = new ActiveMQJmsConnector(); connector.setSpecification(JmsConstants.JMS_SPECIFICATION_11); connector.setName("myConnector"); connector.getDispatcherThreadingProfile().setDoThreading(false); return connector; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/XABridgeJmsJdbcTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/XABridgeJmsJdbcTest0000644000175000017500000000736510745677442033534 0ustar charlescharles/* * $Id: XABridgeJmsJdbcTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transaction; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jdbc.JdbcUtils; import org.mule.transport.jdbc.util.MuleDerbyUtils; import java.sql.Connection; import java.sql.DriverManager; import java.util.List; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.ArrayListHandler; public class XABridgeJmsJdbcTestCase extends FunctionalTestCase { private static String connectionString; protected String getConfigResources() { return "org/mule/test/integration/transaction/xabridge-jms-jdbc-mule.xml"; } protected void suitePreSetUp() throws Exception { String dbName = MuleDerbyUtils.loadDatabaseName("derby.properties", "database.name"); MuleDerbyUtils.defaultDerbyCleanAndInit("derby.properties", "database.name"); connectionString = "jdbc:derby:" + dbName; super.suitePreSetUp(); } // @Override protected void doSetUp() throws Exception { super.doSetUp(); emptyTable(); } protected void emptyTable() throws Exception { try { execSqlUpdate("DELETE FROM TEST"); } catch (Exception e) { execSqlUpdate("CREATE TABLE TEST(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,TYPE INTEGER,DATA VARCHAR(255),ACK TIMESTAMP,RESULT VARCHAR(255))"); } } protected Connection getConnection() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); return DriverManager.getConnection(connectionString); } protected List execSqlQuery(String sql) throws Exception { Connection con = null; try { con = getConnection(); return (List)new QueryRunner().query(con, sql, new ArrayListHandler()); } finally { JdbcUtils.close(con); } } protected int execSqlUpdate(String sql) throws Exception { Connection con = null; try { con = getConnection(); return new QueryRunner().update(con, sql); } finally { JdbcUtils.close(con); } } protected void doTestXaBridge(boolean rollback) throws Exception { XABridgeComponent.mayRollback = rollback; List results = execSqlQuery("SELECT * FROM TEST"); assertEquals(0, results.size()); for (int i = 0; i < 10; i++) { execSqlUpdate("INSERT INTO TEST(TYPE, DATA) VALUES (1, 'Test " + i + "')"); } results = execSqlQuery("SELECT * FROM TEST WHERE TYPE = 1"); assertEquals(10, results.size()); long t0 = System.currentTimeMillis(); while (true) { results = execSqlQuery("SELECT * FROM TEST WHERE TYPE = 2"); logger.info("Results found: " + results.size()); if (results.size() >= 10) { break; } assertTrue(System.currentTimeMillis() - t0 < 20000); Thread.sleep(500); } } public void testXaBridgeWithoutRollbacks() throws Exception { doTestXaBridge(false); } public void testXaBridgeWithRollbacks() throws Exception { doTestXaBridge(true); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/XATransactionsWithSpringDAO.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transaction/XATransactionsWithS0000644000175000017500000001045410754375733033661 0ustar charlescharles/* * $Id: XATransactionsWithSpringDAO.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transaction; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.test.integration.transaction.extras.Book; import org.mule.transport.jdbc.JdbcUtils; import org.mule.transport.jdbc.util.MuleDerbyUtils; import java.sql.Connection; import java.sql.DriverManager; import java.util.List; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.ArrayListHandler; public class XATransactionsWithSpringDAO extends FunctionalTestCase { /** TODO This is insane, make it 10 seconds max. */ private static final int RECEIVE_TIMEOUT = 50000; private static String connectionString; protected String getConfigResources() { return "org/mule/test/integration/transaction/xatransactions-with-spring-dao-config.xml"; } protected void suitePreSetUp() throws Exception { String dbName = MuleDerbyUtils.loadDatabaseName("derby.properties", "database.name"); MuleDerbyUtils.defaultDerbyCleanAndInit("derby.properties", "database.name"); connectionString = "jdbc:derby:" + dbName; super.suitePreSetUp(); } protected void doPostFunctionalSetUp() throws Exception { emptyTable(); } protected void emptyTable() throws Exception { try { execSqlUpdate("DELETE FROM BOOK"); } catch (Exception e) { execSqlUpdate("CREATE TABLE BOOK(ID INTEGER NOT NULL PRIMARY KEY,TITLE VARCHAR(255),AUTHOR VARCHAR(255))"); } } protected Connection getConnection() throws Exception { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); return DriverManager.getConnection(connectionString); } public List execSqlQuery(String sql) throws Exception { Connection con = null; try { con = getConnection(); return (List) new QueryRunner().query(con, sql, new ArrayListHandler()); } finally { JdbcUtils.close(con); } } protected int execSqlUpdate(String sql) throws Exception { Connection con = null; try { con = getConnection(); return new QueryRunner().update(con, sql); } finally { JdbcUtils.close(con); } } public void testXATransactionUsingSpringDaoNoRollback() throws Exception { MuleClient client = new MuleClient(); Book book = new Book(1, "testBook", "testAuthor"); client.sendNoReceive("jms://my.queue", book, null); MuleMessage result = client.request("vm://output", RECEIVE_TIMEOUT); assertNotNull(result); assertNotNull(result.getPayload()); assertTrue(((Boolean) result.getPayload()).booleanValue()); int res = execSqlUpdate("UPDATE BOOK SET TITLE = 'My Test' WHERE TITLE='testBook'"); if (res < 0) { fail(); } } public void testXATransactionUsingSpringDaoWithRollback() throws Exception { MuleClient client = new MuleClient(); Book book = new Book(1, "testBook", "testAuthor"); client.sendNoReceive("jms://my.queue", book, null); MuleMessage result = client.request("vm://output", RECEIVE_TIMEOUT); assertNotNull(result); assertNotNull(result.getPayload()); assertTrue(((Boolean) result.getPayload()).booleanValue()); int res = execSqlUpdate("UPDATE BOOK SET TITLE = 'My Test' WHERE TITLE='testBook'"); if (res < 0) { fail(); } client.sendNoReceive("jms://my.queue", book, null); result = client.request("vm://output", 5000); // need to test that the Spring transaction has really been rolled back... // from log file, it is assertNull(result); } }mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/0000755000175000017500000000000011351411050026743 5ustar charlescharles././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/GlobalEndpointAndTransformerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/GlobalEndpointAndTransfo0000644000175000017500000000230710754375733033600 0ustar charlescharles/* * $Id: GlobalEndpointAndTransformerTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.config; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; /* * This test has been added due to MULE-610 */ public class GlobalEndpointAndTransformerTestCase extends FunctionalTestCase { public void testNormal() throws MuleException { MuleClient client=new MuleClient(); MuleMessage msg=client.send("vm://in",new DefaultMuleMessage("HELLO!")); assertTrue(msg.getPayload() instanceof byte[]); } protected String getConfigResources() { return "org/mule/test/integration/config/globalendpointandtransformer-mule-config.xml"; } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/TestFilter.java0000644000175000017500000000173010745677442031725 0ustar charlescharles/* * $Id: TestFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.config; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; /** * TODO */ public class TestFilter implements Filter { private String foo; private int bar; public int getBar() { return bar; } public void setBar(int bar) { this.bar = bar; } public String getFoo() { return foo; } public void setFoo(String foo) { this.foo = foo; } public boolean accept(MuleMessage message) { return true; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/MultiContainerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/MultiContainerTestCase.j0000644000175000017500000000630010746275214033527 0ustar charlescharles/* * $Id: MultiContainerTestCase.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.config; import org.mule.tck.FunctionalTestCase; /** * Tests Deploying and referencing components from two different spring container * contexts * * TODO MULE-1789 */ public class MultiContainerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/config/multi-container-test.xml"; } public void testSanity() { fail("TODO MULE-1789"); } public void testContainer() throws Exception { // Registry registry = muleContext.getRegistry(); // assertNotNull(registry); // assertNotNull(registry.lookupObject("spring2-Apple")); // assertNotNull(registry.lookupObject("spring-Apple")); // assertNotNull(registry.lookupObject("spring2-Banana")); // assertNotNull(registry.lookupObject("spring-Banana")); // // assertNull(registry.lookupObject("WaterMelon")); } // public void testSpecificContainerAddressing() throws Exception // { // Registry registry = muleContext.getRegistry(); // assertNotNull(registry); // Orange o = (Orange)registry.lookupObject(new ContainerKeyPair("spring1", "Orange")); // assertNotNull(o); // assertEquals(new Integer(8), o.getSegments()); // // o = (Orange)registry.lookupObject(new ContainerKeyPair("spring2", "Orange")); // assertNotNull(o); // assertEquals(new Integer(10), o.getSegments()); // // // gets the service from the first container // o = (Orange)registry.lookupObject("Orange"); // assertNotNull(o); // assertEquals(new Integer(8), o.getSegments()); // } // // public void testSpecificContainerAddressingForComponents() throws Exception // { // QuickConfigurationBuilder builder = new QuickConfigurationBuilder(); // UMODescriptor d = builder.createDescriptor("Orange", "myOrange", "test://foo", null, null); // //d.setContainer("spring2"); // builder.registerComponent(d); // Service c = builder.getMuleContext().getRegistry().lookupModel("main").getComponent("myOrange"); // assertNotNull(c); // Object o = c.getInstance(); // assertTrue(o instanceof Orange); // Orange orange = (Orange)o; // assertEquals(10, orange.getSegments().intValue()); // // d = builder.createDescriptor("Orange", "myOrange2", "test://bar", null, null); // //d.setContainer("spring1"); // builder.registerComponent(d); // c = builder.getMuleContext().getRegistry().lookupModel("main").getComponent("myOrange2"); // assertNotNull(c); // o = c.getInstance(); // assertTrue(o instanceof Orange); // orange = (Orange)o; // assertEquals(8, orange.getSegments().intValue()); // // } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/DummyInitialContextFactory.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/DummyInitialContextFacto0000644000175000017500000000407410774254333033643 0ustar charlescharles/* * $Id: DummyInitialContextFactory.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.config; import org.mule.MuleServer; import org.mule.api.lifecycle.InitialisationCallback; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.object.ObjectFactory; import org.mule.api.service.Service; import org.mule.component.simple.EchoComponent; import org.mule.jndi.SimpleContext; import org.mule.module.management.agent.Log4jAgent; import org.mule.module.xml.transformer.XmlToObject; import org.mule.tck.MuleTestUtils; import org.mule.transport.vm.VMConnector; /** * A dummy property factory for creating a Jndi context */ public class DummyInitialContextFactory implements ObjectFactory { public Object getInstance() throws Exception { SimpleContext c = new SimpleContext(); c.bind("vmConnector", new VMConnector()); c.bind("endpointRef", "vm://my.object"); c.bind("Log4JAgent", new Log4jAgent()); c.bind("XmlToObject", new XmlToObject()); Service d = MuleTestUtils.getTestService("EchoUMO", EchoComponent.class, MuleServer.getMuleContext()); c.bind("EchoUMO", d); return c; } public void initialise() throws InitialisationException { // do nothing } public void dispose() { // do nothing } public void release(Object arg0) { // do nothing } public Class getObjectClass() { throw new UnsupportedOperationException(); } public void addObjectInitialisationCallback(InitialisationCallback callback) { throw new UnsupportedOperationException(); } public boolean isSingleton() { return false; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/ResponseTransformerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/ResponseTransformerTestC0000644000175000017500000000337610765313375033706 0ustar charlescharles/* * $Id: ResponseTransformerTestCase.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.config; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.transformer.Transformer; import org.mule.tck.FunctionalTestCase; import java.util.Iterator; import java.util.List; public class ResponseTransformerTestCase extends FunctionalTestCase { public void testTransformers() { ImmutableEndpoint endpoint = (ImmutableEndpoint) muleContext.getRegistry().lookupObject("endpoint"); assertFalse(endpoint.getTransformers().isEmpty()); assertEquals(2, endpoint.getTransformers().size()); checkNames("normal", endpoint.getTransformers()); assertFalse(endpoint.getResponseTransformers().isEmpty()); assertEquals(2, endpoint.getResponseTransformers().size()); checkNames("response", endpoint.getResponseTransformers()); } protected void checkNames(String prefix, List transformers) { Iterator iterator = transformers.iterator(); for (int count = 1; iterator.hasNext(); count++) { Transformer transformer = (Transformer) iterator.next(); logger.debug(transformer); assertEquals(prefix + count, transformer.getName()); } } protected String getConfigResources() { return "org/mule/test/integration/config/response-transformer-test.xml"; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/CustomConfigTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/config/CustomConfigTestCase.jav0000644000175000017500000000476010763522057033530 0ustar charlescharles/* * $Id: CustomConfigTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.config; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.transformer.Transformer; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.mule.TestCompressionTransformer; import org.mule.tck.testmodels.mule.TestConnector; import org.mule.tck.testmodels.mule.TestExceptionStrategy; public class CustomConfigTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/config/custom-config.xml"; } public void testCustomEndpointConfig() throws Exception { ImmutableEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( "fooEndpoint"); assertNotNull("fooEndpoint should not be null", ep); TestFilter tf = (TestFilter)ep.getFilter(); assertNotNull("the filter on the endpoint should not be null", tf); assertEquals(tf.getFoo(), "goo"); assertEquals(tf.getBar(), 12); } public void testCustomConnectorConfig() throws Exception { TestConnector cnn = (TestConnector)muleContext.getRegistry().lookupConnector("customConnector"); assertNotNull("customConnector should not be null", cnn); assertEquals(cnn.getSomeProperty(), "foo"); //Test exception strategy assertNotNull(cnn.getExceptionListener()); assertTrue(cnn.getExceptionListener() instanceof TestExceptionStrategy); assertEquals("bar", ((TestExceptionStrategy)cnn.getExceptionListener()).getTestProperty()); } public void testCustomTransformerConfig() throws Exception { Transformer trans = muleContext.getRegistry().lookupTransformer("testTransformer"); assertNotNull("testTransformer should not be null", trans); assertTrue("Transformer should be an instance of TestCompressionTransformer", trans instanceof TestCompressionTransformer); assertEquals(((TestCompressionTransformer)trans).getBeanProperty1(), "soo"); assertEquals(((TestCompressionTransformer)trans).getBeanProperty2(), 12345); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/persistence/0000755000175000017500000000000011351411047030030 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/persistence/FilePersistenceTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/persistence/FilePersistenceTest0000644000175000017500000000317410766204322033711 0ustar charlescharles/* * $Id: FilePersistenceTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.persistence; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.util.FileUtils; import java.io.File; public class FilePersistenceTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/persistence/file-persistence-config.xml"; } public void testFilesStored() throws Exception { // Note that the FunctionalTestCase will remove the working directory after // each execution String path = muleContext.getConfiguration().getWorkingDirectory() + "/queuestore/test.queue"; File store = FileUtils.newFile(path); assertFalse(store.exists()); MuleClient client = new MuleClient(); client.send("vm://test.queue", "test", null); File[] files = store.listFiles(); assertNotNull(files); assertEquals(1, files.length); muleContext.getRegistry().lookupService("TestComponent").start(); // give the service some time to initialise Thread.sleep(2000); files = store.listFiles(); assertNotNull(files); assertEquals(0, files.length); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/tck/0000755000175000017500000000000011351411047026265 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/tck/TestNamespaceFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/tck/TestNamespaceFunctionalTest0000644000175000017500000000526110770772424033650 0ustar charlescharles/* * $Id: TestNamespaceFunctionalTestCase.java 11464 2008-03-21 17:49:08Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.tck; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.exceptions.FunctionalTestException; import java.io.FileNotFoundException; public class TestNamespaceFunctionalTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/tck/test-namespace-config.xml"; } public void testService1() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://service1", "foo", null); assertNotNull(message); assertNull(message.getExceptionPayload()); assertEquals("Foo Bar Car Jar", message.getPayloadAsString()); } public void testService2() throws Exception { String result = loadResourceAsString("org/mule/test/integration/tck/test-data.txt"); MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://service2", "foo", null); assertNotNull(message); assertNull(message.getExceptionPayload()); assertEquals(result, message.getPayloadAsString()); } public void testService3() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://service3", "foo", null); assertNotNull(message); assertNull(message.getExceptionPayload()); assertEquals("foo received in testService3", message.getPayloadAsString()); } public void testService4() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://service4", "foo", null); assertNotNull(message); assertNotNull(message.getExceptionPayload()); assertEquals(FunctionalTestException.EXCEPTION_MESSAGE, message.getExceptionPayload().getMessage()); } public void testService5() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://service5", "foo", null); assertNotNull(message); assertNotNull(message.getExceptionPayload()); assertTrue(message.getExceptionPayload().getRootException() instanceof FileNotFoundException); } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/EventMetaDataPropagationTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/EventMetaDataPropagationTestCas0000644000175000017500000001132210766204322033610 0ustar charlescharles/* * $Id: EventMetaDataPropagationTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.api.MuleException; import org.mule.api.MuleEvent; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.Callable; import org.mule.api.service.Service; import org.mule.api.transformer.TransformerException; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.transformer.AbstractMessageAwareTransformer; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.Map; import javax.activation.DataHandler; import javax.activation.DataSource; public class EventMetaDataPropagationTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/event-metadata-propagation-config.xml"; } public void testEventMetaDataPropagation() throws MuleException { Service service = muleContext.getRegistry().lookupService("component1"); MuleSession session = new DefaultMuleSession(service, muleContext); MuleEvent event = new DefaultMuleEvent(new DefaultMuleMessage("Test MuleEvent"), (ImmutableEndpoint)service.getInboundRouter().getEndpoints().get(0), session, true); session.sendEvent(event); } public static class DummyComponent implements Callable { public Object onCall(MuleEventContext context) throws Exception { if ("component1".equals(context.getService().getName())) { Map props = new HashMap(); props.put("stringParam", "param1"); props.put("objectParam", new Apple()); props.put("doubleParam", new Double(12345.6)); props.put("integerParam", new Integer(12345)); props.put("longParam", new Long(123456789)); props.put("booleanParam", Boolean.TRUE); MuleMessage msg = new DefaultMuleMessage(context.getMessageAsString(), props); msg.addAttachment("test1", new DataHandler(new DataSource() { public InputStream getInputStream() throws IOException { return null; } public OutputStream getOutputStream() throws IOException { return null; } public String getContentType() { return "text/plain"; } public String getName() { return "test1"; } })); return msg; } else { MuleMessage msg = context.getMessage(); assertEquals("param1", msg.getProperty("stringParam")); assertTrue(msg.getProperty("objectParam") instanceof Apple); assertEquals(12345.6, 12345.6, msg.getDoubleProperty("doubleParam", 0)); assertEquals(12345, msg.getIntProperty("integerParam", 0)); assertEquals(123456789, msg.getLongProperty("longParam", 0)); assertEquals(true, msg.getBooleanProperty("booleanParam", false)); assertNotNull(msg.getAttachment("test1")); } return null; } } public static class DummyTransformer extends AbstractMessageAwareTransformer { public Object transform(MuleMessage msg, String outputEncoding) throws TransformerException { assertEquals("param1", msg.getProperty("stringParam")); assertTrue(msg.getProperty("objectParam") instanceof Apple); assertEquals(12345.6, 12345.6, msg.getDoubleProperty("doubleParam", 0)); assertEquals(12345, msg.getIntProperty("integerParam", 0)); assertEquals(123456789, msg.getLongProperty("longParam", 0)); assertEquals(true, msg.getBooleanProperty("booleanParam", false)); return msg; } } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/components/0000755000175000017500000000000011351411047027671 5ustar charlescharles././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/components/NoArgsCallComponentTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/components/NoArgsCallComponentT0000644000175000017500000000475510754375733033644 0ustar charlescharles/* * $Id: NoArgsCallComponentTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.components; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; /** * This test re-written to use entry point resolvers. As a consequence, some tests, which verified * implementation details rather than functionality, were dropped. */ public class NoArgsCallComponentTestCase extends FunctionalTestCase { public static final String INPUT_DC_QUEUE_NAME = "vm://in"; public static final String OUTPUT_DC_QUEUE_NAME = "vm://out"; public static final String INPUT_DI_QUEUE_NAME = "vm://invokeWithInjected"; public static final String OUTPUT_DI_QUEUE_NAME = "vm://outWithInjected"; public static final String DEFAULT_INPUT_MESSAGE = "test"; public static final String DEFUALT_OUTPUT_MESSAGE = "Just an apple."; public static final String SERVICE_DC_NAME="WORMS"; public static final String SERVICE_DI_NAME="TIRANA"; public static final String DELEGATE_DC_METHOD_NAME="toString"; public static final String DELEGATE_DI_METHOD_NAME="wash"; public static final int TIMEOUT = 5000; protected String getConfigResources() { return "org/mule/test/integration/components/no-args-call-component-functional-test.xml"; } public void testDelegateClass() throws Exception { MuleClient client = new MuleClient(); client.dispatch(INPUT_DC_QUEUE_NAME, "test", null); MuleMessage message = client.request(OUTPUT_DC_QUEUE_NAME, TIMEOUT); assertNotNull(message); assertEquals(message.getPayload(), DEFUALT_OUTPUT_MESSAGE); client.dispose(); } public void testWithInjectedDelegate() throws Exception { MuleClient client = new MuleClient(); client.dispatch(INPUT_DI_QUEUE_NAME, DEFAULT_INPUT_MESSAGE, null); MuleMessage reply = client.request(OUTPUT_DI_QUEUE_NAME, TIMEOUT); assertNotNull(reply); assertNull(reply.getExceptionPayload()); // same as original input assertEquals(DEFAULT_INPUT_MESSAGE, reply.getPayload()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/0000755000175000017500000000000011351411047027173 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/TestAggregator.java0000644000175000017500000000367110777136322033002 0ustar charlescharles/* * $Id: TestAggregator.java 11553 2008-04-09 12:55:46Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.routing.AggregationException; import org.mule.routing.CollectionCorrelatorCallback; import org.mule.routing.EventCorrelatorCallback; import org.mule.routing.inbound.EventGroup; import org.mule.routing.response.ResponseCorrelationAggregator; import java.util.Iterator; public class TestAggregator extends ResponseCorrelationAggregator { // @Override protected EventCorrelatorCallback getCorrelatorCallback() { return new CollectionCorrelatorCallback() { public MuleMessage aggregateEvents(EventGroup events) throws AggregationException { StringBuffer buffer = new StringBuffer(128); for (Iterator iterator = events.iterator(); iterator.hasNext();) { MuleEvent event = (MuleEvent) iterator.next(); try { buffer.append(event.transformMessageToString()); } catch (TransformerException e) { throw new AggregationException(events, event.getEndpoint(), e); } } logger.debug("event payload is: " + buffer.toString()); return new DefaultMuleMessage(buffer.toString()); } }; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/AsyncReplyTimeoutFailTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/AsyncReplyTimeoutFailTe0000644000175000017500000000407310774001146033652 0ustar charlescharles/* * $Id: AsyncReplyTimeoutFailTestCase.java 11514 2008-03-30 21:13:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing; import org.mule.api.MuleMessage; import org.mule.api.context.notification.RoutingNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.api.routing.ResponseTimeoutException; import org.mule.context.notification.RoutingNotification; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class AsyncReplyTimeoutFailTestCase extends FunctionalTestCase { private CountDownLatch latch; protected String getConfigResources() { return "org/mule/test/integration/routing/multi-async-repy-timeout-fail.xml"; } public void testAggregatorTimeoutWithFailure() throws Exception { latch = new CountDownLatch(1); muleContext.registerListener(new RoutingNotificationListener() { public void onNotification(ServerNotification notification) { if(notification.getAction() == RoutingNotification.ASYNC_REPLY_TIMEOUT) { latch.countDown(); } } }); String message = "test"; MuleClient client = new MuleClient(); MuleMessage result = client.send("vm://distributor.queue", message, null); assertNotNull(result); assertNotNull(result.getExceptionPayload()); assertTrue(result.getExceptionPayload().getException() instanceof ResponseTimeoutException); assertTrue(latch.await(3000, TimeUnit.MILLISECONDS)); } }././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/AsyncReplyNoTimeoutTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/AsyncReplyNoTimeoutTest0000644000175000017500000000271710774001146033725 0ustar charlescharles/* * $Id: AsyncReplyNoTimeoutTestCase.java 11514 2008-03-30 21:13:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing; import org.mule.api.MuleMessage; import org.mule.api.MuleMessageCollection; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class AsyncReplyNoTimeoutTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/multi-async-repy-no-timeout.xml"; } public void testAggregatorWithNoTimeout() throws Exception { String message = "test"; MuleClient client = new MuleClient(); MuleMessage result = client.send("vm://distributor.queue", message, null); assertNotNull(result); assertTrue(result instanceof MuleMessageCollection); MuleMessageCollection mc = (MuleMessageCollection)result; assertEquals(3, mc.size()); for (int i = 0; i < mc.getMessagesAsArray().length; i++) { MuleMessage msg = mc.getMessagesAsArray()[i]; assertEquals("test Received", msg.getPayload()); } } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/SimpleSerializableObject.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/SimpleSerializableObjec0000644000175000017500000000165110664630335033655 0ustar charlescharles/* * $Id: SimpleSerializableObject.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing; import java.io.Serializable; /** * Simple Custom Serializable object to check that Custom Objects Can Actually be * Chunked */ class SimpleSerializableObject implements Serializable { private static final long serialVersionUID = 4705305160224612898L; public String s; public boolean b; public int i; public SimpleSerializableObject(String s, boolean b, int i) { this.s = s; this.b = b; this.i = i; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/AsyncReplyTimeoutTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/AsyncReplyTimeoutTestCa0000644000175000017500000000460510774001146033672 0ustar charlescharles/* * $Id: AsyncReplyTimeoutTestCase.java 11514 2008-03-30 21:13:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing; import org.mule.api.MuleMessage; import org.mule.api.MuleMessageCollection; import org.mule.api.context.notification.RoutingNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.context.notification.RoutingNotification; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class AsyncReplyTimeoutTestCase extends FunctionalTestCase { private CountDownLatch latch; protected String getConfigResources() { return "org/mule/test/integration/routing/multi-async-repy-timeout.xml"; } public void testAggregatorTimeoutWithoutFailure() throws Exception { latch = new CountDownLatch(1); muleContext.registerListener(new RoutingNotificationListener() { public void onNotification(ServerNotification notification) { if(notification.getAction() == RoutingNotification.MISSED_ASYNC_REPLY) { latch.countDown(); assertEquals("test Received Late!", ((MuleMessage)((RoutingNotification)notification).getSource()).getPayload()); } } }); String message = "test"; MuleClient client = new MuleClient(); MuleMessage result = client.send("vm://distributor.queue", message, null); assertNotNull(result); assertTrue(result instanceof MuleMessageCollection); MuleMessageCollection mc = (MuleMessageCollection)result; assertEquals(2, mc.size()); for (int i = 0; i < mc.getMessagesAsArray().length; i++) { MuleMessage msg = mc.getMessagesAsArray()[i]; assertEquals("test Received", msg.getPayload()); } assertTrue(latch.await(3000, TimeUnit.MILLISECONDS)); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/MessageChunkingTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/MessageChunkingTestCase0000644000175000017500000001550310754403514033637 0ustar charlescharles/* * $Id: MessageChunkingTestCase.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing; import org.mule.api.context.notification.MessageNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.context.notification.MessageNotification; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestNotification; import org.mule.tck.functional.FunctionalTestNotificationListener; import org.mule.util.concurrent.Latch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.lang.SerializationUtils; public class MessageChunkingTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/message-chunking.xml"; } public void testMessageChunkingWithEvenSplit() throws Exception { doMessageChunking("0123456789", 5); } public void testMessageChunkingWithOddSplit() throws Exception { doMessageChunking("01234567890", 6); } public void testMessageChunkingWith100Splits() throws Exception { doMessageChunking("0123456789012345678901234567890123456789012345678901234567890123456789" + "01234567890123456789012345678901234567890123456789012345678901234567890123456789" + "01234567890123456789012345678901234567890123456789", 100); } public void testMessageChunkingOneChunk() throws Exception { doMessageChunking("x", 1); } public void testMessageChunkingObject() throws Exception { final AtomicInteger messagePartsCount = new AtomicInteger(0); final Latch chunkingReceiverLatch = new Latch(); final SimpleSerializableObject simpleSerializableObject = new SimpleSerializableObject("Test String", true, 99); // find number of chunks final int parts = (int) Math.ceil((SerializationUtils.serialize(simpleSerializableObject).length / (double) 2)); // Listen to events fired by the ChunkingReceiver service muleContext.registerListener(new FunctionalTestNotificationListener() { public void onNotification(ServerNotification notification) { // Not strictly necessary to test for this as when we register the // listener we supply the ComponentName as the subscription filter assertEquals("ChunkingObjectReceiver", notification.getResourceIdentifier()); // Test that we have received all chunks in the correct order Object reply = ((FunctionalTestNotification) notification).getEventContext().getMessage().getPayload(); // Check if Object is of Correct Type assertTrue(reply instanceof SimpleSerializableObject); SimpleSerializableObject replySimpleSerializableObject = (SimpleSerializableObject) reply; // Check that Contents are Identical assertEquals(simpleSerializableObject.b, replySimpleSerializableObject.b); assertEquals(simpleSerializableObject.i, replySimpleSerializableObject.i); assertEquals(simpleSerializableObject.s, replySimpleSerializableObject.s); chunkingReceiverLatch.countDown(); } }, "ChunkingObjectReceiver"); // Listen to Message Notifications on the Chunking receiver so we can // determine how many message parts have been received muleContext.registerListener(new MessageNotificationListener() { public void onNotification(ServerNotification notification) { if (notification.getAction() == MessageNotification.MESSAGE_RECEIVED) { messagePartsCount.getAndIncrement(); } assertEquals("ChunkingObjectReceiver", notification.getResourceIdentifier()); } }, "ChunkingObjectReceiver"); MuleClient client = new MuleClient(); client.dispatch("vm://inbound.object.channel", simpleSerializableObject, null); // Wait for the message to be received and tested (in the listener above) assertTrue(chunkingReceiverLatch.await(20L, TimeUnit.SECONDS)); // Ensure we processed expected number of message parts assertEquals(parts, messagePartsCount.get()); } protected void doMessageChunking(final String data, int partsCount) throws Exception { final AtomicInteger messagePartsCount = new AtomicInteger(0); final Latch chunkingReceiverLatch = new Latch(); // Listen to events fired by the ChunkingReceiver service muleContext.registerListener(new FunctionalTestNotificationListener() { public void onNotification(ServerNotification notification) { // Not strictly necessary to test for this as when we register the // listener we supply the ComponentName as the subscription filter assertEquals("ChunkingReceiver", notification.getResourceIdentifier()); // Test that we have received all chunks in the correct order Object reply = ((FunctionalTestNotification) notification).getReplyMessage(); assertEquals(data + " Received", reply); chunkingReceiverLatch.countDown(); } }, "ChunkingReceiver"); // Listen to Message Notifications on the Chunking receiver so we can // determine how many message parts have been received muleContext.registerListener(new MessageNotificationListener() { public void onNotification(ServerNotification notification) { if (notification.getAction() == MessageNotification.MESSAGE_RECEIVED) { messagePartsCount.getAndIncrement(); } assertEquals("ChunkingReceiver", notification.getResourceIdentifier()); } }, "ChunkingReceiver"); MuleClient client = new MuleClient(); client.dispatch("vm://inbound.channel", data, null); // Wait for the message to be received and tested (in the listener above) assertTrue(chunkingReceiverLatch.await(20L, TimeUnit.SECONDS)); // Ensure we processed expected number of message parts assertEquals(partsCount, messagePartsCount.get()); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/EndpointBridgingTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/EndpointBridgingTestCas0000644000175000017500000000207210754375733033655 0ustar charlescharles/* * $Id: EndpointBridgingTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class EndpointBridgingTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/bridge-mule.xml"; } public void testSynchronousBridging() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send("vm://bridge.inbound", "test", null); assertNotNull(result); assertEquals("Received: test", result.getPayloadAsString()); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/InboundAggregationWithTimeoutTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/InboundAggregationWithT0000644000175000017500000000343310777661265033673 0ustar charlescharles/* * $Id: InboundAggregationWithTimeoutTestCase.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing; import org.mule.api.context.notification.RoutingNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.context.notification.RoutingNotification; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class InboundAggregationWithTimeoutTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/multi-inbound-aggregator-with-timeout.xml"; } public void testAggregatorTimeout() throws Exception { final CountDownLatch latch = new CountDownLatch(1); muleContext.registerListener(new RoutingNotificationListener() { public void onNotification(ServerNotification notification) { if(notification.getAction() == RoutingNotification.CORRELATION_TIMEOUT) { latch.countDown(); } } }); String message = "test"; MuleClient client = new MuleClient(); client.dispatch("vm://distributor.queue", message, null); assertTrue(latch.await(3000, TimeUnit.MILLISECONDS)); } }././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/InboundAggregationNoTimeoutTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/InboundAggregationNoTim0000644000175000017500000000342310776710212033643 0ustar charlescharles/* * $Id: InboundAggregationNoTimeoutTestCase.java 11531 2008-04-08 15:34:34Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing; import org.mule.api.MuleMessage; import org.mule.api.MuleMessageCollection; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.List; public class InboundAggregationNoTimeoutTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/multi-inbound-aggregator-no-timeout.xml"; } public void testAggregatorWithNoTimeout() throws Exception { String message = "test"; MuleClient client = new MuleClient(); client.dispatch("vm://distributor.queue", message, null); MuleMessage result = client.request("vm://results", 10000); assertNotNull(result); assertTrue(result instanceof MuleMessageCollection); MuleMessageCollection mc = (MuleMessageCollection)result; assertEquals(3, mc.size()); for (int i = 0; i < mc.getMessagesAsArray().length; i++) { MuleMessage msg = mc.getMessagesAsArray()[i]; assertEquals("test Received", msg.getPayload()); } } public static class TestCollectionService { public Object process(List responseMessages) { assertTrue(responseMessages.size() == 3); return responseMessages; } } }mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/WireTapTestCase.java0000644000175000017500000000355610754375733033077 0ustar charlescharles/* * $Id: WireTapTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing; import org.mule.api.context.notification.ServerNotification; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestNotificationListener; import org.mule.util.concurrent.Latch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class WireTapTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/wire-tap.xml"; } public void testWireTap() throws Exception { final Latch receiverLatch = new Latch(); final Latch tappedReceiverLatch = new Latch(); muleContext.registerListener(new FunctionalTestNotificationListener() { public void onNotification(ServerNotification notification) { if (notification.getResourceIdentifier().equals("Receiver")) { receiverLatch.countDown(); } else if (notification.getResourceIdentifier().equals("TappedReceiver")) { tappedReceiverLatch.countDown(); } } }); MuleClient client = new MuleClient(); client.send("vm://inbound.channel", "test", null); assertTrue(receiverLatch.await(3L, TimeUnit.SECONDS)); assertTrue(tappedReceiverLatch.await(1L, TimeUnit.SECONDS)); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/replyto/0000755000175000017500000000000011351411050030663 5ustar charlescharles././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/replyto/ReplytoChainIntegration4TestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/replyto/ReplytoChainInt0000644000175000017500000000220010763522057033674 0ustar charlescharles/* * $Id: ReplytoChainIntegration4TestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing.replyto; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class ReplytoChainIntegration4TestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/replyto/replyto-chain-integration-test-4.xml"; } public void testReplyToChain() throws Exception { String message = "test"; MuleClient client = new MuleClient(); MuleMessage result = client.send("vm://pojo1", message, null); assertNotNull(result); assertEquals("Received: " + message, result.getPayload()); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/replyto/ReplytoChainIntegration3TestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/replyto/ReplytoChainInt0000644000175000017500000000226510763522057033707 0ustar charlescharles/* * $Id: ReplytoChainIntegration3TestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing.replyto; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class ReplytoChainIntegration3TestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/replyto/replyto-chain-integration-test-3.xml"; } public void testReplyToChain() throws Exception { String message = "test"; MuleClient client = new MuleClient(); client.dispatch("vm://pojo1", message, null); MuleMessage result = client.request("jms://response", 10000); assertNotNull(result); assertEquals("Received: " + message, result.getPayload()); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/replyto/ReplytoChainIntegration1TestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/replyto/ReplytoChainInt0000644000175000017500000000324110763522057033702 0ustar charlescharles/* * $Id: ReplytoChainIntegration1TestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing.replyto; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class ReplytoChainIntegration1TestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/replyto/replyto-chain-integration-test-1.xml"; } public void testReplyToChain() throws Exception { String message = "test"; MuleClient client = new MuleClient(); Map props = new HashMap(); props.put(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, "false"); MuleMessage result = client.send("vm://pojo1", message, props); assertNotNull(result); assertEquals("Received: " + message, result.getPayloadAsString()); } public void testReplyToChainWithoutProps() throws Exception { String message = "test"; MuleClient client = new MuleClient(); MuleMessage result = client.send("vm://pojo1", message, null); assertNotNull(result); assertEquals("Received: " + message, result.getPayloadAsString()); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/replyto/ReplytoChainIntegration2TestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/replyto/ReplytoChainInt0000644000175000017500000000250610763522057033705 0ustar charlescharles/* * $Id: ReplytoChainIntegration2TestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing.replyto; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class ReplytoChainIntegration2TestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/replyto/replyto-chain-integration-test-2.xml"; } public void testReplyToChain() throws Exception { String message = "test"; MuleClient client = new MuleClient(); Map props = new HashMap(); props.put(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, "false"); MuleMessage result = client.send("vm://pojo1", message, props); assertNotNull(result); assertEquals("Received: " + message, result.getPayload()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/nested/0000755000175000017500000000000011351411047030455 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/nested/HelloService.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/nested/HelloService.jav0000644000175000017500000000116110664630335033553 0ustar charlescharles/* * $Id: HelloService.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing.nested; public class HelloService implements HelloInterface { public String hello(String s, Integer v) { return "Hello " + s + " " + v; } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/nested/Invoker.java0000644000175000017500000000144610664630335032753 0ustar charlescharles/* * $Id: Invoker.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing.nested; public class Invoker { private HelloInterface hello; public String invoke(String s) { return "Received: " + hello.hello(s, new Integer(0xC0DE)); } public void setHello(HelloInterface hello) { this.hello = hello; } public HelloInterface getHello() { return hello; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/nested/NestedRouterTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/nested/NestedRouterTest0000644000175000017500000000322211001604632033656 0ustar charlescharles/* * $Id: NestedRouterTestCase.java 11583 2008-04-17 08:26:02Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing.nested; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class NestedRouterTestCase extends FunctionalTestCase { private static final int RECEIVE_TIMEOUT = 7000; private static final int number = 0xC0DE; protected String getConfigResources() { return "org/mule/test/integration/routing/nested/nestedrouter-test.xml"; } private void internalTest(String prefix) throws Exception { MuleClient client = new MuleClient(); String message = "Mule"; client.dispatch(prefix + "invoker.in", message, null); MuleMessage reply = client.request(prefix + "invoker.out", RECEIVE_TIMEOUT); assertNotNull(reply); assertNull(reply.getExceptionPayload()); assertEquals("Received: Hello " + message + " " + number, reply.getPayload()); } public void testNestedRouter() throws Exception { internalTest("vm://"); } public void testJmsQueueNestedRouter() throws Exception { internalTest("jms://"); } public void testJmsTopicNestedRouter() throws Exception { internalTest("jms://topic:t"); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/nested/HelloInterface.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/nested/HelloInterface.j0000644000175000017500000000104610664630335033526 0ustar charlescharles/* * $Id: HelloInterface.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing.nested; public interface HelloInterface { String hello(String s, Integer v); } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/outbound/0000755000175000017500000000000011351411047031032 5ustar charlescharles././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/outbound/ChainingRouterNullsHandlingTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/routing/outbound/ChainingRouter0000644000175000017500000000607310754375733033725 0ustar charlescharles/* * $Id: ChainingRouterNullsHandlingTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.service.ServiceException; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.NullPayload; /** */ public class ChainingRouterNullsHandlingTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/outbound/chaining-router-null-handling.xml"; } public void testNoComponentFails() throws Exception { MuleClient muleClient = new MuleClient(); MuleMessage result = muleClient.send("vm://incomingPass", new DefaultMuleMessage("thePayload")); assertNull("Shouldn't have any exceptions", result.getExceptionPayload()); assertEquals("thePayload Received component1 Received component2Pass", result.getPayloadAsString()); } public void testLastComponentFails() throws Exception { MuleClient muleClient = new MuleClient(); MuleMessage result = muleClient.send("vm://incomingLastFail", new DefaultMuleMessage("thePayload")); assertNotNull("Should be a NullPayload instead.", result); assertEquals("Should be a NullPayload instead.", NullPayload.getInstance(), result.getPayload()); assertNotNull("Should've contained an exception payload", result.getExceptionPayload()); Throwable exception = result.getExceptionPayload().getException(); assertNotNull("Exception required", exception); assertTrue("Wrong exception", exception instanceof ServiceException); String compName = ((ServiceException) exception).getService().getName(); assertEquals("Exception raised in wrong service", "component2Fail", compName); } public void testFirstComponentFails() throws Exception { MuleClient muleClient = new MuleClient(); MuleMessage result = muleClient.send("vm://incomingFirstFail", new DefaultMuleMessage("thePayload")); assertNotNull("Should be a NullPayload instead.", result); assertEquals("Should be a NullPayload instead.", NullPayload.getInstance(), result.getPayload()); assertNotNull("Should've contained an exception payload", result.getExceptionPayload()); Throwable exception = result.getExceptionPayload().getException(); assertNotNull("Exception required", exception); assertTrue("Wrong exception", exception instanceof ServiceException); String compName = ((ServiceException) exception).getService().getName(); assertEquals("Exception raised in wrong service", "component1Fail", compName); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/ServerTools.java0000644000175000017500000001336010745677442030664 0ustar charlescharles/* * $Id: ServerTools.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration; import org.mule.transport.file.filters.FilenameWildcardFilter; import org.mule.util.FileUtils; import java.io.File; import javax.jms.JMSException; import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DefaultLogger; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.ExecuteWatchdog; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Environment; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.util.Watchdog; /** * Will start external test servers needed for the integration tests */ public class ServerTools { public static final String ACTIVEMQ_HOME = "org.activemq.home"; private static KillableWatchdog activemq; private static ActiveMQConnectionFactory embeddedFactory = null; public static void launchActiveMq() { launchActiveMq(ActiveMQConnection.DEFAULT_BROKER_URL); } public static ActiveMQConnectionFactory launchEmbeddedActiveMq() throws JMSException { return new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false&broker.useJmx=false"); } public static void killEmbeddedActiveMq() { if (embeddedFactory != null) { /* try { embeddedFactory.stop(); } catch (JMSException e) { throw new RuntimeException("Could not stop embedded ActiveMQ!", e); }*/ embeddedFactory = null; } } public static void launchActiveMq(String brokerUrl) { String activeMqHome = System.getProperty(ACTIVEMQ_HOME); if (activeMqHome == null) { throw new IllegalArgumentException( "You must set the " + ACTIVEMQ_HOME + " system property to the root path of an ActiveMq distribution (v3.0 and greater) before running these tests"); } Project project = new Project(); DefaultLogger consoleLogger = new DefaultLogger(); consoleLogger.setErrorPrintStream(System.err); consoleLogger.setOutputPrintStream(System.out); consoleLogger.setMessageOutputLevel(Project.MSG_INFO); project.addBuildListener(consoleLogger); Path path = new Path(project); File[] jars = FileUtils.newFile(activeMqHome + "\\lib").listFiles(new FilenameWildcardFilter("*.jar")); path.add(new Path(project, FileUtils.newFile(activeMqHome, "\\conf").getAbsolutePath())); for (int i = 0; i < jars.length; i++) { path.add(new Path(project, jars[i].getAbsolutePath())); } jars = FileUtils.newFile(activeMqHome + "\\lib\\optional").listFiles(new FilenameWildcardFilter("*.jar")); for (int i = 0; i < jars.length; i++) { path.add(new Path(project, jars[i].getAbsolutePath())); } final JavaTask java = new JavaTask(); java.setProject(project); java.setClasspath(path); if (activeMqHome.indexOf("4.") > -1) { java.setClassname("org.apache.activemq.broker.Main"); } else { java.setClassname("org.activemq.broker.impl.Main"); } java.setArgs(brokerUrl); java.setFork(true); java.setDir(FileUtils.newFile(activeMqHome)); java.addSysproperty(createVar("activemq.home", FileUtils.newFile(activeMqHome).getAbsolutePath())); java.addSysproperty(createVar("derby.system.home", FileUtils.newFile(activeMqHome, "\\var").getAbsolutePath())); java.createWatchdog(); new Thread() { public void run() { java.execute(); } }.start(); activemq = java.watchDog; } public static void killActiveMq() { try { if (activemq != null) { activemq.kill(); } } catch (Throwable e) { e.printStackTrace(); } } static class JavaTask extends Java { public KillableWatchdog watchDog; private Long timeout = new Long(Long.MAX_VALUE); public void setTimeout(Long value) { this.timeout = value; super.setTimeout(value); } protected ExecuteWatchdog createWatchdog() throws BuildException { if (watchDog == null) { watchDog = new KillableWatchdog(timeout != null ? timeout.longValue() : 0); } return watchDog; } } static class KillableWatchdog extends ExecuteWatchdog { public KillableWatchdog(long timeout) { super(timeout); } public void timeoutOccured(Watchdog w) { // ignore } public synchronized void start(Process process) { super.start(process); } public void kill() { super.timeoutOccured(null); } } static Environment.Variable createVar(String name, String value) { Environment.Variable var = new Environment.Variable(); var.setKey(name); var.setValue(value); return var; } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/0000755000175000017500000000000011351411050027532 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/xmpp/0000755000175000017500000000000011351411050030516 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/xmpp/XmppFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/xmpp/XmppFunctionalTe0000644000175000017500000000457410745677442033744 0ustar charlescharles/* * $Id: XmppFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.xmpp; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.transport.Connector; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.FunctionalTestCase; import org.mule.transport.xmpp.XmppConnector; import org.jivesoftware.smack.XMPPConnection; // TODO Convert this test to an XML-based configuration. public class XmppFunctionalTestCase extends FunctionalTestCase { private XMPPConnection cnn; private XmppConnector connector; public void testSanity() { fail("Convert this test to an XML-based configuration"); } protected String getConfigResources() { // TODO return null; } protected void sendTestData(int iterations) throws Exception { cnn = connector.createXmppConnection(getInDest()); for (int i = 0; i < 100; i++) { cnn.createChat("mule1").sendMessage("Test Message:" + i); } } protected void receiveAndTestResults() throws Exception { Thread.sleep(7000); // seem to be getting messages after the test messages?? // TODO Enable this assert //assertTrue(callbackCount > 100); } protected EndpointURI getInDest() { try { return new MuleEndpointURI("xmpp://mule1:mule@jabber.org.au/foo"); } catch (EndpointException e) { fail(e.getMessage()); return null; } } protected EndpointURI getOutDest() { try { return new MuleEndpointURI("xmpp://mule2:mule@jabber.org.au/foobar"); } catch (EndpointException e) { fail(e.getMessage()); return null; } } protected Connector createConnector() throws Exception { connector = new XmppConnector(); connector.setName("test"); return connector; } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jms/0000755000175000017500000000000011351411050030323 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jms/activemq/0000755000175000017500000000000011351411050032134 5ustar charlescharles././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jms/QosHeadersTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jms/QosHeadersTestCas0000644000175000017500000001170510745677442033630 0ustar charlescharles/* * $Id:QosHeadersTestCase.java 7261 2007-06-27 02:23:03Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.jms; import org.mule.tck.FunctionalTestCase; import javax.jms.Connection; import javax.jms.DeliveryMode; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.activemq.ActiveMQConnectionFactory; public class QosHeadersTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/providers/jms/qosheaders-test.xml"; } public void testQosHeadersHonored() throws JMSException { String producerQueue = "test.in.kind"; String consumerQueue = "test.out.kind"; doSendReceiveCycle(producerQueue, consumerQueue, true); } public void testQosHeadersNotHonored() throws JMSException { String producerQueue = "test.in.selfish"; String consumerQueue = "test.out.selfish"; doSendReceiveCycle(producerQueue, consumerQueue, false); } /** * @param honorProperties indicate which assertion path to take */ protected void doSendReceiveCycle(final String producerQueue, final String consumerQueue, final boolean honorProperties) throws JMSException { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false&broker.useJmx=false"); Connection producerConnection = null; Connection consumerConnection = null; try { // Producer part producerConnection = connectionFactory.createConnection(); producerConnection.start(); Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination producerDestination = producerSession.createQueue(producerQueue); MessageProducer producer = producerSession.createProducer(producerDestination); // Consumer part consumerConnection = connectionFactory.createConnection(); consumerConnection.start(); Session consumerSession = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination consumerDestination = consumerSession.createQueue(consumerQueue); MessageConsumer consumer = consumerSession.createConsumer(consumerDestination); String message = "QoS Headers Propagation Test"; TextMessage textMessage = producerSession.createTextMessage(message); producer.setPriority(7); producer.setDeliveryMode(DeliveryMode.PERSISTENT); producer.send(textMessage); Message response = consumer.receive(10000); // this is ugly, but will do for this test. Man, I wish I could just pass in a closure here... if (honorProperties) { performHeadersHonoredAssertions(response); } else { performHeadersNotHonoredAssertions(response); } } finally { // Grrrr..... try { if (consumerConnection != null) { consumerConnection.close(); } } catch (JMSException e) { // don't care, just let the producer be closed as well } try { if (producerConnection != null) { producerConnection.close(); } } catch (JMSException e) { // don't care } } } protected void performHeadersHonoredAssertions(final Message response) throws JMSException { assertNotNull(response); assertEquals("JMS Priority should've been honored.", 7, response.getJMSPriority()); assertEquals("JMS Delivery mode should've been honored", DeliveryMode.PERSISTENT, response.getJMSDeliveryMode()); } protected void performHeadersNotHonoredAssertions(final Message response) throws JMSException { assertNotNull(response); // default priority assertEquals("JMS Priority should have not been honored.", 4, response.getJMSPriority()); assertEquals("JMS Delivery mode should have not been honored", DeliveryMode.NON_PERSISTENT, response.getJMSDeliveryMode()); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jms/NestedRouterTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jms/NestedRouterTestC0000644000175000017500000000231210754375733033661 0ustar charlescharles/* * $Id: NestedRouterTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.jms; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class NestedRouterTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/providers/jms/nestedrouter-test.xml"; } public void testNestedRouter() throws MuleException { MuleClient client = new MuleClient(); String message = "Mule"; client.dispatch("jms://invoker.in", message, null); MuleMessage reply = client.request("jms://invoker.out", 10000); assertNotNull(reply); assertEquals("Received: Hello " + message + " " + 0xC0DE, reply.getPayload()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jms/tools/0000755000175000017500000000000011351411050031463 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/0000755000175000017500000000000011351411050030451 5ustar charlescharles././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/OutputPatternFromEndpointTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/OutputPatternFro0000644000175000017500000000546210754375733033737 0ustar charlescharles/* * $Id: OutputPatternFromEndpointTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.file; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.util.FileUtils; import java.io.File; public class OutputPatternFromEndpointTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/providers/file/mule-file-output-pattern-from-endpoint.xml"; } public void testBasic() throws Exception { String myFirstDirName = "FirstWrite"; String mySecondDirName = "SecondWrite"; String myFileName1 = "export.txt"; String myFileName2 = "export.txt.OK"; // make sure there is no directory and file File myDir = FileUtils.newFile(myFirstDirName); if (myDir.isDirectory()) { // Delete Any Existing Files File[] files = myDir.listFiles(); for (int i = 0; i < files.length; i++) { assertTrue(files[i].delete()); } // This may fail if this directory contains other directories. assertTrue(myDir.delete()); } File myDir2 = FileUtils.newFile(mySecondDirName); if (myDir2.isDirectory()) { // Delete Any Existing Files File[] files = myDir2.listFiles(); for (int i = 0; i < files.length; i++) { assertTrue(files[i].delete()); } // This may fail if this directory contains other directories. assertTrue(myDir2.delete()); } try { assertFalse(FileUtils.newFile(myDir, myFileName1).exists()); assertFalse(FileUtils.newFile(myDir2, myFileName2).exists()); MuleClient client = new MuleClient(); client.send("vm://filesend", "Hello", null); // the output file should exist now // check that the files with the correct output pattern were generated assertTrue(FileUtils.newFile(myDir, myFileName1).exists()); assertTrue(FileUtils.newFile(myDir2, myFileName2).exists()); } finally { assertTrue(FileUtils.newFile(myDir, myFileName1).delete()); assertTrue(FileUtils.newFile(myDir2, myFileName2).delete()); assertTrue(myDir.delete()); assertTrue(myDir2.delete()); } } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/FileRuntimeExceptionStrategyFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/FileRuntimeExcep0000644000175000017500000000303210745677442033633 0ustar charlescharles/* * $Id: FileRuntimeExceptionStrategyFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.file; import org.mule.tck.FunctionalTestCase; import org.mule.util.FileUtils; import java.io.File; public class FileRuntimeExceptionStrategyFunctionalTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/providers/file/file-runtime-exception-strategy.xml"; } public void testExceptionInTransformer() throws Exception { File f = FileUtils.newFile("./.mule/in/test.txt"); f.createNewFile(); // try a couple of times with backoff strategy, then fail File errorFile = FileUtils.newFile("./.mule/errors/test-0.out"); boolean testSucceded = false; int timesTried = 0; while (timesTried <= 3) { Thread.sleep(500 * ++timesTried); if (errorFile.exists()) { testSucceded = true; break; } } if (!testSucceded) { fail("Exception strategy hasn't moved the file to the error folder."); } } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/FileExceptionStrategyFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/FileExceptionStr0000644000175000017500000000300510745677442033652 0ustar charlescharles/* * $Id: FileExceptionStrategyFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.file; import org.mule.tck.FunctionalTestCase; import org.mule.util.FileUtils; import java.io.File; public class FileExceptionStrategyFunctionalTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/providers/file/file-exception-strategy.xml"; } public void testExceptionInTransformer() throws Exception { File f = FileUtils.newFile("./.mule/in/test.txt"); f.createNewFile(); // try a couple of times with backoff strategy, then fail File errorFile = FileUtils.newFile("./.mule/errors/test-0.out"); boolean testSucceded = false; int timesTried = 0; while (timesTried <= 3) { Thread.sleep(500 * ++timesTried); if (errorFile.exists()) { testSucceded = true; break; } } if (!testSucceded) { fail("Exception strategy hasn't moved the file to the error folder."); } } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/FileAppendEndpointTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/FileAppendEndpoi0000644000175000017500000000131410745677442033572 0ustar charlescharles/* * $Id: FileAppendEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.file; public class FileAppendEndpointTestCase extends FileAppendConnectorTestCase { protected String getConfigResources() { return "org/mule/test/integration/providers/file/mule-fileappend-connector-config.xml"; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/FileAppendConnectorTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/FileAppendConnec0000644000175000017500000000432410754375733033563 0ustar charlescharles/* * $Id: FileAppendConnectorTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.file; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.util.FileUtils; import java.io.File; import java.io.FileInputStream; import org.apache.commons.io.IOUtils; public class FileAppendConnectorTestCase extends FunctionalTestCase { public void testBasic() throws Exception { String myDirName = "myout"; String myFileName = "out.txt"; FileInputStream myFileStream = null; // make sure there is no directory and file File myDir = FileUtils.newFile(myDirName); if (myDir.isDirectory()) { // Delete Any Existing Files File[] files = myDir.listFiles(); for (int i = 0; i < files.length; i++) { assertTrue(files[i].delete()); } // This may fail if this directory contains other directories. assertTrue(myDir.delete()); } try { assertFalse(FileUtils.newFile(myDir, myFileName).exists()); MuleClient client = new MuleClient(); client.send("vm://fileappend", "Hello1", null); client.send("vm://fileappend", "Hello2", null); // the output file should exist now myFileStream = new FileInputStream(FileUtils.newFile(myDir, myFileName)); assertEquals("Hello1Hello2", IOUtils.toString(myFileStream)); } finally { IOUtils.closeQuietly(myFileStream); assertTrue(FileUtils.newFile(myDir, myFileName).delete()); assertTrue(myDir.delete()); } } protected String getConfigResources() { return "org/mule/test/integration/providers/file/mule-fileappend-endpoint-config.xml"; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/FileFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/file/FileFunctionalTe0000644000175000017500000000646610763522057033623 0ustar charlescharles/* * $Id: FileFunctionalTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.file; import org.mule.api.MuleEventContext; import org.mule.api.context.notification.ServerNotification; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.tck.functional.FunctionalTestNotification; import org.mule.tck.functional.FunctionalTestNotificationListener; import org.mule.util.FileUtils; import org.mule.util.IOUtils; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.Arrays; public class FileFunctionalTestCase extends FunctionalTestCase implements FunctionalTestNotificationListener { private Object receivedData = null; //@Override protected void doSetUp() throws Exception { super.doSetUp(); muleContext.registerListener(this); } // @Override protected void doTearDown() throws Exception { super.doTearDown(); muleContext.unregisterListener(this); } // @Override protected String getConfigResources() { return "org/mule/test/integration/providers/file/file-config.xml"; } public void testRelative() throws IOException, InterruptedException { // create binary file data to be written byte[] data = new byte[100000]; for (int i = 0; i < data.length; i++) { data[i] = (byte)(Math.random() * 128); } File f = FileUtils.newFile("./test/testfile.temp"); f.createNewFile(); FileOutputStream fos = new FileOutputStream(f); IOUtils.write(data, fos); IOUtils.closeQuietly(fos); // atomically rename the file to make it available for polling f.renameTo(FileUtils.newFile(f.getPath().replaceAll(".temp", ".data"))); // give polling a chance Thread.sleep(5000); synchronized (this) { assertNotNull(receivedData); assertTrue(receivedData instanceof byte[]); byte[] receivedBytes = (byte[])receivedData; assertEquals(data.length, receivedBytes.length); assertTrue(Arrays.equals(data, receivedBytes)); } } public void onNotification(ServerNotification notification) { synchronized (this) { logger.debug("received notification: " + notification); // save the received message data for verification this.receivedData = ((FunctionalTestNotification)notification).getReplyMessage(); } } public static class FileTestComponent extends FunctionalTestComponent { public Object onCall(MuleEventContext context) throws Exception { // there should not be any transformers configured by default, so the // return message should be a byte[] super.setReturnMessage(context.transformMessage()); return super.onCall(context); } } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jdbc/0000755000175000017500000000000011351411050030434 5ustar charlescharles././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jdbc/JdbcTransactionalJdbcFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jdbc/JdbcTransactiona0000644000175000017500000000150010745677442033615 0ustar charlescharles/* * $Id: JdbcTransactionalJdbcFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.jdbc; import org.mule.api.transaction.TransactionFactory; import org.mule.transport.jdbc.JdbcTransactionFactory; public class JdbcTransactionalJdbcFunctionalTestCase extends AbstractJdbcTransactionalFunctionalTestCase { protected TransactionFactory getTransactionFactory() { return new JdbcTransactionFactory(); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jdbc/JdbcConnectionTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jdbc/JdbcConnectionTe0000644000175000017500000000547410757615756033600 0ustar charlescharles/* * $Id: JdbcConnectionTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.jdbc; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transport.SimpleRetryConnectionStrategy; import org.mule.transport.jdbc.JdbcConnector; import javax.sql.DataSource; /** * This test must be run manually. See the comments inline in testReconnection */ public class JdbcConnectionTestCase extends AbstractJdbcFunctionalTestCase { protected JdbcConnector connector; protected void emptyTable() throws Exception { // TODO this overrides super.emptyTable() - is this correct? // the entire test seems to be incomplete, see the comments below.. } public Connector createConnector() throws Exception { connector = (JdbcConnector)super.createConnector(); SimpleRetryConnectionStrategy strategy = new SimpleRetryConnectionStrategy(); strategy.setRetryCount(10); strategy.setRetryFrequency(1000); strategy.setDoThreading(true); connector.setConnectionStrategy(strategy); return connector; } public void testReconnection() throws Exception { Service service = getTestService("anOrange", Orange.class); service.setModel(model); muleContext.getRegistry().registerService(service); EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("jdbc://test?sql=SELECT * FROM TABLE", muleContext); endpointBuilder.setName("test"); endpointBuilder.setConnector(connector); InboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( endpointBuilder); muleContext.start(); connector.registerListener(service, endpoint); // The derbydb instance should be put offline before starting test // The receiver should try to connect to the database // // Then put derbydb online. // Check that the receiver reconnect and polls the database // // Put derbydb offline. // The receiver should try to connect to the database. Thread.sleep(1000); } protected DataSource createDataSource() throws Exception { return createClientDataSource(); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jdbc/AbstractJdbcTransactionalFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jdbc/AbstractJdbcTran0000644000175000017500000001413410767256152033561 0ustar charlescharles/* * $Id: AbstractJdbcTransactionalFunctionalTestCase.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.jdbc; import org.mule.DefaultExceptionStrategy; import org.mule.api.MuleEventContext; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.TransactionNotificationListener; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transaction.TransactionFactory; import org.mule.component.DefaultJavaComponent; import org.mule.context.notification.TransactionNotification; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.model.seda.SedaService; import org.mule.object.PrototypeObjectFactory; import org.mule.routing.inbound.DefaultInboundRouterCollection; import org.mule.routing.outbound.DefaultOutboundRouterCollection; import org.mule.routing.outbound.OutboundPassThroughRouter; import org.mule.tck.functional.EventCallback; import org.mule.transaction.MuleTransactionConfig; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; public abstract class AbstractJdbcTransactionalFunctionalTestCase extends AbstractJdbcFunctionalTestCase implements TransactionNotificationListener { private Transaction currentTx; protected boolean rollbacked = false; protected void doSetUp() throws Exception { super.doSetUp(); muleContext.registerListener(this); currentTx = null; } public void testReceiveAndSendWithException() throws Exception { final AtomicBoolean called = new AtomicBoolean(false); EventCallback callback = new EventCallback() { public void eventReceived(MuleEventContext context, Object component) throws Exception { try { called.set(true); currentTx = context.getCurrentTransaction(); assertNotNull(currentTx); assertTrue(currentTx.isBegun()); currentTx.setRollbackOnly(); } finally { synchronized (called) { called.notifyAll(); } } } }; // Start the server initialiseService(TransactionConfig.ACTION_ALWAYS_BEGIN, callback); muleContext.start(); execSqlUpdate("INSERT INTO TEST(TYPE, DATA, ACK, RESULT) VALUES (1, '" + DEFAULT_MESSAGE + "', NULL, NULL)"); synchronized (called) { called.wait(20000); } assertTrue(called.get()); Thread.sleep(1000); assertTrue(rollbacked); Object[] obj = execSqlQuery("SELECT COUNT(*) FROM TEST WHERE TYPE = 2"); assertNotNull(obj); assertEquals(1, obj.length); assertEquals(new Integer(0), obj[0]); obj = execSqlQuery("SELECT ACK FROM TEST WHERE TYPE = 1"); assertNotNull(obj); assertEquals(1, obj.length); assertNull(obj[0]); } public Service initialiseService(byte txBeginAction, EventCallback callback) throws Exception { Service service = new SedaService(); service.setExceptionListener(new DefaultExceptionStrategy()); service.setName("testComponent"); service.setComponent(new DefaultJavaComponent(new PrototypeObjectFactory(JdbcFunctionalTestComponent.class))); TransactionFactory tf = getTransactionFactory(); TransactionConfig txConfig = new MuleTransactionConfig(); txConfig.setFactory(tf); txConfig.setAction(txBeginAction); EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(getInDest(), muleContext); endpointBuilder.setName("testIn"); endpointBuilder.setConnector(connector); endpointBuilder.setTransactionConfig(txConfig); InboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( endpointBuilder); EndpointBuilder endpointBuilder2 = new EndpointURIEndpointBuilder(getOutDest(), muleContext); endpointBuilder2.setName("testOut"); endpointBuilder2.setConnector(connector); OutboundEndpoint outProvider = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( endpointBuilder2); service.setOutboundRouter(new DefaultOutboundRouterCollection()); OutboundPassThroughRouter router = new OutboundPassThroughRouter(); router.addEndpoint(outProvider); service.getOutboundRouter().addRouter(router); service.setInboundRouter(new DefaultInboundRouterCollection()); service.getInboundRouter().addEndpoint(endpoint); // these tests no longer work - they need replacing with config driven tests // furthemore, nothing is read from service properties any more // (except for axis and xfire related hacks) // so i am removing the code below since it's a pointless call to a deprecated method // HashMap props = new HashMap(); // props.put("eventCallback", callback); // service.setProperties(props); service.setModel(model); muleContext.getRegistry().registerService(service); return service; } public void onNotification(ServerNotification notification) { if (notification.getAction() == TransactionNotification.TRANSACTION_ROLLEDBACK) { this.rollbacked = true; } } abstract protected TransactionFactory getTransactionFactory(); } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jdbc/AbstractJdbcFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jdbc/AbstractJdbcFunc0000644000175000017500000001526110766637211033550 0ustar charlescharles/* * $Id: AbstractJdbcFunctionalTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.jdbc; import org.mule.api.MuleEventContext; import org.mule.api.model.Model; import org.mule.api.transport.Connector; import org.mule.config.PoolingProfile; import org.mule.model.seda.SedaModel; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.transport.jdbc.JdbcConnector; import org.mule.transport.jdbc.JdbcUtils; import org.mule.transport.jdbc.util.MuleDerbyUtils; import java.sql.Connection; import java.util.HashMap; import java.util.Map; import javax.sql.DataSource; import javax.sql.XADataSource; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.ArrayHandler; import org.enhydra.jdbc.standard.StandardDataSource; public abstract class AbstractJdbcFunctionalTestCase extends AbstractMuleTestCase { public static final String DEFAULT_IN_URI = "jdbc://getTest?type=1"; public static final String DEFAULT_OUT_URI = "jdbc://writeTest?type=2"; public static final String CONNECTOR_NAME = "testConnector"; public static final String DEFAULT_MESSAGE = "Test Message"; public static final String SQL_READ = "SELECT ID, TYPE, DATA, ACK, RESULT FROM TEST WHERE TYPE = ${type} AND ACK IS NULL"; public static final String SQL_ACK = "UPDATE TEST SET ACK = ${NOW} WHERE ID = ${id} AND TYPE = ${type} AND DATA = ${data}"; public static final String SQL_WRITE = "INSERT INTO TEST(TYPE, DATA, ACK, RESULT) VALUES(${type}, ${payload}, NULL, NULL)"; public static String EMBEDDED_CONNECTION_STRING; public static final String EMBEDDED_DRIVER_NAME = "org.apache.derby.jdbc.EmbeddedDriver"; public static String CLIENT_CONNECTION_STRING ; public static final String CLIENT_DRIVER_NAME = "org.apache.derby.jdbc.ClientDriver"; protected Connector connector; protected Model model; protected DataSource dataSource; private static boolean derbySetupDone = false; protected void suitePreSetUp() throws Exception { if (!derbySetupDone) { String dbName = MuleDerbyUtils.loadDatabaseName("derby.properties", "database.name"); MuleDerbyUtils.defaultDerbyCleanAndInit("derby.properties", "database.name"); EMBEDDED_CONNECTION_STRING = "jdbc:derby:" + dbName; CLIENT_CONNECTION_STRING = "jdbc:derby://localhost:1527/"+ dbName +";create=true"; derbySetupDone = true; } super.suitePreSetUp(); } protected void doSetUp() throws Exception { SedaModel model = new SedaModel(); model.setName("main"); model.getPoolingProfile().setInitialisationPolicy( PoolingProfile.INITIALISE_ONE); muleContext.getRegistry().registerModel(model); // Create and register connector connector = createConnector(); muleContext.getRegistry().registerConnector(connector); // Empty table emptyTable(); } protected void emptyTable() throws Exception { try { execSqlUpdate("DELETE FROM TEST"); } catch (Exception e) { execSqlUpdate("CREATE TABLE TEST(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,TYPE INTEGER,DATA VARCHAR(255),ACK TIMESTAMP,RESULT VARCHAR(255))"); } } protected int execSqlUpdate(String sql) throws Exception { Connection con = null; try { con = getConnection(); return new QueryRunner().update(con, sql); } finally { JdbcUtils.close(con); } } protected Object[] execSqlQuery(String sql) throws Exception { Connection con = null; try { con = getConnection(); return (Object[])new QueryRunner().query(con, sql, new ArrayHandler()); } finally { JdbcUtils.close(con); } } public static class JdbcFunctionalTestComponent extends FunctionalTestComponent { public Object onCall(MuleEventContext context) throws Exception { if (getEventCallback() != null) { getEventCallback().eventReceived(context, this); } Map map = (Map)context.getMessage().getPayload(); return map.get("data") + " Received"; } } public Connection getConnection() throws Exception { Object dataSource = getDataSource(); if (dataSource instanceof DataSource) { return ((DataSource)dataSource).getConnection(); } else { return ((XADataSource)dataSource).getXAConnection().getConnection(); } } public DataSource getDataSource() throws Exception { if (dataSource == null) { dataSource = createDataSource(); } return dataSource; } public Connector createConnector() throws Exception { JdbcConnector connector = new JdbcConnector(); connector.setDataSource(getDataSource()); connector.setName(CONNECTOR_NAME); connector.getDispatcherThreadingProfile().setDoThreading(false); connector.setPollingFrequency(5000); Map queries = new HashMap(); queries.put("getTest", SQL_READ); queries.put("getTest.ack", SQL_ACK); queries.put("writeTest", SQL_WRITE); connector.setQueries(queries); return connector; } protected String getInDest() { return DEFAULT_IN_URI; } protected String getOutDest() { return DEFAULT_OUT_URI; } //by default use the embedded datasource protected DataSource createDataSource() throws Exception { return createEmbeddedDataSource(); } protected DataSource createEmbeddedDataSource() throws Exception { StandardDataSource ds = new StandardDataSource(); ds.setDriverName(EMBEDDED_DRIVER_NAME); ds.setUrl(EMBEDDED_CONNECTION_STRING); return ds; } protected DataSource createClientDataSource() throws Exception { StandardDataSource ds = new StandardDataSource(); ds.setDriverName(CLIENT_DRIVER_NAME); ds.setUrl(CLIENT_CONNECTION_STRING); return ds; } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jdbc/JdbcTransactionalXaFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/jdbc/JdbcTransactiona0000644000175000017500000000320310764101307033576 0ustar charlescharles/* * $Id: JdbcTransactionalXaFunctionalTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.jdbc; import org.mule.api.transaction.TransactionFactory; import org.mule.module.jboss.transaction.JBossArjunaTransactionManagerFactory; import org.mule.transaction.XaTransactionFactory; import org.mule.transport.jdbc.xa.DataSourceWrapper; import javax.sql.DataSource; import javax.transaction.TransactionManager; import org.enhydra.jdbc.standard.StandardXADataSource; public class JdbcTransactionalXaFunctionalTestCase extends AbstractJdbcTransactionalFunctionalTestCase { private TransactionManager txManager; protected void doSetUp() throws Exception { txManager = new JBossArjunaTransactionManagerFactory().create(); super.doSetUp(); muleContext.setTransactionManager(txManager); } protected TransactionFactory getTransactionFactory() { return new XaTransactionFactory(); } protected DataSource createDataSource() throws Exception { StandardXADataSource ds = new StandardXADataSource(); ds.setDriverName(EMBEDDED_DRIVER_NAME); ds.setUrl(EMBEDDED_CONNECTION_STRING); ds.setTransactionManager(txManager); return new DataSourceWrapper(ds, txManager); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/axis/0000755000175000017500000000000011351411050030476 5ustar charlescharles././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/axis/AbstractAxisOverJMSWithTransactionsTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/axis/AbstractAxisOver0000644000175000017500000000425410754375733033701 0ustar charlescharles/* * $Id: AbstractAxisOverJMSWithTransactionsTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.axis; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.transport.Connector; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.soap.axis.AxisConnector; import java.util.Collection; import java.util.Iterator; public abstract class AbstractAxisOverJMSWithTransactionsTestCase extends FunctionalTestCase { public void testTransactionPropertiesOnEndpoint() throws Exception { Collection connectors = muleContext.getRegistry().lookupObjects(Connector.class); AxisConnector connector = null; for (Iterator iterator = connectors.iterator(); iterator.hasNext();) { Connector candidate = (Connector) iterator.next(); if (candidate instanceof AxisConnector) { connector = (AxisConnector) candidate; } } assertNotNull(connector); //This no longer works because the Axis descriptor name is made unique per connector //MuleDescriptor axisDescriptor = (MuleDescriptor)MuleManager.getInstance().lookupModel(ModelHelper.SYSTEM_MODEL).getDescriptor(connector.AXIS_SERVICE_COMPONENT_NAME); //assertNotNull(axisDescriptor.getInboundRouter().getEndpoint("jms.TestComponent").getTransactionConfig()); } public void testTransactionsOverAxis() throws Exception{ MuleClient client = new MuleClient(); client.dispatch("axis:jms://TestComponent?method=echo", new DefaultMuleMessage("test")); MuleMessage message = client.request("jms://testout", 5000); assertNotNull(message.getPayload()); assertTrue(message.getPayloadAsString().equals("test")); } }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/axis/AxisOverJMSWithTransactionsTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/axis/AxisOverJMSWithT0000644000175000017500000000143310745677442033545 0ustar charlescharles/* * $Id: AxisOverJMSWithTransactionsTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.axis; /** * Reference to a global transaction factort */ public class AxisOverJMSWithTransactionsTestCase extends AbstractAxisOverJMSWithTransactionsTestCase { protected String getConfigResources() { return "org/mule/test/integration/providers/axis/axis-over-jms-config.xml"; } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/axis/AxisOverJMSWithTransactionsAlternateTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/transport/axis/AxisOverJMSWithT0000644000175000017500000000144710745677442033552 0ustar charlescharles/* * $Id: AxisOverJMSWithTransactionsAlternateTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.transport.axis; /** * Embedded transaction factory */ public class AxisOverJMSWithTransactionsAlternateTestCase extends AbstractAxisOverJMSWithTransactionsTestCase { protected String getConfigResources() { return "org/mule/test/integration/providers/axis/axis-over-jms-config-alternate.xml"; } }mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/xml/0000755000175000017500000000000011351411050026276 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/message/0000755000175000017500000000000011351411047027130 5ustar charlescharles././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/message/AttachmentsPropagationTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/message/AttachmentsPropagationT0000644000175000017500000001115510754375733033702 0ustar charlescharles/* * $Id: AttachmentsPropagationTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.message; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.transport.email.transformers.PlainTextDataSource; import javax.activation.DataHandler; public class AttachmentsPropagationTestCase extends AbstractMuleTestCase implements EventCallback { public void testSanity() { fail("Convert this test to an XML-based configuration"); } // @Override protected void doSetUp() throws Exception { super.doSetUp(); // TODO Convert this to an XML config // EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("vm://Single", muleContext); // endpointBuilder.setName("SingleEndpoint"); // ImmutableEndpoint vmSingle = muleContext.getRegistry() // .lookupEndpointFactory() // .getOutboundEndpoint(endpointBuilder, muleContext); // // EndpointBuilder endpointBuilder2 = new EndpointURIEndpointBuilder("vm://Single", muleContext); // endpointBuilder2.setName("ChainedEndpoint"); // ImmutableEndpoint vmChained = muleContext.getRegistry() // .lookupEndpointFactory() // .getOutboundEndpoint(endpointBuilder2, muleContext); // // FunctionalTestComponent single = new FunctionalTestComponent(); // single.setEventCallback(this); // FunctionalTestComponent chained = new FunctionalTestComponent(); // chained.setEventCallback(this); // builder.registerComponentInstance(single, "SINGLE", vmSingle.getEndpointURI()); // builder.registerComponentInstance(chained, "CHAINED", vmChained.getEndpointURI(), vmSingle // .getEndpointURI()); } public void eventReceived(MuleEventContext context, Object component) throws Exception { MuleMessage message = context.getMessage(); // add an attachment, named after the componentname... message.addAttachment(context.getService().getName(), new DataHandler( new PlainTextDataSource("text/plain", ""))); // return the list of attachment names FunctionalTestComponent fc = (FunctionalTestComponent) component; fc.setReturnMessage(message.getAttachmentNames().toString()); } public void testSingleComponentKnowsAttachments() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send("vm://Single", "", null); assertNotNull(result); // expect SINGLE attachment from SINGLE service assertEquals("[SINGLE]", result.getPayloadAsString()); } public void testChainedComponentKnowsAttachments() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send("vm://Chained", "", null); assertNotNull(result); // expect CHAINED attachment from CHAINED service // and SINGLE attachment from SINGLE service assertEquals("[SINGLE, CHAINED]", result.getPayloadAsString()); } public void testClientReceivesAttachments() throws Exception { // a MuleClient should be able to receive attachments MuleClient client = new MuleClient(); MuleMessage result = client.send("vm://Single", "", null); assertNotNull(result); // expect SINGLE attachment from SINGLE service assertEquals("[SINGLE]", result.getPayloadAsString()); assertNotNull(result.getAttachment("SINGLE")); assertEquals("", result.getAttachment("SINGLE").getContent().toString()); result = client.send("vm://Chained", "", null); assertNotNull(result); // expect SINGLE and CHAINED attachments assertEquals("[SINGLE, CHAINED]", result.getPayloadAsString()); assertNotNull(result.getAttachment("SINGLE")); assertEquals("", result.getAttachment("SINGLE").getContent().toString()); assertNotNull(result.getAttachment("CHAINED")); assertEquals("", result.getAttachment("CHAINED").getContent().toString()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/util/0000755000175000017500000000000011351411050026453 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/util/ObjectNameHelperTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/test/integration/util/ObjectNameHelperTestCase.j0000644000175000017500000000603310745677442033464 0ustar charlescharles/* * $Id: ObjectNameHelperTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.test.integration.util; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.AbstractMuleTestCase; public class ObjectNameHelperTestCase extends AbstractMuleTestCase { public void testEndpointAutomaticNames() throws Exception { ImmutableEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "test://cn=foo,name=queue"); muleContext.getRegistry().registerEndpoint(ep); assertEquals("endpoint.test.cn.foo.name.queue", ep.getName()); ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("test://cn=foo,name=queue"); assertEquals("endpoint.test.cn.foo.name.queue.1", ep.getName()); // Test generating a unique name when there is a matching endpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("vm://my.queue"); assertEquals("endpoint.vm.my.queue", ep.getName()); ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "pop3://ross:secret@mail.mycompany.com?subject=foo"); assertEquals("endpoint.pop3.ross.mycompany.com", ep.getName()); } public void testEndpointNames() throws Exception { ImmutableEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "test://cn=foo,name=queue?endpointName=foo"); muleContext.getRegistry().registerEndpoint(ep); assertEquals("foo", ep.getName()); ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "test://cn=foo,name=queue?endpointName=this_is@aWierd-Name:x"); assertEquals("this.is.aWierd.Name.x", ep.getName()); muleContext.getRegistry().registerEndpoint(ep); // Test generating a unique name when there is a matching endpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "test://cn=foo,name=queue?endpointName=this_is@aWierd-Name:x"); assertEquals("this.is.aWierd.Name.x", ep.getName()); ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "test://cn=foo,name=queue?endpointName=this____is+another=@Wierd----Name:x:::"); assertEquals("this.is.another.Wierd.Name.x", ep.getName()); } public void testTestEndpoint() throws Exception { ImmutableEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "test://exception.listener"); muleContext.getRegistry().registerEndpoint(ep); assertEquals("endpoint.test.exception.listener", ep.getName()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/context/0000755000175000017500000000000011351411052023662 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/0000755000175000017500000000000011351411052026350 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/RestrictedNode.java0000644000175000017500000000205010754375733032153 0ustar charlescharles/* * $Id: RestrictedNode.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; /** * An implementation detail - this enforces the guarantee that once * {@link Node#serial(RestrictedNode)} is called, {@link Node#parallel(RestrictedNode)} cannot be. */ interface RestrictedNode { public RestrictedNode serial(RestrictedNode node); public int match(ServerNotification notification); public boolean contains(Class clazz, int action); public boolean isExhausted(); /** * @return Any remaining node */ public RestrictedNode getAnyRemaining(); Class getNotificationClass(); } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/MessageNotificationLogger.javamule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/MessageNotificationLogger.j0000644000175000017500000000130010755041255033623 0ustar charlescharles/* * $Id: MessageNotificationLogger.java 10803 2008-02-14 13:31:25Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.MessageNotificationListener; public class MessageNotificationLogger extends AbstractNotificationLogger implements MessageNotificationListener { // nothing to do here } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/MessageNotificationTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/MessageNotificationTestCase0000644000175000017500000000434110754375733033711 0ustar charlescharles/* * $Id: MessageNotificationTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.module.client.MuleClient; public class MessageNotificationTestCase extends AbstractNotificationTestCase { public static final String SERVICE_1 = "service-1"; public static final String SERVICE_2 = "service-2"; public static final String CLIENT = null; // client id is null protected String getConfigResources() { return "org/mule/test/integration/notifications/message-notification-test.xml"; } public void doTest() throws Exception { MuleClient client = new MuleClient(); assertNotNull(client.send("vm://in-1?connector=direct", "hello sweet world", null)); client.dispatch("vm://in-2?connector=direct", "goodbye cruel world", null); assertNotNull(client.request("vm://out-2?connector=queue", 5000)); } public RestrictedNode getSpecification() { return new Node() .parallel(new Node(MessageNotification.class, MessageNotification.MESSAGE_SENT, CLIENT)) .parallel(new Node(MessageNotification.class, MessageNotification.MESSAGE_RECEIVED, SERVICE_1)) .parallel(new Node(MessageNotification.class, MessageNotification.MESSAGE_DISPATCHED, CLIENT)) .parallel(new Node(MessageNotification.class, MessageNotification.MESSAGE_RECEIVED, SERVICE_2)) .parallel(new Node(MessageNotification.class, MessageNotification.MESSAGE_DISPATCHED, SERVICE_2)) .parallel(new Node(MessageNotification.class, MessageNotification.MESSAGE_REQUESTED, CLIENT)); } public void validateSpecification(RestrictedNode spec) throws Exception { verifyAllNotifications(spec, MessageNotification.class, MessageNotification.MESSAGE_RECEIVED, MessageNotification.MESSAGE_REQUESTED); } }mule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/Node.java0000644000175000017500000001750110754375733030131 0ustar charlescharles/* * $Id: Node.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.BlockingServerEvent; import java.util.Set; import java.util.HashSet; import java.util.LinkedList; import java.util.Iterator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * We test notifications by defining a "tree" of expected responses (this is needed because the system is * multithreaded and only some ordering is guaranteed serial; other actions happen in parallel) * Each node can test for a notification and then has a set of parallel nodes, which describe which notifications * happen next in any order. * Finally, after all parallel nodes are matched, a node has a set of serial nodes, which are matched in order. * *

Note that nested nodes may themselves have structure and that empty nodes are available, which can * help group dependencies. * *

More exactly, we specify a tree and a traversal - the traversal is hardcoded below, and implicit in * the instructions above. */ class Node implements RestrictedNode { // enumeration describing result of checking at this node public static final int SUCCESS = 0; public static final int FAILURE = 1; public static final int EMPTY = 2; // the data for this node private Class clazz = null; private int action; private String id; private boolean isIdDefined = false; // allow null IDs to be specified private boolean nodeOk = false; protected final transient Log logger = LogFactory.getLog(this.getClass()); // any of these can run after this private Set parallel = new HashSet(); // only once the parallel are done, this runs private LinkedList serial = new LinkedList(); public Node(Class clazz, int action, String id) { this(clazz, action); this.id = id; isIdDefined = true; } public Node(Class clazz, int action) { this.clazz = clazz; this.action = action; } public Node() { nodeOk = true; } public Node parallel(RestrictedNode node) { if (null != node.getNotificationClass() && BlockingServerEvent.class.isAssignableFrom(node.getNotificationClass())) { logger.warn("Registered blocking event as parallel: " + node); } parallel.add(node); return this; } /** * Avoid warnings when we need to add a synch event as parallel for other reasons * (typically because there's more than one model generating some event) */ public Node parallelSynch(RestrictedNode node) { if (null != node.getNotificationClass() && !BlockingServerEvent.class.isAssignableFrom(node.getNotificationClass())) { throw new IllegalStateException("Node " + node + " is not a synch event"); } parallel.add(node); return this; } public RestrictedNode serial(RestrictedNode node) { if (null != node.getNotificationClass() && !BlockingServerEvent.class.isAssignableFrom(node.getNotificationClass())) { logger.warn("Registered non-blocking event as serial: " + node); } serial.addLast(node); return this; } /** * @param notification * @return whether the notification was matched or not (for this node or any child) */ public int match(ServerNotification notification) { // if we need to check ourselves, just do that if (!nodeOk) { if (testLocal(notification)) { nodeOk = true; return SUCCESS; } else { return FAILURE; } } // otherwise, if we have parallel children, try them if (parallel.size() > 0) { for (Iterator children = parallel.iterator(); children.hasNext();) { Node child = (Node) children.next(); switch (child.match(notification)) { case SUCCESS: return SUCCESS; case EMPTY: // the node was empty, clean out children.remove(); break; case FAILURE: break; default: throw new IllegalStateException("Bad return from child"); } } } // if we've still got parallel children, we failed if (parallel.size() > 0) { return FAILURE; } // otherwise, serial children if (serial.size() > 0) { for (Iterator children = serial.iterator(); children.hasNext();) { Node child = (Node) children.next(); switch (child.match(notification)) { case SUCCESS: return SUCCESS; case EMPTY: // the node was empty, clean out children.remove(); break; case FAILURE: return FAILURE; // note this is different to parallel case default: throw new IllegalStateException("Bad return from child"); } } } if (serial.size() > 0) { return FAILURE; } else { return EMPTY; } } private boolean testLocal(ServerNotification notification) { return clazz.equals(notification.getClass()) && action == notification.getAction() && (!isIdDefined || (null == id && null == notification.getResourceIdentifier()) || (null != id && id.equals(notification.getResourceIdentifier()))); } public boolean contains(Class clazz, int action) { if (null != this.clazz && this.clazz.equals(clazz) && this.action == action) { return true; } for (Iterator children = parallel.iterator(); children.hasNext();) { if (((RestrictedNode) children.next()).contains(clazz, action)) { return true; } } for (Iterator children = serial.iterator(); children.hasNext();) { if (((RestrictedNode) children.next()).contains(clazz, action)) { return true; } } return false; } public RestrictedNode getAnyRemaining() { if (! nodeOk) { return this; } for (Iterator children = parallel.iterator(); children.hasNext();) { RestrictedNode any = ((RestrictedNode) children.next()).getAnyRemaining(); if (null != any) { return any; } } for (Iterator children = serial.iterator(); children.hasNext();) { RestrictedNode any = ((RestrictedNode) children.next()).getAnyRemaining(); if (null != any) { return any; } } return null; } public boolean isExhausted() { return null == getAnyRemaining(); } public Class getNotificationClass() { return clazz; } public String toString() { return clazz + ": " + action + (isIdDefined ? ": " + id : ""); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/ServerNotificationManagerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/ServerNotificationManagerTe0000644000175000017500000001536710763554366033736 0ustar charlescharles/* * $Id: ServerNotificationManagerTestCase.java 11181 2008-03-05 17:31:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.service.Service; import org.mule.module.client.MuleClient; public class ServerNotificationManagerTestCase extends AbstractNotificationTestCase { public static final String MULE_SYSTEM_MODEL = "_muleSystemModel"; public static final String MODEL = "the-model"; public static final String SERVICE = "the-service"; protected String getConfigResources() { return "org/mule/test/integration/notifications/server-notification-manager-test.xml"; } public void doTest() throws Exception { MuleClient client = new MuleClient(); assertNotNull(client.send("vm://in", "hello world", null)); Service service = muleContext.getRegistry().lookupService(SERVICE); service.pause(); service.resume(); } public RestrictedNode getSpecification() { return new Node() // all service events are asynchronous, so place parallel to rest .parallel(new Node(ServiceNotification.class, ServiceNotification.SERVICE_INITIALISED, SERVICE)) .parallel(new Node(ServiceNotification.class, ServiceNotification.SERVICE_STARTED, SERVICE)) .parallel(new Node(ServiceNotification.class, ServiceNotification.SERVICE_PAUSED, SERVICE)) .parallel(new Node(ServiceNotification.class, ServiceNotification.SERVICE_RESUMED, SERVICE)) .parallel(new Node(ServiceNotification.class, ServiceNotification.SERVICE_STOPPING, SERVICE)) .parallel(new Node(ServiceNotification.class, ServiceNotification.SERVICE_STOPPED, SERVICE)) .parallel(new Node(ServiceNotification.class, ServiceNotification.SERVICE_DISPOSED, SERVICE)) // synchronous events start here .parallel(new Node() // parallel because we don't know which model .parallelSynch(new Node(ModelNotification.class, ModelNotification.MODEL_INITIALISING, MULE_SYSTEM_MODEL) .serial(new Node(ModelNotification.class, ModelNotification.MODEL_INITIALISED, MULE_SYSTEM_MODEL))) .parallelSynch(new Node(ModelNotification.class, ModelNotification.MODEL_INITIALISING, MODEL) .serial(new Node(ModelNotification.class, ModelNotification.MODEL_INITIALISED, MODEL))) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_STARTING)) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_STARTING_MODELS) // parallel because we don't know which model .parallelSynch(new Node(ModelNotification.class, ModelNotification.MODEL_STARTING, MODEL) .serial(new Node(ModelNotification.class, ModelNotification.MODEL_STARTED, MODEL))) .parallelSynch(new Node(ModelNotification.class, ModelNotification.MODEL_STARTING, MULE_SYSTEM_MODEL) .serial(new Node(ModelNotification.class, ModelNotification.MODEL_STARTED, MULE_SYSTEM_MODEL)))) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_STARTED_MODELS)) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_STARTED)) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_DISPOSING)) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_STOPPING)) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_STOPPING_MODELS) // parallel because we don't know which model .parallelSynch(new Node(ModelNotification.class, ModelNotification.MODEL_STOPPING, MODEL) .serial(new Node(ModelNotification.class, ModelNotification.MODEL_STOPPED, MODEL))) .parallelSynch(new Node(ModelNotification.class, ModelNotification.MODEL_STOPPING, MULE_SYSTEM_MODEL) .serial(new Node(ModelNotification.class, ModelNotification.MODEL_STOPPED, MULE_SYSTEM_MODEL)))) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_STOPPED_MODELS)) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_STOPPED)) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_DISPOSING_CONNECTORS)) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_DISPOSED_CONNECTORS) // parallel because we don't know which model .parallelSynch(new Node(ModelNotification.class, ModelNotification.MODEL_DISPOSING, MODEL) .serial(new Node(ModelNotification.class, ModelNotification.MODEL_DISPOSED, MODEL))) .parallelSynch(new Node(ModelNotification.class, ModelNotification.MODEL_DISPOSING, MULE_SYSTEM_MODEL) .serial(new Node(ModelNotification.class, ModelNotification.MODEL_DISPOSED, MULE_SYSTEM_MODEL)))) .serial(new Node(MuleContextNotification.class, MuleContextNotification.CONTEXT_DISPOSED))); } public void validateSpecification(RestrictedNode spec) throws Exception { verifyAllNotifications(spec, ModelNotification.class, ModelNotification.MODEL_INITIALISING, ModelNotification.MODEL_INITIALISED); // no model/listener notifications verifyAllNotifications(spec, ModelNotification.class, ModelNotification.MODEL_STARTING, ModelNotification.MODEL_DISPOSED); verifyAllNotifications(spec, ServiceNotification.class, ServiceNotification.SERVICE_INITIALISED, ServiceNotification.SERVICE_STOPPING); // no manager initialising or initialised verifyAllNotifications(spec, MuleContextNotification.class, MuleContextNotification.CONTEXT_STARTING, MuleContextNotification.CONTEXT_STOPPED_MODELS); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/ExceptionNotificationLogger.javamule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/ExceptionNotificationLogger0000644000175000017500000000131010755041255033746 0ustar charlescharles/* * $Id: ExceptionNotificationLogger.java 10803 2008-02-14 13:31:25Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ExceptionNotificationListener; public class ExceptionNotificationLogger extends AbstractNotificationLogger implements ExceptionNotificationListener { // nothing to do here } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/ServerNotificationLogger.javamule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/ServerNotificationLogger.ja0000644000175000017500000000161010763554366033665 0ustar charlescharles/* * $Id: ServerNotificationLogger.java 11181 2008-03-05 17:31:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.MuleContextNotificationListener; import org.mule.api.context.notification.ModelNotificationListener; import org.mule.api.context.notification.ServiceNotificationListener; public class ServerNotificationLogger extends AbstractNotificationLogger implements ServiceNotificationListener, MuleContextNotificationListener, ModelNotificationListener { // nothing to do here } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/ExceptionNotificationTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/ExceptionNotificationTestCa0000644000175000017500000000245510754375733033737 0ustar charlescharles/* * $Id: ExceptionNotificationTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.module.client.MuleClient; public class ExceptionNotificationTestCase extends AbstractNotificationTestCase { protected String getConfigResources() { return "org/mule/test/integration/notifications/exception-notification-test.xml"; } public void doTest() throws Exception { MuleClient client = new MuleClient(); assertNotNull(client.send("vm://in-1", "hello world", null)); } public RestrictedNode getSpecification() { return new Node(ExceptionNotification.class, ExceptionNotification.EXCEPTION_ACTION); } public void validateSpecification(RestrictedNode spec) throws Exception { verifyAllNotifications(spec, ExceptionNotification.class, ExceptionNotification.EXCEPTION_ACTION, ExceptionNotification.EXCEPTION_ACTION); } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/AbstractNotificationTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/AbstractNotificationTestCas0000644000175000017500000000642210767631050033714 0ustar charlescharles/* * $Id: AbstractNotificationTestCase.java 11413 2008-03-18 03:08:24Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; import org.mule.tck.FunctionalTestCase; import java.util.Iterator; /** * Tests must define a "notificationLogger" listener */ public abstract class AbstractNotificationTestCase extends FunctionalTestCase { private AbstractNotificationLogger notifications; public AbstractNotificationTestCase() { super(); setDisposeManagerPerSuite(true); } public final void testNotifications() throws Exception { doTest(); notifications = (AbstractNotificationLogger) muleContext.getRegistry().lookupObject("notificationLogger"); } public abstract void doTest() throws Exception; public abstract RestrictedNode getSpecification(); public abstract void validateSpecification(RestrictedNode spec) throws Exception; protected void suitePostTearDown() throws Exception { // Need to explicitly dispose manager here to get disposal notifications muleContext.dispose(); // allow shutdown to complete (or get concurrent mod errors and/or miss notifications) Thread.sleep(2000L); logNotifications(); RestrictedNode spec = getSpecification(); validateSpecification(spec); assertExpectedNotifications(spec); } protected void logNotifications() { logger.info("Number of notifications: " + notifications.getNotifications().size()); for (Iterator iterator = notifications.getNotifications().iterator(); iterator.hasNext();) { ServerNotification notification = (ServerNotification) iterator.next(); logger.info(notification); } } /** * This is destructive - do not use spec after calling this routine */ protected void assertExpectedNotifications(RestrictedNode spec) { for (Iterator iterator = notifications.getNotifications().iterator(); iterator.hasNext();) { ServerNotification notification = (ServerNotification) iterator.next(); switch (spec.match(notification)) { case Node.SUCCESS: break; case Node.FAILURE: fail("Could not match " + notification); break; case Node.EMPTY: fail("Extra notification: " + notification); } } if (!spec.isExhausted()) { fail("Specification not exhausted: " + spec.getAnyRemaining()); } } protected void verifyAllNotifications(RestrictedNode spec, Class clazz, int from, int to) { for (int action = from; action <= to; ++action) { if (!spec.contains(clazz, action)) { fail("Specification missed action " + action + " for class " + clazz); } } } }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/AbstractNotificationLogger.javamule-2.0.1/tests/integration/src/test/java/org/mule/context/notification/AbstractNotificationLogger.0000644000175000017500000000162310755041255033640 0ustar charlescharles/* * $Id: AbstractNotificationLogger.java 10803 2008-02-14 13:31:25Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; import java.util.LinkedList; import java.util.List; public abstract class AbstractNotificationLogger { private LinkedList notifications = new LinkedList(); public synchronized void onNotification(ServerNotification notification) { notifications.addLast(notification); } public List getNotifications() { return notifications; } } mule-2.0.1/tests/integration/src/test/java/org/mule/config/0000755000175000017500000000000011351411052023443 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/0000755000175000017500000000000011351411052024745 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/FunctionalTestAdvice.java0000644000175000017500000000240510766463006031706 0ustar charlescharles/* * $Id: FunctionalTestAdvice.java 11366 2008-03-14 11:48:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.util.concurrent.Latch; import org.mule.api.MuleEventContext; import java.lang.reflect.Method; import org.springframework.aop.MethodBeforeAdvice; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class FunctionalTestAdvice implements MethodBeforeAdvice { private Latch latch = new Latch(); private String message; public void before(Method method, Object[] args, Object target) throws Throwable { if (null != args && args.length == 1 && args[0] instanceof MuleEventContext) { message = ((MuleEventContext) args[0]).getMessageAsString(); } latch.countDown(); } public String getMessage(long ms) throws InterruptedException { latch.await(ms, TimeUnit.MILLISECONDS); return message; } } mule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/TimingInterceptor.java0000644000175000017500000000234210762020555031270 0ustar charlescharles/* * $Id: TimingInterceptor.java 11130 2008-02-29 15:14:53Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.interceptor.Interceptor; import org.mule.api.interceptor.Invocation; import org.mule.api.MuleMessage; import org.mule.api.MuleException; public class TimingInterceptor implements Interceptor { public static final long UNCALLED = -1L; private long interval = UNCALLED; public MuleMessage intercept(Invocation invocation) throws MuleException { long start = System.currentTimeMillis(); try { // call the component invocation.execute(); // let the framework construct the correct message return null; } finally { interval = System.currentTimeMillis() - start; } } public long getInterval() { return interval; } } mule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/VmSchemaValidationTestCase.java0000644000175000017500000000152410755331235032777 0ustar charlescharles/* * $Id: VmSchemaValidationTestCase.java 10816 2008-02-15 15:41:17Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import java.io.IOException; import org.xml.sax.SAXException; public class VmSchemaValidationTestCase extends AbstractSchemaValidationTestCase { public void testRootSchema() throws IOException, SAXException { addSchema("http://www.mulesource.org/schema/mule/vm/2.0", "META-INF/mule-vm.xsd"); doTest("org/mule/config/spring/vm-validation-test.xml"); } }mule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/InterceptorAdapterTestCase.java0000644000175000017500000000243010770356575033070 0ustar charlescharles/* * $Id: InterceptorAdapterTestCase.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class InterceptorAdapterTestCase extends FunctionalTestCase { public static final String MESSAGE = "squeak"; protected String getConfigResources() { return "org/mule/config/spring/interceptor-adapter-test.xml"; } public void testInterceptor() throws Exception { MuleClient client = new MuleClient(); MuleMessage response = client.send("vm://in", MESSAGE, null); assertEquals(MESSAGE, response.getPayloadAsString()); TimingInterceptor timer = (TimingInterceptor) muleContext.getRegistry().lookupObject("timer"); assertNotNull(timer); long ms = timer.getInterval(); assertTrue(TimingInterceptor.UNCALLED != ms); } }mule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/ComponentInterceptorTestCase.java0000644000175000017500000000206210756305520033437 0ustar charlescharles/* * $Id: ComponentInterceptorTestCase.java 10845 2008-02-18 13:42:40Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.module.client.MuleClient; import org.mule.api.MuleException; /** * MULE-2999 - This fails because we do not register components with the spring registry. */ public class ComponentInterceptorTestCase extends AbstractInterceptorTestCase { protected String getConfigResources() { return "org/mule/config/spring/component-interceptor-test.xml"; } public void testInterceptor() throws MuleException, InterruptedException { MuleClient client = new MuleClient(); client.send("vm://in", MESSAGE, null); assertMessageIntercepted(); } }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/AbstractSchemaValidationTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/AbstractSchemaValidationTestCase.j0000644000175000017500000000602410755336022033467 0ustar charlescharles/* * $Id: AbstractSchemaValidationTestCase.java 10818 2008-02-15 16:21:38Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; import java.util.Map; import java.util.Iterator; import javax.xml.XMLConstants; import javax.xml.transform.stream.StreamSource; import javax.xml.transform.Source; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import org.xml.sax.SAXException; import org.apache.commons.collections.map.HashedMap; public abstract class AbstractSchemaValidationTestCase extends AbstractMuleTestCase { public static final String SEPARATOR = " "; private Map schemas = new HashedMap(); // we define these locally so that tests use the latest version rather than grabbing xsi:location protected void doSetUp() throws Exception { addSchema("http://www.mulesource.org/schema/mule/core/2.0", "META-INF/mule.xsd"); } protected void addSchema(String name, String location) { schemas.put(name, location); } protected Source[] getSchemasAsSources() throws IOException { Source[] sources = new Source[schemas.size()]; int index = 0; for (Iterator keys = schemas.keySet().iterator(); keys.hasNext();) { String name = (String) keys.next(); String location = (String) schemas.get(name); sources[index++] = load(location); } return sources; } protected void doTest(String config) throws SAXException, IOException { SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); schemaFactory.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true); Schema schema = schemaFactory.newSchema(getSchemasAsSources()); schema.newValidator().validate(load(config)); } protected Source load(String name) throws IOException { InputStream stream = IOUtils.getResourceAsStream(name, getClass()); assertNotNull("Cannot load " + name, stream); return new StreamSource(stream); } public void testSchemaLocations() throws IOException { for (Iterator keys = schemas.keySet().iterator(); keys.hasNext();) { String name = (String) keys.next(); String location = (String) schemas.get(name); logger.debug("checking " + location + " for " + name); InputStream stream = IOUtils.getResourceAsStream(location, getClass()); assertNotNull("Cannot load " + location + " for " + name, stream); stream.close(); } } }mule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/RootSchemaValidationTestCase.java0000644000175000017500000000137710755331235033346 0ustar charlescharles/* * $Id: RootSchemaValidationTestCase.java 10816 2008-02-15 15:41:17Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import java.io.IOException; import org.xml.sax.SAXException; public class RootSchemaValidationTestCase extends AbstractSchemaValidationTestCase { public void testRootSchema() throws IOException, SAXException { doTest("org/mule/config/spring/root-validation-test.xml"); } }mule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/NamedInterceptorTestCase.java0000644000175000017500000000170510756305520032524 0ustar charlescharles/* * $Id: NamedInterceptorTestCase.java 10845 2008-02-18 13:42:40Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.module.client.MuleClient; import org.mule.api.MuleException; public class NamedInterceptorTestCase extends AbstractInterceptorTestCase { protected String getConfigResources() { return "org/mule/config/spring/named-interceptor-test.xml"; } public void testInterceptor() throws MuleException, InterruptedException { MuleClient client = new MuleClient(); client.send("vm://in", MESSAGE, null); assertMessageIntercepted(); } } mule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/ClassInterceptorTestCase.java0000644000175000017500000000170410756305520032544 0ustar charlescharles/* * $Id: ClassInterceptorTestCase.java 10845 2008-02-18 13:42:40Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.module.client.MuleClient; import org.mule.api.MuleException; public class ClassInterceptorTestCase extends AbstractInterceptorTestCase { protected String getConfigResources() { return "org/mule/config/spring/class-interceptor-test.xml"; } public void testInterceptor() throws MuleException, InterruptedException { MuleClient client = new MuleClient(); client.send("vm://in", MESSAGE, null); assertMessageIntercepted(); } }mule-2.0.1/tests/integration/src/test/java/org/mule/config/spring/AbstractInterceptorTestCase.java0000644000175000017500000000203610756305520033241 0ustar charlescharles/* * $Id: AbstractInterceptorTestCase.java 10845 2008-02-18 13:42:40Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.tck.FunctionalTestCase; import org.mule.api.MuleException; public abstract class AbstractInterceptorTestCase extends FunctionalTestCase { public static final String MESSAGE = "boo"; public void assertMessageIntercepted() throws MuleException, InterruptedException { FunctionalTestAdvice advice = (FunctionalTestAdvice) muleContext.getRegistry().lookupObject("advice"); assertNotNull("Cannot find advice", advice); String message = advice.getMessage(RECEIVE_TIMEOUT); assertEquals("Bad message", MESSAGE, message); } }mule-2.0.1/tests/integration/src/test/java/org/mule/issues/0000755000175000017500000000000011351411052023511 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/issues/ManySendsMule1758TestCase.java0000644000175000017500000000330010757646232031100 0ustar charlescharles/* * $Id: ManySendsMule1758TestCase.java 10973 2008-02-22 22:28:42Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class ManySendsMule1758TestCase extends FunctionalTestCase { private static int NUM_MESSAGES = 3000; protected String getConfigResources() { return "org/mule/issues/many-sends-mule-1758-test.xml"; } public void testSingleSend() throws Exception { MuleClient client = new MuleClient(); MuleMessage response = client.send("vm://s-in", "Marco", null); assertNotNull("Response is null", response); assertEquals("Polo", response.getPayload()); } public void testManySends() throws Exception { long then = System.currentTimeMillis(); MuleClient client = new MuleClient(); for (int i = 0; i < NUM_MESSAGES; ++i) { logger.debug("Message " + i); MuleMessage response = client.send("vm://s-in", "Marco", null); assertNotNull("Response is null", response); assertEquals("Polo", response.getPayload()); } long now = System.currentTimeMillis(); logger.info("Total time " + ((now - then) / 1000.0) + "s; per message " + ((now - then) / (1.0 * NUM_MESSAGES)) + "ms"); } } mule-2.0.1/tests/integration/src/test/java/org/mule/issues/MulticastRouterMule2136TestCase.java0000644000175000017500000000700310757642506032340 0ustar charlescharles/* * $Id: MulticastRouterMule2136TestCase.java 10969 2008-02-22 21:57:26Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.module.xml.functional.AbstractXmlFunctionalTestCase; /** * This is a simplified version of {@link org.mule.module.xml.functional.XmlTransformerFunctionalTestCase} * The {@link #testObjectXmlOut()} method hangs intermittently. */ public class MulticastRouterMule2136TestCase extends AbstractXmlFunctionalTestCase { public static final int TEST_COUNT = 10000; public static final String SERIALIZED = "\n" + " \n" + ""; protected String getConfigResources() { return "org/mule/issues/multicast-router-mule-2136-test.xml"; } protected MuleClient sendObject() throws MuleException { MuleClient client = new MuleClient(); client.dispatch("object-in", new Parent(new Child()), null); return client; } public void testObjectOut() throws MuleException, InterruptedException { request(sendObject(), "object-out", Parent.class); // wait a while, otherwise we pull down everything while it is still running Thread.sleep(3000); } public void testObjectXmlOut() throws MuleException { String xml = (String) request(sendObject(), "object-xml-out", String.class); assertEquals(SERIALIZED, xml); } public void testXmlObjectOut() throws MuleException { request(sendObject(), "xml-object-out", Parent.class); } public void testStress() throws MuleException { int tenth = TEST_COUNT / 10; for (int i = 0; i < TEST_COUNT; i++) { testObjectXmlOut(); // Pull result from "xml-object-out" endpoint as queuing is enabled and otherwise we get // OutOfMemoryExceptions during stress tests when these results build up in queue. request(new MuleClient(), "xml-object-out", Parent.class); if (i % tenth == 0) { logger.info("Iteration " + i); } } } protected Object request(MuleClient client, String endpoint, Class clazz) throws MuleException { MuleMessage message = client.request(endpoint, TIMEOUT); assertNotNull(message); assertNotNull(message.getPayload()); assertTrue(message.getPayload().getClass().getName(), clazz.isAssignableFrom(message.getPayload().getClass())); return message.getPayload(); } public static class Parent { private Child child; public Parent() { this(null); } public Parent(Child child) { setChild(child); } public Child getChild() { return child; } public void setChild(Child child) { this.child = child; } } public static class Child { // nothing here } }mule-2.0.1/tests/integration/src/test/java/org/mule/routing/0000755000175000017500000000000011351411052023665 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/routing/outbound/0000755000175000017500000000000011351411052025524 5ustar charlescharles././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/routing/outbound/ChainingRouterPropertyPropagationTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/routing/outbound/ChainingRouterPropertyPropagati0000644000175000017500000000634110766654216034034 0ustar charlescharles/* * $Id: ChainingRouterPropertyPropagationTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalTestComponent; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; public class ChainingRouterPropertyPropagationTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/test/integration/routing/outbound/chaining-router-properties-propagation-config.xml"; } public void testPropertiesPropagation() throws Exception { FunctionalTestComponent hop1 = (FunctionalTestComponent) getComponent(muleContext.getRegistry().lookupService("hop1Service")); FunctionalTestComponent hop2 = (FunctionalTestComponent) getComponent(muleContext.getRegistry().lookupService("hop2Service")); assertNotNull(hop1); final AtomicBoolean hop1made = new AtomicBoolean(false); EventCallback callback1 = new EventCallback() { public void eventReceived(final MuleEventContext context, final Object component) throws Exception { MuleMessage msg = context.getMessage(); assertTrue(hop1made.compareAndSet(false, true)); FunctionalTestComponent ftc = (FunctionalTestComponent) component; ftc.setReturnMessage("Hop1 ACK"); } }; final AtomicBoolean hop2made = new AtomicBoolean(false); EventCallback callback2 = new EventCallback() { public void eventReceived(final MuleEventContext context, final Object component) throws Exception { MuleMessage msg = context.getMessage(); assertTrue(hop2made.compareAndSet(false, true)); assertEquals("Property not propagated from the first hop.", "hop1", msg.getProperty("TICKET")); FunctionalTestComponent ftc = (FunctionalTestComponent) component; ftc.setReturnMessage(msg.getPayload() + " Hop2 ACK"); } }; hop1.setEventCallback(callback1); hop2.setEventCallback(callback2); MuleClient client = new MuleClient(); DefaultMuleMessage request = new DefaultMuleMessage("payload"); MuleMessage reply = client.send("inboundEndpoint", request); assertNotNull(reply); assertTrue("First callback never fired", hop1made.get()); assertTrue("Second callback never fired", hop2made.get()); assertEquals("Hop1 ACK Hop2 ACK", reply.getPayload()); assertEquals("hop1", reply.getProperty("TICKET")); assertEquals("10000", reply.getProperty("TTL")); } } mule-2.0.1/tests/integration/src/test/java/org/mule/module/0000755000175000017500000000000011351411052023463 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/0000755000175000017500000000000011351411052024263 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/config/0000755000175000017500000000000011351411052025530 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/config/XmlOutboundNamespaceHandlerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/config/XmlOutboundNamespaceHandlerTes0000644000175000017500000000477110763667515033562 0ustar charlescharles/* * $Id: XmlOutboundNamespaceHandlerTestCase.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.config; import org.mule.api.service.Service; import org.mule.module.xml.routing.FilteringXmlMessageSplitter; import org.mule.module.xml.routing.RoundRobinXmlSplitter; import org.mule.routing.outbound.AbstractOutboundRouter; import org.mule.tck.FunctionalTestCase; import java.util.List; import java.util.Map; public class XmlOutboundNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/module/xml/xml-outbound-namespace-test.xml"; } public void testMessageSplitter() { FilteringXmlMessageSplitter splitter = (FilteringXmlMessageSplitter) getRouter("fancy config splitter", FilteringXmlMessageSplitter.class); assertOk(splitter, AbstractOutboundRouter.ENABLE_CORRELATION_ALWAYS); } public void testRoundRobin() { RoundRobinXmlSplitter splitter = (RoundRobinXmlSplitter) getRouter("fancy config round robin", RoundRobinXmlSplitter.class); assertOk(splitter, AbstractOutboundRouter.ENABLE_CORRELATION_IF_NOT_SET); assertTrue(splitter.isEnableEndpointFiltering()); } protected Object getRouter(String name, Class clazz) { Service service = muleContext.getRegistry().lookupService(name); List routers = service.getOutboundRouter().getRouters(); assertEquals(1, routers.size()); assertTrue(routers.get(0).getClass().getName(), clazz.isAssignableFrom(routers.get(0).getClass())); return routers.get(0); } protected void assertOk(FilteringXmlMessageSplitter splitter, int correln) { assertEquals(correln, splitter.getEnableCorrelation()); assertEquals("external", splitter.getExternalSchemaLocation()); assertEquals("/expression", splitter.getSplitExpression()); assertTrue(splitter.isHonorSynchronicity()); assertTrue(splitter.isValidateSchema()); Map namespaces = splitter.getNamespaces(); assertEquals(1, namespaces.size()); assertEquals("foo", namespaces.get("bar")); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/config/XmlFilterNamespaceHandlerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/config/XmlFilterNamespaceHandlerTestC0000644000175000017500000000557110763667515033476 0ustar charlescharles/* * $Id: XmlFilterNamespaceHandlerTestCase.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.config; import org.mule.api.service.Service; import org.mule.module.xml.filters.IsXmlFilter; import org.mule.module.xml.filters.JXPathFilter; import org.mule.routing.filters.logic.NotFilter; import org.mule.routing.outbound.FilteringOutboundRouter; import org.mule.tck.FunctionalTestCase; import java.util.List; import java.util.Map; public class XmlFilterNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/module/xml/xml-filter-functional-test.xml"; } /** * IsXmlFilter doesn't have any properties to test, so just check it is created */ public void testIsXmlFilter() { Service service = muleContext.getRegistry().lookupService("test for xml"); List routers = service.getOutboundRouter().getRouters(); assertEquals(2, routers.size()); assertTrue(routers.get(0).getClass().getName(), routers.get(0) instanceof FilteringOutboundRouter); assertTrue(((FilteringOutboundRouter) routers.get(0)).getFilter() instanceof IsXmlFilter); assertTrue(routers.get(1).getClass().getName(), routers.get(1) instanceof FilteringOutboundRouter); assertTrue(((FilteringOutboundRouter) routers.get(1)).getFilter() instanceof NotFilter); assertTrue(((NotFilter) ((FilteringOutboundRouter) routers.get(1)).getFilter()).getFilter() instanceof IsXmlFilter); } public void testJXPathFilter() { Service service = muleContext.getRegistry().lookupService("filter xml for content"); List routers = service.getOutboundRouter().getRouters(); assertEquals(1, routers.size()); assertTrue(routers.get(0).getClass().getName(), routers.get(0) instanceof FilteringOutboundRouter); assertTrue(((FilteringOutboundRouter) routers.get(0)).getFilter() instanceof JXPathFilter); JXPathFilter filter = (JXPathFilter) ((FilteringOutboundRouter) routers.get(0)).getFilter(); assertEquals("filter xml for content", filter.getExpectedValue()); assertEquals("/mule:mule/mule:model/mule:service[2]/@name", filter.getPattern()); assertNotNull(filter.getNamespaces()); Map namespaces = filter.getNamespaces(); assertEquals(2, namespaces.size()); assertEquals("http://www.springframework.org/schema/beans", namespaces.get("spring")); assertEquals("http://www.mulesource.org/schema/mule/core/2.0", namespaces.get("mule")); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/config/XmlTransformerNamespaceHandlerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/config/XmlTransformerNamespaceHandler0000644000175000017500000001367211003375564033575 0ustar charlescharles/* * $Id: XmlTransformerNamespaceHandlerTestCase.java 11631 2008-04-22 14:51:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.config; import org.mule.api.MuleException; import org.mule.api.transformer.Transformer; import org.mule.module.xml.transformer.AbstractXmlTransformer; import org.mule.module.xml.transformer.DomDocumentToXml; import org.mule.module.xml.transformer.JXPathExtractor; import org.mule.module.xml.transformer.ObjectToXml; import org.mule.module.xml.transformer.XmlToDomDocument; import org.mule.module.xml.transformer.XmlToObject; import org.mule.module.xml.transformer.XsltTransformer; import org.mule.tck.FunctionalTestCase; import org.mule.transformer.AbstractTransformer; public class XmlTransformerNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/module/xml/xml-transformer-namespace-test.xml"; } public void testDomToXml() { getAndTestTransformer("domToXml", DomDocumentToXml.class); } public void testJXPathExtractor() { JXPathExtractor extractor = (JXPathExtractor) getAndTestTransformer("jxpathExtractor", JXPathExtractor.class); assertEquals("/expression", extractor.getExpression()); assertFalse(extractor.isSingleResult()); } public void testObjectToXml() { ObjectToXml objectToXml = (ObjectToXml) getAndTestTransformer("objectToXml", ObjectToXml.class); assertTrue(objectToXml.isAcceptUMOMessage()); } public void testXmlToDom() { getAndTestTransformer("xmlToDom", XmlToDomDocument.class); } public void testXmlToObject() { getAndTestTransformer("xmlToObject", XmlToObject.class); } public void testXslt() { XsltTransformer xslt = (XsltTransformer) getAndTestTransformer("xslt", XsltTransformer.class); assertEquals(10, xslt.getMaxActiveTransformers()); assertEquals(10, xslt.getMaxIdleTransformers()); assertEquals(CustomXsltTransformerFactory.class.getName(), xslt.getXslTransformerFactory()); assertEquals("file", xslt.getXslFile()); assertNotNull(xslt.getXslt()); String transform = xslt.getXslt(); assertTrue(transform.indexOf("test for this string in test") > -1); assertEquals("${header:foo}", xslt.getContextProperties().get("bar")); } public void testDomToXmlOnEndpoint() throws MuleException { getAndTestEndpointTransformer("ep1", DomDocumentToXml.class); } public void testJXPathExtractorOnEndpoint() throws MuleException { JXPathExtractor extractor = (JXPathExtractor) getAndTestEndpointTransformer("ep2", JXPathExtractor.class); assertEquals("/expression", extractor.getExpression()); assertFalse(extractor.isSingleResult()); } public void testObjectToXmlOnEndpoint() throws MuleException { ObjectToXml objectToXml = (ObjectToXml) getAndTestEndpointTransformer("ep3", ObjectToXml.class); assertTrue(objectToXml.isAcceptUMOMessage()); } public void testXmlToDomOnEndpoint() throws MuleException { getAndTestEndpointTransformer("ep4", XmlToDomDocument.class); } public void testXmlToObjectOnEndpoint() throws MuleException { getAndTestEndpointTransformer("ep5", XmlToObject.class); } public void testXsltOnEndpoint() throws MuleException { XsltTransformer xslt = (XsltTransformer) getAndTestEndpointTransformer("ep6", XsltTransformer.class); assertEquals(10, xslt.getMaxActiveTransformers()); assertEquals(10, xslt.getMaxIdleTransformers()); assertEquals(CustomXsltTransformerFactory.class.getName(), xslt.getXslTransformerFactory()); assertEquals("file", xslt.getXslFile()); assertNotNull(xslt.getXslt()); String transform = xslt.getXslt(); assertTrue(transform.indexOf("test for this string in test") > -1); assertEquals("${header:foo}", xslt.getContextProperties().get("bar")); } protected AbstractTransformer getAndTestTransformer(String name, Class clazz) { assertTrue(AbstractTransformer.class.isAssignableFrom(clazz)); Transformer object= muleContext.getRegistry().lookupTransformer(name); assertNotNull(object); assertTrue(clazz.isAssignableFrom(object.getClass())); AbstractTransformer transformer = (AbstractTransformer) object; assertAbstractTransformerOk(transformer, name); return transformer; } protected AbstractTransformer getAndTestEndpointTransformer(String endpointName, Class clazz) throws MuleException { assertTrue(AbstractTransformer.class.isAssignableFrom(clazz)); assertEquals(1, muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(endpointName).getTransformers().size()); AbstractTransformer transformer= (AbstractTransformer) muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(endpointName).getTransformers().get(0); assertNotNull(transformer); assertTrue(clazz.isAssignableFrom(transformer.getClass())); return transformer; } protected void assertAbstractTransformerOk(AbstractTransformer transformer, String name) { assertTrue(transformer.isIgnoreBadInput()); assertEquals(Object.class, transformer.getReturnClass()); assertEquals(name, transformer.getName()); // AbstractXmlTransformer instances have an output encoding if (transformer instanceof AbstractXmlTransformer) { assertEquals("foo", ((AbstractXmlTransformer) transformer).getOutputEncoding()); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/config/CustomXsltTransformerFactory.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/config/CustomXsltTransformerFactory.j0000644000175000017500000000623410763667515033637 0ustar charlescharles/* * $Id: CustomXsltTransformerFactory.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.config; import org.mule.module.xml.util.XMLUtils; import javax.xml.transform.ErrorListener; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.URIResolver; public class CustomXsltTransformerFactory extends TransformerFactory { private final TransformerFactory delegate; public CustomXsltTransformerFactory() { super(); TransformerFactory tf; try { tf = TransformerFactory.newInstance(); } catch (TransformerFactoryConfigurationError e) { System.setProperty("javax.xml.transform.TransformerFactory", XMLUtils.TRANSFORMER_FACTORY_JDK5); tf = TransformerFactory.newInstance(); } this.delegate = tf; } public boolean equals(Object obj) { return delegate.equals(obj); } public Source getAssociatedStylesheet(Source source, String s, String s1, String s2) throws TransformerConfigurationException { return delegate.getAssociatedStylesheet(source, s, s1, s2); } public Object getAttribute(String s) { return delegate.getAttribute(s); } public ErrorListener getErrorListener() { return delegate.getErrorListener(); } public boolean getFeature(String s) { return delegate.getFeature(s); } public URIResolver getURIResolver() { return delegate.getURIResolver(); } public int hashCode() { return delegate.hashCode(); } public Templates newTemplates(Source source) throws TransformerConfigurationException { return delegate.newTemplates(source); } public Transformer newTransformer() throws TransformerConfigurationException { return delegate.newTransformer(); } public Transformer newTransformer(Source source) throws TransformerConfigurationException { return delegate.newTransformer(source); } public void setAttribute(String s, Object obj) { delegate.setAttribute(s, obj); } public void setErrorListener(ErrorListener errorlistener) { delegate.setErrorListener(errorlistener); } public void setFeature(String s, boolean flag) throws TransformerConfigurationException { delegate.setFeature(s, flag); } public void setURIResolver(URIResolver uriresolver) { delegate.setURIResolver(uriresolver); } public String toString() { return delegate.toString(); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/config/XmlPrettyPrinterConfigurationTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/config/XmlPrettyPrinterConfigurationT0000644000175000017500000000302010764101307033644 0ustar charlescharles/* * $Id: XmlPrettyPrinterConfigurationTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.config; import org.mule.module.xml.transformer.XmlPrettyPrinter; import org.mule.tck.FunctionalTestCase; public class XmlPrettyPrinterConfigurationTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/module/xml/xml-prettyprinter-config.xml"; } public void testPrettyPrinter() { XmlPrettyPrinter pp = (XmlPrettyPrinter) muleContext.getRegistry().lookupTransformer( "MyXMLPrettyPrinter"); assertNotNull(pp); assertEquals("ISO-8859-15", pp.getEncoding()); assertEquals(true, pp.isExpandEmptyElements()); assertEquals(true, pp.getIndentEnabled()); assertEquals(" ", pp.getIndentString()); assertEquals("\\n\\n", pp.getLineSeparator()); assertEquals(1, pp.getNewLineAfterNTags()); assertFalse(pp.isNewlines()); assertFalse(pp.isOmitEncoding()); assertFalse(pp.isPadText()); assertFalse(pp.isTrimText()); assertFalse(pp.isSuppressDeclaration()); assertTrue(pp.isXHTML()); } } mule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/0000755000175000017500000000000011351411052026425 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/XmlTransformerFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/XmlTransformerFunctionalTe0000644000175000017500000001022010757614114033657 0ustar charlescharles/* * $Id: XmlTransformerFunctionalTestCase.java 10957 2008-02-22 18:45:32Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.custommonkey.xmlunit.XMLAssert; import org.w3c.dom.Document; public class XmlTransformerFunctionalTestCase extends AbstractXmlFunctionalTestCase { public static final String SIMPLE_XML = "\n"; public static final String CHILDLESS_XML = "\n"; public static final String SERIALIZED = "\n" + " \n" + ""; protected String getConfigResources() { return "org/mule/module/xml/xml-transformer-functional-test.xml"; } protected MuleClient sendXml() throws MuleException { MuleClient client = new MuleClient(); client.dispatch("xml-in", SIMPLE_XML, null); return client; } protected MuleClient sendObject() throws MuleException { return sendObject("object-in"); } protected MuleClient sendObject(String endpoint) throws MuleException { MuleClient client = new MuleClient(); client.dispatch(endpoint, new Parent(new Child()), null); return client; } public void testXmlOut() throws Exception { String xml = (String) request(sendXml(), "xml-out", String.class); XMLAssert.assertXMLEqual(SIMPLE_XML, xml); } public void testXmlDomOut() throws MuleException { Document dom = (Document) request(sendXml(), "xml-dom-out", Document.class); assertEquals("parent", dom.getDocumentElement().getLocalName()); } public void testXmlXsltOut() throws Exception { String xml = (String) request(sendXml(), "xml-xslt-out-string", String.class); XMLAssert.assertXMLEqual(CHILDLESS_XML, xml); } public void testDomXmlOut() throws Exception { String xml = (String) request(sendXml(), "dom-xml-out", String.class); XMLAssert.assertXMLEqual(SIMPLE_XML, xml); } public void testObjectOut() throws Exception { request(sendObject(), "object-out", Parent.class); } public void testObjectXmlOut() throws Exception { String xml = (String) request(sendObject(), "object-xml-out", String.class); System.out.println(xml); XMLAssert.assertXMLEqual(SERIALIZED, xml); } public void testXmlObjectOut() throws MuleException { request(sendObject(), "xml-object-out", Parent.class); } public void testXmlJxpathOut() throws Exception { String xml = (String) request(sendXml(), "xml-jxpath-out", String.class); assertEquals("1", xml); } protected Object request(MuleClient client, String endpoint, Class clazz) throws MuleException { MuleMessage message = client.request(endpoint, TIMEOUT); assertNotNull(message); assertNotNull(message.getPayload()); assertTrue(message.getPayload().getClass().getName(), clazz.isAssignableFrom(message.getPayload().getClass())); return message.getPayload(); } public static class Parent { private Child child; public Parent() { this(null); } public Parent(Child child) { setChild(child); } public Child getChild() { return child; } public void setChild(Child child) { this.child = child; } } public static class Child { // nothing here } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/AbstractXmlFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/AbstractXmlFunctionalTestC0000644000175000017500000000217110757614114033600 0ustar charlescharles/* * $Id: AbstractXmlFunctionalTestCase.java 10957 2008-02-22 18:45:32Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import org.mule.tck.FunctionalTestCase; import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils; public abstract class AbstractXmlFunctionalTestCase extends FunctionalTestCase { public static final long TIMEOUT = 3000L; protected String getConfigAsString() throws IOException { return getResourceAsString(getConfigResources()); } protected String getResourceAsString(String resource) throws IOException { InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource); assertNotNull(resource, is); return IOUtils.toString(is); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/JXPathPropertyExtractorMultipleEndpointsTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/JXPathPropertyExtractorMul0000644000175000017500000000235511004136303033630 0ustar charlescharles/* * $Id: JXPathPropertyExtractorMultipleEndpointsTestCase.java 11641 2008-04-24 17:00:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import java.util.Properties; public class JXPathPropertyExtractorMultipleEndpointsTestCase extends AbstractXmlPropertyExtractorTestCase { public JXPathPropertyExtractorMultipleEndpointsTestCase() { super(true); } protected Properties getStartUpProperties() { Properties p = new Properties(); p.setProperty("selector.expression", "/endpoints/endpoint"); p.setProperty("selector.evaluator", "jxpath"); return p; } protected Object getMatchMessage() { return "matchingEndpoint1matchingEndpoint2"; } protected Object getErrorMessage() { return "missingEndpoint"; } }././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/AbstractXmlPropertyExtractorTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/AbstractXmlPropertyExtract0000644000175000017500000000436511005406111033700 0ustar charlescharles/* * $Id: AbstractXmlPropertyExtractorTestCase.java 11652 2008-04-28 17:41:29Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.NullPayload; public abstract class AbstractXmlPropertyExtractorTestCase extends FunctionalTestCase { public static long WAIT_PERIOD = 5000L; private boolean matchSingle = true; protected AbstractXmlPropertyExtractorTestCase(boolean matchSingle) { this.matchSingle = matchSingle; } protected abstract Object getMatchMessage() throws Exception; protected abstract Object getErrorMessage() throws Exception; protected String getConfigResources() { return "org/mule/module/xml/property-extractor-test.xml"; } public void testMatch() throws Exception { MuleClient client = new MuleClient(); client.dispatch("in", getMatchMessage(), null); MuleMessage message = client.request("vm://match1?connector=queue", WAIT_PERIOD); //TODO MULE-2620 Bean Evaluator tests return null here. but only on the build machine. //Extending the WAIT_PERIOD didn't seem to affect it assertNotNull(message); assertFalse(message.getPayload() instanceof NullPayload); if(!matchSingle) { message = client.request("vm://match2?connector=queue", WAIT_PERIOD); assertNotNull(message); assertFalse(message.getPayload() instanceof NullPayload); } } public void testError() throws Exception { MuleClient client = new MuleClient(); client.dispatch("in", getErrorMessage(), null); MuleMessage message = client.request("vm://error?connector=queue", WAIT_PERIOD); assertNotNull(message); assertFalse(message.getPayload() instanceof NullPayload); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/RoundRobinXmlSplitterFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/RoundRobinXmlSplitterFunct0000644000175000017500000000436310757614114033664 0ustar charlescharles/* * $Id: RoundRobinXmlSplitterFunctionalTestCase.java 10957 2008-02-22 18:45:32Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import org.mule.api.MuleException; import java.io.IOException; public class RoundRobinXmlSplitterFunctionalTestCase extends AbstractXmlOutboundFunctionalTestCase { public void testSimple() throws MuleException, IOException { doSend("roundrobin-det"); assertServices(ROUND_ROBIN_ENDPOINT_PREFIX, 1, new String[]{SERVICE_SPLITTER, ROUND_ROBIN_INDET}); assertService(ROUND_ROBIN_ENDPOINT_PREFIX, 2, ROUND_ROBIN_DET); } public void testDeterministic() throws MuleException, IOException { doSend("roundrobin-det"); assertServices(ROUND_ROBIN_ENDPOINT_PREFIX, 1, new String[]{SERVICE_SPLITTER, ROUND_ROBIN_INDET}); assertService(ROUND_ROBIN_ENDPOINT_PREFIX, 2, ROUND_ROBIN_DET); doSend("roundrobin-det"); assertServices(ROUND_ROBIN_ENDPOINT_PREFIX, 1, new String[]{SERVICE_SPLITTER, ROUND_ROBIN_INDET}); assertService(ROUND_ROBIN_ENDPOINT_PREFIX, 2, ROUND_ROBIN_DET); doSend("roundrobin-det"); doSend("roundrobin-det"); assertServices(ROUND_ROBIN_ENDPOINT_PREFIX, 1, new String[]{SERVICE_SPLITTER, ROUND_ROBIN_INDET, SERVICE_SPLITTER, ROUND_ROBIN_INDET}); assertServices(ROUND_ROBIN_ENDPOINT_PREFIX, 2, new String[]{ROUND_ROBIN_DET, ROUND_ROBIN_DET}); } public void testIndeterministic() throws MuleException, IOException { doSend("roundrobin-indet"); assertServices(ROUND_ROBIN_ENDPOINT_PREFIX, 1, new String[]{SERVICE_SPLITTER, ROUND_ROBIN_INDET}); assertService(ROUND_ROBIN_ENDPOINT_PREFIX, 2, ROUND_ROBIN_DET); doSend("roundrobin-indet"); assertServices(ROUND_ROBIN_ENDPOINT_PREFIX, 2, new String[]{SERVICE_SPLITTER, ROUND_ROBIN_INDET}); assertService(ROUND_ROBIN_ENDPOINT_PREFIX, 1, ROUND_ROBIN_DET); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/W3CDomPropertyExtractorMultipleEndpointsTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/W3CDomPropertyExtractorMul0000644000175000017500000000523311004136303033524 0ustar charlescharles/* * $Id: W3CDomPropertyExtractorMultipleEndpointsTestCase.java 11641 2008-04-24 17:00:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import java.util.Properties; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class W3CDomPropertyExtractorMultipleEndpointsTestCase extends AbstractXmlPropertyExtractorTestCase { public W3CDomPropertyExtractorMultipleEndpointsTestCase() { super(false); } protected Properties getStartUpProperties() { Properties p = new Properties(); p.setProperty("selector.expression", "/endpoints/endpoint"); p.setProperty("selector.evaluator", "xpath"); return p; } protected Object getMatchMessage() throws ParserConfigurationException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); org.w3c.dom.Document doc = builder.newDocument(); org.w3c.dom.Element endpoints = doc.createElement("endpoints"); org.w3c.dom.Element endpoint = doc.createElement("endpoint"); endpoint.appendChild(doc.createTextNode("matchingEndpoint1")); endpoints.appendChild(endpoint); endpoint = doc.createElement("endpoint"); endpoint.appendChild(doc.createTextNode("matchingEndpoint2")); endpoints.appendChild(endpoint); doc.appendChild(endpoints); return doc; } protected Object getErrorMessage() throws ParserConfigurationException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); org.w3c.dom.Document doc = builder.newDocument(); org.w3c.dom.Element endpoint = doc.createElement("endpoint"); endpoint.appendChild(doc.createTextNode("missingEndpoint")); doc.appendChild(endpoint); return doc; } protected org.w3c.dom.Document documentFor(String name) throws ParserConfigurationException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); org.w3c.dom.Document doc = builder.newDocument(); org.w3c.dom.Element endpoint = doc.createElement("endpoint"); endpoint.appendChild(doc.createTextNode(name)); doc.appendChild(endpoint); return doc; } }././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/JXPathPropertyExtractorTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/JXPathPropertyExtractorTes0000644000175000017500000000216411004136303033624 0ustar charlescharles/* * $Id: JXPathPropertyExtractorTestCase.java 11641 2008-04-24 17:00:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import java.util.Properties; public class JXPathPropertyExtractorTestCase extends AbstractXmlPropertyExtractorTestCase { public JXPathPropertyExtractorTestCase() { super(true); } protected Properties getStartUpProperties() { Properties p = new Properties(); p.setProperty("selector.expression", "/endpoint"); p.setProperty("selector.evaluator", "jxpath"); return p; } protected Object getMatchMessage() { return "matchingEndpoint1"; } protected Object getErrorMessage() { return "missingEndpoint"; } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/Dom4jPropertyExtractorMultipleEndpointsTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/Dom4jPropertyExtractorMult0000644000175000017500000000306711004136303033634 0ustar charlescharles/* * $Id: Dom4jPropertyExtractorMultipleEndpointsTestCase.java 11641 2008-04-24 17:00:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import java.util.Properties; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; public class Dom4jPropertyExtractorMultipleEndpointsTestCase extends AbstractXmlPropertyExtractorTestCase { public Dom4jPropertyExtractorMultipleEndpointsTestCase() { super(false); } protected Properties getStartUpProperties() { Properties p = new Properties(); p.setProperty("selector.expression", "/endpoints/endpoint"); p.setProperty("selector.evaluator", "xpath"); return p; } protected Object getMatchMessage() { Document document = DocumentHelper.createDocument(); Element e = document.addElement("endpoints"); e.addElement("endpoint").addText("matchingEndpoint1"); e.addElement("endpoint").addText("matchingEndpoint2"); return document; } protected Object getErrorMessage() { Document document = DocumentHelper.createDocument(); document.addElement("endpoint").addText("missingEndpoint"); return document; } }././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/W3CDomPropertyExtractorTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/W3CDomPropertyExtractorTes0000644000175000017500000000341411004136303033521 0ustar charlescharles/* * $Id: W3CDomPropertyExtractorTestCase.java 11641 2008-04-24 17:00:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import java.util.Properties; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; public class W3CDomPropertyExtractorTestCase extends AbstractXmlPropertyExtractorTestCase { public W3CDomPropertyExtractorTestCase() { super(true); } protected Properties getStartUpProperties() { Properties p = new Properties(); p.setProperty("selector.expression", "/endpoint"); p.setProperty("selector.evaluator", "xpath"); return p; } protected Object getMatchMessage() throws ParserConfigurationException { return documentFor("matchingEndpoint1"); } protected Object getErrorMessage() throws ParserConfigurationException { return documentFor("missingEndpoint"); } protected Document documentFor(String name) throws ParserConfigurationException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.newDocument(); Element endpoint = doc.createElement("endpoint"); endpoint.appendChild(doc.createTextNode(name)); doc.appendChild(endpoint); return doc; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/BeanPropertyExtractorTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/BeanPropertyExtractorTestC0000644000175000017500000000370311004136303033622 0ustar charlescharles/* * $Id: BeanPropertyExtractorTestCase.java 11641 2008-04-24 17:00:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import java.util.Properties; public class BeanPropertyExtractorTestCase extends AbstractXmlPropertyExtractorTestCase { public BeanPropertyExtractorTestCase() { super(true); } protected Properties getStartUpProperties() { Properties p = new Properties(); p.setProperty("selector.expression", "childBean.value"); p.setProperty("selector.evaluator", "bean"); return p; } protected Object getMatchMessage() { //Model a simple bean graph. Path is: childBean.value return new TestRootBean(new TestValueBean("matchingEndpoint1")); } protected Object getErrorMessage() { return new TestRootBean(new TestValueBean("missingEndpoint")); } public class TestRootBean { private TestValueBean childBean; public TestRootBean(TestValueBean childBean) { this.childBean = childBean; } public TestValueBean getChildBean() { return childBean; } public void setChildBean(TestValueBean childBean) { this.childBean = childBean; } } public class TestValueBean { private String value; public TestValueBean(String value) { this.value = value; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } }././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/BeanPropertyExtractorMultipleEndpointsTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/BeanPropertyExtractorMulti0000644000175000017500000000456011004136303033674 0ustar charlescharles/* * $Id: BeanPropertyExtractorMultipleEndpointsTestCase.java 11641 2008-04-24 17:00:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import java.util.ArrayList; import java.util.List; import java.util.Properties; public class BeanPropertyExtractorMultipleEndpointsTestCase extends AbstractXmlPropertyExtractorTestCase { public BeanPropertyExtractorMultipleEndpointsTestCase() { super(false); } protected Properties getStartUpProperties() { Properties p = new Properties(); p.setProperty("selector.expression", "endpointsHolder.endpoints"); p.setProperty("selector.evaluator", "bean"); return p; } protected Object getMatchMessage() { //Model a simple bean graph. Path is: endpointsHolder.endpoints List endpoints = new ArrayList(2); endpoints.add("matchingEndpoint1"); endpoints.add("matchingEndpoint2"); return new TestRootBean(new EndpointsHolder(endpoints)); } protected Object getErrorMessage() { List endpoints = new ArrayList(1); endpoints.add("missingEndpoint"); return new TestRootBean(new EndpointsHolder(endpoints)); } public class TestRootBean { private EndpointsHolder endpointsHolder; public TestRootBean(EndpointsHolder endpointsHolder) { this.endpointsHolder = endpointsHolder; } public EndpointsHolder getEndpointsHolder() { return endpointsHolder; } public void setEndpointsHolder(EndpointsHolder endpointsHolder) { this.endpointsHolder = endpointsHolder; } } public class EndpointsHolder { private List endpoints; public EndpointsHolder(List endpoints) { this.endpoints = endpoints; } public List getEndpoints() { return endpoints; } public void setEndpoints(List endpoints) { this.endpoints = endpoints; } } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/AbstractXmlOutboundFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/AbstractXmlOutboundFunctio0000644000175000017500000000662710757614114033674 0ustar charlescharles/* * $Id: AbstractXmlOutboundFunctionalTestCase.java 10957 2008-02-22 18:45:32Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import java.io.IOException; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import org.dom4j.Document; import org.dom4j.Element; public abstract class AbstractXmlOutboundFunctionalTestCase extends AbstractXmlFunctionalTestCase { public static final String SERVICE_SPLITTER = "service splitter"; public static final String ROUND_ROBIN_DET = "round robin deterministic"; public static final String ROUND_ROBIN_INDET = "round robin indeterministic"; public static final String SPLITTER_ENDPOINT_PREFIX = "service"; public static final String ROUND_ROBIN_ENDPOINT_PREFIX = "robin"; public static final String NAME = "name"; protected String getConfigResources() { return "org/mule/module/xml/xml-outbound-functional-test.xml"; } protected void doSend(String endpoint) throws IOException, MuleException { String xml = getConfigAsString(); MuleClient client = new MuleClient(); client.dispatch(endpoint, xml, null); } protected void assertService(String prefix, int index, String service) throws MuleException, IOException { MuleClient client = new MuleClient(); MuleMessage response = client.request(prefix + index, TIMEOUT); assertNotNull(response); assertNotNull(response.getPayload()); assertTrue(response.getPayload().getClass().getName(), response.getPayload() instanceof Document); Document document = (Document) response.getPayload(); assertEquals("service", document.getRootElement().getName()); Element element = document.getRootElement(); assertEquals(service, element.attributeValue(NAME)); } protected void assertServices(String prefix, int index, String[] services) throws MuleException, IOException { List remaining = new LinkedList(Arrays.asList(services)); // asList is immutable while (remaining.size() > 0) { MuleClient client = new MuleClient(); MuleMessage response = client.request(prefix + index, TIMEOUT); assertNotNull(response); assertNotNull(response.getPayload()); assertTrue(response.getPayload().getClass().getName(), response.getPayload() instanceof Document); Document document = (Document) response.getPayload(); assertEquals("service", document.getRootElement().getName()); Element element = document.getRootElement(); String name = element.attributeValue(NAME); assertTrue(name, remaining.contains(name)); int size = remaining.size(); remaining.remove(name); // check we don't delete all instances of same value // (apparently not - which makes sense, this is a list, not a set). assertEquals(size, remaining.size() + 1); } } }mule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/HideExceptions.java0000644000175000017500000000160410757614114032221 0ustar charlescharles/* * $Id: HideExceptions.java 10957 2008-02-22 18:45:32Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import java.beans.ExceptionListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class HideExceptions implements ExceptionListener { protected transient Log logger = LogFactory.getLog(getClass()); public void exceptionThrown(Exception e) { logger.debug("Hiding exception: " + e); logger.debug("(see config for test - some exceptions expected)"); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/XsltWithParamsTransformerTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/XsltWithParamsTransformerT0000644000175000017500000000315110757614114033666 0ustar charlescharles/* * $Id: XsltWithParamsTransformerTestCase.java 10957 2008-02-22 18:45:32Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.transformer.Transformer; import org.mule.tck.FunctionalTestCase; import org.custommonkey.xmlunit.XMLAssert; import org.custommonkey.xmlunit.XMLUnit; public class XsltWithParamsTransformerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "org/mule/module/xml/xml-namespace-test.xml"; } protected void doSetUp() throws Exception { MuleEvent event = getTestEvent(""); //We need a current event to pull the parameter from event.getMessage().setProperty("Welcome", "hello"); RequestContext.setEvent(event); } public void testTransformWithParameter() throws Exception { Transformer trans = muleContext.getRegistry().lookupTransformer("test1"); assertNotNull(trans); Object result = trans.transform(""); assertNotNull(result); XMLUnit.setIgnoreWhitespace(true); XMLAssert.assertEquals("hello", result); } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/XmlFilterFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/XmlFilterFunctionalTestCas0000644000175000017500000000473310757642506033622 0ustar charlescharles/* * $Id: XmlFilterFunctionalTestCase.java 10969 2008-02-22 21:57:26Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import java.util.Random; public class XmlFilterFunctionalTestCase extends AbstractXmlFunctionalTestCase { public static final int MAX_COUNT = 100; public static final String STRING_MESSAGE = "Hello world"; protected String getConfigResources() { return "org/mule/module/xml/xml-filter-functional-test.xml"; } public void testNotXml() throws Exception { logger.debug("not xml"); MuleClient client = new MuleClient(); client.dispatch("in", STRING_MESSAGE, null); MuleMessage response = client.request("notxml", TIMEOUT); assertNotNull(response); assertNotNull(response.getPayload()); assertEquals(STRING_MESSAGE, response.getPayloadAsString()); } public void testOther() throws Exception { logger.debug("other"); doTestXml("other", getResourceAsString("org/mule/issues/many-sends-mule-1758-test.xml")); } public void testSelf() throws Exception { logger.debug("self"); doTestXml("self", getConfigAsString()); } public void doTestXml(String endpoint, String xml) throws Exception { MuleClient client = new MuleClient(); client.dispatch("in", xml, null); MuleMessage response = client.request(endpoint, TIMEOUT); assertNotNull(response); assertNotNull(response.getPayload()); assertEquals(xml, response.getPayloadAsString()); } public void testMany() throws Exception { Random random = new Random(); for (int i = 0; i < MAX_COUNT; ++i) { switch (random.nextInt(3)) { case 0: testNotXml(); break; case 1: testOther(); break; case 2: testSelf(); break; default: throw new IllegalStateException("Bad case"); } } } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/Dom4jPropertyExtractorTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/Dom4jPropertyExtractorTest0000644000175000017500000000256211004136303033631 0ustar charlescharles/* * $Id: Dom4jPropertyExtractorTestCase.java 11641 2008-04-24 17:00:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import java.util.Properties; import org.dom4j.Document; import org.dom4j.DocumentHelper; public class Dom4jPropertyExtractorTestCase extends AbstractXmlPropertyExtractorTestCase { public Dom4jPropertyExtractorTestCase() { super(true); } protected Properties getStartUpProperties() { Properties p = new Properties(); p.setProperty("selector.expression", "/endpoint"); p.setProperty("selector.evaluator", "xpath"); return p; } protected Object getMatchMessage() { Document document = DocumentHelper.createDocument(); document.addElement("endpoint").addText("matchingEndpoint1"); return document; } protected Object getErrorMessage() { Document document = DocumentHelper.createDocument(); document.addElement("endpoint").addText("missingEndpoint"); return document; } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/FilteringXmlMessageSplitterFunctionalTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/FilteringXmlMessageSplitte0000644000175000017500000000147210757614114033647 0ustar charlescharles/* * $Id: FilteringXmlMessageSplitterFunctionalTestCase.java 10957 2008-02-22 18:45:32Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; public class FilteringXmlMessageSplitterFunctionalTestCase extends AbstractXmlOutboundFunctionalTestCase { public void testSplit() throws Exception { doSend("split"); assertService(SPLITTER_ENDPOINT_PREFIX, 1, SERVICE_SPLITTER); assertService(SPLITTER_ENDPOINT_PREFIX, 2, ROUND_ROBIN_DET); } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/W3CDomPropertyExtractorStaticTestCase.javamule-2.0.1/tests/integration/src/test/java/org/mule/module/xml/functional/W3CDomPropertyExtractorSta0000644000175000017500000000322210757614114033531 0ustar charlescharles/* * $Id: W3CDomPropertyExtractorStaticTestCase.java 10957 2008-02-22 18:45:32Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.functional; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; public class W3CDomPropertyExtractorStaticTestCase extends AbstractXmlPropertyExtractorTestCase { public W3CDomPropertyExtractorStaticTestCase() { super(true); } protected String getConfigResources() { return "org/mule/module/xml/property-extractor-static-test.xml"; } protected Object getMatchMessage() throws ParserConfigurationException { return documentFor("matchingEndpoint1"); } protected Object getErrorMessage() throws ParserConfigurationException { return documentFor("missingEndpoint"); } protected Document documentFor(String name) throws ParserConfigurationException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.newDocument(); Element endpoint = doc.createElement("endpoint"); endpoint.appendChild(doc.createTextNode(name)); doc.appendChild(endpoint); return doc; } }mule-2.0.1/tests/integration/src/test/resources/0000755000175000017500000000000011351411056021542 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/log4j.properties0000644000175000017500000000143310766654216024720 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN log4j.logger.org.mule.test.usecases.http.HttpResponseTestCase=DEBUG log4j.logger.org.mule.context.notification.ServerNotificationManagerTestCase=INFO log4j.logger.org.mule.context.notification.MessageNotificationTestCase=INFO log4j.logger.org.mule.context.notification.ExceptionNotificationTestCase=INFO #log4j.logger.org.mule.management.agents=DEBUG #log4j.logger.org.mule.registry=DEBUG #log4j.logger.org.mule.lifecycle=DEBUG #log4j.logger.org.mule.config.spring=DEBUG mule-2.0.1/tests/integration/src/test/resources/muletest.truststore0000644000175000017500000000151310417016770025572 0ustar charlescharlesmykey 2;X.509 0 0D;J0 *H80j1 0 UUS10U Pennsylvania10U West Chester1 0 U VWR1 0 U IT10U localhost0 060411181538Z 060710181538Z0j1 0 UUS10U Pennsylvania10U West Chester1 0 U VWR1 0 U IT10U localhost00,*H80Su)RJ.R mule-2.0.1/tests/integration/src/test/resources/derby.properties0000644000175000017500000000015110712123201024752 0ustar charlescharlesdatabase.name=muleEmbeddedDB database.connection=jdbc:derby:${database.name};sql.enforce_strict_size=truemule-2.0.1/tests/integration/src/test/resources/muletest.keystore0000644000175000017500000000234210417016770025202 0ustar charlescharlesmykey *300 +*wQkcEY~^):kEM)=VRƀf4ʀ03 &)6(>L@DBU06=qq<푎m@mmⓐPkiP4j$3sl<)$fdR-M$ׄGY}ٝ)0Ufk,p+Cy°؂aJ> |j }bݨbj] Or 1q HceF$Bapj<,'i|dkn3tgPRƱ$65vrQcqQݙ-K'~MekA$|ObVéPAKVF{X.509 0 0D;J0 *H80j1 0 UUS10U Pennsylvania10U West Chester1 0 U VWR1 0 U IT10U localhost0 060411181538Z 060710181538Z0j1 0 UUS10U Pennsylvania10U West Chester1 0 U VWR1 0 U IT10U localhost00,*H80Su)RJ.R mule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/sync/http-transform.xml0000644000175000017500000000611010761267244032565 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/sync/tcp-jms-response.xml0000644000175000017500000000503510771257344033014 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/sync/tcp-to-file.xml0000644000175000017500000000162610745677442031736 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/dlq/0000755000175000017500000000000011351411055026644 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/dlq/exception-dlq.xml0000644000175000017500000000425410774040205032152 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/routing/0000755000175000017500000000000011351411055027553 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/routing/response/0000755000175000017500000000000011351411056031412 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/routing/response/response-router.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/routing/response/response-rou0000644000175000017500000001233310771257077034020 0ustar charlescharles ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/routing/forwarding-message-splitter.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/routing/forwarding-message-sp0000644000175000017500000000320010745174725033715 0ustar charlescharles ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/routing/inbound-transforming-catchall.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/routing/inbound-transforming-0000644000175000017500000000516710757365472033755 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/routing/axis/0000755000175000017500000000000011351411055030517 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/routing/axis/axis-client-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/routing/axis/axis-client-test0000644000175000017500000000255610512501220033637 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/http/0000755000175000017500000000000011351411055027043 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/http/http-post.xml0000644000175000017500000000241510745174725031551 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/http/http-response.xml0000644000175000017500000000266010745174725032424 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/axis/0000755000175000017500000000000011351411055027030 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/axis/clientbridge/0000755000175000017500000000000011351411055031463 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/axis/clientbridge/broken.txt0000644000175000017500000001017410404073340033506 0ustar charlescharles ============== Listen Port: 9002 Target Host: 127.0.0.1 Target Port: 8002 ==== Request ==== POST /axisService/doSomeWork?method=executeComplexity HTTP/1.0 Content-Type: text/xml; charset=utf-8 Accept: application/soap+xml, application/dime, multipart/related, text/* User-Agent: Axis/1.2.1 Host: 127.0.0.1:9002 Cache-Control: no-cache Pragma: no-cache SOAPAction: "" Content-Length: 1737 MjM5Y2MwYWMtNWMyZC0xMWRhLWI3ODktYzEwMWRjYzE3NGU4 LTE= LTE= 84 Rm9v ==== Response ==== HTTP/1.1 200 Date: Wed, 23 Nov 2005 09:26:30 EST Server: Mule/1.2 Expires: Wed, 23 Nov 2005 09:26:30 EST Content-Type: text/plain Content-Length: 1906 MjM5Y2MwYWMtNWMyZC0xMWRhLWI3ODktYzEwMWRjYzE3NGU4LTE=LTE=84 ============== ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/axis/clientbridge/working.txtmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/axis/clientbridge/working.txt0000644000175000017500000000433310404073340033706 0ustar charlescharles ============== Listen Port: 9002 Target Host: 127.0.0.1 Target Port: 8002 ==== Request ==== POST /axisService/doSomeWork?method=executeComplexity HTTP/1.0 Content-Type: text/xml; charset=utf-8 Accept: application/soap+xml, application/dime, multipart/related, text/* User-Agent: Axis/1.2.1 Host: 127.0.0.1:9002 Cache-Control: no-cache Pragma: no-cache SOAPAction: "" Content-Length: 693 42 Foo ==== Response ==== HTTP/1.1 200 Date: Wed, 23 Nov 2005 09:26:08 EST Server: Mule/1.2 Expires: Wed, 23 Nov 2005 09:26:08 EST Content-Type: text/plain Content-Length: 999 Rm9v42 ============== ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/axis/clientbridge/client-mule-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/axis/clientbridge/client-mule0000644000175000017500000000315210745174725033645 0ustar charlescharles ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/axis/clientbridge/mule-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/usecases/axis/clientbridge/mule-config0000644000175000017500000000231710745677442033642 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/0000755000175000017500000000000011351411055026574 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/0000755000175000017500000000000011351411055030611 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/xmpp/0000755000175000017500000000000011351411055031575 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/xmpp/xmpp-2-connectors.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/xmpp/xmpp-2-conn0000644000175000017500000000337310745677442033630 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/jms/0000755000175000017500000000000011351411055031402 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/jms/qosheaders-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/jms/qosheaders-t0000644000175000017500000000373410745174725033753 0ustar charlescharles ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/jms/multiple-connectors-and-transactions-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/jms/multiple-con0000644000175000017500000001333410774266536033765 0ustar charlescharles vm://localhost?broker.persistent=false&broker.useJmx=false ]]> ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/jms/nestedrouter-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/jms/nestedrouter0000644000175000017500000000362210745174725034073 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/0000755000175000017500000000000011351411055031530 5ustar charlescharles././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/mule-fileappend-connector-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/mule-fileap0000644000175000017500000000222510745174725033674 0ustar charlescharles ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/file-exception-strategy.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/file-except0000644000175000017500000000307410745174725033704 0ustar charlescharles ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/file-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/file-config0000644000175000017500000000221710760613766033657 0ustar charlescharles ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/file-runtime-exception-strategy.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/file-runtim0000644000175000017500000000310310745174725033723 0ustar charlescharles ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/mule-fileappend-endpoint-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/mule-fileap0000644000175000017500000000214310745174725033673 0ustar charlescharles ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/mule-file-output-pattern-from-endpoint.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/file/mule-file-o0000644000175000017500000000226410745174725033612 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/axis/0000755000175000017500000000000011351411055031555 5ustar charlescharles././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/axis/axis-over-jms-config-alternate.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/axis/axis-over-j0000644000175000017500000000236510745174725033672 0ustar charlescharles ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/axis/axis-over-jms-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/providers/axis/axis-over-j0000644000175000017500000000237210745174725033670 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/streaming/0000755000175000017500000000000011351411054030564 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/streaming/file-to-tcp-streaming.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/streaming/file-to-tcp-stre0000644000175000017500000000356710777523300033631 0ustar charlescharles ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/streaming/stream-closing.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/streaming/stream-closing.x0000644000175000017500000000233410767456705033734 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/models/0000755000175000017500000000000011351411053030055 5ustar charlescharles././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/models/pipeline-test-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/models/pipeline-test-confi0000644000175000017500000000517510745677442033714 0ustar charlescharles ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/models/optimised-seda-pipeline-test-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/models/optimised-seda-pipe0000644000175000017500000000102510745677442033666 0ustar charlescharles ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/models/direct-pipeline-test-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/models/direct-pipeline-tes0000644000175000017500000000117110707212201033644 0ustar charlescharles ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/models/seda-pipeline-test-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/models/seda-pipeline-test-0000644000175000017500000000071510674006563033571 0ustar charlescharles ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/event-metadata-propagation-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/event-metadata-propagation0000644000175000017500000000307310754365306033757 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transformer/0000755000175000017500000000000011351411054031135 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transformer/auto-transformer-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transformer/auto-transform0000644000175000017500000000251711002221467034046 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transformer/response/0000755000175000017500000000000011351411054032773 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/resolvers/0000755000175000017500000000000011351411053030616 5ustar charlescharles././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/resolvers/entry-point-resolver-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/resolvers/entry-point-reso0000644000175000017500000001666410777503705034035 0ustar charlescharles ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/resolvers/no-args-entry-point-resolver-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/resolvers/no-args-entry-po0000644000175000017500000000330610746074653033706 0ustar charlescharles ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/resolvers/method-entrypoints-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/resolvers/method-entrypoin0000644000175000017500000000201610746115127034057 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/0000755000175000017500000000000011351411054030237 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/loanbroker/0000755000175000017500000000000011351411054032375 5ustar charlescharles././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/loanbroker/loan-broker-async-vm-profiling-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/loanbroker/loan-br0000644000175000017500000001622610754375733033704 0ustar charlescharles ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/loanbroker/loan-broker-sync-vm-profiling-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/loanbroker/loan-br0000644000175000017500000001045210754375733033677 0ustar charlescharles ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/loanbroker/loan-broker-sync-jms-profiling-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/loanbroker/loan-br0000644000175000017500000001264510754375733033705 0ustar charlescharles ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/loanbroker/loan-broker-async-jms-profiling-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/loanbroker/loan-br0000644000175000017500000002026710754375733033704 0ustar charlescharles ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/loanbroker/loan-broker-config-with-normalizers.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/samples/loanbroker/loan-br0000644000175000017500000001666510754375733033713 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/management/0000755000175000017500000000000011351411055030710 5ustar charlescharles././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/management/management-simple-startup-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/management/management-simp0000644000175000017500000000213110757023422033720 0ustar charlescharles ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/management/management-startup-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/management/management-star0000644000175000017500000000302710757023422033726 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/0000755000175000017500000000000011351411055030052 5ustar charlescharles././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/remote-exception-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/remote-exception-co0000644000175000017500000000375110757023422033677 0ustar charlescharles ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/axis-client-test-mule-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/axis-client-test-mu0000644000175000017500000000412110771035204033612 0ustar charlescharles ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/client-remote-dispatcher-common-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/client-remote-dispa0000644000175000017500000000501110757023422033645 0ustar charlescharles ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/mule-client-listener-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/mule-client-listene0000644000175000017500000000244510754403514033670 0ustar charlescharles ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/mule-remote-dispatcher-agent.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/mule-remote-dispatc0000644000175000017500000000154710757023422033672 0ustar charlescharles ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/test-client-mule-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/test-client-mule-co0000644000175000017500000000202210745174725033603 0ustar charlescharles ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/test-client-mule-config-remote-http.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/test-client-mule-co0000644000175000017500000000164110754110316033573 0ustar charlescharles ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/test-client-mule-config-remote-jms.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/test-client-mule-co0000644000175000017500000000226310754403514033601 0ustar charlescharles ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/test-client-jms-mule-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/test-client-jms-mul0000644000175000017500000000230510754403514033621 0ustar charlescharles ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/mule-admin-agent.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/mule-admin-agent.xm0000644000175000017500000000162410757023422033555 0ustar charlescharles ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/test-client-mule-config-remote-tcp.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/client/test-client-mule-co0000644000175000017500000000166210754110316033576 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/exceptions/0000755000175000017500000000000011351411053030753 5ustar charlescharles././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-listener-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-liste0000644000175000017500000000300710766654216034035 0ustar charlescharles ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-strategy-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exception-strat0000644000175000017500000000227410770773146034056 0ustar charlescharles ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exceptions-with-router-mule-2715.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/exceptions/exceptions-with0000644000175000017500000000376610745174725034066 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/spring/0000755000175000017500000000000011351411054030075 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/spring/events/0000755000175000017500000000000011351411054031401 5ustar charlescharles././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/spring/events/mule-events-url-app-context.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/spring/events/mule-events-0000644000175000017500000000252210754375733033671 0ustar charlescharles vm://* emailEndpoint mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/spring/events/async/0000755000175000017500000000000011351411054032516 5ustar charlescharles././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/spring/events/async/mule-events-example-async-app-context.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/spring/events/async/mule-e0000644000175000017500000000425510766204322033642 0ustar charlescharles jms://orders.queue axis:http://localhost:44444/mule/orderManager org.mule.test.integration.spring.events.Order ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/spring/events/mule-events-example-app-context.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/spring/events/mule-events-0000644000175000017500000000412510761274763033671 0ustar charlescharles jms://orders.queue axis:http://localhost:44444/mule/orderManager org.mule.test.integration.spring.events.Order ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/spring/mule-admin-spring.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/spring/mule-admin-spring.x0000644000175000017500000000171610757023422033632 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/0000755000175000017500000000000011351411053031117 5ustar charlescharles././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/xabridge-jms-jdbc-mule.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/xabridge-jms-j0000644000175000017500000001264010762044052033656 0ustar charlescharles org.apache.derby.jdbc.EmbeddedDriver ${database.connection} ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/jdbc-xatransaction-1479.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/jdbc-xatransac0000644000175000017500000001063210754375733033754 0ustar charlescharles ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/xatransaction-with-spring-datasource.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/xatransaction-0000644000175000017500000000625310754375733034027 0ustar charlescharles PROPAGATION_MANDATORY classpath:derby.properties org.apache.derby.jdbc.EmbeddedDriver ${database.connection} 10 vm://localhost?broker.persistent=false&broker.useJmx=false ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/xabridge-jms-jdbc-spring.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/xabridge-jms-j0000644000175000017500000000323010754375733033667 0ustar charlescharles classpath:derby.properties org.apache.derby.jdbc.EmbeddedDriver ${database.connection} vm://localhost?broker.persistent=false&broker.useJmx=false ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/xatransactions-with-spring-dao-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/xatransactions0000644000175000017500000000374610754375733034141 0ustar charlescharles ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/jdbc-xatransaction-1479-spring.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/jdbc-xatransac0000644000175000017500000000233510754375733033755 0ustar charlescharles vm://localhost?broker.persistent=false&broker.useJmx=true ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/outbound-transactions.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/transaction/outbound-trans0000644000175000017500000000645410754403514034050 0ustar charlescharles vm://localhost?broker.persistent=false&broker.useJmx=false ]]> mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/config/0000755000175000017500000000000011351411054030040 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/config/plexus-config.xml0000644000175000017500000000102210404072722033343 0ustar charlescharles plexus-Apple org.mule.tck.testmodels.fruit.Apple plexus-Banana org.mule.tck.testmodels.fruit.Banana Orange org.mule.tck.testmodels.fruit.Orange ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/config/globalendpointandtransformer-mule-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/config/globalendpointandtr0000644000175000017500000000153310745174725034040 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/config/custom-config.xml0000644000175000017500000000274310665301621033352 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/config/spring-config.xml0000644000175000017500000000076610404072722033343 0ustar charlescharles 8 mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/config/spring2-config.xml0000644000175000017500000000077110542524003033416 0ustar charlescharles 10 ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/config/response-transformer-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/config/response-transforme0000644000175000017500000000236410761267244034022 0ustar charlescharles ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/config/multi-container-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/config/multi-container-tes0000644000175000017500000000147710754375733033722 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/persistence/0000755000175000017500000000000011351411053031116 5ustar charlescharles././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/persistence/file-persistence-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/persistence/file-persisten0000644000175000017500000000274310757365472034026 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/tck/0000755000175000017500000000000011351411053027353 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/tck/test-data.txt0000644000175000017500000000003710770575334032023 0ustar charlescharlesSome test data loaded from file././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/tck/test-namespace-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/tck/test-namespace-config.0000644000175000017500000000417110770772424033553 0ustar charlescharles Foo Bar Car Jar mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/test-endpoints-config.xml0000644000175000017500000001312210766460764033564 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/components/0000755000175000017500000000000011351411053030757 5ustar charlescharles././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/components/no-args-call-component-functional-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/components/no-args-call-co0000644000175000017500000000435310746074653033607 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/0000755000175000017500000000000011351411053030261 5ustar charlescharles././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/multi-inbound-aggregator-no-timeout.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/multi-inbound-aggr0000644000175000017500000000563710776735545033754 0ustar charlescharles vm://quoteprovider1.queue vm://quoteprovider2.queue vm://quoteprovider3.queue ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/multi-async-repy-timeout-fail.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/multi-async-repy-t0000644000175000017500000000521610774001146033701 0ustar charlescharles vm://quoteprovider1.queue vm://quoteprovider2.queue vm://quoteprovider3.queue ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/multi-async-repy-timeout.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/multi-async-repy-t0000644000175000017500000000521710774001146033702 0ustar charlescharles vm://quoteprovider1.queue vm://quoteprovider2.queue vm://quoteprovider3.queue ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/multi-inbound-aggregator-with-timeout.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/multi-inbound-aggr0000644000175000017500000000567610776710212033737 0ustar charlescharles vm://quoteprovider1.queue vm://quoteprovider2.queue vm://quoteprovider3.queue mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/bridge-mule.xml0000644000175000017500000000222410754403514033210 0ustar charlescharles ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/message-chunking.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/message-chunking.x0000644000175000017500000000503610766460764033734 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/replyto/0000755000175000017500000000000011351411054031760 5ustar charlescharles././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/replyto/replyto-chain-integration-test-1.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/replyto/replyto-ch0000644000175000017500000000405510754403514034005 0ustar charlescharles ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/replyto/replyto-chain-integration-test-3.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/replyto/replyto-ch0000644000175000017500000000642010754403514034003 0ustar charlescharles vm://localhost?broker.persistent=false ]]> ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/replyto/replyto-chain-integration-test-4.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/replyto/replyto-ch0000644000175000017500000000544610754403514034012 0ustar charlescharles vm://localhost?broker.persistent=false ]]> ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/replyto/replyto-chain-integration-test-2.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/replyto/replyto-ch0000644000175000017500000000514011000701247033766 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/nested/0000755000175000017500000000000011351411053031543 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/nested/nestedrouter-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/nested/nestedroute0000644000175000017500000000706111002156421034031 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/wire-tap.xml0000644000175000017500000000221410745174725032554 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/outbound/0000755000175000017500000000000011351411053032120 5ustar charlescharles././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/outbound/chaining-router-properties-propagation-config.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/outbound/chaining-0000644000175000017500000000414610745174725033727 0ustar charlescharles ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/outbound/chaining-router-null-handling.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/outbound/chaining-0000644000175000017500000000752410766654216033733 0ustar charlescharles ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/multi-async-repy-no-timeout.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/routing/multi-async-repy-n0000644000175000017500000000517110774001146033673 0ustar charlescharles vm://quoteprovider1.queue vm://quoteprovider2.queue vm://quoteprovider3.queue mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/notifications/0000755000175000017500000000000011351411054031444 5ustar charlescharles././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/notifications/exception-notification-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/notifications/exception-no0000644000175000017500000000252710771024442034013 0ustar charlescharles ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/notifications/server-notification-manager-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/notifications/server-notif0000644000175000017500000000213710754375733034040 0ustar charlescharles ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/notifications/message-notification-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/notifications/message-noti0000644000175000017500000000316710754375733034014 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/test/integration/xml/0000755000175000017500000000000011351411054027373 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/config/0000755000175000017500000000000011351411056024540 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/config/spring/0000755000175000017500000000000011351411056026042 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/config/spring/class-interceptor-test.xml0000644000175000017500000000406510756305520033215 0ustar charlescharles advisor mule-2.0.1/tests/integration/src/test/resources/org/mule/config/spring/named-interceptor-test.xml0000644000175000017500000000341210756305520033167 0ustar charlescharles advice mule-2.0.1/tests/integration/src/test/resources/org/mule/config/spring/interceptor-adapter-test.xml0000644000175000017500000000420410762020555033522 0ustar charlescharles advisor mule-2.0.1/tests/integration/src/test/resources/org/mule/config/spring/vm-validation-test.xml0000644000175000017500000000110210755331235032314 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/config/spring/root-validation-test.xml0000644000175000017500000000141610770767514032677 0ustar charlescharles ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/config/spring/component-interceptor-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/config/spring/component-interceptor-test.xm0000644000175000017500000000356510756305520033742 0ustar charlescharles advisor mule-2.0.1/tests/integration/src/test/resources/org/mule/issues/0000755000175000017500000000000011351411056024606 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/issues/many-sends-mule-1758-test.xml0000644000175000017500000000241010766654216031742 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/issues/multicast-router-mule-2136-test.xml0000644000175000017500000000454110757642506033204 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/module/0000755000175000017500000000000011351411056024560 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/0000755000175000017500000000000011351411056025360 5ustar charlescharlesmule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/xml-outbound-namespace-test.xml0000644000175000017500000000401410757614114033456 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/xml-prettyprinter-config.xml0000644000175000017500000000177310757614114033117 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/xml-filter-functional-test.xml0000644000175000017500000000553010757614114033316 0ustar charlescharles ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/property-extractor-static-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/property-extractor-static-test.x0000644000175000017500000000414711004136303033710 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/property-extractor-test.xml0000644000175000017500000000467311004136303032760 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/xml-namespace-test.xml0000644000175000017500000000250510757614114031624 0ustar charlescharles ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/xml-transformer-namespace-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/xml-transformer-namespace-test.x0000644000175000017500000001120611003375564033627 0ustar charlescharles ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/xml-transformer-functional-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/xml-transformer-functional-test.0000644000175000017500000001321710757614114033653 0ustar charlescharles ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/xml-outbound-functional-test.xmlmule-2.0.1/tests/integration/src/test/resources/org/mule/module/xml/xml-outbound-functional-test.xml0000644000175000017500000001120310764057561033667 0ustar charlescharles mule-2.0.1/tests/integration/src/test/resources/mule-jms-provider.properties0000644000175000017500000000007310212317366027245 0ustar charlescharlesjms.provider.properties=activemq-jndi-connection.propertiesmule-2.0.1/tests/integration/src/test/resources/message.xml0000644000175000017500000002631210326023523023713 0ustar charlescharles1-JN1XWAgregar1-JN1XXN004/20/2005 09:37:001251996604/20/2005 00:00:00TELSTRA - F11-JMHCHInvoiceAccount/service/impsatTELSTRA - LOI DIA FOR BUENOS AIRES, ARGENTINA1-9A1Acceso Dedicado InternetTELSTRA - BUENOS AIRES, ARGENTINA1-JN1XP40006120Acceso Dedicado a Internet04/20/2005 14:19:54Pending1-JN1XWY0701S004/20/2005 14:19:5404/20/2005 14:20:23NInternet1-JMHE304/19/2005 16:50:501-HIIZX4000610FLORIOLUSDDEDICATED INTERNET ACCESS - E1 - BUENOS AIRES, ARGENTINAA01HX1-JMHE3NA-USA05/31/2005 00:00:00FLORIOLNewCreation pendingYN1-JN1Z104/20/2005 09:39:18AgregarInstalacion Puerta PlanaY04/20/2005 09:39:19N06/01/2005 00:00:00Internet DiscountAmount,DiscountAmountMRC,BillDescription,EffectiveStartDate,RelatedGroup,BasePrice1002452124500/service/impsatInstalacion Puerta Plana Instalacion Puerta Plana1-9P5Instalacion II1INSTALLATION CHARGE - DEDICATED INTERNET ACCESS - E1 - BUENOS AIRES, ARGENTINAP-Ingresos_Instalacion00PendingN1-JN1Z1 NN0N1-JN1Z2XVelocidad Acceso Dedicado2 MbpsN1-JN1Z404/20/2005 09:39:20AgregarPuerta PlanaYY06/01/2005 00:00:00Internet 669BasePrice,ServicePriceAmount,DiscountAmount,DiscountAmountMRC,BillDescription,EffectiveStartDate,RelatedGroup015732179781084718408/service/impsatPuerta Plana Puerta Plana1-9UDPuerta Internet1DEDICATED INTERNET ACCESS - E1 - BUENOS AIRES, ARGENTINAC-Ingresos_Abono00PendingN1-JN1Z4 NN0Y1-JN1ZFXVelocidad Acceso Dedicado2 MbpsN1-JN1Z5XCantidad de Direcciones IP?N1-JN1ZDXProtocolo de Ultima MillaFrame RelayN1-JN1ZBXPop de EntradaImpsat ArgentinaN1-JN1Z7XDuracion Contrato12 MesesN1-JN1Z9XFactura Mes Vencido?NoN1-JN1ZH04/20/2005 09:39:27AgregarInstallation Fee TerrestialY04/20/2005 09:39:28N06/01/2005 00:00:00Servicios de Red DiscountAmount,DiscountAmountMRC,BillDescription,EffectiveStartDate,RelatedGroup,BasePrice3502388124480/service/impsatInstalacion Terrestre Instalacion Terrestre1-8TTXQInstalacion1INSTALLATION CHARGE - DEDICATED INTERNET ACCESS - E1 - BUENOS AIRES, ARGENTINAP-Ingresos_Instalacion00PendingN1-JN1ZH NN0N1-JN1ZI04/20/2005 09:39:28AgregarAcceso CobreYY06/01/2005 00:00:00Servicios de Red 132DiscountAmount,DiscountAmountMRC,BillDescription,EffectiveStartDate,RelatedGroup,ServicePriceAmount15956164101088914289/service/impsatAcceso Cobre Acceso Cobre1-99XAcceso Cu1DEDICATED INTERNET ACCESS - E1 - BUENOS AIRES, ARGENTINAC-Ingresos_Abono00PendingN1-JN1ZI NN0Y1-JN1ZJXAncho de Banda Cobre2 MbpsN1-JN1ZLXFactura Mes Vencido?NoNmule-2.0.1/tests/integration/src/test/resources/mule-test-exclusions.txt0000644000175000017500000001020611005406111026403 0ustar charlescharles########################################################################## # Mule 1.x ########################################################################## # These tests hang if you're behind a firewall. # Figure out how to use proxy settings here. org.mule.test.integration.client.MuleClientAxisExternalTestCase org.mule.test.integration.client.MuleClientWsdlSoapExternalTestCase org.mule.test.integration.transport.xmpp.XmppFunctionalTestCase # Require updated config? org.mule.test.integration.routing.replyto.ReplytoChainIntegration2TestCase org.mule.test.integration.routing.replyto.ReplytoChainIntegration3TestCase org.mule.test.integration.routing.replyto.ReplytoChainIntegration4TestCase # More testing on these: not recorded in Jira yet org.mule.test.usecases.axis.AxisClientWithComplexTypesTestCase org.mule.test.integration.transaction.OutboundTransactionsTestCase # MULE-2258: fails on the build server org.mule.test.usecases.sync.TcpToFileTestCase ########################################################################## # Convert to XML-based config ########################################################################## # MULE-2749 org.mule.test.integration.transport.jdbc.JdbcConnectionTestCase org.mule.test.integration.transport.jdbc.JdbcTransactionalJdbcFunctionalTestCase org.mule.test.integration.transport.jdbc.JdbcTransactionalXaFunctionalTestCase # MULE-2747 org.mule.test.integration.transport.xmpp.XmppFunctionalTestCase #org.mule.test.integration.EventMetaDataPropagationTestCase org.mule.test.integration.message.AttachmentsPropagationTestCase org.mule.test.integration.transaction.XATransactionsWithSpringDAO # Convert transacted endpoint to XML config org.mule.test.integration.client.MuleClientTransactionTestCase ########################################################################## # Unfinished 2.x implementation ########################################################################## ########################################################################## # Mule 2.x-specific failures ########################################################################## # MULE-2736 # Hangs for a long, long time org.mule.test.integration.transaction.XAJdbcMule1479TestCase # MULE-2734 # Error registering bean with name 'jdbcConnector' defined in null: Could not resolve placeholder 'function:NOW' # at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:249) org.mule.test.integration.transaction.XABridgeJmsJdbcTestCase # MULE-2733 # @ in URI is not getting replaced (1 of 3 tests fails) org.mule.test.integration.util.ObjectNameHelperTestCase # MULE-2620 org.mule.module.xml.functional.BeanPropertyExtractorMultipleEndpointsTestCase org.mule.module.xml.functional.BeanPropertyExtractorTestCase ########################################################################## # Low priority ########################################################################## # MULE-2742 org.mule.test.integration.models.DirectPipelineTestCase org.mule.test.integration.models.ConfigureModelTestCase # MULE-2741 org.mule.test.integration.models.OptimisedSedaPipelineTestCase org.mule.test.integration.models.SedaPipelineComponentPerRequestTestCase org.mule.test.integration.models.SedaPipelineNoPoolingTestCase org.mule.test.integration.models.SedaPipelineTestCase # MULE-1789 org.mule.test.integration.config.MultiContainerTestCase # MULE-2745 # How to configure ? org.mule.test.integration.persistence.FilePersistenceTestCase # MULE-2996 org.mule.config.spring.VmSchemaValidationTestCase # MULE-2999 org.mule.config.spring.ComponentInterceptorTestCase # MULE-3000 org.mule.test.integration.client.MuleClientRemotingTcpTestCase org.mule.test.integration.client.MuleClientRemotingJmsTestCase # MULE-3002 #org.mule.test.integration.management.ManagementSimpleStartupTestCase # This works, but it requires tools.jar on the classpath which we currently don't require: org.mule.test.integration.client.MuleClientWSDLExternalTestCase # Some initial work on MULE-2499 org.mule.test.integration.streaming.StreamClosingTestCasemule-2.0.1/tests/integration/pom.xml0000644000175000017500000002143311006063605017302 0ustar charlescharles 4.0.0 org.mule.tests mule-tests 2.0.1 mule-tests-integration Integration Tests Tests which ensure that Mule sub projects work well together. jar org.apache.maven.plugins maven-surefire-plugin pertest org.apache.maven.plugins maven-jar-plugin test-jar org.mule.tests mule-tests-functional ${version} org.mule.modules mule-module-client ${version} test org.mule.modules mule-module-spring-extras ${version} test org.mule.transports mule-transport-axis ${version} org.mule.transports mule-transport-ejb ${version} org.mule.transports mule-transport-email ${version} org.mule.transports mule-transport-file ${version} org.mule.transports mule-transport-ftp ${version} org.mule.transports mule-transport-http ${version} org.mule.transports mule-transport-jdbc ${version} org.mule.transports mule-transport-jms ${version} org.mule.transports mule-transport-jms ${version} test-jar org.mule.transports mule-transport-soap ${version} test-jar org.mule.transports mule-transport-multicast ${version} org.mule.transports mule-transport-quartz ${version} org.mule.transports mule-transport-rmi ${version} org.mule.transports mule-transport-soap ${version} org.mule.transports mule-transport-ssl ${version} org.mule.transports mule-transport-stdio ${version} org.mule.transports mule-transport-tcp ${version} org.mule.transports mule-transport-udp ${version} org.mule.transports mule-transport-vm ${version} org.mule.transports mule-transport-xmpp ${version} org.mule.modules mule-module-acegi ${version} org.mule.modules mule-module-jbossts ${version} org.mule.modules mule-module-ognl ${version} org.mule.modules mule-module-pgp ${version} org.mule.modules mule-module-spring-extras ${version} org.mule.modules mule-module-scripting ${version} hsqldb hsqldb 1.7.3.0 test org.hibernate hibernate ant ant 1.6.5 org.apache.activemq activemq-core test cglib cglib-nodep 2.1_3 commons-httpclient commons-httpclient xmlunit xmlunit 1.1 test org.apache.derby derby test mule-2.0.1/tests/pom.xml0000644000175000017500000000172711006063605014763 0ustar charlescharles 4.0.0 org.mule mule 2.0.1 org.mule.tests mule-tests pom Mule Tests archetypes functional integration jdk15 1.5 integration-jdk5 mule-2.0.1/transports/0000755000175000017500000000000011351410663014517 5ustar charlescharlesmule-2.0.1/transports/multicast/0000755000175000017500000000000011351410663016524 5ustar charlescharlesmule-2.0.1/transports/multicast/src/0000755000175000017500000000000011351410663017313 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/0000755000175000017500000000000011351410663020237 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/java/0000755000175000017500000000000011351410663021160 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/java/org/0000755000175000017500000000000011351410663021747 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/java/org/mule/0000755000175000017500000000000011351410663022711 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/java/org/mule/transport/0000755000175000017500000000000011351410663024745 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/0000755000175000017500000000000011351410663026752 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/package.html0000644000175000017500000000024710745677442031256 0ustar charlescharles Mule IP multicast connectivity for Mule. Allows components to broadcast and join ip multicast groups. ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/MulticastMessageAdapter.javamule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/MulticastMessageAdapter.j0000644000175000017500000000161110745677442033717 0ustar charlescharles/* * $Id: MulticastMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.multicast; import org.mule.api.MessagingException; import org.mule.transport.udp.UdpMessageAdapter; /** * MulticastMessageAdapter TODO */ public class MulticastMessageAdapter extends UdpMessageAdapter { /** * Serial version */ private static final long serialVersionUID = 4515594269344311534L; public MulticastMessageAdapter(Object message) throws MessagingException { super(message); } } mule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/MulticastConnector.java0000644000175000017500000000416010757615756033461 0ustar charlescharles/* * $Id: MulticastConnector.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.multicast; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.transport.udp.UdpConnector; /** * MulticastConnector can dispatch mule events using ip multicasting */ public class MulticastConnector extends UdpConnector { public static final String MULTICAST = "multicast"; private boolean loopback = false; private int timeToLive = INT_VALUE_NOT_SET; public String getProtocol() { return MULTICAST; } //@java.lang.Override protected void doInitialise() throws InitialisationException { dispatcherSocketsPool.setFactory(new MulticastSocketFactory()); dispatcherSocketsPool.setTestOnBorrow(false); dispatcherSocketsPool.setTestOnReturn(true); //For clarity, note that the max active value does not need to be 1 since you can have multiple //Multicast sockets bound to a single port //dispatcherSocketsPool.setMaxActive(1); } public boolean isLoopback() { return loopback; } public void setLoopback(boolean loopback) { this.loopback = loopback; } public int getTimeToLive() { return timeToLive; } public void setTimeToLive(int timeToLive) { this.timeToLive = timeToLive; } //@java.lang.Override protected Object getReceiverKey(Service service, InboundEndpoint endpoint) { //you can have multiple Multicast sockets bound to a single port, // so store listeners with the service name too return endpoint.getEndpointURI().getAddress() + "/" + service.getName(); } } mule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/config/0000755000175000017500000000000011351410663030217 5ustar charlescharles././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/config/MulticastNamespaceHandler.javamule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/config/MulticastNamespace0000644000175000017500000000201010745726444033732 0ustar charlescharles/* * $Id: MulticastNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.multicast.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.endpoint.URIBuilder; import org.mule.transport.multicast.MulticastConnector; /** * Reigsters a Bean Definition Parser for handling elements. * */ public class MulticastNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(MulticastConnector.MULTICAST, URIBuilder.SOCKET_ATTRIBUTES); registerConnectorDefinitionParser(MulticastConnector.class); } }././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/MulticastSocketFactory.javamule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/MulticastSocketFactory.ja0000644000175000017500000000455610745677442033766 0ustar charlescharles/* * $Id: MulticastSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.multicast; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.transport.Connector; import org.mule.transport.udp.UdpSocketFactory; import java.io.IOException; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.MulticastSocket; /** * TODO */ public class MulticastSocketFactory extends UdpSocketFactory { public Object makeObject(Object key) throws Exception { ImmutableEndpoint ep = (ImmutableEndpoint)key; MulticastSocket socket = (MulticastSocket)super.makeObject(key); socket.setLoopbackMode(((MulticastConnector)ep.getConnector()).isLoopback()); int ttl = ((MulticastConnector)ep.getConnector()).getTimeToLive(); if(ttl!= Connector.INT_VALUE_NOT_SET) { socket.setTimeToLive(ttl); } return socket; } //@java.lang.Override public void destroyObject(Object key, Object object) throws Exception { ImmutableEndpoint ep = (ImmutableEndpoint)key; InetAddress inetAddress; String host = ep.getEndpointURI().getHost(); if("null".equalsIgnoreCase(host)) { inetAddress = InetAddress.getLocalHost(); } else { inetAddress = InetAddress.getByName(host); } MulticastSocket socket = (MulticastSocket)object; socket.leaveGroup(inetAddress); super.destroyObject(key, object); } protected DatagramSocket createSocket() throws IOException { return new MulticastSocket(); } protected DatagramSocket createSocket(int port) throws IOException { throw new IllegalArgumentException("A group host or IP address is required"); } protected DatagramSocket createSocket(int port, InetAddress inetAddress) throws IOException { MulticastSocket socket = new MulticastSocket(port); socket.joinGroup(inetAddress); return socket; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/MulticastMessageReceiver.javamule-2.0.1/transports/multicast/src/main/java/org/mule/transport/multicast/MulticastMessageReceiver.0000644000175000017500000000433210757615756033737 0ustar charlescharles/* * $Id: MulticastMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.multicast; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.transport.AbstractConnector; import org.mule.transport.udp.UdpMessageReceiver; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.MulticastSocket; import java.net.URI; import javax.resource.spi.work.Work; public class MulticastMessageReceiver extends UdpMessageReceiver { public MulticastMessageReceiver(AbstractConnector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); } protected DatagramSocket createSocket(URI uri, InetAddress inetAddress) throws IOException { MulticastSocket socket = new MulticastSocket(uri.getPort()); socket.joinGroup(inetAddress); return socket; } protected Work createWork(DatagramPacket packet) throws IOException { return new MulticastWorker(packet); } public class MulticastWorker extends UdpWorker { public MulticastWorker(DatagramPacket packet) { super(socket, packet); } public void dispose() { // Do not close socket as we reuse it // So do not call super.doDispose(); } } protected void doDispose() { if (socket != null && !socket.isClosed()) { try { ((MulticastSocket) socket).leaveGroup(inetAddress); } catch (IOException e) { logger.error("failed to leave group: " + e.getMessage(), e); } } super.doDispose(); } } mule-2.0.1/transports/multicast/src/main/resources/0000755000175000017500000000000011351410663022251 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/resources/META-INF/0000755000175000017500000000000011351410663023411 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/resources/META-INF/mule-multicast.xsd0000644000175000017500000000717310763567106027121 0ustar charlescharles Set the time-to-live value for multicast packets to control their scope. It must be in the range 0 to 255 (inclusive). Enable local loopback of multicast datagrams. The option is used by the platform's networking code as a hint for setting whether multicast data will be looped back to the local socket. mule-2.0.1/transports/multicast/src/main/resources/META-INF/spring.schemas0000644000175000017500000000014310754365306026267 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/multicast/2.0/mule-multicast.xsd=META-INF/mule-multicast.xsdmule-2.0.1/transports/multicast/src/main/resources/META-INF/spring.handlers0000644000175000017500000000016310754365306026446 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/multicast/2.0=org.mule.transport.multicast.config.MulticastNamespaceHandler mule-2.0.1/transports/multicast/src/main/resources/META-INF/services/0000755000175000017500000000000011351410663025234 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410663026023 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410663026765 5ustar charlescharlesmule-2.0.1/transports/multicast/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410663031002 5ustar charlescharles././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/multicast/src/main/resources/META-INF/services/org/mule/providers/multicast.propertiesmule-2.0.1/transports/multicast/src/main/resources/META-INF/services/org/mule/providers/multicast.pr0000644000175000017500000000066610745677442033402 0ustar charlescharlesconnector=org.mule.transport.multicast.MulticastConnector dispatcher.factory=org.mule.transport.udp.UdpMessageDispatcherFactory requester.factory=org.mule.transport.udp.UdpMessageRequesterFactory message.receiver=org.mule.transport.multicast.MulticastMessageReceiver message.adapter=org.mule.transport.multicast.MulticastMessageAdapter inbound.transformer= outbound.transformer= endpoint.builder=org.mule.endpoint.SocketEndpointURIBuildermule-2.0.1/transports/multicast/src/test/0000755000175000017500000000000011351410663020272 5ustar charlescharlesmule-2.0.1/transports/multicast/src/test/java/0000755000175000017500000000000011351410663021213 5ustar charlescharlesmule-2.0.1/transports/multicast/src/test/java/org/0000755000175000017500000000000011351410663022002 5ustar charlescharlesmule-2.0.1/transports/multicast/src/test/java/org/mule/0000755000175000017500000000000011351410663022744 5ustar charlescharlesmule-2.0.1/transports/multicast/src/test/java/org/mule/transport/0000755000175000017500000000000011351410663025000 5ustar charlescharlesmule-2.0.1/transports/multicast/src/test/java/org/mule/transport/multicast/0000755000175000017500000000000011351410663027005 5ustar charlescharles././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/transports/multicast/src/test/java/org/mule/transport/multicast/MulticastMessageReceiverTestCase.javamule-2.0.1/transports/multicast/src/test/java/org/mule/transport/multicast/MulticastMessageReceiverT0000644000175000017500000000264210757615756034042 0ustar charlescharles/* * $Id: MulticastMessageReceiverTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.multicast; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import org.mule.transport.AbstractConnector; import org.mule.transport.AbstractMessageReceiverTestCase; import com.mockobjects.dynamic.Mock; public class MulticastMessageReceiverTestCase extends AbstractMessageReceiverTestCase { public MessageReceiver getMessageReceiver() throws Exception { Mock mockComponent = new Mock(Service.class); mockComponent.expectAndReturn("getResponseTransformer", null); mockComponent.expectAndReturn("getResponseRouter", null); return new MulticastMessageReceiver((AbstractConnector)endpoint.getConnector(), (Service)mockComponent.proxy(), endpoint); } public InboundEndpoint getEndpoint() throws Exception { return muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("multicast://228.2.3.4:10100"); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/transports/multicast/src/test/java/org/mule/transport/multicast/MulticastNamespaceHandlerTestCase.javamule-2.0.1/transports/multicast/src/test/java/org/mule/transport/multicast/MulticastNamespaceHandler0000644000175000017500000000264310745677442034035 0ustar charlescharles/* * $Id: MulticastNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.multicast; import org.mule.tck.FunctionalTestCase; import org.mule.transport.multicast.MulticastConnector; /** * TODO */ public class MulticastNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "multicast-namespace-config.xml"; } public void testConfig() throws Exception { MulticastConnector c = (MulticastConnector)muleContext.getRegistry().lookupConnector("multicastConnector"); assertNotNull(c); assertEquals(1234, c.getReceiveBufferSize()); assertEquals(2345, c.getReceiveTimeout()); assertEquals(3456, c.getSendBufferSize()); assertEquals(4567, c.getSendTimeout()); assertEquals(5678, c.getTimeToLive()); assertEquals(true, c.isBroadcast()); assertEquals(true, c.isLoopback()); assertEquals(false, c.isKeepSendSocketOpen()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/transports/multicast/src/test/java/org/mule/transport/multicast/MulticastMessageAdapterTestCase.javamule-2.0.1/transports/multicast/src/test/java/org/mule/transport/multicast/MulticastMessageAdapterTe0000644000175000017500000000364210754365306034012 0ustar charlescharles/* * $Id: MulticastMessageAdapterTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.multicast; import org.mule.DefaultMuleMessage; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.transport.multicast.MulticastMessageAdapter; import org.mule.api.MessagingException; import org.mule.api.transport.MessageAdapter; import java.net.DatagramPacket; public class MulticastMessageAdapterTestCase extends AbstractMessageAdapterTestCase { public Object getValidMessage() throws Exception { return new DatagramPacket("Hello".getBytes(), 5); } public MessageAdapter createAdapter(Object payload) throws MessagingException { return new MulticastMessageAdapter(payload); } public void testMessageRetrieval() throws Exception { Object message = getValidMessage(); MessageAdapter adapter = createAdapter(message); DefaultMuleMessage muleMessage = new DefaultMuleMessage(adapter); assertEquals(new String(((DatagramPacket)message).getData()), muleMessage.getPayloadAsString()); byte[] bytes = muleMessage.getPayloadAsBytes(); assertNotNull(bytes); String stringMessage = muleMessage.getPayloadAsString(); assertNotNull(stringMessage); assertNotNull(adapter.getPayload()); try { adapter = createAdapter(getInvalidMessage()); fail("Message adapter should throw exception if an invalid messgae is set"); } catch (Exception e) { // expected } } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/transports/multicast/src/test/java/org/mule/transport/multicast/MulticastConnectorFunctionalTestCase.javamule-2.0.1/transports/multicast/src/test/java/org/mule/transport/multicast/MulticastConnectorFunctio0000644000175000017500000000542210754375733034121 0ustar charlescharles/* * $Id: MulticastConnectorFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.multicast; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashSet; import java.util.Set; public class MulticastConnectorFunctionalTestCase extends FunctionalTestCase { public static final String MESSAGE = "hello"; protected String getConfigResources() { return "multicast-functional-test.xml"; } public void testSendTestData() throws Exception { final int numberOfMessages = 2; MuleClient client = new MuleClient(); logger.debug("sending messages"); for (int sentPackets = 0; sentPackets < numberOfMessages; sentPackets++) { String msg = MESSAGE + sentPackets; client.dispatch("serverEndpoint", msg, null); } int broadcastMessages = numberOfMessages * 3; //3 components Set receivedMessages = new HashSet(broadcastMessages); logger.debug("receiving messages"); int receivedPackets = 0; for (; receivedPackets < broadcastMessages; receivedPackets++) { MuleMessage message = client.request("vm://foo", 2000); assertNotNull(message); receivedMessages.add(message.getPayloadAsString()); } assertEquals(broadcastMessages, receivedPackets); //Check all broadcasts were received from Component1 checkBroadcastMessagesForComponent(numberOfMessages, receivedMessages, "Component1"); //Check all broadcasts were received from Component2 checkBroadcastMessagesForComponent(numberOfMessages, receivedMessages, "Component2"); //Check all broadcasts were received from Component3 checkBroadcastMessagesForComponent(numberOfMessages, receivedMessages, "Component3"); assertEquals(0, receivedMessages.size()); } protected void checkBroadcastMessagesForComponent(int numberOfMessages, Set receivedMessages, String name) { //Check all broadcasts were received from Component2 for (int x = 0; x < numberOfMessages; x++) { String expected = MESSAGE + x + " Received " + name; assertTrue(receivedMessages.contains(expected)); assertTrue(receivedMessages.remove(expected)); } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/multicast/src/test/java/org/mule/transport/multicast/MulticastConnectorTestCase.javamule-2.0.1/transports/multicast/src/test/java/org/mule/transport/multicast/MulticastConnectorTestCas0000644000175000017500000000451410765313375034055 0ustar charlescharles/* * $Id: MulticastConnectorTestCase.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.multicast; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transport.AbstractConnectorTestCase; import java.net.DatagramPacket; public class MulticastConnectorTestCase extends AbstractConnectorTestCase { // @Override public Connector createConnector() throws Exception { MulticastConnector c = new MulticastConnector(); c.setName("MulticastConnector"); return c; } public String getTestEndpointURI() { return "multicast://228.3.4.5:60106"; } public Object getValidMessage() throws Exception { return new DatagramPacket("Hello".getBytes(), 5); } public void testValidListener() throws Exception { Service service = getTestService("orange", Orange.class); Connector connector = getConnector(); InboundEndpoint endpoint2 = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("multicast://228.2.3.4:10100"); connector.registerListener(service, endpoint2); try { connector.registerListener(service, endpoint2); fail("cannot register on the same endpointUri"); } catch (Exception e) { // expected } } public void testProperties() throws Exception { MulticastConnector c = new MulticastConnector(); c.setReceiveBufferSize(1024); assertEquals(1024, c.getReceiveBufferSize()); c.setReceiveBufferSize(0); assertEquals(MulticastConnector.DEFAULT_BUFFER_SIZE, c.getReceiveBufferSize()); c.setReceiveTimeout(-1); assertEquals(MulticastConnector.DEFAULT_SOCKET_TIMEOUT, c.getReceiveTimeout()); c.setLoopback(true); assertTrue(c.isLoopback()); } } mule-2.0.1/transports/multicast/src/test/resources/0000755000175000017500000000000011351410663022304 5ustar charlescharlesmule-2.0.1/transports/multicast/src/test/resources/log4j.properties0000644000175000017500000000050210547540350025441 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/transports/multicast/src/test/resources/multicast-namespace-config.xml0000644000175000017500000000170510666164272030245 0ustar charlescharles mule-2.0.1/transports/multicast/src/test/resources/multicast-functional-test.xml0000644000175000017500000000560710745174725030174 0ustar charlescharles mule-2.0.1/transports/multicast/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000032710754365306027171 0ustar charlescharles# # Test cases listed in this file are not run. # # Disable Multicast tests unless configured # acooke - since this runs ok on CI, leaving enabled org.mule.transport.multicast.MulticastConnectorFunctionalTestCase mule-2.0.1/transports/multicast/pom.xml0000644000175000017500000000451611006063605020044 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-multicast Multicast Transport A Mule transport for Udp Multicasting. This transport supplies a Multicast Data Packet dispatcher and client implementation. org.mule.transports mule-transport-udp ${version} org.mule.tests mule-tests-functional ${version} test org.mule.transports mule-transport-vm ${version} test org.mule.modules mule-module-client ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.transport.multicast.* mule-2.0.1/transports/all-transports/0000755000175000017500000000000011351410641017500 5ustar charlescharlesmule-2.0.1/transports/all-transports/pom.xml0000644000175000017500000001131511006063605021017 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transports-all pom All transports This is a meta pom for referencing all transports as once as needed by various mule distributions we publish org.mule.transports mule-transport-axis ${version} org.mule.transports mule-transport-bpm ${version} org.mule.transports mule-transport-cxf ${version} org.mule.transports mule-transport-ejb ${version} org.mule.transports mule-transport-email ${version} org.mule.transports mule-transport-file ${version} org.mule.transports mule-transport-ftp ${version} org.mule.transports mule-transport-http ${version} org.mule.transports mule-transport-jbpm ${version} org.mule.transports mule-transport-jdbc ${version} org.mule.transports mule-transport-jms ${version} org.mule.transports mule-transport-multicast ${version} org.mule.transports mule-transport-quartz ${version} org.mule.transports mule-transport-rmi ${version} org.mule.transports mule-transport-soap ${version} org.mule.transports mule-transport-ssl ${version} org.mule.transports mule-transport-stdio ${version} org.mule.transports mule-transport-tcp ${version} org.mule.transports mule-transport-udp ${version} org.mule.transports mule-transport-vm ${version} org.mule.transports mule-transport-xmpp ${version} mule-2.0.1/transports/udp/0000755000175000017500000000000011351410654015307 5ustar charlescharlesmule-2.0.1/transports/udp/src/0000755000175000017500000000000011351410653016075 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/0000755000175000017500000000000011351410654017022 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/java/0000755000175000017500000000000011351410653017742 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/java/org/0000755000175000017500000000000011351410653020531 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/java/org/mule/0000755000175000017500000000000011351410653021473 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/java/org/mule/transport/0000755000175000017500000000000011351410653023527 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/0000755000175000017500000000000011351410654024320 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/UdpConnector.java0000644000175000017500000001142010757615756027607 0ustar charlescharles/* * $Id: UdpConnector.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.transport.AbstractConnector; import java.net.DatagramSocket; import org.apache.commons.pool.impl.GenericKeyedObjectPool; /** * UdpConnector can send and receive Mule events as Datagram packets. */ public class UdpConnector extends AbstractConnector { public static final String UDP = "udp"; public static final int DEFAULT_SOCKET_TIMEOUT = INT_VALUE_NOT_SET; public static final int DEFAULT_BUFFER_SIZE = 1024 * 16; public static final String KEEP_SEND_SOCKET_OPEN_PROPERTY = "keepSendSocketOpen"; protected int sendTimeout = DEFAULT_SOCKET_TIMEOUT; protected int receiveTimeout = DEFAULT_SOCKET_TIMEOUT; protected int sendBufferSize = DEFAULT_BUFFER_SIZE; protected int receiveBufferSize = DEFAULT_BUFFER_SIZE; protected boolean keepSendSocketOpen = true; protected boolean broadcast; protected GenericKeyedObjectPool dispatcherSocketsPool = new GenericKeyedObjectPool(); protected void doInitialise() throws InitialisationException { dispatcherSocketsPool.setFactory(new UdpSocketFactory()); dispatcherSocketsPool.setTestOnBorrow(true); dispatcherSocketsPool.setTestOnReturn(true); //There should only be one pooled instance per socket (key) dispatcherSocketsPool.setMaxActive(1); } protected void doDispose() { try { dispatcherSocketsPool.close(); } catch (Exception e) { logger.warn("Failed to close dispatcher socket pool: " + e.getMessage()); } } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { dispatcherSocketsPool.clear(); } protected void doStart() throws MuleException { // template method } protected void doStop() throws MuleException { // template method } public String getProtocol() { return UDP; } public int getSendTimeout() { return this.sendTimeout; } public void setSendTimeout(int timeout) { if (timeout < 0) { timeout = DEFAULT_SOCKET_TIMEOUT; } this.sendTimeout = timeout; } public int getReceiveTimeout() { return receiveTimeout; } public void setReceiveTimeout(int timeout) { if (timeout < 0) { timeout = DEFAULT_SOCKET_TIMEOUT; } this.receiveTimeout = timeout; } public int getSendBufferSize() { return sendBufferSize; } public void setSendBufferSize(int sendBufferSize) { if (sendBufferSize < 1) { sendBufferSize = DEFAULT_BUFFER_SIZE; } this.sendBufferSize = sendBufferSize; } public int getReceiveBufferSize() { return receiveBufferSize; } public void setReceiveBufferSize(int receiveBufferSize) { if (receiveBufferSize < 1) { receiveBufferSize = DEFAULT_BUFFER_SIZE; } this.receiveBufferSize = receiveBufferSize; } public boolean isBroadcast() { return broadcast; } public void setBroadcast(boolean broadcast) { this.broadcast = broadcast; } public boolean isKeepSendSocketOpen() { return keepSendSocketOpen; } public void setKeepSendSocketOpen(boolean keepSendSocketOpen) { this.keepSendSocketOpen = keepSendSocketOpen; } /** * Lookup a socket in the list of dispatcher sockets but don't create a new * socket * * @param endpoint * @return */ DatagramSocket getSocket(ImmutableEndpoint endpoint) throws Exception { return (DatagramSocket) dispatcherSocketsPool.borrowObject(endpoint); } void releaseSocket(DatagramSocket socket, ImmutableEndpoint endpoint) throws Exception { dispatcherSocketsPool.returnObject(endpoint, socket); } protected Object getReceiverKey(Service service, InboundEndpoint endpoint) { return endpoint.getEndpointURI().getAddress() + "/" + service.getName(); } } mule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/package.html0000644000175000017500000000015210745677442026617 0ustar charlescharles Mule Provides Udp connectivity for Mule. mule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/UdpMessageDispatcher.java0000644000175000017500000001014710757615756031255 0ustar charlescharles/* * $Id: UdpMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.transport.AbstractMessageDispatcher; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; /** * UdpMessageDispatcher is responsible for dispatching MuleEvents as * UDP packets on the network */ public class UdpMessageDispatcher extends AbstractMessageDispatcher { protected final UdpConnector connector; public UdpMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (UdpConnector)endpoint.getConnector(); } protected void doConnect() throws Exception { // Test the connection DatagramSocket socket = connector.getSocket(endpoint); connector.releaseSocket(socket, endpoint); } protected void doDisconnect() throws Exception { // nothing to do } protected synchronized void doDispatch(MuleEvent event) throws Exception { ImmutableEndpoint ep = event.getEndpoint(); DatagramSocket socket = connector.getSocket(ep); try { byte[] payload = event.transformMessageToBytes(); int port = ep.getEndpointURI().getPort(); InetAddress inetAddress = null; //TODO, check how expensive this operation is if("null".equalsIgnoreCase(ep.getEndpointURI().getHost())) { inetAddress = InetAddress.getLocalHost(); } else { inetAddress = InetAddress.getByName(ep.getEndpointURI().getHost()); } write(socket, payload, port, inetAddress); } finally { connector.releaseSocket(socket, ep); } } protected void write(DatagramSocket socket, byte[] data, int port, InetAddress inetAddress) throws IOException { DatagramPacket packet = new DatagramPacket(data, data.length); if (port >= 0) { packet.setPort(port); } packet.setAddress(inetAddress); socket.send(packet); } protected synchronized MuleMessage doSend(MuleEvent event) throws Exception { doDispatch(event); // If we're doing sync receive try and read return info from socket if (event.getEndpoint().isRemoteSync()) { DatagramSocket socket = connector.getSocket(event.getEndpoint()); DatagramPacket result = receive(socket, event.getTimeout()); if (result == null) { return null; } return new DefaultMuleMessage(connector.getMessageAdapter(result), event.getMessage()); } else { return event.getMessage(); } } private DatagramPacket receive(DatagramSocket socket, int timeout) throws IOException { int origTimeout = socket.getSoTimeout(); try { DatagramPacket packet = new DatagramPacket(new byte[connector.getReceiveBufferSize()], connector.getReceiveBufferSize()); if(timeout > 0 && timeout != socket.getSoTimeout()) { socket.setSoTimeout(timeout); } socket.receive(packet); return packet; } finally { if(socket.getSoTimeout()!= origTimeout) { socket.setSoTimeout(origTimeout); } } } protected void doDispose() { // template method } } mule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/i18n/0000755000175000017500000000000011351410653025076 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/i18n/UdpMessages.java0000644000175000017500000000171110745677442030202 0ustar charlescharles/* * $Id: UdpMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; import org.mule.transport.udp.UdpConnector; import java.net.URI; public class UdpMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath(UdpConnector.UDP); public static Message failedToBind(URI uri) { return createMessage(BUNDLE_PATH, 1, uri); } public static Message failedToLocateHost(URI uri) { return createMessage(BUNDLE_PATH, 2, uri); } } mule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/config/0000755000175000017500000000000011351410653025564 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/config/UdpNamespaceHandler.java0000644000175000017500000000171010745726444032307 0ustar charlescharles/* * $Id: UdpNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.endpoint.URIBuilder; import org.mule.transport.udp.UdpConnector; /** * Reigsters a Bean Definition Parser for handling UDP specific elements. * */ public class UdpNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(UdpConnector.UDP, URIBuilder.SOCKET_ATTRIBUTES); registerConnectorDefinitionParser(UdpConnector.class); } }mule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/UdpMessageRequesterFactory.java0000644000175000017500000000166010757615756032476 0ustar charlescharles/* * $Id: UdpMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; /** * Creates a dispatcher for receiving UDP packets. */ public class UdpMessageRequesterFactory extends AbstractMessageRequesterFactory { public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new UdpMessageRequester(endpoint); } }mule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/UdpMessageAdapter.java0000644000175000017500000000517210745677442030546 0ustar charlescharles/* * $Id: UdpMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.api.ThreadSafeAccess; import org.mule.api.transport.MessageTypeNotSupportedException; import org.mule.transport.AbstractMessageAdapter; import java.net.DatagramPacket; import java.net.InetAddress; /** * UdpMessageAdapter */ public class UdpMessageAdapter extends AbstractMessageAdapter { /** * Serial version */ private static final long serialVersionUID = -7767141617682012504L; public static final String ADDRESS_PROPERTY = "packet.address"; public static final String PORT_PROPERTY = "packet.port"; private byte[] message; public UdpMessageAdapter(Object message) throws MessageTypeNotSupportedException { if (message instanceof DatagramPacket) { DatagramPacket dp = (DatagramPacket)message; this.message = new byte[dp.getLength()]; System.arraycopy(dp.getData(), 0, this.message, 0, dp.getLength()); InetAddress address = dp.getAddress(); if (address != null) { setProperty(ADDRESS_PROPERTY, address); } setProperty(PORT_PROPERTY, new Integer(dp.getPort())); } else { throw new MessageTypeNotSupportedException(message, getClass()); } } protected UdpMessageAdapter(UdpMessageAdapter template) { super(template); message = template.message; } /** * Converts the message implementation into a String representation * * @param encoding The encoding to use when transforming the message (if * necessary). The parameter is used when converting from a byte array * @return String representation of the message payload * @throws Exception Implementation may throw an endpoint specific exception */ public String getPayloadAsString(String encoding) throws Exception { return new String(message, encoding); } public byte[] getPayloadAsBytes() throws Exception { return message; } public Object getPayload() { return message; } public ThreadSafeAccess newThreadCopy() { return new UdpMessageAdapter(this); } } mule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/UdpMessageReceiver.java0000644000175000017500000002151110757615756030730 0ustar charlescharles/* * $Id: UdpMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.Disposable; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.ConnectException; import org.mule.transport.udp.i18n.UdpMessages; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.SocketAddress; import java.net.SocketTimeoutException; import java.net.URI; import java.net.UnknownHostException; import java.util.List; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkException; import javax.resource.spi.work.WorkManager; /** UdpMessageReceiver receives UDP message packets. */ public class UdpMessageReceiver extends AbstractMessageReceiver implements Work { protected DatagramSocket socket = null; protected InetAddress inetAddress; protected int bufferSize; private URI uri; protected List responseTransformers = null; public UdpMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); bufferSize = ((UdpConnector) connector).getReceiveBufferSize(); uri = endpoint.getEndpointURI().getUri(); try { if (!"null".equalsIgnoreCase(uri.getHost())) { inetAddress = InetAddress.getByName(uri.getHost()); } } catch (UnknownHostException e) { throw new CreateException(UdpMessages.failedToLocateHost(uri), e, this); } responseTransformers = getResponseTransformers(); } protected void doConnect() throws Exception { try { socket = ((UdpConnector) connector).getSocket(endpoint); } catch (Exception e) { throw new ConnectException(UdpMessages.failedToBind(uri), e, this); } try { getWorkManager().scheduleWork(this, WorkManager.INDEFINITE, null, connector); } catch (WorkException e) { throw new ConnectException(CoreMessages.failedToScheduleWork(), e, this); } } protected void doDisconnect() throws Exception { // this will cause the server thread to quit disposing.set(true); if (socket != null) { socket.close(); } } protected void doStart() throws MuleException { // nothing to do } protected void doStop() throws MuleException { // nothing to do } protected List getResponseTransformers() { List transformers = endpoint.getResponseTransformers(); if (transformers == null) { return connector.getDefaultResponseTransformers(); } return transformers; } protected DatagramSocket createSocket(URI uri, InetAddress inetAddress) throws IOException { return new DatagramSocket(uri.getPort(), inetAddress); } /** Obtain the serverSocket */ public DatagramSocket getSocket() { return socket; } protected DatagramPacket createPacket() { DatagramPacket packet = new DatagramPacket(new byte[bufferSize], bufferSize); // if (uri.getPort() > 0) // { // packet.setPort(uri.getPort()); // } // packet.setAddress(inetAddress); return packet; } public void run() { while (!disposing.get()) { if (connector.isStarted()) { try { DatagramPacket packet = createPacket(); try { if (logger.isDebugEnabled()) { logger.debug("Receiving packet on " + uri); } socket.receive(packet); if (logger.isTraceEnabled()) { logger.trace("Received packet on: " + uri); } Work work = createWork(packet); try { getWorkManager().scheduleWork(work, WorkManager.INDEFINITE, null, connector); } catch (WorkException e) { logger.error("Udp receiver interrupted: " + e.getMessage(), e); } } catch (SocketTimeoutException e) { // ignore } } catch (Exception e) { if (!connector.isDisposed() && !disposing.get()) { logger.debug("Accept failed on socket: " + e, e); handleException(e); } } } } } public void release() { dispose(); } protected void doDispose() { if (socket != null && !socket.isClosed()) { logger.debug("Closing Udp connection: " + uri); socket.close(); logger.info("Closed Udp connection: " + uri); } } protected Work createWork(DatagramPacket packet) throws IOException { return new UdpWorker(new DatagramSocket(0), packet); } protected class UdpWorker implements Work, Disposable { private DatagramSocket socket = null; private DatagramPacket packet; public UdpWorker(DatagramSocket socket, DatagramPacket packet) { this.socket = socket; this.packet = packet; } public void release() { dispose(); } public void dispose() { if (socket != null && !socket.isClosed()) { try { socket.close(); } catch (Exception e) { logger.error("Socket close failed", e); } } socket = null; } /** Accept requests from a given Udp address */ public void run() { MuleMessage returnMessage = null; try { MessageAdapter adapter = connector.getMessageAdapter(packet); final SocketAddress clientAddress = socket.getRemoteSocketAddress(); if (clientAddress != null) { adapter.setProperty(MuleProperties.MULE_REMOTE_CLIENT_ADDRESS, clientAddress); } returnMessage = routeMessage(new DefaultMuleMessage(adapter), endpoint.isSynchronous()); if (returnMessage != null) { byte[] data; if (responseTransformers != null) { returnMessage.applyTransformers(responseTransformers); Object response = returnMessage.getPayload(); if (response instanceof byte[]) { data = (byte[]) response; } else { data = response.toString().getBytes(); } } else { data = returnMessage.getPayloadAsBytes(); } DatagramPacket result = new DatagramPacket(data, data.length, packet.getAddress(), packet.getPort()); socket.send(result); } } catch (Exception e) { if (!disposing.get()) { handleException(e); } } finally { dispose(); } } } } mule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/UdpMessageRequester.java0000644000175000017500000000606310770356575031144 0ustar charlescharles/* * $Id: UdpMessageRequester.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.transport.AbstractMessageRequester; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.util.Map; /** * Responsible for requesting MuleEvents as UDP packets on the network */ public class UdpMessageRequester extends AbstractMessageRequester { protected final UdpConnector connector; public UdpMessageRequester(InboundEndpoint endpoint) { super(endpoint); this.connector = (UdpConnector)endpoint.getConnector(); } protected void doConnect() throws Exception { // Test the connection DatagramSocket socket = connector.getSocket(endpoint); connector.releaseSocket(socket, endpoint); } protected void doDisconnect() throws Exception { // nothing to do } private DatagramPacket request(DatagramSocket socket, int timeout) throws IOException { int origTimeout = socket.getSoTimeout(); try { DatagramPacket packet = new DatagramPacket(new byte[connector.getReceiveBufferSize()], connector.getReceiveBufferSize()); if(timeout > 0 && timeout != socket.getSoTimeout()) { socket.setSoTimeout(timeout); } socket.receive(packet); return packet; } finally { if(socket.getSoTimeout()!= origTimeout) { socket.setSoTimeout(origTimeout); } } } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal cuases an exception */ protected MuleMessage doRequest(long timeout) throws Exception { DatagramSocket socket = connector.getSocket(endpoint); DatagramPacket result = request(socket, (int)timeout); if (result == null) { return null; } return new DefaultMuleMessage(connector.getMessageAdapter(result), (Map)null); } protected void doDispose() { // template method } }mule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/UdpMessageDispatcherFactory.java0000644000175000017500000000174410757615756032610 0ustar charlescharles/* * $Id: UdpMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * UdpMessageDispatcherFactory creates a dispatcher for sending UDP * packets. */ public class UdpMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new UdpMessageDispatcher(endpoint); } } mule-2.0.1/transports/udp/src/main/java/org/mule/transport/udp/UdpSocketFactory.java0000644000175000017500000001067710757615756030452 0ustar charlescharles/* * $Id: UdpSocketFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.Connector; import org.mule.util.MapUtils; import java.io.IOException; import java.net.DatagramSocket; import java.net.InetAddress; import java.net.Socket; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.pool.KeyedPoolableObjectFactory; /** * Creates a client socket using the host and port address supplied in the endpoint URI. Addtional * socket parameters will also be set from the connector */ public class UdpSocketFactory implements KeyedPoolableObjectFactory { /** * logger used by this class */ protected transient final Log logger = LogFactory.getLog(UdpSocketFactory.class); public Object makeObject(Object key) throws Exception { ImmutableEndpoint ep = (ImmutableEndpoint)key; DatagramSocket socket; if(ep instanceof InboundEndpoint) { int port = ep.getEndpointURI().getPort(); String host = ep.getEndpointURI().getHost(); if(port > 0) { if("null".equalsIgnoreCase(host)) { socket = createSocket(port); } else { socket = createSocket(port, InetAddress.getByName(host)); } } else { socket = createSocket(); } } else { //If this is a client socket create a default instance socket = createSocket(); } UdpConnector connector = (UdpConnector)ep.getConnector(); //There is some overhead in stting socket timeout and buffer size, so we're //careful here only to set if needed if (connector.getReceiveBufferSize() != Connector.INT_VALUE_NOT_SET && socket.getReceiveBufferSize() != connector.getReceiveBufferSize()) { socket.setReceiveBufferSize(connector.getReceiveBufferSize()); } if (connector.getSendBufferSize() != Connector.INT_VALUE_NOT_SET && socket.getSendBufferSize() != connector.getSendBufferSize()) { socket.setSendBufferSize(connector.getSendBufferSize()); } if (connector.getReceiveTimeout() != Connector.INT_VALUE_NOT_SET && socket.getSoTimeout() != connector.getReceiveTimeout()) { socket.setSoTimeout(connector.getSendTimeout()); } socket.setBroadcast(connector.isBroadcast()); return socket; } public void destroyObject(Object key, Object object) throws Exception { Socket socket = (Socket)object; if(!socket.isClosed()) { socket.close(); } } public boolean validateObject(Object key, Object object) { DatagramSocket socket = (DatagramSocket)object; return !socket.isClosed(); } public void activateObject(Object key, Object object) throws Exception { // nothing to do } public void passivateObject(Object key, Object object) throws Exception { ImmutableEndpoint ep = (ImmutableEndpoint)key; boolean keepSocketOpen = MapUtils.getBooleanValue(ep.getProperties(), UdpConnector.KEEP_SEND_SOCKET_OPEN_PROPERTY, ((UdpConnector)ep.getConnector()).isKeepSendSocketOpen()); DatagramSocket socket = (DatagramSocket)object; if (!keepSocketOpen) { if (socket != null) { socket.close(); } } } protected DatagramSocket createSocket() throws IOException { return new DatagramSocket(); } protected DatagramSocket createSocket(int port) throws IOException { return new DatagramSocket(port); } protected DatagramSocket createSocket(int port, InetAddress inetAddress) throws IOException { return new DatagramSocket(port, inetAddress); } } mule-2.0.1/transports/udp/src/main/resources/0000755000175000017500000000000011351410654021034 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/resources/META-INF/0000755000175000017500000000000011351410654022174 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012110754365306025046 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/udp/2.0/mule-udp.xsd=META-INF/mule-udp.xsdmule-2.0.1/transports/udp/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014110754365306025225 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/udp/2.0=org.mule.transport.udp.config.UdpNamespaceHandler mule-2.0.1/transports/udp/src/main/resources/META-INF/mule-udp.xsd0000644000175000017500000000565710735226404024464 0ustar charlescharles mule-2.0.1/transports/udp/src/main/resources/META-INF/services/0000755000175000017500000000000011351410654024017 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410654024606 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410654025550 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410654027565 5ustar charlescharlesmule-2.0.1/transports/udp/src/main/resources/META-INF/services/org/mule/providers/udp.properties0000644000175000017500000000062210745677442032513 0ustar charlescharlesconnector=org.mule.transport.udp.UdpConnector dispatcher.factory=org.mule.transport.udp.UdpMessageDispatcherFactory requester.factory=org.mule.transport.udp.UdpMessageRequesterFactory message.receiver=org.mule.transport.udp.UdpMessageReceiver message.adapter=org.mule.transport.udp.UdpMessageAdapter inbound.transformer= outbound.transformer= endpoint.builder=org.mule.endpoint.SocketEndpointURIBuildermule-2.0.1/transports/udp/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410654026327 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/udp/src/main/resources/META-INF/services/org/mule/i18n/udp-messages.propertiesmule-2.0.1/transports/udp/src/main/resources/META-INF/services/org/mule/i18n/udp-messages.properties0000644000175000017500000000013610330216565033043 0ustar charlescharles1=Failed to bind to uri "{0}" 2=Unable to locate host "{0}" 3=Failed to close udp socket "{0}"mule-2.0.1/transports/udp/src/test/0000755000175000017500000000000011351410653017054 5ustar charlescharlesmule-2.0.1/transports/udp/src/test/java/0000755000175000017500000000000011351410653017775 5ustar charlescharlesmule-2.0.1/transports/udp/src/test/java/org/0000755000175000017500000000000011351410653020564 5ustar charlescharlesmule-2.0.1/transports/udp/src/test/java/org/mule/0000755000175000017500000000000011351410653021526 5ustar charlescharlesmule-2.0.1/transports/udp/src/test/java/org/mule/transport/0000755000175000017500000000000011351410653023562 5ustar charlescharlesmule-2.0.1/transports/udp/src/test/java/org/mule/transport/udp/0000755000175000017500000000000011351410653024352 5ustar charlescharlesmule-2.0.1/transports/udp/src/test/java/org/mule/transport/udp/UdpMessageReceiverTestCase.java0000644000175000017500000000330110757615756032414 0ustar charlescharles/* * $Id: UdpMessageReceiverTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.transport.AbstractMessageReceiverTestCase; import com.mockobjects.dynamic.Mock; public class UdpMessageReceiverTestCase extends AbstractMessageReceiverTestCase { public MessageReceiver getMessageReceiver() throws Exception { endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "udp://localhost:10100"); Mock mockComponent = new Mock(Service.class); mockComponent.expectAndReturn("getResponseTransformer", null); mockComponent.expectAndReturn("getResponseRouter", null); return new UdpMessageReceiver(endpoint.getConnector(), (Service) mockComponent.proxy(), endpoint); } public InboundEndpoint getEndpoint() throws Exception { EndpointBuilder builder = new EndpointURIEndpointBuilder("udp://localhost:10100", muleContext); builder.setConnector(new UdpConnector()); return muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint(builder); } } mule-2.0.1/transports/udp/src/test/java/org/mule/transport/udp/functional/0000755000175000017500000000000011351410653026514 5ustar charlescharlesmule-2.0.1/transports/udp/src/test/java/org/mule/transport/udp/functional/UdpRoundTripTestCase.java0000644000175000017500000000471010745677442033435 0ustar charlescharles/* * $Id: UdpRoundTripTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp.functional; import org.mule.tck.FunctionalTestCase; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import edu.emory.mathcs.backport.java.util.Arrays; public class UdpRoundTripTestCase extends FunctionalTestCase { protected String getConfigResources() { return "udp-roundtrip-test-config.xml"; } public void testSendAndReceiveUDP() throws IOException { int outPort = 61000; int inPort = 61001; // the socket we talk to DatagramSocket socket = new DatagramSocket(inPort, InetAddress.getLocalHost()); // prepare outgoing packet ByteArrayOutputStream bytesOut = new ByteArrayOutputStream(); DataOutputStream dataOut = new DataOutputStream(bytesOut); dataOut.writeFloat(1.0f); dataOut.writeFloat(2.0f); byte[] bytesToSend = bytesOut.toByteArray(); DatagramPacket outboundPacket = new DatagramPacket(bytesToSend, bytesToSend.length, InetAddress.getLocalHost(), outPort); socket.send(outboundPacket); // receive whatever came back byte[] receiveBuffer = new byte[bytesToSend.length]; DatagramPacket inboundPacket = new DatagramPacket(receiveBuffer, receiveBuffer.length); socket.receive(inboundPacket); // compare byte buffers as strings so we get to see the diff assertEquals(Arrays.toString(outboundPacket.getData()), Arrays.toString(inboundPacket.getData())); // make sure the contents are really the same ByteArrayInputStream bytesIn = new ByteArrayInputStream(inboundPacket.getData()); DataInputStream dataIn = new DataInputStream(bytesIn); // the delta is only here to make JUnit happy assertEquals(1.0f, dataIn.readFloat(), 0.1f); assertEquals(2.0f, dataIn.readFloat(), 0.1f); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/udp/src/test/java/org/mule/transport/udp/functional/UdpConnectorFunctionalTestCase.javamule-2.0.1/transports/udp/src/test/java/org/mule/transport/udp/functional/UdpConnectorFunctionalTest0000644000175000017500000001074710754375733033755 0ustar charlescharles/* * $Id: UdpConnectorFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp.functional; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashSet; import java.util.Set; public class UdpConnectorFunctionalTestCase extends FunctionalTestCase { public static final String MESSAGE = "hello"; public static final int TOTAL_MESSAGE_COUNT = 1000; public static final int MAX_NUMBER_OF_BATCHES = 128; public static final long MAX_PAUSE_PERIOD = 2000; public static final long MIN_PAUSE_PERIOD = 10; public static final long BETWEEN_BATCH_PAUSE = 5000; protected String getConfigResources() { return "udp-functional-test.xml"; } /** * We try progressively smaller batches to see if there are issues with internal * buffers. If we don't get 100% success eventually, we fail. */ public void testMany() throws Exception { int numberOfBatches = 0; boolean ok = false; while (!ok && numberOfBatches < MAX_NUMBER_OF_BATCHES) { numberOfBatches = 0 == numberOfBatches ? 1 : numberOfBatches * 2; ok = doTestSome(TOTAL_MESSAGE_COUNT, TOTAL_MESSAGE_COUNT / numberOfBatches); if (!ok) { logger.warn("UDP failed to send " + TOTAL_MESSAGE_COUNT + " messages in " + numberOfBatches + " batches"); // clean out the system try { synchronized(this) { this.wait(BETWEEN_BATCH_PAUSE); } } catch (InterruptedException e) { // ignore } MuleClient client = new MuleClient(); int dropped = 0; while (null != client.request("vm://foo", MAX_PAUSE_PERIOD)) { // discard old messages dropped++; } logger.info("Cleaned out " + dropped + " messages"); } } if (!ok) { fail("Couldn't get UDP to 100% with a batch size of " + TOTAL_MESSAGE_COUNT / numberOfBatches); } else { logger.info("Required " + numberOfBatches + " batches before UDP 100% OK (" + TOTAL_MESSAGE_COUNT + " messages)"); } } /** * @param numberOfMessages Total number of tests * @param burst Number of mesages to send between wait periods * @return true if all messages received * @throws Exception */ protected boolean doTestSome(int numberOfMessages, int burst) throws Exception { logger.info("Trying " + numberOfMessages + " messages in batches of " + burst); MuleClient client = new MuleClient(); int burstCount = 0; Set receivedMessages = new HashSet(numberOfMessages); for (int sentPackets = 0; sentPackets < numberOfMessages; sentPackets++) { burstCount++; String msg = MESSAGE + sentPackets; client.dispatch("serverEndpoint", msg, null); if (burst == burstCount || sentPackets == numberOfMessages-1) { long pause = MAX_PAUSE_PERIOD; for (int i = 0; i < burstCount; i++) { MuleMessage message = client.request("vm://foo", pause); // reduce waiting time once we have a bunch of messages coming in // (without this, we can end up waiting for very long times....) pause = Math.max(MIN_PAUSE_PERIOD, pause / 2); if (null != message) { receivedMessages.add(message.getPayloadAsString()); } } burstCount = 0; } } boolean ok = receivedMessages.size() == numberOfMessages; if (!ok) { logger.info("Received " + receivedMessages.size() + " messages"); } return ok; } } mule-2.0.1/transports/udp/src/test/java/org/mule/transport/udp/UdpConnectorTestCase.java0000644000175000017500000000441110765313375031267 0ustar charlescharles/* * $Id: UdpConnectorTestCase.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transport.AbstractConnectorTestCase; import java.net.DatagramPacket; public class UdpConnectorTestCase extends AbstractConnectorTestCase { // @Override public Connector createConnector() throws Exception { UdpConnector c = new UdpConnector(); c.setName("UdpConnector"); return c; } public String getTestEndpointURI() { return "udp://localhost:61024"; } public Object getValidMessage() throws Exception { return new DatagramPacket("Hello".getBytes(), 5); } public void testValidListener() throws Exception { Service service = getTestService("orange", Orange.class); Connector connector = getConnector(); InboundEndpoint endpoint2 = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("udp://localhost:3456"); connector.registerListener(service, endpoint2); try { connector.registerListener(service, endpoint2); fail("cannot register on the same endpointUri"); } catch (Exception e) { // expected } } public void testProperties() throws Exception { UdpConnector connector = (UdpConnector)this.getConnector(); connector.setReceiveBufferSize(1024); assertEquals(1024, connector.getReceiveBufferSize()); connector.setReceiveBufferSize(0); assertEquals(UdpConnector.DEFAULT_BUFFER_SIZE, connector.getReceiveBufferSize()); connector.setReceiveTimeout(-1); assertEquals(UdpConnector.DEFAULT_SOCKET_TIMEOUT, connector.getReceiveTimeout()); } } mule-2.0.1/transports/udp/src/test/java/org/mule/transport/udp/UdpMessageAdapterTestCase.java0000644000175000017500000000357410754365306032232 0ustar charlescharles/* * $Id: UdpMessageAdapterTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.DefaultMuleMessage; import org.mule.api.MessagingException; import org.mule.api.transport.MessageAdapter; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.transport.udp.UdpMessageAdapter; import java.net.DatagramPacket; public class UdpMessageAdapterTestCase extends AbstractMessageAdapterTestCase { public Object getValidMessage() throws Exception { return new DatagramPacket("Hello".getBytes(), 5); } public MessageAdapter createAdapter(Object payload) throws MessagingException { return new UdpMessageAdapter(payload); } public void testMessageRetrieval() throws Exception { Object message = getValidMessage(); MessageAdapter adapter = createAdapter(message); DefaultMuleMessage muleMessage = new DefaultMuleMessage(adapter); assertEquals(new String(((DatagramPacket)message).getData()), muleMessage.getPayloadAsString()); byte[] bytes = muleMessage.getPayloadAsBytes(); assertNotNull(bytes); String stringMessage = muleMessage.getPayloadAsString(); assertNotNull(stringMessage); assertNotNull(adapter.getPayload()); try { adapter = createAdapter(getInvalidMessage()); fail("Message adapter should throw exception if an invalid messgae is set"); } catch (Exception e) { // expected } } } mule-2.0.1/transports/udp/src/test/java/org/mule/transport/udp/UdpNamespaceHandlerTestCase.java0000644000175000017500000000242310745677442032536 0ustar charlescharles/* * $Id: UdpNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.udp; import org.mule.tck.FunctionalTestCase; import org.mule.transport.udp.UdpConnector; /** * TODO */ public class UdpNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "udp-namespace-config.xml"; } public void testConfig() throws Exception { UdpConnector c = (UdpConnector)muleContext.getRegistry().lookupConnector("udpConnector"); assertNotNull(c); assertEquals(1234, c.getReceiveBufferSize()); assertEquals(2345, c.getReceiveTimeout()); assertEquals(3456, c.getSendBufferSize()); assertEquals(4567, c.getSendTimeout()); assertEquals(true, c.isBroadcast()); assertEquals(false, c.isKeepSendSocketOpen()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } }mule-2.0.1/transports/udp/src/test/resources/0000755000175000017500000000000011351410653021066 5ustar charlescharlesmule-2.0.1/transports/udp/src/test/resources/log4j.properties0000644000175000017500000000073710745677442024253 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN # this test is giving some interesting feedback i'd like to see in builds log4j.logger.org.mule.transport.udp.functional.UdpConnectorFunctionalTestCase=INFO mule-2.0.1/transports/udp/src/test/resources/udp-roundtrip-test-config.xml0000644000175000017500000000255110757365472026670 0ustar charlescharles mule-2.0.1/transports/udp/src/test/resources/udp-namespace-config.xml0000644000175000017500000000170610665301621025602 0ustar charlescharles mule-2.0.1/transports/udp/src/test/resources/udp-functional-test.xml0000644000175000017500000000324310745174725025534 0ustar charlescharles mule-2.0.1/transports/udp/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000027610745677442025766 0ustar charlescharles# # Test cases listed in this file are not run. # # Andrew C local #org.mule.transport.udp.functional.UdpConnectorFunctionalTestCase org.mule.transport.udp.functional.UdpRoundTripTestCase mule-2.0.1/transports/udp/pom.xml0000644000175000017500000000445611006063605016632 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-udp UDP Transport A Mule transport for Udp Connectivity. This transport supplies a Udp Data Packet dispatcher and client implementation. osgi org.apache.felix maven-bundle-plugin org.mule.transport.udp.* org.mule mule-core ${version} org.mule.tests mule-tests-functional ${version} test org.mule.transports mule-transport-vm ${version} test org.mule.modules mule-module-client ${version} test mule-2.0.1/transports/xmpp/0000755000175000017500000000000011351410641015477 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/0000755000175000017500000000000011351410641016266 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/0000755000175000017500000000000011351410641017212 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/java/0000755000175000017500000000000011351410641020133 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/java/org/0000755000175000017500000000000011351410641020722 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/java/org/mule/0000755000175000017500000000000011351410641021664 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/0000755000175000017500000000000011351410641023720 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/0000755000175000017500000000000011351410641024704 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppMessageRequester.java0000644000175000017500000000647210757615756031740 0ustar charlescharles/* * $Id: XmppMessageRequester.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.transport.AbstractMessageRequester; import org.jivesoftware.smack.Chat; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.Message; /** * Allows Mule events to be received over Xmpp */ public class XmppMessageRequester extends AbstractMessageRequester { private final XmppConnector connector; private volatile XMPPConnection xmppConnection = null; public XmppMessageRequester(InboundEndpoint endpoint) { super(endpoint); this.connector = (XmppConnector)endpoint.getConnector(); } protected void doConnect() throws Exception { if (xmppConnection == null) { EndpointURI uri = endpoint.getEndpointURI(); xmppConnection = connector.createXmppConnection(uri); } } protected void doDisconnect() throws Exception { try { if (xmppConnection != null) { xmppConnection.close(); } } finally { xmppConnection = null; } } protected void doDispose() { // template method } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal cuases an exception */ protected MuleMessage doRequest(long timeout) throws Exception { // Should be in the form of xmpp://user:pass@host:[port]/folder String to = (String)endpoint.getProperty("folder"); if (to == null) { throw new MalformedEndpointException(endpoint.getEndpointURI().toString()); } Chat chat = xmppConnection.createChat(to); Message message = null; if (timeout == MuleEvent.TIMEOUT_WAIT_FOREVER) { message = chat.nextMessage(); } else if (timeout == MuleEvent.TIMEOUT_DO_NOT_WAIT) { message = chat.nextMessage(1); } else { message = chat.nextMessage(timeout); } if (message != null) { return new DefaultMuleMessage(connector.getMessageAdapter(message)); } else { return null; } } }mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppEndpointURIBuilder.java0000644000175000017500000000305510745677442032112 0ustar charlescharles/* * $Id: XmppEndpointURIBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.endpoint.UserInfoEndpointURIBuilder; import org.mule.transport.xmpp.i18n.XmppMessages; import java.net.URI; import java.util.Properties; /** * Does the same as the UserInfoEndpointBuilder but also ensures that a path is set * on the uri. The path is used as either the groupChat name or the recipient name of * a one on one chat. */ public class XmppEndpointURIBuilder extends UserInfoEndpointURIBuilder { protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException { if (uri.getPath().length() == 0) { throw new MalformedEndpointException(XmppMessages.noRecipientInUri(), uri.toString()); } if (props.getProperty(XmppConnector.XMPP_GROUP_CHAT, "false").equalsIgnoreCase("true")) { if (props.getProperty(XmppConnector.XMPP_NICKNAME, null) == null) { throw new MalformedEndpointException(XmppMessages.nicknameMustBeSet(), uri.toString()); } } super.setEndpoint(uri, props); } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppMessageAdapter.java0000644000175000017500000000661110745677442031331 0ustar charlescharles/* * $Id: XmppMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.api.MessagingException; import org.mule.api.ThreadSafeAccess; import org.mule.api.transport.MessageTypeNotSupportedException; import org.mule.transport.AbstractMessageAdapter; import org.mule.util.StringUtils; import java.util.Iterator; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Packet; /** * XmppMessageAdapter wraps a Smack XMPP packet */ public class XmppMessageAdapter extends AbstractMessageAdapter { public static final String DEFAULT_SUBJECT = "(no subject)"; public static final String DEFAULT_THREAD = "(no thread)"; /** * Serial version */ private static final long serialVersionUID = -4003299444661664762L; private final Packet message; public XmppMessageAdapter(Object message) throws MessagingException { if (message instanceof Packet) { this.message = (Packet)message; for (Iterator iter = this.message.getPropertyNames(); iter.hasNext();) { String name = (String)iter.next(); this.setProperty(name, this.message.getProperty(name)); } if (this.message instanceof Message) { this.setProperty("subject", StringUtils.defaultIfEmpty(((Message)this.message).getSubject(), DEFAULT_SUBJECT)); this.setProperty("thread", StringUtils.defaultIfEmpty(((Message)this.message).getThread(), DEFAULT_THREAD)); } } else { throw new MessageTypeNotSupportedException(message, getClass()); } } protected XmppMessageAdapter(XmppMessageAdapter template) { super(template); message = template.message; } /** * Converts the message implementation into a String representation * * @param encoding The encoding to use when transforming the message (if * necessary). The parameter is used when converting from a byte array * @return String representation of the message payload * @throws Exception Implementation may throw an endpoint specific exception */ public String getPayloadAsString(String encoding) throws Exception { if (message instanceof Message) { return ((Message)message).getBody(); } else { return message.toString(); } } public byte[] getPayloadAsBytes() throws Exception { if (message instanceof Message) { return ((Message)message).getBody().getBytes(); } else { return message.toString().getBytes(); } } public Object getPayload() { return message; } // @Override public String getUniqueId() { return message.getPacketID(); } public ThreadSafeAccess newThreadCopy() { return new XmppMessageAdapter(this); } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppMessageRequesterFactory.java0000644000175000017500000000172410757615756033263 0ustar charlescharles/* * $Id: XmppMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; /** * Creates a dispatcher responsible for writing Xmpp packets to a an Jabber chat */ public class XmppMessageRequesterFactory extends AbstractMessageRequesterFactory { public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new XmppMessageRequester(endpoint); } }mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/transformers/0000755000175000017500000000000011351410641027431 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/transformers/XmppPacketToObject.javamule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/transformers/XmppPacketToObject.jav0000644000175000017500000000250010745677442033662 0ustar charlescharles/* * $Id: XmppPacketToObject.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.transformers; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractMessageAwareTransformer; import java.util.Iterator; import org.jivesoftware.smack.packet.Message; public class XmppPacketToObject extends AbstractMessageAwareTransformer { public XmppPacketToObject() { registerSourceType(Message.class); setReturnClass(String.class); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { Message xmppMessage = (Message) message.getPayload(); for (Iterator iterator = xmppMessage.getPropertyNames(); iterator.hasNext();) { String name = (String) iterator.next(); message.setProperty(name, xmppMessage.getProperty(name)); } return xmppMessage.getBody(); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/transformers/ObjectToXmppPacket.javamule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/transformers/ObjectToXmppPacket.jav0000644000175000017500000000536610745677442033677 0ustar charlescharles/* * $Id: ObjectToXmppPacket.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.transformers; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.transport.xmpp.XmppConnector; import java.util.Iterator; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.XMPPError; /** * Creates an Xmpp message packet from a MuleMessage */ public class ObjectToXmppPacket extends AbstractMessageAwareTransformer { public ObjectToXmppPacket() { this.registerSourceType(String.class); this.registerSourceType(Message.class); setReturnClass(Message.class); } public Object transform(MuleMessage msg, String outputEncoding) throws TransformerException { Object src = msg.getPayload(); // Make the transformer match its wiki documentation: we accept Messages and Strings. // No special treatment for Messages is needed if (src instanceof Message) { return src; } Message result = new Message(); if (msg.getExceptionPayload() != null) { result.setError(new XMPPError(503, msg.getExceptionPayload().getMessage())); } for (Iterator iterator = msg.getPropertyNames().iterator(); iterator.hasNext();) { String name = (String) iterator.next(); if (name.equals(XmppConnector.XMPP_THREAD)) { result.setThread((String) msg.getProperty(name)); } else if (name.equals(XmppConnector.XMPP_SUBJECT)) { result.setSubject((String) msg.getProperty(name)); } else if (name.equals(XmppConnector.XMPP_FROM)) { result.setFrom((String) msg.getProperty(name)); } else if (name.equals(XmppConnector.XMPP_TO)) { result.setTo((String) msg.getProperty(name)); } else { result.setProperty(name, msg.getProperty(name)); } } // copy the payload. Since it can only be a String (other objects wouldn't be passed in through // AbstractTransformer) the following is safe. result.setBody((String) src); return result; } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppMessageDispatcher.java0000644000175000017500000001077610757615756032051 0ustar charlescharles/* * $Id: XmppMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.transport.AbstractMessageDispatcher; import org.jivesoftware.smack.Chat; import org.jivesoftware.smack.GroupChat; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.packet.Message; /** * Allows Mule events to be sent over Xmpp */ public class XmppMessageDispatcher extends AbstractMessageDispatcher { private final XmppConnector connector; private volatile XMPPConnection xmppConnection = null; private volatile Chat chat; private volatile GroupChat groupChat; public XmppMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (XmppConnector)endpoint.getConnector(); } protected void doConnect() throws Exception { if (xmppConnection == null) { EndpointURI uri = endpoint.getEndpointURI(); xmppConnection = connector.createXmppConnection(uri); } } protected void doDisconnect() throws Exception { try { if (groupChat != null) { groupChat.leave(); } if (xmppConnection != null) { xmppConnection.close(); } } finally { xmppConnection = null; } } protected void doDispose() { // template method } protected void doDispatch(MuleEvent event) throws Exception { sendMessage(event); } protected MuleMessage doSend(MuleEvent event) throws Exception { sendMessage(event); if (useRemoteSync(event)) { Message response; if (groupChat != null) { response = groupChat.nextMessage(event.getTimeout()); } else { response = chat.nextMessage(event.getTimeout()); } if (response != null) { if (logger.isDebugEnabled()) { logger.debug("Got a response from chat: " + chat); } return new DefaultMuleMessage(connector.getMessageAdapter(response)); } } return null; } protected void sendMessage(MuleEvent event) throws Exception { if (chat == null && groupChat == null) { MuleMessage msg = event.getMessage(); boolean group = msg.getBooleanProperty(XmppConnector.XMPP_GROUP_CHAT, false); String nickname = msg.getStringProperty(XmppConnector.XMPP_NICKNAME, "mule"); String recipient = event.getEndpoint().getEndpointURI().getPath().substring(1); if (group) { groupChat = new GroupChat(xmppConnection, recipient); if (!groupChat.isJoined()) { groupChat.join(nickname); } } else { chat = new Chat(xmppConnection, recipient); } } Object msgObj = event.getMessage().getPayload(); Message message; // avoid duplicate transformation if (!(msgObj instanceof Message)) { message = (Message)event.transformMessage(); } else { message = (Message)msgObj; } if (logger.isTraceEnabled()) { logger.trace("Transformed packet: " + message.toXML()); } // if the endpoint specified a designated recipient, use that if (message.getTo() != null) { xmppConnection.sendPacket(message); } else if (chat != null) { chat.sendMessage(message); } else { groupChat.sendMessage(message); } if (logger.isDebugEnabled()) { logger.debug("Packet successfully sent"); } } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppsConnector.java0000644000175000017500000000261310745677442030557 0ustar charlescharles/* * $Id: XmppsConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.api.endpoint.EndpointURI; import org.jivesoftware.smack.SSLXMPPConnection; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; public class XmppsConnector extends XmppConnector { public static final String XMPPS = "xmpps"; public String getProtocol() { return XMPPS; } /** * This method creates a {@link SSLXMPPConnection} to allow secure communication to the Jabber * server. */ protected XMPPConnection doCreateXmppConnection(EndpointURI endpointURI) throws XMPPException { XMPPConnection xmppConnection = null; if (endpointURI.getPort() != -1) { xmppConnection = new SSLXMPPConnection(endpointURI.getHost(), endpointURI.getPort()); } else { xmppConnection = new SSLXMPPConnection(endpointURI.getHost()); } return xmppConnection; } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppMessageReceiver.java0000644000175000017500000001162010757615756031514 0ustar charlescharles/* * $Id: XmppMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.MessageAdapter; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractConnector; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.ConnectException; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkException; import javax.resource.spi.work.WorkManager; import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.filter.PacketTypeFilter; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Packet; /** XmppMessageReceiver is responsible for receiving Mule events over XMPP. */ public class XmppMessageReceiver extends AbstractMessageReceiver implements PacketListener { private XMPPConnection xmppConnection = null; public XmppMessageReceiver(AbstractConnector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); } protected void doConnect() throws Exception { try { XmppConnector cnn = (XmppConnector) connector; xmppConnection = cnn.createXmppConnection(endpoint.getEndpointURI()); if (endpoint.getFilter() instanceof PacketFilter) { xmppConnection.addPacketListener(this, (PacketFilter) endpoint.getFilter()); } else { PacketFilter filter = new PacketTypeFilter(Message.class); xmppConnection.addPacketListener(this, filter); } } catch (XMPPException e) { throw new ConnectException(CoreMessages.failedToCreate("XMPP Connection"), e, this); } } protected void doDisconnect() throws Exception { if (xmppConnection != null) { xmppConnection.removePacketListener(this); xmppConnection.close(); } } protected void doStart() throws MuleException { // nothing to do } protected void doStop() throws MuleException { // nothing to do } protected void doDispose() { // nothing to do } protected Work createWork(Packet message) { return new XMPPWorker(message); } /** @see org.jivesoftware.smack.PacketListener#processPacket(org.jivesoftware.smack.packet.Packet) */ public void processPacket(Packet packet) { if (logger.isDebugEnabled()) { logger.debug("processing packet: " + packet.toXML()); } Work work = createWork(packet); try { getWorkManager().scheduleWork(work, WorkManager.INDEFINITE, null, connector); } catch (WorkException e) { logger.error("Xmpp Server receiver work failed: " + e.getMessage(), e); } } private class XMPPWorker implements Work { Packet packet = null; public XMPPWorker(Packet message) { this.packet = message; } /** Accept requests from a given TCP port */ public void run() { try { MessageAdapter adapter = connector.getMessageAdapter(packet); if (logger.isDebugEnabled()) { logger.debug("Processing XMPP packet from: " + packet.getFrom()); logger.debug("MessageAdapter is a: " + adapter.getClass().getName()); } MuleMessage returnMessage = routeMessage(new DefaultMuleMessage(adapter), endpoint.isSynchronous()); if (returnMessage != null && packet instanceof Message) { returnMessage.applyTransformers(connector.getDefaultResponseTransformers()); Packet result = (Packet) returnMessage.getPayload(); xmppConnection.sendPacket(result); } } catch (Exception e) { handleException(e); } } public void release() { // template method } } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/i18n/0000755000175000017500000000000011351410641025463 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/i18n/XmppMessages.java0000644000175000017500000000164510745677442030774 0ustar charlescharles/* * $Id: XmppMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; import org.mule.transport.xmpp.XmppConnector; public class XmppMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath(XmppConnector.XMPP); public static Message noRecipientInUri() { return createMessage(BUNDLE_PATH, 1); } public static Message nicknameMustBeSet() { return createMessage(BUNDLE_PATH, 2); } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/config/0000755000175000017500000000000011351410641026151 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/config/XmppNamespaceHandler.java0000644000175000017500000000433510745726444033101 0ustar charlescharles/* * $Id: XmppNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.processors.RequireAttribute; import org.mule.endpoint.URIBuilder; import org.mule.transport.xmpp.XmppConnector; import org.mule.util.StringUtils; import org.w3c.dom.Element; /** * Registers a Bean Definition Parser for handling elements. */ public class XmppNamespaceHandler extends AbstractMuleNamespaceHandler { public static final String RECIPIENT = "recipient"; public static final String[] REQUIRED_ADDRESS_ATTRIBUTES = new String[]{RECIPIENT, URIBuilder.USER, URIBuilder.HOST}; public void init() { registerStandardTransportEndpoints(XmppConnector.XMPP, REQUIRED_ADDRESS_ATTRIBUTES).addAlias(RECIPIENT, URIBuilder.PATH).registerPreProcessor(new RequireNickname()); this.registerConnectorDefinitionParser(XmppConnector.class); } public static class RequireNickname implements PreProcessor { public void preProcess(PropertyConfiguration config, Element element) { String groupChat = element.getAttribute(XmppConnector.XMPP_GROUP_CHAT); if (Boolean.valueOf(groupChat).booleanValue()) { if (StringUtils.isBlank(element.getAttribute(XmppConnector.XMPP_NICKNAME))) { throw new RequireAttribute.RequireAttributeException("Attribute " + XmppConnector.XMPP_NICKNAME + " must be given if " + XmppConnector.XMPP_GROUP_CHAT + " is true."); } } } } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/config/XmppsNamespaceHandler.java0000644000175000017500000000217110745726444033260 0ustar charlescharles/* * $Id: XmppsNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.endpoint.URIBuilder; import org.mule.transport.xmpp.XmppsConnector; /** * Registers a Bean Definition Parser for handling elements. */ public class XmppsNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(XmppsConnector.XMPPS, XmppNamespaceHandler.REQUIRED_ADDRESS_ATTRIBUTES).addAlias(XmppNamespaceHandler.RECIPIENT, URIBuilder.PATH).registerPreProcessor(new XmppNamespaceHandler.RequireNickname()); this.registerConnectorDefinitionParser(XmppsConnector.class); } }mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/0000755000175000017500000000000011351410641026354 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/XmppPacketIDFilter.java0000644000175000017500000000166110745677442032706 0ustar charlescharles/* * $Id: XmppPacketIDFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.filters; import org.jivesoftware.smack.filter.PacketFilter; /** * XmppPacketIDFilter is an Xmpp PacketIDFilter adapter. */ public class XmppPacketIDFilter extends XmppFromContainsFilter { public XmppPacketIDFilter() { super(); } public XmppPacketIDFilter(String expression) { super(expression); } protected PacketFilter createFilter() { return new org.jivesoftware.smack.filter.PacketIDFilter(pattern); } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/XmppMessageTypeFilter.java0000644000175000017500000000201510745677442033502 0ustar charlescharles/* * $Id: XmppMessageTypeFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.filters; import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.packet.Message; /** * XmppMessageTypeFilter is an Xmpp MessageTypeFilter adapter. */ public class XmppMessageTypeFilter extends XmppFromContainsFilter { public XmppMessageTypeFilter() { super(); } public XmppMessageTypeFilter(String expression) { super(expression); } protected PacketFilter createFilter() { return new org.jivesoftware.smack.filter.MessageTypeFilter(Message.Type.fromString(pattern)); } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/XmppThreadFilter.java0000644000175000017500000000164310745677442032471 0ustar charlescharles/* * $Id: XmppThreadFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.filters; import org.jivesoftware.smack.filter.PacketFilter; /** * XmppThreadFilter is an Xmpp ThreadFilter adapter. */ public class XmppThreadFilter extends XmppFromContainsFilter { public XmppThreadFilter() { super(); } public XmppThreadFilter(String expression) { super(expression); } protected PacketFilter createFilter() { return new org.jivesoftware.smack.filter.ThreadFilter(pattern); } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/XmppOrFilter.java0000644000175000017500000000166410745677442031645 0ustar charlescharles/* * $Id: XmppOrFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.filters; import org.jivesoftware.smack.filter.OrFilter; import org.jivesoftware.smack.filter.PacketFilter; /** * XmppAndFilter an Xmpp OR filter */ public class XmppOrFilter extends XmppAndFilter { public XmppOrFilter() { super(); } public XmppOrFilter(PacketFilter left, PacketFilter right) { super(left, right); } protected PacketFilter createFilter() { return new OrFilter(getLeftFilter(), getRightFilter()); } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/AbstractXmppFilter.java0000644000175000017500000000241110745677442033017 0ustar charlescharles/* * $Id: AbstractXmppFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.packet.Packet; /** * AbstractXmppFilter is a filter adapter so that Smack Filters can be * configured as Mule filters. */ public abstract class AbstractXmppFilter implements Filter, PacketFilter { protected volatile PacketFilter delegate; public boolean accept(Packet packet) { if (delegate == null) { delegate = createFilter(); } return delegate.accept(packet); } public boolean accept(MuleMessage message) { // If we have received a MuleMessage the filter has already been applied return true; } protected abstract PacketFilter createFilter(); } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/XmppNotFilter.java0000644000175000017500000000214210745677442032015 0ustar charlescharles/* * $Id: XmppNotFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.filters; import org.jivesoftware.smack.filter.NotFilter; import org.jivesoftware.smack.filter.PacketFilter; /** * XmppAndFilter an Xmpp AND filter */ public class XmppNotFilter extends AbstractXmppFilter { private volatile PacketFilter filter; public XmppNotFilter() { super(); } public XmppNotFilter(PacketFilter filter) { this.filter = filter; } public void setFilter(PacketFilter filter) { this.filter = filter; } public PacketFilter getFilter() { return filter; } protected PacketFilter createFilter() { return new NotFilter(filter); } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/XmppPacketTypeFilter.java0000644000175000017500000000225710745677442033335 0ustar charlescharles/* * $Id: XmppPacketTypeFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.filters; import org.jivesoftware.smack.filter.PacketFilter; /** * XmppPacketTypeFilter is an Xmpp PacketTypeFilter adapter. */ public class XmppPacketTypeFilter extends AbstractXmppFilter { private volatile Class expectedType; public XmppPacketTypeFilter() { super(); } public XmppPacketTypeFilter(Class expectedType) { setExpectedType(expectedType); } public Class getExpectedType() { return expectedType; } public void setExpectedType(Class expectedType) { this.expectedType = expectedType; } protected PacketFilter createFilter() { return new org.jivesoftware.smack.filter.PacketTypeFilter(expectedType); } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/XmppAndFilter.java0000644000175000017500000000263310745677442031764 0ustar charlescharles/* * $Id: XmppAndFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.filters; import org.jivesoftware.smack.filter.AndFilter; import org.jivesoftware.smack.filter.PacketFilter; /** * XmppAndFilter an Xmpp AND filter */ public class XmppAndFilter extends AbstractXmppFilter { private volatile PacketFilter leftFilter; private volatile PacketFilter rightFilter; public XmppAndFilter() { super(); } public XmppAndFilter(PacketFilter left, PacketFilter right) { this.leftFilter = left; this.rightFilter = right; } public void setLeftFilter(PacketFilter left) { this.leftFilter = left; } public void setRightFilter(PacketFilter right) { this.leftFilter = right; } public PacketFilter getLeftFilter() { return leftFilter; } public PacketFilter getRightFilter() { return rightFilter; } protected PacketFilter createFilter() { return new AndFilter(leftFilter, rightFilter); } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/XmppToContainsFilter.java0000644000175000017500000000167710745677442033352 0ustar charlescharles/* * $Id: XmppToContainsFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.filters; import org.jivesoftware.smack.filter.PacketFilter; /** * XmppToContainsFilter is an Xmpp ToContainsfilter adapter. */ public class XmppToContainsFilter extends XmppFromContainsFilter { public XmppToContainsFilter() { super(); } public XmppToContainsFilter(String expression) { super(expression); } protected PacketFilter createFilter() { return new org.jivesoftware.smack.filter.ToContainsFilter(pattern); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/XmppFromContainsFilter.javamule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/filters/XmppFromContainsFilter.java0000644000175000017500000000216510745677442033664 0ustar charlescharles/* * $Id: XmppFromContainsFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp.filters; import org.jivesoftware.smack.filter.PacketFilter; /** * XmppFromContainsFilter is an Xmpp FromContainsfilter adapter. */ public class XmppFromContainsFilter extends AbstractXmppFilter { protected volatile String pattern; public XmppFromContainsFilter() { super(); } public XmppFromContainsFilter(String pattern) { this.pattern = pattern; } public String getPattern() { return pattern; } public void setPattern(String pattern) { this.pattern = pattern; } protected PacketFilter createFilter() { return new XmppFromContainsFilter(pattern); } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppConnector.java0000644000175000017500000001131610745677442030374 0ustar charlescharles/* * $Id: XmppConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.lifecycle.InitialisationException; import org.mule.transport.AbstractConnector; import org.jivesoftware.smack.AccountManager; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; /** * XmppConnector TODO */ public class XmppConnector extends AbstractConnector { public static final String XMPP = "xmpp"; public static final String XMPP_PROPERTY_PREFIX = ""; public static final String XMPP_RESOURCE = XMPP_PROPERTY_PREFIX + "resource"; public static final String XMPP_SUBJECT = XMPP_PROPERTY_PREFIX + "subject"; public static final String XMPP_THREAD = XMPP_PROPERTY_PREFIX + "thread"; public static final String XMPP_TO = XMPP_PROPERTY_PREFIX + "to"; public static final String XMPP_FROM = XMPP_PROPERTY_PREFIX + "from"; public static final String XMPP_GROUP_CHAT = XMPP_PROPERTY_PREFIX + "groupChat"; public static final String XMPP_NICKNAME = XMPP_PROPERTY_PREFIX + "nickname"; protected void doInitialise() throws InitialisationException { // template method, nothing to do } protected void doDispose() { // template method } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } protected void doStart() throws MuleException { // template method } protected void doStop() throws MuleException { // template method } public String getProtocol() { return XMPP; } public XMPPConnection createXmppConnection(EndpointURI endpointURI) throws XMPPException { logger.info("Trying to find XMPP connection for uri: " + endpointURI); String username = endpointURI.getUser(); String hostname = endpointURI.getHost(); String password = endpointURI.getPassword(); String resource = (String)endpointURI.getParams().get("resource"); XMPPConnection xmppConnection = this.doCreateXmppConnection(endpointURI); if (!xmppConnection.isAuthenticated()) { // Make sure we have an account. If we don't, make one. try { AccountManager accManager = new AccountManager(xmppConnection); accManager.createAccount(username, password); } catch (XMPPException ex) { // User probably already exists, throw away... logger.info("*** account (" + username + ") already exists ***"); } if (logger.isDebugEnabled()) { logger.debug("Logging in as: " + username); logger.debug("pw is : " + password); logger.debug("server : " + hostname); logger.debug("resource : " + resource); } if (resource == null) { xmppConnection.login(username, password); } else { xmppConnection.login(username, password, resource); } } else { if (logger.isDebugEnabled()) { logger.debug("Already authenticated on this connection, no need to log in again."); } } return xmppConnection; } /** * This method creates and returns the {@link XMPPConnection} object that's uses to talk to * the Jabber server. *

* Subclasses can override this method to create a more specialized {@link XMPPConnection}. * * @param endpointURI * @return * @throws XMPPException */ protected XMPPConnection doCreateXmppConnection(EndpointURI endpointURI) throws XMPPException { XMPPConnection xmppConnection = null; if (endpointURI.getPort() != -1) { xmppConnection = new XMPPConnection(endpointURI.getHost(), endpointURI.getPort()); } else { xmppConnection = new XMPPConnection(endpointURI.getHost()); } return xmppConnection; } public boolean isRemoteSyncEnabled() { return true; } } mule-2.0.1/transports/xmpp/src/main/java/org/mule/transport/xmpp/XmppMessageDispatcherFactory.java0000644000175000017500000000173610757615756033375 0ustar charlescharles/* * $Id: XmppMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * Creates a dispatcher responsible for writing Xmpp packets to a an Jabber chat */ public class XmppMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new XmppMessageDispatcher(endpoint); } } mule-2.0.1/transports/xmpp/src/main/resources/0000755000175000017500000000000011351410641021224 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/resources/META-INF/0000755000175000017500000000000011351410641022364 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/resources/META-INF/spring.schemas0000644000175000017500000000025510743406323025243 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/xmpp/2.0/mule-xmpp.xsd=META-INF/mule-xmpp.xsd http\://www.mulesource.org/schema/mule/xmpps/2.0/mule-xmpps.xsd=META-INF/mule-xmpps.xsd mule-2.0.1/transports/xmpp/src/main/resources/META-INF/mule-xmpps.xsd0000644000175000017500000000343110743406323025222 0ustar charlescharles Connect Mule to an XMPPS (Jabber over SSL) server, to send or receive data via the network. mule-2.0.1/transports/xmpp/src/main/resources/META-INF/spring.handlers0000644000175000017500000000031210745677442025430 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/xmpp/2.0=org.mule.transport.xmpp.config.XmppNamespaceHandler http\://www.mulesource.org/schema/mule/xmpps/2.0=org.mule.transport.xmpp.config.XmppsNamespaceHandler mule-2.0.1/transports/xmpp/src/main/resources/META-INF/services/0000755000175000017500000000000011351410641024207 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410641024776 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410641025740 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410641027755 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/main/resources/META-INF/services/org/mule/providers/xmpps.properties0000644000175000017500000000102010745677442033257 0ustar charlescharlesconnector=org.mule.transport.xmpp.XmppsConnector dispatcher.factory=org.mule.transport.xmpp.XmppMessageDispatcherFactory requester.factory=org.mule.transport.xmpp.XmppMessageRequesterFactory message.receiver=org.mule.transport.xmpp.XmppMessageReceiver message.adapter=org.mule.transport.xmpp.XmppMessageAdapter endpoint.builder=org.mule.transport.xmpp.XmppEndpointURIBuilder outbound.transformer=org.mule.transport.xmpp.transformers.ObjectToXmppPacket response.transformer=org.mule.transport.xmpp.transformers.ObjectToXmppPacketmule-2.0.1/transports/xmpp/src/main/resources/META-INF/services/org/mule/providers/xmpp.properties0000644000175000017500000000101710745677442033102 0ustar charlescharlesconnector=org.mule.transport.xmpp.XmppConnector dispatcher.factory=org.mule.transport.xmpp.XmppMessageDispatcherFactory requester.factory=org.mule.transport.xmpp.XmppMessageRequesterFactory message.receiver=org.mule.transport.xmpp.XmppMessageReceiver message.adapter=org.mule.transport.xmpp.XmppMessageAdapter endpoint.builder=org.mule.transport.xmpp.XmppEndpointURIBuilder outbound.transformer=org.mule.transport.xmpp.transformers.ObjectToXmppPacket response.transformer=org.mule.transport.xmpp.transformers.ObjectToXmppPacketmule-2.0.1/transports/xmpp/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410641026517 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/xmpp/src/main/resources/META-INF/services/org/mule/i18n/xmpp-messages.propertiesmule-2.0.1/transports/xmpp/src/main/resources/META-INF/services/org/mule/i18n/xmpp-messages.properti0000644000175000017500000000027610304314556033110 0ustar charlescharles1=An Xmpp endpoint must have a path on the uri which is used as either the recipient name or groupChat name 2=If the groupChat property is set to true the nickname parameter must also be setmule-2.0.1/transports/xmpp/src/main/resources/META-INF/mule-xmpp.xsd0000644000175000017500000000651210743406323025042 0ustar charlescharles Connect Mule to an XMPP (Jabber) server, to send or receive data via the network. mule-2.0.1/transports/xmpp/src/test/0000755000175000017500000000000011351410641017245 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/test/java/0000755000175000017500000000000011351410640020165 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/test/java/org/0000755000175000017500000000000011351410640020754 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/test/java/org/mule/0000755000175000017500000000000011351410641021717 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/test/java/org/mule/providers/0000755000175000017500000000000011351410641023734 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/test/java/org/mule/providers/xmpp/0000755000175000017500000000000011351410641024720 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/test/java/org/mule/transport/0000755000175000017500000000000011351410640023752 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/test/java/org/mule/transport/xmpp/0000755000175000017500000000000011351410641024737 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/test/java/org/mule/transport/xmpp/XmppConnectorTestCase.java0000644000175000017500000000231710754365306032055 0ustar charlescharles/* * $Id: XmppConnectorTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.xmpp.XmppConnector; import org.jivesoftware.smack.packet.Message; public class XmppConnectorTestCase extends AbstractConnectorTestCase { // @Override public Connector createConnector() throws Exception { XmppConnector cnn = new XmppConnector(); cnn.setName("xmppConnector"); return cnn; } public Object getValidMessage() throws Exception { return new Message("Hello"); } protected String getProtocol() { return "xmpp"; } public String getTestEndpointURI() { return this.getProtocol() + "://mule1:mule@jabber.org.au/ross@jabber.org"; } } mule-2.0.1/transports/xmpp/src/test/java/org/mule/transport/xmpp/NoNicknameTestCase.java0000644000175000017500000000232410745677442031305 0ustar charlescharles/* * $Id: NoNicknameTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.api.MuleContext; import org.mule.tck.FunctionalTestCase; public class NoNicknameTestCase extends FunctionalTestCase { private boolean errorDuringStartup = false; protected String getConfigResources() { return "no-nickname.xml"; } protected MuleContext createMuleContext() throws Exception { try { return super.createMuleContext(); } catch (Exception e) { logger.info(e.getMessage()); assertTrue(e.getMessage().indexOf("Attribute nickname must be given if groupChat is true") > -1); errorDuringStartup = true; return null; } } public void testConfig() { assertTrue(errorDuringStartup); } } mule-2.0.1/transports/xmpp/src/test/java/org/mule/transport/xmpp/XmppEndpointTestCase.java0000644000175000017500000000676510745677442031725 0ustar charlescharles/* * $Id: XmppEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.api.lifecycle.InitialisationException; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class XmppEndpointTestCase extends AbstractMuleTestCase { public void testMalformedXmppUrl() throws Exception { try { MuleEndpointURI uri = new MuleEndpointURI("xmpp://mule:secret@jabber.org"); uri.initialise(); fail("There is no path set on the endpoint"); } catch (InitialisationException e) { // expected } } public void testXmppUrlWithPortAndToChat() throws Exception { MuleEndpointURI endpointUri = new MuleEndpointURI( "xmpp://mule:secret@jabber.org:6666/ross@jabber.org"); endpointUri.initialise(); assertEquals("xmpp", endpointUri.getScheme()); assertEquals("mule@jabber.org:6666", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(6666, endpointUri.getPort()); assertEquals("jabber.org", endpointUri.getHost()); assertEquals("mule:secret", endpointUri.getUserInfo()); assertEquals("xmpp://mule:secret@jabber.org:6666/ross@jabber.org", endpointUri.toString()); assertEquals(0, endpointUri.getParams().size()); assertEquals("ross@jabber.org", endpointUri.getPath().substring(1)); } public void testXmppUrlWithPortAndToChatWithParam() throws Exception { MuleEndpointURI endpointUri = new MuleEndpointURI( "xmpp://mule:secret@jabber.org:6666/ross@jabber.org?groupChat=true&nickname=ross"); endpointUri.initialise(); assertEquals("xmpp", endpointUri.getScheme()); assertEquals("mule@jabber.org:6666", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(6666, endpointUri.getPort()); assertEquals("jabber.org", endpointUri.getHost()); assertEquals("mule:secret", endpointUri.getUserInfo()); assertEquals("xmpp://mule:secret@jabber.org:6666/ross@jabber.org?groupChat=true&nickname=ross", endpointUri.toString()); assertEquals(2, endpointUri.getParams().size()); assertEquals("ross@jabber.org", endpointUri.getPath().substring(1)); assertEquals("true", endpointUri.getParams().get("groupChat")); assertEquals("ross", endpointUri.getParams().get("nickname")); } public void testXmppBadGroupChatParams() throws Exception { try { MuleEndpointURI uri = new MuleEndpointURI("xmpp://mule:secret@jabber.org:6666/ross@jabber.org?groupChat=true"); uri.initialise(); fail("if groupchat is set to true a nickname must be set"); } catch (InitialisationException e) { // expected } MuleEndpointURI uri = new MuleEndpointURI("xmpp://mule:secret@jabber.org:6666/ross@jabber.org?groupChat=false"); uri.initialise(); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/xmpp/src/test/java/org/mule/transport/xmpp/AbstractNamespaceHandlerTestCase.javamule-2.0.1/transports/xmpp/src/test/java/org/mule/transport/xmpp/AbstractNamespaceHandlerTestCase.ja0000644000175000017500000000456310745677442033621 0ustar charlescharles/* * $Id: AbstractNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.tck.FunctionalTestCase; import org.mule.transport.xmpp.XmppConnector; public abstract class AbstractNamespaceHandlerTestCase extends FunctionalTestCase { private String protocolName; public AbstractNamespaceHandlerTestCase(String protocolName) { this.protocolName = protocolName; } protected String getConfigResources() { return protocolName + "-namespace-config.xml"; } public void testConfig() throws Exception { XmppConnector connector = (XmppConnector) muleContext.getRegistry().lookupConnector(protocolName + "Connector"); assertNotNull(connector); } public void testEndpoints() throws EndpointException, InitialisationException { ImmutableEndpoint simpleEndpoint = muleContext.getRegistry() .lookupEndpointBuilder("simpleEndpoint") .buildOutboundEndpoint(); assertEquals(protocolName + "://mule:secret@localhost:1234/recipient", simpleEndpoint.getEndpointURI() .toString()); ImmutableEndpoint groupChatEndpoint = muleContext.getRegistry() .lookupEndpointBuilder("groupChatEndpoint") .buildOutboundEndpoint(); assertEquals(protocolName + "://mule:secret@localhost:1234/recipient", groupChatEndpoint.getEndpointURI() .toString()); assertNotNull(groupChatEndpoint.getProperty("groupChat")); assertTrue(groupChatEndpoint.getProperty("groupChat") instanceof String); assertEquals("true", groupChatEndpoint.getProperty("groupChat")); assertNotNull(groupChatEndpoint.getProperty("nickname")); assertTrue(groupChatEndpoint.getProperty("nickname") instanceof String); assertEquals("bob", groupChatEndpoint.getProperty("nickname")); } } mule-2.0.1/transports/xmpp/src/test/java/org/mule/transport/xmpp/XmppsConnectorTestCase.java0000644000175000017500000000114410745677442032244 0ustar charlescharles/* * $Id: XmppsConnectorTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; public class XmppsConnectorTestCase extends XmppConnectorTestCase { protected String getProtocol() { return "xmpps"; } } mule-2.0.1/transports/xmpp/src/test/java/org/mule/transport/xmpp/XmppNamespaceHandlerTestCase.java0000644000175000017500000000127010745677442033321 0ustar charlescharles/* * $Id: XmppNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.transport.xmpp.XmppConnector; public class XmppNamespaceHandlerTestCase extends AbstractNamespaceHandlerTestCase { public XmppNamespaceHandlerTestCase() { super(XmppConnector.XMPP); } } mule-2.0.1/transports/xmpp/src/test/java/org/mule/transport/xmpp/XmppsNamespaceHandlerTestCase.java0000644000175000017500000000164110745677442033506 0ustar charlescharles/* * $Id: XmppsNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.xmpp; import org.mule.transport.xmpp.XmppsConnector; public class XmppsNamespaceHandlerTestCase extends AbstractNamespaceHandlerTestCase { public XmppsNamespaceHandlerTestCase() { super(XmppsConnector.XMPPS); } public void testSubclassConfig() throws Exception { XmppsConnector connector = (XmppsConnector) muleContext.getRegistry().lookupConnector( "xmppsConnector"); assertNotNull(connector); } } mule-2.0.1/transports/xmpp/src/test/resources/0000755000175000017500000000000011351410641021257 5ustar charlescharlesmule-2.0.1/transports/xmpp/src/test/resources/xmpps-namespace-config.xml0000644000175000017500000000177010743406323026360 0ustar charlescharles mule-2.0.1/transports/xmpp/src/test/resources/log4j.properties0000644000175000017500000000057710745677442024451 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN log4j.logger.org.mule.transport.xmpp.NoNicknameTestCase=INFO mule-2.0.1/transports/xmpp/src/test/resources/no-nickname.xml0000644000175000017500000000147110743406323024211 0ustar charlescharles mule-2.0.1/transports/xmpp/src/test/resources/xmpp-namespace-config.xml0000644000175000017500000000175710743406323026202 0ustar charlescharles mule-2.0.1/transports/xmpp/pom.xml0000644000175000017500000000371711006063605017025 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-xmpp XMPP Transport A Mule transport that enables event sending and receiving over XMPP (Jabber). osgi org.apache.felix maven-bundle-plugin org.mule.transport.xmpp.* jivesoftware smack 2.2.1 org.mule mule-core ${version} org.mule.tests mule-tests-functional ${version} test mule-2.0.1/transports/ftp/0000755000175000017500000000000011351410656015312 5ustar charlescharlesmule-2.0.1/transports/ftp/src/0000755000175000017500000000000011351410656016101 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/0000755000175000017500000000000011351410656017025 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/java/0000755000175000017500000000000011351410656017746 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/java/org/0000755000175000017500000000000011351410656020535 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/java/org/mule/0000755000175000017500000000000011351410656021477 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/java/org/mule/transport/0000755000175000017500000000000011351410656023533 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/java/org/mule/transport/ftp/0000755000175000017500000000000011351410656024324 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/java/org/mule/transport/ftp/FtpConnector.java0000644000175000017500000004507610757615756027630 0ustar charlescharles/* * $Id: FtpConnector.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleRuntimeException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transport.ConnectorException; import org.mule.api.transport.DispatchException; import org.mule.api.transport.MessageReceiver; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; import org.mule.model.streaming.CallbackOutputStream; import org.mule.transport.AbstractConnector; import org.mule.transport.file.FilenameParser; import org.mule.transport.file.SimpleFilenameParser; import org.mule.util.ClassUtils; import java.io.IOException; import java.io.OutputStream; import java.text.MessageFormat; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.pool.ObjectPool; import org.apache.commons.pool.impl.GenericObjectPool; public class FtpConnector extends AbstractConnector { public static final String FTP = "ftp"; // endpoint properties public static final String PROPERTY_POLLING_FREQUENCY = "pollingFrequency"; // inbound only public static final int DEFAULT_POLLING_FREQUENCY = 1000; public static final String PROPERTY_OUTPUT_PATTERN = "outputPattern"; // outbound only public static final String PROPERTY_PASSIVE_MODE = "passive"; public static final String PROPERTY_BINARY_TRANSFER = "binary"; // message properties public static final String PROPERTY_FILENAME = "filename"; /** * TODO it makes sense to have a type-safe adapter for FTP specifically, but without * Java 5's covariant return types the benefits are diminished. Keeping it simple for now. */ public static final String DEFAULT_FTP_CONNECTION_FACTORY_CLASS = "org.mule.transport.ftp.FtpConnectionFactory"; /** * Time in milliseconds to poll. On each poll the poll() method is called */ private long pollingFrequency; private String outputPattern; private FilenameParser filenameParser = new SimpleFilenameParser(); private boolean passive = true; private boolean binary = true; /** * Whether to test FTP connection on each take from pool. */ private boolean validateConnections = true; private Map pools = new HashMap(); private String connectionFactoryClass = DEFAULT_FTP_CONNECTION_FACTORY_CLASS; public String getProtocol() { return FTP; } public MessageReceiver createReceiver(Service service, InboundEndpoint endpoint) throws Exception { long polling = pollingFrequency; Map props = endpoint.getProperties(); if (props != null) { // Override properties on the endpoint for the specific endpoint String tempPolling = (String) props.get(PROPERTY_POLLING_FREQUENCY); if (tempPolling != null) { polling = Long.parseLong(tempPolling); } } if (polling <= 0) { polling = DEFAULT_POLLING_FREQUENCY; } logger.debug("set polling frequency to " + polling); return serviceDescriptor.createMessageReceiver(this, service, endpoint, new Object[]{new Long(polling)}); } /** * @return Returns the pollingFrequency. */ public long getPollingFrequency() { return pollingFrequency; } /** * @param pollingFrequency The pollingFrequency to set. */ public void setPollingFrequency(long pollingFrequency) { this.pollingFrequency = pollingFrequency; } /** * Getter for property 'connectionFactoryClass'. * * @return Value for property 'connectionFactoryClass'. */ public String getConnectionFactoryClass() { return connectionFactoryClass; } /** * Setter for property 'connectionFactoryClass'. Should be an instance of * {@link FtpConnectionFactory}. * * @param connectionFactoryClass Value to set for property 'connectionFactoryClass'. */ public void setConnectionFactoryClass(final String connectionFactoryClass) { this.connectionFactoryClass = connectionFactoryClass; } public FTPClient getFtp(EndpointURI uri) throws Exception { if (logger.isDebugEnabled()) { logger.debug(">>> retrieving client for " + uri); } return (FTPClient) getFtpPool(uri).borrowObject(); } public void releaseFtp(EndpointURI uri, FTPClient client) throws Exception { if (logger.isDebugEnabled()) { logger.debug("<<< releasing client for " + uri); } if (dispatcherFactory.isCreateDispatcherPerRequest()) { destroyFtp(uri, client); } else { getFtpPool(uri).returnObject(client); } } public void destroyFtp(EndpointURI uri, FTPClient client) throws Exception { if (logger.isDebugEnabled()) { logger.debug("<<< destroying client for " + uri); } try { getFtpPool(uri).invalidateObject(client); } catch (Exception e) { // no way to test if pool is closed except try to access it logger.debug(e.getMessage()); } } protected synchronized ObjectPool getFtpPool(EndpointURI uri) { if (logger.isDebugEnabled()) { logger.debug("=== get pool for " + uri); } String key = uri.getUser() + ":" + uri.getPassword() + "@" + uri.getHost() + ":" + uri.getPort(); ObjectPool pool = (ObjectPool) pools.get(key); if (pool == null) { try { FtpConnectionFactory connectionFactory = (FtpConnectionFactory) ClassUtils.instanciateClass(getConnectionFactoryClass(), new Object[] {uri}, getClass()); pool = new GenericObjectPool(connectionFactory); ((GenericObjectPool) pool).setTestOnBorrow(this.validateConnections); pools.put(key, pool); } catch (Exception ex) { throw new MuleRuntimeException( MessageFactory.createStaticMessage("Hmm, couldn't instanciate FTP connection factory."), ex); } } return pool; } protected void doInitialise() throws InitialisationException { try { Class objectFactoryClass = ClassUtils.loadClass(this.connectionFactoryClass, getClass()); if (!FtpConnectionFactory.class.isAssignableFrom(objectFactoryClass)) { throw new InitialisationException(MessageFactory.createStaticMessage( "FTP connectionFactoryClass is not an instance of org.mule.transport.ftp.FtpConnectionFactory"), this); } } catch (ClassNotFoundException e) { throw new InitialisationException(e, this); } } protected void doDispose() { // template method } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } protected void doStart() throws MuleException { // template method } protected void doStop() throws MuleException { if (logger.isDebugEnabled()) { logger.debug("!!! stopping all pools"); } try { for (Iterator it = pools.values().iterator(); it.hasNext();) { ObjectPool pool = (ObjectPool)it.next(); pool.close(); } } catch (Exception e) { throw new ConnectorException(CoreMessages.failedToStop("FTP Connector"), this, e); } } /** * @return Returns the outputPattern. */ public String getOutputPattern() { return outputPattern; } /** * @param outputPattern The outputPattern to set. */ public void setOutputPattern(String outputPattern) { this.outputPattern = outputPattern; } /** * @return Returns the filenameParser. */ public FilenameParser getFilenameParser() { return filenameParser; } /** * @param filenameParser The filenameParser to set. */ public void setFilenameParser(FilenameParser filenameParser) { this.filenameParser = filenameParser; } /** * Getter for FTP passive mode. * * @return true if using FTP passive mode */ public boolean isPassive() { return passive; } /** * Setter for FTP passive mode. * * @param passive passive mode flag */ public void setPassive(final boolean passive) { this.passive = passive; } /** * Passive mode is OFF by default. The value is taken from the connector * settings. In case there are any overriding properties set on the endpoint, * those will be used. * * @see #setPassive(boolean) */ public void enterActiveOrPassiveMode(FTPClient client, ImmutableEndpoint endpoint) { // well, no endpoint URI here, as we have to use the most common denominator // in API :( final String passiveString = (String)endpoint.getProperty(FtpConnector.PROPERTY_PASSIVE_MODE); if (passiveString == null) { // try the connector properties then if (isPassive()) { if (logger.isTraceEnabled()) { logger.trace("Entering FTP passive mode"); } client.enterLocalPassiveMode(); } else { if (logger.isTraceEnabled()) { logger.trace("Entering FTP active mode"); } client.enterLocalActiveMode(); } } else { // override with endpoint's definition final boolean passiveMode = Boolean.valueOf(passiveString).booleanValue(); if (passiveMode) { if (logger.isTraceEnabled()) { logger.trace("Entering FTP passive mode (endpoint override)"); } client.enterLocalPassiveMode(); } else { if (logger.isTraceEnabled()) { logger.trace("Entering FTP active mode (endpoint override)"); } client.enterLocalActiveMode(); } } } /** * Whether to test FTP connection on each take from pool. */ public boolean isValidateConnections() { return validateConnections; } /** * Whether to test FTP connection on each take from pool. This takes care of a * failed (or restarted) FTP server at the expense of an additional NOOP command * packet being sent, but increases overall availability.

Disable to gain * slight performance gain or if you are absolutely sure of the FTP server * availability.

The default value is true */ public void setValidateConnections(final boolean validateConnections) { this.validateConnections = validateConnections; } /** * Getter for FTP transfer type. * * @return true if using FTP binary type */ public boolean isBinary() { return binary; } /** * Setter for FTP transfer type. * * @param binary binary type flag */ public void setBinary(final boolean binary) { this.binary = binary; } /** * Transfer type is BINARY by default. The value is taken from the connector * settings. In case there are any overriding properties set on the endpoint, * those will be used.

The alternative type is ASCII.

* * @see #setBinary(boolean) */ public void setupFileType(FTPClient client, ImmutableEndpoint endpoint) throws Exception { int type; // well, no endpoint URI here, as we have to use the most common denominator // in API :( final String binaryTransferString = (String)endpoint.getProperty(FtpConnector.PROPERTY_BINARY_TRANSFER); if (binaryTransferString == null) { // try the connector properties then if (isBinary()) { if (logger.isTraceEnabled()) { logger.trace("Using FTP BINARY type"); } type = org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE; } else { if (logger.isTraceEnabled()) { logger.trace("Using FTP ASCII type"); } type = org.apache.commons.net.ftp.FTP.ASCII_FILE_TYPE; } } else { // override with endpoint's definition final boolean binaryTransfer = Boolean.valueOf(binaryTransferString).booleanValue(); if (binaryTransfer) { if (logger.isTraceEnabled()) { logger.trace("Using FTP BINARY type (endpoint override)"); } type = org.apache.commons.net.ftp.FTP.BINARY_FILE_TYPE; } else { if (logger.isTraceEnabled()) { logger.trace("Using FTP ASCII type (endpoint override)"); } type = org.apache.commons.net.ftp.FTP.ASCII_FILE_TYPE; } } client.setFileType(type); } /** * Well get the output stream (if any) for this type of transport. Typically this * will be called only when Streaming is being used on an outbound endpoint * * @param endpoint the endpoint that releates to this Dispatcher * @param message the current message being processed * @return the output stream to use for this request or null if the transport * does not support streaming * @throws org.mule.api.MuleException */ public OutputStream getOutputStream(ImmutableEndpoint endpoint, MuleMessage message) throws MuleException { try { final EndpointURI uri = endpoint.getEndpointURI(); String filename = getFilename(endpoint, message); final FTPClient client = this.createFtpClient(endpoint); try { OutputStream out = client.storeFileStream(filename); return new CallbackOutputStream(out, new CallbackOutputStream.Callback() { public void onClose() throws Exception { try { if (!client.completePendingCommand()) { client.logout(); client.disconnect(); throw new IOException("FTP Stream failed to complete pending request"); } } finally { releaseFtp(uri, client); } } }); } catch (Exception e) { logger.debug("Error getting output stream: ", e); releaseFtp(uri, client); throw e; } } catch (Exception e) { throw new DispatchException(CoreMessages.streamingFailedNoStream(), message, endpoint, e); } } private String getFilename(ImmutableEndpoint endpoint, MuleMessage message) throws IOException { String filename = (String)message.getProperty(FtpConnector.PROPERTY_FILENAME); if (filename == null) { String outPattern = (String) endpoint.getProperty(FtpConnector.PROPERTY_OUTPUT_PATTERN); if (outPattern == null) { outPattern = message.getStringProperty(FtpConnector.PROPERTY_OUTPUT_PATTERN, getOutputPattern()); } filename = generateFilename(message, outPattern); } if (filename == null) { throw new IOException("Filename is null"); } return filename; } private String generateFilename(MuleMessage message, String pattern) { if (pattern == null) { pattern = getOutputPattern(); } return getFilenameParser().getFilename(message, pattern); } /** * Creates a new FTPClient that logs in and changes the working directory using the data * provided in endpoint. */ protected FTPClient createFtpClient(ImmutableEndpoint endpoint) throws Exception { EndpointURI uri = endpoint.getEndpointURI(); FTPClient client = this.getFtp(uri); this.enterActiveOrPassiveMode(client, endpoint); this.setupFileType(client, endpoint); String path = uri.getPath(); // MULE-2400: if the path begins with '~' we must strip the first '/' to make things // work with FTPClient if ((path.length() >= 2) && (path.charAt(1) == '~')) { path = path.substring(1); } if (!client.changeWorkingDirectory(path)) { throw new IOException(MessageFormat.format("Failed to change working directory to {0}. Ftp error: {1}", new Object[] {path, new Integer(client.getReplyCode())})); } return client; } } mule-2.0.1/transports/ftp/src/main/java/org/mule/transport/ftp/FtpMessageDispatcherFactory.java0000644000175000017500000000163110757615756032606 0ustar charlescharles/* * $Id: FtpMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; public class FtpMessageDispatcherFactory extends AbstractMessageDispatcherFactory { /** {@inheritDoc} */ public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new FtpMessageDispatcher(endpoint); } } mule-2.0.1/transports/ftp/src/main/java/org/mule/transport/ftp/FtpConnectionFactory.java0000644000175000017500000000524510745677442031314 0ustar charlescharles/* * $Id: FtpConnectionFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.api.endpoint.EndpointURI; import java.io.IOException; import org.apache.commons.net.ftp.FTP; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPReply; import org.apache.commons.pool.PoolableObjectFactory; public class FtpConnectionFactory implements PoolableObjectFactory { private EndpointURI uri; public FtpConnectionFactory(EndpointURI uri) { this.uri = uri; } public Object makeObject() throws Exception { FTPClient client = new FTPClient(); try { if (uri.getPort() > 0) { client.connect(uri.getHost(), uri.getPort()); } else { client.connect(uri.getHost()); } if (!FTPReply.isPositiveCompletion(client.getReplyCode())) { throw new IOException("Ftp error: " + client.getReplyCode()); } if (!client.login(uri.getUser(), uri.getPassword())) { throw new IOException("Ftp error: " + client.getReplyCode()); } if (!client.setFileType(FTP.BINARY_FILE_TYPE)) { throw new IOException("Ftp error. Couldn't set BINARY transfer type."); } } catch (Exception e) { if (client.isConnected()) { client.disconnect(); } throw e; } return client; } public void destroyObject(Object obj) throws Exception { FTPClient client = (FTPClient) obj; client.logout(); client.disconnect(); } public boolean validateObject(Object obj) { FTPClient client = (FTPClient) obj; try { client.sendNoOp(); return true; } catch (IOException e) { return false; } } public void activateObject(Object obj) throws Exception { FTPClient client = (FTPClient) obj; client.setReaderThread(true); } public void passivateObject(Object obj) throws Exception { FTPClient client = (FTPClient) obj; client.setReaderThread(false); } } mule-2.0.1/transports/ftp/src/main/java/org/mule/transport/ftp/FtpMessageRequesterFactory.java0000644000175000017500000000161710757615756032503 0ustar charlescharles/* * $Id: FtpMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; public class FtpMessageRequesterFactory extends AbstractMessageRequesterFactory { /** {@inheritDoc} */ public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new FtpMessageRequester(endpoint); } }mule-2.0.1/transports/ftp/src/main/java/org/mule/transport/ftp/FtpMessageRequester.java0000644000175000017500000001063010757615756031146 0ustar charlescharles/* * $Id: FtpMessageRequester.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.transport.AbstractMessageRequester; import org.mule.transport.file.FileConnector; import java.io.FilenameFilter; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; public class FtpMessageRequester extends AbstractMessageRequester { protected final FtpConnector connector; public FtpMessageRequester(InboundEndpoint endpoint) { super(endpoint); this.connector = (FtpConnector) endpoint.getConnector(); } protected void doDispose() { // no op } protected void doConnect() throws Exception { // what was this for?! //connector.releaseFtp(endpoint.getEndpointURI()); } protected void doDisconnect() throws Exception { try { EndpointURI uri = endpoint.getEndpointURI(); FTPClient client = connector.getFtp(uri); connector.destroyFtp(uri, client); } catch (Exception e) { // pool may be closed } } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal cuases an exception */ protected MuleMessage doRequest(long timeout) throws Exception { FTPClient client = null; try { client = connector.createFtpClient(endpoint); FilenameFilter filenameFilter = null; if (endpoint.getFilter() instanceof FilenameFilter) { filenameFilter = (FilenameFilter) endpoint.getFilter(); } FTPFile[] files = client.listFiles(); if (!FTPReply.isPositiveCompletion(client.getReplyCode())) { throw new IOException("Ftp error: " + client.getReplyCode()); } if (files == null || files.length == 0) { return null; } List fileList = new ArrayList(); for (int i = 0; i < files.length; i++) { if (files[i].isFile()) { if (filenameFilter == null || filenameFilter.accept(null, files[i].getName())) { fileList.add(files[i]); // only read the first one break; } } } if (fileList.size() == 0) { return null; } FTPFile file = (FTPFile) fileList.get(0); ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (!client.retrieveFile(file.getName(), baos)) { throw new IOException("Ftp error: " + client.getReplyCode()); } MuleMessage reply = new DefaultMuleMessage(connector.getMessageAdapter(baos.toByteArray())); reply.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, file.getName()); reply.setProperty(FileConnector.PROPERTY_FILE_SIZE, new Long(file.getSize())); return reply; } finally { logger.debug("leaving doRequest()"); connector.releaseFtp(endpoint.getEndpointURI(), client); } } }mule-2.0.1/transports/ftp/src/main/java/org/mule/transport/ftp/FtpMessageReceiver.java0000644000175000017500000001463710757615756030746 0ustar charlescharles/* * $Id: FtpMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.transport.AbstractPollingMessageReceiver; import org.mule.transport.file.FileConnector; import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.resource.spi.work.Work; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; public class FtpMessageReceiver extends AbstractPollingMessageReceiver { protected final FtpConnector connector; protected final FilenameFilter filenameFilter; // there's nothing like homegrown pseudo-2PC.. :/ // shared state management like this should go into the connector and use // something like commons-tx protected final Set scheduledFiles = Collections.synchronizedSet(new HashSet()); protected final Set currentFiles = Collections.synchronizedSet(new HashSet()); public FtpMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint, long frequency) throws CreateException { super(connector, service, endpoint); this.setFrequency(frequency); this.connector = (FtpConnector) connector; if (endpoint.getFilter() instanceof FilenameFilter) { this.filenameFilter = (FilenameFilter) endpoint.getFilter(); } else { this.filenameFilter = null; } } public void poll() throws Exception { FTPFile[] files = listFiles(); synchronized (scheduledFiles) { for (int i = 0; i < files.length; i++) { final FTPFile file = files[i]; final String fileName = file.getName(); if (!scheduledFiles.contains(fileName) && !currentFiles.contains(fileName)) { scheduledFiles.add(fileName); getWorkManager().scheduleWork(new FtpWork(fileName, file)); } } } } protected FTPFile[] listFiles() throws Exception { FTPClient client = null; try { client = connector.createFtpClient(endpoint); FTPFile[] files = client.listFiles(); if (!FTPReply.isPositiveCompletion(client.getReplyCode())) { throw new IOException("Failed to list files. Ftp error: " + client.getReplyCode()); } if (files == null || files.length == 0) { return files; } List v = new ArrayList(); for (int i = 0; i < files.length; i++) { if (files[i].isFile()) { if (filenameFilter == null || filenameFilter.accept(null, files[i].getName())) { v.add(files[i]); } } } return (FTPFile[]) v.toArray(new FTPFile[v.size()]); } finally { if (client != null) { connector.releaseFtp(endpoint.getEndpointURI(), client); } } } protected void processFile(FTPFile file) throws Exception { logger.debug("entering processFile()"); FTPClient client = null; try { client = connector.createFtpClient(endpoint); final String fileName = file.getName(); MuleMessage message; InputStream stream = client.retrieveFileStream(fileName); if (stream == null) { throw new IOException(MessageFormat.format("Failed to retrieve file {0}. Ftp error: {1}", new Object[]{fileName, new Integer(client.getReplyCode())})); } message = new DefaultMuleMessage(connector.getMessageAdapter(stream)); message.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, fileName); message.setProperty(FileConnector.PROPERTY_FILE_SIZE, new Long(file.getSize())); routeMessage(message); if (!client.deleteFile(fileName)) { throw new IOException(MessageFormat.format("Failed to delete file {0}. Ftp error: {1}", new Object[]{fileName, new Integer(client.getReplyCode())})); } } finally { logger.debug("leaving processFile()"); if (client != null) { connector.releaseFtp(endpoint.getEndpointURI(), client); } } } protected void doConnect() throws Exception { // why?! //connector.releaseFtp(getEndpointURI()); } protected void doDisconnect() throws Exception { // no op } protected void doDispose() { // template method } private final class FtpWork implements Work { private final String name; private final FTPFile file; private FtpWork(String name, FTPFile file) { this.name = name; this.file = file; } public void run() { try { currentFiles.add(name); processFile(file); } catch (Exception e) { connector.handleException(e); } finally { currentFiles.remove(name); scheduledFiles.remove(name); } } public void release() { // no op } } } mule-2.0.1/transports/ftp/src/main/java/org/mule/transport/ftp/config/0000755000175000017500000000000011351410656025571 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/java/org/mule/transport/ftp/config/FtpNamespaceHandler.java0000644000175000017500000000314410764142752032310 0ustar charlescharles/* * $Id: FtpNamespaceHandler.java 11242 2008-03-07 04:34:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.file.ExpressionFilenameParser; import org.mule.transport.file.FilenameParser; import org.mule.transport.file.SimpleFilenameParser; import org.mule.transport.ftp.FtpConnector; /** * Reigsters a Bean Definition Parser for handling elements. * */ public class FtpNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(FtpConnector.FTP, URIBuilder.SOCKET_ATTRIBUTES); registerConnectorDefinitionParser(FtpConnector.class); registerBeanDefinitionParser("custom-filename-parser", new ChildDefinitionParser("filenameParser", null, FilenameParser.class)); registerBeanDefinitionParser("legacy-filename-parser", new ChildDefinitionParser("filenameParser", SimpleFilenameParser.class)); registerBeanDefinitionParser("expression-filename-parser", new ChildDefinitionParser("filenameParser", ExpressionFilenameParser.class)); } }mule-2.0.1/transports/ftp/src/main/java/org/mule/transport/ftp/FtpMessageDispatcher.java0000644000175000017500000000516610757615756031265 0ustar charlescharles/* * $Id: FtpMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.transport.AbstractMessageDispatcher; import java.io.InputStream; import java.io.OutputStream; import org.apache.commons.io.IOUtils; import org.apache.commons.net.ftp.FTPClient; public class FtpMessageDispatcher extends AbstractMessageDispatcher { protected final FtpConnector connector; public FtpMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (FtpConnector) endpoint.getConnector(); } protected void doDispose() { // no op } protected void doDispatch(MuleEvent event) throws Exception { Object data = event.transformMessage(); OutputStream out = connector.getOutputStream(event.getEndpoint(), event.getMessage()); try { if (data instanceof InputStream) { InputStream is = ((InputStream) data); IOUtils.copy(is, out); is.close(); } else { byte[] dataBytes; if (data instanceof byte[]) { dataBytes = (byte[]) data; } else { dataBytes = data.toString().getBytes(event.getEncoding()); } IOUtils.write(dataBytes, out); } } finally { out.close(); } } protected MuleMessage doSend(MuleEvent event) throws Exception { doDispatch(event); return event.getMessage(); } protected void doConnect() throws Exception { // what was this for?! //connector.releaseFtp(endpoint.getEndpointURI()); } protected void doDisconnect() throws Exception { try { EndpointURI uri = endpoint.getEndpointURI(); FTPClient client = connector.getFtp(uri); connector.destroyFtp(uri, client); } catch (Exception e) { // pool may be closed } } } mule-2.0.1/transports/ftp/src/main/resources/0000755000175000017500000000000011351410656021037 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/resources/META-INF/0000755000175000017500000000000011351410656022177 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012110754365306025047 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/ftp/2.0/mule-ftp.xsd=META-INF/mule-ftp.xsdmule-2.0.1/transports/ftp/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014110754365306025226 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/ftp/2.0=org.mule.transport.ftp.config.FtpNamespaceHandler mule-2.0.1/transports/ftp/src/main/resources/META-INF/services/0000755000175000017500000000000011351410656024022 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410656024611 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410656025553 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410656027570 5ustar charlescharlesmule-2.0.1/transports/ftp/src/main/resources/META-INF/services/org/mule/providers/ftp.properties0000644000175000017500000000054410745677442032520 0ustar charlescharlesconnector=org.mule.transport.ftp.FtpConnector dispatcher.factory=org.mule.transport.ftp.FtpMessageDispatcherFactory requester.factory=org.mule.transport.ftp.FtpMessageRequesterFactory message.receiver=org.mule.transport.ftp.FtpMessageReceiver message.adapter=org.mule.transport.DefaultMessageAdapter endpoint.builder=org.mule.endpoint.UrlEndpointURIBuildermule-2.0.1/transports/ftp/src/main/resources/META-INF/mule-ftp.xsd0000644000175000017500000001655110764142752024466 0ustar charlescharles Validate connection (via NOOP) before use. A class that extends FtpConnectionFactory. The frequency in milliseconds that the read directory should be checked. Note that the read directory is specified by the endpoint of the listening component. The pattern to use when writing a file to disk. This can use the patterns supported by the filename-parser configured for this connector Select/disable binary file transfer type. Select/disable passive protocol (more likely to work through firewalls). A file location. A username. A password. An IP address (eg www.mulesource.com, localhost, 127.0.0.1). A port number. mule-2.0.1/transports/ftp/src/test/0000755000175000017500000000000011351410656017060 5ustar charlescharlesmule-2.0.1/transports/ftp/src/test/java/0000755000175000017500000000000011351410656020001 5ustar charlescharlesmule-2.0.1/transports/ftp/src/test/java/org/0000755000175000017500000000000011351410656020570 5ustar charlescharlesmule-2.0.1/transports/ftp/src/test/java/org/mule/0000755000175000017500000000000011351410656021532 5ustar charlescharlesmule-2.0.1/transports/ftp/src/test/java/org/mule/transport/0000755000175000017500000000000011351410656023566 5ustar charlescharlesmule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/0000755000175000017500000000000011351410656024357 5ustar charlescharlesmule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/FtpNamespaceHandlerTestCase.java0000644000175000017500000000310110763253546032526 0ustar charlescharles/* * $Id: FtpNamespaceHandlerTestCase.java 11156 2008-03-04 14:06:30Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.tck.FunctionalTestCase; import org.mule.transport.file.DummyFilenameParser; import org.mule.transport.file.FilenameParser; import org.mule.transport.ftp.FtpConnector; public class FtpNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "ftp-namespace-config.xml"; } public void testConfig() throws Exception { FtpConnector c = (FtpConnector)muleContext.getRegistry().lookupConnector("ftpConnector"); assertNotNull(c); assertEquals("abc", c.getOutputPattern()); assertEquals(1234, c.getPollingFrequency()); assertEquals(false, c.isBinary()); assertEquals(false, c.isPassive()); assertEquals(false, c.isValidateConnections()); assertEquals(FTPConnectorTestCase.TestFtpConnectionFactory.class.getName(), c.getConnectionFactoryClass()); FilenameParser parser = c.getFilenameParser(); assertTrue(parser.getClass().getName(), c.getFilenameParser() instanceof DummyFilenameParser); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/0000755000175000017500000000000011351410656025665 5ustar charlescharlesmule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/FileManager.java0000644000175000017500000000220310745677442030715 0ustar charlescharles/* * $Id: FileManager.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import org.apache.ftpserver.ftplet.FileSystemManager; import org.apache.ftpserver.ftplet.FileSystemView; import org.apache.ftpserver.ftplet.FtpException; import org.apache.ftpserver.ftplet.User; public class FileManager implements FileSystemManager { private ServerState state; public void setStateFromSystemProperties(String key) { state = (InOutState) System.getProperties().get(key); if (null == state) { throw new IllegalStateException("Missing state for key " + key); } state.started(); } public FileSystemView createFileSystemView(User user) throws FtpException { return new FileView(state); } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/NamedPayload.java0000644000175000017500000000250310745677442031104 0ustar charlescharles/* * $Id: NamedPayload.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; public class NamedPayload { public static final String DEFAULT_NAME = "default-file-name"; private byte[] payload; private String name; public NamedPayload(byte[] payload) { this(DEFAULT_NAME, payload); } public NamedPayload(String name, byte[] payload) { setName(name); setPayload(payload); } public byte[] getPayload() { return payload; } public void setPayload(byte[] payload) { this.payload = payload; } public String getName() { return name; } public void setName(String name) { this.name = name; } // @Override public String toString() { try { return name + " " + new String(payload); } catch(Exception e) { return name + " " + payload; } } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/DownloadFile.java0000644000175000017500000000204110745677442031112 0ustar charlescharles/* * $Id: DownloadFile.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; public class DownloadFile extends File { public DownloadFile(String name, ServerState state) { super(name, state); } public InputStream createInputStream(long offset) throws IOException { NamedPayload payload = getState().getDownload(getShortName()); if (null == payload) { return null; } else { return new NonSignallingInputStream(new ByteArrayInputStream(payload.getPayload())); } } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/InMemoryIpRestrictor.java0000644000175000017500000000317310754403514032646 0ustar charlescharles/* * $Id:InMemoryIpRestrictor.java 7261 2007-06-27 02:23:03Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import java.net.InetAddress; import org.apache.ftpserver.ftplet.Component; import org.apache.ftpserver.ftplet.Configuration; import org.apache.ftpserver.interfaces.IpRestrictor; /** * This class is needed to avoid creating unnesessary configuration files while running ftp transport tests. */ public class InMemoryIpRestrictor implements IpRestrictor, Component { /** * Configure the IP restrictor. * * @param config ignored */ public void configure(Configuration config) { // nothing to do } /** * Has the permission? * * @param address ignored * @return true */ public boolean hasPermission(InetAddress address) { return true; } /** * Get permission array. * * @return empty array */ public Object[][] getPermissions() { return new Object[0][2]; } /** * Set permission array. * * @param permissions ignored */ public void setPermissions(Object[][] permissions) { // nothing to do } /** * Release all the resources */ public void dispose() { // nothing to do } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/ServerState.java0000644000175000017500000000144010745677442031014 0ustar charlescharles/* * $Id: ServerState.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import java.util.Collection; public interface ServerState { void pushLastUpload(NamedPayload payload); NamedPayload getDownload(String name); Collection getDownloadNames(); void started(); void awaitStart(long ms) throws InterruptedException; NamedPayload awaitUpload(long ms) throws InterruptedException; } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/InOutState.java0000644000175000017500000000366310745677442030615 0ustar charlescharles/* * $Id: InOutState.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import java.util.Collection; import java.util.HashSet; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class InOutState implements ServerState { private NamedPayload payload; private CountDownLatch started = new CountDownLatch(1); private CountDownLatch received = new CountDownLatch(1); private boolean isPayloadAvailable() { return null != payload; } public NamedPayload getDownload(String name) { if (isPayloadAvailable() && (name == null || name.equals(payload.getName()))) { NamedPayload download = payload; payload = null; return download; } else { return null; } } public Collection getDownloadNames() { Collection names = new HashSet(); if (isPayloadAvailable()) { names.add(payload.getName()); } return names; } public void pushLastUpload(NamedPayload payload) { this.payload = payload; received.countDown(); } public void started() { started.countDown(); } public void awaitStart(long ms) throws InterruptedException { started.await(ms, TimeUnit.MILLISECONDS); } public NamedPayload awaitUpload(long ms) throws InterruptedException { received.await(ms, TimeUnit.MILLISECONDS); return payload; } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/FileView.java0000644000175000017500000000410710745677442030262 0ustar charlescharles/* * $Id: FileView.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ftpserver.ftplet.FileObject; import org.apache.ftpserver.ftplet.FileSystemView; import org.apache.ftpserver.ftplet.FtpException; public class FileView implements FileSystemView { protected final Log logger = LogFactory.getLog(getClass()); private CountDownLatch started = new CountDownLatch(1); private ServerState state; public FileView(ServerState state) { this.state = state; } public void flagStarted(int count) { started.countDown(); } public FileObject getHomeDirectory() throws FtpException { return new Directory("/", state); } public FileObject getCurrentDirectory() throws FtpException { return new Directory("/", state); } public boolean changeDirectory(String dir) throws FtpException { return true; } public FileObject getFileObject(String name) throws FtpException { logger.debug("request for: " + name); if (state.getDownloadNames().contains(name)) { return new DownloadFile(name, state); } // TODO - is this standard FTP convention? else if (null != name && name.endsWith("/")) { return new Directory(name, state); } else { return new UploadFile(name, state); } } public boolean isRandomAccessible() throws FtpException { return true; } public void dispose() { // no-op } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/UploadFile.java0000644000175000017500000000145510745677442030577 0ustar charlescharles/* * $Id: UploadFile.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import java.io.IOException; import java.io.OutputStream; public class UploadFile extends File { public UploadFile(String name, ServerState state) { super(name, state); } public OutputStream createOutputStream(long offset) throws IOException { return new SignallingOutputStream(getShortName(), getState()); } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/Server.java0000644000175000017500000000533310745677442030020 0ustar charlescharles/* * $Id: Server.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import java.util.Properties; import org.apache.ftpserver.ConfigurableFtpServerContext; import org.apache.ftpserver.FtpServer; import org.apache.ftpserver.config.PropertiesConfiguration; import org.apache.ftpserver.ftplet.Configuration; import org.apache.ftpserver.interfaces.FtpServerContext; /** * An initial wrapper for the Apache ftpServer. This will progress into a provider of its own, * but for now is necessary to avoid duplicating code in FTP tests using FTPClient. */ public class Server { private static final String FTP_STATE_KEY = "ftp-state-key-"; private FtpServer server; private ServerState state; private int port; public Server(int port) throws Exception { this.port = port; this.state = new InOutState(); // this must be set BEFORE the configuration is created // it is accessed BEFORE server startup System.getProperties().put(FTP_STATE_KEY + port, state); Properties properties = new Properties(); properties.setProperty("config.listeners.default.port", Integer.toString(port)); properties.setProperty("config.file-system-manager.class", FileManager.class.getName()); properties.setProperty("config.file-system-manager.stateFromSystemProperties", FTP_STATE_KEY + port); properties.setProperty("config.connection-manager.default-idle-time", "1"); properties.setProperty("config.connection-manager.max-login", "1000"); properties.setProperty("config.connection-manager.max-anonymous-login", "1000"); properties.setProperty("config.user-manager.class", InMemoryUserManager.class.getName()); properties.setProperty("config.ip-restrictor.class", InMemoryIpRestrictor.class.getName()); Configuration config = new PropertiesConfiguration(properties); FtpServerContext context = new ConfigurableFtpServerContext(config); server = new FtpServer(context); server.start(); } public void awaitStart(long ms) throws InterruptedException { state.awaitStart(ms); } public NamedPayload awaitUpload(long ms) throws InterruptedException { return state.awaitUpload(ms); } public void stop() { server.stop(); System.getProperties().remove(FTP_STATE_KEY + port); } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/SignallingOutputStream.java0000644000175000017500000000260310747501743033223 0ustar charlescharles/* * $Id: SignallingOutputStream.java 10590 2008-01-29 01:39:47Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import java.io.IOException; import java.io.OutputStream; import org.apache.commons.io.output.ByteArrayOutputStream; public class SignallingOutputStream extends OutputStream { private String name; private ServerState state; private ByteArrayOutputStream delegate = new ByteArrayOutputStream(); public SignallingOutputStream(String name, ServerState state) { this.name = name; this.state = state; } public void write(int b) throws IOException { delegate.write(b); } public void write(byte b[]) throws IOException { delegate.write(b); } public void write(byte b[], int off, int len) throws IOException { delegate.write(b, off, len); } // @Override public void close() throws IOException { delegate.close(); state.pushLastUpload(new NamedPayload(name, delegate.toByteArray())); super.close(); } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/InMemoryUserManager.java0000644000175000017500000001635110745677442032445 0ustar charlescharles/* * $Id:InMemoryUserManager.java 7261 2007-06-27 02:23:03Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.List; import org.apache.ftpserver.ftplet.Authentication; import org.apache.ftpserver.ftplet.AuthenticationFailedException; import org.apache.ftpserver.ftplet.Authority; import org.apache.ftpserver.ftplet.User; import org.apache.ftpserver.usermanager.AbstractUserManager; import org.apache.ftpserver.usermanager.AnonymousAuthentication; import org.apache.ftpserver.usermanager.BaseUser; import org.apache.ftpserver.usermanager.ConcurrentLoginPermission; import org.apache.ftpserver.usermanager.TransferRatePermission; import org.apache.ftpserver.usermanager.UsernamePasswordAuthentication; import org.apache.ftpserver.usermanager.WritePermission; import org.apache.ftpserver.util.BaseProperties; import org.apache.ftpserver.util.EncryptUtils; /** * This class is needed to avoid creating unnesessary configuration files while running ftp transport tests. * Based on org.apache.ftpserver.usermanager.PropertiesUserManager */ public class InMemoryUserManager extends AbstractUserManager { private static final String PREFIX = "ftpserver.user."; private BaseProperties userDataProp = new BaseProperties(); private boolean isPasswordEncrypt = true; public InMemoryUserManager() { // this is just copied from default file ./res/user.gen userDataProp.setProperty("ftpserver.user.admin.userpassword", "21232F297A57A5A743894A0E4A801FC3"); userDataProp.setProperty("ftpserver.user.admin.idletime", 0); userDataProp.setProperty("ftpserver.user.anonymous.enableflag", true); userDataProp.setProperty("ftpserver.user.anonymous.uploadrate", 4800); userDataProp.setProperty("ftpserver.user.admin.writepermission", true); userDataProp.setProperty("ftpserver.user.anonymous.userpassword", "D41D8CD98F00B204E9800998ECF8427E"); userDataProp.setProperty("ftpserver.user.anonymous.maxloginperip", 2); userDataProp.setProperty("ftpserver.user.anonymous.idletime", 300); userDataProp.setProperty("ftpserver.user.anonymous.homedirectory", "./res/home"); userDataProp.setProperty("ftpserver.user.admin.enableflag", true); userDataProp.setProperty("ftpserver.user.anonymous.downloadrate", 4800); userDataProp.setProperty("ftpserver.user.anonymous.maxloginnumber", 20); userDataProp.setProperty("ftpserver.user.admin.homedirectory", "./res/home"); userDataProp.setProperty("ftpserver.user.anonymous.writepermission", false); } /** * Load user data. */ public User getUserByName(String userName) { if (!doesExist(userName)) { return null; } String baseKey = PREFIX + userName + '.'; BaseUser user = new BaseUser(); user.setName(userName); user.setEnabled(userDataProp.getBoolean(baseKey + ATTR_ENABLE, true)); user.setHomeDirectory(userDataProp.getProperty(baseKey + ATTR_HOME, "/")); List authorities = new ArrayList(); if (userDataProp.getBoolean(baseKey + ATTR_WRITE_PERM, false)) { authorities.add(new WritePermission()); } int maxLogin = userDataProp.getInteger(baseKey + ATTR_MAX_LOGIN_NUMBER, 0); int maxLoginPerIP = userDataProp.getInteger(baseKey + ATTR_MAX_LOGIN_PER_IP, 0); authorities.add(new ConcurrentLoginPermission(maxLogin, maxLoginPerIP)); int uploadRate = userDataProp.getInteger(baseKey + ATTR_MAX_UPLOAD_RATE, 0); int downloadRate = userDataProp.getInteger(baseKey + ATTR_MAX_DOWNLOAD_RATE, 0); authorities.add(new TransferRatePermission(downloadRate, uploadRate)); user.setAuthorities((Authority[]) authorities.toArray(new Authority[authorities.size()])); user.setMaxIdleTime(userDataProp.getInteger(baseKey + ATTR_MAX_IDLE_TIME, 0)); return user; } /** * Get all user names. */ public String[] getAllUserNames() { // get all user names String suffix = '.' + ATTR_HOME; ArrayList ulst = new ArrayList(); Enumeration allKeys = userDataProp.propertyNames(); int prefixlen = PREFIX.length(); int suffixlen = suffix.length(); while (allKeys.hasMoreElements()) { String key = (String) allKeys.nextElement(); if (key.endsWith(suffix)) { String name = key.substring(prefixlen); int endIndex = name.length() - suffixlen; name = name.substring(0, endIndex); ulst.add(name); } } Collections.sort(ulst); return (String[]) ulst.toArray(new String[ulst.size()]); } /** * Delete an user. Removes all this user entries from the properties. * After removing the corresponding from the properties, save the data. */ public void delete(String login) { // we don't need this } /** * Save user data. Store the properties. */ public void save(User user) { // we don't need this } /** * User existance check */ public boolean doesExist(String name) { String key = PREFIX + name + '.' + ATTR_HOME; return userDataProp.containsKey(key); } /** * User authenticate method */ public synchronized User authenticate(Authentication authentication) throws AuthenticationFailedException { if (authentication instanceof UsernamePasswordAuthentication) { UsernamePasswordAuthentication upauth = (UsernamePasswordAuthentication) authentication; String user = upauth.getUsername(); String password = upauth.getPassword(); if (user == null) { throw new AuthenticationFailedException("Authentication failed"); } if (password == null) { password = ""; } String passVal = userDataProp.getProperty(PREFIX + user + '.' + ATTR_PASSWORD); if (isPasswordEncrypt) { password = EncryptUtils.encryptMD5(password); } if (password.equals(passVal)) { return getUserByName(user); } else { throw new AuthenticationFailedException("Authentication failed"); } } else if (authentication instanceof AnonymousAuthentication) { if (doesExist("anonymous")) { return getUserByName("anonymous"); } else { throw new AuthenticationFailedException("Authentication failed"); } } else { throw new IllegalArgumentException("Authentication not supported by this user manager"); } } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/NonSignallingInputStream.java0000644000175000017500000000225010745677442033503 0ustar charlescharles/* * $Id: NonSignallingInputStream.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import java.io.IOException; import java.io.InputStream; public class NonSignallingInputStream extends InputStream { private InputStream inputStream; public NonSignallingInputStream(InputStream inputStream) { this.inputStream = inputStream; } public int read() throws IOException { return inputStream.read(); } // @Override public int read(byte b[]) throws IOException { return inputStream.read(b); } // @Override public int read(byte b[], int off, int len) throws IOException { return inputStream.read(b, off, len); } // @Override public void close() throws IOException { super.close(); } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/Directory.java0000644000175000017500000000260610745677442030516 0ustar charlescharles/* * $Id: Directory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import java.util.Collection; import java.util.Iterator; import org.apache.ftpserver.ftplet.FileObject; public class Directory extends Named { public Directory(String name, ServerState state) { super(name, state); } public boolean isDirectory() { return true; } public boolean isFile() { return false; } public FileObject[] listFiles() { logger.debug("list files"); Collection available = getState().getDownloadNames(); FileObject[] files = new FileObject[available.size()]; int index = 0; for (Iterator names = available.iterator(); names.hasNext();) { String name = (String) names.next(); if (logger.isDebugEnabled()) { logger.debug("file available: " + name); } files[index++] = new DownloadFile(name, getState()); } return files; } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/Named.java0000644000175000017500000000460310745677442027575 0ustar charlescharles/* * $Id: Named.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ftpserver.ftplet.FileObject; public abstract class Named implements FileObject { protected final Log logger = LogFactory.getLog(getClass()); private String name; private ServerState state; public Named(String name, ServerState state) { this.name = name; this.state = state; if (logger.isDebugEnabled()) { logger.debug("created: " + name); } } public String getFullName() { return name; } public String getShortName() { return name; } public boolean isHidden() { return false; } public boolean isDirectory() { return true; } public boolean doesExist() { return true; } public boolean hasReadPermission() { return true; } public boolean hasWritePermission() { return true; } public boolean hasDeletePermission() { return false; } public String getOwnerName() { return null; } public String getGroupName() { return null; } public int getLinkCount() { return 0; } public long getLastModified() { return 0; } public long getSize() { return 0; } public boolean mkdir() { return false; } public boolean delete() { return false; } public boolean move(FileObject destination) { return false; } protected ServerState getState() { return state; } public OutputStream createOutputStream(long offset) throws IOException { return null; } public InputStream createInputStream(long offset) throws IOException { return null; } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/server/File.java0000644000175000017500000000151010745677442027422 0ustar charlescharles/* * $Id: File.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.server; import org.apache.ftpserver.ftplet.FileObject; public class File extends Named { public File(String name, ServerState state) { super(name, state); } public boolean isDirectory() { return false; } public boolean isFile() { return true; } public FileObject[] listFiles() { return new FileObject[0]; } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/AbstractFtpServerTestCase.java0000644000175000017500000000371110763522057032271 0ustar charlescharles/* * $Id: AbstractFtpServerTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.tck.FunctionalTestCase; import org.mule.transport.ftp.server.NamedPayload; import org.mule.transport.ftp.server.Server; public abstract class AbstractFtpServerTestCase extends FunctionalTestCase { public static final String TEST_MESSAGE = "Test FTP message"; private static int DEFAULT_TIMEOUT = 10000; private int timeout; private int port; private Server server; public AbstractFtpServerTestCase(int port, int timeout) { this.port = port; this.timeout = timeout; } public AbstractFtpServerTestCase(int port) { this(port, DEFAULT_TIMEOUT); } protected void startServer() throws Exception { server = new Server(port); server.awaitStart(timeout); // this is really ugly, but the above doesn't get to waiting. // need to improve this as part of ftp server work synchronized(this) { wait(500); } } protected void stopServer() throws Exception { // stop the server if (null != server) { server.stop(); } } // @Override protected void doSetUp() throws Exception { startServer(); } // @Override protected void doTearDown() throws Exception { stopServer(); } protected int getTimeout() { return timeout; } protected NamedPayload awaitUpload() throws InterruptedException { return server.awaitUpload(timeout); } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/FtpFunctionalTestCase.java0000644000175000017500000000336210754375733031452 0ustar charlescharles/* * $Id: FtpFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.transport.file.FileConnector; import org.mule.transport.ftp.server.NamedPayload; import java.util.HashMap; import java.util.Map; public class FtpFunctionalTestCase extends AbstractFtpServerTestCase { private static int PORT = 60198; public FtpFunctionalTestCase() { super(PORT); } protected String getConfigResources() { return "ftp-functional-test.xml"; } public void testSendAndRequest() throws Exception { Map properties = new HashMap(); MuleClient client = new MuleClient(); client.dispatch("ftp://anonymous:email@localhost:" + PORT, TEST_MESSAGE, properties); NamedPayload payload = awaitUpload(); assertNotNull(payload); assertEquals(TEST_MESSAGE, new String(payload.getPayload())); logger.info("received message OK!"); MuleMessage retrieved = client.request("ftp://anonymous:email@localhost:" + PORT, getTimeout()); assertNotNull(retrieved); assertNotNull(retrieved.getProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME)); assertNotNull(retrieved.getProperty(FileConnector.PROPERTY_FILE_SIZE)); assertEquals(retrieved.getPayloadAsString(), TEST_MESSAGE); } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/issues/0000755000175000017500000000000011351410656025672 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/issues/MultiStreamMule1696TestCase.javamule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/issues/MultiStreamMule1696TestCase.ja0000644000175000017500000001011110761053756033263 0ustar charlescharles/* * $Id: MultiStreamMule1696TestCase.java 11039 2008-02-26 18:18:22Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp.issues; import org.mule.api.MuleEventContext; import org.mule.module.client.MuleClient; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalStreamingTestComponent; import org.mule.transport.ftp.AbstractFtpServerTestCase; import org.mule.transport.ftp.server.NamedPayload; import java.util.HashMap; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference; public class MultiStreamMule1696TestCase extends AbstractFtpServerTestCase { public static final String TEST_MESSAGE_2 = "Another test message"; private static int PORT = 60197; public MultiStreamMule1696TestCase() { super(PORT); } protected String getConfigResources() { return "ftp-streaming-test.xml"; } private EventCallback newCallback(final CountDownLatch latch, final AtomicReference message) { return new EventCallback() { public synchronized void eventReceived(MuleEventContext context, Object component) { try { FunctionalStreamingTestComponent ftc = (FunctionalStreamingTestComponent) component; logger.debug("Callback called: " + ftc.getSummary()); message.set(ftc.getSummary()); latch.countDown(); } catch (Exception e) { logger.error(e.getMessage(), e); } } }; } public void testSendAndRequest() throws Exception { MuleClient client = new MuleClient(); Object ftc = getComponent("testComponent"); assertTrue("FunctionalStreamingTestComponent expected", ftc instanceof FunctionalStreamingTestComponent); assertNotNull(ftc); // assertEquals(1, ftc.getNumber()); CountDownLatch latch = new CountDownLatch(1); AtomicReference message = new AtomicReference(); EventCallback callback = newCallback(latch, message); ((FunctionalStreamingTestComponent) ftc).setEventCallback(callback, TEST_MESSAGE.length()); // send out to FTP server via streaming model client.dispatch("tcp://localhost:60196", TEST_MESSAGE, new HashMap()); NamedPayload payload = awaitUpload(); assertNotNull(payload); logger.info("received message: " + payload); assertEquals(TEST_MESSAGE, new String(payload.getPayload())); // poll and pull back through test service latch.await(getTimeout(), TimeUnit.MILLISECONDS); assertEquals("Received stream; length: 16; 'Test...sage'", message.get()); // repeat, but restart server due to simple state, connection limitations stopServer(); Thread.sleep(3000); // wait for scket to close startServer(); CountDownLatch latch2 = new CountDownLatch(1); AtomicReference message2 = new AtomicReference(); EventCallback callback2 = newCallback(latch2, message2); ((FunctionalStreamingTestComponent) ftc).setEventCallback(callback2, TEST_MESSAGE_2.length()); client.dispatch("tcp://localhost:60196", TEST_MESSAGE_2, new HashMap()); NamedPayload payload2 = awaitUpload(); assertNotNull(payload2); logger.info("received message: " + payload2); assertEquals(TEST_MESSAGE_2, new String(payload2.getPayload())); latch2.await(getTimeout(), TimeUnit.MILLISECONDS); assertEquals("Received stream; length: 20; 'Anot...sage'", message2.get()); } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/FtpStreamingTestCase.java0000644000175000017500000000700710761053756031275 0ustar charlescharles/* * $Id: FtpStreamingTestCase.java 11039 2008-02-26 18:18:22Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.api.MuleEventContext; import org.mule.module.client.MuleClient; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalStreamingTestComponent; import org.mule.transport.ftp.server.NamedPayload; import java.util.HashMap; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference; /** * We don't have an integrated ftp server (yet), and synchronous return doesn't work * with streaming, as far as i can tell, so the best we can do here is dispatch a * through a streaming bridge to the test server, then pull it back again (again, * through the streaming model). */ public class FtpStreamingTestCase extends AbstractFtpServerTestCase { private static int PORT = 60197; public FtpStreamingTestCase() { super(PORT); } protected String getConfigResources() { return "ftp-streaming-test.xml"; } public void testSendAndRequest() throws Exception { final CountDownLatch latch = new CountDownLatch(1); final AtomicReference message = new AtomicReference(); final AtomicInteger loopCount = new AtomicInteger(0); EventCallback callback = new EventCallback() { public synchronized void eventReceived(MuleEventContext context, Object component) { try { logger.info("called " + loopCount.incrementAndGet() + " times"); FunctionalStreamingTestComponent ftc = (FunctionalStreamingTestComponent) component; // without this we may have problems with the many repeats if (1 == latch.getCount()) { message.set(ftc.getSummary()); latch.countDown(); } } catch (Exception e) { logger.error(e.getMessage(), e); } } }; MuleClient client = new MuleClient(); Object ftc = getComponent("testComponent"); assertTrue("FunctionalStreamingTestComponent expected", ftc instanceof FunctionalStreamingTestComponent); assertNotNull(ftc); // assertEquals(1, ftc.getNumber()); ((FunctionalStreamingTestComponent) ftc).setEventCallback(callback, TEST_MESSAGE.length()); // send out to FTP server via streaming model client.dispatch("tcp://localhost:60196", TEST_MESSAGE, new HashMap()); NamedPayload payload = awaitUpload(); assertNotNull(payload); logger.info("received message: " + payload); assertEquals(TEST_MESSAGE, new String(payload.getPayload())); // poll and pull back through test service latch.await(getTimeout(), TimeUnit.MILLISECONDS); assertEquals("Received stream; length: 16; 'Test...sage'", message.get()); } } mule-2.0.1/transports/ftp/src/test/java/org/mule/transport/ftp/FTPConnectorTestCase.java0000644000175000017500000001152610757615756031210 0ustar charlescharles/* * $Id: FTPConnectorTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ftp; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageReceiver; import org.mule.tck.testmodels.fruit.Apple; import org.mule.transport.AbstractConnectorTestCase; import java.util.Properties; import org.apache.commons.pool.ObjectPool; public class FTPConnectorTestCase extends AbstractConnectorTestCase { static final long POLLING_FREQUENCY = 1234; static final long POLLING_FREQUENCY_OVERRIDE = 4321; static final String TEST_ENDPOINT_URI = "ftp://foo:bar@example.com"; static final String VALID_MESSAGE = "This is a valid FTP message"; /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractConnectorTestCase#createConnector() */ // @Override public Connector createConnector() throws Exception { return internalGetConnector(false); } public Object getValidMessage() throws Exception { return VALID_MESSAGE.getBytes(); } public String getTestEndpointURI() { return TEST_ENDPOINT_URI; } /** * Test polling frequency set on a connector. */ public void testConnectorPollingFrequency() throws Exception { InboundEndpoint endpoint = getTestInboundEndpoint("mock"); Service service = getTestService("apple", Apple.class); FtpConnector connector = (FtpConnector)getConnector(); MessageReceiver receiver = connector.createReceiver(service, endpoint); assertEquals("Connector's polling frequency must not be ignored.", POLLING_FREQUENCY, ((FtpMessageReceiver)receiver).getFrequency()); } /** * Test polling frequency overridden at an endpoint level. */ public void testPollingFrequencyEndpointOverride() throws Exception { Properties props = new Properties(); // Endpoint wants String-typed properties props.put(FtpConnector.PROPERTY_POLLING_FREQUENCY, String.valueOf(POLLING_FREQUENCY_OVERRIDE)); InboundEndpoint endpoint = getTestInboundEndpoint("mock", null, null, null, props); Service service = getTestService("apple", Apple.class); FtpConnector connector = (FtpConnector)getConnector(); MessageReceiver receiver = connector.createReceiver(service, endpoint); assertEquals("Polling frequency endpoint override must not be ignored.", POLLING_FREQUENCY_OVERRIDE, ((FtpMessageReceiver)receiver).getFrequency()); } public void testCustomFtpConnectionFactory() throws Exception { final String testObject = "custom object"; final ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getOutboundEndpoint("ftp://test:test@example.com"); final EndpointURI endpointURI = endpoint.getEndpointURI(); FtpConnectionFactory testFactory = new TestFtpConnectionFactory(endpointURI); FtpConnector connector = (FtpConnector)getConnector(); connector.setConnectionFactoryClass(testFactory.getClass().getName()); // no validate call for simplicity connector.setValidateConnections(false); ObjectPool pool = connector.getFtpPool(endpointURI); Object obj = pool.borrowObject(); assertEquals("Custom FTP connection factory has been ignored.", testObject, obj); } /** * Workaround. The super getConnector() call will init the connector, * but for some tests we want more config steps before the initialisation. */ protected FtpConnector internalGetConnector(boolean initialiseConnector) throws Exception { FtpConnector connector = new FtpConnector(); connector.setName("testFTP"); connector.setPollingFrequency(POLLING_FREQUENCY); if (initialiseConnector) { connector.initialise(); } return connector; } public static final class TestFtpConnectionFactory extends FtpConnectionFactory { public TestFtpConnectionFactory(EndpointURI uri) { super(uri); } public Object makeObject() throws Exception { return "custom object"; } public void activateObject(final Object obj) throws Exception { // empty no-op, do not call super } } } mule-2.0.1/transports/ftp/src/test/resources/0000755000175000017500000000000011351410656021072 5ustar charlescharlesmule-2.0.1/transports/ftp/src/test/resources/ftp-streaming-test.xml0000644000175000017500000000363310774266536025374 0ustar charlescharles mule-2.0.1/transports/ftp/src/test/resources/log4j.properties0000644000175000017500000000050210700532050024212 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/transports/ftp/src/test/resources/ftp-namespace-config.xml0000644000175000017500000000207610764142752025615 0ustar charlescharles mule-2.0.1/transports/ftp/src/test/resources/ftp-functional-test.xml0000644000175000017500000000141510665301621025521 0ustar charlescharles mule-2.0.1/transports/ftp/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006210700467676025755 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/transports/ftp/pom.xml0000644000175000017500000001013411006063605016621 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-ftp FTP Transport A Mule transport for Ftp Connectivity. commons-net commons-net 1.4.1 oro oro 2.0.7 org.mule mule-core ${version} org.mule.transports mule-transport-file ${version} org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test org.mule.transports mule-transport-file ${version} test-jar test org.mule.transports mule-transport-tcp ${version} test org.apache.ftpserver ftpserver-core 1.0-mule-temp test org.apache.ftpserver ftplet-api 1.0-mule-temp test org.apache.mina mina-core 1.0.2 test backport-util-concurrent backport-util-concurrent org.slf4j slf4j-api osgi org.apache.felix maven-bundle-plugin org.mule.transport.ftp.* mule-2.0.1/transports/jms/0000755000175000017500000000000011351410656015312 5ustar charlescharlesmule-2.0.1/transports/jms/src/0000755000175000017500000000000011351410655016100 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/0000755000175000017500000000000011351410656017025 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/0000755000175000017500000000000011351410655017745 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/org/0000755000175000017500000000000011351410655020534 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/org/mule/0000755000175000017500000000000011351410655021476 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/org/mule/transport/0000755000175000017500000000000011351410655023532 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/0000755000175000017500000000000011351410656024324 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/MultiConsumerJmsMessageReceiver.java0000644000175000017500000003050511002156421033432 0ustar charlescharles/* * $Id: MultiConsumerJmsMessageReceiver.java 11597 2008-04-18 17:40:33Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MuleException; import org.mule.api.MuleRuntimeException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.LifecycleException; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transport.Connector; import org.mule.config.i18n.MessageFactory; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.AbstractReceiverWorker; import org.mule.transport.ConnectException; import org.mule.transport.jms.filters.JmsSelectorFilter; import org.mule.util.ClassUtils; import java.util.ArrayList; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.Session; import javax.jms.Topic; import javax.resource.spi.work.WorkException; import edu.emory.mathcs.backport.java.util.concurrent.BlockingDeque; import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingDeque; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This is an experimental rework of the transacted.message.receiver * (it may work with non-transacted sessions as well, * just hasn't been tested and load-tested yet. *

* In Mule an endpoint corresponds to a single receiver. It's up to the receiver to do multithreaded consumption and * resource allocation, if needed. This class honors the numberOfConcurrentTransactedReceivers strictly * and will create exactly this number of consumers. */ public class MultiConsumerJmsMessageReceiver extends AbstractMessageReceiver { protected final BlockingDeque consumers; protected volatile int receiversCount; private final JmsConnector jmsConnector; public MultiConsumerJmsMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); jmsConnector = (JmsConnector) connector; final boolean isTopic = jmsConnector.getTopicResolver().isTopic(endpoint, true); receiversCount = jmsConnector.getNumberOfConcurrentTransactedReceivers(); if (isTopic && receiversCount != 1) { if (logger.isInfoEnabled()) { logger.info("Destination " + getEndpoint().getEndpointURI() + " is a topic, but " + receiversCount + " receivers have been configured. Will configure only 1."); } receiversCount = 1; } if (logger.isDebugEnabled()) { logger.debug("Creating " + receiversCount + " sub-receivers for " + endpoint.getEndpointURI()); } consumers = new LinkedBlockingDeque(receiversCount); for (int i = 0; i < receiversCount; i++) { consumers.addLast(new SubReceiver()); } } protected void doStart() throws MuleException { logger.debug("doStart()"); for (int i = 0; i < receiversCount; i++) { SubReceiver sub = (SubReceiver) consumers.removeFirst(); sub.doStart(); consumers.addLast(sub); } } protected void doStop() throws MuleException { logger.debug("doStop()"); for (int i = 0; i < receiversCount; i++) { SubReceiver sub = (SubReceiver) consumers.removeFirst(); sub.doStop(); consumers.addLast(sub); } } protected void doConnect() throws Exception { logger.debug("doConnect()"); for (int i = 0; i < receiversCount; i++) { SubReceiver sub = (SubReceiver) consumers.removeFirst(); sub.doConnect(); consumers.addLast(sub); } } protected void doDisconnect() throws Exception { logger.debug("doDisconnect()"); for (int i = 0; i < receiversCount; i++) { SubReceiver sub = (SubReceiver) consumers.removeFirst(); sub.doDisconnect(); consumers.addLast(sub); } } protected void doDispose() { logger.debug("doDispose()"); } private class SubReceiver implements MessageListener { private final Log subLogger = LogFactory.getLog(getClass()); private volatile Session session; private volatile MessageConsumer consumer; protected void doConnect() throws Exception { subLogger.debug("SUB doConnect()"); createConsumer(); } protected void doDisconnect() throws Exception { closeConsumer(); } protected void closeConsumer() { jmsConnector.closeQuietly(consumer); consumer = null; jmsConnector.closeQuietly(session); session = null; } protected void doStart() throws MuleException { try { consumer.setMessageListener(this); } catch (JMSException e) { throw new LifecycleException(e, this); } } protected void doStop() throws MuleException { try { if (consumer != null) { consumer.setMessageListener(null); } } catch (JMSException e) { throw new LifecycleException(e, this); } } /** * Create a consumer for the jms destination. */ protected void createConsumer() throws Exception { try { JmsSupport jmsSupport = jmsConnector.getJmsSupport(); // Create session if none exists if (session == null) { session = jmsConnector.getSession(endpoint); } boolean topic = jmsConnector.getTopicResolver().isTopic(endpoint, true); // Create destination Destination dest = jmsSupport.createDestination(session, endpoint.getEndpointURI().getAddress(), topic); // Extract jms selector String selector = null; if (endpoint.getFilter() != null && endpoint.getFilter() instanceof JmsSelectorFilter) { selector = ((JmsSelectorFilter) endpoint.getFilter()).getExpression(); } else { if (endpoint.getProperties() != null) { // still allow the selector to be set as a property on the endpoint // to be backward compatable selector = (String) endpoint.getProperties().get(JmsConstants.JMS_SELECTOR_PROPERTY); } } String tempDurable = (String) endpoint.getProperties().get(JmsConstants.DURABLE_PROPERTY); boolean durable = jmsConnector.isDurable(); if (tempDurable != null) { durable = Boolean.valueOf(tempDurable).booleanValue(); } // Get the durable subscriber name if there is one String durableName = (String) endpoint.getProperties().get(JmsConstants.DURABLE_NAME_PROPERTY); if (durableName == null && durable && dest instanceof Topic) { durableName = "mule." + jmsConnector.getName() + "." + endpoint.getEndpointURI().getAddress(); logger.debug("Jms Connector for this receiver is durable but no durable name has been specified. Defaulting to: " + durableName); } // Create consumer consumer = jmsSupport.createConsumer(session, dest, selector, jmsConnector.isNoLocal(), durableName, topic); } catch (JMSException e) { throw new ConnectException(e, MultiConsumerJmsMessageReceiver.this); } } public void onMessage(final Message message) { try { // This must be the doWork() to preserve the transactional context. // We are already running in the consumer thread by this time. // The JmsWorker classe is a one-off executor which is abandoned after it's done and is // easily garbage-collected (confirmed with a profiler) getWorkManager().doWork(new JmsWorker(message, MultiConsumerJmsMessageReceiver.this, this)); } catch (WorkException e) { throw new MuleRuntimeException(MessageFactory.createStaticMessage( "Couldn't submit a work item to the WorkManager"), e); } } } protected class JmsWorker extends AbstractReceiverWorker { private final SubReceiver subReceiver; public JmsWorker(Message message, AbstractMessageReceiver receiver, SubReceiver subReceiver) { super(new ArrayList(1), receiver); this.subReceiver = subReceiver; messages.add(message); } //@Override protected Object preProcessMessage(Object message) throws Exception { Message m = (Message) message; if (logger.isDebugEnabled()) { logger.debug("Message received it is of type: " + ClassUtils.getSimpleName(message.getClass())); if (m.getJMSDestination() != null) { logger.debug("Message received on " + m.getJMSDestination() + " (" + m.getJMSDestination().getClass().getName() + ")"); } else { logger.debug("Message received on unknown destination"); } logger.debug("Message CorrelationId is: " + m.getJMSCorrelationID()); logger.debug("Jms Message Id is: " + m.getJMSMessageID()); } if (m.getJMSRedelivered()) { // lazily create the redelivery handler RedeliveryHandler redeliveryHandler = jmsConnector.getRedeliveryHandlerFactory().create(); redeliveryHandler.setConnector(jmsConnector); if (logger.isDebugEnabled()) { logger.debug("Message with correlationId: " + m.getJMSCorrelationID() + " has redelivered flag set, handing off to Exception Handler"); } redeliveryHandler.handleRedelivery(m); } return m; } protected void bindTransaction(Transaction tx) throws TransactionException { if (tx instanceof JmsTransaction) { if (logger.isDebugEnabled()) { logger.debug(">>> !! Binding " + subReceiver.session + " to " + jmsConnector.getConnection()); } tx.bindResource(jmsConnector.getConnection(), subReceiver.session); } else { if (tx instanceof JmsClientAcknowledgeTransaction) { //We should still bind the session to the transaction, but we also need the message itself //since that is the object that gets Acknowledged //tx.bindResource(jmsConnector.getConnection(), session); ((JmsClientAcknowledgeTransaction) tx).setMessage((Message) messages.get(0)); } } } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageAdapter.java0000644000175000017500000002337310745677442030554 0ustar charlescharles/* * $Id: JmsMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MessagingException; import org.mule.api.ThreadSafeAccess; import org.mule.api.config.MuleProperties; import org.mule.api.transport.MessageTypeNotSupportedException; import org.mule.transport.AbstractMessageAdapter; import java.util.Enumeration; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; /** * JmsMessageAdapter allows a DefaultMuleEvent to access the * properties and payload of a JMS Message in a uniform way. The JmsMessageAdapter * expects a message of type javax.jms.Message and will throw an * IllegalArgumentException if the source message type is not compatible. The * JmsMessageAdapter should be suitable for all JMS Connector implementations. */ public class JmsMessageAdapter extends AbstractMessageAdapter { /** * Serial version */ private static final long serialVersionUID = -8151716840620558143L; private String jmsSpec; private Message jmsMessage; public JmsMessageAdapter(Object message) throws MessagingException { super(); this.setMessage(message); } protected JmsMessageAdapter(JmsMessageAdapter template) { super(template); jmsSpec = template.jmsSpec; jmsMessage = template.jmsMessage; } public void setSpecification(String newSpec) { if (JmsConstants.JMS_SPECIFICATION_11.equals(newSpec) || (JmsConstants.JMS_SPECIFICATION_102B.equals(newSpec))) { this.jmsSpec = newSpec; } else { throw new IllegalArgumentException( "JMS specification needs to be one of the defined values in JmsConstants but was: " + newSpec); } } /** * Converts the message implementation into a String representation * * @param encoding The encoding to use when transforming the message (if * necessary). The parameter is used when converting from a byte array * @return String representation of the message payload * @throws Exception Implementation may throw an endpoint specific exception */ public String getPayloadAsString(String encoding) throws Exception { return new String(getPayloadAsBytes(), encoding); } /** * Converts the message implementation into a String representation * * @return String representation of the message * @throws Exception Implemetation may throw an endpoint specific exception */ public byte[] getPayloadAsBytes() throws Exception { return JmsMessageUtils.toByteArray(jmsMessage, jmsSpec); } /** * @return the current message */ public Object getPayload() { return jmsMessage; } /** * @param message new value for the message */ private void setMessage(Object message) throws MessagingException { if (message instanceof Message) { this.jmsMessage = (Message)message; } else { throw new MessageTypeNotSupportedException(message, getClass()); } try { String value = this.jmsMessage.getJMSCorrelationID(); if (value != null) { setProperty(JmsConstants.JMS_CORRELATION_ID, value); } } catch (JMSException e) { // ignored } try { int value = this.jmsMessage.getJMSDeliveryMode(); setProperty(JmsConstants.JMS_DELIVERY_MODE, new Integer(value)); } catch (JMSException e) { // ignored } try { Destination value = this.jmsMessage.getJMSDestination(); if (value != null) { setProperty(JmsConstants.JMS_DESTINATION, value); } } catch (JMSException e) { // ignored } try { long value = this.jmsMessage.getJMSExpiration(); setProperty(JmsConstants.JMS_EXPIRATION, new Long(value)); } catch (JMSException e) { // ignored } try { String value = this.jmsMessage.getJMSMessageID(); if (value != null) { setProperty(JmsConstants.JMS_MESSAGE_ID, value); } } catch (JMSException e) { // ignored } try { int value = this.jmsMessage.getJMSPriority(); setProperty(JmsConstants.JMS_PRIORITY, new Integer(value)); } catch (JMSException e) { // ignored } try { boolean value = this.jmsMessage.getJMSRedelivered(); setProperty(JmsConstants.JMS_REDELIVERED, Boolean.valueOf(value)); } catch (JMSException e) { // ignored } try { Destination value = this.jmsMessage.getJMSReplyTo(); if (value != null) { setProperty(JmsConstants.JMS_REPLY_TO, value); } } catch (JMSException e) { // ignored } try { long value = this.jmsMessage.getJMSTimestamp(); setProperty(JmsConstants.JMS_TIMESTAMP, new Long(value)); } catch (JMSException e) { // ignored } try { String value = this.jmsMessage.getJMSType(); if (value != null) { setProperty(JmsConstants.JMS_TYPE, value); } } catch (JMSException e) { // ignored } try { Enumeration e = this.jmsMessage.getPropertyNames(); while (e.hasMoreElements()) { String key = (String)e.nextElement(); try { Object value = this.jmsMessage.getObjectProperty(key); if (value != null) { setProperty(key, value); } } catch (JMSException e1) { // ignored } } } catch (JMSException e1) { // ignored } } public String getUniqueId() { return (String)getProperty(JmsConstants.JMS_MESSAGE_ID); } /** * Sets a correlationId for this message. The correlation Id can be used by * components in the system to manage message relations

transport protocol. * As such not all messages will support the notion of a correlationId i.e. tcp * or file. In this situation the correlation Id is set as a property of the * message where it's up to developer to keep the association with the message. * For example if the message is serialised to xml the correlationId will be * available in the message. * * @param id the Id reference for this relationship */ public void setCorrelationId(String id) { setProperty(JmsConstants.JMS_CORRELATION_ID, id); } /** * Sets a correlationId for this message. The correlation Id can be used by * components in the system to manage message relations.

The correlationId * is associated with the message using the underlying transport protocol. As * such not all messages will support the notion of a correlationId i.e. tcp or * file. In this situation the correlation Id is set as a property of the message * where it's up to developer to keep the association with the message. For * example if the message is serialised to xml the correlationId will be * available in the message. * * @return the correlationId for this message or null if one hasn't been set */ public String getCorrelationId() { return (String)getProperty(JmsConstants.JMS_CORRELATION_ID); } /** * Sets a replyTo address for this message. This is useful in an asynchronous * environment where the caller doesn't wait for a response and the response * needs to be routed somewhere for further processing. The value of this field * can be any valid endpointUri url. * * @param replyTo the endpointUri url to reply to */ public void setReplyTo(Object replyTo) { if (replyTo instanceof Destination) { setProperty(JmsConstants.JMS_REPLY_TO, replyTo); } else { super.setReplyTo(replyTo); } } /** * Sets a replyTo address for this message. This is useful in an asynchronous * environment where the caller doesn't wait for a response and the response * needs to be routed somewhere for further processing. The value of this field * can be any valid endpointUri url. * * @return the endpointUri url to reply to or null if one has not been set */ public Object getReplyTo() { Object replyTo = getProperty(JmsConstants.JMS_REPLY_TO); if (replyTo == null) { replyTo = getProperty(MuleProperties.MULE_REPLY_TO_PROPERTY); } return replyTo; } public ThreadSafeAccess newThreadCopy() { return new JmsMessageAdapter(this); } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/Jms11Support.java0000644000175000017500000001365510745677442027507 0ustar charlescharles/* * $Id: Jms11Support.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.DeliveryMode; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.Topic; /** * Jms11Support is a template class to provide an abstraction to to * the JMS 1.1 API specification. */ public class Jms11Support implements JmsSupport { protected JmsConnector connector; public Jms11Support(JmsConnector connector) { this.connector = connector; } public Connection createConnection(ConnectionFactory connectionFactory, String username, String password) throws JMSException { if (connectionFactory == null) { throw new IllegalArgumentException("connectionFactory cannot be null"); } return connectionFactory.createConnection(username, password); } public Connection createConnection(ConnectionFactory connectionFactory) throws JMSException { if (connectionFactory == null) { throw new IllegalArgumentException("connectionFactory cannot be null"); } return connectionFactory.createConnection(); } public Session createSession(Connection connection, boolean topic, boolean transacted, int ackMode, boolean noLocal) throws JMSException { return connection.createSession(transacted, (transacted ? Session.SESSION_TRANSACTED : ackMode)); } public MessageProducer createProducer(Session session, Destination destination, boolean topic) throws JMSException { return session.createProducer(destination); } public MessageConsumer createConsumer(Session session, Destination destination, boolean topic) throws JMSException { return createConsumer(session, destination, null, false, null, topic); } public MessageConsumer createConsumer(Session session, Destination destination, String messageSelector, boolean noLocal, String durableName, boolean topic) throws JMSException { if (durableName == null) { if (topic) { return session.createConsumer(destination, messageSelector, noLocal); } else { return session.createConsumer(destination, messageSelector); } } else { if (topic) { return session.createDurableSubscriber((Topic) destination, durableName, messageSelector, noLocal); } else { throw new JMSException( "A durable subscriber name was set but the destination was not a Topic"); } } } public Destination createDestination(Session session, String name, boolean topic) throws JMSException { if (session == null) { throw new IllegalArgumentException("MuleSession cannot be null when creating a destination"); } if (name == null) { throw new IllegalArgumentException("Destination name cannot be null when creating a destination"); } if (topic) { return session.createTopic(name); } else { return session.createQueue(name); } } public Destination createTemporaryDestination(Session session, boolean topic) throws JMSException { if (session == null) { throw new IllegalArgumentException("MuleSession cannot be null when creating a destination"); } if (topic) { return session.createTemporaryTopic(); } else { return session.createTemporaryQueue(); } } public void send(MessageProducer producer, Message message, boolean topic) throws JMSException { send(producer, message, connector.isPersistentDelivery(), Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE, topic); } public void send(MessageProducer producer, Message message, Destination dest, boolean topic) throws JMSException { send(producer, message, dest, connector.isPersistentDelivery(), Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE, topic); } public void send(MessageProducer producer, Message message, boolean persistent, int priority, long ttl, boolean topic) throws JMSException { producer.send(message, (persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT), priority, ttl); } public void send(MessageProducer producer, Message message, Destination dest, boolean persistent, int priority, long ttl, boolean topic) throws JMSException { producer.send(dest, message, (persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT), priority, ttl); } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/package.html0000644000175000017500000000016310745677442026623 0ustar charlescharles Provides Jms transport connectivity with support for all Jms features. mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsTransaction.java0000644000175000017500000000541510745677442030151 0ustar charlescharles/* * $Id: JmsTransaction.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; import org.mule.transaction.AbstractSingleResourceTransaction; import org.mule.transaction.IllegalTransactionStateException; import org.mule.transport.jms.i18n.JmsMessages; import javax.jms.Connection; import javax.jms.JMSException; import javax.jms.Session; /** * JmsTransaction is a wrapper for a JMS local transaction. This * object holds the JMS session and controls when the transaction is committed or * rolled back. */ public class JmsTransaction extends AbstractSingleResourceTransaction { public void bindResource(Object key, Object resource) throws TransactionException { if (!(key instanceof Connection) || !(resource instanceof Session)) { throw new IllegalTransactionStateException( CoreMessages.transactionCanOnlyBindToResources("javax.jms.Connection/javax.jms.Session")); } Session session = (Session)resource; try { if (!session.getTransacted()) { throw new IllegalTransactionStateException(JmsMessages.sessionShouldBeTransacted()); } } catch (JMSException e) { throw new IllegalTransactionStateException(CoreMessages.transactionCannotReadState(), e); } super.bindResource(key, resource); } protected void doBegin() throws TransactionException { // do nothing } protected void doCommit() throws TransactionException { try { ((Session)resource).commit(); } catch (JMSException e) { throw new TransactionException(CoreMessages.transactionCommitFailed(), e); } } protected void doRollback() throws TransactionException { if (resource != null) { try { ((Session)resource).rollback(); } catch (JMSException e) { throw new TransactionException(CoreMessages.transactionRollbackFailed(), e); } } else { throw new TransactionException(MessageFactory.createStaticMessage("No resource has been bound to this transaction")); } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/RedeliveryHandlerFactory.java0000644000175000017500000000163511002071522032120 0ustar charlescharles/* * $Id: RedeliveryHandlerFactory.java 11592 2008-04-18 10:09:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; /** * Implementors of this interface are responsible to create {@link RedeliveryHandler} * instances upon request. *

* Note that due to the stateful nature of a {@link RedeliveryHandler} this factory * should always return new {@link RedeliveryHandler} instances. */ public interface RedeliveryHandlerFactory { /** * @return {@link RedeliveryHandler} new redelivery handler instance. */ RedeliveryHandler create(); } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/transformers/0000755000175000017500000000000011351410656027051 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/transformers/package.html0000644000175000017500000000021610745677442031347 0ustar charlescharles Mule Contains transformers to convert to and from different javax.jms.Message types mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/transformers/ObjectToJMSMessage.java0000644000175000017500000000400510745677442033321 0ustar charlescharles/* * $Id: ObjectToJMSMessage.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.transformers; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.util.ClassUtils; import javax.jms.Message; /** * ObjectToJMSMessage will convert any object to a * javax.jms.Message or sub-type into an object. One of the 5 types of * JMS message will be created based on the type of Object passed in. *

    *
  • java.lang.String - javax.jms.TextMessage
  • *
  • byte[] - javax.jms.BytesMessage
  • *
  • java.util.Map - javax.jms.MapMessage
  • *
  • java.io.InputStream - javax.jms.StreamMessage
  • *
  • java.lang.Object - javax.jms.ObjectMessage
  • *
* Note that if compression is turned on then a javax.jms.BytesMessage * is sent. */ public class ObjectToJMSMessage extends AbstractJmsTransformer { public ObjectToJMSMessage() { setReturnClass(Message.class); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { try { if (logger.isDebugEnabled()) { logger.debug("Source object is " + ClassUtils.getSimpleName(message.getPayload().getClass())); } Object result = transformToMessage(message); if (logger.isDebugEnabled()) { logger.debug("Resulting object is " + ClassUtils.getSimpleName(result.getClass())); } return result; } catch (Exception e) { throw new TransformerException(this, e); } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/transformers/JMSMessageToObject.java0000644000175000017500000000623510774040205033307 0ustar charlescharles/* * $Id: JMSMessageToObject.java 11516 2008-03-31 01:38:13Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.transformers; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.util.ClassUtils; import javax.jms.Message; import javax.jms.TextMessage; import javax.jms.ObjectMessage; import javax.jms.BytesMessage; import javax.jms.MapMessage; import javax.jms.StreamMessage; /** * JMSMessageToObject Will convert a javax.jms.Message * or sub-type into an object by extracting the message payload. Users of this * transformer can set different return types on the transform to control the way it * behaves. *
    *
  • javax.jms.TextMessage - java.lang.String
  • *
  • javax.jms.ObjectMessage - java.lang.Object
  • *
  • javax.jms.BytesMessage - Byte[]. Note that the transformer will check if the * payload is compressed and automatically uncompress the message.
  • *
  • javax.jms.MapMessage - java.util.Map
  • *
  • javax.jms.StreamMessage - java.util.Vector of objects from the Stream * Message.
  • *
*/ public class JMSMessageToObject extends AbstractJmsTransformer { public JMSMessageToObject() { super(); registerSourceType(Message.class); registerSourceType(TextMessage.class); registerSourceType(ObjectMessage.class); registerSourceType(BytesMessage.class); registerSourceType(MapMessage.class); registerSourceType(StreamMessage.class); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { try { if (logger.isDebugEnabled()) { logger.debug("Source object is " + ClassUtils.getSimpleName(message.getPayload().getClass())); } Object result = transformFromMessage((Message) message.getPayload()); //We need to handle String / byte[] explicitly since this transformer does not nefine a single return type //TODO I don't think we should allow a null return class if (returnClass != null) { if (returnClass.equals(byte[].class) && result instanceof String) { result = result.toString().getBytes(outputEncoding); } else if (returnClass.equals(String.class) && result instanceof byte[]) { result = new String((byte[]) result, outputEncoding); } } if (logger.isDebugEnabled()) { logger.debug("Resulting object is " + ClassUtils.getSimpleName(result.getClass())); } return result; } catch (Exception e) { throw new TransformerException(this, e); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/transformers/AbstractJmsTransformer.javamule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/transformers/AbstractJmsTransformer.j0000644000175000017500000001745310745677442033714 0ustar charlescharles/* * $Id: AbstractJmsTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.transformers; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.transaction.Transaction; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.Connector; import org.mule.transaction.TransactionCoordination; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.JmsConstants; import org.mule.transport.jms.JmsMessageUtils; import org.mule.util.ClassUtils; import java.util.Iterator; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.Session; /** * AbstractJmsTransformer is an abstract class that should be used for * all transformers where a JMS message will be the transformed or transformee * object. It provides services for compressing and uncompressing messages. */ public abstract class AbstractJmsTransformer extends AbstractMessageAwareTransformer implements DiscoverableTransformer { private int priorityWeighting = DiscoverableTransformer.DEFAULT_PRIORITY_WEIGHTING; public AbstractJmsTransformer() { super(); } protected Message transformToMessage(MuleMessage message) throws TransformerException { Session session = null; try { Message result; Object src = message.getPayload(); if (src instanceof Message) { result = (Message) src; result.clearProperties(); } else { session = this.getSession(); result = JmsMessageUtils.toMessage(src, session); } this.setJmsProperties(message, result); return result; } catch (TransformerException tex) { // rethrow throw tex; } catch (Exception e) { throw new TransformerException(this, e); } finally { /* session.getTransacted() would be easier in most cases, but e.g. in Weblogic 8.x Java EE apps there could be some quirks, see http://forums.bea.com/thread.jspa?threadID=200007643 to get a picture. Though JmsTransaction has this session.getTransacted() validation already, we're taking extra precautions to cover XA cases and potentially to make up for a configuration error. E.g. omitting transaction configuration from an outbound endpoint or router. Note, XA support in Mule will deliberately fail with fanfares to signal this case, which is really a user error. */ if (session != null && endpoint != null) // endpoint can be null in some programmatic tests only in fact { Transaction muleTx = TransactionCoordination.getInstance().getTransaction(); final JmsConnector connector = (JmsConnector) endpoint.getConnector(); if (muleTx == null) { if (logger.isDebugEnabled()) { logger.debug("Closing non-transacted jms session: " + session); } connector.closeQuietly(session); } else if (!muleTx.hasResource(connector.getConnection())) { // this is some other session from another connection, don't let it leak if (logger.isDebugEnabled()) { logger.debug("Closing an orphaned, but transacted jms session: " + session + ", transaction: " + muleTx); } connector.closeQuietly(session); } } // aggressively killing any session refs session = null; } } protected Object transformFromMessage(Message source) throws TransformerException { try { if (logger.isDebugEnabled()) { logger.debug("Message type received is: " + ClassUtils.getSimpleName(source.getClass())); } // Try to figure out our endpoint's JMS Specification and fall back to // 1.0.2 if none is set. String jmsSpec = JmsConstants.JMS_SPECIFICATION_102B; ImmutableEndpoint endpoint = this.getEndpoint(); if (endpoint != null) { Connector connector = endpoint.getConnector(); if (connector instanceof JmsConnector) { jmsSpec = ((JmsConnector) connector).getSpecification(); } } return JmsMessageUtils.toObject(source, jmsSpec); } catch (Exception e) { throw new TransformerException(this, e); } } protected void setJmsProperties(MuleMessage umoMessage, Message msg) throws JMSException { for (Iterator iterator = umoMessage.getPropertyNames().iterator(); iterator.hasNext();) { String key = iterator.next().toString(); if (!JmsConstants.JMS_PROPERTY_NAMES.contains(key)) { Object value = umoMessage.getProperty(key); if (MuleProperties.MULE_CORRELATION_ID_PROPERTY.equals(key)) { msg.setJMSCorrelationID(umoMessage.getCorrelationId()); } // We dont want to set the ReplyTo property again as it will be set // using JMSReplyTo if (!(MuleProperties.MULE_REPLY_TO_PROPERTY.equals(key) && value instanceof Destination)) { // sanitize key as JMS header key = JmsMessageUtils.encodeHeader(key); try { msg.setObjectProperty(key, value); } catch (JMSException e) { // Various JMS servers have slightly different rules to what // can be set as an object property on the message; therefore // we have to take a hit n' hope approach if (logger.isDebugEnabled()) { logger.debug("Unable to set property '" + key + "' of type " + ClassUtils.getSimpleName(value.getClass()) + "': " + e.getMessage()); } } } } } } protected Session getSession() throws TransformerException, JMSException { if (endpoint != null) { return ((JmsConnector) endpoint.getConnector()).getSession(endpoint); } else { throw new TransformerException(this, new IllegalStateException( "This transformer needs a valid endpoint")); } } public int getPriorityWeighting() { return priorityWeighting; } public void setPriorityWeighting(int priorityWeighting) { this.priorityWeighting = priorityWeighting; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageDispatcherFactory.java0000644000175000017500000000175510757615756032615 0ustar charlescharles/* * $Id: JmsMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * JmsMessageDispatcherFactory creates a message adapter that will * send JMS messages */ public class JmsMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new JmsMessageDispatcher(endpoint); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsClientAcknowledgeTransactionFactory.javamule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsClientAcknowledgeTransactionFactor0000644000175000017500000000243110745677442033666 0ustar charlescharles/* * $Id: JmsClientAcknowledgeTransactionFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MuleContext; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transaction.TransactionFactory; /** * JmsClientAcknowledgeTransactionFactory creates a JMS Client * Acknowledge Transaction using a JMS Message. */ public class JmsClientAcknowledgeTransactionFactory implements TransactionFactory { /* * (non-Javadoc) * * @see org.mule.api.TransactionFactory#beginTransaction(java.lang.Object) */ public Transaction beginTransaction(MuleContext muleContext) throws TransactionException { JmsClientAcknowledgeTransaction tx = new JmsClientAcknowledgeTransaction(); tx.begin(); return tx; } public boolean isTransacted() { return false; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/Jms102bSupport.java0000644000175000017500000002167310745677442027731 0ustar charlescharles/* * $Id: Jms102bSupport.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.DeliveryMode; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.QueueSender; import javax.jms.QueueSession; import javax.jms.Session; import javax.jms.Topic; import javax.jms.TopicConnection; import javax.jms.TopicConnectionFactory; import javax.jms.TopicPublisher; import javax.jms.TopicSession; /** * Jms102bSupport is a template class to provide an absstraction * to to the Jms 1.0.2b api specification. * */ public class Jms102bSupport extends Jms11Support { public Jms102bSupport(JmsConnector connector) { super(connector); } public Connection createConnection(ConnectionFactory connectionFactory, String username, String password) throws JMSException { if (connectionFactory == null) { throw new IllegalArgumentException("connectionFactory cannot be null"); } if (connectionFactory instanceof QueueConnectionFactory) { return ((QueueConnectionFactory) connectionFactory).createQueueConnection(username, password); } else if (connectionFactory instanceof TopicConnectionFactory) { return ((TopicConnectionFactory) connectionFactory).createTopicConnection(username, password); } else { throw new IllegalArgumentException("Unsupported ConnectionFactory type: " + connectionFactory.getClass().getName()); } } public Connection createConnection(ConnectionFactory connectionFactory) throws JMSException { if (connectionFactory == null) { throw new IllegalArgumentException("connectionFactory cannot be null"); } if (connectionFactory instanceof QueueConnectionFactory) { return ((QueueConnectionFactory) connectionFactory).createQueueConnection(); } else if (connectionFactory instanceof TopicConnectionFactory) { return ((TopicConnectionFactory) connectionFactory).createTopicConnection(); } else { throw new IllegalArgumentException("Unsupported ConnectionFactory type: " + connectionFactory.getClass().getName()); } } public Session createSession(Connection connection, boolean topic, boolean transacted, int ackMode, boolean noLocal) throws JMSException { if (topic && connection instanceof TopicConnection) { return ((TopicConnection) connection).createTopicSession(noLocal, ackMode); } else if (connection instanceof QueueConnection) { // for transacted sessions the ackMode is always ignored, but // set it for readability (SESSION_TRANSACTION is recommented // for this case). return ((QueueConnection) connection).createQueueSession( transacted, (transacted ? Session.SESSION_TRANSACTED : ackMode)); } else { throw new IllegalArgumentException("Connection and domain type do not match"); } } public MessageConsumer createConsumer(Session session, Destination destination, String messageSelector, boolean noLocal, String durableName, boolean topic) throws JMSException { if (topic && session instanceof TopicSession) { if (durableName == null) { return ((TopicSession) session).createSubscriber((Topic) destination, messageSelector, noLocal); } else { // DO NOT REMOVE THE CAST, breaks Weblogic return ((TopicSession) session).createDurableSubscriber((Topic) destination, durableName, messageSelector, noLocal); } } else if (session instanceof QueueSession) { if (messageSelector != null) { return ((QueueSession) session).createReceiver((Queue) destination, messageSelector); } else { return ((QueueSession) session).createReceiver((Queue) destination); } } else { throw new IllegalArgumentException("MuleSession and domain type do not match"); } } public MessageProducer createProducer(Session session, Destination dest, boolean topic) throws JMSException { if (topic && session instanceof TopicSession) { return ((TopicSession) session).createPublisher((Topic) dest); } else if (session instanceof QueueSession) { return ((QueueSession) session).createSender((Queue) dest); } else { throw new IllegalArgumentException("MuleSession and domain type do not match"); } } public Destination createDestination(Session session, String name, boolean topic) throws JMSException { if (session == null) { throw new IllegalArgumentException("MuleSession cannot be null when creating a destination"); } if (name == null) { throw new IllegalArgumentException("Destination name cannot be null when creating a destination"); } if (topic) { // DO NOT REMOVE THE CAST, BREAKS WEBLOGIC 8.X return ((TopicSession) session).createTopic(name); } else { // DO NOT REMOVE THE CAST, BREAKS WEBLOGIC 8.X return ((QueueSession) session).createQueue(name); } } public Destination createTemporaryDestination(Session session, boolean topic) throws JMSException { if (session == null) { throw new IllegalArgumentException("MuleSession cannot be null when creating a destination"); } if (topic) { // DO NOT REMOVE THE CAST, BREAKS WEBLOGIC 8.X return ((TopicSession) session).createTemporaryTopic(); } else { // DO NOT REMOVE THE CAST, BREAKS WEBLOGIC 8.X return ((QueueSession) session).createTemporaryQueue(); } } public void send(MessageProducer producer, Message message, boolean persistent, int priority, long ttl, boolean topic) throws JMSException { if (topic && producer instanceof TopicPublisher) { ((TopicPublisher) producer).publish( message, (persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT), priority, ttl); } else if (producer instanceof QueueSender) { // DO NOT REMOVE THIS CAST, it breaks Weblogic ((QueueSender) producer).send( message, (persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT), priority, ttl); } else { throw new IllegalArgumentException("Producer and domain type do not match"); } } public void send(MessageProducer producer, Message message, Destination dest, boolean persistent, int priority, long ttl, boolean topic) throws JMSException { if (topic && producer instanceof TopicPublisher) { ((TopicPublisher) producer).publish( (Topic) dest, message, (persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT), priority, ttl); } else if (producer instanceof QueueSender) { ((QueueSender) producer).send( (Queue) dest, message, (persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT), priority, ttl); } else { throw new IllegalArgumentException("Producer and domain type do not match"); } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsTransactionFactory.java0000644000175000017500000000254310745677442031500 0ustar charlescharles/* * $Id: JmsTransactionFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MuleContext; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transaction.TransactionFactory; /** *

* JmsTransactionFactory creates a JMS local transaction */ public class JmsTransactionFactory implements TransactionFactory { private String name; /* * (non-Javadoc) * * @see org.mule.api.TransactionFactory#beginTransaction(org.mule.api.transport.MessageDispatcher) */ public Transaction beginTransaction(MuleContext muleContext) throws TransactionException { JmsTransaction tx = new JmsTransaction(); tx.begin(); return tx; } public boolean isTransacted() { return true; } public String getName() { return name; } public void setName(String name) { this.name = name; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsConstants.java0000644000175000017500000000445610745677442027644 0ustar charlescharles/* * $Id: JmsConstants.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Set; // @ThreadSafe public class JmsConstants { public static final String JMS_SPECIFICATION_102B = "1.0.2b"; public static final String JMS_SPECIFICATION_11 = "1.1"; public static final String JMS_CORRELATION_ID = "JMSCorrelationID"; public static final String JMS_DELIVERY_MODE = "JMSDeliveryMode"; public static final String JMS_DESTINATION = "JMSDestination"; public static final String JMS_EXPIRATION = "JMSExpiration"; public static final String JMS_MESSAGE_ID = "JMSMessageID"; public static final String JMS_PRIORITY = "JMSPriority"; public static final String JMS_REDELIVERED = "JMSRedelivered"; public static final String JMS_REPLY_TO = "JMSReplyTo"; public static final String JMS_TIMESTAMP = "JMSTimestamp"; public static final String JMS_TYPE = "JMSType"; // QoS properties public static final String TIME_TO_LIVE_PROPERTY = "timeToLive"; public static final String PERSISTENT_DELIVERY_PROPERTY = "persistentDelivery"; public static final String PRIORITY_PROPERTY = "priority"; public static final String JMS_SELECTOR_PROPERTY = "selector"; public static final String TOPIC_PROPERTY = "topic"; public static final String DURABLE_PROPERTY = "durable"; public static final String DURABLE_NAME_PROPERTY = "durableName"; public static final String CACHE_JMS_SESSIONS_PROPERTY = "cacheJmsSessions"; public static final Set JMS_PROPERTY_NAMES = Collections.unmodifiableSet(new HashSet( Arrays.asList(new String[]{JMS_SPECIFICATION_102B, JMS_SPECIFICATION_11, JMS_CORRELATION_ID, JMS_DELIVERY_MODE, JMS_DELIVERY_MODE, JMS_DESTINATION, JMS_EXPIRATION, JMS_MESSAGE_ID, JMS_PRIORITY, JMS_REDELIVERED, JMS_REPLY_TO, JMS_TIMESTAMP, JMS_TYPE, JMS_SELECTOR_PROPERTY}))); } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageUtils.java0000644000175000017500000002746110745677442030276 0ustar charlescharles/* * $Id: JmsMessageUtils.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.util.ArrayUtils; import org.mule.util.ClassUtils; import org.mule.util.StringUtils; import java.io.IOException; import java.io.InputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import java.util.Vector; import javax.jms.BytesMessage; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.MapMessage; import javax.jms.Message; import javax.jms.MessageEOFException; import javax.jms.ObjectMessage; import javax.jms.Queue; import javax.jms.Session; import javax.jms.StreamMessage; import javax.jms.TextMessage; import javax.jms.Topic; import org.apache.commons.io.output.ByteArrayOutputStream; /** * JmsMessageUtils contains helper method for dealing with JMS * messages in Mule. */ public class JmsMessageUtils { public static final char REPLACEMENT_CHAR = '_'; /** * Encode a String so that is is a valid JMS header name * * @param name the String to encode * @return a valid JMS header name */ public static String encodeHeader(String name) { if (StringUtils.isEmpty(name)) { throw new IllegalArgumentException("Header name to encode must not be null or empty"); } int i = 0, length = name.length(); while (i < length && Character.isJavaIdentifierPart(name.charAt(i))) { // zip through i++; } if (i == length) { // String is already valid return name; } else { // make a copy, fix up remaining characters StringBuffer sb = new StringBuffer(name); for (int j = i; j < length; j++) { if (!Character.isJavaIdentifierPart(sb.charAt(j))) { sb.setCharAt(j, REPLACEMENT_CHAR); } } return sb.toString(); } } public static Message toMessage(Object object, Session session) throws JMSException { if (object instanceof Message) { return (Message)object; } else if (object instanceof String) { return session.createTextMessage((String)object); } else if (object instanceof Map) { MapMessage mMsg = session.createMapMessage(); Map src = (Map)object; for (Iterator i = src.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry)i.next(); mMsg.setObject(entry.getKey().toString(), entry.getValue()); } return mMsg; } else if (object instanceof InputStream) { StreamMessage sMsg = session.createStreamMessage(); InputStream temp = (InputStream)object; byte[] buffer = new byte[4096]; int len; try { while ((len = temp.read(buffer)) != -1) { sMsg.writeBytes(buffer, 0, len); } } catch (IOException e) { throw new JMSException("Failed to read input stream to create a stream message: " + e); } return sMsg; } else if (object instanceof byte[]) { BytesMessage bMsg = session.createBytesMessage(); bMsg.writeBytes((byte[])object); return bMsg; } else if (object instanceof Serializable) { ObjectMessage oMsg = session.createObjectMessage(); oMsg.setObject((Serializable)object); return oMsg; } else { throw new JMSException( "Source was not of a supported type, data must be Serializable, String, byte[], Map or InputStream, " + "but was " + ClassUtils.getShortClassName(object, "")); } } public static Object toObject(Message source, String jmsSpec) throws JMSException, IOException { if (source instanceof ObjectMessage) { return ((ObjectMessage)source).getObject(); } else if (source instanceof MapMessage) { Hashtable map = new Hashtable(); MapMessage m = (MapMessage)source; for (Enumeration e = m.getMapNames(); e.hasMoreElements();) { String name = (String)e.nextElement(); Object obj = m.getObject(name); map.put(name, obj); } return map; } else if (source instanceof TextMessage) { return ((TextMessage)source).getText(); } else if (source instanceof BytesMessage) { return toByteArray(source, jmsSpec); } else if (source instanceof StreamMessage) { try { StreamMessage sMsg = (StreamMessage)source; Vector result = new Vector(); Object obj; while ((obj = sMsg.readObject()) != null) { result.addElement(obj); } return result; } catch (MessageEOFException eof) { // ignored } catch (Exception e) { throw new JMSException("Failed to extract information from JMS Stream Message: " + e); } } // what else is there to do? return source; } /** * @param message the message to receive the bytes from. Note this only works for * TextMessge, ObjectMessage, StreamMessage and BytesMessage. * @param jmsSpec indicates the JMS API version, either * {@link JmsConstants#JMS_SPECIFICATION_102B} or * {@link JmsConstants#JMS_SPECIFICATION_11}. Any other value * including null is treated as fallback to * {@link JmsConstants#JMS_SPECIFICATION_102B}. * @return a byte array corresponding with the message payload * @throws JMSException if the message can't be read or if the message passed is * a MapMessage * @throws java.io.IOException if a failure occurs while reading the stream and * converting the message data */ public static byte[] toByteArray(Message message, String jmsSpec) throws JMSException, IOException { if (message instanceof BytesMessage) { BytesMessage bMsg = (BytesMessage)message; bMsg.reset(); if (JmsConstants.JMS_SPECIFICATION_11.equals(jmsSpec)) { long bmBodyLength = bMsg.getBodyLength(); if (bmBodyLength > Integer.MAX_VALUE) { throw new JMSException("Size of BytesMessage exceeds Integer.MAX_VALUE; " + "please consider using JMS StreamMessage instead"); } if (bmBodyLength > 0) { byte[] bytes = new byte[(int)bmBodyLength]; bMsg.readBytes(bytes); return bytes; } else { return ArrayUtils.EMPTY_BYTE_ARRAY; } } else { ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); byte[] buffer = new byte[4096]; int len; while ((len = bMsg.readBytes(buffer)) != -1) { baos.write(buffer, 0, len); } if (baos.size() > 0) { return baos.toByteArray(); } else { return ArrayUtils.EMPTY_BYTE_ARRAY; } } } else if (message instanceof StreamMessage) { StreamMessage sMsg = (StreamMessage)message; sMsg.reset(); ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); byte[] buffer = new byte[4096]; int len; while ((len = sMsg.readBytes(buffer)) != -1) { baos.write(buffer, 0, len); } return baos.toByteArray(); } else if (message instanceof ObjectMessage) { ObjectMessage oMsg = (ObjectMessage)message; ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream os = new ObjectOutputStream(baos); os.writeObject(oMsg.getObject()); os.flush(); os.close(); return baos.toByteArray(); } else if (message instanceof TextMessage) { TextMessage tMsg = (TextMessage)message; String tMsgText = tMsg.getText(); if (null == tMsgText) { // Avoid creating new instances of byte arrays, even empty ones. The // load on this part of the code can be high. return ArrayUtils.EMPTY_BYTE_ARRAY; } else { return tMsgText.getBytes(); } } else { throw new JMSException("Cannot get bytes from Map Message"); } } public static String getNameForDestination(Destination dest) throws JMSException { if (dest instanceof Queue) { return ((Queue)dest).getQueueName(); } else if (dest instanceof Topic) { return ((Topic)dest).getTopicName(); } else { return null; } } public static Message copyJMSProperties(Message from, Message to, JmsConnector connector) throws JMSException { if (connector.supportsProperty(JmsConstants.JMS_CORRELATION_ID)) { to.setJMSCorrelationID(from.getJMSCorrelationID()); } if (connector.supportsProperty(JmsConstants.JMS_DELIVERY_MODE)) { to.setJMSDeliveryMode(from.getJMSDeliveryMode()); } if (connector.supportsProperty(JmsConstants.JMS_DESTINATION)) { to.setJMSDestination(from.getJMSDestination()); } if (connector.supportsProperty(JmsConstants.JMS_EXPIRATION)) { to.setJMSExpiration(from.getJMSExpiration()); } if (connector.supportsProperty(JmsConstants.JMS_MESSAGE_ID)) { to.setJMSMessageID(from.getJMSMessageID()); } if (connector.supportsProperty(JmsConstants.JMS_PRIORITY)) { to.setJMSPriority(from.getJMSPriority()); } if (connector.supportsProperty(JmsConstants.JMS_REDELIVERED)) { to.setJMSRedelivered(from.getJMSRedelivered()); } if (connector.supportsProperty(JmsConstants.JMS_REPLY_TO)) { to.setJMSReplyTo(from.getJMSReplyTo()); } if (connector.supportsProperty(JmsConstants.JMS_TIMESTAMP)) { to.setJMSTimestamp(from.getJMSTimestamp()); } if (connector.supportsProperty(JmsConstants.JMS_TYPE)) { to.setJMSType(from.getJMSType()); } return to; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/activemq/0000755000175000017500000000000011351410655026134 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/activemq/package.html0000644000175000017500000000020110745677442030425 0ustar charlescharles Provides Jms connectivity with ActiveMQ-specific workarounds and improvements. mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/activemq/ActiveMQXAJmsConnector.java0000644000175000017500000000233510754365306033241 0ustar charlescharles/* * $Id: ActiveMQXAJmsConnector.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.activemq; import org.mule.util.ClassUtils; import javax.jms.ConnectionFactory; public class ActiveMQXAJmsConnector extends ActiveMQJmsConnector { public static final String ACTIVEMQ_XA_CONNECTION_FACTORY_CLASS = "org.apache.activemq.ActiveMQXAConnectionFactory"; protected ConnectionFactory getDefaultConnectionFactory() { try { ConnectionFactory connectionFactory = (ConnectionFactory) ClassUtils.instanciateClass(ACTIVEMQ_XA_CONNECTION_FACTORY_CLASS, new Object[]{getBrokerURL()}); applyVendorSpecificConnectionFactoryProperties(connectionFactory); return connectionFactory; } catch (Exception e) { logger.warn(e); return null; } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/activemq/ActiveMQJmsConnector.java0000644000175000017500000001110010755041255032771 0ustar charlescharles/* * $Id: ActiveMQJmsConnector.java 10803 2008-02-14 13:31:25Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.activemq; import org.mule.transport.ConnectException; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.xa.ConnectionInvocationHandler; import org.mule.util.ClassUtils; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import javax.jms.Connection; import javax.jms.ConnectionFactory; /** * ActiveMQ 4.x-specific JMS connector. */ public class ActiveMQJmsConnector extends JmsConnector { public static final String ACTIVEMQ_CONNECTION_FACTORY_CLASS = "org.apache.activemq.ActiveMQConnectionFactory"; public static final String DEFAULT_BROKER_URL = "vm://localhost?broker.persistent=false&broker.useJmx=false"; private String brokerURL = DEFAULT_BROKER_URL; /** * Constructs a new ActiveMQJmsConnector. */ public ActiveMQJmsConnector() { setEagerConsumer(false); // TODO MULE-1409 better support for ActiveMQ 4.x temp destinations } protected ConnectionFactory getDefaultConnectionFactory() { try { ConnectionFactory connectionFactory = (ConnectionFactory) ClassUtils.instanciateClass(ACTIVEMQ_CONNECTION_FACTORY_CLASS, new Object[]{getBrokerURL()}); applyVendorSpecificConnectionFactoryProperties(connectionFactory); return connectionFactory; } catch (Exception e) { handleException(e); return null; } } protected void applyVendorSpecificConnectionFactoryProperties(ConnectionFactory connectionFactory) { try { Method getRedeliveryPolicyMethod = connectionFactory.getClass().getMethod("getRedeliveryPolicy", new Class[]{}); Object redeliveryPolicy = getRedeliveryPolicyMethod.invoke(connectionFactory, new Object[]{}); Method setMaximumRedeliveriesMethod = redeliveryPolicy.getClass().getMethod("setMaximumRedeliveries", new Class[]{Integer.TYPE}); setMaximumRedeliveriesMethod.invoke(redeliveryPolicy, new Object[]{new Integer(getMaxRedelivery())}); } catch (Exception e) { logger.error("Can not set MaxRedelivery parameter to RedeliveryPolicy " + e); } } /** * Will additionally try to cleanup the ActiveMq connection, otherwise there's a deadlock on shutdown. */ protected void doDisconnect() throws ConnectException { try { Connection connection = getConnection(); if (connection == null) { return; } final Class clazz = connection.getClass(); Method cleanupMethod; if (Proxy.isProxyClass(clazz)) { ConnectionInvocationHandler handler = (ConnectionInvocationHandler) Proxy.getInvocationHandler(connection); // this is really an XA connection, bypass the java.lang.reflect.Proxy as it // can't delegate to non-interfaced methods (like proprietary 'cleanup' one) // TODO check if CGlib will manage to enhance the AMQ connection class, // there are no final methods, but a number of private ones, though connection = (Connection) handler.getTargetObject(); Class realConnectionClass = connection.getClass(); cleanupMethod = realConnectionClass.getMethod("cleanup", (Class[])null); } else { cleanupMethod = clazz.getMethod("cleanup", (Class[])null); } try { if (cleanupMethod != null) { cleanupMethod.invoke(connection, (Object[])null); } } finally { connection.close(); } } catch (Exception e) { throw new ConnectException(e, this); } finally { setConnection(null); } } public String getBrokerURL() { return brokerURL; } public void setBrokerURL(String brokerURL) { this.brokerURL = brokerURL; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsExceptionReader.java0000644000175000017500000000315410745677442030743 0ustar charlescharles/* * $Id: JmsExceptionReader.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.config.ExceptionReader; import java.util.HashMap; import java.util.Map; import javax.jms.JMSException; /** * This reader will ensure that the LinkedException and JMS code is not lost when * printing the JMSException. */ public class JmsExceptionReader implements ExceptionReader { public String getMessage(Throwable t) { JMSException e = (JMSException)t; return e.getMessage() + "(JMS Code: " + e.getErrorCode() + ")"; } public Throwable getCause(Throwable t) { JMSException e = (JMSException)t; Throwable cause = e.getLinkedException(); if (cause == null) { cause = e.getCause(); } return cause; } public Class getExceptionType() { return JMSException.class; } /** * Returns a map of the non-stanard information stored on the exception * * @return a map of the non-stanard information stored on the exception */ public Map getInfo(Throwable t) { JMSException e = (JMSException)t; Map info = new HashMap(); info.put("JMS Code", e.getErrorCode()); return info; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageReceiver.java0000644000175000017500000002124211002071522030677 0ustar charlescharles/* * $Id: JmsMessageReceiver.java 11592 2008-04-18 10:09:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.LifecycleException; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transport.Connector; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.AbstractReceiverWorker; import org.mule.transport.ConnectException; import org.mule.transport.jms.filters.JmsSelectorFilter; import org.mule.util.ClassUtils; import java.util.ArrayList; import java.util.List; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.Session; import javax.jms.Topic; /** * Registers a single JmsMessage listener but uses a thread pool to process incoming * messages */ public class JmsMessageReceiver extends AbstractMessageReceiver implements MessageListener { protected JmsConnector connector; protected RedeliveryHandler redeliveryHandler; protected MessageConsumer consumer; protected Session session; protected boolean startOnConnect = false; public JmsMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); this.connector = (JmsConnector) connector; try { redeliveryHandler = this.connector.getRedeliveryHandlerFactory().create(); redeliveryHandler.setConnector(this.connector); } catch (Exception e) { throw new CreateException(e, this); } } protected void doConnect() throws Exception { createConsumer(); if (startOnConnect) { doStart(); } } protected void doDisconnect() throws Exception { closeConsumer(); } public void onMessage(Message message) { try { getWorkManager().scheduleWork(new JmsWorker(message, this)); } catch (Exception e) { handleException(e); } } protected class JmsWorker extends AbstractReceiverWorker { public JmsWorker(Message message, AbstractMessageReceiver receiver) { super(new ArrayList(1), receiver); messages.add(message); } public JmsWorker(List messages, AbstractMessageReceiver receiver) { super(messages, receiver); } //@Override protected Object preProcessMessage(Object message) throws Exception { Message m = (Message) message; if (logger.isDebugEnabled()) { logger.debug("Message received it is of type: " + ClassUtils.getSimpleName(message.getClass())); if (m.getJMSDestination() != null) { logger.debug("Message received on " + m.getJMSDestination() + " (" + m.getJMSDestination().getClass().getName() + ")"); } else { logger.debug("Message received on unknown destination"); } logger.debug("Message CorrelationId is: " + m.getJMSCorrelationID()); logger.debug("Jms Message Id is: " + m.getJMSMessageID()); } if (m.getJMSRedelivered() && redeliveryHandler != null) { if (logger.isDebugEnabled()) { logger.debug("Message with correlationId: " + m.getJMSCorrelationID() + " has redelivered flag set, handing off to Exception Handler"); } redeliveryHandler.handleRedelivery(m); } return m; } protected void bindTransaction(Transaction tx) throws TransactionException { if(tx instanceof JmsTransaction) { tx.bindResource(connector.getConnection(), session); } else if(tx instanceof JmsClientAcknowledgeTransaction) { //We should still bind the session to the transaction, but we also need the message itself //since that is the object that gets Acknowledged tx.bindResource(connector.getConnection(), session); ((JmsClientAcknowledgeTransaction)tx).setMessage((Message)messages.get(0)); } } } protected void doStart() throws MuleException { try { // We ned to register the listener when start is called in order to only // start receiving messages after // start/ // If the consumer is null it means that the connection strategy is being // run in a separate thread // And hasn't managed to connect yet. if (consumer == null) { startOnConnect = true; } else { startOnConnect = false; consumer.setMessageListener(this); } } catch (JMSException e) { throw new LifecycleException(e, this); } } protected void doStop() throws MuleException { try { if (consumer != null) { consumer.setMessageListener(null); } } catch (JMSException e) { throw new LifecycleException(e, this); } } protected void doDispose() { // template method } protected void closeConsumer() { connector.closeQuietly(consumer); consumer = null; connector.closeQuietly(session); session = null; } /** * Create a consumer for the jms destination * * @throws Exception */ protected void createConsumer() throws Exception { try { JmsSupport jmsSupport = this.connector.getJmsSupport(); // Create session if none exists if (session == null) { session = this.connector.getSession(endpoint); } boolean topic = connector.getTopicResolver().isTopic(endpoint, true); // Create destination Destination dest = jmsSupport.createDestination(session, endpoint.getEndpointURI().getAddress(), topic); // Extract jms selector String selector = null; if (endpoint.getFilter() != null && endpoint.getFilter() instanceof JmsSelectorFilter) { selector = ((JmsSelectorFilter) endpoint.getFilter()).getExpression(); } else if (endpoint.getProperties() != null) { // still allow the selector to be set as a property on the endpoint // to be backward compatable selector = (String) endpoint.getProperties().get(JmsConstants.JMS_SELECTOR_PROPERTY); } String tempDurable = (String) endpoint.getProperties().get(JmsConstants.DURABLE_PROPERTY); boolean durable = connector.isDurable(); if (tempDurable != null) { durable = Boolean.valueOf(tempDurable).booleanValue(); } // Get the durable subscriber name if there is one String durableName = (String) endpoint.getProperties().get(JmsConstants.DURABLE_NAME_PROPERTY); if (durableName == null && durable && dest instanceof Topic) { durableName = "mule." + connector.getName() + "." + endpoint.getEndpointURI().getAddress(); logger.debug("Jms Connector for this receiver is durable but no durable name has been specified. Defaulting to: " + durableName); } // Create consumer consumer = jmsSupport.createConsumer(session, dest, selector, connector.isNoLocal(), durableName, topic); } catch (JMSException e) { throw new ConnectException(e, this); } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/i18n/0000755000175000017500000000000011351410655025102 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/i18n/JmsMessages.java0000644000175000017500000000462110745677442030210 0ustar charlescharles/* * $Id: JmsMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; import org.mule.transport.jms.JmsMessageAdapter; import org.mule.util.ClassUtils; import org.mule.util.ObjectUtils; import org.mule.util.StringMessageUtils; public class JmsMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("jms"); public static Message connectorDoesNotSupportSyncReceiveWhenTransacted() { return createMessage(BUNDLE_PATH, 2); } public static Message sessionShouldBeTransacted() { return createMessage(BUNDLE_PATH, 4); } public static Message sessionShouldNotBeTransacted() { return createMessage(BUNDLE_PATH, 5); } public static Message noMessageBoundForAck() { return createMessage(BUNDLE_PATH, 6); } public static Message messageMarkedForRedelivery(JmsMessageAdapter jmsMessage) { String messageDescription = (jmsMessage == null) ? "[null message]" : jmsMessage.getUniqueId(); return createMessage(BUNDLE_PATH, 7, messageDescription); } public static Message failedToCreateAndDispatchResponse(Object object) { return createMessage(BUNDLE_PATH, 8, ObjectUtils.toString(object, "null")); } public static Message tooManyRedeliveries(String id, String times) { return createMessage(BUNDLE_PATH, 11, id, times); } public static Message invalidResourceType(Class expectedClass, Class actualClass) { return createMessage(BUNDLE_PATH, 12, StringMessageUtils.toString(expectedClass), StringMessageUtils.toString(actualClass)); } public static Message checkTransformer(String string, Class class1, String name) { return createMessage(BUNDLE_PATH, 13, string, ClassUtils.getSimpleName(class1.getClass()), name); } public static Message noConnectionFactorySet() { return createMessage(BUNDLE_PATH, 14); } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/XaTransactedJmsMessageReceiver.java0000644000175000017500000003165611002071522033213 0ustar charlescharles/* * $Id: XaTransactedJmsMessageReceiver.java 11592 2008-04-18 10:09:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.DefaultMuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import org.mule.transaction.TransactionCoordination; import org.mule.transaction.XaTransaction; import org.mule.transport.ConnectException; import org.mule.transport.SingleAttemptConnectionStrategy; import org.mule.transport.TransactedPollingMessageReceiver; import org.mule.transport.jms.filters.JmsSelectorFilter; import org.mule.util.ClassUtils; import org.mule.util.MapUtils; import java.util.List; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.Session; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class XaTransactedJmsMessageReceiver extends TransactedPollingMessageReceiver { public static final long DEFAULT_JMS_POLL_FREQUENCY = 100; public static final TimeUnit DEFAULT_JMS_POLL_TIMEUNIT = TimeUnit.MILLISECONDS; protected final JmsConnector connector; protected boolean reuseConsumer; protected boolean reuseSession; protected final ThreadContextLocal context = new ThreadContextLocal(); protected final long timeout; protected final RedeliveryHandler redeliveryHandler; /** * Holder receiving the session and consumer for this thread. */ protected static class JmsThreadContext { public Session session; public MessageConsumer consumer; } /** * Strongly typed ThreadLocal for ThreadContext. */ protected static class ThreadContextLocal extends ThreadLocal { public JmsThreadContext getContext() { return (JmsThreadContext)get(); } protected Object initialValue() { return new JmsThreadContext(); } } public XaTransactedJmsMessageReceiver(Connector umoConnector, Service service, InboundEndpoint endpoint) throws CreateException { super(umoConnector, service, endpoint); // TODO AP: find appropriate value for polling frequency with the scheduler; // see setFrequency/setTimeUnit & VMMessageReceiver for more this.setFrequency(DEFAULT_JMS_POLL_FREQUENCY); this.setTimeUnit(DEFAULT_JMS_POLL_TIMEUNIT); this.connector = (JmsConnector) umoConnector; this.timeout = endpoint.getTransactionConfig().getTimeout(); // If reconnection is set, default reuse strategy to false // as some jms brokers will not detect lost connections if the // same consumer / session is used if (this.connectionStrategy instanceof SingleAttemptConnectionStrategy) { this.reuseConsumer = true; this.reuseSession = true; } // User may override reuse strategy if necessary this.reuseConsumer = MapUtils.getBooleanValue(endpoint.getProperties(), "reuseConsumer", this.reuseConsumer); this.reuseSession = MapUtils.getBooleanValue(endpoint.getProperties(), "reuseSession", this.reuseSession); // Do extra validation, XA Topic & reuse are incompatible. See MULE-2622 boolean topic = connector.getTopicResolver().isTopic(getEndpoint()); if (topic && (reuseConsumer || reuseSession)) { logger.warn("Destination " + getEndpoint().getEndpointURI() + " is a topic and XA transaction was " + "configured. Forcing 'reuseSession' and 'reuseConsumer' to false. Set these " + "on endpoint to avoid the message."); reuseConsumer = false; reuseSession = false; } // Check if the destination is a queue and // if we are in transactional mode. // If true, set receiveMessagesInTransaction to true. // It will start multiple threads, depending on the threading profile. // If we're using topics we don't want to use multiple receivers as we'll get // the same message multiple times this.setUseMultipleTransactedReceivers(!topic); try { redeliveryHandler = this.connector.getRedeliveryHandlerFactory().create(); redeliveryHandler.setConnector(this.connector); } catch (Exception e) { throw new CreateException(e, this); } } protected void doDispose() { // template method } protected void doConnect() throws Exception { if (connector.isConnected() && connector.isEagerConsumer()) { createConsumer(); // creating this consumer now would prevent from the actual worker // consumer // to receive the message! //Antoine Borg 08 Dec 2006 - Uncommented for MULE-1150 // if we comment this line, if one tries to restart the service through // JMX, // this will fail... //This Line seems to be the root to a number of problems and differences between //Jms providers. A which point the consumer is created changes how the conneciton can be managed. //For example, WebsphereMQ needs the consumer created here, otherwise ReconnectionStrategies don't work properly //(See MULE-1150) However, is the consumer is created here for Active MQ, The worker thread cannot actually //receive the message. We need to test with a few more Jms providers and transactions to see which behaviour // is correct. My gut feeling is that the consumer should be created here and there is a bug in ActiveMQ } } protected void doDisconnect() throws Exception { if (connector.isConnected()) { closeConsumer(true); } } /** * The poll method is overriden from the {@link TransactedPollingMessageReceiver} */ public void poll() throws Exception { try { JmsThreadContext ctx = context.getContext(); // Create consumer if necessary if (ctx.consumer == null) { createConsumer(); } // Do polling super.poll(); } catch (Exception e) { // Force consumer to close closeConsumer(true); throw e; } finally { // Close consumer if necessary closeConsumer(false); } } /* * (non-Javadoc) * * @see org.mule.transport.TransactionEnabledPollingMessageReceiver#getMessages() */ protected List getMessages() throws Exception { // As the session is created outside the transaction, it is not // bound to it yet JmsThreadContext ctx = context.getContext(); Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (tx != null) { tx.bindResource(connector.getConnection(), ctx.session); } // Retrieve message Message message = null; try { message = ctx.consumer.receive(timeout); } catch (JMSException e) { // If we're being disconnected, ignore the exception if (!this.isConnected()) { // ignore } else { throw e; } } if (message == null) { if (tx != null) { tx.setRollbackOnly(); } return null; } message = connector.preProcessMessage(message, ctx.session); // Process message if (logger.isDebugEnabled()) { logger.debug("Message received it is of type: " + ClassUtils.getSimpleName(message.getClass())); if (message.getJMSDestination() != null) { logger.debug("Message received on " + message.getJMSDestination() + " (" + message.getJMSDestination().getClass().getName() + ")"); } else { logger.debug("Message received on unknown destination"); } logger.debug("Message CorrelationId is: " + message.getJMSCorrelationID()); logger.debug("Jms Message Id is: " + message.getJMSMessageID()); } if (message.getJMSRedelivered()) { if (logger.isDebugEnabled()) { logger.debug("Message with correlationId: " + message.getJMSCorrelationID() + " is redelivered. handing off to Exception Handler"); } redeliveryHandler.handleRedelivery(message); } if (tx instanceof JmsClientAcknowledgeTransaction) { tx.bindResource(message, null); } MessageAdapter adapter = connector.getMessageAdapter(message); routeMessage(new DefaultMuleMessage(adapter)); return null; } /* * (non-Javadoc) * * @see org.mule.transport.TransactionEnabledPollingMessageReceiver#processMessage(java.lang.Object) */ protected void processMessage(Object msg) throws Exception { // This method is never called as the // message is processed when received } protected void closeConsumer(boolean force) { JmsThreadContext ctx = context.getContext(); if (ctx == null) { return; } // Close consumer if (force || !reuseSession || !reuseConsumer) { connector.closeQuietly(ctx.consumer); ctx.consumer = null; } // Do not close session if a transaction is in progress // the session will be closed by the transaction if (force || !reuseSession) { connector.closeQuietly(ctx.session); ctx.session = null; } } /** * Create a consumer for the jms destination * * @throws Exception */ protected void createConsumer() throws Exception { try { JmsSupport jmsSupport = this.connector.getJmsSupport(); JmsThreadContext ctx = context.getContext(); // Create session if none exists if (ctx.session == null) { ctx.session = this.connector.getSession(endpoint); //set reuse flag ((XaTransaction.MuleXaObject) ctx.session).setReuseObject(reuseSession); } // Create destination final boolean topic = connector.getTopicResolver().isTopic(endpoint); Destination dest = jmsSupport.createDestination(ctx.session, endpoint.getEndpointURI() .getAddress(), topic); // Extract jms selector String selector = null; if (endpoint.getFilter() != null && endpoint.getFilter() instanceof JmsSelectorFilter) { selector = ((JmsSelectorFilter)endpoint.getFilter()).getExpression(); } else if (endpoint.getProperties() != null) { // still allow the selector to be set as a property on the endpoint // to be backward compatible selector = (String)endpoint.getProperties().get(JmsConstants.JMS_SELECTOR_PROPERTY); } String tempDurable = (String)endpoint.getProperties().get("durable"); boolean durable = connector.isDurable(); if (tempDurable != null) { durable = Boolean.valueOf(tempDurable).booleanValue(); } // Get the durable subscriber name if there is one String durableName = (String)endpoint.getProperties().get("durableName"); if (durableName == null && durable && topic) { durableName = "mule." + connector.getName() + "." + endpoint.getEndpointURI().getAddress(); logger.debug("Jms Connector for this receiver is durable but no durable name has been specified. Defaulting to: " + durableName); } // Create consumer ctx.consumer = jmsSupport.createConsumer(ctx.session, dest, selector, connector.isNoLocal(), durableName, topic); } catch (JMSException e) { throw new ConnectException(e, this); } } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/TransactedSingleResourceJmsMessageReceiver.javamule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/TransactedSingleResourceJmsMessageRec0000644000175000017500000002457411002071522033622 0ustar charlescharles/* * $Id: TransactedSingleResourceJmsMessageReceiver.java 11592 2008-04-18 10:09:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.StartException; import org.mule.api.lifecycle.StopException; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionCallback; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import org.mule.transaction.TransactionCoordination; import org.mule.transaction.TransactionTemplate; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.ConnectException; import org.mule.transport.jms.filters.JmsSelectorFilter; import org.mule.util.ClassUtils; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.Session; import javax.jms.Topic; import javax.resource.spi.work.Work; public class TransactedSingleResourceJmsMessageReceiver extends AbstractMessageReceiver implements MessageListener { protected JmsConnector connector; protected RedeliveryHandler redeliveryHandler; protected MessageConsumer consumer; protected Session session; protected boolean startOnConnect = false; /** determines whether messages will be received in a transaction template */ protected boolean receiveMessagesInTransaction = true; /** determines whether Multiple receivers are created to improve throughput */ protected boolean useMultipleReceivers = true; /** * @param connector * @param service * @param endpoint * @throws InitialisationException */ public TransactedSingleResourceJmsMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); this.connector = (JmsConnector) connector; // TODO check which properties being set in the TransecteJmsMessage receiver // are needed... try { redeliveryHandler = this.connector.getRedeliveryHandlerFactory().create(); redeliveryHandler.setConnector(this.connector); } catch (Exception e) { throw new CreateException(e, this); } } protected void doDispose() { // template method } protected void doConnect() throws Exception { try { JmsSupport jmsSupport = this.connector.getJmsSupport(); // Create session if none exists if (session == null) { session = this.connector.getSession(endpoint); } // Create destination boolean topic = connector.getTopicResolver().isTopic(endpoint, true); Destination dest = jmsSupport.createDestination(session, endpoint.getEndpointURI().getAddress(), topic); // Extract jms selector String selector = null; if (endpoint.getFilter() != null && endpoint.getFilter() instanceof JmsSelectorFilter) { selector = ((JmsSelectorFilter) endpoint.getFilter()).getExpression(); } else if (endpoint.getProperties() != null) { // still allow the selector to be set as a property on the endpoint // to be backward compatable selector = (String) endpoint.getProperties().get(JmsConstants.JMS_SELECTOR_PROPERTY); } String tempDurable = (String) endpoint.getProperties().get(JmsConstants.DURABLE_PROPERTY); boolean durable = connector.isDurable(); if (tempDurable != null) { durable = Boolean.valueOf(tempDurable).booleanValue(); } // Get the durable subscriber name if there is one String durableName = (String) endpoint.getProperties().get(JmsConstants.DURABLE_NAME_PROPERTY); if (durableName == null && durable && dest instanceof Topic) { durableName = "mule." + connector.getName() + "." + endpoint.getEndpointURI().getAddress(); logger.debug("Jms Connector for this receiver is durable but no durable name has been specified. Defaulting to: " + durableName); } // Create consumer consumer = jmsSupport.createConsumer(session, dest, selector, connector.isNoLocal(), durableName, topic); } catch (JMSException e) { throw new ConnectException(e, this); } } protected void doStart() throws MuleException { try { // We ned to register the listener when start is called in order to only // start receiving messages after start. // If the consumer is null it means that the connection strategy is being // run in a separate thread and hasn't managed to connect yet. if (consumer == null) { startOnConnect = true; } else { startOnConnect = false; this.consumer.setMessageListener(this); } } catch (JMSException e) { throw new StartException(e, this); } } protected void doStop() throws MuleException { try { if (consumer != null) { consumer.setMessageListener(null); } } catch (JMSException e) { throw new StopException(e, this); } } public void doDisconnect() throws Exception { closeConsumer(); } protected void closeConsumer() { connector.closeQuietly(consumer); consumer = null; connector.closeQuietly(session); session = null; } public void onMessage(Message message) { try { getWorkManager().scheduleWork(new MessageReceiverWorker(message)); } catch (Exception e) { handleException(e); } } protected class MessageReceiverWorker implements Work { Message message; public MessageReceiverWorker(Message message) { this.message = message; } public void run() { try { TransactionTemplate tt = new TransactionTemplate(endpoint.getTransactionConfig(), connector.getExceptionListener(), connector.getMuleContext()); if (receiveMessagesInTransaction) { TransactionCallback cb = new MessageTransactionCallback(message) { public Object doInTransaction() throws Exception { // Get Transaction & Bind MuleSession Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (tx != null) { tx.bindResource(connector.getConnection(), session); } if (tx instanceof JmsClientAcknowledgeTransaction) { tx.bindResource(message, message); } if (logger.isDebugEnabled()) { logger.debug("Message received it is of type: " + ClassUtils.getSimpleName(message.getClass())); if (message.getJMSDestination() != null) { logger.debug("Message received on " + message.getJMSDestination() + " (" + message.getJMSDestination().getClass().getName() + ")"); } else { logger.debug("Message received on unknown destination"); } logger.debug("Message CorrelationId is: " + message.getJMSCorrelationID()); logger.debug("Jms Message Id is: " + message.getJMSMessageID()); } if (message.getJMSRedelivered()) { if (logger.isDebugEnabled()) { logger.debug("Message with correlationId: " + message.getJMSCorrelationID() + " is redelivered. handing off to Exception Handler"); } redeliveryHandler.handleRedelivery(message); } MessageAdapter adapter = connector.getMessageAdapter(message); routeMessage(new DefaultMuleMessage(adapter)); return null; } }; tt.execute(cb); } else { MessageAdapter adapter = connector.getMessageAdapter(message); routeMessage(new DefaultMuleMessage(adapter)); } } catch (Exception e) { getConnector().handleException(e); } } public void release() { // Nothing to release. } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsConnector.java0000644000175000017500000006022111004110772027563 0ustar charlescharles/* * $Id: JmsConnector.java 11640 2008-04-24 13:58:18Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MessagingException; import org.mule.api.MuleException; import org.mule.api.context.notification.ConnectionNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.StartException; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.ReplyToHandler; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.ConnectionNotification; import org.mule.context.notification.NotificationException; import org.mule.transaction.TransactionCoordination; import org.mule.transport.AbstractConnector; import org.mule.transport.ConnectException; import org.mule.transport.FatalConnectException; import org.mule.transport.jms.i18n.JmsMessages; import org.mule.transport.jms.xa.ConnectionFactoryWrapper; import java.text.MessageFormat; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.ExceptionListener; import javax.jms.JMSException; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TemporaryQueue; import javax.jms.TemporaryTopic; import javax.jms.XAConnectionFactory; import javax.naming.NamingException; import org.apache.commons.lang.UnhandledException; /** * JmsConnector is a JMS 1.0.2b compliant connector that can be used * by a Mule endpoint. The connector supports all JMS functionality including topics * and queues, durable subscribers, acknowledgement modes and local transactions. */ public class JmsConnector extends AbstractConnector implements ConnectionNotificationListener { public static final String JMS = "jms"; //////////////////////////////////////////////////////////////////////// // Properties //////////////////////////////////////////////////////////////////////// private int acknowledgementMode = Session.AUTO_ACKNOWLEDGE; private String clientId; private boolean durable; private boolean noLocal; private boolean persistentDelivery; private boolean honorQosHeaders; private int maxRedelivery = 0; private boolean cacheJmsSessions = false; private boolean recoverJmsConnections = true; /** Whether to create a consumer on connect. */ private boolean eagerConsumer = true; //////////////////////////////////////////////////////////////////////// // JMS Connection //////////////////////////////////////////////////////////////////////// private ConnectionFactory connectionFactory; public String username = null; public String password = null; /** * JMS Connection, not settable by the user. */ private Connection connection; //////////////////////////////////////////////////////////////////////// // Strategy classes //////////////////////////////////////////////////////////////////////// private String specification = JmsConstants.JMS_SPECIFICATION_102B; private JmsSupport jmsSupport; private JmsTopicResolver topicResolver; private RedeliveryHandlerFactory redeliveryHandlerFactory; //////////////////////////////////////////////////////////////////////// // Methods //////////////////////////////////////////////////////////////////////// /* Register the Jms Exception reader if this class gets loaded */ static { ExceptionHelper.registerExceptionReader(new JmsExceptionReader()); } public String getProtocol() { return JMS; } protected void doInitialise() throws InitialisationException { if (connectionFactory == null) { connectionFactory = getDefaultConnectionFactory(); } if (connectionFactory == null) { throw new InitialisationException(JmsMessages.noConnectionFactorySet(), this); } if (topicResolver == null) { topicResolver = new DefaultJmsTopicResolver(this); } if (redeliveryHandlerFactory == null) { redeliveryHandlerFactory = new DefaultRedeliveryHandlerFactory(); } try { muleContext.registerListener(this, getName()); } catch (NotificationException nex) { throw new InitialisationException(nex, this); } } /** Override this method to provide a default ConnectionFactory for a vendor-specific JMS Connector. */ protected ConnectionFactory getDefaultConnectionFactory() { return null; } protected void doDispose() { if (connection != null) { try { connection.close(); } catch (JMSException e) { logger.error("Jms connector failed to dispose properly: ", e); } connection = null; } } protected Connection createConnection() throws NamingException, JMSException, InitialisationException { ConnectionFactory cf = this.connectionFactory; Connection connection; try { if (cf instanceof XAConnectionFactory && muleContext.getTransactionManager() != null) { cf = new ConnectionFactoryWrapper(cf); } } catch (Exception e) { throw new InitialisationException(e, this); } if (cf == null) { throw new InitialisationException(JmsMessages.noConnectionFactorySet(), this); } if (username != null) { connection = jmsSupport.createConnection(cf, username, password); } else { connection = jmsSupport.createConnection(cf); } if (clientId != null) { connection.setClientID(getClientId()); } // Register a JMS exception listener to detect failed connections. // Existing connection strategy will be used to recover. if (recoverJmsConnections && connectionStrategy != null && connection != null) { connection.setExceptionListener(new ExceptionListener() { public void onException(JMSException jmsException) { logger.debug("About to recycle myself due to remote JMS connection shutdown."); final JmsConnector jmsConnector = JmsConnector.this; try { jmsConnector.stop(); jmsConnector.initialised.set(false); } catch (MuleException e) { logger.warn(e.getMessage(), e); } try { //connectionStrategy.connect(jmsConnector); jmsConnector.initialise(); jmsConnector.start(); } catch (FatalConnectException fcex) { logger.fatal("Failed to reconnect to JMS server. I'm giving up."); } catch (MuleException umoex) { throw new UnhandledException("Failed to recover a connector.", umoex); } } }); } return connection; } protected void doConnect() throws ConnectException { try { if (jmsSupport == null) { if (JmsConstants.JMS_SPECIFICATION_102B.equals(specification)) { jmsSupport = new Jms102bSupport(this); } else { jmsSupport = new Jms11Support(this); } } } catch (Exception e) { throw new ConnectException(CoreMessages.failedToCreate("Jms Connector"), e, this); } try { connection = createConnection(); if (started.get()) { connection.start(); } } catch (Exception e) { throw new ConnectException(e, this); } } protected void doDisconnect() throws ConnectException { try { if (connection != null) { connection.close(); } } catch (Exception e) { throw new ConnectException(e, this); } finally { // connectionFactory = null; connection = null; } } public MessageAdapter getMessageAdapter(Object message) throws MessagingException { JmsMessageAdapter adapter = (JmsMessageAdapter) super.getMessageAdapter(message); adapter.setSpecification(this.getSpecification()); return adapter; } protected Object getReceiverKey(Service service, InboundEndpoint endpoint) { return service.getName() + "~" + endpoint.getEndpointURI().getAddress(); } public Session getSessionFromTransaction() { Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (tx != null) { if (tx.hasResource(connection)) { if (logger.isDebugEnabled()) { logger.debug("Retrieving jms session from current transaction " + tx); } Session session = (Session) tx.getResource(connection); if (logger.isDebugEnabled()) { logger.debug("Using " + session + " bound to transaction " + tx); } return session; } } return null; } public Session getSession(ImmutableEndpoint endpoint) throws JMSException { final boolean topic = getTopicResolver().isTopic(endpoint); return getSession(endpoint.getTransactionConfig().isTransacted(), topic); } public Session getSession(boolean transacted, boolean topic) throws JMSException { if (!isConnected()) { throw new JMSException("Not connected"); } Session session = getSessionFromTransaction(); if (session != null) { return session; } Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (logger.isDebugEnabled()) { logger.debug(MessageFormat.format( "Retrieving new jms session from connection: " + "topic={0}, transacted={1}, ack mode={2}, nolocal={3}", new Object[]{Boolean.valueOf(topic), Boolean.valueOf(transacted), new Integer(acknowledgementMode), Boolean.valueOf(noLocal)})); } session = jmsSupport.createSession(connection, topic, transacted, acknowledgementMode, noLocal); if (tx != null) { logger.debug("Binding session " + session + " to current transaction " + tx); try { tx.bindResource(connection, session); } catch (TransactionException e) { closeQuietly(session); throw new RuntimeException("Could not bind session to current transaction", e); } } return session; } protected void doStart() throws MuleException { if (connection != null) { try { connection.start(); } catch (JMSException e) { throw new StartException(CoreMessages.failedToStart("Jms Connection"), e, this); } } } protected void doStop() throws MuleException { // template method } public ReplyToHandler getReplyToHandler() { return new JmsReplyToHandler(this, getDefaultResponseTransformers()); } public void onNotification(ServerNotification notification) { if (notification.getAction() == ConnectionNotification.CONNECTION_DISCONNECTED || notification.getAction() == ConnectionNotification.CONNECTION_FAILED) { // Remove all dispatchers as any cached session will be invalidated disposeDispatchers(); // TODO should we dispose receivers here as well (in case they are // transactional) // gives a harmless NPE at // AbstractConnector.connect(AbstractConnector.java:927) // disposeReceivers(); } } /** * This method may be overridden in case a certain JMS implementation does not * support all the standard JMS properties. */ public boolean supportsProperty(String property) { return true; } /** * This method may be overridden in order to apply pre-processing to the message * as soon as it arrives. * * @param message - the incoming message * @param session - the JMS session * @return the preprocessed message */ public javax.jms.Message preProcessMessage(javax.jms.Message message, Session session) throws Exception { return message; } /** * Closes the MessageProducer * * @param producer * @throws JMSException */ public void close(MessageProducer producer) throws JMSException { if (producer != null) { producer.close(); } } /** * Closes the MessageProducer without throwing an exception (an error message is * logged instead). * * @param producer */ public void closeQuietly(MessageProducer producer) { try { close(producer); } catch (JMSException e) { logger.error("Failed to close jms message producer", e); } } /** * Closes the MessageConsumer * * @param consumer * @throws JMSException */ public void close(MessageConsumer consumer) throws JMSException { if (consumer != null) { consumer.close(); } } /** * Closes the MessageConsumer without throwing an exception (an error message is * logged instead). * * @param consumer */ public void closeQuietly(MessageConsumer consumer) { try { close(consumer); } catch (JMSException e) { logger.error("Failed to close jms message consumer", e); } } /** * Closes the MuleSession * * @param session * @throws JMSException */ public void close(Session session) throws JMSException { if (session != null) { session.close(); } } /** * Closes the MuleSession without throwing an exception (an error message is logged * instead). * * @param session */ public void closeQuietly(Session session) { try { close(session); } catch (JMSException e) { logger.error("Failed to close jms session consumer", e); } } /** * Closes the TemporaryQueue * * @param tempQueue * @throws JMSException */ public void close(TemporaryQueue tempQueue) throws JMSException { if (tempQueue != null) { tempQueue.delete(); } } /** * Closes the TemporaryQueue without throwing an exception (an error message is * logged instead). * * @param tempQueue */ public void closeQuietly(TemporaryQueue tempQueue) { try { close(tempQueue); } catch (JMSException e) { if (logger.isErrorEnabled()) { String queueName = ""; try { queueName = tempQueue.getQueueName(); } catch (JMSException innerEx) { // ignore, we are just trying to get the queue name } logger.info(MessageFormat.format( "Faled to delete a temporary queue '{0}' Reason: {1}", new Object[]{queueName, e.getMessage()})); } } } /** * Closes the TemporaryTopic * * @param tempTopic * @throws JMSException */ public void close(TemporaryTopic tempTopic) throws JMSException { if (tempTopic != null) { tempTopic.delete(); } } /** * Closes the TemporaryTopic without throwing an exception (an error message is * logged instead). * * @param tempTopic */ public void closeQuietly(TemporaryTopic tempTopic) { try { close(tempTopic); } catch (JMSException e) { if (logger.isErrorEnabled()) { String topicName = ""; try { topicName = tempTopic.getTopicName(); } catch (JMSException innerEx) { // ignore, we are just trying to get the topic name } logger.error("Faled to delete a temporary topic " + topicName, e); } } } //////////////////////////////////////////////////////////////////////// // Getters and Setters //////////////////////////////////////////////////////////////////////// /** @return Returns the connection. */ public Connection getConnection() { return connection; } protected void setConnection(Connection connection) { this.connection = connection; } /** @return Returns the acknowledgeMode. */ public int getAcknowledgementMode() { return acknowledgementMode; } /** @param acknowledgementMode The acknowledgementMode to set. */ public void setAcknowledgementMode(int acknowledgementMode) { this.acknowledgementMode = acknowledgementMode; } /** @return Returns the durable. */ public boolean isDurable() { return durable; } /** @param durable The durable to set. */ public void setDurable(boolean durable) { this.durable = durable; } /** @return Returns the noLocal. */ public boolean isNoLocal() { return noLocal; } /** @param noLocal The noLocal to set. */ public void setNoLocal(boolean noLocal) { this.noLocal = noLocal; } /** @return Returns the persistentDelivery. */ public boolean isPersistentDelivery() { return persistentDelivery; } /** @param persistentDelivery The persistentDelivery to set. */ public void setPersistentDelivery(boolean persistentDelivery) { this.persistentDelivery = persistentDelivery; } public JmsSupport getJmsSupport() { return jmsSupport; } public void setJmsSupport(JmsSupport jmsSupport) { this.jmsSupport = jmsSupport; } public String getSpecification() { return specification; } public void setSpecification(String specification) { this.specification = specification; } public void setRecoverJmsConnections(boolean recover) { this.recoverJmsConnections = recover; } public boolean isRecoverJmsConnections() { return this.recoverJmsConnections; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } public int getMaxRedelivery() { return maxRedelivery; } public void setMaxRedelivery(int maxRedelivery) { this.maxRedelivery = maxRedelivery; } public boolean isRemoteSyncEnabled() { return true; } /** * Getter for property 'topicResolver'. * * @return Value for property 'topicResolver'. */ public JmsTopicResolver getTopicResolver() { return topicResolver; } /** * Setter for property 'topicResolver'. * * @param topicResolver Value to set for property 'topicResolver'. */ public void setTopicResolver(final JmsTopicResolver topicResolver) { this.topicResolver = topicResolver; } /** * Getter for property 'eagerConsumer'. Default * is {@code true}. * * @return Value for property 'eagerConsumer'. * @see #eagerConsumer */ public boolean isEagerConsumer() { return eagerConsumer; } /** * A value of {@code true} will create a consumer on * connect, in contrast to lazy instantiation in the poll loop. * This setting very much depends on the JMS vendor. * Affects transactional receivers, typical symptoms are: *

    *
  • consumer thread hanging forever, though a message is * available *
  • failure to consume the first message (the rest * are fine) *
*

* * @param eagerConsumer Value to set for property 'eagerConsumer'. * @see #eagerConsumer * @see org.mule.transport.jms.XaTransactedJmsMessageReceiver */ public void setEagerConsumer(final boolean eagerConsumer) { this.eagerConsumer = eagerConsumer; } public boolean isCacheJmsSessions() { return cacheJmsSessions; } public void setCacheJmsSessions(boolean cacheJmsSessions) { this.cacheJmsSessions = cacheJmsSessions; } public ConnectionFactory getConnectionFactory() { return connectionFactory; } public void setConnectionFactory(ConnectionFactory connectionFactory) { this.connectionFactory = connectionFactory; } public RedeliveryHandlerFactory getRedeliveryHandlerFactory() { return redeliveryHandlerFactory; } public void setRedeliveryHandlerFactory(RedeliveryHandlerFactory redeliveryHandlerFactory) { this.redeliveryHandlerFactory = redeliveryHandlerFactory; } /** * Sets the honorQosHeaders property, which determines whether * {@link JmsMessageDispatcher} should honor incoming message's QoS headers * (JMSPriority, JMSDeliveryMode). * * @param honorQosHeaders true if {@link JmsMessageDispatcher} * should honor incoming message's QoS headers; otherwise * false Default is false, meaning that * connector settings will override message headers. */ public void setHonorQosHeaders(boolean honorQosHeaders) { this.honorQosHeaders = honorQosHeaders; } /** * Gets the value of honorQosHeaders property. * * @return true if JmsMessageDispatcher should * honor incoming message's QoS headers; otherwise false * Default is false, meaning that connector settings will * override message headers. */ public boolean isHonorQosHeaders() { return honorQosHeaders; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsClientAcknowledgeTransaction.java0000644000175000017500000000707510745677442033460 0ustar charlescharles/* * $Id: JmsClientAcknowledgeTransaction.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.CoreMessages; import org.mule.transaction.AbstractSingleResourceTransaction; import org.mule.transaction.IllegalTransactionStateException; import org.mule.transport.jms.i18n.JmsMessages; import javax.jms.Connection; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.Session; /** * JmsClientAcknowledgeTransaction is a transaction implementation of * performing a message acknowledgement. There is no notion of rollback with client * acknowledgement, but this transaction can be useful for controlling how messages * are consumed from a destination. */ public class JmsClientAcknowledgeTransaction extends AbstractSingleResourceTransaction { private volatile Message message; public void setMessage(Message message) { this.message = message; } /* * (non-Javadoc) * * @see org.mule.transaction.AbstractSingleResourceTransaction#doBegin() */ protected void doBegin() throws TransactionException { // nothing to do } /* * (non-Javadoc) * * @see org.mule.transaction.AbstractSingleResourceTransaction#doCommit() */ protected void doCommit() throws TransactionException { try { if (message == null) { throw new IllegalTransactionStateException( JmsMessages.noMessageBoundForAck()); } message.acknowledge(); } catch (JMSException e) { throw new IllegalTransactionStateException(CoreMessages.transactionCommitFailed(), e); } } /* * (non-Javadoc) * * @see org.mule.transaction.AbstractSingleResourceTransaction#doRollback() */ protected void doRollback() throws TransactionException { // If a message has been bound, rollback is forbidden if (message != null) { throw new UnsupportedOperationException("Jms Client Acknowledge doesn't support rollback"); } } /* * (non-Javadoc) * * @see org.mule.api.Transaction#bindResource(java.lang.Object, * java.lang.Object) */ public void bindResource(Object key, Object resource) throws TransactionException { if (key instanceof Message) { this.message = (Message)key; return; } if (!(key instanceof Connection) || !(resource instanceof Session)) { throw new IllegalTransactionStateException( CoreMessages.transactionCanOnlyBindToResources("javax.jms.Connection/javax.jms.Session")); } Session session = (Session)resource; try { if (session.getTransacted()) { throw new IllegalTransactionStateException(JmsMessages.sessionShouldNotBeTransacted()); } } catch (JMSException e) { throw new IllegalTransactionStateException(CoreMessages.transactionCannotReadState(), e); } super.bindResource(key, resource); } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/config/0000755000175000017500000000000011351410656025571 5ustar charlescharles././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/config/ConnectionFactoryDefinitionParser.javamule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/config/ConnectionFactoryDefinitionPar0000644000175000017500000000250210745677442033634 0ustar charlescharles/* * $Id: ConnectionFactoryDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.config; import org.mule.config.spring.parsers.delegate.AbstractFirstResultSerialDefinitionParser; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.mule.config.spring.parsers.specific.ObjectFactoryWrapper; /** * We want to set the connection factory as a pojo factory and then add attributes (username and * password) on the parent */ public class ConnectionFactoryDefinitionParser extends AbstractFirstResultSerialDefinitionParser { public static final String USERNAME = "username"; public static final String PASSWORD = "password"; public ConnectionFactoryDefinitionParser() { addDelegate(new ObjectFactoryWrapper("connectionFactory")).addIgnored(USERNAME).addIgnored(PASSWORD); addDelegate(new ParentDefinitionParser()).setIgnoredDefault(true).removeIgnored(USERNAME).removeIgnored(PASSWORD); } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/config/JmsNamespaceHandler.java0000644000175000017500000001246710745677442032330 0ustar charlescharles/* * $Id: JmsNamespaceHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.config; import org.mule.config.spring.factories.InboundEndpointFactoryBean; import org.mule.config.spring.factories.OutboundEndpointFactoryBean; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.assembly.configuration.PrefixValueMap; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.specific.FilterDefinitionParser; import org.mule.config.spring.parsers.specific.TransactionDefinitionParser; import org.mule.config.spring.parsers.specific.TransformerDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.TransportEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.TransportGlobalEndpointDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transaction.XaTransactionFactory; import org.mule.transport.jms.JmsClientAcknowledgeTransactionFactory; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.JmsTransactionFactory; import org.mule.transport.jms.activemq.ActiveMQJmsConnector; import org.mule.transport.jms.activemq.ActiveMQXAJmsConnector; import org.mule.transport.jms.filters.JmsPropertyFilter; import org.mule.transport.jms.filters.JmsSelectorFilter; import org.mule.transport.jms.transformers.JMSMessageToObject; import org.mule.transport.jms.transformers.ObjectToJMSMessage; import org.mule.transport.jms.weblogic.WeblogicJmsConnector; import org.mule.transport.jms.websphere.WebsphereJmsConnector; /** * Registers Bean Definition Parsers for the "jms" namespace. */ public class JmsNamespaceHandler extends AbstractMuleNamespaceHandler { public static final String QUEUE = "queue"; public static final String TOPIC = "topic"; public static final String[][] JMS_ATTRIBUTES = new String[][]{new String[]{QUEUE}, new String[]{TOPIC}}; public void init() { registerJmsTransportEndpoints(); registerBeanDefinitionParser("connector", new JmsConnectorDefinitionParser()); registerBeanDefinitionParser("custom-connector", new JmsConnectorDefinitionParser()); registerBeanDefinitionParser("activemq-connector", new JmsConnectorDefinitionParser(ActiveMQJmsConnector.class)); registerBeanDefinitionParser("activemq-xa-connector", new JmsConnectorDefinitionParser(ActiveMQXAJmsConnector.class)); registerBeanDefinitionParser("weblogic-connector", new JmsConnectorDefinitionParser(WeblogicJmsConnector.class)); registerBeanDefinitionParser("websphere-connector", new JmsConnectorDefinitionParser(WebsphereJmsConnector.class)); registerBeanDefinitionParser("transaction", new TransactionDefinitionParser(JmsTransactionFactory.class)); registerBeanDefinitionParser("client-ack-transaction", new TransactionDefinitionParser(JmsClientAcknowledgeTransactionFactory.class)); registerBeanDefinitionParser("xa-transaction", new TransactionDefinitionParser(XaTransactionFactory.class)); registerBeanDefinitionParser("jmsmessage-to-object-transformer", new TransformerDefinitionParser(JMSMessageToObject.class)); registerBeanDefinitionParser("object-to-jmsmessage-transformer", new TransformerDefinitionParser(ObjectToJMSMessage.class)); registerBeanDefinitionParser("property-filter", new FilterDefinitionParser(JmsPropertyFilter.class)); registerBeanDefinitionParser("selector", new ChildDefinitionParser(FilterDefinitionParser.FILTER, JmsSelectorFilter.class)); } /** * Need to use the most complex constructors as have mutually exclusive address aattributes */ protected void registerJmsTransportEndpoints() { registerJmsEndpointDefinitionParser("endpoint", new TransportGlobalEndpointDefinitionParser(JmsConnector.JMS, TransportGlobalEndpointDefinitionParser.PROTOCOL, TransportGlobalEndpointDefinitionParser.RESTRICTED_ENDPOINT_ATTRIBUTES, JMS_ATTRIBUTES, new String[][]{})); registerJmsEndpointDefinitionParser("inbound-endpoint", new TransportEndpointDefinitionParser(JmsConnector.JMS, TransportEndpointDefinitionParser.PROTOCOL, InboundEndpointFactoryBean.class, TransportEndpointDefinitionParser.RESTRICTED_ENDPOINT_ATTRIBUTES, JMS_ATTRIBUTES, new String[][]{})); registerJmsEndpointDefinitionParser("outbound-endpoint", new TransportEndpointDefinitionParser(JmsConnector.JMS, TransportEndpointDefinitionParser.PROTOCOL, OutboundEndpointFactoryBean.class, TransportEndpointDefinitionParser.RESTRICTED_ENDPOINT_ATTRIBUTES, JMS_ATTRIBUTES, new String[][]{})); } protected void registerJmsEndpointDefinitionParser(String element, MuleDefinitionParser parser) { parser.addAlias(QUEUE, URIBuilder.PATH); parser.addAlias(TOPIC, URIBuilder.PATH); parser.addMapping(TOPIC, new PrefixValueMap(TOPIC + ":")); registerBeanDefinitionParser(element, parser); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/config/JmsConnectorDefinitionParser.javamule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/config/JmsConnectorDefinitionParser.j0000644000175000017500000000216410745677442033557 0ustar charlescharles/* * $Id: JmsConnectorDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.config; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; import org.mule.transport.jms.JmsConnector; import javax.jms.Session; public class JmsConnectorDefinitionParser extends MuleOrphanDefinitionParser { public JmsConnectorDefinitionParser() { this(JmsConnector.class); } public JmsConnectorDefinitionParser(Class clazz) { super(clazz, true); addMapping("acknowledgementMode", "AUTO_ACKNOWLEDGE=" + Session.AUTO_ACKNOWLEDGE + "," + "CLIENT_ACKNOWLEDGE=" + Session.CLIENT_ACKNOWLEDGE + "," + "DUPS_OK_ACKNOWLEDGE=" + Session.DUPS_OK_ACKNOWLEDGE); } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/DefaultRedeliveryHandler.java0000644000175000017500000000641610745677442032131 0ustar charlescharles/* * $Id: DefaultRedeliveryHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MessagingException; import org.mule.transport.jms.i18n.JmsMessages; import java.util.Collections; import java.util.Map; import javax.jms.JMSException; import javax.jms.Message; import org.apache.commons.collections.map.LRUMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * DefaultRedeliveryHandler TODO */ public class DefaultRedeliveryHandler implements RedeliveryHandler { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(DefaultRedeliveryHandler.class); private Map messages = null; protected JmsConnector connector; public DefaultRedeliveryHandler() { messages = Collections.synchronizedMap(new LRUMap(256)); } /** * The connector associated with this handler is set before * handleRedelivery() is called * * @param connector the connector associated with this handler */ public void setConnector(JmsConnector connector) { this.connector = connector; } /** * process the redelivered message. If the Jms receiver should process the * message, it should be returned. Otherwise the connector should throw a * MessageRedeliveredException to indicate that the message should * be handled by the connector Exception Handler. * * @param message */ public void handleRedelivery(Message message) throws JMSException, MessagingException { if (connector.getMaxRedelivery() <= 0) { return; } String id = message.getJMSMessageID(); Integer i = (Integer)messages.remove(id); if (i == null) { if (logger.isDebugEnabled()) { logger.debug("Message with id: " + id + " has been redelivered for the first time"); } messages.put(id, new Integer(1)); return; } else if (i.intValue() == connector.getMaxRedelivery()) { if (logger.isDebugEnabled()) { logger.debug("Message with id: " + id + " has been redelivered " + (i.intValue() + 1) + " times, which exceeds the maxRedelivery setting on the connector"); } JmsMessageAdapter adapter = (JmsMessageAdapter)connector.getMessageAdapter(message); throw new MessageRedeliveredException( JmsMessages.tooManyRedeliveries(id, String.valueOf(i.intValue() + 1)), adapter); } else { messages.put(id, new Integer(i.intValue() + 1)); if (logger.isDebugEnabled()) { logger.debug("Message with id: " + id + " has been redelivered " + i.intValue() + " times"); } } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/DefaultJmsTopicResolver.java0000644000175000017500000001013010745677442031757 0ustar charlescharles/* * $Id: DefaultJmsTopicResolver.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.util.MapUtils; import org.mule.util.StringMessageUtils; import javax.jms.Destination; import javax.jms.Queue; import javax.jms.Topic; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A default implementation of the resolver uses endpoint's * resource info and Java's {@code instanceof} operator to * detect JMS topics. */ public class DefaultJmsTopicResolver implements JmsTopicResolver { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(DefaultJmsTopicResolver.class); /** * Connector back-reference. */ private JmsConnector connector; /** * Create an instance of the resolver. * @param connector owning connector */ public DefaultJmsTopicResolver (final JmsConnector connector) { this.connector = connector; } /** * Getter for property 'connector'. * * @return Value for property 'connector'. */ public JmsConnector getConnector () { return connector; } /** * Will use endpoint's resource info to detect a topic, * as in {@code jms://topic:trade.PriceUpdatesTopic}. This * method will call {@link #isTopic(org.mule.api.endpoint.ImmutableEndpoint, boolean)} * with fallback flag set to true. *

* NOTE: When using topics, use the '.' (dot) symbol for subcontext separation, * as opposed to '/'. Otherwise the resource info may not get properly translated for the * topic endpoint due to the way URI's are parsed. * @param endpoint endpoint to test * @return true if the endpoint has a topic configuration * @see #isTopic(org.mule.api.endpoint.ImmutableEndpoint, boolean) */ public boolean isTopic (ImmutableEndpoint endpoint) { return isTopic(endpoint, true); } /** {@inheritDoc} */ public boolean isTopic (ImmutableEndpoint endpoint, boolean fallbackToEndpointProperties) { final String resourceInfo = endpoint.getEndpointURI().getResourceInfo(); boolean topic = JmsConstants.TOPIC_PROPERTY.equalsIgnoreCase(resourceInfo); if (!topic && fallbackToEndpointProperties) { topic = MapUtils.getBooleanValue(endpoint.getProperties(), JmsConstants.TOPIC_PROPERTY, false); } return topic; } /** * Will use an {@code instanceof} operator. Keep in mind * that may fail for JMS systems implementing both a * {@code javax.jms.Topic} and {@code javax.jms.Queue} in * a single destination class implementation. * @param destination a jms destination to test * @return {@code true} if the destination is a topic */ public boolean isTopic (Destination destination) { checkInvariants(destination); return destination instanceof Topic; } /** * Perform some sanity checks, will complain in the log. * @param destination destination to test */ protected void checkInvariants (final Destination destination) { if (destination instanceof Topic && destination instanceof Queue && connector.getJmsSupport() instanceof Jms102bSupport) { logger.error(StringMessageUtils.getBoilerPlate( "Destination implements both Queue and Topic " + "while complying with JMS 1.0.2b specification. " + "Please report your application server or JMS vendor name and version " + "to dev<_at_>mule.codehaus.org or http://www.mulesource.org/jira")); } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/xa/0000755000175000017500000000000011351410655024733 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/xa/ConsumerProducerInvocationHandler.javamule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/xa/ConsumerProducerInvocationHandler.0000644000175000017500000000326410745677442033607 0ustar charlescharles/* * $Id: ConsumerProducerInvocationHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.xa; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class ConsumerProducerInvocationHandler implements InvocationHandler { private Object target; private SessionInvocationHandler sessionInvocationHandler; public ConsumerProducerInvocationHandler(SessionInvocationHandler sessionInvocationHandler, Object target) { this.sessionInvocationHandler = sessionInvocationHandler; this.target = target; } /* * (non-Javadoc) * * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, * java.lang.reflect.Method, java.lang.Object[]) */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (ConnectionFactoryWrapper.logger.isDebugEnabled()) { ConnectionFactoryWrapper.logger.debug("Invoking " + method); } if (!method.getName().equals("close")) { sessionInvocationHandler.enlist(); } try { return method.invoke(target, args); } catch (InvocationTargetException e) { throw e.getCause(); } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/xa/XAResourceWrapper.java0000644000175000017500000000451010747501743031166 0ustar charlescharles/* * $Id: XAResourceWrapper.java 10590 2008-01-29 01:39:47Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.xa; import javax.transaction.xa.XAException; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; /** * Arjuna can't serialize proxy */ public class XAResourceWrapper implements XAResource { private XAResource xaResource; private SessionInvocationHandler sessionInvocationHandler; public XAResourceWrapper(XAResource xaResource, SessionInvocationHandler sessionInvocationHandler) { this.xaResource = xaResource; this.sessionInvocationHandler = sessionInvocationHandler; } public int getTransactionTimeout() throws XAException { return xaResource.getTransactionTimeout(); } public boolean setTransactionTimeout(int i) throws XAException { return xaResource.setTransactionTimeout(i); } public boolean isSameRM(XAResource xaResource) throws XAException { if (xaResource instanceof XAResourceWrapper) { xaResource = ((XAResourceWrapper) xaResource).xaResource; } return this.xaResource.isSameRM(xaResource); } public Xid[] recover(int i) throws XAException { return xaResource.recover(i); } public int prepare(Xid xid) throws XAException { return xaResource.prepare(xid); } public void forget(Xid xid) throws XAException { xaResource.forget(xid); } public void rollback(Xid xid) throws XAException { xaResource.rollback(xid); } public void end(Xid xid, int i) throws XAException { xaResource.end(xid, i); sessionInvocationHandler.setEnlisted(false); } public void start(Xid xid, int i) throws XAException { xaResource.start(xid, i); } public void commit(Xid xid, boolean b) throws XAException { xaResource.commit(xid, b); } public String toString() { return xaResource.toString(); } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/xa/SessionInvocationHandler.java0000644000175000017500000002045010755041255032555 0ustar charlescharles/* * $Id: SessionInvocationHandler.java 10803 2008-02-14 13:31:25Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.xa; import org.mule.api.transaction.Transaction; import org.mule.config.i18n.CoreMessages; import org.mule.transaction.IllegalTransactionStateException; import org.mule.transaction.TransactionCoordination; import org.mule.transaction.XaTransaction; import java.lang.ref.Reference; import java.lang.ref.WeakReference; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import javax.jms.JMSException; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.QueueReceiver; import javax.jms.QueueSender; import javax.jms.Session; import javax.jms.TopicPublisher; import javax.jms.TopicSubscriber; import javax.jms.XAQueueSession; import javax.jms.XASession; import javax.jms.XATopicSession; import javax.transaction.xa.XAResource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class SessionInvocationHandler implements InvocationHandler { protected static final transient Log logger = LogFactory.getLog(SessionInvocationHandler.class); private XASession xaSession; private XAResource xaResource; private volatile boolean enlisted = false; private volatile boolean reuseObject = false; private final Reference underlyingObject; private static final Method SESSION_CLOSE_METHOD; static { try { SESSION_CLOSE_METHOD = Session.class.getMethod("close", (Class[])null); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } } public SessionInvocationHandler(XASession xaSession) throws JMSException { this.xaSession = xaSession; underlyingObject = new WeakReference(xaSession.getSession()); this.xaResource = new XAResourceWrapper(xaSession.getXAResource(), this); } public SessionInvocationHandler(XAQueueSession xaSession) throws JMSException { this.xaSession = xaSession; underlyingObject = new WeakReference(xaSession.getQueueSession()); this.xaResource = new XAResourceWrapper(xaSession.getXAResource(), this); } public SessionInvocationHandler(XATopicSession xaSession) throws JMSException { this.xaSession = xaSession; underlyingObject = new WeakReference(xaSession.getTopicSession()); this.xaResource = new XAResourceWrapper(xaSession.getXAResource(), this); } /* * (non-Javadoc) * * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, * java.lang.reflect.Method, java.lang.Object[]) */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (logger.isDebugEnabled()) { logger.debug("Invoking " + method); } if (underlyingObject.get() == null) { throw new IllegalStateException("Underlying session is null, XASession " + xaSession); } // processing method from MuleXaObject if (XaTransaction.MuleXaObject.DELIST_METHOD_NAME.equals(method.getName())) { return Boolean.valueOf(delist()); } else if (XaTransaction.MuleXaObject.SET_REUSE_OBJECT_METHOD_NAME.equals(method.getName())) { reuseObject = ((Boolean) args[0]).booleanValue(); return null; } else if (XaTransaction.MuleXaObject.IS_REUSE_OBJECT_METHOD_NAME.equals(method.getName())) { return Boolean.valueOf(reuseObject); } else if (XaTransaction.MuleXaObject.GET_TARGET_OBJECT_METHOD_NAME.equals(method.getName())) { return getTargetObject(); } else if (XaTransaction.MuleXaObject.CLOSE_METHOD_NAME.equals(method.getName())) { return SESSION_CLOSE_METHOD.invoke(underlyingObject.get(), args); } //close will be directly called on session object Object result = method.invoke(underlyingObject.get(), args); if (result instanceof TopicSubscriber) { result = Proxy.newProxyInstance(Session.class.getClassLoader(), new Class[]{TopicSubscriber.class}, new ConsumerProducerInvocationHandler(this, result)); } else if (result instanceof QueueReceiver) { result = Proxy.newProxyInstance(Session.class.getClassLoader(), new Class[]{QueueReceiver.class}, new ConsumerProducerInvocationHandler(this, result)); } else if (result instanceof MessageConsumer) { result = Proxy.newProxyInstance(Session.class.getClassLoader(), new Class[]{MessageConsumer.class}, new ConsumerProducerInvocationHandler(this, result)); } else if (result instanceof TopicPublisher) { result = Proxy.newProxyInstance(Session.class.getClassLoader(), new Class[]{TopicPublisher.class}, new ConsumerProducerInvocationHandler(this, result)); } else if (result instanceof QueueSender) { result = Proxy.newProxyInstance(Session.class.getClassLoader(), new Class[]{QueueSender.class}, new ConsumerProducerInvocationHandler(this, result)); } else if (result instanceof MessageProducer) { result = Proxy.newProxyInstance(Session.class.getClassLoader(), new Class[]{MessageProducer.class}, new ConsumerProducerInvocationHandler(this, result)); } return result; } protected void enlist() throws Exception { if (isEnlisted()) { return; } if (logger.isDebugEnabled()) { logger.debug("Enlistment request: " + this); } Transaction transaction = TransactionCoordination.getInstance().getTransaction(); if (transaction == null) { throw new IllegalTransactionStateException(CoreMessages.noMuleTransactionAvailable()); } if (!(transaction instanceof XaTransaction)) { throw new IllegalTransactionStateException(CoreMessages.notMuleXaTransaction(transaction)); } if (!isEnlisted()) { if (logger.isDebugEnabled()) { logger.debug("Enlisting resource " + xaResource + " in xa transaction " + transaction); } enlisted = ((XaTransaction) transaction).enlistResource(xaResource); } } public boolean delist() throws Exception { if (!isEnlisted()) { return false; } if (logger.isDebugEnabled()) { logger.debug("Delistment request: " + this); } Transaction transaction = TransactionCoordination.getInstance().getTransaction(); if (transaction == null) { throw new IllegalTransactionStateException(CoreMessages.noMuleTransactionAvailable()); } if (!(transaction instanceof XaTransaction)) { throw new IllegalTransactionStateException(CoreMessages.notMuleXaTransaction(transaction)); } if (isEnlisted()) { if (logger.isDebugEnabled()) { logger.debug("Delisting resource " + xaResource + " in xa transaction " + transaction); } enlisted = !((XaTransaction) transaction).delistResource(xaResource, XAResource.TMSUCCESS); } return !isEnlisted(); } public boolean isEnlisted() { return enlisted; } public void setEnlisted(boolean enlisted) { this.enlisted = enlisted; } public XASession getTargetObject() { return xaSession; } public XAResource getXAResource() { return xaResource; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/xa/ConnectionInvocationHandler.java0000644000175000017500000000553610772331303033234 0ustar charlescharles/* * $Id: ConnectionInvocationHandler.java 11510 2008-03-26 02:19:47Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.xa; import org.mule.transaction.XaTransaction; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import javax.jms.QueueSession; import javax.jms.Session; import javax.jms.TopicSession; import javax.jms.XAConnection; import javax.jms.XAQueueConnection; import javax.jms.XAQueueSession; import javax.jms.XASession; import javax.jms.XATopicConnection; import javax.jms.XATopicSession; public class ConnectionInvocationHandler implements InvocationHandler { private Object xaConnection; public ConnectionInvocationHandler(Object xac) { this.xaConnection = xac; } /** * Can be one of 3 types. * TODO check if we can portably cast it (JMS 1.1 vs 1.0.2b), see Jms102bSupport why * * @return underlying XAConnection instance */ public Object getTargetObject() { return xaConnection; } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (ConnectionFactoryWrapper.logger.isDebugEnabled()) { ConnectionFactoryWrapper.logger.debug("Invoking " + method); } if (method.getName().equals("createSession")) { XASession xas = ((XAConnection) xaConnection).createXASession(); return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{Session.class, XaTransaction.MuleXaObject.class}, new SessionInvocationHandler(xas)); } else if (method.getName().equals("createQueueSession")) { XAQueueSession xaqs = ((XAQueueConnection) xaConnection).createXAQueueSession(); return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{QueueSession.class, XaTransaction.MuleXaObject.class}, new SessionInvocationHandler(xaqs)); } else if (method.getName().equals("createTopicSession")) { XATopicSession xats = ((XATopicConnection) xaConnection).createXATopicSession(); return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{TopicSession.class, XaTransaction.MuleXaObject.class}, new SessionInvocationHandler(xats)); } else { return method.invoke(xaConnection, args); } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/xa/ConnectionFactoryWrapper.java0000644000175000017500000001222210747501743032574 0ustar charlescharles/* * $Id: ConnectionFactoryWrapper.java 10590 2008-01-29 01:39:47Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.xa; import java.lang.reflect.Proxy; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.TopicConnection; import javax.jms.TopicConnectionFactory; import javax.jms.XAConnection; import javax.jms.XAConnectionFactory; import javax.jms.XAQueueConnection; import javax.jms.XAQueueConnectionFactory; import javax.jms.XATopicConnection; import javax.jms.XATopicConnectionFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class ConnectionFactoryWrapper implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory { /** * logger used by this class */ protected static final transient Log logger = LogFactory.getLog(ConnectionFactoryWrapper.class); protected final Object factory; public ConnectionFactoryWrapper(Object factory) { this.factory = factory; } /* * (non-Javadoc) * * @see javax.jms.ConnectionFactory#createConnection() */ public Connection createConnection() throws JMSException { XAConnection xac = ((XAConnectionFactory) factory).createXAConnection(); Connection proxy = (Connection) Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class[]{Connection.class}, new ConnectionInvocationHandler(xac)); return proxy; } /* * (non-Javadoc) * * @see javax.jms.ConnectionFactory#createConnection(java.lang.String, * java.lang.String) */ public Connection createConnection(String username, String password) throws JMSException { XAConnection xac = ((XAConnectionFactory) factory).createXAConnection(username, password); Connection proxy = (Connection) Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class[]{Connection.class}, new ConnectionInvocationHandler(xac)); return proxy; } /* * (non-Javadoc) * * @see javax.jms.QueueConnectionFactory#createQueueConnection() */ public QueueConnection createQueueConnection() throws JMSException { XAQueueConnection xaqc = ((XAQueueConnectionFactory) factory).createXAQueueConnection(); QueueConnection proxy = (QueueConnection) Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class[]{QueueConnection.class}, new ConnectionInvocationHandler(xaqc)); return proxy; } /* * (non-Javadoc) * * @see javax.jms.QueueConnectionFactory#createQueueConnection(java.lang.String, * java.lang.String) */ public QueueConnection createQueueConnection(String username, String password) throws JMSException { XAQueueConnection xaqc = ((XAQueueConnectionFactory) factory).createXAQueueConnection(username, password); QueueConnection proxy = (QueueConnection) Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class[]{QueueConnection.class}, new ConnectionInvocationHandler(xaqc)); return proxy; } /* * (non-Javadoc) * * @see javax.jms.TopicConnectionFactory#createTopicConnection() */ public TopicConnection createTopicConnection() throws JMSException { XATopicConnection xatc = ((XATopicConnectionFactory) factory).createXATopicConnection(); TopicConnection proxy = (TopicConnection) Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class[]{TopicConnection.class}, new ConnectionInvocationHandler(xatc)); return proxy; } /* * (non-Javadoc) * * @see javax.jms.TopicConnectionFactory#createTopicConnection(java.lang.String, * java.lang.String) */ public TopicConnection createTopicConnection(String username, String password) throws JMSException { XATopicConnection xatc = ((XATopicConnectionFactory) factory).createXATopicConnection(username, password); TopicConnection proxy = (TopicConnection) Proxy.newProxyInstance(Connection.class.getClassLoader(), new Class[]{TopicConnection.class}, new ConnectionInvocationHandler(xatc)); return proxy; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageRequester.java0000644000175000017500000000726410757615756031157 0ustar charlescharles/* * $Id: JmsMessageRequester.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.transport.AbstractMessageRequester; import javax.jms.Destination; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.Session; /** * JmsMessageDispatcher is responsible for dispatching messages to JMS * destinations. All JMS semantics apply and settings such as replyTo and QoS * properties are read from the event properties or defaults are used (according to * the JMS specification) */ public class JmsMessageRequester extends AbstractMessageRequester { private JmsConnector connector; public JmsMessageRequester(InboundEndpoint endpoint) { super(endpoint); this.connector = (JmsConnector)endpoint.getConnector(); } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal cuases an exception */ protected MuleMessage doRequest(long timeout) throws Exception { Session session = null; MessageConsumer consumer = null; try { final boolean topic = connector.getTopicResolver().isTopic(endpoint); JmsSupport support = connector.getJmsSupport(); session = connector.getSession(false, topic); Destination dest = support.createDestination(session, endpoint.getEndpointURI().getAddress(), topic); consumer = support.createConsumer(session, dest, topic); try { Message message; if (timeout == JmsMessageDispatcher.RECEIVE_NO_WAIT) { message = consumer.receiveNoWait(); } else if (timeout == JmsMessageDispatcher.RECEIVE_WAIT_INDEFINITELY) { message = consumer.receive(); } else { message = consumer.receive(timeout); } if (message == null) { return null; } message = connector.preProcessMessage(message, session); return new DefaultMuleMessage(connector.getMessageAdapter(message)); } catch (Exception e) { connector.handleException(e); return null; } } finally { connector.closeQuietly(consumer); connector.closeQuietly(session); } } protected void doDispose() { // template method } }mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/filters/0000755000175000017500000000000011351410655025773 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/filters/JmsSelectorFilter.java0000644000175000017500000000223410745677442032256 0ustar charlescharles/* * $Id: JmsSelectorFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; /** * JmsSelectorFilter is a wrapper for a JMS Selector. This filter * should not be called. Instead the JmsConnector sets the selector on the * destination to the expression set on this filer. */ public class JmsSelectorFilter implements Filter { private String expression = null; public boolean accept(MuleMessage message) { // If we have received the message the selector has been honoured return true; } public String getExpression() { return expression; } public void setExpression(String expression) { this.expression = expression; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/filters/JmsPropertyFilter.java0000644000175000017500000001257110745677442032327 0ustar charlescharles/* * $Id: * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import org.mule.util.ClassUtils; import org.mule.util.StringUtils; import java.util.regex.Pattern; import javax.jms.Message; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class JmsPropertyFilter implements Filter { /** * Logger used by this class */ private static Log logger = LogFactory.getLog(JmsPropertyFilter.class); /** * Name of the JMS property to filter on */ private String propertyName = null; /** * Class type of the JMS property */ private String propertyClass = null; /** * Expression value to match on */ private String expression = null; /** * Optional regular expression pattern to search on */ private Pattern pattern = null; public boolean accept(MuleMessage message) { if (StringUtils.isBlank(propertyName)) { logger.warn("No property name was specified"); return false; } if (StringUtils.isBlank(expression) && pattern == null) { logger.warn("Either no expression or pattern was specified"); return false; } if (message.getPayload() instanceof javax.jms.Message) { try { Message m = (javax.jms.Message) message.getPayload(); if (StringUtils.isBlank(propertyClass)) { Object object = m.getObjectProperty(propertyName); if (object == null) { return false; } String value = object.toString(); if (pattern != null) { return pattern.matcher(value).find(); } else { return value.equals(expression); } } else if (propertyClass.equals("java.lang.String")) { String value = m.getStringProperty(propertyName); if (value == null) { return false; } if (pattern != null) { return pattern.matcher(value).find(); } else { return value.equals(expression); } } else if (propertyClass.equals("java.lang.Integer")) { int value = m.getIntProperty(propertyName); int match = Integer.parseInt(expression); return (value == match); } else if (propertyClass.equals("java.lang.Short")) { short value = m.getShortProperty(propertyName); short match = Short.parseShort(expression); return (value == match); } } catch (NumberFormatException nfe) { logger.warn("Unable to convert expression " + expression + " to " + propertyClass + ": " + nfe.toString()); } catch (Exception e) { logger.warn("Error filtering on property " + propertyName + ": " + e.toString()); } } else { logger.warn("Expected a payload of javax.jms.Message but instead received " + ClassUtils.getSimpleName(message.getPayload().getClass())); } return false; } /** * Sets the match expression */ public void setExpression(String expression) { this.expression = expression; } /** * Returns the match expression */ public String getExpression() { return expression; } /** * Sets the name of the property */ public void setPropertyName(String propertyName) { this.propertyName = propertyName; } /** * Returns the name of the property */ public String getPropertyName() { return propertyName; } /** * Sets the class type of the property */ public void setPropertyClass(String propertyClass) { this.propertyClass = propertyClass; } /** * Returns the class type of the property */ public String getPropertyClass() { return propertyClass; } /** * Sets the regex pattern to match on */ public String getPattern() { return (pattern == null ? null : pattern.pattern()); } /** * Return the regex pattern to match on */ public void setPattern(String pattern) { this.pattern = Pattern.compile(pattern); } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/websphere/0000755000175000017500000000000011351410655026307 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/websphere/package.html0000644000175000017500000000020210745677442030601 0ustar charlescharles Provides Jms connectivity with Websphere-specific workarounds and improvements. mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/websphere/WebsphereJmsConnector.java0000644000175000017500000000137110745677442033444 0ustar charlescharles/* * $Id: WebsphereJmsConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.websphere; import org.mule.transport.jms.JmsConnector; /** * Websphere-specific JMS connector. */ public class WebsphereJmsConnector extends JmsConnector { /** Constructs a new WebsphereJmsConnector. */ public WebsphereJmsConnector() { setRecoverJmsConnections(false); } }mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsTopicResolver.java0000644000175000017500000000356410745677442030467 0ustar charlescharles/* * $Id: JmsTopicResolver.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.endpoint.ImmutableEndpoint; import javax.jms.Destination; /** * A strategy interface to detect a {@code javax.jms.Topic} in, * possibly, a vendor-specific way. */ public interface JmsTopicResolver { /** * Use endpoint configuration to detect a topic. * @param endpoint endpoint to test * @return true if endpoint's config tells it's a topic * @see #isTopic(org.mule.api.endpoint.ImmutableEndpoint, boolean) */ boolean isTopic(ImmutableEndpoint endpoint); /** * Use endpoint configuration to detect a topic. Additionally, * specify a fallback mechanism to search in endpoint's properties * in case resource info yields {@code false}. In case resource info * returned {@code true} no endpoint properties would be consulted. * @param endpoint endpoint to test * @param fallbackToEndpointProperties whether to check endpoint's properties if * resource info returned false * @return true if endpoint's config tells it's a topic */ boolean isTopic(ImmutableEndpoint endpoint, boolean fallbackToEndpointProperties); /** * Use any means suitable to detect a topic. This can * be as simple as an {@code instanceof} call or utilize * reflection and/or vendor API instead. * @param destination a jms destination to test * @return {@code true} for topic */ boolean isTopic(Destination destination); } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/MessageRedeliveredException.java0000644000175000017500000000216310745677442032625 0ustar charlescharles/* * $Id: MessageRedeliveredException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MessagingException; import org.mule.config.i18n.Message; import org.mule.transport.jms.i18n.JmsMessages; public class MessageRedeliveredException extends MessagingException { /** * Serial version */ private static final long serialVersionUID = 9013890402770563931L; public MessageRedeliveredException(JmsMessageAdapter jmsMessage) { super(JmsMessages.messageMarkedForRedelivery(jmsMessage), jmsMessage); } public MessageRedeliveredException(Message message, JmsMessageAdapter jmsMessage) { super(message.setNextMessage(JmsMessages.messageMarkedForRedelivery(jmsMessage)), jmsMessage); } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageRequesterFactory.java0000644000175000017500000000174310757615756032503 0ustar charlescharles/* * $Id: JmsMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; /** * JmsMessageDispatcherFactory creates a message adapter that will * send JMS messages */ public class JmsMessageRequesterFactory extends AbstractMessageRequesterFactory { public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new JmsMessageRequester(endpoint); } }mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsReplyToHandler.java0000644000175000017500000001464410771736371030560 0ustar charlescharles/* * $Id: JmsReplyToHandler.java 11488 2008-03-24 14:38:49Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.transformer.Transformer; import org.mule.api.transport.DispatchException; import org.mule.service.AbstractService; import org.mule.transport.DefaultReplyToHandler; import org.mule.transport.jms.i18n.JmsMessages; import org.mule.util.StringMessageUtils; import java.util.Iterator; import java.util.List; import javax.jms.DeliveryMode; import javax.jms.Destination; import javax.jms.Message; import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.Topic; /** * JmsReplyToHandler will process a JMS replyTo or hand off to the * default replyTo handler if the replyTo is a URL */ public class JmsReplyToHandler extends DefaultReplyToHandler { private final JmsConnector connector; public JmsReplyToHandler(JmsConnector connector, List transformers) { super(transformers); this.connector = connector; } public void processReplyTo(MuleEvent event, MuleMessage returnMessage, Object replyTo) throws MuleException { Destination replyToDestination = null; MessageProducer replyToProducer = null; Session session = null; try { // now we need to send the response if (replyTo instanceof Destination) { replyToDestination = (Destination)replyTo; } if (replyToDestination == null) { super.processReplyTo(event, returnMessage, replyTo); return; } //This is a work around for JmsTransformers where the current endpoint needs //to be set on the transformer so that a JMSMEssage can be created correctly Class srcType = returnMessage.getPayload().getClass(); for (Iterator iterator = getTransformers().iterator(); iterator.hasNext();) { Transformer t = (Transformer) iterator.next(); if (t.isSourceTypeSupported(srcType)) { if (t.getEndpoint() == null) { t.setEndpoint(getEndpoint(event, "jms://temporary")); break; } } } returnMessage.applyTransformers(getTransformers()); Object payload = returnMessage.getPayload(); if (replyToDestination instanceof Topic && replyToDestination instanceof Queue && connector.getJmsSupport() instanceof Jms102bSupport) { logger.error(StringMessageUtils.getBoilerPlate("ReplyTo destination implements both Queue and Topic " + "while complying with JMS 1.0.2b specification. " + "Please report your application server or JMS vendor name and version " + "to dev<_at_>mule.codehaus.org or http://mule.mulesource.org/jira")); } final boolean topic = connector.getTopicResolver().isTopic(replyToDestination); session = connector.getSession(false, topic); Message replyToMessage = JmsMessageUtils.toMessage(payload, session); replyToMessage.setJMSReplyTo(null); if (logger.isDebugEnabled()) { logger.debug("Sending jms reply to: " + replyToDestination + "(" + replyToDestination.getClass().getName() + ")"); } replyToProducer = connector.getJmsSupport().createProducer(session, replyToDestination, topic); // QoS support MuleMessage eventMsg = event.getMessage(); String ttlString = (String)eventMsg.removeProperty(JmsConstants.TIME_TO_LIVE_PROPERTY); String priorityString = (String)eventMsg.removeProperty(JmsConstants.PRIORITY_PROPERTY); String persistentDeliveryString = (String)eventMsg.removeProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY); if (ttlString == null && priorityString == null && persistentDeliveryString == null) { connector.getJmsSupport().send(replyToProducer, replyToMessage, topic); } else { long ttl = Message.DEFAULT_TIME_TO_LIVE; int priority = Message.DEFAULT_PRIORITY; // TODO this first assignment is ignored anyway, review and remove if need to boolean persistent = Message.DEFAULT_DELIVERY_MODE == DeliveryMode.PERSISTENT; if (ttlString != null) { ttl = Long.parseLong(ttlString); } if (priorityString != null) { priority = Integer.parseInt(priorityString); } // TODO StringUtils.notBlank() would be more robust here persistent = persistentDeliveryString != null ? Boolean.valueOf(persistentDeliveryString).booleanValue() : connector.isPersistentDelivery(); connector.getJmsSupport().send(replyToProducer, replyToMessage, persistent, priority, ttl, topic); } // connector.getJmsSupport().send(replyToProducer, replyToMessage, // replyToDestination); logger.info("Reply Message sent to: " + replyToDestination); ((AbstractService) event.getService()).getStatistics().incSentReplyToEvent(); } catch (Exception e) { throw new DispatchException( JmsMessages.failedToCreateAndDispatchResponse(replyToDestination), returnMessage, null, e); } finally { connector.closeQuietly(replyToProducer); connector.closeQuietly(session); } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/weblogic/0000755000175000017500000000000011351410656026117 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/weblogic/package.html0000644000175000017500000000020110745677442030407 0ustar charlescharles Provides Jms connectivity with Weblogic-specific workarounds and improvements. mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/weblogic/WeblogicJmsConnector.java0000644000175000017500000000141110745677442033055 0ustar charlescharles/* * $Id: WeblogicJmsConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.weblogic; import org.mule.transport.jms.JmsConnector; /** * Weblogic-specific JMS connector. */ public class WeblogicJmsConnector extends JmsConnector { /** Constructs a new WeblogicJmsConnector. */ public WeblogicJmsConnector() { setTopicResolver(new WeblogicJmsTopicResolver(this)); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/weblogic/WeblogicJmsTopicResolver.javamule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/weblogic/WeblogicJmsTopicResolver.jav0000644000175000017500000000455610745677442033577 0ustar charlescharles/* * $Id: WeblogicJmsTopicResolver.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.weblogic; import org.mule.transport.jms.DefaultJmsTopicResolver; import org.mule.transport.jms.Jms102bSupport; import org.mule.transport.jms.JmsConnector; import org.mule.util.ClassUtils; import java.lang.reflect.Method; import javax.jms.Destination; import javax.jms.Queue; import javax.jms.Topic; /** * Weblogic-specific JMS topic resolver. Will use reflection and * a vendor API to detect topics. */ public class WeblogicJmsTopicResolver extends DefaultJmsTopicResolver { /** * Cached empty class array, used in the no-args reflective method call. */ protected static final Class[] PARAMETER_TYPES_NONE = new Class[0]; /** * Create an instance of the resolver. * * @param connector owning connector */ public WeblogicJmsTopicResolver(final JmsConnector connector) { super(connector); } /** * For Weblogic 8.x (JMS 1.0.2b) will use Weblogic-specific API call to test for topic. * For Weblogic 9.x and later (JMS 1.1) this call is not required due to the unified * messaging domains. * * @param destination a jms destination to test * @return {@code true} if the destination is a topic */ public boolean isTopic(final Destination destination) { // don't check the invariants, we already handle Weblogic's case here boolean topic = destination instanceof Topic; if (topic && destination instanceof Queue && getConnector().getJmsSupport() instanceof Jms102bSupport) { try { Method topicMethod = ClassUtils.getPublicMethod(destination.getClass(), "isTopic", PARAMETER_TYPES_NONE); topic = ((Boolean) topicMethod.invoke(destination, ClassUtils.NO_ARGS)).booleanValue(); } catch (Exception e) { logger.warn(e.getMessage()); } } return topic; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/MessageTransactionCallback.java0000644000175000017500000000140310745677442032412 0ustar charlescharles/* * $Id: MessageTransactionCallback.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.transaction.TransactionCallback; import javax.jms.Message; public abstract class MessageTransactionCallback implements TransactionCallback { protected final Message message; public MessageTransactionCallback(Message message) { this.message = message; } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/RedeliveryHandler.java0000644000175000017500000000370011002071522030563 0ustar charlescharles/* * $Id: RedeliveryHandler.java 11592 2008-04-18 10:09:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MessagingException; import javax.jms.JMSException; import javax.jms.Message; /** * RedeliveryHandler is used to control how redelivered messages are * processed by a connector. Typically, a messsage will be re-tried once or twice * before throwing an exception. Then the exception strategy on the connector can be * used to forward the message to a JMS queue or log the failure. */ public interface RedeliveryHandler { /** * The connector associated with this handler is set before * handleRedelivery() is called * * @param connector the connector associated with this handler */ public void setConnector(JmsConnector connector); /** * Process the redelivered message. If the JMS receiver should process the * message, it should be returned. Otherwise the connector should throw a * {@link MessageRedeliveredException} to indicate that the message should be * handled by the connector's exception handler. * * @param message * @throws JMSException if properties cannot be read from the JMSMessage * @throws MessageRedeliveredException should be thrown if the message should be * handled by the connection exception handler * @throws MessagingException if there is a problem reading or proessing the * message */ public void handleRedelivery(Message message) throws JMSException, MessageRedeliveredException, MessagingException; } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/SingleJmsMessageReceiver.java0000644000175000017500000000243610757615756032102 0ustar charlescharles/* * $Id: SingleJmsMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import javax.jms.Message; import javax.jms.MessageListener; /** * Registers a single Jms MessageListener for an endpoint */ public class SingleJmsMessageReceiver extends JmsMessageReceiver implements MessageListener { public SingleJmsMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); } public void onMessage(Message message) { try { JmsWorker worker = new JmsWorker(message, this); worker.run(); } catch (Exception e) { handleException(e); } } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/DefaultRedeliveryHandlerFactory.java0000644000175000017500000000122711002071522033422 0ustar charlescharles/* * $Id: DefaultRedeliveryHandlerFactory.java 11592 2008-04-18 10:09:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; public class DefaultRedeliveryHandlerFactory implements RedeliveryHandlerFactory { public RedeliveryHandler create() { return new DefaultRedeliveryHandler(); } } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsSupport.java0000644000175000017500000000550710745677442027342 0ustar charlescharles/* * $Id: JmsSupport.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; /** * JmsSupport is an interface that provides a polymorphic facade to * the JMS 1.0.2b and 1.1 API specifications. this interface is not intended for * general purpose use and should only be used with the Mule JMS connector. */ public interface JmsSupport { Connection createConnection(ConnectionFactory connectionFactory) throws JMSException; Connection createConnection(ConnectionFactory connectionFactory, String username, String password) throws JMSException; Session createSession(Connection connection, boolean topic, boolean transacted, int ackMode, boolean noLocal) throws JMSException; MessageProducer createProducer(Session session, Destination destination, boolean topic) throws JMSException; MessageConsumer createConsumer(Session session, Destination destination, String messageSelector, boolean noLocal, String durableName, boolean topic) throws JMSException; MessageConsumer createConsumer(Session session, Destination destination, boolean topic) throws JMSException; Destination createDestination(Session session, String name, boolean topic) throws JMSException; Destination createTemporaryDestination(Session session, boolean topic) throws JMSException; void send(MessageProducer producer, Message message, boolean topic) throws JMSException; void send(MessageProducer producer, Message message, boolean persistent, int priority, long ttl, boolean topic) throws JMSException; void send(MessageProducer producer, Message message, Destination dest, boolean topic) throws JMSException; void send(MessageProducer producer, Message message, Destination dest, boolean persistent, int priority, long ttl, boolean topic) throws JMSException; } mule-2.0.1/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageDispatcher.java0000644000175000017500000003361011005760560031235 0ustar charlescharles/* * $Id: JmsMessageDispatcher.java 11663 2008-04-30 03:03:12Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.Connector; import org.mule.api.transport.DispatchException; import org.mule.api.transport.MessageAdapter; import org.mule.transaction.IllegalTransactionStateException; import org.mule.transport.AbstractMessageDispatcher; import org.mule.transport.jms.i18n.JmsMessages; import org.mule.util.ClassUtils; import org.mule.util.NumberUtils; import org.mule.util.StringUtils; import org.mule.util.concurrent.Latch; import org.mule.util.concurrent.WaitableBoolean; import javax.jms.DeliveryMode; import javax.jms.Destination; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageListener; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TemporaryQueue; import javax.jms.TemporaryTopic; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import org.apache.commons.lang.BooleanUtils; /** * JmsMessageDispatcher is responsible for dispatching messages to JMS * destinations. All JMS semantics apply and settings such as replyTo and QoS * properties are read from the event properties or defaults are used (according to * the JMS specification) */ public class JmsMessageDispatcher extends AbstractMessageDispatcher { private JmsConnector connector; private Session cachedSession; public JmsMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (JmsConnector)endpoint.getConnector(); } protected void doDispatch(MuleEvent event) throws Exception { dispatchMessage(event); } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } private MuleMessage dispatchMessage(MuleEvent event) throws Exception { Session session = null; MessageProducer producer = null; MessageConsumer consumer = null; Destination replyTo = null; boolean transacted = false; boolean cached = false; boolean remoteSync = useRemoteSync(event); if (logger.isDebugEnabled()) { logger.debug("dispatching on endpoint: " + event.getEndpoint().getEndpointURI() + ". MuleEvent id is: " + event.getId() + ". Outbound transformers are: " + event.getEndpoint().getTransformers()); } try { session = connector.getSessionFromTransaction(); if (session != null) { transacted = true; // If a transaction is running, we can not receive any messages // in the same transaction. if (remoteSync) { throw new IllegalTransactionStateException( JmsMessages.connectorDoesNotSupportSyncReceiveWhenTransacted()); } } // Should we be caching sessions? Note this is not part of the JMS spec. // and is turned off by default. else if (event.getMessage().getBooleanProperty(JmsConstants.CACHE_JMS_SESSIONS_PROPERTY, connector.isCacheJmsSessions())) { cached = true; if (cachedSession != null) { session = cachedSession; } else { session = connector.getSession(event.getEndpoint()); cachedSession = session; } } else { session = connector.getSession(event.getEndpoint()); if (event.getEndpoint().getTransactionConfig().isTransacted()) { transacted = true; } } EndpointURI endpointUri = event.getEndpoint().getEndpointURI(); boolean topic = connector.getTopicResolver().isTopic(event.getEndpoint(), true); Destination dest = connector.getJmsSupport().createDestination(session, endpointUri.getAddress(), topic); producer = connector.getJmsSupport().createProducer(session, dest, topic); Object message = event.transformMessage(); if (!(message instanceof Message)) { throw new DispatchException( JmsMessages.checkTransformer("JMS message", message.getClass(), connector.getName()), event.getMessage(), event.getEndpoint()); } Message msg = (Message)message; if (event.getMessage().getCorrelationId() != null) { msg.setJMSCorrelationID(event.getMessage().getCorrelationId()); } MuleMessage eventMsg = event.getMessage(); // Some JMS implementations might not support the ReplyTo property. if (connector.supportsProperty(JmsConstants.JMS_REPLY_TO)) { Object tempReplyTo = eventMsg.removeProperty(JmsConstants.JMS_REPLY_TO); if (tempReplyTo != null) { if (tempReplyTo instanceof Destination) { replyTo = (Destination)tempReplyTo; } else { // TODO AP should this drill-down be moved into the resolver as well? boolean replyToTopic = false; String reply = tempReplyTo.toString(); int i = reply.indexOf(":"); if (i > -1) { // TODO MULE-1409 this check will not work for ActiveMQ 4.x, // as they have temp-queue:// and temp-topic:// URIs // Extract to a custom resolver for ActiveMQ4.x // The code path can be exercised, e.g. by a LoanBrokerESBTestCase String qtype = reply.substring(0, i); replyToTopic = JmsConstants.TOPIC_PROPERTY.equalsIgnoreCase(qtype); reply = reply.substring(i + 1); } replyTo = connector.getJmsSupport().createDestination(session, reply, replyToTopic); } } // Are we going to wait for a return event ? if (remoteSync && replyTo == null) { replyTo = connector.getJmsSupport().createTemporaryDestination(session, topic); } // Set the replyTo property if (replyTo != null) { msg.setJMSReplyTo(replyTo); } // Are we going to wait for a return event ? if (remoteSync) { try { consumer = connector.getJmsSupport().createConsumer(session, replyTo, topic); } catch (Exception e) { logger.warn(e); } } } // QoS support String ttlString = (String)eventMsg.removeProperty(JmsConstants.TIME_TO_LIVE_PROPERTY); String priorityString = (String)eventMsg.removeProperty(JmsConstants.PRIORITY_PROPERTY); String persistentDeliveryString = (String)eventMsg.removeProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY); long ttl = StringUtils.isNotBlank(ttlString) ? NumberUtils.toLong(ttlString) : Message.DEFAULT_TIME_TO_LIVE; int priority = StringUtils.isNotBlank(priorityString) ? NumberUtils.toInt(priorityString) : Message.DEFAULT_PRIORITY; boolean persistent = StringUtils.isNotBlank(persistentDeliveryString) ? BooleanUtils.toBoolean(persistentDeliveryString) : connector.isPersistentDelivery(); if (connector.isHonorQosHeaders()) { int priorityProp = eventMsg.getIntProperty(JmsConstants.JMS_PRIORITY, Connector.INT_VALUE_NOT_SET); int deliveryModeProp = eventMsg.getIntProperty(JmsConstants.JMS_DELIVERY_MODE, Connector.INT_VALUE_NOT_SET); if (priorityProp != Connector.INT_VALUE_NOT_SET) { priority = priorityProp; } if (deliveryModeProp != Connector.INT_VALUE_NOT_SET) { persistent = deliveryModeProp == DeliveryMode.PERSISTENT; } } if (logger.isDebugEnabled()) { logger.debug("Sending message of type " + ClassUtils.getSimpleName(msg.getClass())); } if (consumer != null && topic) { // need to register a listener for a topic Latch l = new Latch(); ReplyToListener listener = new ReplyToListener(l); consumer.setMessageListener(listener); connector.getJmsSupport().send(producer, msg, persistent, priority, ttl, topic); int timeout = event.getTimeout(); if (logger.isDebugEnabled()) { logger.debug("Waiting for return event for: " + timeout + " ms on " + replyTo); } l.await(timeout, TimeUnit.MILLISECONDS); consumer.setMessageListener(null); listener.release(); Message result = listener.getMessage(); if (result == null) { logger.debug("No message was returned via replyTo destination"); return null; } else { MessageAdapter adapter = connector.getMessageAdapter(result); return new DefaultMuleMessage(JmsMessageUtils.toObject(result, connector.getSpecification()), adapter); } } else { connector.getJmsSupport().send(producer, msg, persistent, priority, ttl, topic); if (consumer != null) { int timeout = event.getTimeout(); if (logger.isDebugEnabled()) { logger.debug("Waiting for return event for: " + timeout + " ms on " + replyTo); } Message result = consumer.receive(timeout); if (result == null) { logger.debug("No message was returned via replyTo destination"); return null; } else { MessageAdapter adapter = connector.getMessageAdapter(result); return new DefaultMuleMessage( JmsMessageUtils.toObject(result, connector.getSpecification()), adapter); } } } return null; } finally { connector.closeQuietly(producer); connector.closeQuietly(consumer); // TODO AP check if TopicResolver is to be utilized for temp destinations as well if (replyTo != null && (replyTo instanceof TemporaryQueue || replyTo instanceof TemporaryTopic)) { if (replyTo instanceof TemporaryQueue) { connector.closeQuietly((TemporaryQueue)replyTo); } else { // hope there are no more non-standard tricks from JMS vendors // here ;) connector.closeQuietly((TemporaryTopic)replyTo); } } // If the session is from the current transaction, it is up to the // transaction to close it. if (session != null && !cached && !transacted) { connector.closeQuietly(session); } } } protected MuleMessage doSend(MuleEvent event) throws Exception { MuleMessage message = dispatchMessage(event); return message; } protected void doDispose() { // template method } private class ReplyToListener implements MessageListener { private final Latch latch; private volatile Message message; private final WaitableBoolean released = new WaitableBoolean(false); public ReplyToListener(Latch latch) { this.latch = latch; } public Message getMessage() { return message; } public void release() { released.set(true); } public void onMessage(Message message) { this.message = message; latch.countDown(); try { released.whenTrue(null); } catch (InterruptedException e) { // ignored } } } } mule-2.0.1/transports/jms/src/main/resources/0000755000175000017500000000000011351410656021037 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/resources/META-INF/0000755000175000017500000000000011351410656022177 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012211002135175025032 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/jms/2.0/mule-jms.xsd=META-INF/mule-jms.xsd mule-2.0.1/transports/jms/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014211002115761025210 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/jms/2.0=org.mule.transport.jms.config.JmsNamespaceHandler mule-2.0.1/transports/jms/src/main/resources/META-INF/services/0000755000175000017500000000000011351410656024022 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410656024611 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410656025553 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410656027570 5ustar charlescharlesmule-2.0.1/transports/jms/src/main/resources/META-INF/services/org/mule/providers/jms.properties0000644000175000017500000000172511002153730032472 0ustar charlescharlesconnector=org.mule.transport.jms.JmsConnector dispatcher.factory=org.mule.transport.jms.JmsMessageDispatcherFactory requester.factory=org.mule.transport.jms.JmsMessageRequesterFactory #message.receiver=org.mule.transport.jms.JmsMessageReceiver message.receiver=org.mule.transport.jms.MultiConsumerJmsMessageReceiver #transacted.message.receiver=org.mule.transport.jms.JmsMessageReceiver transacted.message.receiver=org.mule.transport.jms.MultiConsumerJmsMessageReceiver xa.transacted.message.receiver=org.mule.transport.jms.XaTransactedJmsMessageReceiver message.adapter=org.mule.transport.jms.JmsMessageAdapter inbound.transformer=org.mule.transport.jms.transformers.JMSMessageToObject response.transformer=org.mule.transport.jms.transformers.ObjectToJMSMessage outbound.transformer=org.mule.transport.jms.transformers.ObjectToJMSMessage #service.error=Cannot create Jms connector using current service descriptor endpoint.builder=org.mule.endpoint.ResourceNameEndpointURIBuilder mule-2.0.1/transports/jms/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410656026332 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/jms/src/main/resources/META-INF/services/org/mule/i18n/jms-messages.propertiesmule-2.0.1/transports/jms/src/main/resources/META-INF/services/org/mule/i18n/jms-messages.properties0000644000175000017500000000162710700234357033053 0ustar charlescharles1=Jms Session cannot be null when transforming to a Jms payload 2=Jms connector does not support synchronous receive in transacted mode 3=Failed to get Jms session 4=Jms session should be transacted 5=Jms session should not be transacted 6=No message has been bound for acknowledgement 7=Message with id "{0}" has been marked for redelivery, this usually happens after a transaction rollback 8=Failed to create and dispatch response event over Jms destination "{0}" 9=Unable to obtain session factory for JmsClient Ack 10=A transaction manager must be configured on the Mule Manager when using an XA ConnionFactory 11="Message with id "{0}" has been redelivered "{1}" times, which exceeds the maxRedelivery setting on the connector 12=Invalid resource type. Expected {0}, but got {1} 13=Message is not a {0}, it is of type "{1}". Check the transformer for this Connector "{2}" 14=connectionFactory property must be set mule-2.0.1/transports/jms/src/main/resources/META-INF/services/org/mule/config/0000755000175000017500000000000011351410656027020 5ustar charlescharles././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/jms/src/main/resources/META-INF/services/org/mule/config/registry-bootstrap.propertiesmule-2.0.1/transports/jms/src/main/resources/META-INF/services/org/mule/config/registry-bootstrap.pr0000644000175000017500000000110510745677442033261 0ustar charlescharlestransformer.1=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=byte[] transformer.2=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=java.lang.String transformer.3=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=java.util.Hashtable transformer.4=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=java.util.Vector transformer.5=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=java.lang.Object transformer.6=org.mule.transport.jms.transformers.ObjectToJMSMessage,returnClass=javax.jms.Messagemule-2.0.1/transports/jms/src/main/resources/META-INF/mule-jms.xsd0000644000175000017500000002322211003265322024441 0ustar charlescharles The queue name. This cannot be used with the topic attribute (the two are exclusive). The topic name. The "topic:" prefix will be added automatically. This cannot be used with the queue attribute (the two are exclusive). This sets a selector on the underlying JMS transport. It is not a standard Mule filter - it cannot be combined with other filters. mule-2.0.1/transports/jms/src/test/0000755000175000017500000000000011351410654017056 5ustar charlescharlesmule-2.0.1/transports/jms/src/test/java/0000755000175000017500000000000011351410654017777 5ustar charlescharlesmule-2.0.1/transports/jms/src/test/java/org/0000755000175000017500000000000011351410654020566 5ustar charlescharlesmule-2.0.1/transports/jms/src/test/java/org/mule/0000755000175000017500000000000011351410654021530 5ustar charlescharlesmule-2.0.1/transports/jms/src/test/java/org/mule/transport/0000755000175000017500000000000011351410654023564 5ustar charlescharlesmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/0000755000175000017500000000000011351410654024355 5ustar charlescharlesmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/JmsMessageReceiverTestCase.java0000644000175000017500000000643310757615756032430 0ustar charlescharles/* * $Id: JmsMessageReceiverTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transport.MessageReceiver; import org.mule.config.i18n.MessageFactory; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transport.AbstractMessageReceiverTestCase; import com.mockobjects.dynamic.AnyConstraintMatcher; import com.mockobjects.dynamic.Mock; import javax.jms.Connection; import javax.jms.ConnectionFactory; public class JmsMessageReceiverTestCase extends AbstractMessageReceiverTestCase { private JmsConnector connector; protected void doSetUp() throws Exception { connector = new JmsConnector(); connector.setName("TestConnector"); connector.setSpecification("1.1"); Mock connectionFactory = new Mock(ConnectionFactory.class); Mock connection = new Mock(Connection.class); connectionFactory.expectAndReturn("createConnection", connection.proxy()); connection.expect("setExceptionListener", new AnyConstraintMatcher()); connection.expect("close"); connection.expect("start"); connection.expect("stop"); connector.setConnectionFactory((ConnectionFactory) connectionFactory.proxy()); connector.setMuleContext(muleContext); //muleContext.applyLifecycle(connector); muleContext.getRegistry().registerConnector(connector); super.doSetUp(); } public void testReceive() throws Exception { JmsMessageReceiver receiver = (JmsMessageReceiver)getMessageReceiver(); assertNotNull(receiver.getService()); assertNotNull(receiver.getConnector()); assertNotNull(receiver.getEndpoint()); // hmm how do we unit test a message receive // receiver.onMessage((Message) getValidMessage()); } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageReceiverTestCase#getMessageReceiver() */ public MessageReceiver getMessageReceiver() throws Exception { return new JmsMessageReceiver(endpoint.getConnector(), getTestService("orange", Orange.class), endpoint); } public Object getValidMessage() throws Exception { return JmsConnectorTestCase.getMessage(); } public InboundEndpoint getEndpoint() throws Exception { EndpointBuilder builder = new EndpointURIEndpointBuilder("jms://testcase", muleContext); if (connector == null) { throw new InitialisationException(MessageFactory.createStaticMessage("Connector has not been initialized."), null); } builder.setConnector(connector); endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(builder); return endpoint; } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/test/0000755000175000017500000000000011351410654025334 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/test/TestRedeliveryHandlerFactory.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/test/TestRedeliveryHandlerFactory.jav0000644000175000017500000000137511002071522033632 0ustar charlescharles/* * $Id: TestRedeliveryHandlerFactory.java 11592 2008-04-18 10:09:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.test; import org.mule.transport.jms.RedeliveryHandler; import org.mule.transport.jms.RedeliveryHandlerFactory; public class TestRedeliveryHandlerFactory implements RedeliveryHandlerFactory { public RedeliveryHandler create() { return new TestRedeliveryHandler(); } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/test/TestConnectionFactory.java0000644000175000017500000000344510745677442032514 0ustar charlescharles/* * $Id: TestConnectionFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.test; import javax.jms.Connection; import javax.jms.JMSException; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; public class TestConnectionFactory implements QueueConnectionFactory { private String providerProperty = "NOT_SET"; private String connectionFactoryProperty = "NOT_SET"; public Connection createConnection() throws JMSException { return null; } public Connection createConnection(String string, String string1) throws JMSException { return null; } public String getProviderProperty() { return providerProperty; } /** * Should NOT be called. */ public void setProviderProperty(final String providerProperty) { throw new IllegalStateException("Should never be called."); } public String getConnectionFactoryProperty() { return connectionFactoryProperty; } /** * MUST be called */ public void setConnectionFactoryProperty(final String connectionFactoryProperty) { this.connectionFactoryProperty = connectionFactoryProperty; } public QueueConnection createQueueConnection() throws JMSException { return null; } public QueueConnection createQueueConnection(String string, String string1) throws JMSException { return null; } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/test/TestRedeliveryHandler.java0000644000175000017500000000114310745677442032466 0ustar charlescharles/* * $Id: TestRedeliveryHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.test; import org.mule.transport.jms.DefaultRedeliveryHandler; public class TestRedeliveryHandler extends DefaultRedeliveryHandler { // nop } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/test/GenericTestJmsConnector.java0000644000175000017500000000161310745677442032761 0ustar charlescharles/* * $Id: GenericTestJmsConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.test; import org.mule.transport.jms.JmsConnector; public class GenericTestJmsConnector extends JmsConnector { private String providerProperty = "NOT_SET"; public GenericTestJmsConnector() { super(); } public String getProviderProperty() { return providerProperty; } public void setProviderProperty(String providerProperty) { this.providerProperty = providerProperty; } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/test/TestJmsConnector.java0000644000175000017500000000135610754365306031461 0ustar charlescharles/* * $Id: TestJmsConnector.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.test; import org.mule.api.lifecycle.InitialisationException; import org.mule.transport.jms.JmsConnector; public class TestJmsConnector extends JmsConnector { public TestJmsConnector() throws InitialisationException { setConnectionFactory(new TestConnectionFactory()); } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/JmsConnectionFactoryTestCase.java0000644000175000017500000000376710745677442033012 0ustar charlescharles/* * $Id: JmsConnectionFactoryTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jms.test.TestConnectionFactory; import javax.jms.ConnectionFactory; public class JmsConnectionFactoryTestCase extends FunctionalTestCase { protected String getConfigResources() { return "jms-connection-factory.xml"; } /** * Test providerProperties set on JmsConnector are not passed to the underlying * ConnectionFactory. */ public void testProviderPropertiesNotPassed() throws Exception { JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("jmsConnector1"); assertNotNull(c); ConnectionFactory cf = c.getConnectionFactory(); assertTrue(cf instanceof TestConnectionFactory); assertEquals("Provider properties should not be passed to the ConnectionFactory.", "NOT_SET", ((TestConnectionFactory)cf).getProviderProperty()); } /** * Test connectionFactoryProperties set on JmsConnector are actually passed to * the underlying ConnectionFactory. */ public void testConnectionFactoryPropertiesPassed() throws Exception { JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("jmsConnector2"); assertNotNull(c); ConnectionFactory cf = c.getConnectionFactory(); assertTrue(cf instanceof TestConnectionFactory); assertEquals("ConnectionFactory properties should be passed to the ConnectionFactory.", "TEST_VALUE", ((TestConnectionFactory)cf).getConnectionFactoryProperty()); } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/JmsMessageUtilsTestCase.java0000644000175000017500000000636010745677442031760 0ustar charlescharles/* * $Id: JmsMessageUtilsTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.jms.JmsConstants; import org.mule.transport.jms.JmsMessageUtils; import com.mockobjects.constraint.IsInstanceOf; import com.mockobjects.dynamic.Mock; import javax.jms.BytesMessage; import javax.jms.TextMessage; public class JmsMessageUtilsTestCase extends AbstractMuleTestCase { public void testHeaders() { // already valid headers are returned as-is, so we can assertSame assertSame("identifier", JmsMessageUtils.encodeHeader("identifier")); assertSame("_identifier", JmsMessageUtils.encodeHeader("_identifier")); assertSame("identifier_", JmsMessageUtils.encodeHeader("identifier_")); assertSame("ident_ifier", JmsMessageUtils.encodeHeader("ident_ifier")); assertEquals("_identifier", JmsMessageUtils.encodeHeader("-identifier")); assertEquals("identifier_", JmsMessageUtils.encodeHeader("identifier-")); assertEquals("ident_ifier", JmsMessageUtils.encodeHeader("ident-ifier")); assertEquals("_ident_ifier_", JmsMessageUtils.encodeHeader("-ident_ifier-")); assertEquals("_ident_ifier_", JmsMessageUtils.encodeHeader("-ident-ifier-")); } public void testTextMessageNullContent() throws Exception { Mock mockMessage = new Mock(TextMessage.class); mockMessage.expectAndReturn("getText", null); TextMessage mockTextMessage = (TextMessage)mockMessage.proxy(); byte[] result = JmsMessageUtils.toByteArray(mockTextMessage, JmsConstants.JMS_SPECIFICATION_102B); assertNotNull(result); assertEquals("Should return an empty byte array.", 0, result.length); mockMessage.verify(); } public void testByteMessageNullContent() throws Exception { // test for JMS 1.0.2-compliant code path Mock mockMessage = new Mock(BytesMessage.class); mockMessage.expect("reset"); mockMessage.expectAndReturn("readBytes", new IsInstanceOf(byte[].class), -1); BytesMessage mockBytesMessage = (BytesMessage)mockMessage.proxy(); byte[] result = JmsMessageUtils.toByteArray(mockBytesMessage, JmsConstants.JMS_SPECIFICATION_102B); assertNotNull(result); assertEquals("Should return an empty byte array.", 0, result.length); mockMessage.verify(); // test for JMS 1.1-compliant code path mockMessage = new Mock(BytesMessage.class); mockMessage.expect("reset"); mockMessage.expectAndReturn("getBodyLength", new Long(0)); mockBytesMessage = (BytesMessage)mockMessage.proxy(); result = JmsMessageUtils.toByteArray(mockBytesMessage, JmsConstants.JMS_SPECIFICATION_11); assertNotNull(result); assertEquals("Should return an empty byte array.", 0, result.length); mockMessage.verify(); } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/JmsExceptionReaderTestCase.java0000644000175000017500000000415410745677442032433 0ustar charlescharles/* * $Id: JmsExceptionReaderTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.DefaultMuleException; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.MessageFactory; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.jms.JmsExceptionReader; import java.io.IOException; import java.util.List; import java.util.Map; import javax.jms.JMSException; public class JmsExceptionReaderTestCase extends AbstractMuleTestCase { protected void doSetUp() throws Exception { ExceptionHelper.registerExceptionReader(new JmsExceptionReader()); } public void testNestedExceptionRetrieval() throws Exception { Exception testException = getException(); Throwable t = ExceptionHelper.getRootException(testException); assertNotNull(t); assertEquals("blah", t.getMessage()); assertNull(t.getCause()); t = ExceptionHelper.getRootMuleException(testException); assertNotNull(t); assertEquals("bar", t.getMessage()); assertNotNull(t.getCause()); List l = ExceptionHelper.getExceptionsAsList(testException); assertEquals(4, l.size()); Map info = ExceptionHelper.getExceptionInfo(testException); assertNotNull(info); assertEquals(2, info.size()); assertNotNull(info.get("JavaDoc")); assertEquals("1234", info.get("JMS Code")); } private Exception getException() { JMSException e = new JMSException("Jms error", "1234"); e.setLinkedException(new IOException("blah")); return new DefaultMuleException(MessageFactory.createStaticMessage("foo"), new DefaultMuleException( MessageFactory.createStaticMessage("bar"), e)); } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/vendors/0000755000175000017500000000000011351410654026035 5ustar charlescharles././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/vendors/ActiveMQXaJmsConnectorTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/vendors/ActiveMQXaJmsConnectorTestCas0000644000175000017500000000505210755041255033544 0ustar charlescharles/* * $Id: ActiveMQXaJmsConnectorTestCase.java 10803 2008-02-14 13:31:25Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.vendors; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.xa.ConnectionFactoryWrapper; import org.mule.transport.jms.xa.ConnectionInvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import javax.jms.Connection; import javax.jms.ConnectionFactory; import org.apache.activemq.ActiveMQXAConnectionFactory; public class ActiveMQXaJmsConnectorTestCase extends FunctionalTestCase { protected String getConfigResources() { return "activemq-xa.xml"; } public void testReflectiveXaCleanup() throws Exception { JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("jmsConnector"); assertNotNull(c); ConnectionFactory cf = c.getConnectionFactory(); assertTrue(cf instanceof ActiveMQXAConnectionFactory); ConnectionFactoryWrapper wrapper = new ConnectionFactoryWrapper(cf); // can be a proxy Connection connection = wrapper.createConnection(); assertNotNull(connection); assertTrue(Proxy.isProxyClass(connection.getClass())); try { final Class clazz = connection.getClass(); Method cleanupMethod; if (Proxy.isProxyClass(clazz)) { ConnectionInvocationHandler handler = (ConnectionInvocationHandler) Proxy.getInvocationHandler(connection); // this is really an XA connection connection = (Connection) handler.getTargetObject(); Class realConnectionClass = connection.getClass(); cleanupMethod = realConnectionClass.getMethod("cleanup", (Class[])null); } else { cleanupMethod = clazz.getMethod("cleanup", (Class[])null); } if (cleanupMethod != null) { cleanupMethod.invoke(connection, (Object[])null); } } finally { connection.close(); } // there should be no errors } }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/vendors/WeblogicJmsConnectorTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/vendors/WeblogicJmsConnectorTestCase.0000644000175000017500000000255310745677442033577 0ustar charlescharles/* * $Id: WeblogicJmsConnectorTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.vendors; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.JmsTopicResolver; import org.mule.transport.jms.weblogic.WeblogicJmsTopicResolver; public class WeblogicJmsConnectorTestCase extends FunctionalTestCase { protected String getConfigResources() { return "weblogic-config.xml"; } public void testDefaultConfig() throws Exception { JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("jmsConnector"); assertNotNull(c); // TODO has to be confirmed for Weblogic assertTrue(c.isEagerConsumer()); JmsTopicResolver resolver = c.getTopicResolver(); assertNotNull("Topic resolver must not be null.", resolver); assertTrue("Wrong topic resolver configured on the connector.", resolver instanceof WeblogicJmsTopicResolver); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/vendors/ActiveMQJmsConnectorTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/vendors/ActiveMQJmsConnectorTestCase.0000644000175000017500000000770611002071522033470 0ustar charlescharles/* * $Id: ActiveMQJmsConnectorTestCase.java 11592 2008-04-18 10:09:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.vendors; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jms.DefaultJmsTopicResolver; import org.mule.transport.jms.DefaultRedeliveryHandler; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.activemq.ActiveMQJmsConnector; import org.mule.transport.jms.test.TestRedeliveryHandler; import javax.jms.ConnectionFactory; import javax.jms.Session; import org.apache.activemq.ActiveMQConnectionFactory; public class ActiveMQJmsConnectorTestCase extends FunctionalTestCase { protected String getConfigResources() { return "activemq-config.xml"; } public void testConfigurationDefaults() throws Exception { JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("jmsConnector"); assertNotNull(c); assertFalse(c.isEagerConsumer()); ConnectionFactory cf = c.getConnectionFactory(); assertTrue(cf instanceof ActiveMQConnectionFactory); assertEquals(ActiveMQJmsConnector.DEFAULT_BROKER_URL, ((ActiveMQConnectionFactory) cf).getBrokerURL()); assertNotNull(c.getTopicResolver()); assertTrue("Wrong topic resolver configured on the connector.", c.getTopicResolver() instanceof DefaultJmsTopicResolver); } public void testDefaultActiveMqConnectorConfig() throws Exception { JmsConnector c = (JmsConnector) muleContext.getRegistry().lookupConnector("activeMqJmsConnector"); assertNotNull(c); assertTrue(c instanceof ActiveMQJmsConnector); assertNotNull(c.getConnectionFactory()); assertTrue(c.getConnectionFactory() instanceof ActiveMQConnectionFactory); assertEquals(Session.AUTO_ACKNOWLEDGE, c.getAcknowledgementMode()); assertNull(c.getUsername()); assertNull(c.getPassword()); assertNotNull(c.getRedeliveryHandlerFactory()); assertTrue(c.getRedeliveryHandlerFactory().create() instanceof DefaultRedeliveryHandler); assertFalse(c.isDurable()); assertFalse(c.isNoLocal()); assertFalse(c.isPersistentDelivery()); assertEquals(0, c.getMaxRedelivery()); assertFalse(c.isCacheJmsSessions()); assertTrue(c.isRecoverJmsConnections()); assertFalse(c.isEagerConsumer()); assertEquals("1.0.2b", c.getSpecification()); } public void testCustomActiveMqConnectorConfig() throws Exception { JmsConnector c = (JmsConnector) muleContext.getRegistry().lookupConnector("customActiveMqJmsConnector"); assertNotNull(c); assertTrue(c instanceof ActiveMQJmsConnector); assertNotNull(c.getConnectionFactory()); assertTrue(c.getConnectionFactory() instanceof ActiveMQConnectionFactory); assertEquals(Session.DUPS_OK_ACKNOWLEDGE, c.getAcknowledgementMode()); assertNull(c.getUsername()); assertNull(c.getPassword()); assertNotNull(c.getRedeliveryHandlerFactory()); assertTrue(c.getRedeliveryHandlerFactory().create() instanceof TestRedeliveryHandler); assertEquals("myClient", c.getClientId()); assertTrue(c.isDurable()); assertTrue(c.isNoLocal()); assertTrue(c.isPersistentDelivery()); assertEquals(5, c.getMaxRedelivery()); assertTrue(c.isCacheJmsSessions()); assertFalse(c.isRecoverJmsConnections()); assertFalse(c.isEagerConsumer()); assertEquals("1.1", c.getSpecification()); // 1.0.2b is the default, should be changed in the config } }././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/vendors/WebsphereEmbeddedJmsConnectorTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/vendors/WebsphereEmbeddedJmsConnector0000644000175000017500000000300510745677442033661 0ustar charlescharles/* * $Id: WebsphereEmbeddedJmsConnectorTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.vendors; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jms.DefaultJmsTopicResolver; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.JmsTopicResolver; public class WebsphereEmbeddedJmsConnectorTestCase extends FunctionalTestCase { protected String getConfigResources() { return "websphere-config.xml"; } public void testDefaultConfig() throws Exception { JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("jmsConnector"); assertNotNull(c); // TODO has to be confirmed for Websphere assertTrue(c.isEagerConsumer()); assertFalse("JMS connection recovery is not supported by Websphere Embedded provider.", c.isRecoverJmsConnections()); JmsTopicResolver resolver = c.getTopicResolver(); assertNotNull("Topic resolver must not be null.", resolver); assertTrue("Wrong topic resolver configured on the connector.", resolver instanceof DefaultJmsTopicResolver); } }mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/JmsTransformerTestCase.java0000644000175000017500000001052410745677442031652 0ustar charlescharles/* * $Id: JmsTransformerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleEvent; import org.mule.RequestContext; import org.mule.api.MuleMessage; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import org.mule.transport.jms.JmsMessageAdapter; import org.mule.transport.jms.transformers.ObjectToJMSMessage; import com.mockobjects.constraint.Constraint; import com.mockobjects.constraint.IsEqual; import com.mockobjects.dynamic.ConstraintMatcher; import com.mockobjects.dynamic.FullConstraintMatcher; import com.mockobjects.dynamic.Mock; import javax.jms.Message; import javax.jms.TextMessage; import org.apache.commons.collections.IteratorUtils; public class JmsTransformerTestCase extends AbstractMuleTestCase { public void testCustomJMSProperty() throws Exception { // Warning: this test is REALLY complicated :) // The purpose is to test whether custom JMS message properties survive // transformations when their name begins with "JMS" (MULE-1120). // First we need a JMS message wrapped into a MuleMessage. This turned out to // be trickier than expected (ha ha) since mocking a Message depends on the // specific calls made to the mocked class. Mock mockMessage = new Mock(TextMessage.class); mockMessage.expectAndReturn("getJMSCorrelationID", null); mockMessage.expectAndReturn("getJMSMessageID", "1234567890"); mockMessage.expectAndReturn("getJMSDeliveryMode", new Integer(1)); mockMessage.expectAndReturn("getJMSDestination", null); mockMessage.expectAndReturn("getJMSPriority", new Integer(4)); mockMessage.expectAndReturn("getJMSRedelivered", Boolean.FALSE); mockMessage.expectAndReturn("getJMSReplyTo", null); mockMessage.expectAndReturn("getJMSExpiration", new Long(0)); mockMessage.expectAndReturn("getJMSTimestamp", new Long(0)); mockMessage.expectAndReturn("getJMSType", null); mockMessage.expect("toString"); mockMessage.expect("toString"); mockMessage.expect("clearProperties"); mockMessage.expectAndReturn("getPropertyNames", IteratorUtils.asEnumeration(IteratorUtils.emptyIterator())); mockMessage.expectAndReturn("getObjectProperty", "JMS_CUSTOM_PROPERTY", "customValue"); ConstraintMatcher setPropertyMatcher = new FullConstraintMatcher(new Constraint[]{ new IsEqual("JMS_CUSTOM_PROPERTY"), new IsEqual("customValue")}); mockMessage.expect("setObjectProperty", setPropertyMatcher); Message mockTextMessage = (Message)mockMessage.proxy(); MuleMessage msg = new DefaultMuleMessage(new JmsMessageAdapter(mockTextMessage)); // Now we set a custom "JMS-like" property on the MuleMessage msg.setProperty("JMS_CUSTOM_PROPERTY", "customValue"); // The AbstractJMSTransformer will only apply JMS properties to the // underlying message when a "current event" is available, so we need to set // one. assertNotNull("The test hasn't been configured properly, no muleContext available", muleContext); RequestContext.setEvent(new DefaultMuleEvent(msg, MuleTestUtils.getTestEvent("previous", muleContext))); // The transformer we are going to use is ObjectToJMSMessage, which will // return the same (but mockingly modified!) JMS message that is used as // input. ObjectToJMSMessage transformer = new ObjectToJMSMessage(); Message transformed = (Message)transformer.transform(msg.getPayload()); // Finally we can assert that the setProperty done to the MuleMessage actually // made it through to the wrapped JMS Message. Yay! assertEquals("customValue", transformed.getObjectProperty("JMS_CUSTOM_PROPERTY")); // note that we don't verify() the mock since we have no way of knowing // whether toString was actually called (environment dependency) } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/config/0000755000175000017500000000000011351410654025622 5ustar charlescharlesmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/config/JmsTestNamespaceHandler.java0000644000175000017500000000214410745677442033212 0ustar charlescharles/* * $Id: JmsTestNamespaceHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.config; import org.mule.transport.jms.config.ConnectionFactoryDefinitionParser; import org.mule.transport.jms.config.JmsConnectorDefinitionParser; import org.mule.transport.jms.test.TestJmsConnector; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; /** Registers Bean Definition Parsers for the "jms" namespace. */ public class JmsTestNamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("connector", new JmsConnectorDefinitionParser(TestJmsConnector.class)); registerBeanDefinitionParser("connection-factory", new ConnectionFactoryDefinitionParser()); } }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/config/JmsVendorNamespaceHandlerTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/config/JmsVendorNamespaceHandlerTestC0000644000175000017500000000533210745677442033555 0ustar charlescharles/* * $Id: JmsVendorNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.config; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.activemq.ActiveMQJmsConnector; import org.mule.transport.jms.weblogic.WeblogicJmsConnector; import org.mule.transport.jms.websphere.WebsphereJmsConnector; import javax.jms.ConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory; /** * Tests the "jms" namespace for vendor-specific configs. */ public class JmsVendorNamespaceHandlerTestCase extends FunctionalTestCase { public JmsVendorNamespaceHandlerTestCase() { setStartContext(false); } protected String getConfigResources() { return "jms-vendor-namespace-config.xml"; } public void testActiveMqDefault() throws Exception { JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("activeMqConnectorDefaults"); assertNotNull(c); assertTrue(c instanceof ActiveMQJmsConnector); assertNotNull(c.getConnectionFactory()); ConnectionFactory cf = c.getConnectionFactory(); assertTrue(cf instanceof ActiveMQConnectionFactory); assertEquals(ActiveMQJmsConnector.DEFAULT_BROKER_URL, ((ActiveMQConnectionFactory) cf).getBrokerURL()); } public void testActiveMqBrokerURL() throws Exception { JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("activeMqConnectorBroker"); assertNotNull(c); assertTrue(c instanceof ActiveMQJmsConnector); assertNotNull(c.getConnectionFactory()); ConnectionFactory cf = c.getConnectionFactory(); assertTrue(cf instanceof ActiveMQConnectionFactory); assertEquals("tcp://localhost:1234", ((ActiveMQConnectionFactory) cf).getBrokerURL()); } public void testWeblogicDefaultConfig() throws Exception { JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("weblogicConnector"); assertNotNull(c); assertTrue(c instanceof WeblogicJmsConnector); } public void testWebsphereDefaultConfig() throws Exception { JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("websphereConnector"); assertNotNull(c); assertTrue(c instanceof WebsphereJmsConnector); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/config/JmsNamespaceHandlerTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/config/JmsNamespaceHandlerTestCase.ja0000644000175000017500000001452511002071522033433 0ustar charlescharles/* * $Id: JmsNamespaceHandlerTestCase.java 11592 2008-04-18 10:09:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.config; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.routing.filter.Filter; import org.mule.routing.filters.logic.NotFilter; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.mule.TestTransactionFactory; import org.mule.transport.jms.DefaultRedeliveryHandler; import org.mule.transport.jms.DefaultRedeliveryHandlerFactory; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.filters.JmsPropertyFilter; import org.mule.transport.jms.filters.JmsSelectorFilter; import org.mule.transport.jms.test.TestConnectionFactory; import org.mule.transport.jms.test.TestRedeliveryHandler; import javax.jms.Session; /** * Tests the "jms" namespace. */ public class JmsNamespaceHandlerTestCase extends FunctionalTestCase { public JmsNamespaceHandlerTestCase() { setStartContext(false); } protected String getConfigResources() { return "jms-namespace-config.xml"; } public void testDefaultConfig() throws Exception { JmsConnector c = (JmsConnector)muleContext.getRegistry().lookupConnector("jmsConnectorDefaults"); assertNotNull(c); assertNotNull(c.getConnectionFactory()); assertTrue(c.getConnectionFactory() instanceof TestConnectionFactory); assertEquals(Session.AUTO_ACKNOWLEDGE, c.getAcknowledgementMode()); assertNull(c.getUsername()); assertNull(c.getPassword()); assertNotNull(c.getRedeliveryHandlerFactory()); assertTrue(c.getRedeliveryHandlerFactory() instanceof DefaultRedeliveryHandlerFactory); assertTrue(c.getRedeliveryHandlerFactory().create() instanceof DefaultRedeliveryHandler); assertNull(c.getClientId()); assertFalse(c.isDurable()); assertFalse(c.isNoLocal()); assertFalse(c.isPersistentDelivery()); assertEquals(0, c.getMaxRedelivery()); assertFalse(c.isCacheJmsSessions()); assertTrue(c.isRecoverJmsConnections()); assertTrue(c.isEagerConsumer()); } public void testConnectorConfig() throws Exception { JmsConnector c = (JmsConnector) muleContext.getRegistry().lookupConnector("jmsConnector1"); assertNotNull(c); assertNotNull(c.getConnectionFactory()); assertTrue(c.getConnectionFactory() instanceof TestConnectionFactory); assertEquals(Session.DUPS_OK_ACKNOWLEDGE, c.getAcknowledgementMode()); assertEquals("myuser", c.getUsername()); assertEquals("mypass", c.getPassword()); assertNotNull(c.getRedeliveryHandlerFactory()); assertTrue(c.getRedeliveryHandlerFactory().create() instanceof TestRedeliveryHandler); assertEquals("myClient", c.getClientId()); assertTrue(c.isDurable()); assertTrue(c.isNoLocal()); assertTrue(c.isPersistentDelivery()); assertEquals(5, c.getMaxRedelivery()); assertTrue(c.isCacheJmsSessions()); assertFalse(c.isRecoverJmsConnections()); assertFalse(c.isEagerConsumer()); assertEquals("1.1", c.getSpecification()); // 1.0.2b is the default, should be changed in the config //test properties, default is 4 assertEquals(c.getNumberOfConcurrentTransactedReceivers(),7); } public void testCustomConnectorConfig() throws Exception { JmsConnector c = (JmsConnector) muleContext.getRegistry().lookupConnector("jmsConnector2"); assertNotNull(c); assertEquals("1.1", c.getSpecification()); // 1.0.2b is the default, should be changed in the config } public void testTestConnectorConfig() throws Exception { JmsConnector c = (JmsConnector) muleContext.getRegistry().lookupConnector("jmsConnector3"); assertNotNull(c); assertNotNull(c.getConnectionFactory()); assertTrue(c.getConnectionFactory() instanceof TestConnectionFactory); assertEquals(Session.DUPS_OK_ACKNOWLEDGE, c.getAcknowledgementMode()); assertNotNull(c.getRedeliveryHandlerFactory()); assertTrue(c.getRedeliveryHandlerFactory().create() instanceof TestRedeliveryHandler); assertEquals("myClient", c.getClientId()); assertTrue(c.isDurable()); assertTrue(c.isNoLocal()); assertTrue(c.isPersistentDelivery()); assertEquals(5, c.getMaxRedelivery()); assertTrue(c.isCacheJmsSessions()); assertFalse(c.isRecoverJmsConnections()); assertFalse(c.isEagerConsumer()); assertEquals("1.1", c.getSpecification()); // 1.0.2b is the default, should be changed in the config } public void testEndpointConfig() throws EndpointException, InitialisationException { ImmutableEndpoint endpoint1 = muleContext.getRegistry().lookupEndpointBuilder("endpoint1").buildInboundEndpoint(); assertNotNull(endpoint1); Filter filter1 = endpoint1.getFilter(); assertNotNull(filter1); assertTrue(filter1 instanceof JmsSelectorFilter); ImmutableEndpoint endpoint2 = muleContext.getRegistry().lookupEndpointBuilder("endpoint2").buildOutboundEndpoint(); assertNotNull(endpoint2); Filter filter2 = endpoint2.getFilter(); assertNotNull(filter2); assertTrue(filter2 instanceof NotFilter); Filter filter3 = ((NotFilter) filter2).getFilter(); assertNotNull(filter3); assertTrue(filter3 instanceof JmsPropertyFilter); } public void testCustomTransactions() throws EndpointException, InitialisationException { ImmutableEndpoint endpoint3 = muleContext.getRegistry().lookupEndpointBuilder("endpoint3").buildInboundEndpoint(); assertNotNull(endpoint3); TestTransactionFactory factory = (TestTransactionFactory) endpoint3.getTransactionConfig().getFactory(); assertNotNull(factory); assertEquals("foo", factory.getValue()); } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/JmsMessageAdapterTestCase.java0000644000175000017500000000342210754365306032225 0ustar charlescharles/* * $Id: JmsMessageAdapterTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.MessagingException; import org.mule.api.transport.MessageAdapter; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.transport.jms.JmsConstants; import org.mule.transport.jms.JmsMessageAdapter; public class JmsMessageAdapterTestCase extends AbstractMessageAdapterTestCase { /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#createAdapter() */ public MessageAdapter createAdapter(Object payload) throws MessagingException { return new JmsMessageAdapter(payload); } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#getValidMessage() */ public Object getValidMessage() throws Exception { return JmsConnectorTestCase.getMessage(); } public void testIllegalSpecification() throws Exception { JmsMessageAdapter a = (JmsMessageAdapter)this.createAdapter(this.getValidMessage()); // these will work a.setSpecification(JmsConstants.JMS_SPECIFICATION_102B); a.setSpecification(JmsConstants.JMS_SPECIFICATION_11); try { // this will not :) a.setSpecification("1.2"); } catch (IllegalArgumentException iax) { // OK } } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/issues/0000755000175000017500000000000011351410654025670 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/issues/JmsRemoteSyncMule2868TestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/issues/JmsRemoteSyncMule2868TestCase.0000644000175000017500000000202710754375733033261 0ustar charlescharles/* * $Id: JmsRemoteSyncMule2868TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.issues; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class JmsRemoteSyncMule2868TestCase extends FunctionalTestCase { protected String getConfigResources() { return "jms-remote-sync-mule2868.xml"; } public void testMule2868() throws MuleException { MuleClient muleClient = new MuleClient(); MuleMessage response = muleClient.send("vm://in", "test", null); assertEquals("test", response.getPayload()); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/issues/MessageAwareTransformersMule2685TestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/issues/MessageAwareTransformersMule260000644000175000017500000001121310745677442033576 0ustar charlescharles/* * $Id: MessageAwareTransformersMule2685TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.issues; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.routing.outbound.StaticRecipientList; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.integration.AbstractJmsFunctionalTestCase; import org.mule.transport.jms.transformers.AbstractJmsTransformer; import org.mule.transport.jms.transformers.ObjectToJMSMessage; import javax.jms.ConnectionFactory; import javax.jms.Message; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** JmsTransformersTestCase Tests the JMS transformer implementations. */ public class MessageAwareTransformersMule2685TestCase extends AbstractJmsFunctionalTestCase { protected final Log logger = LogFactory.getLog(getClass()); private Session session = null; protected String getConfigResources() { return "activemq-config.xml"; } protected void doSetUp() throws Exception { super.doSetUp(); JmsConnector connector = (JmsConnector) muleContext.getRegistry().lookupConnector("jmsConnector"); ConnectionFactory cf = connector.getConnectionFactory(); session = cf.createConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); } // @Override protected void doTearDown() throws Exception { RequestContext.setEvent(null); if (session != null) { session.close(); session = null; } } public void testMessageAwareTransformerChainedWithObjectToJMSMessage() throws Exception { RequestContext.setEvent(getTestEvent("test")); MuleMessage message = new DefaultMuleMessage("This is a test TextMessage"); SetTestRecipientsTransformer trans = new SetTestRecipientsTransformer(); MuleMessage result1 = (MuleMessage) trans.transform(message); // Check that transformer 1 set message property ok. assertEquals("vm://recipient1, vm://recipient1, vm://recipient3", result1.getProperty("recipients")); AbstractJmsTransformer trans2 = new SessionEnabledObjectToJMSMessage(session); Message result2 = (Message) trans2.transform(result1); // Test to see that ObjectToJMSMessage transformer transformed to JMS message correctly assertTrue("Transformed object should be a TextMessage", result2 instanceof TextMessage); assertEquals("This is a test TextMessage", ((TextMessage) result2).getText()); // Check to see if after the ObjectToJMSMessage transformer these properties are on JMS message assertEquals("vm://recipient1, vm://recipient1, vm://recipient3", result2.getStringProperty("recipients")); } /* * This class overrides getSession() to return the specified test MuleSession; otherwise we would need a * full-fledged JMS connector with dispatchers etc. TODO check if we really need this stateful transformer * now */ public static class SessionEnabledObjectToJMSMessage extends ObjectToJMSMessage { private final Session transformerSession; public SessionEnabledObjectToJMSMessage(Session session) { super(); transformerSession = session; } // @Override protected Session getSession() { return transformerSession; } } /** Test AbstractMessageAwareTransformer which sets Message properties */ private class SetTestRecipientsTransformer extends AbstractMessageAwareTransformer { public SetTestRecipientsTransformer() { registerSourceType(MuleMessage.class); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { String recipients = "vm://recipient1, vm://recipient1, vm://recipient3"; logger.debug("Setting recipients to '" + recipients + "'"); message.setProperty(StaticRecipientList.RECIPIENTS_PROPERTY, recipients); return message; } } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/JmsTransformersTestCase.java0000644000175000017500000002147010745677442032037 0ustar charlescharles/* * $Id: JmsTransformersTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.RequestContext; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.integration.AbstractJmsFunctionalTestCase; import org.mule.transport.jms.transformers.AbstractJmsTransformer; import org.mule.transport.jms.transformers.JMSMessageToObject; import org.mule.transport.jms.transformers.ObjectToJMSMessage; import org.mule.util.FileUtils; import org.mule.util.compression.CompressionStrategy; import org.mule.util.compression.GZipCompression; import java.io.File; import java.util.Arrays; import java.util.Map; import java.util.Properties; import javax.jms.BytesMessage; import javax.jms.ConnectionFactory; import javax.jms.MapMessage; import javax.jms.ObjectMessage; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.commons.io.output.ByteArrayOutputStream; /** * JmsTransformersTestCase Tests the JMS transformer implementations. */ public class JmsTransformersTestCase extends AbstractJmsFunctionalTestCase { private Session session = null; protected String getConfigResources() { return "activemq-config.xml"; } protected void doSetUp() throws Exception { super.doSetUp(); JmsConnector connector = (JmsConnector) muleContext.getRegistry().lookupConnector("jmsConnector"); ConnectionFactory cf = connector.getConnectionFactory(); session = cf.createConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); } // @Override protected void doTearDown() throws Exception { RequestContext.setEvent(null); if (session != null) { session.close(); session = null; } } public void testTransformObjectMessage() throws Exception { RequestContext.setEvent(getTestEvent("test")); ObjectMessage oMsg = session.createObjectMessage(); File f = FileUtils.newFile("/some/random/path"); oMsg.setObject(f); AbstractJmsTransformer trans = new JMSMessageToObject(); Object result = trans.transform(oMsg); assertTrue("Transformed object should be a File", result.getClass().equals(File.class)); AbstractJmsTransformer trans2 = new SessionEnabledObjectToJMSMessage(session); trans2.setReturnClass(ObjectMessage.class); Object result2 = trans2.transform(f); assertTrue("Transformed object should be an object message", result2 instanceof ObjectMessage); } public void testTransformTextMessage() throws Exception { RequestContext.setEvent(getTestEvent("test")); String text = "This is a test TextMessage"; TextMessage tMsg = session.createTextMessage(); tMsg.setText(text); AbstractJmsTransformer trans = new JMSMessageToObject(); Object result = trans.transform(tMsg); assertTrue("Transformed object should be a string", text.equals(result.toString())); AbstractJmsTransformer trans2 = new SessionEnabledObjectToJMSMessage(session); trans2.setReturnClass(TextMessage.class); Object result2 = trans2.transform(text); assertTrue("Transformed object should be a TextMessage", result2 instanceof TextMessage); } public void testTransformMapMessage() throws Exception { RequestContext.setEvent(getTestEvent("test")); Properties p = new Properties(); p.setProperty("Key1", "Value1"); p.setProperty("Key2", "Value2"); p.setProperty("Key3", "Value3"); AbstractJmsTransformer trans = new SessionEnabledObjectToJMSMessage(session); trans.setReturnClass(MapMessage.class); Object result2 = trans.transform(p); assertTrue("Transformed object should be a MapMessage", result2 instanceof MapMessage); MapMessage mMsg = (MapMessage)result2; AbstractJmsTransformer trans2 = new JMSMessageToObject(); trans2.setReturnClass(Map.class); Object result = trans2.transform(mMsg); assertTrue("Transformed object should be a Map", result instanceof Map); } public void testTransformByteMessage() throws Exception { RequestContext.setEvent(getTestEvent("test")); AbstractJmsTransformer trans = new SessionEnabledObjectToJMSMessage(session); trans.setReturnClass(BytesMessage.class); String text = "This is a test BytesMessage"; Object result2 = trans.transform(text.getBytes()); assertTrue("Transformed object should be a BytesMessage", result2 instanceof BytesMessage); AbstractJmsTransformer trans2 = new JMSMessageToObject(); trans2.setReturnClass(byte[].class); BytesMessage bMsg = (BytesMessage)result2; Object result = trans2.transform(bMsg); assertTrue("Transformed object should be a byte[]", result instanceof byte[]); String res = new String((byte[])result); assertEquals("Source and result should be equal", text, res); } // The following test was disabled for ActiveMQ 3.x because ActiveMQ 3.2.4 // unconditionally uncompresses BytesMessages for reading, even if it is not // supposed to do so (the layer doing the message reading seems to have no access // to the Broker configuration and seems to assume that compressed data was // compressed by ActiveMQ for more efficient wire transport). // This was fixed in 4.x. // For more information why this was VERY BAD read: // http://en.wikipedia.org/wiki/Zip_of_death public void testCompressedBytesMessage() throws Exception { RequestContext.setEvent(getTestEvent("test")); // use GZIP CompressionStrategy compressor = new GZipCompression(); // create compressible data ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (int i = 0; i < 5000; i++) { baos.write(i); } byte[] originalBytes = baos.toByteArray(); byte[] compressedBytes = compressor.compressByteArray(originalBytes); assertTrue("Source compressedBytes should be compressed", compressor.isCompressed(compressedBytes)); // now create a BytesMessage from the compressed byte[] AbstractJmsTransformer trans = new SessionEnabledObjectToJMSMessage(session); trans.setReturnClass(BytesMessage.class); Object result2 = trans.transform(compressedBytes); assertTrue("Transformed object should be a Bytes message", result2 instanceof BytesMessage); // check whether the BytesMessage contains the compressed bytes BytesMessage intermediate = (BytesMessage)result2; intermediate.reset(); byte[] intermediateBytes = new byte[(int)(intermediate.getBodyLength())]; int intermediateSize = intermediate.readBytes(intermediateBytes); assertTrue("Intermediate bytes must be compressed", compressor.isCompressed(intermediateBytes)); assertTrue("Intermediate bytes must be equal to compressed source", Arrays.equals(compressedBytes, intermediateBytes)); assertEquals("Intermediate bytes and compressed source must have same size", compressedBytes.length, intermediateSize); // now test the other way around: getting the byte[] from a manually created // BytesMessage AbstractJmsTransformer trans2 = new JMSMessageToObject(); trans2.setReturnClass(byte[].class); BytesMessage bMsg = session.createBytesMessage(); bMsg.writeBytes(compressedBytes); Object result = trans2.transform(bMsg); assertTrue("Transformed object should be a byte[]", result instanceof byte[]); assertTrue("Result should be compressed", compressor.isCompressed((byte[])result)); assertTrue("Source and result should be equal", Arrays.equals(compressedBytes, (byte[])result)); } /* * This class overrides getSession() to return the specified test MuleSession; * otherwise we would need a full-fledged JMS connector with dispatchers etc. * TODO check if we really need this stateful transformer now */ public static class SessionEnabledObjectToJMSMessage extends ObjectToJMSMessage { private final Session transformerSession; public SessionEnabledObjectToJMSMessage(Session session) { super(); transformerSession = session; } // @Override protected Session getSession() { return transformerSession; } } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/JmsEndpointTestCase.java0000644000175000017500000001261210745677442031130 0ustar charlescharles/* * $Id: JmsEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class JmsEndpointTestCase extends AbstractMuleTestCase { public void testWithoutFullUrl() throws Exception { EndpointURI url = new MuleEndpointURI("jms:/my.queue"); url.initialise(); assertEquals("jms", url.getScheme()); assertEquals("my.queue", url.getAddress()); assertNull(url.getEndpointName()); assertEquals("jms:/my.queue", url.toString()); } public void testFullUrlWithSlashes() throws Exception { EndpointURI url = new MuleEndpointURI("jms://my/queue"); url.initialise(); assertEquals("jms", url.getScheme()); assertEquals("my/queue", url.getAddress()); assertNull(url.getEndpointName()); assertEquals("jms://my/queue", url.toString()); } public void testWithoutFullUrlAndEndpointName() throws Exception { EndpointURI url = new MuleEndpointURI("jms:/my.queue?endpointName=jmsProvider"); url.initialise(); assertEquals("jms", url.getScheme()); assertEquals("my.queue", url.getAddress()); assertNotNull(url.getEndpointName()); assertEquals("jmsProvider", url.getEndpointName()); assertEquals("jms:/my.queue?endpointName=jmsProvider", url.toString()); } public void testJmsUrl() throws Exception { EndpointURI url = new MuleEndpointURI("jms://queue1?endpointName=jmsProvider"); url.initialise(); assertEquals("jms", url.getScheme()); assertEquals("queue1", url.getAddress()); assertEquals("jmsProvider", url.getEndpointName()); assertEquals("jms://queue1?endpointName=jmsProvider", url.toString()); } public void testJmsTopic() throws Exception { EndpointURI url = new MuleEndpointURI("jms://topic:topic1"); url.initialise(); assertEquals("jms", url.getScheme()); assertEquals("topic1", url.getAddress()); assertEquals("topic", url.getResourceInfo()); assertEquals(null, url.getEndpointName()); assertEquals("jms://topic:topic1", url.toString()); } public void testJmsTopicWithProvider() throws Exception { EndpointURI url = new MuleEndpointURI("jms://topic:topic1?endpointName=jmsProvider"); url.initialise(); assertEquals("jms", url.getScheme()); assertEquals("topic1", url.getAddress()); assertEquals("jmsProvider", url.getEndpointName()); assertEquals("topic", url.getResourceInfo()); assertEquals("jms://topic:topic1?endpointName=jmsProvider", url.toString()); } public void testJmsTopicWithUserInfo() throws Exception { EndpointURI url = new MuleEndpointURI("jms://user:password@topic:topic1"); url.initialise(); assertEquals("jms", url.getScheme()); assertEquals("topic1", url.getAddress()); assertEquals("topic", url.getResourceInfo()); assertEquals("user:password", url.getUserInfo()); assertEquals("user", url.getUser()); assertEquals("password", url.getPassword()); assertEquals("jms://user:password@topic:topic1", url.toString()); } public void testJmsTopicWithUserInfoAndProvider() throws Exception { EndpointURI url = new MuleEndpointURI("jms://user:password@topic:topic1?endpointName=jmsProvider"); url.initialise(); assertEquals("jms", url.getScheme()); assertEquals("topic1", url.getAddress()); assertEquals("jmsProvider", url.getEndpointName()); assertEquals("topic", url.getResourceInfo()); assertEquals("user:password", url.getUserInfo()); assertEquals("user", url.getUser()); assertEquals("password", url.getPassword()); assertEquals("jms://user:password@topic:topic1?endpointName=jmsProvider", url.toString()); } public void testJmsDestWithSlashesAndUserInfoUsingAddressParam() throws Exception { EndpointURI url = new MuleEndpointURI("jms://user:password@?address=/myQueues/myQueue"); url.initialise(); assertEquals("jms", url.getScheme()); assertEquals("/myQueues/myQueue", url.getAddress()); assertEquals("user:password", url.getUserInfo()); assertEquals("user", url.getUser()); assertEquals("password", url.getPassword()); assertEquals("jms://user:password@?address=/myQueues/myQueue", url.toString()); } public void testJmsDestWithSlashesAndUserInfo() throws Exception { EndpointURI url = new MuleEndpointURI("jms://user:password@myQueues/myQueue"); url.initialise(); assertEquals("jms", url.getScheme()); assertEquals("myQueues/myQueue", url.getAddress()); assertEquals("user:password", url.getUserInfo()); assertEquals("user", url.getUser()); assertEquals("password", url.getPassword()); assertEquals("jms://user:password@myQueues/myQueue", url.toString()); } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/DefaultJmsTopicResolverTestCase.java0000644000175000017500000001256610745677442033465 0ustar charlescharles/* * $Id: DefaultJmsTopicResolverTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jms.DefaultJmsTopicResolver; import org.mule.transport.jms.JmsConnector; import com.mockobjects.dynamic.Mock; import javax.jms.Queue; import javax.jms.Topic; public class DefaultJmsTopicResolverTestCase extends FunctionalTestCase { private JmsConnector connector; private DefaultJmsTopicResolver resolver; protected void doSetUp() throws Exception { super.doSetUp(); connector = (JmsConnector) muleContext.getRegistry().lookupConnector("jmsConnector"); resolver = (DefaultJmsTopicResolver) connector.getTopicResolver(); } protected String getConfigResources() { return "jms-topic-resolver.xml"; } public void testSameConnector() { assertSame(connector, resolver.getConnector()); } public void testEndpointNotTopicWithFallback() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep1"); assertFalse(resolver.isTopic(endpoint)); } public void testEndpointNotTopicWithFallback2() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep1"); assertFalse(resolver.isTopic(endpoint, true)); } public void testEndpointNotTopicNoFallback() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep1"); assertFalse(resolver.isTopic(endpoint, false)); } public void testEndpointTopicPropertyWithFallback() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep2"); assertTrue(resolver.isTopic(endpoint)); } public void testEndpointTopicPropertyWithFallback2() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep2"); assertTrue(resolver.isTopic(endpoint, true)); } public void testEndpointTopicPropertyNoFallback() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep2"); assertFalse(resolver.isTopic(endpoint, false)); } public void testEndpointTopicPrefixWithFallback() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep3"); assertTrue(resolver.isTopic(endpoint)); } public void testEndpointTopicPrefixWithFallback2() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep3"); assertTrue(resolver.isTopic(endpoint, true)); } public void testEndpointTopicPrefixNoFallback() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep3"); assertTrue(resolver.isTopic(endpoint, false)); } public void testEndpointTopicPrefixAndPropertyWithFallback() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep4"); assertTrue(resolver.isTopic(endpoint)); } public void testEndpointTopicPrefixAndPropertyWithFallback2() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep4"); assertTrue(resolver.isTopic(endpoint, true)); } public void testEndpointTopicPrefixAndPropertyNoFallback() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep4"); assertTrue(resolver.isTopic(endpoint, false)); } public void testEndpointTopicUsesEndpointProperties() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ep5"); assertTrue(resolver.isTopic(endpoint)); } public void testDestinationNotTopic() throws Exception { // prepare the mock Mock mock = new Mock(Queue.class); Queue queue = (Queue) mock.proxy(); assertFalse(resolver.isTopic(queue)); mock.verify(); } public void testDestinationTopic() throws Exception { // prepare the mock Mock mock = new Mock(Topic.class); Topic topic = (Topic) mock.proxy(); assertTrue(resolver.isTopic(topic)); mock.verify(); } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/JmsConnectorTestCase.java0000644000175000017500000000625110754365306031275 0ustar charlescharles/* * $Id: JmsConnectorTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.jms.JmsConnector; import org.mule.transport.jms.JmsConstants; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.ExceptionListener; import javax.jms.TextMessage; import org.apache.commons.collections.IteratorUtils; public class JmsConnectorTestCase extends AbstractConnectorTestCase { /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractConnectorTestCase#getConnectorName() */ // @Override public Connector createConnector() throws Exception { JmsConnector newConnector = new JmsConnector(); newConnector.setName("TestConnector"); newConnector.setSpecification(JmsConstants.JMS_SPECIFICATION_11); Mock connectionFactory = new Mock(ConnectionFactory.class); Mock connection = new Mock(Connection.class); connectionFactory.expectAndReturn("createConnection", connection.proxy()); connection.expect("setExceptionListener", C.isA(ExceptionListener.class)); connection.expect("close"); connection.expect("start"); connection.expect("stop"); connection.expect("stop"); connection.expect("setClientID", "mule.TestConnector"); newConnector.setConnectionFactory((ConnectionFactory) connectionFactory.proxy()); return newConnector; } public String getTestEndpointURI() { return "jms://test.queue"; } public Object getValidMessage() throws Exception { return getMessage(); } public static Object getMessage() throws Exception { Mock message = new Mock(TextMessage.class); message.expectAndReturn("getText", "Test JMS Message"); message.expectAndReturn("getText", "Test JMS Message"); message.expectAndReturn("getJMSCorrelationID", null); message.expectAndReturn("getJMSMessageID", "1234567890"); message.expectAndReturn("getJMSDeliveryMode", new Integer(1)); message.expectAndReturn("getJMSDestination", null); message.expectAndReturn("getJMSPriority", new Integer(4)); message.expectAndReturn("getJMSRedelivered", Boolean.FALSE); message.expectAndReturn("getJMSReplyTo", null); message.expectAndReturn("getJMSExpiration", new Long(0)); message.expectAndReturn("getJMSTimestamp", new Long(0)); message.expectAndReturn("getJMSType", null); message.expect("toString"); message.expectAndReturn("getPropertyNames", IteratorUtils.asEnumeration(IteratorUtils.emptyIterator())); return message.proxy(); } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/0000755000175000017500000000000011351410654026700 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsMuleSideDurableTopicTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsMuleSideDurableTopicTe0000644000175000017500000001043210745677442033613 0ustar charlescharles/* * $Id: JmsMuleSideDurableTopicTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; import javax.jms.DeliveryMode; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; import javax.jms.TopicConnection; import javax.jms.TopicConnectionFactory; import javax.jms.TopicPublisher; import javax.jms.TopicSession; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.command.ActiveMQTopic; public class JmsMuleSideDurableTopicTestCase extends AbstractJmsFunctionalTestCase { public static final String TOPIC_QUEUE_NAME = "durable.broadcast"; public static final String CONNECTOR1_NAME = "jmsConnectorC1"; protected String getConfigResources() { return "providers/activemq/jms-muleside-durable-topic.xml"; } public void testMuleDurableSubscriber() throws Exception { send(scenarioNoTx); receive(scenarioNoTx); receive(scenarioNoTx); muleContext.getRegistry().lookupConnector(CONNECTOR1_NAME).stop(); assertEquals(muleContext.getRegistry().lookupConnector(CONNECTOR1_NAME).isStarted(), false); logger.info(CONNECTOR1_NAME + " is stopped"); send(scenarioNoTx); muleContext.getRegistry().lookupConnector(CONNECTOR1_NAME).start(); logger.info(CONNECTOR1_NAME + " is started"); receive(scenarioNoTx); receive(scenarioNoTx); } Scenario scenarioNoTx = new NonTransactedScenario() { public String getInputQueue() { return TOPIC_QUEUE_NAME; } public void send(Session session, MessageProducer producer) throws JMSException { //publish and send is the same for ActiveMQ producer.send(session.createTextMessage(DEFAULT_INPUT_MESSAGE)); } public Message receive(Session session, MessageConsumer consumer) throws JMSException { Message message = consumer.receive(TIMEOUT); assertNotNull(message); assertTrue(TextMessage.class.isAssignableFrom(message.getClass())); assertEquals(((TextMessage) message).getText(), DEFAULT_OUTPUT_MESSAGE); return message; } }; public void send(Scenario scenario) throws Exception { TopicConnection connection = null; try { TopicConnectionFactory factory = new ActiveMQConnectionFactory(scenario.getBrokerUrl()); connection = factory.createTopicConnection(); connection.start(); TopicSession session = null; try { session = connection.createTopicSession(scenario.isTransacted(), scenario.getAcknowledge()); ActiveMQTopic destination = new ActiveMQTopic(scenario.getInputQueue()); TopicPublisher publisher = null; try { publisher = session.createPublisher(destination); publisher.setDeliveryMode(DeliveryMode.PERSISTENT); scenario.send(session, publisher); } catch (Exception e) { throw e; } finally { if (publisher != null) { publisher.close(); } } } catch (Exception e) { throw e; } finally { if (session != null) { session.close(); } } } catch (Exception e) { throw e; } finally { if (connection != null) { connection.close(); } } } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsTopicTestCase.java0000644000175000017500000000236310745677442032753 0ustar charlescharles/* * $Id: JmsTopicTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; /** * Message is put to topic with two subscribers */ public class JmsTopicTestCase extends AbstractJmsFunctionalTestCase { protected String getConfigResources() { return "providers/activemq/jms-topic.xml"; } public void testJmsTopic() throws Exception { // One message is sent. dispatchMessage(); // The same message is read twice from the same JMS topic. receiveMessage(); receiveMessage(); } public void testMultipleSend() throws Exception { // One message is sent. dispatchMessage(); dispatchMessage(); // The same message is read twice from the same JMS topic. receiveMessage(); receiveMessage(); receiveMessage(); receiveMessage(); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsXATransactionComponentTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsXATransactionComponent0000644000175000017500000000352410754375733033720 0ustar charlescharles/* * $Id: JmsXATransactionComponentTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; public class JmsXATransactionComponentTestCase extends AbstractJmsFunctionalTestCase { public static final String CONNECTOR1_NAME = "jmsConnector"; protected String getConfigResources() { return "providers/activemq/jms-xa-tx-component.xml"; } public void testOneGlobalTx() throws Exception { MuleMessage result = null; MuleClient client = new MuleClient(); client.dispatch("vm://in", DEFAULT_INPUT_MESSAGE, null); result = client.request("vm://out", TIMEOUT); assertNotNull(result); result = client.request("vm://out", SMALL_TIMEOUT); assertNull(result); muleContext.getRegistry().lookupConnector(CONNECTOR1_NAME).stop(); assertEquals(muleContext.getRegistry().lookupConnector(CONNECTOR1_NAME).isStarted(), false); logger.info(CONNECTOR1_NAME + " is stopped"); client.dispatch("vm://in", DEFAULT_INPUT_MESSAGE, null); Thread.sleep(1000); muleContext.getRegistry().lookupConnector(CONNECTOR1_NAME).start(); Thread.sleep(1000); logger.info(CONNECTOR1_NAME + " is started"); result = client.request("vm://out", TIMEOUT); assertNotNull(result); result = client.request("vm://out", SMALL_TIMEOUT); assertNull(result); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsSingleTransactionNoneTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsSingleTransactionNoneT0000644000175000017500000000160210755041255033673 0ustar charlescharles/* * $Id: JmsSingleTransactionNoneTestCase.java 10803 2008-02-14 13:31:25Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; /** * Send and recieve JmsMessage without any tx */ public class JmsSingleTransactionNoneTestCase extends AbstractJmsFunctionalTestCase { protected String getConfigResources() { return "providers/activemq/jms-single-tx-NONE.xml"; } public void testNoneTx() throws Exception { send(scenarioNoTx); receive(scenarioNoTx); receive(scenarioNotReceive); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/AbstractJmsFunctionalTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/AbstractJmsFunctionalTest0000644000175000017500000002204310755041255033730 0ustar charlescharles/* * $Id: AbstractJmsFunctionalTestCase.java 10803 2008-02-14 13:31:25Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; import javax.jms.TextMessage; import javax.transaction.HeuristicMixedException; import javax.transaction.HeuristicRollbackException; import javax.transaction.RollbackException; import javax.transaction.SystemException; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.command.ActiveMQQueue; /** * The main idea */ public abstract class AbstractJmsFunctionalTestCase extends FunctionalTestCase { public static final String DEFAULT_BROKER_URL = "vm://localhost?broker.persistent=false&broker.useJmx=false"; public static final String DEFAULT_INPUT_MESSAGE = "INPUT MESSAGE"; public static final String DEFAULT_OUTPUT_MESSAGE = "OUTPUT MESSAGE"; public static final String DEFAULT_INPUT_MQ_QUEUE_NAME = "in"; public static final String DEFAULT_INPUT_MULE_QUEUE_NAME = "jms://" + DEFAULT_INPUT_MQ_QUEUE_NAME; public static final String DEFAULT_OUTPUT_MQ_QUEUE_NAME = "out"; public static final String DEFAULT_OUTPUT_MULE_QUEUE_NAME = "jms://" + DEFAULT_OUTPUT_MQ_QUEUE_NAME; public static final long TIMEOUT = 5000; public static final long SMALL_TIMEOUT = 1000; public static final long LOCK_WAIT = 1000; public static final String CONNECTOR_NAME = "MuleMQConnector"; private MuleClient client; protected void dispatchMessage() throws Exception { client.dispatch(DEFAULT_INPUT_MULE_QUEUE_NAME, DEFAULT_INPUT_MESSAGE, null); } protected MuleMessage receiveMessage() throws Exception { MuleMessage result = client.request(DEFAULT_OUTPUT_MULE_QUEUE_NAME, TIMEOUT); assertNotNull(result); assertNotNull(result.getPayload()); assertNull(result.getExceptionPayload()); assertEquals(DEFAULT_OUTPUT_MESSAGE, result.getPayload()); return result; } public void runAsynchronousDispatching() throws Exception { dispatchMessage(); receiveMessage(); MuleMessage result = client.request(DEFAULT_OUTPUT_MULE_QUEUE_NAME, SMALL_TIMEOUT); assertNull(result); } protected void doSetUp() throws Exception { super.doSetUp(); client = new MuleClient(); } protected void doTearDown() throws Exception { super.doTearDown(); client.dispose(); } protected MuleClient getClient() { return client; } public void send(Scenario scenario) throws Exception { Connection connection = null; try { ConnectionFactory factory = new ActiveMQConnectionFactory(scenario.getBrokerUrl()); connection = factory.createConnection(); connection.start(); Session session = null; try { session = connection.createSession(scenario.isTransacted(), scenario.getAcknowledge()); ActiveMQQueue destination = new ActiveMQQueue(scenario.getInputQueue()); MessageProducer producer = null; try { producer = session.createProducer(destination); scenario.send(session, producer); } finally { if (producer != null) { producer.close(); } } } finally { if (session != null) { session.close(); } } } finally { if (connection != null) { connection.close(); } } } public Message receive(Scenario scenario) throws Exception { Connection connection = null; try { ConnectionFactory factory = new ActiveMQConnectionFactory(scenario.getBrokerUrl()); connection = factory.createConnection(); connection.start(); Session session = null; try { session = connection.createSession(scenario.isTransacted(), scenario.getAcknowledge()); ActiveMQQueue destination = new ActiveMQQueue(scenario.getOutputQueue()); MessageConsumer consumer = null; try { consumer = session.createConsumer(destination); return scenario.receive(session, consumer); } finally { if (consumer != null) { consumer.close(); } } } finally { if (session != null) { session.close(); } } } finally { if (connection != null) { connection.close(); } } } /////////////////////////////////////////////////////////////////////////////////////////////////// // Test Scenarios /////////////////////////////////////////////////////////////////////////////////////////////////// interface Scenario { String getBrokerUrl(); String getInputQueue(); String getOutputQueue(); int getAcknowledge(); void send(Session session, MessageProducer producer) throws JMSException, SystemException, HeuristicMixedException, HeuristicRollbackException, RollbackException; Message receive(Session session, MessageConsumer consumer) throws JMSException, SystemException, HeuristicMixedException, HeuristicRollbackException, RollbackException; boolean isTransacted(); } abstract class AbstractScenario implements Scenario { public String getBrokerUrl() { return DEFAULT_BROKER_URL; } public String getInputQueue() { return DEFAULT_INPUT_MQ_QUEUE_NAME; } public String getOutputQueue() { return DEFAULT_OUTPUT_MQ_QUEUE_NAME; } public int getAcknowledge() { return Session.AUTO_ACKNOWLEDGE; } public void send(Session session, MessageProducer producer) throws JMSException { producer.send(session.createTextMessage(DEFAULT_INPUT_MESSAGE)); applyTransaction(session); } public Message receive(Session session, MessageConsumer consumer) throws JMSException { Message message = consumer.receive(TIMEOUT); assertNotNull(message); assertTrue(TextMessage.class.isAssignableFrom(message.getClass())); assertEquals(DEFAULT_OUTPUT_MESSAGE, ((TextMessage) message).getText()); applyTransaction(session); return message; } abstract protected void applyTransaction(Session session) throws JMSException; } Scenario scenarioNoTx = new NonTransactedScenario(); class NonTransactedScenario extends AbstractScenario { public boolean isTransacted() { return false; } protected void applyTransaction(Session session) throws JMSException { // do nothing } } Scenario scenarioCommit = new ScenarioCommit(); class ScenarioCommit extends AbstractScenario { public boolean isTransacted() { return true; } protected void applyTransaction(Session session) throws JMSException { session.commit(); } } Scenario scenarioRollback = new ScenarioRollback(); class ScenarioRollback extends AbstractScenario { public boolean isTransacted() { return true; } protected void applyTransaction(Session session) throws JMSException { session.rollback(); } } Scenario scenarioNotReceive = new ScenarioNotReceive(); class ScenarioNotReceive extends NonTransactedScenario { // @Override public Message receive(Session session, MessageConsumer consumer) throws JMSException { Message message = consumer.receive(SMALL_TIMEOUT); assertNull(message); return message; } } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsDurableTopicSingleTxTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsDurableTopicSingleTxTe0000644000175000017500000000352310745677442033644 0ustar charlescharles/* * $Id: JmsDurableTopicSingleTxTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; /** * Testing durable topic with external subscriber */ public class JmsDurableTopicSingleTxTestCase extends JmsDurableTopicTestCase { public static final String TOPIC_QUEUE_NAME = "durable.broadcast"; protected String getConfigResources() { return "providers/activemq/jms-durable-topic-single-tx.xml"; } /** * @throws Exception */ public void testProviderDurableSubscriber() throws Exception { setClientId("Client1"); receive(scenarioNotReceive); setClientId("Client2"); receive(scenarioNotReceive); setClientId("Sender"); send(scenarioCommit); setClientId("Client1"); receive(scenarioCommit); receive(scenarioNotReceive); setClientId("Client2"); receive(scenarioRollback); receive(scenarioCommit); receive(scenarioNotReceive); } Scenario scenarioCommit = new ScenarioCommit() { public String getOutputQueue() { return TOPIC_QUEUE_NAME; } }; Scenario scenarioRollback = new ScenarioRollback() { public String getOutputQueue() { return TOPIC_QUEUE_NAME; } }; Scenario scenarioNotReceive = new ScenarioNotReceive() { public String getOutputQueue() { return TOPIC_QUEUE_NAME; } }; } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsDurableTopicTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsDurableTopicTestCase.j0000644000175000017500000000715610745677442033567 0ustar charlescharles/* * $Id: JmsDurableTopicTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.TopicConnection; import javax.jms.TopicConnectionFactory; import javax.jms.TopicSession; import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.command.ActiveMQTopic; public class JmsDurableTopicTestCase extends AbstractJmsFunctionalTestCase { public static final String TOPIC_QUEUE_NAME = "durable.broadcast"; private String clientId; protected String getConfigResources() { return "providers/activemq/jms-durable-topic.xml"; } public void testProviderDurableSubscriber() throws Exception { setClientId("Client1"); receive(scenarioNotReceive); setClientId("Client2"); receive(scenarioNotReceive); setClientId("Sender"); send(scenarioNonTx); setClientId("Client1"); receive(scenarioNonTx); receive(scenarioNotReceive); setClientId("Client2"); receive(scenarioNonTx); receive(scenarioNotReceive); } Scenario scenarioNonTx = new NonTransactedScenario() { public String getOutputQueue() { return TOPIC_QUEUE_NAME; } }; Scenario scenarioNotReceive = new ScenarioNotReceive() { public String getOutputQueue() { return TOPIC_QUEUE_NAME; } }; public Message receive(Scenario scenario) throws Exception { TopicConnection connection = null; try { TopicConnectionFactory factory = new ActiveMQConnectionFactory(scenario.getBrokerUrl()); connection = factory.createTopicConnection(); connection.setClientID(getClientId()); connection.start(); TopicSession session = null; try { session = connection.createTopicSession(scenario.isTransacted(), scenario.getAcknowledge()); ActiveMQTopic destination = new ActiveMQTopic(scenario.getOutputQueue()); MessageConsumer consumer = null; try { consumer = session.createDurableSubscriber(destination, getClientId()); return scenario.receive(session, consumer); } catch (Exception e) { throw e; } finally { if (consumer != null) { consumer.close(); } } } catch (Exception e) { throw e; } finally { if (session != null) { session.close(); } } } catch (Exception e) { throw e; } finally { if (connection != null) { connection.close(); } } } public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsSingleTransactionBeginOrJoinAndAlwaysBeginTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsSingleTransactionBegin0000644000175000017500000000206110745677442033710 0ustar charlescharles/* * $Id: JmsSingleTransactionBeginOrJoinAndAlwaysBeginTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; /** * BEGIN_OR_JOIN is same action as ALWAYS_BEGIN for current impl JmsTransaction */ public class JmsSingleTransactionBeginOrJoinAndAlwaysBeginTestCase extends AbstractJmsFunctionalTestCase { protected String getConfigResources() { return "providers/activemq/jms-single-tx-BEGIN_OR_JOIN_AND_ALWAYS_BEGIN.xml"; } public void testSingleTransactionBeginOrJoinAndAlwaysBegin() throws Exception { send(scenarioCommit); receive(scenarioRollback); receive(scenarioCommit); receive(scenarioNotReceive); } } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsQueueTestCase.java0000644000175000017500000000214010754365306032743 0ustar charlescharles/* * $Id: JmsQueueTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; /** * Message is sent to and received from simple queue. */ public class JmsQueueTestCase extends AbstractJmsFunctionalTestCase { protected String getConfigResources() { return "providers/activemq/jms-queue.xml"; } public void testJmsQueue() throws Exception { dispatchMessage(); receiveMessage(); receive(scenarioNotReceive); } public void testMultipleSend() throws Exception { dispatchMessage(); dispatchMessage(); dispatchMessage(); receiveMessage(); receiveMessage(); receiveMessage(); receive(scenarioNotReceive); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsSingleTransactionComponentTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsSingleTransactionCompo0000644000175000017500000000230410754365306033732 0ustar charlescharles/* * $Id: JmsSingleTransactionComponentTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; /** * There is a separate transaction for each service * when single transaction(action: BEGIN_OR_JOIN) and jms transport are used */ public class JmsSingleTransactionComponentTestCase extends AbstractJmsFunctionalTestCase { protected String getConfigResources() { return "providers/activemq/jms-single-tx-component.xml"; } public void testSingleTransactionComponent() throws Exception { send(scenarioCommit); // Receive message but roll back transaction. receive(scenarioRollback); // Receive message again and commit transaction. receive(scenarioCommit); // Verify there is no more message to receive. receive(scenarioNotReceive); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsMuleSideDurableTopicXATxTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsMuleSideDurableTopicXA0000644000175000017500000000410610754375733033552 0ustar charlescharles/* * $Id: JmsMuleSideDurableTopicXATxTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; /** * Testing durable topic * with XA transactions */ public class JmsMuleSideDurableTopicXATxTestCase extends AbstractJmsFunctionalTestCase { public static final String CONNECTOR1_NAME = "jmsConnectorC1"; protected String getConfigResources() { return "providers/activemq/jms-muleside-durable-topic-xa-tx.xml"; } public void testMuleXaTopic() throws Exception { MuleMessage result = null; MuleClient client = new MuleClient(); client.dispatch("vm://in", DEFAULT_INPUT_MESSAGE, null); result = client.request("vm://out", TIMEOUT); assertNotNull(result); result = client.request("vm://out", TIMEOUT); assertNotNull(result); result = client.request("vm://out", SMALL_TIMEOUT); assertNull(result); muleContext.getRegistry().lookupConnector(CONNECTOR1_NAME).stop(); assertEquals(muleContext.getRegistry().lookupConnector(CONNECTOR1_NAME).isStarted(), false); logger.info(CONNECTOR1_NAME + " is stopped"); client.dispatch("vm://in", DEFAULT_INPUT_MESSAGE, null); Thread.sleep(1000); muleContext.getRegistry().lookupConnector(CONNECTOR1_NAME).start(); Thread.sleep(1000); logger.info(CONNECTOR1_NAME + " is started"); result = client.request("vm://out", TIMEOUT); assertNotNull(result); result = client.request("vm://out", TIMEOUT); assertNotNull(result); result = client.request("vm://out", SMALL_TIMEOUT); assertNull(result); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsXAAlwaysBeginTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsXAAlwaysBeginTestCase.0000644000175000017500000000703310754365306033461 0ustar charlescharles/* * $Id: JmsXAAlwaysBeginTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; import java.util.List; import javax.transaction.Transaction; import javax.transaction.xa.XAException; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class JmsXAAlwaysBeginTestCase extends AbstractJmsFunctionalTestCase { private static final List committedTx = new CopyOnWriteArrayList(); private static final List rolledbackTx = new CopyOnWriteArrayList(); protected static final Log logger = LogFactory.getLog(JmsXAAlwaysBeginTestCase.class); protected String getConfigResources() { return "providers/activemq/jms-xa-tx-ALWAYS_BEGIN.xml"; } public void testAlwaysBeginTx() throws Exception { send(scenarioNoTx); receive(scenarioNoTx); receive(scenarioNoTx); receive(scenarioNotReceive); assertEquals(committedTx.size(), 0); assertEquals(rolledbackTx.size(), 2); } public static class TestRollbackComponent { public Object processObject(Object a) throws Exception { logger.debug("TestRollbackComponent " + a); TestResource res = new TestResource(); Transaction currentTrans = muleContext.getTransactionManager().getTransaction(); currentTrans.enlistResource(res); currentTrans.setRollbackOnly(); return DEFAULT_OUTPUT_MESSAGE; } } public static class TestResource implements XAResource { public void commit(Xid id, boolean onePhase) throws XAException { committedTx.add(id); logger.debug("XA_COMMIT[" + id + "]"); } public void end(Xid xid, int flags) throws XAException { logger.debug("XA_END[" + xid + "] Flags=" + flags); } public void forget(Xid xid) throws XAException { logger.debug("XA_FORGET[" + xid + "]"); } public int getTransactionTimeout() throws XAException { return (_timeout); } public boolean isSameRM(XAResource xares) throws XAException { return (xares.equals(this)); } public int prepare(Xid xid) throws XAException { logger.debug("XA_PREPARE[" + xid + "]"); return (XA_OK); } public Xid[] recover(int flag) throws XAException { logger.debug("RECOVER[" + flag + "]"); return (null); } public void rollback(Xid xid) throws XAException { rolledbackTx.add(xid); logger.debug("XA_ROLLBACK[" + xid + "]"); } public boolean setTransactionTimeout(int seconds) throws XAException { _timeout = seconds; return (true); } public void start(Xid xid, int flags) throws XAException { logger.debug("XA_START[" + xid + "] Flags=" + flags); } protected int _timeout = 0; } }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsExceptionStrategyTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsExceptionStrategyTestC0000644000175000017500000000726510755041255033737 0ustar charlescharles/* * $Id: JmsExceptionStrategyTestCase.java 10803 2008-02-14 13:31:25Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; import org.mule.api.config.MuleProperties; import org.mule.message.ExceptionMessage; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.ObjectMessage; import javax.jms.Session; /** * Tests a transactional exception strategy. */ public class JmsExceptionStrategyTestCase extends AbstractJmsFunctionalTestCase { public static final String DEADLETTER_QUEUE_NAME = "dead.letter"; protected String getConfigResources() { return "providers/activemq/jms-exception-strategy.xml"; } public void testTransactedRedeliveryToDLDestination() throws Exception { send(scenarioDeadLetter); // Verify outbound message did _not_ get delivered. receive(scenarioNotReceive); // Verify message got sent to dead letter queue instead. receive(scenarioDeadLetter); } public void testTransactedRedeliveryToDLDestinationRollback() throws Exception { send(scenarioDeadLetter); // Receive message but roll back transaction. receive(scenarioDeadLetterRollback); // Receive message again and commit transaction. receive(scenarioDeadLetter); // Verify there is no more message to receive. receive(scenarioDeadLetterNotReceive); } Scenario scenarioDeadLetter = new ScenarioDeadLetter(); class ScenarioDeadLetter extends ScenarioCommit { // @Override public String getOutputQueue() { return DEADLETTER_QUEUE_NAME; } // @Override public Message receive(Session session, MessageConsumer consumer) throws JMSException { // Verify message got sent to dead letter queue. Message message = consumer.receive(TIMEOUT); assertNotNull(message); assertTrue("Message should be ObjectMessage but is " + message.getClass(), message instanceof ObjectMessage); Object obj = ((ObjectMessage) message).getObject(); assertTrue(obj instanceof ExceptionMessage); // The payload should be the original message, not the reply message since the FTC threw an exception. assertEquals(DEFAULT_INPUT_MESSAGE, ((ExceptionMessage) obj).getPayload()); String dest = message.getStringProperty(MuleProperties.MULE_ENDPOINT_PROPERTY); assertNotNull(dest); assertEquals("jms://" + DEADLETTER_QUEUE_NAME, dest); applyTransaction(session); return message; } } Scenario scenarioDeadLetterRollback = new ScenarioDeadLetterRollback(); class ScenarioDeadLetterRollback extends ScenarioDeadLetter { // @Override protected void applyTransaction(Session session) throws JMSException { session.rollback(); } } Scenario scenarioDeadLetterNotReceive = new ScenarioDeadLetterNotReceive(); class ScenarioDeadLetterNotReceive extends ScenarioDeadLetter { // @Override public Message receive(Session session, MessageConsumer consumer) throws JMSException { Message message = consumer.receive(SMALL_TIMEOUT); assertNull(message); return message; } } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsClientAcknowledgeTransactionTestCase.javamule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/integration/JmsClientAcknowledgeTrans0000644000175000017500000000375510745677442033721 0ustar charlescharles/* * $Id: JmsClientAcknowledgeTransactionTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms.integration; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Session; /** * Test jms using JmsClientAcknowledgeTransactionFactory */ public class JmsClientAcknowledgeTransactionTestCase extends AbstractJmsFunctionalTestCase { protected String getConfigResources() { return "providers/activemq/jms-client-acknowledge-tx.xml"; } public void testJmsClientAcknowledgeTransaction() throws Exception { send(scenarioAcknowledge); receive(scenarioWithoutAcknowledge); receive(scenarioAcknowledge); receive(scenarioNotReceive); } Scenario scenarioAcknowledge = new NonTransactedScenario() { //@Override public int getAcknowledge() { return Session.CLIENT_ACKNOWLEDGE; } public void send(Session session, MessageProducer producer) throws JMSException { producer.send(session.createTextMessage(DEFAULT_INPUT_MESSAGE)); } public Message receive(Session session, MessageConsumer consumer) throws JMSException { Message message = consumer.receive(TIMEOUT); assertNotNull(message); message.acknowledge(); return message; } }; Scenario scenarioWithoutAcknowledge = new NonTransactedScenario() { //@Override public int getAcknowledge() { return Session.CLIENT_ACKNOWLEDGE; } }; } mule-2.0.1/transports/jms/src/test/java/org/mule/transport/jms/Jms11SupportTestCase.java0000644000175000017500000000743510745677442031175 0ustar charlescharles/* * $Id: Jms11SupportTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jms; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.jms.Jms11Support; import org.mule.transport.jms.JmsConnector; import com.mockobjects.constraint.Constraint; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.FullConstraintMatcher; import com.mockobjects.dynamic.Mock; import javax.jms.JMSException; import javax.jms.Queue; import javax.jms.Session; import javax.jms.Topic; public class Jms11SupportTestCase extends AbstractMuleTestCase { public void testNoLocalCalledForDurableTopic() throws Exception { Jms11Support jmsSupport = new Jms11Support(new JmsConnector()); Mock mockTopic = new Mock(Topic.class); Topic topic = (Topic)mockTopic.proxy(); String durableName = "durableName"; boolean noLocal = true; FullConstraintMatcher matcher = new FullConstraintMatcher(new Constraint[]{C.eq(topic), C.eq(durableName), C.IS_NULL, C.IS_TRUE}); Mock mockSession = new Mock(Session.class); mockSession.expect("createDurableSubscriber", matcher); jmsSupport.createConsumer((Session)mockSession.proxy(), topic, null, noLocal, durableName, true); mockTopic.verify(); mockSession.verify(); } public void testNoLocalCalledForNonDurableTopic() throws Exception { Jms11Support jmsSupport = new Jms11Support(new JmsConnector()); Mock mockTopic = new Mock(Topic.class); Topic topic = (Topic)mockTopic.proxy(); boolean noLocal = true; FullConstraintMatcher matcher = new FullConstraintMatcher(new Constraint[]{C.eq(topic), C.IS_NULL, C.IS_TRUE}); Mock mockSession = new Mock(Session.class); mockSession.expect("createConsumer", matcher); jmsSupport.createConsumer((Session)mockSession.proxy(), topic, null, noLocal, null, true); mockTopic.verify(); mockSession.verify(); } public void testNoLocalNotCalledForQueue() throws Exception { Jms11Support jmsSupport = new Jms11Support(new JmsConnector()); Mock mockQueue = new Mock(Queue.class); Queue queue = (Queue)mockQueue.proxy(); boolean noLocal = true; FullConstraintMatcher matcher = new FullConstraintMatcher(new Constraint[]{C.eq(queue), C.IS_NULL}); Mock mockSession = new Mock(Session.class); mockSession.expect("createConsumer", matcher); jmsSupport.createConsumer((Session)mockSession.proxy(), queue, null, noLocal, null, false); mockQueue.verify(); mockSession.verify(); } public void testDurableWithQueueThrowsException() throws Exception { Jms11Support jmsSupport = new Jms11Support(new JmsConnector()); Mock mockQueue = new Mock(Queue.class); Queue queue = (Queue)mockQueue.proxy(); String durableName = "durableName"; boolean noLocal = true; Mock mockSession = new Mock(Session.class); try { jmsSupport.createConsumer((Session)mockSession.proxy(), queue, null, noLocal, durableName, false); } catch (JMSException jmsex) { // expected assertEquals("Wrong exception text.", "A durable subscriber name was set but the destination was not a Topic", jmsex.getMessage()); } mockQueue.verify(); mockSession.verify(); } } mule-2.0.1/transports/jms/src/test/resources/0000755000175000017500000000000011351410655021071 5ustar charlescharlesmule-2.0.1/transports/jms/src/test/resources/providers/0000755000175000017500000000000011351410655023106 5ustar charlescharlesmule-2.0.1/transports/jms/src/test/resources/providers/activemq/0000755000175000017500000000000011351410655024717 5ustar charlescharlesmule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-xa-tx-ALWAYS_BEGIN.xml0000644000175000017500000000531510754365306031207 0ustar charlescharles ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-muleside-durable-topic-xa-tx.xmlmule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-muleside-durable-topic-xa-tx.xml0000644000175000017500000001014710745174725033644 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-xa-tx-component.xml0000644000175000017500000001234610745174725031312 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-muleside-durable-topic.xml0000644000175000017500000000477011002156421032566 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-topic.xml0000644000175000017500000000460610745174725027367 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-single-tx-component.xml0000644000175000017500000000704110745174725032157 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-client-acknowledge-tx.xml0000644000175000017500000000515410745174725032440 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-durable-topic-single-tx.xml0000644000175000017500000000340410745174725032706 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-durable-topic.xml0000644000175000017500000000324310745174725030777 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-single-tx-NONE.xml0000644000175000017500000000413210745174725030712 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-exception-strategy.xml0000644000175000017500000000405310771015120032061 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-queue.xml0000644000175000017500000000425410754365306027371 0ustar charlescharles ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-single-tx-BEGIN_OR_JOIN_AND_ALWAYS_BEGIN.xmlmule-2.0.1/transports/jms/src/test/resources/providers/activemq/jms-single-tx-BEGIN_OR_JOIN_AND_ALWA0000644000175000017500000000520410747501743032702 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/log4j.properties0000644000175000017500000000063410674031545024235 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN #log4j.logger.com.arjuna=DEBUG #log4j.logger.org.apache.activemq.TransactionContext=DEBUG mule-2.0.1/transports/jms/src/test/resources/jms-vendor-namespace-config.xml0000644000175000017500000000215310754070267027104 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/jms-namespace-config.xml0000644000175000017500000000633511002071522025575 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/weblogic-config.xml0000644000175000017500000000154410745677442024674 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/activemq-config.xml0000644000175000017500000000320411002071522024653 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/websphere-config.xml0000644000175000017500000000154510745677442025066 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/jms-connection-factory.xml0000644000175000017500000000232610745677442026230 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/jms-topic-resolver.xml0000644000175000017500000000267310745677442025406 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/activemq-xa.xml0000644000175000017500000000150410745162661024041 0ustar charlescharles mule-2.0.1/transports/jms/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006210754403514025743 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/transports/jms/src/test/resources/jms-remote-sync-mule2868.xml0000644000175000017500000000313410754403514026142 0ustar charlescharles mule-2.0.1/transports/jms/pom.xml0000644000175000017500000001013011006063605016615 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-jms JMS Transport A Mule transport for Jms Connectivity. maven-surefire-plugin pertest **/*TestCase.java **/*Test.java org.apache.maven.plugins maven-jar-plugin test-jar org.mule mule-core ${version} org.apache.geronimo.specs geronimo-jms_1.1_spec org.mule.tests mule-tests-functional ${version} test org.mule.transports mule-transport-tcp ${version} test org.mule.transports mule-transport-vm ${version} test org.mule.modules mule-module-client ${version} test org.mule.modules mule-module-jbossts ${version} test org.apache.activemq activemq-core test geronimo-j2ee-management_1.0_spec org.apache.geronimo.specs osgi org.apache.felix maven-bundle-plugin org.mule.transport.jms.* mule-2.0.1/transports/email/0000755000175000017500000000000011351410652015604 5ustar charlescharlesmule-2.0.1/transports/email/src/0000755000175000017500000000000011351410650016371 5ustar charlescharlesmule-2.0.1/transports/email/src/main/0000755000175000017500000000000011351410652017317 5ustar charlescharlesmule-2.0.1/transports/email/src/main/java/0000755000175000017500000000000011351410650020236 5ustar charlescharlesmule-2.0.1/transports/email/src/main/java/org/0000755000175000017500000000000011351410650021025 5ustar charlescharlesmule-2.0.1/transports/email/src/main/java/org/mule/0000755000175000017500000000000011351410650021767 5ustar charlescharlesmule-2.0.1/transports/email/src/main/java/org/mule/transport/0000755000175000017500000000000011351410650024023 5ustar charlescharlesmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/0000755000175000017500000000000011351410652025114 5ustar charlescharlesmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/package.html0000644000175000017500000000017210745677442027417 0ustar charlescharles Mule Provides pop3, smtp and imap connectivity for Mule. ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/DefaultDataContentHandlerFactory.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/DefaultDataContentHandlerFactory.0000644000175000017500000000652610745677442033507 0ustar charlescharles/* * $Id:DefaultDataContentHandlerFactory.java 7555 2007-07-18 03:17:16Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import com.sun.mail.handlers.image_gif; import com.sun.mail.handlers.image_jpeg; import com.sun.mail.handlers.text_html; import com.sun.mail.handlers.text_plain; import com.sun.mail.handlers.text_xml; import java.util.HashMap; import java.util.Map; import javax.activation.DataContentHandler; import javax.activation.DataContentHandlerFactory; import javax.activation.DataHandler; /** * This is a default registry for mapping MimeTypes to DataHandlers */ public class DefaultDataContentHandlerFactory implements DataContentHandlerFactory { static { //If this class gets loaded then register this Factory with Activation DataHandler.setDataContentHandlerFactory(getInstance()); } private Map types = new HashMap(); private Map classToHandlers = new HashMap(); private Map classToType = new HashMap(); private static DefaultDataContentHandlerFactory factory; public static DefaultDataContentHandlerFactory getInstance() { if(factory==null) { factory = new DefaultDataContentHandlerFactory(); } return factory; } private DefaultDataContentHandlerFactory() { register(new image_jpeg()); register(new image_gif()); register(new text_plain()); register(new text_xml()); register(new text_html()); } public DataContentHandler createDataContentHandler(String contentType) { return (DataContentHandler) types.get(contentType); } public DataContentHandler getDataContentHandler(Class clazz) { return (DataContentHandler) classToHandlers.get(clazz); } public String getContentType(Class clazz) { return (String) classToHandlers.get(clazz); } /** * Register a DataContentHandler for a particular MIME type. * @param contentType The Content Type. * @param handler The DataContentHandler. */ public void register(String contentType, Class clazz, DataContentHandler handler) { types.put(contentType, handler); classToHandlers.put(clazz, handler); classToType.put(clazz, contentType); } /** * Registers a {@link DataContenetHandler} for use with certain mime types. To use this registration * method the DataHandler has to be implmented correctly. This method uses the DataFalvour of the * DataHandler to obtain the mimeType and DefaultRepresentation class. If there is more than one DataFlavour * on the DataHandler, then each flavour will be registered seperately. * @param handler */ public void register(DataContentHandler handler) { for (int i = 0; i < handler.getTransferDataFlavors().length; i++) { register(handler.getTransferDataFlavors()[i].getMimeType(), handler.getTransferDataFlavors()[i].getDefaultRepresentationClass(), handler); } } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/0000755000175000017500000000000011351410651027640 5ustar charlescharles././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/Rfc822ByteArraytoMimeMessage.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/Rfc822ByteArraytoMim0000644000175000017500000000511110765525116033373 0ustar charlescharles/* * $Id: Rfc822ByteArraytoMimeMessage.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.transformers; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.AbstractTransformer; import org.mule.transport.email.AbstractMailConnector; import java.io.ByteArrayInputStream; import java.io.InputStream; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.internet.MimeMessage; public class Rfc822ByteArraytoMimeMessage extends AbstractTransformer { public Rfc822ByteArraytoMimeMessage() { registerSourceType(byte[].class); registerSourceType(InputStream.class); setReturnClass(MimeMessage.class); } protected Object doTransform(Object src, String encoding) throws TransformerException { try { if (src instanceof byte[]) { byte[] bytes = (byte[]) src; return new MimeMessage(getSession(), new ByteArrayInputStream(bytes)); } else if (src instanceof InputStream) { return new MimeMessage(getSession(), (InputStream)src); } else { throw new TransformerException( CoreMessages.transformOnObjectUnsupportedTypeOfEndpoint(this.getName(), src.getClass(), endpoint)); } } catch (MessagingException e) { throw new TransformerException(this, e); } } protected Session getSession() throws TransformerException { if (null == endpoint) { throw new TransformerException(this, new IllegalStateException("The transformer is no associated with an endpoint.")); } Connector connector = endpoint.getConnector(); if (!(connector instanceof AbstractMailConnector)) { throw new TransformerException(this, new IllegalStateException("The transformer is not associated with an email endpoint.")); } return ((AbstractMailConnector) connector).getSessionDetails(endpoint).getSession(); } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/package.html0000644000175000017500000000021010745677442032135 0ustar charlescharles Mule Contains transformers to convert to and from the java.mail.Message type. ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/MimeMessageToRfc822ByteArray.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/MimeMessageToRfc822B0000644000175000017500000000243710745677442033304 0ustar charlescharles/* * $Id: MimeMessageToRfc822ByteArray.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.transformers; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import java.io.ByteArrayOutputStream; import javax.mail.internet.MimeMessage; public class MimeMessageToRfc822ByteArray extends AbstractTransformer { public MimeMessageToRfc822ByteArray() { registerSourceType(MimeMessage.class); setReturnClass(byte[].class); } protected Object doTransform(Object src, String encoding) throws TransformerException { try { MimeMessage mime = (MimeMessage) src; ByteArrayOutputStream baos = new ByteArrayOutputStream(); mime.writeTo(baos); return baos.toByteArray(); } catch (Exception e) { throw new TransformerException(this, e); } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/StringToEmailMessage.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/StringToEmailMessage0000644000175000017500000001464210745677442033643 0ustar charlescharles/* * $Id: StringToEmailMessage.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.transformers; import org.mule.RegistryContext; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.transport.email.MailProperties; import org.mule.transport.email.MailUtils; import org.mule.transport.email.SmtpConnector; import org.mule.util.MapUtils; import org.mule.util.StringUtils; import org.mule.util.TemplateParser; import java.util.Calendar; import java.util.Iterator; import java.util.Map; import java.util.Properties; import javax.mail.Message; import javax.mail.internet.MimeMessage; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * StringToEmailMessage will convert a String to a JavaMail Message, * using the String as the contents. This implementation uses properties on the * transformer to determine the To: and Subject: fields. */ public class StringToEmailMessage extends AbstractMessageAwareTransformer { /** * logger used by this class */ private final Log logger = LogFactory.getLog(getClass()); private TemplateParser templateParser = TemplateParser.createAntStyleParser(); public StringToEmailMessage() { this.registerSourceType(String.class); this.setReturnClass(Message.class); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { String endpointAddress = endpoint.getEndpointURI().getAddress(); SmtpConnector connector = (SmtpConnector) endpoint.getConnector(); String to = message.getStringProperty(MailProperties.TO_ADDRESSES_PROPERTY, endpointAddress); String cc = message.getStringProperty(MailProperties.CC_ADDRESSES_PROPERTY, connector.getCcAddresses()); String bcc = message.getStringProperty(MailProperties.BCC_ADDRESSES_PROPERTY, connector.getBccAddresses()); String from = message.getStringProperty(MailProperties.FROM_ADDRESS_PROPERTY, connector.getFromAddress()); String replyTo = message.getStringProperty(MailProperties.REPLY_TO_ADDRESSES_PROPERTY, connector.getReplyToAddresses()); String subject = message.getStringProperty(MailProperties.SUBJECT_PROPERTY, connector.getSubject()); String contentType = message.getStringProperty(MailProperties.CONTENT_TYPE_PROPERTY, connector.getContentType()); Properties headers = new Properties(); Properties customHeaders = connector.getCustomHeaders(); if (customHeaders != null && !customHeaders.isEmpty()) { headers.putAll(customHeaders); } Properties otherHeaders = (Properties) message.getProperty(MailProperties.CUSTOM_HEADERS_MAP_PROPERTY); if (otherHeaders != null && !otherHeaders.isEmpty()) { //TODO Whats going on here? // final MuleContext mc = context.getMuleContext(); // for (Iterator iterator = message.getPropertyNames().iterator(); iterator.hasNext();) // { // String propertyKey = (String) iterator.next(); // mc.getRegistry().registerObject(propertyKey, message.getProperty(propertyKey), mc); // } headers.putAll(templateParser.parse(new TemplateParser.TemplateCallback() { public Object match(String token) { return RegistryContext.getRegistry().lookupObject(token); } }, otherHeaders)); } if (logger.isDebugEnabled()) { StringBuffer buf = new StringBuffer(); buf.append("Constructing email using:\n"); buf.append("To: ").append(to); buf.append("From: ").append(from); buf.append("CC: ").append(cc); buf.append("BCC: ").append(bcc); buf.append("Subject: ").append(subject); buf.append("ReplyTo: ").append(replyTo); buf.append("Content type: ").append(contentType); buf.append("Payload type: ").append(message.getPayload().getClass().getName()); buf.append("Custom Headers: ").append(MapUtils.toString(headers, false)); logger.debug(buf.toString()); } try { Message email = new MimeMessage(((SmtpConnector) endpoint.getConnector()).getSessionDetails(endpoint).getSession()); email.setRecipients(Message.RecipientType.TO, MailUtils.stringToInternetAddresses(to)); // sent date email.setSentDate(Calendar.getInstance().getTime()); if (StringUtils.isNotBlank(from)) { email.setFrom(MailUtils.stringToInternetAddresses(from)[0]); } if (StringUtils.isNotBlank(cc)) { email.setRecipients(Message.RecipientType.CC, MailUtils.stringToInternetAddresses(cc)); } if (StringUtils.isNotBlank(bcc)) { email.setRecipients(Message.RecipientType.BCC, MailUtils.stringToInternetAddresses(bcc)); } if (StringUtils.isNotBlank(replyTo)) { email.setReplyTo(MailUtils.stringToInternetAddresses(replyTo)); } email.setSubject(subject); for (Iterator iterator = headers.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); email.setHeader(entry.getKey().toString(), entry.getValue().toString()); } setContent(message.getPayload(), email, contentType, message); return email; } catch (Exception e) { throw new TransformerException(this, e); } } protected void setContent(Object payload, Message msg, String contentType, MuleMessage message) throws Exception { msg.setContent(payload, contentType); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/PlainTextDataSource.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/PlainTextDataSource.0000644000175000017500000000454610745677442033560 0ustar charlescharles/* * $Id: PlainTextDataSource.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ /* * Copyright 2001-2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mule.transport.email.transformers; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.activation.DataSource; import org.apache.commons.io.output.ByteArrayOutputStream; public class PlainTextDataSource implements DataSource { public static final String CONTENT_TYPE = "text/plain"; private final String name; private byte[] data; private ByteArrayOutputStream os; public PlainTextDataSource(String name, String data) { this.name = name; this.data = data == null ? null : data.getBytes(); os = new ByteArrayOutputStream(); } // ctor public String getName() { return name; } // getName public String getContentType() { return CONTENT_TYPE; } // getContentType public InputStream getInputStream() throws IOException { if (os.size() != 0) { data = os.toByteArray(); } return new ByteArrayInputStream(data == null ? new byte[0] : data); } // getInputStream public OutputStream getOutputStream() throws IOException { if (os.size() != 0) { data = os.toByteArray(); } return new ByteArrayOutputStream(); } // getOutputStream } // class PlainTextDataSource ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/EmailMessageToString.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/EmailMessageToString0000644000175000017500000000373010754365306033630 0ustar charlescharles/* * $Id: EmailMessageToString.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.transformers; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import javax.mail.Message; import javax.mail.internet.MimeMultipart; /** * EmailMessageToString extracts a java mail Message contents and * returns a string. */ public class EmailMessageToString extends AbstractTransformer { public EmailMessageToString() { registerSourceType(Message.class); setReturnClass(String.class); } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { Message msg = (Message) src; try { /* * Other information about the message such as cc addresses, attachments * are handled by the mail message adapter. */ // For this impl we just pass back the email content Object result = msg.getContent(); if (result instanceof String) { return result; } else { // very simplisitic, only gets first part MimeMultipart part = (MimeMultipart)result; String transMsg = (String) part.getBodyPart(0).getContent(); return transMsg; } } catch (Exception e) { throw new TransformerException(this, e); } } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/ObjectToMimeMessage.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/transformers/ObjectToMimeMessage.0000644000175000017500000001150410745677442033513 0ustar charlescharles/* * $Id: ObjectToMimeMessage.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.transformers; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.transformer.simple.SerializableToByteArray; import org.mule.transport.email.MailMessageAdapter; import org.mule.util.StringUtils; import java.io.IOException; import java.io.Serializable; import java.util.Iterator; import java.util.Map; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.activation.FileDataSource; import javax.mail.BodyPart; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMultipart; import javax.mail.util.ByteArrayDataSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Transforms a javax.mail.Message to a MuleMessage, with support for attachments */ public class ObjectToMimeMessage extends StringToEmailMessage { private Log logger = LogFactory.getLog(getClass()); // @Override protected void setContent(Object payload, Message msg, String contentType, MuleMessage message) throws Exception { if (message.getAttachmentNames().size() > 0) { // The content type must be multipart/mixed MimeMultipart multipart = new MimeMultipart("mixed"); multipart.addBodyPart(getPayloadBodyPart(message.getPayload(), contentType)); for (Iterator it = message.getAttachmentNames().iterator(); it.hasNext();) { String name = (String)it.next(); BodyPart part = getBodyPartForAttachment(message.getAttachment(name), name); // Check message props for extra headers addBodyPartHeaders(part, name, message); multipart.addBodyPart(part); } // the payload must be set to the constructed MimeMultipart message payload = multipart; // the ContentType of the message to be sent, must be the multipart contentType = multipart.getContentType(); // content type } // now the message will contain the multipart payload, and the multipart // contentType super.setContent(payload, msg, contentType, message); } protected void addBodyPartHeaders(BodyPart part, String name, MuleMessage message) { Map headers = (Map)message.getProperty( name + MailMessageAdapter.ATTACHMENT_HEADERS_PROPERTY_POSTFIX); if (null != headers) { for (Iterator it = headers.keySet().iterator(); it.hasNext();) { try { String key = (String)it.next(); part.setHeader(key, (String)headers.get(key)); } catch (MessagingException me) { logger.error("Failed to set bodypart header", me); } } } } protected BodyPart getBodyPartForAttachment(DataHandler handler, String name) throws MessagingException { BodyPart part = new MimeBodyPart(); part.setDataHandler(handler); part.setDescription(name); DataSource source = handler.getDataSource(); // Only set the file name if the DataSource is a file if (source instanceof FileDataSource) { part.setFileName(StringUtils.defaultString(handler.getName(), name)); } return part; } protected BodyPart getPayloadBodyPart(Object payload, String contentType) throws MessagingException, TransformerException, IOException { DataHandler handler; if (payload instanceof String) { handler = new DataHandler(new ByteArrayDataSource((String) payload, contentType)); } else if (payload instanceof byte[]) { handler = new DataHandler(new ByteArrayDataSource((byte[])payload, contentType)); } else if (payload instanceof Serializable) { handler = new DataHandler(new ByteArrayDataSource( (byte[])new SerializableToByteArray().transform(payload), contentType)); } else { throw new IllegalArgumentException(); } BodyPart part = new MimeBodyPart(); part.setDataHandler(handler); part.setDescription("Payload"); return part; } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/MailProperties.java0000644000175000017500000000425510745677442030746 0ustar charlescharles/* * $Id: MailProperties.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; /** * Mail properties that are sent on the DefaultMuleMessage when receiving a Mail Message or * which can be set on the endpoint or event to be added to outgoing mail */ public interface MailProperties { /** * MuleEvent properties */ public static final String CONTENT_TYPE_PROPERTY = "contentType"; public static final String TO_ADDRESSES_PROPERTY = "toAddresses"; public static final String CC_ADDRESSES_PROPERTY = "ccAddresses"; public static final String BCC_ADDRESSES_PROPERTY = "bccAddresses"; public static final String FROM_ADDRESS_PROPERTY = "fromAddress"; public static final String REPLY_TO_ADDRESSES_PROPERTY = "replyToAddresses"; public static final String SUBJECT_PROPERTY = "subject"; public static final String CUSTOM_HEADERS_MAP_PROPERTY = "customHeaders"; public static final String SENT_DATE_PROPERTY = "sentDate"; //these properties will be used to avoid conflict with the outbound SMTP properties public static final String INBOUND_CONTENT_TYPE_PROPERTY = "inbound.contentType"; public static final String INBOUND_TO_ADDRESSES_PROPERTY = "inbound.toAddresses"; public static final String INBOUND_CC_ADDRESSES_PROPERTY = "inbound.ccAddresses"; public static final String INBOUND_BCC_ADDRESSES_PROPERTY = "inbound.bccAddresses"; public static final String INBOUND_FROM_ADDRESS_PROPERTY = "inbound.fromAddress"; public static final String INBOUND_REPLY_TO_ADDRESSES_PROPERTY = "inbound.replyToAddresses"; public static final String INBOUND_SUBJECT_PROPERTY = "inbound.subject"; public static final String INBOUND_CUSTOM_HEADERS_MAP_PROPERTY = "inbound.customHeaders"; public static final String INBOUND_SENT_DATE_PROPERTY = "inbound.sentDate"; } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/SessionDetails.java0000644000175000017500000000227110745677442030734 0ustar charlescharles/* * $Id: SessionDetails.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import javax.mail.NoSuchProviderException; import javax.mail.Session; import javax.mail.Store; import javax.mail.Transport; import javax.mail.URLName; public class SessionDetails { private Session session; private URLName url; public SessionDetails(Session session, URLName url) { this.session = session; this.url = url; } public Session getSession() { return session; } public URLName getUrl() { return url; } public Store newStore() throws NoSuchProviderException { return session.getStore(url); } public Transport newTransport() throws NoSuchProviderException { return session.getTransport(url); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/AbstractRetrieveMailConnector.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/AbstractRetrieveMailConnector.jav0000644000175000017500000000573710757615756033606 0ustar charlescharles/* * $Id: AbstractRetrieveMailConnector.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; /** * Support for connecting to and receiving email from a mailbox (the exact protocol depends on * the subclass). */ public abstract class AbstractRetrieveMailConnector extends AbstractMailConnector { public static final int DEFAULT_CHECK_FREQUENCY = 60000; /** * Holds the time in milliseconds that the endpoint should wait before checking a * mailbox */ private volatile long checkFrequency = DEFAULT_CHECK_FREQUENCY; /** * Holds a path where messages should be backed up to (auto-generated if empty) */ private volatile String backupFolder = null; /** * Should we save backups to backupFolder? */ private boolean backupEnabled = false; /** * Once a message has been read, should it be deleted */ private volatile boolean deleteReadMessages = true; protected AbstractRetrieveMailConnector(int defaultPort) { super(defaultPort, MAILBOX); } /** * @return the milliseconds between checking the folder for messages */ public long getCheckFrequency() { return checkFrequency; } public void setCheckFrequency(long l) { if (l < 1) { l = DEFAULT_CHECK_FREQUENCY; } checkFrequency = l; } /** * @return a relative or absolute path to a directory on the file system */ public String getBackupFolder() { return backupFolder; } public void setBackupFolder(String string) { backupFolder = string; } /* * (non-Javadoc) * * @see org.mule.transport.UMOConnector#registerListener(javax.jms.MessageListener, * java.lang.String) */ public MessageReceiver createReceiver(Service service, InboundEndpoint endpoint) throws Exception { Object[] args = {new Long(checkFrequency), Boolean.valueOf(isBackupEnabled()), backupFolder}; return serviceDescriptor.createMessageReceiver(this, service, endpoint, args); } public boolean isDeleteReadMessages() { return deleteReadMessages; } public void setDeleteReadMessages(boolean deleteReadMessages) { this.deleteReadMessages = deleteReadMessages; } public boolean isBackupEnabled() { return backupEnabled; } public void setBackupEnabled(boolean backupEnabled) { this.backupEnabled = backupEnabled; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/SmtpMessageDispatcherFactory.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/SmtpMessageDispatcherFactory.java0000644000175000017500000000206710757615756033600 0ustar charlescharles/* * $Id: SmtpMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * SmtpMessageDispatcherFactory creates an instance of an SmtpMessage * dispatcher used for sending email events via an SMTP gateway */ public class SmtpMessageDispatcherFactory extends AbstractMessageDispatcherFactory { /** {@inheritDoc} */ public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new SmtpMessageDispatcher(endpoint); } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/SmtpConnector.java0000644000175000017500000000734010761536530030571 0ustar charlescharles/* * $Id: SmtpConnector.java 11110 2008-02-28 13:55:36Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import java.util.Properties; /** * SmtpConnector is used to connect to and send data to an SMTP mail * server */ public class SmtpConnector extends AbstractMailConnector { public static final String SMTP = "smtp"; public static final String DEFAULT_SMTP_HOST = "localhost"; public static final int DEFAULT_SMTP_PORT = 25; public static final String DEFAULT_CONTENT_TYPE = "text/plain"; /** * Holds value of bcc addresses. */ private String bcc; /** * Holds value of cc addresses. */ private String cc; /** * Holds value of replyTo addresses. */ private String replyTo; /** * Holds value of default subject */ private String defaultSubject = "[No Subject]"; /** * Holds value of the from address. */ private String from; /** * Any custom headers to be set on messages sent using this connector */ private Properties customHeaders = new Properties(); private String contentType = DEFAULT_CONTENT_TYPE; public SmtpConnector() { this(DEFAULT_SMTP_PORT); } SmtpConnector(int defaultPort) { super(defaultPort, null); } public String getProtocol() { return "smtp"; } /* * (non-Javadoc) * * @see org.mule.transport.UMOConnector#registerListener(javax.jms.MessageListener, * java.lang.String) */ public MessageReceiver createReceiver(Service service, InboundEndpoint endpoint) throws Exception { throw new UnsupportedOperationException("Listeners cannot be registered on a SMTP endpoint"); } /** * @return The default from address to use */ public String getFromAddress() { return from; } /** * @return the default comma separated list of BCC addresses to use */ public String getBccAddresses() { return bcc; } /** * @return the default comma separated list of CC addresses to use */ public String getCcAddresses() { return cc; } /** * @return the default message subject to use */ public String getSubject() { return defaultSubject; } public void setBccAddresses(String string) { bcc = string; } public void setCcAddresses(String string) { cc = string; } public void setSubject(String string) { defaultSubject = string; } public void setFromAddress(String string) { from = string; } public String getReplyToAddresses() { return replyTo; } public void setReplyToAddresses(String replyTo) { this.replyTo = replyTo; } public Properties getCustomHeaders() { return customHeaders; } public void setCustomHeaders(Properties customHeaders) { this.customHeaders = customHeaders; } public String getContentType() { return contentType; } public void setContentType(String contentType) { this.contentType = contentType; } public int getDefaultPort() { return DEFAULT_SMTP_PORT; } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/ImapsSocketFactory.java0000644000175000017500000000203710745677442031555 0ustar charlescharles/* * $Id: ImapsSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.security.tls.TlsPropertiesSocketFactory; import javax.net.SocketFactory; /** * A socket factor that reads "indirect" configuration (see {@link org.mule.api.security.tls.TlsConfiguration}) * for IMAPS from System properties. */ public class ImapsSocketFactory extends TlsPropertiesSocketFactory { public static final String MULE_IMAPS_NAMESPACE = "mule.email.imaps"; public ImapsSocketFactory() { super(true, MULE_IMAPS_NAMESPACE); } public static SocketFactory getDefault() { return new ImapsSocketFactory(); } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/SimpleMailMessageAdapter.java0000644000175000017500000002261210745677442032646 0ustar charlescharles/* * $Id: SimpleMailMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.MessagingException; import org.mule.api.ThreadSafeAccess; import org.mule.api.transport.MessageTypeNotSupportedException; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractMessageAdapter; import org.mule.util.IOUtils; import org.mule.util.StringUtils; import org.mule.util.SystemUtils; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Date; import java.util.Enumeration; import java.util.LinkedList; import java.util.List; import javax.mail.Header; import javax.mail.Message; import javax.mail.Part; /** * SimpleMailMessageAdapter is an adapter for mail messages. * Unlike {@link MailMessageAdapter} this preserves the message intact in its original * form. * *

Header values are stored in two formats. First, as historically used by * {@link MailMessageAdapter}, a single String value is stored for each distinct * header name (if a header is repeated only one value is stored). * Secondly, a list of values for each distinct header is stored in a property name * prefixed by HEADER_LIST_PREFIX * (which produces an invalid header name according to RFC 822 and so (i) avoids * conflict with the first property type and (ii) will cause current applications * that wrongly assume all properties are simple header values to fail fast). * The utility methods * {@link #isListHeader(String)}, {@link #toHeader(String)} and * {@link #toListHeader(String)} identify and convert between property and * header names as required. */ public class SimpleMailMessageAdapter extends AbstractMessageAdapter { private static final long serialVersionUID = 8002607243523460556L; public static final String HEADER_LIST_PREFIX = "List:"; private Part message; private byte[] cache = null; public SimpleMailMessageAdapter(Object object) throws MessagingException { Message message = assertMessageType(object); try { setMessageDetails(message); handleMessage(message); } catch (Exception e) { throw new MessagingException(CoreMessages.failedToCreate("Message Adapter"), e); } } protected SimpleMailMessageAdapter(SimpleMailMessageAdapter template) { super(template); message = template.message; cache = template.cache; } /** * By default, this simply stores the entire message as a single message. * Sub-classes may override with more complex processing. */ protected void handleMessage(Message message) throws Exception { setMessage(message); } protected void setMessage(Part message) { this.message = message; } public Object getPayload() { return message; } public byte[] getPayloadAsBytes() throws Exception { return buildCache(getEncoding()); } public String getPayloadAsString(String encoding) throws Exception { // TODO - i don't understand how encoding is used here // could this method be called with various encodings? // does that invalidate the cache? // (ie there are two encodings -- one used to generate the cache from // the mail message, and one used to generate the string from the cache) return new String(buildCache(encoding), encoding); } private byte[] buildCache(String encoding) throws Exception { if (null == cache) { if (message.getContentType().startsWith("text/")) { cache = textPayload(encoding); } else { cache = binaryPayload(); } } return cache; } private static Message assertMessageType(Object message) throws MessageTypeNotSupportedException { if (message instanceof Message) { return (Message)message; } else { throw new MessageTypeNotSupportedException(message, MailMessageAdapter.class); } } private void setMessageDetails(Message message) throws javax.mail.MessagingException { setProperty(MailProperties.INBOUND_TO_ADDRESSES_PROPERTY, MailUtils.mailAddressesToString(message.getRecipients(Message.RecipientType.TO))); setProperty(MailProperties.INBOUND_CC_ADDRESSES_PROPERTY, MailUtils.mailAddressesToString(message.getRecipients(Message.RecipientType.CC))); setProperty(MailProperties.INBOUND_BCC_ADDRESSES_PROPERTY, MailUtils.mailAddressesToString(message.getRecipients(Message.RecipientType.BCC))); try { setProperty(MailProperties.INBOUND_REPLY_TO_ADDRESSES_PROPERTY, MailUtils.mailAddressesToString(message.getReplyTo())); } catch (javax.mail.MessagingException me) { logger.warn("Invalid address found in ReplyTo header:", me); } try { setProperty(MailProperties.INBOUND_FROM_ADDRESS_PROPERTY, MailUtils.mailAddressesToString(message.getFrom())); } catch (javax.mail.MessagingException me) { logger.warn("Invalid address found in From header:", me); } setProperty(MailProperties.INBOUND_SUBJECT_PROPERTY, StringUtils.defaultIfEmpty( message.getSubject(),"(no subject)")); setProperty(MailProperties.INBOUND_CONTENT_TYPE_PROPERTY, StringUtils.defaultIfEmpty( message.getContentType(), "text/plain")); Date sentDate = message.getSentDate(); if (sentDate == null) { sentDate = new Date(); } setProperty(MailProperties.SENT_DATE_PROPERTY, sentDate); for (Enumeration e = message.getAllHeaders(); e.hasMoreElements();) { Header header = (Header)e.nextElement(); String name = header.getName(); String listName = toListHeader(name); String value = header.getValue(); if (null == getProperty(name)) { setProperty(name, value); } if (null == getProperty(listName)) { setProperty(listName, new LinkedList()); } if (getProperty(listName) instanceof List) { ((List) getProperty(listName)).add(header.getValue()); } } } /** * Check whether a property name has the format associated with a list * of header values * @param name A property name * @return true if the name is associated with a list of header values * (more exactly, if it starts with HEADER_LIST_PREFIX, which gives an * invalid header name according to RFC822). */ public static boolean isListHeader(String name) { return null != name && name.startsWith(HEADER_LIST_PREFIX); } /** * Convert a property name associated with a list of header values to * the relevant header name (ie drop the prefix) * @param name A property name * @return The associated header name (ie with HEADER_LIST_PREFIX removed) */ public static String toHeader(String name) { if (isListHeader(name)) { return name.substring(HEADER_LIST_PREFIX.length()); } else { return name; } } /** * Convert a header name to the property name associated with a list of * header values (ie prepend the prefix) * @param header A header name * @return The associated list property name (ie with HEADER_LIST_PREFIX prepended) */ public static String toListHeader(String header) { if (isListHeader(header)) { return header; } else { return HEADER_LIST_PREFIX + header; } } private static InputStream addBuffer(InputStream stream) { if (!(stream instanceof BufferedInputStream)) { stream = new BufferedInputStream(stream); } return stream; } private byte[] binaryPayload() throws Exception { InputStream stream = addBuffer(message.getInputStream()); ByteArrayOutputStream baos = new ByteArrayOutputStream(32768); IOUtils.copy(stream, baos); return baos.toByteArray(); } private byte[] textPayload(String encoding) throws Exception { InputStream stream = addBuffer(message.getInputStream()); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); StringBuffer buffer = new StringBuffer(32768); String line; while ((line = reader.readLine()) != null) { buffer.append(line).append(SystemUtils.LINE_SEPARATOR); } return buffer.toString().getBytes(encoding); } public ThreadSafeAccess newThreadCopy() { return new SimpleMailMessageAdapter(this); } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/i18n/0000755000175000017500000000000011351410650025671 5ustar charlescharlesmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/i18n/EmailMessages.java0000644000175000017500000000140210745677442031274 0ustar charlescharles/* * $Id: EmailMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class EmailMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("email"); public static Message routingError() { return createMessage(BUNDLE_PATH, 3); } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/0000755000175000017500000000000011351410652026361 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/Pop3sNamespaceHandler.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/Pop3sNamespaceHandler.java0000644000175000017500000000250310770356575033364 0ustar charlescharles/* * $Id: Pop3sNamespaceHandler.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.specific.tls.ClientKeyStoreDefinitionParser; import org.mule.config.spring.parsers.specific.tls.TrustStoreDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.email.Pop3sConnector; /** * Reigsters a Bean Definition Parser for handling elements. * */ public class Pop3sNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(Pop3sConnector.POP3S, URIBuilder.USERHOST_ATTRIBUTES); registerConnectorDefinitionParser(Pop3sConnector.class); registerBeanDefinitionParser("tls-trust-store", new TrustStoreDefinitionParser()); registerBeanDefinitionParser("tls-client", new ClientKeyStoreDefinitionParser()); } }mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/SmtpNamespaceHandler.java0000644000175000017500000000320710745726444033303 0ustar charlescharles/* * $Id: SmtpNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.email.MailProperties; import org.mule.transport.email.SmtpConnector; /** * Reigsters a Bean Definition Parser for handling elements. * */ public class SmtpNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(SmtpConnector.SMTP, URIBuilder.HOST_ATTRIBUTES) .addAlias("to", MailProperties.TO_ADDRESSES_PROPERTY) .addAlias("from", MailProperties.FROM_ADDRESS_PROPERTY) .addAlias("cc", MailProperties.CC_ADDRESSES_PROPERTY) .addAlias("bcc", MailProperties.BCC_ADDRESSES_PROPERTY) .addAlias("from", MailProperties.FROM_ADDRESS_PROPERTY) .addAlias("replyTo", MailProperties.REPLY_TO_ADDRESSES_PROPERTY); registerConnectorDefinitionParser(SmtpConnector.class); registerBeanDefinitionParser("header", new ChildMapEntryDefinitionParser("customHeaders", "key", "value")); } }././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/SmtpsNamespaceHandler.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/SmtpsNamespaceHandler.java0000644000175000017500000000375510770356575033500 0ustar charlescharles/* * $Id: SmtpsNamespaceHandler.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser; import org.mule.config.spring.parsers.specific.tls.ClientKeyStoreDefinitionParser; import org.mule.config.spring.parsers.specific.tls.TrustStoreDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.email.MailProperties; import org.mule.transport.email.SmtpsConnector; /** * Reigsters a Bean Definition Parser for handling elements. * */ public class SmtpsNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(SmtpsConnector.SMTPS, URIBuilder.HOST_ATTRIBUTES) .addAlias("to", MailProperties.TO_ADDRESSES_PROPERTY) .addAlias("from", MailProperties.FROM_ADDRESS_PROPERTY) .addAlias("cc", MailProperties.CC_ADDRESSES_PROPERTY) .addAlias("bcc", MailProperties.BCC_ADDRESSES_PROPERTY) .addAlias("from", MailProperties.FROM_ADDRESS_PROPERTY) .addAlias("replyTo", MailProperties.REPLY_TO_ADDRESSES_PROPERTY); registerConnectorDefinitionParser(SmtpsConnector.class); registerBeanDefinitionParser("header", new ChildMapEntryDefinitionParser("customHeaders", "key", "value")); registerBeanDefinitionParser("tls-trust-store", new TrustStoreDefinitionParser()); registerBeanDefinitionParser("tls-client", new ClientKeyStoreDefinitionParser()); } }mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/Pop3NamespaceHandler.java0000644000175000017500000000174210745726444033203 0ustar charlescharles/* * $Id: Pop3NamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.endpoint.URIBuilder; import org.mule.transport.email.Pop3Connector; /** * Reigsters a Bean Definition Parser for handling elements. * */ public class Pop3NamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(Pop3Connector.POP3, URIBuilder.USERHOST_ATTRIBUTES); registerConnectorDefinitionParser(Pop3Connector.class); } }././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/EmailNamespaceHandler.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/EmailNamespaceHandler.java0000644000175000017500000000331610745677442033413 0ustar charlescharles/* * $Id: EmailNamespaceHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.specific.TransformerDefinitionParser; import org.mule.transport.email.transformers.EmailMessageToString; import org.mule.transport.email.transformers.MimeMessageToRfc822ByteArray; import org.mule.transport.email.transformers.ObjectToMimeMessage; import org.mule.transport.email.transformers.Rfc822ByteArraytoMimeMessage; import org.mule.transport.email.transformers.StringToEmailMessage; public class EmailNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerBeanDefinitionParser("email-to-string-transformer", new TransformerDefinitionParser(EmailMessageToString.class)); registerBeanDefinitionParser("string-to-email-transformer", new TransformerDefinitionParser(StringToEmailMessage.class)); registerBeanDefinitionParser("object-to-mime-transformer", new TransformerDefinitionParser(ObjectToMimeMessage.class)); registerBeanDefinitionParser("mime-to-bytes-transformer", new TransformerDefinitionParser(MimeMessageToRfc822ByteArray.class)); registerBeanDefinitionParser("bytes-to-mime-transformer", new TransformerDefinitionParser(Rfc822ByteArraytoMimeMessage.class)); } }././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/ImapsNamespaceHandler.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/ImapsNamespaceHandler.java0000644000175000017500000000250310770356575033431 0ustar charlescharles/* * $Id: ImapsNamespaceHandler.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.specific.tls.ClientKeyStoreDefinitionParser; import org.mule.config.spring.parsers.specific.tls.TrustStoreDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.email.ImapsConnector; /** * Reigsters a Bean Definition Parser for handling elements. * */ public class ImapsNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(ImapsConnector.IMAPS, URIBuilder.USERHOST_ATTRIBUTES); registerConnectorDefinitionParser(ImapsConnector.class); registerBeanDefinitionParser("tls-trust-store", new TrustStoreDefinitionParser()); registerBeanDefinitionParser("tls-client", new ClientKeyStoreDefinitionParser()); } }mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/config/ImapNamespaceHandler.java0000644000175000017500000000174510745726444033253 0ustar charlescharles/* * $Id: ImapNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.endpoint.URIBuilder; import org.mule.transport.email.ImapConnector; /** * Reigsters a Bean Definition Parser for handling elements. * */ public class ImapNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(ImapConnector.IMAP, URIBuilder.USERHOST_ATTRIBUTES); registerConnectorDefinitionParser(ImapConnector.class); } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/RetrieveMessageReceiver.java0000644000175000017500000002523310766204322032547 0ustar charlescharles/* * $Id: RetrieveMessageReceiver.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.DefaultMuleMessage; import org.mule.MuleServer; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.Startable; import org.mule.api.lifecycle.Stoppable; import org.mule.api.routing.RoutingException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.api.transport.ReceiveException; import org.mule.transport.AbstractPollingMessageReceiver; import org.mule.transport.email.i18n.EmailMessages; import org.mule.util.FileUtils; import org.mule.util.StringUtils; import org.mule.util.UUID; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import javax.mail.Address; import javax.mail.Flags; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Store; import javax.mail.event.MessageCountEvent; import javax.mail.event.MessageCountListener; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; /** * Poll a mailbox for messages, remove the messages and route them as events into Mule. *

* This contains a reference to a mail folder (and also the endpoint and connector, via superclasses) */ public class RetrieveMessageReceiver extends AbstractPollingMessageReceiver implements MessageCountListener, Startable, Stoppable { private Folder folder = null; private boolean backupEnabled; private String backupFolder = null; public RetrieveMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint, long checkFrequency, boolean backupEnabled, String backupFolder) throws CreateException { super(connector, service, endpoint); this.backupFolder = backupFolder; this.backupEnabled = backupEnabled; this.setFrequency(checkFrequency); } private AbstractRetrieveMailConnector castConnector() { return (AbstractRetrieveMailConnector) getConnector(); } protected void doConnect() throws Exception { SessionDetails session = castConnector().getSessionDetails(endpoint); Store store = session.newStore(); store.connect(); folder = store.getFolder(castConnector().getMailboxFolder()); // set default value if empty/null if (StringUtils.isEmpty(backupFolder)) { this.backupFolder = MuleServer.getMuleContext().getConfiguration().getWorkingDirectory() + "/mail/" + folder.getName(); } if (backupFolder != null && !this.backupFolder.endsWith(File.separator)) { this.backupFolder += File.separator; } } protected void doDisconnect() throws Exception { // nothing to do here } protected void doStop() { if (folder != null) { folder.removeMessageCountListener(this); } } protected void doStart() throws MuleException { super.doStart(); folder.addMessageCountListener(this); } public void messagesAdded(MessageCountEvent event) { Message messages[] = event.getMessages(); if (messages != null) { MuleMessage message = null; for (int i = 0; i < messages.length; i++) { try { if (!messages[i].getFlags().contains(Flags.Flag.DELETED)) { MimeMessage mimeMessage = new MimeMessage((MimeMessage) messages[i]); storeMessage(mimeMessage); message = new DefaultMuleMessage(castConnector().getMessageAdapter(mimeMessage)); if (castConnector().isDeleteReadMessages()) { // Mark as deleted messages[i].setFlag(Flags.Flag.DELETED, true); } else { messages[i].setFlag(Flags.Flag.SEEN, true); } routeMessage(message, endpoint.isSynchronous()); } } catch (MuleException e) { handleException(e); } catch (Exception e) { Exception forwarded; if (message != null) { forwarded = new RoutingException(EmailMessages.routingError(), message, endpoint, e); } else { forwarded = new ReceiveException(endpoint, -1, e); } handleException(forwarded); } } } } // @Override protected MuleMessage handleUnacceptedFilter(MuleMessage message) { super.handleUnacceptedFilter(message); if (message.getPayload() instanceof Message) { Message msg = (Message) message.getPayload(); try { msg.setFlag(Flags.Flag.DELETED, endpoint.isDeleteUnacceptedMessages()); } catch (MessagingException e) { logger.error("failed to set message deleted: " + e.getMessage(), e); } } return message; } public void messagesRemoved(MessageCountEvent event) { if (logger.isDebugEnabled()) { Message messages[] = event.getMessages(); for (int i = 0; i < messages.length; i++) { try { logger.debug("Message removed: " + messages[i].getSubject()); } catch (MessagingException ignore) { logger.debug("ignoring exception: " + ignore.getMessage()); } } } } /** @return the current Mail folder */ public Folder getFolder() { return folder; } /** @param folder */ public synchronized void setFolder(Folder folder) { if (folder == null) { throw new IllegalArgumentException("Mail folder cannot be null"); } this.folder = folder; synchronized (this.folder) { if (!this.folder.isOpen()) { try { this.folder.open(Folder.READ_WRITE); } catch (MessagingException e) { logger.warn("Failed to open folder: " + folder.getFullName(), e); } } } } /** * Helper method for testing which stores a copy of the message locally as the * POP3

message will be deleted from the server * * @param msg the message to store * @throws IOException If a failure happens writing the message * @throws MessagingException If a failure happens reading the message */ protected void storeMessage(Message msg) throws IOException, MessagingException { if (backupEnabled) { String filename = msg.getFileName(); if (filename == null) { Address[] from = msg.getFrom(); if (from != null && from.length > 0) { filename = from[0] instanceof InternetAddress ? ((InternetAddress) from[0]).getAddress() : from[0].toString(); } else { filename = "(no from address)"; } filename += "[" + UUID.getUUID() + "]"; } filename = FileUtils.prepareWinFilename(filename); filename = backupFolder + filename + ".msg"; if (logger.isDebugEnabled()) { logger.debug("Writing message to: " + filename); } File f = FileUtils.createFile(filename); FileOutputStream fos = new FileOutputStream(f); msg.writeTo(fos); } } public synchronized void poll() { try { try { if (!folder.isOpen()) { folder.open(Folder.READ_WRITE); } } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("ignoring exception: " + e.getMessage()); } } int count = folder.getMessageCount(); if (count > 0) { Message[] messages = folder.getMessages(); MessageCountEvent event = new MessageCountEvent(folder, MessageCountEvent.ADDED, true, messages); messagesAdded(event); } else if (count == -1) { throw new MessagingException("Cannot monitor folder: " + folder.getFullName() + " as folder is closed"); } } catch (MessagingException e) { handleException(e); } finally { try { folder.close(true); // close and expunge deleted messages } catch (Exception e) { logger.error("Failed to close pop3 inbox: " + e.getMessage()); } } } protected void doDispose() { if (null != folder) { folder.removeMessageCountListener(this); if (folder.isOpen()) { try { folder.close(true); } catch (Exception e) { logger.debug("ignoring exception: " + e.getMessage(), e); } } } } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/SmtpsSocketFactory.java0000644000175000017500000000204310745677442031607 0ustar charlescharles/* * $Id: SmtpsSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.security.tls.TlsPropertiesSocketFactory; import javax.net.SocketFactory; /** * A socket factor that reads "indirect" configuration (see {@link org.mule.api.security.tls.TlsConfiguration}) * for SMTPS from System properties. */ public class SmtpsSocketFactory extends TlsPropertiesSocketFactory { public static final String MULE_SMTPS_NAMESPACE = "mule.email.smtps"; public SmtpsSocketFactory() { super(true, MULE_SMTPS_NAMESPACE); } public static SocketFactory getDefault() { return new SmtpsSocketFactory(); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/AbstractTlsRetrieveMailConnector.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/AbstractTlsRetrieveMailConnector.0000644000175000017500000001077610745677442033564 0ustar charlescharles/* * $Id: AbstractTlsRetrieveMailConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.TlsIndirectKeyStore; import org.mule.api.security.TlsIndirectTrustStore; import org.mule.api.security.tls.TlsConfiguration; import org.mule.api.security.tls.TlsPropertiesMapper; import java.io.IOException; import java.util.Properties; import javax.mail.URLName; /** * Support for connecting to and receiving email from a secure mailbox (the exact protocol depends on * the subclass). */ public abstract class AbstractTlsRetrieveMailConnector extends AbstractRetrieveMailConnector implements TlsIndirectTrustStore, TlsIndirectKeyStore { private String namespace; private String socketFactory; private String socketFactoryFallback = "false"; private TlsConfiguration tls = new TlsConfiguration(TlsConfiguration.DEFAULT_KEYSTORE); protected AbstractTlsRetrieveMailConnector(int defaultPort, String namespace, Class defaultSocketFactory) { super(defaultPort); this.namespace = namespace; socketFactory = defaultSocketFactory.getName(); // see comment below // this.namespace = TlsConfiguration.JSSE_NAMESPACE; // socketFactory = SSLServerSocketFactory.class.getName(); } protected void doInitialise() throws InitialisationException { try { tls.initialise(true, null); } catch (CreateException e) { throw new InitialisationException(e, this); } super.doInitialise(); } // @Override protected void extendPropertiesForSession(Properties global, Properties local, URLName url) { super.extendPropertiesForSession(global, local, url); local.setProperty("mail." + getProtocol() + ".ssl", "true"); local.setProperty("mail." + getProtocol() + ".socketFactory.class", getSocketFactory()); local.setProperty("mail." + getProtocol() + ".socketFactory.fallback", getSocketFactoryFallback()); new TlsPropertiesMapper(namespace).writeToProperties(global, tls); // this, instead of the line above, and with the constructor changes, // would have changed to local SSL configuration, if that was possible // (it didn't work) // new TlsPropertiesMapper(namespace).writeToProperties(local, tls); } public String getSocketFactory() { return socketFactory; } public void setSocketFactory(String sslSocketFactory) { this.socketFactory = sslSocketFactory; } public String getSocketFactoryFallback() { return socketFactoryFallback; } public void setSocketFactoryFallback(String socketFactoryFallback) { this.socketFactoryFallback = socketFactoryFallback; } public String getTrustStore() { return tls.getTrustStore(); } public String getTrustStorePassword() { return tls.getTrustStorePassword(); } public void setTrustStore(String trustStore) throws IOException { tls.setTrustStore(trustStore); } public void setTrustStorePassword(String trustStorePassword) { tls.setTrustStorePassword(trustStorePassword); } // these were not present before, but could be set implicitly via global properties // that is no longer true, so i have added them in here public String getClientKeyStore() { return this.tls.getClientKeyStore(); } public String getClientKeyStorePassword() { return this.tls.getClientKeyStorePassword(); } public String getClientKeyStoreType() { return this.tls.getClientKeyStoreType(); } public void setClientKeyStore(String name) throws IOException { this.tls.setClientKeyStore(name); } public void setClientKeyStorePassword(String clientKeyStorePassword) { this.tls.setClientKeyStorePassword(clientKeyStorePassword); } public void setClientKeyStoreType(String clientKeyStoreType) { this.tls.setClientKeyStoreType(clientKeyStoreType); } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/SmtpsConnector.java0000644000175000017500000001014510745677442030763 0ustar charlescharles/* * $Id: SmtpsConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.TlsIndirectKeyStore; import org.mule.api.security.TlsIndirectTrustStore; import org.mule.api.security.tls.TlsConfiguration; import org.mule.api.security.tls.TlsPropertiesMapper; import java.io.IOException; import java.util.Properties; import javax.mail.URLName; /** Creates a secure SMTP connection */ public class SmtpsConnector extends SmtpConnector implements TlsIndirectTrustStore, TlsIndirectKeyStore { public static final String SMTPS = "smtps"; public static final String DEFAULT_SOCKET_FACTORY = SmtpsSocketFactory.class.getName(); private String socketFactory = DEFAULT_SOCKET_FACTORY; private String socketFactoryFallback = "false"; private TlsConfiguration tls = new TlsConfiguration(TlsConfiguration.DEFAULT_KEYSTORE); public static final int DEFAULT_SMTPS_PORT = 465; public SmtpsConnector() { super(DEFAULT_SMTPS_PORT); } public String getProtocol() { return "smtps"; } public String getBaseProtocol() { return "smtp"; } protected void doInitialise() throws InitialisationException { try { tls.initialise(true, null); } catch (CreateException e) { throw new InitialisationException(e, this); } } // @Override protected void extendPropertiesForSession(Properties global, Properties local, URLName url) { super.extendPropertiesForSession(global, local, url); local.setProperty("mail." + getProtocol() + ".ssl", "true"); local.setProperty("mail." + getProtocol() + ".socketFactory.class", getSocketFactory()); local.setProperty("mail." + getProtocol() + ".socketFactory.fallback", getSocketFactoryFallback()); new TlsPropertiesMapper(SmtpsSocketFactory.MULE_SMTPS_NAMESPACE).writeToProperties(global, tls); } public String getSocketFactory() { return socketFactory; } public void setSocketFactory(String sslSocketFactory) { this.socketFactory = sslSocketFactory; } public String getSocketFactoryFallback() { return socketFactoryFallback; } public void setSocketFactoryFallback(String socketFactoryFallback) { this.socketFactoryFallback = socketFactoryFallback; } public String getTrustStore() { return tls.getTrustStore(); } public String getTrustStorePassword() { return tls.getTrustStorePassword(); } public void setTrustStore(String trustStore) throws IOException { tls.setTrustStore(trustStore); } public void setTrustStorePassword(String trustStorePassword) { tls.setTrustStorePassword(trustStorePassword); } // these were not present before, but could be set implicitly via global proeprties // that is no longer true, so i have added them in here public String getClientKeyStore() { return this.tls.getClientKeyStore(); } public String getClientKeyStorePassword() { return this.tls.getClientKeyStorePassword(); } public String getClientKeyStoreType() { return this.tls.getClientKeyStoreType(); } public void setClientKeyStore(String name) throws IOException { this.tls.setClientKeyStore(name); } public void setClientKeyStorePassword(String clientKeyStorePassword) { this.tls.setClientKeyStorePassword(clientKeyStorePassword); } public void setClientKeyStoreType(String clientKeyStoreType) { this.tls.setClientKeyStoreType(clientKeyStoreType); } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/filters/0000755000175000017500000000000011351410652026564 5ustar charlescharlesmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/filters/AbstractMailFilter.java0000644000175000017500000000277410745677442033177 0ustar charlescharles/* * $Id: AbstractMailFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import org.mule.util.ClassUtils; import javax.mail.Message; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractMailFilter is a base class for all javax.mail.Message * filters. */ public abstract class AbstractMailFilter implements Filter { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); public final boolean accept(MuleMessage message) { if (message == null) { return false; } Object object = message.getPayload(); if (object instanceof Message) { return accept((Message)object); } else { throw new IllegalArgumentException("The Mail filter does not understand: " + ClassUtils.getSimpleName(object.getClass())); } } public abstract boolean accept(Message message); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/filters/MailSubjectRegExFilter.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/filters/MailSubjectRegExFilter.ja0000644000175000017500000000242110745677442033424 0ustar charlescharles/* * $Id: MailSubjectRegExFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.filters; import org.mule.routing.filters.RegExFilter; import javax.mail.Message; import javax.mail.MessagingException; /** * MailSubjectRegExFilter applies a regular expression to a Mail * Message subject. */ public class MailSubjectRegExFilter extends AbstractMailFilter { private RegExFilter filter = new RegExFilter(); public boolean accept(Message message) { try { return filter.accept(message.getSubject()); } catch (MessagingException e) { logger.warn("Failed to read message subject: " + e.getMessage(), e); return false; } } public void setExpression(String pattern) { filter.setPattern(pattern); } public String getExpression() { return filter.getPattern(); } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/MailMessageAdapter.java0000644000175000017500000000600610745677442031473 0ustar charlescharles/* * $Id: MailMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.MessagingException; import org.mule.transport.AbstractMessageAdapter; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; import javax.mail.Header; import javax.mail.Message; import javax.mail.Multipart; import javax.mail.Part; /** * MailMessageAdapter is a wrapper for a javax.mail.Message that * separates multi-part mail messages, storing all but the first part as attachments * to the underlying {@link AbstractMessageAdapter}. Alternatively, you can use * {@link SimpleMailMessageAdapter}, which stores the message as a single * entity. */ public class MailMessageAdapter extends SimpleMailMessageAdapter { private static final long serialVersionUID = -6013198455030918360L; public static final String ATTACHMENT_HEADERS_PROPERTY_POSTFIX = "Headers"; public MailMessageAdapter(Object object) throws MessagingException { super(object); } /** * Store only the first body part directly; add further parts as attachments. */ // @Override protected void handleMessage(Message message) throws Exception { Object content = message.getContent(); if (content instanceof Multipart) { TreeMap attachments = new TreeMap(); MailUtils.getAttachments((Multipart)content, attachments); logger.debug("Received Multipart message"); int i = 0; for (Iterator iterator = attachments.entrySet().iterator(); iterator.hasNext();i++) { Map.Entry entry = (Map.Entry) iterator.next(); Part part = (Part)entry.getValue(); String name = entry.getKey().toString(); if(i==0) { setMessage(part); } else { addAttachment(name, part.getDataHandler()); addAttachmentHeaders(name, part); } } } else { setMessage(message); } } protected void addAttachmentHeaders(String name, Part part) throws javax.mail.MessagingException { Map headers = new HashMap(4); for (Enumeration e = part.getAllHeaders(); e.hasMoreElements();) { Header h = (Header)e.nextElement(); headers.put(h.getName(), h.getValue()); } if (headers.size() > 0) { setProperty(name + ATTACHMENT_HEADERS_PROPERTY_POSTFIX, headers); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/email/src/main/java/org/mule/transport/email/RetrieveMessageRequesterFactory.javamule-2.0.1/transports/email/src/main/java/org/mule/transport/email/RetrieveMessageRequesterFactory.j0000644000175000017500000000245110757615756033640 0ustar charlescharles/* * $Id: RetrieveMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; /** * A source of mail receiving message dispatchers. * The dispatcher can only be used to receive message (as apposed to * listening for them). Trying to send or dispatch will throw an * {@link UnsupportedOperationException}. */ public class RetrieveMessageRequesterFactory extends AbstractMessageRequesterFactory { /** * By default client connections are closed after the request. */ // @Override public boolean isCreateRequesterPerRequest() { return true; } public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new RetrieveMessageRequester(endpoint); } }mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/SmtpMessageDispatcher.java0000644000175000017500000001127610757615756032252 0ustar charlescharles/* * $Id: SmtpMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.DispatchException; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractMessageDispatcher; import java.util.Calendar; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Transport; /** * SmtpMessageDispatcher will dispatch Mule events as Mime email * messages over an SMTP gateway. * * This contains a reference to a transport (and endpoint and connector, via superclasses) */ public class SmtpMessageDispatcher extends AbstractMessageDispatcher { private volatile Transport transport; public SmtpMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); } private SmtpConnector castConnector() { return (SmtpConnector) getConnector(); } protected void doConnect() throws Exception { if (transport == null) { try { transport = castConnector().getSessionDetails(endpoint).newTransport(); EndpointURI uri = endpoint.getEndpointURI(); transport.connect(uri.getHost(), uri.getPort(), uri.getUser(), uri.getPassword()); } catch (Exception e) { throw new EndpointException( org.mule.config.i18n.MessageFactory.createStaticMessage("Unable to connect to mail transport."), e); } } } protected void doDisconnect() throws Exception { if (null != transport) { try { transport.close(); } finally { transport = null; } } } protected void doDispatch(MuleEvent event) throws Exception { Object data = event.transformMessage(); if (!(data instanceof Message)) { throw new DispatchException( CoreMessages.transformUnexpectedType(data.getClass(), Message.class), event.getMessage(), event.getEndpoint()); } else { // Check the message for any unset data and use defaults sendMailMessage((Message) data); } } protected MuleMessage doSend(MuleEvent event) throws Exception { doDispatch(event); return null; } protected void sendMailMessage(Message message) throws MessagingException { // sent date message.setSentDate(Calendar.getInstance().getTime()); /* * Double check that the transport is still connected as some SMTP servers may * disconnect idle connections. */ if (!transport.isConnected()) { EndpointURI uri = endpoint.getEndpointURI(); if (logger.isInfoEnabled()) { logger.info("Connection closed by remote server. Reconnecting."); } transport.connect(uri.getHost(), uri.getPort(), uri.getUser(), uri.getPassword()); } transport.sendMessage(message, message.getAllRecipients()); if (logger.isDebugEnabled()) { StringBuffer msg = new StringBuffer(); msg.append("Email message sent with subject'").append(message.getSubject()).append("' sent- "); msg.append(", From: ").append(MailUtils.mailAddressesToString(message.getFrom())).append(" "); msg.append(", To: ").append( MailUtils.mailAddressesToString(message.getRecipients(Message.RecipientType.TO))).append(" "); msg.append(", Cc: ").append( MailUtils.mailAddressesToString(message.getRecipients(Message.RecipientType.CC))).append(" "); msg.append(", Bcc: ") .append(MailUtils.mailAddressesToString(message.getRecipients(Message.RecipientType.BCC))) .append(" "); msg.append(", ReplyTo: ").append(MailUtils.mailAddressesToString(message.getReplyTo())); logger.debug(msg.toString()); } } protected void doDispose() { // nothing doing } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/AbstractMailConnector.java0000644000175000017500000001660210745677442032227 0ustar charlescharles/* * $Id: AbstractMailConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.transport.AbstractConnector; import org.mule.util.StringUtils; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Session; import javax.mail.URLName; /** * Abstract superclass for mail connectors. Provides Mule with an Authenticator * object and other shared functionality like e.g. MuleSession creation. */ public abstract class AbstractMailConnector extends AbstractConnector { public static final String MAILBOX = "INBOX"; private Map sessions = new HashMap(); private String mailboxFolder; private int defaultPort; /** * A custom authenticator to be used on any mail sessions created with this * connector. This will only be used if user name credendials are set on the * endpoint. */ private Authenticator authenticator = null; public AbstractMailConnector(int defaultPort, String mailboxFolder) { super(); this.defaultPort = defaultPort; this.mailboxFolder = mailboxFolder; } public int getDefaultPort() { return defaultPort; } public Authenticator getAuthenticator() { return authenticator; } public void setAuthenticator(Authenticator authenticator) { this.authenticator = authenticator; } public String getMailboxFolder() { return mailboxFolder; } public void setMailboxFolder(String mailboxFolder) { this.mailboxFolder = mailboxFolder; } public synchronized SessionDetails getSessionDetails(ImmutableEndpoint endpoint) { SessionDetails sessionDetails = (SessionDetails) sessions.get(endpoint); if (null == sessionDetails) { sessionDetails = newSession(endpoint); sessions.put(endpoint, sessionDetails); } return sessionDetails; } public URLName urlFromEndpoint(ImmutableEndpoint endpoint) { String inbox = endpoint.getEndpointURI().getPath(); if (inbox.length() == 0) { inbox = getMailboxFolder(); } else { inbox = inbox.substring(1); } EndpointURI uri = endpoint.getEndpointURI(); return new URLName(uri.getScheme(), uri.getHost(), uri.getPort(), inbox, uri.getUser(), uri.getPassword()); } /** * Some protocols (eg secure extensions) extend a "base" protocol. * Subclasses for such protocols should override this method. * * @return the underlying (eg non-secure) protocol */ protected String getBaseProtocol() { return getProtocol(); } /** * Subclasses should extend this to add further properties. * Synchronization is managed outside this call (so no need to synchronize further on properties) * * @param global system properties * @param local local properties (specific to one session) * @param url the endpoint url */ protected void extendPropertiesForSession(Properties global, Properties local, URLName url) { int port = url.getPort(); if (port == -1) { port = this.getDefaultPort(); } local.setProperty("mail." + getBaseProtocol() + ".socketFactory.port", Integer.toString(port)); if (StringUtils.isNotBlank(url.getPassword())) { local.setProperty("mail." + getBaseProtocol() + ".auth", "true"); if (getAuthenticator() == null) { setAuthenticator(new DefaultAuthenticator(url.getUsername(), url.getPassword())); if (logger.isDebugEnabled()) { logger.debug("No Authenticator set on connector: " + getName() + "; using default."); } } } else { local.setProperty("mail." + getBaseProtocol() + ".auth", "false"); } // TODO - i'm not at all certain that these properties (especially the ones // using the base protocol) are needed. they are inherited from old, gnarly // code. if (StringUtils.isNotBlank(url.getHost())) { local.setProperty("mail." + getBaseProtocol() + ".host", url.getHost()); } local.setProperty("mail." + getBaseProtocol() + ".rsetbeforequit", "true"); } protected SessionDetails newSession(ImmutableEndpoint endpoint) { URLName url = urlFromEndpoint(endpoint); Properties global = System.getProperties(); Properties local = new Properties(); Session session; // make sure we do not mess with authentication set via system properties synchronized (global) { extendPropertiesForSession(global, local, url); session = Session.getInstance(local, getAuthenticator()); } if (logger.isDebugEnabled()) { local.setProperty("mail.debug", "true"); dumpProperties("MuleSession local properties", local, true); dumpProperties("System global properties", global, true); logger.debug("Creating mail session: host = " + url.getHost() + ", port = " + url.getPort() + ", user = " + url.getUsername() + ", pass = " + url.getPassword()); } return new SessionDetails(session, url); } protected void dumpProperties(String title, Properties properties, boolean filter) { int skipped = 0; logger.debug(title + " ============="); Enumeration keys = properties.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); if (!filter || key.startsWith("mule.") || key.startsWith("mail.") || key.startsWith("javax.")) { String value = properties.getProperty(key); logger.debug(key + ": " + value); } else { ++skipped; } } if (filter) { logger.debug("skipped " + skipped); } } // supply these here because sub-classes are very simple protected void doInitialise() throws InitialisationException { // template method, nothing to do } protected void doDispose() { // template method, nothing to do } protected void doConnect() throws Exception { // template method, nothing to do } protected void doDisconnect() throws Exception { // template method, nothing to do } protected void doStart() throws MuleException { // template method, nothing to do } protected void doStop() throws MuleException { // template method, nothing to do } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/ImapConnector.java0000644000175000017500000000146510745677442030550 0ustar charlescharles/* * $Id: ImapConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; /** * Receives messages from an IMAP mailbox */ public class ImapConnector extends AbstractRetrieveMailConnector { public static final String IMAP = "imap"; public static final int DEFAULT_IMAP_PORT = 143; public ImapConnector() { super(DEFAULT_IMAP_PORT); } public String getProtocol() { return IMAP; } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/Pop3sConnector.java0000644000175000017500000000173110745677442030662 0ustar charlescharles/* * $Id: Pop3sConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; /** * Creates a secure connection to a POP3 mailbox */ public class Pop3sConnector extends AbstractTlsRetrieveMailConnector { public static final String POP3S = "pop3s"; public static final int DEFAULT_POP3S_PORT = 995; public Pop3sConnector() { super(DEFAULT_POP3S_PORT, Pop3sSocketFactory.MULE_POP3S_NAMESPACE, Pop3sSocketFactory.class); } public String getProtocol() { return "pop3s"; } public String getBaseProtocol() { return "pop3"; } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/Pop3Connector.java0000644000175000017500000000154610745677442030503 0ustar charlescharles/* * $Id: Pop3Connector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; /** * Pop3Connector is used to connect and receive mail from a POP3 * mailbox. */ public class Pop3Connector extends AbstractRetrieveMailConnector { public static final String POP3 = "pop3"; public static final int DEFAULT_POP3_PORT = 110; public Pop3Connector() { super(DEFAULT_POP3_PORT); } public String getProtocol() { return POP3; } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/MailUtils.java0000644000175000017500000000736710745677442027721 0ustar charlescharles/* * $Id: MailUtils.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.config.i18n.CoreMessages; import org.mule.util.StringUtils; import java.io.IOException; import java.util.Map; import javax.mail.Address; import javax.mail.MessagingException; import javax.mail.Multipart; import javax.mail.Part; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; /** * Contains javax.mail helpers. */ public class MailUtils { public static String internetAddressesToString(InternetAddress[] addresses) { if (addresses == null || addresses.length == 0) { return StringUtils.EMPTY; } StringBuffer buf = new StringBuffer(80); for (int i = 0; i < addresses.length; i++) { InternetAddress address = addresses[i]; buf.append(address.getAddress()); // all except the last one if (i < addresses.length - 1) { buf.append(", "); } } return buf.toString(); } public static String internetAddressesToString(InternetAddress address) { return internetAddressesToString(new InternetAddress[]{address}); } public static String mailAddressesToString(Address[] addresses) { if (addresses == null || addresses.length == 0) { return StringUtils.EMPTY; } StringBuffer buf = new StringBuffer(80); for (int i = 0; i < addresses.length; i++) { Address address = addresses[i]; buf.append(address.toString()); // all except the last one if (i < addresses.length - 1) { buf.append(", "); } } return buf.toString(); } public static String mailAddressesToString(Address address) { return mailAddressesToString(new Address[]{address}); } public static InternetAddress[] stringToInternetAddresses(String address) throws AddressException { if (StringUtils.isNotBlank(address)) { return InternetAddress.parse(address, false); } else { throw new IllegalArgumentException(CoreMessages.objectIsNull("Email address").toString()); } } public static void getAttachments(Multipart content, Map attachments) throws MessagingException, IOException { int x = 0; for(int i=0; i < content.getCount(); i++) { Part p = content.getBodyPart(i); if(p.getContentType().indexOf("multipart/mixed") > -1) { Multipart m = (Multipart)p.getContent(); getAttachments(m, attachments); } else { String key; if(StringUtils.isNotEmpty(p.getDescription())) { key = p.getDescription(); } else if(StringUtils.isNotEmpty(p.getFileName())) { key = p.getFileName(); } else if(StringUtils.isNotEmpty(p.getDisposition())) { key = p.getDisposition(); } else { key = String.valueOf(x++); } attachments.put(key, p); } } } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/Pop3sSocketFactory.java0000644000175000017500000000203710745677442031510 0ustar charlescharles/* * $Id: Pop3sSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.security.tls.TlsPropertiesSocketFactory; import javax.net.SocketFactory; /** * A socket factor that reads "indirect" configuration (see {@link org.mule.api.security.tls.TlsConfiguration}) * for POP3S from System properties. */ public class Pop3sSocketFactory extends TlsPropertiesSocketFactory { public static final String MULE_POP3S_NAMESPACE = "mule.email.pop3s"; public Pop3sSocketFactory() { super(true, MULE_POP3S_NAMESPACE); } public static SocketFactory getDefault() { return new Pop3sSocketFactory(); } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/RetrieveMessageRequester.java0000644000175000017500000001636110757615756033005 0ustar charlescharles/* * $Id: RetrieveMessageRequester.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.transport.AbstractMessageRequester; import javax.mail.Flags; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Store; /** * This dispatcher can only be used to receive message (as opposed to listening for them). * Trying to send or dispatch will throw an UnsupportedOperationException. * * This contains a reference to a mail folder (and also the endpoint and connector, via superclasses) */ public class RetrieveMessageRequester extends AbstractMessageRequester { private Folder folder; public RetrieveMessageRequester(InboundEndpoint endpoint) { super(endpoint); } private AbstractRetrieveMailConnector castConnector() { return (AbstractRetrieveMailConnector) getConnector(); } protected void doConnect() throws Exception { if (folder == null || !folder.isOpen()) { Store store = castConnector().getSessionDetails(endpoint).newStore(); EndpointURI uri = endpoint.getEndpointURI(); store.connect(uri.getHost(), uri.getPort(), uri.getUser(), uri.getPassword()); folder = store.getFolder(castConnector().getMailboxFolder()); if (!folder.isOpen()) { try { // Depending on Server implementation it's not always // necessary to open the folder to check it // Opening folders can be exprensive! // folder.open(Folder.READ_ONLY); folder.open(Folder.READ_WRITE); } catch (MessagingException e) { logger.warn("Failed to open folder: " + folder.getFullName(), e); } } } } protected void doDisconnect() throws Exception { // close and expunge deleted messages try { if (folder != null) { try { folder.expunge(); } catch (MessagingException e) { if (logger.isDebugEnabled()) { logger.debug("ignoring exception on expunge: " + e.getMessage()); } } if (folder.isOpen()) { folder.close(true); } } } catch (Exception e) { logger.error("Failed to close inbox: " + e.getMessage(), e); } } /** * @param event * @throws UnsupportedOperationException */ protected void doDispatch(MuleEvent event) throws Exception { throw new UnsupportedOperationException("Cannot dispatch from a Pop3 connection"); } /** * @param event * @return * @throws UnsupportedOperationException */ protected MuleMessage doSend(MuleEvent event) throws Exception { throw new UnsupportedOperationException("Cannot send from a Pop3 connection"); } /** * Make a specific request to the underlying transport. Endpoint can be in the * form of pop3://username:password@pop3.lotsofmail.org * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal causes an exception */ protected MuleMessage doRequest(long timeout) throws Exception { long t0 = System.currentTimeMillis(); if (timeout < 0) { timeout = Long.MAX_VALUE; } do { if (hasMessages(folder)) { int count = getMessageCount(folder); if (count > 0) { Message message = getNextMessage(folder); // so we don't get the same message again flagMessage(folder, message); return new DefaultMuleMessage(castConnector().getMessageAdapter(message)); } else if (count == -1) { throw new MessagingException("Cannot monitor folder: " + folder.getFullName() + " as folder is closed"); } } long sleep = Math.min(castConnector().getCheckFrequency(), timeout - (System.currentTimeMillis() - t0)); if (sleep > 0) { if (logger.isDebugEnabled()) { logger.debug("No results, sleeping for " + sleep); } Thread.sleep(sleep); } else { logger.debug("Timeout"); return null; } } while (true); } /** * There seems to be som variation on pop3 implementation so it may be * preferrable to mark messages as seen here and alos overload the getMessages * method to grab only new messages * * @param message * @throws javax.mail.MessagingException */ protected void flagMessage(Folder folder, Message message) throws MessagingException { message.setFlag(Flags.Flag.DELETED, true); } protected static Message getNextMessage(Folder folder) throws MessagingException { return folder.getMessage(1); } protected static int getMessageCount(Folder folder) throws MessagingException { return folder.getMessageCount(); } /** * Optimised check to se whether to return the message count and retrieve the * messages. Some pop3 implementations differ so an optimised check such as * folder.hasNewMessages() cannot be used * * @param folder * @return * @throws javax.mail.MessagingException */ protected static boolean hasMessages(Folder folder) throws MessagingException { return getMessageCount(folder) > 0; } protected void doDispose() { if (null != folder && folder.isOpen()) { try { folder.close(true); } catch (Exception e) { logger.debug("ignoring exception: " + e.getMessage(), e); } } } }mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/DefaultAuthenticator.java0000644000175000017500000000175510745677442032130 0ustar charlescharles/* * $Id: DefaultAuthenticator.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import javax.mail.PasswordAuthentication; /** * DefaultAuthenticator is used to do simple authentication when the SMTP server * requires it. */ class DefaultAuthenticator extends javax.mail.Authenticator { private String username = null; private String password = null; public DefaultAuthenticator(String user, String pwd) { username = user; password = pwd; } public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } } mule-2.0.1/transports/email/src/main/java/org/mule/transport/email/ImapsConnector.java0000644000175000017500000000172710745677442030734 0ustar charlescharles/* * $Id: ImapsConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; /** * Creates a secure IMAP connection */ public class ImapsConnector extends AbstractTlsRetrieveMailConnector { public static final String IMAPS = "imaps"; public static final int DEFAULT_IMAPS_PORT = 993; public ImapsConnector() { super(DEFAULT_IMAPS_PORT, ImapsSocketFactory.MULE_IMAPS_NAMESPACE, ImapsSocketFactory.class); } public String getProtocol() { return IMAPS; } public String getBaseProtocol() { return ImapConnector.IMAP; } } mule-2.0.1/transports/email/src/main/resources/0000755000175000017500000000000011351410652021331 5ustar charlescharlesmule-2.0.1/transports/email/src/main/resources/META-INF/0000755000175000017500000000000011351410652022471 5ustar charlescharlesmule-2.0.1/transports/email/src/main/resources/META-INF/mule-pop3s.xsd0000644000175000017500000000500210754365306025225 0ustar charlescharles mule-2.0.1/transports/email/src/main/resources/META-INF/spring.schemas0000644000175000017500000000113610715134324025343 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/email/2.0/mule-email.xsd=META-INF/mule-email.xsd http\://www.mulesource.org/schema/mule/smtp/2.0/mule-smtp.xsd=META-INF/mule-smtp.xsd http\://www.mulesource.org/schema/mule/smtps/2.0/mule-smtps.xsd=META-INF/mule-smtps.xsd http\://www.mulesource.org/schema/mule/pop3/2.0/mule-pop3.xsd=META-INF/mule-pop3.xsd http\://www.mulesource.org/schema/mule/pop3s/2.0/mule-pop3s.xsd=META-INF/mule-pop3s.xsd http\://www.mulesource.org/schema/mule/imap/2.0/mule-imap.xsd=META-INF/mule-imap.xsd http\://www.mulesource.org/schema/mule/imaps/2.0/mule-imaps.xsd=META-INF/mule-imaps.xsdmule-2.0.1/transports/email/src/main/resources/META-INF/mule-smtps.xsd0000644000175000017500000000557510763761355025352 0ustar charlescharles mule-2.0.1/transports/email/src/main/resources/META-INF/mule-imap.xsd0000644000175000017500000000407410740651573025116 0ustar charlescharles mule-2.0.1/transports/email/src/main/resources/META-INF/spring.handlers0000644000175000017500000000131310754365306025526 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/email/2.0=org.mule.transport.email.config.EmailNamespaceHandler http\://www.mulesource.org/schema/mule/imap/2.0=org.mule.transport.email.config.ImapNamespaceHandler http\://www.mulesource.org/schema/mule/imaps/2.0=org.mule.transport.email.config.ImapsNamespaceHandler http\://www.mulesource.org/schema/mule/pop3/2.0=org.mule.transport.email.config.Pop3NamespaceHandler http\://www.mulesource.org/schema/mule/pop3s/2.0=org.mule.transport.email.config.Pop3sNamespaceHandler http\://www.mulesource.org/schema/mule/smtp/2.0=org.mule.transport.email.config.SmtpNamespaceHandler http\://www.mulesource.org/schema/mule/smtps/2.0=org.mule.transport.email.config.SmtpsNamespaceHandler mule-2.0.1/transports/email/src/main/resources/META-INF/mule-smtp.xsd0000644000175000017500000001530010763761235025147 0ustar charlescharles Comma separated list of addresses for blind copies. Comma separated list of addresses for copies. Mime type for the outgoing message. The from address for the outgoing message. The reply-to address for the outgoing message. The default subject for the outgoing message if none is set in the message. Additional header name and value, added to the message. The destination for the email. The address of the sender of the email. The email subject. A comma separated list of email addresses to carbon copy to. A comma separated list of email addresses to blind carbon copy to. The address used by default if someone replies to the email. mule-2.0.1/transports/email/src/main/resources/META-INF/services/0000755000175000017500000000000011351410652024314 5ustar charlescharlesmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410652025103 5ustar charlescharlesmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410652026045 5ustar charlescharlesmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410652030062 5ustar charlescharlesmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/providers/imap.properties0000644000175000017500000000072110745677442033150 0ustar charlescharlesconnector=org.mule.transport.email.ImapConnector dispatcher.factory=org.mule.transport.UnsupportedMessageDispatcherFactory requester.factory=org.mule.transport.email.RetrieveMessageRequesterFactory message.receiver=org.mule.transport.email.RetrieveMessageReceiver message.adapter=org.mule.transport.email.MailMessageAdapter inbound.transformer=org.mule.transport.email.transformers.EmailMessageToString endpoint.builder=org.mule.endpoint.UserInfoEndpointURIBuilder ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/providers/pop3s.propertiesmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/providers/pop3s.properties0000644000175000017500000000072210745677442033267 0ustar charlescharlesconnector=org.mule.transport.email.Pop3sConnector dispatcher.factory=org.mule.transport.UnsupportedMessageDispatcherFactory requester.factory=org.mule.transport.email.RetrieveMessageRequesterFactory message.receiver=org.mule.transport.email.RetrieveMessageReceiver message.adapter=org.mule.transport.email.MailMessageAdapter inbound.transformer=org.mule.transport.email.transformers.EmailMessageToString endpoint.builder=org.mule.endpoint.UserInfoEndpointURIBuilder mule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/providers/smtp.properties0000644000175000017500000000075610745677442033215 0ustar charlescharlesconnector=org.mule.transport.email.SmtpConnector dispatcher.factory=org.mule.transport.email.SmtpMessageDispatcherFactory requester.factory=org.mule.transport.UnsupportedMessageRequesterFactory #message.receiver= message.adapter=org.mule.transport.email.MailMessageAdapter #inbound.transformer=org.mule.transport.email.transformers.EmailMessageToString outbound.transformer=org.mule.transport.email.transformers.ObjectToMimeMessage endpoint.builder=org.mule.endpoint.UserInfoEndpointURIBuilder mule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/providers/pop3.properties0000644000175000017500000000072110745677442033103 0ustar charlescharlesconnector=org.mule.transport.email.Pop3Connector dispatcher.factory=org.mule.transport.UnsupportedMessageDispatcherFactory requester.factory=org.mule.transport.email.RetrieveMessageRequesterFactory message.receiver=org.mule.transport.email.RetrieveMessageReceiver message.adapter=org.mule.transport.email.MailMessageAdapter inbound.transformer=org.mule.transport.email.transformers.EmailMessageToString endpoint.builder=org.mule.endpoint.UserInfoEndpointURIBuilder ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/providers/smtps.propertiesmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/providers/smtps.properties0000644000175000017500000000075710745677442033401 0ustar charlescharlesconnector=org.mule.transport.email.SmtpsConnector dispatcher.factory=org.mule.transport.email.SmtpMessageDispatcherFactory requester.factory=org.mule.transport.UnsupportedMessageRequesterFactory #message.receiver= message.adapter=org.mule.transport.email.MailMessageAdapter #inbound.transformer=org.mule.transport.email.transformers.EmailMessageToString outbound.transformer=org.mule.transport.email.transformers.ObjectToMimeMessage endpoint.builder=org.mule.endpoint.UserInfoEndpointURIBuilder ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/providers/imaps.propertiesmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/providers/imaps.properties0000644000175000017500000000072210745677442033334 0ustar charlescharlesconnector=org.mule.transport.email.ImapsConnector dispatcher.factory=org.mule.transport.UnsupportedMessageDispatcherFactory requester.factory=org.mule.transport.email.RetrieveMessageRequesterFactory message.receiver=org.mule.transport.email.RetrieveMessageReceiver message.adapter=org.mule.transport.email.MailMessageAdapter inbound.transformer=org.mule.transport.email.transformers.EmailMessageToString endpoint.builder=org.mule.endpoint.UserInfoEndpointURIBuilder mule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410652026624 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/i18n/email-messages.propertiesmule-2.0.1/transports/email/src/main/resources/META-INF/services/org/mule/i18n/email-messages.proper0000644000175000017500000000015010621717250032750 0ustar charlescharles1=Failed to parse the from address '{0}' 2=Failed to parse the to address '{0}' 3=Failed to route event mule-2.0.1/transports/email/src/main/resources/META-INF/mule-imaps.xsd0000644000175000017500000000500210740651573025271 0ustar charlescharles mule-2.0.1/transports/email/src/main/resources/META-INF/mule-pop3.xsd0000644000175000017500000000401310754365306025043 0ustar charlescharles mule-2.0.1/transports/email/src/main/resources/META-INF/mule-email.xsd0000644000175000017500000000715310761340655025257 0ustar charlescharles Should we save copies to backupFolder (default is false)? The folder to which messages are moved when read. Period (ms) between poll connections to the server. The folder to check for email. Whether or not to delete messages from the server when they have been downloaded. mule-2.0.1/transports/email/src/test/0000755000175000017500000000000011351410647017356 5ustar charlescharlesmule-2.0.1/transports/email/src/test/java/0000755000175000017500000000000011351410646020276 5ustar charlescharlesmule-2.0.1/transports/email/src/test/java/org/0000755000175000017500000000000011351410646021065 5ustar charlescharlesmule-2.0.1/transports/email/src/test/java/org/mule/0000755000175000017500000000000011351410646022027 5ustar charlescharlesmule-2.0.1/transports/email/src/test/java/org/mule/transport/0000755000175000017500000000000011351410646024063 5ustar charlescharlesmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/0000755000175000017500000000000011351410647025153 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/SimpleMailMessageAdapterTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/SimpleMailMessageAdapterTestCase.0000644000175000017500000000612110745677442033470 0ustar charlescharles/* * $Id: SimpleMailMessageAdapterTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.email.MailProperties; import org.mule.transport.email.SimpleMailMessageAdapter; import java.util.List; import java.util.Properties; import javax.mail.Address; import javax.mail.Message; import javax.mail.Session; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class SimpleMailMessageAdapterTestCase extends AbstractMuleTestCase { private static final String NAME_1 = "name1"; private static final String NAME_2 = "name2"; private static final String VALUE_1 = "value1"; private static final String VALUE_2 = "value2"; public void testHeaders() throws Exception { Message message = new MimeMessage(Session.getDefaultInstance(new Properties())); message.addHeader(NAME_1, VALUE_1); message.addHeader(NAME_1, VALUE_2); message.addHeader(NAME_2, VALUE_2); SimpleMailMessageAdapter adapter = new SimpleMailMessageAdapter(message); assertEquals(adapter.getProperty(NAME_1), VALUE_1); assertTrue(adapter.getProperty(SimpleMailMessageAdapter.toListHeader(NAME_1)) instanceof List); List list1 = (List) adapter.getProperty(SimpleMailMessageAdapter.toListHeader(NAME_1)); assertTrue(list1.contains(VALUE_1)); assertTrue(list1.contains(VALUE_2)); assertEquals(2, list1.size()); assertEquals(adapter.getProperty(NAME_2), VALUE_2); assertTrue(adapter.getProperty(SimpleMailMessageAdapter.toListHeader(NAME_2)) instanceof List); List list2 = (List) adapter.getProperty(SimpleMailMessageAdapter.toListHeader(NAME_2)); assertTrue(list2.contains(VALUE_2)); assertEquals(1, list2.size()); } public void testInvalidFrom() throws Exception { Message message = new MimeMessage(Session.getDefaultInstance(new Properties())); // do not use the ctor taking a string here as it tries to parse the string and we're // trying to use an invalid address here. InternetAddress fromAddress = new InternetAddress(); fromAddress.setAddress("foo@bar@baz"); message.setFrom(fromAddress); InternetAddress replyToAddrress = new InternetAddress(); replyToAddrress.setAddress("baz@bletch@buzz"); message.setReplyTo(new Address[] { replyToAddrress }); SimpleMailMessageAdapter adapter = new SimpleMailMessageAdapter(message); assertEquals(null, adapter.getProperty(MailProperties.INBOUND_FROM_ADDRESS_PROPERTY)); assertEquals(null, adapter.getProperty(MailProperties.INBOUND_REPLY_TO_ADDRESSES_PROPERTY)); } } mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/FixedPortGreenMailSupport.java0000644000175000017500000000132010745677442033115 0ustar charlescharles/* * $Id: FixedPortGreenMailSupport.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; public class FixedPortGreenMailSupport extends AbstractGreenMailSupport { private int port; public FixedPortGreenMailSupport(int port) { this.port = port; } protected int nextPort() { return port++; } } mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/transformers/0000755000175000017500000000000011351410647027700 5ustar charlescharles././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/transformers/MailMessageTransformersTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/transformers/MailMessageTransform0000644000175000017500000000754110754365306033724 0ustar charlescharles/* * $Id: MailMessageTransformersTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.transformers; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.transformer.TransformerException; import org.mule.api.transformer.Transformer; import org.mule.lifecycle.AlreadyInitialisedException; import org.mule.transformer.AbstractTransformer; import org.mule.transformer.AbstractTransformerTestCase; import org.mule.transport.email.transformers.EmailMessageToString; import org.mule.transport.email.transformers.StringToEmailMessage; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.internet.MimeMessage; public class MailMessageTransformersTestCase extends AbstractTransformerTestCase { private Message message; public Transformer getTransformer() throws Exception { return new EmailMessageToString(); } public Transformer getRoundTripTransformer() throws Exception { StringToEmailMessage trans = new StringToEmailMessage(); ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( "smtp://a:a@a.com"); // We need to init the connector without actually connecting for this test // case try { endpoint.getConnector().initialise(); } catch (AlreadyInitialisedException e) { assertNotNull(e); } trans.setEndpoint(endpoint); return trans; } public Object getTestData() { if (message == null) { message = new MimeMessage(Session.getDefaultInstance(new Properties())); try { message.setContent(getResultData(), "text/plain"); } catch (MessagingException e) { throw new RuntimeException("Failed to create Mime Message: " + e.getMessage(), e); } } return message; } public Object getResultData() { return "Test Email Message"; } public boolean compareResults(Object src, Object result) { if (src instanceof Message) { Object objSrc; Object objRes; try { objSrc = ((Message) src).getContent(); objRes = ((Message) result).getContent(); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } if (objSrc == null || objRes == null) { return false; } return objRes.equals(objSrc); } return super.compareResults(src, result); } public void testStringSourceType() throws Exception { try { assertFalse(getTransformer().isSourceTypeSupported(String.class)); getTransformer().transform(getResultData()); fail("Should throw exception for string source type"); } catch (TransformerException e) { // expected assertTrue(true); } } public void testStringSourceTypeWithIgnoreBadInput() throws Exception { AbstractTransformer trans = (AbstractTransformer) getTransformer(); trans.setIgnoreBadInput(true); Object result = trans.transform(getResultData()); trans.setIgnoreBadInput(false); assertSame(result, getResultData()); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/transformers/Rfc822ByteArrayTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/transformers/Rfc822ByteArrayTestC0000644000175000017500000000566110745677442033405 0ustar charlescharles/* * $Id: Rfc822ByteArrayTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.transformers; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.transformer.TransformerException; import org.mule.tck.FunctionalTestCase; import org.mule.transport.email.transformers.MimeMessageToRfc822ByteArray; import org.mule.transport.email.transformers.Rfc822ByteArraytoMimeMessage; import java.io.IOException; import java.util.Properties; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class Rfc822ByteArrayTestCase extends FunctionalTestCase { protected String getConfigResources() { return "rfc822-byte-array-test.xml"; } public void testToByteArray() throws MessagingException, TransformerException { mimeMessageToByteArray(newMimeMessage()); } public void testToByteArrayAndBack() throws MessagingException, MuleException, IOException { MimeMessage first = newMimeMessage(); byte[] bytes = mimeMessageToByteArray(first); MimeMessage second = byteArrayToMimeMessage(bytes); assertEquals(first.getContent(), second.getContent()); assertEquals(1, second.getFrom().length); assertEquals(first.getFrom().length, second.getFrom().length); assertEquals(first.getFrom()[0], second.getFrom()[0]); } protected MimeMessage byteArrayToMimeMessage(byte[] bytes) throws MuleException { Rfc822ByteArraytoMimeMessage transformer = new Rfc822ByteArraytoMimeMessage(); ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "smtp"); transformer.setEndpoint(endpoint); Object result = transformer.transform(bytes); assertTrue(result instanceof MimeMessage); return (MimeMessage) result; } protected byte[] mimeMessageToByteArray(MimeMessage mimeMessage) throws TransformerException { Object result = new MimeMessageToRfc822ByteArray().transform(mimeMessage); assertTrue(result instanceof byte[]); return (byte[]) result; } protected MimeMessage newMimeMessage() throws MessagingException { MimeMessage message = new MimeMessage(newSession()); message.setText("text"); message.setFrom(new InternetAddress("bob@example.com")); return message; } protected Session newSession() { return Session.getDefaultInstance(new Properties(), null); } } mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/GreenMailUtilities.java0000644000175000017500000000676110772340531031567 0ustar charlescharles/* * $Id: GreenMailUtilities.java 11511 2008-03-26 03:22:01Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import com.icegreen.greenmail.user.GreenMailUser; import com.icegreen.greenmail.user.UserManager; import com.icegreen.greenmail.util.GreenMail; import java.net.Socket; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class GreenMailUtilities { protected static Log logger = LogFactory.getLog(GreenMailUtilities.class); public static void storeEmail(UserManager userManager, String email, String user, String password, MimeMessage message) throws Exception { // note that with greenmail 1.1 the Servers object is unreliable // and the approach taken in their examples will not work. // the following does work, but may break in a later version // (there is some confusion in the greenmail code about // whether users are identified by email or name alone) // in which case try retrieving by EMAIL rather than USER userManager.createUser(email, user, password); GreenMailUser gmUser = userManager.getUser(user); assert null != gmUser; gmUser.deliver(message); } public static MimeMessage toMessage(String text, String email) throws MessagingException { MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties())); message.setContent(text, "text/plain"); message.setRecipient(Message.RecipientType.TO, new InternetAddress(email)); return message; } public static void waitForStartup(String host, int port, int count, long wait) throws InterruptedException { for (int i = 0; i < count; ++i) { Thread.sleep(wait); try { Socket socket = new Socket(host, port); socket.close(); logger.info("Successful connection made to port " + port); return; } catch (Exception e) { logger.warn("Could not connect to server on " + host + ":" + port + " - " + e.getMessage()); } } throw new RuntimeException("Server failed to start within " + (count * wait) + "ms"); } public static void robustStartup(GreenMail servers, String host, int port, int startMax, int testMax, long wait) throws InterruptedException { for (int start = 0; start < startMax; ++start) { try { servers.start(); waitForStartup(host, port, testMax, wait); return; } catch (Exception e) { try { servers.stop(); } catch (Throwable t) { // ignore } } Thread.sleep(wait); } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/AutoIncrementGreenMailSupport.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/AutoIncrementGreenMailSupport.jav0000644000175000017500000000206310745677442033632 0ustar charlescharles/* * $Id: AutoIncrementGreenMailSupport.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; public class AutoIncrementGreenMailSupport extends AbstractGreenMailSupport { // something odd happening here? 50006 seems to have failed a // couple of times? public static final int INITIAL_SERVER_PORT = 50007; // large enough to jump away from a group of related ports public static final int PORT_INCREMENT = 17; private static final AtomicInteger nextPort = new AtomicInteger(INITIAL_SERVER_PORT); protected int nextPort() { return nextPort.addAndGet(PORT_INCREMENT); } } mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/EmailRoundTripTestCase.java0000644000175000017500000000547310754375733032375 0ustar charlescharles/* * $Id: EmailRoundTripTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import javax.mail.internet.MimeMessage; /** * This demonstrates "round trip" processing of email - an email is pulled from a POP * server and then sent to an SMTP server. While within Mule the message is serialized * as RFC822 encoded bytes (this would let the message be transmitted over JMS etc). * *

The email servers for the test are managed by the greenMailSupport instance. * The Mule services (defined in email-round-trip-test.xml) are started by the test framework. * So all we need to do here is test that the message is handled correctly.

*/ public class EmailRoundTripTestCase extends FunctionalTestCase { public static final long WAIT_MS = 3000L; // this places the SMTP server at 62000 and POP at 62002 private AbstractGreenMailSupport greenMailSupport = new FixedPortGreenMailSupport(62000); protected String getConfigResources() { return "email-round-trip-test.xml"; } public void testRoundTrip() throws MuleException, InterruptedException { // first, check that the conversion happened - we should have a copy of // the message as rfc822 encoded bytes on vm://rfc822 MuleClient client = new MuleClient(); MuleMessage message = client.request("vm://rfc822?connector=queue", WAIT_MS); assertTrue(message.getPayload() instanceof byte[]); // next, check that the email is received in the server greenMailSupport.getServers().waitForIncomingEmail(WAIT_MS, 1); MimeMessage[] messages = greenMailSupport.getServers().getReceivedMessages(); assertNotNull("did not receive any messages", messages); assertEquals("did not receive 1 mail", 1, messages.length); } /** * Start the servers when the test starts * @throws Exception */ // @Override protected void suitePreSetUp() throws Exception { greenMailSupport.startServers(); greenMailSupport.createBobAndStoreEmail(greenMailSupport.getValidMessage(AbstractGreenMailSupport.ALICE_EMAIL)); } /** * Stop the servers when the test ends * @throws Exception */ // @Override protected void suitePostTearDown() throws Exception { greenMailSupport.stopServers(); } } mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/EmailEndpointsTestCase.java0000644000175000017500000001671110745677442032411 0ustar charlescharles/* * $Id: EmailEndpointsTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.email.ImapConnector; public class EmailEndpointsTestCase extends AbstractMuleTestCase { private static final int PORT = 3125; public void testPop3Url() throws Exception { MuleEndpointURI endpointUri = new MuleEndpointURI("pop3://username:password@pop3.lotsofmail.org"); endpointUri.initialise(); assertEquals("pop3", endpointUri.getScheme()); assertEquals("username@lotsofmail.org", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(-1, endpointUri.getPort()); assertEquals("pop3.lotsofmail.org", endpointUri.getHost()); assertEquals("username:password", endpointUri.getUserInfo()); assertEquals("pop3://username:password@pop3.lotsofmail.org", endpointUri.toString()); assertEquals(0, endpointUri.getParams().size()); } public void testSmtpUrl() throws Exception { MuleEndpointURI endpointUri = new MuleEndpointURI("smtp://username:password@smtp.lotsofmail.org"); endpointUri.initialise(); assertEquals("smtp", endpointUri.getScheme()); assertEquals("username@lotsofmail.org", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(-1, endpointUri.getPort()); assertEquals("smtp.lotsofmail.org", endpointUri.getHost()); assertEquals("username:password", endpointUri.getUserInfo()); assertEquals("smtp://username:password@smtp.lotsofmail.org", endpointUri.toString()); assertEquals(0, endpointUri.getParams().size()); } public void testSmtpUrlWithPort() throws Exception { MuleEndpointURI endpointUri = new MuleEndpointURI("smtp://user:password@hostname:" + PORT); endpointUri.initialise(); assertEquals("smtp", endpointUri.getScheme()); assertEquals("user@hostname:" + PORT, endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(PORT, endpointUri.getPort()); assertEquals("hostname", endpointUri.getHost()); assertEquals("user:password", endpointUri.getUserInfo()); assertEquals("smtp://user:password@hostname:" + PORT, endpointUri.toString()); assertEquals(0, endpointUri.getParams().size()); } public void testImapUrlWithFolder() throws Exception { MuleEndpointURI endpointUri = new MuleEndpointURI( "imap://username:password@imap.lotsofmail.org/MyMail"); endpointUri.initialise(); assertEquals(ImapConnector.IMAP, endpointUri.getScheme()); assertEquals("username@lotsofmail.org", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(-1, endpointUri.getPort()); assertEquals("imap.lotsofmail.org", endpointUri.getHost()); assertEquals("username:password", endpointUri.getUserInfo()); assertEquals("imap://username:password@imap.lotsofmail.org/MyMail", endpointUri.toString()); assertEquals(0, endpointUri.getParams().size()); assertEquals("/MyMail", endpointUri.getPath()); } public void testSmtpUrlEmailUsernameAndParams() throws Exception { MuleEndpointURI endpointUri = new MuleEndpointURI( "smtp://test%40lotsofmail.org:password@smtpout.secureserver.net:" + PORT + "?address=test@lotsofmail.org&ccAddresses=donkey@lotsofmail.org"); endpointUri.initialise(); assertEquals("smtp", endpointUri.getScheme()); assertEquals("test@lotsofmail.org", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(PORT, endpointUri.getPort()); assertEquals("smtpout.secureserver.net", endpointUri.getHost()); assertEquals("test@lotsofmail.org:password", endpointUri.getUserInfo()); assertEquals( "smtp://test%40lotsofmail.org:password@smtpout.secureserver.net:" + PORT + "?address=test@lotsofmail.org&ccAddresses=donkey@lotsofmail.org", endpointUri.toString()); assertEquals(2, endpointUri.getParams().size()); assertEquals("donkey@lotsofmail.org", endpointUri.getParams().get("ccAddresses")); } /** * Mule will assume that the username is the from address as it has an @ symbol * in it * @throws Exception */ public void testSmtpUrlEmailUsernameWithoutAddressParam() throws Exception { MuleEndpointURI endpointUri = new MuleEndpointURI( "smtp://test%40lotsofmail.org:password@smtpout.secureserver.net:" + PORT + "?ccAddresses=donkey@lotsofmail.org"); endpointUri.initialise(); assertEquals("smtp", endpointUri.getScheme()); assertEquals("test@lotsofmail.org", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(PORT, endpointUri.getPort()); assertEquals("smtpout.secureserver.net", endpointUri.getHost()); assertEquals("test@lotsofmail.org:password", endpointUri.getUserInfo()); assertEquals( "smtp://test%40lotsofmail.org:password@smtpout.secureserver.net:" + PORT + "?ccAddresses=donkey@lotsofmail.org", endpointUri.toString()); assertEquals(1, endpointUri.getParams().size()); assertEquals("donkey@lotsofmail.org", endpointUri.getParams().get("ccAddresses")); } /** * Mule will assume that the username is the from address as it has an @ symbol * in it * @throws Exception */ public void testSmtpWithoutCredentials() throws Exception { MuleEndpointURI endpointUri = new MuleEndpointURI( "smtp://smtpout.secureserver.net:" + PORT + "?address=test@lotsofmail.org"); endpointUri.initialise(); assertEquals("smtp", endpointUri.getScheme()); assertEquals("test@lotsofmail.org", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(PORT, endpointUri.getPort()); assertEquals("smtpout.secureserver.net", endpointUri.getHost()); assertNull(endpointUri.getUserInfo()); assertEquals("smtp://smtpout.secureserver.net:" + PORT + "?address=test@lotsofmail.org", endpointUri.toString()); assertEquals(1, endpointUri.getParams().size()); } /** * Added by Lajos on 2006-12-14 per Ross */ public void testWithAddressOverrideOnly() throws Exception { MuleEndpointURI endpointUri = new MuleEndpointURI("smtp://?address=test@lotsofmail.org"); endpointUri.initialise(); assertEquals("smtp", endpointUri.getScheme()); assertEquals("test@lotsofmail.org", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(-1, endpointUri.getPort()); assertNull(endpointUri.getHost()); assertNull(endpointUri.getUserInfo()); assertEquals("smtp://?address=test@lotsofmail.org", endpointUri.toString()); assertEquals(1, endpointUri.getParams().size()); } } mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/config/0000755000175000017500000000000011351410647026420 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/config/SmtpNamespaceHandlerTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/config/SmtpNamespaceHandlerTestCa0000644000175000017500000000626710761536530033524 0ustar charlescharles/* * $Id: SmtpNamespaceHandlerTestCase.java 11110 2008-02-28 13:55:36Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.config; import org.mule.api.MuleException; import org.mule.transport.email.SmtpConnector; import org.mule.transport.email.SmtpsConnector; import java.util.Properties; public class SmtpNamespaceHandlerTestCase extends AbstractEmailNamespaceHandlerTestCase { protected String getConfigResources() { return "smtp-namespace-config.xml"; } public void testConfig() throws Exception { SmtpConnector c = (SmtpConnector)muleContext.getRegistry().lookupConnector("smtpConnector"); assertNotNull(c); assertEquals("abc@example.com", c.getBccAddresses()); assertEquals("bcd@example.com", c.getCcAddresses()); assertEquals("foo/bar", c.getContentType()); Properties headers = c.getCustomHeaders(); assertEquals(2, headers.size()); assertEquals("bar", headers.getProperty("foo")); assertEquals("boz", headers.getProperty("baz")); assertEquals("cde@example.com", c.getFromAddress()); assertEquals("def@example.com", c.getReplyToAddresses()); assertEquals("subject", c.getSubject()); // authenticator? assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testSecureConfig() throws Exception { SmtpsConnector c = (SmtpsConnector)muleContext.getRegistry().lookupConnector("smtpsConnector"); assertNotNull(c); assertEquals("abc@example.com", c.getBccAddresses()); assertEquals("bcd@example.com", c.getCcAddresses()); assertEquals("foo/bar", c.getContentType()); Properties headers = c.getCustomHeaders(); assertEquals(2, headers.size()); assertEquals("bar", headers.getProperty("foo")); assertEquals("boz", headers.getProperty("baz")); assertEquals("cde@example.com", c.getFromAddress()); assertEquals("def@example.com", c.getReplyToAddresses()); assertEquals("subject", c.getSubject()); // authenticator? //The full path gets resolved, we're just checkng that the property got set assertTrue(c.getClientKeyStore().endsWith("/greenmail-truststore")); assertEquals("password", c.getClientKeyStorePassword()); //The full path gets resolved, we're just checkng that the property got set assertTrue(c.getTrustStore().endsWith("/greenmail-truststore")); assertEquals("password", c.getTrustStorePassword()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testEndpoint() throws MuleException { testEndpoint("global1", SmtpConnector.SMTP); testEndpoint("global2", SmtpConnector.SMTP); testEndpoint("global1s", SmtpsConnector.SMTPS); testEndpoint("global2s", SmtpsConnector.SMTPS); } }././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/config/ImapNamespaceHandlerTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/config/ImapNamespaceHandlerTestCa0000644000175000017500000000511110745677442033464 0ustar charlescharles/* * $Id: ImapNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.config; import org.mule.api.MuleException; import org.mule.transport.email.ImapConnector; import org.mule.transport.email.ImapsConnector; public class ImapNamespaceHandlerTestCase extends AbstractEmailNamespaceHandlerTestCase { protected String getConfigResources() { return "imap-namespace-config.xml"; } public void testConfig() throws Exception { ImapConnector c = (ImapConnector)muleContext.getRegistry().lookupConnector("imapConnector"); assertNotNull(c); assertTrue(c.isBackupEnabled()); assertEquals("newBackup", c.getBackupFolder()); assertEquals(1234, c.getCheckFrequency()); assertEquals("newMailbox", c.getMailboxFolder()); assertEquals(false, c.isDeleteReadMessages()); // authenticator? assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testSecureConfig() throws Exception { ImapsConnector c = (ImapsConnector)muleContext.getRegistry().lookupConnector("imapsConnector"); assertNotNull(c); assertFalse(c.isBackupEnabled()); assertEquals("newBackup", c.getBackupFolder()); assertEquals(1234, c.getCheckFrequency()); assertEquals("newMailbox", c.getMailboxFolder()); assertEquals(false, c.isDeleteReadMessages()); // authenticator? //The full path gets resolved, we're just checkng that the property got set assertTrue(c.getClientKeyStore().endsWith("/greenmail-truststore")); assertEquals("password", c.getClientKeyStorePassword()); //The full path gets resolved, we're just checkng that the property got set assertTrue(c.getTrustStore().endsWith("/greenmail-truststore")); assertEquals("password", c.getTrustStorePassword()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testEndpoint() throws MuleException { testEndpoint("global1", ImapConnector.IMAP); testEndpoint("global2", ImapConnector.IMAP); testEndpoint("global1s", ImapsConnector.IMAPS); testEndpoint("global2s", ImapsConnector.IMAPS); } }././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/config/Pop3NamespaceHandlerTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/config/Pop3NamespaceHandlerTestCa0000644000175000017500000000513110745677442033421 0ustar charlescharles/* * $Id: Pop3NamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.config; import org.mule.api.MuleException; import org.mule.transport.email.Pop3Connector; import org.mule.transport.email.Pop3sConnector; /** * TODO */ public class Pop3NamespaceHandlerTestCase extends AbstractEmailNamespaceHandlerTestCase { protected String getConfigResources() { return "pop3-namespace-config.xml"; } public void testConfig() throws Exception { Pop3Connector c = (Pop3Connector)muleContext.getRegistry().lookupConnector("pop3Connector"); assertNotNull(c); assertTrue(c.isBackupEnabled()); assertEquals("newBackup", c.getBackupFolder()); assertEquals(1234, c.getCheckFrequency()); assertEquals("newMailbox", c.getMailboxFolder()); assertEquals(false, c.isDeleteReadMessages()); // authenticator? assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testSecureConfig() throws Exception { Pop3sConnector c = (Pop3sConnector)muleContext.getRegistry().lookupConnector("pop3sConnector"); assertNotNull(c); assertTrue(c.isBackupEnabled()); assertEquals("newBackup", c.getBackupFolder()); assertEquals(1234, c.getCheckFrequency()); assertEquals("newMailbox", c.getMailboxFolder()); assertEquals(false, c.isDeleteReadMessages()); // authenticator? //The full path gets resolved, we're just checkng that the property got set assertTrue(c.getClientKeyStore().endsWith("/greenmail-truststore")); assertEquals("password", c.getClientKeyStorePassword()); //The full path gets resolved, we're just checkng that the property got set assertTrue(c.getTrustStore().endsWith("/greenmail-truststore")); assertEquals("password", c.getTrustStorePassword()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testEndpoint() throws MuleException { testEndpoint("global1", Pop3Connector.POP3); testEndpoint("global2", Pop3Connector.POP3); testEndpoint("global1s", Pop3sConnector.POP3S); testEndpoint("global2s", Pop3sConnector.POP3S); } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/config/AbstractEmailNamespaceHandlerTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/config/AbstractEmailNamespaceHand0000644000175000017500000000255010745677442033506 0ustar charlescharles/* * $Id: AbstractEmailNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.config; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.FunctionalTestCase; public abstract class AbstractEmailNamespaceHandlerTestCase extends FunctionalTestCase { protected void testEndpoint(String name, String protocolName) throws MuleException { ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(name); assertNotNull(endpoint); String address = endpoint.getEndpointURI().getAddress(); assertNotNull(address); assertEquals("bob@localhost:123", address); String password = endpoint.getEndpointURI().getPassword(); assertNotNull(password); assertEquals("secret", password); String protocol = endpoint.getProtocol(); assertNotNull(protocol); assertEquals(protocolName, protocol); } }mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/MailUtilsTestCase.java0000644000175000017500000000577010745677442031404 0ustar charlescharles/* * $Id: MailUtilsTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.email.MailUtils; import javax.mail.internet.InternetAddress; public class MailUtilsTestCase extends AbstractMuleTestCase { private static final String EMAIL_1 = "vasya@pupkin.com"; private static final String EMAIL_2 = "zhora@buryakov.com"; private InternetAddress inetAddress1; private InternetAddress inetAddress2; private static final String MULTIPLE_EMAILS_WITH_WHITESPACE = EMAIL_1 + ", " + EMAIL_2; private static final String MULTIPLE_EMAILS_WITHOUT_WHITESPACE = EMAIL_1 + "," + EMAIL_2; protected void doSetUp() throws Exception { inetAddress1 = new InternetAddress(EMAIL_1); inetAddress2 = new InternetAddress(EMAIL_2); } public void testSingleInternetAddressToString() throws Exception { String result = MailUtils.internetAddressesToString(inetAddress1); assertEquals("Wrong internet address conversion.", EMAIL_1, result); } public void testMultipleInternetAddressesToString() { String result = MailUtils.internetAddressesToString(new InternetAddress[]{inetAddress1, inetAddress2}); assertEquals("Wrong internet address conversion.", MULTIPLE_EMAILS_WITH_WHITESPACE, result); } public void testStringToSingleInternetAddresses() throws Exception { InternetAddress[] result = MailUtils.stringToInternetAddresses(EMAIL_1); assertNotNull(result); assertEquals("Wrong number of addresses parsed.", 1, result.length); assertEquals("Wrong internet address conversion.", inetAddress1, result[0]); } public void testStringWithWhitespaceToMultipleInternetAddresses() throws Exception { InternetAddress[] result = MailUtils.stringToInternetAddresses(MULTIPLE_EMAILS_WITH_WHITESPACE); assertNotNull(result); assertEquals("Wrong number of addresses parsed.", 2, result.length); assertEquals("Wrong internet address conversion.", inetAddress1, result[0]); assertEquals("Wrong internet address conversion.", inetAddress2, result[1]); } public void testStringWithoutWhitespaceToMultipleInternetAddresses() throws Exception { InternetAddress[] result = MailUtils.stringToInternetAddresses(MULTIPLE_EMAILS_WITHOUT_WHITESPACE); assertNotNull(result); assertEquals("Wrong number of addresses parsed.", 2, result.length); assertEquals("Wrong internet address conversion.", inetAddress1, result[0]); assertEquals("Wrong internet address conversion.", inetAddress2, result[1]); } } mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/0000755000175000017500000000000011351410647026466 5ustar charlescharles././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/MakeBackupMule2050TestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/MakeBackupMule2050TestCase0000644000175000017500000000120610745677442033217 0ustar charlescharles/* * $Id: MakeBackupMule2050TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.issues; public class MakeBackupMule2050TestCase extends AbstractBaseBackupMule2050TestCase { public MakeBackupMule2050TestCase() { super(50020, true); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/NoBackupMule2050TestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/NoBackupMule2050TestCase.j0000644000175000017500000000120110745677442033141 0ustar charlescharles/* * $Id: NoBackupMule2050TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.issues; public class NoBackupMule2050TestCase extends AbstractBaseBackupMule2050TestCase { public NoBackupMule2050TestCase() { super(50021, false); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/ExceptionHandlingMule2167TestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/ExceptionHandlingMule2167T0000644000175000017500000000247710754375733033331 0ustar charlescharles/* * $Id: ExceptionHandlingMule2167TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class ExceptionHandlingMule2167TestCase extends FunctionalTestCase { public static final String MESSAGE = "a message"; public static final long WAIT_MS = 3000L; protected String getConfigResources() { return "exception-handling-mule-2167-test.xml"; } public void testDefaultConfig() throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://in-default?connector=defaultVm", MESSAGE, null); MuleMessage message = client.request("vm://out-default?connector=queue", WAIT_MS); assertNotNull("null message", message); assertNotNull("null payload", message.getPayload()); assertEquals(MESSAGE, message.getPayloadAsString()); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/Pop3WithConnectorMule2042TestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/Pop3WithConnectorMule2042T0000644000175000017500000000156110745677442033241 0ustar charlescharles/* * $Id: Pop3WithConnectorMule2042TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.issues; import org.mule.transport.email.functional.AbstractEmailFunctionalTestCase; public class Pop3WithConnectorMule2042TestCase extends AbstractEmailFunctionalTestCase { public Pop3WithConnectorMule2042TestCase() { super(65435, STRING_MESSAGE, "pop3", "pop3-with-connector-mule-2042-test.xml"); } public void testRequest() throws Exception { doRequest(); } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/Pop3MimeWithConnectorMule2042TestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/Pop3MimeWithConnectorMule20000644000175000017500000000160010745677442033471 0ustar charlescharles/* * $Id: Pop3MimeWithConnectorMule2042TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.issues; import org.mule.transport.email.functional.AbstractEmailFunctionalTestCase; public class Pop3MimeWithConnectorMule2042TestCase extends AbstractEmailFunctionalTestCase { public Pop3MimeWithConnectorMule2042TestCase() { super(65445, MIME_MESSAGE, "pop3", "pop3-mime-with-connector-mule-2042-test.xml"); } public void testRequest() throws Exception { doRequest(); } }././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/AbstractBaseBackupMule2050TestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/issues/AbstractBaseBackupMule20500000644000175000017500000000353110761151311033223 0ustar charlescharles/* * $Id: AbstractBaseBackupMule2050TestCase.java 11058 2008-02-27 03:02:33Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.issues; import org.mule.api.transport.Connector; import org.mule.transport.email.AbstractRetrieveMailConnector; import org.mule.transport.email.connectors.ImapConnectorTestCase; import org.mule.util.FileUtils; import java.io.File; public abstract class AbstractBaseBackupMule2050TestCase extends ImapConnectorTestCase { private boolean backupEnabled; public AbstractBaseBackupMule2050TestCase(int port, boolean backupEnabled) { super(port); this.backupEnabled = backupEnabled; } // @Override public Connector createConnector() throws Exception { Connector connector = super.createConnector(); ((AbstractRetrieveMailConnector) connector).setBackupEnabled(backupEnabled); return connector; } public void testReceiver() throws Exception { File dir = FileUtils.newFile(muleContext.getConfiguration().getWorkingDirectory() + "/mail/INBOX"); FileUtils.deleteTree(new File(muleContext.getConfiguration().getWorkingDirectory() + "/mail")); assertFalse("Mail backup file already exists: " + dir.getAbsolutePath(), dir.exists()); debug(dir); super.testReceiver(); debug(dir); assertTrue(dir.getAbsolutePath(), dir.exists() == backupEnabled); } protected void debug(File dir) { logger.debug(dir.getAbsolutePath() + " exists? " + dir.exists()); } }mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/0000755000175000017500000000000011351410646027314 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/ImapMimeFunctionalTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/ImapMimeFunctionalTest0000644000175000017500000000141010745677442033633 0ustar charlescharles/* * $Id: ImapMimeFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.functional; public class ImapMimeFunctionalTestCase extends AbstractEmailFunctionalTestCase { public ImapMimeFunctionalTestCase() { super(65443, MIME_MESSAGE, "imap", "imap-mime-functional-test.xml"); } public void testRequest() throws Exception { doRequest(); } }././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/Pop3FunctionalTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/Pop3FunctionalTestCase0000644000175000017500000000133610745677442033561 0ustar charlescharles/* * $Id: Pop3FunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.functional; public class Pop3FunctionalTestCase extends AbstractEmailFunctionalTestCase { public Pop3FunctionalTestCase() { super(65435, STRING_MESSAGE, "pop3"); } public void testRequest() throws Exception { doRequest(); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/ImapFunctionalTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/ImapFunctionalTestCase0000644000175000017500000000133510745677442033625 0ustar charlescharles/* * $Id: ImapFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.functional; public class ImapFunctionalTestCase extends AbstractEmailFunctionalTestCase { public ImapFunctionalTestCase() { super(65433, STRING_MESSAGE, "imap"); } public void testRequest() throws Exception { doRequest(); } }././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/SmtpMimeFunctionalTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/SmtpMimeFunctionalTest0000644000175000017500000000140210745677442033671 0ustar charlescharles/* * $Id: SmtpMimeFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.functional; public class SmtpMimeFunctionalTestCase extends AbstractEmailFunctionalTestCase { public SmtpMimeFunctionalTestCase() { super(65438, MIME_MESSAGE, "smtp", "smtp-mime-functional-test.xml"); } public void testSend() throws Exception { doSend(); } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/Pop3sFunctionalTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/Pop3sFunctionalTestCas0000644000175000017500000000134110745677442033573 0ustar charlescharles/* * $Id: Pop3sFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.functional; public class Pop3sFunctionalTestCase extends AbstractEmailFunctionalTestCase { public Pop3sFunctionalTestCase() { super(65436, STRING_MESSAGE, "pop3s"); } public void testRequest() throws Exception { doRequest(); } }././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/Pop3MimeFunctionalTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/Pop3MimeFunctionalTest0000644000175000017500000000141010745677442033566 0ustar charlescharles/* * $Id: Pop3MimeFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.functional; public class Pop3MimeFunctionalTestCase extends AbstractEmailFunctionalTestCase { public Pop3MimeFunctionalTestCase() { super(65445, MIME_MESSAGE, "pop3", "pop3-mime-functional-test.xml"); } public void testRequest() throws Exception { doRequest(); } }././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/SmtpFunctionalTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/SmtpFunctionalTestCase0000644000175000017500000000132710745677442033663 0ustar charlescharles/* * $Id: SmtpFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.functional; public class SmtpFunctionalTestCase extends AbstractEmailFunctionalTestCase { public SmtpFunctionalTestCase() { super(65437, STRING_MESSAGE, "smtp"); } public void testSend() throws Exception { doSend(); } }././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/AbstractEmailFunctionalTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/AbstractEmailFunctiona0000644000175000017500000001331110772340531033621 0ustar charlescharles/* * $Id: AbstractEmailFunctionalTestCase.java 11511 2008-03-26 03:22:01Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.functional; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.email.GreenMailUtilities; import org.mule.transport.email.ImapConnector; import org.mule.transport.email.Pop3Connector; import com.icegreen.greenmail.util.GreenMail; import com.icegreen.greenmail.util.ServerSetup; import java.io.IOException; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; public abstract class AbstractEmailFunctionalTestCase extends FunctionalTestCase { protected static final String CONFIG_BASE = "-functional-test.xml"; protected static final long DELIVERY_DELAY_MS = 1000L; protected static final boolean MIME_MESSAGE = true; protected static final boolean STRING_MESSAGE = false; protected static final String DEFAULT_EMAIL = "bob@example.com"; protected static final String DEFAULT_USER = "bob"; protected static final String DEFAULT_MESSAGE = "Test email message"; protected static final String DEFAULT_PASSWORD = "password"; private String protocol; private boolean isMimeMessage; private int port; private String configFile; private GreenMail server; private String email; private String user; private String message; private String password; protected AbstractEmailFunctionalTestCase(int port, boolean isMimeMessage, String protocol) { this(port, isMimeMessage, protocol, protocol + CONFIG_BASE); } protected AbstractEmailFunctionalTestCase(int port, boolean isMimeMessage, String protocol, String configFile) { this(port, isMimeMessage, protocol, configFile, DEFAULT_EMAIL, DEFAULT_USER, DEFAULT_MESSAGE, DEFAULT_PASSWORD); } protected AbstractEmailFunctionalTestCase(int port, boolean isMimeMessage, String protocol, String configFile, String email, String user, String message, String password) { this.isMimeMessage = isMimeMessage; this.protocol = protocol; this.port = port; this.configFile = configFile; this.email = email; this.user = user; this.message = message; this.password = password; } protected String getConfigResources() { return configFile; } // @Override protected void suitePreSetUp() throws Exception { startServer(); } // @Override protected void suitePostTearDown() throws Exception { stopServer(); } protected void doSend() throws Exception { Object msg; if (isMimeMessage) { msg = GreenMailUtilities.toMessage(message, email); } else { msg = message; } MuleClient client = new MuleClient(); client.send("vm://send", msg, null); server.waitForIncomingEmail(DELIVERY_DELAY_MS, 1); MimeMessage[] messages = server.getReceivedMessages(); assertNotNull("did not receive any messages", messages); assertEquals("did not receive 1 mail", 1, messages.length); verifyMessage(messages[0]); } protected void verifyMessage(MimeMessage received) throws IOException, MessagingException { assertTrue("Did not receive a message with String contents", received.getContent() instanceof String); verifyMessage((String) received.getContent()); assertNotNull(received.getRecipients(Message.RecipientType.TO)); assertEquals(1, received.getRecipients(Message.RecipientType.TO).length); assertEquals(received.getRecipients(Message.RecipientType.TO)[0].toString(), email); } protected void verifyMessage(String receivedText) { // for some reason, something is adding a newline at the end of messages // so we need to strip that out for comparison assertEquals(message, receivedText.trim()); } protected void doRequest() throws Exception { assertEquals(1, server.getReceivedMessages().length); MuleClient client = new MuleClient(); MuleMessage message = client.request("vm://receive", 5000); assertNotNull(message); Object payload = message.getPayload(); if (isMimeMessage) { assertTrue(payload instanceof MimeMessage); verifyMessage((MimeMessage) payload); } else { assertTrue(payload instanceof String); verifyMessage((String) payload); } } private void startServer() throws Exception { logger.debug("starting server on port " + port); ServerSetup setup = new ServerSetup(port, null, protocol); server = new GreenMail(setup); server.start(); if (protocol.startsWith(Pop3Connector.POP3) || protocol.startsWith(ImapConnector.IMAP)) { GreenMailUtilities.storeEmail(server.getManagers().getUserManager(), email, user, password, GreenMailUtilities.toMessage(message, email)); } logger.debug("server started for protocol " + protocol); } private void stopServer() { server.stop(); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/SmtpsFunctionalTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/SmtpsFunctionalTestCas0000644000175000017500000000133310745677442033676 0ustar charlescharles/* * $Id: SmtpsFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.functional; public class SmtpsFunctionalTestCase extends AbstractEmailFunctionalTestCase { public SmtpsFunctionalTestCase() { super(65439, STRING_MESSAGE, "smtps"); } public void testSend() throws Exception { doSend(); } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/ImapsFunctionalTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/functional/ImapsFunctionalTestCas0000644000175000017500000000134110745677442033640 0ustar charlescharles/* * $Id: ImapsFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.functional; public class ImapsFunctionalTestCase extends AbstractEmailFunctionalTestCase { public ImapsFunctionalTestCase() { super(65444, STRING_MESSAGE, "imaps"); } public void testRequest() throws Exception { doRequest(); } }mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/0000755000175000017500000000000011351410647027330 5ustar charlescharles././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/ImapsConnectorTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/ImapsConnectorTestCase0000644000175000017500000000241710745677442033655 0ustar charlescharles/* * $Id: ImapsConnectorTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.connectors; import org.mule.api.transport.Connector; import org.mule.transport.email.ImapsConnector; import com.icegreen.greenmail.util.ServerSetup; /** * Simple tests for pulling from an IMAP server. */ public class ImapsConnectorTestCase extends AbstractReceivingMailConnectorTestCase { public ImapsConnectorTestCase() { super(ServerSetup.PROTOCOL_IMAPS, 50011); } public Connector createConnector() throws Exception { ImapsConnector connector = new ImapsConnector(); connector.setName("ImapsConnector"); connector.setCheckFrequency(POLL_PERIOD_MS); connector.setServiceOverrides(newEmailToStringServiceOverrides()); connector.setTrustStorePassword("password"); connector.setTrustStore("greenmail-truststore"); return connector; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/AbstractMailConnectorFunctionalTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/AbstractMailConnectorF0000644000175000017500000001110010772340531033573 0ustar charlescharles/* * $Id: AbstractMailConnectorFunctionalTestCase.java 11511 2008-03-26 03:22:01Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.connectors; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.email.GreenMailUtilities; import com.icegreen.greenmail.util.GreenMail; import com.icegreen.greenmail.util.ServerSetup; import javax.mail.Message; import javax.mail.internet.MimeMessage; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; /** * Start a (greenmail) mail server with a known message, for use in subclasses. */ public abstract class AbstractMailConnectorFunctionalTestCase extends AbstractConnectorTestCase { public static final String LOCALHOST = "127.0.0.1"; public static final String USER = "bob"; public static final String PROVIDER = "example.com"; public static final String EMAIL = USER + "@" + PROVIDER; public static final String PASSWORD = "secret"; public static final String MESSAGE = "Test Email Message"; public static final int START_ATTEMPTS = 3; public static final int TEST_ATTEMPTS = 5; public static final long STARTUP_PERIOD_MS = 1000; // for constructor public static final boolean SEND_INITIAL_EMAIL = true; public static final boolean NO_INITIAL_EMAIL = false; private static final AtomicInteger nameCount = new AtomicInteger(0); private MimeMessage message; private GreenMail servers; private boolean initialEmail = false; private String protocol; private int port; protected AbstractMailConnectorFunctionalTestCase(boolean initialEmail, String protocol, int port) { super(); this.initialEmail = initialEmail; this.protocol = protocol; this.port = port; } // @Override protected void doSetUp() throws Exception { super.doSetUp(); startServers(); } // @Override protected void doTearDown() throws Exception { stopServers(); super.doTearDown(); } private void storeEmail() throws Exception { GreenMailUtilities.storeEmail(servers.getManagers().getUserManager(), EMAIL, USER, PASSWORD, (MimeMessage) getValidMessage()); assertEquals(1, servers.getReceivedMessages().length); } private void startServers() throws Exception { servers = new GreenMail(getSetups()); GreenMailUtilities.robustStartup(servers, LOCALHOST, port, START_ATTEMPTS, TEST_ATTEMPTS, STARTUP_PERIOD_MS); if (initialEmail) { storeEmail(); } } private ServerSetup[] getSetups() { return new ServerSetup[]{new ServerSetup(port, null, protocol)}; } private void stopServers() throws Exception { if (null != servers) { servers.stop(); } } protected GreenMail getServers() { return servers; } // @Override public Object getValidMessage() throws Exception { if (null == message) { message = GreenMailUtilities.toMessage(MESSAGE, EMAIL); } return message; } public String getTestEndpointURI() { return protocol + "://" + USER + ":" + PASSWORD + "@" + LOCALHOST + ":" + port + "?connector=" + connectorName; } protected void assertMessageOk(Object message) throws Exception { assertTrue("Did not receive a MimeMessage", message instanceof MimeMessage); MimeMessage received = (MimeMessage) message; // for some reason, something is adding a newline at the end of messages // so we need to strip that out for comparison assertTrue("Did not receive a message with String contents", received.getContent() instanceof String); String receivedText = ((String) received.getContent()).trim(); assertEquals(MESSAGE, receivedText); assertNotNull(received.getRecipients(Message.RecipientType.TO)); assertEquals(1, received.getRecipients(Message.RecipientType.TO).length); assertEquals(received.getRecipients(Message.RecipientType.TO)[0].toString(), EMAIL); } protected String uniqueName(String root) { return root + nameCount.incrementAndGet(); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/Pop3sConnectorTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/Pop3sConnectorTestCase0000644000175000017500000000247610745677442033615 0ustar charlescharles/* * $Id: Pop3sConnectorTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.connectors; import org.mule.api.transport.Connector; import org.mule.transport.email.Pop3sConnector; import com.icegreen.greenmail.util.ServerSetup; /** * Simple tests for pulling from an IMAP server. */ public class Pop3sConnectorTestCase extends AbstractReceivingMailConnectorTestCase { public Pop3sConnectorTestCase() { super(ServerSetup.PROTOCOL_POP3S, 50009); } public Connector createConnector() throws Exception { Pop3sConnector connector = new Pop3sConnector(); connector.setName("Pop3sConnector"); connector.setCheckFrequency(POLL_PERIOD_MS); connector.setServiceOverrides(newEmailToStringServiceOverrides()); connector.setTrustStorePassword("password"); connector.setTrustStore("greenmail-truststore"); connector.setMuleContext(muleContext); return connector; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/SmtpsConnectorTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/SmtpsConnectorTestCase0000644000175000017500000000212610745677442033707 0ustar charlescharles/* * $Id: SmtpsConnectorTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.connectors; import org.mule.api.transport.Connector; import org.mule.transport.email.SmtpsConnector; import com.icegreen.greenmail.util.ServerSetup; public class SmtpsConnectorTestCase extends SmtpConnectorTestCase { public SmtpsConnectorTestCase() { super(ServerSetup.PROTOCOL_SMTPS, 50008); } // @Override public Connector createConnector() throws Exception { SmtpsConnector connector = new SmtpsConnector(); connector.setName("SmtpsConnector"); connector.setTrustStorePassword("password"); connector.setTrustStore("greenmail-truststore"); return connector; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/Pop3ConnectorTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/Pop3ConnectorTestCase.0000644000175000017500000000223010745677442033474 0ustar charlescharles/* * $Id: Pop3ConnectorTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.connectors; import org.mule.api.transport.Connector; import org.mule.transport.email.Pop3Connector; import com.icegreen.greenmail.util.ServerSetup; /** * Simple tests for pulling from a POP3 server. */ public class Pop3ConnectorTestCase extends AbstractReceivingMailConnectorTestCase { public Pop3ConnectorTestCase() { super(ServerSetup.PROTOCOL_POP3, 50010); } public Connector createConnector() throws Exception { Pop3Connector connector = new Pop3Connector(); connector.setName("Pop3Connector"); connector.setCheckFrequency(POLL_PERIOD_MS); connector.setServiceOverrides(newEmailToStringServiceOverrides()); return connector; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/SmtpConnectorTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/SmtpConnectorTestCase.0000644000175000017500000001145710766204322033573 0ustar charlescharles/* * $Id: SmtpConnectorTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.connectors; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.ResponseOutputStream; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.routing.outbound.OutboundPassThroughRouter; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.tck.testmodels.fruit.Apple; import org.mule.transport.email.MailProperties; import org.mule.transport.email.SmtpConnector; import com.icegreen.greenmail.util.ServerSetup; import javax.mail.internet.MimeMessage; /** * Send a message via SMTP to a (greenmail) server. */ public class SmtpConnectorTestCase extends AbstractMailConnectorFunctionalTestCase { public static final long DELIVERY_DELAY_MS = 5000; public SmtpConnectorTestCase() { this(ServerSetup.PROTOCOL_SMTP, 50007); } public SmtpConnectorTestCase(String protocol, int port) { super(NO_INITIAL_EMAIL, protocol, port); } public Connector createConnector() throws Exception { SmtpConnector c = new SmtpConnector(); c.setName("SmtpConnector"); return c; } /** * The SmtpConnector does not accept listeners, so the test in the * superclass makes no sense here. Instead, we simply check that * a listener is rejected. */ // @Override public void testConnectorListenerSupport() throws Exception { Connector connector = getConnector(); assertNotNull(connector); Service service = getTestService("anApple", Apple.class); //muleContext.getRegistry().registerComponent(service); EndpointBuilder builder = new EndpointURIEndpointBuilder(getTestEndpointURI(), muleContext); builder.setName("test"); InboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( builder); try { connector.registerListener(service, endpoint); fail("SMTP connector does not accept listeners"); } catch (Exception e) { assertNotNull("expected", e); } } public void testSend() throws Exception { //muleContext.getRegistry().registerConnector(createConnector(false)); OutboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( getTestEndpointURI()); Service service = getTestService(uniqueName("testComponent"), FunctionalTestComponent.class); // TODO Simplify this API for adding an outbound endpoint. ((OutboundPassThroughRouter) service.getOutboundRouter().getRouters().get(0)).addEndpoint(endpoint); //muleContext.getRegistry().registerComponent(service); MuleMessage message = new DefaultMuleMessage(MESSAGE); message.setStringProperty(MailProperties.TO_ADDRESSES_PROPERTY, EMAIL); MuleSession session = getTestSession(getTestService("apple", Apple.class), muleContext); DefaultMuleEvent event = new DefaultMuleEvent(message, endpoint, session, true, new ResponseOutputStream(System.out)); endpoint.dispatch(event); getServers().waitForIncomingEmail(DELIVERY_DELAY_MS, 1); MimeMessage[] messages = getServers().getReceivedMessages(); assertNotNull("did not receive any messages", messages); assertEquals("did not receive 1 mail", 1, messages.length); assertMessageOk(messages[0]); } // MULE-2130 (Impossible to re-initialise SMTP connector) public void testConnectorReinitialise() throws Exception { Connector c = getConnector(); c.start(); assertTrue(c.isStarted()); c.stop(); assertFalse(c.isStarted()); // are these supposed to work? // - initialise() without dispose() // - initialise() after dispose() // c.dispose(); // assertFalse(c.isStarted()); // assertTrue(c.isDisposed()); // // c.initialise(); // assertFalse(c.isDisposed()); // assertFalse(c.isStarted()); c.start(); assertFalse(c.isDisposed()); assertTrue(c.isStarted()); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/AbstractReceivingMailConnectorTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/AbstractReceivingMailC0000644000175000017500000000731410757615756033606 0ustar charlescharles/* * $Id: AbstractReceivingMailConnectorTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.connectors; import org.mule.api.MuleEventContext; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.service.Service; import org.mule.routing.inbound.DefaultInboundRouterCollection; import org.mule.tck.MuleTestUtils; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.transport.email.transformers.EmailMessageToString; import java.util.HashMap; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; /** * Given an endpoint ({@link #getTestEndpointURI()}) this waits for up to 10 seconds, * hoping to receive the message stored in the mail server. It also runs the unit tests * defined way down in {@link org.mule.transport.AbstractConnectorTestCase}. */ public abstract class AbstractReceivingMailConnectorTestCase extends AbstractMailConnectorFunctionalTestCase { public static final int POLL_PERIOD_MS = 2000; public static final int WAIT_PERIOD_MS = 4 * POLL_PERIOD_MS; protected AbstractReceivingMailConnectorTestCase(String protocol, int port) { super(SEND_INITIAL_EMAIL, protocol, port); } public void testReceiver() throws Exception { final CountDownLatch countDown = new CountDownLatch(1); HashMap props = new HashMap(); props.put("eventCallback", new EventCallback() { public synchronized void eventReceived(MuleEventContext context, Object component) { try { logger.debug("woot - event received"); logger.debug("context: " + context); logger.debug("component: " + component); assertMessageOk(context.getMessage().getOrginalPayload()); countDown.countDown(); } catch (Exception e) { // counter will not be incremented logger.error(e.getMessage(), e); } } }); Service service = MuleTestUtils.getTestService(uniqueName("testComponent"), FunctionalTestComponent.class, props, muleContext, /*initialize*/false); InboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory() .getInboundEndpoint(getTestEndpointURI()); InboundRouterCollection inboundRouter = new DefaultInboundRouterCollection(); inboundRouter.addEndpoint(ep); service.setInboundRouter(inboundRouter); muleContext.getRegistry().registerService(service); //muleContext.applyLifecycle(service); if (!muleContext.isStarted()) { muleContext.start(); } logger.debug("waiting for count down"); assertTrue(countDown.await(WAIT_PERIOD_MS, TimeUnit.MILLISECONDS)); } protected static Map newEmailToStringServiceOverrides() { Map serviceOverrides = new HashMap(); serviceOverrides.put(MuleProperties.CONNECTOR_INBOUND_TRANSFORMER, EmailMessageToString.class.getName()); return serviceOverrides; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/ImapConnectorTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/connectors/ImapConnectorTestCase.0000644000175000017500000000236610745677442033553 0ustar charlescharles/* * $Id: ImapConnectorTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.connectors; import org.mule.api.transport.Connector; import org.mule.transport.email.ImapConnector; import com.icegreen.greenmail.util.ServerSetup; /** * Simple tests for pulling from an IMAP server. */ public class ImapConnectorTestCase extends AbstractReceivingMailConnectorTestCase { public ImapConnectorTestCase() { this(50012); } public ImapConnectorTestCase(int port) { super(ServerSetup.PROTOCOL_IMAP, port); } // @Override public Connector createConnector() throws Exception { ImapConnector connector = new ImapConnector(); connector.setName("ImapConnector"); connector.setCheckFrequency(POLL_PERIOD_MS); connector.setServiceOverrides(newEmailToStringServiceOverrides()); return connector; } } mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/AbstractGreenMailSupport.java0000644000175000017500000001066610772340531032753 0ustar charlescharles/* * $Id: AbstractGreenMailSupport.java 11511 2008-03-26 03:22:01Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import com.icegreen.greenmail.user.GreenMailUser; import com.icegreen.greenmail.user.UserManager; import com.icegreen.greenmail.util.GreenMail; import com.icegreen.greenmail.util.ServerSetup; import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public abstract class AbstractGreenMailSupport { public static final String LOCALHOST = "127.0.0.1"; public static final String MESSAGE = "Test Email Message"; public static final String AT_EXAMPLE_COM = "@example.com"; public static final String BOB = "bob"; public static final String BOB_EMAIL = BOB + AT_EXAMPLE_COM; public static final String ALICE = "alice"; public static final String ALICE_EMAIL = ALICE + AT_EXAMPLE_COM; public static final String PASSWORD = "secret"; public static final long STARTUP_PERIOD_MS = 100; protected final Log logger = LogFactory.getLog(this.getClass()); private GreenMail servers; protected void createUserAndStoreEmail(String email, String user, String password, Object message) throws Exception { // note that with greenmail 1.1 the Servers object is unreliable // and the approach taken in their examples will not work. // the following does work, but may break in a later version // (there is some confusion in the greenmail code about // whether users are identified by email or name alone) // in which case try retrieving by EMAIL rather than USER logger.debug("Creating mail user " + user + "/" + email + "/" + password); UserManager userManager = servers.getManagers().getUserManager(); userManager.createUser(email, user, password); GreenMailUser target = userManager.getUser(user); if (null == target) { throw new IllegalStateException("Failure in greenmail - see comments in test code."); } target.deliver((MimeMessage) message); Thread.sleep(STARTUP_PERIOD_MS); } protected void createBobAndStoreEmail(Object message) throws Exception { createUserAndStoreEmail(BOB_EMAIL, BOB, PASSWORD, message); } protected void createAliceAndStoreEmail(Object message) throws Exception { createUserAndStoreEmail(ALICE_EMAIL, ALICE, PASSWORD, message); } protected void startServers() throws Exception { logger.info("Starting mail servers"); servers = new GreenMail(getSetups()); servers.start(); Thread.sleep(STARTUP_PERIOD_MS); } protected abstract int nextPort(); private ServerSetup[] getSetups() { return new ServerSetup[]{ newServerSetup(nextPort(), ServerSetup.PROTOCOL_SMTP), newServerSetup(nextPort(), ServerSetup.PROTOCOL_SMTPS), newServerSetup(nextPort(), ServerSetup.PROTOCOL_POP3), newServerSetup(nextPort(), ServerSetup.PROTOCOL_POP3S), newServerSetup(nextPort(), ServerSetup.PROTOCOL_IMAP), newServerSetup(nextPort(), ServerSetup.PROTOCOL_IMAPS) }; } private ServerSetup newServerSetup(int port, String protocol) { logger.debug("Server for " + protocol + " will be on port " + port); return new ServerSetup(port, null, protocol); } protected void stopServers() throws Exception { logger.info("Stopping mail servers"); if (null != servers) { servers.stop(); } } protected GreenMail getServers() { return servers; } public MimeMessage getValidMessage(String to) throws Exception { MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties())); message.setContent(MESSAGE, "text/plain"); message.setRecipient(Message.RecipientType.TO, new InternetAddress(to)); return message; } } mule-2.0.1/transports/email/src/test/java/org/mule/transport/email/adapters/0000755000175000017500000000000011351410646026755 5ustar charlescharles././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/adapters/SimpleMailMessageAdapterTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/adapters/SimpleMailMessageAdapter0000644000175000017500000000410410745677442033560 0ustar charlescharles/* * $Id: SimpleMailMessageAdapterTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.adapters; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.email.SimpleMailMessageAdapter; import java.util.List; import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail.internet.MimeMessage; public class SimpleMailMessageAdapterTestCase extends AbstractMuleTestCase { private static final String NAME_1 = "name1"; private static final String NAME_2 = "name2"; private static final String VALUE_1 = "value1"; private static final String VALUE_2 = "value2"; public void testHeaders() throws Exception { Message message = new MimeMessage(Session.getDefaultInstance(new Properties())); message.addHeader(NAME_1, VALUE_1); message.addHeader(NAME_1, VALUE_2); message.addHeader(NAME_2, VALUE_2); SimpleMailMessageAdapter adapter = new SimpleMailMessageAdapter(message); assertEquals(adapter.getProperty(NAME_1), VALUE_1); assertTrue(adapter.getProperty(SimpleMailMessageAdapter.toListHeader(NAME_1)) instanceof List); List list1 = (List) adapter.getProperty(SimpleMailMessageAdapter.toListHeader(NAME_1)); assertTrue(list1.contains(VALUE_1)); assertTrue(list1.contains(VALUE_2)); assertEquals(2, list1.size()); assertEquals(adapter.getProperty(NAME_2), VALUE_2); assertTrue(adapter.getProperty(SimpleMailMessageAdapter.toListHeader(NAME_2)) instanceof List); List list2 = (List) adapter.getProperty(SimpleMailMessageAdapter.toListHeader(NAME_2)); assertTrue(list2.contains(VALUE_2)); assertEquals(1, list2.size()); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/adapters/MailMessageAdapterTestCase.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/adapters/MailMessageAdapterTestCa0000644000175000017500000000361010754365306033504 0ustar charlescharles/* * $Id: MailMessageAdapterTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email.adapters; import org.mule.api.MessagingException; import org.mule.api.registry.ServiceDescriptorFactory; import org.mule.api.transport.MessageAdapter; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.transport.email.MailMessageAdapter; import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail.internet.MimeMessage; public class MailMessageAdapterTestCase extends AbstractMessageAdapterTestCase { private Message message; protected void doSetUp() throws Exception { //wee need to load the transport descriptor in order to tes tthe message Adapter muleContext.getRegistry().lookupServiceDescriptor(ServiceDescriptorFactory.PROVIDER_SERVICE_TYPE, "pop3", null); } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#createAdapter() */ public MessageAdapter createAdapter(Object payload) throws MessagingException { return new MailMessageAdapter(payload); } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#getValidMessage() */ public Object getValidMessage() throws Exception { if (message == null) { message = new MimeMessage(Session.getDefaultInstance(new Properties())); message.setContent("Test Email Message", "text/plain"); } return message; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/email/src/test/java/org/mule/transport/email/GreenMailCertificateExtractor.javamule-2.0.1/transports/email/src/test/java/org/mule/transport/email/GreenMailCertificateExtractor.jav0000644000175000017500000002133410745677442033600 0ustar charlescharles/* * $Id: GreenMailCertificateExtractor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.email; import org.mule.util.FileUtils; import com.icegreen.greenmail.util.DummyTrustManager; import java.io.ByteArrayInputStream; import java.io.FileOutputStream; import java.security.KeyStore; import java.security.cert.Certificate; import java.security.cert.X509Certificate; import java.util.Enumeration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A one-shot utility used to extract the ceritificate used by greenmail. * See greenmail-truststore in resources. * This program does not need to be run for tests. It is left as documentation. */ public class GreenMailCertificateExtractor { private static final Log logger = LogFactory.getLog(GreenMailCertificateExtractor.class); // cut + paste from greenmail source for DummySSLServerSocketFactory private static byte[] hardCodedKeystore = new byte[]{-2, -19, -2, -19, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8, 105, 99, 101, 103, 114, 101, 101, 110, 0, 0, 1, 9, 77, 96, -11, -114, 0, 0, 2, -71, 48, -126, 2, -75, 48, 14, 6, 10, 43, 6, 1, 4, 1, 42, 2, 17, 1, 1, 5, 0, 4, -126, 2, -95, -32, -63, -7, 87, -14, 62, 94, 25, -18, 67, -101, -103, -88, -31, 72, -121, -6, 97, 44, 33, -48, 24, -98, -19, -101, 117, 7, -116, -117, 70, -116, -51, 83, -124, 37, -24, -67, 75, -98, 115, 52, -45, -88, 49, 82, 22, -48, -110, -45, -78, 61, 14, 63, 77, -92, -65, -108, 72, -42, -92, -44, 81, -43, 112, 73, 75, -25, 13, 46, 14, 19, 16, 33, 91, -122, 4, 112, -79, -23, 60, 39, 54, -6, 34, -44, -115, 55, 57, -28, 127, -62, -66, 19, -87, 60, 23, -22, 44, -91, 54, 118, -58, 18, 83, 12, -43, -39, 113, 44, -36, 95, -54, 69, 18, 115, 6, 28, 75, 120, 120, 30, 75, 92, 119, -84, 119, 26, 44, -52, 0, -3, -46, -85, 88, -117, -32, 30, -16, -102, 125, -75, -85, 56, -67, 26, -48, -72, 35, 83, 87, 100, -127, 10, 76, 43, 87, -71, -101, 14, 22, -97, 124, 93, 54, -32, -57, 18, 73, 60, 98, -61, 20, 37, 10, -74, -5, 2, 26, 60, -61, 69, 94, -72, -23, -25, -16, -114, 110, -2, 34, 54, 59, 103, 41, -127, 93, -82, -113, 118, -58, -32, 0, 15, 95, 95, 52, -102, -111, 35, -17, -101, 49, 123, 3, -30, 85, -82, -53, -30, -65, -91, 101, 68, 101, -110, -11, 73, -51, -23, 90, 40, 4, -11, -111, 93, 87, -9, -3, 48, 121, -96, -80, -121, -127, 109, 113, 104, -26, 68, 92, -18, -109, 42, -6, 53, -62, 54, 127, 100, -77, 43, -122, 6, 24, 106, -29, 109, -33, 101, 1, -87, 9, -50, 68, 54, -100, -128, 15, -49, 45, -57, -7, -16, 2, -24, 1, 85, -17, -16, -77, 39, 95, -14, 0, 83, 126, -42, 90, -75, 88, 56, 32, 38, 98, 67, 74, -9, 49, 0, 113, -95, 63, -68, -21, -97, -117, 21, -108, 112, -1, 11, -2, -69, -109, -55, -106, 35, -126, 34, 73, 18, 15, -39, -81, 114, 38, -34, 108, -120, -45, -108, 109, 83, -76, 61, -86, 52, 21, 51, 86, -74, 18, 89, -25, -101, -16, -26, 75, -45, -19, -54, -118, 51, 116, -104, 59, 43, -2, 6, -82, 107, -84, 72, -7, -67, 67, -36, -118, 93, -34, 101, -75, 61, -59, 77, -128, 87, -3, 13, 19, -109, 110, 115, 10, 117, -77, -71, 53, 37, -107, 29, 38, -97, 106, 123, 34, -48, 76, -57, 63, 71, 44, -111, 39, -81, 22, -93, -96, 97, -83, -100, -8, 72, -9, 99, -124, -125, 111, -90, 4, -91, 104, 108, -7, -4, 35, 60, 90, 72, -96, -76, 78, 40, 69, 121, -28, -107, -84, -13, -17, -12, 44, 50, -16, -16, 69, -111, 61, 3, 50, -65, -126, 3, -108, -110, 29, 38, -41, 16, -70, -11, -47, -31, -62, -99, 64, -95, 32, -10, 39, 12, 74, 110, -107, -60, 16, -12, -67, 43, -106, -29, 67, -20, 73, -117, -4, 11, -81, 67, -110, 6, -56, -60, -15, -51, -41, 121, -2, -125, 13, 15, 64, -66, -58, -99, -14, 118, -69, -20, -53, 9, 27, 15, 89, 62, -46, 34, 98, 103, 41, 10, 89, 19, -4, -87, 107, -75, -80, -65, -82, -114, 60, 49, -69, 57, -75, 24, 126, 120, -35, -78, 40, -107, -98, 122, 16, -1, 93, -60, 36, 99, -104, 27, -42, -53, -65, 36, 24, -87, -126, -46, -99, -94, -67, -78, -112, -42, 46, -8, -70, 103, -31, 107, -37, 94, 61, 78, 76, -7, 75, 92, -110, 104, -42, -7, -3, 51, -82, 34, 55, 29, 30, -118, 100, -34, 86, -6, 81, 65, 7, -30, 41, -42, -99, -103, 11, -37, 88, 104, 38, -12, -114, 86, 88, 16, 23, 46, 74, 14, -18, 72, -93, 80, -20, 36, 44, -67, -84, -86, -92, 37, -12, -35, 65, -121, -46, -1, -6, -126, 12, -40, -74, -59, 92, 74, 71, -14, 21, 105, -18, 4, -119, -128, 61, 61, -114, -24, -106, -63, -65, 89, -40, 99, 0, 0, 0, 1, 0, 5, 88, 46, 53, 48, 57, 0, 0, 2, 78, 48, -126, 2, 74, 48, -126, 1, -77, 2, 4, 67, -22, -39, 83, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 4, 5, 0, 48, 108, 49, 16, 48, 14, 6, 3, 85, 4, 6, 19, 7, 85, 110, 107, 110, 111, 119, 110, 49, 16, 48, 14, 6, 3, 85, 4, 8, 19, 7, 85, 110, 107, 110, 111, 119, 110, 49, 16, 48, 14, 6, 3, 85, 4, 7, 19, 7, 85, 110, 107, 110, 111, 119, 110, 49, 16, 48, 14, 6, 3, 85, 4, 10, 19, 7, 85, 110, 107, 110, 111, 119, 110, 49, 16, 48, 14, 6, 3, 85, 4, 11, 19, 7, 85, 110, 107, 110, 111, 119, 110, 49, 16, 48, 14, 6, 3, 85, 4, 3, 19, 7, 85, 110, 107, 110, 111, 119, 110, 48, 30, 23, 13, 48, 54, 48, 50, 48, 57, 48, 53, 53, 53, 51, 49, 90, 23, 13, 48, 54, 48, 53, 49, 48, 48, 53, 53, 53, 51, 49, 90, 48, 108, 49, 16, 48, 14, 6, 3, 85, 4, 6, 19, 7, 85, 110, 107, 110, 111, 119, 110, 49, 16, 48, 14, 6, 3, 85, 4, 8, 19, 7, 85, 110, 107, 110, 111, 119, 110, 49, 16, 48, 14, 6, 3, 85, 4, 7, 19, 7, 85, 110, 107, 110, 111, 119, 110, 49, 16, 48, 14, 6, 3, 85, 4, 10, 19, 7, 85, 110, 107, 110, 111, 119, 110, 49, 16, 48, 14, 6, 3, 85, 4, 11, 19, 7, 85, 110, 107, 110, 111, 119, 110, 49, 16, 48, 14, 6, 3, 85, 4, 3, 19, 7, 85, 110, 107, 110, 111, 119, 110, 48, -127, -97, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 1, 5, 0, 3, -127, -115, 0, 48, -127, -119, 2, -127, -127, 0, -81, 83, -88, -35, -61, -91, 16, 53, 107, -45, -117, -18, 22, -6, -119, -117, -85, -51, 65, -65, 0, -112, -10, -22, 110, -57, -13, -106, -85, -32, -110, 32, 107, 91, 57, 2, -51, -49, -113, 102, -109, -90, 87, -112, 11, 84, -10, 114, 60, -52, 33, 70, 58, 56, -106, 76, -44, 0, -32, 77, -45, -27, -120, -53, 8, 118, -108, 85, 74, 82, 60, 68, -57, 61, 52, -107, 16, 6, 44, 71, -60, -22, -14, -113, 105, -42, 76, 41, -11, 2, 98, 33, -45, 78, 124, 10, 6, 30, 82, 113, -105, -115, 29, 24, 89, -20, 37, 127, -102, -118, -74, -114, -105, 111, 43, 112, 124, 60, -67, 56, 106, -96, -11, -99, -5, 72, -52, -45, 2, 3, 1, 0, 1, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 4, 5, 0, 3, -127, -127, 0, 40, -92, -6, -125, 61, -112, -107, 48, 57, -120, -95, -34, -127, 58, -117, -117, 90, -64, -68, 33, 102, 112, 59, 81, -104, 6, 76, 91, -17, -119, -72, -40, -16, 27, 22, 68, -124, 109, -67, 35, 114, 105, -37, 71, -48, -24, -45, 23, -90, -90, 3, -38, 82, -116, -45, 57, -22, 56, 66, -40, 62, -117, -100, -4, -71, -112, 58, 48, -45, -120, -18, 39, 94, -123, 82, -125, 0, -97, 48, 117, -26, 76, -95, -104, 33, -14, -4, 39, 93, 50, 95, -104, -128, 65, -25, -11, 48, -90, -30, -7, 127, 25, -96, 94, -111, -89, 27, -21, -50, -119, 105, -22, 72, -95, 37, 70, 22, -87, 15, 17, -109, 29, -2, 50, 84, -22, -96, -121, 34, 26, -65, -56, -17, -127, 90, -10, 18, 124, 55, -54, 98, 88, -110, 94, -43, -117, 59, 98}; /** * @param args */ public static void main(String[] args) throws Exception { DummyTrustManager trustManager = new DummyTrustManager(); X509Certificate[] trustedCerts = trustManager.getAcceptedIssuers(); X509Certificate[] checkCerts = (new DummyTrustManager()).getAcceptedIssuers(); logger.info("Have " + trustedCerts.length + " certificates"); assert(trustedCerts.length == checkCerts.length); for (int i = 0; i < trustedCerts.length; ++i) { assert(trustedCerts[i].equals(checkCerts[i])); } // argh! it just says yes all the time (see DummyTrustManager source!) // cannot access certificates by a public interface... // so cut + paste KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); char[] pass = "changeit".toString().toCharArray(); ks.load(new ByteArrayInputStream(hardCodedKeystore), pass); Enumeration aliases = ks.aliases(); while (aliases.hasMoreElements()) { String alias = (String) aliases.nextElement(); logger.info(alias); // single alias, "icegreen" Certificate certificate = ks.getCertificate(alias); logger.info(certificate); assert(certificate instanceof X509Certificate); X509Certificate x509 = (X509Certificate) certificate; (new FileOutputStream(FileUtils.newFile("/tmp/greenmail-" + alias))).write(x509.getEncoded()); } } } mule-2.0.1/transports/email/src/test/resources/0000755000175000017500000000000011351410650021362 5ustar charlescharlesmule-2.0.1/transports/email/src/test/resources/pop3-mime-functional-test.xml0000644000175000017500000000303410774266536027053 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/log4j.properties0000644000175000017500000000060110745677442024540 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN log4j.logger.org.mule.transport.email.GreenMailUtilities=INFO mule-2.0.1/transports/email/src/test/resources/pop3-functional-test.xml0000644000175000017500000000255210774266536026132 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/pop3-with-connector-mule-2042-test.xml0000644000175000017500000000305010774266536030252 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/clientKeystore0000644000175000017500000000335610624163334024326 0ustar charlescharles muleclient 00 +*(+lAJv;ǸH H#Vpab^ko5t(vaH~3D9V&\b(hMRtF Y}0ɤ^qIT_ZTZ%0qe4kh#_skyXhغQrpcA *k`XgE  ۲i ⎝"&m- zi[I8_"#F>>'Lu@P`!D/4&) fbYFmpքzޭŏX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'. muleserver -X.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlOU_PT}Kmule-2.0.1/transports/email/src/test/resources/rfc822-byte-array-test.xml0000644000175000017500000000132510716331616026155 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/imap-functional-test.xml0000644000175000017500000000255210774266536026177 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/smtp-functional-test.xml0000644000175000017500000000244310745174725026227 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/pop3-mime-with-connector-mule-2042-test.xml0000644000175000017500000000314110774266536031200 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/smtps-functional-test.xml0000644000175000017500000000274610763766522026422 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/pop3s-functional-test.xml0000644000175000017500000000334410774266536026315 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/imap-mime-functional-test.xml0000644000175000017500000000310310774266536027115 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/smtp-namespace-config.xml0000644000175000017500000000462410763766522026314 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/pop3-namespace-config.xml0000644000175000017500000000356110763766522026211 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/greenmail-truststore0000644000175000017500000000121410577411741025515 0ustar charlescharlesmykeyG2)X.509N0J0CS0  *H 0l10UUnknown10UUnknown10UUnknown10U Unknown10U Unknown10UUnknown0 060209055531Z 060510055531Z0l10UUnknown10UUnknown10UUnknown10U Unknown10U Unknown10UUnknown00  *H 0Så5kӋAn k[9ϏfW Tr:0ӈ'^R0uL!']2_A0^ΉiH%F2Tꠇy:Zf.tRYmule-2.0.1/transports/email/src/test/resources/email-round-trip-test.xml0000644000175000017500000000467310745677442026307 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/imap-namespace-config.xml0000644000175000017500000000356110763766522026256 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/README.txt0000644000175000017500000000030710672263414023071 0ustar charlescharles The greenmail-truststore was built from a certificate that itself was generated from a copy of the hardcoded truststore used in the greenmail library. See the program GreenmailCertificateExtract. mule-2.0.1/transports/email/src/test/resources/imaps-functional-test.xml0000644000175000017500000000334310774266536026361 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006210705462617026246 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/transports/email/src/test/resources/exception-handling-mule-2167-test.xml0000644000175000017500000000332610745174725030222 0ustar charlescharles mule-2.0.1/transports/email/src/test/resources/smtp-mime-functional-test.xml0000644000175000017500000000273310745677442027162 0ustar charlescharles mule-2.0.1/transports/email/pom.xml0000644000175000017500000000602711006063605017125 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-email E-Mail Transport A Mule transport for Email Connectivity. This transport supplies a Pop3 connector, Smtp connector and a Mail connector which is an aggregation of the two. org.mule mule-core ${version} javax.mail mail provided com.icegreen greenmail 1.3 test org.slf4j slf4j-api javax.mail mail org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test org.mule.transports mule-transport-vm ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.transport.email.* mule-2.0.1/transports/file/0000755000175000017500000000000011351410636015436 5ustar charlescharlesmule-2.0.1/transports/file/src/0000755000175000017500000000000011351410635016224 5ustar charlescharlesmule-2.0.1/transports/file/src/main/0000755000175000017500000000000011351410635017150 5ustar charlescharlesmule-2.0.1/transports/file/src/main/java/0000755000175000017500000000000011351410635020071 5ustar charlescharlesmule-2.0.1/transports/file/src/main/java/org/0000755000175000017500000000000011351410635020660 5ustar charlescharlesmule-2.0.1/transports/file/src/main/java/org/mule/0000755000175000017500000000000011351410635021622 5ustar charlescharlesmule-2.0.1/transports/file/src/main/java/org/mule/transport/0000755000175000017500000000000011351410635023656 5ustar charlescharlesmule-2.0.1/transports/file/src/main/java/org/mule/transport/file/0000755000175000017500000000000011351410635024575 5ustar charlescharlesmule-2.0.1/transports/file/src/main/java/org/mule/transport/file/FileMessageDispatcherFactory.java0000644000175000017500000000201610757615756033206 0ustar charlescharles/* * $Id: FileMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * FileMessageDispatcherFactory creaes a dispatcher responsible for * writing files to disk */ public class FileMessageDispatcherFactory extends AbstractMessageDispatcherFactory { /** {@inheritDoc} */ public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new FileMessageDispatcher(endpoint); } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/FileMessageReceiver.java0000644000175000017500000003644110757615756031345 0ustar charlescharles/* * $Id: FileMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.DefaultMuleMessage; import org.mule.api.DefaultMuleException; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.routing.RoutingException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import org.mule.transport.AbstractPollingMessageReceiver; import org.mule.transport.ConnectException; import org.mule.transport.DefaultMessageAdapter; import org.mule.transport.file.i18n.FileMessages; import org.mule.util.FileUtils; import java.io.File; import java.io.FileFilter; import java.io.FileNotFoundException; import java.io.FilenameFilter; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; import java.util.Comparator; import edu.emory.mathcs.backport.java.util.Arrays; import org.apache.commons.collections.comparators.ReverseComparator; /** * FileMessageReceiver is a polling listener that reads files from a * directory. */ public class FileMessageReceiver extends AbstractPollingMessageReceiver { public static final String COMPARATOR_CLASS_NAME_PROPERTY = "comparator"; public static final String COMPARATOR_REVERSE_ORDER_PROPERTY = "reverseOrder"; private String readDir = null; private String moveDir = null; private File readDirectory = null; private File moveDirectory = null; private String moveToPattern = null; private FilenameFilter filenameFilter = null; private FileFilter fileFilter = null; public FileMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint, String readDir, String moveDir, String moveToPattern, long frequency) throws CreateException { super(connector, service, endpoint); this.setFrequency(frequency); this.readDir = readDir; this.moveDir = moveDir; this.moveToPattern = moveToPattern; if (endpoint.getFilter() instanceof FilenameFilter) { filenameFilter = (FilenameFilter) endpoint.getFilter(); } else if (endpoint.getFilter() instanceof FileFilter) { fileFilter = (FileFilter) endpoint.getFilter(); } else if (endpoint.getFilter() != null) { throw new CreateException(FileMessages.invalidFileFilter(endpoint.getEndpointURI()), this); } } protected void doConnect() throws Exception { if (readDir != null) { readDirectory = FileUtils.openDirectory(readDir); if (!(readDirectory.canRead())) { throw new ConnectException(FileMessages.fileDoesNotExist(readDirectory.getAbsolutePath()), this); } else { logger.debug("Listening on endpointUri: " + readDirectory.getAbsolutePath()); } } if (moveDir != null) { moveDirectory = FileUtils.openDirectory((moveDir)); if (!(moveDirectory.canRead()) || !moveDirectory.canWrite()) { throw new ConnectException(FileMessages.moveToDirectoryNotWritable(), this); } } } protected void doDisconnect() throws Exception { // template method } protected void doDispose() { // nothing to do } public void poll() { try { File[] files = this.listFiles(); if (logger.isDebugEnabled()) { logger.debug("Files: " + files); } Comparator comparator = getComparator(); if (comparator != null) { Arrays.sort(files, comparator); } for (int i = 0; i < files.length; i++) { // don't process directories if (files[i].isFile()) { this.processFile(files[i]); } } } catch (Exception e) { this.handleException(e); } } public synchronized void processFile(final File sourceFile) throws MuleException { //TODO RM*: This can be put in a Filter. Also we can add an AndFileFilter/OrFileFilter to allow users to //combine file filters (since we can only pass a single filter to File.listFiles, we would need to wrap //the current And/Or filters to extend {@link FilenameFilter} boolean checkFileAge = ((FileConnector) connector).getCheckFileAge(); if (checkFileAge) { long fileAge = ((FileConnector) connector).getFileAge(); long lastMod = sourceFile.lastModified(); long now = System.currentTimeMillis(); long thisFileAge = now - lastMod; if (thisFileAge < fileAge) { if (logger.isDebugEnabled()) { logger.debug("The file has not aged enough yet, will return nothing for: " + sourceFile); } return; } } // don't process a file that is locked by another process (probably still being written) if (!attemptFileLock(sourceFile)) { return; } FileConnector fc = ((FileConnector) connector); String sourceFileOriginalName = sourceFile.getName(); // Perform some quick checks to make sure file can be processed if (!(sourceFile.canRead() && sourceFile.exists() && sourceFile.isFile())) { throw new DefaultMuleException(FileMessages.fileDoesNotExist(sourceFileOriginalName)); } // This isn't nice but is needed as MessageAdaptor is required to resolve // destination file name, and StreamingReceiverFileInputStream is // required to create MessageAdaptor DefaultMessageAdapter fileParserMsgAdaptor = new DefaultMessageAdapter(null); fileParserMsgAdaptor.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, sourceFileOriginalName); // set up destination file File destinationFile = null; if (moveDir != null) { String destinationFileName = sourceFileOriginalName; if (moveToPattern != null) { destinationFileName = ((FileConnector) connector).getFilenameParser().getFilename(fileParserMsgAdaptor, moveToPattern); } // don't use new File() directly, see MULE-1112 destinationFile = FileUtils.newFile(moveDir, destinationFileName); } MessageAdapter msgAdapter = null; try { if (fc.isStreaming()) { msgAdapter = connector.getMessageAdapter(new ReceiverFileInputStream(sourceFile, fc.isAutoDelete(), destinationFile)); } else { msgAdapter = connector.getMessageAdapter(sourceFile); } } catch (FileNotFoundException e) { // we can ignore since we did manage to acquire a lock, but just in case logger.error("File being read disappeared!", e); return; } msgAdapter.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, sourceFileOriginalName); if (!fc.isStreaming()) { moveAndDelete(sourceFile, destinationFile, sourceFileOriginalName, msgAdapter); } else { // If we are streaming no need to move/delete now, that will be done when // stream is closed this.routeMessage(new DefaultMuleMessage(msgAdapter), endpoint.isSynchronous()); } } private void moveAndDelete(final File sourceFile, File destinationFile, String sourceFileOriginalName, MessageAdapter msgAdapter) { boolean fileWasMoved = false; try { // If we are moving the file to a read directory, move it there now and // hand over a reference to the // File in its moved location if (destinationFile != null) { // move sourceFile to new destination fileWasMoved = FileUtils.moveFile(sourceFile, destinationFile); // move didn't work - bail out (will attempt rollback) if (!fileWasMoved) { throw new DefaultMuleException(FileMessages.failedToMoveFile(sourceFile.getAbsolutePath(), destinationFile.getAbsolutePath())); } // create new MessageAdapter for destinationFile msgAdapter = connector.getMessageAdapter(destinationFile); msgAdapter.setProperty(FileConnector.PROPERTY_FILENAME, destinationFile.getName()); msgAdapter.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, sourceFileOriginalName); } // finally deliver the file message this.routeMessage(new DefaultMuleMessage(msgAdapter), endpoint.isSynchronous()); // at this point msgAdapter either points to the old sourceFile // or the new destinationFile. if (((FileConnector) connector).isAutoDelete()) { // no moveTo directory if (destinationFile == null) { // delete source if (!sourceFile.delete()) { throw new DefaultMuleException(FileMessages.failedToDeleteFile(sourceFile.getAbsolutePath())); } } else { // nothing to do here since moveFile() should have deleted // the source file for us } } } catch (Exception e) { boolean fileWasRolledBack = false; // only attempt rollback if file move was successful if (fileWasMoved) { fileWasRolledBack = rollbackFileMove(destinationFile, sourceFile.getAbsolutePath()); } // wrap exception & handle it Exception ex = new RoutingException(FileMessages.exceptionWhileProcessing(sourceFile.getName(), (fileWasRolledBack ? "successful" : "unsuccessful")), new DefaultMuleMessage(msgAdapter), endpoint, e); this.handleException(ex); } } /** * Try to acquire a lock on a file and release it immediately. Usually used as a * quick check to see if another process is still holding onto the file, e.g. a * large file (more than 100MB) is still being written to. * * @param sourceFile file to check * @return true if the file can be locked */ protected boolean attemptFileLock(final File sourceFile) { // check if the file can be processed, be sure that it's not still being // written // if the file can't be locked don't process it yet, since creating // a new FileInputStream() will throw an exception FileLock lock = null; FileChannel channel = null; boolean fileCanBeLocked = false; try { channel = new RandomAccessFile(sourceFile, "rw").getChannel(); // Try acquiring the lock without blocking. This method returns // null or throws an exception if the file is already locked. lock = channel.tryLock(); } catch (FileNotFoundException fnfe) { logger.warn("Unable to open " + sourceFile.getAbsolutePath(), fnfe); } catch (IOException e) { // Unable to create a lock. This exception should only be thrown when // the file is already locked. No sense in repeating the message over // and over. } finally { if (lock != null) { // if lock is null the file is locked by another process fileCanBeLocked = true; try { // Release the lock lock.release(); } catch (IOException e) { // ignore } } if (channel != null) { try { // Close the file channel.close(); } catch (IOException e) { // ignore } } } return fileCanBeLocked; } /** * Get a list of files to be processed. * * @return an array of files to be processed. * @throws org.mule.api.MuleException which will wrap any other exceptions or * errors. */ File[] listFiles() throws MuleException { try { File[] todoFiles = null; if (fileFilter != null) { todoFiles = readDirectory.listFiles(fileFilter); } else { todoFiles = readDirectory.listFiles(filenameFilter); } // logger.trace("Reading directory " + readDirectory.getAbsolutePath() + // " -> " + TODOFiles.length + " file(s)"); return (todoFiles == null ? new File[0] : todoFiles); } catch (Exception e) { throw new DefaultMuleException(FileMessages.errorWhileListingFiles(), e); } } /** Exception tolerant roll back method */ protected boolean rollbackFileMove(File sourceFile, String destinationFilePath) { boolean result = false; try { result = FileUtils.moveFile(sourceFile, FileUtils.newFile(destinationFilePath)); } catch (Throwable t) { logger.debug("rollback of file move failed: " + t.getMessage()); } return result; } protected Comparator getComparator() throws Exception { Object o = getEndpoint().getProperty(COMPARATOR_CLASS_NAME_PROPERTY); Object reverseProperty = this.getEndpoint().getProperty(COMPARATOR_REVERSE_ORDER_PROPERTY); boolean reverse = false; if (o != null) { if (reverseProperty != null) { reverse = Boolean.valueOf((String) reverseProperty).booleanValue(); } Class clazz = Class.forName(o.toString()); o = clazz.newInstance(); return reverse ? new ReverseComparator((Comparator) o) : (Comparator) o; } return null; } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/FileContentsMessageAdapter.java0000644000175000017500000000442510777454544032672 0ustar charlescharles/* * $Id: FileContentsMessageAdapter.java 11559 2008-04-10 18:16:04Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MessagingException; import org.mule.api.MuleRuntimeException; import org.mule.api.ThreadSafeAccess; import org.mule.config.i18n.CoreMessages; import org.mule.util.IOUtils; import java.io.FileInputStream; /** * FileContentsMessageAdapter provides a wrapper for file data. Users * can obtain the contents of the message through the payload property and can get * the filename and directory in the properties using PROPERTY_FILENAME and * PROPERTY_DIRECTORY. */ public class FileContentsMessageAdapter extends FileMessageAdapter { /** * Serial version */ private static final long serialVersionUID = 7368719494535568721L; private byte[] contents = null; public FileContentsMessageAdapter(Object message) throws MessagingException { super(message); this.getPayload(); } public FileContentsMessageAdapter(FileContentsMessageAdapter template) { super(template); contents = template.contents; this.getPayload(); } public Object getPayload() { if (contents == null) { synchronized (this) { try { if (fileInputStream == null) { fileInputStream = new FileInputStream(file); } contents = IOUtils.toByteArray(fileInputStream); fileInputStream.close(); } catch (Exception noPayloadException) { throw new MuleRuntimeException(CoreMessages.failedToReadPayload(), noPayloadException); } } } return contents; } public ThreadSafeAccess newThreadCopy() { return new FileContentsMessageAdapter(this); } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/package.html0000644000175000017500000000022210745677442027073 0ustar charlescharles Mule Provides file transport in the form of a directory listeners and file dispatchers. mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/transformers/0000755000175000017500000000000011351410635027322 5ustar charlescharlesmule-2.0.1/transports/file/src/main/java/org/mule/transport/file/transformers/package.html0000644000175000017500000000020410745677442031620 0ustar charlescharles Mule Transformers for converting to and from the FileMessage type. mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/transformers/FileToByteArray.java0000644000175000017500000000443210745677442033216 0ustar charlescharles/* * $Id: FileToByteArray.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file.transformers; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import org.mule.util.ArrayUtils; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import org.apache.commons.io.IOUtils; /** * FileToByteArray reads the contents of a file as a byte array. */ public class FileToByteArray extends AbstractTransformer { public FileToByteArray() { registerSourceType(File.class); setReturnClass(byte[].class); } public Object doTransform(Object src, String encoding) throws TransformerException { File file = (File)src; if (file == null) { throw new TransformerException(this, new IllegalArgumentException("null file")); } if (!file.exists()) { throw new TransformerException(this, new FileNotFoundException(file.getPath())); } if (file.length() == 0) { logger.warn("File is empty: " + file.getAbsolutePath()); return ArrayUtils.EMPTY_BYTE_ARRAY; } FileInputStream fis = null; byte[] bytes = null; try { fis = new FileInputStream(file); // TODO Attention: arbitrary 4GB limit & also a great way to reap // OOMs int length = new Long(file.length()).intValue(); bytes = new byte[length]; fis.read(bytes); return bytes; } // at least try.. catch (OutOfMemoryError oom) { throw new TransformerException(this, oom); } catch (IOException e) { throw new TransformerException(this, e); } finally { IOUtils.closeQuietly(fis); } } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/transformers/FileToString.java0000644000175000017500000000407210777522770032560 0ustar charlescharles/* * $Id: FileToString.java 11561 2008-04-10 23:42:48Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file.transformers; import org.mule.api.transformer.TransformerException; import org.mule.util.IOUtils; import java.io.File; import java.io.InputStream; import java.io.UnsupportedEncodingException; /** * FileToString reads file contents into a string. */ public class FileToString extends FileToByteArray { public FileToString() { registerSourceType(File.class); registerSourceType(InputStream.class); registerSourceType(byte[].class); setReturnClass(String.class); } /** * Simple implementation which relies on {@link FileToByteArray} to get a * byte[] from the file beeing parsed and then transform it to a * String with the correct encoding. If the encoding isn't supported simply throw * an exception, good tranformation or no transformation at all. NOTE: if a * byte[] is passed in as a source object this transformer accepts * it and tries the usual transformation. */ // @Override public Object doTransform(Object src, String encoding) throws TransformerException { byte[] bytes; if (src instanceof InputStream) { bytes = IOUtils.toByteArray((InputStream) src); } else if (src instanceof byte[]) { bytes = (byte[])src; } else { bytes = (byte[])super.doTransform(src, encoding); } try { return new String(bytes, encoding); } catch (UnsupportedEncodingException uee) { throw new TransformerException(this, uee); } } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/test/0000755000175000017500000000000011351410635025554 5ustar charlescharlesmule-2.0.1/transports/file/src/main/java/org/mule/transport/file/FileMessageDispatcher.java0000644000175000017500000001112310757615756031655 0ustar charlescharles/* * $Id: FileMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.DefaultMuleMessage; import org.mule.api.DefaultMuleException; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.OutputHandler; import org.mule.transport.AbstractMessageDispatcher; import org.mule.transport.file.i18n.FileMessages; import org.mule.util.FileUtils; import org.mule.util.IOUtils; import java.io.File; import java.io.FileOutputStream; import java.io.FilenameFilter; import java.io.InputStream; /** * FileMessageDispatcher is used to read/write files to the filesystem */ public class FileMessageDispatcher extends AbstractMessageDispatcher { private final FileConnector connector; public FileMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (FileConnector) endpoint.getConnector(); } /* * (non-Javadoc) * * @see org.mule.api.transport.UMOConnectorSession#dispatch(org.mule.api.MuleEvent) */ protected void doDispatch(MuleEvent event) throws Exception { Object data = event.transformMessage(); // Wrap the transformed message before passing it to the filename parser MuleMessage message = new DefaultMuleMessage(data, event.getMessage()); FileOutputStream fos = (FileOutputStream) connector.getOutputStream(event.getEndpoint(), message); try { if (event.getMessage().getStringProperty(FileConnector.PROPERTY_FILENAME, null) == null) { event.getMessage().setStringProperty(FileConnector.PROPERTY_FILENAME, message.getStringProperty(FileConnector.PROPERTY_FILENAME, "")); } if (data instanceof byte[]) { fos.write((byte[]) data); } else if (data instanceof String) { fos.write(data.toString().getBytes(event.getEncoding())); } else if (data instanceof OutputHandler) { ((OutputHandler) data).write(event, fos); } else { InputStream is = (InputStream) event.transformMessage(InputStream.class); IOUtils.copyLarge(is, fos); is.close(); } } finally { logger.debug("Closing file"); fos.close(); } } /** * There is no associated session for a file connector * * @throws MuleException */ public Object getDelegateSession() throws MuleException { return null; } protected static File getNextFile(String dir, FilenameFilter filter) throws MuleException { File[] files; File file = FileUtils.newFile(dir); File result = null; try { if (file.exists()) { if (file.isFile()) { result = file; } else if (file.isDirectory()) { if (filter != null) { files = file.listFiles(filter); } else { files = file.listFiles(); } if (files.length > 0) { result = files[0]; } } } return result; } catch (Exception e) { throw new DefaultMuleException(FileMessages.errorWhileListingFiles(), e); } } /* * (non-Javadoc) * * @see org.mule.api.transport.UMOConnectorSession#send(org.mule.api.MuleEvent) */ protected MuleMessage doSend(MuleEvent event) throws Exception { doDispatch(event); return event.getMessage(); } protected void doDispose() { // no op } protected void doConnect() throws Exception { // no op } protected void doDisconnect() throws Exception { // no op } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/FileEndpointURIBuilder.java0000644000175000017500000000237110745677442031733 0ustar charlescharles/* * $Id: FileEndpointURIBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.endpoint.AbstractEndpointURIBuilder; import java.net.URI; import java.util.Properties; /** * FileEndpointBuilder File uris need some special processing because * the uri path can be any length, and the default resolver relies on a particular * path format. */ public class FileEndpointURIBuilder extends AbstractEndpointURIBuilder { protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException { address = uri.getSchemeSpecificPart(); if (address.startsWith("//")) { address = address.substring(2); } int i = address.indexOf("?"); if (i > -1) { address = address.substring(0, i); } } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/comparator/0000755000175000017500000000000011351410635026744 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/file/src/main/java/org/mule/transport/file/comparator/OlderFirstComparator.javamule-2.0.1/transports/file/src/main/java/org/mule/transport/file/comparator/OlderFirstComparator.jav0000644000175000017500000000326710745677442033604 0ustar charlescharles/* * $Id: OlderFirstComparator.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file.comparator; import org.mule.util.ClassUtils; import org.mule.util.FileUtils; import java.io.File; import java.text.MessageFormat; import java.util.Comparator; /** *

OlderComparatorComparator is a {@link Comparator} of File * which is capable of comparing files for equality based on their modification dates.

*/ public class OlderFirstComparator implements Comparator { public int compare(Object o1, Object o2) { if (o1 instanceof File && o2 instanceof File) { File f = (File) o1; File f1 = (File) o2; boolean fileNewer = FileUtils.isFileNewer(f, f1); boolean fileOlder = FileUtils.isFileOlder(f, f1); if (!fileNewer && !fileOlder) { return 0; } else if (fileNewer) { return 1; } else { return -1; } } throw new IllegalArgumentException(MessageFormat.format( "Expected java.io.File instance, but was {0} and {1}", new Object[] {ClassUtils.getShortClassName(o1, ""), ClassUtils.getShortClassName(o2, "FileMessageDispatcher is used to read/write files to the filesystem */ public class FileMessageRequester extends AbstractMessageRequester { private final FileConnector connector; public FileMessageRequester(InboundEndpoint endpoint) { super(endpoint); this.connector = (FileConnector) endpoint.getConnector(); } /** * There is no associated session for a file connector * * @throws org.mule.api.MuleException */ public Object getDelegateSession() throws MuleException { return null; } /** * Will attempt to do a receive from a directory, if the endpointUri resolves to * a file name the file will be returned, otherwise the first file in the * directory according to the filename filter configured on the connector. * * @param timeout this is ignored when doing a receive on this dispatcher * @return a message containing file contents or null if there was notthing to * receive * @throws Exception */ protected MuleMessage doRequest(long timeout) throws Exception { File file = FileUtils.newFile(endpoint.getEndpointURI().getAddress()); File result = null; FilenameFilter filenameFilter = null; String filter = (String) endpoint.getProperty("filter"); if (filter != null) { filter = URLDecoder.decode(filter, MuleServer.getMuleContext().getConfiguration().getDefaultEncoding()); filenameFilter = new FilenameWildcardFilter(filter); } if (file.exists()) { if (file.isFile()) { result = file; } else if (file.isDirectory()) { result = FileMessageDispatcher.getNextFile(endpoint.getEndpointURI().getAddress(), filenameFilter); } if (result != null) { boolean checkFileAge = connector.getCheckFileAge(); if (checkFileAge) { long fileAge = connector.getFileAge(); long lastMod = result.lastModified(); long now = System.currentTimeMillis(); long thisFileAge = now - lastMod; if (thisFileAge < fileAge) { if (logger.isDebugEnabled()) { logger.debug("The file has not aged enough yet, will return nothing for: " + result.getCanonicalPath()); } return null; } } // Don't we need to try to obtain a file lock as we do with receiver String sourceFileOriginalName = result.getName(); // This isn't nice but is needed as MessageAdaptor is required to // resolve // destination file name, and StreamingReceiverFileInputStream is // required to create MessageAdaptor DefaultMessageAdapter fileParserMsgAdaptor = new DefaultMessageAdapter(null); fileParserMsgAdaptor.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, sourceFileOriginalName); // set up destination file File destinationFile = null; String movDir = connector.getMoveToDirectory(); if (movDir != null) { String destinationFileName = sourceFileOriginalName; String moveToPattern = connector.getMoveToPattern(); if (moveToPattern != null) { destinationFileName = connector.getFilenameParser().getFilename( fileParserMsgAdaptor, moveToPattern); } // don't use new File() directly, see MULE-1112 destinationFile = FileUtils.newFile(movDir, destinationFileName); } MessageAdapter msgAdapter = null; try { if (connector.isStreaming()) { msgAdapter = connector.getMessageAdapter(new ReceiverFileInputStream(result, connector.isAutoDelete(), destinationFile)); } else { msgAdapter = connector.getMessageAdapter(result); } } catch (FileNotFoundException e) { // we can ignore since we did manage to acquire a lock, but just // in case logger.error("File being read disappeared!", e); return null; } msgAdapter.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, sourceFileOriginalName); if (!connector.isStreaming()) { moveOrDelete(result, destinationFile); return new DefaultMuleMessage(msgAdapter); } else { // If we are streaming no need to move/delete now, that will be // done when stream is closed return new DefaultMuleMessage(msgAdapter); } } } return null; } private void moveOrDelete(final File sourceFile, File destinationFile) throws DefaultMuleException { if (destinationFile != null) { // move sourceFile to new destination if (!FileUtils.moveFile(sourceFile, destinationFile)) { throw new DefaultMuleException(FileMessages.failedToMoveFile(sourceFile.getAbsolutePath(), destinationFile.getAbsolutePath())); } } if (connector.isAutoDelete()) { // no moveTo directory if (destinationFile == null) { // delete source if (!sourceFile.delete()) { throw new DefaultMuleException(FileMessages.failedToDeleteFile(sourceFile.getAbsolutePath())); } } else { // nothing to do here since moveFile() should have deleted // the source file for us } } } protected void doDispose() { // no op } protected void doConnect() throws Exception { // no op } protected void doDisconnect() throws Exception { // no op } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/i18n/0000755000175000017500000000000011351410635025354 5ustar charlescharlesmule-2.0.1/transports/file/src/main/java/org/mule/transport/file/i18n/FileMessages.java0000644000175000017500000000311110745677442030603 0ustar charlescharles/* * $Id: FileMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file.i18n; import org.mule.api.endpoint.EndpointURI; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class FileMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("file"); public static Message errorWhileListingFiles() { return createMessage(BUNDLE_PATH, 1); } public static Message exceptionWhileProcessing(String name, String string) { return createMessage(BUNDLE_PATH, 2, name, string); } public static Message failedToDeleteFile(String path) { return createMessage(BUNDLE_PATH, 3, path); } public static Message failedToMoveFile(String from, String to) { return createMessage(BUNDLE_PATH, 4, from, to); } public static Message moveToDirectoryNotWritable() { return createMessage(BUNDLE_PATH, 5); } public static Message invalidFileFilter(EndpointURI endpointURI) { return createMessage(BUNDLE_PATH, 6, endpointURI); } public static Message fileDoesNotExist(String string) { return createMessage(BUNDLE_PATH, 7, string); } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/FilenameParser.java0000644000175000017500000000131610745677442030357 0ustar charlescharles/* * $Id: FilenameParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.transport.MessageAdapter; /** * FilenameParser is a simple expression parser interface for * processing filenames */ public interface FilenameParser { public String getFilename(MessageAdapter adapter, String pattern); } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/config/0000755000175000017500000000000011351410635026042 5ustar charlescharlesmule-2.0.1/transports/file/src/main/java/org/mule/transport/file/config/FileNamespaceHandler.java0000644000175000017500000000464111003270417032700 0ustar charlescharles/* * $Id: FileNamespaceHandler.java 11626 2008-04-22 05:01:03Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.specific.TransformerDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.file.ExpressionFilenameParser; import org.mule.transport.file.FileConnector; import org.mule.transport.file.FilenameParser; import org.mule.transport.file.SimpleFilenameParser; import org.mule.transport.file.filters.FilenameRegexFilter; import org.mule.transport.file.filters.FilenameWildcardFilter; import org.mule.transport.file.transformers.FileToByteArray; import org.mule.transport.file.transformers.FileToString; /** * Reigsters a Bean Definition Parser for handling elements. * */ public class FileNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(FileConnector.FILE, URIBuilder.PATH_ATTRIBUTES); registerConnectorDefinitionParser(FileConnector.class); registerBeanDefinitionParser("custom-filename-parser", new ChildDefinitionParser("filenameParser", null, FilenameParser.class)); registerBeanDefinitionParser("legacy-filename-parser", new ChildDefinitionParser("filenameParser", SimpleFilenameParser.class)); registerBeanDefinitionParser("expression-filename-parser", new ChildDefinitionParser("filenameParser", ExpressionFilenameParser.class)); registerBeanDefinitionParser("file-to-byte-array-transformer", new TransformerDefinitionParser(FileToByteArray.class)); registerBeanDefinitionParser("file-to-string-transformer", new TransformerDefinitionParser(FileToString.class)); registerBeanDefinitionParser("filename-wildcard-filter", new ChildDefinitionParser("filter", FilenameWildcardFilter.class)); registerBeanDefinitionParser("filename-regex-filter", new ChildDefinitionParser("filter", FilenameRegexFilter.class)); } }mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/SimpleFilenameParser.java0000644000175000017500000000742510745677442031540 0ustar charlescharles/* * $Id: SimpleFilenameParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.transport.MessageAdapter; import org.mule.util.DateUtils; import org.mule.util.TemplateParser; import org.mule.util.UUID; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong; /** * SimpleFilenameParser understands a limited set of tokens, namely *
    *
  • ${DATE} : the currrent date in the format dd-MM-yy_HH-mm-ss.SS
  • *
  • ${DATE:yy-MM-dd} : the current date using the specified format
  • *
  • ${SYSTIME} : The current system time milliseconds
  • *
  • ${UUID} : A generated Universally unique id
  • *
  • ${ORIGINALNAME} : The origial file name if the file being written was read * from another location
  • *
  • ${COUNT} : An incremental counter
  • *
  • ${} : A name of a property on the message
  • *
* Note that square brackets can be used instead of curl brackets, this is useful * when defining the file output pattern in a Mule Url endpointUri where the curl * bracket is an invalid character. */ public class SimpleFilenameParser implements FilenameParser { public static final String DEFAULT_DATE_FORMAT = "dd-MM-yy_HH-mm-ss.SSS"; private final TemplateParser antParser = TemplateParser.createAntStyleParser(); private final TemplateParser squareParser = TemplateParser.createSquareBracesStyleParser(); private final AtomicLong count = new AtomicLong(0); public String getFilename(MessageAdapter adapter, String pattern) { if (pattern == null) { return UUID.getUUID() + ".dat"; } else { if (pattern.indexOf('{') > -1) { return getFilename(adapter, pattern, antParser); } else { return getFilename(adapter, pattern, squareParser); } } } protected String getFilename(final MessageAdapter adapter, String pattern, TemplateParser parser) { return parser.parse(new TemplateParser.TemplateCallback() { public Object match(String token) { if (token.equals("DATE")) { return DateUtils.getTimeStamp(DEFAULT_DATE_FORMAT); } else if (token.startsWith("DATE:")) { token = token.substring(5); return DateUtils.getTimeStamp(token); } else if (token.startsWith("UUID")) { return UUID.getUUID(); } else if (token.startsWith("SYSTIME")) { return String.valueOf(System.currentTimeMillis()); } else if (token.startsWith("COUNT")) { return String.valueOf(count.getAndIncrement()); } else if (adapter != null) { if (token.startsWith("ORIGINALNAME")) { return adapter.getStringProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, null); } else { return adapter.getStringProperty(token, null); } } return null; } }, pattern); } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/FileMessageRequesterFactory.java0000644000175000017500000000173110757615756033102 0ustar charlescharles/* * $Id: FileMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; /** * Creates a requester responsible for reading files from disk */ public class FileMessageRequesterFactory extends AbstractMessageRequesterFactory { /** {@inheritDoc} */ public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new FileMessageRequester(endpoint); } }mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/filters/0000755000175000017500000000000011351410635026245 5ustar charlescharlesmule-2.0.1/transports/file/src/main/java/org/mule/transport/file/filters/FilenameRegexFilter.java0000644000175000017500000000600010745677442033006 0ustar charlescharles/* * $Id: FilenameRegexFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file.filters; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * FilenameRegexFilter filters incoming files from a directory, based * on a regular expression. If the expression evaluates to true, then the file will * be accepted. */ public class FilenameRegexFilter extends FilenameWildcardFilter { protected volatile Pattern[] compiledPatterns = null; /** * Filter condition decider method. *

* Returns boolean TRUE if the file conforms to the * regular expression pattern or FALSE otherwise. * * @param name The name of the file to apply the filter to. * @return indication of acceptance as boolean. */ // //@Override public boolean accept(Object object) { if (object == null) { return false; } boolean foundMatch = false; if (compiledPatterns != null) { for (int i = 0; i < compiledPatterns.length; i++) { Pattern pattern = compiledPatterns[i]; String string = object.toString(); /* Determine if there is an exact match. */ Matcher matcher = pattern.matcher(string); foundMatch = matcher.matches(); if (foundMatch) { // we found a match, bail break; } } } return foundMatch; } /* * (non-Javadoc) * * @see org.mule.routing.filters.WildcardFilter#setCaseSensitive(boolean) */ // //@Override public void setCaseSensitive(boolean caseSensitive) { super.setCaseSensitive(caseSensitive); this.setPattern(pattern); } /* * (non-Javadoc) * * @see org.mule.routing.filters.WildcardFilter#setPattern(java.lang.String) */ // //@Override public void setPattern(String pattern) { super.setPattern(pattern); if (patterns != null) { compiledPatterns = new Pattern[patterns.length]; for (int i = 0; i < patterns.length; i++) { if (!isCaseSensitive()) { /* Add insensitive option if set in the configuration. */ compiledPatterns[i] = Pattern.compile(patterns[i], Pattern.CASE_INSENSITIVE); } else { compiledPatterns[i] = Pattern.compile(patterns[i]); } } } } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/filters/package.html0000644000175000017500000000017110745677442030546 0ustar charlescharles Mule Filename filters used to filter on a listening directory. ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/file/src/main/java/org/mule/transport/file/filters/FilenameWildcardFilter.javamule-2.0.1/transports/file/src/main/java/org/mule/transport/file/filters/FilenameWildcardFilter.java0000644000175000017500000000341610745677442033475 0ustar charlescharles/* * $Id: FilenameWildcardFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file.filters; import org.mule.api.MuleMessage; import org.mule.routing.filters.WildcardFilter; import org.mule.transport.file.FileConnector; import java.io.File; import java.io.FilenameFilter; /** * FilenameWildcardFilter filters incoming files from a directory, * based on file patterns. */ public class FilenameWildcardFilter extends WildcardFilter implements FilenameFilter { public FilenameWildcardFilter() { super(); } public FilenameWildcardFilter(String pattern) { super(pattern); } /** * Filter condition decider method.

Returns * boolean TRUE if the file conforms to an * acceptable pattern or FALSE otherwise. * * @param dir The directory to apply the filter to. * @param name The name of the file to apply the filter to. * @return indication of acceptance as boolean. */ public boolean accept(File dir, String name) { if (name == null) { logger.warn("The filename and/or directory was null"); return false; } else { return accept(name); } } public boolean accept(MuleMessage message) { return accept(message.getProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME)); } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/ReceiverFileInputStream.java0000644000175000017500000000405010777050076032211 0ustar charlescharles/* * $Id: ReceiverFileInputStream.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.DefaultMuleException; import org.mule.transport.file.i18n.FileMessages; import org.mule.util.FileUtils; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; /** * This implementation is used when streaming and will move or delete the source file * when the stream is closed. */ class ReceiverFileInputStream extends FileInputStream { private File currentFile; private boolean deleteOnClose; private File moveToOnClose; public ReceiverFileInputStream(File currentFile, boolean deleteOnClose, File moveToOnClose) throws FileNotFoundException { super(currentFile); this.currentFile = currentFile; this.deleteOnClose = deleteOnClose; this.moveToOnClose = moveToOnClose; } public void close() throws IOException { super.close(); if (moveToOnClose != null) { FileUtils.moveFile(currentFile, moveToOnClose); } else if (deleteOnClose) { if (!currentFile.delete()) { try { throw new DefaultMuleException( FileMessages.failedToDeleteFile(currentFile.getAbsolutePath())); } catch (DefaultMuleException e) { IOException e2 = new IOException(); e2.initCause(e); throw e2; } } } } public File getCurrentFile() { return currentFile; } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/FileMessageAdapter.java0000644000175000017500000000562210777627267031160 0ustar charlescharles/* * $Id: FileMessageAdapter.java 11565 2008-04-11 09:26:15Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MessagingException; import org.mule.api.ThreadSafeAccess; import org.mule.api.transport.MessageTypeNotSupportedException; import org.mule.transport.AbstractMessageAdapter; import java.io.File; import java.io.InputStream; /** * FileMessageAdapter provides a wrapper for a file reference. Users * can obtain the contents of the message through the payload property and can get * the filename and directory in the properties using FileConnector.PROPERTY_FILENAME * and FileConnector.PROPERTY_DIRECTORY.
* This message adaptor supports both InputStream and File payload types. */ public class FileMessageAdapter extends AbstractMessageAdapter { /** Serial version */ private static final long serialVersionUID = 4127485947547548996L; protected File file = null; protected InputStream fileInputStream; public FileMessageAdapter(Object message) throws MessagingException { super(); if (message instanceof File) { this.setFileMessage((File) message); } else if (message instanceof ReceiverFileInputStream) { this.setStreamMessage((ReceiverFileInputStream) message); } else { throw new MessageTypeNotSupportedException(message, this.getClass()); } } protected FileMessageAdapter(FileMessageAdapter template) { super(template); file = template.file; fileInputStream = template.fileInputStream; } public Object getPayload() { if (fileInputStream != null) { return fileInputStream; } return file; } protected void setFileMessage(File message) throws MessagingException { this.file = message; setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, this.file.getName()); setProperty(FileConnector.PROPERTY_DIRECTORY, this.file.getParent()); } protected void setStreamMessage(ReceiverFileInputStream message) throws MessagingException { this.file = message.getCurrentFile(); this.fileInputStream = message; setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, this.file.getName()); setProperty(FileConnector.PROPERTY_DIRECTORY, this.file.getParent()); } public String getUniqueId() { return file.getAbsolutePath(); } public ThreadSafeAccess newThreadCopy() { return new FileMessageAdapter(this); } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/FileConnector.java0000644000175000017500000004247611002161500030172 0ustar charlescharles/* * $Id: FileConnector.java 11599 2008-04-18 18:06:56Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MessagingException; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transport.DispatchException; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.MessageReceiver; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.simple.ByteArrayToSerializable; import org.mule.transformer.simple.SerializableToByteArray; import org.mule.transport.AbstractConnector; import org.mule.transport.file.filters.FilenameWildcardFilter; import org.mule.util.FileUtils; import org.mule.util.MapUtils; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Map; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * FileConnector is used for setting up listeners on a directory and * for writing files to a directory. The connecotry provides support for defining * file output patterns and filters for receiving files. */ public class FileConnector extends AbstractConnector { public static final String FILE = "file"; private static Log logger = LogFactory.getLog(FileConnector.class); // These are properties that can be overridden on the Receiver by the endpoint declaration // inbound only public static final String PROPERTY_POLLING_FREQUENCY = "pollingFrequency"; public static final String PROPERTY_FILE_AGE = "fileAge"; public static final String PROPERTY_MOVE_TO_PATTERN = "moveToPattern"; public static final String PROPERTY_MOVE_TO_DIRECTORY = "moveToDirectory"; public static final String PROPERTY_READ_FROM_DIRECTORY = "readFromDirectoryName"; // outbound only public static final String PROPERTY_OUTPUT_PATTERN = "outputPattern"; // apparently unused (once strange override code deleted) // public static final String PROPERTY_DELETE_ON_READ = "autoDelete"; // public static final String PROPERTY_SERVICE_OVERRIDE = "serviceOverrides"; // message properties public static final String PROPERTY_FILENAME = "filename"; public static final String PROPERTY_ORIGINAL_FILENAME = "originalFilename"; public static final String PROPERTY_DIRECTORY = "directory"; public static final String PROPERTY_WRITE_TO_DIRECTORY = "writeToDirectoryName"; public static final String PROPERTY_FILE_SIZE = "fileSize"; public static final long DEFAULT_POLLING_FREQUENCY = 1000; /** * Time in milliseconds to poll. On each poll the poll() method is called */ private long pollingFrequency = 0; private String moveToPattern = null; private String writeToDirectoryName = null; private String moveToDirectoryName = null; private String readFromDirectoryName = null; private String outputPattern = null; private boolean outputAppend = false; private boolean autoDelete = true; private boolean checkFileAge = false; private long fileAge = 0; private FileOutputStream outputStream = null; private boolean serialiseObjects = false; private boolean streaming = true; public FilenameParser filenameParser; /* * (non-Javadoc) * * @see org.mule.transport.AbstractConnector#doInitialise() */ public FileConnector() { super(); // MULE-1773: limit the number of dispatchers per endpoint to 1 until // there is a proper (Distributed)LockManager in place (MULE-2402). // We also override the setter to prevent "wrong" configuration for now. super.setMaxDispatchersActive(1); filenameParser = new SimpleFilenameParser(); } // @Override public void setMaxDispatchersActive(int value) { if (value != 1) { throw new IllegalArgumentException("MULE-1773: cannot configure maxDispatchersActive"); } } // @Override protected Object getReceiverKey(Service service, InboundEndpoint endpoint) { if (endpoint.getFilter() != null && endpoint.getFilter() instanceof FilenameWildcardFilter) { return endpoint.getEndpointURI().getAddress() + "/" + ((FilenameWildcardFilter) endpoint.getFilter()).getPattern(); } return endpoint.getEndpointURI().getAddress(); } /** * Registers a listener for a particular directory The following properties can * be overriden in the endpoint declaration *

    *
  • moveToDirectory
  • *
  • filterPatterns
  • *
  • filterClass
  • *
  • pollingFrequency
  • *
*/ public MessageReceiver createReceiver(Service service, InboundEndpoint endpoint) throws Exception { String readDir = endpoint.getEndpointURI().getAddress(); if (null != getReadFromDirectory()) { readDir = getReadFromDirectory(); } long polling = this.pollingFrequency; String moveTo = moveToDirectoryName; String moveToPattern = getMoveToPattern(); Map props = endpoint.getProperties(); if (props != null) { // Override properties on the endpoint for the specific endpoint String read = (String) props.get(PROPERTY_READ_FROM_DIRECTORY); if (read != null) { readDir = read; } String move = (String) props.get(PROPERTY_MOVE_TO_DIRECTORY); if (move != null) { moveTo = move; } String tempMoveToPattern = (String) props.get(PROPERTY_MOVE_TO_PATTERN); if (tempMoveToPattern != null) { if (logger.isDebugEnabled()) { logger.debug("set moveTo Pattern to: " + tempMoveToPattern); } moveToPattern = tempMoveToPattern; } String tempPolling = (String) props.get(PROPERTY_POLLING_FREQUENCY); if (tempPolling != null) { polling = Long.parseLong(tempPolling); } if (polling <= 0) { polling = DEFAULT_POLLING_FREQUENCY; } if (logger.isDebugEnabled()) { logger.debug("set polling frequency to: " + polling); } String tempFileAge = (String) props.get(PROPERTY_FILE_AGE); if (tempFileAge != null) { try { setFileAge(Long.parseLong(tempFileAge)); } catch (Exception ex1) { logger.error("Failed to set fileAge", ex1); } } // this is surreal! what on earth was it useful for? // Map srvOverride = (Map) props.get(PROPERTY_SERVICE_OVERRIDE); // if (srvOverride != null) // { // if (serviceOverrides == null) // { // serviceOverrides = new Properties(); // } // serviceOverrides.setProperty(MuleProperties.CONNECTOR_INBOUND_TRANSFORMER, // NoActionTransformer.class.getName()); // serviceOverrides.setProperty(MuleProperties.CONNECTOR_OUTBOUND_TRANSFORMER, // NoActionTransformer.class.getName()); // } } try { return serviceDescriptor.createMessageReceiver(this, service, endpoint, new Object[]{readDir, moveTo, moveToPattern, new Long(polling)}); } catch (Exception e) { throw new InitialisationException( CoreMessages.failedToCreateObjectWith("Message Receiver", serviceDescriptor), e, this); } } public String getProtocol() { return FILE; } public FilenameParser getFilenameParser() { return filenameParser; } public void setFilenameParser(FilenameParser filenameParser) { this.filenameParser = filenameParser; } protected void doDispose() { try { doStop(); } catch (MuleException e) { logger.error(e.getMessage(), e); } } protected void doInitialise() throws InitialisationException { // template method, nothing to do } protected void doConnect() throws Exception { // template method, nothing to do } protected void doDisconnect() throws Exception { // template method, nothing to do } protected void doStart() throws MuleException { // template method, nothing to do } protected void doStop() throws MuleException { if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { logger.warn("Failed to close file output stream on stop: " + e); } } } /** * @return Returns the moveToDirectoryName. */ public String getMoveToDirectory() { return moveToDirectoryName; } /** * @param dir The moveToDirectoryName to set. */ public void setMoveToDirectory(String dir) { this.moveToDirectoryName = dir; } /** * @return Returns the outputAppend. */ public boolean isOutputAppend() { return outputAppend; } /** * @param outputAppend The outputAppend to set. */ public void setOutputAppend(boolean outputAppend) { this.outputAppend = outputAppend; } /** * @return Returns the outputPattern. */ public String getOutputPattern() { return outputPattern; } /** * @param outputPattern The outputPattern to set. */ public void setOutputPattern(String outputPattern) { this.outputPattern = outputPattern; } /** * @return Returns the outputStream. */ public FileOutputStream getOutputStream() { return outputStream; } /** * @param outputStream The outputStream to set. */ public void setOutputStream(FileOutputStream outputStream) { this.outputStream = outputStream; } /** * @return Returns the pollingFrequency. */ public long getPollingFrequency() { return pollingFrequency; } /** * @param pollingFrequency The pollingFrequency to set. */ public void setPollingFrequency(long pollingFrequency) { this.pollingFrequency = pollingFrequency; } /** * @return Returns the fileAge. */ public long getFileAge() { return fileAge; } public boolean getCheckFileAge() { return checkFileAge; } /** * @param fileAge The fileAge in milliseconds to set. */ public void setFileAge(long fileAge) { this.fileAge = fileAge; this.checkFileAge = true; } /** * @return Returns the writeToDirectory. */ public String getWriteToDirectory() { return writeToDirectoryName; } /** * @param dir The writeToDirectory to set. */ public void setWriteToDirectory(String dir) throws IOException { this.writeToDirectoryName = dir; if (writeToDirectoryName != null) { File writeToDirectory = FileUtils.openDirectory(writeToDirectoryName); if (!(writeToDirectory.canRead()) || !writeToDirectory.canWrite()) { throw new IOException( "Error on initialization, Write To directory does not exist or is not read/write"); } } } /** * @return Returns the readFromDirectory. */ public String getReadFromDirectory() { return readFromDirectoryName; } /** * @param dir The readFromDirectory to set. */ public void setReadFromDirectory(String dir) throws IOException { this.readFromDirectoryName = dir; if (readFromDirectoryName != null) { File readFromDirectory = FileUtils.openDirectory((readFromDirectoryName)); if (!readFromDirectory.canRead()) { throw new IOException( "Error on initialization, read from directory does not exist or is not readable"); } } } public boolean isSerialiseObjects() { return serialiseObjects; } public void setSerialiseObjects(boolean serialiseObjects) { // set serialisable transformers on the connector if this is set if (serialiseObjects) { if (serviceOverrides == null) { serviceOverrides = new Properties(); } serviceOverrides.setProperty(MuleProperties.CONNECTOR_INBOUND_TRANSFORMER, ByteArrayToSerializable.class.getName()); serviceOverrides.setProperty(MuleProperties.CONNECTOR_OUTBOUND_TRANSFORMER, SerializableToByteArray.class.getName()); } this.serialiseObjects = serialiseObjects; } public boolean isAutoDelete() { return autoDelete; } public void setAutoDelete(boolean autoDelete) { this.autoDelete = autoDelete; } public String getMoveToPattern() { return moveToPattern; } public void setMoveToPattern(String moveToPattern) { this.moveToPattern = moveToPattern; } /** * Well get the output stream (if any) for this type of transport. Typically this * will be called only when Streaming is being used on an outbound endpoint * * @param endpoint the endpoint that releates to this Dispatcher * @param message the current message being processed * @return the output stream to use for this request or null if the transport * does not support streaming * @throws org.mule.api.MuleException */ public OutputStream getOutputStream(ImmutableEndpoint endpoint, MuleMessage message) throws MuleException { String address = endpoint.getEndpointURI().getAddress(); String writeToDirectory = message.getStringProperty(FileConnector.PROPERTY_WRITE_TO_DIRECTORY, null); if (writeToDirectory == null) { writeToDirectory = getWriteToDirectory(); } if (writeToDirectory != null) { address = getFilenameParser().getFilename(message, writeToDirectory); } String filename; String outPattern = (String) endpoint.getProperty(FileConnector.PROPERTY_OUTPUT_PATTERN); if (outPattern == null) { outPattern = message.getStringProperty(FileConnector.PROPERTY_OUTPUT_PATTERN, null); } if (outPattern == null) { outPattern = getOutputPattern(); } try { if (outPattern != null) { filename = generateFilename(message, outPattern); } else { filename = message.getStringProperty(FileConnector.PROPERTY_FILENAME, null); if (filename == null) { filename = generateFilename(message, null); } } if (filename == null) { throw new IOException("Filename is null"); } File file = FileUtils.createFile(address + "/" + filename); if (logger.isInfoEnabled()) { logger.info("Writing file to: " + file.getAbsolutePath()); } return new FileOutputStream(file, MapUtils.getBooleanValue(endpoint.getProperties(), "outputAppend", isOutputAppend())); } catch (IOException e) { throw new DispatchException(CoreMessages.streamingFailedNoStream(), message, endpoint, e); } } private String generateFilename(MuleMessage message, String pattern) { if (pattern == null) { pattern = getOutputPattern(); } return getFilenameParser().getFilename(message, pattern); } public boolean isStreaming() { return streaming; } public void setStreaming(boolean streaming) { this.streaming = streaming; } public MessageAdapter getMessageAdapter(Object message) throws MessagingException { if (isStreaming()) { // TODO Shouldn't we have a way to specify MessageAdaptor for streaming // in service descriptor // See MULE-3209, MULE-3199 return new FileMessageAdapter(message); } else { return super.getMessageAdapter(message); } } } mule-2.0.1/transports/file/src/main/java/org/mule/transport/file/ExpressionFilenameParser.java0000644000175000017500000000617310764067246032441 0ustar charlescharles/* * $Id: ExpressionFilenameParser.java 11232 2008-03-06 22:22:30Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.transport.MessageAdapter; import org.mule.util.TemplateParser; import org.mule.util.expression.ExpressionEvaluatorManager; /** * ExpressionFilenameParser can use any expression language supported by Mule * to construct a file name for the current message. Expressions can be xpath, xquery, ognl, mvel, header, function * and more. For more information see http://muledocs.org/v2/Expressions. *

* For example an xpath expression can be defined to pull a message id out of an xml message and use that as the file name - * * ${xpath:/message/header/@id} * *

* This parser superseeds the {@link org.mule.transport.file.SimpleFilenameParser} which has been kept in Mule 2 for * compatibility. The following demonstrates how to achieve the same results when using the ExpressionFilenameParser * over the {@link org.mule.transport.file.SimpleFilenameParser}. *

    *
  • ${DATE} : ${function:dateStamp}
  • *
  • ${DATE:yy-MM-dd} : ${function:dateStamp(yy-MM-dd)}
  • *
  • ${SYSTIME} : ${function:systime}
  • *
  • ${UUID} : ${function:uuid}
  • *
  • ${ORIGINALNAME} : ${header:originalFilename}
  • *
  • ${COUNT} : ${function:counter} - note that this is a global counter. If you want a local counter per file connector then you should use the {@link org.mule.transport.file.SimpleFilenameParser}.
  • *
  • ${} : ${header:}
  • *
*/ public class ExpressionFilenameParser implements FilenameParser { public static final String DEFAULT_DATE_FORMAT = "dd-MM-yy_HH-mm-ss.SSS"; public static final String DEFAULT_EXPRESSION = "${function:uuid}.dat"; private final TemplateParser antParser = TemplateParser.createAntStyleParser(); private final TemplateParser squareParser = TemplateParser.createSquareBracesStyleParser(); public String getFilename(MessageAdapter adapter, String expression) { if (expression == null) { return expression = DEFAULT_EXPRESSION; } if (expression.indexOf(ExpressionEvaluatorManager.DEFAULT_EXPRESSION_PREFIX) > -1) { return getFilename(adapter, expression, antParser); } else { return getFilename(adapter, expression, squareParser); } } protected String getFilename(final MessageAdapter adapter, String expression, TemplateParser parser) { return parser.parse(new TemplateParser.TemplateCallback() { public Object match(String token) { return ExpressionEvaluatorManager.evaluate(token, adapter); } }, expression); } }mule-2.0.1/transports/file/src/main/resources/0000755000175000017500000000000011351410635021162 5ustar charlescharlesmule-2.0.1/transports/file/src/main/resources/META-INF/0000755000175000017500000000000011351410636022323 5ustar charlescharlesmule-2.0.1/transports/file/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012410754365306025200 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/file/2.0/mule-file.xsd=META-INF/mule-file.xsdmule-2.0.1/transports/file/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014410754365306025357 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/file/2.0=org.mule.transport.file.config.FileNamespaceHandler mule-2.0.1/transports/file/src/main/resources/META-INF/services/0000755000175000017500000000000011351410636024146 5ustar charlescharlesmule-2.0.1/transports/file/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410636024735 5ustar charlescharlesmule-2.0.1/transports/file/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410636025677 5ustar charlescharlesmule-2.0.1/transports/file/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410636027714 5ustar charlescharlesmule-2.0.1/transports/file/src/main/resources/META-INF/services/org/mule/providers/file.properties0000644000175000017500000000062310745677442032772 0ustar charlescharlesconnector=org.mule.transport.file.FileConnector dispatcher.factory=org.mule.transport.file.FileMessageDispatcherFactory requester.factory=org.mule.transport.file.FileMessageRequesterFactory message.receiver=org.mule.transport.file.FileMessageReceiver message.adapter=org.mule.transport.file.FileContentsMessageAdapter endpoint.builder=org.mule.transport.file.FileEndpointURIBuilder inbound.transformer= mule-2.0.1/transports/file/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410636026456 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/file/src/main/resources/META-INF/services/org/mule/i18n/file-messages.propertiesmule-2.0.1/transports/file/src/main/resources/META-INF/services/org/mule/i18n/file-messages.properti0000644000175000017500000000104410621717250032770 0ustar charlescharles1=Error happened while listing files 2=Exception while processing "{0}" Result of rollback of move was {1} 3=Failed to delete file "{0}" as part of the file move operation. The file was being delete because 'AutoDelete' was set on the file connector. 4=Failed to move file "{0}" to "{1}". The file might already exist. 5=Error on initialization, Move To directory does not exist or is not read/write 6=A Filter has been set on endpoint "{0}" but the filter is not of type FilenameFilter or FileFilter 7=File "{0}" does not exist or cannot be read mule-2.0.1/transports/file/src/main/resources/META-INF/mule-file.xsd0000644000175000017500000003470311002166330024721 0ustar charlescharles This controls the mapping from filename patterns to filenames. Is requires an implementation of the FilenameParser interface, which is used to control how filename patterns are used to generate file names. The directory path where the file should be written on dispatch. This path is usually set as the endpoint of the dispatch event, however this allows you to explicitly force a single directory for the connector. The directory path where the file should be read from. This path is usually set as the inbound endpoint, however this allows you to explicitly force a single directory for the connector. By default, when a file is received it is read into a String or byte[]. The file is moved if the moveToDirectory is set, otherwise it is deleted. To access the File object set this property to false and specify a NoActionTransformer transformer for the connector. Mule will not delete the file, so it's up to the component to delete it when it's done. If the moveToDirectory is set, the file is first moved, then the File object of the moved file is passed to the component. It is recommended that a moveToDirectory is specified when turning autoDelete off. Should output append to existing file? Determines whether objects should be serialized to the file or not. If not the raw bytes or text is written. Should a FileInputStream be sent as the message payload or a File? The frequency in milliseconds that the read directory should be checked. Note that the read directory is specified by the endpoint of the listening component. Miniumum age (ms) for a file to be processed. The pattern to use when moving a read file to an new location determined by the moveToDirectory property. This can use the patterns supported by the filename-parser configured for this connector The directory path where the file should be written once it has been read. If this is not set the file read is deleted. Sort incoming files using this comparator. The class must implement java.util.Comparator interface. Should comparator order be reversed? The pattern to use when writing a file to disk. This can use the patterns supported by the filename-parser configured for this connector A file location. The file connector uses this as a default implementation, it understands the following patterns:
  • ${DATE} - the current date in the format dd-MM-yy_HH-mm-ss.SS;
  • ${DATE:yy-MM-dd} - the current date using the specified format;
  • ${SYSTIME} - The current system time milliseconds;
  • ${UUID} - A generated Universally unique id;
  • ${ORIGINALNAME} - The original file name if the file being written was read from another location;
  • ${COUNT} - An incremental counter.
ExpressionFilenameParser can use any expression language supported by Mule to construct a file name for the current message. Expressions can be xpath, xquery, ognl, mvel, header, function and more. For more information see http://muledocs.org/v2/Expressions. For example an xpath expression can be defined to pull a message id out of an xml message and use that as the file name - ${xpath:/message/header/@id} This parser superseeds the legacy-filename-parser which has been kept in Mule 2 for compatibility. The following demonstrates how to achieve the same results when using the expression-filename-parser over the legacy-filename-parser.
  • ${DATE} : ${function:dateStamp}
  • ${DATE:yy-MM-dd} : ${function:dateStamp(yy-MM-dd)}
  • ${SYSTIME} : ${function:systime}
  • ${UUID} : ${function:uuid}
  • ${ORIGINALNAME} : ${header:originalFilename}
  • ${COUNT} : ${function:counter} - note that this is a global counter. If you want a local counter per file connector then you should use the legacy-filename-parser.
  • ${[Message Property Name]} : ${header:[Message Property Name]}
Allows the user to specify custom filename parser. The implementation has to implement org.mule.transports.file.FilenameParser. The implementation class name that implement s org.mule.transports.file.FilenameParser. A placeholder for flename parser elements.
mule-2.0.1/transports/file/src/test/0000755000175000017500000000000011351410635017203 5ustar charlescharlesmule-2.0.1/transports/file/src/test/java/0000755000175000017500000000000011351410635020124 5ustar charlescharlesmule-2.0.1/transports/file/src/test/java/org/0000755000175000017500000000000011351410635020713 5ustar charlescharlesmule-2.0.1/transports/file/src/test/java/org/mule/0000755000175000017500000000000011351410635021655 5ustar charlescharlesmule-2.0.1/transports/file/src/test/java/org/mule/transport/0000755000175000017500000000000011351410635023711 5ustar charlescharlesmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/0000755000175000017500000000000011351410635024630 5ustar charlescharlesmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileNamespaceHandlerTestCase.java0000644000175000017500000001035611003375564033133 0ustar charlescharles/* * $Id: FileNamespaceHandlerTestCase.java 11631 2008-04-22 14:51:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.routing.filter.Filter; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.tck.FunctionalTestCase; import org.mule.transport.file.filters.FilenameRegexFilter; import org.mule.transport.file.transformers.FileToByteArray; import org.mule.transport.file.transformers.FileToString; import java.util.List; public class FileNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "file-namespace-config.xml"; } public void testConfig() throws Exception { FileConnector c = (FileConnector)muleContext.getRegistry().lookupConnector("fileConnector"); assertNotNull(c); assertEquals(1234, c.getFileAge()); assertEquals("abc", c.getMoveToDirectory()); assertEquals("bcd", c.getMoveToPattern()); assertEquals("cde", c.getOutputPattern()); assertEquals(2345, c.getPollingFrequency()); // don't test these - they force directory creation //assertEquals("efg", c.getReadFromDirectory()); //assertEquals("fgh", c.getWriteToDirectory()); assertEquals(false, c.isAutoDelete()); assertEquals(true, c.isOutputAppend()); assertEquals(true, c.isSerialiseObjects()); assertEquals(false, c.isStreaming()); // Not implemented yet, see MULE-2671 //assertNull(c.getComparator()); //assertFalse(c.isReverseOrder()); FilenameParser parser = c.getFilenameParser(); assertTrue(parser.getClass().getName(), c.getFilenameParser() instanceof DummyFilenameParser); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testSecondConnector() throws Exception { FileConnector c = (FileConnector)muleContext.getRegistry().lookupConnector("secondConnector"); assertNotNull(c); FilenameParser parser = c.getFilenameParser(); assertTrue(parser.getClass().getName(), c.getFilenameParser() instanceof SimpleFilenameParser); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testThirdConnector() throws Exception { FileConnector c = (FileConnector)muleContext.getRegistry().lookupConnector("thirdConnector"); assertNotNull(c); FilenameParser parser = c.getFilenameParser(); assertTrue(parser.getClass().getName(), c.getFilenameParser() instanceof ExpressionFilenameParser); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testTransformersOnEndpoints() throws Exception { Object transformer1 = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("ep1").getTransformers().get(0); assertNotNull(transformer1); assertEquals(FileToByteArray.class, transformer1.getClass()); Object transformer2 = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("ep2").getTransformers().get(0); assertNotNull(transformer2); assertEquals(FileToString.class, transformer2.getClass()); } public void testFileFilter() throws Exception { Service service = muleContext.getRegistry().lookupService("Test"); assertNotNull(service); List endpoints = service.getInboundRouter().getEndpoints(); assertEquals(1, endpoints.size()); InboundEndpoint endpoint = (InboundEndpoint) endpoints.get(0); Filter filter = endpoint.getFilter(); assertNotNull(filter); assertTrue(filter instanceof FilenameRegexFilter); final FilenameRegexFilter f = (FilenameRegexFilter) filter; assertEquals(false, f.isCaseSensitive()); assertEquals("(^SemDirector_Report-\\d)(.*)(tab$)", f.getPattern()); } }mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileEndpointTestCase.java0000644000175000017500000000652110745677442031534 0ustar charlescharles/* * $Id: FileEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class FileEndpointTestCase extends AbstractMuleTestCase { private EndpointURI newMuleEndpointURI(String text) throws Exception { MuleEndpointURI uri = new MuleEndpointURI(text); uri.initialise(); return uri; } public void testFileUrl() throws Exception { EndpointURI url = newMuleEndpointURI("file:///C:/temp?endpointName=fileEndpoint"); assertEquals("file", url.getScheme()); assertEquals("/C:/temp", url.getAddress()); assertNotNull(url.getEndpointName()); assertEquals("fileEndpoint", url.getEndpointName()); assertEquals(-1, url.getPort()); assertEquals("file:///C:/temp?endpointName=fileEndpoint", url.toString()); assertEquals("endpointName=fileEndpoint", url.getQuery()); assertEquals(1, url.getParams().size()); } public void testFileUrlWithoutDrive() throws Exception { EndpointURI url = newMuleEndpointURI("file://temp?endpointName=fileEndpoint"); assertEquals("file", url.getScheme()); assertEquals("temp", url.getAddress()); assertNotNull(url.getEndpointName()); assertEquals("fileEndpoint", url.getEndpointName()); assertEquals(-1, url.getPort()); assertEquals("file://temp?endpointName=fileEndpoint", url.toString()); assertEquals("endpointName=fileEndpoint", url.getQuery()); assertEquals(1, url.getParams().size()); } public void testRelativeFileUriParentDir() throws Exception { String muleURI = "file://../test-data/in"; EndpointURI url = newMuleEndpointURI(muleURI); assertEquals("../test-data/in", url.getAddress()); } public void testRelativeFileUriCurrentDir() throws Exception { String muleURI = "file://./test-data/in"; EndpointURI url = newMuleEndpointURI(muleURI); assertEquals("./test-data/in", url.getAddress()); } public void testWinNetworkUri() throws Exception { String muleURI = "file:////192.168.0.1/test/"; EndpointURI url = newMuleEndpointURI(muleURI); assertEquals("//192.168.0.1/test/", url.getAddress()); } public void testRelativeFileUriAsParameter() throws Exception { EndpointURI url = newMuleEndpointURI("file://?address=./temp&endpointName=fileEndpoint"); assertEquals("file", url.getScheme()); assertEquals("./temp", url.getAddress()); assertNotNull(url.getEndpointName()); assertEquals("fileEndpoint", url.getEndpointName()); assertEquals(-1, url.getPort()); assertEquals("file://?address=./temp&endpointName=fileEndpoint", url.toString()); assertEquals("address=./temp&endpointName=fileEndpoint", url.getQuery()); assertEquals(2, url.getParams().size()); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileRequestorMoveDeleteTestCase.javamule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileRequestorMoveDeleteTestCase.jav0000644000175000017500000001535610776717104033556 0ustar charlescharles/* * $Id: FileRequestorMoveDeleteTestCase.java 11532 2008-04-08 16:33:08Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MessagingException; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.model.streaming.DelegatingInputStream; import org.mule.module.client.MuleClient; import org.mule.transport.DefaultMessageAdapter; import org.mule.util.IOUtils; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; public class FileRequestorMoveDeleteTestCase extends AbstractFileMoveDeleteTestCase { public void testMoveAndDeleteStreaming() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, true, true, true, null); assertRequested(request(inFile), inFile, true); assertFiles(inFile, moveToDir, true, true); } public void testMoveOnlyStreaming() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, true, true, false, null); assertRequested(request(inFile), inFile, true); assertFiles(inFile, moveToDir, true, false); } public void testDeleteOnlyStreaming() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, true, false, true, null); assertRequested(request(inFile), inFile, true); assertFiles(inFile, moveToDir, false, true); } public void testNoMoveNoDeleteStreaming() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, true, false, false, null); assertRequested(request(inFile), inFile, true); assertFiles(inFile, moveToDir, false, false); } public void testMoveAndDelete() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, true, true, null); assertRequested(request(inFile), inFile, false); assertFiles(inFile, moveToDir, true, true); } public void testMoveOnly() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, true, false, null); assertRequested(request(inFile), inFile, false); assertFiles(inFile, moveToDir, true, false); } public void testDeleteOnly() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, false, true, null); assertRequested(request(inFile), inFile, false); assertFiles(inFile, moveToDir, false, true); } public void testNoMoveNoDelete() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, false, false, null); assertRequested(request(inFile), inFile, false); assertFiles(inFile, moveToDir, false, false); } public void testMoveAndDeleteFilePayload() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, true, false, FileMessageAdapter.class); // TODO MULE-3198 // assertRequested(request(inFile), inFile, false); // assertFiles(inFile, moveToDir, true, true); } public void testMoveOnlyFilePayload() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, true, false, FileMessageAdapter.class); // TODO MULE-3198 // assertRequested(request(inFile), inFile, false); // assertFiles(inFile, moveToDir, true, false); } public void testDeleteOnlyFilePayload() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, false, true, FileMessageAdapter.class); // TODO MULE-3198 // assertRequested(request(inFile), inFile, false); // assertFiles(inFile, moveToDir, false, true); } public void testNoMoveNoDeleteFilePayload() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, false, false, FileMessageAdapter.class); // TODO MULE-3198 // assertRequested(request(inFile), inFile, false); assertFiles(inFile, moveToDir, false, false); } protected void assertRequested(MuleMessage message, File inFile, boolean streaming) throws IOException, MessagingException, InterruptedException { // Allow time for deletes/moves, so we can then assert to check files that // shouldn't havn't been moved havn't Thread.sleep(2000); assertNotNull(message); assertNotNull(message.getAdapter()); assertEquals(inFile.getName(), message.getAdapter().getProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME)); if (streaming) { // Adaptor gets wrapped by requester because FileMessageAdaptor does not // implement MutableMessageAdaptor assertEquals(DefaultMessageAdapter.class, message.getAdapter().getClass()); } else { assertEquals(FileContentsMessageAdapter.class, message.getAdapter().getClass()); } assertNotNull(message.getPayload()); if (streaming) { // We can't check ReceiverFileInputStream is received because it is // wrapped in a DelegatingInputStream assertTrue(message.getPayload() instanceof DelegatingInputStream); InputStream fis = (InputStream) message.getPayload(); ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); IOUtils.copy(fis, byteOut); // close() not called yet, nothing should have been deleted or moved yet assertFilesUntouched(inFile); fis.close(); String result = new String(byteOut.toByteArray()); assertEquals(TEST_MESSAGE, result); } else { assertTrue(message.getPayload() instanceof byte[]); assertEquals(TEST_MESSAGE, new String((byte[]) message.getPayload())); } } protected MuleMessage request(File file) throws MuleException, MalformedURLException { MuleClient muleClient = new MuleClient(); return muleClient.request(fileToUrl(file) + "?connector=moveDeleteConnector", 2000); } } mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/transformers/0000755000175000017500000000000011351410635027355 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/transformers/FileToStringTestCase.javamule-2.0.1/transports/file/src/test/java/org/mule/transport/file/transformers/FileToStringTestCase.j0000644000175000017500000000564510754365306033561 0ustar charlescharles/* * $Id: FileToStringTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file.transformers; import org.mule.api.transformer.TransformerException; import org.mule.api.transformer.Transformer; import org.mule.transformer.AbstractTransformerTestCase; import org.mule.transport.file.transformers.FileToString; import org.mule.util.FileUtils; import org.mule.util.SystemUtils; import java.io.File; import java.io.FileWriter; /** * Test case for FileToString transformer */ public class FileToStringTestCase extends AbstractTransformerTestCase { FileToString _fts; File _testData = null; final String _resultData = "The dog is on the table, where's the dog?"; /* * (non-Javadoc) * * @see org.mule.tck.AbstractTransformerTestCase#doSetUp() */ protected void doSetUp() throws Exception { super.doSetUp(); _testData = FileUtils.newFile(SystemUtils.JAVA_IO_TMPDIR, "FileToStringTestData"); FileWriter fw = new FileWriter(_testData); fw.write(_resultData); fw.close(); } /* * (non-Javadoc) * * @see org.mule.tck.AbstractTransformerTestCase#doTearDown() */ protected void doTearDown() throws Exception { assertTrue(_testData.delete()); super.doTearDown(); } /* * (non-Javadoc) * * @see org.mule.tck.AbstractTransformerTestCase#getResultData() */ public Object getResultData() { return _resultData; } /* * (non-Javadoc) * * @see org.mule.tck.AbstractTransformerTestCase#getRoundTripTransformer() */ public Transformer getRoundTripTransformer() throws Exception { return null; } /* * (non-Javadoc) * * @see org.mule.tck.AbstractTransformerTestCase#getTestData() */ public Object getTestData() { return _testData; } /* * (non-Javadoc) * * @see org.mule.tck.AbstractTransformerTestCase#getTransformer() */ public Transformer getTransformer() throws Exception { return new FileToString(); } /** * Transform with a wrong encoding should result in an Exception to be thrown */ public void testTransformExcEnc() throws Exception { try { FileToString fts = (FileToString)getTransformer(); fts.doTransform(getTestData(), "NO-SUCH_ENCODING"); fail("Should fail when the specified encoding is not supported"); } catch (TransformerException tfe) { // Expected } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/AbstractFileFunctionalTestCase.javamule-2.0.1/transports/file/src/test/java/org/mule/transport/file/AbstractFileFunctionalTestCase.java0000644000175000017500000000575310763522057033537 0ustar charlescharles/* * $Id: AbstractFileFunctionalTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MuleMessage; import org.mule.tck.FunctionalTestCase; import org.mule.util.FileUtils; import org.mule.util.IOUtils; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileWriter; import java.io.InputStream; import java.io.Writer; import java.net.MalformedURLException; /** * We are careful here to access the file system in a generic way. This means setting * directories dynamically. */ public abstract class AbstractFileFunctionalTestCase extends FunctionalTestCase { public static final String TEST_MESSAGE = "Test file contents"; public static final String TARGET_FILE = "TARGET_FILE"; private File tmpDir; protected String getConfigResources() { return "file-functional-test.xml"; } protected String fileToUrl(File file) throws MalformedURLException { return file.getAbsoluteFile().toURI().toURL().toString(); } // annoying but necessary wait apparently due to OS caching? protected void waitForFileSystem() throws Exception { synchronized (this) { wait(1000); } } protected File initForRequest() throws Exception { tmpDir = File.createTempFile("mule-file-test-", "-dir"); tmpDir.delete(); tmpDir.mkdir(); tmpDir.deleteOnExit(); File target = File.createTempFile("mule-file-test-", ".txt", tmpDir); Writer out = new FileWriter(target); out.write(TEST_MESSAGE); out.close(); target.deleteOnExit(); // define the readFromDirectory on the connector FileConnector connector = (FileConnector) muleContext.getRegistry().lookupConnector( "receiveConnector"); connector.setReadFromDirectory(tmpDir.getAbsolutePath()); logger.debug("Directory is " + connector.getReadFromDirectory()); waitForFileSystem(); return target; } protected void checkReceivedMessage(MuleMessage message) throws Exception { assertNotNull(message); assertNotNull(message.getPayload()); assertTrue(message.getPayload() instanceof InputStream); InputStream fis = (InputStream) message.getPayload(); ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); IOUtils.copy(fis, byteOut); fis.close(); String result = new String(byteOut.toByteArray()); assertEquals(TEST_MESSAGE, result); } protected void doTearDown() throws Exception { super.doTearDown(); FileUtils.deleteTree(tmpDir); } } mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/DummyFilenameParser.java0000644000175000017500000000132410745677442031425 0ustar charlescharles/* * $Id: DummyFilenameParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.transport.MessageAdapter; import org.mule.transport.file.FilenameParser; public class DummyFilenameParser implements FilenameParser { public String getFilename(MessageAdapter adapter, String pattern) { return null; } } mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileConnectorTestCase.java0000644000175000017500000001072510770356575031706 0ustar charlescharles/* * $Id: FileConnectorTestCase.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.util.FileUtils; import java.io.File; public class FileConnectorTestCase extends AbstractConnectorTestCase { static final long POLLING_FREQUENCY = 1234; static final long POLLING_FREQUENCY_OVERRIDE = 4321; private File validMessage; // @Override protected void doSetUp() throws Exception { super.doSetUp(); // The working directory is deleted on tearDown File tempDir = FileUtils.newFile(muleContext.getConfiguration().getWorkingDirectory(), "tmp"); if (!tempDir.exists()) { tempDir.mkdirs(); } validMessage = File.createTempFile("simple", ".mule", tempDir); assertNotNull(validMessage); FileUtils.writeStringToFile(validMessage, "validMessage"); } // @Override protected void doTearDown() throws Exception { // TestConnector dispatches events via the test: protocol to test://test // endpoints, which seems to end up in a directory called "test" :( FileUtils.deleteTree(FileUtils.newFile(getTestConnector().getProtocol())); super.doTearDown(); } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractConnectorTestCase#createConnector() */ public Connector createConnector() throws Exception { Connector connector = new FileConnector(); connector.setName("testFile"); return connector; } public String getTestEndpointURI() { return "file://" + muleContext.getConfiguration().getWorkingDirectory(); } public Object getValidMessage() throws Exception { return validMessage; } // /** // * Test polling frequency set on a connector. // */ // public void testConnectorPollingFrequency() throws Exception // { // FileConnector connector = (FileConnector)getConnector(); // connector.setPollingFrequency(POLLING_FREQUENCY); // // Endpoint endpoint = getTestEndpoint("simple", ImmutableEndpoint.ENDPOINT_TYPE_RECEIVER); // Service service = getTestComponent(descriptor); // MessageReceiver receiver = connector.createReceiver(service, endpoint); // assertEquals("Connector's polling frequency must not be ignored.", POLLING_FREQUENCY, // ((FileMessageReceiver)receiver).getFrequency()); // } // // /** // * Test polling frequency overridden at an endpoint level. // */ // public void testPollingFrequencyEndpointOverride() throws Exception // { // FileConnector connector = (FileConnector)getConnector(); // // set some connector-level value which we are about to override // connector.setPollingFrequency(-1); // // Endpoint endpoint = getTestEndpoint("simple", ImmutableEndpoint.ENDPOINT_TYPE_RECEIVER); // // Properties props = new Properties(); // // Endpoint wants String-typed properties // props.put(FileConnector.PROPERTY_POLLING_FREQUENCY, String.valueOf(POLLING_FREQUENCY_OVERRIDE)); // endpoint.setProperties(props); // // Service service = getTestComponent(descriptor); // MessageReceiver receiver = connector.createReceiver(service, endpoint); // assertEquals("Polling frequency endpoint override must not be ignored.", POLLING_FREQUENCY_OVERRIDE, // ((FileMessageReceiver)receiver).getFrequency()); // } public void testOnlySingleDispatcherPerEndpoint() { // MULE-1773 implies that we must only have one dispatcher per endpoint FileConnector connector = (FileConnector) getConnector(); assertEquals(1, connector.getMaxDispatchersActive()); try { connector.setMaxDispatchersActive(2); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException iax) { // OK - expected } // value must be unchanged assertEquals(1, connector.getMaxDispatchersActive()); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileReceiverMoveDeleteTestCase.javamule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileReceiverMoveDeleteTestCase.java0000644000175000017500000002113510776717104033462 0ustar charlescharles/* * $Id: FileReceiverMoveDeleteTestCase.java 11532 2008-04-08 16:33:08Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.service.Service; import org.mule.api.transformer.TransformerException; import org.mule.component.DefaultJavaComponent; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.endpoint.URIBuilder; import org.mule.model.seda.SedaService; import org.mule.object.SingletonObjectFactory; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.transformer.NoActionTransformer; import org.mule.util.concurrent.Latch; import java.io.File; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class FileReceiverMoveDeleteTestCase extends AbstractFileMoveDeleteTestCase { public void testMoveAndDeleteStreaming() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, true, true, true, null); assertRecevied(configureService(inFile, true, false)); assertFiles(inFile, moveToDir, true, true); } public void testMoveOnlyStreaming() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, true, true, false, null); assertRecevied(configureService(inFile, true, false)); assertFiles(inFile, moveToDir, true, false); } public void testDeleteOnlyStreaming() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, true, false, true, null); assertRecevied(configureService(inFile, true, false)); assertFiles(inFile, moveToDir, false, true); } public void testNoMoveNoDeleteStreaming() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, true, false, false, null); assertRecevied(configureService(inFile, true, false)); assertFiles(inFile, moveToDir, false, false); } public void testMoveAndDelete() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, true, true, null); assertRecevied(configureService(inFile, false, false)); assertFiles(inFile, moveToDir, true, true); } public void testMoveOnly() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, true, false, null); assertRecevied(configureService(inFile, false, false)); assertFiles(inFile, moveToDir, true, false); } public void testDeleteOnly() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, false, true, null); assertRecevied(configureService(inFile, false, false)); assertFiles(inFile, moveToDir, false, true); } public void testNoMoveNoDelete() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, false, false, null); assertRecevied(configureService(inFile, false, false)); assertFiles(inFile, moveToDir, false, false); } public void testMoveAndDeleteFilePayload() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, true, false, FileMessageAdapter.class); // TODO MULE-3198 // assertRecevied(configureService(inFile, false, true)); // assertFiles(inFile, moveToDir, true, true); } public void testMoveOnlyFilePayload() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, true, false, FileMessageAdapter.class); // TODO MULE-3198 // assertRecevied(configureService(inFile, false, true)); // assertFiles(inFile, moveToDir, true, false); } public void testDeleteOnlyFilePayload() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, false, true, FileMessageAdapter.class); // TODO MULE-3198 // assertRecevied(configureService(inFile, false, true)); // assertFiles(inFile, moveToDir, false, true); } public void testNoMoveNoDeleteFilePayload() throws Exception { File inFile = initForRequest(); File moveToDir = configureConnector(inFile, false, false, false, FileMessageAdapter.class); // TODO MULE-3198 // assertRecevied(configureService(inFile, false, true)); assertFiles(inFile, moveToDir, false, false); } protected Latch configureService(File inFile, boolean streaming, boolean filePayload) throws Exception { Service s = new SedaService(); s.setName("moveDeleteBridgeService"); String url = fileToUrl(inFile.getParentFile()) + "?connector=moveDeleteConnector"; org.mule.api.transformer.Transformer transformer = null; if (streaming) { if (filePayload) { fail("Inconsistant test case: streaming and file payload are not compatible"); } else { transformer = new FileMessageAdaptorAssertingTransformer(FileMessageAdapter.class, ReceiverFileInputStream.class); } } else { if (filePayload) { transformer = new FileMessageAdaptorAssertingTransformer(FileMessageAdapter.class, File.class); } else { transformer = new FileMessageAdaptorAssertingTransformer(FileContentsMessageAdapter.class, byte[].class); } } EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(new URIBuilder(url), muleContext); endpointBuilder.addTransformer(transformer); if (filePayload) { endpointBuilder.addTransformer(new NoActionTransformer()); } endpointBuilder.setSynchronous(true); s.getInboundRouter().addEndpoint( muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(endpointBuilder)); final Latch latch = new Latch(); FunctionalTestComponent component = new FunctionalTestComponent(); component.setEventCallback(new EventCallback() { public void eventReceived(final MuleEventContext context, final Object message) throws Exception { assertEquals(1, latch.getCount()); latch.countDown(); assertEquals(TEST_MESSAGE, context.transformMessageToString()); } }); component.initialise(); s.setComponent(new DefaultJavaComponent(new SingletonObjectFactory(component))); s.setModel(muleContext.getRegistry().lookupSystemModel()); muleContext.getRegistry().registerService(s); s.start(); return latch; } protected void assertRecevied(Latch latch) throws Exception { assertTrue(latch != null && latch.await(2000, TimeUnit.MILLISECONDS)); } private class FileMessageAdaptorAssertingTransformer extends AbstractMessageAwareTransformer { private Class expectedMessageAdaptor; private Class expectedPayload; public FileMessageAdaptorAssertingTransformer(Class expectedMessageAdaptor, Class expectedPayload) { this.expectedMessageAdaptor = expectedMessageAdaptor; this.expectedPayload = expectedPayload; } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { assertEquals(expectedMessageAdaptor, message.getAdapter().getClass()); assertEquals(expectedPayload, message.getAdapter().getPayload().getClass()); // If we are streaming, copy/delete shouldn't have happened yet if (expectedMessageAdaptor.equals(FileMessageAdapter.class)) { assertFilesUntouched(((FileMessageAdapter) message.getAdapter()).file); } return message; } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/AbstractFileMoveDeleteTestCase.javamule-2.0.1/transports/file/src/test/java/org/mule/transport/file/AbstractFileMoveDeleteTestCase.java0000644000175000017500000000460710776717104033466 0ustar charlescharles/* * $Id: AbstractFileMoveDeleteTestCase.java 11532 2008-04-08 16:33:08Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.Map; import org.apache.commons.collections.map.HashedMap; public abstract class AbstractFileMoveDeleteTestCase extends AbstractFileFunctionalTestCase { protected File configureConnector(File inFile, boolean stream, boolean move, boolean delete, Class messageAdaptor) throws Exception { FileConnector fc = new FileConnector(); if (messageAdaptor != null) { Map overrides = new HashedMap(); overrides.put("message.adapter", messageAdaptor.getName()); fc.setServiceOverrides(overrides); } fc.setName("moveDeleteConnector"); File moveToDir = new File(inFile.getParent() + "/moveto/"); moveToDir.mkdir(); muleContext.getRegistry().registerConnector(fc); if (move) { fc.setMoveToDirectory(moveToDir.getPath()); } fc.setAutoDelete(delete); fc.setStreaming(stream); return moveToDir; } protected void assertFiles(File inFile, File moveToDir, boolean move, boolean delete) throws Exception { waitForFileSystem(); boolean inFileShouldExst = !delete && !move; assertTrue(inFile.exists() == inFileShouldExst); if (inFileShouldExst) { assertEquals(TEST_MESSAGE, new BufferedReader(new FileReader(inFile)).readLine()); } File movedFile = new File(moveToDir.getPath() + "/" + inFile.getName()); assertTrue(movedFile.exists() == move); if (move) { assertEquals(TEST_MESSAGE, new BufferedReader(new FileReader(movedFile)).readLine()); } } protected void assertFilesUntouched(File inFile) { assertTrue(inFile.exists()); File movedFile = new File(inFile.getParent() + "/moveto/" + inFile.getName()); assertFalse(movedFile.exists()); } } mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/SimpleFilenameParserTestCase.java0000644000175000017500000000703610745677442033225 0ustar charlescharles/* * $Id: SimpleFilenameParserTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.transport.MessageAdapter; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.DefaultMessageAdapter; import org.mule.transport.file.FileConnector; import org.mule.transport.file.SimpleFilenameParser; /** * Test the syntax of the SimpleFilename parser */ public class SimpleFilenameParserTestCase extends AbstractMuleTestCase { private SimpleFilenameParser parser; private MessageAdapter adapter; protected void doSetUp() throws Exception { super.doSetUp(); parser = new SimpleFilenameParser(); adapter = new DefaultMessageAdapter("hello"); adapter.setProperty("foo", "bar"); adapter.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, "originalName"); adapter.setProperty(FileConnector.PROPERTY_FILENAME, "newName"); } public void testAntStyleParsing() { String result = parser.getFilename(adapter, "Test1_${COUNT}.txt"); assertEquals("Test1_0.txt", result); result = parser.getFilename(adapter, "Test2_${DATE:yyMMdd}.txt"); assertEquals(16, result.length()); result = parser.getFilename(adapter, "Test3_${DATE}.txt"); assertEquals(31, result.length()); result = parser.getFilename(adapter, "Test4_${SYSTIME}.txt"); assertFalse(result.equals("Test4_${SYSTIME}.txt")); result = parser.getFilename(adapter, "Test5_${UUID}.txt"); assertFalse(result.equals("Test5_${UUID}.txt")); result = parser.getFilename(adapter, "Test6_${COUNT}.txt"); assertEquals("Test6_1.txt", result); result = parser.getFilename(adapter, "Test7_${ORIGINALNAME}.txt"); assertEquals("Test7_originalName.txt", result); result = parser.getFilename(adapter, "Test8_${foo}.txt"); assertEquals("Test8_bar.txt", result); result = parser.getFilename(adapter, "Test9_${xxx}.txt"); assertEquals("Test9_${xxx}.txt", result); } public void testSquareStyleParsing() { String result = parser.getFilename(adapter, "Test1_[COUNT].txt"); assertEquals("Test1_0.txt", result); result = parser.getFilename(adapter, "Test2_[DATE:yyMMdd].txt"); assertEquals("got result: " + result, 16, result.length()); result = parser.getFilename(adapter, "Test3_[DATE].txt"); assertEquals("got result: '" + result, 31, result.length()); result = parser.getFilename(adapter, "Test4_[SYSTIME].txt"); assertFalse(result.equals("Test4_[SYSTIME].txt")); result = parser.getFilename(adapter, "Test5_[UUID].txt"); assertFalse(result.equals("Test5_[UUID].txt")); result = parser.getFilename(adapter, "Test6_[COUNT].txt"); assertEquals("Test6_1.txt", result); result = parser.getFilename(adapter, "Test7_[ORIGINALNAME].txt"); assertEquals("Test7_originalName.txt", result); result = parser.getFilename(adapter, "Test8_[foo].txt"); assertEquals("Test8_bar.txt", result); result = parser.getFilename(adapter, "Test9_[xxx].txt"); assertEquals("Test9_[xxx].txt", result); } } mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileMessageReceiverTestCase.java0000644000175000017500000000376210757615756033034 0ustar charlescharles/* * $Id: FileMessageReceiverTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import org.mule.tck.MuleTestUtils; import org.mule.transport.AbstractMessageReceiverTestCase; import org.mule.util.FileUtils; import com.mockobjects.dynamic.Mock; import java.io.File; public class FileMessageReceiverTestCase extends AbstractMessageReceiverTestCase { File read = FileUtils.newFile("testcasedata/read"); File move = FileUtils.newFile("testcasedata/move"); Mock session = MuleTestUtils.getMockSession(); public void testReceiver() throws Exception { // FIX A bit hard testing receive from a unit simple as we need to reg // listener etc. // file endpoint functions tests for this } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageReceiverTestCase#getMessageReceiver() */ public MessageReceiver getMessageReceiver() throws Exception { endpoint.getConnector().start(); Mock mockComponent = new Mock(Service.class); mockComponent.expectAndReturn("getResponseRouter", null); read.deleteOnExit(); move.deleteOnExit(); return new FileMessageReceiver(endpoint.getConnector(), (Service)mockComponent.proxy(), endpoint, read.getAbsolutePath(), move.getAbsolutePath(), null, 1000); } public InboundEndpoint getEndpoint() throws Exception { return muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("file://./simple"); } } mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/filters/0000755000175000017500000000000011351410635026300 5ustar charlescharles././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/filters/FilenameRegexFilterTestCase.javamule-2.0.1/transports/file/src/test/java/org/mule/transport/file/filters/FilenameRegexFilterTestCase0000644000175000017500000000334110745677442033562 0ustar charlescharles/* * $Id: FilenameRegexFilterTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file.filters; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.file.filters.FilenameRegexFilter; public class FilenameRegexFilterTestCase extends AbstractMuleTestCase { public void testFilenameRegexFilter() { FilenameRegexFilter filter = new FilenameRegexFilter(); assertNull(filter.getPattern()); assertFalse(filter.accept("foo")); filter.setPattern("[0-9]*_test.csv"); assertNotNull(filter.getPattern()); filter.setCaseSensitive(true); assertNotNull(filter.getPattern()); filter.setPattern(null); assertNull(filter.getPattern()); filter.setPattern("[0-9]*_test.csv"); filter.setCaseSensitive(true); String fileNameMatch = "20060101_test.csv"; String fileNameNoMatch1 = "20060101_test_test.csv"; String fileNameNoMatch2 = "20060101_TEST.csv"; assertNotNull(filter.getPattern()); assertTrue(filter.accept(fileNameMatch)); assertFalse(filter.accept(fileNameNoMatch1)); assertFalse(filter.accept(fileNameNoMatch2)); filter.setCaseSensitive(false); assertTrue(filter.accept(fileNameMatch)); assertFalse(filter.accept(fileNameNoMatch1)); assertTrue(filter.accept(fileNameNoMatch2)); } } mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileComparatorTestCase.java0000644000175000017500000000466310766654216032065 0ustar charlescharles/* * $Id: FileComparatorTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MuleEventContext; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.util.FileUtils; import java.io.File; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class FileComparatorTestCase extends FunctionalTestCase { public static final String PATH = "./.mule/in/"; public static final String FILE_CONNECTOR_NAME = "fileConnector"; public static final int TIMEOUT = 50000; public static final String FILE_NAMES[] = {"first", "second"}; public static final String MODEL_NAME = "ESTest"; public static final String COMPONENT_NAME = "FolderTO"; public void testComparator() throws Exception { final CountDownLatch countDown = new CountDownLatch(2); EventCallback callback = new EventCallback() { public void eventReceived(MuleEventContext context, Object component) throws Exception { int index = (int) countDown.getCount() - 1; assertEquals(context.getMessage().getProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME), FILE_NAMES[index]); countDown.countDown(); } }; ((FunctionalTestComponent) getComponent(COMPONENT_NAME)).setEventCallback(callback); muleContext.getRegistry().lookupConnector(FILE_CONNECTOR_NAME).stop(); File f1 = FileUtils.newFile(PATH + FILE_NAMES[0]); assertTrue(f1.createNewFile()); Thread.sleep(1000); File f2 = FileUtils.newFile(PATH + FILE_NAMES[1]); assertTrue(f2.createNewFile()); Thread.sleep(1000); muleContext.getRegistry().lookupConnector(FILE_CONNECTOR_NAME).start(); assertTrue(countDown.await(TIMEOUT, TimeUnit.MILLISECONDS)); } protected String getConfigResources() { return "file-functional-config.xml"; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/AutoDeleteOnFileDispatcherReceiverTestCase.javamule-2.0.1/transports/file/src/test/java/org/mule/transport/file/AutoDeleteOnFileDispatcherReceiverT0000644000175000017500000000750410766204322033534 0ustar charlescharles/* * $Id: AutoDeleteOnFileDispatcherReceiverTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.transport.Connector; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.FileUtils; import java.io.File; import java.io.InputStream; public class AutoDeleteOnFileDispatcherReceiverTestCase extends AbstractMuleTestCase { private File validMessage; private String tempDirName = "input"; File tempDir; Connector connector; public void testAutoDeleteFalseOnDispatcher() throws Exception { ((FileConnector)connector).setAutoDelete(false); MuleEvent event = getTestEvent("TestData"); event = RequestContext.setEvent(event); MuleMessage message = RequestContext.getEventContext().requestEvent(getTestEndpointURI()+"/"+tempDirName+"?connector=FileConnector", 50000); // read the payload into a string so the file is deleted on InputStream.close() assertNotNull(message.getPayloadAsString()); File[] files = tempDir.listFiles(); assertTrue(files.length > 0); for (int i = 0; i < files.length; i++) { assertTrue(files[i].getName().equals(message.getProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME))); files[i].delete(); } } public void testAutoDeleteTrueOnDispatcher() throws Exception { ((FileConnector)connector).setAutoDelete(true); MuleEvent event = getTestEvent("TestData"); event = RequestContext.setEvent(event); MuleMessage message = RequestContext.getEventContext().requestEvent(getTestEndpointURI()+"/"+tempDirName, 50000); assertNotNull(message.getPayload()); assertTrue(message.getPayload() instanceof InputStream); // Auto-delete happens after FileInputStream.close() when streaming. Streaming is default. assertTrue(tempDir.listFiles().length > 0); ((InputStream) message.getPayload()).close(); // Give file-system some time (annoying but necessary wait apparently due to OS caching?) Thread.sleep(1000); assertTrue(tempDir.listFiles().length == 0); } protected void doSetUp() throws Exception { super.doSetUp(); // The working directory is deleted on tearDown tempDir = FileUtils.newFile(muleContext.getConfiguration().getWorkingDirectory(), tempDirName); tempDir.deleteOnExit(); if (!tempDir.exists()) { tempDir.mkdirs(); } validMessage = File.createTempFile("hello", ".txt", tempDir); assertNotNull(validMessage); connector = getConnector(); } protected void doTearDown() throws Exception { // TestConnector dispatches events via the test: protocol to test://test // endpoints, which seems to end up in a directory called "test" :( FileUtils.deleteTree(FileUtils.newFile(getTestConnector().getProtocol())); super.doTearDown(); } public Connector getConnector() throws Exception { Connector connector = new FileConnector(); connector.setName("FileConnector"); connector.setMuleContext(muleContext); muleContext.getRegistry().registerConnector(connector); return connector; } public String getTestEndpointURI() { return "file://" + muleContext.getConfiguration().getWorkingDirectory(); } }mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/issues/0000755000175000017500000000000011351410635026143 5ustar charlescharles././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/issues/IndirectReceiveMule1842TestCase.javamule-2.0.1/transports/file/src/test/java/org/mule/transport/file/issues/IndirectReceiveMule1842TestC0000644000175000017500000000334110757615756033264 0ustar charlescharles/* * $Id: IndirectReceiveMule1842TestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file.issues; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.module.client.MuleClient; import org.mule.transport.file.AbstractFileFunctionalTestCase; import java.io.File; /** * This used to be part of FileFunctionalTest; moved here to allow isolation of individual case. */ public class IndirectReceiveMule1842TestCase extends AbstractFileFunctionalTestCase { public void testIndirectRequest() throws Exception { File target = initForRequest(); // add a receiver endpoint that will poll the readFromDirectory Service relay = muleContext.getRegistry().lookupService("relay"); assertNotNull(relay); String url = fileToUrl(target) + "?connector=receiveConnector"; logger.debug(url); InboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(url); relay.getInboundRouter().addEndpoint(endpoint); relay.stop(); relay.start(); // then read from the queue that the polling receiver will write to MuleClient client = new MuleClient(); MuleMessage message = client.request("receive", 3000); checkReceivedMessage(message); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/ExpressionFilenameParserTestCase.javamule-2.0.1/transports/file/src/test/java/org/mule/transport/file/ExpressionFilenameParserTestCase.ja0000644000175000017500000000733710765015256033577 0ustar charlescharles/* * $Id: ExpressionFilenameParserTestCase.java 11295 2008-03-09 17:13:18Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.transport.MessageAdapter; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.DefaultMessageAdapter; import org.mule.transport.file.FileConnector; /** * Test the syntax of the SimpleFilename parser */ public class ExpressionFilenameParserTestCase extends AbstractMuleTestCase { private ExpressionFilenameParser parser; private MessageAdapter adapter; protected void doSetUp() throws Exception { super.doSetUp(); parser = new ExpressionFilenameParser(); adapter = new DefaultMessageAdapter("hello"); adapter.setProperty("foo", "bar"); adapter.setProperty(FileConnector.PROPERTY_ORIGINAL_FILENAME, "originalName"); adapter.setProperty(FileConnector.PROPERTY_FILENAME, "newName"); } public void testAntStyleParsing() { String result = parser.getFilename(adapter, "Test1_${function:count}.txt"); assertEquals("Test1_0.txt", result); result = parser.getFilename(adapter, "Test2_${function:datestamp-yyMMdd}.txt"); assertEquals(16, result.length()); result = parser.getFilename(adapter, "Test3_${function:datestamp}.txt"); assertEquals(31, result.length()); result = parser.getFilename(adapter, "Test4_${function:systime}.txt"); assertFalse(result.equals("Test4_${function:systime}.txt")); result = parser.getFilename(adapter, "Test5_${function:uuid}.txt"); assertFalse(result.equals("Test5_${function:uuid}.txt")); result = parser.getFilename(adapter, "Test6_${function:count}.txt"); assertEquals("Test6_1.txt", result); result = parser.getFilename(adapter, "Test7_${header:originalFilename}.txt"); assertEquals("Test7_originalName.txt", result); result = parser.getFilename(adapter, "Test8_${header:foo}.txt"); assertEquals("Test8_bar.txt", result); result = parser.getFilename(adapter, "Test9_${header:xxx}.txt"); assertEquals("Test9_${header:xxx}.txt", result); } public void testSquareStyleParsing() { String result = parser.getFilename(adapter, "Test1_[function:count].txt"); assertEquals("Test1_0.txt", result); result = parser.getFilename(adapter, "Test2_[function:dateStamp-yyMMdd].txt"); assertEquals("got result: " + result, 16, result.length()); result = parser.getFilename(adapter, "Test3_[function:dateStamp].txt"); assertEquals("got result: '" + result, 31, result.length()); result = parser.getFilename(adapter, "Test4_[function:systime].txt"); assertFalse(result.equals("Test4_[function:systime].txt")); result = parser.getFilename(adapter, "Test5_[function:uuid].txt"); assertFalse(result.equals("Test5_[function:uuid].txt")); result = parser.getFilename(adapter, "Test6_[function:count].txt"); assertEquals("Test6_1.txt", result); result = parser.getFilename(adapter, "Test7_[header:originalFilename].txt"); assertEquals("Test7_originalName.txt", result); result = parser.getFilename(adapter, "Test8_[header:foo].txt"); assertEquals("Test8_bar.txt", result); result = parser.getFilename(adapter, "Test9_[header:xxx].txt"); assertEquals("Test9_[header:xxx].txt", result); } }mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileMessageAdapterTestCase.java0000644000175000017500000000646310777454544032647 0ustar charlescharles/* * $Id: FileMessageAdapterTestCase.java 11559 2008-04-10 18:16:04Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.DefaultMuleMessage; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.api.transport.MessageAdapter; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.util.FileUtils; import java.io.File; import java.io.FileInputStream; import java.util.Arrays; public class FileMessageAdapterTestCase extends AbstractMessageAdapterTestCase { private File message; /* * (non-Javadoc) * * @see junit.framework.TestCase#setUp() */ protected void doSetUp() throws Exception { super.doSetUp(); // The working directory is deleted on tearDown File dir = FileUtils.newFile(muleContext.getConfiguration().getWorkingDirectory(), "tmp"); if (!dir.exists()) { dir.mkdirs(); } message = File.createTempFile("simple", ".mule", dir); } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#getValidMessage() */ public Object getValidMessage() { return message; } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#createAdapter() */ public MessageAdapter createAdapter(Object payload) throws MessagingException { return new FileMessageAdapter(payload); } public void testMessageRetrieval2() throws Exception { Object message = new ReceiverFileInputStream((File) getValidMessage(), false, null); MessageAdapter adapter = createAdapter(message); MuleMessage muleMessage = new DefaultMuleMessage(adapter); doTestMessageEqualsPayload(message, adapter.getPayload()); byte[] bytes = muleMessage.getPayloadAsBytes(); assertNotNull(bytes); String stringMessage = muleMessage.getPayloadAsString(); assertNotNull(stringMessage); assertNotNull(adapter.getPayload()); } protected void doTestMessageEqualsPayload(Object message, Object payload) throws Exception { if (message instanceof File) { File file = (File) message; assertTrue(payload instanceof File); assertEquals(file, payload); } else if (message instanceof FileInputStream) { byte[] messageBytes = null; byte[] payloadBytes = null; FileInputStream fis = (FileInputStream) message; FileInputStream payloadFis = (FileInputStream) payload; messageBytes = new byte[fis.available()]; payloadBytes = new byte[payloadFis.available()]; fis.read(messageBytes); payloadFis.read(payloadBytes); assertTrue(Arrays.equals(messageBytes, payloadBytes)); } else { fail("FileMessageAdaptor supports File or FileInputStream"); } } } mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/SecondDummyFilenameParser.java0000644000175000017500000000133710745677442032565 0ustar charlescharles/* * $Id: SecondDummyFilenameParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.transport.MessageAdapter; import org.mule.transport.file.FilenameParser; public class SecondDummyFilenameParser implements FilenameParser { public String getFilename(MessageAdapter adapter, String pattern) { return null; } }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/ConnectorServiceOverridesTestCase.javamule-2.0.1/transports/file/src/test/java/org/mule/transport/file/ConnectorServiceOverridesTestCase.j0000644000175000017500000001031110745677442033612 0ustar charlescharles/* * $Id: ConnectorServiceOverridesTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.tck.FunctionalTestCase; import org.mule.transformer.TransformerUtils; import org.mule.transformer.simple.ByteArrayToSerializable; import org.mule.transformer.simple.SerializableToByteArray; import org.mule.transport.AbstractConnector; import org.mule.transport.file.FileConnector; public class ConnectorServiceOverridesTestCase extends FunctionalTestCase { protected String getConfigResources() { return "test-connector-config.xml"; } public void testServiceOverrides() throws InterruptedException { FileConnector c = (FileConnector) muleContext.getRegistry().lookupConnector("fileConnector2"); assertNotNull(c); assertNotNull(c.getServiceOverrides()); assertEquals("org.mule.transformer.simple.ByteArrayToSerializable", c.getServiceOverrides().get( "inbound.transformer")); assertNotNull(TransformerUtils.firstOrNull(c.getDefaultInboundTransformers())); assertNotNull(TransformerUtils.firstOrNull(c.getDefaultOutboundTransformers())); assertTrue(TransformerUtils.firstOrNull(c.getDefaultInboundTransformers()) instanceof ByteArrayToSerializable); assertTrue(TransformerUtils.firstOrNull(c.getDefaultOutboundTransformers()) instanceof SerializableToByteArray); } public void testServiceOverrides2() throws InterruptedException { FileConnector c = (FileConnector) muleContext.getRegistry().lookupConnector("fileConnector1"); assertNotNull(c); assertNull(c.getServiceOverrides()); c = (FileConnector) muleContext.getRegistry().lookupConnector("fileConnector2"); assertNotNull(c); assertNotNull(c.getServiceOverrides()); c = (FileConnector) muleContext.getRegistry().lookupConnector("fileConnector3"); assertNotNull(c); assertNull(c.getServiceOverrides()); } public void testServiceOverrides3() throws InterruptedException, MuleException { // EndpointURI uri = new MuleEndpointURI("file:///temp?connector=fileConnector1"); ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "file:///temp?connector=fileConnector1"); assertNotNull(endpoint); assertNotNull(endpoint.getConnector()); assertNull(((AbstractConnector) endpoint.getConnector()).getServiceOverrides()); FileConnector c = (FileConnector) muleContext.getRegistry().lookupConnector("fileConnector2"); assertNotNull(c); assertNotNull(c.getServiceOverrides()); EndpointBuilder builder = new EndpointURIEndpointBuilder("file:///temp?connector=fileConnector1", muleContext); builder.setConnector(c); endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(builder); assertNotNull(((AbstractConnector) endpoint.getConnector()).getServiceOverrides()); EndpointBuilder builder2 = new EndpointURIEndpointBuilder("file:///temp?connector=fileConnector3", muleContext); builder.setConnector(c); endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(builder2); assertNull(((AbstractConnector) endpoint.getConnector()).getServiceOverrides()); EndpointBuilder builder3 = new EndpointURIEndpointBuilder("file:///temp?connector=fileConnector2", muleContext); builder.setConnector(c); endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(builder3); assertNotNull(((AbstractConnector) endpoint.getConnector()).getServiceOverrides()); } } mule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileFunctionalTestCase.java0000644000175000017500000000404110754375733032047 0ustar charlescharles/* * $Id: FileFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.transport.file.FileConnector; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.HashMap; import java.util.Map; /** * We are careful here to access the file sstem in a generic way. This means setting directories * dynamically. */ public class FileFunctionalTestCase extends AbstractFileFunctionalTestCase { public void testSend() throws Exception { File target = File.createTempFile("mule-file-test-", ".txt"); target.deleteOnExit(); FileConnector connector = (FileConnector) muleContext.getRegistry().lookupConnector("sendConnector"); connector.setWriteToDirectory(target.getParent()); logger.debug("Directory is " + connector.getWriteToDirectory()); Map props = new HashMap(); props.put(TARGET_FILE, target.getName()); logger.debug("File is " + props.get(TARGET_FILE)); MuleClient client = new MuleClient(); client.dispatch("send", TEST_MESSAGE, props); waitForFileSystem(); String result = new BufferedReader(new FileReader(target)).readLine(); assertEquals(TEST_MESSAGE, result); } public void testDirectRequest() throws Exception { File target = initForRequest(); MuleClient client = new MuleClient(); String url = fileToUrl(target) + "?connector=receiveConnector"; logger.debug(url); MuleMessage message = client.request(url, 100000); checkReceivedMessage(message); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileContentsMessageAdapterTestCase.javamule-2.0.1/transports/file/src/test/java/org/mule/transport/file/FileContentsMessageAdapterTestCase.0000644000175000017500000001002510770356575033506 0ustar charlescharles/* * $Id: FileContentsMessageAdapterTestCase.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.file; import org.mule.api.MessagingException; import org.mule.api.transport.MessageAdapter; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.util.FileUtils; import java.io.File; import java.util.Arrays; public class FileContentsMessageAdapterTestCase extends AbstractMessageAdapterTestCase { private String validMessageContent = "Yabbadabbadooo!"; private byte[] validMessage = validMessageContent.getBytes(); private File messageFile; /* * (non-Javadoc) * * @see junit.framework.TestCase#setUp() */ protected void doSetUp() throws Exception { super.doSetUp(); // The working directory is deleted on tearDown File dir = FileUtils.newFile(muleContext.getConfiguration().getWorkingDirectory(), "tmp"); if (!dir.exists()) { dir.mkdirs(); } messageFile = File.createTempFile("simple", ".mule", dir); FileUtils.writeStringToFile(messageFile, validMessageContent, null); } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#getValidMessage() */ public Object getValidMessage() { return validMessage; } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#createAdapter() */ public MessageAdapter createAdapter(Object payload) throws MessagingException { if (payload.equals(validMessage)) { return new FileContentsMessageAdapter(messageFile); } else { // properly throw return new FileContentsMessageAdapter(payload); } } // overridden to properly check the byte[] by content and not just by reference public void doTestMessageEqualsPayload(Object message, Object payload) throws Exception { if (message instanceof byte[] && payload instanceof byte[]) { assertTrue(Arrays.equals((byte[])message, (byte[])payload)); } else { fail("message and payload must both be byte[]"); } } public void testMessageContentsProperlyLoaded() throws Exception { // get new message adapter to test MessageAdapter adapter = new FileContentsMessageAdapter(messageFile); // delete the file before accessing the payload assertTrue(messageFile.delete()); // slight detour for testing :) doTestMessageEqualsPayload(validMessage, adapter.getPayload()); } /** * This is not a valid use case since Transport adapters are immutable, hence a new one should be created * for each messages */ // public void testMultipleSetMessageCalls() throws Exception // { // // get new message adapter to test // FileContentsMessageAdapter adapter = new FileContentsMessageAdapter(messageFile); // // // access first payload // doTestMessageEqualsPayload(validMessage, adapter.getPayload()); // // // create another source file // String secondMessageContent = "Hooray"; // byte[] secondMessage = secondMessageContent.getBytes(); // File secondFile = File.createTempFile("simple2", ".mule", messageFile.getParentFile()); // FileUtils.writeStringToFile(secondFile, secondMessageContent, null); // // // replace the first message content //This shouln't even be visible // adapter.setFileMessage(secondFile); // // // make sure the file was properly read // doTestMessageEqualsPayload(secondMessage, adapter.getPayload()); // } } mule-2.0.1/transports/file/src/test/resources/0000755000175000017500000000000011351410635021215 5ustar charlescharlesmule-2.0.1/transports/file/src/test/resources/file-namespace-config.xml0000644000175000017500000000424411003375564026064 0ustar charlescharles mule-2.0.1/transports/file/src/test/resources/test-connector-config.xml0000644000175000017500000000202310745677442026167 0ustar charlescharles mule-2.0.1/transports/file/src/test/resources/log4j.properties0000644000175000017500000000050410626131050024344 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages #log4j.logger.org.mule=DEBUG mule-2.0.1/transports/file/src/test/resources/file-functional-config.xml0000644000175000017500000000366311003270417026265 0ustar charlescharles mule-2.0.1/transports/file/src/test/resources/file-functional-test.xml0000644000175000017500000000365310763300436026005 0ustar charlescharles mule-2.0.1/transports/file/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006210757334735026104 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/transports/file/pom.xml0000644000175000017500000000562611006063605016761 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-file File Transport A Mule transport for File Connectivity. This transport allows files to be read and written to directories on the local file system. The transport can be configured to filter the file it reads and the way files are written, such as whether binary output is used or the file is appended to. org.apache.maven.plugins maven-jar-plugin test-jar org.mule mule-core ${version} org.mule.tests mule-tests-functional ${version} test org.mule.transports mule-transport-vm ${version} test org.mule.modules mule-module-client ${version} test osgi org.apache.felix maven-bundle-plugin file org.mule.transport.file.* mule-2.0.1/transports/jbpm/0000755000175000017500000000000011351410653015446 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/0000755000175000017500000000000011351410653016235 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/main/0000755000175000017500000000000011351410653017161 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/main/java/0000755000175000017500000000000011351410653020102 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/main/java/org/0000755000175000017500000000000011351410653020671 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/main/java/org/mule/0000755000175000017500000000000011351410653021633 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/0000755000175000017500000000000011351410653023667 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/0000755000175000017500000000000011351410653024445 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/0000755000175000017500000000000011351410653025375 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/Jbpm.java0000644000175000017500000003211010745677442027146 0ustar charlescharles/* * $Id: Jbpm.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm; import org.mule.transport.bpm.BPMS; import org.mule.transport.bpm.MessageService; import org.mule.util.IOUtils; import org.mule.util.NumberUtils; import java.io.IOException; import java.io.InputStream; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jbpm.JbpmConfiguration; import org.jbpm.JbpmContext; import org.jbpm.graph.def.ProcessDefinition; import org.jbpm.graph.exe.ProcessInstance; import org.jbpm.taskmgmt.exe.TaskInstance; /** * jBPM's implementation of Mule's generic BPMS interface. * This class should be set as the "bpms" property of the BPM Connector: * * * * * * * * * * * * * * */ public class Jbpm implements BPMS { protected static final Log logger = LogFactory.getLog(Jbpm.class); protected JbpmConfiguration jbpmConfiguration = null; /** * Indicates whether jBPM has been instantiated by the connector (false) or was passed * in from somewhere else (true). */ protected boolean containerManaged; // /////////////////////////////////////////////////////////////////////////// // Lifecycle methods // /////////////////////////////////////////////////////////////////////////// /** * Creates the Mule wrapper for jBPM using a default configuration. */ public Jbpm() { this(JbpmConfiguration.getInstance()); containerManaged = false; } /** * Creates the Mule BPM wrapper based on an already-initialized jBPM instance * * @param jbpmConfiguration - the already-initialized jBPM instance */ public Jbpm(JbpmConfiguration jbpmConfiguration) { setJbpmConfiguration(jbpmConfiguration); containerManaged = true; } public void destroy() { if (!containerManaged && jbpmConfiguration != null) { jbpmConfiguration.close(); jbpmConfiguration = null; } } public void setMessageService(MessageService msgService) { JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { MuleMessageService.setMessageService(msgService); } finally { jbpmContext.close(); } } // /////////////////////////////////////////////////////////////////////////// // Process manipulation // /////////////////////////////////////////////////////////////////////////// /** * Start a new process. * * @return the newly-created ProcessInstance */ public synchronized Object startProcess(Object processType) throws Exception { return startProcess(processType, /* transition */null, /* processVariables */null); } /** * Start a new process. * * @return the newly-created ProcessInstance */ public synchronized Object startProcess(Object processType, Object transition, Map processVariables) throws Exception { ProcessInstance processInstance; JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { ProcessDefinition processDefinition = jbpmContext.getGraphSession().findLatestProcessDefinition( (String) processType); if (processDefinition == null) { throw new IllegalArgumentException("No process definition found for process " + processType); } processInstance = new ProcessInstance(processDefinition); // Set any process variables. if (processVariables != null && !processVariables.isEmpty()) { processInstance.getContextInstance().addVariables(processVariables); } processInstance.getContextInstance().addVariables(processVariables); // Leave the start state. processInstance.signal(); jbpmContext.save(processInstance); return processInstance; } catch (Exception e) { jbpmContext.setRollbackOnly(); throw e; } finally { jbpmContext.close(); } } /** * Advance a process instance one step. * * @return the updated ProcessInstance */ public synchronized Object advanceProcess(Object processId) throws Exception { return advanceProcess(processId, /* transition */null, /* processVariables */null); } /** * Advance a process instance one step. * * @return the updated ProcessInstance */ public synchronized Object advanceProcess(Object processId, Object transition, Map processVariables) throws Exception { ProcessInstance processInstance; JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { // Look up the process instance from the database. processInstance = jbpmContext.getGraphSession() .loadProcessInstance(NumberUtils.toLong(processId)); if (processInstance.hasEnded()) { throw new IllegalStateException( "Process cannot be advanced because it has already terminated, processId = " + processId); } // Set any process variables. // Note: addVariables() will replace the old value of a variable if it // already exists. if (processVariables != null && !processVariables.isEmpty()) { processInstance.getContextInstance().addVariables(processVariables); } // Advance the workflow. if (transition != null) { processInstance.signal((String) transition); } else { processInstance.signal(); } // Save the process state back to the database. jbpmContext.save(processInstance); return processInstance; } catch (Exception e) { jbpmContext.setRollbackOnly(); throw e; } finally { jbpmContext.close(); } } /** * Update the variables for a process instance. * * @return the updated ProcessInstance */ public synchronized Object updateProcess(Object processId, Map processVariables) throws Exception { ProcessInstance processInstance; JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { // Look up the process instance from the database. processInstance = jbpmContext.getGraphSession() .loadProcessInstance(NumberUtils.toLong(processId)); // Set any process variables. // Note: addVariables() will replace the old value of a variable if it // already exists. if (processVariables != null && !processVariables.isEmpty()) { processInstance.getContextInstance().addVariables(processVariables); } // Save the process state back to the database. jbpmContext.save(processInstance); return processInstance; } catch (Exception e) { jbpmContext.setRollbackOnly(); throw e; } finally { jbpmContext.close(); } } /** * Delete a process instance. */ public synchronized void abortProcess(Object processId) throws Exception { JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { jbpmContext.getGraphSession().deleteProcessInstance(NumberUtils.toLong(processId)); } catch (Exception e) { jbpmContext.setRollbackOnly(); throw e; } finally { jbpmContext.close(); } } // /////////////////////////////////////////////////////////////////////////// // Process status / lookup // /////////////////////////////////////////////////////////////////////////// public boolean isProcess(Object obj) throws Exception { return (obj instanceof ProcessInstance); } public Object getId(Object process) throws Exception { return new Long(((ProcessInstance) process).getId()); } // By default the process is lazily-initialized so we need to open a new session to the // database before calling process.getRootToken().getNode().getName() public Object getState(Object process) throws Exception { ProcessInstance processInstance = (ProcessInstance) process; JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { // Look up the process instance from the database. processInstance = jbpmContext.getGraphSession() .loadProcessInstance(processInstance.getId()); return processInstance.getRootToken().getNode().getName(); } finally { jbpmContext.close(); } } public boolean hasEnded(Object process) throws Exception { return ((ProcessInstance) process).hasEnded(); } /** * Look up an already-running process instance. * * @return the ProcessInstance */ public Object lookupProcess(Object processId) throws Exception { ProcessInstance processInstance; JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { // Look up the process instance from the database. processInstance = jbpmContext.getGraphSession() .loadProcessInstance(NumberUtils.toLong(processId)); return processInstance; } finally { jbpmContext.close(); } } // /////////////////////////////////////////////////////////////////////////// // Miscellaneous // /////////////////////////////////////////////////////////////////////////// /** * Deploy a new process definition. */ public void deployProcess(String processDefinitionFile) throws IOException { deployProcessFromStream(IOUtils.getResourceAsStream(processDefinitionFile, getClass())); } public void deployProcessFromStream(InputStream processDefinition) throws IOException { deployProcess(ProcessDefinition.parseXmlInputStream(processDefinition)); } private void deployProcess(ProcessDefinition processDefinition) { JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { jbpmContext.deployProcessDefinition(processDefinition); } finally { jbpmContext.close(); } } public List/* */loadTasks(ProcessInstance process) { List/* */taskInstances; JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { taskInstances = jbpmContext.getTaskMgmtSession().findTaskInstancesByToken( process.getRootToken().getId()); return taskInstances; } finally { jbpmContext.close(); } } public synchronized void completeTask(TaskInstance task) { completeTask(task, /* transition */null); } public synchronized void completeTask(TaskInstance task, String transition) { JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); try { task = jbpmContext.getTaskMgmtSession().loadTaskInstance(task.getId()); if (transition != null) { task.end(transition); } else { task.end(); } } finally { jbpmContext.close(); } } // /////////////////////////////////////////////////////////////////////////// // Getters and setters // /////////////////////////////////////////////////////////////////////////// public JbpmConfiguration getJbpmConfiguration() { return jbpmConfiguration; } public void setJbpmConfiguration(JbpmConfiguration jbpmConfiguration) { this.jbpmConfiguration = jbpmConfiguration; } } mule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/MuleMessageService.java0000644000175000017500000000440010777653124032003 0ustar charlescharles/* * $Id: MuleMessageService.java 11566 2008-04-11 12:15:16Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm; import org.mule.api.MuleMessage; import java.util.Map; import org.apache.commons.lang.NotImplementedException; import org.jbpm.graph.exe.Token; import org.jbpm.job.Job; /** * jBPM has built-in support for messaging via the org.jbpm.msg.MessageService interface, * the idea being that one can plug in a JMS implementation and send messages from a process * using a standard "" construct. * * If Mule were to implement this interface, one could make Mule the standard MessageService * instead of JMS, which would make the Mule/jBPM integration more "seamless". * * This is an unfinished work, see MULE-1219 */ public class MuleMessageService implements org.jbpm.msg.MessageService { private static final long serialVersionUID = 1L; protected static org.mule.transport.bpm.MessageService proxy; public MuleMessageService() { super(); } public static void setMessageService(org.mule.transport.bpm.MessageService msgService) { proxy = msgService; } // TODO This should be replaced by the standard send() method below, which would // make Mule the default messaging service within jBpm. public MuleMessage generateMessage(String endpoint, Object payloadObject, Map messageProperties, boolean synchronous) throws Exception { return proxy.generateMessage(endpoint, payloadObject, messageProperties, synchronous); } public void send(Job job) { throw new NotImplementedException("MULE-1219"); } public void suspendMessages(Token token) { // no-op } public void resumeMessages(Token token) { // no-op } public void close() { // nop-op } } mule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/MuleMessage.java0000644000175000017500000000153110777653124030464 0ustar charlescharles/* * $Id: MuleMessage.java 11566 2008-04-11 12:15:16Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm; import org.apache.commons.lang.NotImplementedException; import org.jbpm.JbpmContext; import org.jbpm.job.Job; /** * This is an unfinished work, see MULE-1219 */ public class MuleMessage extends Job { private static final long serialVersionUID = 1L; public boolean execute(JbpmContext jbpmContext) throws Exception { throw new NotImplementedException("MULE-1219"); } } mule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/0000755000175000017500000000000011351410653027035 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/ValidateMessageType.javamule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/ValidateMessageType.jav0000644000175000017500000000370010745677442033460 0ustar charlescharles/* * $Id: ValidateMessageType.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm.actions; import org.mule.util.ClassUtils; import org.jbpm.JbpmException; import org.jbpm.graph.exe.ExecutionContext; /** * Throws an exception if the incoming message's class is not as expected. * * * com.mycompany.MyClass * * * @param expectedType the expected class type * @param strict if true, the class must match exactly, otherwise it can be a subclass * @throws JbpmException */ public class ValidateMessageType extends IntegrationActionHandler { private static final long serialVersionUID = 1L; protected String expectedType; protected boolean strict = false; public void execute(ExecutionContext executionContext) throws Exception { super.execute(executionContext); Object message = getIncomingMessage(); if (message == null) { throw new JbpmException("Incoming message is null."); } Class expectedClass = ClassUtils.loadClass(expectedType, this.getClass()); boolean match; if (strict) { match = message.getClass().equals(expectedClass); } else { match = expectedClass.isAssignableFrom(message.getClass()); } if (!match) { throw new JbpmException("Incoming message type is " + message.getClass() + ", expected type is " + expectedType); } } } mule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/Continue.java0000644000175000017500000000153610745677442031512 0ustar charlescharles/* * $Id: Continue.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm.actions; import org.jbpm.graph.def.ActionHandler; import org.jbpm.graph.exe.ExecutionContext; /** * Simply continues the process execution (moves on to the next state). */ public class Continue implements ActionHandler { private static final long serialVersionUID = 1L; public void execute(ExecutionContext executionContext) throws Exception { executionContext.leaveNode(); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/LoggingActionHandler.javamule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/LoggingActionHandler.ja0000644000175000017500000000237510745677442033423 0ustar charlescharles/* * $Id: LoggingActionHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm.actions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jbpm.graph.def.ActionHandler; import org.jbpm.graph.exe.ExecutionContext; public abstract class LoggingActionHandler implements ActionHandler { protected transient Log logger = LogFactory.getLog(getClass()); public void execute(ExecutionContext executionContext) throws Exception { if (logger.isDebugEnabled()) { String currentNode = "???"; if (executionContext.getNode() != null) { currentNode = executionContext.getNode().getFullyQualifiedName(); } logger.debug("Executing action " + this.getClass().getName() + " from state \"" + currentNode + "\""); } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/SendMuleEventAndContinue.javamule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/SendMuleEventAndContinu0000644000175000017500000000263310745677442033506 0ustar charlescharles/* * $Id: SendMuleEventAndContinue.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm.actions; import org.mule.transport.bpm.ProcessConnector; import org.jbpm.graph.exe.ExecutionContext; /** * Sends a Mule message to the specified endpoint and continues execution to the next * state. This class assumes the current state has only one leaving transition. * * @param url - the Mule endpoint * @param transformers - any transformers to be applied * @param payload - specify the payload as a string directly in the jPDL * @param payloadSource - process variable from which to generate the message * payload, defaults to {@link ProcessConnector.PROCESS_VARIABLE_DATA} * @param messageProperties - any properties to be applied to the message */ public class SendMuleEventAndContinue extends SendMuleEvent { private static final long serialVersionUID = 1L; public void execute(ExecutionContext executionContext) throws Exception { super.execute(executionContext); executionContext.leaveNode(); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/IntegrationActionHandler.javamule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/IntegrationActionHandle0000644000175000017500000000173310745677442033542 0ustar charlescharles/* * $Id: IntegrationActionHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm.actions; import org.mule.transport.bpm.ProcessConnector; import org.jbpm.graph.exe.ExecutionContext; public abstract class IntegrationActionHandler extends LoggingActionHandler { private Object incoming; public void execute(ExecutionContext executionContext) throws Exception { super.execute(executionContext); incoming = executionContext.getVariable(ProcessConnector.PROCESS_VARIABLE_INCOMING); } protected Object getIncomingMessage() { return incoming; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/ValidateMessageSource.javamule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/ValidateMessageSource.j0000644000175000017500000000350310745677442033451 0ustar charlescharles/* * $Id: ValidateMessageSource.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm.actions; import org.mule.transport.bpm.ProcessConnector; import org.jbpm.JbpmException; import org.jbpm.graph.exe.ExecutionContext; /** * Throws an exception if the message's source is not as expected. * * * ERPGateway * * * http://localhost:8080/incoming * * * @param expectedSource can be the expected endpoint's "name" or "address" * @throws JbpmException */ public class ValidateMessageSource extends LoggingActionHandler { private static final long serialVersionUID = 1L; protected String expectedSource; public void execute(ExecutionContext executionContext) throws Exception { super.execute(executionContext); String messageSource = (String)executionContext .getVariable(ProcessConnector.PROCESS_VARIABLE_INCOMING_SOURCE); logger.debug("Validating message source = " + messageSource + ", expected = " + expectedSource); if (!expectedSource.equalsIgnoreCase(messageSource)) { throw new JbpmException("Incoming message source is " + messageSource + ", expected source is " + expectedSource); } } } mule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/StoreIncomingData.java0000644000175000017500000000277110745677442033302 0ustar charlescharles/* * $Id: StoreIncomingData.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm.actions; import org.mule.transport.bpm.ProcessConnector; import org.jbpm.graph.exe.ExecutionContext; /** * Stores the incoming message payload into the specified variable. * * foo * */ public class StoreIncomingData extends IntegrationActionHandler { private static final long serialVersionUID = 1L; protected String variable = ProcessConnector.PROCESS_VARIABLE_DATA; public void execute(ExecutionContext executionContext) throws Exception { super.execute(executionContext); executionContext.setVariable(variable, transform(getIncomingMessage())); } /** * This method may be overriden in order to store the incoming data as a * different type. * * @param incomingData - the message that has arrived * @return the object to be stored as a process variable */ protected Object transform(Object incomingData) throws Exception { return incomingData; } } mule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/actions/SendMuleEvent.java0000644000175000017500000001147510776731741032444 0ustar charlescharles/* * $Id: SendMuleEvent.java 11539 2008-04-08 18:05:21Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm.actions; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.transport.bpm.ProcessConnector; import org.mule.transport.bpm.jbpm.MuleMessageService; import org.mule.util.StringUtils; import java.util.HashMap; import java.util.Map; import org.apache.commons.jxpath.JXPathContext; import org.jbpm.graph.exe.ExecutionContext; /** * Sends a Mule message to the specified endpoint. If the message is synchronous, * the response from Mule will be automatically stored in PROCESS_VARIABLE_INCOMING. * * @param endpoint - the Mule endpoint * @param transformers - any transformers to be applied * @param payload - specify the payload as a string directly in the jPDL * @param payloadSource - process variable from which to generate the message * payload, defaults to {@link ProcessConnector.PROCESS_VARIABLE_DATA} or * {@link ProcessConnector.PROCESS_VARIABLE_INCOMING} * @param messageProperties - any properties to be applied to the message */ public class SendMuleEvent extends LoggingActionHandler { private static final long serialVersionUID = 1L; boolean synchronous = true; String endpoint = null; String transformers = null; Map properties = null; // Use "payload" to easily specify the payload as a string directly in the jPDL. // Use "payloadSource" to get the payload from a process variable. String payload = null; String payloadSource = null; // The actual payload (as an object) will be stored here. private Object payloadObject; public void execute(ExecutionContext executionContext) throws Exception { super.execute(executionContext); MuleMessageService mule = (MuleMessageService) executionContext.getJbpmContext().getServices() .getMessageService(); if (transformers != null) { endpoint += "?transformers=" + transformers; } if (payload == null) { if (payloadSource == null) { payloadObject = executionContext.getVariable(ProcessConnector.PROCESS_VARIABLE_DATA); if (payloadObject == null) { payloadObject = executionContext.getVariable(ProcessConnector.PROCESS_VARIABLE_INCOMING); } } else { // The payloadSource may be specified using JavaBean notation (e.g., // "myObject.myStuff.myField" would first retrieve the process // variable "myObject" and then call .getMyStuff().getMyField() String[] tokens = StringUtils.split(payloadSource, ".", 2); payloadObject = executionContext.getVariable(tokens[0]); if (tokens.length > 1) { JXPathContext context = JXPathContext.newContext(payloadObject); payloadObject = context.getValue(tokens[1].replaceAll("\\.", "/")); } } } else { payloadObject = payload; } if (payloadObject == null) { throw new IllegalArgumentException("Payload for message is null. Payload source is \"" + payloadSource + "\""); } Map props = new HashMap(); props.put(ProcessConnector.PROPERTY_PROCESS_TYPE, executionContext.getProcessDefinition().getName()); props.put(ProcessConnector.PROPERTY_PROCESS_ID, new Long(executionContext.getProcessInstance() .getId())); props.put(MuleProperties.MULE_CORRELATION_ID_PROPERTY, new Long(executionContext.getProcessInstance() .getId()).toString()); props .put(ProcessConnector.PROPERTY_PROCESS_STARTED, executionContext.getProcessInstance().getStart()); if (properties != null) { props.putAll(properties); } MuleMessage response = mule.generateMessage(endpoint, payloadObject, props, synchronous); if (synchronous) { if (response != null) { executionContext.setVariable(ProcessConnector.PROCESS_VARIABLE_INCOMING, response.getPayload()); } else { logger.info("Synchronous message was sent to endpoint " + endpoint + ", but no response was returned."); } } } } mule-2.0.1/transports/jbpm/src/main/java/org/mule/transport/bpm/jbpm/MuleMessageServiceFactory.java0000644000175000017500000000144210745677442033342 0ustar charlescharles/* * $Id: MuleMessageServiceFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm; import org.jbpm.svc.Service; import org.jbpm.svc.ServiceFactory; public class MuleMessageServiceFactory implements ServiceFactory { private static final long serialVersionUID = 1L; public Service openService() { return new MuleMessageService(); } public void close() { // no-op } } mule-2.0.1/transports/jbpm/src/main/resources/0000755000175000017500000000000011351410653021173 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/test/0000755000175000017500000000000011351410652017213 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/test/java/0000755000175000017500000000000011351410652020134 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/test/java/org/0000755000175000017500000000000011351410652020723 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/test/java/org/mule/0000755000175000017500000000000011351410652021665 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/test/java/org/mule/transport/0000755000175000017500000000000011351410652023721 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/test/java/org/mule/transport/bpm/0000755000175000017500000000000011351410652024477 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/test/java/org/mule/transport/bpm/jbpm/0000755000175000017500000000000011351410652025427 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/test/java/org/mule/transport/bpm/jbpm/SimpleJbpmTestCase.java0000644000175000017500000000700310754375733032010 0ustar charlescharles/* * $Id: SimpleJbpmTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.transport.bpm.BPMS; import org.mule.transport.bpm.ProcessConnector; import org.mule.transport.bpm.jbpm.Jbpm; import org.mule.util.NumberUtils; /** * Tests the connector against jBPM with a simple process. */ public class SimpleJbpmTestCase extends AbstractJbpmTestCase { protected String getConfigResources() { return "jbpm-functional-test.xml"; } public void testSimpleProcess() throws Exception { // Deploy the process definition. ((Jbpm) bpms).deployProcess("simple-process.xml"); MuleMessage response; Object process; BPMS bpms = connector.getBpms(); MuleClient client = new MuleClient(); try { // Create a new process. response = client.send("bpm://simple", "data", null); process = response.getPayload(); long processId = NumberUtils.toLong(bpms.getId(process)); // The process should be started and in a wait state. assertFalse(processId == -1); assertEquals("dummyState", bpms.getState(process)); // Advance the process one step. response = client.send("bpm://simple/" + processId, null, null); process = response.getPayload(); // The process should have ended. assertTrue(bpms.hasEnded(process)); } finally { client.dispose(); } } public void testSimpleProcessWithParameters() throws Exception { // Deploy the process definition. ((Jbpm) bpms).deployProcess("simple-process.xml"); MuleMessage response; Object process; BPMS bpms = connector.getBpms(); MuleClient client = new MuleClient(); try { // Create a new process. response = client.send("bpm://?" + ProcessConnector.PROPERTY_ACTION + "=" + ProcessConnector.ACTION_START + "&" + ProcessConnector.PROPERTY_PROCESS_TYPE + "=simple", "data", null); process = response.getPayload(); long processId = response.getLongProperty(ProcessConnector.PROPERTY_PROCESS_ID, -1); // The process should be started and in a wait state. assertFalse(processId == -1); assertEquals("dummyState", bpms.getState(process)); // Advance the process one step. response = client.send("bpm://?" + ProcessConnector.PROPERTY_ACTION + "=" + ProcessConnector.ACTION_ADVANCE + "&" + ProcessConnector.PROPERTY_PROCESS_TYPE + "=simple&" + ProcessConnector.PROPERTY_PROCESS_ID + "=" + processId, "data", null); process = response.getPayload(); // The process should have ended. assertTrue(bpms.hasEnded(process)); } finally { client.dispose(); } } } mule-2.0.1/transports/jbpm/src/test/java/org/mule/transport/bpm/jbpm/SimpleJbpmLegacyTestCase.java0000644000175000017500000000140410745677442033136 0ustar charlescharles/* * $Id: SimpleJbpmLegacyTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm; /** * Tests the connector against jBPM with a simple process. * jBPM is instantiated by Spring using the Spring jBPM module. */ public class SimpleJbpmLegacyTestCase extends SimpleJbpmTestCase { protected String getConfigResources() { return "jbpm-functional-legacy-test.xml"; } } mule-2.0.1/transports/jbpm/src/test/java/org/mule/transport/bpm/jbpm/AbstractJbpmTestCase.java0000644000175000017500000000226310745677442032327 0ustar charlescharles/* * $Id: AbstractJbpmTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm; import org.mule.transport.bpm.tests.AbstractBpmTestCase; import org.mule.transport.jdbc.util.MuleDerbyUtils; public abstract class AbstractJbpmTestCase extends AbstractBpmTestCase { private static boolean derbySetupDone = false; protected void suitePreSetUp() throws Exception { if (!derbySetupDone) { String dbName = MuleDerbyUtils.loadDatabaseName("derby.properties", "database.name"); System.getProperties().put("hibernate.dbURL", "jdbc:derby:" + dbName + ";sql.enforce_strict_size=true"); MuleDerbyUtils.defaultDerbyCleanAndInit("derby.properties", "database.name"); derbySetupDone = true; } super.suitePreSetUp(); } } mule-2.0.1/transports/jbpm/src/test/java/org/mule/transport/bpm/jbpm/MessagingJbpmTestCase.java0000644000175000017500000000377010762044052032465 0ustar charlescharles/* * $Id: MessagingJbpmTestCase.java 11134 2008-02-29 18:00:10Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.jbpm; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.transport.bpm.BPMS; import org.mule.util.NumberUtils; /** * Tests the connector against jBPM with a process which generates a Mule message and * processes its response. jBPM is instantiated by Spring using the Spring jBPM * module. */ public class MessagingJbpmTestCase extends AbstractJbpmTestCase { protected String getConfigResources() { return "jbpm-functional-test.xml"; } public void testSendMessageProcess() throws Exception { // Deploy the process definition. ((Jbpm)bpms).deployProcess("message-process.xml"); MuleMessage response; Object process; BPMS bpms = connector.getBpms(); MuleClient client = new MuleClient(); try { // Create a new process. response = client.send("bpm://message", "data", null); process = response.getPayload(); long processId = NumberUtils.toLong(bpms.getId(process)); // The process should be started and in a wait state. assertFalse(processId == -1); assertEquals("sendMessage", bpms.getState(process)); // Advance the process one step. response = client.send("bpm://message/" + processId, "data", null); process = response.getPayload(); // The process should have ended. assertTrue(bpms.hasEnded(process)); } finally { client.dispose(); } } } mule-2.0.1/transports/jbpm/src/test/resources/0000755000175000017500000000000011351410653021226 5ustar charlescharlesmule-2.0.1/transports/jbpm/src/test/resources/log4j.properties0000644000175000017500000000076310624211577024377 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN # shut up warnings "Narrowing proxy to class xxx - this operation breaks" # during unit tests log4j.logger.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog = ERROR mule-2.0.1/transports/jbpm/src/test/resources/simple-process.xml0000644000175000017500000000050110621717250024713 0ustar charlescharles Simple process mule-2.0.1/transports/jbpm/src/test/resources/jbpm-functional-legacy-test.xml0000644000175000017500000001217510745677442027306 0ustar charlescharles classpath:derby.properties jbpm.cfg.xml false classpath*:/org/jbpm/**/*.hbm.xml org.hibernate.dialect.DerbyDialect true 1, false 0 0 update org.hibernate.cache.HashtableCacheProvider 1 3 false org.apache.derby.jdbc.EmbeddedDriver ${database.connection} string_max org.jbpm.db.hibernate.StringMax mule-2.0.1/transports/jbpm/src/test/resources/hibernate.cfg.xml0000644000175000017500000002404710777653124024473 0ustar charlescharles org.hibernate.dialect.DerbyDialect org.apache.derby.jdbc.EmbeddedDriver ${hibernate.dbURL} org.hibernate.cache.HashtableCacheProvider update mule-2.0.1/transports/jbpm/src/test/resources/derby.properties0000644000175000017500000000015110712123201024434 0ustar charlescharlesdatabase.name=muleEmbeddedDB database.connection=jdbc:derby:${database.name};sql.enforce_strict_size=truemule-2.0.1/transports/jbpm/src/test/resources/message-process.xml0000644000175000017500000000127310745677442025074 0ustar charlescharles Generates a Mule message and processes its response. test:///tmp Message in a bottle. false mule-2.0.1/transports/jbpm/src/test/resources/jbpm-functional-test.xml0000644000175000017500000001334510777653124026040 0ustar charlescharles jbpm.cfg.xml false classpath*:/org/jbpm/**/*.hbm.xml org.hibernate.dialect.DerbyDialect true 1, false 0 0 update org.hibernate.cache.HashtableCacheProvider 1 3 false org.apache.derby.jdbc.EmbeddedDriver ${database.connection} string_max org.jbpm.db.hibernate.StringMax mule-2.0.1/transports/jbpm/src/test/resources/jbpm.cfg.xml0000644000175000017500000000604510777653124023460 0ustar charlescharles mule-2.0.1/transports/jbpm/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000023710745677442026123 0ustar charlescharles# # Test cases listed in this file are not run. # # Cannot run legacy tests without 1to2migration module org.mule.transport.bpm.jbpm.SimpleJbpmLegacyTestCase mule-2.0.1/transports/jbpm/pom.xml0000644000175000017500000000706111006063605016765 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-jbpm jar BPM Transport: JBoss jBPM Classes which allow Mule to integrate with JBoss jBPM via the BPM Connector. org.mule.transports mule-transport-bpm ${version} org.jbpm jbpm-jpdl 3.2.2 commons-logging commons-logging cglib cglib-nodep 2.1_3 org.hibernate hibernate javax.jcr jcr 1.0 org.springmodules spring-modules-jbpm31 0.9 org.springframework spring-orm org.springframework spring-jdbc bsh bsh 1.3.0 true org.apache.derby derby test org.mule.transports mule-transport-bpm ${version} test test-jar org.mule.transports mule-transport-jdbc ${version} test org.mule.transports mule-transport-vm ${version} test mule-2.0.1/transports/soap/0000755000175000017500000000000011351410661015457 5ustar charlescharlesmule-2.0.1/transports/soap/src/0000755000175000017500000000000011351410661016246 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/0000755000175000017500000000000011351410661017172 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/java/0000755000175000017500000000000011351410661020113 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/java/org/0000755000175000017500000000000011351410661020702 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/java/org/mule/0000755000175000017500000000000011351410661021644 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/java/org/mule/tck/0000755000175000017500000000000011351410661022425 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/java/org/mule/tck/providers/0000755000175000017500000000000011351410661024442 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/java/org/mule/tck/providers/soap/0000755000175000017500000000000011351410661025404 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/java/org/mule/transport/0000755000175000017500000000000011351410661023700 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/0000755000175000017500000000000011351410661024642 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/transformers/0000755000175000017500000000000011351410661027367 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/transformers/HttpRequestToSoapRequest.javamule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/transformers/HttpRequestToSoapReque0000644000175000017500000001111410745677442033752 0ustar charlescharles/* * $Id: HttpRequestToSoapRequest.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.transformers; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.util.IOUtils; import org.mule.util.PropertiesUtils; import org.mule.util.StringMessageUtils; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.util.Iterator; import java.util.Map; import java.util.Properties; /** * A simple transformer for converting an Http GET request into a SOAP request. * Usually, you would POST a SOAP document, but this Transformer can be useful for * making simple SOAP requests */ public class HttpRequestToSoapRequest extends AbstractMessageAwareTransformer { public static final String SOAP_HEADER = ""; public static final String SOAP_FOOTER = ""; public static final String DEFAULT_NAMESPACE = "http://www.muleumo.org/soap"; public HttpRequestToSoapRequest() { registerSourceType(String.class); registerSourceType(InputStream.class); registerSourceType(byte[].class); setReturnClass(String.class); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { Object src = message.getPayload(); String data = src.toString(); if (src instanceof InputStream) { InputStream is = (InputStream)src; ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { try { IOUtils.copy(is, bos); } finally { is.close(); } } catch (IOException e) { throw new TransformerException(this, e); } src = bos.toByteArray(); } if (src instanceof byte[]) { try { data = new String((byte[])src, outputEncoding); } catch (UnsupportedEncodingException e) { throw new TransformerException(this, e); } // Data is already Xml if (data.startsWith("<") || data.startsWith("<")) { return data; } } String httpMethod = message.getStringProperty("http.method", "GET"); String request = message.getStringProperty("http.request", null); int i = request.indexOf('?'); String query = request.substring(i + 1); Properties p = PropertiesUtils.getPropertiesFromQueryString(query); String method = (String)p.remove(MuleProperties.MULE_METHOD_PROPERTY); if (method == null) { throw new TransformerException( CoreMessages.propertiesNotSet(MuleProperties.MULE_METHOD_PROPERTY), this); } if (httpMethod.equals("POST")) { p.setProperty(method, data); } StringBuffer result = new StringBuffer(8192); String header = StringMessageUtils.getFormattedMessage(SOAP_HEADER, new Object[]{outputEncoding}); result.append(header); result.append('<').append(method).append(" xmlns=\""); result.append(DEFAULT_NAMESPACE).append("\">"); for (Iterator iterator = p.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry)iterator.next(); result.append('<').append(entry.getKey()).append('>'); result.append(entry.getValue()); result.append("'); } result.append("'); result.append(SOAP_FOOTER); return result.toString(); } } mule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/WsdlServiceFinder.java0000644000175000017500000000156310745677442031116 0ustar charlescharles/* * $Id: WsdlServiceFinder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap; /** * WsdlServiceFinder finds a the connector service to use by checking * the classpath for jars required for each of the soap connector implementations */ public class WsdlServiceFinder extends SoapServiceFinder { private static final String PROTOCOL_PREFIX = "wsdl-"; protected String getProtocolFromKey(String key) { return PROTOCOL_PREFIX + super.getProtocolFromKey(key); } } mule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/WSProxyService.java0000644000175000017500000002211410774254333030433 0ustar charlescharles/* * $Id: WSProxyService.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap; import org.mule.DefaultMuleMessage; import org.mule.MuleServer; import org.mule.api.MuleContext; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.routing.OutboundRouter; import org.mule.api.service.Service; import org.mule.api.service.ServiceAware; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; import org.mule.util.IOUtils; import org.mule.util.StringUtils; import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This class is implemented to act as a Proxy for a Web Service. It listens for * requests on the inbound endpoint and if it encounters the "WSDL" property in the * address, it will fetch the WSDL from the original web service and return it back. * In case the wsdlFile property is set, when the WSProxyService encounters a request * for the wsdl, instead of fetching the WSDL from the original web service, it will * return back the file expressed in the property. When a normal SOAP request is * encountered, it will forward the call to the web service with no modifications to * the SOAP message. The outbound router of this class must include the address of * the webservice to be proxied. No need to include the method name as a parameter in * the address, since it will be in the SOAP message as well. Furthermore a property * named uriWsdl can optionally be set which as the name suggests, indicate the URL * of the WSDL for the service. If this property is not set, the address of the WSDL * will be assumed to be the value of uriWebservice followed by "?WSDL". It is * important to note that both urls' of the webservice to be proxied and the WSDL * address must contain no xfire or axis endpoints, just plain http endpoints. Even * the inbound endpoint of the WSProxyService must be residing on an http protocol * (with no xfire or axis). * */ public class WSProxyService implements Callable, ServiceAware, Initialisable { private String urlWebservice; private String wsdlEndpoint; private String wsdlFile; private String wsdlFileContents; private boolean useFile = false; private Service service; private static final String HTTP_REQUEST = "http.request"; private static final String WSDL_PARAM_1 = "?wsdl"; private static final String WSDL_PARAM_2 = "&wsdl"; /** This is an internal semaphore, not a property */ private boolean lazyInit = false; protected static transient Log logger = LogFactory.getLog(WSProxyService.class); /** * @return returns the url of the WSDL */ public String getWsdlEndpoint() { return wsdlEndpoint; } /** * @param urlWsdl Sets the property urlWsdl (the url of the WSDL of the web * service) */ public void setWsdlEndpoint(String urlWsdl) { this.wsdlEndpoint = urlWsdl; } /** * @return returns the location of the local wsdl */ public String getWsdlFile() { return wsdlFile; } /** * @param wsdlFile sets the location of the local wsdl file */ public void setWsdlFile(String wsdlFile) { this.wsdlFile = wsdlFile; } public Object onCall(MuleEventContext eventContext) throws Exception { if (wsdlEndpoint == null && lazyInit) { initialise(); } // retrieve the message MuleMessage message = eventContext.getMessage(); // retrieve the original http request. This will be used to check if the user // asked for the WSDL or just for the service String httpRequest = ((String)message.getProperty(HTTP_REQUEST)).toLowerCase(); // check if the inbound endpoint contains the WSDL parameter if ((httpRequest.indexOf(WSDL_PARAM_1) != -1) || (httpRequest.indexOf(WSDL_PARAM_2) != -1)) { logger.debug("Retrieving WSDL from web service"); String wsdlString; if (this.useFile) { // the processing is stopped so that the result is not passed through the // outbound router but will be passed back as a result eventContext.setStopFurtherProcessing(true); return wsdlFileContents; } MuleContext muleContext = MuleServer.getMuleContext(); InboundEndpoint webServiceEndpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint(this.wsdlEndpoint); MuleMessage replyWSDL = eventContext.requestEvent(webServiceEndpoint, eventContext.getTimeout()); wsdlString = replyWSDL.getPayloadAsString(); // find all dependencies and change them wsdlString = wsdlString.replaceAll(this.urlWebservice, eventContext.getEndpointURI().getAddress()); // create a new mule message with the new WSDL DefaultMuleMessage modifiedWsdl = new DefaultMuleMessage(wsdlString, message); logger.debug("WSDL retrieved successfully"); // the processing is stopped so that the result is not passed through the // outbound router but will be passed back as a result eventContext.setStopFurtherProcessing(true); return modifiedWsdl; } else // forward the normal call on the outbound router without any modification { logger.debug("Forwarding SOAP message"); return eventContext.getMessage(); } } // called once upon initialisation public void setService(Service service) { this.service = service; } public void initialise() throws InitialisationException { if (service != null) { OutboundRouter router = (OutboundRouter)service.getOutboundRouter().getRouters().get(0); ImmutableEndpoint endpoint = (ImmutableEndpoint)router.getEndpoints().get(0); this.urlWebservice = endpoint.getEndpointURI().getAddress(); // remove any params from the url int paramIndex; if ((paramIndex = this.urlWebservice.indexOf("?")) != -1) { this.urlWebservice = this.urlWebservice.substring(0, paramIndex); } // if the wsdlFile property is not empty, the onCall() will use this file for WSDL requests if (StringUtils.isNotBlank(this.wsdlFile)) { try { this.wsdlFileContents = IOUtils.getResourceAsString(this.wsdlFile, getClass()); if (StringUtils.isNotBlank(this.wsdlFileContents)) { this.useFile = true; logger.info("Using file " + this.wsdlFile + " as WSDL file"); } } catch (IOException fileError) { throw new InitialisationException(CoreMessages.failedToLoad(this.wsdlFile), this); } } if (!this.useFile) { // if no wsdl property is set, create one which will include the original // url of the webservice followed by ?WSDL if (StringUtils.isBlank(this.wsdlEndpoint)) { if (urlWebservice == null) { throw new InitialisationException(MessageFactory.createStaticMessage("urlWebservice has not been set, service has not been initialized properly"), this); } this.wsdlEndpoint = this.urlWebservice.concat("?WSDL"); logger.info("Defaulting to: " + this.wsdlEndpoint); } else { logger.info("Using url " + this.wsdlEndpoint + " as WSDL"); } } } else if (!lazyInit) { // Service not injected yet, try lazy init (i.e., upon onCall()). logger.debug("Service has not yet been injected, lazy initialization will be used."); lazyInit = true; } else { // We're already in lazy init and the service is still not set, so throw an exception. throw new InitialisationException(MessageFactory.createStaticMessage("Service not set, this service has not been initialized properly."), this); } } } mule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/NamedParameter.java0000644000175000017500000001572410745677442030425 0ustar charlescharles/* * $Id: NamedParameter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap; import org.mule.config.i18n.CoreMessages; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; /** * Representation of a Named parameter in a SOAP call */ public class NamedParameter { public final int MODE_IN = 0; public final int MODE_OUT = 1; public final int MODE_INOUT = 2; public static final String URI_1999_SCHEMA_XSD = "http://www.w3.org/1999/XMLSchema"; public static final String URI_2000_SCHEMA_XSD = "http://www.w3.org/2000/10/XMLSchema"; public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema"; public static final String URI_DEFAULT_SCHEMA_XSD = URI_2001_SCHEMA_XSD; public static final QName XSD_STRING = new QName(URI_DEFAULT_SCHEMA_XSD, "string"); public static final QName XSD_BOOLEAN = new QName(URI_DEFAULT_SCHEMA_XSD, "boolean"); public static final QName XSD_DOUBLE = new QName(URI_DEFAULT_SCHEMA_XSD, "double"); public static final QName XSD_FLOAT = new QName(URI_DEFAULT_SCHEMA_XSD, "float"); public static final QName XSD_INT = new QName(URI_DEFAULT_SCHEMA_XSD, "int"); public static final QName XSD_INTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "integer"); public static final QName XSD_LONG = new QName(URI_DEFAULT_SCHEMA_XSD, "long"); public static final QName XSD_SHORT = new QName(URI_DEFAULT_SCHEMA_XSD, "short"); public static final QName XSD_BYTE = new QName(URI_DEFAULT_SCHEMA_XSD, "byte"); public static final QName XSD_DECIMAL = new QName(URI_DEFAULT_SCHEMA_XSD, "decimal"); public static final QName XSD_BASE64 = new QName(URI_DEFAULT_SCHEMA_XSD, "base64Binary"); public static final QName XSD_HEXBIN = new QName(URI_DEFAULT_SCHEMA_XSD, "hexBinary"); public static final QName XSD_ANYSIMPLETYPE = new QName(URI_DEFAULT_SCHEMA_XSD, "anySimpleType"); public static final QName XSD_ANYTYPE = new QName(URI_DEFAULT_SCHEMA_XSD, "anyType"); public static final QName XSD_ANY = new QName(URI_DEFAULT_SCHEMA_XSD, "any"); public static final QName XSD_QNAME = new QName(URI_DEFAULT_SCHEMA_XSD, "QName"); public static final QName XSD_DATETIME = new QName(URI_DEFAULT_SCHEMA_XSD, "dateTime"); public static final QName XSD_DATE = new QName(URI_DEFAULT_SCHEMA_XSD, "date"); public static final QName XSD_TIME = new QName(URI_DEFAULT_SCHEMA_XSD, "time"); public static final QName XSD_TIMEINSTANT1999 = new QName(URI_1999_SCHEMA_XSD, "timeInstant"); public static final QName XSD_TIMEINSTANT2000 = new QName(URI_2000_SCHEMA_XSD, "timeInstant"); public static final QName XSD_NORMALIZEDSTRING = new QName(URI_2001_SCHEMA_XSD, "normalizedString"); public static final QName XSD_TOKEN = new QName(URI_2001_SCHEMA_XSD, "token"); public static final QName XSD_UNSIGNEDLONG = new QName(URI_DEFAULT_SCHEMA_XSD, "unsignedLong"); public static final QName XSD_UNSIGNEDINT = new QName(URI_DEFAULT_SCHEMA_XSD, "unsignedInt"); public static final QName XSD_UNSIGNEDSHORT = new QName(URI_DEFAULT_SCHEMA_XSD, "unsignedShort"); public static final QName XSD_UNSIGNEDBYTE = new QName(URI_DEFAULT_SCHEMA_XSD, "unsignedByte"); public static final QName XSD_POSITIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "positiveInteger"); public static final QName XSD_NEGATIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "negativeInteger"); public static final QName XSD_NONNEGATIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "nonNegativeInteger"); public static final QName XSD_NONPOSITIVEINTEGER = new QName(URI_DEFAULT_SCHEMA_XSD, "nonPositiveInteger"); public static final QName XSD_YEARMONTH = new QName(URI_DEFAULT_SCHEMA_XSD, "gYearMonth"); public static final QName XSD_MONTHDAY = new QName(URI_DEFAULT_SCHEMA_XSD, "gMonthDay"); public static final QName XSD_YEAR = new QName(URI_DEFAULT_SCHEMA_XSD, "gYear"); public static final QName XSD_MONTH = new QName(URI_DEFAULT_SCHEMA_XSD, "gMonth"); public static final QName XSD_DAY = new QName(URI_DEFAULT_SCHEMA_XSD, "gDay"); public static final QName XSD_DURATION = new QName(URI_DEFAULT_SCHEMA_XSD, "duration"); public static final QName XSD_NAME = new QName(URI_DEFAULT_SCHEMA_XSD, "Name"); public static final QName XSD_NCNAME = new QName(URI_DEFAULT_SCHEMA_XSD, "NCName"); public static final QName XSD_NMTOKEN = new QName(URI_DEFAULT_SCHEMA_XSD, "NMTOKEN"); public static final QName XSD_NMTOKENS = new QName(URI_DEFAULT_SCHEMA_XSD, "NMTOKENS"); public static final QName XSD_NOTATION = new QName(URI_DEFAULT_SCHEMA_XSD, "NOTATION"); public static final QName XSD_ENTITY = new QName(URI_DEFAULT_SCHEMA_XSD, "ENTITY"); public static final QName XSD_ENTITIES = new QName(URI_DEFAULT_SCHEMA_XSD, "ENTITIES"); public static final QName XSD_IDREF = new QName(URI_DEFAULT_SCHEMA_XSD, "IDREF"); public static final QName XSD_IDREFS = new QName(URI_DEFAULT_SCHEMA_XSD, "IDREFS"); public static final QName XSD_ANYURI = new QName(URI_DEFAULT_SCHEMA_XSD, "anyURI"); public static final QName XSD_LANGUAGE = new QName(URI_DEFAULT_SCHEMA_XSD, "language"); public static final QName XSD_ID = new QName(URI_DEFAULT_SCHEMA_XSD, "ID"); public static final QName XSD_SCHEMA = new QName(URI_DEFAULT_SCHEMA_XSD, "schema"); private QName name; private QName type; private ParameterMode mode; public NamedParameter(QName name, QName type, String mode) { this.name = name; this.type = type; setMode(mode); } public NamedParameter(QName name, QName type, ParameterMode mode) { this.name = name; this.type = type; this.mode = mode; } public NamedParameter(String name, String type, ParameterMode mode) { this.name = new QName(name); this.type = createQName(name); this.mode = mode; } protected void setMode(String mode) { mode = mode.toLowerCase().trim(); if (mode.equals("in")) { this.mode = ParameterMode.IN; } else if (mode.equals("out")) { this.mode = ParameterMode.OUT; } else if (mode.equals("inout")) { this.mode = ParameterMode.INOUT; } else { throw new IllegalArgumentException(CoreMessages.valueIsInvalidFor(mode, "mode").toString()); } } public QName getName() { return name; } public QName getType() { return type; } public ParameterMode getMode() { return mode; } public static QName createQName(String value) { return new QName(URI_DEFAULT_SCHEMA_XSD, value); } } mule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/SoapConstants.java0000644000175000017500000000245510745677442030334 0ustar charlescharles/* * $Id: SoapConstants.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap; /** * Common SOAP constants */ public interface SoapConstants { public static final String WSDL_PROPERTY = "wsdl"; public static final String LIST_PROPERTY = "list"; public static final String SOAP_ENDPOINT_PREFIX = "soap:"; public static final String METHOD_NAMESPACE_PROPERTY = "methodNamespace"; // i don't udnerstand what is going on here, but these are two different properties and // axis fails (in partiuclar, look at AxisJmsEndpointFormat test) if they are unified. public static final String SOAP_ACTION_PROPERTY = "soapAction"; public static final String SOAP_ACTION_PROPERTY_CAPS = "SOAPAction"; public static final String WSDL_URL_PROPERTY = "WSDL_URL"; public static final String SOAP_NAMESPACE_PROPERTY = "SOAP_NAMESPACE_PROPERTY"; public static final String SERVICE_INTERFACES = "serviceInterfaces"; } mule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/i18n/0000755000175000017500000000000011351410661025421 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/i18n/SoapMessages.java0000644000175000017500000000217310745677442030703 0ustar charlescharles/* * $Id: SoapMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class SoapMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("soap"); public static Message cannotInvokeCallWithoutOperation() { return createMessage(BUNDLE_PATH, 4); } public static Message failedToProcessSoapHeaders() { return createMessage(BUNDLE_PATH, 5); } public static Message cannotRemoveSingleAttachment() { return createMessage(BUNDLE_PATH, 6); } public static Message couldNotFindSoapProvider(String name) { return createMessage(BUNDLE_PATH, 8, name); } } mule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/config/0000755000175000017500000000000011351410661026107 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/config/SoapNamespaceHandler.java0000644000175000017500000000177310745677442033021 0ustar charlescharles/* * $Id: SoapNamespaceHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.config; import org.mule.config.spring.parsers.specific.TransformerDefinitionParser; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.transport.soap.transformers.HttpRequestToSoapRequest; /** * Reigsters a Bean Definition Parser for handling soap transport elements. */ public class SoapNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerBeanDefinitionParser("http-to-soap-request-transformer", new TransformerDefinitionParser(HttpRequestToSoapRequest.class)); } }mule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/MuleSoapHeaders.java0000644000175000017500000002021510745677442030550 0ustar charlescharles/* * $Id: MuleSoapHeaders.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap; import org.mule.api.MuleEvent; import org.mule.api.config.MuleProperties; import java.util.Iterator; import javax.xml.soap.Name; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPHeader; import javax.xml.soap.SOAPHeaderElement; import org.dom4j.Namespace; import org.dom4j.QName; import org.dom4j.dom.DOMElement; import org.w3c.dom.Element; import org.w3c.dom.Node; /** * MuleSoapHeaders is a helper class for extracting and writing Mule * header properties to s Soap message */ public class MuleSoapHeaders { private String replyTo; private String correlationId; private String correlationGroup; private String correlationSequence; public static final String MULE_10_ACTOR = "http://www.muleumo.org/providers/soap/1.0"; public static final String MULE_NAMESPACE = "mule"; public static final String MULE_HEADER = "header"; public static final String ENV_REQUEST_HEADERS = "MULE_REQUEST_HEADERS"; /** * Extracts header properties from a Mule event * * @param event */ public MuleSoapHeaders(MuleEvent event) { setCorrelationId(event.getMessage().getCorrelationId()); setCorrelationGroup(String.valueOf(event.getMessage().getCorrelationGroupSize())); setCorrelationSequence(String.valueOf(event.getMessage().getCorrelationSequence())); setReplyTo((String)event.getMessage().getReplyTo()); } /** * Extracts Mule header properties from a Soap message * * @param soapHeader */ public MuleSoapHeaders(SOAPHeader soapHeader) { Iterator iter = soapHeader.examineHeaderElements(MULE_10_ACTOR); SOAPHeaderElement headerElement; while (iter.hasNext()) { headerElement = (SOAPHeaderElement)iter.next(); // checking that the elements are part of the mule namespace if (org.mule.util.StringUtils.equals(MULE_10_ACTOR, headerElement.getNamespaceURI())) { Iterator iter2 = headerElement.getChildElements(); readElements(iter2); } } } public MuleSoapHeaders(Iterator elements) { readElements(elements); } protected void readElements(Iterator elements) { SOAPElement element; while (elements.hasNext()) { Object elementObject = elements.next(); // Fixed MULE-770 (http://mule.mulesource.org/jira/browse/MULE-770) if (elementObject instanceof SOAPElement) // if not, means that it is a value not an element, therefore we cannot // look for correlation_id ... { element = (SOAPElement)elementObject; String localName = element.getLocalName(); String elementValue = getStringValue(element); if (MuleProperties.MULE_CORRELATION_ID_PROPERTY.equals(localName)) { correlationId = elementValue; } else if (MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY.equals(localName)) { correlationGroup = elementValue; } else if (MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY.equals(localName)) { correlationSequence = elementValue; } else if (MuleProperties.MULE_REPLY_TO_PROPERTY.equals(localName)) { replyTo = elementValue; } } } } private String getStringValue(Element e) { String value = e.getNodeValue(); if (value == null && e.hasChildNodes()) { // see if the value is base64 ecoded value = e.getFirstChild().getNodeValue(); if (value != null) { // value = new String(org.apache.axis.encoding.Base64.decode(value)); } } return value; } /** * Writes the header properties to a Soap header * * @param env * @throws SOAPException */ public void addHeaders(SOAPEnvelope env) throws Exception { SOAPHeader header = env.getHeader(); SOAPHeaderElement muleHeader; if (correlationId != null || replyTo != null) { if (header == null) { header = env.addHeader(); } Name muleHeaderName = env.createName(MULE_HEADER, MULE_NAMESPACE, MULE_10_ACTOR); muleHeader = header.addHeaderElement(muleHeaderName); muleHeader.setActor(MULE_10_ACTOR); } else { return; } if (correlationId != null) { SOAPElement e = muleHeader.addChildElement(MuleProperties.MULE_CORRELATION_ID_PROPERTY, MULE_NAMESPACE); e.addTextNode(correlationId); e = muleHeader.addChildElement(MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY, MULE_NAMESPACE); e.addTextNode(correlationGroup); e = muleHeader.addChildElement(MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY, MULE_NAMESPACE); e.addTextNode(correlationSequence); } if (replyTo != null) { SOAPElement e = muleHeader.addChildElement(MuleProperties.MULE_REPLY_TO_PROPERTY, MULE_NAMESPACE); // String enc = (String)encoder.transform(replyTo); // e.addTextNode(enc); e.addTextNode(replyTo); } } public Element createHeaders() throws Exception { Element muleHeader = null; if (correlationId != null || replyTo != null) { muleHeader = new DOMElement(new QName(MULE_HEADER, new Namespace(MULE_NAMESPACE, MULE_10_ACTOR))); } else { return null; } if (correlationId != null) { Node e = muleHeader.appendChild(new DOMElement(new QName( MuleProperties.MULE_CORRELATION_ID_PROPERTY, new Namespace(MULE_NAMESPACE, MULE_10_ACTOR)))); e.setNodeValue(correlationId); e = muleHeader.appendChild(new DOMElement(new QName( MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY, new Namespace(MULE_NAMESPACE, MULE_10_ACTOR)))); e.setNodeValue(correlationGroup); e = muleHeader.appendChild(new DOMElement(new QName( MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY, new Namespace(MULE_NAMESPACE, MULE_10_ACTOR)))); e.setNodeValue(correlationSequence); } if (replyTo != null) { Node e = muleHeader.appendChild(new DOMElement(new QName(MuleProperties.MULE_REPLY_TO_PROPERTY, new Namespace(MULE_NAMESPACE, MULE_10_ACTOR)))); e.setNodeValue(replyTo); } return muleHeader; } public String getReplyTo() { return replyTo; } public void setReplyTo(String replyTo) { this.replyTo = replyTo; } public String getCorrelationId() { return correlationId; } public void setCorrelationId(String correlationId) { this.correlationId = correlationId; } public String getCorrelationGroup() { return correlationGroup; } public void setCorrelationGroup(String correlationGroup) { this.correlationGroup = correlationGroup; } public String getCorrelationSequence() { return correlationSequence; } public void setCorrelationSequence(String correlationSequence) { this.correlationSequence = correlationSequence; } } mule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/SoapMethod.java0000644000175000017500000001434610754365306027573 0ustar charlescharles/* * $Id: SoapMethod.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap; import org.mule.config.spring.editors.QNamePropertyEditor; import org.mule.util.ClassUtils; import org.mule.util.StringUtils; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; /** * A SOAP method representation where the parameters are named */ public class SoapMethod { private QName name; private List namedParameters = new ArrayList(); private QName returnType; private Class returnClass = Object.class; public SoapMethod(String methodName, String paramsString) throws ClassNotFoundException { this(QNamePropertyEditor.convert(methodName), paramsString); } /** * Creates a Soap Method using the param string set in the MUle configuration * file * * @param methodName the name of the method * @param params the param string to parse */ public SoapMethod(String methodName, List params) throws ClassNotFoundException { this(QNamePropertyEditor.convert(methodName), params); } public SoapMethod(QName methodName, String paramsString) throws ClassNotFoundException { name = methodName; List params = new ArrayList(); for (StringTokenizer stringTokenizer = new StringTokenizer(paramsString, ","); stringTokenizer.hasMoreTokens();) { params.add(stringTokenizer.nextToken().trim()); } initParams(params); } public SoapMethod(QName methodName, List params) throws ClassNotFoundException { name = methodName; initParams(params); } private void initParams(List params) throws ClassNotFoundException { NamedParameter param; for (Iterator iterator = params.iterator(); iterator.hasNext();) { String s = (String)iterator.next(); for (StringTokenizer tokenizer = new StringTokenizer(s, ";"); tokenizer.hasMoreTokens();) { String name = tokenizer.nextToken(); String type = tokenizer.nextToken(); if (name.equalsIgnoreCase("return")) { if (type.startsWith("qname{")) { returnType = QNamePropertyEditor.convert(type); } else { returnType = NamedParameter.createQName(type); } } else if (name.equalsIgnoreCase("returnClass")) { returnClass = ClassUtils.loadClass(type, getClass()); } else { String mode = tokenizer.nextToken(); QName paramName; if (name.startsWith("qname{")) { paramName = QNamePropertyEditor.convert(name); } else { paramName = new QName(getName().getNamespaceURI(), name, getName().getPrefix()); } QName qtype; if (type.startsWith("qname{")) { qtype = QNamePropertyEditor.convert(type); } else { qtype = NamedParameter.createQName(type); } param = new NamedParameter(paramName, qtype, mode); addNamedParameter(param); } } } } public SoapMethod(QName name) { this.name = name; this.returnType = null; } public SoapMethod(QName name, QName returnType) { this.name = name; this.returnType = returnType; } public SoapMethod(QName name, QName returnType, Class returnClass) { this.name = name; this.returnType = returnType; this.returnClass = returnClass; } public SoapMethod(QName name, Class returnClass) { this.name = name; this.returnClass = returnClass; } public SoapMethod(QName name, List namedParameters, QName returnType) { this.name = name; this.namedParameters = namedParameters; this.returnType = returnType; } public void addNamedParameter(NamedParameter param) { namedParameters.add(param); } public NamedParameter addNamedParameter(QName name, QName type, String mode) { if (StringUtils.isBlank(name.getNamespaceURI())) { name = new QName(getName().getNamespaceURI(), name.getLocalPart(), name.getPrefix()); } NamedParameter param = new NamedParameter(name, type, mode); namedParameters.add(param); return param; } public NamedParameter addNamedParameter(QName name, QName type, ParameterMode mode) { if (StringUtils.isBlank(name.getNamespaceURI())) { name = new QName(getName().getNamespaceURI(), name.getLocalPart(), name.getPrefix()); } NamedParameter param = new NamedParameter(name, type, mode); namedParameters.add(param); return param; } public void removeNamedParameter(NamedParameter param) { namedParameters.remove(param); } public QName getName() { return name; } public List getNamedParameters() { return namedParameters; } public QName getReturnType() { return returnType; } public void setReturnType(QName returnType) { this.returnType = returnType; } public Class getReturnClass() { return returnClass; } public void setReturnClass(Class returnClass) { this.returnClass = returnClass; } } mule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/SoapServiceFinder.java0000644000175000017500000000436110745677442031106 0ustar charlescharles/* * $Id: SoapServiceFinder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap; import org.mule.api.registry.ServiceDescriptor; import org.mule.api.registry.ServiceException; import org.mule.api.registry.ServiceFinder; import org.mule.transport.soap.i18n.SoapMessages; import org.mule.util.ClassUtils; import org.mule.util.PropertiesUtils; import java.util.Iterator; import java.util.Map; import java.util.Properties; import java.util.TreeMap; /** * SoapServiceFinder finds a the connector service to use by checking * the classpath for jars required for each of the soap connector implementations */ public class SoapServiceFinder implements ServiceFinder { /** * @deprecated We can use a more intelligent strategy for locating the service using the OSGi registry. */ // //@Override public String findService(String service, ServiceDescriptor descriptor, Properties props) throws ServiceException { Map finders = new TreeMap(); PropertiesUtils.getPropertiesWithPrefix(props, "finder.class", finders); StringBuffer buf = new StringBuffer(); for (Iterator iterator = finders.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry)iterator.next(); try { ClassUtils.loadClass(entry.getValue().toString(), getClass()); return getProtocolFromKey(entry.getKey().toString()); } catch (ClassNotFoundException e1) { buf.append(entry.getValue().toString()).append("(").append(entry.getKey().toString()).append( ")").append(", "); } } throw new ServiceException(SoapMessages.couldNotFindSoapProvider(buf.toString())); } protected String getProtocolFromKey(String key) { return key.substring(key.lastIndexOf('.') + 1); } } mule-2.0.1/transports/soap/src/main/java/org/mule/transport/soap/WsdlUrlEndpointURIBuilder.java0000644000175000017500000000330110745677442032510 0ustar charlescharles/* * $Id: WsdlUrlEndpointURIBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.endpoint.AbstractEndpointURIBuilder; import java.net.URI; import java.util.Properties; /** * The same as the UrlEndpointbuilder except that all parameters except the first are * set as properties on the endpoint and stripped from the endpoint Uri */ public class WsdlUrlEndpointURIBuilder extends AbstractEndpointURIBuilder { protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException { address = ""; if (uri.getHost() != null) { // set the endpointUri to be a proper url if host and port are set this.address = uri.getScheme() + "://" + uri.getHost(); if (uri.getPort() != -1) { address += ":" + uri.getPort(); } } if (uri.getPath() != null) { address += uri.getPath(); } String query = uri.getQuery(); if (query != null) { int i = query.indexOf("&"); if (i > -1) { address += "?" + query.substring(0, i); } else { address += "?" + query; } } } } mule-2.0.1/transports/soap/src/main/resources/0000755000175000017500000000000011351410661021204 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/resources/META-INF/0000755000175000017500000000000011351410661022344 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012510721555136025220 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/soap/2.0/mule-soap.xsd=META-INF/mule-soap.xsd mule-2.0.1/transports/soap/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014410754365306025402 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/soap/2.0=org.mule.transport.soap.config.SoapNamespaceHandler mule-2.0.1/transports/soap/src/main/resources/META-INF/services/0000755000175000017500000000000011351410661024167 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410661024756 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410661025720 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410661027735 5ustar charlescharlesmule-2.0.1/transports/soap/src/main/resources/META-INF/services/org/mule/providers/wsdl.properties0000644000175000017500000000055610766272451033046 0ustar charlescharlesservice.finder=org.mule.transport.soap.WsdlServiceFinder endpoint.builder=org.mule.endpoint.UrlEndpointURIBuilder finder.class.1.cxf=org.apache.cxf.interceptor.Fault finder.class.2.xfire=org.codehaus.xfire.fault.XFireFault finder.class.3.axis=org.apache.axis.AxisFault finder.class.4.axis2=org.apache.axis2.AxisFault finder.class.5.glue=electric.soap.SOAPException mule-2.0.1/transports/soap/src/main/resources/META-INF/services/org/mule/providers/soap.properties0000644000175000017500000000055610745677442033045 0ustar charlescharlesservice.finder=org.mule.transport.soap.SoapServiceFinder endpoint.builder=org.mule.endpoint.UrlEndpointURIBuilder finder.class.1.xfire=org.codehaus.xfire.fault.XFireFault finder.class.2.axis=org.apache.axis.AxisFault finder.class.3.axis2=org.apache.axis2.AxisFault finder.class.4.glue=electric.soap.SOAPException finder.class.5.cxf=org.apache.cxf.interceptor.Fault mule-2.0.1/transports/soap/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410661026477 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/soap/src/main/resources/META-INF/services/org/mule/i18n/soap-messages.propertiesmule-2.0.1/transports/soap/src/main/resources/META-INF/services/org/mule/i18n/soap-messages.properti0000644000175000017500000000105310621717250033036 0ustar charlescharles1=Failed to shutdown Http server for url: {0} 2=No service interfaces could be found for component '{0}' 3=Failed to register component '{0}' as a service 4=Cannot invoke WS call without an Operation. Set the 'method' param on your endpointUri or on the endpoint itself 5=Failed to process Soap Headers 6=Cannot remove a single attachment on a SOAP message. Set name to 'all' to remove all attchments 7=Cannot resolve method Name for Document/Literal invocation 8=Failed to find a soap provider on the classpath. Checked for the following classes: "{0}" mule-2.0.1/transports/soap/src/main/resources/META-INF/mule-soap.xsd0000644000175000017500000000147310744156467025013 0ustar charlescharles mule-2.0.1/transports/soap/src/test/0000755000175000017500000000000011351410661017225 5ustar charlescharlesmule-2.0.1/transports/soap/src/test/java/0000755000175000017500000000000011351410660020145 5ustar charlescharlesmule-2.0.1/transports/soap/src/test/java/org/0000755000175000017500000000000011351410660020734 5ustar charlescharlesmule-2.0.1/transports/soap/src/test/java/org/mule/0000755000175000017500000000000011351410661021677 5ustar charlescharlesmule-2.0.1/transports/soap/src/test/java/org/mule/tck/0000755000175000017500000000000011351410660022457 5ustar charlescharlesmule-2.0.1/transports/soap/src/test/java/org/mule/tck/providers/0000755000175000017500000000000011351410660024474 5ustar charlescharlesmule-2.0.1/transports/soap/src/test/java/org/mule/tck/providers/soap/0000755000175000017500000000000011351410661025437 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/soap/src/test/java/org/mule/tck/providers/soap/AbstractSoapFunctionalTestCase.javamule-2.0.1/transports/soap/src/test/java/org/mule/tck/providers/soap/AbstractSoapFunctionalTestCase.0000644000175000017500000001526610763522057033530 0ustar charlescharles/* * $Id: AbstractSoapFunctionalTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.providers.soap; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.transport.DispatchException; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.services.Person; import org.mule.transport.NullPayload; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public abstract class AbstractSoapFunctionalTestCase extends FunctionalTestCase { protected abstract String getRequestResponseEndpoint(); protected abstract String getReceiveEndpoint(); protected abstract String getReceiveComplexEndpoint(); protected abstract String getSendReceiveComplexEndpoint1(); protected abstract String getSendReceiveComplexEndpoint2(); protected abstract String getReceiveComplexCollectionEndpoint(); protected abstract String getDispatchAsyncComplexEndpoint1(); protected abstract String getDispatchAsyncComplexEndpoint2(); protected abstract String getTestExceptionEndpoint(); protected abstract String getWsdlEndpoint(); public void testRequestResponse() throws Throwable { MuleClient client = new MuleClient(); List results = new ArrayList(); int number = 1; Map props = new HashMap(); for (int i = 0; i < number; i++) { props.put("X-Message-Number", String.valueOf(i)); MuleMessage msg = client.send(getRequestResponseEndpoint(), "Message " + i, props); assertNotNull(msg); results.add(msg.getPayload()); } assertEquals(number, results.size()); for (int i = 0; i < number; i++) { assertEquals("Message " + i, results.get(i).toString()); } } public void testRequest() throws Throwable { MuleClient client = new MuleClient(); MuleMessage result = client.request(getReceiveEndpoint(), 0); assertNotNull(result); assertNotNull(result.getPayload()); assertTrue(result.getPayload().toString().length() > 0); } public void testReceiveComplex() throws Throwable { MuleClient client = new MuleClient(); MuleMessage result = client.request(getReceiveComplexEndpoint(), 0); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Fred", ((Person)result.getPayload()).getFirstName()); assertEquals("Flintstone", ((Person)result.getPayload()).getLastName()); result = client.request(getReceiveComplexEndpoint(), 0); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Fred", ((Person)result.getPayload()).getFirstName()); assertEquals("Flintstone", ((Person)result.getPayload()).getLastName()); } public void testSendAndReceiveComplex() throws Throwable { MuleClient client = new MuleClient(); MuleMessage result = client.send(getSendReceiveComplexEndpoint1(), new Person("Dino", "Flintstone"), null); assertEquals(NullPayload.getInstance(), result.getPayload()); result = client.request(getSendReceiveComplexEndpoint2(), 0); assertNotNull(result); assertTrue(result.getPayload() instanceof Person); assertEquals("Dino", ((Person)result.getPayload()).getFirstName()); assertEquals("Flintstone", ((Person)result.getPayload()).getLastName()); } public void testReceiveComplexCollection() throws Throwable { MuleClient client = new MuleClient(); MuleMessage result = client.request(getReceiveComplexCollectionEndpoint(), 0); assertNotNull(result); assertTrue(result.getPayload() instanceof Person[]); assertEquals(3, ((Person[])result.getPayload()).length); } public void testDispatchAsyncComplex() throws Throwable { MuleClient client = new MuleClient(); client.dispatch(getDispatchAsyncComplexEndpoint1(), new Person("Betty", "Rubble"), null); Thread.sleep(4500); // lets get our newly added person MuleMessage result = client.request(getDispatchAsyncComplexEndpoint2(), 0); assertNotNull(result); assertTrue("Did not receive a Person but: " + result.getPayload().getClass(), result.getPayload() instanceof Person); assertEquals("Betty", ((Person)result.getPayload()).getFirstName()); assertEquals("Rubble", ((Person)result.getPayload()).getLastName()); } public void testException() throws Exception { MuleClient client = new MuleClient(); try { client.send(getTestExceptionEndpoint(), new Person("Ross", "Mason"), null); fail("A nested Fault should have been raised"); } catch (MuleException e) { // toplevel assertTrue(e instanceof DispatchException); // the nested Axis fault assertTrue(e.getCause() instanceof Exception); } } public void testLocationUrlInWSDL() throws Exception { Map props = new HashMap(); props.put(HttpConnector.HTTP_METHOD_PROPERTY, "GET"); MuleClient client = new MuleClient(); MuleMessage result = client.send(getWsdlEndpoint(), null, props); assertNotNull(result); if (logger.isDebugEnabled()) { logger.debug(result.getPayloadAsString()); } String location = getWsdlEndpoint(); location = location.substring(0, location.length() - 5); if (location.endsWith("/")) { location = location.substring(0, location.length() - 1); } if (result.getPayloadAsString().indexOf("location=\"" + location) == -1) { assertTrue(result.getPayloadAsString().indexOf("location='" + location) > -1); } else { assertTrue(result.getPayloadAsString().indexOf("location=\"" + location) > -1); } assertTrue(result.getStringProperty(HttpConstants.HEADER_CONTENT_TYPE, "").startsWith("text/xml")); if (logger.isDebugEnabled()) { logger.debug(result.getPayloadAsString()); } } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/transports/soap/src/test/java/org/mule/tck/providers/soap/AbstractSoapResourceEndpointFunctionalTestCase.javamule-2.0.1/transports/soap/src/test/java/org/mule/tck/providers/soap/AbstractSoapResourceEndpointFun0000644000175000017500000000515510664630335033650 0ustar charlescharles/* * $Id: AbstractSoapResourceEndpointFunctionalTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.providers.soap; public abstract class AbstractSoapResourceEndpointFunctionalTestCase extends AbstractSoapFunctionalTestCase { public String getConfigResources() { return "axis-" + getTransportProtocol() + "-mule-config.xml"; } protected abstract String getTransportProtocol(); protected abstract String getSoapProvider(); protected String getRequestResponseEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent?method=echo"; } protected String getReceiveEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent2?method=getDate"; } protected String getReceiveComplexEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=getPerson¶m=Fred"; } protected String getSendReceiveComplexEndpoint1() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=addPerson"; } protected String getSendReceiveComplexEndpoint2() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=getPerson¶m=Dino"; } protected String getReceiveComplexCollectionEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=getPeople"; } protected String getDispatchAsyncComplexEndpoint1() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=addPerson"; } protected String getDispatchAsyncComplexEndpoint2() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=getPerson¶m=Betty"; } protected String getTestExceptionEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=addPerson"; } protected String getWsdlEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent?wsdl"; } public void testLocationUrlInWSDL() throws Exception { // Only works with socket based protocols } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/transports/soap/src/test/java/org/mule/tck/providers/soap/AbstractSoapUrlEndpointFunctionalTestCase.javamule-2.0.1/transports/soap/src/test/java/org/mule/tck/providers/soap/AbstractSoapUrlEndpointFunction0000644000175000017500000000542410664630335033657 0ustar charlescharles/* * $Id: AbstractSoapUrlEndpointFunctionalTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.providers.soap; public abstract class AbstractSoapUrlEndpointFunctionalTestCase extends AbstractSoapFunctionalTestCase { protected abstract String getTransportProtocol(); protected abstract String getSoapProvider(); protected String getComponentWithoutInterfacesEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://localhost:62111/mule/test"; } protected String getRequestResponseEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://localhost:62108/mule/mycomponent?method=echo"; } protected String getReceiveEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://localhost:62109/mule/services/mycomponent2?method=getDate"; } protected String getReceiveComplexEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://localhost:62109/mycomponent3?method=getPerson¶m=Fred"; } protected String getSendReceiveComplexEndpoint1() { return getSoapProvider() + ":" + getTransportProtocol() + "://localhost:62109/mycomponent3?method=addPerson"; } protected String getSendReceiveComplexEndpoint2() { return getSoapProvider() + ":" + getTransportProtocol() + "://localhost:62109/mycomponent3?method=getPerson¶m=Dino"; } protected String getReceiveComplexCollectionEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://localhost:62109/mycomponent3?method=getPeople"; } protected String getDispatchAsyncComplexEndpoint1() { return getSoapProvider() + ":" + getTransportProtocol() + "://localhost:62109/mycomponent3?method=addPerson"; } protected String getDispatchAsyncComplexEndpoint2() { return getSoapProvider() + ":" + getTransportProtocol() + "://localhost:62109/mycomponent3?method=getPerson¶m=Betty"; } protected String getTestExceptionEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://localhost:62109/mycomponent3?method=addPerson"; } protected String getWsdlEndpoint() { return getTransportProtocol() + "://localhost:62108/mule/mycomponent?wsdl"; } } mule-2.0.1/transports/soap/src/test/java/org/mule/transport/0000755000175000017500000000000011351410661023733 5ustar charlescharlesmule-2.0.1/transports/soap/src/test/java/org/mule/transport/soap/0000755000175000017500000000000011351410661024675 5ustar charlescharlesmule-2.0.1/transports/soap/src/test/java/org/mule/transport/soap/SoapMethodTestCase.java0000644000175000017500000000466010745677442031267 0ustar charlescharles/* * $Id: SoapMethodTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.transport.soap.NamedParameter; import org.mule.transport.soap.SoapMethod; import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; public class SoapMethodTestCase extends AbstractMuleTestCase { public void testNamedParameterParsing() throws Exception { SoapMethod method = new SoapMethod("getFruit", "firstName;string;in, age;integer;in, returnClass;org.mule.tck.testmodels.fruit.Apple"); assertEquals(new QName("getFruit"), method.getName()); assertEquals(2, method.getNamedParameters().size()); assertEquals(Apple.class, method.getReturnClass()); assertNull(method.getReturnType()); Iterator i = method.getNamedParameters().iterator(); NamedParameter np = (NamedParameter)i.next(); assertEquals(new QName("firstName"), np.getName()); assertEquals(NamedParameter.XSD_STRING, np.getType()); assertEquals(ParameterMode.IN, np.getMode()); np = (NamedParameter)i.next(); assertEquals(new QName("age"), np.getName()); assertEquals(NamedParameter.XSD_INTEGER, np.getType()); assertEquals(ParameterMode.IN, np.getMode()); } public void testNamedParameterParsing2() throws Exception { SoapMethod method = new SoapMethod("getAge", "firstName;string;inout,return;int"); assertEquals(new QName("getAge"), method.getName()); assertEquals(1, method.getNamedParameters().size()); assertEquals(Object.class, method.getReturnClass()); assertEquals(NamedParameter.XSD_INT, method.getReturnType()); Iterator i = method.getNamedParameters().iterator(); NamedParameter np = (NamedParameter)i.next(); assertEquals(new QName("firstName"), np.getName()); assertEquals(NamedParameter.XSD_STRING, np.getType()); assertEquals(ParameterMode.INOUT, np.getMode()); } } mule-2.0.1/transports/soap/src/test/resources/0000755000175000017500000000000011351410661021237 5ustar charlescharlesmule-2.0.1/transports/soap/src/test/resources/log4j.properties0000644000175000017500000000050210547540350024376 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/transports/soap/pom.xml0000644000175000017500000000674311006063605017005 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-soap SOAP Transport A Mule transport for SOAP connectivity. The transport will use Axis, Glue or XFire depending on which is on the classpath. org.apache.maven.plugins maven-surefire-plugin pertest org.apache.maven.plugins maven-jar-plugin test-jar osgi org.apache.felix maven-bundle-plugin org.mule.transport.soap.* org.mule.transports mule-transport-http ${version} org.apache.geronimo.specs geronimo-jaxrpc_1.1_spec javax.xml.soap saaj-api 1.3 com.sun.xml.messaging.saaj saaj-impl 1.3 dom4j dom4j org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test mule-2.0.1/transports/tcp/0000755000175000017500000000000011351410645015305 5ustar charlescharlesmule-2.0.1/transports/tcp/src/0000755000175000017500000000000011351410644016073 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/0000755000175000017500000000000011351410645017020 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/java/0000755000175000017500000000000011351410644017740 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/java/org/0000755000175000017500000000000011351410644020527 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/java/org/mule/0000755000175000017500000000000011351410644021471 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/java/org/mule/transport/0000755000175000017500000000000011351410644023525 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/0000755000175000017500000000000011351410645024314 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/TcpMessageRequester.java0000644000175000017500000000614210757615756031140 0ustar charlescharles/* * $Id: TcpMessageRequester.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.transport.AbstractMessageRequester; import java.net.Socket; import java.net.SocketTimeoutException; /** * Request transformed Mule events from TCP. */ public class TcpMessageRequester extends AbstractMessageRequester { private final TcpConnector connector; public TcpMessageRequester(InboundEndpoint endpoint) { super(endpoint); this.connector = (TcpConnector) endpoint.getConnector(); } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was available * @throws Exception if the call to the underlying protocal cuases an exception */ protected MuleMessage doRequest(long timeout) throws Exception { if (timeout > Integer.MAX_VALUE || timeout < 0) { throw new IllegalArgumentException("Timeout incorrect: " + timeout); } Socket socket = connector.getSocket(endpoint); try { Object result = TcpMessageDispatcher.receiveFromSocket(socket, (int)timeout, endpoint); if (result == null) { return null; } return new DefaultMuleMessage(connector.getMessageAdapter(result)); } catch (SocketTimeoutException e) { // we don't necesarily expect to receive a resonse here if (logger.isDebugEnabled()) { logger.debug("Socket timed out normally while doing a synchronous receive on endpointUri: " + endpoint.getEndpointURI()); } return null; } } protected synchronized void doDispose() { try { doDisconnect(); } catch (Exception e) { logger.error("Failed to shutdown the dispatcher.", e); } } protected void doConnect() throws Exception { // Test the connection if (connector.isValidateConnections()) { Socket socket = connector.getSocket(endpoint); connector.releaseSocket(socket, endpoint); } } protected void doDisconnect() throws Exception { //nothing to do } }mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/package.html0000644000175000017500000000015210745677442026613 0ustar charlescharles Mule Provides tcp connectivity for Mule. mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/TcpProtocol.java0000644000175000017500000000366410745677442027460 0ustar charlescharles/* * $Id: TcpProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.ResponseOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; /** * The TcpProtocol interface enables to plug different application level protocols on * a TcpConnector. Note that this interface has lost the direct byte array write method. * Standard callers should (and will, since it matches the same signature, which is why * the method has not been deprecated) use the generic method instead.. */ public interface TcpProtocol { /** * Reads the input stream and returns a whole message. * * @param is the input stream * @return an array of byte containing a full message * @throws IOException if an exception occurs */ Object read(InputStream is) throws IOException; /** * Write the specified message to the output stream. * * @param os the output stream to write to * @param data the data to write * @throws IOException if an exception occurs */ void write(OutputStream os, Object data) throws IOException; /** * This lets protocols encode a response stream. If the protocol does not support a * response stream (ie does not support streaming) then the stream should thrown an * exception when used. * * @param socket The destination to write to * @return A stream whose output will be encoded * @throws IOException */ ResponseOutputStream createResponse(Socket socket) throws IOException; } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/TcpConnector.java0000644000175000017500000003267710761541316027603 0ustar charlescharles/* * $Id: TcpConnector.java 11113 2008-02-28 14:18:54Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.api.MessagingException; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.model.streaming.CallbackOutputStream; import org.mule.transport.AbstractConnector; import org.mule.transport.tcp.protocols.SafeProtocol; import java.io.BufferedOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; import java.net.SocketException; import java.net.URI; import org.apache.commons.pool.impl.GenericKeyedObjectPool; /** * TcpConnector can bind or sent to a given TCP port on a given host. * Other socket-based transports can be built on top of this class by providing the * appropriate socket factories and application level protocols as required (see * the constructor and the SSL transport for examples). */ public class TcpConnector extends AbstractConnector { public static final String TCP = "tcp"; /** Property can be set on the endpoint to configure how the socket is managed */ public static final String KEEP_SEND_SOCKET_OPEN_PROPERTY = "keepSendSocketOpen"; public static final int DEFAULT_SOCKET_TIMEOUT = INT_VALUE_NOT_SET; public static final int DEFAULT_SO_LINGER = INT_VALUE_NOT_SET; public static final int DEFAULT_BUFFER_SIZE = INT_VALUE_NOT_SET; public static final int DEFAULT_BACKLOG = INT_VALUE_NOT_SET; // to clarify arg to configureSocket public static final boolean SERVER = false; public static final boolean CLIENT = true; private int clientSoTimeout = DEFAULT_SOCKET_TIMEOUT; private int serverSoTimeout = DEFAULT_SOCKET_TIMEOUT; private int sendBufferSize = DEFAULT_BUFFER_SIZE; private int receiveBufferSize = DEFAULT_BUFFER_SIZE; private int receiveBacklog = DEFAULT_BACKLOG; private boolean sendTcpNoDelay; private boolean validateConnections = true; private Boolean reuseAddress = Boolean.TRUE; // this could be null for Java default private int socketSoLinger = DEFAULT_SO_LINGER; private TcpProtocol tcpProtocol; private boolean keepSendSocketOpen = false; private boolean keepAlive = false; private AbstractTcpSocketFactory socketFactory; private SimpleServerSocketFactory serverSocketFactory; private GenericKeyedObjectPool socketsPool = new GenericKeyedObjectPool(); //TODO MULE-2300 remove once fixed private TcpSocketKey lastSocketKey; public TcpConnector() { setSocketFactory(new TcpSocketFactory()); setServerSocketFactory(new TcpServerSocketFactory()); setTcpProtocol(new SafeProtocol()); } public void configureSocket(boolean client, Socket socket) throws SocketException { // There is some overhead in setting socket timeout and buffer size, so we're // careful here only to set if needed if (newValue(getReceiveBufferSize(), socket.getReceiveBufferSize())) { socket.setReceiveBufferSize(getReceiveBufferSize()); } if (newValue(getSendBufferSize(), socket.getSendBufferSize())) { socket.setSendBufferSize(getSendBufferSize()); } if (client) { if (newValue(getClientSoTimeout(), socket.getSoTimeout())) { socket.setSoTimeout(getClientSoTimeout()); } } else { if (newValue(getServerSoTimeout(), socket.getSoTimeout())) { socket.setSoTimeout(getServerSoTimeout()); } } if (newValue(getSocketSoLinger(), socket.getSoLinger())) { socket.setSoLinger(true, getSocketSoLinger()); } try { socket.setTcpNoDelay(isSendTcpNoDelay()); } catch (SocketException e) { // MULE-2800 - Bug in Solaris } socket.setKeepAlive(isKeepAlive()); } private boolean newValue(int parameter, int socketValue) { return parameter != Connector.INT_VALUE_NOT_SET && parameter != socketValue; } protected void doInitialise() throws InitialisationException { socketsPool.setFactory(getSocketFactory()); socketsPool.setTestOnBorrow(true); socketsPool.setTestOnReturn(true); //There should only be one pooled instance per socket (key) socketsPool.setMaxActive(1); socketsPool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK); } protected void doDispose() { logger.debug("Closing TCP connector"); try { socketsPool.close(); } catch (Exception e) { logger.warn("Failed to close dispatcher socket pool: " + e.getMessage()); } } /** * Lookup a socket in the list of dispatcher sockets but don't create a new * socket */ protected Socket getSocket(ImmutableEndpoint endpoint) throws Exception { TcpSocketKey socketKey = new TcpSocketKey(endpoint); if (logger.isDebugEnabled()) { logger.debug("borrowing socket for " + socketKey + "/" + socketKey.hashCode()); if (null != lastSocketKey) { logger.debug("same as " + lastSocketKey.hashCode() + "? " + lastSocketKey.equals(socketKey)); } } Socket socket = (Socket) socketsPool.borrowObject(socketKey); if (logger.isDebugEnabled()) { logger.debug("borrowed socket, " + (socket.isClosed() ? "closed" : "open") + "; debt " + socketsPool.getNumActive()); } return socket; } void releaseSocket(Socket socket, ImmutableEndpoint endpoint) throws Exception { TcpSocketKey socketKey = new TcpSocketKey(endpoint); lastSocketKey = socketKey; socketsPool.returnObject(socketKey, socket); if (logger.isDebugEnabled()) { logger.debug("returning socket for " + socketKey.hashCode()); logger.debug("returned socket; debt " + socketsPool.getNumActive()); } } public OutputStream getOutputStream(final ImmutableEndpoint endpoint, MuleMessage message) throws MuleException { final Socket socket; try { socket = getSocket(endpoint); } catch (Exception e) { throw new MessagingException(CoreMessages.failedToGetOutputStream(), message, e); } if (socket == null) { // This shouldn't happen throw new IllegalStateException("could not get socket for endpoint: " + endpoint.getEndpointURI().getAddress()); } try { return new CallbackOutputStream( new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())), new CallbackOutputStream.Callback() { public void onClose() throws Exception { releaseSocket(socket, endpoint); } }); } catch (IOException e) { throw new MessagingException(CoreMessages.failedToGetOutputStream(), message, e); } } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { socketsPool.clear(); } protected void doStart() throws MuleException { // template method } protected void doStop() throws MuleException { // template method } public String getProtocol() { return TCP; } // getters and setters --------------------------------------------------------- public boolean isKeepSendSocketOpen() { return keepSendSocketOpen; } public void setKeepSendSocketOpen(boolean keepSendSocketOpen) { this.keepSendSocketOpen = keepSendSocketOpen; } /** * A shorthand property setting timeout for both SEND and RECEIVE sockets. * * @deprecated The time out should be set explicitly for each */ public void setTimeout(int timeout) { setClientSoTimeout(timeout); setServerSoTimeout(timeout); } public int getClientSoTimeout() { return this.clientSoTimeout; } public void setClientSoTimeout(int timeout) { this.clientSoTimeout = valueOrDefault(timeout, 0, DEFAULT_SOCKET_TIMEOUT); } public int getServerSoTimeout() { return serverSoTimeout; } public void setServerSoTimeout(int timeout) { this.serverSoTimeout = valueOrDefault(timeout, 0, DEFAULT_SOCKET_TIMEOUT); } /** @deprecated Should use {@link #getSendBufferSize()} or {@link #getReceiveBufferSize()} */ public int getBufferSize() { return sendBufferSize; } /** @deprecated Should use {@link #setSendBufferSize(int)} or {@link #setReceiveBufferSize(int)} */ public void setBufferSize(int bufferSize) { sendBufferSize = valueOrDefault(bufferSize, 1, DEFAULT_BUFFER_SIZE); } public int getSendBufferSize() { return sendBufferSize; } public void setSendBufferSize(int bufferSize) { sendBufferSize = valueOrDefault(bufferSize, 1, DEFAULT_BUFFER_SIZE); } public int getReceiveBufferSize() { return receiveBufferSize; } public void setReceiveBufferSize(int bufferSize) { receiveBufferSize = valueOrDefault(bufferSize, 1, DEFAULT_BUFFER_SIZE); } public int getReceiveBacklog() { return receiveBacklog; } public void setReceiveBacklog(int receiveBacklog) { this.receiveBacklog = valueOrDefault(receiveBacklog, 0, DEFAULT_BACKLOG); } public int getSocketSoLinger() { return socketSoLinger; } public void setSocketSoLinger(int soLinger) { this.socketSoLinger = valueOrDefault(soLinger, 0, INT_VALUE_NOT_SET); } /** * @return * @deprecated should use {@link #getReceiveBacklog()} */ public int getBacklog() { return receiveBacklog; } /** * @param backlog * @deprecated should use {@link #setReceiveBacklog(int)} */ public void setBacklog(int backlog) { this.receiveBacklog = backlog; } public TcpProtocol getTcpProtocol() { return tcpProtocol; } public void setTcpProtocol(TcpProtocol tcpProtocol) { this.tcpProtocol = tcpProtocol; } public boolean isRemoteSyncEnabled() { return true; } public boolean isKeepAlive() { return keepAlive; } public void setKeepAlive(boolean keepAlive) { this.keepAlive = keepAlive; } public boolean isSendTcpNoDelay() { return sendTcpNoDelay; } public void setSendTcpNoDelay(boolean sendTcpNoDelay) { this.sendTcpNoDelay = sendTcpNoDelay; } protected void setSocketFactory(AbstractTcpSocketFactory socketFactory) { this.socketFactory = socketFactory; } protected AbstractTcpSocketFactory getSocketFactory() { return socketFactory; } public SimpleServerSocketFactory getServerSocketFactory() { return serverSocketFactory; } public void setServerSocketFactory(SimpleServerSocketFactory serverSocketFactory) { this.serverSocketFactory = serverSocketFactory; } protected ServerSocket getServerSocket(URI uri) throws IOException { return getServerSocketFactory().createServerSocket(uri, getReceiveBacklog(), isReuseAddress()); } private static int valueOrDefault(int value, int threshhold, int deflt) { if (value < threshhold) { return deflt; } else { return value; } } /** * Should the connection be checked before sending data? * * @return If true, the message adapter opens and closes the socket on intialisation. */ public boolean isValidateConnections() { return validateConnections; } /** * @param validateConnections If true, the message adapter opens and closes the socket on intialisation. * @see #isValidateConnections() */ public void setValidateConnections(boolean validateConnections) { this.validateConnections = validateConnections; } /** * @return true if the server socket sets SO_REUSEADDRESS before opening */ public Boolean isReuseAddress() { return reuseAddress; } /** * This allows closed sockets to be reused while they are still in TIME_WAIT state * * @param reuseAddress Whether the server socket sets SO_REUSEADDRESS before opening */ public void setReuseAddress(Boolean reuseAddress) { this.reuseAddress = reuseAddress; } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/TcpMessageRequesterFactory.java0000644000175000017500000000156610757615756032475 0ustar charlescharles/* * $Id: TcpMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; public class TcpMessageRequesterFactory extends AbstractMessageRequesterFactory { public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new TcpMessageRequester(endpoint); } }mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/TcpServerSocketFactory.java0000644000175000017500000000423510745677442031621 0ustar charlescharles/* * $Id: TcpServerSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.util.StringUtils; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.URI; public class TcpServerSocketFactory implements SimpleServerSocketFactory { public ServerSocket createServerSocket(URI uri, int backlog, Boolean reuse) throws IOException { String host = StringUtils.defaultIfEmpty(uri.getHost(), "localhost"); InetAddress inetAddress = InetAddress.getByName(host); if (inetAddress.equals(InetAddress.getLocalHost()) || inetAddress.isLoopbackAddress() || host.trim().equals("localhost")) { return createServerSocket(uri.getPort(), backlog, reuse); } else { return createServerSocket(inetAddress, uri.getPort(), backlog, reuse); } } public ServerSocket createServerSocket(InetAddress address, int port, int backlog, Boolean reuse) throws IOException { return configure(new ServerSocket(), reuse, new InetSocketAddress(address, port), backlog); } public ServerSocket createServerSocket(int port, int backlog, Boolean reuse) throws IOException { return configure(new ServerSocket(), reuse, new InetSocketAddress(port), backlog); } protected ServerSocket configure(ServerSocket socket, Boolean reuse, InetSocketAddress address, int backlog) throws IOException { if (null != reuse && reuse.booleanValue() != socket.getReuseAddress()) { socket.setReuseAddress(reuse.booleanValue()); } // bind *after* setting so_reuseaddress socket.bind(address, backlog); return socket; } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/SimpleServerSocketFactory.java0000644000175000017500000000232010745677442032315 0ustar charlescharles/* * $Id: SimpleServerSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.URI; public interface SimpleServerSocketFactory { /** * @param uri The address and port to connect to * @param backlog The backlog (or {@link org.mule.api.transport.Connector#INT_VALUE_NOT_SET}) * @param reuse Whether to reuse addresses (null for default) * @return A new, bound server socket * @throws IOException */ ServerSocket createServerSocket(URI uri, int backlog, Boolean reuse) throws IOException; ServerSocket createServerSocket(InetAddress address, int port, int backlog, Boolean reuse) throws IOException; ServerSocket createServerSocket(int port, int backlog, Boolean reuse) throws IOException; } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/i18n/0000755000175000017500000000000011351410644025072 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/i18n/TcpMessages.java0000644000175000017500000000227210745677442030177 0ustar charlescharles/* * $Id: TcpMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; import org.mule.transport.tcp.TcpConnector; import java.net.URI; public class TcpMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath(TcpConnector.TCP); public static Message failedToBindToUri(URI uri) { return createMessage(BUNDLE_PATH, 1, uri); } public static Message failedToCloseSocket() { return createMessage(BUNDLE_PATH, 2); } public static Message failedToInitMessageReader() { return createMessage(BUNDLE_PATH, 3); } public static Message invalidStreamingOutputType(Class c) { return createMessage(BUNDLE_PATH, 4, c.getName()); } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/config/0000755000175000017500000000000011351410645025561 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/config/package.html0000644000175000017500000000022210745677442030056 0ustar charlescharles Mule Configuration classes for processing Xml config elements within the TCP namespace. mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/config/TcpNamespaceHandler.java0000644000175000017500000000553310745726444032310 0ustar charlescharles/* * $Id: TcpNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.tcp.TcpConnector; import org.mule.transport.tcp.TcpProtocol; import org.mule.transport.tcp.protocols.DirectProtocol; import org.mule.transport.tcp.protocols.EOFProtocol; import org.mule.transport.tcp.protocols.LengthProtocol; import org.mule.transport.tcp.protocols.MuleMessageDirectProtocol; import org.mule.transport.tcp.protocols.MuleMessageEOFProtocol; import org.mule.transport.tcp.protocols.MuleMessageLengthProtocol; import org.mule.transport.tcp.protocols.MuleMessageSafeProtocol; import org.mule.transport.tcp.protocols.SafeProtocol; import org.mule.transport.tcp.protocols.StreamingProtocol; import org.mule.transport.tcp.protocols.XmlMessageEOFProtocol; import org.mule.transport.tcp.protocols.XmlMessageProtocol; /** * Registers a Bean Definition Parser for handling elements. * */ public class TcpNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(TcpConnector.TCP, URIBuilder.SOCKET_ATTRIBUTES); registerConnectorDefinitionParser(TcpConnector.class); registerBeanDefinitionParser("custom-protocol", new ChildDefinitionParser("tcpProtocol", null, TcpProtocol.class, true)); registerBeanDefinitionParser("xml-protocol", new ChildDefinitionParser("tcpProtocol", XmlMessageProtocol.class)); registerBeanDefinitionParser("xml-eof-protocol", new ChildDefinitionParser("tcpProtocol", XmlMessageEOFProtocol.class)); registerBeanDefinitionParser("safe-protocol", new ByteOrMessageProtocolDefinitionParser(SafeProtocol.class, MuleMessageSafeProtocol.class)); registerBeanDefinitionParser("length-protocol", new ByteOrMessageProtocolDefinitionParser(LengthProtocol.class, MuleMessageLengthProtocol.class)); registerBeanDefinitionParser("eof-protocol", new ByteOrMessageProtocolDefinitionParser(EOFProtocol.class, MuleMessageEOFProtocol.class)); registerBeanDefinitionParser("direct-protocol", new ByteOrMessageProtocolDefinitionParser(DirectProtocol.class, MuleMessageDirectProtocol.class)); registerBeanDefinitionParser("streaming-protocol", new ByteOrMessageProtocolDefinitionParser(StreamingProtocol.class, MuleMessageDirectProtocol.class)); } }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/config/ByteOrMessageProtocolDefinitionParser.javamule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/config/ByteOrMessageProtocolDefinitio0000644000175000017500000000204210745677442033610 0ustar charlescharles/* * $Id: ByteOrMessageProtocolDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.config; import org.mule.config.spring.parsers.delegate.BooleanAttributeSelectionDefinitionParser; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; public class ByteOrMessageProtocolDefinitionParser extends BooleanAttributeSelectionDefinitionParser { public static final String PROTOCOL = "tcpProtocol"; public ByteOrMessageProtocolDefinitionParser(Class bytes, Class message) { super("payloadOnly", true, new ChildDefinitionParser(PROTOCOL, bytes), new ChildDefinitionParser(PROTOCOL, message)); } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/TcpInputStream.java0000755000175000017500000000242110770356575030122 0ustar charlescharles/* * $Id: TcpInputStream.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.model.streaming.DelegatingInputStream; import java.io.InputStream; /** * The {@link TcpMessageDispatcher} and the {@link TcpMessageReceiver} use this * class as the input parameter to the read() method on the {@link TcpProtocol} * interface. If you wish to simply use the InputStream as the message payload * that you're reading in, you just call tcpInputStream.setStreaming(true) so * that Mule knows to stop listening for more messages on that stream. */ public class TcpInputStream extends DelegatingInputStream { private boolean streaming; public TcpInputStream(InputStream delegate) { super(delegate); } public boolean isStreaming() { return streaming; } public void setStreaming(boolean streaming) { this.streaming = streaming; } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/TcpSocketFactory.java0000644000175000017500000000132610745677442030430 0ustar charlescharles/* * $Id: TcpSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import java.io.IOException; import java.net.Socket; public class TcpSocketFactory extends AbstractTcpSocketFactory { protected Socket createSocket(TcpSocketKey key) throws IOException { return new Socket(key.getInetAddress(), key.getPort()); } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/TcpMessageDispatcher.java0000644000175000017500000001252210757615756031246 0ustar charlescharles/* * $Id: TcpMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transformer.TransformerException; import org.mule.transport.AbstractMessageDispatcher; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.IOException; import java.net.Socket; import java.net.SocketTimeoutException; /** * Send transformed Mule events over TCP. */ public class TcpMessageDispatcher extends AbstractMessageDispatcher { private final TcpConnector connector; public TcpMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (TcpConnector) endpoint.getConnector(); } protected synchronized void doDispatch(MuleEvent event) throws Exception { Socket socket = connector.getSocket(event.getEndpoint()); try { dispatchToSocket(socket, event); } finally { connector.releaseSocket(socket, event.getEndpoint()); } } protected synchronized MuleMessage doSend(MuleEvent event) throws Exception { Socket socket = connector.getSocket(event.getEndpoint()); dispatchToSocket(socket, event); try { if (useRemoteSync(event)) { try { Object result = receiveFromSocket(socket, event.getTimeout(), endpoint); if (result == null) { return null; } if (result instanceof MuleMessage) { return (MuleMessage) result; } return new DefaultMuleMessage(connector.getMessageAdapter(result)); } catch (SocketTimeoutException e) { // we don't necessarily expect to receive a response here logger.info("Socket timed out normally while doing a synchronous receive on endpointUri: " + event.getEndpoint().getEndpointURI()); return null; } } else { return event.getMessage(); } } finally { if (!useRemoteSync(event)) { connector.releaseSocket(socket, endpoint); } } } // Socket management (get and release) is handled outside this method private void dispatchToSocket(Socket socket, MuleEvent event) throws Exception { Object payload = event.transformMessage(); write(socket, payload); } private void write(Socket socket, Object data) throws IOException, TransformerException { BufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream()); connector.getTcpProtocol().write(bos, data); bos.flush(); } protected static Object receiveFromSocket(final Socket socket, int timeout, final ImmutableEndpoint endpoint) throws IOException { final TcpConnector connector = (TcpConnector) endpoint.getConnector(); DataInputStream underlyingIs = new DataInputStream(new BufferedInputStream(socket.getInputStream())); TcpInputStream tis = new TcpInputStream(underlyingIs) { public void close() throws IOException { try { connector.releaseSocket(socket, endpoint); } catch (IOException e) { throw e; } catch (Exception e) { IOException e2 = new IOException(); e2.initCause(e); throw e2; } } }; if (timeout >= 0) { socket.setSoTimeout(timeout); } try { return connector.getTcpProtocol().read(tis); } finally { if (!tis.isStreaming()) { tis.close(); } } } protected synchronized void doDispose() { try { doDisconnect(); } catch (Exception e) { logger.error("Failed to shutdown the dispatcher.", e); } } protected void doConnect() throws Exception { // Test the connection if (connector.isValidateConnections()) { Socket socket = connector.getSocket(endpoint); connector.releaseSocket(socket, endpoint); } } protected void doDisconnect() throws Exception { //nothing to do } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/0000755000175000017500000000000011351410644026337 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/StreamingProtocol.java0000755000175000017500000000425410754365306032677 0ustar charlescharles/* * $Id: StreamingProtocol.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.transport.tcp.TcpInputStream; import org.mule.transport.tcp.TcpProtocol; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class StreamingProtocol extends EOFProtocol implements TcpProtocol { public StreamingProtocol() { super(); } public Object read(InputStream is) throws IOException { if (is instanceof TcpInputStream) { ((TcpInputStream) is).setStreaming(true); } return is; } /** * * @param is * @param os * @throws IOException */ protected void copyStream(InputStream is, OutputStream os) throws IOException { try { int limit = getLimit(); byte[] buffer = new byte[bufferSize]; int len; int remain = remaining(limit, limit, 0); int total = 0; boolean repeat; do { len = copy(is, buffer, os, remain); total += len; remain = remaining(limit, remain, len); repeat = EOF != len && remain > 0 && isRepeat(len, is.available()); // Flush the data if we didn't fill up the whole buffer // in case we're at the end of the stream and the receiving // side is waiting for the end of the data before closing the socket if (len > 0 && len < buffer.length) { os.flush(); } } while (repeat); } finally { is.close(); } } protected int getLimit() { return UNLIMITED; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/MuleMessageDirectProtocol.javamule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/MuleMessageDirectProtocol.j0000644000175000017500000000232110745677442033615 0ustar charlescharles/* * $Id: MuleMessageDirectProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * This Protocol will send the actual Mule Message over the TCP channel, and in this * way we are preserving any headers which might be needed, for example Correlation * IDs in order to be able to aggregate messages after chunking. Data are read until * no more are (momentarily) available. */ public class MuleMessageDirectProtocol extends DirectProtocol { // @Override public Object read(InputStream is) throws IOException { return MuleMessageWorker.doRead(super.read(is)); } // @Override public void write(OutputStream os, byte[] data) throws IOException { super.write(os, MuleMessageWorker.doWrite()); } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/MuleMessageWorker.java0000644000175000017500000000247510745677442032634 0ustar charlescharles/* * $Id: MuleMessageWorker.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import java.io.IOException; import org.apache.commons.lang.SerializationUtils; /** * Helper class for Mule message handling so that we can apply the same logic across all * sub-protocols (default, EOF and length). */ class MuleMessageWorker { private MuleMessageWorker() { // no-op } public static byte[] doWrite() throws IOException { DefaultMuleMessage msg = (DefaultMuleMessage) RequestContext.getEvent().getMessage(); return SerializationUtils.serialize(msg); } public static Object doRead(Object message) throws IOException { byte[] tmp = (byte[]) message; if (tmp == null) { return null; } else { return SerializationUtils.deserialize(tmp); } } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/XmlMessageProtocol.java0000644000175000017500000001335310745677442033017 0ustar charlescharles/* * $Id: XmlMessageProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import java.io.IOException; import java.io.InputStream; import java.io.PushbackInputStream; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; /** *

* The XmlMessageProtocol is an application level tcp protocol that can be used to * read streaming xml documents. The only requirement is that each document include * an xml declaration at the beginning of the document of the form "SHOULD begin with an XML declaration which specifies the version * of XML being used" while the xml 1.1 standard contains "Definition: XML 1.1 * documents MUST begin with an XML declaration which specifies the * version of XML being used". The SHOULD indicates a recommendation that, if not * followed, needs to be carefully checked for unintended consequences. MUST * indicates a mandatory requirement for a well-formed document. Please make sure * that the xml documents being streamed begin with an xml declaration when using * this class. *

*

* Data are read until a new document is found or there are no more data * (momentarily). For slower networks, * {@link org.mule.transport.tcp.protocols.XmlMessageEOFProtocol} may be more reliable. *

*

* Also, the default character encoding for the platform is used to decode the * message bytes when looking for the XML declaration. Some caution with message * character encodings is warranted. *

*

* Finally, this class uses a PushbackInputStream to enable parsing of individual * messages. The stream stores any pushed-back bytes into it's own internal buffer * and not the original stream. Therefore, the read buffer size is intentionally * limited to insure that unread characters remain on the stream so that all data may * be read later. *

*/ public class XmlMessageProtocol extends AbstractByteProtocol { private static final String XML_PATTERN = "= 0) { // TODO take encoding into account, ideally from the incoming XML message.append(new String(buffer, 0, len)); // start search at 2nd character in buffer (index=1) to // indicate whether we have reached a new document. patternIndex = message.toString().indexOf(XML_PATTERN, 1); repeat = isRepeat(patternIndex, len, pbis.available()); } else { // never repeat on closed stream (and avoid calling available) repeat = false; } } while (repeat); if (patternIndex > 0) { // push back the start of the next message and // ignore the pushed-back characters in the return buffer pbis.unread(message.substring(patternIndex, message.length()).getBytes()); message.setLength(patternIndex); } // TODO encoding here, too... return nullEmptyArray(message.toString().getBytes()); } finally { // TODO - this doesn't seem very reliable, since loop above can end // without EOF. On the other hand, what else can we do? Entire logic // is not very dependable, IMHO. XmlMessageEOFProtocol is more likely // to be correct here, I think. // clear from map if stream has ended if (len < 0) { pbMap.remove(is); } } } /** * Show we continue reading? This class, following previous implementations, only * reads while input is saturated. * @see XmlMessageEOFProtocol * * @param patternIndex The index of the xml tag (or -1 if the next message not found) * @param len The amount of data read this loop (or -1 if EOF) * @param available The amount of data available to read * @return true if the read should continue */ protected boolean isRepeat(int patternIndex, int len, int available) { return patternIndex < 0 && len == READ_BUFFER_SIZE && available > 0; } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/XmlMessageEOFProtocol.java0000644000175000017500000000221410745677442033343 0ustar charlescharles/* * $Id: XmlMessageEOFProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; /** * Extend {@link org.mule.transport.tcp.protocols.XmlMessageProtocol} to continue reading * until either a new message or EOF is found. */ public class XmlMessageEOFProtocol extends XmlMessageProtocol { /** * Continue reading til EOF or new document found * * @param patternIndex The index of the xml tag (or -1 if the next message not found) * @param len The amount of data read this loop (or -1 if EOF) * @param available The amount of data available to read * @return true if the read should continue */ // @Override protected boolean isRepeat(int patternIndex, int len, int available) { return patternIndex < 0; } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/DirectProtocol.java0000644000175000017500000000752110745677442032164 0ustar charlescharles/* * $Id: DirectProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import java.io.IOException; import java.io.InputStream; import java.text.MessageFormat; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * The DirectProtocol class is an application level tcp protocol that does nothing. * The socket is read until no more bytes are (momentarily) available * (previously the transfer buffer also had to be full on the previous read, which made * stronger requirements on the underlying network). On slow networks * {@link org.mule.transport.tcp.protocols.EOFProtocol} and * {@link org.mule.transport.tcp.protocols.LengthProtocol} may be more reliable. * *

Writing simply writes the data to the socket.

*/ public class DirectProtocol extends AbstractByteProtocol { protected static final int UNLIMITED = -1; private static final Log logger = LogFactory.getLog(DirectProtocol.class); private static final int DEFAULT_BUFFER_SIZE = 8192; protected int bufferSize; public DirectProtocol() { this(STREAM_OK, DEFAULT_BUFFER_SIZE); } public DirectProtocol(boolean streamOk, int bufferSize) { super(streamOk); this.bufferSize = bufferSize; } public Object read(InputStream is) throws IOException { return read(is, UNLIMITED); } public Object read(InputStream is, int limit) throws IOException { // this can grow on repeated reads ByteArrayOutputStream baos = new ByteArrayOutputStream(bufferSize); try { byte[] buffer = new byte[bufferSize]; int len; int remain = remaining(limit, limit, 0); boolean repeat; do { len = copy(is, buffer, baos, remain); remain = remaining(limit, remain, len); repeat = EOF != len && remain > 0 && isRepeat(len, is.available()); if (logger.isDebugEnabled()) { logger.debug(MessageFormat.format( "len/limit/repeat: {0}/{1}/{2}", new Object[] {new Integer(len), new Integer(limit), Boolean.valueOf(repeat)})); } } while (repeat); } finally { baos.flush(); baos.close(); } return nullEmptyArray(baos.toByteArray()); } protected int remaining(int limit, int remain, int len) { if (UNLIMITED == limit) { return bufferSize; } else if (EOF != len) { return remain - len; } else { return remain; } } /** * Decide whether to repeat transfer. This implementation does so if * more data are available. Note that previously, while documented as such, * there was also the additional requirement that the previous transfer * completely used the transfer buffer. * * @param len Amount transferred last call (-1 on EOF or socket error) * @param available Amount available * @return true if the transfer should continue */ protected boolean isRepeat(int len, int available) { // previous logic - less reliable on slow networks // return len == bufferSize && available > 0; return available > 0; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/MuleMessageEOFProtocol.javamule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/MuleMessageEOFProtocol.java0000644000175000017500000000230410745677442033505 0ustar charlescharles/* * $Id: MuleMessageEOFProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * This Protocol will send the actual Mule Message over the TCP channel, and in this * way we are preserving any headers which might be needed, for example Correlation * IDs in order to be able to aggregate messages after chunking. Data are read until * the client closes the channel. */ public class MuleMessageEOFProtocol extends EOFProtocol { // @Override public Object read(InputStream is) throws IOException { return MuleMessageWorker.doRead(super.read(is)); } // @Override public void write(OutputStream os, Object unused) throws IOException { super.write(os, MuleMessageWorker.doWrite()); } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/EOFProtocol.java0000644000175000017500000000175110745677442031362 0ustar charlescharles/* * $Id: EOFProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; /** * The EOFProtocol class is an application level tcp protocol that does nothing. * Reading is terminated by the stream being closed by the client. */ public class EOFProtocol extends DirectProtocol { /** * Repeat until end of file * * @param len Amount transferred last call (-1 on EOF or socket error) * @param available Amount available * @return true if the transfer should continue */ // @Override protected boolean isRepeat(int len, int available) { return true; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/MuleMessageSafeProtocol.javamule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/MuleMessageSafeProtocol.jav0000644000175000017500000000234210745677442033613 0ustar charlescharles/* * $Id: MuleMessageSafeProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; /** * This Protocol will send the actual Mule Message over the TCP channel, and in this * way we are preserving any headers which might be needed, for example Correlation * IDs in order to be able to aggregate messages after chunking. Data are encoded * using {@link org.mule.transport.tcp.protocols.SafeProtocol}. */ public class MuleMessageSafeProtocol extends SafeProtocol { // @Override public Object read(InputStream is) throws IOException { return MuleMessageWorker.doRead(super.read(is)); } // @Override public void write(OutputStream os, Object unused) throws IOException { super.write(os, MuleMessageWorker.doWrite()); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/MuleMessageLengthProtocol.javamule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/MuleMessageLengthProtocol.j0000644000175000017500000000235210745677442033630 0ustar charlescharles/* * $Id: MuleMessageLengthProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * This Protocol will send the actual Mule Message over the TCP channel, and in this * way we are preserving any headers which might be needed, for example Correlation * IDs in order to be able to aggregate messages after chunking. Data are encoded * using {@link org.mule.transport.tcp.protocols.LengthProtocol}. */ public class MuleMessageLengthProtocol extends LengthProtocol { // @Override public Object read(InputStream is) throws IOException { return MuleMessageWorker.doRead(super.read(is)); } // @Override public void write(OutputStream os, Object unused) throws IOException { super.write(os, MuleMessageWorker.doWrite()); } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/LengthProtocol.java0000644000175000017500000000725510745677442032177 0ustar charlescharles/* * $Id: LengthProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * The LengthProtocol is an application level tcp protocol that can be used to * transfer large amounts of data without risking some data to be loss. The protocol * is defined by sending / reading an integer (the packet length) and then the data * to be transferred. * *

Note that use of this protocol must be symmetric - both the sending and receiving * connectors must use the same protocol.

*/ public class LengthProtocol extends DirectProtocol { private static final Log logger = LogFactory.getLog(LengthProtocol.class); // TODO - can we not get this from the API somewhere? private static final int SIZE_INT = 4; public static final int NO_MAX_LENGTH = -1; private int maxMessageLength; public LengthProtocol() { this(NO_MAX_LENGTH); } public LengthProtocol(int maxMessageLength) { super(NO_STREAM, SIZE_INT); this.setMaxMessageLength(maxMessageLength); } public Object read(InputStream is) throws IOException { // original comments indicated that we nede to use read(byte[]) rather than readInt() // to avoid socket timeouts - don't understand, but don't want to risk change. // first read the data necessary to know the length of the payload DataInputStream dis = new DataInputStream(is); dis.mark(SIZE_INT); // this pulls through SIZE_INT bytes if (null == super.read(dis, SIZE_INT)) { return null; // eof } // reset and read the integer dis.reset(); int length = dis.readInt(); if (logger.isDebugEnabled()) { logger.debug("length: " + length); } if (length < 0 || (getMaxMessageLength() > 0 && length > getMaxMessageLength())) { throw new IOException("Length " + length + " exceeds limit: " + getMaxMessageLength()); } // finally read the rest of the data byte[] buffer = new byte[length]; dis.readFully(buffer); if (logger.isDebugEnabled()) { logger.debug("length read: " + buffer.length); } return buffer; } // @Override protected void writeByteArray(OutputStream os, byte[] data) throws IOException { // Write the length and then the data. DataOutputStream dos = new DataOutputStream(os); dos.writeInt(data.length); dos.write(data); dos.flush(); } /** * Read all four bytes for initial integer (limit is set in read) * * @param len Amount transferred last call (-1 on EOF or socket error) * @param available Amount available * @return true if the transfer should continue */ // @Override protected boolean isRepeat(int len, int available) { return true; } public int getMaxMessageLength() { return maxMessageLength; } public void setMaxMessageLength(int maxMessageLength) { this.maxMessageLength = maxMessageLength; } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/ProtocolStream.java0000644000175000017500000000347710745677442032213 0ustar charlescharles/* * $Id: ProtocolStream.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.transport.tcp.TcpProtocol; import org.mule.util.ClassUtils; import java.io.IOException; import java.io.OutputStream; public class ProtocolStream extends OutputStream { private boolean streamOk; private TcpProtocol protocol; private OutputStream os; public ProtocolStream(TcpProtocol protocol, boolean streamOk, OutputStream os) { this.protocol = protocol; this.streamOk = streamOk; this.os = os; } private void assertStreamOk() { if (!streamOk) { throw new IllegalArgumentException("TCP protocol " + ClassUtils.getSimpleName(protocol.getClass()) + " does not support streaming output"); } } public void write(byte b[]) throws IOException { assertStreamOk(); protocol.write(os, b); } public void write(byte b[], int off, int len) throws IOException { assertStreamOk(); byte[] buffer = new byte[len]; System.arraycopy(b, off, buffer, 0, len); protocol.write(os, buffer); } public void flush() throws IOException { assertStreamOk(); os.flush(); } public void write(int b) throws IOException { write(new byte[]{(byte) b}); } public void close() throws IOException { assertStreamOk(); os.close(); } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/SafeProtocol.java0000644000175000017500000000732710745677442031634 0ustar charlescharles/* * $Id: SafeProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.ResponseOutputStream; import org.mule.transport.tcp.TcpProtocol; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; /** * This precedes every message with a cookie. * It should probably not be used in production. * We use ths protocol as the default because previously people tended to use DefaultProtocol without considering packet fragmentation etc. * You should probably change to LengthProtocol. * Remember - both sender and receiver must use the same protocol. */ public class SafeProtocol implements TcpProtocol { public static final String COOKIE = "You are using SafeProtocol"; private TcpProtocol delegate = new LengthProtocol(); private TcpProtocol cookieProtocol = new LengthProtocol(COOKIE.length()); public Object read(InputStream is) throws IOException { if (assertSiblingSafe(is)) { Object result = delegate.read(is); if (null == result) { // EOF after cookie but before data helpUser(); } return result; } else { return null; } } public void write(OutputStream os, Object data) throws IOException { assureSibling(os); delegate.write(os, data); } public ResponseOutputStream createResponse(Socket socket) throws IOException { return new ResponseOutputStream(socket, new ProtocolStream(this, false, socket.getOutputStream())); } private void assureSibling(OutputStream os) throws IOException { cookieProtocol.write(os, COOKIE); } /** * @param is Stream to read data from * @return true if further data are available; false if EOF * @throws IOException */ private boolean assertSiblingSafe(InputStream is) throws IOException { Object cookie = null; try { cookie = cookieProtocol.read(is); } catch (Exception e) { helpUser(e); } if (null != cookie) { if (!(cookie instanceof byte[] && ((byte[]) cookie).length == COOKIE.length() && COOKIE.equals(new String((byte[]) cookie)))) { helpUser(); } else { return true; } } return false; // eof } private void helpUser() throws IOException { throw new IOException("You are not using a consistent protocol on your TCP transport. " + "Please read the documentation for the TCP transport, " + "paying particular attention to the protocol parameter."); } private void helpUser(Exception e) throws IOException { throw (IOException) new IOException("An error occurred while verifying your connection. " + "You may not be using a consistent protocol on your TCP transport. " + "Please read the documentation for the TCP transport, " + "paying particular attention to the protocol parameter.").initCause(e); } public void setMaxMessageLength(int maxMessageLength) { delegate = new LengthProtocol(maxMessageLength); } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/protocols/AbstractByteProtocol.java0000644000175000017500000001602710745677442033342 0ustar charlescharles/* * $Id: AbstractByteProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.ResponseOutputStream; import org.mule.api.transport.MessageAdapter; import org.mule.transport.tcp.TcpProtocol; import org.mule.util.ClassUtils; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Serializable; import java.net.Socket; import java.net.SocketException; import java.net.SocketTimeoutException; import org.apache.commons.lang.SerializationUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This Abstract class has been introduced so as to have the byte protocols (i.e. the * protocols that had only a single write method taking just an array of bytes as a * parameter) to inherit from since they will all behave the same, i.e. if the object * is serializable, serialize it into an array of bytes and send it. *

*

Note that the raw write method has changed name from write to * writeByteArray. This is to remove ambiguity from the code. In almost * all cases it is possible to call {@link #write(java.io.OutputStream, Object)} which * will, via {@link #write(java.io.OutputStream, Object)}, dispatch to * {@link #writeByteArray(java.io.OutputStream, byte[])}.

. */ public abstract class AbstractByteProtocol implements TcpProtocol { private static final Log logger = LogFactory.getLog(DirectProtocol.class); private static final long PAUSE_PERIOD = 100; public static final int EOF = -1; // make this really clear in subclasses, because otherwise people will forget public static final boolean STREAM_OK = true; public static final boolean NO_STREAM = false; private boolean streamOk; public AbstractByteProtocol(boolean streamOk) { this.streamOk = streamOk; } public void write(OutputStream os, Object data) throws IOException { if (data instanceof InputStream) { if (streamOk) { IOUtils.copyLarge((InputStream) data, os); os.flush(); os.close(); } else { throw new IOException("TCP protocol " + ClassUtils.getSimpleName(getClass()) + " cannot handle streaming"); } } else if (data instanceof MessageAdapter) { write(os, ((MessageAdapter) data).getPayload()); } else if (data instanceof byte[]) { writeByteArray(os, (byte[]) data); } else if (data instanceof String) { // TODO SF: encoding is lost/ignored; it is probably a good idea to have // a separate "stringEncoding" property on the protocol writeByteArray(os, ((String) data).getBytes()); } else if (data instanceof Serializable) { writeByteArray(os, SerializationUtils.serialize((Serializable) data)); } else { throw new IllegalArgumentException("Cannot serialize data: " + data); } } protected void writeByteArray(OutputStream os, byte[] data) throws IOException { os.write(data); } /** * Manage non-blocking reads and handle errors * * @param is The input stream to read from * @param buffer The buffer to read into * @return The amount of data read (always non-zero, -1 on EOF or socket exception) * @throws IOException other than socket exceptions */ protected int safeRead(InputStream is, byte[] buffer) throws IOException { return safeRead(is, buffer, buffer.length); } /** * Manage non-blocking reads and handle errors * * @param is The input stream to read from * @param buffer The buffer to read into * @param size The amount of data (upper bound) to read * @return The amount of data read (always non-zero, -1 on EOF or socket exception) * @throws IOException other than socket exceptions */ protected int safeRead(InputStream is, byte[] buffer, int size) throws IOException { int len; try { do { len = is.read(buffer, 0, size); if (0 == len) { // wait for non-blocking input stream // use new lock since not expecting notification try { Thread.sleep(PAUSE_PERIOD); } catch (InterruptedException e) { // no-op } } } while (0 == len); return len; } catch (SocketException e) { // do not pollute the log with a stacktrace, log only the message logger.info("Socket exception occured: " + e.getMessage()); return EOF; } catch (SocketTimeoutException e) { logger.debug("Socket timeout."); return EOF; } } /** * Make a single transfer from source to dest via a byte array buffer * * @param source Source of data * @param buffer Buffer array for transfer * @param dest Destination of data * @return Amount of data transferred, or -1 on eof or socket error * @throws IOException On non-socket error */ protected int copy(InputStream source, byte[] buffer, OutputStream dest) throws IOException { return copy(source, buffer, dest, buffer.length); } /** * Make a single transfer from source to dest via a byte array buffer * * @param source Source of data * @param buffer Buffer array for transfer * @param dest Destination of data * @param size The amount of data (upper bound) to read * @return Amount of data transferred, or -1 on eof or socket error * @throws IOException On non-socket error */ protected int copy(InputStream source, byte[] buffer, OutputStream dest, int size) throws IOException { int len = safeRead(source, buffer, size); if (len > 0) { dest.write(buffer, 0, len); } return len; } protected byte[] nullEmptyArray(byte[] data) { if (0 == data.length) { return null; } else { return data; } } public ResponseOutputStream createResponse(Socket socket) throws IOException { return new ResponseOutputStream(socket, new ProtocolStream(this, streamOk, socket.getOutputStream())); } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/TcpMessageReceiver.java0000644000175000017500000003215610757615756030731 0ustar charlescharles/* * $Id: TcpMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.DisposeException; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.AbstractReceiverResourceWorker; import org.mule.transport.ConnectException; import org.mule.transport.tcp.i18n.TcpMessages; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; import java.net.SocketAddress; import java.net.SocketTimeoutException; import java.net.URI; import java.util.Iterator; import java.util.List; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkException; import javax.resource.spi.work.WorkManager; /** * TcpMessageReceiver acts like a TCP server to receive socket * requests. */ public class TcpMessageReceiver extends AbstractMessageReceiver implements Work { private ServerSocket serverSocket = null; public TcpMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); } protected void doConnect() throws ConnectException { disposing.set(false); URI uri = endpoint.getEndpointURI().getUri(); try { serverSocket = ((TcpConnector) connector).getServerSocket(uri); } catch (Exception e) { throw new org.mule.transport.ConnectException(TcpMessages.failedToBindToUri(uri), e, this); } try { getWorkManager().scheduleWork(this, WorkManager.INDEFINITE, null, connector); } catch (WorkException e) { throw new ConnectException(CoreMessages.failedToScheduleWork(), e, this); } } protected void doDisconnect() throws ConnectException { // this will cause the server thread to quit disposing.set(true); try { if (serverSocket != null) { if (logger.isDebugEnabled()) { logger.debug("Closing: " + serverSocket); } serverSocket.close(); } } catch (IOException e) { logger.warn("Failed to close server socket: " + e.getMessage(), e); } } protected void doStart() throws MuleException { // nothing to do } protected void doStop() throws MuleException { // nothing to do } /** * Obtain the serverSocket * @return the server socket for this server */ public ServerSocket getServerSocket() { return serverSocket; } public void run() { while (!disposing.get()) { if (connector.isStarted() && !disposing.get()) { Socket socket = null; try { socket = serverSocket.accept(); if (logger.isTraceEnabled()) { logger.trace("Accepted: " + serverSocket); } } catch (java.io.InterruptedIOException iie) { if (logger.isDebugEnabled()) { logger.debug("Interupted IO doing serverSocket.accept: " + iie.getMessage()); } } catch (Exception e) { if (!connector.isDisposed() && !disposing.get()) { logger.warn("Accept failed on socket: " + e, e); handleException(new ConnectException(e, this)); } } if (socket != null) { try { Work work = createWork(socket); try { getWorkManager().scheduleWork(work, WorkManager.INDEFINITE, null, connector); } catch (WorkException e) { logger.error("Tcp Server receiver Work was not processed: " + e.getMessage(), e); } } catch (IOException e) { handleException(e); } } } } } public void release() { // template method } protected void doDispose() { try { if (serverSocket != null && !serverSocket.isClosed()) { if (logger.isDebugEnabled()) { logger.debug("Closing: " + serverSocket); } serverSocket.close(); } serverSocket = null; } catch (Exception e) { logger.error(new DisposeException(TcpMessages.failedToCloseSocket(), e, this)); } logger.info("Closed Tcp port"); } protected Work createWork(Socket socket) throws IOException { return new TcpWorker(socket, this); } protected class TcpWorker extends AbstractReceiverResourceWorker implements Disposable { protected Socket socket = null; protected TcpInputStream dataIn; protected InputStream underlyingIn; protected OutputStream dataOut; protected TcpProtocol protocol; protected boolean dataInWorkFinished = false; protected Object notify = new Object(); private boolean moreMessages = true; public TcpWorker(Socket socket, AbstractMessageReceiver receiver) throws IOException { super(socket, receiver, ((TcpConnector) connector).getTcpProtocol().createResponse(socket)); this.socket = socket; final TcpConnector tcpConnector = ((TcpConnector) connector); protocol = tcpConnector.getTcpProtocol(); try { tcpConnector.configureSocket(TcpConnector.SERVER, socket); underlyingIn = new BufferedInputStream(socket.getInputStream()); dataIn = new TcpInputStream(underlyingIn) { public void close() throws IOException { // Don't actually close the stream, we just want to know if the // we want to stop receiving messages on this sockete. // The Protocol is responsible for closing this. dataInWorkFinished = true; moreMessages = false; synchronized (notify) { notify.notifyAll(); } } }; dataOut = new BufferedOutputStream(socket.getOutputStream()); } catch (IOException e) { logger.error("Failed to set Socket properties: " + e.getMessage(), e); } } public void dispose() { releaseSocket(); } public void release() { waitForStreams(); releaseSocket(); } private void waitForStreams() { // The Message with the InputStream as a payload can be dispatched // into a different thread, in which case we need to wait for it to // finish streaming if (!dataInWorkFinished) { synchronized (notify) { if (!dataInWorkFinished) { try { notify.wait(); } catch (InterruptedException e) { } } } } } /** * Releases the socket when the input stream is closed. */ private void releaseSocket() { try { if (socket != null && !socket.isClosed()) { if (logger.isDebugEnabled()) { // some dirty workaround for IBM JSSE's SSL implementation, // which closes sockets asynchronously by that point. final SocketAddress socketAddress = socket.getLocalSocketAddress(); if (socketAddress == null) { logger.debug("Listener has already been closed by other process."); } else { logger.debug("Closing listener: " + socketAddress); } } shutdownSocket(); socket.close(); } } catch (IOException e) { logger.warn("Socket close failed with: " + e); } } protected void shutdownSocket() throws IOException { socket.shutdownOutput(); } protected void bindTransaction(Transaction tx) throws TransactionException { //nothing to do } protected Object getNextMessage(Object resource) throws Exception { Object readMsg = null; try { readMsg = protocol.read(dataIn); if (dataIn.isStreaming()) { moreMessages = false; } return readMsg; } catch (SocketTimeoutException e) { if (!socket.getKeepAlive()) { return null; } } finally { if (readMsg == null) { // Protocols can return a null object, which means we're done // reading messages for now and can mark the stream for closing later. // Also, exceptions can be thrown, in which case we're done reading. dataIn.close(); } } return null; } protected boolean hasMoreMessages(Object message) { return !socket.isClosed() && !dataInWorkFinished && !disposing.get() && moreMessages; } //@Override protected void handleResults(List messages) throws Exception { //should send back only if remote synch is set or no outbound endpoints if (endpoint.isRemoteSync() || !service.getOutboundRouter().hasEndpoints()) { for (Iterator iterator = messages.iterator(); iterator.hasNext();) { Object o = iterator.next(); protocol.write(dataOut, o); dataOut.flush(); } } } protected Object processData(Object data) throws Exception { MessageAdapter adapter = connector.getMessageAdapter(data); OutputStream os = ((TcpConnector) connector).getTcpProtocol().createResponse(socket); MuleMessage returnMessage = routeMessage(new DefaultMuleMessage(adapter), endpoint.isSynchronous(), os); if (returnMessage != null) { return returnMessage; } else { return null; } } protected void preRouteMuleMessage(final DefaultMuleMessage message) throws Exception { super.preRouteMuleMessage(message); final SocketAddress clientAddress = socket.getRemoteSocketAddress(); if (clientAddress != null) { message.setProperty(MuleProperties.MULE_REMOTE_CLIENT_ADDRESS, clientAddress.toString()); } } } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/TcpSocketKey.java0000644000175000017500000000411710745677442027552 0ustar charlescharles/* * $Id: TcpSocketKey.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.api.endpoint.ImmutableEndpoint; import java.net.InetAddress; import java.net.InetSocketAddress; /** * This is used to adapt an endpoint so that it can be used as a key for sockets. It must * meet two requirements: (1) implement hash and equals in a way that reflects socket identity * (ie using address and port); (2) allow access to the endpoint for use in the socket factory. * For simplicity we also expose the connector, address and port directly. */ public class TcpSocketKey { private InetSocketAddress address; private ImmutableEndpoint endpoint; public TcpSocketKey(ImmutableEndpoint endpoint) { if (!(endpoint.getConnector() instanceof TcpConnector)) { throw new IllegalArgumentException("Sockets must be keyed via a TCP endpoint"); } this.endpoint = endpoint; address = new InetSocketAddress( endpoint.getEndpointURI().getHost(), endpoint.getEndpointURI().getPort()); } public boolean equals(Object obj) { return obj instanceof TcpSocketKey && address.equals(((TcpSocketKey) obj).address); } public int hashCode() { return address.hashCode(); } public ImmutableEndpoint getEndpoint() { return endpoint; } public TcpConnector getConnector() { return (TcpConnector) endpoint.getConnector(); } public InetAddress getInetAddress() { return address.getAddress(); } public int getPort() { return address.getPort(); } public String toString() { return getInetAddress() + ":" + getPort(); } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/TcpMessageDispatcherFactory.java0000644000175000017500000000160010757615756032571 0ustar charlescharles/* * $Id: TcpMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; public class TcpMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new TcpMessageDispatcher(endpoint); } } mule-2.0.1/transports/tcp/src/main/java/org/mule/transport/tcp/AbstractTcpSocketFactory.java0000644000175000017500000000527210745677442032120 0ustar charlescharles/* * $Id: AbstractTcpSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.util.MapUtils; import java.io.IOException; import java.net.Socket; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.pool.KeyedPoolableObjectFactory; /** * Creates a client socket using the socket address extracted from the endpoint. Addtional * socket parameters will also be set from the connector */ public abstract class AbstractTcpSocketFactory implements KeyedPoolableObjectFactory { /** * logger used by this class */ private static final Log logger = LogFactory.getLog(TcpSocketFactory.class); public Object makeObject(Object key) throws Exception { TcpSocketKey socketKey = (TcpSocketKey) key; Socket socket = createSocket(socketKey); socket.setReuseAddress(true); TcpConnector connector = socketKey.getConnector(); connector.configureSocket(TcpConnector.CLIENT, socket); return socket; } protected abstract Socket createSocket(TcpSocketKey key) throws IOException; public void destroyObject(Object key, Object object) throws Exception { Socket socket = (Socket) object; if(!socket.isClosed()) { socket.close(); } } public boolean validateObject(Object key, Object object) { Socket socket = (Socket) object; return !socket.isClosed(); } public void activateObject(Object key, Object object) throws Exception { // cannot really activate a Socket } public void passivateObject(Object key, Object object) throws Exception { TcpSocketKey socketKey = (TcpSocketKey) key; boolean keepSocketOpen = MapUtils.getBooleanValue(socketKey.getEndpoint().getProperties(), TcpConnector.KEEP_SEND_SOCKET_OPEN_PROPERTY, socketKey.getConnector().isKeepSendSocketOpen()); Socket socket = (Socket) object; if (!keepSocketOpen) { try { if (socket != null) { socket.close(); } } catch (IOException e) { logger.debug("Failed to close socket after dispatch: " + e.getMessage()); } } } }mule-2.0.1/transports/tcp/src/main/resources/0000755000175000017500000000000011351410645021032 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/resources/META-INF/0000755000175000017500000000000011351410645022172 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012110754365306025044 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/tcp/2.0/mule-tcp.xsd=META-INF/mule-tcp.xsdmule-2.0.1/transports/tcp/src/main/resources/META-INF/mule-tcp.xsd0000644000175000017500000004003510764002667024452 0ustar charlescharles Connect Mule to a TCP socket, to send or receive data via the network. The size of the buffer (in bytes) used when sending data, set on the socket itself. The size of the buffer (in bytes) used when receiving data, set on the socket itself. The maximum queue length for incoming connections. If set, transmitted data are not collected together for greater efficiency, but sent immediately. If set (the default) then SO_REUSEADDRESS is set on server sockets before binding. This helps reduce "address already in use" errors when a socket is re-used. This sets the socket's SO_TIMEOUT value when the socket is used as a client. Reading from the socket will block for up to this long (in milliseconds) before the read fails. A value of 0 (the default) causes the read to wait indefinitely (if no data arrive). This sets the socket's SO_TIMEOUT value when the socket is used as a server. Reading from the socket will block for up to this long (in milliseconds) before the read fails. A value of 0 (the default) causes the read to wait indefinitely (if no data arrive). This sets the socket's SO_LINGER value. This is related to how long (in milliseconds) the socket will take to close so that any remaining data are transmitted correctly. If set, the socket is not closed after sending a message. Enables SO_KEEPALIVE behaviour on open sockets. This automatically checks socket connections which are open but unused for long periods and closes them if the connection becomes unavailable. This "blips" the socket, opening and closing it to validate the connection, when first accessed. The class name for the protocol handler. This controls how the raw data stream is converted into messages. By default messages are constructed as dara are received, with no correction for multiple packets or fragmentation. You nearly always want to change this (or use a transport that includes a protocol, like HTTP). TCP does not guarantee that a data written to a socket are transmitted in a single packet, so if we want to transmit entire Mule messages reliably we must specify an additional protocol. However, this is not an issue with streaming, so this is an alias for the "direct" (null) protocol. TCP does not guarantee that a data written to a socket are transmitted in a single packet, so if we want to transmit entire Mule messages reliably we must specify an additional protocol. This protocol uses XML syntax to isolate messages from the stream of bytes received, so it will only work with well-formed XML. TCP does not guarantee that a data written to a socket are transmitted in a single packet, so if we want to transmit entire Mule messages reliably we must specify an additional protocol. This protocol is similar to "xml-protocol", but will also use socket closure to terminate a message (even if the XML is not well-formed). TCP does not guarantee that a data written to a socket are transmitted in a single packet, so if we want to transmit entire Mule messages reliably we must specify an additional protocol. This protocol simply accumulates all data until the socket closes and places it in a single message. TCP does not guarantee that a data written to a socket are transmitted in a single packet. Using this "null" protocol does not change the normal TCP behaviour, so message fragmentation may occur (ie a single sent message may be received in several pieces, each as a separate received message). This was the default behaviour in Mule 1.x - normally it is not a good choice for messaging within Mule, but it may be necessary to interface with external TCP-based protocols. Do not send the entire mule message object (including properties etc), just the payload (contents)? This defaults to true when the protocol is not specified explicitly (when the safe protocol is used). TCP does not guarantee that a data written to a socket are transmitted in a single packet, so if we want to transmit entire Mule messages reliably we must specify an additional protocol. This protocol is similar to "length-protocol", but also includes a prefix. Verification of the prefix allows mis-matched protocols to be detected and avoids interpreting "random" data as a message length (which may give out of memory errors). This is the default protocol in Mule 2.x. TCP does not guarantee that a data written to a socket are transmitted in a single packet, so if we want to transmit entire Mule messages reliably we must specify an additional protocol. This protocol precedes each message with the number of bytes sent so that an entire message can be constructed on the received. An optional maximum length for the number of bytes in a single message. Messages larger than this will trigger an error in the receiver, but give an assurance that no out-of-memory error will occur. TCP does not guarantee that a data written to a socket are transmitted in a single packet, so if we want to transmit entire Mule messages reliably we must specify an additional protocol. The user may supply their own protocol implementation via this element. A class that implements the TcpProtocol interface. mule-2.0.1/transports/tcp/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014110754365306025223 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/tcp/2.0=org.mule.transport.tcp.config.TcpNamespaceHandler mule-2.0.1/transports/tcp/src/main/resources/META-INF/services/0000755000175000017500000000000011351410645024015 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410645024604 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410645025546 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410645027563 5ustar charlescharlesmule-2.0.1/transports/tcp/src/main/resources/META-INF/services/org/mule/providers/tcp.properties0000644000175000017500000000062210745677442032507 0ustar charlescharlesconnector=org.mule.transport.tcp.TcpConnector dispatcher.factory=org.mule.transport.tcp.TcpMessageDispatcherFactory requester.factory=org.mule.transport.tcp.TcpMessageRequesterFactory message.receiver=org.mule.transport.tcp.TcpMessageReceiver message.adapter=org.mule.transport.DefaultMessageAdapter inbound.transformer= outbound.transformer= endpoint.builder=org.mule.endpoint.SocketEndpointURIBuildermule-2.0.1/transports/tcp/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410645026325 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/tcp/src/main/resources/META-INF/services/org/mule/i18n/tcp-messages.propertiesmule-2.0.1/transports/tcp/src/main/resources/META-INF/services/org/mule/i18n/tcp-messages.properties0000644000175000017500000000023210710670237033036 0ustar charlescharles1=Failed to bind to uri "{0}" 2=Failed to close socket 3=Failed to initialize message reader 4=Output type {0} is not understood by the StreamingProtocol.mule-2.0.1/transports/tcp/src/test/0000755000175000017500000000000011351410643017051 5ustar charlescharlesmule-2.0.1/transports/tcp/src/test/java/0000755000175000017500000000000011351410642017771 5ustar charlescharlesmule-2.0.1/transports/tcp/src/test/java/org/0000755000175000017500000000000011351410642020560 5ustar charlescharlesmule-2.0.1/transports/tcp/src/test/java/org/mule/0000755000175000017500000000000011351410642021522 5ustar charlescharlesmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/0000755000175000017500000000000011351410642023556 5ustar charlescharlesmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/0000755000175000017500000000000011351410643024345 5ustar charlescharlesmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/TcpMessageReceiverTestCase.java0000644000175000017500000000260310757615756032412 0ustar charlescharles/* * $Id: TcpMessageReceiverTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import org.mule.transport.AbstractConnector; import org.mule.transport.AbstractMessageReceiverTestCase; import com.mockobjects.dynamic.Mock; public class TcpMessageReceiverTestCase extends AbstractMessageReceiverTestCase { public MessageReceiver getMessageReceiver() throws Exception { Mock mockComponent = new Mock(Service.class); mockComponent.expectAndReturn("getResponseTransformer", null); mockComponent.expectAndReturn("getResponseRouter", null); return new TcpMessageReceiver((AbstractConnector)endpoint.getConnector(), (Service)mockComponent.proxy(), endpoint); } public InboundEndpoint getEndpoint() throws Exception { return muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("tcp://localhost:1234"); } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/other/0000755000175000017500000000000011351410642025465 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/other/SocketTimingExperimentTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/other/SocketTimingExperimentTestCase.0000644000175000017500000001270510745677442033613 0ustar charlescharles/* * $Id: SocketTimingExperimentTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.other; import org.mule.tck.AbstractMuleTestCase; import java.io.IOException; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; /** * This was an attempt to understand the issue we saw with HTTP closing early. * Unfortunately, it doesn't shed any light on the problem. */ public class SocketTimingExperimentTestCase extends AbstractMuleTestCase { private static int MAX_COUNT = 3; private static int SERVER_PORT = 60323; private static String LOCALHOST = "localhost"; public void testSocketTiming() throws IOException, InterruptedException { try { boolean expectBadClient = expectBadClient(); logger.info("Expected bad client: " + expectBadClient); } catch (Exception e) { logger.info(e); } try { boolean expectBadServer = expectBadServer(); logger.info("Expected bad server: " + expectBadServer); } catch (Exception e) { logger.info(e); } } protected boolean expectBadClient() throws IOException, InterruptedException { for (int i = 0; i < MAX_COUNT; ++i) { if (! expectBadClientSingle()) { return false; } } return true; } protected boolean expectBadClientSingle() throws IOException, InterruptedException { ServerSocket server = new ServerSocket(); try { server.bind(new InetSocketAddress(LOCALHOST, SERVER_PORT)); return badSend(new Socket(LOCALHOST, SERVER_PORT), server.accept(), null); } finally { server.close(); } } protected boolean badSend(Socket from, Socket to, ServerSocket server) throws IOException, InterruptedException { try { // reduce buffers so that they are easy to fill to.setReceiveBufferSize(1); from.setSendBufferSize(1); // just in case this reduces close time // from.setReuseAddress(true); // make linger very small (same result if false or zero, or omitted) from.setSoLinger(false, 0); to.setSoLinger(false, 0); // don't send until buffer full (should be default) to.setTcpNoDelay(false); from.setTcpNoDelay(false); // write two bytes to the buffer - this is more than the target can receive // so we should end up with one byte in receiver and one in sender from.getOutputStream().write(1); from.getOutputStream().write(2); // this blocks, confirming buffers are correct // OH NO IT DOESN'T from.getOutputStream().write(3); // this appears to block (no timeout) // from.getOutputStream().write(new byte[100000]); // close (before buffer sent) // close everything we can think of... // from.shutdownInput(); // from.shutdownOutput(); from.close(); // to.shutdownOutput(); if (null != server) { server.close(); } // make sure tcp has time to fail Thread.sleep(100); // this works when server is closed (bad server case) if (null != server) { ServerSocket another = new ServerSocket(); another.bind(new InetSocketAddress(LOCALHOST, SERVER_PORT)); another.setReuseAddress(true); Socket another2 = new Socket(LOCALHOST, SERVER_PORT); Socket another3 = another.accept(); another2.getOutputStream().write(9); assertEquals(9, another3.getInputStream().read()); another3.close(); another2.close(); another.close(); } // now try reading - this should fail on second value? return 1 == to.getInputStream().read() && 2 == to.getInputStream().read() && 3 == to.getInputStream().read(); } finally { to.close(); if (!from.isClosed()) { from.close(); } } } protected boolean expectBadServer() throws IOException, InterruptedException { for (int i = 0; i < MAX_COUNT; ++i) { if (! expectBadServerSingle()) { return false; } } return true; } protected boolean expectBadServerSingle() throws IOException, InterruptedException { ServerSocket server = new ServerSocket(); try { server.bind(new InetSocketAddress(LOCALHOST, SERVER_PORT)); Socket client = new Socket(LOCALHOST, SERVER_PORT); return badSend(server.accept(), client, server); } finally { server.close(); } } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/TcpNamespaceHandlerTestCase.java0000644000175000017500000000351210745677442032530 0ustar charlescharles/* * $Id: TcpNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.tck.FunctionalTestCase; import org.mule.transport.tcp.TcpConnector; /** * TODO */ public class TcpNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "tcp-namespace-config.xml"; } public void testConfig() throws Exception { TcpConnector c = (TcpConnector)muleContext.getRegistry().lookupConnector("tcpConnector"); assertNotNull(c); assertEquals(1024, c.getReceiveBufferSize()); assertEquals(2048, c.getSendBufferSize()); assertEquals(50, c.getReceiveBacklog()); assertFalse(c.isReuseAddress().booleanValue()); // this is what we want - i was worried that the client was used as default if the server // wasn't set, but that's not the case assertEquals(-1, c.getServerSoTimeout()); assertEquals(3000, c.getClientSoTimeout()); assertTrue(c.isKeepAlive()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testSeparateTimeouts() throws Exception { TcpConnector c = (TcpConnector)muleContext.getRegistry().lookupConnector("separateTimeouts"); assertNotNull(c); assertEquals(4000, c.getServerSoTimeout()); assertEquals(3000, c.getClientSoTimeout()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/TcpSocketKeyTestCase.java0000644000175000017500000000337010745677442031241 0ustar charlescharles/* * $Id: TcpSocketKeyTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.FunctionalTestCase; import org.mule.transport.tcp.TcpSocketKey; public class TcpSocketKeyTestCase extends FunctionalTestCase { public void testHashAndEquals() throws MuleException { ImmutableEndpoint endpoint1in = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("globalEndpoint1"); TcpSocketKey key1in = new TcpSocketKey(endpoint1in); ImmutableEndpoint endpoint1out = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint("globalEndpoint1"); TcpSocketKey key1out = new TcpSocketKey(endpoint1out); ImmutableEndpoint endpoint2in = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("globalEndpoint2"); TcpSocketKey key2in = new TcpSocketKey(endpoint2in); assertEquals(key1in, key1in); assertEquals(key1in, key1out); assertNotSame(key1in, key2in); assertEquals(key1in.hashCode(), key1in.hashCode()); assertEquals(key1in.hashCode(), key1out.hashCode()); assertFalse(key1in.hashCode() == key2in.hashCode()); } protected String getConfigResources() { return "tcp-socket-key-test.xml"; } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/ConnectorFactoryTestCase.java0000644000175000017500000000173310745677442032154 0ustar charlescharles/* * $Id: ConnectorFactoryTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.AbstractMuleTestCase; public class ConnectorFactoryTestCase extends AbstractMuleTestCase { public void testCreate() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("tcp://7877"); assertNotNull(endpoint); assertNotNull(endpoint.getConnector()); assertEquals("tcp://localhost:7877", endpoint.getEndpointURI().getAddress()); } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/TcpSyncTestCase.java0000644000175000017500000000676310766204322030247 0ustar charlescharles/* * $Id: TcpSyncTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleSession; import org.mule.NullSessionHandler; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.FunctionalTestCase; import org.mule.transport.tcp.TcpConnector; import java.util.Arrays; public class TcpSyncTestCase extends FunctionalTestCase { private static final String endpointUri = "tcp://localhost:45441"; protected String getConfigResources() { return "tcp-sync.xml"; } protected MuleMessage send(Object payload) throws Exception { MuleMessage message = new DefaultMuleMessage(payload); ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( endpointUri); DefaultMuleSession session = new DefaultMuleSession(message, new NullSessionHandler(), muleContext); DefaultMuleEvent event = new DefaultMuleEvent(message, endpoint, session, true); event.setTimeout(60000); return event.getSession().sendEvent(event); } public void testSendString() throws Exception { MuleMessage message = send("data"); assertNotNull(message); String response = message.getPayloadAsString(); assertEquals("data", response); } public void testSyncResponseOfBufferSize() throws Exception { int size = 1024 * 16; TcpConnector tcp = (TcpConnector)muleContext.getRegistry().lookupConnector("tcpConnector"); tcp.setSendBufferSize(size); tcp.setReceiveBufferSize(size); byte[] data = fillBuffer(new byte[size]); MuleMessage message = send(data); assertNotNull(message); byte[] response = message.getPayloadAsBytes(); assertEquals(data.length, response.length); assertTrue(Arrays.equals(data, response)); } public void testManySyncResponseOfBufferSize() throws Exception { int size = 1024 * 16; TcpConnector tcp = (TcpConnector)muleContext.getRegistry().lookupConnector("tcpConnector"); tcp.setSendBufferSize(size); tcp.setReceiveBufferSize(size); byte[] data = fillBuffer(new byte[size]); for (int i = 0; i < 20; ++i) { MuleMessage message = send(data); assertNotNull(message); byte[] response = message.getPayloadAsBytes(); assertEquals(data.length, response.length); assertTrue(Arrays.equals(data, response)); } } public void testSyncResponseVeryBig() throws Exception { byte[] data = fillBuffer(new byte[1024 * 1024]); MuleMessage message = send(data); assertNotNull(message); byte[] response = message.getPayloadAsBytes(); assertEquals(data.length, response.length); assertTrue(Arrays.equals(data, response)); } protected byte[] fillBuffer(byte[] buffer) { for (int i = 0; i < buffer.length; ++i) { buffer[i] = (byte) (i % 255); } return buffer; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/MultipleNamedTcpConnectorsTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/MultipleNamedTcpConnectorsTestCase.ja0000644000175000017500000000150410745677442033604 0ustar charlescharles/* * $Id: MultipleNamedTcpConnectorsTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.tck.FunctionalTestCase; public class MultipleNamedTcpConnectorsTestCase extends FunctionalTestCase { protected String getConfigResources() { return "multiple-named-tcp-connectors-test.xml"; } public void testMultipleNamedConnectors() throws Exception { // no-op, the initialization must not fail. } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/TcpConnectorTestCase.java0000644000175000017500000000346510765313375031271 0ustar charlescharles/* * $Id: TcpConnectorTestCase.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; public class TcpConnectorTestCase extends AbstractConnectorTestCase { // @Override public Connector createConnector() throws Exception { TcpConnector c = new TcpConnector(); c.setName("TcpConnector"); return c; } public String getTestEndpointURI() { return "tcp://localhost:56801"; } public Object getValidMessage() throws Exception { return "Hello".getBytes(); } public void testValidListener() throws Exception { // TODO Implement } public void testProperties() throws Exception { TcpConnector c = (TcpConnector)getConnector(); c.setSendBufferSize(1024); assertEquals(1024, c.getSendBufferSize()); c.setSendBufferSize(0); assertEquals(TcpConnector.DEFAULT_BUFFER_SIZE, c.getSendBufferSize()); // timeouts c.setServerSoTimeout(-1); assertEquals(TcpConnector.DEFAULT_SOCKET_TIMEOUT, c.getServerSoTimeout()); c.setClientSoTimeout(-1); assertEquals(TcpConnector.DEFAULT_SOCKET_TIMEOUT, c.getClientSoTimeout()); c.setClientSoTimeout(1000); c.setServerSoTimeout(1000); assertEquals(1000, c.getServerSoTimeout()); assertEquals(1000, c.getClientSoTimeout()); } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/0000755000175000017500000000000011351410643026371 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/MuleMessageLengthTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/MuleMessageLengthTestCase.j0000644000175000017500000000222210763522057033560 0ustar charlescharles/* * $Id: MuleMessageLengthTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class MuleMessageLengthTestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test TCP Request"; protected String getConfigResources() { return "tcp-mplength-test.xml"; } public void testSend() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); MuleMessage result = client.send("clientEndpoint", TEST_MESSAGE, props); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); } }././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/XmlMessageEOFProtocolTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/XmlMessageEOFProtocolTestCa0000644000175000017500000000215310745677442033564 0ustar charlescharles/* * $Id: XmlMessageEOFProtocolTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.transport.tcp.protocols.XmlMessageEOFProtocol; public class XmlMessageEOFProtocolTestCase extends XmlMessageProtocolTestCase { // @Override protected void doSetUp() throws Exception { setProtocol(new XmlMessageEOFProtocol()); } // @Override public void testSlowStream() throws Exception { String msgData = "hello"; SlowInputStream bais = new SlowInputStream(msgData.getBytes()); byte[] result = read(bais); assertNotNull(result); // hurray! get everything assertEquals(msgData, new String(result)); } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/SafeProtocolTestCase.java0000644000175000017500000000365210754375733033316 0ustar charlescharles/* * $Id: SafeProtocolTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class SafeProtocolTestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test TCP Request"; protected String getConfigResources() { return "safe-protocol-test.xml"; } public void testSafeToSafe() throws MuleException { MuleClient client = new MuleClient(); assertResponseOk(client.send("tcp://localhost:65432?connector=safe", TEST_MESSAGE, null)); } public void testUnsafeToSafe() throws MuleException { MuleClient client = new MuleClient(); assertResponseBad(client.send("tcp://localhost:65432?connector=unsafe", TEST_MESSAGE, null)); } private void assertResponseOk(MuleMessage message) { assertNotNull("Null message", message); Object payload = message.getPayload(); assertNotNull("Null payload", payload); assertTrue("Payload not byte[]", payload instanceof byte[]); assertEquals(TEST_MESSAGE + " Received", new String((byte[]) payload)); } protected void assertResponseBad(MuleMessage message) { try { if (message.getPayloadAsString().equals(TEST_MESSAGE + " Received")) { fail("expected error"); } } catch (Exception e) { // expected } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/LengthProtocolTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/LengthProtocolTestCase.java0000644000175000017500000000276410745677442033666 0ustar charlescharles/* * $Id: LengthProtocolTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.transport.tcp.protocols.LengthProtocol; import java.io.ByteArrayInputStream; public class LengthProtocolTestCase extends DefaultProtocolTestCase { public LengthProtocolTestCase() { super(new LengthProtocol(), 1); } public void testFinalValue() throws Exception { byte[] result = (byte[]) getProtocol().read(new SlowInputStream()); assertEquals((byte) SlowInputStream.PAYLOAD, result[0]); } // try also with a "generous" input stream (ie one that will return all data // without delay) to make sure reset logic is ok public void testGenerous() throws Exception { byte[] bytes = new byte[SlowInputStream.FULL_LENGTH]; for (int i = 0; i < SlowInputStream.FULL_LENGTH; ++i) { bytes[i] = (byte) SlowInputStream.CONTENTS[i]; } ByteArrayInputStream bis = new ByteArrayInputStream(bytes); byte[] result = (byte[]) getProtocol().read(bis); assertEquals((byte) SlowInputStream.PAYLOAD, result[0]); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/DefaultProtocolTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/DefaultProtocolTestCase.jav0000644000175000017500000000257510745677442033670 0ustar charlescharles/* * $Id: DefaultProtocolTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.tcp.TcpProtocol; import org.mule.transport.tcp.protocols.DirectProtocol; public class DefaultProtocolTestCase extends AbstractMuleTestCase { private TcpProtocol protocol; private int expectedLength; public DefaultProtocolTestCase() { // for old (full buffer) condition in DefaultProtocol // this(new DefaultProtocol(), 1); this(new DirectProtocol(), SlowInputStream.FULL_LENGTH); } public DefaultProtocolTestCase(TcpProtocol protocol, int expectedLength) { this.protocol = protocol; this.expectedLength = expectedLength; } public void testRead() throws Exception { byte[] result = (byte[]) protocol.read(new SlowInputStream()); assertEquals(expectedLength, result.length); } protected TcpProtocol getProtocol() { return protocol; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/XmlMessageProtocolTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/XmlMessageProtocolTestCase.0000644000175000017500000001001710745677442033636 0ustar charlescharles/* * $Id: XmlMessageProtocolTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.tcp.protocols.XmlMessageProtocol; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; /** * Test by reading characters from a fixed StringBuffer instead of a TCP port. */ public class XmlMessageProtocolTestCase extends AbstractMuleTestCase { private XmlMessageProtocol xmp; protected void setProtocol(XmlMessageProtocol xmp) { this.xmp = xmp; } protected byte[] read(InputStream is) throws IOException { return(byte[]) xmp.read(is); } protected void doSetUp() throws Exception { setProtocol(new XmlMessageProtocol()); } protected void doTearDown() throws Exception { xmp = null; } public void testSingleMessage() throws Exception { String msgData = "hello"; ByteArrayInputStream bais = new ByteArrayInputStream(msgData.getBytes()); byte[] result = read(bais); assertNotNull(result); assertEquals(msgData, new String(result)); assertNull(read(bais)); } public void testTwoMessages() throws Exception { String[] msgData = {"hello", "goodbye"}; ByteArrayInputStream bais = new ByteArrayInputStream((msgData[0] + msgData[1]).getBytes()); byte[] result = read(bais); assertNotNull(result); assertEquals(msgData[0], new String(result)); result = read(bais); assertNotNull(result); assertEquals(msgData[1], new String(result)); assertNull(read(bais)); } public void testMultipleMessages() throws Exception { String[] msgData = {"1", "22", "333", "4444", "55555", "666666", "7777777", "88888888", "999999999", "aaaaaaaaaa", "bbbbbbbbbbb", "cccccccccccc", "ddddddddddddd", "eeeeeeeeeeeeee", "fffffffffffffff"}; StringBuffer allMsgData = new StringBuffer(); for (int i = 0; i < msgData.length; i++) { allMsgData.append(msgData[i]); } ByteArrayInputStream bais = new ByteArrayInputStream(allMsgData.toString().getBytes()); byte[] result; for (int i = 0; i < msgData.length; i++) { result = read(bais); assertNotNull(result); assertEquals(msgData[i], new String(result)); } assertNull(read(bais)); } public void testSlowStream() throws Exception { String msgData = "hello"; SlowInputStream bais = new SlowInputStream(msgData.getBytes()); byte[] result = read(bais); assertNotNull(result); // only get the first character! use XmlMessageEOFProtocol instead assertEquals(msgData.substring(0, 1), new String(result)); } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/EofProtocolTestCase.java0000644000175000017500000000130010745677442033137 0ustar charlescharles/* * $Id: EofProtocolTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import org.mule.transport.tcp.protocols.EOFProtocol; public class EofProtocolTestCase extends DefaultProtocolTestCase { public EofProtocolTestCase() { super(new EOFProtocol(), SlowInputStream.FULL_LENGTH); } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/protocols/SlowInputStream.java0000644000175000017500000000452310755041255032366 0ustar charlescharles/* * $Id: SlowInputStream.java 10803 2008-02-14 13:31:25Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.protocols; import java.io.IOException; import java.io.InputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Returns data one byte at a time. By default the data are a 4 byte integer, value 1, and * a single byte value -1. */ public class SlowInputStream extends InputStream { public static final int EOF = -1; public static int PAYLOAD = 255; public static int[] CONTENTS = new int[]{0, 0, 0, 1, PAYLOAD}; public static final int FULL_LENGTH = CONTENTS.length; private static final Log logger = LogFactory.getLog(SlowInputStream.class); private int[] contents; private int next = 0; private int mark = 0; public SlowInputStream() { this(CONTENTS); } public SlowInputStream(int[] contents) { this.contents = contents; } public SlowInputStream(byte[] bytes) { contents = new int[bytes.length]; for (int i = 0; i < bytes.length; ++i) { contents[i] = bytes[i]; } } public int available() throws IOException { int available = next < contents.length ? 1 : 0; logger.debug("available: " + available); return available; } public int read() throws IOException { int value = available() > 0 ? contents[next++] : EOF; logger.debug("read: " + value); return value; } public int read(byte b[], int off, int len) throws IOException { int value = read(); if (value != EOF) { b[off] = (byte) value; return 1; } else { return EOF; } } public synchronized void reset() throws IOException { next = mark; } public synchronized void mark(int readlimit) { mark = next; } public boolean markSupported() { return true; } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/0000755000175000017500000000000011351410643025660 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/LengthProtocolLengthTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/LengthProtocolLengthTestCase.j0000644000175000017500000000402510754375733033615 0ustar charlescharles/* * $Id: LengthProtocolLengthTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import edu.emory.mathcs.backport.java.util.Arrays; public class LengthProtocolLengthTestCase extends FunctionalTestCase { protected String getConfigResources() { return "length-protocol-length-test.xml"; } public void testLength() throws Exception { doTest("length", 5, true); doTest("length", 15, false); } public void testSafe() throws Exception { doTest("safe", 5, true); doTest("safe", 15, false); } protected void doTest(String endpoint, int length, boolean ok) throws Exception { byte[] message = new byte[length]; for (int i = 0; i < length; ++i) { message[i] = (byte)(i % 255); } MuleClient client = new MuleClient(); if (ok) { MuleMessage response = client.send(endpoint, message, null); assertNotNull(response); assertNotNull(response.getPayload()); assertTrue(Arrays.equals(message, response.getPayloadAsBytes())); } else { assertResponseBad(client.send(endpoint, message, null)); } } protected void assertResponseBad(MuleMessage message) { try { if (message.getPayloadAsString().equals(TEST_MESSAGE + " Received")) { fail("expected error"); } } catch (Exception e) { // expected } } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/InputStreamSource.java0000644000175000017500000000161610745677442032205 0ustar charlescharles/* * $Id: InputStreamSource.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; import org.mule.transport.tcp.integration.AbstractStreamingCapacityTestCase; import org.mule.transport.tcp.integration.BigInputStream; public class InputStreamSource { public static final long SIZE = 10 * AbstractStreamingCapacityTestCase.ONE_MB; // whether this is declared to return Object or InputStream makes no difference public Object doSomething(Object request) { return new BigInputStream(SIZE, 10); } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/ReuseMule2069TestCase.java0000644000175000017500000000177310745677442032440 0ustar charlescharles/* * $Id: ReuseMule2069TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; import org.mule.transport.tcp.TcpConnector; import org.mule.transport.tcp.TcpFunctionalTestCase; /** * This is just to check that the Boolean (rather than boolean) doesn't cause any problems */ public class ReuseMule2069TestCase extends TcpFunctionalTestCase { protected String getConfigResources() { return "reuse-mule-2069.xml"; } public void testReuseSetOnConnector() { assertTrue(((TcpConnector) muleContext.getRegistry().lookupConnector(TcpConnector.TCP)).isReuseAddress().booleanValue()); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/SafeProtocolMule2227TestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/SafeProtocolMule2227TestCase.j0000644000175000017500000000354110754375733033252 0ustar charlescharles/* * $Id: SafeProtocolMule2227TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; import org.mule.api.MuleException; import org.mule.module.client.MuleClient; import org.mule.transport.tcp.protocols.SafeProtocolTestCase; public class SafeProtocolMule2227TestCase extends SafeProtocolTestCase { // this actually "works" much of the time, in that a response is received that looks reasonable. // that's just because the test is so simple that the length encoded string is read by the // server as a literal chunk of text (including the cookies and lengths!). on the return these // are still present so the data that were sent are read (missing the appended text). // the rest of the time, it gives an out of memory error. that's because it responds to the // cookie alone, which means that "Received" is taken as a message, and "Re" gives a length of // 542270819 leading to a memory overflow // the only way round this i can see is to allow a parameter on the protocol to specify a // maximum size. see MULE-2449. // update - we now do have a maximum size public void testSafeToUnsafe() throws MuleException { MuleClient client = new MuleClient(); // this may fail, but should not crash try { client.send("tcp://localhost:65433?connector=safe", TEST_MESSAGE, null); } catch(Exception e) { // an error is ok - we were losing the JVM before } } }././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/MultiStreamMule1692TestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/MultiStreamMule1692TestCase.ja0000644000175000017500000000714010763522057033256 0ustar charlescharles/* * $Id: MultiStreamMule1692TestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; import org.mule.api.MuleEventContext; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalStreamingTestComponent; import java.util.HashMap; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class MultiStreamMule1692TestCase extends FunctionalTestCase { private static final Log logger = LogFactory.getLog(MultiStreamMule1692TestCase.class); public static final int TIMEOUT = 3000; public static final String TEST_MESSAGE = "Test TCP Request"; public static final String TEST_MESSAGE_2 = "Second test TCP Request"; public static final String RESULT = "Received stream; length: 16; 'Test...uest'"; public static final String RESULT_2 = "Received stream; length: 23; 'Seco...uest'"; protected String getConfigResources() { return "tcp-streaming-test.xml"; } private EventCallback newCallback(final CountDownLatch latch, final AtomicReference message) { return new EventCallback() { public synchronized void eventReceived(MuleEventContext context, Object component) { try { FunctionalStreamingTestComponent ftc = (FunctionalStreamingTestComponent) component; // without this we may have problems with the many repeats if (1 == latch.getCount()) { message.set(ftc.getSummary()); latch.countDown(); } } catch (Exception e) { logger.error(e.getMessage(), e); } } }; } public void testSend() throws Exception { MuleClient client = new MuleClient(); Object ftc = getComponent("testComponent"); assertTrue("FunctionalStreamingTestComponent expected", ftc instanceof FunctionalStreamingTestComponent); // assertNotNull(ftc); // assertEquals(1, ftc.getNumber()); final CountDownLatch latch = new CountDownLatch(1); final AtomicReference message = new AtomicReference(); ((FunctionalStreamingTestComponent) ftc).setEventCallback(newCallback(latch, message), TEST_MESSAGE.length()); client.dispatch("tcp://localhost:65432", TEST_MESSAGE, new HashMap()); latch.await(10, TimeUnit.SECONDS); assertEquals(RESULT, message.get()); final CountDownLatch latch2 = new CountDownLatch(1); final AtomicReference message2 = new AtomicReference(); ((FunctionalStreamingTestComponent) ftc).setEventCallback(newCallback(latch2, message2), TEST_MESSAGE_2.length()); client.dispatch("tcp://localhost:65432", TEST_MESSAGE_2, new HashMap()); latch2.await(10, TimeUnit.SECONDS); assertEquals(RESULT_2, message2.get()); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/ReuseExperimentMule2067TestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/ReuseExperimentMule2067TestCas0000644000175000017500000001707110745677442033410 0ustar charlescharles/* * $Id: ReuseExperimentMule2067TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; import org.mule.tck.AbstractMuleTestCase; import java.io.IOException; import java.net.BindException; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Can we avoid the "address already in use" errors by using SO_REUSEADDR? * * Typical results are
 [07-24 19:32:49] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats without reuse and a pause of 100 ms
 [07-24 19:33:49] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 57.3 +/- 33.15131973240282
 [07-24 19:33:49] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats with reuse and a pause of 100 ms
 [07-24 19:35:32] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 100.0 +/- 0.0
 [07-24 19:35:32] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats without reuse and a pause of 10 ms
 [07-24 19:35:48] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 96.8 +/- 7.332121111929359
 [07-24 19:35:48] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats with reuse and a pause of 10 ms
 [07-24 19:36:04] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 100.0 +/- 0.0
 [07-24 19:36:04] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats without reuse and a pause of 1 ms
 [07-24 19:36:10] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 75.8 +/- 37.690317058894586
 [07-24 19:36:10] INFO  ReuseExperimentMule2067TestCase [main]: Measuring average run length for 100 repeats with reuse and a pause of 1 ms
 [07-24 19:36:18] INFO  ReuseExperimentMule2067TestCase [main]: Average run length: 100.0 +/- 0.0
* which suggest that enabling address re-use could help with the issue. * * Note that if a single socket (ie a single port number) is reused for all tests we often * zeroes eveywhere (even with waits of 2sec and similar between iterations/tests). This * suggests that once the error occurs, the socket enters a long-lived "broken" state. * * All this is by AC on linux, dual CPU, Java 1.4 - I suspect results will vary like crazy * in different contexts. */ public class ReuseExperimentMule2067TestCase extends AbstractMuleTestCase { private static final int NO_WAIT = -1; private static final int PORT = 65432; private static boolean NO_REUSE = false; private static boolean REUSE = true; private Log logger = LogFactory.getLog(getClass()); public void testReuse() throws IOException { repeatOpenCloseClientServer(1000, 10, PORT, 1, REUSE, false); // fails, but less often? repeatOpenCloseClientServer(100, 10, PORT, 1, NO_REUSE, false); // intermittent } public void testMeasureImprovement() throws IOException { measureMeanRunLength(10, 100, 10, PORT, 100, NO_REUSE); measureMeanRunLength(10, 100, 10, PORT+10, 100, REUSE); measureMeanRunLength(10, 100, 10, PORT+20, 10, NO_REUSE); measureMeanRunLength(10, 100, 10, PORT+30, 10, REUSE); measureMeanRunLength(10, 100, 10, PORT+40, 1, NO_REUSE); measureMeanRunLength(10, 100, 10, PORT+50, 1, REUSE); } protected void measureMeanRunLength(int sampleSize, int numberOfRepeats, int numberOfConnections, int port, long pause, boolean reuse) throws IOException { logger.info("Measuring average run length for " + numberOfRepeats + " repeats " + (reuse ? "with" : "without") + " reuse and a pause of " + pause + " ms"); int totalLength = 0; long totalLengthSquared = 0; for (int i = 0; i < sampleSize; ++i) { int length = repeatOpenCloseClientServer(numberOfRepeats, numberOfConnections, port+i, pause, reuse, true); totalLength += length; totalLengthSquared += length * length; } double mean = totalLength / (double) sampleSize; double sd = Math.sqrt(totalLengthSquared / (double) sampleSize - mean * mean); logger.info("Average run length: " + mean + " +/- " + sd); } protected int repeatOpenCloseClientServer(int numberOfRepeats, int numberOfConnections, int port, long pause, boolean reuse, boolean noFail) throws IOException { String message = "Repeating openCloseClientServer with pauses of " + pause + " ms " + (reuse ? "with" : "without") + " reuse"; if (noFail) { logger.debug(message); } else { logger.info(message); } for (int i = 0; i < numberOfRepeats; i++) { if (0 != i) { pause(pause); } try { openCloseClientServer(numberOfConnections, port, reuse); } catch (BindException e) { if (noFail && e.getMessage().indexOf("Address already in use") > -1) { return i; } throw e; } } return numberOfRepeats; } protected void openCloseClientServer(int numberOfConnections, int port, boolean reuse) throws IOException { Server server = new Server(port, reuse); try { new Thread(server).start(); for (int i = 0; i < numberOfConnections; i++) { logger.debug("opening socket " + i); Socket client = new Socket("localhost", port); client.close(); } } finally { server.close(); } } protected void pause(long pause) { if (pause != NO_WAIT) { try { synchronized(this) { if (pause > 0) { this.wait(pause); } } } catch (InterruptedException e) { // ignore } } } protected static class Server implements Runnable { private Log logger = LogFactory.getLog(getClass()); private ServerSocket server; public Server(int port, boolean reuse) throws IOException { server = new ServerSocket(); server.setReuseAddress(reuse); server.bind(new InetSocketAddress("localhost", port)); } public void run() { try { while (true) { Socket socket = server.accept(); socket.close(); } } catch (Exception e) { logger.debug("Expected - dirty closedown: " + e); } } public void close() throws IOException { server.close(); server = null; } } }././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/SynchStreamingMule1687TestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/SynchStreamingMule1687TestCase0000644000175000017500000000274310763522057033365 0ustar charlescharles/* * $Id: SynchStreamingMule1687TestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.DefaultMessageAdapter; import java.io.ByteArrayInputStream; import java.io.InputStream; public class SynchStreamingMule1687TestCase extends FunctionalTestCase { public static final String TEST_MESSAGE = "Test TCP Request"; protected String getConfigResources() { return "tcp-synch-streaming-test.xml"; } public void testSendAndRequest() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("tcp://localhost:65432", new DefaultMuleMessage(new DefaultMessageAdapter(new ByteArrayInputStream(TEST_MESSAGE.getBytes())))); assertNotNull(message); Object payload = message.getPayload(); assertTrue(payload instanceof InputStream); assertEquals("Some value - set to make test ok", message.getPayloadAsString()); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/AbstractStreamingDownloadMule1389TestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/AbstractStreamingDownloadMule10000644000175000017500000000310110754375733033627 0ustar charlescharles/* * $Id: AbstractStreamingDownloadMule1389TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.tcp.integration.AbstractStreamingCapacityTestCase; public abstract class AbstractStreamingDownloadMule1389TestCase extends FunctionalTestCase { protected String endpoint; public AbstractStreamingDownloadMule1389TestCase(String endpoint) { this.endpoint = endpoint; } public void testDownloadSpeed() throws Exception { MuleClient client = new MuleClient(); long now = System.currentTimeMillis(); MuleMessage result = client.send(endpoint, "request", null); assertNotNull(result); assertNotNull(result.getPayload()); assertEquals(InputStreamSource.SIZE, result.getPayloadAsBytes().length); long then = System.currentTimeMillis(); double speed = InputStreamSource.SIZE / (double) (then - now) * 1000 / AbstractStreamingCapacityTestCase.ONE_MB; logger.info("Transfer speed " + speed + " MB/s (" + InputStreamSource.SIZE + " B in " + (then - now) + " ms)"); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/KeepSendSocketOpenMule1491TestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/KeepSendSocketOpenMule1491Test0000644000175000017500000001105610763522057033312 0ustar charlescharles/* * $Id: KeepSendSocketOpenMule1491TestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.tcp.protocols.LengthProtocol; import java.io.BufferedInputStream; import java.io.InputStream; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.HashMap; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; public class KeepSendSocketOpenMule1491TestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test TCP Request"; protected String getConfigResources() { return "tcp-keep-send-socket-open.xml"; } public void testSend() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); MuleMessage result = client.send("clientEndpoint", TEST_MESSAGE, props); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); // try an extra message in case it's a problem on repeat result = client.send("clientEndpoint", TEST_MESSAGE, props); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); } private void useServer(String endpoint, int port, int count) throws Exception { SimpleServerSocket server = new SimpleServerSocket(port); try { new Thread(server).start(); MuleClient client = new MuleClient(); client.send(endpoint, "Hello", null); client.send(endpoint, "world", null); assertEquals(count, server.getCount()); } finally { server.close(); } } public void testOpen() throws Exception { useServer("tcp://localhost:60197?connector=openConnectorLength", 60197, 1); } public void testClose() throws Exception { useServer("tcp://localhost:60196?connector=closeConnectorLength", 60196, 2); } private class SimpleServerSocket implements Runnable { private ServerSocket server; AtomicBoolean running = new AtomicBoolean(true); AtomicInteger count = new AtomicInteger(0); public SimpleServerSocket(int port) throws Exception { server = new ServerSocket(); logger.debug("starting server"); server.bind(new InetSocketAddress("localhost", port), 3); } public int getCount() { return count.get(); } public void run() { try { LengthProtocol protocol = new LengthProtocol(); while (true) { Socket socket = server.accept(); logger.debug("have connection " + count); count.incrementAndGet(); InputStream stream = new BufferedInputStream(socket.getInputStream()); // repeat for as many messages as we receive until null received while (true) { Object read = protocol.read(stream); if (null == read) { break; } String msg = new String((byte[]) read); logger.debug("read: " + msg); logger.debug("writing reply"); protocol.write(socket.getOutputStream(), "ok"); } } } catch (Exception e) { // an exception is expected during shutdown if (running.get()) { throw new RuntimeException(e); } } } public void close() { try { running.set(false); server.close(); } catch (Exception e) { // no-op } } } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/StreamingDownloadMule1389TestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/StreamingDownloadMule1389TestC0000644000175000017500000000154110745677442033362 0ustar charlescharles/* * $Id: StreamingDownloadMule1389TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; /** * This fails to work as described in the issue, but isn't HTTP... */ public class StreamingDownloadMule1389TestCase extends AbstractStreamingDownloadMule1389TestCase { public StreamingDownloadMule1389TestCase() { super("tcp://localhost:65432"); } protected String getConfigResources() { return "streaming-download-mule-1389.xml"; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/LingerExperimentMule2067TestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/LingerExperimentMule2067TestCa0000644000175000017500000001647410745677442033370 0ustar charlescharles/* * $Id: LingerExperimentMule2067TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; import org.mule.tck.AbstractMuleTestCase; import java.io.IOException; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Are the "address already in use" errors coming from lingering sockets? * * We see "address already in use" errors when trying to re-use sockets very quickly, * but the tests below don't give much information, except that: * - data needs to be sent * - explicitly setting or disabling the SO_LINGER value has little effect */ public class LingerExperimentMule2067TestCase extends AbstractMuleTestCase { private static final int NO_LINGER = -1; private static final int HARD_CLOSE = 0; private static final int NO_WAIT = -1; private static final int PORT = 65432; private Log logger = LogFactory.getLog(getClass()); public void testInoffensive() throws IOException { // this shows it's not simple open/close that causes a problem openCloseServer(1000, PORT); // ok openCloseClientServer(1000, PORT, NO_LINGER, NO_LINGER); // ok } public void testThisShowsTheProblem() throws IOException { // this shows a problem with repeated open/close with a client/server pair repeatOpenCloseClientServer(10, 10, PORT, 1000); // ok repeatOpenCloseClientServer(10, 10, PORT, 100); // ok repeatOpenCloseClientServer(10, 10, PORT, 10); // ok repeatOpenCloseClientServer(10, 10, PORT, 1); // ok repeatOpenCloseClientServer(10, 10, PORT, 0); // intermittent repeatOpenCloseClientServer(10, 10, PORT, NO_WAIT); // intermittent } public void testWithClientLinger() throws IOException { // this shows it's not simple client linger time, or the later tests would always fail repeatOpenCloseClientServer(10, 10, PORT, NO_WAIT, NO_LINGER); // intermittent, as above repeatOpenCloseClientServer(10, 10, PORT, 100, 1); // ok repeatOpenCloseClientServer(10, 10, PORT, 10, 1); // intermittent repeatOpenCloseClientServer(10, 10, PORT, 100, 2); // intermittent repeatOpenCloseClientServer(10, 10, PORT, 100, 30); // intermittent // hard close on client doesn't help repeatOpenCloseClientServer(10, 10, PORT, 10, HARD_CLOSE); // intermittent repeatOpenCloseClientServer(10, 10, PORT, NO_WAIT, HARD_CLOSE); // intermittent } public void testWithServerLinger() throws IOException { // server linger seems to improve things(?!), but still have problems repeatOpenCloseClientServer(10, 10, PORT, 10, NO_LINGER, 1); // ok repeatOpenCloseClientServer(10, 10, PORT, 10, NO_LINGER, 1); // ok repeatOpenCloseClientServer(10, 10, PORT, 10, NO_LINGER, 2); // ok repeatOpenCloseClientServer(10, 10, PORT, 10, NO_LINGER, 30); // ok repeatOpenCloseClientServer(10, 10, PORT, NO_WAIT, NO_LINGER, 1); // intermittent } public void testHardClose() throws IOException { // this gives (very?) occasional "already in use" and also a "connection reset by peer" // at the client, due to server closing so quickly repeatOpenCloseClientServer(10, 10, PORT, NO_WAIT, HARD_CLOSE, HARD_CLOSE); // intermittent } protected void openCloseServer(int numberOfSockets, int port) throws IOException { for (int i = 0; i < numberOfSockets; i++) { ServerSocket socket = new ServerSocket(port); socket.close(); } } protected void repeatOpenCloseClientServer(int numberOfRepeats, int numberOfConnections, int port, long pause) throws IOException { repeatOpenCloseClientServer(numberOfRepeats, numberOfConnections, port, pause, NO_LINGER); } protected void repeatOpenCloseClientServer(int numberOfRepeats, int numberOfConnections, int port, long pause, int clientLinger) throws IOException { repeatOpenCloseClientServer(numberOfRepeats, numberOfConnections, port, pause, clientLinger, NO_LINGER); } protected void repeatOpenCloseClientServer(int numberOfRepeats, int numberOfConnections, int port, long pause, int clientLinger, int serverLinger) throws IOException { logger.info("Repeating openCloseClientServer with pauses of " + pause + " ms and lingers of " + clientLinger + "/" + serverLinger + " s (client/server)"); for (int i = 0; i < numberOfRepeats; i++) { if (0 != i && pause != NO_WAIT) { try { synchronized(this) { if (pause > 0) { this.wait(pause); } } } catch (InterruptedException e) { // ignore } } openCloseClientServer(numberOfConnections, port, clientLinger, serverLinger); } } protected void openCloseClientServer(int numberOfConnections, int port, int clientLinger, int serverLinger) throws IOException { Server server = new Server(port, serverLinger); try { new Thread(server).start(); for (int i = 0; i < numberOfConnections; i++) { logger.debug("opening socket " + i); Socket client = new Socket("localhost", port); if (NO_LINGER != clientLinger) { client.setSoLinger(true, clientLinger); } client.close(); } } finally { server.close(); } } protected static class Server implements Runnable { private Log logger = LogFactory.getLog(getClass()); private ServerSocket server; private int linger; public Server(int port, int linger) throws IOException { this.linger = linger; server = new ServerSocket(); server.bind(new InetSocketAddress("localhost", port)); } public void run() { try { while (true) { Socket socket = server.accept(); if (NO_LINGER != linger) { socket.setSoLinger(true, linger); } socket.close(); } } catch (Exception e) { logger.debug("Expected - dirty closedown: " + e); } } public void close() throws IOException { server.close(); server = null; } } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/issues/AsynchMule1869TestCase.java0000644000175000017500000000250210763522057032567 0ustar charlescharles/* * $Id: AsynchMule1869TestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class AsynchMule1869TestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test TCP Request"; protected String getConfigResources() { return "tcp-functional-test.xml"; } public void testDispatchAndReply() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); client.dispatch("asyncClientEndpoint", TEST_MESSAGE, props); // MULE-2754 Thread.sleep(100); MuleMessage result = client.request("asyncClientEndpoint", 10000); assertNotNull("No message received", result); assertEquals(TEST_MESSAGE + " Received Async", result.getPayloadAsString()); } }mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/TcpEndpointTestCase.java0000644000175000017500000000531610745677442031122 0ustar charlescharles/* * $Id: TcpEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.tcp.TcpConnector; public class TcpEndpointTestCase extends AbstractMuleTestCase { public void testHostPortUrl() throws Exception { EndpointURI url = new MuleEndpointURI("tcp://localhost:7856"); url.initialise(); assertEquals(TcpConnector.TCP, url.getScheme()); assertEquals("tcp://localhost:7856", url.getAddress()); assertNull(url.getEndpointName()); assertEquals(7856, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("tcp://localhost:7856", url.getAddress()); assertEquals(0, url.getParams().size()); } public void testQueryParams1() throws Exception { EndpointURI url = new MuleEndpointURI("tcp://localhost:7856?param=1"); url.initialise(); assertEquals(TcpConnector.TCP, url.getScheme()); assertEquals("tcp://localhost:7856", url.getAddress()); assertNull(url.getEndpointName()); assertEquals(7856, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("tcp://localhost:7856?param=1", url.toString()); assertEquals(1, url.getParams().size()); assertEquals("1", url.getParams().getProperty("param")); } public void testQueryParams2() throws Exception { EndpointURI url = new MuleEndpointURI( "tcp://localhost:7856?param=1&endpointName=tcpProvider&blankParam="); url.initialise(); assertEquals(TcpConnector.TCP, url.getScheme()); assertEquals("tcp://localhost:7856", url.getAddress()); assertNotNull(url.getEndpointName()); assertEquals("tcpProvider", url.getEndpointName()); assertEquals(7856, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("tcp://localhost:7856?param=1&endpointName=tcpProvider&blankParam=", url.toString()); assertEquals("param=1&endpointName=tcpProvider&blankParam=", url.getQuery()); assertEquals(3, url.getParams().size()); assertEquals("1", url.getParams().getProperty("param")); assertEquals("", url.getParams().getProperty("blankParam")); } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/0000755000175000017500000000000011351410643026670 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/StreamingSynchCapacityTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/StreamingSynchCapacityTes0000644000175000017500000000276510745677442033737 0ustar charlescharles/* * $Id: StreamingSynchCapacityTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; /** * Tests a model for which synchonous=true for environment (was "and connector", but that is * no longer possible). * * Not the same as issue MULE-1687. * * This will happily send 1GB while running in significantly less memory, but it takes some time. * Since I'd like this to run in CI I will set at 100MB and test memory delta. But since memory usage * could be around that anyway, this is may be a little unreliable. And there's no way to * measure memory use directly in 1.4. We'll see... * * IMPORTANT - DO NOT RUN THIS TEST IN AN IDE WITH LOG LEVEL OF DEBUG. USE INFO TO SEE * DIAGNOSTICS. OTHERWISE THE CONSOLE OUTPUT WILL BE SIMILAR SIZE TO DATA TRANSFERRED, * CAUSING CONFUSNG AND PROBABLY FATAL MEMORY USE. */ public class StreamingSynchCapacityTestCase extends AbstractStreamingCapacityTestCase { public StreamingSynchCapacityTestCase() { super(100 * ONE_MB, "tcp://localhost:65432"); } protected String getConfigResources() { return "tcp-streaming2-test.xml"; } }mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/StreamingTestCase.java0000644000175000017500000000615610763522057033141 0ustar charlescharles/* * $Id: StreamingTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; import org.mule.api.MuleEventContext; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalStreamingTestComponent; import java.util.HashMap; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference; /** * This test is more about testing the streaming model than the TCP provider, really. */ public class StreamingTestCase extends FunctionalTestCase { public static final int TIMEOUT = 300000; public static final String TEST_MESSAGE = "Test TCP Request"; public static final String RESULT = "Received stream; length: 16; 'Test...uest'"; protected String getConfigResources() { return "tcp-streaming-test.xml"; } public void testSend() throws Exception { final CountDownLatch latch = new CountDownLatch(1); final AtomicReference message = new AtomicReference(); final AtomicInteger loopCount = new AtomicInteger(0); EventCallback callback = new EventCallback() { public synchronized void eventReceived(MuleEventContext context, Object component) { try { logger.info("called " + loopCount.incrementAndGet() + " times"); FunctionalStreamingTestComponent ftc = (FunctionalStreamingTestComponent) component; // without this we may have problems with the many repeats if (1 == latch.getCount()) { message.set(ftc.getSummary()); assertEquals(RESULT, message.get()); latch.countDown(); } } catch (Exception e) { logger.error(e.getMessage(), e); } } }; MuleClient client = new MuleClient(); // this works only if singleton set in descriptor Object ftc = getComponent("testComponent"); assertTrue("FunctionalStreamingTestComponent expected", ftc instanceof FunctionalStreamingTestComponent); assertNotNull(ftc); ((FunctionalStreamingTestComponent) ftc).setEventCallback(callback, TEST_MESSAGE.length()); client.dispatch("tcp://localhost:65432", TEST_MESSAGE, new HashMap()); latch.await(10, TimeUnit.SECONDS); assertEquals(RESULT, message.get()); } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/MessageObject.java0000644000175000017500000000145210745677442032272 0ustar charlescharles/* * $Id: MessageObject.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; import java.io.Serializable; public class MessageObject implements Serializable { private static final long serialVersionUID = 6623028039115997808L; public int i; public String s; public boolean b; public MessageObject(int i, String s, boolean b) { this.i = i; this.s = s; this.b = b; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/CustomSerializationProtocol.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/CustomSerializationProtoc0000644000175000017500000000337610745677442034045 0ustar charlescharles/* * $Id: CustomSerializationProtocol.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; import org.mule.transport.tcp.protocols.DirectProtocol; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.commons.lang.SerializationUtils; public class CustomSerializationProtocol extends DirectProtocol { // @Override public void write(OutputStream os, Object data) throws IOException { if (data instanceof NonSerializableMessageObject) { NonSerializableMessageObject in = (NonSerializableMessageObject)data; // do serialization... will use normal Serialization to simplify code... MessageObject serializableObject = new MessageObject(in.i, in.s, in.b); write(os, SerializationUtils.serialize(serializableObject)); } else { super.write(os, data); } } // @Override public Object read(InputStream is) throws IOException { byte[] tmp = (byte[]) super.read(is); if (tmp == null) { return null; } else { MessageObject serializableObject = (MessageObject)SerializationUtils.deserialize(tmp); return new NonSerializableMessageObject(serializableObject.i, serializableObject.s, serializableObject.b); } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/StreamingCapacityTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/StreamingCapacityTestCase0000644000175000017500000000270010746161201033655 0ustar charlescharles/* * $Id: StreamingCapacityTestCase.java 10523 2008-01-24 19:09:53Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; /** * This will happily send 1GB while running in significantly less memory, but it takes some time. * Since I'd like this to run in CI I will set at 100MB and test memory delta. But since memory usage * could be around that anyway, this is may be a little unreliable. And there's no way to * measure memory use directly in 1.4. We'll see... * * IMPORTANT - DO NOT RUN THIS TEST IN AN IDE WITH LOG LEVEL OF DEBUG. USE INFO TO SEE * DIAGNOSTICS. OTHERWISE THE CONSOLE OUTPUT WILL BE SIMILAR SIZE TO DATA TRANSFERRED, * CAUSING CONFUSNG AND PROBABLY FATAL MEMORY USE. */ public class StreamingCapacityTestCase extends AbstractStreamingCapacityTestCase { public StreamingCapacityTestCase() { // super(100 * ONE_MB, "tcp://localhost:65432"); super(10 * ONE_GB, "tcp://localhost:65432"); // super(Integer.MAX_VALUE * 2L, "tcp://localhost:65432"); } protected String getConfigResources() { return "tcp-streaming-test.xml"; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/EOFStreamingTestComponent.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/EOFStreamingTestComponent0000755000175000017500000000373410754365306033646 0ustar charlescharles/* * $Id: EOFStreamingTestComponent.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; import org.mule.tck.functional.FunctionalStreamingTestComponent; import java.io.IOException; import java.io.InputStream; import java.net.SocketException; import java.net.SocketTimeoutException; /** * Extends the FunctionalStreamingTestComponent to wait for data in a non * blocking fashion for the StreamingProtocol. * * @see org.mule.tck.functional.EventCallback */ public class EOFStreamingTestComponent extends FunctionalStreamingTestComponent { protected int read(InputStream is, byte[] buffer) throws IOException { int len; try { do { len = is.read(buffer, 0, buffer.length); if (0 == len) { // wait for non-blocking input stream // use new lock since not expecting notification try { Thread.sleep(50); } catch (InterruptedException e) { // no-op } } } while (0 == len); return len; } catch (SocketException e) { // do not pollute the log with a stacktrace, log only the message logger.info("Socket exception occured: " + e.getMessage()); return -1; } catch (SocketTimeoutException e) { logger.debug("Socket timeout."); return -1; } } }././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/MuleMessageProtocolChunkingTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/MuleMessageProtocolChunki0000644000175000017500000000561510754375733033735 0ustar charlescharles/* * $Id: MuleMessageProtocolChunkingTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; /** * This test was set for the new changes due to Mule1199 */ public class MuleMessageProtocolChunkingTestCase extends FunctionalTestCase { public static final long WAIT_MS = 3000L; private static int messages = 2; private static int messagelength = 10; public void testChunking() throws Exception { String message = ""; for (int i = 0; i < messagelength; i++) { for (int j = 0; j < 10; j++) message += i; } sendString(message); } public void testHugeChunk() throws Exception { StringBuffer message = new StringBuffer(); // send 50K of stuff; for (int i = 1000; i < 2000; i++) { message.append(i); } sendString(message.toString()); } public void testCustomObject() throws Exception { MuleClient client = new MuleClient(); StringBuffer sBuffer = new StringBuffer(); // send 50K of stuff; for (int i = 10000; i < 20000; i++) { sBuffer.append(i); } MessageObject message = new MessageObject(1, sBuffer.toString(), true); for (int i = 0; i < messages; i++) { client.dispatch("vm://in", new DefaultMuleMessage(message)); } for (int i = 0; i < messages; i++) { MuleMessage msg = client.request("vm://out", WAIT_MS); assertNotNull(msg); assertTrue(msg.getPayload() instanceof MessageObject); MessageObject received = (MessageObject)msg.getPayload(); assertEquals(message.s, received.s); assertEquals(1, received.i); assertEquals(true, received.b); } } private void sendString(String message) throws Exception { MuleClient client = new MuleClient(); for (int i = 0; i < messages; i++) { client.dispatch("vm://in", new DefaultMuleMessage(message)); } for (int i = 0; i < messages; i++) { MuleMessage msg = client.request("vm://out", WAIT_MS); assertEquals(message, new String((byte[])msg.getPayload())); } } protected String getConfigResources() { return "mule-message-protocol-mule-config.xml"; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/NonSerializableMessageObject.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/NonSerializableMessageObj0000644000175000017500000000133210745677442033655 0ustar charlescharles/* * $Id: NonSerializableMessageObject.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; public class NonSerializableMessageObject { public int i; public String s; public boolean b; public NonSerializableMessageObject(int i, String s, boolean b) { this.i = i; this.s = s; this.b = b; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/EOFEchoStreamTestComponent.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/EOFEchoStreamTestComponen0000755000175000017500000000162010754365306033553 0ustar charlescharles/* * $Id: EOFEchoStreamTestComponent.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; import java.io.IOException; import java.io.InputStream; public class EOFEchoStreamTestComponent { public Object invoke(final InputStream is) throws IOException { byte[] buf = new byte[is.available()]; int n = 0; int total = 0; while (total < 16) { n = is.read(buf); total += n; } is.close(); return new String(buf); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/TcpFunctionalLegacyTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/TcpFunctionalLegacyTestCa0000644000175000017500000000223710763522057033632 0ustar charlescharles/* * $Id: TcpFunctionalLegacyTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class TcpFunctionalLegacyTestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test TCP Request"; protected String getConfigResources() { return "tcp-functional-legacy-test.xml"; } public void testSend() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); MuleMessage result = client.send("clientEndpoint", TEST_MESSAGE, props); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); } }././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/AbstractStreamingCapacityTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/AbstractStreamingCapacity0000644000175000017500000001072510763522057033724 0ustar charlescharles/* * $Id: AbstractStreamingCapacityTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEventContext; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalStreamingTestComponent; import org.mule.transport.DefaultMessageAdapter; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * IMPORTANT - DO NOT RUN THIS TEST IN AN IDE WITH LOG LEVEL OF DEBUG. USE INFO TO SEE * DIAGNOSTICS. OTHERWISE THE CONSOLE OUTPUT WILL BE SIMILAR SIZE TO DATA TRANSFERRED, * CAUSING CONFUSNG AND PROBABLY FATAL MEMORY USE. */ public abstract class AbstractStreamingCapacityTestCase extends FunctionalTestCase { public static final long ONE_KB = 1024; public static final long ONE_MB = ONE_KB * ONE_KB; public static final long ONE_GB = ONE_KB * ONE_MB; public static final int MESSAGES = 21; protected final Log logger = LogFactory.getLog(getClass()); private long size; private String endpoint; public AbstractStreamingCapacityTestCase(long size, String endpoint) { this.size = size; this.endpoint = endpoint; } public void testSend() throws Exception { final CountDownLatch latch = new CountDownLatch(1); final AtomicReference message = new AtomicReference(); EventCallback callback = new EventCallback() { public synchronized void eventReceived(MuleEventContext context, Object component) { try { FunctionalStreamingTestComponent ftc = (FunctionalStreamingTestComponent) component; message.set(ftc.getSummary()); latch.countDown(); } catch (Exception e) { logger.error(e.getMessage(), e); } } }; MuleClient client = new MuleClient(); Object ftc = getComponent("testComponent"); assertTrue("FunctionalStreamingTestComponent expected", ftc instanceof FunctionalStreamingTestComponent); assertNotNull(ftc); //assertEquals(1, ftc.getNumber()); ((FunctionalStreamingTestComponent) ftc).setEventCallback(callback, size); Runtime runtime = Runtime.getRuntime(); runtime.gc(); // i know, i know... long freeStart = runtime.freeMemory(); long maxStart = runtime.maxMemory(); long timeStart = System.currentTimeMillis(); BigInputStream stream = new BigInputStream(size, MESSAGES); DefaultMessageAdapter adapter = new DefaultMessageAdapter(stream); client.dispatch(endpoint, new DefaultMuleMessage(adapter)); // if we assume 1MB/sec then we need at least... long pause = Math.max(size / ONE_MB, 60 * 10) + 10; logger.info("Waiting for up to " + pause + " seconds"); latch.await(pause, TimeUnit.SECONDS); assertEquals(stream.summary(), message.get()); // neither of these memory tests are really reliable, but if we stay with 1.4 i don't // know of anything better. // if these fail in practice i guess we just remove them. long freeEnd = runtime.freeMemory(); long delta = freeStart - freeEnd; long timeEnd = System.currentTimeMillis(); double speed = size / (double) (timeEnd - timeStart) * 1000 / ONE_MB; logger.info("Transfer speed " + speed + " MB/s (" + size + " B in " + (timeEnd - timeStart) + " ms)"); double usePercent = 100.0 * delta / size; logger.info("Memory delta " + delta + " B = " + usePercent + "%"); assertTrue("Memory used too high", usePercent < 10); long maxEnd = runtime.maxMemory(); assertEquals("Max memory shifted", 0, maxEnd - maxStart); } }mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/BigInputStream.java0000644000175000017500000000556610746161201032444 0ustar charlescharles/* * $Id: BigInputStream.java 10523 2008-01-24 19:09:53Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; import java.io.InputStream; import java.io.IOException; import java.text.MessageFormat; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class BigInputStream extends InputStream { private static final int SUMMARY_SIZE = 4; private static final MessageFormat FORMAT = new MessageFormat("Sent {0,number,#} bytes, {1,number,###.##}% (free {2,number,#}/{3,number,#})"); private final Log logger = LogFactory.getLog(getClass()); private long size; private int messages; private long sent = 0; private byte[] data; private int dataIndex = 0; private long printedMessages = 0; private long nextMessage = 0; /** * @param size Number of bytes to transfer * @param messages Number of mesagges logged as INFO */ public BigInputStream(long size, int messages) { this.size = size; this.messages = messages; data = ("This message is repeated for " + size + " bytes. ").getBytes(); } /** * @return String matching {@link org.mule.tck.functional.FunctionalStreamingTestComponent} */ public String summary() { byte[] tail = new byte[SUMMARY_SIZE]; for (int i = 0; i < SUMMARY_SIZE; ++i) { tail[i] = data[(int) ((sent - SUMMARY_SIZE + i) % data.length)]; } return "Received stream; length: " + sent + "; '" + new String(data, 0, 4) + "..." + new String(tail) + "'"; } public int read() throws IOException { if (sent == size) { return -1; } else { if (++sent > nextMessage) { double percent = 100l * sent / ((double) size); Runtime runtime = Runtime.getRuntime(); logger.info(FORMAT.format(new Object[]{ new Long(sent), new Double(percent), new Long(runtime.freeMemory()), new Long(runtime.maxMemory())})); nextMessage = ++printedMessages * ((int) Math.floor(((double) size) / (messages - 1)) - 1); } if (dataIndex == data.length) { dataIndex = 0; } return data[dataIndex++]; } } public int available() throws IOException { return (int) Math.min(size - sent, Integer.MAX_VALUE); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/CustomSerializationProtocolTestCase.javamule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/integration/CustomSerializationProtoc0000644000175000017500000000327310754375733034037 0ustar charlescharles/* * $Id: CustomSerializationProtocolTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp.integration; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; /** * This test was set for the new changes due to Mule1199 */ public class CustomSerializationProtocolTestCase extends FunctionalTestCase { final private int messages = 1; public void testCustomObject() throws Exception { MuleClient client = new MuleClient(); NonSerializableMessageObject message = new NonSerializableMessageObject(1, "Hello", true); for (int i = 0; i < messages; i++) { client.dispatch("vm://in", new DefaultMuleMessage(message)); } for (int i = 0; i < messages; i++) { MuleMessage msg = client.request("vm://out", 30000); assertTrue(msg.getPayload() instanceof NonSerializableMessageObject); NonSerializableMessageObject received = (NonSerializableMessageObject)msg.getPayload(); assertEquals("Hello", received.s); assertEquals(1, received.i); assertEquals(true, received.b); } } protected String getConfigResources() { return "custom-serialisation-mule-config.xml"; } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/TcpLengthFunctionalTestCase.java0000644000175000017500000000412410754375733032600 0ustar charlescharles/* * $Id: TcpLengthFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class TcpLengthFunctionalTestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test TCP Request"; public TcpLengthFunctionalTestCase() { setDisposeManagerPerSuite(true); } protected String getConfigResources() { return "tcp-length-functional-test.xml"; } public void testSend() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); MuleMessage result = client.send("clientEndpoint", TEST_MESSAGE, props); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); } public void testDispatchAndReplyViaStream() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); client.dispatch("asyncClientEndpoint1", TEST_MESSAGE, props); // MULE-2754 Thread.sleep(200); MuleMessage result = client.request("asyncClientEndpoint1", 3000); // expect failure - streaming not supported assertNull(result); } public void testDispatchAndReply() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); client.dispatch("asyncClientEndpoint2", TEST_MESSAGE, props); // MULE-2754 Thread.sleep(200); MuleMessage result = client.request("asyncClientEndpoint2", 3000); // expect failure - TCP simply can't work like this assertNull(result); } }mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/TcpFunctionalTestCase.java0000644000175000017500000000425310763522057031432 0ustar charlescharles/* * $Id: TcpFunctionalTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class TcpFunctionalTestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test TCP Request"; protected String getConfigResources() { return "tcp-functional-test.xml"; } public void testSend() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); MuleMessage result = client.send("clientEndpoint", TEST_MESSAGE, props); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); } public void testDispatchAndReply() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); client.dispatch("asyncClientEndpoint", TEST_MESSAGE, props); // MULE-2754 Thread.sleep(100); MuleMessage result = client.request("asyncClientEndpoint", 10000); assertNotNull(result); assertEquals(TEST_MESSAGE + " Received Async", result.getPayloadAsString()); } public void timeMultipleSend() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); long now = System.currentTimeMillis(); int count = 1000; for (int i = 0; i < count; i++) { MuleMessage result = client.send("clientEndpoint", TEST_MESSAGE, props); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); } long later = System.currentTimeMillis(); double speed = count * 1000.0 / (later - now); logger.error(speed + " messages per second"); } } mule-2.0.1/transports/tcp/src/test/java/org/mule/transport/tcp/TcpRemoteSyncTestCase.java0000644000175000017500000000400710754375733031424 0ustar charlescharles/* * $Id: TcpRemoteSyncTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.tcp; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class TcpRemoteSyncTestCase extends FunctionalTestCase { public static final String message = "mule"; protected String getConfigResources() { return "tcp-remotesync.xml"; } public void testTcpTcpRemoteSync() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); //must notify the client to wait for a response from the server props.put(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, Boolean.TRUE); MuleMessage reply = client.send("tcp://localhost:6161", new DefaultMuleMessage(message), props); assertNotNull(reply); assertNotNull(reply.getPayload()); assertEquals("Received: " + message, reply.getPayloadAsString()); } public void testTcpVmRemoteSync() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); //must notify the client to wait for a response from the server props.put(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, Boolean.TRUE); MuleMessage reply = client.send("tcp://localhost:6163", new DefaultMuleMessage(message), props); assertNotNull(reply); assertNotNull(reply.getPayload()); assertEquals("Received: " + message, reply.getPayloadAsString()); } } mule-2.0.1/transports/tcp/src/test/resources/0000755000175000017500000000000011351410644021064 5ustar charlescharlesmule-2.0.1/transports/tcp/src/test/resources/tcp-mplength-test.xml0000644000175000017500000000223510745174725025204 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/tcp-socket-key-test.xml0000644000175000017500000000151010723544452025431 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/custom-serialisation-mule-config.xml0000644000175000017500000000415410745677442030214 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/log4j.properties0000644000175000017500000000137110754564441024236 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages #log4j.logger.org.mule=DEBUG #log4j.logger.org.mule.transport.tcp.issues.LingerExperimentMule2067TestCase=DEBUG #log4j.logger.org.mule.transport.tcp.issues.KeepSendSocketOpenMule1491TestCase=DEBUG log4j.logger.org.mule.transport.tcp.other.SocketTimingExperimentTestCase=DEBUG log4j.logger.org.mule.transport.tcp.integration.StreamingCapacityTestCase=INFO log4j.logger.org.mule.transport.tcp.integration.BigInputStream=INFO #log4j.logger.org.mule.transport.tcp=DEBUG mule-2.0.1/transports/tcp/src/test/resources/multiple-named-tcp-connectors-test.xml0000644000175000017500000000230310745174725030452 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/tcp-keep-send-socket-open.xml0000644000175000017500000000300410754564441026502 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/tcp-namespace-config.xml0000644000175000017500000000214010665301621025567 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/tcp-synch-streaming-test.xml0000644000175000017500000000202610766460764026503 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/reuse-mule-2069.xml0000644000175000017500000000357310745174725024314 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/tcp-remotesync.xml0000644000175000017500000000404410745174725024601 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/safe-protocol-test.xml0000644000175000017500000000303510745174725025356 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/streaming-download-mule-1389.xml0000644000175000017500000000354110745677442026772 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/tcp-streaming-test.xml0000644000175000017500000000314610766460764025365 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/tcp-streaming2-test.xml0000644000175000017500000000343510766460764025450 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/mule-message-protocol-mule-config.xml0000644000175000017500000000354710757365472030266 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/length-protocol-length-test.xml0000644000175000017500000000340610766654216027203 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000126510766204551025751 0ustar charlescharles# # Test cases listed in this file are not run. # # MULE-1389 org.mule.transport.tcp.issues.StreamingDownloadMule1389TestCase # MULE-2067 org.mule.transport.tcp.issues.LingerExperimentMule2067TestCase org.mule.transport.tcp.issues.ReuseExperimentMule2067TestCase # cannot have a legacy test case with old config without 1to2migration org.mule.transport.tcp.integration.TcpFunctionalLegacyTestCase # MULE-2574 org.mule.transport.tcp.integration.MuleMessageProtocolChunkingTestCase # MULE-2730 org.mule.transport.tcp.issues.SynchStreamingMule1687TestCase # Disable this long-running test to speed up testing during development #org.mule.transport.tcp.integration.StreamingCapacityTestCase mule-2.0.1/transports/tcp/src/test/resources/tcp-functional-test.xml0000644000175000017500000000361510745174725025533 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/tcp-length-functional-test.xml0000644000175000017500000000550510766654216027013 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/tcp-functional-legacy-test.xml0000644000175000017500000000141210653721225026755 0ustar charlescharles mule-2.0.1/transports/tcp/src/test/resources/tcp-sync.xml0000644000175000017500000000235510770767514023372 0ustar charlescharles mule-2.0.1/transports/tcp/pom.xml0000644000175000017500000000564011006063605016624 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-tcp TCP Transport A Mule transport for Tcp Connectivity. This transport supplies a tcp Server and client implementation. org.apache.maven.plugins maven-jar-plugin test-jar org.mule mule-core ${version} org.mule.tests mule-tests-functional ${version} test org.mule.transports mule-transport-vm ${version} test org.mule.modules mule-module-client ${version} test osgi org.apache.felix maven-bundle-plugin tcp org.mule.transport.tcp.*, META-INF.services.org.mule.i18n mule-2.0.1/transports/quartz/0000755000175000017500000000000011351410642016042 5ustar charlescharlesmule-2.0.1/transports/quartz/src/0000755000175000017500000000000011351410642016631 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/0000755000175000017500000000000011351410642017555 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/java/0000755000175000017500000000000011351410642020476 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/java/org/0000755000175000017500000000000011351410642021265 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/java/org/mule/0000755000175000017500000000000011351410642022227 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/java/org/mule/transport/0000755000175000017500000000000011351410642024263 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/0000755000175000017500000000000011351410642025611 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/i18n/0000755000175000017500000000000011351410642026370 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/i18n/QuartzMessages.java0000644000175000017500000000316510745677442032241 0ustar charlescharles/* * $Id: QuartzMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class QuartzMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("quartz"); public static Message cronExpressionOrIntervalMustBeSet() { return createMessage(BUNDLE_PATH, 1); } public static Message invalidPayloadType() { return createMessage(BUNDLE_PATH, 2); } public static Message invalidJobObject() { return createMessage(BUNDLE_PATH, 3); } public static Message missingJobDetail(String detail) { return createMessage(BUNDLE_PATH, 4, detail); } public static Message receiverNotInJobDataMap() { return createMessage(BUNDLE_PATH, 5); } public static Message connectorNotInJobDataMap() { return createMessage(BUNDLE_PATH, 6); } public static Message noConnectorFound(String connectorName) { return createMessage(BUNDLE_PATH, 7, connectorName); } public static Message noReceiverInConnector(String receiver, String connector) { return createMessage(BUNDLE_PATH, 8, receiver, connector); } } mule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/config/0000755000175000017500000000000011351410642027056 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/config/QuartzNamespaceHandler.javamule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/config/QuartzNamespaceHandler.j0000644000175000017500000001247411003247564033647 0ustar charlescharles/* * $Id: QuartzNamespaceHandler.java 11620 2008-04-22 02:37:40Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.config; import org.mule.config.spring.factories.InboundEndpointFactoryBean; import org.mule.config.spring.factories.OutboundEndpointFactoryBean; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.collection.ChildMapDefinitionParser; import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.mule.config.spring.parsers.specific.DataObjectDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.EndpointPropertyElementDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.EndpointRefParser; import org.mule.config.spring.parsers.specific.endpoint.TransportEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.TransportGlobalEndpointDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.quartz.QuartzConnector; import org.mule.transport.quartz.jobs.CustomJobConfig; import org.mule.transport.quartz.jobs.CustomJobFromMessageConfig; import org.mule.transport.quartz.jobs.EndpointPollingJobConfig; import org.mule.transport.quartz.jobs.EventGeneratorJobConfig; import org.mule.transport.quartz.jobs.ScheduledDispatchJobConfig; /** * Registers Bean Definition Parsers for the "quartz" namespace */ public class QuartzNamespaceHandler extends AbstractMuleNamespaceHandler { public static final String JOB_NAME_ATTRIBUTE = "jobName"; public static final String[][] QUARTZ_ATTRIBUTES = new String[][]{new String[]{JOB_NAME_ATTRIBUTE}}; public void init() { registerQuartzTransportEndpoints(); registerMuleBeanDefinitionParser("connector", new MuleOrphanDefinitionParser(QuartzConnector.class, true)).addAlias("scheduler", "quartzScheduler"); // note that we use the singular (factoryProperty) for the setter so that we auto-detect a collection registerBeanDefinitionParser("factory-property", new ChildSingletonMapDefinitionParser("factoryProperty")); registerBeanDefinitionParser("factory-properties", new ChildMapDefinitionParser("factoryProperty")); registerBeanDefinitionParser("event-generator-job", new EndpointPropertyElementDefinitionParser(QuartzConnector.PROPERTY_JOB_CONFIG, EventGeneratorJobConfig.class)); registerBeanDefinitionParser("endpoint-polling-job", new EndpointPropertyElementDefinitionParser(QuartzConnector.PROPERTY_JOB_CONFIG, EndpointPollingJobConfig.class)); registerBeanDefinitionParser("scheduled-dispatch-job", new EndpointPropertyElementDefinitionParser(QuartzConnector.PROPERTY_JOB_CONFIG, ScheduledDispatchJobConfig.class)); registerBeanDefinitionParser("custom-job", new EndpointPropertyElementDefinitionParser(QuartzConnector.PROPERTY_JOB_CONFIG, CustomJobConfig.class)); registerBeanDefinitionParser("custom-job-from-message", new EndpointPropertyElementDefinitionParser(QuartzConnector.PROPERTY_JOB_CONFIG, CustomJobFromMessageConfig.class)); ParentDefinitionParser parser = new ParentDefinitionParser(); parser.addAlias("address", "endpointRef"); parser.addAlias("ref", "endpointRef"); registerBeanDefinitionParser("job-endpoint", new EndpointRefParser("endpointRef")); registerBeanDefinitionParser("payload", new DataObjectDefinitionParser("payload")); } /** * Need to use the most complex constructors as have mutually exclusive address * aattributes */ protected void registerQuartzTransportEndpoints() { registerQuartzEndpointDefinitionParser("endpoint", new TransportGlobalEndpointDefinitionParser(QuartzConnector.QUARTZ, TransportGlobalEndpointDefinitionParser.PROTOCOL, TransportGlobalEndpointDefinitionParser.RESTRICTED_ENDPOINT_ATTRIBUTES, QUARTZ_ATTRIBUTES, new String[][]{})); registerQuartzEndpointDefinitionParser("inbound-endpoint", new TransportEndpointDefinitionParser( QuartzConnector.QUARTZ, TransportEndpointDefinitionParser.PROTOCOL, InboundEndpointFactoryBean.class, TransportEndpointDefinitionParser.RESTRICTED_ENDPOINT_ATTRIBUTES, QUARTZ_ATTRIBUTES, new String[][]{})); registerQuartzEndpointDefinitionParser("outbound-endpoint", new TransportEndpointDefinitionParser( QuartzConnector.QUARTZ, TransportEndpointDefinitionParser.PROTOCOL, OutboundEndpointFactoryBean.class, TransportEndpointDefinitionParser.RESTRICTED_ENDPOINT_ATTRIBUTES, QUARTZ_ATTRIBUTES, new String[][]{})); } protected void registerQuartzEndpointDefinitionParser(String element, MuleDefinitionParser parser) { parser.addAlias(JOB_NAME_ATTRIBUTE, URIBuilder.PATH); registerBeanDefinitionParser(element, parser); } } mule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/config/JobConfig.java0000644000175000017500000000152711002723722031565 0ustar charlescharles/* * $Id: JobConfig.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.config; import java.io.Serializable; /** * The generic interface for Job Configuration endpoints that are described on Quartz endpoints */ public interface JobConfig extends Serializable { public Class getJobClass(); public String getGroupName(); public String getJobGroupName(); public void setGroupName(String groupName); public void setJobGroupName(String groupName); } mule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/config/AbstractJobConfig.java0000644000175000017500000000221511002723722033244 0ustar charlescharles/* * $Id: AbstractJobConfig.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.config; import org.mule.transport.quartz.QuartzConnector; /** * Base implementation of {@link org.mule.transport.quartz.config.JobConfig}. */ public abstract class AbstractJobConfig implements JobConfig { private String groupName = QuartzConnector.DEFAULT_GROUP_NAME; private String jobGroupName = QuartzConnector.DEFAULT_GROUP_NAME; public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } public String getJobGroupName() { return jobGroupName; } public void setJobGroupName(String jobGroupName) { this.jobGroupName = jobGroupName; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/QuartzMessageDispatcherFactory.javamule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/QuartzMessageDispatcherFactory.0000644000175000017500000000170110757615756033771 0ustar charlescharles/* * $Id: QuartzMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * Creates a QuartzMessageDispatcher instance. */ public class QuartzMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new QuartzMessageDispatcher(endpoint); } } mule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/0000755000175000017500000000000011351410642026546 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/ScheduledDispatchJob.java0000644000175000017500000000430111002723722033421 0ustar charlescharles/* * $Id: ScheduledDispatchJob.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.jobs; import org.mule.api.MuleException; import org.mule.module.client.MuleClient; import org.mule.transport.NullPayload; import org.mule.transport.quartz.QuartzConnector; import org.mule.transport.quartz.i18n.QuartzMessages; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.quartz.Job; import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; /** * Will dispatch the current message to a Mule endpoint at a leter time. * This job can be used to fire timebased events. */ public class ScheduledDispatchJob implements Job { /** * The logger used for this class */ protected transient Log logger = LogFactory.getLog(getClass()); public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap(); Object payload = jobDataMap.get(QuartzConnector.PROPERTY_PAYLOAD); if (payload == null) { payload = NullPayload.getInstance(); } ScheduledDispatchJobConfig config = (ScheduledDispatchJobConfig)jobDataMap.get(QuartzConnector.PROPERTY_JOB_CONFIG); if (config == null) { throw new JobExecutionException( QuartzMessages.missingJobDetail(QuartzConnector.PROPERTY_JOB_CONFIG).getMessage()); } try { MuleClient client = new MuleClient(); logger.debug("Dispatching payload on: " + config.getEndpointRef()); client.dispatch(config.getEndpointRef(), payload, jobDataMap); } catch (MuleException e) { throw new JobExecutionException(e); } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/ScheduledDispatchJobConfig.javamule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/ScheduledDispatchJobConfig0000644000175000017500000000217211002723722033633 0ustar charlescharles/* * $Id: ScheduledDispatchJobConfig.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.jobs; import org.mule.transport.quartz.config.AbstractJobConfig; /** * The configuration for the {@link org.mule.transport.quartz.jobs.ScheduledDispatchJob} job. */ public class ScheduledDispatchJobConfig extends AbstractJobConfig { /** The endpoint ref has t be a string and not a reference to the actual endpoint because * jobs can get stored in a database */ private String endpointRef; public String getEndpointRef() { return endpointRef; } public void setEndpointRef(String endpointRef) { this.endpointRef = endpointRef; } public Class getJobClass() { return ScheduledDispatchJob.class; } }mule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/CustomJob.java0000644000175000017500000000457711002723722031332 0ustar charlescharles/* * $Id: CustomJob.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.jobs; import org.mule.RegistryContext; import org.mule.transport.quartz.QuartzConnector; import org.mule.transport.quartz.i18n.QuartzMessages; import org.quartz.Job; import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; /** * Extracts the Job object to invoke from the context. The Job itself can be * scheduled by dispatching an event over a quartz endpoint. The job can either be * set as a property on the event (this property can be a container reference or the * actual job object) or the payload of the event can be the Job (in which case when * the job is fired it will have a NullPayload) * * @see org.mule.transport.NullPayload */ public class CustomJob implements Job { public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap(); Object tempJob = jobDataMap.get(QuartzConnector.PROPERTY_JOB_OBJECT); if (tempJob == null) { tempJob = jobDataMap.get(QuartzConnector.PROPERTY_JOB_REF); if (tempJob == null) { throw new JobExecutionException(QuartzMessages.invalidPayloadType().getMessage()); } else { tempJob = RegistryContext.getRegistry().lookupObject((String) tempJob); if(tempJob==null) { throw new JobExecutionException("Job not found: " + tempJob); } if (!(tempJob instanceof Job)) { throw new JobExecutionException(QuartzMessages.invalidJobObject().getMessage()); } } } else if (!(tempJob instanceof Job)) { throw new JobExecutionException(QuartzMessages.invalidJobObject().toString()); } ((Job)tempJob).execute(jobExecutionContext); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EventGeneratorJobConfig.javamule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EventGeneratorJobConfig.ja0000644000175000017500000000175711002723722033604 0ustar charlescharles/* * $Id: EventGeneratorJobConfig.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.jobs; import org.mule.transport.quartz.config.AbstractJobConfig; import org.mule.transport.NullPayload; /** * The configuration for the {@link EventGeneratorJob} job. */ public class EventGeneratorJobConfig extends AbstractJobConfig { private Object payload = NullPayload.getInstance(); public Object getPayload() { return payload; } public void setPayload(Object payload) { this.payload = payload; } public Class getJobClass() { return EventGeneratorJob.class; } } mule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EndpointPollingJob.java0000644000175000017500000000762311002723722033160 0ustar charlescharles/* * $Id: EndpointPollingJob.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.jobs; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.ThreadSafeAccess; import org.mule.api.transport.PropertyScope; import org.mule.module.client.MuleClient; import org.mule.transport.quartz.QuartzConnector; import org.mule.transport.quartz.QuartzMessageReceiver; import org.mule.transport.quartz.i18n.QuartzMessages; import org.mule.transport.AbstractConnector; import org.mule.transport.AbstractMessageReceiver; import org.mule.RegistryContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.quartz.Job; import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; /** * Will receive on an endpoint and dispatch it to the component set via the Receiver information. */ public class EndpointPollingJob implements Job { /** * The logger used for this class */ protected transient Log logger = LogFactory.getLog(getClass()); public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap(); String receiverKey = (String) jobDataMap.get(QuartzMessageReceiver.QUARTZ_RECEIVER_PROPERTY); if (receiverKey == null) { throw new JobExecutionException(QuartzMessages.receiverNotInJobDataMap().getMessage()); } String connectorName = (String) jobDataMap.get(QuartzMessageReceiver.QUARTZ_CONNECTOR_PROPERTY); if (connectorName == null) { throw new JobExecutionException(QuartzMessages.connectorNotInJobDataMap().getMessage()); } AbstractConnector connector = (AbstractConnector) RegistryContext.getRegistry().lookupConnector(connectorName); if (connector == null) { throw new JobExecutionException(QuartzMessages.noConnectorFound(connectorName).getMessage()); } AbstractMessageReceiver receiver = (AbstractMessageReceiver) connector.lookupReceiver(receiverKey); if (receiver == null) { throw new JobExecutionException( QuartzMessages.noReceiverInConnector(receiverKey, connectorName).getMessage()); } EndpointPollingJobConfig jobConfig = (EndpointPollingJobConfig) jobDataMap.get(QuartzConnector.PROPERTY_JOB_CONFIG); if (jobConfig == null) { throw new JobExecutionException( QuartzMessages.missingJobDetail(QuartzConnector.PROPERTY_JOB_CONFIG).getMessage()); } try { MuleClient client = new MuleClient(); logger.debug("Attempting to receive event on: " + jobConfig.getEndpointRef()); MuleMessage result = client.request(jobConfig.getEndpointRef(), jobConfig.getTimeout()); if (result != null) { if (logger.isDebugEnabled()) { logger.debug("Received event on: " + jobConfig.getEndpointRef()); } //we need to do this because result = (MuleMessage)((ThreadSafeAccess)result).newThreadCopy(); //Add the context properties to the message. result.addProperties(jobDataMap, PropertyScope.INVOCATION); receiver.routeMessage(result); } } catch (MuleException e) { throw new JobExecutionException(e); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EndpointPollingJobConfig.javamule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EndpointPollingJobConfig.j0000644000175000017500000000232711002723722033612 0ustar charlescharles/* * $Id: EndpointPollingJobConfig.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.jobs; import org.mule.transport.quartz.config.AbstractJobConfig; import org.mule.api.config.MuleConfiguration; /** * Configuration for the {@link EndpointPollingJob} job. */ public class EndpointPollingJobConfig extends AbstractJobConfig { private String endpointRef; //TODO this should use th system default private int timeout = 5000; public String getEndpointRef() { return endpointRef; } public void setEndpointRef(String endpointRef) { this.endpointRef = endpointRef; } public int getTimeout() { return timeout; } public void setTimeout(int timeout) { this.timeout = timeout; } public Class getJobClass() { return EndpointPollingJob.class; } }mule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/CustomJobConfig.java0000644000175000017500000000163211002723722032445 0ustar charlescharles/* * $Id: CustomJobConfig.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.jobs; import org.mule.transport.quartz.config.AbstractJobConfig; import org.quartz.Job; /** * This configuration simply holds a reference to a user defined job to execute. */ public class CustomJobConfig extends AbstractJobConfig { private Job job; public Job getJob() { return job; } public void setJob(Job job) { this.job = job; } public Class getJobClass() { return CustomJob.class; } }mule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/EventGeneratorJob.java0000644000175000017500000000727711002723722033010 0ustar charlescharles/* * $Id: EventGeneratorJob.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.jobs; import org.mule.DefaultMuleMessage; import org.mule.RegistryContext; import org.mule.transport.AbstractConnector; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.NullPayload; import org.mule.transport.quartz.QuartzConnector; import org.mule.transport.quartz.QuartzMessageReceiver; import org.mule.transport.quartz.i18n.QuartzMessages; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.quartz.Job; import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; /** * Will generate a new event based o the scheduled time. The payload of the event is * currently a static object or instance of {@link org.mule.transport.NullPayload} if no payload * has been set. * * We may want to extend this but allowing the payload to be generated using a factory. */ public class EventGeneratorJob implements Job { /** * The logger used for this class */ protected transient Log logger = LogFactory.getLog(getClass()); public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { JobDataMap map = jobExecutionContext.getJobDetail().getJobDataMap(); String receiverKey = (String)map.get(QuartzMessageReceiver.QUARTZ_RECEIVER_PROPERTY); if (receiverKey == null) throw new JobExecutionException(QuartzMessages.receiverNotInJobDataMap().getMessage()); String connectorName = (String)map.get(QuartzMessageReceiver.QUARTZ_CONNECTOR_PROPERTY); if (connectorName == null) throw new JobExecutionException(QuartzMessages.connectorNotInJobDataMap().getMessage()); AbstractConnector connector = (AbstractConnector) RegistryContext.getRegistry().lookupConnector(connectorName); if (connector == null) throw new JobExecutionException(QuartzMessages.noConnectorFound(connectorName).getMessage()); AbstractMessageReceiver receiver = (AbstractMessageReceiver)connector.lookupReceiver(receiverKey); if (receiver == null) throw new JobExecutionException( QuartzMessages.noReceiverInConnector(receiverKey, connectorName).getMessage()); Object payload = jobExecutionContext.getJobDetail().getJobDataMap().get( QuartzConnector.PROPERTY_PAYLOAD); try { if (payload == null) { String ref = jobExecutionContext.getJobDetail().getJobDataMap().getString( QuartzConnector.PROPERTY_PAYLOAD); if (ref == null) { payload = NullPayload.getInstance(); } else { payload = RegistryContext.getRegistry().lookupObject(ref); } if (payload==null) { logger.warn("There is no payload attached to this quartz job. Sending Null payload"); payload = NullPayload.getInstance(); } } receiver.routeMessage(new DefaultMuleMessage(receiver.getConnector().getMessageAdapter(payload))); } catch (Exception e) { receiver.handleException(e); } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/CustomJobFromMessageConfig.javamule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/jobs/CustomJobFromMessageConfig0000644000175000017500000000705611002723722033664 0ustar charlescharles/* * $Id: CustomJobFromMessageConfig.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.jobs; import org.mule.transport.quartz.config.JobConfig; import org.mule.transport.quartz.config.AbstractJobConfig; import org.mule.api.MuleMessage; import org.mule.util.expression.ExpressionEvaluatorManager; import org.mule.util.ClassUtils; import org.mule.config.i18n.CoreMessages; import java.lang.reflect.InvocationTargetException; import org.quartz.Job; /** * This configuration simply holds a reference to a user defined job to execute. */ public class CustomJobFromMessageConfig extends AbstractJobConfig { private String expression; private String evaluator; private String customEvaluator; public Job getJob(MuleMessage message) throws ClassNotFoundException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException { if (evaluator.equals("custom")) { evaluator = customEvaluator; } Object result = ExpressionEvaluatorManager.evaluate(expression, evaluator, message, true); Class clazz; if (result instanceof Job) { return (Job) result; } else if (result instanceof JobConfig) { clazz = ((JobConfig)result).getJobClass(); } else { throw new IllegalStateException(CoreMessages.propertyIsNotSupportedType(evaluator + ":" + expression, new Class[]{Job.class, JobConfig.class}, result.getClass()).getMessage()); } return (Job) ClassUtils.instanciateClass(clazz, ClassUtils.NO_ARGS); } public JobConfig getJobConfig(MuleMessage message) throws ClassNotFoundException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException { if (evaluator.equals("custom")) { evaluator = customEvaluator; } Object result = ExpressionEvaluatorManager.evaluate(expression, evaluator, message, true); Class clazz; if (result instanceof Job) { CustomJobConfig customJob = new CustomJobConfig(); customJob.setJob((Job) result); return customJob; } else if (result instanceof JobConfig) { return (JobConfig)result; } else { throw new IllegalStateException(CoreMessages.propertyIsNotSupportedType(evaluator + ":" + expression, new Class[]{Job.class, JobConfig.class, Class.class, String.class}, result.getClass()).getMessage()); } } public String getCustomEvaluator() { return customEvaluator; } public void setCustomEvaluator(String customEvaluator) { this.customEvaluator = customEvaluator; } public String getEvaluator() { return evaluator; } public void setEvaluator(String evaluator) { this.evaluator = evaluator; } public String getExpression() { return expression; } public void setExpression(String expression) { this.expression = expression; } public Class getJobClass() { return CustomJob.class; } }mule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/QuartzMessageReceiver.java0000644000175000017500000001356611002723722032746 0ustar charlescharles/* * $Id: QuartzMessageReceiver.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.quartz.i18n.QuartzMessages; import org.mule.transport.quartz.config.JobConfig; import java.util.Date; import org.quartz.CronTrigger; import org.quartz.JobDataMap; import org.quartz.JobDetail; import org.quartz.ObjectAlreadyExistsException; import org.quartz.Scheduler; import org.quartz.SimpleTrigger; import org.quartz.Trigger; /** * Listens for Quartz sheduled events using the Receiver Job and fires events to the * service associated with this receiver. */ public class QuartzMessageReceiver extends AbstractMessageReceiver { public static final String QUARTZ_RECEIVER_PROPERTY = "mule.quartz.receiver"; public static final String QUARTZ_CONNECTOR_PROPERTY = "mule.quartz.connector"; private final QuartzConnector connector; public QuartzMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); this.connector = (QuartzConnector) connector; } protected void doDispose() { // template method } protected void doStart() throws MuleException { try { Scheduler scheduler = connector.getQuartzScheduler(); JobConfig jobConfig = (JobConfig)endpoint.getProperty(QuartzConnector.PROPERTY_JOB_CONFIG); if(jobConfig==null) { throw new IllegalArgumentException(CoreMessages.objectIsNull(QuartzConnector.PROPERTY_JOB_CONFIG).getMessage()); } JobDetail jobDetail = new JobDetail(); jobDetail.setName(endpoint.getEndpointURI().getAddress()); jobDetail.setJobClass(jobConfig.getJobClass()); JobDataMap jobDataMap = new JobDataMap(); jobDataMap.put(QUARTZ_RECEIVER_PROPERTY, this.getReceiverKey()); jobDataMap.put(QUARTZ_CONNECTOR_PROPERTY, this.connector.getName()); jobDataMap.putAll(endpoint.getProperties()); jobDetail.setJobDataMap(jobDataMap); Trigger trigger; String cronExpression = (String)endpoint.getProperty(QuartzConnector.PROPERTY_CRON_EXPRESSION); String repeatInterval = (String)endpoint.getProperty(QuartzConnector.PROPERTY_REPEAT_INTERVAL); String repeatCount = (String)endpoint.getProperty(QuartzConnector.PROPERTY_REPEAT_COUNT); String startDelay = (String)endpoint.getProperty(QuartzConnector.PROPERTY_START_DELAY); String groupName = jobConfig.getGroupName(); String jobGroupName = jobConfig.getJobGroupName(); if (groupName == null) { groupName = QuartzConnector.DEFAULT_GROUP_NAME; } if (jobGroupName == null) { jobGroupName = groupName; } jobDetail.setGroup(groupName); if (cronExpression != null) { CronTrigger ctrigger = new CronTrigger(); ctrigger.setCronExpression(cronExpression); trigger = ctrigger; } else if (repeatInterval != null) { SimpleTrigger strigger = new SimpleTrigger(); strigger.setRepeatInterval(Long.parseLong(repeatInterval)); if (repeatCount != null) { strigger.setRepeatCount(Integer.parseInt(repeatCount)); } else { strigger.setRepeatCount(-1); } trigger = strigger; } else { throw new IllegalArgumentException( QuartzMessages.cronExpressionOrIntervalMustBeSet().getMessage()); } long start = System.currentTimeMillis(); if (startDelay != null) { start += Long.parseLong(startDelay); } trigger.setStartTime(new Date(start)); trigger.setName(endpoint.getEndpointURI().getAddress()); trigger.setGroup(groupName); trigger.setJobName(endpoint.getEndpointURI().getAddress()); trigger.setJobGroup(jobGroupName); // We need to handle cases when the job has already been // persisted try { scheduler.scheduleJob(jobDetail, trigger); } catch (ObjectAlreadyExistsException oaee) { // Do anything here? logger.warn("A quartz Job with name: " + endpoint.getEndpointURI().getAddress() + " has already been registered. Cannot register again"); } scheduler.start(); } catch (Exception e) { throw new EndpointException(CoreMessages.failedToStart("Quartz receiver"), e); } } protected void doStop() throws MuleException { // nothing to do } protected void doConnect() throws Exception { // nothing to do } protected void doDisconnect() throws Exception { // nothing to do } } mule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/QuartzMessageDispatcher.java0000644000175000017500000001443711002723722033266 0ustar charlescharles/* * $Id: QuartzMessageDispatcher.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz; import org.mule.RegistryContext; import org.mule.util.ClassUtils; import org.mule.config.i18n.CoreMessages; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.DispatchException; import org.mule.transport.AbstractMessageDispatcher; import org.mule.transport.quartz.i18n.QuartzMessages; import org.mule.transport.quartz.jobs.CustomJob; import org.mule.transport.quartz.jobs.CustomJobConfig; import org.mule.transport.quartz.jobs.CustomJobFromMessageConfig; import org.mule.transport.quartz.config.JobConfig; import java.util.Date; import java.util.Iterator; import org.quartz.CronTrigger; import org.quartz.Job; import org.quartz.JobDataMap; import org.quartz.JobDetail; import org.quartz.Scheduler; import org.quartz.SimpleTrigger; import org.quartz.Trigger; /** * Can schedule a Job with the Quartz scheduler. The event must contain the Job to * invoke or have it set as a property. Time triggger properties can be set on the * event to control how and when the event is fired. */ public class QuartzMessageDispatcher extends AbstractMessageDispatcher { public QuartzMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); } protected void doDispose() { // template method } protected void doDispatch(MuleEvent event) throws Exception { JobConfig jobConfig = (JobConfig)endpoint.getProperty(QuartzConnector.PROPERTY_JOB_CONFIG); if(jobConfig==null) { throw new IllegalArgumentException(CoreMessages.objectIsNull(QuartzConnector.PROPERTY_JOB_CONFIG).getMessage()); } JobDetail jobDetail = new JobDetail(); // make the job name unique per endpoint (MULE-753) jobDetail.setName(event.getEndpoint().getEndpointURI().getAddress() + "-" + event.getId()); JobDataMap jobDataMap = new JobDataMap(); MuleMessage msg = event.getMessage(); for (Iterator iterator = msg.getPropertyNames().iterator(); iterator.hasNext();) { String propertyKey = (String)iterator.next(); jobDataMap.put(propertyKey, msg.getProperty(propertyKey)); } jobDetail.setJobDataMap(jobDataMap); Job job = null; // work out what we're actually calling Object payload = event.transformMessage(); if(jobConfig instanceof CustomJobConfig) { job = ((CustomJobConfig)jobConfig).getJob(); } else if(jobConfig instanceof CustomJobFromMessageConfig) { job = ((CustomJobFromMessageConfig)jobConfig).getJob(msg); //rewrite the jobConfig to the real Jobconfig on the message jobConfig = ((CustomJobFromMessageConfig)jobConfig).getJobConfig(msg); } jobDataMap.put(QuartzConnector.PROPERTY_JOB_CONFIG, jobConfig); jobDetail.setJobClass(jobConfig.getJobClass()); // If there has been a job created or found then we default to a customJob configuration if (job!=null ) { jobDataMap.put(QuartzConnector.PROPERTY_JOB_OBJECT, job); jobDetail.setJobClass(CustomJob.class); } // The payload will be ignored by the CustomJob - don't know why // we need it here //RM: The custom job may want the message and the Job type may not be delegating job jobDataMap.put(QuartzConnector.PROPERTY_PAYLOAD, payload); Trigger trigger; String cronExpression = jobDataMap.getString(QuartzConnector.PROPERTY_CRON_EXPRESSION); String repeatInterval = jobDataMap.getString(QuartzConnector.PROPERTY_REPEAT_INTERVAL); String repeatCount = jobDataMap.getString(QuartzConnector.PROPERTY_REPEAT_COUNT); String startDelay = jobDataMap.getString(QuartzConnector.PROPERTY_START_DELAY); String groupName = jobConfig.getGroupName(); String jobGroupName = jobConfig.getJobGroupName(); if (groupName == null) { groupName = QuartzConnector.DEFAULT_GROUP_NAME; } if (jobGroupName == null) { jobGroupName = groupName; } jobDetail.setGroup(groupName); if (cronExpression != null) { CronTrigger ctrigger = new CronTrigger(); ctrigger.setCronExpression(cronExpression); trigger = ctrigger; } else if (repeatInterval != null) { SimpleTrigger strigger = new SimpleTrigger(); strigger.setRepeatInterval(Long.parseLong(repeatInterval)); if (repeatCount != null) { strigger.setRepeatCount(Integer.parseInt(repeatCount)); } else { strigger.setRepeatCount(-1); } trigger = strigger; } else { throw new IllegalArgumentException( QuartzMessages.cronExpressionOrIntervalMustBeSet().getMessage()); } long start = System.currentTimeMillis(); if (startDelay != null) { start += Long.parseLong(startDelay); } trigger.setStartTime(new Date(start)); trigger.setName(event.getEndpoint().getEndpointURI().toString() + "-" + event.getId()); trigger.setGroup(groupName); trigger.setJobName(jobDetail.getName()); trigger.setJobGroup(jobGroupName); Scheduler scheduler = ((QuartzConnector)this.getConnector()).getQuartzScheduler(); scheduler.scheduleJob(jobDetail, trigger); // scheduler.start(); } protected MuleMessage doSend(MuleEvent event) throws Exception { doDispatch(event); return null; } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } } mule-2.0.1/transports/quartz/src/main/java/org/mule/transport/quartz/QuartzConnector.java0000644000175000017500000001017711002723722031622 0ustar charlescharles/* * $Id: QuartzConnector.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz; import org.mule.api.MuleException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transport.ConnectorException; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractConnector; import java.util.Properties; import org.quartz.Scheduler; import org.quartz.SchedulerFactory; import org.quartz.impl.StdSchedulerFactory; /** * Creates a connection to a Quartz scheduler. This allows events to be scheduled at * specific times, with repeated occurrences. */ public class QuartzConnector extends AbstractConnector { public static final String QUARTZ = "quartz"; public static final String PROPERTY_CRON_EXPRESSION = "cronExpression"; public static final String PROPERTY_REPEAT_INTERVAL = "repeatInterval"; public static final String PROPERTY_REPEAT_COUNT = "repeatCount"; public static final String PROPERTY_START_DELAY = "startDelay"; public static final String PROPERTY_PAYLOAD = "payload"; public static final String PROPERTY_JOB_CONFIG = "jobConfig"; public static final String PROPERTY_JOB_REF = "jobRef"; public static final String PROPERTY_JOB_OBJECT = "jobObject"; public static final String DEFAULT_GROUP_NAME = "mule"; /** * Properties to be used for creating the scheduler. If no properties are given, the * scheduler will be created by StdSchedulerFactory.getDefaultScheduler() */ private Properties factoryProperties = null; /** * The scheduler instance. This can be configured by the user and injected as a bean * or if not, it will be created by Mule upon initialization. */ private Scheduler quartzScheduler = null; protected void doInitialise() throws InitialisationException { try { if (quartzScheduler == null) { if (factoryProperties != null) { SchedulerFactory factory = new StdSchedulerFactory(factoryProperties); quartzScheduler = factory.getScheduler(); } else { quartzScheduler = StdSchedulerFactory.getDefaultScheduler(); } } } catch (Exception e) { throw new InitialisationException(CoreMessages.initialisationFailure("Quartz provider"), e, this); } } protected void doDispose() { // template method } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } protected void doStart() throws MuleException { try { quartzScheduler.start(); } catch (Exception e) { throw new ConnectorException(CoreMessages.failedToStart("Quartz provider"), this, e); } } protected void doStop() throws MuleException { try { if (quartzScheduler != null) { quartzScheduler.shutdown(); } } catch (Exception e) { throw new ConnectorException(CoreMessages.failedToStop("Quartz provider"), this, e); } } public String getProtocol() { return QUARTZ; } public Scheduler getQuartzScheduler() { return quartzScheduler; } public void setQuartzScheduler(Scheduler scheduler) { this.quartzScheduler = scheduler; } public Properties getFactoryProperties() { return factoryProperties; } public void setFactoryProperties(Properties factoryProperties) { this.factoryProperties = factoryProperties; } } mule-2.0.1/transports/quartz/src/main/resources/0000755000175000017500000000000011351410642021567 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/resources/META-INF/0000755000175000017500000000000011351410642022727 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/resources/META-INF/spring.schemas0000644000175000017500000000013210622416734025602 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/quartz/2.0/mule-quartz.xsd=META-INF/mule-quartz.xsdmule-2.0.1/transports/quartz/src/main/resources/META-INF/spring.handlers0000644000175000017500000000015210745677442025774 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/quartz/2.0=org.mule.transport.quartz.config.QuartzNamespaceHandler mule-2.0.1/transports/quartz/src/main/resources/META-INF/services/0000755000175000017500000000000011351410642024552 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410642025341 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410642026303 5ustar charlescharlesmule-2.0.1/transports/quartz/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410642030320 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/quartz/src/main/resources/META-INF/services/org/mule/providers/quartz.propertiesmule-2.0.1/transports/quartz/src/main/resources/META-INF/services/org/mule/providers/quartz.properti0000644000175000017500000000057210745677442033463 0ustar charlescharlesconnector=org.mule.transport.quartz.QuartzConnector message.receiver=org.mule.transport.quartz.QuartzMessageReceiver message.adapter=org.mule.transport.DefaultMessageAdapter dispatcher.factory=org.mule.transport.quartz.QuartzMessageDispatcherFactory requester.factory=org.mule.transport.UnsupportedMessageRequesterFactory endpoint.builder=org.mule.endpoint.UrlEndpointURIBuildermule-2.0.1/transports/quartz/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410642027062 5ustar charlescharles././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/quartz/src/main/resources/META-INF/services/org/mule/i18n/quartz-messages.propertiesmule-2.0.1/transports/quartz/src/main/resources/META-INF/services/org/mule/i18n/quartz-messages.prop0000644000175000017500000000124110561713511033120 0ustar charlescharles1=Either the 'cronExpression' or 'interval' property must be set 2=When dispatching a Quartz event the payload must be of type org.quartz.Job or the 'jobObject' or 'jobReference' property must be set on the event 3=The value of the 'jobObject' or 'jobReference' property must be an instance of or reference to an object of type org.quartz.Job 4=Client =Job could not execute as the "{0}" was not set on the JobDetail 5=The 'mule.quartz.receiver' property cannot be found in the jobDataMap 6=The 'mule.quartz.connector' property cannot be found in the jobDataMap 7=No connector named "{0}" found in MuleManager 8=No receiver with key "{1}" could be found in connector "{0}" mule-2.0.1/transports/quartz/src/main/resources/META-INF/mule-quartz.xsd0000644000175000017500000002315711002723722025744 0ustar charlescharles Set a property on the factory (see scheduler-ref). Set a collection of properties on the factory (see scheduler-ref). Provide an implementation of the Quartz Scheduler interface. If no value is given here a scheduler is retrieved from the StdSchedulerFactory: if no properties are given the getDefaultScheduler method is called, otherwise a new factory instance is created using the given properties and a scheduler retrieved using the getScheduler method. A placeholder for quartz jobs that can be set on the endpoint. The base element type for all quartz jobs The group name of the scheduled job The job group name of the scheduled job. The cron expression to schedule events at specified dates / times. This or repeatInterval is required. The number of milliseconds between two events. This or cronExpression is required. The number of events to be scheduled. This value defaults to -1 which means that the events will be scheduled indefinitely. The number of milliseconds that will elapse before the first event is fired. mule-2.0.1/transports/quartz/src/test/0000755000175000017500000000000011351410642017610 5ustar charlescharlesmule-2.0.1/transports/quartz/src/test/java/0000755000175000017500000000000011351410641020530 5ustar charlescharlesmule-2.0.1/transports/quartz/src/test/java/org/0000755000175000017500000000000011351410641021317 5ustar charlescharlesmule-2.0.1/transports/quartz/src/test/java/org/mule/0000755000175000017500000000000011351410641022261 5ustar charlescharlesmule-2.0.1/transports/quartz/src/test/java/org/mule/transport/0000755000175000017500000000000011351410641024315 5ustar charlescharlesmule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/0000755000175000017500000000000011351410642025644 5ustar charlescharlesmule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzFunctionalTestCase.java0000644000175000017500000000357211002723722033462 0ustar charlescharles/* * $Id: QuartzFunctionalTestCase.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent2; import org.mule.tck.functional.CountdownCallback; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class QuartzFunctionalTestCase extends FunctionalTestCase { protected String getConfigResources() { return "quartz-functional-test.xml"; } public void testMuleReceiverJob() throws Exception { FunctionalTestComponent2 component = (FunctionalTestComponent2) getComponent("quartzService1"); assertNotNull(component); CountdownCallback count1 = new CountdownCallback(4); component.setEventCallback(count1); component = (FunctionalTestComponent2) getComponent("quartzService2"); assertNotNull(component); CountdownCallback count2 = new CountdownCallback(2); component.setEventCallback(count2); // we wait up to 60 seconds here which is WAY too long for three ticks with 1 // second interval, but it seems that "sometimes" it takes a very long time // for Quartz go kick in. Once it starts ticking everything is fine. assertTrue("Count 1 timed out: expected 0, value is: " + count1.getCount(), count1.await(60000)); assertTrue("Count 2 timed out: expected 0, value is: " + count2.getCount(), count2.await(5000)); } } mule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/config/0000755000175000017500000000000011351410642027111 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/config/QuartzNamespaceHandlerTestCase.javamule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/config/QuartzNamespaceHandlerTe0000644000175000017500000001474411002723722033737 0ustar charlescharles/* * $Id: QuartzNamespaceHandlerTestCase.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz.config; import org.mule.tck.FunctionalTestCase; import org.mule.transport.quartz.QuartzConnector; import org.mule.transport.quartz.jobs.EventGeneratorJobConfig; import org.mule.transport.quartz.jobs.CustomJobConfig; import org.mule.transport.quartz.jobs.CustomJobFromMessageConfig; import org.mule.transport.quartz.jobs.EventGeneratorJob; import org.mule.transport.quartz.jobs.EndpointPollingJobConfig; import org.mule.transport.quartz.jobs.EndpointPollingJob; import org.mule.transport.quartz.jobs.ScheduledDispatchJobConfig; import org.mule.transport.quartz.jobs.ScheduledDispatchJob; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.quartz.impl.StdScheduler; /** * Tests the "quartz" namespace. */ public class QuartzNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "quartz-namespace-config.xml"; } public void testDefaultConfig() throws Exception { QuartzConnector c = (QuartzConnector)muleContext.getRegistry().lookupConnector("quartzConnectorDefaults"); assertNotNull(c); assertNotNull(c.getQuartzScheduler()); assertEquals(StdScheduler.class, c.getQuartzScheduler().getClass()); StdScheduler scheduler = (StdScheduler) c.getQuartzScheduler(); assertEquals("DefaultQuartzScheduler", scheduler.getSchedulerName()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testInjectedSchedulerBean() throws Exception { QuartzConnector c = (QuartzConnector)muleContext.getRegistry().lookupConnector("quartzConnector1"); assertNotNull(c); assertNotNull(c.getQuartzScheduler()); assertEquals(StdScheduler.class, c.getQuartzScheduler().getClass()); StdScheduler scheduler = (StdScheduler) c.getQuartzScheduler(); assertEquals("MuleScheduler1", scheduler.getSchedulerName()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testFactoryProperties() throws Exception { QuartzConnector c = (QuartzConnector)muleContext.getRegistry().lookupConnector("quartzConnector2"); assertNotNull(c); assertNotNull(c.getQuartzScheduler()); assertEquals(StdScheduler.class, c.getQuartzScheduler().getClass()); StdScheduler scheduler = (StdScheduler) c.getQuartzScheduler(); assertEquals("MuleScheduler2", scheduler.getSchedulerName()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testEndpoint1Config() throws Exception { EndpointBuilder eb = muleContext.getRegistry().lookupEndpointBuilder("qEP1"); assertNotNull(eb); InboundEndpoint ep = eb.buildInboundEndpoint(); assertNotNull(ep.getProperty("jobConfig")); assertTrue(ep.getProperty("jobConfig") instanceof EventGeneratorJobConfig); EventGeneratorJobConfig config = (EventGeneratorJobConfig)ep.getProperty("jobConfig"); assertEquals("foo", config.getPayload()); } public void testEndpoint2Config() throws Exception { EndpointBuilder eb = muleContext.getRegistry().lookupEndpointBuilder("qEP2"); assertNotNull(eb); InboundEndpoint ep = eb.buildInboundEndpoint(); assertNotNull(ep.getProperty("jobConfig")); assertTrue(ep.getProperty("jobConfig") instanceof EventGeneratorJobConfig); EventGeneratorJobConfig config = (EventGeneratorJobConfig)ep.getProperty("jobConfig"); assertEquals("foo bar", config.getPayload()); } public void testEndpoint3Config() throws Exception { EndpointBuilder eb = muleContext.getRegistry().lookupEndpointBuilder("qEP3"); assertNotNull(eb); InboundEndpoint ep = eb.buildInboundEndpoint(); assertNotNull(ep.getProperty("jobConfig")); assertTrue(ep.getProperty("jobConfig") instanceof CustomJobFromMessageConfig); CustomJobFromMessageConfig config = (CustomJobFromMessageConfig)ep.getProperty("jobConfig"); assertEquals("header", config.getEvaluator()); assertEquals("jobConfig", config.getExpression()); assertNull(config.getCustomEvaluator()); //Test grabbing the Job instance } public void testEndpoint4Config() throws Exception { EndpointBuilder eb = muleContext.getRegistry().lookupEndpointBuilder("qEP4"); assertNotNull(eb); InboundEndpoint ep = eb.buildInboundEndpoint(); assertNotNull(ep.getProperty("jobConfig")); assertTrue(ep.getProperty("jobConfig") instanceof CustomJobConfig); CustomJobConfig config = (CustomJobConfig)ep.getProperty("jobConfig"); assertTrue(config.getJob() instanceof EventGeneratorJob); } public void testEndpoint5Config() throws Exception { EndpointBuilder eb = muleContext.getRegistry().lookupEndpointBuilder("qEP5"); assertNotNull(eb); InboundEndpoint ep = eb.buildInboundEndpoint(); assertNotNull(ep.getProperty("jobConfig")); assertTrue(ep.getProperty("jobConfig") instanceof EndpointPollingJobConfig); EndpointPollingJobConfig config = (EndpointPollingJobConfig)ep.getProperty("jobConfig"); assertEquals(EndpointPollingJob.class, config.getJobClass()); assertEquals("vm://foo", config.getEndpointRef()); assertEquals(4000, config.getTimeout()); } public void testEndpoint6Config() throws Exception { EndpointBuilder eb = muleContext.getRegistry().lookupEndpointBuilder("qEP6"); assertNotNull(eb); InboundEndpoint ep = eb.buildInboundEndpoint(); assertNotNull(ep.getProperty("jobConfig")); assertTrue(ep.getProperty("jobConfig") instanceof ScheduledDispatchJobConfig); ScheduledDispatchJobConfig config = (ScheduledDispatchJobConfig)ep.getProperty("jobConfig"); assertEquals(ScheduledDispatchJob.class, config.getJobClass()); assertEquals("scheduledDispatchEndpoint", config.getEndpointRef()); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzFunctionalLegacyTestCase.javamule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzFunctionalLegacyTestCase.0000644000175000017500000000361511002723722033743 0ustar charlescharles/* * $Id: QuartzFunctionalLegacyTestCase.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent2; import org.mule.tck.functional.CountdownCallback; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class QuartzFunctionalLegacyTestCase extends FunctionalTestCase { protected String getConfigResources() { return "quartz-functional-legacy-test.xml"; } public void testMuleReceiverJob() throws Exception { FunctionalTestComponent2 component = (FunctionalTestComponent2) getComponent("quartzService1"); assertNotNull(component); CountdownCallback count1 = new CountdownCallback(4); component.setEventCallback(count1); component = (FunctionalTestComponent2) getComponent("quartzService2"); assertNotNull(component); CountdownCallback count2 = new CountdownCallback(2); component.setEventCallback(count2); // we wait up to 60 seconds here which is WAY too long for three ticks with 1 // second interval, but it seems that "sometimes" it takes a very long time // for Quartz go kick in. Once it starts ticking everything is fine. assertTrue("Count 1 timed out: expected 0, value is: " + count1.getCount(), count1.await(60000)); assertTrue("Count 2 timed out: expected 0, value is: " + count2.getCount(), count2.await(5000)); } } mule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzConnectorTestCase.java0000644000175000017500000000264610754365306033330 0ustar charlescharles/* * $Id: QuartzConnectorTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.quartz.QuartzConnector; public class QuartzConnectorTestCase extends AbstractConnectorTestCase { /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractConnectorTestCase#getConnector() */ // @Override public Connector createConnector() throws Exception { QuartzConnector c = new QuartzConnector(); c.setName("QuartzConnector"); return c; } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractConnectorTestCase#getValidMessage() */ public Object getValidMessage() throws Exception { return "test"; } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractConnectorTestCase#getTestEndpointURI() */ public String getTestEndpointURI() { return "quartz:/myService?repeatInterval=1000"; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzCustomJobFromMessageTestCase.javamule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzCustomJobFromMessageTestC0000644000175000017500000000453611002723722034006 0ustar charlescharles/* * $Id: QuartzCustomJobFromMessageTestCase.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent2; import org.mule.tck.functional.CountdownCallback; import org.mule.transport.quartz.QuartzConnector; import org.mule.transport.quartz.jobs.ScheduledDispatchJobConfig; import org.mule.transport.NullPayload; import java.util.HashMap; import java.util.Map; public class QuartzCustomJobFromMessageTestCase extends FunctionalTestCase { protected String getConfigResources() { return "quartz-receive-dispatch-delegating-job.xml"; } public void testDelegatingJobAsProperty() throws Exception { FunctionalTestComponent2 component = (FunctionalTestComponent2) getComponent("scheduledService"); assertNotNull(component); CountdownCallback count = new CountdownCallback(1); component.setEventCallback(count); MuleClient client = new MuleClient(); Map props = new HashMap(); ScheduledDispatchJobConfig jobConfig = new ScheduledDispatchJobConfig(); jobConfig.setEndpointRef("vm://quartz.in"); props.put(QuartzConnector.PROPERTY_JOB_CONFIG, jobConfig); client.send("vm://quartz.scheduler1", NullPayload.getInstance(), props); assertTrue(count.await(7000)); } public void testDelegatingJobAsPayload() throws Exception { FunctionalTestComponent2 component = (FunctionalTestComponent2) getComponent("scheduledService"); assertNotNull(component); CountdownCallback count = new CountdownCallback(1); component.setEventCallback(count); MuleClient client = new MuleClient(); ScheduledDispatchJobConfig jobConfig = new ScheduledDispatchJobConfig(); jobConfig.setEndpointRef("vm://quartz.in"); client.send("vm://quartz.scheduler2", jobConfig, null); assertTrue(count.await(7000)); } } mule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzDispatchJobTestCase.java0000644000175000017500000000256111002723722033547 0ustar charlescharles/* * $Id: QuartzDispatchJobTestCase.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent2; import org.mule.tck.functional.CountdownCallback; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class QuartzDispatchJobTestCase extends FunctionalTestCase { protected String getConfigResources() { return "quartz-dispatch.xml"; } public void testMuleClientDispatchJob() throws Exception { FunctionalTestComponent2 component = (FunctionalTestComponent2)getComponent("scheduledService"); assertNotNull(component); CountdownCallback count = new CountdownCallback(3); component.setEventCallback(count); new MuleClient().send("vm://quartz.scheduler", "quartz test", null); assertTrue(count.await(5000)); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzReceiveAndDispatchJobTestCase.javamule-2.0.1/transports/quartz/src/test/java/org/mule/transport/quartz/QuartzReceiveAndDispatchJobTest0000644000175000017500000000315111002723722033755 0ustar charlescharles/* * $Id: QuartzReceiveAndDispatchJobTestCase.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.quartz; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent2; import org.mule.tck.functional.CountdownCallback; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class QuartzReceiveAndDispatchJobTestCase extends FunctionalTestCase { protected String getConfigResources() { return "quartz-receive-dispatch.xml"; } public void testMuleClientReceiveAndDispatchJob() throws Exception { FunctionalTestComponent2 component = (FunctionalTestComponent2)getComponent("scheduledService"); assertNotNull(component); CountdownCallback count = new CountdownCallback(3); component.setEventCallback(count); new MuleClient().send("vm://event.queue", "quartz test", null); new MuleClient().send("vm://event.queue", "quartz test", null); new MuleClient().send("vm://event.queue", "quartz test", null); new MuleClient().send("vm://quartz.scheduler", "test", null); assertTrue(count.await(5000)); } } mule-2.0.1/transports/quartz/src/test/resources/0000755000175000017500000000000011351410642021622 5ustar charlescharlesmule-2.0.1/transports/quartz/src/test/resources/quartz-dispatch.xml0000644000175000017500000000337711002723722025500 0ustar charlescharles mule-2.0.1/transports/quartz/src/test/resources/quartz-functional-legacy-test.xml0000644000175000017500000000372311002723722030255 0ustar charlescharles mule-2.0.1/transports/quartz/src/test/resources/quartz-functional-test.xml0000644000175000017500000000354211002723722027012 0ustar charlescharles foo mule-2.0.1/transports/quartz/src/test/resources/payload-data.txt0000644000175000017500000000000711002723722024717 0ustar charlescharlesfoo barmule-2.0.1/transports/quartz/src/test/resources/quartz-namespace-config.xml0000644000175000017500000001043711002723722027073 0ustar charlescharles MuleScheduler1 org.quartz.simpl.SimpleThreadPool 3 false false org.quartz.simpl.RAMJobStore foo mule-2.0.1/transports/quartz/src/test/resources/quartz-receive-dispatch.xml0000644000175000017500000000367111002723722027115 0ustar charlescharles mule-2.0.1/transports/quartz/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000047411002723722026500 0ustar charlescharles # Cannot run legacy tests without 1to2migration module org.mule.transport.quartz.QuartzFunctionalLegacyTestCase # MULE-1925 #org.mule.transport.quartz.QuartzFunctionalTestCase # MULE-2688 #org.mule.transport.quartz.QuartzReceiveAndDispatchJobTestCase #org.mule.transport.quartz.QuartzCustomJobFromMessageTestCase mule-2.0.1/transports/quartz/src/test/resources/quartz-receive-dispatch-delegating-job.xml0000644000175000017500000000503711002723722031764 0ustar charlescharles mule-2.0.1/transports/quartz/pom.xml0000644000175000017500000000444511006063605017366 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-quartz Quartz Transport A Mule transport for Quartz. This transport supplies a receiver for jobs scheduled with Quartz. quartz quartz-all 1.6.0 org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} org.mule.transports mule-transport-vm ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.transport.quartz.* mule-2.0.1/transports/bpm/0000755000175000017500000000000011351410663015275 5ustar charlescharlesmule-2.0.1/transports/bpm/src/0000755000175000017500000000000011351410663016064 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/0000755000175000017500000000000011351410663017010 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/java/0000755000175000017500000000000011351410663017731 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/java/org/0000755000175000017500000000000011351410663020520 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/java/org/mule/0000755000175000017500000000000011351410663021462 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/java/org/mule/transport/0000755000175000017500000000000011351410663023516 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/java/org/mule/transport/bpm/0000755000175000017500000000000011351410663024274 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/java/org/mule/transport/bpm/ProcessComponent.java0000644000175000017500000000152210777653124030454 0ustar charlescharles/* * $Id: ProcessComponent.java 11566 2008-04-11 12:15:16Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.component.AbstractComponent; import org.apache.commons.lang.NotImplementedException; // TODO MULE-3205 public class ProcessComponent extends AbstractComponent { //@Override protected MuleMessage doOnCall(MuleEvent event) throws Exception { throw new NotImplementedException(); } } mule-2.0.1/transports/bpm/src/main/java/org/mule/transport/bpm/ProcessMessageDispatcher.java0000644000175000017500000002120710757615756032116 0ustar charlescharles/* * $Id: ProcessMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.DispatchException; import org.mule.config.i18n.MessageFactory; import org.mule.transport.AbstractMessageDispatcher; import org.mule.transport.NullPayload; import org.mule.util.StringUtils; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * Initiates or advances a workflow process from an outgoing Mule event. */ public class ProcessMessageDispatcher extends AbstractMessageDispatcher { private ProcessConnector connector; public ProcessMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (ProcessConnector)endpoint.getConnector(); } /** * Performs a synchronous action on the BPMS. * * @return an object representing the new state of the process */ public MuleMessage doSend(MuleEvent event) throws Exception { Object process = processAction(event); if (process != null) { MuleMessage msg = new DefaultMuleMessage(process); msg.setProperty(ProcessConnector.PROPERTY_PROCESS_ID, connector.getBpms().getId(process)); return msg; } else { throw new DispatchException(MessageFactory .createStaticMessage("Synchronous process invocation must return the new process state."), event.getMessage(), event.getEndpoint()); } } /** * Performs an asynchronous action on the BPMS. */ public void doDispatch(MuleEvent event) throws Exception { processAction(event); } protected Object processAction(MuleEvent event) throws Exception { // An object representing the new state of the process Object process = null; // Create a map of process variables based on the message properties. Map processVariables = new HashMap(); if (event != null) { String propertyName; for (Iterator iterator = event.getMessage().getPropertyNames().iterator(); iterator.hasNext();) { propertyName = (String)iterator.next(); processVariables.put(propertyName, event.getMessage().getProperty(propertyName)); } Object payload = event.transformMessage(); if (payload != null && !(payload instanceof NullPayload)) { // Store the message's payload as a process variable. processVariables.put(ProcessConnector.PROCESS_VARIABLE_INCOMING, payload); // Store the endpoint on which the message was received as a process // variable. String originatingEndpoint = event.getMessage().getStringProperty( MuleProperties.MULE_ORIGINATING_ENDPOINT_PROPERTY, null); if (StringUtils.isNotEmpty(originatingEndpoint)) { processVariables.put(ProcessConnector.PROCESS_VARIABLE_INCOMING_SOURCE, originatingEndpoint); } } } // Retrieve the parameters Object processType = event.getProperty(ProcessConnector.PROPERTY_PROCESS_TYPE, /* exhaustiveSearch */ true); processVariables.remove(ProcessConnector.PROPERTY_PROCESS_TYPE); // TODO MULE-1220 The processId for BPM is sort of like a session and so we could probably use // Mule's SessionHandler interface for managing this. Object processId; String processIdField = connector.getProcessIdField(); if (StringUtils.isNotEmpty(processIdField)) { processId = event.getProperty(processIdField, /* exhaustiveSearch */false); } // If processId is explicitly set for the message, this overrides the // processIdField. processId = event.getProperty(ProcessConnector.PROPERTY_PROCESS_ID, /* exhaustiveSearch */true); processVariables.remove(ProcessConnector.PROPERTY_PROCESS_ID); // Default action is "advance" String action = event.getMessage().getStringProperty(ProcessConnector.PROPERTY_ACTION, ProcessConnector.ACTION_ADVANCE); processVariables.remove(ProcessConnector.PROPERTY_ACTION); Object transition = event.getMessage().getProperty(ProcessConnector.PROPERTY_TRANSITION); processVariables.remove(ProcessConnector.PROPERTY_TRANSITION); // Decode the URI, for example: // bpm://testProcess/4561?action=advance String temp; temp = event.getEndpoint().getEndpointURI().getHost(); if (StringUtils.isNotEmpty(temp)) { processType = temp; } temp = event.getEndpoint().getEndpointURI().getPath(); if (StringUtils.isNotEmpty(temp)) { // Strip the leading "/" from the path. if (temp.startsWith("/")) { temp = StringUtils.right(temp, temp.length() - 1); } // If there are any remaining "/", we don't know what to do with them. if (temp.indexOf("/") != -1) { throw new IllegalArgumentException("Unexpected format in the path of the URL: " + temp); } processId = temp; } // ////////////////////////////////////////////////////////////////////// // Start a new process. if (processId == null || action.equals(ProcessConnector.ACTION_START)) { if (processType != null) { process = connector.getBpms().startProcess(processType, transition, processVariables); if ((process != null) && logger.isInfoEnabled()) { logger.info("New process started, ID = " + connector.getBpms().getId(process)); } } else { throw new IllegalArgumentException("Process type is missing, cannot start a new process."); } } // Don't advance the process, just update the process variables. else if (action.equals(ProcessConnector.ACTION_UPDATE)) { if (processId != null) { process = connector.getBpms().updateProcess(processId, processVariables); if ((process != null) && logger.isInfoEnabled()) { logger.info("Process variables updated, ID = " + connector.getBpms().getId(process)); } } else { throw new IllegalArgumentException("Process ID is missing, cannot update process."); } } // Abort the running process (end abnormally). else if (action.equals(ProcessConnector.ACTION_ABORT)) { if (processId != null) { connector.getBpms().abortProcess(processId); process = NullPayload.getInstance(); logger.info("Process aborted, ID = " + processId); } else { throw new IllegalArgumentException("Process ID is missing, cannot abort process."); } } // Advance the already-running process one step. else { if (processId != null) { process = connector.getBpms().advanceProcess(processId, transition, processVariables); if ((process != null) && logger.isInfoEnabled()) { logger.info("Process advanced, ID = " + connector.getBpms().getId(process) + ", new state = " + connector.getBpms().getState(process)); } } else { throw new IllegalArgumentException("Process ID is missing, cannot advance process."); } } return process; } protected void doConnect() throws Exception { /* nop */ } protected void doDisconnect() throws Exception { /* nop */ } protected void doDispose() { /* nop */ } } mule-2.0.1/transports/bpm/src/main/java/org/mule/transport/bpm/ProcessConnector.java0000644000175000017500000002133610776732355030454 0ustar charlescharles/* * $Id: ProcessConnector.java 11541 2008-04-08 18:09:49Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.ConfigurationException; import org.mule.api.config.MuleProperties; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.MessageFactory; import org.mule.module.client.MuleClient; import org.mule.transport.AbstractConnector; import org.mule.util.StringUtils; import java.util.Map; /** * The BPM provider allows Mule events to initiate and/or advance processes in an * external or embedded Business Process Management System (BPMS). It also allows * executing processes to generate Mule events. */ public class ProcessConnector extends AbstractConnector implements MessageService { /** The underlying BPMS */ protected BPMS bpms; /** This field will be used to correlate messages with processes. */ protected String processIdField; /** * The global receiver allows an endpoint of type "bpm://*" to receive any * incoming message to the BPMS, regardless of the process. If this is false, the * process name must be specified for each endpoint, e.g. "bpm://MyProcess" will * only receive messages for the process "MyProcess". */ protected boolean allowGlobalReceiver = false; /** * If false, any message generated by the process is routed from the service on * which it is received. If true, a process can send messages to any endpoint * on any service. */ protected boolean allowGlobalDispatcher = false; public static final String BPM_PROPERTY_PREFIX = "BPM_"; public static final String PROPERTY_ENDPOINT = MuleProperties.PROPERTY_PREFIX + BPM_PROPERTY_PREFIX + "ENDPOINT"; public static final String PROPERTY_PROCESS_TYPE = MuleProperties.PROPERTY_PREFIX + BPM_PROPERTY_PREFIX + "PROCESS_TYPE"; public static final String PROPERTY_PROCESS_ID = MuleProperties.PROPERTY_PREFIX + BPM_PROPERTY_PREFIX + "PROCESS_ID"; public static final String PROPERTY_ACTION = MuleProperties.PROPERTY_PREFIX + BPM_PROPERTY_PREFIX + "ACTION"; public static final String PROPERTY_TRANSITION = MuleProperties.PROPERTY_PREFIX + BPM_PROPERTY_PREFIX + "TRANSITION"; public static final String PROPERTY_PROCESS_STARTED = MuleProperties.PROPERTY_PREFIX + BPM_PROPERTY_PREFIX + "STARTED"; public static final String ACTION_START = "start"; public static final String ACTION_ADVANCE = "advance"; public static final String ACTION_UPDATE = "update"; public static final String ACTION_ABORT = "abort"; public static final String PROCESS_VARIABLE_INCOMING = "incoming"; public static final String PROCESS_VARIABLE_INCOMING_SOURCE = "incomingSource"; public static final String PROCESS_VARIABLE_DATA = "data"; public static final String PROTOCOL = "bpm"; public static final String GLOBAL_RECEIVER = PROTOCOL + "://*"; private MuleClient muleClient = null; public String getProtocol() { return PROTOCOL; } protected void doInitialise() throws InitialisationException { try { if (bpms == null) { throw new ConfigurationException( MessageFactory.createStaticMessage("The bpms property must be set for this connector.")); } // Set a callback so that the BPMS may generate messages within Mule. bpms.setMessageService(this); // The MuleClient is used as a global dispatcher. // TODO MULE-1221 It would be cleaner to use something like the dynamic:// transport if ((allowGlobalDispatcher == true) && (muleClient == null)) { muleClient = new MuleClient(muleContext); } } catch (Exception e) { throw new InitialisationException(e, this); } } protected void doDispose() { // template method } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } protected void doStart() throws MuleException { // template method } protected void doStop() throws MuleException { // template method } /** * This method looks for a receiver based on the process name and ID. It searches * iteratively from the narrowest scope (match process name and ID) to the widest * scope (match neither - global receiver) possible. * * @return ProcessMessageReceiver or null if no match is found */ public ProcessMessageReceiver lookupReceiver(String processName, Object processId) { ProcessMessageReceiver receiver = (ProcessMessageReceiver)lookupReceiver(toUrl(processName, processId)); if (receiver == null) { receiver = (ProcessMessageReceiver)lookupReceiver(toUrl(processName, null)); } if (receiver == null) { receiver = (ProcessMessageReceiver)lookupReceiver(toUrl(null, null)); } return receiver; } /** * Generate a URL based on the process name and ID such as "bpm://myProcess/2342" * If the parameters are missing, and allowGlobalReceiver is true, * the GLOBAL_RECEIVER is returned. */ public String toUrl(String processName, Object processId) { String url = getProtocol() + "://"; if (StringUtils.isNotEmpty(processName)) { url += processName; if (processId != null) { url += "/" + processId; } } else if (isAllowGlobalReceiver()) { return GLOBAL_RECEIVER; } else { throw new IllegalArgumentException( "No valid URL could be created for the given process name and ID: processName = " + processName + ", processId = " + processId); } return url; } public MuleMessage generateMessage(String endpoint, Object payloadObject, Map messageProperties, boolean synchronous) throws Exception { String processName = (String)messageProperties.get(ProcessConnector.PROPERTY_PROCESS_TYPE); Object processId = messageProperties.get(ProcessConnector.PROPERTY_PROCESS_ID); // Look up a receiver for this process. ProcessMessageReceiver receiver = lookupReceiver(processName, processId); if (receiver == null) { throw new ConfigurationException(MessageFactory .createStaticMessage("No corresponding receiver found for processName = " + processName + ", processId = " + processId)); } if (synchronous) { // Send the process-generated Mule message synchronously. return receiver.generateSynchronousEvent(endpoint, payloadObject, messageProperties); } else { // Dispatch the process-generated Mule message asynchronously. receiver.generateAsynchronousEvent(endpoint, payloadObject, messageProperties); return null; } } // ////////////////////////////////////////////////////////////////////////// // Getters and Setters // ////////////////////////////////////////////////////////////////////////// public BPMS getBpms() { return bpms; } public void setBpms(BPMS bpms) { this.bpms = bpms; } public MuleClient getMuleClient() { return muleClient; } public boolean isAllowGlobalDispatcher() { return allowGlobalDispatcher; } public void setAllowGlobalDispatcher(boolean allowGlobalDispatcher) { this.allowGlobalDispatcher = allowGlobalDispatcher; } public boolean isAllowGlobalReceiver() { return allowGlobalReceiver; } public void setAllowGlobalReceiver(boolean allowGlobalReceiver) { this.allowGlobalReceiver = allowGlobalReceiver; } public String getProcessIdField() { return processIdField; } public void setProcessIdField(String processIdField) { this.processIdField = processIdField; } } mule-2.0.1/transports/bpm/src/main/java/org/mule/transport/bpm/config/0000755000175000017500000000000011351410663025541 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/java/org/mule/transport/bpm/config/BpmNamespaceHandler.java0000644000175000017500000000433211005753365032244 0ustar charlescharles/* * $Id: BpmNamespaceHandler.java 11659 2008-04-30 02:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.specific.RouterDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.routing.outbound.EndpointSelector; import org.mule.transport.bpm.ProcessConnector; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Registers a Bean Definition Parsers for the "bpm" namespace. */ public class BpmNamespaceHandler extends AbstractMuleNamespaceHandler { public static final String PROCESS = "process"; public void init() { registerStandardTransportEndpoints(ProcessConnector.PROTOCOL, new String[]{PROCESS}).addAlias(PROCESS, URIBuilder.PATH); registerConnectorDefinitionParser(ProcessConnector.class); registerBeanDefinitionParser("outbound-router", new BpmOutboundRouterDefinitionParser()); // TODO MULE-3205 //registerBeanDefinitionParser("component", new ComponentDefinitionParser(ProcessComponent.class)); } /** * This is merely a shortcut for: * */ class BpmOutboundRouterDefinitionParser extends RouterDefinitionParser { public BpmOutboundRouterDefinitionParser() { super(EndpointSelector.class); } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { builder.addPropertyValue("evaluator", "header"); builder.addPropertyValue("expression", ProcessConnector.PROPERTY_ENDPOINT); super.parseChild(element, parserContext, builder); } } } mule-2.0.1/transports/bpm/src/main/java/org/mule/transport/bpm/ProcessMessageDispatcherFactory.java0000644000175000017500000000170310757615756033445 0ustar charlescharles/* * $Id: ProcessMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * Creates a WorkflowMessageDispatcher instance. */ public class ProcessMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new ProcessMessageDispatcher(endpoint); } } mule-2.0.1/transports/bpm/src/main/java/org/mule/transport/bpm/BPMS.java0000644000175000017500000000673210745677442025730 0ustar charlescharles/* * $Id: BPMS.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm; import java.util.Map; /** * A generic interface for any Process Engine. * * Theoretically, any Process Engine can be "plugged into" Mule via the BPM connector * if it implements this interface. * * @see {@link MessageService} */ public interface BPMS { /** * {@link MessageService} contains a callback method used to generate Mule messages from your process. * This method is REQUIRED. * * @param msgService An interface within Mule which the BPMS may call to generate * Mule messages. */ public void setMessageService(MessageService msgService); /** * Start a new process. * This method is REQUIRED. * * @param processType - the type of process to start * @param processVariables - optional process variables/parameters to set * @return an object representing the new process */ public Object startProcess(Object processType, Object transition, Map processVariables) throws Exception; /** * Advance an already-running process. * This method is REQUIRED. * * @param processId - an ID which identifies the running process * @param transition - optionally specify which transition to take from the * current state * @param processVariables - optional process variables/parameters to set * @return an object representing the process in its new (i.e., advanced) state */ public Object advanceProcess(Object processId, Object transition, Map processVariables) throws Exception; /** * Update the variables/parameters for an already-running process. * This method is OPTIONAL. * * @param processId - an ID which identifies the running process * @param processVariables - process variables/parameters to set * @return an object representing the process in its new (i.e., updated) state */ public Object updateProcess(Object processId, Map processVariables) throws Exception; /** * Abort a running process (end abnormally). * This method is OPTIONAL. * * @param processId - an ID which identifies the running process */ public void abortProcess(Object processId) throws Exception; /** * Looks up an already-running process. * This method is OPTIONAL. * * @return an object representing the process */ public Object lookupProcess(Object processId) throws Exception; /** * @return an ID which identifies the given process. * This method is OPTIONAL. */ public Object getId(Object process) throws Exception; /** * @return the current state of the given process. * This method is OPTIONAL. */ public Object getState(Object process) throws Exception; /** * @return true if the given process has ended. * This method is OPTIONAL. */ public boolean hasEnded(Object process) throws Exception; /** * @return true if the object is a valid process * This method is OPTIONAL. */ public boolean isProcess(Object obj) throws Exception; } mule-2.0.1/transports/bpm/src/main/java/org/mule/transport/bpm/ProcessMessageReceiver.java0000644000175000017500000001106510757615756031575 0ustar charlescharles/* * $Id: ProcessMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.transport.AbstractMessageReceiver; import java.util.Map; import javax.resource.spi.work.Work; /** Generates an incoming Mule event from an executing workflow process. */ public class ProcessMessageReceiver extends AbstractMessageReceiver { private ProcessConnector connector = null; public ProcessMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); this.connector = (ProcessConnector) connector; } public MuleMessage generateSynchronousEvent(String endpoint, Object payload, Map messageProperties) throws MuleException { logger.debug("Executing process is sending an event (synchronously) to Mule endpoint = " + endpoint); MuleMessage response = generateEvent(endpoint, payload, messageProperties, true); if (logger.isDebugEnabled()) { logger.debug("Synchronous response is " + (response != null ? response.getPayload() : null)); } return response; } public void generateAsynchronousEvent(String endpoint, Object payload, Map messageProperties) throws MuleException { logger.debug("Executing process is dispatching an event (asynchronously) to Mule endpoint = " + endpoint); try { getWorkManager().scheduleWork(new Worker(endpoint, payload, messageProperties)); } catch (Exception e) { handleException(e); } } protected MuleMessage generateEvent(String endpoint, Object payload, Map messageProperties, boolean synchronous) throws MuleException { MuleMessage message; if (payload instanceof MuleMessage) { message = (MuleMessage) payload; } else { message = new DefaultMuleMessage(connector.getMessageAdapter(payload)); } message.addProperties(messageProperties); if (connector.isAllowGlobalDispatcher()) { // TODO MULE-1221 This should use the "dynamic://" endpoint and not depend on the MuleClient. if (synchronous) { return connector.getMuleClient().send(endpoint, message); } else { connector.getMuleClient().dispatch(endpoint, message); return null; } } else { message.setStringProperty(ProcessConnector.PROPERTY_ENDPOINT, endpoint); return routeMessage(message, synchronous); } } private class Worker implements Work { private String endpoint; private Object payload; private Map messageProperties; public Worker(String endpoint, Object payload, Map messageProperties) { this.endpoint = endpoint; this.payload = payload; this.messageProperties = messageProperties; } public void run() { try { generateEvent(endpoint, payload, messageProperties, false); } catch (Exception e) { getConnector().handleException(e); } } public void release() { /*nop*/ } } protected void doInitialise() throws InitialisationException { //nothing to do } protected void doConnect() throws Exception { // nothing to do } protected void doDisconnect() throws Exception { // nothing to do } protected void doStart() throws MuleException { // nothing to do } protected void doStop() throws MuleException { // nothing to do } protected void doDispose() { // nothing to do } } mule-2.0.1/transports/bpm/src/main/java/org/mule/transport/bpm/MessageService.java0000644000175000017500000000166510776731636030074 0ustar charlescharles/* * $Id: MessageService.java 11538 2008-04-08 18:04:14Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm; import org.mule.api.MuleMessage; import java.util.Map; /** * A message-generation service provided by Mule. Any BPMS may call this service from * its own processes in order to generate Mule messages. The generated messages will * be received by the "bpm://processName" endpoint within your Mule config. */ public interface MessageService { public MuleMessage generateMessage(String endpoint, Object payloadObject, Map messageProperties, boolean synchronous) throws Exception; } mule-2.0.1/transports/bpm/src/main/resources/0000755000175000017500000000000011351410663021022 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/resources/META-INF/0000755000175000017500000000000011351410663022162 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012210623150206025017 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/bpm/2.0/mule-bpm.xsd=META-INF/mule-bpm.xsd mule-2.0.1/transports/bpm/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014110745677442025222 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/bpm/2.0=org.mule.transport.bpm.config.BpmNamespaceHandler mule-2.0.1/transports/bpm/src/main/resources/META-INF/services/0000755000175000017500000000000011351410663024005 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410663024574 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410663025536 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410663027553 5ustar charlescharlesmule-2.0.1/transports/bpm/src/main/resources/META-INF/services/org/mule/providers/bpm.properties0000644000175000017500000000056410745677442032474 0ustar charlescharlesconnector=org.mule.transport.bpm.ProcessConnector message.receiver=org.mule.transport.bpm.ProcessMessageReceiver message.adapter=org.mule.transport.DefaultMessageAdapter dispatcher.factory=org.mule.transport.bpm.ProcessMessageDispatcherFactory requester.factory=org.mule.transport.UnsupportedMessageRequesterFactory endpoint.builder=org.mule.endpoint.UrlEndpointURIBuildermule-2.0.1/transports/bpm/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410663026315 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/bpm/src/main/resources/META-INF/services/org/mule/i18n/bpm-messages.propertiesmule-2.0.1/transports/bpm/src/main/resources/META-INF/services/org/mule/i18n/bpm-messages.properties0000644000175000017500000000000010672263414033011 0ustar charlescharlesmule-2.0.1/transports/bpm/src/main/resources/META-INF/mule-bpm.xsd0000644000175000017500000001302210777653124024432 0ustar charlescharles A reference to the underlying BPMS. This must implement the org.mule.providers.bpm.BPMS interface. The global receiver allows an endpoint of type "bpm://*" to receive any incoming message to the BPMS, regardless of the process. If this is false, the process name must be specified for each endpoint, e.g. "bpm://MyProcess" will only receive messages for the process "MyProcess". If false, any message generated by the process is routed from the component on which it is received. If true, a process can send messages to any endpoint on any component. This field will be used to correlate messages with processes. mule-2.0.1/transports/bpm/src/test/0000755000175000017500000000000011351410663017043 5ustar charlescharlesmule-2.0.1/transports/bpm/src/test/java/0000755000175000017500000000000011351410663017764 5ustar charlescharlesmule-2.0.1/transports/bpm/src/test/java/org/0000755000175000017500000000000011351410663020553 5ustar charlescharlesmule-2.0.1/transports/bpm/src/test/java/org/mule/0000755000175000017500000000000011351410663021515 5ustar charlescharlesmule-2.0.1/transports/bpm/src/test/java/org/mule/transport/0000755000175000017500000000000011351410663023551 5ustar charlescharlesmule-2.0.1/transports/bpm/src/test/java/org/mule/transport/bpm/0000755000175000017500000000000011351410663024327 5ustar charlescharlesmule-2.0.1/transports/bpm/src/test/java/org/mule/transport/bpm/tests/0000755000175000017500000000000011351410663025471 5ustar charlescharlesmule-2.0.1/transports/bpm/src/test/java/org/mule/transport/bpm/tests/AbstractBpmTestCase.java0000644000175000017500000000170110754365306032202 0ustar charlescharles/* * $Id: AbstractBpmTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.tests; import org.mule.tck.FunctionalTestCase; import org.mule.transport.bpm.BPMS; import org.mule.transport.bpm.ProcessConnector; public abstract class AbstractBpmTestCase extends FunctionalTestCase { protected ProcessConnector connector; protected BPMS bpms; protected void doSetUp() throws Exception { connector = (ProcessConnector) muleContext.getRegistry().lookupConnector("bpmConnector"); bpms = connector.getBpms(); super.doSetUp(); } } mule-2.0.1/transports/bpm/src/test/java/org/mule/transport/bpm/BpmConnectorTestCase.java0000644000175000017500000000364010766204322031224 0ustar charlescharles/* * $Id: BpmConnectorTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.bpm.test.TestBpms; import com.mockobjects.dynamic.Mock; /** * Generic connector tests. */ public class BpmConnectorTestCase extends AbstractConnectorTestCase { /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractConnectorTestCase#getConnector() */ public Connector createConnector() throws Exception { ProcessConnector c = new ProcessConnector(); c.setName("ProcessConnector"); c.setBpms(new TestBpms()); return c; } public void testMessageServiceSet() throws Exception { ProcessConnector c = (ProcessConnector) this.createConnector(); // The BPMS must be set prior to initializing the connector. Mock bpms = new Mock(BPMS.class); bpms.expect("setMessageService", c); c.setBpms((BPMS) bpms.proxy()); c.setMuleContext(muleContext); c.initialise(); bpms.verify(); } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractConnectorTestCase#getValidMessage() */ public Object getValidMessage() throws Exception { return "test"; } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractConnectorTestCase#getTestEndpointURI() */ public String getTestEndpointURI() { return "bpm://dummyProcess?processId=1234"; } } mule-2.0.1/transports/bpm/src/test/java/org/mule/transport/bpm/test/0000755000175000017500000000000011351410663025306 5ustar charlescharlesmule-2.0.1/transports/bpm/src/test/java/org/mule/transport/bpm/test/TestBpms.java0000644000175000017500000000351410745677442027735 0ustar charlescharles/* * $Id: TestBpms.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.test; import org.mule.transport.bpm.BPMS; import org.mule.transport.bpm.MessageService; import java.util.Map; /** * Dummy BPMS for unit testing. */ public class TestBpms implements BPMS { private String foo; public void abortProcess(Object processId) throws Exception { // nop } public Object advanceProcess(Object processId, Object transition, Map processVariables) throws Exception { return null; } public Object getId(Object process) throws Exception { return null; } public Object getState(Object process) throws Exception { return null; } public boolean hasEnded(Object process) throws Exception { return false; } public boolean isProcess(Object obj) throws Exception { return false; } public Object lookupProcess(Object processId) throws Exception { return null; } public void setMessageService(MessageService msgService) { // nop } public Object startProcess(Object processType, Object transition, Map processVariables) throws Exception { return null; } public Object updateProcess(Object processId, Map processVariables) throws Exception { return null; } public String getFoo() { return foo; } public void setFoo(String foo) { this.foo = foo; } } mule-2.0.1/transports/bpm/src/test/java/org/mule/transport/bpm/config/0000755000175000017500000000000011351410663025574 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/bpm/src/test/java/org/mule/transport/bpm/config/BpmNamespaceHandlerTestCase.javamule-2.0.1/transports/bpm/src/test/java/org/mule/transport/bpm/config/BpmNamespaceHandlerTestCase.ja0000644000175000017500000000407510745677442033423 0ustar charlescharles/* * $Id: BpmNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.bpm.config; import org.mule.tck.FunctionalTestCase; import org.mule.transport.bpm.BPMS; import org.mule.transport.bpm.ProcessConnector; import org.mule.transport.bpm.test.TestBpms; /** * Tests the Spring XML namespace for the BPM transport. */ public class BpmNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "bpm-namespace-config.xml"; } public void testDefaults() throws Exception { ProcessConnector c = (ProcessConnector)muleContext.getRegistry().lookupConnector("bpmConnectorDefaults"); assertNotNull(c); assertFalse(c.isAllowGlobalDispatcher()); assertFalse(c.isAllowGlobalReceiver()); assertNull(c.getProcessIdField()); BPMS bpms = c.getBpms(); assertNotNull(bpms); assertEquals(TestBpms.class, bpms.getClass()); assertEquals("bar", ((TestBpms) bpms).getFoo()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testConfig() throws Exception { ProcessConnector c = (ProcessConnector)muleContext.getRegistry().lookupConnector("bpmConnector1"); assertNotNull(c); assertTrue(c.isAllowGlobalDispatcher()); assertTrue(c.isAllowGlobalReceiver()); assertEquals("myId", c.getProcessIdField()); BPMS bpms = c.getBpms(); assertNotNull(bpms); assertEquals(TestBpms.class, bpms.getClass()); assertEquals("bar", ((TestBpms) bpms).getFoo()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } } mule-2.0.1/transports/bpm/src/test/resources/0000755000175000017500000000000011351410663021055 5ustar charlescharlesmule-2.0.1/transports/bpm/src/test/resources/bpm-namespace-config.xml0000644000175000017500000000200710745677442025571 0ustar charlescharles mule-2.0.1/transports/bpm/pom.xml0000644000175000017500000000475511006063605016622 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-bpm BPM Transport Allows Mule events to initiate and/or advance processes in an external or embedded Business Process Management System (BPMS). It also allows executing processes to generate Mule events. org.apache.maven.plugins maven-jar-plugin test-jar org.mule.modules mule-module-client ${version} org.mule.tests mule-tests-functional ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.transport.bpm.* mule-2.0.1/transports/stdio/0000755000175000017500000000000011351410637015642 5ustar charlescharlesmule-2.0.1/transports/stdio/src/0000755000175000017500000000000011351410637016431 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/0000755000175000017500000000000011351410637017355 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/java/0000755000175000017500000000000011351410637020276 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/java/org/0000755000175000017500000000000011351410637021065 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/java/org/mule/0000755000175000017500000000000011351410637022027 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/java/org/mule/transport/0000755000175000017500000000000011351410637024063 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/0000755000175000017500000000000011351410637025205 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/StdioConnector.java0000644000175000017500000000530710757615756031034 0ustar charlescharles/* * $Id: StdioConnector.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.stdio; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import org.mule.transport.AbstractConnector; import org.mule.transport.AbstractPollingMessageReceiver; import java.io.InputStream; import java.io.OutputStream; import org.apache.commons.io.IOUtils; /** * StdioConnector can send and receive Mule events over IO streams. */ public abstract class StdioConnector extends AbstractConnector { public static final String STDIO = "stdio"; public static final String STREAM_SYSTEM_IN = "system.in"; public static final String STREAM_SYSTEM_OUT = "system.out"; public static final String STREAM_SYSTEM_ERR = "system.err"; protected OutputStream outputStream; protected InputStream inputStream; /* * (non-Javadoc) * * @see org.mule.api.transport.Connector#registerListener(org.mule.api.MuleSession, * org.mule.api.endpoint.Endpoint) */ public MessageReceiver createReceiver(Service service, InboundEndpoint endpoint) throws Exception { return serviceDescriptor.createMessageReceiver(this, service, endpoint, new Object[]{new Long(AbstractPollingMessageReceiver.DEFAULT_POLL_FREQUENCY)}); } /* * (non-Javadoc) * * @see org.mule.transport.AbstractConnector#doStop() */ public void doStop() { // template method } protected void doDispose() { IOUtils.closeQuietly(inputStream); IOUtils.closeQuietly(outputStream); } /* * (non-Javadoc) * * @see org.mule.transport.AbstractConnector#doStart() */ public void doStart() { // template method } /* * (non-Javadoc) * * @see org.mule.api.transport.Connector#getProtocol() */ public String getProtocol() { return STDIO; } public InputStream getInputStream() { return inputStream; } public void setInputStream(InputStream inputStream) { this.inputStream = inputStream; } public OutputStream getOutputStream() { return outputStream; } public void setOutputStream(OutputStream outputStream) { this.outputStream = outputStream; } } mule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/PromptStdioConnector.java0000644000175000017500000001572710757615756032245 0ustar charlescharles/* * $Id: PromptStdioConnector.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.stdio; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageReceiver; import org.mule.config.i18n.MessageFactory; import org.mule.util.StringUtils; import java.io.InputStream; import java.io.OutputStream; /** * PromptStdioConnector connects to the System streams in and out by * default and add some basic fuctionality for writing out prompt messages. */ public class PromptStdioConnector extends StdioConnector { private String promptMessage; private String promptMessageCode = null; private String resourceBundle = null; private String outputMessage; private String outputMessageCode = null; private long messageDelayTime = 3000; private boolean firstTime = true; public PromptStdioConnector() { super(); inputStream = System.in; outputStream = System.out; } protected void doInitialise() throws InitialisationException { // template method, nothing to do } protected void doDispose() { // Override as a no-op. // The reason is System.in/out shouldn't be closed. // It is valid for them to remain open (consider, e.g. tail -F). // Trying to close System.in will result in I/O block, and // available() will always return 0 bytes for System.in. // There is a scheme to get a ref to System.in via NIO, // e.g. : // FileInputStream fis = new FileInputStream(FileDescriptor.in); // InputStream is = Channels.newInputStream(fis.getChannel); // // It is then possible to register a watchdog thread for the caller // which will interrupt this (now wrapped with NIO) read() call. // Well, it isn't absolutely required for the reasons stated above, // just following the KISS principle. } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } public InputStream getInputStream() { return inputStream; } public void doStart() { firstTime = false; } public OutputStream getOutputStream() { return outputStream; } /** * @return Returns the promptMessage. */ public String getPromptMessage() { if (StringUtils.isNotBlank(resourceBundle) && StringUtils.isNotBlank(promptMessageCode)) { return StdioMessageFactory.getString(resourceBundle, promptMessageCode); } return promptMessage; } /** * @param promptMessage The promptMessage to set. */ public void setPromptMessage(String promptMessage) { this.promptMessage = promptMessage; } /** * @return Returns the promptMessageCode. */ public String getPromptMessageCode() { return promptMessageCode; } /** * @param promptMessageCode The promptMessageCode to set. */ public void setPromptMessageCode(String promptMessageCode) { this.promptMessageCode = promptMessageCode; } /** * @return Returns the resourceBundle. */ public String getResourceBundle() { return resourceBundle; } /** * @param resourceBundle The resourceBundle to read the message from. This property is * only needed in conjunction with promptMessageCode or outputMessageCode. */ public void setResourceBundle(String resourceBundle) { this.resourceBundle = resourceBundle; } /** * @return Returns the outputMessage. */ public String getOutputMessage() { if (StringUtils.isNotBlank(resourceBundle) && StringUtils.isNotBlank(outputMessageCode)) { return StdioMessageFactory.getString(resourceBundle, outputMessageCode); } return outputMessage; } /** * @param outputMessage The outputMessage to set. */ public void setOutputMessage(String outputMessage) { this.outputMessage = outputMessage; } /** * @return Returns the outputMessageCode. */ public String getOutputMessageCode() { return outputMessageCode; } /** * @param outputMessageCode The outputMessageCode to set. */ public void setOutputMessageCode(String outputMessageCode) { this.outputMessageCode = outputMessageCode; } public Connector getConnector() { return this; } public MessageReceiver registerListener(Service service, InboundEndpoint endpoint) throws Exception { if (receivers.size() > 0) { throw new UnsupportedOperationException( "You can only register one listener per system stream connector"); } MessageReceiver receiver = super.registerListener(service, endpoint); return receiver; } public long getMessageDelayTime() { if (firstTime) { return messageDelayTime + 4000; } else { return messageDelayTime; } } public void setMessageDelayTime(long messageDelayTime) { this.messageDelayTime = messageDelayTime; } public OutputStream getOutputStream(ImmutableEndpoint endpoint, MuleMessage message) throws MuleException { OutputStream out; String streamName = endpoint.getEndpointURI().getAddress(); if (STREAM_SYSTEM_OUT.equalsIgnoreCase(streamName)) { out = System.out; } else if (STREAM_SYSTEM_ERR.equalsIgnoreCase(streamName)) { out = System.err; } else { out = getOutputStream(); } return out; } /** * {@link PromptStdioConnector} needs a way to access other modules' messages. The default * way to access messages is by using {@link MessageFactory} which itself is not meant to be used * directly. In order not to soften this requiement this private subclass offers access to * {@link MessageFactory}'s methods. */ private static class StdioMessageFactory extends MessageFactory { protected static String getString(String bundlePath, String code) { return MessageFactory.getString(bundlePath, Integer.parseInt(code)); } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/StdioMessageDispatcherFactory.javamule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/StdioMessageDispatcherFactory.jav0000644000175000017500000000226310757615756033662 0ustar charlescharles/* * $Id: StdioMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.stdio; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * StdioMessageDispatcherFactory creates a Stream dispatcher suitable * for writing to fixed streams such as System.in or System.out. */ public class StdioMessageDispatcherFactory extends AbstractMessageDispatcherFactory { /* * (non-Javadoc) * * @see org.mule.api.transport.MessageDispatcherFactory#create(org.mule.api.transport.Connector) */ public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new StdioMessageDispatcher(endpoint); } } mule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/i18n/0000755000175000017500000000000011351410637025764 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/i18n/StdioMessages.java0000644000175000017500000000153610745677442031425 0ustar charlescharles/* * $Id: StdioMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.stdio.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; import org.mule.transport.stdio.StdioConnector; public class StdioMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath(StdioConnector.STDIO); public static Message couldNotFindStreamWithName(String name) { return createMessage(BUNDLE_PATH, 1, name); } } mule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/StdioMessageReceiver.java0000644000175000017500000001434210757615756032152 0ustar charlescharles/* * $Id: StdioMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.stdio; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.transport.AbstractPollingMessageReceiver; import java.io.InputStream; import java.io.PrintStream; import java.io.PushbackInputStream; import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.SystemUtils; /** * StdioMessageReceiver is a listener for events from Mule components * which then simply passes the events on to the target components. */ public class StdioMessageReceiver extends AbstractPollingMessageReceiver { public static final int DEFAULT_BUFFER_SIZE = 4096; private int bufferSize = DEFAULT_BUFFER_SIZE; private InputStream inputStream; private StdioConnector connector; private boolean sendStream; public StdioMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint, long checkFrequency) throws CreateException { super(connector, service, endpoint); this.setFrequency(checkFrequency); this.connector = (StdioConnector) connector; String streamName = endpoint.getEndpointURI().getAddress(); if (StdioConnector.STREAM_SYSTEM_IN.equalsIgnoreCase(streamName)) { inputStream = System.in; } else { inputStream = this.connector.getInputStream(); } // apply connector-specific properties if (connector instanceof PromptStdioConnector) { PromptStdioConnector ssc = (PromptStdioConnector) connector; String promptMessage = (String) endpoint.getProperties().get("promptMessage"); if (promptMessage != null) { ssc.setPromptMessage(promptMessage); } } this.sendStream = BooleanUtils.toBoolean((String) endpoint.getProperties().get("sendStream")); } protected void doDispose() { // template method } public void doConnect() throws Exception { if (connector instanceof PromptStdioConnector) { PromptStdioConnector ssc = (PromptStdioConnector) connector; DelayedMessageWriter writer = new DelayedMessageWriter(ssc); writer.start(); } } public void doDisconnect() throws Exception { // noop } /* * (non-Javadoc) * * @see org.mule.util.timer.TimeEventListener#timeExpired(org.mule.util.timer.TimeEvent) */ public void poll() { try { if (sendStream) { PushbackInputStream in = new PushbackInputStream(inputStream); //Block until we have some data int i = in.read(); //Roll back our read in.unread(i); MuleMessage umoMessage = new DefaultMuleMessage(connector.getMessageAdapter(in)); routeMessage(umoMessage, endpoint.isSynchronous()); } else { byte[] inputBuffer = new byte[bufferSize]; int len = inputStream.read(inputBuffer); if (len == -1) { return; } StringBuffer fullBuffer = new StringBuffer(bufferSize); while (len > 0) { fullBuffer.append(new String(inputBuffer, 0, len)); len = 0; // mark as read if (inputStream.available() > 0) { len = inputStream.read(inputBuffer); } } // remove any trailing CR/LF String finalMessageString; int noCRLFLength = fullBuffer.length() - SystemUtils.LINE_SEPARATOR.length(); if (fullBuffer.indexOf(SystemUtils.LINE_SEPARATOR, noCRLFLength) != -1) { finalMessageString = fullBuffer.substring(0, noCRLFLength); } else { finalMessageString = fullBuffer.toString(); } MuleMessage umoMessage = new DefaultMuleMessage(connector.getMessageAdapter(finalMessageString)); routeMessage(umoMessage, endpoint.isSynchronous()); } doConnect(); } catch (Exception e) { handleException(e); } } public InputStream getInputStream() { return inputStream; } public void setInputStream(InputStream inputStream) { this.inputStream = inputStream; } public int getBufferSize() { return bufferSize; } public void setBufferSize(int bufferSize) { this.bufferSize = bufferSize; } private class DelayedMessageWriter extends Thread { private long delay = 0; private PromptStdioConnector ssc; public DelayedMessageWriter(PromptStdioConnector ssc) { this.delay = ssc.getMessageDelayTime(); this.ssc = ssc; } public void run() { if (delay > 0) { try { // Allow all other console message to be printed out first sleep(delay); } catch (InterruptedException e1) { // ignore } } ((PrintStream) ssc.getOutputStream()).println(); ((PrintStream) ssc.getOutputStream()).print(ssc.getPromptMessage()); } } } mule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/config/0000755000175000017500000000000011351410637026452 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/config/StdioNamespaceHandler.javamule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/config/StdioNamespaceHandler.java0000644000175000017500000000273610745726444033536 0ustar charlescharles/* * $Id: StdioNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.stdio.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.endpoint.URIBuilder; import org.mule.transport.stdio.PromptStdioConnector; import org.mule.transport.stdio.StdioConnector; /** * Reigsters a Bean Definition Parser for handling elements. * */ public class StdioNamespaceHandler extends AbstractMuleNamespaceHandler { public static final String SYSTEM_ATTRIBUTE = "system"; public static final String SYSTEM_MAP = "IN=" + StdioConnector.STREAM_SYSTEM_IN + ",OUT=" + StdioConnector.STREAM_SYSTEM_OUT + ",ERR=" + StdioConnector.STREAM_SYSTEM_ERR; public static final String[] SYSTEM_ATTRIBUTE_ARRAY = new String[]{SYSTEM_ATTRIBUTE}; public void init() { registerStandardTransportEndpoints(StdioConnector.STDIO, SYSTEM_ATTRIBUTE_ARRAY).addMapping(SYSTEM_ATTRIBUTE, SYSTEM_MAP).addAlias(SYSTEM_ATTRIBUTE, URIBuilder.PATH); registerConnectorDefinitionParser(PromptStdioConnector.class); } } mule-2.0.1/transports/stdio/src/main/java/org/mule/transport/stdio/StdioMessageDispatcher.java0000644000175000017500000000641110757615756032472 0ustar charlescharles/* * $Id: StdioMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.stdio; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.DispatchException; import org.mule.transport.AbstractMessageDispatcher; import org.mule.transport.stdio.i18n.StdioMessages; import org.mule.util.StringUtils; import java.io.OutputStream; /** * StdioMessageDispatcher is a simple stream dispatcher that obtains * a stream from the Stream Connector to write to. This is only really useful for * testing purposes right now when writing to System.in and System.out. However, it * is feasible to set any OutputStream on the Stream connector and have that written * to. */ public class StdioMessageDispatcher extends AbstractMessageDispatcher { private final StdioConnector connector; public StdioMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (StdioConnector)endpoint.getConnector(); // apply connector-specific properties if (connector instanceof PromptStdioConnector) { PromptStdioConnector ssc = (PromptStdioConnector)connector; String outputMessage = (String)endpoint.getProperties().get("outputMessage"); if (outputMessage != null) { ssc.setOutputMessage(outputMessage); } } } protected synchronized void doDispatch(MuleEvent event) throws Exception { OutputStream out = connector.getOutputStream(); if (out == null) { throw new DispatchException( StdioMessages.couldNotFindStreamWithName(event.getEndpoint().getEndpointURI().getAddress()), event.getMessage(), event.getEndpoint()); } // TODO - remove this ugliness if (connector instanceof PromptStdioConnector) { PromptStdioConnector ssc = (PromptStdioConnector)connector; if (StringUtils.isNotBlank(ssc.getOutputMessage())) { out.write(ssc.getOutputMessage().getBytes()); } } Object data = event.transformMessage(); if (data instanceof byte[]) { out.write((byte[])data); } else { out.write(data.toString().getBytes()); } out.flush(); } /* * (non-Javadoc) * * @see org.mule.api.transport.Connector#send(org.mule.api.MuleEvent) */ protected MuleMessage doSend(MuleEvent event) throws Exception { doDispatch(event); return event.getMessage(); } protected void doDispose() { // template method } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } } mule-2.0.1/transports/stdio/src/main/resources/0000755000175000017500000000000011351410637021367 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/resources/META-INF/0000755000175000017500000000000011351410637022527 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012710754365306025406 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/stdio/2.0/mule-stdio.xsd=META-INF/mule-stdio.xsdmule-2.0.1/transports/stdio/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014710754365306025565 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/stdio/2.0=org.mule.transport.stdio.config.StdioNamespaceHandler mule-2.0.1/transports/stdio/src/main/resources/META-INF/services/0000755000175000017500000000000011351410637024352 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410637025141 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410637026103 5ustar charlescharlesmule-2.0.1/transports/stdio/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410637030120 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/stdio/src/main/resources/META-INF/services/org/mule/providers/stdio.propertiesmule-2.0.1/transports/stdio/src/main/resources/META-INF/services/org/mule/providers/stdio.properties0000644000175000017500000000060310754365306033367 0ustar charlescharlesconnector=org.mule.transport.stdio.PromptStdioConnector dispatcher.factory=org.mule.transport.stdio.StdioMessageDispatcherFactory requester.factory=org.mule.transport.UnsupportedMessageRequesterFactory message.receiver=org.mule.transport.stdio.StdioMessageReceiver message.adapter=org.mule.transport.DefaultMessageAdapter endpoint.builder=org.mule.endpoint.ResourceNameEndpointURIBuildermule-2.0.1/transports/stdio/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410637026662 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/stdio/src/main/resources/META-INF/services/org/mule/i18n/stdio-messages.propertiesmule-2.0.1/transports/stdio/src/main/resources/META-INF/services/org/mule/i18n/stdio-messages.proper0000644000175000017500000000006110625325157033044 0ustar charlescharles1=could not create or find stream with name "{0}"mule-2.0.1/transports/stdio/src/main/resources/META-INF/mule-stdio.xsd0000644000175000017500000001122110763777177025353 0ustar charlescharles Delay (ms) before printing prompt to stdout. Text printed to stdout when a message is sent. Text printed to stdout when waiting for input. Code used to retrieve prompt message from resource bundle. Code used to retrieve output message from resource bundle. Resource bundle to provide prompt, with promptMessageCode. mule-2.0.1/transports/stdio/src/test/0000755000175000017500000000000011351410637017410 5ustar charlescharlesmule-2.0.1/transports/stdio/src/test/java/0000755000175000017500000000000011351410637020331 5ustar charlescharlesmule-2.0.1/transports/stdio/src/test/java/org/0000755000175000017500000000000011351410637021120 5ustar charlescharlesmule-2.0.1/transports/stdio/src/test/java/org/mule/0000755000175000017500000000000011351410637022062 5ustar charlescharlesmule-2.0.1/transports/stdio/src/test/java/org/mule/providers/0000755000175000017500000000000011351410637024077 5ustar charlescharlesmule-2.0.1/transports/stdio/src/test/java/org/mule/providers/stdio/0000755000175000017500000000000011351410637025221 5ustar charlescharlesmule-2.0.1/transports/stdio/src/test/java/org/mule/transport/0000755000175000017500000000000011351410637024116 5ustar charlescharlesmule-2.0.1/transports/stdio/src/test/java/org/mule/transport/stdio/0000755000175000017500000000000011351410637025240 5ustar charlescharlesmule-2.0.1/transports/stdio/src/test/java/org/mule/transport/stdio/package.html0000644000175000017500000000025710745677442027544 0ustar charlescharles Mule Provides access to stream transports. Useful for testing; sending and receiving from System.out and System.in. ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/stdio/src/test/java/org/mule/transport/stdio/StdioNamespaceHandlerTestCase.javamule-2.0.1/transports/stdio/src/test/java/org/mule/transport/stdio/StdioNamespaceHandlerTestCase.jav0000644000175000017500000000433010761043432033572 0ustar charlescharles/* * $Id: StdioNamespaceHandlerTestCase.java 11035 2008-02-26 17:06:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.stdio; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.FunctionalTestCase; public class StdioNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "stdio-namespace-config.xml"; } public void testConfig() throws Exception { PromptStdioConnector c = (PromptStdioConnector) muleContext.getRegistry().lookupConnector("stdioConnector"); assertNotNull(c); assertEquals(1234, c.getMessageDelayTime()); assertEquals("abc", c.getOutputMessage()); assertEquals("edc", c.getPromptMessage()); assertEquals("456", c.getPromptMessageCode()); assertEquals("dummy-messages", c.getResourceBundle()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testNoBundle() throws Exception { PromptStdioConnector c = (PromptStdioConnector)muleContext.getRegistry().lookupConnector("noBundleConnector"); assertNotNull(c); assertEquals(1234, c.getMessageDelayTime()); assertEquals("abc", c.getOutputMessage()); assertEquals("bcd", c.getPromptMessage()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testSystemAttributeMap() { testEndpointAttribute("in", "system.in"); testEndpointAttribute("out", "system.out"); testEndpointAttribute("err", "system.err"); } protected void testEndpointAttribute(String name, String address) { ImmutableEndpoint endpoint = (ImmutableEndpoint) muleContext.getRegistry().lookupObject(name); assertNotNull("Null " + name, endpoint); assertEquals(address, endpoint.getEndpointURI().getAddress()); } }././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/stdio/src/test/java/org/mule/transport/stdio/StdioMessageReceiverTestCase.javamule-2.0.1/transports/stdio/src/test/java/org/mule/transport/stdio/StdioMessageReceiverTestCase.java0000644000175000017500000000364510757615756033645 0ustar charlescharles/* * $Id: StdioMessageReceiverTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.stdio; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transport.AbstractMessageReceiverTestCase; public class StdioMessageReceiverTestCase extends AbstractMessageReceiverTestCase { public void testReceiver() throws Exception { // FIX A bit hard testing receive from a unit test as we need to reg // listener etc // file endpoint functions tests for this } public void testOtherProperties() throws Exception { StdioMessageReceiver receiver = (StdioMessageReceiver) getMessageReceiver(); Service service = getTestService("orange", Orange.class); assertNotNull(service); endpoint.getConnector().start(); receiver.setFrequency(1001); receiver.setInputStream(System.in); assertTrue(receiver.getFrequency() == 1001); receiver.setFrequency(0); assertTrue(receiver.getFrequency() == StdioMessageReceiver.DEFAULT_POLL_FREQUENCY); } public MessageReceiver getMessageReceiver() throws CreateException { return new StdioMessageReceiver(endpoint.getConnector(), service, endpoint, 1000); } public InboundEndpoint getEndpoint() throws Exception { return muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("stdio://System"); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/stdio/src/test/java/org/mule/transport/stdio/PromptStdioConnectorTestCase.javamule-2.0.1/transports/stdio/src/test/java/org/mule/transport/stdio/PromptStdioConnectorTestCase.java0000644000175000017500000000204710754365306033711 0ustar charlescharles/* * $Id: PromptStdioConnectorTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.stdio; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.stdio.PromptStdioConnector; public class PromptStdioConnectorTestCase extends AbstractConnectorTestCase { public String getTestEndpointURI() { return "stdio://System.out"; } public Connector createConnector() throws Exception { Connector cnn = new PromptStdioConnector(); cnn.setName("TestStdio"); return cnn; } public Object getValidMessage() throws Exception { return "Test Message"; } } mule-2.0.1/transports/stdio/src/test/resources/0000755000175000017500000000000011351410637021422 5ustar charlescharlesmule-2.0.1/transports/stdio/src/test/resources/log4j.properties0000644000175000017500000000050210547540350024556 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/transports/stdio/src/test/resources/dummy-messages.properties0000644000175000017500000000006410625325157026505 0ustar charlescharles# see PromptStdioNamespaceHandlerTestCase 456 = edc mule-2.0.1/transports/stdio/src/test/resources/stdio-namespace-config.xml0000644000175000017500000000311110745174725026472 0ustar charlescharles mule-2.0.1/transports/stdio/pom.xml0000644000175000017500000000351111006063605017153 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-stdio System I/O Transport A Mule transport used as the interface to Java's System.out and System.in objects, typically for testing purposes. org.mule mule-core ${version} org.mule.tests mule-tests-functional ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.transport.stdio.* mule-2.0.1/transports/ejb/0000755000175000017500000000000011351410657015262 5ustar charlescharlesmule-2.0.1/transports/ejb/src/0000755000175000017500000000000011351410657016051 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/0000755000175000017500000000000011351410657016775 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/java/0000755000175000017500000000000011351410657017716 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/java/org/0000755000175000017500000000000011351410657020505 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/java/org/mule/0000755000175000017500000000000011351410657021447 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/java/org/mule/transport/0000755000175000017500000000000011351410657023503 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/java/org/mule/transport/ejb/0000755000175000017500000000000011351410657024243 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/java/org/mule/transport/ejb/EjbConnector.java0000644000175000017500000000313010745677442027473 0ustar charlescharles/* * $Id: EjbConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.transport.rmi.RmiConnector; import org.mule.util.ClassUtils; import java.lang.reflect.Method; import java.net.UnknownHostException; import java.rmi.Remote; import java.rmi.RemoteException; import javax.ejb.EJBObject; /** * Provides Connection configurstion for EJB endpoints */ public class EjbConnector extends RmiConnector { public static final String EJB = "ejb"; // Errorcodes public static final int EJB_SERVICECLASS_INVOCATION_FAILED = 2; public String getProtocol() { return EJB; } public Remote getRemoteObject(ImmutableEndpoint endpoint) throws RemoteException, UnknownHostException { EJBObject remoteObj; try { Object ref = getRemoteRef(endpoint); Method method = ClassUtils.getMethod(ref.getClass(), "create", null); remoteObj = (EJBObject)method.invoke(ref, ClassUtils.NO_ARGS); } catch (Exception e) { throw new RemoteException("Remote EJBObject lookup failed for '" + endpoint.getEndpointURI(), e); } return remoteObj; } } mule-2.0.1/transports/ejb/src/main/java/org/mule/transport/ejb/EjbMessageDispatcherFactory.java0000644000175000017500000000177610757615756032505 0ustar charlescharles/* * $Id: EjbMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * EjbMessageDispatcherFactory creates a dispatcher for marshalling * requests to an EJB MuleSession bean */ public class EjbMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new EjbMessageDispatcher(endpoint); } } mule-2.0.1/transports/ejb/src/main/java/org/mule/transport/ejb/i18n/0000755000175000017500000000000011351410657025022 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/java/org/mule/transport/ejb/i18n/EjbMessages.java0000644000175000017500000000160110745677442030070 0ustar charlescharles/* * $Id: EjbMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class EjbMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("ejb"); public static Message ejbObjectMissingCreate(Object key) { return createMessage(BUNDLE_PATH, 3); } public static Message ejbKeyRefNotValid(Object key) { return createMessage(BUNDLE_PATH, 4); } } mule-2.0.1/transports/ejb/src/main/java/org/mule/transport/ejb/EjbMessageReceiver.java0000644000175000017500000000252110757615756030620 0ustar charlescharles/* * $Id: EjbMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.transport.rmi.RmiMessageReceiver; /** * Will repeatedly call a method on an EJB object. If the method takes parameters A * List of objects can be specified on the endpoint called * methodArgumentsList, If this property is ommitted it is assumed * that the method takes no parameters */ public class EjbMessageReceiver extends RmiMessageReceiver { public EjbMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint, long frequency) throws CreateException { super(connector, service, endpoint, frequency); this.connector = (EjbConnector) connector; } } mule-2.0.1/transports/ejb/src/main/java/org/mule/transport/ejb/config/0000755000175000017500000000000011351410657025510 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/java/org/mule/transport/ejb/config/EjbNamespaceHandler.java0000644000175000017500000000405710745726444032206 0ustar charlescharles/* * $Id: EjbNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb.config; import org.mule.config.spring.factories.InboundEndpointFactoryBean; import org.mule.config.spring.factories.OutboundEndpointFactoryBean; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.specific.endpoint.TransportEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.TransportGlobalEndpointDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.ejb.EjbConnector; import org.mule.transport.rmi.config.RmiNamespaceHandler; public class EjbNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerMuleBeanDefinitionParser("endpoint", new TransportGlobalEndpointDefinitionParser(EjbConnector.EJB, TransportGlobalEndpointDefinitionParser.PROTOCOL, RmiNamespaceHandler.ADDRESS, RmiNamespaceHandler.PROPERTIES)).addAlias(RmiNamespaceHandler.OBJECT, URIBuilder.PATH); registerMuleBeanDefinitionParser("inbound-endpoint", new TransportEndpointDefinitionParser(EjbConnector.EJB, TransportGlobalEndpointDefinitionParser.PROTOCOL, InboundEndpointFactoryBean.class, RmiNamespaceHandler.ADDRESS, RmiNamespaceHandler.PROPERTIES)).addAlias(RmiNamespaceHandler.OBJECT, URIBuilder.PATH); registerMuleBeanDefinitionParser("outbound-endpoint", new TransportEndpointDefinitionParser(EjbConnector.EJB, TransportGlobalEndpointDefinitionParser.PROTOCOL, OutboundEndpointFactoryBean.class, RmiNamespaceHandler.ADDRESS, RmiNamespaceHandler.PROPERTIES)).addAlias(RmiNamespaceHandler.OBJECT, URIBuilder.PATH); registerConnectorDefinitionParser(EjbConnector.class); } }mule-2.0.1/transports/ejb/src/main/java/org/mule/transport/ejb/EjbMessageAdapter.java0000644000175000017500000000165310745677442030436 0ustar charlescharles/* * $Id: EjbMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb; import org.mule.api.transport.MessageTypeNotSupportedException; import org.mule.transport.rmi.RmiMessageAdapter; /* * Wraps an object obtained by calling a method on an EJB object */ public class EjbMessageAdapter extends RmiMessageAdapter { /** * Serial version */ private static final long serialVersionUID = 3932390270676915501L; public EjbMessageAdapter(Object message) throws MessageTypeNotSupportedException { super(message); } } mule-2.0.1/transports/ejb/src/main/java/org/mule/transport/ejb/EjbMessageDispatcher.java0000644000175000017500000000151610757615756031145 0ustar charlescharles/* * $Id: EjbMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.transport.rmi.RmiMessageDispatcher; /** * Invokes a method on an EJB object stored in Jndi. A dispatcher is created for each * type of object invoked */ public class EjbMessageDispatcher extends RmiMessageDispatcher { public EjbMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); } } mule-2.0.1/transports/ejb/src/main/resources/0000755000175000017500000000000011351410657021007 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/resources/META-INF/0000755000175000017500000000000011351410657022147 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012210630351713025005 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/ejb/2.0/mule-ejb.xsd=META-INF/mule-ejb.xsd mule-2.0.1/transports/ejb/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014110754365306025175 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/ejb/2.0=org.mule.transport.ejb.config.EjbNamespaceHandler mule-2.0.1/transports/ejb/src/main/resources/META-INF/services/0000755000175000017500000000000011351410657023772 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410657024561 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410657025523 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410657027540 5ustar charlescharlesmule-2.0.1/transports/ejb/src/main/resources/META-INF/services/org/mule/providers/ejb.properties0000644000175000017500000000055310745677442032436 0ustar charlescharlesconnector=org.mule.transport.ejb.EjbConnector dispatcher.factory=org.mule.transport.ejb.EjbMessageDispatcherFactory requester.factory=org.mule.transport.UnsupportedMessageRequesterFactory message.receiver=org.mule.transport.ejb.EjbMessageReceiver message.adapter=org.mule.transport.ejb.EjbMessageAdapter endpoint.builder=org.mule.endpoint.SocketEndpointURIBuildermule-2.0.1/transports/ejb/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410657026302 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/ejb/src/main/resources/META-INF/services/org/mule/i18n/ejb-messages.propertiesmule-2.0.1/transports/ejb/src/main/resources/META-INF/services/org/mule/i18n/ejb-messages.properties0000644000175000017500000000047310621717250032767 0ustar charlescharles1=Cannot invoke EJB call without an Operation. Set the 'method' param on your endpointUri or on the endpoint itself 2=EjbAble creation failed. Does it have parameterless constructor and does it implement EjbAble? 3=EJB Home object "{0}" does not have a create method 4=Object for key "{0}" is not an EJBHome object mule-2.0.1/transports/ejb/src/main/resources/META-INF/mule-ejb.xsd0000644000175000017500000000663210737272027024402 0ustar charlescharles Connector for EJB beans. Period (ms) between polling connections. Bean reference to the security manager that should be used. The security policy (file name) used to enable connections. The target class name. The target method. mule-2.0.1/transports/ejb/src/main/resources/ejb-howto.txt0000644000175000017500000000202310745677442023460 0ustar charlescharles mule-2.0.1/transports/ejb/src/test/0000755000175000017500000000000011351410656017027 5ustar charlescharlesmule-2.0.1/transports/ejb/src/test/java/0000755000175000017500000000000011351410656017750 5ustar charlescharlesmule-2.0.1/transports/ejb/src/test/java/org/0000755000175000017500000000000011351410656020537 5ustar charlescharlesmule-2.0.1/transports/ejb/src/test/java/org/mule/0000755000175000017500000000000011351410656021501 5ustar charlescharlesmule-2.0.1/transports/ejb/src/test/java/org/mule/container/0000755000175000017500000000000011351410656023463 5ustar charlescharlesmule-2.0.1/transports/ejb/src/test/java/org/mule/container/DummyEjb.java0000644000175000017500000000141410764230245026043 0ustar charlescharles/* * $Id: DummyEjb.java 11245 2008-03-07 12:10:13Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.container; import java.rmi.RemoteException; import javax.ejb.EJBObject; /** * A test EJB object */ public interface DummyEjb extends EJBObject { public void dummy() throws RemoteException; public String reverseString(String string) throws RemoteException; public String upperCaseString(String string) throws RemoteException; } mule-2.0.1/transports/ejb/src/test/java/org/mule/container/DummyEjbBean.java0000644000175000017500000000421310764230245026631 0ustar charlescharles/* * $Id: DummyEjbBean.java 11245 2008-03-07 12:10:13Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.container; import org.mule.util.StringUtils; import java.rmi.RemoteException; import javax.ejb.EJBException; import javax.ejb.EJBHome; import javax.ejb.EJBObject; import javax.ejb.Handle; import javax.ejb.RemoveException; import javax.ejb.SessionBean; import javax.ejb.SessionContext; /** * A fake (and invalid) EJB used for testing MUle ejb lookup */ public class DummyEjbBean implements SessionBean, DummyEjb { /** * Serial version */ private static final long serialVersionUID = -1521532107372250896L; public void ejbActivate() throws EJBException { // nothing to do } public void ejbPassivate() throws EJBException { // nothing to do } public void ejbRemove() throws EJBException { // nothing to do } public void ejbCreate() throws EJBException { // nothing to do } public void setSessionContext(SessionContext sessionContext) throws EJBException { // nothing to do } public void dummy() { // nothing to do } public String reverseString(String string) { return StringUtils.reverse(string); } public String upperCaseString(String string) { return string.toUpperCase(); } public EJBHome getEJBHome() throws RemoteException { return null; } public Handle getHandle() throws RemoteException { return null; } public Object getPrimaryKey() throws RemoteException { return null; } public boolean isIdentical(EJBObject ejbObject) throws RemoteException { return false; } public void remove() throws RemoteException, RemoveException { // nothing to do } } mule-2.0.1/transports/ejb/src/test/java/org/mule/container/DummyEjbHome.java0000644000175000017500000000131610764230245026655 0ustar charlescharles/* * $Id: DummyEjbHome.java 11245 2008-03-07 12:10:13Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.container; import java.rmi.RemoteException; import javax.ejb.CreateException; import javax.ejb.EJBHome; /** * DummyHome Test EJB */ public interface DummyEjbHome extends EJBHome { public abstract DummyEjb create() throws RemoteException, CreateException; } mule-2.0.1/transports/ejb/src/test/java/org/mule/container/DummyEjbHomeProxy.java0000644000175000017500000000237010764230245027720 0ustar charlescharles/* * $Id: DummyEjbHomeProxy.java 11245 2008-03-07 12:10:13Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.container; import java.rmi.RemoteException; import javax.ejb.CreateException; import javax.ejb.EJBMetaData; import javax.ejb.Handle; import javax.ejb.HomeHandle; import javax.ejb.RemoveException; /** * Test EJB Home impl */ public class DummyEjbHomeProxy implements DummyEjbHome { public DummyEjb create() throws RemoteException, CreateException { return new DummyEjbBean(); } public EJBMetaData getEJBMetaData() throws RemoteException { return null; } public HomeHandle getHomeHandle() throws RemoteException { return null; } public void remove(Handle handle) throws RemoteException, RemoveException { // nothing to do } public void remove(Object object) throws RemoteException, RemoveException { // nothing to do } } mule-2.0.1/transports/ejb/src/test/java/org/mule/transport/0000755000175000017500000000000011351410656023535 5ustar charlescharlesmule-2.0.1/transports/ejb/src/test/java/org/mule/transport/ejb/0000755000175000017500000000000011351410656024275 5ustar charlescharlesmule-2.0.1/transports/ejb/src/test/java/org/mule/transport/ejb/EjbNamespaceHandlerTestCase.java0000644000175000017500000000464210745677442032433 0ustar charlescharles/* * $Id: EjbNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb; import org.mule.tck.FunctionalTestCase; import org.mule.tck.jndi.InMemoryContext; import org.mule.transport.ejb.EjbConnector; import org.mule.transport.rmi.DummySecurityManager; import org.mule.transport.rmi.RmiConnector; public class EjbNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "ejb-namespace-config.xml"; } public void testConfig() throws Exception { EjbConnector c = (EjbConnector) muleContext.getRegistry().lookupConnector("ejbConnector"); assertNotNull(c); assertEquals(1234, c.getPollingFrequency()); assertEquals(DummySecurityManager.class, c.getSecurityManager().getClass()); String url = c.getSecurityPolicy(); assertNotNull(url); int index = url.lastIndexOf("/"); assertTrue(index > 0); assertEquals("rmi.policy", url.substring(index+1)); assertEquals("bcd", c.getServerClassName()); assertEquals("cde", c.getServerCodebase()); assertEquals("org.mule.tck.jndi.InMemoryContextFactory", c.getJndiInitialFactory()); assertEquals("efg", c.getJndiProviderUrl()); assertEquals("fgh", c.getJndiUrlPkgPrefixes()); assertEquals("hij", c.getJndiProviderProperties().get("ghi")); } public void testConfig2() throws Exception { RmiConnector c = (RmiConnector) muleContext.getRegistry().lookupConnector("ejbConnector2"); assertNotNull(c); assertEquals(1234, c.getPollingFrequency()); assertEquals(DummySecurityManager.class, c.getSecurityManager().getClass()); String url = c.getSecurityPolicy(); assertNotNull(url); int index = url.lastIndexOf("/"); assertTrue(index > 0); assertEquals("rmi.policy", url.substring(index+1)); assertEquals("bcd", c.getServerClassName()); assertEquals("cde", c.getServerCodebase()); assertTrue(c.getJndiContext() instanceof InMemoryContext); } }mule-2.0.1/transports/ejb/src/test/java/org/mule/transport/ejb/EjbFunctionalTestCase.java0000644000175000017500000001026210757615756031341 0ustar charlescharles/* * $Id: EjbFunctionalTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.DispatchException; import org.mule.config.i18n.Message; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.rmi.RmiConnector; import org.mule.transport.rmi.i18n.RmiMessages; import java.util.HashMap; import java.util.Properties; /** * test RMI object invocations */ public class EjbFunctionalTestCase extends FunctionalTestCase { protected String getConfigResources() { return "ejb-functional-test.xml"; } private MuleMessage send(String uri, String message) throws Exception { MuleClient client = new MuleClient(); return client.send(uri, message, new HashMap()); } public void testReverseString() throws Exception { MuleMessage message = send("ejb://localhost/TestService?method=reverseString", "hello"); assertNotNull(message.getPayload()); assertEquals("olleh", message.getPayloadAsString()); } public void testUpperCaseString() throws Exception { MuleMessage message = send("ejb://localhost/TestService?method=upperCaseString", "hello"); assertNotNull(message.getPayload()); assertEquals("HELLO", message.getPayloadAsString()); } public void testNoMethodSet() throws Exception { try { send("ejb://localhost/TestService", "hello"); } catch (MuleException e) { assertTrue(e instanceof DispatchException); Message message = RmiMessages.messageParamServiceMethodNotSet(); assertTrue(e.getMessage().startsWith(message.toString())); } } public void testBadMethodName() throws Exception { try { send("ejb://localhost/TestService?method=foo", "hello"); } catch (MuleException e) { assertTrue(e.getCause() instanceof NoSuchMethodException); } } public void testBadMethodType() throws Exception { // moving this to xml config requires endpoint properties // MULE-1790 EndpointBuilder builder = new EndpointURIEndpointBuilder("ejb://localhost/TestService?method=reverseString", muleContext); Properties props = new Properties(); props.put(RmiConnector.PROPERTY_SERVICE_METHOD_PARAM_TYPES, StringBuffer.class.getName()); builder.setProperties(props); OutboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( builder); try { ep.send(getTestEvent("hello", ep)); } catch (MuleException e) { assertTrue(e.getCause() instanceof NoSuchMethodException); } } public void testCorrectMethodType() throws Exception { // moving this to xml config requires endpoint properties // MULE-1790 EndpointBuilder builder = new EndpointURIEndpointBuilder("ejb://localhost/TestService?method=reverseString", muleContext); Properties props = new Properties(); props.put(RmiConnector.PROPERTY_SERVICE_METHOD_PARAM_TYPES, StringBuffer.class.getName()); builder.setProperties(props); OutboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( builder); try { ep.send(getTestEvent("hello", ep)); } catch (MuleException e) { assertTrue(e.getCause() instanceof NoSuchMethodException); } } } mule-2.0.1/transports/ejb/src/test/java/org/mule/transport/ejb/EjbConnectorTestCase.java0000644000175000017500000000275410754365306031166 0ustar charlescharles/* * $Id: EjbConnectorTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.ejb.EjbConnector; public class EjbConnectorTestCase extends AbstractConnectorTestCase { public Connector createConnector() throws Exception { EjbConnector c = new EjbConnector(); c.setName("EjbConnector"); c.setSecurityManager(null); return c; } public String getTestEndpointURI() { return "ejb://localhost:1099"; } public Object getValidMessage() throws Exception { return "Hello".getBytes(); } public void testProperties() throws Exception { EjbConnector c = (EjbConnector) getConnector(); String securityPolicy = "rmi.policy"; String serverCodebase = "file:///E:/projects/MyTesting/JAVA/rmi/classes/"; c.setSecurityPolicy(securityPolicy); assertNotNull(c.getSecurityPolicy()); c.setServerCodebase(serverCodebase); assertEquals(serverCodebase, c.getServerCodebase()); } } mule-2.0.1/transports/ejb/src/test/java/org/mule/transport/ejb/EjbMessageAdapterTestCase.java0000644000175000017500000000204310754365306032110 0ustar charlescharles/* * $Id: EjbMessageAdapterTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb; import org.mule.api.MessagingException; import org.mule.api.transport.MessageAdapter; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.transport.ejb.EjbMessageAdapter; public class EjbMessageAdapterTestCase extends AbstractMessageAdapterTestCase { public Object getValidMessage() throws Exception { return "Hello".getBytes(); } public MessageAdapter createAdapter(Object payload) throws MessagingException { return new EjbMessageAdapter(payload); } public Object getInvalidMessage() { return null; } } mule-2.0.1/transports/ejb/src/test/java/org/mule/transport/ejb/EjbEndpointTestCase.java0000644000175000017500000000577210745677442031026 0ustar charlescharles/* * $Id: EjbEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class EjbEndpointTestCase extends AbstractMuleTestCase { public void testHostPortUrl() throws Exception { EndpointURI url = new MuleEndpointURI("ejb://localhost:1099"); url.initialise(); assertEquals("ejb", url.getScheme()); assertEquals("ejb://localhost:1099", url.getAddress()); assertNull(url.getEndpointName()); assertEquals(1099, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("ejb://localhost:1099", url.getAddress()); assertEquals(0, url.getParams().size()); } public void testQueryParams1() throws Exception { EndpointURI url = new MuleEndpointURI("ejb://localhost:1099/BeeShirtsejbServer?method=testMethod"); url.initialise(); assertEquals("ejb", url.getScheme()); assertEquals("ejb://localhost:1099", url.getAddress()); assertEquals("/BeeShirtsejbServer", url.getPath()); assertNull(url.getEndpointName()); assertEquals(1099, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("ejb://localhost:1099/BeeShirtsejbServer?method=testMethod", url.toString()); assertEquals(1, url.getParams().size()); assertEquals("testMethod", url.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); } public void testQueryParams2() throws Exception { EndpointURI url = new MuleEndpointURI( "ejb://localhost:1099/BeeShirtsejbServer?method=testMethod&endpointName=ejbProvider&blankParam="); url.initialise(); assertEquals("ejb", url.getScheme()); assertEquals("ejb://localhost:1099", url.getAddress()); assertEquals("/BeeShirtsejbServer", url.getPath()); assertNotNull(url.getEndpointName()); assertEquals("ejbProvider", url.getEndpointName()); assertEquals(1099, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals( "ejb://localhost:1099/BeeShirtsejbServer?method=testMethod&endpointName=ejbProvider&blankParam=", url.toString()); assertEquals("method=testMethod&endpointName=ejbProvider&blankParam=", url.getQuery()); assertEquals(3, url.getParams().size()); assertEquals("testMethod", url.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); assertEquals("", url.getParams().getProperty("blankParam")); } } mule-2.0.1/transports/ejb/src/test/java/org/mule/transport/ejb/SimpleEjbContextFactory.java0000644000175000017500000000306410745677442031730 0ustar charlescharles/* * $Id: SimpleEjbContextFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ejb; import org.mule.api.config.PropertyFactory; import org.mule.jndi.MuleInitialContextFactory; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import javax.naming.Context; import javax.naming.InitialContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class SimpleEjbContextFactory implements PropertyFactory { protected final Log logger = LogFactory.getLog(getClass()); public Object create(Map properties) throws Exception { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, MuleInitialContextFactory.class.getName()); InitialContext context = new InitialContext(env); Iterator keys = properties.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); if (key instanceof String) { Object value = properties.get(key); logger.debug("Binding " + key + " to " + value); context.bind((String) key, value); } } return context; } } mule-2.0.1/transports/ejb/src/test/resources/0000755000175000017500000000000011351410657021042 5ustar charlescharlesmule-2.0.1/transports/ejb/src/test/resources/log4j.properties0000644000175000017500000000050210547540350024174 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/transports/ejb/src/test/resources/ejb-functional-test.xml0000644000175000017500000000306010745677442025455 0ustar charlescharles mule-2.0.1/transports/ejb/src/test/resources/rmi.policy0000644000175000017500000000020710304042302023032 0ustar charlescharles/* AUTOMATICALLY GENERATED ON Tue May 03 13:51:07 CEST 2005*/ /* DO NOT EDIT */ grant { permission java.security.AllPermission; }; mule-2.0.1/transports/ejb/src/test/resources/ejb-namespace-config.xml0000644000175000017500000000324010745677442025535 0ustar charlescharles mule-2.0.1/transports/ejb/pom.xml0000644000175000017500000000545211006063605016577 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-ejb EJB Transport A Mule transport for Ejb Connectivity that allows you to invoke an ejb object using an endpoint. osgi org.apache.felix maven-bundle-plugin org.mule.transport.ejb.* org.mule mule-core ${version} org.mule.transports mule-transport-rmi ${version} org.mule.transports mule-transport-rmi ${version} org.apache.geronimo.specs geronimo-ejb_2.1_spec org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test org.mule.transports mule-transport-rmi ${version} test-jar test mule-2.0.1/transports/ssl/0000755000175000017500000000000011351410660015315 5ustar charlescharlesmule-2.0.1/transports/ssl/src/0000755000175000017500000000000011351410657016112 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/0000755000175000017500000000000011351410660017030 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/java/0000755000175000017500000000000011351410657017757 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/java/org/0000755000175000017500000000000011351410657020546 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/java/org/mule/0000755000175000017500000000000011351410657021510 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/java/org/mule/transport/0000755000175000017500000000000011351410657023544 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/java/org/mule/transport/ssl/0000755000175000017500000000000011351410660024337 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/java/org/mule/transport/ssl/package.html0000644000175000017500000000016310745677442026643 0ustar charlescharles Mule Provides tcp connectivity over Ssl for Mule. mule-2.0.1/transports/ssl/src/main/java/org/mule/transport/ssl/SslMessageReceiver.java0000644000175000017500000000751310757615756030771 0ustar charlescharles/* * $Id: SslMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.DefaultMuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.tcp.TcpMessageReceiver; import java.io.IOException; import java.net.Socket; import java.security.cert.Certificate; import javax.net.ssl.HandshakeCompletedEvent; import javax.net.ssl.HandshakeCompletedListener; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSocket; import javax.resource.spi.work.Work; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class SslMessageReceiver extends TcpMessageReceiver implements HandshakeCompletedListener { // we must wait for handshake to complete before sending message, as the callback // sets important properties. the wait period is arbitrary, but the two threads // are approximately synchronized (handshake completes before/at same time as // message is received) so value should not be critical private CountDownLatch handshakeComplete = new CountDownLatch(1); private static final long HANDSHAKE_WAIT = 30000L; private Certificate[] peerCertificateChain; private Certificate[] localCertificateChain; public SslMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); } protected Work createWork(Socket socket) throws IOException { return new SslWorker(socket, this); } private void preRoute(DefaultMuleMessage message) throws Exception { handshakeComplete.await(HANDSHAKE_WAIT, TimeUnit.MILLISECONDS); if (0 != handshakeComplete.getCount()) { throw new IllegalStateException("Handshake did not complete"); } if (peerCertificateChain != null) { message.setProperty(SslConnector.PEER_CERTIFICATES, peerCertificateChain); } if (localCertificateChain != null) { message.setProperty(SslConnector.LOCAL_CERTIFICATES, localCertificateChain); } } public void handshakeCompleted(HandshakeCompletedEvent event) { try { localCertificateChain = event.getLocalCertificates(); try { peerCertificateChain = event.getPeerCertificates(); } catch (SSLPeerUnverifiedException e) { logger.debug("Cannot get peer certificate chain: "+ e.getMessage()); } } finally { handshakeComplete.countDown(); } } protected class SslWorker extends TcpWorker { public SslWorker(Socket socket, AbstractMessageReceiver receiver) throws IOException { super(socket, receiver); ((SSLSocket) socket).addHandshakeCompletedListener(SslMessageReceiver.this); } protected void preRouteMuleMessage(DefaultMuleMessage message) throws Exception { super.preRouteMuleMessage(message); preRoute(message); } protected void shutdownSocket() throws IOException { // SSL Sockets don't support shutdownSocket } } } mule-2.0.1/transports/ssl/src/main/java/org/mule/transport/ssl/config/0000755000175000017500000000000011351410657025612 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/java/org/mule/transport/ssl/config/package.html0000644000175000017500000000022210745677442030104 0ustar charlescharles Mule Configuration classes for processing Xml config elements within the SSL namespace. mule-2.0.1/transports/ssl/src/main/java/org/mule/transport/ssl/config/SslNamespaceHandler.java0000644000175000017500000000317510770356575032353 0ustar charlescharles/* * $Id: SslNamespaceHandler.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.specific.tls.ClientKeyStoreDefinitionParser; import org.mule.config.spring.parsers.specific.tls.KeyStoreDefinitionParser; import org.mule.config.spring.parsers.specific.tls.ProtocolHandlerDefinitionParser; import org.mule.config.spring.parsers.specific.tls.TrustStoreDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.ssl.SslConnector; /** * Reigsters a Bean Definition Parser for handling elements. */ public class SslNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(SslConnector.SSL, URIBuilder.SOCKET_ATTRIBUTES); registerConnectorDefinitionParser(SslConnector.class); registerBeanDefinitionParser("key-store", new KeyStoreDefinitionParser()); registerBeanDefinitionParser("client", new ClientKeyStoreDefinitionParser()); registerBeanDefinitionParser("server", new TrustStoreDefinitionParser()); registerBeanDefinitionParser("protocol-handler", new ProtocolHandlerDefinitionParser()); } } mule-2.0.1/transports/ssl/src/main/java/org/mule/transport/ssl/config/TlsNamespaceHandler.java0000644000175000017500000000317410770356575032353 0ustar charlescharles/* * $Id: TlsNamespaceHandler.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.specific.tls.ClientKeyStoreDefinitionParser; import org.mule.config.spring.parsers.specific.tls.KeyStoreDefinitionParser; import org.mule.config.spring.parsers.specific.tls.ProtocolHandlerDefinitionParser; import org.mule.config.spring.parsers.specific.tls.TrustStoreDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.ssl.TlsConnector; /** * Reigsters a Bean Definition Parser for handling elements. */ public class TlsNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(TlsConnector.TLS, URIBuilder.SOCKET_ATTRIBUTES); registerConnectorDefinitionParser(TlsConnector.class); registerBeanDefinitionParser("key-store", new KeyStoreDefinitionParser()); registerBeanDefinitionParser("client", new ClientKeyStoreDefinitionParser()); registerBeanDefinitionParser("server", new TrustStoreDefinitionParser()); registerBeanDefinitionParser("protocol-handler", new ProtocolHandlerDefinitionParser()); } }mule-2.0.1/transports/ssl/src/main/java/org/mule/transport/ssl/SslServerSocketFactory.java0000644000175000017500000000374210745677442031664 0ustar charlescharles/* * $Id: SslServerSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.api.security.tls.TlsConfiguration; import org.mule.transport.tcp.TcpServerSocketFactory; import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.InetSocketAddress; import javax.net.ServerSocketFactory; public class SslServerSocketFactory extends TcpServerSocketFactory { private TlsConfiguration tls; public SslServerSocketFactory(TlsConfiguration tls) { this.tls = tls; } // @Override public ServerSocket createServerSocket(InetAddress address, int port, int backlog, Boolean reuse) throws IOException { try { ServerSocketFactory ssf = tls.getServerSocketFactory(); return configure(ssf.createServerSocket(), reuse, new InetSocketAddress(address, port), backlog); } catch (IOException e) { throw e; } catch (Exception e) { throw (IOException) new IOException(e.getMessage()).initCause(e); } } // @Override public ServerSocket createServerSocket(int port, int backlog, Boolean reuse) throws IOException { try { ServerSocketFactory ssf = tls.getServerSocketFactory(); return configure(ssf.createServerSocket(), reuse, new InetSocketAddress(port), backlog); } catch (IOException e) { throw e; } catch (Exception e) { throw (IOException) new IOException(e.getMessage()).initCause(e); } } } mule-2.0.1/transports/ssl/src/main/java/org/mule/transport/ssl/SslSocketFactory.java0000644000175000017500000000263210745677442030472 0ustar charlescharles/* * $Id: SslSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.api.security.tls.TlsConfiguration; import org.mule.transport.tcp.AbstractTcpSocketFactory; import org.mule.transport.tcp.TcpSocketKey; import java.io.IOException; import java.net.Socket; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; public class SslSocketFactory extends AbstractTcpSocketFactory { private TlsConfiguration tls; public SslSocketFactory(TlsConfiguration tls) { this.tls = tls; } protected Socket createSocket(TcpSocketKey key) throws IOException { try { return tls.getSocketFactory().createSocket(key.getInetAddress(), key.getPort()); } catch (NoSuchAlgorithmException e) { throw (IOException) new IOException(e.getMessage()).initCause(e); } catch (KeyManagementException e) { throw (IOException) new IOException(e.getMessage()).initCause(e); } } } mule-2.0.1/transports/ssl/src/main/java/org/mule/transport/ssl/TlsConnector.java0000644000175000017500000000124610745677442027645 0ustar charlescharles/* * $Id: TlsConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; /** * TlsConnector Provides TLS connections */ public class TlsConnector extends SslConnector { public static final String TLS = "tls"; public String getProtocol() { return TLS; } } mule-2.0.1/transports/ssl/src/main/java/org/mule/transport/ssl/SslConnector.java0000644000175000017500000001662310745677442027651 0ustar charlescharles/* * $Id: SslConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.TlsDirectKeyStore; import org.mule.api.security.TlsDirectTrustStore; import org.mule.api.security.TlsIndirectKeyStore; import org.mule.api.security.TlsProtocolHandler; import org.mule.api.security.provider.SecurityProviderFactory; import org.mule.api.security.tls.TlsConfiguration; import org.mule.transport.tcp.TcpConnector; import org.mule.transport.tcp.protocols.DirectProtocol; import java.io.IOException; import java.net.ServerSocket; import java.net.URI; import java.security.Provider; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLServerSocket; import javax.net.ssl.TrustManagerFactory; /** * SslConnector provides a connector for SSL connections. * Note that the *only* function of the code in this package is to configure and * provide SSL enabled sockets. All other logic is identical to TCP. */ public class SslConnector extends TcpConnector implements TlsDirectKeyStore, TlsIndirectKeyStore, TlsDirectTrustStore, TlsProtocolHandler { public static final String SSL = "ssl"; public static final String PEER_CERTIFICATES = "PEER_CERTIFICATES"; public static final String LOCAL_CERTIFICATES = "LOCAL_CERTIFICATES"; // null initial keystore - see below private TlsConfiguration tls = new TlsConfiguration(null); public SslConnector() { setSocketFactory(new SslSocketFactory(tls)); setServerSocketFactory(new SslServerSocketFactory(tls)); setTcpProtocol(new DirectProtocol()); // setting this true causes problems as socket closes before handshake finishes setValidateConnections(false); } // @Override protected void doInitialise() throws InitialisationException { super.doInitialise(); // the original logic here was slightly different to other uses of the TlsSupport code - // it appeared to be equivalent to switching anon by whether or not a keyStore was defined // (which seems to make sense), so that is used here. try { tls.initialise(null == getKeyStore(), TlsConfiguration.JSSE_NAMESPACE); } catch (CreateException e) { throw new InitialisationException(e, this); } } // @Override protected ServerSocket getServerSocket(URI uri) throws IOException { SSLServerSocket serverSocket = (SSLServerSocket) super.getServerSocket(uri); serverSocket.setNeedClientAuth(isRequireClientAuthentication()); return serverSocket; } // @Override public String getProtocol() { return SSL; } public String getClientKeyStore() { return tls.getClientKeyStore(); } public String getClientKeyStorePassword() { return tls.getClientKeyStorePassword(); } public String getClientKeyStoreType() { return this.tls.getClientKeyStoreType(); } public String getKeyManagerAlgorithm() { return tls.getKeyManagerAlgorithm(); } public KeyManagerFactory getKeyManagerFactory() { return tls.getKeyManagerFactory(); } public String getKeyPassword() { return tls.getKeyPassword(); } public String getKeyStore() { return tls.getKeyStore(); } public String getKeyStoreType() { return tls.getKeyStoreType(); } public String getProtocolHandler() { return tls.getProtocolHandler(); } public Provider getProvider() { return tls.getProvider(); } public SecurityProviderFactory getSecurityProviderFactory() { return tls.getSecurityProviderFactory(); } public String getSslType() { return tls.getSslType(); } public String getKeyStorePassword() { return tls.getKeyStorePassword(); } public String getTrustManagerAlgorithm() { return tls.getTrustManagerAlgorithm(); } public TrustManagerFactory getTrustManagerFactory() { return tls.getTrustManagerFactory(); } public String getTrustStore() { return tls.getTrustStore(); } public String getTrustStorePassword() { return tls.getTrustStorePassword(); } public String getTrustStoreType() { return tls.getTrustStoreType(); } public boolean isExplicitTrustStoreOnly() { return tls.isExplicitTrustStoreOnly(); } public boolean isRequireClientAuthentication() { return tls.isRequireClientAuthentication(); } public void setClientKeyStore(String clientKeyStore) throws IOException { tls.setClientKeyStore(clientKeyStore); } public void setClientKeyStorePassword(String clientKeyStorePassword) { tls.setClientKeyStorePassword(clientKeyStorePassword); } public void setClientKeyStoreType(String clientKeyStoreType) { this.tls.setClientKeyStoreType(clientKeyStoreType); } public void setExplicitTrustStoreOnly(boolean explicitTrustStoreOnly) { tls.setExplicitTrustStoreOnly(explicitTrustStoreOnly); } public void setKeyManagerAlgorithm(String keyManagerAlgorithm) { tls.setKeyManagerAlgorithm(keyManagerAlgorithm); } public void setKeyPassword(String keyPassword) { tls.setKeyPassword(keyPassword); } public void setKeyStore(String keyStore) throws IOException { tls.setKeyStore(keyStore); } public void setKeyStoreType(String keystoreType) { tls.setKeyStoreType(keystoreType); } public void setProtocolHandler(String protocolHandler) { tls.setProtocolHandler(protocolHandler); } public void setProvider(Provider provider) { tls.setProvider(provider); } public void setRequireClientAuthentication(boolean requireClientAuthentication) { tls.setRequireClientAuthentication(requireClientAuthentication); } public void setSecurityProviderFactory(SecurityProviderFactory spFactory) { tls.setSecurityProviderFactory(spFactory); } public void setSslType(String sslType) { tls.setSslType(sslType); } public void setKeyStorePassword(String storePassword) { tls.setKeyStorePassword(storePassword); } public void setTrustManagerAlgorithm(String trustManagerAlgorithm) { tls.setTrustManagerAlgorithm(trustManagerAlgorithm); } public void setTrustManagerFactory(TrustManagerFactory trustManagerFactory) { tls.setTrustManagerFactory(trustManagerFactory); } public void setTrustStore(String trustStore) throws IOException { tls.setTrustStore(trustStore); } public void setTrustStorePassword(String trustStorePassword) { tls.setTrustStorePassword(trustStorePassword); } public void setTrustStoreType(String trustStoreType) { tls.setTrustStoreType(trustStoreType); } } mule-2.0.1/transports/ssl/src/main/resources/0000755000175000017500000000000011351410660021042 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/resources/META-INF/0000755000175000017500000000000011351410660022202 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/resources/META-INF/spring.schemas0000644000175000017500000000024310630346062025053 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/ssl/2.0/mule-ssl.xsd=META-INF/mule-ssl.xsd http\://www.mulesource.org/schema/mule/tls/2.0/mule-tls.xsd=META-INF/mule-tls.xsdmule-2.0.1/transports/ssl/src/main/resources/META-INF/spring.handlers0000644000175000017500000000030210754365306025235 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/ssl/2.0=org.mule.transport.ssl.config.SslNamespaceHandler http\://www.mulesource.org/schema/mule/tls/2.0=org.mule.transport.ssl.config.TlsNamespaceHandler mule-2.0.1/transports/ssl/src/main/resources/META-INF/services/0000755000175000017500000000000011351410660024025 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410660024614 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410660025556 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410660027573 5ustar charlescharlesmule-2.0.1/transports/ssl/src/main/resources/META-INF/services/org/mule/providers/ssl.properties0000644000175000017500000000062310745677442032536 0ustar charlescharlesconnector=org.mule.transport.ssl.SslConnector dispatcher.factory=org.mule.transport.tcp.TcpMessageDispatcherFactory requester.factory=org.mule.transport.tcp.TcpMessageRequesterFactory message.receiver=org.mule.transport.ssl.SslMessageReceiver message.adapter=org.mule.transport.DefaultMessageAdapter inbound.transformer= outbound.transformer= endpoint.builder=org.mule.endpoint.SocketEndpointURIBuilder mule-2.0.1/transports/ssl/src/main/resources/META-INF/services/org/mule/providers/tls.properties0000644000175000017500000000062210745677442032536 0ustar charlescharlesconnector=org.mule.transport.ssl.TlsConnector dispatcher.factory=org.mule.transport.tcp.TcpMessageDispatcherFactory requester.factory=org.mule.transport.tcp.TcpMessageRequesterFactory message.receiver=org.mule.transport.tcp.TcpMessageReceiver message.adapter=org.mule.transport.DefaultMessageAdapter inbound.transformer= outbound.transformer= endpoint.builder=org.mule.endpoint.SocketEndpointURIBuildermule-2.0.1/transports/ssl/src/main/resources/META-INF/mule-tls.xsd0000644000175000017500000000613510763773200024501 0ustar charlescharles mule-2.0.1/transports/ssl/src/main/resources/META-INF/mule-ssl.xsd0000644000175000017500000000645110763773200024501 0ustar charlescharles Connect Mule to an SSL socket, to send or receive data via the network. mule-2.0.1/transports/ssl/src/test/0000755000175000017500000000000011351410657017071 5ustar charlescharlesmule-2.0.1/transports/ssl/src/test/java/0000755000175000017500000000000011351410657020012 5ustar charlescharlesmule-2.0.1/transports/ssl/src/test/java/org/0000755000175000017500000000000011351410657020601 5ustar charlescharlesmule-2.0.1/transports/ssl/src/test/java/org/mule/0000755000175000017500000000000011351410657021543 5ustar charlescharlesmule-2.0.1/transports/ssl/src/test/java/org/mule/transport/0000755000175000017500000000000011351410657023577 5ustar charlescharlesmule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/0000755000175000017500000000000011351410657024400 5ustar charlescharlesmule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/TlsFunctionalTestCase.java0000644000175000017500000000116510745677442031504 0ustar charlescharles/* * $Id: TlsFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; public class TlsFunctionalTestCase extends SslFunctionalTestCase { protected String getConfigResources() { return "tls-functional-test.xml"; } }mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/TlsNamespaceHandlerTestCase.java0000644000175000017500000000367710745677442032606 0ustar charlescharles/* * $Id: TlsNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.tck.FunctionalTestCase; import org.mule.transport.ssl.SslConnector; public class TlsNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "tls-namespace-config.xml"; } public void testConnectorProperties() throws Exception { SslConnector connector = (SslConnector)muleContext.getRegistry().lookupConnector("sslConnector"); assertNotNull(connector); assertEquals(1024, connector.getSendBufferSize()); assertEquals(2048, connector.getReceiveBufferSize()); assertTrue(connector.isKeepAlive()); //The full path gets resolved, we're just checkng that the property got set assertTrue(connector.getKeyStore().endsWith("/serverKeystore")); assertEquals("mulepassword", connector.getKeyPassword()); assertEquals("mulepassword", connector.getKeyStorePassword()); //The full path gets resolved, we're just checkng that the property got set assertTrue(connector.getClientKeyStore().endsWith("/clientKeystore")); assertEquals("mulepassword", connector.getClientKeyStorePassword()); //The full path gets resolved, we're just checkng that the property got set assertTrue(connector.getTrustStore().endsWith("/trustStore")); assertEquals("mulepassword", connector.getTrustStorePassword()); assertTrue(connector.isExplicitTrustStoreOnly()); assertTrue(connector.isRequireClientAuthentication()); } }mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/ConnectorFactoryTestCase.java0000644000175000017500000000174710745677442032207 0ustar charlescharles/* * $Id: ConnectorFactoryTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.AbstractMuleTestCase; public class ConnectorFactoryTestCase extends AbstractMuleTestCase { public void testCreate() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("ssl://localhost:7877"); assertNotNull(endpoint); assertNotNull(endpoint.getConnector()); assertEquals("ssl://localhost:7877", endpoint.getEndpointURI().getAddress()); } } mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/SaveCertificatesCallback.java0000644000175000017500000000260510754403514032107 0ustar charlescharles/* * $Id: SaveCertificatesCallback.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.tck.functional.EventCallback; import org.mule.api.MuleEventContext; import java.util.Collections; import java.util.List; import java.util.LinkedList; public class SaveCertificatesCallback implements EventCallback { // volatile since this is a thread-safe collection (see holger) private volatile List certificates; public SaveCertificatesCallback() { clear(); } public void eventReceived(MuleEventContext context, Object component) throws Exception { // putting a Thread.sleep here doesn't make this less reliable // surely it would if it was thread scribbling? Thread.sleep(100); certificates.add(context.getMessage().getProperty(SslConnector.LOCAL_CERTIFICATES)); } public void clear() { certificates = Collections.synchronizedList(new LinkedList()); } public List getCertificates() { return certificates; } }mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/SslCertificateTestCase.java0000644000175000017500000000325710754403514031612 0ustar charlescharles/* * $Id: SslCertificateTestCase.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent; public class SslCertificateTestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test Request"; private static int NUM_MESSAGES = 100; protected String getConfigResources() { return "ssl-certificate-test.xml"; } public void testOnce() throws Exception { doTests(1); } public void testMany() throws Exception { doTests(NUM_MESSAGES); } protected void doTests(int n) throws Exception { SaveCertificateCallback callback = (SaveCertificateCallback) muleContext.getRegistry().lookupObject("certificates"); MuleClient client = new MuleClient(); for (int i = 0; i < n; ++i) { callback.clear(); String msg = TEST_MESSAGE + n; MuleMessage result = client.send("in", msg, null); assertTrue(callback.isCalled()); assertNotNull("Null certificates", callback.getCertificates()); assertEquals(FunctionalTestComponent.received(msg), result.getPayloadAsString()); } } }mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/SslMessageReceiverTestCase.java0000644000175000017500000000246710757615756032463 0ustar charlescharles/* * $Id: SslMessageReceiverTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import org.mule.transport.AbstractMessageReceiverTestCase; import com.mockobjects.dynamic.Mock; public class SslMessageReceiverTestCase extends AbstractMessageReceiverTestCase { public MessageReceiver getMessageReceiver() throws Exception { Mock mockComponent = new Mock(Service.class); mockComponent.expectAndReturn("getResponseTransformer", null); mockComponent.expectAndReturn("getResponseRouter", null); return new SslMessageReceiver(endpoint.getConnector(), (Service) mockComponent.proxy(), endpoint); } public InboundEndpoint getEndpoint() throws Exception { return muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("ssl://localhost:1234"); } } mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/issues/0000755000175000017500000000000011351410657025713 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/issues/MultipleConnectorsMule1765TestCase.javamule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/issues/MultipleConnectorsMule1765Test0000644000175000017500000000242310763522057033502 0ustar charlescharles/* * $Id: MultipleConnectorsMule1765TestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class MultipleConnectorsMule1765TestCase extends FunctionalTestCase { // protected static String TEST_MESSAGE = "Test SSL Request (R�dgr�d), 57 = \u06f7\u06f5 in Arabic"; protected static String TEST_MESSAGE = "Test SSL Request"; protected String getConfigResources() { return "multiple-connectors-test.xml"; } public void testSend() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); MuleMessage result = client.send("clientEndpoint", TEST_MESSAGE, props); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/issues/AsynchronousSslMule1854TestCase.javamule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/issues/AsynchronousSslMule1854TestCas0000644000175000017500000000235410763522057033457 0ustar charlescharles/* * $Id: AsynchronousSslMule1854TestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class AsynchronousSslMule1854TestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test Request"; protected String getConfigResources() { return "ssl-functional-test.xml"; } public void testAsynchronous() throws Exception { MuleClient client = new MuleClient(); client.dispatch("asyncEndpoint", TEST_MESSAGE, null); // MULE-2754 Thread.sleep(100); MuleMessage response = client.request("asyncEndpoint", 5000); assertNotNull("Response is null", response); assertEquals(TEST_MESSAGE + " Received Async", response.getPayloadAsString()); } }mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/SslConnectorTestCase.java0000644000175000017500000000544310766204322031320 0ustar charlescharles/* * $Id: SslConnectorTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transport.AbstractConnectorTestCase; public class SslConnectorTestCase extends AbstractConnectorTestCase { // @Override public Connector createConnector() throws Exception { SslConnector cnn = new SslConnector(); cnn.setMuleContext(muleContext); cnn.setName("SslConnector"); cnn.setKeyStore("serverKeystore"); cnn.setClientKeyStore("clientKeystore"); cnn.setClientKeyStorePassword("mulepassword"); cnn.setKeyPassword("mulepassword"); cnn.setKeyStorePassword("mulepassword"); cnn.setTrustStore("trustStore"); cnn.setTrustStorePassword("mulepassword"); cnn.getDispatcherThreadingProfile().setDoThreading(false); return cnn; } public void testClientConnector() throws Exception { SslConnector cnn = new SslConnector(); cnn.setMuleContext(muleContext); cnn.setClientKeyStore("clientKeystore"); cnn.setClientKeyStorePassword("mulepassword"); cnn.getDispatcherThreadingProfile().setDoThreading(false); } public String getTestEndpointURI() { return "ssl://localhost:56801"; } public Object getValidMessage() throws Exception { return "Hello".getBytes(); } public void testValidListener() throws Exception { Service service = getTestService("orange", Orange.class); Connector connector = getConnector(); InboundEndpoint endpoint2 = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("ssl://localhost:30303"); connector.registerListener(service, endpoint2); try { connector.registerListener(service, endpoint2); fail("cannot register on the same endpointUri"); } catch (Exception e) { // expected } } public void testProperties() throws Exception { SslConnector c = (SslConnector)getConnector(); c.setSendBufferSize(1024); assertEquals(1024, c.getSendBufferSize()); c.setSendBufferSize(0); assertEquals(SslConnector.DEFAULT_BUFFER_SIZE, c.getSendBufferSize()); } } mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/SslNamespaceHandlerTestCase.java0000644000175000017500000000401710745677442032572 0ustar charlescharles/* * $Id: SslNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.tck.FunctionalTestCase; import org.mule.transport.ssl.SslConnector; public class SslNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "ssl-namespace-config.xml"; } public void testConnectorProperties() throws Exception { SslConnector connector = (SslConnector) muleContext.getRegistry().lookupConnector("sslConnector"); assertNotNull(connector); assertEquals(1024, connector.getSendBufferSize()); assertEquals(2048, connector.getReceiveBufferSize()); assertTrue(connector.isKeepAlive()); //The full path gets resolved, we're just checkng that the property got set assertTrue(connector.getKeyStore().endsWith("/serverKeystore")); assertEquals("mulepassword", connector.getKeyPassword()); assertEquals("mulepassword", connector.getKeyStorePassword()); //The full path gets resolved, we're just checkng that the property got set assertTrue(connector.getClientKeyStore().endsWith("/clientKeystore")); assertEquals("mulepassword", connector.getClientKeyStorePassword()); //The full path gets resolved, we're just checkng that the property got set assertTrue(connector.getTrustStore().endsWith("/trustStore")); assertEquals("mulepassword", connector.getTrustStorePassword()); assertTrue(connector.isExplicitTrustStoreOnly()); assertTrue(connector.isRequireClientAuthentication()); assertEquals("foo", connector.getProtocolHandler()); } } mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/SslCertificatesTestCase.java0000644000175000017500000000375410754403514031777 0ustar charlescharles/* * $Id: SslCertificatesTestCase.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent; import java.util.Iterator; /** * A different version of {@link org.mule.transport.ssl.SslCertificateTestCase} to see if we can get * different timing. */ public class SslCertificatesTestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test Request"; private static int NUM_MESSAGES = 100; protected String getConfigResources() { return "ssl-certificates-test.xml"; } public void testOnce() throws Exception { doTests(1); } public void testMany() throws Exception { doTests(NUM_MESSAGES); } protected void doTests(int n) throws Exception { SaveCertificatesCallback callback = (SaveCertificatesCallback) muleContext.getRegistry().lookupObject("certificates"); callback.clear(); MuleClient client = new MuleClient(); for (int i = 0; i < n; ++i) { String msg = TEST_MESSAGE + n; MuleMessage result = client.send("in", msg, null); assertEquals(FunctionalTestComponent.received(msg), result.getPayloadAsString()); } Iterator certificates = callback.getCertificates().iterator(); for (int i = 0; i < n; ++i) { assertTrue("No cert at " + i, certificates.hasNext()); assertNotNull("Null cert at " + i, certificates.next()); } } }mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/SslFunctionalTestCase.java0000644000175000017500000000557610766654216031512 0ustar charlescharles/* * $Id: SslFunctionalTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.api.MuleMessage; import org.mule.api.service.Service; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.CounterCallback; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.tck.testmodels.mule.TestSedaService; import java.util.HashMap; import java.util.Map; public class SslFunctionalTestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test Request"; private static int NUM_MESSAGES = 100; protected String getConfigResources() { return "ssl-functional-test.xml"; } public void testSend() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); MuleMessage result = client.send("sendEndpoint", TEST_MESSAGE, props); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); } public void testSendMany() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); for (int i = 0; i < NUM_MESSAGES; ++i) { MuleMessage result = client.send("sendManyEndpoint", TEST_MESSAGE, props); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); } Service c = muleContext.getRegistry().lookupService("testComponent2"); assertTrue("Service should be a TestSedaService", c instanceof TestSedaService); Object ftc = getComponent(c); assertNotNull("Functional Test Service not found in the model.", ftc); assertTrue("Service should be a FunctionalTestComponent", ftc instanceof FunctionalTestComponent); EventCallback cc = ((FunctionalTestComponent) ftc).getEventCallback(); assertNotNull("EventCallback is null", cc); assertTrue("EventCallback should be a CounterCallback", cc instanceof CounterCallback); assertEquals(NUM_MESSAGES, ((CounterCallback) cc).getCallbackCount()); } public void testAsynchronous() throws Exception { MuleClient client = new MuleClient(); client.dispatch("asyncEndpoint", TEST_MESSAGE, null); // MULE-2754 Thread.sleep(100); MuleMessage response = client.request("asyncEndpoint", 5000); assertNotNull("Response is null", response); assertEquals(TEST_MESSAGE + " Received Async", response.getPayloadAsString()); } } mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/SslEndpointTestCase.java0000644000175000017500000000516710745677442031167 0ustar charlescharles/* * $Id: SslEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class SslEndpointTestCase extends AbstractMuleTestCase { public void testHostPortUrl() throws Exception { EndpointURI url = new MuleEndpointURI("ssl://localhost:7856"); url.initialise(); assertEquals("ssl", url.getScheme()); assertEquals("ssl://localhost:7856", url.getAddress()); assertNull(url.getEndpointName()); assertEquals(7856, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("ssl://localhost:7856", url.getAddress()); assertEquals(0, url.getParams().size()); } public void testQueryParams1() throws Exception { EndpointURI url = new MuleEndpointURI("ssl://localhost:7856?param=1"); url.initialise(); assertEquals("ssl", url.getScheme()); assertEquals("ssl://localhost:7856", url.getAddress()); assertNull(url.getEndpointName()); assertEquals(7856, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("ssl://localhost:7856?param=1", url.toString()); assertEquals(1, url.getParams().size()); assertEquals("1", url.getParams().getProperty("param")); } public void testQueryParams2() throws Exception { EndpointURI url = new MuleEndpointURI( "ssl://localhost:7856?param=1&endpointName=sslProvider&blankParam="); url.initialise(); assertEquals("ssl", url.getScheme()); assertEquals("ssl://localhost:7856", url.getAddress()); assertNotNull(url.getEndpointName()); assertEquals("sslProvider", url.getEndpointName()); assertEquals(7856, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("ssl://localhost:7856?param=1&endpointName=sslProvider&blankParam=", url.toString()); assertEquals("param=1&endpointName=sslProvider&blankParam=", url.getQuery()); assertEquals(3, url.getParams().size()); assertEquals("1", url.getParams().getProperty("param")); assertEquals("", url.getParams().getProperty("blankParam")); } } mule-2.0.1/transports/ssl/src/test/java/org/mule/transport/ssl/SaveCertificateCallback.java0000644000175000017500000000301410754403514031717 0ustar charlescharles/* * $Id: SaveCertificateCallback.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.ssl; import org.mule.tck.functional.EventCallback; import org.mule.api.MuleEventContext; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; public class SaveCertificateCallback implements EventCallback { private AtomicReference certificates; private AtomicBoolean called; public SaveCertificateCallback() { clear(); } public void eventReceived(MuleEventContext context, Object component) throws Exception { // putting a Thread.sleep here doesn't make this less reliable // surely it would if it was thread scribbling? certificates.set(context.getMessage().getProperty(SslConnector.LOCAL_CERTIFICATES)); called.set(true); } public void clear() { certificates = new AtomicReference(); called = new AtomicBoolean(false); } public boolean isCalled() { return called.get(); } public Object getCertificates() { return certificates.get(); } } mule-2.0.1/transports/ssl/src/test/resources/0000755000175000017500000000000011351410657021103 5ustar charlescharlesmule-2.0.1/transports/ssl/src/test/resources/serverKeystore0000644000175000017500000000335610443345072024070 0ustar charlescharles muleclient '3X.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'. muleserver ,6N00 +*d;j5V3g2+sDjav}tKmn@GFzS̛-ps냦""AYNZMgGqYS"IW٥ .17e7i??i~?k5ݺZT((`){B|.쵱L6&/rՒpFt$jXesἕVSQ 8,]tKϪ>țbE=K\{_\./S~If#9Ysk BCGEkFw BqTW>uΓ$6ռD.G@{-ɍ\@ҡ `>d gZ6Z?4( 3 .bzX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlOnOO}*Hgmule-2.0.1/transports/ssl/src/test/resources/log4j.properties0000644000175000017500000000050210547540350024235 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/transports/ssl/src/test/resources/tls-namespace-config.xml0000644000175000017500000000240310763773200025625 0ustar charlescharles mule-2.0.1/transports/ssl/src/test/resources/clientKeystore0000644000175000017500000000335610443345072024040 0ustar charlescharles muleclient 00 +*(+lAJv;ǸH H#Vpab^ko5t(vaH~3D9V&\b(hMRtF Y}0ɤ^qIT_ZTZ%0qe4kh#_skyXhغQrpcA *k`XgE  ۲i ⎝"&m- zi[I8_"#F>>'Lu@P`!D/4&) fbYFmpքzޭŏX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'. muleserver -X.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlOU_PT}Kmule-2.0.1/transports/ssl/src/test/resources/ssl-certificate-test.xml0000644000175000017500000000331510766654216025677 0ustar charlescharles mule-2.0.1/transports/ssl/src/test/resources/ssl-namespace-config.xml0000644000175000017500000000240310763773200025624 0ustar charlescharles mule-2.0.1/transports/ssl/src/test/resources/muleclient.cer0000644000175000017500000000074310443345072023742 0ustar charlescharles00HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'.mule-2.0.1/transports/ssl/src/test/resources/trustStore0000644000175000017500000003736210443345072023236 0ustar charlescharlesqӓ=:0  *H 01 0 UUS10U VeriSign, Inc.1<0:U 3Class 1 Public Primary Certification Authority - G21:08U 1(c) 1998 VeriSign, Inc. - For authorized use only10U VeriSign Trust Network0 980518000000Z 280801235959Z01 0 UUS10U VeriSign, Inc.1<0:U 3Class 1 Public Primary Certification Authority - G21:08U 1(c) 1998 VeriSign, Inc. - For authorized use only10U VeriSign Trust Network00  *H 0к-v1ʔVooR6nuV UC!e~!k2?4A5ݪY?SmO*ZĦE]>d$vͫo{Qan4A @s=ku0  *H O g,٨-u~;r~\- km`|Ő# \JЯ]Ƕ  vOÛu[kܬrNOdt{•AesXJKl#P&D#q$GuȦ0  *H +9t^dXJ-73G\`'ER?dh|`3ibTk`BШ;\&#
ZW%v ,75xdT@Qɿ⊂7U!vhKK%f"VlYmepqv>wLPVH).JYIT,s:i9mpgH-{0  *H ~e~:qFǠ@&> Z7a[i;D S kI>5l\:/`KM _d{\w9YoӵMMBVv_8_u_{厀|Pwww.verisign.com/repository/TestCPS Incorp. By Ref. Liab. LTD.1F0DU =For VeriSign authorized testing only. No assurances (C)VS19970 980204000000Z 030304235959Z010U  VeriSign, Inc1G0EU >www.verisign.com/repository/TestCPS Incorp. By Ref. Liab. LTD.1F0DU =For VeriSign authorized testing only. No assurances (C)VS19970\0  *H K0HAƤ&'8œn@˟6~sNбFm@p(Y4Mێ'C;;rN`oQ0  *H Am$g$]upy;N4 د¯NJg {rGc{HL/وQ9 u?verisign class 1 ca individual subscriber-persona not validated ɮX.509j0f0Ϡ O[uj)0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority0 980512000000Z 080512235959Z010U VeriSign, Inc.10U VeriSign Trust Network1F0DU =www.verisign.com/repository/RPA Incorp. By Ref.,LIAB.LTD(c)981H0FU?VeriSign Class 1 CA Individual Subscriber-Persona Not Validated00  *H 0ZDUz-Ox6 JoTw*h1ApzKHV-BD\B/;' ]6B3nTOJƚj$e~7jJ 00 `HB05U.0,0*(&$http://crl.verisign.com/pca1.1.1.crl0GU @0>0< `HE0-0++www.verisign.com/repository/RPA0U00 U0  *H B|ߌyLMU/P^N.^2ye JRը1!l4x BZъު"!e3 3 >5d$[h|7d Ž33>>s muleclient ɯX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'.%2q^P' #˦B7verisign class 1 public primary certification authority ɮkX.509A0=0ͺVT"rU0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority0 960129000000Z 280801235959Z0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority00  *H 0mVa-Hqg޹뷞 8%Fs$] en VsߴX9knը?14׏4g NEVixG)6c\-{2{0*/1g0  *H L?hC3]Mz36ؕ"6hl|B.?OvJ͠ )"]݁#{%F0yK@<_SH䆴{5{%ӎ?84qthawte personal basic ca ɮX.509%0!00  *H 01 0 UZA10U Western Cape10U Cape Town10U Thawte Consulting1(0&U Certification Services Division1!0UThawte Personal Basic CA1(0& *H  personal-basic@thawte.com0 960101000000Z 201231235959Z01 0 UZA10U Western Cape10U Cape Town10U Thawte Consulting1(0&U Certification Services Division1!0UThawte Personal Basic CA1(0& *H  personal-basic@thawte.com00  *H 0SmPOH5ZoBGwurݍIWx?Qi v"jQK7 M458WJpYC}O= bzu݈NN@ۨ2to D يo)(;@(Z<յ ʤQL,YڹuB#.pG*verisign international server ca - class 3 ɮ6X.50900%K8BXݮ"n0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 3 Public Primary Certification Authority0 970417000000Z 111024235959Z010U VeriSign Trust Network10U VeriSign, Inc.1301U *VeriSign International Server CA - Class 31I0GU @www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign00  *H 0؂}9%e+Ӽ6;Ll[( ;MN9\IZӲp0B+QZ<:"OSO4{o00U00DU =0;09 `HE0*0(+https://www.verisign.com/CPS04U%-0+++ `HB `HE0 U0 `HB01U*0(0&$" http://crl.verisign.com/pca3.crl0  *H hBs#:T#>j:36 o)+rDѬ -8=܆aN&_^ $p&C=I.R_>f)N,Fus~ gTR muleserver ɯFX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlO?verisign class 3 ca individual subscriber-persona not validated ɮ'X.5095010#l+ t`0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 3 Public Primary Certification Authority0 970417000000Z 040107235959Z010U VeriSign Trust Network10U VeriSign, Inc.1301U *VeriSign International Server CA - Class 31I0GU @www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign00  *H 0؂}9%e+Ӽ6;Ll[( ;MN9\IZӲp0B+QZ<:"OSO4{o00U00 U0 `HB0 U%0 `HE `HB05U ,0(0$ `HE00(+https://www.verisign.com/CPS0+00VeriSign, Inc.0VeriSign's Certification Practice Statement, www.verisign.com/CPS, governs this certificate & is incorporated by reference herein. SOME WARRANTIES DISCLAIMED & LIABILITY LTD. (c)1997 VeriSign0  *H +Hrh tcXE"N3bZ!$lBE:gHk7K}xU1fF}x`UlUibp|MC (ьFP1f$J[Kf^eU_7?verisign class 2 ca individual subscriber-persona not validated ɮX.509V0R0R |΂Es0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 2 Public Primary Certification Authority0 980512000000Z 040106235959Z010U VeriSign, Inc.10U VeriSign Trust Network1F0DU =www.verisign.com/repository/RPA Incorp. By Ref.,LIAB.LTD(c)981402U+VeriSign Class 2 CA - Individual Subscriber00  *H 0T^%,Y_ kJK >~/e_c, k^Ih%$_#iM;}ڏ ϥX:Kخu""(`0!p^H!T_8)SzSX ]PK9Ti00 `HB05U.0,0*(&$http://crl.verisign.com/pca2.1.1.crl0GU @0>0< `HE0-0++www.verisign.com/repository/RPA0U00 U0  *H  cQ"U_8$^;ID7RuĊRXٮdV/4H׏bƅel@~h!4Z_p LܠA(/ F @LC@1Tmule-2.0.1/transports/ssl/src/test/resources/ssl-certificates-test.xml0000644000175000017500000000331610766654216026063 0ustar charlescharles mule-2.0.1/transports/ssl/src/test/resources/ssl-functional-test.xml0000644000175000017500000000655210766654216025565 0ustar charlescharles mule-2.0.1/transports/ssl/src/test/resources/tls-functional-test.xml0000644000175000017500000000670110766654216025562 0ustar charlescharles mule-2.0.1/transports/ssl/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006310754403514025754 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/transports/ssl/src/test/resources/multiple-connectors-test.xml0000644000175000017500000000250310763773200026612 0ustar charlescharles mule-2.0.1/transports/ssl/src/test/resources/muleserver.cer0000644000175000017500000000074310443345072023772 0ustar charlescharles00HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlOmule-2.0.1/transports/ssl/pom.xml0000644000175000017500000000416211006063605016635 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-ssl SSL Transport A Mule transport for Socket connectivity using SSL authentication. This transport supplies a tcp Server and client implementation over SSL. org.mule.transports mule-transport-tcp ${version} org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.transport.ssl.* mule-2.0.1/transports/vm/0000755000175000017500000000000011351410640015134 5ustar charlescharlesmule-2.0.1/transports/vm/src/0000755000175000017500000000000011351410640015723 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/0000755000175000017500000000000011351410640016647 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/java/0000755000175000017500000000000011351410640017570 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/java/org/0000755000175000017500000000000011351410640020357 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/java/org/mule/0000755000175000017500000000000011351410640021321 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/java/org/mule/transport/0000755000175000017500000000000011351410640023355 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/0000755000175000017500000000000011351410640023777 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/package.html0000644000175000017500000000031610745677442026305 0ustar charlescharles A connector implementation allowing events to be passed between Mule sessions via in-memory queues. These queues can also be configured to be persistent queues. mule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/VMMessageDispatcher.java0000644000175000017500000001113110757615756030525 0ustar charlescharles/* * $Id: VMMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.DispatchException; import org.mule.api.transport.NoReceiverForEndpointException; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractMessageDispatcher; import org.mule.transport.vm.i18n.VMMessages; import org.mule.util.queue.Queue; import org.mule.util.queue.QueueSession; /** * VMMessageDispatcher is used for providing in memory interaction * between components. */ public class VMMessageDispatcher extends AbstractMessageDispatcher { private final VMConnector connector; public VMMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (VMConnector) endpoint.getConnector(); } protected void doDispatch(MuleEvent event) throws Exception { EndpointURI endpointUri = event.getEndpoint().getEndpointURI(); //Apply any outbound transformers on this event before we dispatch event.transformMessage(); if (endpointUri == null) { throw new DispatchException( CoreMessages.objectIsNull("Endpoint"), event.getMessage(), event.getEndpoint()); } if (connector.isQueueEvents()) { QueueSession session = connector.getQueueSession(); Queue queue = session.getQueue(endpointUri.getAddress()); queue.put(event.getMessage()); } else { VMMessageReceiver receiver = connector.getReceiver(event.getEndpoint().getEndpointURI()); if (receiver == null) { logger.warn("No receiver for endpointUri: " + event.getEndpoint().getEndpointURI()); return; } MuleMessage message = event.getMessage(); connector.getSessionHandler().storeSessionInfoToMessage(event.getSession(), message); receiver.onMessage(message); } if (logger.isDebugEnabled()) { logger.debug("dispatched MuleEvent on endpointUri: " + endpointUri); } } protected MuleMessage doSend(MuleEvent event) throws Exception { MuleMessage retMessage; EndpointURI endpointUri = event.getEndpoint().getEndpointURI(); VMMessageReceiver receiver = connector.getReceiver(endpointUri); //Apply any outbound transformers on this event before we dispatch event.transformMessage(); if (receiver == null) { if (connector.isQueueEvents()) { if (logger.isDebugEnabled()) { logger.debug("Writing to queue as there is no receiver on connector: " + connector.getName() + ", for endpointUri: " + event.getEndpoint().getEndpointURI()); } doDispatch(event); return null; } else { throw new NoReceiverForEndpointException( VMMessages.noReceiverForEndpoint(connector.getName(), event.getEndpoint().getEndpointURI())); } } MuleMessage message = event.getMessage(); connector.getSessionHandler().storeSessionInfoToMessage(event.getSession(), message); retMessage = (MuleMessage) receiver.onCall(message, event.isSynchronous()); if (logger.isDebugEnabled()) { logger.debug("sent event on endpointUri: " + event.getEndpoint().getEndpointURI()); } return retMessage; } protected void doDispose() { // template method } protected void doConnect() throws Exception { if (connector.isQueueEvents()) { // use the default queue profile to configure this queue. connector.getQueueProfile().configureQueue( endpoint.getEndpointURI().getAddress(), connector.getQueueManager()); } } protected void doDisconnect() throws Exception { // template method } } mule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/i18n/0000755000175000017500000000000011351410640024556 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/i18n/VMMessages.java0000644000175000017500000000152510745677442027463 0ustar charlescharles/* * $Id: VMMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; import org.mule.transport.vm.VMConnector; public class VMMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath(VMConnector.VM); public static Message noReceiverForEndpoint(String name, Object uri) { return createMessage(BUNDLE_PATH, 1, name, uri); } } mule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/VMTransaction.java0000644000175000017500000000462610745677442027427 0ustar charlescharles/* * $Id: VMTransaction.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.MuleContext; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.CoreMessages; import org.mule.transaction.AbstractSingleResourceTransaction; import org.mule.transaction.IllegalTransactionStateException; import org.mule.util.queue.QueueManager; import org.mule.util.queue.QueueSession; import org.mule.util.xa.ResourceManagerException; public class VMTransaction extends AbstractSingleResourceTransaction { public VMTransaction(MuleContext muleContext) throws TransactionException { QueueManager qm = muleContext.getQueueManager(); QueueSession qs = qm.getQueueSession(); bindResource(qm, qs); } public void bindResource(Object key, Object resource) throws TransactionException { if (!(key instanceof QueueManager) || !(resource instanceof QueueSession)) { throw new IllegalTransactionStateException( CoreMessages.transactionCanOnlyBindToResources("QueueManager/QueueSession")); } super.bindResource(key, resource); } protected void doBegin() throws TransactionException { try { ((QueueSession)resource).begin(); } catch (ResourceManagerException e) { throw new TransactionException(CoreMessages.cannotStartTransaction("VMTransaction"), e); } } protected void doCommit() throws TransactionException { try { ((QueueSession)resource).commit(); } catch (ResourceManagerException e) { throw new TransactionException(CoreMessages.transactionCommitFailed(), e); } } protected void doRollback() throws TransactionException { try { ((QueueSession)resource).rollback(); } catch (ResourceManagerException e) { throw new TransactionException(CoreMessages.transactionRollbackFailed(), e); } } } mule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/VMConnector.java0000644000175000017500000002003510757615756027067 0ustar charlescharles/* * $Id: VMConnector.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.DefaultMuleMessage; import org.mule.api.MessagingException; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.MessageReceiver; import org.mule.config.QueueProfile; import org.mule.config.i18n.CoreMessages; import org.mule.endpoint.DynamicURIInboundEndpoint; import org.mule.endpoint.MuleEndpointURI; import org.mule.routing.filters.WildcardFilter; import org.mule.transaction.TransactionCoordination; import org.mule.transport.AbstractConnector; import org.mule.util.queue.MemoryPersistenceStrategy; import org.mule.util.queue.QueueManager; import org.mule.util.queue.QueueSession; import org.mule.util.queue.TransactionalQueueManager; import java.util.Iterator; /** * VMConnector A simple endpoint wrapper to allow a Mule service to *

be accessed from an endpoint * */ public class VMConnector extends AbstractConnector { public static final String VM = "vm"; private boolean queueEvents = false; private QueueProfile queueProfile; private int queueTimeout = 1000; /** The queue manager to use for vm queues only */ private QueueManager queueManager; protected void doInitialise() throws InitialisationException { if (queueEvents) { if (queueManager == null) { queueManager = new TransactionalQueueManager(); queueManager.setPersistenceStrategy(new MemoryPersistenceStrategy()); } if (queueProfile == null) { //create a default QueueProfile queueProfile = new QueueProfile(); if(logger.isDebugEnabled()) { logger.debug("created default QueueProfile for VM connector: " + queueProfile); } } } } protected void doDispose() { // template method } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } protected void doStart() throws MuleException { // template method } protected void doStop() throws MuleException { // template method } public MessageReceiver createReceiver(Service service, InboundEndpoint endpoint) throws Exception { if (queueEvents) { queueProfile.configureQueue(endpoint.getEndpointURI().getAddress(), queueManager); } return serviceDescriptor.createMessageReceiver(this, service, endpoint); } public MessageAdapter getMessageAdapter(Object message) throws MessagingException { if (message == null) { throw new NullPointerException(CoreMessages.objectIsNull("message").getMessage()); } else if (message instanceof DefaultMuleMessage) { return ((DefaultMuleMessage)message).getAdapter(); } else if (message instanceof MessageAdapter) { return (MessageAdapter)message; } else { throw new MessagingException(CoreMessages.objectNotOfCorrectType(message.getClass(), MessageAdapter.class), null); } } public String getProtocol() { return "VM"; } public boolean isQueueEvents() { return queueEvents; } public void setQueueEvents(boolean queueEvents) { this.queueEvents = queueEvents; } public QueueProfile getQueueProfile() { return queueProfile; } public void setQueueProfile(QueueProfile queueProfile) { this.queueProfile = queueProfile; } VMMessageReceiver getReceiver(EndpointURI endpointUri) throws EndpointException { return (VMMessageReceiver)getReceiverByEndpoint(endpointUri); } QueueSession getQueueSession() throws InitialisationException { Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (tx != null) { if (tx.hasResource(queueManager)) { final QueueSession queueSession = (QueueSession) tx.getResource(queueManager); if (logger.isDebugEnabled()) { logger.debug("Retrieved VM queue session " + queueSession + " from current transaction " + tx); } return queueSession; } } if (logger.isDebugEnabled()) { logger.debug("Retrieving new VM queue session from queue manager"); } QueueSession session = queueManager.getQueueSession(); if (tx != null) { if (logger.isDebugEnabled()) { logger.debug("Binding VM queue session " + session + " to current transaction " + tx); } try { tx.bindResource(queueManager, session); } catch (TransactionException e) { throw new RuntimeException("Could not bind queue session to current transaction", e); } } return session; } protected MessageReceiver getReceiverByEndpoint(EndpointURI endpointUri) throws EndpointException { if (logger.isDebugEnabled()) { logger.debug("Looking up vm receiver for address: " + endpointUri.toString()); } MessageReceiver receiver; // If we have an exact match, use it receiver = (MessageReceiver)receivers.get(endpointUri.getAddress()); if (receiver != null) { if (logger.isDebugEnabled()) { logger.debug("Found exact receiver match on endpointUri: " + endpointUri); } return receiver; } // otherwise check each one against a wildcard match for (Iterator iterator = receivers.values().iterator(); iterator.hasNext();) { receiver = (MessageReceiver)iterator.next(); String filterAddress = receiver.getEndpointURI().getAddress(); WildcardFilter filter = new WildcardFilter(filterAddress); if (filter.accept(endpointUri.getAddress())) { InboundEndpoint endpoint = receiver.getEndpoint(); EndpointURI newEndpointURI = new MuleEndpointURI(endpointUri, filterAddress); receiver.setEndpoint(new DynamicURIInboundEndpoint(endpoint, newEndpointURI)); if (logger.isDebugEnabled()) { logger.debug("Found receiver match on endpointUri: " + receiver.getEndpointURI() + " against " + endpointUri); } return receiver; } } if (logger.isDebugEnabled()) { logger.debug("No receiver found for endpointUri: " + endpointUri); } return null; } // //@Override public boolean isRemoteSyncEnabled() { return true; } public int getQueueTimeout() { return queueTimeout; } public void setQueueTimeout(int queueTimeout) { this.queueTimeout = queueTimeout; } public QueueManager getQueueManager() { return queueManager; } } mule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/config/0000755000175000017500000000000011351410640025244 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/config/VmNamespaceHandler.java0000644000175000017500000000225510745726444031632 0ustar charlescharles/* * $Id: VmNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm.config; import org.mule.config.QueueProfile; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.vm.VMConnector; /** * Reigsters a Bean Definition Parser for handling elements. * */ public class VmNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(VMConnector.VM, URIBuilder.PATH_ATTRIBUTES); registerConnectorDefinitionParser(VMConnector.class); registerBeanDefinitionParser("queueProfile", new ChildDefinitionParser("queueProfile", QueueProfile.class)); } } mule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/VMTransactionFactory.java0000644000175000017500000000173310745677442030753 0ustar charlescharles/* * $Id: VMTransactionFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.MuleContext; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transaction.TransactionFactory; public class VMTransactionFactory implements TransactionFactory { public Transaction beginTransaction(MuleContext muleContext) throws TransactionException { VMTransaction tx = new VMTransaction(muleContext); tx.begin(); return tx; } public boolean isTransacted() { return true; } } mule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/VMMessageRequester.java0000644000175000017500000001066711001657654030415 0ustar charlescharles/* * $Id: VMMessageRequester.java 11586 2008-04-17 14:33:16Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.MuleMessage; import org.mule.api.ThreadSafeAccess; import org.mule.api.endpoint.InboundEndpoint; import org.mule.transport.AbstractMessageRequester; import org.mule.util.queue.Queue; import org.mule.util.queue.QueueSession; /** * VMMessageDispatcher is used for providing in memory interaction * between components. */ public class VMMessageRequester extends AbstractMessageRequester { private final VMConnector connector; public VMMessageRequester(InboundEndpoint endpoint) { super(endpoint); this.connector = (VMConnector) endpoint.getConnector(); } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was available * @throws Exception if the call to the underlying protocol causes an exception */ protected MuleMessage doRequest(long timeout) throws Exception { if (!connector.isQueueEvents()) { throw new UnsupportedOperationException("Receive requested on VM Connector, but queueEvents is false"); } try { QueueSession queueSession = connector.getQueueSession(); Queue queue = queueSession.getQueue(endpoint.getEndpointURI().getAddress()); if (queue == null) { if (logger.isDebugEnabled()) { logger.debug("No queue with name " + endpoint.getEndpointURI().getAddress()); } return null; } else { MuleMessage message = null; if (logger.isDebugEnabled()) { logger.debug("Waiting for a message on " + endpoint.getEndpointURI().getAddress()); } try { message = (MuleMessage) queue.poll(timeout); } catch (InterruptedException e) { logger.error("Failed to receive message from queue: " + endpoint.getEndpointURI()); } if (message != null) { //The message will contain old thread information, we need to reset it if(message instanceof ThreadSafeAccess) { //TODO: would it be ok just to reset access control here? i.e. ((ThreadSafeAccess)message).resetAccessControl(); // message = (MuleMessage)((ThreadSafeAccess)message).newThreadCopy(); } if (logger.isDebugEnabled()) { logger.debug("Message received: " + message); } return message; } else { if (logger.isDebugEnabled()) { logger.debug("No event received after " + timeout + " ms"); } return null; } } } catch (Exception e) { throw e; } } protected void doDispose() { // template method } protected void doConnect() throws Exception { if (connector.isQueueEvents()) { // use the default queue profile to configure this queue. connector.getQueueProfile().configureQueue( endpoint.getEndpointURI().getAddress(), connector.getQueueManager()); } } protected void doDisconnect() throws Exception { // template method } }mule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/VMMessageRequesterFactory.java0000644000175000017500000000213110757615756031746 0ustar charlescharles/* * $Id: VMMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; /** * VMMessageDispatcherFactory creates an in-memory event dispatcher */ public class VMMessageRequesterFactory extends AbstractMessageRequesterFactory { /* * (non-Javadoc) * * @see org.mule.api.transport.MessageDispatcherFactory#create(org.mule.api.transport.Connector) */ public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new VMMessageRequester(endpoint); } }mule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/VMMessageReceiver.java0000644000175000017500000001536110762003746030176 0ustar charlescharles/* * $Id: VMMessageReceiver.java 11127 2008-02-29 13:25:58Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.transport.PollingReceiverWorker; import org.mule.transport.TransactedPollingMessageReceiver; import org.mule.util.queue.Queue; import org.mule.util.queue.QueueSession; import java.util.LinkedList; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionException; /** * VMMessageReceiver is a listener for events from a Mule service which then simply passes * the events on to the target service. */ public class VMMessageReceiver extends TransactedPollingMessageReceiver { private VMConnector connector; private final Object lock = new Object(); public VMMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); this.setReceiveMessagesInTransaction(endpoint.getTransactionConfig().isTransacted()); this.connector = (VMConnector) connector; } /* * We only need to start scheduling this receiver if event queueing is enabled on the connector; otherwise * events are delivered via onEvent/onCall. */ // @Override protected void schedule() throws RejectedExecutionException, NullPointerException, IllegalArgumentException { if (connector.isQueueEvents()) { super.schedule(); } } protected void doDispose() { // template method } protected void doConnect() throws Exception { if (connector.isQueueEvents()) { // Ensure we can create a vm queue QueueSession queueSession = connector.getQueueSession(); Queue q = queueSession.getQueue(endpoint.getEndpointURI().getAddress()); if (logger.isDebugEnabled()) { logger.debug("Current queue depth for queue: " + endpoint.getEndpointURI().getAddress() + " is: " + q.size()); } } } protected void doDisconnect() throws Exception { // template method } public void onMessage(MuleMessage message) throws MuleException { // Rewrite the message to treat it as a new message MuleMessage newMessage = new DefaultMuleMessage(message.getPayload(), message); /* * TODO review: onEvent can only be called by the VMMessageDispatcher - why is * this lock here and do we still need it? what can break if this receiver is run * concurrently by multiple dispatchers, which are isolated? */ synchronized (lock) { routeMessage(newMessage); } } public Object onCall(MuleMessage message, boolean synchronous) throws MuleException { // Rewrite the message to treat it as a new message MuleMessage newMessage = new DefaultMuleMessage(message.getPayload(), message); return routeMessage(newMessage, synchronous); } protected List getMessages() throws Exception { // The queue from which to pull events QueueSession qs = connector.getQueueSession(); Queue queue = qs.getQueue(endpoint.getEndpointURI().getAddress()); // The list of retrieved messages that will be returned List messages = new LinkedList(); /* * Determine how many messages to batch in this poll: we need to drain the queue quickly, but not by * slamming the workManager too hard. It is impossible to determine this more precisely without proper * load statistics/feedback or some kind of "event cost estimate". Therefore we just try to use half * of the receiver's workManager, since it is shared with receivers for other endpoints. */ int maxThreads = connector.getReceiverThreadingProfile().getMaxThreadsActive(); // also make sure batchSize is always at least 1 int batchSize = Math.max(1, Math.min(queue.size(), ((maxThreads / 2) - 1))); // try to get the first event off the queue MuleMessage message = (MuleMessage) queue.poll(connector.getQueueTimeout()); if (message != null) { // keep first dequeued event messages.add(message); // keep batching if more events are available for (int i = 0; i < batchSize && message != null; i++) { message = (MuleMessage) queue.poll(0); if (message != null) { messages.add(message); } } } // let our workManager handle the batch of events return messages; } protected void processMessage(Object msg) throws Exception { // getMessages() returns UMOEvents MuleMessage message = (MuleMessage) msg; // Rewrite the message to treat it as a new message MuleMessage newMessage = new DefaultMuleMessage(message.getPayload(), message); routeMessage(newMessage); } /* * We create our own "polling" worker here since we need to evade the standard scheduler. */ // @Override protected PollingReceiverWorker createWork() { return new VMReceiverWorker(this); } /* * Even though the VM transport is "polling" for messages, the nonexistent cost of accessing the queue is * a good reason to not use the regular scheduling mechanism in order to both minimize latency and * maximize throughput. */ protected static class VMReceiverWorker extends PollingReceiverWorker { public VMReceiverWorker(VMMessageReceiver pollingMessageReceiver) { super(pollingMessageReceiver); } public void run() { /* * We simply run our own polling loop all the time as long as the receiver is started. The * blocking wait defined by VMConnector.getQueueTimeout() will prevent this worker's receiver * thread from busy-waiting. */ while (this.getReceiver().isConnected()) { super.run(); } } } } mule-2.0.1/transports/vm/src/main/java/org/mule/transport/vm/VMMessageDispatcherFactory.java0000644000175000017500000000214410757615756032061 0ustar charlescharles/* * $Id: VMMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * VMMessageDispatcherFactory creates an in-memory event dispatcher */ public class VMMessageDispatcherFactory extends AbstractMessageDispatcherFactory { /* * (non-Javadoc) * * @see org.mule.api.transport.MessageDispatcherFactory#create(org.mule.api.transport.Connector) */ public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new VMMessageDispatcher(endpoint); } } mule-2.0.1/transports/vm/src/main/resources/0000755000175000017500000000000011351410640020661 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/resources/META-INF/0000755000175000017500000000000011351410640022021 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/resources/META-INF/spring.schemas0000644000175000017500000000011710622416734024701 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/vm/2.0/mule-vm.xsd=META-INF/mule-vm.xsd mule-2.0.1/transports/vm/src/main/resources/META-INF/spring.handlers0000644000175000017500000000013610745677442025072 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/vm/2.0=org.mule.transport.vm.config.VmNamespaceHandler mule-2.0.1/transports/vm/src/main/resources/META-INF/services/0000755000175000017500000000000011351410640023644 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410640024433 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410640025375 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410640027412 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/resources/META-INF/services/org/mule/providers/vm.properties0000644000175000017500000000065710745677442032207 0ustar charlescharlesconnector=org.mule.transport.vm.VMConnector dispatcher.factory=org.mule.transport.vm.VMMessageDispatcherFactory requester.factory=org.mule.transport.vm.VMMessageRequesterFactory message.receiver=org.mule.transport.vm.VMMessageReceiver message.adapter=org.mule.transport.DefaultMessageAdapter #stream.message.adapter=org.mule.transport.streaming.StreamMessageAdapter endpoint.builder=org.mule.endpoint.ResourceNameEndpointURIBuildermule-2.0.1/transports/vm/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410640026154 5ustar charlescharlesmule-2.0.1/transports/vm/src/main/resources/META-INF/services/org/mule/i18n/vm-messages.properties0000644000175000017500000000011110621717250032520 0ustar charlescharles1=There is no receiver registered on connector "{0}" for endpointUri {1} mule-2.0.1/transports/vm/src/main/resources/META-INF/mule-vm.xsd0000644000175000017500000000612110764025046024134 0ustar charlescharles Determines if queues should be set up for listeners on the connector. If this is false the connector simply forwards events to components via the Mule server. If it is set then the queues are configured using the queuing profile. mule-2.0.1/transports/vm/src/test/0000755000175000017500000000000011351410640016702 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/java/0000755000175000017500000000000011351410637017631 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/java/org/0000755000175000017500000000000011351410637020420 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/java/org/mule/0000755000175000017500000000000011351410640021354 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/java/org/mule/issues/0000755000175000017500000000000011351410640022667 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/java/org/mule/issues/ResponseTransformerMule2165TestCase.java0000644000175000017500000001201510754375733032372 0ustar charlescharles/* * $Id: ResponseTransformerMule2165TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class ResponseTransformerMule2165TestCase extends FunctionalTestCase { public static final long TIMEOUT = 1000L; public static final String MESSAGE = "a message"; // i don't know if this is the "correct" response - it's *one* of the responses in 1.4, // and it seems vaguely reasonable. /* RM Described as: 1. Client dispatch = "outbound" 2. First Service receiver = "inbound" 3. First Service dispatch (first endpoint) = "outbound" 4. Second Service receiver = "inbound" 5. Response transformer from SecondComponent = "response" Note that because the response transformer is configured locally on the outbound endppoint it only gets called once */ public static final String LOCAL_RESPONSE = MESSAGE + " outbound inbound outbound inbound response"; // an alternative in 1.4 is " outbound outbound response response" for the global // transformers, which also makes some sense /* RM Described as: 1. Client dispatch = "outbound" 2. First Service receiver = "inbound" 3. First Service dispatch (first endpoint) = "outbound" 4. Second Service receiver = "inbound" 5. Response transformer from SecondComponent = "response" 6. Response from outbound endpoint (to the service) = "response" Note that because the global outbound inpoint is also the inbound endpoint of the bounce service The "response" ResponseTransformer gets called twice */ public static final String GLOBAL_RESPONSE = LOCAL_RESPONSE + " response"; protected String getConfigResources() { return "issues/response-transformer-mule-2165-test.xml"; } protected MuleClient send(String endpoint) throws MuleException { MuleClient client = new MuleClient(); client.send(endpoint, MESSAGE, null); return client; } protected MuleClient dispatch(String endpoint) throws MuleException { MuleClient client = new MuleClient(); client.dispatch(endpoint, MESSAGE, null); return client; } protected String request(MuleClient client, String endpoint) throws Exception { MuleMessage message = client.request(endpoint, TIMEOUT); assertNotNull("no response from " + endpoint, message); assertNotNull(message.getPayloadAsString()); return message.getPayloadAsString(); } protected void testTransformered(String endpoint, String response) throws Exception { String message = request(send("in-" + endpoint), "out-" + endpoint); assertEquals("bad response (" + message + ") for " + endpoint, response, message); } protected void testTransformeredAsync(String endpoint, String response) throws Exception { String message = request(dispatch("in-" + endpoint), "out-" + endpoint); assertEquals("bad response (" + message + ") for " + endpoint, response, message); } public void testGlobalNameGlobalTransformer() throws Exception { testTransformered("global-name-global-transformer", GLOBAL_RESPONSE); } public void testGlobalNameUrlTransformer() throws Exception { testTransformered("global-name-url-transformer", GLOBAL_RESPONSE); } public void testGlobalNameLocalTransformer() throws Exception { testTransformered("global-name-local-transformer", LOCAL_RESPONSE); } public void testLocalNameLocalTransformer() throws Exception { testTransformered("local-name-local-transformer", LOCAL_RESPONSE); } public void testLocalNameUrlTransformer() throws Exception { testTransformered("local-name-url-transformer", LOCAL_RESPONSE); } public void testGlobalNameGlobalTransformerAsync() throws Exception { testTransformeredAsync("global-name-global-transformer", GLOBAL_RESPONSE); } public void testGlobalNameUrlTransformerAsync() throws Exception { testTransformeredAsync("global-name-url-transformer", GLOBAL_RESPONSE); } public void testGlobalNameLocalTransformerAsync() throws Exception { testTransformeredAsync("global-name-local-transformer", LOCAL_RESPONSE); } public void testLocalNameLocalTransformerAsync() throws Exception { testTransformeredAsync("local-name-local-transformer", LOCAL_RESPONSE); } public void testLocalNameUrlTransformerAsync() throws Exception { testTransformeredAsync("local-name-url-transformer", LOCAL_RESPONSE); } } mule-2.0.1/transports/vm/src/test/java/org/mule/issues/BridgeMule2540TestCase.java0000644000175000017500000000270610754375733027550 0ustar charlescharles/* * $Id: BridgeMule2540TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class BridgeMule2540TestCase extends FunctionalTestCase { private static final int RECEIVE_TIMEOUT = 5000; protected String getConfigResources() { return "issues/bridge-mule-2540-test.xml"; } public void testBridge() throws Exception { String input = "Test message"; String[] output = {"Test", "message"}; MuleClient client = new MuleClient(); client.dispatch("vm://receiver", input, null); MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT); assertNotNull(result); assertNotNull(result.getPayload()); assertNull(result.getExceptionPayload()); String[] payload = (String[]) result.getPayload(); assertEquals(output.length, payload.length); for (int i = 0; i < output.length; i++) { assertEquals(output[i], payload[i]); } } }mule-2.0.1/transports/vm/src/test/java/org/mule/issues/TransformerChainMule2131TestCase.java0000644000175000017500000000123010667335517031603 0ustar charlescharles/* * $Id: TransformerChainMule2131TestCase.java 8186 2007-09-04 20:08:47Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; public class TransformerChainMule2131TestCase extends TransformerChainMule2063TestCase { public void testOutputTransformers() throws Exception { doTest("test3", TEST3_OUT); } }mule-2.0.1/transports/vm/src/test/java/org/mule/issues/SimpleSerializableObject.java0000644000175000017500000000163210700525365030453 0ustar charlescharles/* * $Id: SimpleSerializableObject.java 8800 2007-10-02 20:32:53Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; import java.io.Serializable; /** * Simple Custom Serializable object to check that Custom Objects Can Actually be * Chunked */ class SimpleSerializableObject implements Serializable { private static final long serialVersionUID = 4705305160224612898L; public String s; public boolean b; public int i; public SimpleSerializableObject(String s, boolean b, int i) { this.s = s; this.b = b; this.i = i; } } mule-2.0.1/transports/vm/src/test/java/org/mule/issues/EndpointTransformerMule2131TestCase.java0000644000175000017500000000543210755201713032335 0ustar charlescharles/* * $Id: EndpointTransformerMule2131TestCase.java 10812 2008-02-15 03:15:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.StringAppendTestTransformer; public class EndpointTransformerMule2131TestCase extends FunctionalTestCase { public static final long TIMEOUT = 1000L; public static final String MESSAGE = "a message"; protected String getConfigResources() { return "issues/endpoint-transformer-mule-2131-test.xml"; } protected MuleClient send() throws MuleException { MuleClient client = new MuleClient(); client.dispatch("in", MESSAGE, null); return client; } public void testDirect() throws Exception { String response = request(send(), "direct"); assertEquals(MESSAGE, response); } public void testGlobalNameGlobalTransformer() throws Exception { String response = request(send(), "global-name-global-transformer"); // Transformer is applied twice because it is on global endpoint and is // therfore // used for both the inbound and outbound endpoints because both use the // global endpoint name and thus use the global endpoint as a template assertEquals(MESSAGE + StringAppendTestTransformer.DEFAULT_TEXT + StringAppendTestTransformer.DEFAULT_TEXT, response); } public void testGlobalNameLocalTransformer() throws Exception { doTestTransformed("global-name-local-transformer"); } public void testNoNameLocalTransformer() throws Exception { doTestTransformed("vm://no-name-local-transformer?connector=queue"); } public void testLocalNameLocalTransformer() throws Exception { doTestTransformed("vm://local-name-local-transformer?connector=queue"); } protected void doTestTransformed(String endpoint) throws Exception { String response = request(send(), endpoint); assertEquals(MESSAGE + StringAppendTestTransformer.DEFAULT_TEXT, response); } protected String request(MuleClient client, String endpoint) throws Exception { MuleMessage message = client.request(endpoint, TIMEOUT); assertNotNull(message); assertNotNull(message.getPayloadAsString()); return message.getPayloadAsString(); } } mule-2.0.1/transports/vm/src/test/java/org/mule/issues/TransformerChainMule2063TestCase.java0000644000175000017500000000336310763271122031604 0ustar charlescharles/* * $Id: TransformerChainMule2063TestCase.java 11159 2008-03-04 16:01:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class TransformerChainMule2063TestCase extends FunctionalTestCase { public static final String IN = "in"; public static final String TEST1_OUT = IN + "123"; public static final String TEST2_OUT = IN + "123"; public static final String TEST3_OUT = IN + "123abc"; public static final long WAIT_MS = 3000L; protected String getConfigResources() { return "issues/transformer-chain-mule-2063-test.xml"; } protected void doTest(String name, String result) throws Exception { MuleClient client = new MuleClient(); client.send("vm://" + name + "-in", IN, null); MuleMessage message = client.request("vm://" + name + "-out", WAIT_MS); assertNotNull(message); assertNotNull(message.getPayloadAsString()); assertEquals(result, message.getPayloadAsString()); } public void testInputTransformers() throws Exception { doTest("test1", TEST1_OUT); } public void testGlobalTransformers() throws Exception { doTest("test2", TEST2_OUT); } public void testOutputTransformers() throws Exception { doTest("test3", TEST3_OUT); } } mule-2.0.1/transports/vm/src/test/java/org/mule/issues/ServiceOverridesMule1770TestCase.java0000644000175000017500000000500210745677442031635 0ustar charlescharles/* * $Id: ServiceOverridesMule1770TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; import org.mule.api.config.MuleProperties; import org.mule.api.transformer.Transformer; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.mule.TestMessageDispatcherFactory; import org.mule.transformer.NoActionTransformer; import org.mule.transformer.TransformerUtils; import org.mule.transport.AbstractConnector; public class ServiceOverridesMule1770TestCase extends FunctionalTestCase { protected String getConfigResources() { return "issues/service-overrides-mule-1770-test.xml"; } public void testServiceOverrides() { AbstractConnector c = (AbstractConnector)muleContext.getRegistry().lookupConnector("test"); assertNotNull("Connector should not be null", c); assertNotNull("Service overrides should not be null", c.getServiceOverrides()); String temp = (String)c.getServiceOverrides().get(MuleProperties.CONNECTOR_DISPATCHER_FACTORY); assertNotNull("DispatcherFactory override should not be null", temp); assertEquals(TestMessageDispatcherFactory.class.getName(), temp); Transformer transformer = TransformerUtils.firstOrNull(c.getDefaultInboundTransformers()); assertNotNull("InboundTransformer should not be null", transformer); assertEquals(NoActionTransformer.class, transformer.getClass()); } // MULE-1878 public void testDuplicate() { AbstractConnector c1 = (AbstractConnector)muleContext.getRegistry().lookupConnector("test"); assertNotNull("Connector should not be null", c1); Transformer t1 = TransformerUtils.firstOrNull(c1.getDefaultInboundTransformers()); assertNotNull("InboundTransformer should not be null", t1); assertEquals(NoActionTransformer.class, t1.getClass()); AbstractConnector c2 = (AbstractConnector)muleContext.getRegistry().lookupConnector("second"); assertNotNull("Connector should not be null", c2); Transformer t2 = TransformerUtils.firstOrNull(c2.getDefaultInboundTransformers()); assertNull("InboundTransformer should be null", t2); } } mule-2.0.1/transports/vm/src/test/java/org/mule/issues/CustomFilterMule2437TestCase.java0000644000175000017500000000266610754375733031006 0ustar charlescharles/* * $Id: CustomFilterMule2437TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class CustomFilterMule2437TestCase extends FunctionalTestCase { private static final long TIMEOUT = 3000L; protected String getConfigResources() { return "issues/custom-filter-mule-2437-test.xml"; } public void testVowels() throws Exception { doTest("aei", "vm://vowels"); } public void testConsonants() throws Exception { doTest("zyx", "vm://consonants"); } protected void doTest(String message, String destination) throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://in?connector=default", new DefaultMuleMessage(message)); MuleMessage response = client.request(destination + "?connector=queue", TIMEOUT); assertNotNull(response); assertEquals(message, response.getPayloadAsString()); } } mule-2.0.1/transports/vm/src/test/java/org/mule/issues/MulticastRouterMule2112TestCase.java0000644000175000017500000000502710761053756031510 0ustar charlescharles/* * $Id: MulticastRouterMule2112TestCase.java 11039 2008-02-26 18:18:22Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEventContext; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalTestComponent; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; public class MulticastRouterMule2112TestCase extends FunctionalTestCase { protected String getConfigResources() { return "issues/multicast-router-mule-2112-test.xml"; } public void testMulticastRoutingOverTwoEndpoints() throws Exception { Object hop1 = getComponent("hop1"); assertTrue("FunctionalTestComponent expected", hop1 instanceof FunctionalTestComponent); Object hop2 = getComponent("hop2"); assertTrue("FunctionalTestComponent expected", hop2 instanceof FunctionalTestComponent); assertNotNull(hop1); assertNotNull(hop2); final AtomicBoolean hop1made = new AtomicBoolean(false); EventCallback callback1 = new EventCallback() { public void eventReceived(final MuleEventContext context, final Object component) throws Exception { assertTrue(hop1made.compareAndSet(false, true)); } }; final AtomicBoolean hop2made = new AtomicBoolean(false); EventCallback callback2 = new EventCallback() { public void eventReceived(final MuleEventContext context, final Object component) throws Exception { assertTrue(hop2made.compareAndSet(false, true)); } }; ((FunctionalTestComponent) hop1).setEventCallback(callback1); ((FunctionalTestComponent) hop2).setEventCallback(callback2); MuleClient client = new MuleClient(); DefaultMuleMessage request = new DefaultMuleMessage("payload"); client.dispatch("vm://inbound", request); Thread.sleep(1000); assertTrue("First callback never fired", hop1made.get()); assertTrue("Second callback never fired", hop2made.get()); } } mule-2.0.1/transports/vm/src/test/java/org/mule/issues/PropertyScribblingMule893TestCase.java0000644000175000017500000000273210754375733032127 0ustar charlescharles/* * $Id: PropertyScribblingMule893TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.issues; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class PropertyScribblingMule893TestCase extends FunctionalTestCase { protected String getConfigResources() { return "issues/property-scribbling-mule-893-test.xml"; } public void testSingleMessage() throws Exception { MuleClient client = new MuleClient(); Map properties = new HashMap(); properties.put(MuleProperties.MULE_REPLY_TO_PROPERTY, "receive"); client.dispatch("dispatch", "Message", properties); MuleMessage response = client.request("receive", 3000L); assertNotNull("Response is null", response); assertEquals("Message Received", response.getPayload()); } public void testManyMessage() throws Exception { for (int i = 0; i < 1000; i++) { testSingleMessage(); } } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/0000755000175000017500000000000011351410640023410 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/0000755000175000017500000000000011351410640024032 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/VMFunctionalTestCase.java0000644000175000017500000000366410754375733030732 0ustar charlescharles/* * $Id: VMFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class VMFunctionalTestCase extends FunctionalTestCase { public static final long WAIT = 3000L; protected String getConfigResources() { return "vm/vm-functional-test.xml"; } public void testSingleMessage() throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://in", "Marco", null); MuleMessage response = client.request("vm://out", WAIT); assertNotNull("Response is null", response); assertEquals("Polo", response.getPayload()); } public void testRequest() throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://in", "Marco", null); MuleMessage response = client.request("vm://out", WAIT); assertNotNull("Response is null", response); assertEquals("Polo", response.getPayload()); } public void testMultipleMessages() throws Exception { MuleClient client = new MuleClient(); client.dispatch("vm://in", "Marco", null); client.dispatch("vm://in", "Marco", null); client.dispatch("vm://in", "Marco", null); MuleMessage response; for (int i = 0; i < 3; ++i) { response = client.request("vm://out", WAIT); assertNotNull("Response is null", response); assertEquals("Polo", response.getPayload()); } } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/VMMessageReceiverTestCase.java0000644000175000017500000000241410757615756031676 0ustar charlescharles/* * $Id: VMMessageReceiverTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageReceiver; import org.mule.transport.AbstractMessageReceiverTestCase; public class VMMessageReceiverTestCase extends AbstractMessageReceiverTestCase { VMMessageReceiver receiver; protected void doSetUp() throws Exception { super.doSetUp(); receiver = new VMMessageReceiver(endpoint.getConnector(), service, endpoint); } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageReceiverTestCase#getMessageReceiver() */ public MessageReceiver getMessageReceiver() { return receiver; } public InboundEndpoint getEndpoint() throws Exception { return muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("vm://test"); } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/VMMessageAdapterTestCase.java0000644000175000017500000000354210754365306031503 0ustar charlescharles/* * $Id: VMMessageAdapterTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.MessageTypeNotSupportedException; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.transport.DefaultMessageAdapter; /** * VMMessageAdapterTestCase TODO (document class) */ public class VMMessageAdapterTestCase extends AbstractMessageAdapterTestCase { /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#createAdapter() */ public MessageAdapter createAdapter(Object payload) throws MessageTypeNotSupportedException { if (payload instanceof MuleMessage) { return new DefaultMessageAdapter(payload); } else { throw new MessageTypeNotSupportedException(payload, DefaultMessageAdapter.class); } } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#getValidMessage() */ public Object getValidMessage() throws MuleException { return new DefaultMuleMessage("Valid Message"); } /* * (non-Javadoc) * * @see org.mule.tck.providers.AbstractMessageAdapterTestCase#getInvalidMessage() */ public Object getInvalidMessage() { return "Invalid message"; } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/config/0000755000175000017500000000000011351410640025277 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/config/VmNamespaceHandlerTestCase.java0000644000175000017500000000544210745677442033325 0ustar charlescharles/* * $Id: VmNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm.config; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.config.QueueProfile; import org.mule.tck.FunctionalTestCase; import org.mule.transport.vm.VMConnector; /** * Tests the Spring XML namespace for the VM transport. */ public class VmNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "vm/vm-namespace-config.xml"; } public void testDefaults() throws Exception { VMConnector c = (VMConnector)muleContext.getRegistry().lookupConnector("vmConnectorDefaults"); assertNotNull(c); assertFalse(c.isQueueEvents()); assertEquals(1000, c.getQueueTimeout()); QueueProfile queueProfile = c.getQueueProfile(); assertNull(queueProfile); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testDefaultQueueProfile() throws Exception { VMConnector c = (VMConnector)muleContext.getRegistry().lookupConnector("vmConnector1"); assertNotNull(c); assertTrue(c.isQueueEvents()); assertEquals(1000, c.getQueueTimeout()); QueueProfile queueProfile = c.getQueueProfile(); assertNotNull(queueProfile); assertFalse(queueProfile.isPersistent()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testConfig() throws Exception { VMConnector c = (VMConnector)muleContext.getRegistry().lookupConnector("vmConnector2"); assertNotNull(c); assertTrue(c.isQueueEvents()); assertEquals(5000, c.getQueueTimeout()); QueueProfile queueProfile = c.getQueueProfile(); assertNotNull(queueProfile); assertTrue(queueProfile.isPersistent()); assertEquals(10, queueProfile.getMaxOutstandingMessages()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testGlobalEndpoint() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("vmEndpoint"); assertNotNull(endpoint); EndpointURI uri = endpoint.getEndpointURI(); assertNotNull(uri); String address = uri.getAddress(); assertEquals(address, "queue"); } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/VMQueueTestCase.java0000644000175000017500000000657510754375733027720 0ustar charlescharles/* * $Id: VMQueueTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import java.util.StringTokenizer; public class VMQueueTestCase extends FunctionalTestCase { public static final long WAIT = 3000L; protected String getConfigResources() { return "vm/vm-queue-test.xml"; } public void testSingleMessage() throws Exception { MuleClient client = new MuleClient(); client.dispatch("queue", "Marco", null); MuleMessage response = client.request("queue", WAIT); assertNotNull("Response is null", response); assertEquals("Marco", response.getPayload()); } public void testMultipleMessages() throws Exception { MuleClient client = new MuleClient(); Set polos = new HashSet(Arrays.asList(new String[]{"Marco", "Niccolo", "Maffeo"})); Iterator people = polos.iterator(); while (people.hasNext()) { client.dispatch("queue", people.next(), null); } for (int i = 0; i < 3; ++i) { MuleMessage response = client.request("queue", WAIT); assertNotNull("Response is null", response); String person = (String) response.getPayload(); assertTrue(person, polos.contains(person)); polos.remove(person); } } public void testPassThrough() throws Exception { MuleClient client = new MuleClient(); Set polos = new HashSet(Arrays.asList(new String[]{"Marco", "Niccolo", "Maffeo"})); Iterator people = polos.iterator(); while (people.hasNext()) { client.dispatch("vm://entry?connector=vm-normal", people.next(), null); } for (int i = 0; i < 3; ++i) { MuleMessage response = client.request("queue", WAIT); assertNotNull("Response is null", response); String person = (String) response.getPayload(); String name = new StringTokenizer(person).nextToken(); assertTrue(name, polos.contains(name)); polos.remove(name); } } public void testNamedEndpoint() throws Exception { MuleClient client = new MuleClient(); Set polos = new HashSet(Arrays.asList(new String[]{"Marco", "Niccolo", "Maffeo"})); Iterator people = polos.iterator(); while (people.hasNext()) { client.dispatch("entry", people.next(), null); } for (int i = 0; i < 3; ++i) { MuleMessage response = client.request("queue", WAIT); assertNotNull("Response is null", response); String person = (String) response.getPayload(); String name = new StringTokenizer(person).nextToken(); assertTrue(name, polos.contains(name)); polos.remove(name); } } }mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/functional/0000755000175000017500000000000011351410640026174 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/functional/VMAttachmentsTestCase.java0000644000175000017500000000336710754375733033245 0ustar charlescharles/* * $Id: VMAttachmentsTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm.functional; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.io.File; import javax.activation.DataHandler; import javax.activation.FileDataSource; public class VMAttachmentsTestCase extends FunctionalTestCase { protected String getConfigResources() { return "vm/vm-attachments-test.xml"; } public void testAttachments() throws Exception { DefaultMuleMessage msg = new DefaultMuleMessage("Mmm... attachments!"); FileDataSource ds = new FileDataSource(new File("transports/vm/src/test/resources/" + getConfigResources()).getAbsoluteFile()); msg.addAttachment("test-attachment", new DataHandler(ds)); MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm-in", msg); assertNotNull(reply); if (reply.getExceptionPayload() != null) { fail(reply.getExceptionPayload().getException().getCause().toString()); } assertEquals(1, reply.getAttachmentNames().size()); assertNotNull(reply.getAttachment("mule")); assertTrue(reply.getAttachment("mule").getContentType().startsWith("image/gif")); } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/functional/AttachmentsComponent.java0000644000175000017500000000415010746275214033212 0ustar charlescharles/* * $Id:AttachmentsComponent.java 7555 2007-07-18 03:17:16Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm.functional; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.Callable; import java.io.File; import javax.activation.DataHandler; import javax.activation.FileDataSource; /** * A test service that reads inbound attachments and sends an attachment back. This class is only suitable * for the VMAttachementsTestCase. */ public class AttachmentsComponent implements Callable { public Object onCall(MuleEventContext eventContext) throws Exception { MuleMessage msg = eventContext.getMessage(); if (msg.getAttachmentNames().size() == 2) { throw new IllegalArgumentException("There shuold be 2 attachments"); } DataHandler dh = msg.getAttachment("test-attachment"); if (dh == null) { throw new IllegalArgumentException("test-attachment is not on the message"); } if (!dh.getContentType().startsWith("text/xml")) { throw new IllegalArgumentException("content type is not text/xml"); } if (!"Mmm... attachments!".equals(msg.getPayloadAsString())) { throw new IllegalArgumentException("payload is incorrect"); } //Lets return an image MuleMessage result = new DefaultMuleMessage("here is one for you!"); FileDataSource ds = new FileDataSource(new File("transports/vm/src/test/resources/test.gif").getAbsoluteFile()); result.addAttachment("mule", new DataHandler(ds)); return result; } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/functional/VMRequestorTestCase.java0000644000175000017500000000305411000777766032751 0ustar charlescharles/* * $Id: VMRequestorTestCase.java 11576 2008-04-15 01:08:06Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm.functional; import org.mule.tck.FunctionalTestCase; import org.mule.module.client.MuleClient; import org.mule.api.MuleMessage; import org.mule.api.MuleException; public class VMRequestorTestCase extends FunctionalTestCase { protected String getConfigResources() { return "vm/vm-functional-test.xml"; } public void testRequestorWithUpdateonMessage() throws Exception { final MuleClient client = new MuleClient(); Thread t = new Thread(new Runnable() { public void run() { try { client.send("vm://in", "test", null); } catch (MuleException e) { fail("failed to dispatch event: " + e); e.printStackTrace(); } } }, "test-thread"); t.start(); MuleMessage result = client.request("vm://out", 3000L); assertNotNull(result); //This would fail if the owner thread info was not updated result.setProperty("foo", "bar"); } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/functional/VmTransactionTestCase.java0000644000175000017500000000451610754375733033314 0ustar charlescharles/* * $Id: VmTransactionTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm.functional; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transaction.TransactionCoordination; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class VmTransactionTestCase extends FunctionalTestCase { protected static volatile boolean success = true; protected static final Log logger = LogFactory.getLog(VmTransactionTestCase.class); protected String getConfigResources() { return "vm/vm-transaction.xml"; } public void testTransactionQueueEventsTrue() throws Exception { success = true; MuleClient client = new MuleClient(); client.dispatch("vm://in?connector=vm", "TEST", null); MuleMessage message = client.request("vm://out?connector=vm", 10000); assertNotNull(message); assertTrue(success); } public void testTransactionSyncEndpoint() throws Exception { success = true; MuleClient client = new MuleClient(); MuleMessage message = client.send("vm://sync?connector=vm", "TEST", null); assertNotNull(message); assertTrue(success); } public void testTransactionQueueEventsFalse() throws Exception { success = true; MuleClient client = new MuleClient(); client.dispatch("vm://int3?connector=vmOnFly", "TEST", null); MuleMessage message = client.request("vm://outt3?connector=vm", 10000); assertNotNull(message); assertTrue(success); } public static class TestComponent { public Object process(Object a) throws Exception { if (TransactionCoordination.getInstance().getTransaction() == null) { success = false; logger.error("Transction is null"); } return a; } } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/VMConnectorTestCase.java0000644000175000017500000000206610754365306030550 0ustar charlescharles/* * $Id: VMConnectorTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.DefaultMuleMessage; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.vm.VMConnector; public class VMConnectorTestCase extends AbstractConnectorTestCase { public Connector createConnector() throws Exception { VMConnector conn = new VMConnector(); conn.setName("TestVM"); return conn; } public String getTestEndpointURI() { return "vm://test.queue"; } public Object getValidMessage() throws Exception { return new DefaultMuleMessage("TestMessage"); } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/TransformerAttributeTestCase.java0000644000175000017500000000327710754375733032553 0ustar charlescharles/* * $Id: TransformerAttributeTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.tck.functional.StringAppendTestTransformer; public class TransformerAttributeTestCase extends FunctionalTestCase { public static final String OUTBOUND_MESSAGE = "Test message"; protected String getConfigResources() { return "vm/transformer-attribute-test.xml"; } public void testSimple() throws Exception { MuleMessage message = new MuleClient().send("vm://simple", OUTBOUND_MESSAGE, null); assertNotNull(message); assertEquals( FunctionalTestComponent.received( StringAppendTestTransformer.appendDefault(OUTBOUND_MESSAGE)), message.getPayloadAsString()); } public void testThrough() throws Exception { MuleMessage message = new MuleClient().send("vm://chained", OUTBOUND_MESSAGE, null); assertNotNull(message); assertEquals( FunctionalTestComponent.received( StringAppendTestTransformer.appendDefault(OUTBOUND_MESSAGE)), message.getPayloadAsString()); } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/VMEndpointTestCase.java0000644000175000017500000000222610745677442030403 0ustar charlescharles/* * $Id: VMEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.vm.VMConnector; public class VMEndpointTestCase extends AbstractMuleTestCase { public void testUrlWithProvider() throws Exception { EndpointURI url = new MuleEndpointURI("vm://some.queue?endpointName=vmProvider"); url.initialise(); assertEquals(VMConnector.VM, url.getScheme()); assertEquals("some.queue", url.getAddress()); assertEquals("vmProvider", url.getEndpointName()); assertEquals("vm://some.queue?endpointName=vmProvider", url.toString()); assertEquals(1, url.getParams().size()); } } mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/VMSynchTestCase.java0000644000175000017500000000233610754375733027707 0ustar charlescharles/* * $Id: VMSynchTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; /** * Simple synch test used to study message flow. */ public class VMSynchTestCase extends FunctionalTestCase { protected String getConfigResources() { return "vm/vm-synch-test.xml"; } public void testSingleMessage() throws Exception { MuleClient client = new MuleClient(); MuleMessage response = client.send("vm://bridge", "Message", null); assertNotNull("Response is null", response); assertEquals("Message Received", response.getPayload()); } public void testManyMessage() throws Exception { for (int i = 0; i < 1000; i++) { testSingleMessage(); } } }mule-2.0.1/transports/vm/src/test/java/org/mule/transport/vm/PersistentVMQueueTestCase.java0000644000175000017500000000273510754375733031773 0ustar charlescharles/* * $Id: PersistentVMQueueTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.vm; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class PersistentVMQueueTestCase extends FunctionalTestCase { private static final int RECEIVE_TIMEOUT = 5000; protected String getConfigResources() { return "vm/persistent-vmqueue-test.xml"; } public void testAsynchronousDispatching() throws Exception { String input = "Test message"; String[] output = {"Test", "message"}; MuleClient client = new MuleClient(); client.dispatch("vm://receiver", input, null); MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT); assertNotNull(result); assertNotNull(result.getPayload()); assertNull(result.getExceptionPayload()); String[] payload = (String[]) result.getPayload(); assertEquals(output.length, payload.length); for (int i = 0; i < output.length; i++) { assertEquals(output[i], payload[i]); } } } mule-2.0.1/transports/vm/src/test/resources/0000755000175000017500000000000011351410640020714 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/resources/log4j.properties0000644000175000017500000000125710726003051024055 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages #log4j.logger.org.mule=DEBUG # this gives useful info when trying to configure filter #log4j.logger.org.mule.routing.filters.xml.JXPathFilter=DEBUG # this gives useful info for debugging routers #log4j.logger.org.mule.routing.outbound=DEBUG # show iteration counts log4j.logger.org.mule.issues.MulticastRouterMule2136TestCase=INFO log4j.logger.org.mule.issues.ManySendsMule1758TestCase=INFO mule-2.0.1/transports/vm/src/test/resources/vm/0000755000175000017500000000000011351410640021336 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/resources/vm/vm-queue-test.xml0000644000175000017500000000263210745174725024625 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/vm/vm-namespace-config.xml0000644000175000017500000000177410702741745025724 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/vm/vm-synch-test.xml0000644000175000017500000000306511000777766024625 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/vm/transformer-attribute-test.xml0000644000175000017500000000361310745174725027424 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/vm/persistent-vmqueue-test.xml0000644000175000017500000000341610754365306026744 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/vm/vm-functional-test.xml0000644000175000017500000000272411000777766025644 0ustar charlescharles Polo mule-2.0.1/transports/vm/src/test/resources/vm/test.gif0000644000175000017500000000031710654147142023016 0ustar charlescharlesGIF89a*|~Η0XpN>tA9CGOs+ج!,|I8kl_@4DJ,l Ѡ*e|q8HH ET8(`"B`A`iM0[!KǸ|NianVXp\ KXDNNRmKcEXcJn#;mule-2.0.1/transports/vm/src/test/resources/vm/vm-attachments-test.xml0000644000175000017500000000174610745677442026025 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/vm/vm-transaction.xml0000644000175000017500000000604010747501743025042 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/issues/0000755000175000017500000000000011351410640022227 5ustar charlescharlesmule-2.0.1/transports/vm/src/test/resources/issues/response-transformer-mule-2165-test.xml0000644000175000017500000001515410754403514031475 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/issues/property-scribbling-mule-893-test.xml0000644000175000017500000000344410757025234031226 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/issues/transformer-chain-mule-2063-test.xml0000644000175000017500000000557310757365472030737 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/issues/endpoint-transformer-mule-2131-test.xml0000644000175000017500000000440710745174725031460 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/issues/custom-filter-mule-2437-test.xml0000644000175000017500000000361110745174725030102 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/issues/bridge-mule-2540-test.xml0000644000175000017500000000370710754365306026537 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/issues/service-overrides-mule-1770-test.xml0000644000175000017500000000175210745677442030754 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/issues/multicast-router-mule-2112-test.xml0000644000175000017500000000406110757365472030622 0ustar charlescharles mule-2.0.1/transports/vm/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000016710757614114025605 0ustar charlescharles# # Test cases listed in this file are not run. # # MULE-2905 org.mule.transport.vm.functional.VmTransactionTestCase mule-2.0.1/transports/vm/pom.xml0000644000175000017500000000463211006063605016460 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-vm VM Transport A Mule transport that enables event sending and receiving over VM or embedded memory queues. These queues can be persistent or transient. org.mule mule-core ${version} javax.activation activation org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test xmlunit xmlunit 1.1 test osgi org.apache.felix maven-bundle-plugin org.mule.transport.vm.* mule-2.0.1/transports/jdbc/0000755000175000017500000000000011351410660015416 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/0000755000175000017500000000000011351410660016205 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/0000755000175000017500000000000011351410660017131 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/java/0000755000175000017500000000000011351410660020052 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/java/org/0000755000175000017500000000000011351410660020641 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/java/org/mule/0000755000175000017500000000000011351410660021603 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/0000755000175000017500000000000011351410660023637 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/0000755000175000017500000000000011351410660024541 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/package.html0000644000175000017500000000013310745677442027042 0ustar charlescharles Mule Provides jdbc transport. mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcMessageRequesterFactory.java0000644000175000017500000000206510757615756033034 0ustar charlescharles/* * $Id: JdbcMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; /** * Creates JdbcMessageDispatchers. */ public class JdbcMessageRequesterFactory extends AbstractMessageRequesterFactory { /* * (non-Javadoc) * * @see org.mule.api.transport.MessageDispatcherFactory#create(org.mule.api.transport.Connector) */ public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new JdbcMessageRequester(endpoint); } }mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcMessageReceiver.java0000644000175000017500000001312110757615756031264 0ustar charlescharles/* * $Id: JdbcMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import org.mule.transaction.TransactionCoordination; import org.mule.transport.ConnectException; import org.mule.transport.TransactedPollingMessageReceiver; import org.mule.util.ArrayUtils; import java.sql.Connection; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; /** TODO */ public class JdbcMessageReceiver extends TransactedPollingMessageReceiver { protected JdbcConnector connector; protected String readStmt; protected String ackStmt; protected List readParams; protected List ackParams; public JdbcMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint, String readStmt, String ackStmt) throws CreateException { super(connector, service, endpoint); this.setFrequency(((JdbcConnector) connector).getPollingFrequency()); this.setReceiveMessagesInTransaction(false); this.connector = (JdbcConnector) connector; this.readParams = new ArrayList(); this.readStmt = this.connector.parseStatement(readStmt, this.readParams); this.ackParams = new ArrayList(); this.ackStmt = this.connector.parseStatement(ackStmt, this.ackParams); } protected void doDispose() { // template method } protected void doConnect() throws Exception { Connection con = null; try { con = this.connector.getConnection(); } catch (Exception e) { throw new ConnectException(e, this); } finally { JdbcUtils.close(con); } } protected void doDisconnect() throws ConnectException { // noop } public void processMessage(Object message) throws Exception { Connection con = null; Transaction tx = TransactionCoordination.getInstance().getTransaction(); try { con = this.connector.getConnection(); MessageAdapter msgAdapter = this.connector.getMessageAdapter(message); MuleMessage umoMessage = new DefaultMuleMessage(msgAdapter); if (this.ackStmt != null) { Object[] ackParams = connector.getParams(endpoint, this.ackParams, umoMessage, this.endpoint.getEndpointURI().getAddress()); if (logger.isDebugEnabled()) { logger.debug("SQL UPDATE: " + ackStmt + ", params = " + ArrayUtils.toString(ackParams)); } int nbRows = connector.getQueryRunner().update(con, this.ackStmt, ackParams); if (nbRows != 1) { logger.warn("Row count for ack should be 1 and not " + nbRows); } } routeMessage(umoMessage, tx, tx != null || endpoint.isSynchronous()); } catch (Exception ex) { if (tx != null) { tx.setRollbackOnly(); } // rethrow throw ex; } finally { if (endpoint.getMuleContext().getTransactionManager() != null || tx == null) { // We are running in an XA transaction. // This call is required here for compatibility with strict XA // DataSources // implementations, as is the case for WebSphere AS and Weblogic. // Failure to do it here may result in a connection leak. // The close() call will NOT close the connection, neither will it // return it to the pool. // It will notify the XA driver's ConnectionEventListener that the XA // connection // is no longer used by the application and is ready for the 2PC // commit. JdbcUtils.close(con); } } } public List getMessages() throws Exception { Connection con = null; try { try { con = this.connector.getConnection(); } catch (SQLException e) { throw new ConnectException(e, this); } Object[] readParams = connector.getParams(endpoint, this.readParams, null, this.endpoint.getEndpointURI().getAddress()); if (logger.isDebugEnabled()) { logger.debug("SQL QUERY: " + readStmt + ", params = " + ArrayUtils.toString(readParams)); } Object results = connector.getQueryRunner().query(con, this.readStmt, readParams, connector.getResultSetHandler()); return (List) results; } finally { JdbcUtils.close(con); } } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcEndpointURIBuilder.java0000644000175000017500000000320010745677442031654 0ustar charlescharles/* * $Id: JdbcEndpointURIBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.endpoint.AbstractEndpointURIBuilder; import java.net.URI; import java.util.Properties; /** * Parses a JDBC style endpoint to a MuleEndpointURI */ public class JdbcEndpointURIBuilder extends AbstractEndpointURIBuilder { protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException { if (uri.getHost() != null && !"localhost".equals(uri.getHost())) { endpointName = uri.getHost(); } int i = uri.getPath().indexOf("/", 1); if (i > 0) { endpointName = uri.getPath().substring(1, i); address = uri.getPath().substring(i + 1); } else if (uri.getPath() != null && uri.getPath().length() != 0) { address = uri.getPath().substring(1); } else { address = uri.getAuthority(); } // JDBC endpoints can just have a param string, hence te address is left // null, but the address // should always be a non-null value if (address == null) { address = uri.getScheme(); } } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcTransactionFactory.java0000644000175000017500000000227410745677442032034 0ustar charlescharles/* * $Id: JdbcTransactionFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.MuleContext; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transaction.TransactionFactory; /** * TODO */ public class JdbcTransactionFactory implements TransactionFactory { /* * (non-Javadoc) * * @see org.mule.api.TransactionFactory#beginTransaction() */ public Transaction beginTransaction(MuleContext muleContext) throws TransactionException { JdbcTransaction tx = new JdbcTransaction(); tx.begin(); return tx; } /* * (non-Javadoc) * * @see org.mule.api.TransactionFactory#isTransacted() */ public boolean isTransacted() { return true; } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcConnector.java0000644000175000017500000002543711004106214030124 0ustar charlescharles/* * $Id: JdbcConnector.java 11638 2008-04-24 13:35:08Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transport.MessageReceiver; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.MessageFactory; import org.mule.transaction.TransactionCoordination; import org.mule.transport.AbstractConnector; import org.mule.util.expression.ExpressionEvaluatorManager; import java.sql.Connection; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.sql.DataSource; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.ResultSetHandler; import org.apache.commons.dbutils.handlers.MapListHandler; public class JdbcConnector extends AbstractConnector { public static final String JDBC = "jdbc"; // These are properties that can be overridden on the Receiver by the endpoint // declaration public static final String PROPERTY_POLLING_FREQUENCY = "pollingFrequency"; public static final long DEFAULT_POLLING_FREQUENCY = 1000; private static final Pattern STATEMENT_ARGS = Pattern.compile("\\$\\{[^\\}]*\\}"); /* Register the SQL Exception reader if this class gets loaded */ static { ExceptionHelper.registerExceptionReader(new SQLExceptionReader()); } protected long pollingFrequency = 0; protected Map queries; private DataSource dataSource; private ResultSetHandler resultSetHandler; private QueryRunner queryRunner; protected void doInitialise() throws InitialisationException { if (dataSource == null) { throw new InitialisationException(MessageFactory.createStaticMessage("Missing data source"), this); } if (resultSetHandler == null) { resultSetHandler = new MapListHandler(); } if (queryRunner == null) { queryRunner = new QueryRunner(); } } public MessageReceiver createReceiver(Service service, InboundEndpoint endpoint) throws Exception { Map props = endpoint.getProperties(); if (props != null) { String tempPolling = (String) props.get(PROPERTY_POLLING_FREQUENCY); if (tempPolling != null) { pollingFrequency = Long.parseLong(tempPolling); } } if (pollingFrequency <= 0) { pollingFrequency = DEFAULT_POLLING_FREQUENCY; } String[] params = getReadAndAckStatements(endpoint); return getServiceDescriptor().createMessageReceiver(this, service, endpoint, params); } public String[] getReadAndAckStatements(ImmutableEndpoint endpoint) { String str; // Find read statement String readStmt; if ((str = (String)endpoint.getProperty("sql")) != null) { readStmt = str; } else { readStmt = endpoint.getEndpointURI().getAddress(); } // Find ack statement String ackStmt; if ((str = (String)endpoint.getProperty("ack")) != null) { ackStmt = str; if ((str = getQuery(endpoint, ackStmt)) != null) { ackStmt = str; } ackStmt = ackStmt.trim(); } else { ackStmt = readStmt + ".ack"; if ((str = getQuery(endpoint, ackStmt)) != null) { ackStmt = str.trim(); } else { ackStmt = null; } } // Translate both using queries map if ((str = getQuery(endpoint, readStmt)) != null) { readStmt = str; } if (readStmt == null) { throw new IllegalArgumentException("Read statement should not be null"); } else { // MULE-3109: trim the readStatement for better user experience readStmt = readStmt.trim(); } if (!"select".equalsIgnoreCase(readStmt.substring(0, 6)) && !"call".equalsIgnoreCase(readStmt.substring(0, 4))) { throw new IllegalArgumentException("Read statement should be a select sql statement or a stored procedure"); } if (ackStmt != null) { if (!"insert".equalsIgnoreCase(ackStmt.substring(0, 6)) && !"update".equalsIgnoreCase(ackStmt.substring(0, 6)) && !"delete".equalsIgnoreCase(ackStmt.substring(0, 6))) { throw new IllegalArgumentException( "Ack statement should be an insert / update / delete sql statement"); } } return new String[]{readStmt, ackStmt}; } public String getQuery(ImmutableEndpoint endpoint, String stmt) { Object query = null; if (endpoint != null && endpoint.getProperties() != null) { Object queries = endpoint.getProperties().get("queries"); if (queries instanceof Map) { query = ((Map)queries).get(stmt); } } if (query == null) { if (this.queries != null) { query = this.queries.get(stmt); } } return query == null ? null : query.toString(); } public Connection getConnection() throws Exception { Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (tx != null) { if (tx.hasResource(dataSource)) { logger.debug("Retrieving connection from current transaction"); return (Connection)tx.getResource(dataSource); } } logger.debug("Retrieving new connection from data source"); Connection con = dataSource.getConnection(); if (tx != null) { logger.debug("Binding connection to current transaction"); try { tx.bindResource(dataSource, con); } catch (TransactionException e) { JdbcUtils.close(con); throw new RuntimeException("Could not bind connection to current transaction", e); } } return con; } /** * Parse the given statement filling the parameter list and return the ready to * use statement. * * @param stmt * @param params * @return */ public String parseStatement(String stmt, List params) { if (stmt == null) { return stmt; } Matcher m = STATEMENT_ARGS.matcher(stmt); StringBuffer sb = new StringBuffer(200); while (m.find()) { String key = m.group(); m.appendReplacement(sb, "?"); params.add(key); } m.appendTail(sb); return sb.toString(); } public Object[] getParams(ImmutableEndpoint endpoint, List paramNames, Object message, String query) throws Exception { Object[] params = new Object[paramNames.size()]; for (int i = 0; i < paramNames.size(); i++) { String param = (String)paramNames.get(i); String name = param.substring(2, param.length() - 1); Object value = null; // If we find a value and it happens to be null, thats acceptable boolean foundValue = false; //There must be an expression namespace to use the ExpresionEvaluator i.e. header:type if (message != null && ExpressionEvaluatorManager.isValidExpression(name)) { value = ExpressionEvaluatorManager.evaluate(name, message); foundValue = value!=null; } if (!foundValue) { value = endpoint.getProperty(name); } // Allow null values which may be acceptable to the user // Why shouldn't nulls be allowed? Otherwise every null parameter has to // be defined // if (value == null && !foundValue) // { // throw new IllegalArgumentException("Can not retrieve argument " + // name); // } params[i] = value; } return params; } protected void doDispose() { // template method } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } protected void doStart() throws MuleException { // template method } protected void doStop() throws MuleException { // template method } ////////////////////////////////////////////////////////////////////////////////////// // Getters and Setters ////////////////////////////////////////////////////////////////////////////////////// public String getProtocol() { return JDBC; } public DataSource getDataSource() { return dataSource; } public void setDataSource(DataSource dataSource) { this.dataSource = dataSource; } public ResultSetHandler getResultSetHandler() { return resultSetHandler; } public void setResultSetHandler(ResultSetHandler resultSetHandler) { this.resultSetHandler = resultSetHandler; } public QueryRunner getQueryRunner() { return queryRunner; } public void setQueryRunner(QueryRunner queryRunner) { this.queryRunner = queryRunner; } /** * @return Returns the pollingFrequency. */ public long getPollingFrequency() { return pollingFrequency; } /** * @param pollingFrequency The pollingFrequency to set. */ public void setPollingFrequency(long pollingFrequency) { this.pollingFrequency = pollingFrequency; } /** * @return Returns the queries. */ public Map getQueries() { return queries; } /** * @param queries The queries to set. */ public void setQueries(Map queries) { this.queries = queries; } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/i18n/0000755000175000017500000000000011351410660025320 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/i18n/JdbcMessages.java0000644000175000017500000000161510745677442030543 0ustar charlescharles/* * $Id: JdbcMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class JdbcMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("jdbc"); public static Message transactionSetAutoCommitFailed() { return createMessage(BUNDLE_PATH, 1); } public static Message jndiResourceNotFound(String name) { return createMessage(BUNDLE_PATH, 2, name); } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/config/0000755000175000017500000000000011351410660026006 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/config/JdbcNamespaceHandler.java0000644000175000017500000000451510745726444032653 0ustar charlescharles/* * $Id: JdbcNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser; import org.mule.config.spring.parsers.delegate.ParentContextDefinitionParser; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.mule.config.spring.parsers.specific.ObjectFactoryWrapper; import org.mule.config.spring.parsers.specific.TransactionDefinitionParser; import org.mule.config.spring.parsers.specific.properties.NestedMapDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.jdbc.JdbcConnector; import org.mule.transport.jdbc.JdbcTransactionFactory; /** Registers Bean Definition Parsers for the "jdbc" namespace. */ public class JdbcNamespaceHandler extends AbstractMuleNamespaceHandler { public static final String QUERY_KEY = "queryKey"; public static final String[] ADDRESS_ATTRIBUTES = new String[]{QUERY_KEY}; public void init() { registerStandardTransportEndpoints(JdbcConnector.JDBC, ADDRESS_ATTRIBUTES).addAlias(QUERY_KEY, URIBuilder.PATH); registerConnectorDefinitionParser(JdbcConnector.class); registerBeanDefinitionParser("dataSource", new ObjectFactoryWrapper("dataSourceFactory")); MuleDefinitionParser connectorQuery = new ChildSingletonMapDefinitionParser("query"); MuleDefinitionParser endpointQuery = new NestedMapDefinitionParser("properties", "queries"); endpointQuery.addCollection("properties"); registerMuleBeanDefinitionParser("query", new ParentContextDefinitionParser("connector", connectorQuery).otherwise(endpointQuery)); registerBeanDefinitionParser("extractors", new ParentDefinitionParser()); registerBeanDefinitionParser("transaction", new TransactionDefinitionParser(JdbcTransactionFactory.class)); } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcTransaction.java0000644000175000017500000000474210745677442030506 0ustar charlescharles/* * $Id: JdbcTransaction.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.CoreMessages; import org.mule.transaction.AbstractSingleResourceTransaction; import org.mule.transaction.IllegalTransactionStateException; import org.mule.transaction.TransactionRollbackException; import org.mule.transport.jdbc.i18n.JdbcMessages; import java.sql.Connection; import java.sql.SQLException; import javax.sql.DataSource; /** * TODO */ public class JdbcTransaction extends AbstractSingleResourceTransaction { public JdbcTransaction() { super(); } public void bindResource(Object key, Object resource) throws TransactionException { if (!(key instanceof DataSource) || !(resource instanceof Connection)) { throw new IllegalTransactionStateException( CoreMessages.transactionCanOnlyBindToResources("javax.sql.DataSource/java.sql.Connection")); } Connection con = (Connection)resource; try { if (con.getAutoCommit()) { con.setAutoCommit(false); } } catch (SQLException e) { throw new TransactionException(JdbcMessages.transactionSetAutoCommitFailed(), e); } super.bindResource(key, resource); } protected void doBegin() throws TransactionException { // Do nothing } protected void doCommit() throws TransactionException { try { ((Connection)resource).commit(); ((Connection)resource).close(); } catch (SQLException e) { throw new TransactionException(CoreMessages.transactionCommitFailed(), e); } } protected void doRollback() throws TransactionException { try { ((Connection)resource).rollback(); ((Connection)resource).close(); } catch (SQLException e) { throw new TransactionRollbackException(CoreMessages.transactionRollbackFailed(), e); } } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/xa/0000755000175000017500000000000011351410660025151 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/xa/StatementInvocationHandler.java0000644000175000017500000000301510745677442033332 0ustar charlescharles/* * $Id: StatementInvocationHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.xa; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.sql.Statement; public class StatementInvocationHandler implements InvocationHandler { private Statement statement; private ConnectionWrapper connectionWrapper; public StatementInvocationHandler(ConnectionWrapper connectionWrapper, Statement statement) { this.connectionWrapper = connectionWrapper; this.statement = statement; } /* * (non-Javadoc) * * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, * java.lang.reflect.Method, java.lang.Object[]) */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getName().startsWith("execute")) { connectionWrapper.enlist(); } try { return method.invoke(statement, args); } catch (InvocationTargetException ex) { throw ex.getCause(); } } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/xa/ConnectionWrapper.java0000644000175000017500000003663610747501743031505 0ustar charlescharles/* * $Id: ConnectionWrapper.java 10590 2008-01-29 01:39:47Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.xa; import org.mule.api.transaction.Transaction; import org.mule.config.i18n.CoreMessages; import org.mule.transaction.IllegalTransactionStateException; import org.mule.transaction.TransactionCoordination; import org.mule.transaction.XaTransaction; import java.lang.reflect.Proxy; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.Savepoint; import java.sql.Statement; import java.util.Map; import javax.sql.XAConnection; import javax.transaction.xa.XAResource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Using for unification XAConnection and Connection */ public class ConnectionWrapper implements Connection, XaTransaction.MuleXaObject { private final XAConnection xaConnection; private Connection connection; private volatile boolean enlisted = false; protected static final transient Log logger = LogFactory.getLog(ConnectionWrapper.class); private volatile boolean reuseObject = false; public ConnectionWrapper(XAConnection xaCon) throws SQLException { this.xaConnection = xaCon; this.connection = xaCon.getConnection(); } /* * (non-Javadoc) * * @see java.sql.Connection#getHoldability() */ public int getHoldability() throws SQLException { return connection.getHoldability(); } /* * (non-Javadoc) * * @see java.sql.Connection#getTransactionIsolation() */ public int getTransactionIsolation() throws SQLException { return connection.getTransactionIsolation(); } /* * (non-Javadoc) * * @see java.sql.Connection#clearWarnings() */ public void clearWarnings() throws SQLException { connection.clearWarnings(); } /* * (non-Javadoc) * * @see java.sql.Connection#close() */ public void close() throws SQLException { connection.close(); } /* * (non-Javadoc) * * @see java.sql.Connection#commit() */ public void commit() throws SQLException { connection.commit(); } /* * (non-Javadoc) * * @see java.sql.Connection#rollback() */ public void rollback() throws SQLException { connection.rollback(); } /* * (non-Javadoc) * * @see java.sql.Connection#getAutoCommit() */ public boolean getAutoCommit() throws SQLException { return connection.getAutoCommit(); } /* * (non-Javadoc) * * @see java.sql.Connection#isClosed() */ public boolean isClosed() throws SQLException { return connection.isClosed(); } /* * (non-Javadoc) * * @see java.sql.Connection#isReadOnly() */ public boolean isReadOnly() throws SQLException { return connection.isReadOnly(); } /* * (non-Javadoc) * * @see java.sql.Connection#setHoldability(int) */ public void setHoldability(int holdability) throws SQLException { connection.setHoldability(holdability); } /* * (non-Javadoc) * * @see java.sql.Connection#setTransactionIsolation(int) */ public void setTransactionIsolation(int level) throws SQLException { connection.setTransactionIsolation(level); } /* * (non-Javadoc) * * @see java.sql.Connection#setAutoCommit(boolean) */ public void setAutoCommit(boolean autoCommit) throws SQLException { connection.setAutoCommit(autoCommit); } /* * (non-Javadoc) * * @see java.sql.Connection#setReadOnly(boolean) */ public void setReadOnly(boolean readOnly) throws SQLException { connection.setReadOnly(readOnly); } /* * (non-Javadoc) * * @see java.sql.Connection#getCatalog() */ public String getCatalog() throws SQLException { return connection.getCatalog(); } /* * (non-Javadoc) * * @see java.sql.Connection#setCatalog(java.lang.String) */ public void setCatalog(String catalog) throws SQLException { connection.setCatalog(catalog); } /* * (non-Javadoc) * * @see java.sql.Connection#getMetaData() */ public DatabaseMetaData getMetaData() throws SQLException { return connection.getMetaData(); } /* * (non-Javadoc) * * @see java.sql.Connection#getWarnings() */ public SQLWarning getWarnings() throws SQLException { return connection.getWarnings(); } /* * (non-Javadoc) * * @see java.sql.Connection#setSavepoint() */ public Savepoint setSavepoint() throws SQLException { return connection.setSavepoint(); } /* * (non-Javadoc) * * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint) */ public void releaseSavepoint(Savepoint savepoint) throws SQLException { connection.releaseSavepoint(savepoint); } /* * (non-Javadoc) * * @see java.sql.Connection#rollback(java.sql.Savepoint) */ public void rollback(Savepoint savepoint) throws SQLException { connection.rollback(); } /* * (non-Javadoc) * * @see java.sql.Connection#createStatement() */ public Statement createStatement() throws SQLException { Statement st = connection.createStatement(); return (Statement) Proxy.newProxyInstance(Statement.class.getClassLoader(), new Class[]{Statement.class}, new StatementInvocationHandler(this, st)); } /* * (non-Javadoc) * * @see java.sql.Connection#createStatement(int, int) */ public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { Statement st = connection.createStatement(resultSetType, resultSetConcurrency); return (Statement) Proxy.newProxyInstance(Statement.class.getClassLoader(), new Class[]{Statement.class}, new StatementInvocationHandler(this, st)); } /* * (non-Javadoc) * * @see java.sql.Connection#createStatement(int, int, int) */ public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { Statement st = connection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); return (Statement) Proxy.newProxyInstance(Statement.class.getClassLoader(), new Class[]{Statement.class}, new StatementInvocationHandler(this, st)); } /* * (non-Javadoc) * * @see java.sql.Connection#getTypeMap() */ public Map getTypeMap() throws SQLException { return connection.getTypeMap(); } /* * (non-Javadoc) * * @see java.sql.Connection#setTypeMap(java.util.Map) */ public void setTypeMap(Map map) throws SQLException { connection.setTypeMap(map); } /* * (non-Javadoc) * * @see java.sql.Connection#nativeSQL(java.lang.String) */ public String nativeSQL(String sql) throws SQLException { return connection.nativeSQL(sql); } /* * (non-Javadoc) * * @see java.sql.Connection#prepareCall(java.lang.String) */ public CallableStatement prepareCall(String sql) throws SQLException { CallableStatement cs = connection.prepareCall(sql); return (CallableStatement) Proxy.newProxyInstance(CallableStatement.class.getClassLoader(), new Class[]{CallableStatement.class}, new StatementInvocationHandler(this, cs)); } /* * (non-Javadoc) * * @see java.sql.Connection#prepareCall(java.lang.String, int, int) */ public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { CallableStatement cs = connection.prepareCall(sql, resultSetType, resultSetConcurrency); return (CallableStatement) Proxy.newProxyInstance(CallableStatement.class.getClassLoader(), new Class[]{CallableStatement.class}, new StatementInvocationHandler(this, cs)); } /* * (non-Javadoc) * * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int) */ public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { CallableStatement cs = connection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); return (CallableStatement) Proxy.newProxyInstance(CallableStatement.class.getClassLoader(), new Class[]{CallableStatement.class}, new StatementInvocationHandler(this, cs)); } /* * (non-Javadoc) * * @see java.sql.Connection#prepareStatement(java.lang.String) */ public PreparedStatement prepareStatement(String sql) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql); return (PreparedStatement) Proxy.newProxyInstance(PreparedStatement.class.getClassLoader(), new Class[]{PreparedStatement.class}, new StatementInvocationHandler(this, ps)); } /* * (non-Javadoc) * * @see java.sql.Connection#prepareStatement(java.lang.String, int) */ public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql, autoGeneratedKeys); return (PreparedStatement) Proxy.newProxyInstance(PreparedStatement.class.getClassLoader(), new Class[]{PreparedStatement.class}, new StatementInvocationHandler(this, ps)); } /* * (non-Javadoc) * * @see java.sql.Connection#prepareStatement(java.lang.String, int, int) */ public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql, resultSetType, resultSetConcurrency); return (PreparedStatement) Proxy.newProxyInstance(PreparedStatement.class.getClassLoader(), new Class[]{PreparedStatement.class}, new StatementInvocationHandler(this, ps)); } /* * (non-Javadoc) * * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int) */ public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); return (PreparedStatement) Proxy.newProxyInstance(PreparedStatement.class.getClassLoader(), new Class[]{PreparedStatement.class}, new StatementInvocationHandler(this, ps)); } /* * (non-Javadoc) * * @see java.sql.Connection#prepareStatement(java.lang.String, int[]) */ public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql, columnIndexes); return (PreparedStatement) Proxy.newProxyInstance(PreparedStatement.class.getClassLoader(), new Class[]{PreparedStatement.class}, new StatementInvocationHandler(this, ps)); } /* * (non-Javadoc) * * @see java.sql.Connection#setSavepoint(java.lang.String) */ public Savepoint setSavepoint(String name) throws SQLException { return connection.setSavepoint(name); } /* * (non-Javadoc) * * @see java.sql.Connection#prepareStatement(java.lang.String, * java.lang.String[]) */ public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { PreparedStatement ps = connection.prepareStatement(sql, columnNames); return (PreparedStatement) Proxy.newProxyInstance(PreparedStatement.class.getClassLoader(), new Class[]{PreparedStatement.class}, new StatementInvocationHandler(this, ps)); } protected void enlist() throws Exception { if (isEnlisted()) { return; } if (logger.isDebugEnabled()) { logger.debug("Enlistment request: " + this); } Transaction transaction = TransactionCoordination.getInstance().getTransaction(); if (transaction == null) { throw new IllegalTransactionStateException(CoreMessages.noMuleTransactionAvailable()); } if (!(transaction instanceof XaTransaction)) { throw new IllegalTransactionStateException(CoreMessages.notMuleXaTransaction(transaction)); } if (!isEnlisted()) { enlisted = ((XaTransaction) transaction).enlistResource(xaConnection.getXAResource()); } } public boolean delist() throws Exception { if (!isEnlisted()) { return false; } if (logger.isDebugEnabled()) { logger.debug("Delistment request: " + this); } Transaction transaction = TransactionCoordination.getInstance().getTransaction(); if (transaction == null) { throw new IllegalTransactionStateException(CoreMessages.noMuleTransactionAvailable()); } if (!(transaction instanceof XaTransaction)) { throw new IllegalTransactionStateException(CoreMessages.notMuleXaTransaction(transaction)); } if (isEnlisted()) { enlisted = !((XaTransaction) transaction).delistResource(xaConnection.getXAResource(), XAResource.TMSUCCESS); } return !isEnlisted(); } public boolean isEnlisted() { return enlisted; } public void setEnlisted(boolean enlisted) { this.enlisted = enlisted; } public boolean isReuseObject() { return reuseObject; } public void setReuseObject(boolean reuseObject) { this.reuseObject = reuseObject; } public Object getTargetObject() { return xaConnection; } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/xa/DataSourceWrapper.java0000644000175000017500000000555110745677442031440 0ustar charlescharles/* * $Id: DataSourceWrapper.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.xa; import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; import javax.sql.DataSource; import javax.sql.XADataSource; import javax.transaction.TransactionManager; /** * Using for unification XADataSource and DataSource */ public class DataSourceWrapper implements DataSource { private XADataSource xaDataSource; public DataSourceWrapper() { super(); } public DataSourceWrapper(XADataSource xaDataSource, TransactionManager tm) { this.xaDataSource = xaDataSource; } /* * (non-Javadoc) * * @see javax.sql.DataSource#getLoginTimeout() */ public int getLoginTimeout() throws SQLException { return xaDataSource.getLoginTimeout(); } /* * (non-Javadoc) * * @see javax.sql.DataSource#setLoginTimeout(int) */ public void setLoginTimeout(int seconds) throws SQLException { xaDataSource.setLoginTimeout(seconds); } /* * (non-Javadoc) * * @see javax.sql.DataSource#getLogWriter() */ public PrintWriter getLogWriter() throws SQLException { return xaDataSource.getLogWriter(); } /* * (non-Javadoc) * * @see javax.sql.DataSource#setLogWriter(java.io.PrintWriter) */ public void setLogWriter(PrintWriter out) throws SQLException { xaDataSource.setLogWriter(out); } /* * (non-Javadoc) * * @see javax.sql.DataSource#getConnection() */ public Connection getConnection() throws SQLException { final Connection connWrapper = new ConnectionWrapper(xaDataSource.getXAConnection()); connWrapper.setAutoCommit(false); return connWrapper; } /* * (non-Javadoc) * * @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String) */ public Connection getConnection(String username, String password) throws SQLException { final Connection connWrapper = new ConnectionWrapper(xaDataSource.getXAConnection(username, password)); connWrapper.setAutoCommit(false); return connWrapper; } /** * @return Returns the underlying XADataSource. */ public XADataSource getXaDataSource() { return xaDataSource; } /** * @param xads The XADataSource to set. */ public void setXaDataSource(XADataSource xads) { this.xaDataSource = xads; } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcMessageRequester.java0000644000175000017500000000514410757615756031505 0ustar charlescharles/* * $Id: JdbcMessageRequester.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.transport.AbstractMessageRequester; public class JdbcMessageRequester extends AbstractMessageRequester { private JdbcConnector connector; public JdbcMessageRequester(InboundEndpoint endpoint) { super(endpoint); this.connector = (JdbcConnector) endpoint.getConnector(); } /* * (non-Javadoc) * * @see org.mule.transport.AbstractMessageDispatcher#doDispose() */ protected void doDispose() { // template method } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was available * @throws Exception if the call to the underlying protocol causes an exception */ protected MuleMessage doRequest(long timeout) throws Exception { return doRequest(timeout, null); } /** * Make a specific request to the underlying transport * Special case: The event is need when doReceive was called from doSend * @param timeout only for compatibility with doRequest(long timeout) * @param event There is a need to get params from message * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was available * @throws Exception if the call to the underlying protocol causes an exception */ protected MuleMessage doRequest(long timeout, MuleEvent event) throws Exception { return JdbcMessageDispatcher.executeRequest(timeout, event, connector, endpoint); } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } }mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcMessageDispatcherFactory.java0000644000175000017500000000210010757615756033131 0ustar charlescharles/* * $Id: JdbcMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * Creates JdbcMessageDispatchers. */ public class JdbcMessageDispatcherFactory extends AbstractMessageDispatcherFactory { /* * (non-Javadoc) * * @see org.mule.api.transport.MessageDispatcherFactory#create(org.mule.api.transport.Connector) */ public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new JdbcMessageDispatcher(endpoint); } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcMessageDispatcher.java0000644000175000017500000002260511004106214031557 0ustar charlescharles/* * $Id: JdbcMessageDispatcher.java 11638 2008-04-24 13:35:08Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transaction.Transaction; import org.mule.api.transport.MessageAdapter; import org.mule.transaction.TransactionCoordination; import org.mule.transport.AbstractMessageDispatcher; import org.mule.util.ArrayUtils; import org.mule.util.StringUtils; import java.sql.Connection; import java.util.ArrayList; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * The Jdbc Message dispatcher is responsible for executing SQL queries against a * database. */ public class JdbcMessageDispatcher extends AbstractMessageDispatcher { private static Log staticLogger = LogFactory.getLog(AbstractMessageDispatcher.class); private JdbcConnector connector; private static final String STORED_PROCEDURE_PREFIX = "{ "; private static final String STORED_PROCEDURE_SUFFIX = " }"; public JdbcMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (JdbcConnector) endpoint.getConnector(); } /* * (non-Javadoc) * * @see org.mule.transport.AbstractMessageDispatcher#doDispose() */ protected void doDispose() { // template method } protected void executeWriteStatement(MuleEvent event, String writeStmt) throws Exception { List paramNames = new ArrayList(); writeStmt = connector.parseStatement(writeStmt, paramNames); Object[] paramValues = connector.getParams(endpoint, paramNames, new DefaultMuleMessage( event.transformMessage()), this.endpoint.getEndpointURI().getAddress()); Transaction tx = TransactionCoordination.getInstance().getTransaction(); Connection con = null; try { con = this.connector.getConnection(); if ("call".equalsIgnoreCase(writeStmt.substring(0, 4))) { writeStmt = STORED_PROCEDURE_PREFIX + writeStmt + STORED_PROCEDURE_SUFFIX; } if (logger.isDebugEnabled()) { logger.debug("SQL UPDATE: " + writeStmt + ", params = " + ArrayUtils.toString(paramValues)); } int nbRows = connector.getQueryRunner().update(con, writeStmt, paramValues); if (nbRows != 1) { logger.warn("Row count for write should be 1 and not " + nbRows); } if (tx == null) { JdbcUtils.commitAndClose(con); } logger.debug("MuleEvent dispatched succesfuly"); } catch (Exception e) { logger.debug("Error dispatching event: " + e.getMessage(), e); if (tx == null) { JdbcUtils.rollbackAndClose(con); } throw e; } } protected String getStatement(ImmutableEndpoint endpoint) { String writeStmt = endpoint.getEndpointURI().getAddress(); String str; if ((str = this.connector.getQuery(endpoint, writeStmt)) != null) { writeStmt = str; } writeStmt = StringUtils.trimToEmpty(writeStmt); if (StringUtils.isBlank(writeStmt)) { throw new IllegalArgumentException("Missing statement"); } return writeStmt; } protected boolean isWriteStatement(String writeStmt) { if (!"insert".equalsIgnoreCase(writeStmt.substring(0, 6)) && !"update".equalsIgnoreCase(writeStmt.substring(0, 6)) && !"delete".equalsIgnoreCase(writeStmt.substring(0, 6)) && !"merge".equalsIgnoreCase(writeStmt.substring(0, 5)) && !"call".equalsIgnoreCase(writeStmt.substring(0, 4))) { return false; } return true; } /* * (non-Javadoc) * * @see org.mule.transport.AbstractMessageDispatcher#doDispatch(org.mule.api.MuleEvent) */ protected void doDispatch(MuleEvent event) throws Exception { if (logger.isDebugEnabled()) { logger.debug("Dispatch event: " + event); } String writeStmt = getStatement(event.getEndpoint()); if (!isWriteStatement(writeStmt)) { throw new IllegalArgumentException( "Write statement should be an insert / update / delete / merge sql statement, or a stored-procedure call"); } this.executeWriteStatement(event, writeStmt); } /* * (non-Javadoc) * * @see org.mule.transport.AbstractMessageDispatcher#doSend(org.mule.api.MuleEvent) */ protected MuleMessage doSend(MuleEvent event) throws Exception { String statement = getStatement(event.getEndpoint()); if (isWriteStatement(statement)) { executeWriteStatement(event, statement); return event.getMessage(); } return executeRequest(event.getTimeout(),event, connector, endpoint); } /** * This does work for both dispatcher and requester * * @param timeout * @param event * @param connector * @param endpoint * @return * @throws Exception */ protected static MuleMessage executeRequest(long timeout, MuleEvent event, JdbcConnector connector, ImmutableEndpoint endpoint) throws Exception { if (staticLogger.isDebugEnabled()) { staticLogger.debug("Trying to receive a message with a timeout of " + timeout); } String[] stmts = connector.getReadAndAckStatements(endpoint); String readStmt = stmts[0]; String ackStmt = stmts[1]; List readParams = new ArrayList(); List ackParams = new ArrayList(); readStmt = connector.parseStatement(readStmt, readParams); ackStmt = connector.parseStatement(ackStmt, ackParams); Connection con = null; long t0 = System.currentTimeMillis(); try { con = connector.getConnection(); if (timeout < 0) { timeout = Long.MAX_VALUE; } Object result; do { Object[] params = connector.getParams(endpoint, readParams, event!=null ? event.getMessage() : null, endpoint.getEndpointURI().getAddress()); if (staticLogger.isDebugEnabled()) { staticLogger.debug("SQL QUERY: " + readStmt + ", params = " + ArrayUtils.toString(params)); } result = connector.getQueryRunner().query(con, readStmt, params, connector.getResultSetHandler()); if (result != null) { if (staticLogger.isDebugEnabled()) { staticLogger.debug("Received: " + result); } break; } long sleep = Math.min(connector.getPollingFrequency(), timeout - (System.currentTimeMillis() - t0)); if (sleep > 0) { if (staticLogger.isDebugEnabled()) { staticLogger.debug("No results, sleeping for " + sleep); } Thread.sleep(sleep); } else { staticLogger.debug("Timeout"); JdbcUtils.rollbackAndClose(con); return null; } } while (true); if (ackStmt != null) { Object[] params = connector.getParams(endpoint, ackParams, result, ackStmt); if (staticLogger.isDebugEnabled()) { staticLogger.debug("SQL UPDATE: " + ackStmt + ", params = " + ArrayUtils.toString(params)); } int nbRows = connector.getQueryRunner().update(con, ackStmt, params); if (nbRows != 1) { staticLogger.warn("Row count for ack should be 1 and not " + nbRows); } } MessageAdapter msgAdapter = connector.getMessageAdapter(result); MuleMessage message = new DefaultMuleMessage(msgAdapter); JdbcUtils.commitAndClose(con); return message; } catch (Exception e) { JdbcUtils.rollbackAndClose(con); throw e; } } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/SQLExceptionReader.java0000644000175000017500000000374310745677442031077 0ustar charlescharles/* * $Id: SQLExceptionReader.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.config.ExceptionReader; import org.mule.util.StringUtils; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; /** * Surfaces information about SQLExceptions such as the code and sql state. Also uses * the NextException to find the cause */ public class SQLExceptionReader implements ExceptionReader { public String getMessage(Throwable t) { SQLException e = (SQLException) t; return e.getMessage() + "(SQL Code: " + e.getErrorCode() + ", SQL State: + " + e.getSQLState() + ")"; } public Throwable getCause(Throwable t) { SQLException e = (SQLException) t; Throwable cause = e.getNextException(); if (cause == null) { cause = e.getCause(); } return cause; } public Class getExceptionType() { return SQLException.class; } /** * Returns a map of the non-stanard information stored on the exception * * @param t the exception to extract the information from * @return a map of the non-stanard information stored on the exception */ public Map getInfo(Throwable t) { SQLException e = (SQLException) t; Map info = new HashMap(); if (e.getErrorCode() != 0) { info.put("SQL Code", String.valueOf(e.getErrorCode())); } if (e.getSQLState() != null && !e.getSQLState().equals(StringUtils.EMPTY)) { info.put("SQL State", e.getSQLState()); } return info; } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/JdbcUtils.java0000644000175000017500000000254410745677442027317 0ustar charlescharles/* * $Id: JdbcUtils.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import java.sql.Connection; import java.sql.SQLException; /** * Utility methods for working with various parts of JDBC. */ public abstract class JdbcUtils { protected JdbcUtils() { // empty, just to restrict instanciation } public static void close(Connection con) throws SQLException { if (con != null && !con.isClosed()) { con.close(); } } public static void commitAndClose(Connection con) throws SQLException { if (con != null) { if (!con.getAutoCommit()) { con.commit(); } con.close(); } } public static void rollbackAndClose(Connection con) throws SQLException { if (con != null) { if (!con.getAutoCommit()) { con.rollback(); } con.close(); } } } mule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/util/0000755000175000017500000000000011351410660025516 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/java/org/mule/transport/jdbc/util/MuleDerbyUtils.java0000644000175000017500000001040110754375733031307 0ustar charlescharles/* * $Id: MuleDerbyUtils.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.util; import org.mule.util.ClassUtils; import org.mule.util.FileUtils; import java.io.File; import java.io.IOException; import java.lang.reflect.Method; import java.net.URL; import java.sql.Driver; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; /** * NOTE: Don't forget to duplicate all the changes in {@link org.mule.example.loanbroker.bpm.DbUtils} */ public class MuleDerbyUtils { private static final String DERBY_DRIVER_CLASS = "org.apache.derby.jdbc.EmbeddedDriver"; //class cannot be instantiated private MuleDerbyUtils() { super(); } //by default, set the derby home to the target directory public static String setDerbyHome() { return setDerbyHome("target"); } public static String setDerbyHome(String path) { File derbySystemHome = new File(System.getProperty("user.dir"), path); System.setProperty("derby.system.home", derbySystemHome.getAbsolutePath()); return derbySystemHome.getAbsolutePath(); } /** * Properly shutdown an embedded Derby database * * @throws SQLException * @see Derby docs */ public static void stopDatabase() throws SQLException { try { // force loading the driver so it's available even if no prior connection to the // database was made ClassUtils.instanciateClass(DERBY_DRIVER_CLASS, new Object[0]); DriverManager.getConnection("jdbc:derby:;shutdown=true"); } catch (SQLException sqlex) { // this exception is documented to be thrown upon shutdown if (!"XJ015".equals(sqlex.getSQLState())) { throw sqlex; } } catch (Exception ex) { // this can only happen when the driver class is not in classpath. In this case, just // throw up throw new RuntimeException(ex); } } public static void cleanupDerbyDb(String derbySystemHome, String databaseName) throws IOException, SQLException { stopDatabase(); FileUtils.deleteTree(new File(derbySystemHome + File.separator + databaseName)); } public static void createDataBase(String databaseName) throws SQLException { // Do not use the EmbeddedDriver class here directly to avoid compile time references // on derby.jar try { Driver derbyDriver = (Driver) ClassUtils.instanciateClass(DERBY_DRIVER_CLASS, new Object[0]); Method connectMethod = derbyDriver.getClass().getMethod("connect", new Class[] { String.class, Properties.class }); String connectionName = "jdbc:derby:" + databaseName + ";create=true"; connectMethod.invoke(derbyDriver, new Object[] { connectionName, null }); } catch (Exception ex) { throw new RuntimeException("Error creating the database " + databaseName, ex); } } public static String loadDatabaseName(String propertiesLocation, String propertyName) throws IOException { Properties derbyProperties = new Properties(); URL resource = ClassUtils.getResource(propertiesLocation, MuleDerbyUtils.class); derbyProperties.load(resource.openStream()); return derbyProperties.getProperty(propertyName); } public static void defaultDerbyCleanAndInit(String propertiesLocation, String propertyName) throws IOException, SQLException { String derbyHome = setDerbyHome(); String dbName = loadDatabaseName(propertiesLocation, propertyName); cleanupDerbyDb(derbyHome, dbName); createDataBase(dbName); } } mule-2.0.1/transports/jdbc/src/main/resources/0000755000175000017500000000000011351410660021143 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/resources/META-INF/0000755000175000017500000000000011351410660022303 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/resources/META-INF/mule-jdbc.xsd0000644000175000017500000000627110771035437024705 0ustar charlescharles mule-2.0.1/transports/jdbc/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012410625347127025161 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/jdbc/2.0/mule-jdbc.xsd=META-INF/mule-jdbc.xsdmule-2.0.1/transports/jdbc/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014410745677442025351 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/jdbc/2.0=org.mule.transport.jdbc.config.JdbcNamespaceHandler mule-2.0.1/transports/jdbc/src/main/resources/META-INF/services/0000755000175000017500000000000011351410660024126 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410660024715 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410660025657 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410660027674 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/main/resources/META-INF/services/org/mule/providers/jdbc.properties0000644000175000017500000000056510745677442032745 0ustar charlescharlesconnector=org.mule.transport.jdbc.JdbcConnector dispatcher.factory=org.mule.transport.jdbc.JdbcMessageDispatcherFactory requester.factory=org.mule.transport.jdbc.JdbcMessageRequesterFactory message.receiver=org.mule.transport.jdbc.JdbcMessageReceiver message.adapter=org.mule.transport.DefaultMessageAdapter endpoint.builder=org.mule.transport.jdbc.JdbcEndpointURIBuilder mule-2.0.1/transports/jdbc/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410660026436 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/jdbc/src/main/resources/META-INF/services/org/mule/i18n/jdbc-messages.propertiesmule-2.0.1/transports/jdbc/src/main/resources/META-INF/services/org/mule/i18n/jdbc-messages.properti0000644000175000017500000000012410621717250032734 0ustar charlescharles1=Failed to set Auto commit on transaction 2=JNDI Resource not found for name "{0}" mule-2.0.1/transports/jdbc/src/test/0000755000175000017500000000000011351410660017164 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/test/java/0000755000175000017500000000000011351410660020105 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/test/java/org/0000755000175000017500000000000011351410660020674 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/test/java/org/mule/0000755000175000017500000000000011351410660021636 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/0000755000175000017500000000000011351410660023672 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/0000755000175000017500000000000011351410660024574 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/test/0000755000175000017500000000000011351410660025553 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/test/JdbcFunctionalTestComponent.javamule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/test/JdbcFunctionalTestComponent.ja0000644000175000017500000000156610754365306033523 0ustar charlescharles/* * $Id: JdbcFunctionalTestComponent.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.test; import org.mule.api.MuleEventContext; import org.mule.tck.functional.FunctionalTestComponent; import java.util.Map; public class JdbcFunctionalTestComponent extends FunctionalTestComponent { public Object onCall(MuleEventContext context) throws Exception { super.onCall(context); Map map = (Map)context.getMessage().getPayload(); return map.get("data") + " Received"; } } mule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/test/TestDataSource.java0000644000175000017500000000273210745677442031337 0ustar charlescharles/* * $Id: TestDataSource.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.test; import com.mockobjects.dynamic.Mock; import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; import javax.sql.DataSource; public class TestDataSource implements DataSource { public Connection getConnection() throws SQLException { Mock mockConnection = new Mock(Connection.class); mockConnection.expectAndReturn("getAutoCommit", false); mockConnection.expect("commit"); mockConnection.expect("close"); return (Connection) mockConnection.proxy(); } public Connection getConnection(String username, String password) throws SQLException { return getConnection(); } public int getLoginTimeout() throws SQLException { return 0; } public PrintWriter getLogWriter() throws SQLException { return null; } public void setLoginTimeout(int seconds) throws SQLException { // nop } public void setLogWriter(PrintWriter out) throws SQLException { // nop } } mule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/test/JdbcTestContextFactory.java0000644000175000017500000000151010745677442033035 0ustar charlescharles/* * $Id: JdbcTestContextFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.test; import org.mule.tck.jndi.TestContextFactory; import javax.naming.Context; import javax.naming.NamingException; public class JdbcTestContextFactory extends TestContextFactory { protected void populateTestData(Context context) throws NamingException { super.populateTestData(context); context.bind("jdbc/testDS", new TestDataSource()); } } mule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/JdbcConnectorTestCase.java0000644000175000017500000000254210754365306031627 0ustar charlescharles/* * $Id: JdbcConnectorTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.jdbc.JdbcConnector; import java.util.HashMap; import java.util.Map; import org.apache.derby.jdbc.EmbeddedDataSource; public class JdbcConnectorTestCase extends AbstractConnectorTestCase { // @Override public Connector createConnector() throws Exception { JdbcConnector c = new JdbcConnector(); EmbeddedDataSource embeddedDS = new EmbeddedDataSource(); embeddedDS.setDatabaseName("embeddedDB"); c.setName("JdbcConnector"); c.setDataSource(embeddedDS); c.setPollingFrequency(1000); return c; } public Object getValidMessage() throws Exception { Map map = new HashMap(); return map; } public String getTestEndpointURI() { return "jdbc://test?sql=SELECT * FROM TABLE"; } } mule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/JdbcEndpointTestCase.java0000644000175000017500000000420210745677442031457 0ustar charlescharles/* * $Id: JdbcEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class JdbcEndpointTestCase extends AbstractMuleTestCase { public void testWithoutEndpointName() throws Exception { EndpointURI url = new MuleEndpointURI("jdbc:/?sql=SELECT * FROM TABLE"); url.initialise(); assertEquals("jdbc", url.getScheme()); assertEquals("", url.getAddress()); assertNull(url.getEndpointName()); assertNotNull(url.getParams()); assertEquals("SELECT * FROM TABLE", url.getParams().get("sql")); assertEquals("jdbc:/?sql=SELECT%20*%20FROM%20TABLE", url.toString()); } public void testWithoutEndpointName2() throws Exception { EndpointURI url = new MuleEndpointURI("jdbc://?sql=SELECT * FROM TABLE"); url.initialise(); assertEquals("jdbc", url.getScheme()); assertEquals("jdbc", url.getAddress()); assertNull(url.getEndpointName()); assertNotNull(url.getParams()); assertEquals("SELECT * FROM TABLE", url.getParams().get("sql")); assertEquals("jdbc://?sql=SELECT%20*%20FROM%20TABLE", url.toString()); } public void testWithEndpointName() throws Exception { EndpointURI url = new MuleEndpointURI("jdbc://history/writeTests?type=2"); url.initialise(); assertEquals("jdbc", url.getScheme()); assertEquals("writeTests", url.getAddress()); assertEquals("history", url.getEndpointName()); assertNotNull(url.getParams()); assertEquals("2", url.getParams().get("type")); assertEquals("jdbc://history/writeTests?type=2", url.toString()); } } mule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/SqlExceptionReaderTestCase.java0000644000175000017500000000434010745677442032660 0ustar charlescharles/* * $Id: SqlExceptionReaderTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.DefaultMuleException; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.MessageFactory; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.jdbc.SQLExceptionReader; import java.sql.SQLException; import java.util.List; import java.util.Map; public class SqlExceptionReaderTestCase extends AbstractMuleTestCase { /** * Print the name of this test to standard output */ protected void doSetUp() throws Exception { ExceptionHelper.registerExceptionReader(new SQLExceptionReader()); } public void testNestedExceptionRetreval() throws Exception { Exception testException = getException(); Throwable t = ExceptionHelper.getRootException(testException); assertNotNull(t); assertEquals("blah", t.getMessage()); assertNull(t.getCause()); t = ExceptionHelper.getRootMuleException(testException); assertNotNull(t); assertEquals("bar", t.getMessage()); assertNotNull(t.getCause()); List l = ExceptionHelper.getExceptionsAsList(testException); assertEquals(4, l.size()); Map info = ExceptionHelper.getExceptionInfo(testException); assertNotNull(info); assertEquals(3, info.size()); assertNotNull(info.get("JavaDoc")); assertEquals("1234", info.get("SQL Code")); assertEquals("bad SQL state", info.get("SQL State")); } private Exception getException() { SQLException e = new SQLException("SQL error", "bad SQL state", 1234); e.setNextException(new SQLException("blah")); return new DefaultMuleException(MessageFactory.createStaticMessage("foo"), new DefaultMuleException( MessageFactory.createStaticMessage("bar"), e)); } } mule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/JdbcMessageDispatcherTestCase.java0000644000175000017500000000433010757615756033277 0ustar charlescharles/* * $Id: JdbcMessageDispatcherTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc; import org.mule.api.endpoint.InboundEndpoint; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.jdbc.test.TestDataSource; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.ResultSetHandler; public class JdbcMessageDispatcherTestCase extends AbstractMuleTestCase { public void testCustomResultSetHandlerIsNotIgnored() throws Exception { JdbcConnector connector = new JdbcConnector(); connector.setQueryRunner(new TestQueryRunner()); connector.setResultSetHandler(new TestResultSetHandler()); connector.setDataSource(new TestDataSource()); connector.setMuleContext(muleContext); //muleContext.applyLifecycle(connector); muleContext.getRegistry().registerConnector(connector); InboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "jdbc://select * from test"); ep.request(0); } public static final class TestQueryRunner extends QueryRunner { public Object query(Connection connection, String string, Object[] objects, ResultSetHandler resultSetHandler) throws SQLException { assertTrue("Custom result set handler has been ignored.", resultSetHandler instanceof TestResultSetHandler); return new Object(); } } public static final class TestResultSetHandler implements ResultSetHandler { public Object handle(ResultSet resultSet) throws SQLException { return new Object(); } } } mule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/config/0000755000175000017500000000000011351410660026041 5ustar charlescharles././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/config/JdbcNamespaceHandlerTestCase.javamule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/config/JdbcNamespaceHandlerTestCase0000644000175000017500000000551310771035437033413 0ustar charlescharles/* * $Id: JdbcNamespaceHandlerTestCase.java 11476 2008-03-21 22:47:59Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.config; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jdbc.JdbcConnector; import org.mule.transport.jdbc.test.TestDataSource; /** * Tests the "jdbc" namespace. */ public class JdbcNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "jdbc-namespace-config.xml"; } public void testWithDataSource() throws Exception { JdbcConnector c = (JdbcConnector) muleContext.getRegistry().lookupConnector("jdbcConnector1"); assertNotNull(c); assertTrue(c.getDataSource() instanceof TestDataSource); assertNull(c.getQueries()); } public void testWithDataSourceViaJndi() throws Exception { JdbcConnector c = (JdbcConnector) muleContext.getRegistry().lookupConnector("jdbcConnector2"); assertNotNull(c); assertTrue(c.getDataSource() instanceof TestDataSource); assertNull(c.getQueries()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testFullyConfigured() throws Exception { JdbcConnector c = (JdbcConnector) muleContext.getRegistry().lookupConnector("jdbcConnector3"); assertNotNull(c); assertTrue(c.getDataSource() instanceof TestDataSource); assertNotNull(c.getQueries()); assertEquals(3, c.getQueries().size()); assertTrue(c.isConnected()); assertTrue(c.isStarted()); } public void testEndpointQueryOverride() throws Exception { JdbcConnector c = (JdbcConnector) muleContext.getRegistry().lookupConnector("jdbcConnector3"); ImmutableEndpoint testJdbcEndpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint("testJdbcEndpoint"); //On connector, not overridden assertNotNull(c.getQuery(testJdbcEndpoint, "getTest")); //On connector, overridden on endpoint assertNotNull(c.getQuery(testJdbcEndpoint, "getTest2")); assertEquals("OVERRIDDEN VALUE", c.getQuery(testJdbcEndpoint, "getTest2")); //Only on endpoint assertNotNull(c.getQuery(testJdbcEndpoint, "getTest3")); //Does not exist on either assertNull(c.getQuery(testJdbcEndpoint, "getTest4")); } } mule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/0000755000175000017500000000000011351410660026736 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/JdbcNullParamsTestCase.javamule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/JdbcNullParamsTestCase.j0000644000175000017500000000441510754375733033433 0ustar charlescharles/* * $Id: JdbcNullParamsTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.functional; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.transport.NullPayload; import java.util.Collection; import java.util.Map; public class JdbcNullParamsTestCase extends AbstractJdbcFunctionalTestCase { public JdbcNullParamsTestCase() { setPopulateTestData(false); } protected String getConfigResources() { return "jdbc-null-params.xml"; } public void testJdbcNullParams() throws Exception { MuleClient client = new MuleClient(); //check that db is still empty MuleMessage reply = client.request("jdbc://getTest", 1000); assertTrue(reply.getPayload() instanceof Collection); assertTrue(((Collection)reply.getPayload()).isEmpty()); //execute the write query by sending a message on the jdbc://writeTest //the message is a nullpayload since we are not taking any params from any object //No other params will be sent to this endpoint client.send("jdbc://writeTest", new DefaultMuleMessage(NullPayload.getInstance())); //get the data which was written by the previous statement and test it reply = client.request("jdbc://getTest", 1000); assertNotNull(reply); assertTrue(reply.getPayload() instanceof Collection); Collection result = (Collection)reply.getPayload(); assertEquals(1, result.size()); Map res = (Map)result.iterator().next(); //check that id is equal to the one set originally and all others are null Integer id = (Integer)res.get("ID"); assertEquals(1, id.intValue()); assertNull(res.get("TYPE")); assertNull(res.get("DATA")); assertNull(res.get("RESULT")); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/JdbcSelectOnOutboundFunctionalTestCase.javamule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/JdbcSelectOnOutboundFunc0000644000175000017500000000517210771035437033533 0ustar charlescharles/* * $Id: JdbcSelectOnOutboundFunctionalTestCase.java 11476 2008-03-21 22:47:59Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.functional; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.transport.NullPayload; import java.io.Serializable; import java.util.List; import java.util.Map; public class JdbcSelectOnOutboundFunctionalTestCase extends AbstractJdbcFunctionalTestCase { protected String getConfigResources() { return super.getConfigResources() + ",jdbc-select-outbound.xml"; } public void testSelectOnOutbound() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm://jdbc.test", new DefaultMuleMessage(NullPayload.getInstance())); assertNotNull(reply.getPayload()); assertTrue(reply.getPayload() instanceof List); List resultList = (List) reply.getPayload(); assertTrue(resultList.size() == 1); assertTrue(resultList.get(0) instanceof Map); Map resultMap = (Map) resultList.get(0); assertEquals(new Integer(1), resultMap.get("TYPE")); assertEquals(TEST_VALUES[0], resultMap.get("DATA")); } public void testSelectOnOutboundByExpression() throws Exception { MuleClient client = new MuleClient(); MyMessage payload = new MyMessage(2); MuleMessage reply = client.send("vm://terra", new DefaultMuleMessage(payload)); assertNotNull(reply.getPayload()); assertTrue(reply.getPayload() instanceof List); List resultList = (List) reply.getPayload(); logger.debug("resultList.size() " + resultList.size()); assertTrue(resultList.size() == 1); assertTrue(resultList.get(0) instanceof Map); Map resultMap = (Map) resultList.get(0); assertEquals(new Integer(2), resultMap.get("TYPE")); assertEquals(TEST_VALUES[1], resultMap.get("DATA")); } public static class MyMessage implements Serializable { public MyMessage(int type) { this.type = type; } private int type; public int getType() { return type; } public void setType(int type) { this.type = type; } } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/AbstractJdbcFunctionalTestCase.javamule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/AbstractJdbcFunctionalTe0000644000175000017500000001007110754365306033536 0ustar charlescharles/* * $Id: AbstractJdbcFunctionalTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.functional; import org.mule.api.MuleMessage; import org.mule.tck.FunctionalTestCase; import org.mule.transport.jdbc.JdbcConnector; import org.mule.transport.jdbc.util.MuleDerbyUtils; import java.util.List; import org.apache.commons.dbutils.QueryRunner; public abstract class AbstractJdbcFunctionalTestCase extends FunctionalTestCase { protected static final String[] TEST_VALUES = {"Test", "The Moon", "Terra"}; private boolean populateTestData = true; JdbcConnector jdbcConnector = null; protected String getConfigResources() { return "jdbc-connector.xml"; } // @Override protected void doSetUp() throws Exception { super.doSetUp(); jdbcConnector = (JdbcConnector) muleContext.getRegistry().lookupConnector("jdbcConnector"); try { deleteTable(); } catch (Exception e) { createTable(); } if (populateTestData) { populateTable(); } } // @Override protected void doTearDown() throws Exception { deleteTable(); super.doTearDown(); } protected void createTable() throws Exception { QueryRunner qr = jdbcConnector.getQueryRunner(); qr.update(jdbcConnector.getConnection(), "CREATE TABLE TEST(ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY,TYPE INTEGER,DATA VARCHAR(255),ACK TIMESTAMP,RESULT VARCHAR(255))"); logger.debug("Table created"); } protected void deleteTable() throws Exception { QueryRunner qr = jdbcConnector.getQueryRunner(); int updated = qr.update(jdbcConnector.getConnection(), "DELETE FROM TEST"); logger.debug(updated + " rows deleted"); } protected void populateTable() throws Exception { QueryRunner qr = jdbcConnector.getQueryRunner(); int updated; updated = qr.update(jdbcConnector.getConnection(), "INSERT INTO TEST(TYPE, DATA) VALUES (1, '" + TEST_VALUES[0] + "')"); logger.debug(updated + " rows updated"); updated = qr.update(jdbcConnector.getConnection(), "INSERT INTO TEST(TYPE, DATA) VALUES (2, '" + TEST_VALUES[1] + "')"); logger.debug(updated + " rows updated"); updated = qr.update(jdbcConnector.getConnection(), "INSERT INTO TEST(TYPE, DATA) VALUES (3, '" + TEST_VALUES[2] + "')"); logger.debug(updated + " rows updated"); } // @Override protected void suitePreSetUp() throws Exception { MuleDerbyUtils.defaultDerbyCleanAndInit("derby.properties", "database.name"); super.suitePreSetUp(); } /* * org.apache.commons.dbutils.ResultSetHandler (called by QueryRunner which is * called by JdbcMessageReceiver) allows either null or a List of 0 rows to be * returned so we check for both. */ protected static void assertResultSetEmpty(MuleMessage message) { assertNotNull(message); Object payload = message.getPayload(); assertTrue(payload instanceof java.util.List); List list = (List)payload; assertTrue(list.isEmpty()); } protected static void assertResultSetNotEmpty(MuleMessage message) { assertNotNull(message); Object payload = message.getPayload(); assertTrue(payload instanceof java.util.List); List list = (List)payload; assertFalse(list.isEmpty()); } public boolean isPopulateTestData() { return populateTestData; } public void setPopulateTestData(boolean populateTestData) { this.populateTestData = populateTestData; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/JdbcFunctionalTestCase.javamule-2.0.1/transports/jdbc/src/test/java/org/mule/transport/jdbc/functional/JdbcFunctionalTestCase.j0000644000175000017500000001050610754375733033455 0ustar charlescharles/* * $Id: JdbcFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jdbc.functional; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import java.util.HashMap; import java.util.Map; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.ArrayHandler; public class JdbcFunctionalTestCase extends AbstractJdbcFunctionalTestCase { public static final String DEFAULT_MESSAGE = "Test Message"; public JdbcFunctionalTestCase() { setPopulateTestData(false); } protected String getConfigResources() { return super.getConfigResources() + ",jdbc-functional-config.xml"; } public void testDirectSql() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.request("jdbc://?sql=SELECT * FROM TEST", 1000); assertResultSetEmpty(message); QueryRunner qr = jdbcConnector.getQueryRunner(); int updated = qr.update(jdbcConnector.getConnection(), "INSERT INTO TEST(TYPE, DATA) VALUES (1, '" + DEFAULT_MESSAGE + "')"); assertEquals(1, updated); message = client.request("jdbc://?sql=SELECT * FROM TEST", 1000); assertResultSetNotEmpty(message); } public void testSend() throws Exception { MuleClient client = new MuleClient(); client.send("jdbc://writeTest?type=2", new DefaultMuleMessage(DEFAULT_MESSAGE)); QueryRunner qr = jdbcConnector.getQueryRunner(); Object[] obj2 = (Object[]) qr.query(jdbcConnector.getConnection(), "SELECT DATA FROM TEST WHERE TYPE = 2", new ArrayHandler()); assertNotNull(obj2); assertEquals(1, obj2.length); assertEquals(DEFAULT_MESSAGE, obj2[0]); } public void testSendMap() throws Exception { MuleClient client = new MuleClient(); Map map = new HashMap(); map.put("data", DEFAULT_MESSAGE); client.send("jdbc://writeMap?type=2", new DefaultMuleMessage(map)); QueryRunner qr = jdbcConnector.getQueryRunner(); Object[] obj2 = (Object[]) qr.query(jdbcConnector.getConnection(), "SELECT DATA FROM TEST WHERE TYPE = 2", new ArrayHandler()); assertNotNull(obj2); assertEquals(1, obj2.length); assertEquals(DEFAULT_MESSAGE, obj2[0]); } public void testReceive() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.request("jdbc://getTest?type=1", 1000); assertResultSetEmpty(message); QueryRunner qr = jdbcConnector.getQueryRunner(); int updated = qr.update(jdbcConnector.getConnection(), "INSERT INTO TEST(TYPE, DATA, ACK, RESULT) VALUES (1, '" + DEFAULT_MESSAGE + "', NULL, NULL)"); assertEquals(1, updated); message = client.request("jdbc://getTest?type=1", 1000); assertResultSetNotEmpty(message); } public void testReceiveAndSend() throws Exception { QueryRunner qr = jdbcConnector.getQueryRunner(); qr.update(jdbcConnector.getConnection(), "INSERT INTO TEST(TYPE, DATA, ACK, RESULT) VALUES (1, '" + DEFAULT_MESSAGE + "', NULL, NULL)"); long t0 = System.currentTimeMillis(); while (System.currentTimeMillis() - t0 < 20000) { Object[] rs = (Object[]) qr.query(jdbcConnector.getConnection(), "SELECT COUNT(*) FROM TEST WHERE TYPE = 2", new ArrayHandler()); assertNotNull(rs); assertEquals(1, rs.length); if (((Number)rs[0]).intValue() > 0) { break; } Thread.sleep(100); } Object[] obj2 = (Object[]) qr.query(jdbcConnector.getConnection(), "SELECT DATA FROM TEST WHERE TYPE = 2", new ArrayHandler()); assertNotNull(obj2); assertEquals(1, obj2.length); assertEquals(DEFAULT_MESSAGE + " Received", obj2[0]); } } mule-2.0.1/transports/jdbc/src/test/resources/0000755000175000017500000000000011351410660021176 5ustar charlescharlesmule-2.0.1/transports/jdbc/src/test/resources/log4j.properties0000644000175000017500000000050210547540350024336 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/transports/jdbc/src/test/resources/jdbc-namespace-config.xml0000644000175000017500000000457610745677442026056 0ustar charlescharles mule-2.0.1/transports/jdbc/src/test/resources/jdbc-functional-config.xml0000644000175000017500000000233510764770465026253 0ustar charlescharles mule-2.0.1/transports/jdbc/src/test/resources/derby.properties0000644000175000017500000000015110676324552024433 0ustar charlescharlesdatabase.name=muleEmbeddedDB database.connection=jdbc:derby:${database.name};sql.enforce_strict_size=truemule-2.0.1/transports/jdbc/src/test/resources/jdbc-null-params.xml0000644000175000017500000000273310742671230025065 0ustar charlescharles mule-2.0.1/transports/jdbc/src/test/resources/jdbc-select-outbound.xml0000644000175000017500000000320310745174725025751 0ustar charlescharles mule-2.0.1/transports/jdbc/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006310714321506026051 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/transports/jdbc/src/test/resources/jdbc-connector.xml0000644000175000017500000000351010764770465024634 0ustar charlescharles mule-2.0.1/transports/jdbc/pom.xml0000644000175000017500000000662211006063605016741 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-jdbc JDBC Transport A Mule transport for JDBC connectivity. org.apache.maven.plugins maven-jar-plugin test-jar org.mule mule-core ${version} commons-dbutils commons-dbutils 1.1 com.experlog xapool 1.4 org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test org.mule.modules mule-module-xml ${version} test org.mule.transports mule-transport-vm ${version} test org.apache.derby derby test osgi org.apache.felix maven-bundle-plugin org.mule.transport.jdbc.* mule-2.0.1/transports/cxf/0000755000175000017500000000000011351410637015300 5ustar charlescharlesmule-2.0.1/transports/cxf/src/0000755000175000017500000000000011351410636016066 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/0000755000175000017500000000000011351410637017013 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/java/0000755000175000017500000000000011351410636017733 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/java/org/0000755000175000017500000000000011351410636020522 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/java/org/mule/0000755000175000017500000000000011351410636021464 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/0000755000175000017500000000000011351410636023520 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/0000755000175000017500000000000011351410637024301 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/CxfConstants.java0000755000175000017500000000251211004437405027561 0ustar charlescharles/* * $Id: CxfConstants.java 11646 2008-04-25 20:28:53Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; public interface CxfConstants { String DATA_BINDING = "databinding"; String BINDING_ID = "bindingId"; String FRONTEND = "frontend"; String JAX_WS_FRONTEND = "jaxws"; String SIMPLE_FRONTEND = "simple"; String WSDL_LOCATION = "wsdlLocation"; String NAMESPACE = "namespace"; String NAME = "name"; String CLIENT_CLASS = "clientClass"; String SERVICE_INTERFACE = "serviceInterface"; String CLIENT_PORT = "wsdlPort"; String OPERATION = "operation"; String BRIDGE = "bridge"; String SERVICE_CLASS = "serviceClass"; String FEATURES = "features"; String IN_INTERCEPTORS = "inInterceptors"; String IN_FAULT_INTERCEPTORS = "inFaultInterceptors"; String OUT_INTERCEPTORS = "outInterceptors"; String OUT_FAULT_INTERCEPTORS = "outFaultInterceptors"; String MTOM_ENABLED = "mtomEnabled"; String MULE_MESSAGE = "mule.message"; } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/CxfMuleSession.java0000755000175000017500000000237210767604414030072 0ustar charlescharles/* * $Id: CxfMuleSession.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.MuleSession; import org.apache.cxf.transport.Session; /** * Mules session wrapper for XFire */ public class CxfMuleSession implements Session { MuleSession session; public CxfMuleSession(MuleSession session) { if (session == null) { throw new IllegalArgumentException("MuleSession"); } this.session = session; } /** * Get a variable from the session by the key. * * @param key * @return Value */ public Object get(Object key) { return session.getProperty(key); } /** * Put a variable into the session with a key. * * @param key * @param value */ public void put(Object key, Object value) { session.setProperty(key, value); } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/MuleInvoker.java0000755000175000017500000001611210767604414027420 0ustar charlescharles/* * $Id: MuleInvoker.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.ServiceException; import org.mule.transport.NullPayload; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import org.apache.cxf.frontend.MethodDispatcher; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.FaultMode; import org.apache.cxf.service.Service; import org.apache.cxf.service.invoker.Invoker; import org.apache.cxf.service.model.BindingOperationInfo; /** * Invokes a Mule Service via a CXF binding. */ public class MuleInvoker implements Invoker { private final CxfMessageReceiver receiver; private final boolean synchronous; private Class targetClass; public MuleInvoker(CxfMessageReceiver receiver, Class targetClass, boolean synchronous) { this.receiver = receiver; this.targetClass = targetClass; this.synchronous = synchronous; } public Object invoke(Exchange exchange, Object o) { BindingOperationInfo bop = exchange.get(BindingOperationInfo.class); Service svc = exchange.get(Service.class); MethodDispatcher md = (MethodDispatcher) svc.get(MethodDispatcher.class.getName()); Method m = md.getMethod(bop); if (targetClass != null) { m = matchMethod(m, targetClass); } MuleMessage message = null; try { CxfMessageAdapter messageAdapter = (CxfMessageAdapter) receiver.getConnector().getMessageAdapter( exchange.getInMessage()); if (!receiver.isBridge()) { messageAdapter.setProperty(MuleProperties.MULE_METHOD_PROPERTY, m); } DefaultMuleMessage muleReq = new DefaultMuleMessage(messageAdapter); String replyTo = (String) exchange.getInMessage().get(MuleProperties.MULE_REPLY_TO_PROPERTY); if (replyTo != null) { muleReq.setReplyTo(replyTo); } String corId = (String) exchange.getInMessage().get(MuleProperties.MULE_CORRELATION_ID_PROPERTY); if (corId != null) { muleReq.setCorrelationId(corId); } String corGroupSize = (String) exchange.getInMessage().get(MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY); if (corGroupSize != null) { muleReq.setCorrelationGroupSize(Integer.valueOf(corGroupSize)); } String corSeq = (String) exchange.getInMessage().get(MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY); if (corSeq != null) { muleReq.setCorrelationSequence(Integer.valueOf(corSeq)); } message = receiver.routeMessage(muleReq, synchronous); } catch (MuleException e) { throw new Fault(e); } if (message != null) { if (message.getExceptionPayload() != null) { Throwable cause = message.getExceptionPayload().getException(); if (cause instanceof ServiceException) { cause = cause.getCause(); } exchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT); if (cause instanceof Fault) { throw (Fault) cause; } throw new Fault(cause); } else if (message.getPayload() instanceof NullPayload) { return null; } else { return new Object[]{message.getPayload()}; } } else { return null; } } public InboundEndpoint getEndpoint() { return receiver.getEndpoint(); } /** * Returns a Method that has the same declaring class as the class of * targetObject to avoid the IllegalArgumentException when invoking the * method on the target object. The methodToMatch will be returned if the * targetObject doesn't have a similar method. * * @param methodToMatch The method to be used when finding a matching method * in targetObject * @param targetObject The object to search in for the method. * @return The methodToMatch if no such method exist in the class of * targetObject; otherwise, a method from the class of targetObject * matching the matchToMethod method. */ private static Method matchMethod(Method methodToMatch, Class targetClass) { Class[] interfaces = targetClass.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { Method m = getMostSpecificMethod(methodToMatch, interfaces[i]); if (!methodToMatch.equals(m)) { return m; } } return methodToMatch; } /** * Return whether the given object is a J2SE dynamic proxy. * * @param object the object to check * @see java.lang.reflect.Proxy#isProxyClass */ public static boolean isJdkDynamicProxy(Object object) { return object != null && Proxy.isProxyClass(object.getClass()); } /** * Given a method, which may come from an interface, and a targetClass used * in the current AOP invocation, find the most specific method if there is * one. E.g. the method may be IFoo.bar() and the target class may be * DefaultFoo. In this case, the method may be DefaultFoo.bar(). This * enables attributes on that method to be found. * * @param method method to be invoked, which may come from an interface * @param targetClass target class for the curren invocation. May be * null or may not even implement the method. * @return the more specific method, or the original method if the * targetClass doesn't specialize it or implement it or is null */ public static Method getMostSpecificMethod(Method method, Class targetClass) { if (method != null && targetClass != null) { try { method = targetClass.getMethod(method.getName(), method.getParameterTypes()); } catch (NoSuchMethodException ex) { // Perhaps the target class doesn't implement this method: // that's fine, just use the original method } } return method; } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/CxfMessageDispatcher.java0000755000175000017500000002115210767604414031214 0ustar charlescharles/* * $Id: CxfMessageDispatcher.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transformer.TransformerException; import org.mule.transport.AbstractMessageDispatcher; import org.mule.transport.soap.SoapConstants; import org.mule.util.TemplateParser; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.regex.Pattern; import javax.activation.DataHandler; import javax.xml.namespace.QName; import javax.xml.ws.BindingProvider; import org.apache.cxf.endpoint.Client; import org.apache.cxf.endpoint.ClientImpl; import org.apache.cxf.service.model.BindingOperationInfo; /** * The CxfMessageDispatcher is used for making Soap client requests to remote * services. */ public class CxfMessageDispatcher extends AbstractMessageDispatcher { private static final String URI_REGEX = "cxf:\\[(.+?)\\]:(.+?)/\\[(.+?)\\]:(.+?)"; Pattern URI_PATTERN = Pattern.compile(URI_REGEX); protected final CxfConnector connector; protected ClientWrapper wrapper; private final TemplateParser soapActionTemplateParser = TemplateParser.createAntStyleParser(); public CxfMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (CxfConnector) endpoint.getConnector(); } /* We need a way to associate an endpoint with a specific CXF service and operation, and the most sensible way to accomplish that is to overload URI syntax: cxf:[service_URI]:service_localname/[ep_URI]:ep_localname And the map method to operation */ protected void doConnect() throws Exception { wrapper = new ClientWrapper(); wrapper.setBus(connector.getCxfBus()); wrapper.setEndpoint(endpoint); wrapper.initialize(); } protected void doDisconnect() throws Exception { wrapper = null; } protected void doDispose() { // nothing to do } protected Object[] getArgs(MuleEvent event) throws TransformerException { Object payload = event.transformMessage(); Object[] args; if (payload instanceof Object[]) { args = (Object[])payload; } else { args = new Object[]{payload}; } MuleMessage message = event.getMessage(); Set attachmentNames = message.getAttachmentNames(); if (attachmentNames != null && !attachmentNames.isEmpty()) { List attachments = new ArrayList(); for (Iterator i = attachmentNames.iterator(); i.hasNext();) { attachments.add(message.getAttachment((String)i.next())); } List temp = new ArrayList(Arrays.asList(args)); temp.add(attachments.toArray(new DataHandler[0])); args = temp.toArray(); } return args; } protected MuleMessage doSend(MuleEvent event) throws Exception { ((ClientImpl)wrapper.getClient()).setSynchronousTimeout(event.getTimeout()); if (!wrapper.isProxy()) { return doSendWithClient(event); } else { return doSendWithProxy(event); } } protected MuleMessage doSendWithProxy(MuleEvent event) throws Exception { Method method = wrapper.getMethod(event); Map props = new HashMap(); props.put(MuleProperties.MULE_EVENT_PROPERTY, event); // Set custom soap action if set on the event or endpoint String soapAction = (String)event.getMessage().getProperty(SoapConstants.SOAP_ACTION_PROPERTY); if (soapAction != null) { soapAction = parseSoapAction(soapAction, new QName(method.getName()), event); props.put(org.apache.cxf.binding.soap.SoapConstants.SOAP_ACTION, soapAction); } BindingProvider bp = wrapper.getProxy(); bp.getRequestContext().putAll(props); Object response = method.invoke(wrapper.getProxy(), getArgs(event)); // TODO: handle holders return buildResponseMessage(event, new Object[] { response }); } protected MuleMessage doSendWithClient(MuleEvent event) throws Exception { BindingOperationInfo bop = wrapper.getOperation(event); Map props = new HashMap(); props.put(MuleProperties.MULE_EVENT_PROPERTY, event); // Set custom soap action if set on the event or endpoint String soapAction = (String)event.getMessage().getProperty(SoapConstants.SOAP_ACTION_PROPERTY); if (soapAction != null) { soapAction = parseSoapAction(soapAction, bop.getName(), event); props.put(org.apache.cxf.binding.soap.SoapConstants.SOAP_ACTION, soapAction); event.getMessage().setProperty(SoapConstants.SOAP_ACTION_PROPERTY, soapAction); } Map ctx = new HashMap(); ctx.put(Client.REQUEST_CONTEXT, props); ctx.put(Client.RESPONSE_CONTEXT, props); // Set Custom Headers on the client Object[] arr = event.getMessage().getPropertyNames().toArray(); String head; for (int i = 0; i < arr.length; i++) { head = (String) arr[i]; if ((head != null) && (!head.startsWith("MULE"))) { props.put((String) arr[i], event.getMessage().getProperty((String) arr[i])); } } Object[] response = wrapper.getClient().invoke(bop, getArgs(event), ctx); return buildResponseMessage(event, response); } protected MuleMessage buildResponseMessage(MuleEvent event, Object[] response) { MuleMessage result = null; if (response != null && response.length <= 1) { if (response.length == 1) { result = new DefaultMuleMessage(response[0], event.getMessage()); } } else { result = new DefaultMuleMessage(response, event.getMessage()); } return result; } protected void doDispatch(MuleEvent event) throws Exception { doSend(event); } public String parseSoapAction(String soapAction, QName method, MuleEvent event) { EndpointURI endpointURI = event.getEndpoint().getEndpointURI(); Map properties = new HashMap(); MuleMessage msg = event.getMessage(); for (Iterator iterator = msg.getPropertyNames().iterator(); iterator.hasNext();) { String propertyKey = (String)iterator.next(); properties.put(propertyKey, msg.getProperty(propertyKey).toString()); } properties.put(MuleProperties.MULE_METHOD_PROPERTY, method.getLocalPart()); properties.put("methodNamespace", method.getNamespaceURI()); properties.put("address", endpointURI.getAddress()); properties.put("scheme", endpointURI.getScheme()); properties.put("host", endpointURI.getHost()); properties.put("port", String.valueOf(endpointURI.getPort())); properties.put("path", endpointURI.getPath()); properties.put("hostInfo", endpointURI.getScheme() + "://" + endpointURI.getHost() + (endpointURI.getPort() > -1 ? ":" + String.valueOf(endpointURI.getPort()) : "")); if (event.getService() != null) { properties.put("serviceName", event.getService().getName()); } soapAction = soapActionTemplateParser.parse(properties, soapAction); if (logger.isDebugEnabled()) { logger.debug("SoapAction for this call is: " + soapAction); } return soapAction; } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/CxfMessageDispatcherFactory.java0000755000175000017500000000173510767604414032551 0ustar charlescharles/* * $Id: CxfMessageDispatcherFactory.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * Creates a CXF Message dispatcher used for making requests using the CXF client. */ public class CxfMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new CxfMessageDispatcher(endpoint); } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/0000755000175000017500000000000011351410637026015 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/CxfUtils.java0000755000175000017500000000326310777050076030440 0ustar charlescharles/* * $Id: CxfUtils.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.support; import org.mule.api.endpoint.EndpointNotFoundException; import java.io.IOException; import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.ChainInitiationObserver; import org.apache.cxf.transport.Destination; import org.apache.cxf.transport.DestinationFactory; import org.apache.cxf.transport.MessageObserver; public final class CxfUtils { public static Endpoint getEndpoint(DestinationFactory df, String uri) throws IOException, EndpointNotFoundException { int idx = uri.indexOf('?'); if (idx != -1) { uri = uri.substring(0, idx); } EndpointInfo ei = new EndpointInfo(); ei.setAddress(uri); Destination d = df.getDestination(ei); if (d.getMessageObserver() == null) { // TODO is this the right Mule exception? throw new EndpointNotFoundException(uri); } MessageObserver mo = d.getMessageObserver(); if (!(mo instanceof ChainInitiationObserver)) { throw new EndpointNotFoundException(uri); } ChainInitiationObserver co = (ChainInitiationObserver) mo; return co.getEndpoint(); } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/ProviderService.java0000755000175000017500000000133110777050076032004 0ustar charlescharles/* * $Id: ProviderService.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.support; import javax.xml.transform.Source; import javax.xml.ws.Provider; import javax.xml.ws.WebServiceProvider; @WebServiceProvider public class ProviderService implements Provider { public Source invoke(Source arg0) { return null; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/MuleHeadersOutInterceptor.javamule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/MuleHeadersOutInterceptor.jav0000755000175000017500000000706510770356575033655 0ustar charlescharles/* * $Id: MuleHeadersOutInterceptor.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.support; import static org.mule.api.config.MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY; import static org.mule.api.config.MuleProperties.MULE_CORRELATION_ID_PROPERTY; import static org.mule.api.config.MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY; import static org.mule.api.config.MuleProperties.MULE_EVENT_PROPERTY; import static org.mule.api.config.MuleProperties.MULE_REPLY_TO_PROPERTY; import static org.mule.transport.soap.MuleSoapHeaders.MULE_HEADER; import org.mule.api.MuleEvent; import org.mule.transport.soap.MuleSoapHeaders; import javax.xml.namespace.QName; import org.apache.cxf.binding.soap.SoapHeader; import org.apache.cxf.binding.soap.SoapMessage; import org.apache.cxf.helpers.DOMUtils; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.Phase; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; /** * Writes the Mule Soap Header to the outgoing request. */ public class MuleHeadersOutInterceptor extends BaseMuleHeaderInterceptor { public MuleHeadersOutInterceptor() { super(Phase.PRE_PROTOCOL); } public void handleMessage(Message m) throws Fault { if (!(m instanceof SoapMessage)) { return; } SoapMessage message = (SoapMessage) m; MuleEvent event = (MuleEvent) message.getExchange().get(MULE_EVENT_PROPERTY); if (event == null) { return; } MuleSoapHeaders muleHeaders = new MuleSoapHeaders(event); if (muleHeaders.getCorrelationId() == null && muleHeaders.getReplyTo() == null) { return; } Document owner_doc = DOMUtils.createDocument(); Element mule_header = owner_doc.createElementNS(MULE_NS_URI, QUALIFIED_MULE_HEADER); // setup mule: namespace prefix declaration so that we can use it. mule_header.setAttribute("xmlns:mule", MULE_NS_URI); if (muleHeaders.getCorrelationId() != null) { mule_header.appendChild(buildMuleHeader(owner_doc, MULE_CORRELATION_ID_PROPERTY, muleHeaders.getCorrelationId())); mule_header.appendChild(buildMuleHeader(owner_doc, MULE_CORRELATION_GROUP_SIZE_PROPERTY, muleHeaders.getCorrelationGroup())); mule_header.appendChild(buildMuleHeader(owner_doc, MULE_CORRELATION_SEQUENCE_PROPERTY, muleHeaders.getCorrelationSequence())); } if (muleHeaders.getReplyTo() != null) { mule_header.appendChild(buildMuleHeader(owner_doc, MULE_REPLY_TO_PROPERTY, muleHeaders.getReplyTo())); } SoapHeader sh = new SoapHeader(new QName(MULE_NS_URI, MULE_HEADER), mule_header); message.getHeaders().add(sh); } Element buildMuleHeader(Document owner_doc, String localName, String value) { Element out = owner_doc.createElementNS(MULE_NS_URI, "mule:" + localName); if (value != null) { Text text = owner_doc.createTextNode(value); out.appendChild(text); } return out; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/MuleHeadersInInterceptor.javamule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/MuleHeadersInInterceptor.java0000755000175000017500000000560710767604414033607 0ustar charlescharles/* * $Id: MuleHeadersInInterceptor.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.support; import java.util.Set; import javax.xml.namespace.QName; import org.apache.cxf.binding.soap.SoapMessage; import org.apache.cxf.headers.Header; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.Phase; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; /** * Reads the Mule Soap Header and sets the various header properties on the message. */ public class MuleHeadersInInterceptor extends BaseMuleHeaderInterceptor { public MuleHeadersInInterceptor() { super(Phase.PRE_PROTOCOL); } public void handleMessage(Message m) throws Fault { if (!(m instanceof SoapMessage)) { return; } SoapMessage message = (SoapMessage) m; if (!message.hasHeaders()) { return; } Header mule_header = message.getHeader(MULE_HEADER_Q); if (mule_header == null) { return; } Object obj = mule_header.getObject(); if (!(obj instanceof Element)) { // Error? We can't work with it at any rate. return; } Element header_element = (Element) obj; NodeList mule_headers = header_element.getChildNodes(); int idx = 0; Node child; while ((child = mule_headers.item(idx++)) != null) { if (child.getNodeType() != Node.ELEMENT_NODE) { continue; } Element child_el = (Element) child; if (child_el.getNamespaceURI() == null || !child_el.getNamespaceURI().equals(MULE_NS_URI)) { continue; } if (SUPPORTED_HEADERS.contains(child_el.getLocalName())) { message.put(child_el.getLocalName(), collectTextFrom(child_el)); } } } public Set getUnderstoodHeaders() { return UNDERSTOOD_HEADERS; } private String collectTextFrom(Element e) { NodeList children = e.getChildNodes(); StringBuilder sb = new StringBuilder(); int idx = 0; Node n; while ((n = children.item(idx++)) != null) { if (n.getNodeType() == Node.TEXT_NODE) { sb.append(((Text) n).getTextContent()); } } return sb.toString(); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/BaseMuleHeaderInterceptor.javamule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/BaseMuleHeaderInterceptor.jav0000755000175000017500000000432510777050076033563 0ustar charlescharles/* * $Id: BaseMuleHeaderInterceptor.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.support; import static org.mule.api.config.MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY; import static org.mule.api.config.MuleProperties.MULE_CORRELATION_ID_PROPERTY; import static org.mule.api.config.MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY; import static org.mule.api.config.MuleProperties.MULE_REPLY_TO_PROPERTY; import static org.mule.transport.soap.MuleSoapHeaders.MULE_10_ACTOR; import static org.mule.transport.soap.MuleSoapHeaders.MULE_HEADER; import static org.mule.transport.soap.MuleSoapHeaders.MULE_NAMESPACE; import java.util.HashSet; import java.util.Set; import javax.xml.namespace.QName; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; /** * */ abstract class BaseMuleHeaderInterceptor extends AbstractPhaseInterceptor { protected final static String MULE_NS_URI = MULE_10_ACTOR; protected final static String MULE_NS_PREFIX = MULE_NAMESPACE; protected final static String MULE_XMLNS = "xmlns:" + MULE_NS_PREFIX; protected final static String QUALIFIED_MULE_HEADER = MULE_NS_PREFIX + ":" + MULE_HEADER; protected static final QName MULE_HEADER_Q = new QName(MULE_NS_URI, MULE_HEADER); protected static final Set UNDERSTOOD_HEADERS = new HashSet(); static { UNDERSTOOD_HEADERS.add(MULE_HEADER_Q); } protected static final Set SUPPORTED_HEADERS = new HashSet(); static { SUPPORTED_HEADERS.add(MULE_CORRELATION_GROUP_SIZE_PROPERTY); SUPPORTED_HEADERS.add(MULE_CORRELATION_ID_PROPERTY); SUPPORTED_HEADERS.add(MULE_CORRELATION_SEQUENCE_PROPERTY); SUPPORTED_HEADERS.add(MULE_REPLY_TO_PROPERTY); } public BaseMuleHeaderInterceptor(String p) { super(p); } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/DelegatingOutputStream.java0000755000175000017500000000315411004437405033323 0ustar charlescharles/* * $Id$ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.support; import java.io.IOException; import java.io.OutputStream; public class DelegatingOutputStream extends OutputStream { private OutputStream outputStream; public DelegatingOutputStream(OutputStream outputStream) { super(); this.outputStream = outputStream; } public OutputStream getOutputStream() { return outputStream; } public void setOutputStream(OutputStream outputStream) { this.outputStream = outputStream; } public void close() throws IOException { outputStream.close(); } public boolean equals(Object obj) { return outputStream.equals(obj); } public void flush() throws IOException { outputStream.flush(); } public int hashCode() { return outputStream.hashCode(); } public String toString() { return outputStream.toString(); } public void write(byte[] b, int off, int len) throws IOException { outputStream.write(b, off, len); } public void write(byte[] b) throws IOException { outputStream.write(b); } public void write(int b) throws IOException { outputStream.write(b); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/MuleProtocolHeadersOutInterceptor.javamule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/support/MuleProtocolHeadersOutInterce0000755000175000017500000000606611005763611033674 0ustar charlescharles/* * $Id: MuleProtocolHeadersOutInterceptor.java 11664 2008-04-30 03:29:13Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.support; import org.mule.api.transport.MessageAdapter; import org.mule.transport.cxf.CxfConstants; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import java.util.List; import java.util.Map; import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.interceptor.AttachmentOutInterceptor; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; public class MuleProtocolHeadersOutInterceptor extends AbstractPhaseInterceptor { public MuleProtocolHeadersOutInterceptor() { super(Phase.PRE_STREAM); getAfter().add(AttachmentOutInterceptor.class.getName()); } public void handleMessage(Message message) throws Fault { MessageAdapter muleMsg = (MessageAdapter) message.getExchange().get(CxfConstants.MULE_MESSAGE); if (muleMsg == null) { return; } extractAndSet(message, muleMsg, Message.CONTENT_TYPE, HttpConstants.HEADER_CONTENT_TYPE); String method = (String) message.get(Message.HTTP_REQUEST_METHOD); if (method == null) method = HttpConstants.METHOD_POST; muleMsg.setProperty(HttpConnector.HTTP_METHOD_PROPERTY, method); Map> reqHeaders = CastUtils.cast((Map) message.get(Message.PROTOCOL_HEADERS)); if (reqHeaders != null) { for (Map.Entry> e : reqHeaders.entrySet()) { String key = e.getKey(); String val = format(e.getValue()); muleMsg.setProperty(key, val); } } if (!Boolean.TRUE.equals(message.containsKey(Message.REQUESTOR_ROLE))) { message.getInterceptorChain().pause(); } } private void extractAndSet(Message message, MessageAdapter muleMsg, String cxfHeader, String muleHeader) { String ct = (String) message.get(cxfHeader); if (ct != null) { muleMsg.setProperty(muleHeader, ct); } } private String format(List value) { StringBuilder sb = new StringBuilder(); boolean first = true; for (String s : value) { if (!first) { sb.append(", "); first = false; } else { first = false; } sb.append(s); } return sb.toString(); } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/wsdl/0000755000175000017500000000000011351410637025252 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/wsdl/CxfWsdlMessageDispatcher.java0000644000175000017500000000641710767604414033023 0ustar charlescharles/* * $Id: CxfWsdlMessageDispatcher.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.wsdl; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.transport.cxf.ClientWrapper; import org.mule.transport.cxf.CxfMessageDispatcher; import org.mule.util.StringUtils; import java.io.IOException; import javax.xml.namespace.QName; import org.apache.cxf.endpoint.dynamic.DynamicClientFactory; /** * TODO document */ public class CxfWsdlMessageDispatcher extends CxfMessageDispatcher { public CxfWsdlMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); } // @Override protected void doConnect() throws Exception { try { wrapper = new ClientWrapper() { @Override public void initialize() throws Exception, IOException { String wsdlUrl = endpoint.getEndpointURI().getAddress(); String serviceName = null; String portName = null; // If the property specified an alternative WSDL url, use it if (endpoint.getProperty("wsdlLocation") != null && StringUtils.isNotBlank(endpoint.getProperty("wsdlLocation").toString())) { wsdlUrl = (String) endpoint.getProperty("wsdlLocation"); } // If the property specified an alternative service, use it if (endpoint.getProperty("service") != null && StringUtils.isNotBlank(endpoint.getProperty("service").toString())) { serviceName = (String) endpoint.getProperty("service"); } // If the property specified an alternative port, use it if (endpoint.getProperty("port") != null && StringUtils.isNotBlank(endpoint.getProperty("port").toString())) { portName = (String) endpoint.getProperty("port"); } try { DynamicClientFactory cf = DynamicClientFactory.newInstance(bus); this.client = cf.createClient(wsdlUrl, (serviceName == null ? null : QName.valueOf(serviceName)), (portName == null ? null : QName.valueOf(portName))); addMuleInterceptors(); } catch (Exception ex) { disconnect(); throw ex; } } }; wrapper.setBus(connector.getCxfBus()); wrapper.setEndpoint(endpoint); wrapper.initialize(); } catch (Exception ex) { disconnect(); throw ex; } } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/wsdl/CxfWsdlConnector.java0000644000175000017500000000200510767604414031347 0ustar charlescharles/* * $Id: CxfWsdlConnector.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.wsdl; import org.mule.transport.cxf.CxfConnector; /** * TODO document */ public class CxfWsdlConnector extends CxfConnector { protected void registerProtocols() { registerSupportedProtocol("http"); registerSupportedProtocol("https"); // This allows the generic WSDL provider to created endpoints using this // connector registerSupportedProtocolWithoutPrefix("wsdl:http"); registerSupportedProtocolWithoutPrefix("wsdl:https"); } public String getProtocol() { return "wsdl-cxf"; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/wsdl/CxfWsdlMessageDispatcherFactory.javamule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/wsdl/CxfWsdlMessageDispatcherFactory.0000644000175000017500000000171010767604414033500 0ustar charlescharles/* * $Id: CxfWsdlMessageDispatcherFactory.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.wsdl; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * Creates an XFire WSDL Message Dispatcher */ public class CxfWsdlMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new CxfWsdlMessageDispatcher(endpoint); } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/i18n/0000755000175000017500000000000011351410636025057 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/i18n/CxfMessages.java0000755000175000017500000000477010767604414030156 0ustar charlescharles/* * $Id: CxfMessages.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class CxfMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("cxf"); public static Message serviceIsNull(String serviceName) { return createMessage(BUNDLE_PATH, 8, serviceName); } public static Message annotationsRequireJava5() { return createMessage(BUNDLE_PATH, 9); } public static Message couldNotInitAnnotationProcessor(Object object) { return createMessage(BUNDLE_PATH, 10, object); } public static Message unableToInitBindingProvider(String bindingProvider) { return createMessage(BUNDLE_PATH, 11, bindingProvider); } public static Message unableToLoadServiceClass(String classname) { return createMessage(BUNDLE_PATH,12,classname); } public static Message unableToConstructAdapterForNullMessage() { return createMessage(BUNDLE_PATH,13); } public static Message inappropriateMessageTypeForAttachments(String className) { return createMessage(BUNDLE_PATH,14,className); } public static Message bothServiceClassAndWsdlUrlAreRequired() { return createMessage(BUNDLE_PATH,15); } public static Message incorrectlyFormattedEndpointUri(String uri) { return createMessage(BUNDLE_PATH,16,uri); } public static Message invalidFrontend(String frontend) { return createMessage(BUNDLE_PATH,17,frontend); } public static Message portNotFound(String port) { return createMessage(BUNDLE_PATH,18,port); } public static Message mustSpecifyPort() { return createMessage(BUNDLE_PATH,19); } public static Message wsdlNotFound(String loc) { return createMessage(BUNDLE_PATH,20,loc); } public static Message noOperationWasFoundOrSpecified() { return createMessage(BUNDLE_PATH,21); } public static Message javaComponentRequiredForInboundEndpoint() { return createMessage(BUNDLE_PATH,22); } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/CxfServiceComponent.java0000755000175000017500000003347311004437405031102 0ustar charlescharles/* * $Id: CxfServiceComponent.java 11646 2008-04-25 20:28:53Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.ExceptionPayload; import org.mule.api.MuleEvent; import org.mule.api.MuleEventContext; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.ConfigurationException; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointNotFoundException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.Lifecycle; import org.mule.api.transport.OutputHandler; import org.mule.config.i18n.MessageFactory; import org.mule.message.DefaultExceptionPayload; import org.mule.transport.cxf.support.DelegatingOutputStream; import org.mule.transport.cxf.transport.MuleUniversalDestination; import org.mule.transport.cxf.transport.MuleUniversalTransport; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import org.mule.transport.soap.SoapConstants; import org.mule.util.StringUtils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import javax.xml.stream.XMLStreamReader; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.cxf.Bus; import org.apache.cxf.BusException; import org.apache.cxf.io.CachedOutputStream; import org.apache.cxf.message.ExchangeImpl; import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageImpl; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.staxutils.StaxUtils; import org.apache.cxf.transport.DestinationFactoryManager; import org.apache.cxf.transport.MessageObserver; import org.apache.cxf.transport.local.LocalConduit; import org.apache.cxf.transports.http.QueryHandler; import org.apache.cxf.transports.http.QueryHandlerRegistry; import org.xmlsoap.schemas.wsdl.http.AddressType; /** * The CXF receives messages from Mule, converts them into CXF messages and dispatches * them into the receiving CXF destination. */ public class CxfServiceComponent implements Callable, Lifecycle { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); protected Bus bus; // manager to the component protected MuleUniversalTransport universalTransport; protected String transportClass; private CxfMessageReceiver receiver; public CxfServiceComponent(CxfMessageReceiver receiver) throws ConfigurationException { super(); this.receiver = receiver; this.bus = receiver.connector.getCxfBus(); try { universalTransport = (MuleUniversalTransport) getBus().getExtension( DestinationFactoryManager.class).getDestinationFactory(MuleUniversalTransport.TRANSPORT_ID); } catch (BusException e) { throw new ConfigurationException(e); } } public Object onCall(MuleEventContext eventContext) throws Exception { if (logger.isDebugEnabled()) { logger.debug(eventContext); } // if http request String request = eventContext.getMessage().getStringProperty(HttpConnector.HTTP_REQUEST_PROPERTY, StringUtils.EMPTY); String uri = eventContext.getEndpointURI().toString(); if (request.indexOf('?') > -1 || uri.indexOf('?') > -1) { return generateWSDLOrXSD(eventContext, request, uri); } else { return sendToDestination(eventContext, uri); } } protected Object generateWSDLOrXSD(MuleEventContext eventContext, String req, String uri) throws EndpointNotFoundException, IOException { // TODO: Is there a way to make this not so ugly? String ctxUri; String uriBase = null; EndpointURI epUri = eventContext.getEndpointURI(); String host = (String) eventContext.getMessage().getProperty("Host", epUri.getHost()); // This is the case of the HTTP message receiver. The servlet one sends different info if (req != null && req.length() > 0) { uriBase = epUri.getScheme() + "://" + host + epUri.getPath(); int qIdx = uriBase.indexOf('?'); if (qIdx > -1) { uriBase = uriBase.substring(0, qIdx); } qIdx = req.indexOf('?'); if (qIdx > -1) { req = req.substring(qIdx); } qIdx = req.indexOf('&'); if (qIdx > -1) { req = req.substring(0, qIdx); } uri = uriBase + req; } ctxUri = eventContext.getEndpointURI().getPath(); EndpointInfo ei = receiver.getServer().getEndpoint().getEndpointInfo(); if (uriBase != null) { ei.setAddress(uriBase); if (ei.getExtensor(AddressType.class) != null) { ei.getExtensor(AddressType.class).setLocation(uriBase); } } ByteArrayOutputStream out = new ByteArrayOutputStream(); String ct = null; for (QueryHandler qh : bus.getExtension(QueryHandlerRegistry.class).getHandlers()) { if (qh.isRecognizedQuery(uri, ctxUri, ei)) { ct = qh.getResponseContentType(uri, ctxUri); qh.writeResponse(uri, ctxUri, ei, out); out.flush(); } } String msg; if (ct == null) { ct = "text/plain"; msg = "No query handler found for URL."; } else { msg = out.toString(); } MuleMessage result = new DefaultMuleMessage(msg); result.setProperty(HttpConstants.HEADER_CONTENT_TYPE, ct); return result; } protected Object sendToDestination(MuleEventContext ctx, String uri) throws MuleException, IOException { try { final MessageImpl m = new MessageImpl(); final MuleMessage muleMsg = ctx.getMessage(); String method = (String) muleMsg.getProperty(HttpConnector.HTTP_METHOD_PROPERTY); String ct = (String) muleMsg.getProperty(HttpConstants.HEADER_CONTENT_TYPE); if (ct != null) { m.put(Message.CONTENT_TYPE, ct); } String path = (String) muleMsg.getProperty(HttpConnector.HTTP_REQUEST_PROPERTY); if (path == null) { path = ""; } if (method != null) { m.put(Message.HTTP_REQUEST_METHOD, method); m.put(Message.PATH_INFO, path); m.put(Message.BASE_PATH, ctx.getEndpointURI().getPath()); if (!"GET".equals(method.toUpperCase())) { Object payload = ctx.transformMessage(); if (payload instanceof InputStream) { m.put(Message.ENCODING, ctx.getEncoding()); m.setContent(InputStream.class, payload); } else if (payload instanceof Reader) { m.setContent(XMLStreamReader.class, StaxUtils.createXMLStreamReader((Reader) payload)); } else if (payload instanceof byte[]) { m.setContent(InputStream.class, new ByteArrayInputStream((byte[]) payload)); } else { InputStream is = (InputStream) ctx.transformMessage(InputStream.class); m.put(Message.ENCODING, ctx.getEncoding()); m.setContent(InputStream.class, is); } } } // TODO: Not sure if this is 100% correct - DBD String soapAction = getSoapAction(ctx.getMessage()); m.put(org.mule.transport.soap.SoapConstants.SOAP_ACTION_PROPERTY_CAPS, soapAction); EndpointInfo ei = receiver.getServer().getEndpoint().getEndpointInfo(); MuleUniversalDestination d = (MuleUniversalDestination) universalTransport.getDestination(ei); if (d.getMessageObserver() == null) { // TODO is this the right Mule exception? throw new EndpointNotFoundException(uri); } // Set up a listener for the response m.put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE); m.put(MuleProperties.MULE_EVENT_PROPERTY, RequestContext.getEvent()); m.setDestination(d); OutputHandler outputHandler = new OutputHandler() { public void write(MuleEvent event, OutputStream out) throws IOException { Message outFaultMessage = m.getExchange().getOutFaultMessage(); Message outMessage = m.getExchange().getOutMessage(); Message contentMsg = null; if (outFaultMessage != null) { contentMsg = outFaultMessage; } else if (outMessage != null) { contentMsg = outMessage; } DelegatingOutputStream delegate = (DelegatingOutputStream) contentMsg.getContent(OutputStream.class); out.write(((ByteArrayOutputStream) delegate.getOutputStream()).toByteArray()); delegate.setOutputStream(out); contentMsg.getInterceptorChain().resume(); out.flush(); } }; DefaultMuleMessage responseMsg = new DefaultMuleMessage(outputHandler); ExchangeImpl exchange = new ExchangeImpl(); exchange.setInMessage(m); exchange.put(CxfConstants.MULE_MESSAGE, responseMsg); // invoke the actual web service up until right before we serialize the respones d.getMessageObserver().onMessage(m); // Handle a fault if there is one. Message faultMsg = m.getExchange().getOutFaultMessage(); if (faultMsg != null) { Exception ex = faultMsg.getContent(Exception.class); if (ex != null) { ExceptionPayload exceptionPayload = new DefaultExceptionPayload(new Exception("")); ctx.getMessage().setExceptionPayload(exceptionPayload); } } return responseMsg; } catch (MuleException e) { logger.warn("Could not dispatch message to XFire!", e); throw e; } } /** * Gets the stream representation of the current message. If the message is set * for streaming the input stream on the UMOStreamMEssageAdapter will be used, * otherwise a byteArrayInputStream will be used to hold the byte[] * representation of the current message. * * @param context the event context * @return The inputstream for the current message * @throws MuleException */ protected InputStream getMessageStream(MuleEventContext context) throws MuleException { InputStream is; Object eventMsgPayload = context.transformMessage(); if (eventMsgPayload instanceof InputStream) { is = (InputStream) eventMsgPayload; } else { is = (InputStream) context.transformMessage(InputStream.class); } return is; } protected String getSoapAction(MuleMessage message) { String action = (String) message.getProperty(SoapConstants.SOAP_ACTION_PROPERTY); if (action != null && action.startsWith("\"") && action.endsWith("\"") && action.length() >= 2) { action = action.substring(1, action.length() - 1); } return action; } public Bus getBus() { return bus; } public void setBus(Bus bus) { this.bus = bus; } class ResponseListener implements MessageObserver { private Message message; public CachedOutputStream getCachedStream() { return message.getContent(CachedOutputStream.class); } public Message getMessage() { return message; } public synchronized void onMessage(Message message) { this.message = message; } } public void initialise() throws InitialisationException { if (bus == null) { throw new InitialisationException(MessageFactory.createStaticMessage("No Cxf bus instance, this component has not been initialized properly."), this); } } public void start() throws MuleException { // nothing to do } public void stop() throws MuleException { // nothing to do } public void dispose() { // template method } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/config/0000755000175000017500000000000011351410637025546 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/config/EndpointChildDefinitionParser.javamule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/config/EndpointChildDefinitionParser.0000644000175000017500000000352510761364545033500 0ustar charlescharles/* * $Id: EndpointChildDefinitionParser.java 11101 2008-02-27 22:51:17Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.config; import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser; import org.mule.config.spring.parsers.processors.NamedSetterChildElementIterator; import org.mule.config.spring.parsers.processors.AddAttribute; import org.mule.config.spring.parsers.assembly.MapEntryCombiner; import org.mule.config.spring.parsers.assembly.DefaultBeanAssemblerFactory; import org.mule.config.spring.parsers.assembly.configuration.SimplePropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; public class EndpointChildDefinitionParser extends ChildSingletonMapDefinitionParser { public static final String PROPERTIES = "properties"; public EndpointChildDefinitionParser(String elementName) { super(PROPERTIES); addCollection(PROPERTIES); addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE); PropertyConfiguration configuration = new SimplePropertyConfiguration(); configuration.addCollection(MapEntryCombiner.VALUE); registerPreProcessor(new AddAttribute(MapEntryCombiner.KEY, elementName)); registerPostProcessor( new NamedSetterChildElementIterator( MapEntryCombiner.VALUE, new DefaultBeanAssemblerFactory(), configuration)); } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/config/CxfNamespaceHandler.java0000755000175000017500000000327211005452007032244 0ustar charlescharles/* * $Id: CxfNamespaceHandler.java 11654 2008-04-28 22:47:35Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.transport.cxf.CxfConnector; import org.mule.transport.cxf.CxfConstants; public class CxfNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerMetaTransportEndpoints(CxfConnector.CXF); registerConnectorDefinitionParser(CxfConnector.class); registerBeanDefinitionParser("features", new EndpointChildDefinitionParser("features")); registerBeanDefinitionParser(CxfConstants.DATA_BINDING, new EndpointChildDefinitionParser( CxfConstants.DATA_BINDING)); registerBeanDefinitionParser(CxfConstants.IN_INTERCEPTORS, new EndpointChildDefinitionParser( CxfConstants.IN_INTERCEPTORS)); registerBeanDefinitionParser(CxfConstants.IN_FAULT_INTERCEPTORS, new EndpointChildDefinitionParser( CxfConstants.IN_FAULT_INTERCEPTORS)); registerBeanDefinitionParser(CxfConstants.OUT_INTERCEPTORS, new EndpointChildDefinitionParser( CxfConstants.OUT_INTERCEPTORS)); registerBeanDefinitionParser(CxfConstants.OUT_FAULT_INTERCEPTORS, new EndpointChildDefinitionParser( CxfConstants.OUT_FAULT_INTERCEPTORS)); } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/CxfComponentExceptionStrategy.java0000755000175000017500000000221110767604414033160 0ustar charlescharles/* * $Id: CxfComponentExceptionStrategy.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.service.DefaultServiceExceptionStrategy; import org.apache.cxf.interceptor.Fault; /** * This exception strategy forces the exception thrown from a web service invocation * to be passed as-is, not wrapped in a Mule exception object. This ensures the XFire * serialiser/deserialiser can send the correct exception object to the client. */ public class CxfComponentExceptionStrategy extends DefaultServiceExceptionStrategy { protected void defaultHandler(Throwable t) { if (t.getCause() instanceof Fault) { super.defaultHandler(t.getCause()); } else { super.defaultHandler(t); } } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/CxfMessageRequester.java0000755000175000017500000000604110757615756031117 0ustar charlescharles/* * $Id: CxfMessageRequester.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.InboundEndpoint; import org.mule.transport.AbstractMessageRequester; import java.util.Iterator; import java.util.Properties; import org.apache.cxf.endpoint.ClientImpl; /** * AxisMessageDispatcher is used to make soap requests via the Axis * soap client. */ public class CxfMessageRequester extends AbstractMessageRequester { protected CxfConnector connector; private ClientWrapper wrapper; public CxfMessageRequester(InboundEndpoint endpoint) { super(endpoint); this.connector = (CxfConnector)endpoint.getConnector(); } protected void doConnect() throws Exception { wrapper = new ClientWrapper(); wrapper.setBus(connector.getCxfBus()); wrapper.setEndpoint(endpoint); wrapper.initialize(); } protected void doDisconnect() throws Exception { } protected void doDispose() { // template method } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal cuases an exception */ protected MuleMessage doRequest(long timeout) throws Exception { ((ClientImpl)wrapper.getClient()).setSynchronousTimeout((int)timeout); String method = (String)endpoint.getProperty(MuleProperties.MULE_METHOD_PROPERTY); if (method == null) { method = (String)endpoint.getProperty(CxfConstants.OPERATION); } Properties params = endpoint.getEndpointURI().getUserParams(); Object args[] = new Object[params.size()]; int i = 0; for (Iterator iterator = params.values().iterator(); iterator.hasNext(); i++) { args[i] = iterator.next().toString(); } Object[] response = wrapper.getClient().invoke(method, args); if (response != null && response.length == 1) { return new DefaultMuleMessage(response[0]); } else { return new DefaultMuleMessage(response); } } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/ClientWrapper.java0000755000175000017500000003062611004437523027733 0ustar charlescharles/* * $Id: ClientWrapper.java 11647 2008-04-25 20:30:11Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.MuleEvent; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.transport.DispatchException; import org.mule.transport.cxf.i18n.CxfMessages; import org.mule.transport.cxf.support.MuleHeadersInInterceptor; import org.mule.transport.cxf.support.MuleHeadersOutInterceptor; import org.mule.transport.cxf.support.MuleProtocolHeadersOutInterceptor; import org.mule.transport.soap.i18n.SoapMessages; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.net.URL; import java.util.List; import javax.xml.namespace.QName; import javax.xml.ws.BindingProvider; import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; import javax.xml.ws.WebServiceClient; import org.apache.cxf.Bus; import org.apache.cxf.common.classloader.ClassLoaderUtils; import org.apache.cxf.endpoint.Client; import org.apache.cxf.endpoint.ClientImpl; import org.apache.cxf.endpoint.Endpoint; import org.apache.cxf.feature.AbstractFeature; import org.apache.cxf.frontend.ClientProxy; import org.apache.cxf.frontend.MethodDispatcher; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.resource.ResourceManager; import org.apache.cxf.resource.URIResolver; import org.apache.cxf.service.model.BindingOperationInfo; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.ChainInitiationObserver; import org.apache.cxf.transport.Destination; import org.apache.cxf.transport.DestinationFactory; import org.apache.cxf.transport.DestinationFactoryManager; import org.apache.cxf.transport.MessageObserver; public class ClientWrapper { protected ImmutableEndpoint endpoint; protected Bus bus; protected Client client; protected String defaultMethodName; // If we have a proxy we're going to invoke it directly // Since the JAX-WS proxy does extra special things for us. protected BindingProvider proxy; protected Method defaultMethod; public Client getClient() { return client; } public BindingProvider getProxy() { return proxy; } @SuppressWarnings("unchecked") public void initialize() throws Exception, IOException { String clientClass = (String) endpoint.getProperty(CxfConstants.CLIENT_CLASS); if (clientClass != null) { createClientFromClass(bus, clientClass); } else { createClientFromLocalServer(bus); } addInterceptors(client.getInInterceptors(), (List) endpoint.getProperty(CxfConstants.IN_INTERCEPTORS)); addInterceptors(client.getInFaultInterceptors(), (List) endpoint.getProperty(CxfConstants.IN_FAULT_INTERCEPTORS)); addInterceptors(client.getOutInterceptors(), (List) endpoint.getProperty(CxfConstants.OUT_INTERCEPTORS)); addInterceptors(client.getOutFaultInterceptors(), (List) endpoint.getProperty(CxfConstants.OUT_FAULT_INTERCEPTORS)); List features = (List) endpoint.getProperty(CxfConstants.OUT_FAULT_INTERCEPTORS); if (features != null) { for (AbstractFeature f : features) { f.initialize(client, bus); } } addMuleInterceptors(); } @SuppressWarnings("unchecked") private void addInterceptors(List col, List supplied) { if (supplied != null) { col.addAll(supplied); } } protected Method findMethod(Class clientCls) throws Exception { if (defaultMethod == null) { String op = (String) endpoint.getProperties().get(CxfConstants.OPERATION); if (op == null) { op = (String) endpoint.getProperties().get(CxfConstants.OPERATION); } if (op != null) { return getMethodFromOperation(op); } } return null; } protected BindingOperationInfo getOperation(String opName) throws Exception { // Normally its not this hard to invoke the CXF Client, but we're // sending along some exchange properties, so we need to use a more advanced // method Endpoint ep = client.getEndpoint(); QName q = new QName(ep.getService().getName().getNamespaceURI(), opName); BindingOperationInfo bop = ep.getBinding().getBindingInfo().getOperation(q); if (bop == null) { throw new Exception("No such operation: " + defaultMethod); } if (bop.isUnwrappedCapable()) { bop = bop.getUnwrappedOperation(); } return bop; } private Method getMethodFromOperation(String op) throws Exception { BindingOperationInfo bop = getOperation(op); MethodDispatcher md = (MethodDispatcher) client.getEndpoint().getService().get( MethodDispatcher.class.getName()); return md.getMethod(bop); } protected void createClientFromClass(Bus bus, String clientClassName) throws Exception { // TODO: Specify WSDL String wsdlLocation = (String) endpoint.getProperty(CxfConstants.WSDL_LOCATION); Class clientCls = ClassLoaderUtils.loadClass(clientClassName, getClass()); Service s = null; if (wsdlLocation != null) { Constructor cons = clientCls.getConstructor(URL.class, QName.class); ResourceManager rr = bus.getExtension(ResourceManager.class); URL url = rr.resolveResource(wsdlLocation, URL.class); if (url == null) { URIResolver res = new URIResolver(wsdlLocation); if (!res.isResolved()) { throw new CreateException(CxfMessages.wsdlNotFound(wsdlLocation), this); } url = res.getURL(); } WebServiceClient clientAnn = clientCls.getAnnotation(WebServiceClient.class); QName svcName = new QName(clientAnn.targetNamespace(), clientAnn.name()); s = (Service) cons.newInstance(url, svcName); } else { s = (Service) clientCls.newInstance(); } String port = (String) endpoint.getProperty(CxfConstants.CLIENT_PORT); if (port == null) { throw new CreateException(CxfMessages.mustSpecifyPort(), this); } proxy = null; if (port != null) { for (Method m : clientCls.getMethods()) { WebEndpoint we = m.getAnnotation(WebEndpoint.class); if (we != null && we.name().equals(port)) { proxy = (BindingProvider) m.invoke(s, new Object[0]); break; } } } if (proxy == null) { throw new CreateException(CxfMessages.portNotFound(port), this); } EndpointURI uri = endpoint.getEndpointURI(); if (uri.getUser() != null) { proxy.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, uri.getUser()); } if (uri.getPassword() != null) { proxy.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, uri.getPassword()); } proxy.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, uri.getAddress()); client = ClientProxy.getClient(proxy); defaultMethod = findMethod(clientCls); defaultMethodName = getDefaultMethodName(); } private String getDefaultMethodName() { EndpointURI endpointUri = endpoint.getEndpointURI(); String m = (String) endpointUri.getParams().get(MuleProperties.MULE_METHOD_PROPERTY); if (m == null) { m = (String) endpoint.getProperties().get(MuleProperties.MULE_METHOD_PROPERTY); } return m; } protected void createClientFromLocalServer(final Bus bus) throws Exception, IOException { String uri = endpoint.getEndpointURI().toString(); int idx = uri.indexOf('?'); if (idx != -1) { uri = uri.substring(0, idx); } EndpointInfo ei = new EndpointInfo(); ei.setAddress(uri); DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); DestinationFactory df = dfm.getDestinationFactoryForUri(uri); if (df == null) { throw new Exception("Could not find a destination factory for uri " + uri); } Destination dest = df.getDestination(ei); MessageObserver mo = dest.getMessageObserver(); if (mo instanceof ChainInitiationObserver) { ChainInitiationObserver cMo = (ChainInitiationObserver) mo; Endpoint cxfEP = cMo.getEndpoint(); client = new ClientImpl(bus, cxfEP); } else { throw new Exception("Could not create client! No Server was found directly on the endpoint: " + uri); } } protected void addMuleInterceptors() { client.getInInterceptors().add(new MuleHeadersInInterceptor()); client.getInFaultInterceptors().add(new MuleHeadersInInterceptor()); client.getOutInterceptors().add(new MuleHeadersOutInterceptor()); client.getOutFaultInterceptors().add(new MuleHeadersOutInterceptor()); client.getOutInterceptors().add(new MuleProtocolHeadersOutInterceptor()); client.getOutFaultInterceptors().add(new MuleProtocolHeadersOutInterceptor()); } protected String getMethodOrOperationName(MuleEvent event) throws DispatchException { // @TODO: Which of these *really* matter? String method = (String) event.getMessage().getProperty(MuleProperties.MULE_METHOD_PROPERTY); if (method == null) { method = (String) event.getMessage().getProperty(CxfConstants.OPERATION); } if (method == null) { method = defaultMethodName; } if (method == null) { throw new DispatchException(SoapMessages.cannotInvokeCallWithoutOperation(), event.getMessage(), event.getEndpoint()); } return method; } public void setEndpoint(ImmutableEndpoint endpoint) { this.endpoint = endpoint; } public void setBus(Bus bus) { this.bus = bus; } public boolean isProxy() { return proxy != null; } public BindingOperationInfo getOperation(MuleEvent event) throws Exception { String opName = getMethodOrOperationName(event); if (opName == null) { opName = defaultMethodName; } return getOperation(opName); } public Method getMethod(MuleEvent event) throws Exception { Method method = defaultMethod; if (method == null) { String opName = (String) event.getMessage().getProperty(CxfConstants.OPERATION); if (opName != null) { method = getMethodFromOperation(opName); } if (method == null) { opName = (String) endpoint.getProperty(CxfConstants.OPERATION); if (opName != null) { method = getMethodFromOperation(opName); } } if (method == null) { opName = defaultMethodName; if (opName != null) { method = getMethodFromOperation(opName); } } } if (method == null) { throw new DispatchException(CxfMessages.noOperationWasFoundOrSpecified(), event.getMessage(), endpoint); } return method; } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/transport/0000755000175000017500000000000011351410637026335 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/transport/MuleUniversalConduit.java0000755000175000017500000002665011005763611033334 0ustar charlescharles/* * $Id: MuleUniversalConduit.java 11664 2008-04-30 03:29:13Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.transport; import static org.apache.cxf.message.Message.DECOUPLED_CHANNEL_MESSAGE; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.RegistryContext; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleEventContext; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.OutputHandler; import org.mule.transport.DefaultMessageAdapter; import org.mule.transport.cxf.CxfConnector; import org.mule.transport.cxf.CxfConstants; import org.mule.transport.cxf.support.DelegatingOutputStream; import org.mule.transport.cxf.support.MuleProtocolHeadersOutInterceptor; import org.mule.transport.http.HttpConstants; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.util.logging.Logger; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.ExchangeImpl; import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageImpl; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.AbstractConduit; import org.apache.cxf.transport.Destination; import org.apache.cxf.transport.MessageObserver; import org.apache.cxf.ws.addressing.AttributedURIType; import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.apache.cxf.wsdl.EndpointReferenceUtils; /** * A Conduit is primarily responsible for sending messages from CXF to somewhere * else. This conduit takes messages which are being written and sends them to the * Mule bus. */ public class MuleUniversalConduit extends AbstractConduit { private static final Logger LOGGER = Logger.getLogger(MuleUniversalConduit.class.getName()); private EndpointInfo endpoint; private CxfConnector connector; private Destination decoupledDestination; private String decoupledEndpoint; private MuleUniversalTransport transport; private int decoupledDestinationRefCount; /** * @param ei The Endpoint being invoked by this destination. * @param t The EPR associated with this Conduit - i.e. the reply destination. */ public MuleUniversalConduit(MuleUniversalTransport transport, CxfConnector connector, EndpointInfo ei, EndpointReferenceType t) { super(getTargetReference(ei, t)); this.transport = transport; this.endpoint = ei; this.connector = connector; } @Override protected Logger getLogger() { return LOGGER; } public synchronized Destination getBackChannel() { if (decoupledDestination == null && decoupledEndpoint != null) { setUpDecoupledDestination(); } return decoupledDestination; } private void setUpDecoupledDestination() { EndpointInfo ei = new EndpointInfo(); ei.setAddress(decoupledEndpoint); try { decoupledDestination = transport.getDestination(ei); decoupledDestination.setMessageObserver(new InterposedMessageObserver()); duplicateDecoupledDestination(); } catch (IOException e) { throw new RuntimeException(e); } } /** * Prepare the message for writing. */ public void prepare(final Message message) throws IOException { // save in a separate place in case we need to resend the request final ByteArrayOutputStream cache = new ByteArrayOutputStream(); final DelegatingOutputStream delegating = new DelegatingOutputStream(cache); message.setContent(OutputStream.class, delegating); AbstractPhaseInterceptor i = new AbstractPhaseInterceptor(Phase.PRE_STREAM) { public void handleMessage(Message m) throws Fault { try { dispatchMuleMessage(m); } catch (IOException e) { throw new Fault(e); } } }; i.getAfter().add(MuleProtocolHeadersOutInterceptor.class.getName()); message.getInterceptorChain().add(i); OutputHandler handler = new OutputHandler() { public void write(MuleEvent event, OutputStream out) throws IOException { out.write(cache.toByteArray()); delegating.setOutputStream(out); // resume writing! message.getInterceptorChain().doIntercept(message); } }; // We can create a generic StreamMessageAdapter here as the underlying // transport will create one specific to the transport DefaultMessageAdapter req = new DefaultMessageAdapter(handler); message.getExchange().put(CxfConstants.MULE_MESSAGE, req); } protected void dispatchMuleMessage(Message m) throws IOException { String uri = setupURL(m); LOGGER.info("Sending message to " + uri); try { OutboundEndpoint ep = RegistryContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(uri); MessageAdapter req = (MessageAdapter) m.getExchange().get(CxfConstants.MULE_MESSAGE); MuleMessage result = sendStream(req, ep); // If we have a result, send it back to CXF if (result != null) { Message inMessage = new MessageImpl(); String contentType = req.getStringProperty(HttpConstants.HEADER_CONTENT_TYPE, "text/xml"); inMessage.put(Message.ENCODING, result.getEncoding()); inMessage.put(Message.CONTENT_TYPE, contentType); inMessage.setContent(InputStream.class, result.getPayload(InputStream.class)); // inMessage.setContent(InputStream.class, // result.getPayload(InputStream.class)); inMessage.setExchange(m.getExchange()); getMessageObserver().onMessage(inMessage); } } catch (Exception e) { if (e instanceof IOException) { throw (IOException) e; } IOException ex = new IOException("Could not send message to Mule."); ex.initCause(e); throw ex; } } private String setupURL(Message message) throws MalformedURLException { String value = (String) message.get(Message.ENDPOINT_ADDRESS); String pathInfo = (String) message.get(Message.PATH_INFO); String queryString = (String) message.get(Message.QUERY_STRING); String result = value != null ? value : getTargetOrEndpoint(); // REVISIT: is this really correct? if (null != pathInfo && !result.endsWith(pathInfo)) { result = result + pathInfo; } if (queryString != null) { result = result + "?" + queryString; } return result; } private String getTargetOrEndpoint() { if (target != null) { return target.getAddress().getValue(); } return endpoint.getAddress().toString(); } @SuppressWarnings("unchecked") public void onClose(final Message m) throws IOException { } protected MuleMessage sendStream(MessageAdapter sa, OutboundEndpoint ep) throws MuleException { MuleEventContext eventContext = RequestContext.getEventContext(); MuleSession session = null; if (eventContext != null) { session = eventContext.getSession(); } MuleMessage message = new DefaultMuleMessage(sa); if (session == null) { session = new DefaultMuleSession(message, connector.getSessionHandler(), connector.getMuleContext()); } MuleEvent event = new DefaultMuleEvent(message, ep, session, true); event.setTimeout(MuleEvent.TIMEOUT_NOT_SET_VALUE); RequestContext.setEvent(event); return ep.send(event); } public void close() { // in decoupled case, close response Destination if reference count // hits zero // if (decoupledDestination != null) { releaseDecoupledDestination(); } } private synchronized void duplicateDecoupledDestination() { decoupledDestinationRefCount++; } private synchronized void releaseDecoupledDestination() { if (--decoupledDestinationRefCount == 0) { // LOG.log(Level.INFO, "shutting down decoupled destination"); decoupledDestination.shutdown(); } } public String getDecoupledEndpoint() { return decoupledEndpoint; } public void setDecoupledEndpoint(String decoupledEndpoint) { this.decoupledEndpoint = decoupledEndpoint; } /** * Get the target endpoint reference. * * @param ei the corresponding EndpointInfo * @param t the given target EPR if available * @param bus the Bus * @return the actual target */ protected static EndpointReferenceType getTargetReference(EndpointInfo ei, EndpointReferenceType t) { EndpointReferenceType ref = null; if (null == t) { ref = new EndpointReferenceType(); AttributedURIType address = new AttributedURIType(); address.setValue(ei.getAddress()); ref.setAddress(address); if (ei.getService() != null) { EndpointReferenceUtils.setServiceAndPortName(ref, ei.getService().getName(), ei.getName() .getLocalPart()); } } else { ref = t; } return ref; } /** * Used to set appropriate message properties, exchange etc. as required for an * incoming decoupled response (as opposed what's normally set by the Destination * for an incoming request). */ protected class InterposedMessageObserver implements MessageObserver { /** * Called for an incoming message. * * @param inMessage */ public void onMessage(Message inMessage) { // disposable exchange, swapped with real Exchange on correlation inMessage.setExchange(new ExchangeImpl()); inMessage.put(DECOUPLED_CHANNEL_MESSAGE, Boolean.TRUE); inMessage.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_OK); inMessage.remove(Message.ASYNC_POST_RESPONSE_DISPATCH); incomingObserver.onMessage(inMessage); } } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/transport/MuleUniversalDestination.javamule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/transport/MuleUniversalDestination.ja0000755000175000017500000000645711004437405033662 0ustar charlescharles/* * $Id: MuleUniversalDestination.java 11646 2008-04-25 20:28:53Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.transport; import org.mule.transport.cxf.support.DelegatingOutputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.HttpURLConnection; import java.util.logging.Logger; import org.apache.cxf.message.Message; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.transport.AbstractConduit; import org.apache.cxf.transport.AbstractDestination; import org.apache.cxf.transport.Conduit; import org.apache.cxf.transport.ConduitInitiator; import org.apache.cxf.ws.addressing.EndpointReferenceType; public class MuleUniversalDestination extends AbstractDestination { public static final String RESPONSE_OBSERVER = "mule.destination.response.observer"; private static final Logger LOGGER = Logger.getLogger(MuleUniversalDestination.class.getName()); private MuleUniversalTransport transport; public MuleUniversalDestination(MuleUniversalTransport transport, EndpointReferenceType ref, EndpointInfo ei) { super(ref, ei); this.transport = transport; } @Override protected Conduit getInbuiltBackChannel(Message inMessage) { return new ResponseConduit(null); } @Override protected Logger getLogger() { return LOGGER; } @Override public void shutdown() { transport.remove(this); super.shutdown(); } @Override protected boolean markPartialResponse(Message partialResponse, EndpointReferenceType decoupledTarget) { // setup the outbound message to for 202 Accepted partialResponse.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_ACCEPTED); partialResponse.getExchange().put(EndpointReferenceType.class, decoupledTarget); return true; } /** * @return the associated conduit initiator, or null if decoupled mode not * supported. */ @Override protected ConduitInitiator getConduitInitiator() { return transport; } public class ResponseConduit extends AbstractConduit { public ResponseConduit(EndpointReferenceType arg0) { super(arg0); } public void prepare(Message message) throws IOException { // set an outputstream which will be used for things like attachment headers. // we'll stream the body later on down the line via the OutputHandler in CxfServiceComponent message.setContent(OutputStream.class, new DelegatingOutputStream(new ByteArrayOutputStream())); } @Override public void close(Message message) throws IOException { message.getContent(OutputStream.class).close(); } @Override protected Logger getLogger() { return LOGGER; } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/transport/MuleUniversalTransport.javamule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/transport/MuleUniversalTransport.java0000755000175000017500000001615210777050076033730 0ustar charlescharles/* * $Id: MuleUniversalTransport.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.transport; import org.mule.transport.cxf.CxfConnector; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import javax.wsdl.Port; import javax.wsdl.extensions.http.HTTPAddress; import javax.wsdl.extensions.soap.SOAPAddress; import javax.xml.namespace.QName; import org.apache.cxf.Bus; import org.apache.cxf.service.Service; import org.apache.cxf.service.model.BindingInfo; import org.apache.cxf.service.model.EndpointInfo; import org.apache.cxf.service.model.ServiceInfo; import org.apache.cxf.transport.AbstractTransportFactory; import org.apache.cxf.transport.Conduit; import org.apache.cxf.transport.ConduitInitiator; import org.apache.cxf.transport.Destination; import org.apache.cxf.transport.DestinationFactory; import org.apache.cxf.ws.addressing.AttributedURIType; import org.apache.cxf.ws.addressing.EndpointReferenceType; import org.apache.cxf.wsdl11.WSDLEndpointFactory; import org.xmlsoap.schemas.wsdl.http.AddressType; public class MuleUniversalTransport extends AbstractTransportFactory implements ConduitInitiator, DestinationFactory, WSDLEndpointFactory { public static final String TRANSPORT_ID = "http://mule.codehaus.org/cxf"; private static Set PREFIXES = new HashSet(); static { PREFIXES.add("http://"); PREFIXES.add("https://"); PREFIXES.add("jms://"); PREFIXES.add("vm://"); PREFIXES.add("xmpp://"); PREFIXES.add("smtp://"); PREFIXES.add("tcp://"); } private Map destinations = new HashMap(); private Bus bus; private CxfConnector connector; public MuleUniversalTransport(CxfConnector connector) { super(); ArrayList tids = new ArrayList(); tids.add("http://schemas.xmlsoap.org/soap/http"); setTransportIds(tids); this.connector = connector; } public Destination getDestination(EndpointInfo ei) throws IOException { return getDestination(ei, createReference(ei)); } protected Destination getDestination(EndpointInfo ei, EndpointReferenceType reference) throws IOException { String uri = reference.getAddress().getValue(); int idx = uri.indexOf('?'); if (idx != -1) { uri = uri.substring(0, idx); } synchronized (this) { Destination d = destinations.get(uri); if (d == null) { d = createDestination(ei, reference); destinations.put(uri, d); } return d; } } private Destination createDestination(EndpointInfo ei, EndpointReferenceType reference) { return new MuleUniversalDestination(this, reference, ei); } public Conduit getConduit(EndpointInfo ei) throws IOException { return new MuleUniversalConduit(this, connector, ei, null); } public Conduit getConduit(EndpointInfo ei, EndpointReferenceType target) throws IOException { return new MuleUniversalConduit(this, connector, ei, target); } EndpointReferenceType createReference(EndpointInfo ei) { EndpointReferenceType epr = new EndpointReferenceType(); AttributedURIType address = new AttributedURIType(); address.setValue(ei.getAddress()); epr.setAddress(address); return epr; } @Override public Set getUriPrefixes() { return PREFIXES; } public Bus getBus() { return bus; } public void setBus(Bus bus) { this.bus = bus; } void remove(MuleUniversalDestination destination) { destinations.remove(destination.getAddress().getAddress().getValue()); } public CxfConnector getConnector() { return connector; } // Stuff relating to building of the - // I have no idea how this really works, but it does public void createPortExtensors(EndpointInfo ei, Service service) { // TODO } @SuppressWarnings("unchecked") public EndpointInfo createEndpointInfo(ServiceInfo serviceInfo, BindingInfo b, Port port) { if (port != null) { List ees = port.getExtensibilityElements(); for (Iterator itr = ees.iterator(); itr.hasNext();) { Object extensor = itr.next(); if (extensor instanceof HTTPAddress) { final HTTPAddress httpAdd = (HTTPAddress) extensor; EndpointInfo info = new HttpEndpointInfo(serviceInfo, "http://schemas.xmlsoap.org/wsdl/http/"); info.setAddress(httpAdd.getLocationURI()); info.addExtensor(httpAdd); return info; } else if (extensor instanceof AddressType) { final AddressType httpAdd = (AddressType) extensor; EndpointInfo info = new HttpEndpointInfo(serviceInfo, "http://schemas.xmlsoap.org/wsdl/http/"); info.setAddress(httpAdd.getLocation()); info.addExtensor(httpAdd); return info; } } } HttpEndpointInfo hei = new HttpEndpointInfo(serviceInfo, "http://schemas.xmlsoap.org/wsdl/http/"); AddressType at = new HttpAddressType(); hei.addExtensor(at); return hei; } private static class HttpEndpointInfo extends EndpointInfo { AddressType saddress; HttpEndpointInfo(ServiceInfo serv, String trans) { super(serv, trans); } public void setAddress(String s) { super.setAddress(s); if (saddress != null) { saddress.setLocation(s); } } public void addExtensor(Object el) { super.addExtensor(el); if (el instanceof AddressType) { saddress = (AddressType) el; } } } private static class HttpAddressType extends AddressType implements HTTPAddress, SOAPAddress { public HttpAddressType() { super(); setElementType(new QName("http://schemas.xmlsoap.org/wsdl/soap/", "address")); } public String getLocationURI() { return getLocation(); } public void setLocationURI(String locationURI) { setLocation(locationURI); } } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/CxfConnector.java0000755000175000017500000002326711005635015027547 0ustar charlescharles/* * $Id: CxfConnector.java 11657 2008-04-29 15:09:01Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.MuleException; import org.mule.api.context.notification.MuleContextNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import org.mule.component.DefaultJavaComponent; import org.mule.context.notification.MuleContextNotification; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.model.seda.SedaService; import org.mule.object.SingletonObjectFactory; import org.mule.routing.inbound.DefaultInboundRouterCollection; import org.mule.transport.AbstractConnector; import org.mule.transport.cxf.transport.MuleUniversalTransport; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import org.apache.cxf.Bus; import org.apache.cxf.BusFactory; import org.apache.cxf.bus.spring.SpringBusFactory; import org.apache.cxf.endpoint.Server; import org.apache.cxf.transport.ConduitInitiatorManager; import org.apache.cxf.transport.DestinationFactoryManager; /** * Connects Mule to a CXF bus instance. */ public class CxfConnector extends AbstractConnector implements MuleContextNotificationListener { public static final String CXF = "cxf"; public static final String CXF_SERVICE_COMPONENT_NAME = "_cxfServiceComponent"; public static final String CONFIGURATION_LOCATION = "configurationLocation"; public static final String DEFAULT_MULE_NAMESPACE_URI = "http://www.muleumo.org"; public static final String BUS_PROPERTY = CXF; // The CXF Bus object private Bus bus; private String configurationLocation; private String defaultFrontend = CxfConstants.JAX_WS_FRONTEND; private List services = new ArrayList(); public CxfConnector() { super(); registerProtocols(); } protected void registerProtocols() { registerSupportedProtocol("http"); registerSupportedProtocol("https"); registerSupportedProtocol("jms"); registerSupportedProtocol("vm"); registerSupportedProtocol("servlet"); } public String getProtocol() { return CXF; } protected void doInitialise() throws InitialisationException { if (configurationLocation != null) { bus = new SpringBusFactory().createBus(configurationLocation); } else { bus = new SpringBusFactory().createBus(); } BusFactory.setDefaultBus(null); MuleUniversalTransport transport = new MuleUniversalTransport(this); DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", transport); dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", transport); dfm.registerDestinationFactory(MuleUniversalTransport.TRANSPORT_ID, transport); ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class); extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/", transport); extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/http", transport); extension.registerConduitInitiator(MuleUniversalTransport.TRANSPORT_ID, transport); // Registers the listener try { muleContext.registerListener(this); } catch (Exception e) { throw new InitialisationException(e, this); } } protected void doDispose() { // template method } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } protected void doStart() throws MuleException { } protected void doStop() throws MuleException { bus.shutdown(true); } public Bus getCxfBus() { return bus; } public void setCxfBus(Bus bus) { this.bus = bus; } public String getConfigurationLocation() { return configurationLocation; } public void setConfigurationLocation(String configurationLocation) { this.configurationLocation = configurationLocation; } public String getDefaultFrontend() { return defaultFrontend; } public void setDefaultFrontend(String defaultFrontend) { this.defaultFrontend = defaultFrontend; } @SuppressWarnings("unchecked") protected void registerReceiverWithMuleService(MessageReceiver receiver, EndpointURI ep) throws MuleException { CxfMessageReceiver cxfReceiver = (CxfMessageReceiver) receiver; Server server = cxfReceiver.getServer(); // TODO MULE-2228 Simplify this API SedaService c = new SedaService(); c.setName(CXF_SERVICE_COMPONENT_NAME + server.getEndpoint().getService().getName() + c.hashCode()); c.setModel(muleContext.getRegistry().lookupSystemModel()); CxfServiceComponent svcComponent = new CxfServiceComponent((CxfMessageReceiver) receiver); svcComponent.setBus(bus); c.setComponent(new DefaultJavaComponent(new SingletonObjectFactory(svcComponent))); // No determine if the endpointUri requires a new connector to be // registed in the case of http we only need to register the new // endpointUri if the port is different String endpoint = receiver.getEndpointURI().getAddress(); String scheme = ep.getScheme().toLowerCase(); boolean sync = receiver.getEndpoint().isSynchronous(); // If we are using sockets then we need to set the endpoint name appropiately // and if using http/https // we need to default to POST and set the Content-Type if (scheme.equals("http") || scheme.equals("https") || scheme.equals("ssl") || scheme.equals("tcp") || scheme.equals("servlet")) { receiver.getEndpoint().getProperties().put(HttpConnector.HTTP_METHOD_PROPERTY, "POST"); receiver.getEndpoint().getProperties().put(HttpConstants.HEADER_CONTENT_TYPE, "text/xml"); } QName serviceName = server.getEndpoint().getEndpointInfo().getName(); // The 'serviceEndpoint' is the outer protocol endpoint e.g. http if the // configured endpoint uri is 'cxf:http://' EndpointBuilder serviceEndpointbuilder = new EndpointURIEndpointBuilder(endpoint, muleContext); serviceEndpointbuilder.setSynchronous(sync); serviceEndpointbuilder.setName(ep.getScheme() + ":" + serviceName.getLocalPart()); // The outer 'serviceEndpoint' is not be configured with the transformers, // filters or security filter configured in configuration. c.setInboundRouter(new DefaultInboundRouterCollection()); c.getInboundRouter().addEndpoint( muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(serviceEndpointbuilder)); services.add(c); } /** * The method determines the key used to store the receiver against. * * @param service the service for which the endpoint is being registered * @param endpoint the endpoint being registered for the service * @return the key to store the newly created receiver against. In this case it * is the service name, which is equivilent to the Axis service name. */ @Override protected Object getReceiverKey(Service service, InboundEndpoint endpoint) { if (endpoint.getEndpointURI().getPort() == -1) { return service.getName(); } else { return endpoint.getEndpointURI().getAddress(); } } public void onNotification(ServerNotification event) { // We need to register the CXF service service once the model // starts because // when the model starts listeners on components are started, thus // all listener // need to be registered for this connector before the CXF service // service is registered. The implication of this is that to add a // new service and a // different http port the model needs to be restarted before the // listener is available if (event.getAction() == MuleContextNotification.CONTEXT_STARTED) { for (Service c : services) { try { muleContext.getRegistry().registerService(c); } catch (MuleException e) { handleException(e); } } } } public boolean isSyncEnabled(String protocol) { protocol = protocol.toLowerCase(); if (protocol.equals("http") || protocol.equals("https") || protocol.equals("ssl") || protocol.equals("tcp") || protocol.equals("servlet")) { return true; } else { return super.isSyncEnabled(protocol); } } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/CxfMessageRequesterFactory.java0000755000175000017500000000177610757615756032461 0ustar charlescharles/* * $Id: CxfMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; /** * CxfMessageRequesterFactory creates an CxfMessageRequester, used * for making SOAP calls using the CXF framework. */ public class CxfMessageRequesterFactory extends AbstractMessageRequesterFactory { public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new CxfMessageRequester(endpoint); } }mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/CxfMessageReceiver.java0000755000175000017500000002736511005452007030667 0ustar charlescharles/* * $Id: CxfMessageReceiver.java 11654 2008-04-28 22:47:35Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.MuleException; import org.mule.api.component.JavaComponent; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.service.ServiceAware; import org.mule.api.transport.Connector; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.cxf.i18n.CxfMessages; import org.mule.transport.cxf.support.MuleHeadersInInterceptor; import org.mule.transport.cxf.support.MuleProtocolHeadersOutInterceptor; import org.mule.transport.cxf.support.ProviderService; import org.mule.util.ClassUtils; import org.mule.util.StringUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import org.apache.commons.lang.BooleanUtils; import org.apache.cxf.Bus; import org.apache.cxf.aegis.databinding.AegisDatabinding; import org.apache.cxf.configuration.Configurer; import org.apache.cxf.databinding.DataBinding; import org.apache.cxf.endpoint.Server; import org.apache.cxf.feature.AbstractFeature; import org.apache.cxf.frontend.ServerFactoryBean; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.jaxws.JaxWsServerFactoryBean; import org.apache.cxf.service.factory.AbstractServiceConfiguration; import org.apache.cxf.service.factory.ReflectionServiceFactoryBean; /** * Create a CXF service. All messages for the service will be sent to the Mule bus a * la the MuleInvoker. */ public class CxfMessageReceiver extends AbstractMessageReceiver { protected CxfConnector connector; private Server server; private boolean bridge; public CxfMessageReceiver(Connector Connector, Service service, InboundEndpoint Endpoint) throws CreateException { super(Connector, service, Endpoint); connector = (CxfConnector) Connector; } @SuppressWarnings("unchecked") @Override protected void doInitialise() throws InitialisationException { try { Map endpointProps = getEndpoint().getProperties(); String wsdlUrl = (String) endpointProps.get(CxfConstants.WSDL_LOCATION); String bindingId = (String) endpointProps.get(CxfConstants.BINDING_ID); String frontend = (String) endpointProps.get(CxfConstants.FRONTEND); String bridge = (String) endpointProps.get(CxfConstants.BRIDGE); String serviceClassName = (String) endpointProps.get(CxfConstants.SERVICE_CLASS); String mtomEnabled = (String) endpointProps.get(CxfConstants.MTOM_ENABLED); List databinding = (List) endpointProps.get(CxfConstants.DATA_BINDING); List features = (List) endpointProps.get(CxfConstants.FEATURES); Class svcCls = null; Class targetCls = getTargetClass(); if (!StringUtils.isEmpty(serviceClassName)) { svcCls = ClassUtils.loadClass(serviceClassName, getClass()); } else { svcCls = targetCls; } if (BooleanUtils.toBoolean(bridge)) { svcCls = ProviderService.class; frontend = "jaxws"; } if (StringUtils.isEmpty(frontend)) { frontend = connector.getDefaultFrontend(); } ServerFactoryBean sfb = null; if (CxfConstants.SIMPLE_FRONTEND.equals(frontend)) { sfb = new ServerFactoryBean(); sfb.setDataBinding(new AegisDatabinding()); } else if (CxfConstants.JAX_WS_FRONTEND.equals(frontend)) { sfb = new JaxWsServerFactoryBean(); } else { throw new CreateException(CxfMessages.invalidFrontend(frontend), this); } if (databinding != null && databinding.size() > 0) { // TODO: find a way to make this not a list sfb.setDataBinding(databinding.get(0)); } if (!(service.getComponent() instanceof JavaComponent)) { throw new InitialisationException(CxfMessages.javaComponentRequiredForInboundEndpoint(), this); } else { sfb.setServiceBean(((JavaComponent) service.getComponent()).getObjectFactory().getInstance()); } // The binding - i.e. SOAP, XML, HTTP Binding, etc if (bindingId != null) { sfb.setBindingId(bindingId); } if (features != null) { sfb.setFeatures(features); } if (mtomEnabled != null) { Map properties = sfb.getProperties(); if (properties == null) { properties = new HashMap(); sfb.setProperties(properties); } properties.put("mtom-enabled", mtomEnabled); } sfb.setInInterceptors((List) endpointProps.get("inInterceptors")); sfb.setInFaultInterceptors((List) endpointProps.get("inFaultInterceptors")); sfb.setOutInterceptors((List) endpointProps.get("outInterceptors")); sfb.setOutFaultInterceptors((List) endpointProps.get("outFaultInterceptors")); if (sfb.getInInterceptors() == null) { sfb.setInInterceptors(new ArrayList()); } sfb.getInInterceptors().add(new MuleHeadersInInterceptor()); if (sfb.getOutInterceptors() == null) { sfb.setOutInterceptors(new ArrayList()); } sfb.getOutInterceptors().add(new MuleProtocolHeadersOutInterceptor()); if (sfb.getOutFaultInterceptors() == null) { sfb.setOutFaultInterceptors(new ArrayList()); } sfb.getOutInterceptors().add(new MuleProtocolHeadersOutInterceptor()); sfb.setServiceClass(svcCls); sfb.setAddress(getAddressWithoutQuery()); if (wsdlUrl != null) { sfb.setWsdlURL(wsdlUrl); } ReflectionServiceFactoryBean svcFac = sfb.getServiceFactory(); addIgnoredMethods(svcFac, Callable.class.getName()); addIgnoredMethods(svcFac, Initialisable.class.getName()); addIgnoredMethods(svcFac, Disposable.class.getName()); addIgnoredMethods(svcFac, ServiceAware.class.getName()); String name = (String) endpointProps.get(CxfConstants.NAME); // check if there is the namespace property on the service String namespace = (String) endpointProps.get(CxfConstants.NAMESPACE); // HACK because CXF expects a QName for the service initServiceName(svcCls, name, namespace, svcFac); boolean sync = endpoint.isSynchronous(); // default to synchronous if using http if (endpoint.getEndpointURI().getScheme().startsWith("http") || endpoint.getEndpointURI().getScheme().startsWith("servlet")) { sync = true; } sfb.setInvoker(new MuleInvoker(this, targetCls, sync)); sfb.setStart(false); Bus bus = connector.getCxfBus(); sfb.setBus(bus); initializeServerFactory(sfb); Configurer configurer = bus.getExtension(Configurer.class); if (null != configurer) { configurer.configureBean(sfb.getServiceFactory().getEndpointName().toString(), sfb); } server = sfb.create(); } catch (MuleException e) { throw new InitialisationException(e, this); } catch (ClassNotFoundException e) { // will be thrown in the case that the ClassUtils.loadClass() does // not find the class to load throw new InitialisationException(e, this); } catch (Exception e) { throw new InitialisationException(e, this); } } /** * If any custom initialization logic needs to be done, it can * be done by overriding this method. * @param sfb */ protected void initializeServerFactory(ServerFactoryBean sfb) { } private String getAddressWithoutQuery() { String a = getEndpointURI().getAddress(); int idx = a.lastIndexOf('?'); if (idx > -1) { a = a.substring(0, idx); } return a; } /** * Gross hack to support getting the service namespace from CXF if one wasn't * supplied. */ private void initServiceName(Class exposedInterface, String name, String namespace, ReflectionServiceFactoryBean svcFac) { svcFac.setServiceClass(exposedInterface); for (AbstractServiceConfiguration c : svcFac.getServiceConfigurations()) { c.setServiceFactory(svcFac); } if (name != null && namespace == null) { namespace = svcFac.getServiceQName().getNamespaceURI(); } else if (name == null && namespace != null) { name = svcFac.getServiceQName().getLocalPart(); } if (name != null) { svcFac.setServiceName(new QName(namespace, name)); } } public void addIgnoredMethods(ReflectionServiceFactoryBean svcFac, String className) { try { Class c = ClassUtils.loadClass(className, getClass()); for (int i = 0; i < c.getMethods().length; i++) { svcFac.getIgnoredMethods().add(c.getMethods()[i]); } } catch (ClassNotFoundException e) { // can be ignored. } } private Class getTargetClass() throws MuleException, ClassNotFoundException { try { return ((JavaComponent) service.getComponent()).getObjectType(); } catch (Exception e) { throw new CreateException(e, this); } } protected void doDispose() { // template method } public void doConnect() throws Exception { // Start the CXF Server server.start(); connector.registerReceiverWithMuleService(this, endpoint.getEndpointURI()); } public void doDisconnect() throws Exception { server.stop(); } public void doStart() throws MuleException { // nothing to do } public void doStop() throws MuleException { // nothing to do } public Server getServer() { return server; } public boolean isBridge() { return bridge; } } mule-2.0.1/transports/cxf/src/main/java/org/mule/transport/cxf/CxfMessageAdapter.java0000755000175000017500000000700011005635015030465 0ustar charlescharles/* * $Id: CxfMessageAdapter.java 11657 2008-04-29 15:09:01Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.DefaultMuleException; import org.mule.api.MuleException; import org.mule.transport.AbstractMessageAdapter; import org.mule.transport.cxf.i18n.CxfMessages; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.activation.DataHandler; import org.apache.cxf.attachment.AttachmentImpl; import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.message.AbstractWrappedMessage; import org.apache.cxf.message.Attachment; import org.apache.cxf.message.Message; /** * */ public class CxfMessageAdapter extends AbstractMessageAdapter { /** * Serial version */ private static final long serialVersionUID = -1L; private final Message payload; public CxfMessageAdapter(Message message) throws MuleException { if (message == null) { throw new DefaultMuleException(CxfMessages.unableToConstructAdapterForNullMessage()); } this.payload = message; } /** * @return the current payload */ public Object getPayload() { List objs = CastUtils.cast(payload.getContent(List.class)); if (objs == null) { // Seems Providers get objects stored this way Object o = payload.getContent(Object.class); if (o != null) { return o; } else { return new Object[0]; } } if (objs.size() == 1 && objs.get(0) != null) { return objs.get(0); } else { return objs.toArray(); } } public void addAttachment(String name, DataHandler dataHandler) throws Exception { Collection attachments = getAttachments(); AttachmentImpl newA = new AttachmentImpl(name); newA.setDataHandler(dataHandler); attachments.add(newA); } public void removeAttachment(String name) throws Exception { Collection attachments = getAttachments(); List newAttachments = new ArrayList(); for (Attachment attachment : attachments) { // @TODO: Get some clarify around expected contract, e.g., is an // ID? Ever? if (attachment.getId() != null && attachment.getId().equals(name)) { continue; } newAttachments.add(attachment); } payload.setAttachments(newAttachments); } protected Collection getAttachments() throws MuleException { if (payload instanceof AbstractWrappedMessage) { AbstractWrappedMessage soap = (AbstractWrappedMessage) payload; return soap.getAttachments(); } else { // @TODO: Maybe pass the connector down and use connector exception // instead? throw new DefaultMuleException(CxfMessages.inappropriateMessageTypeForAttachments(payload.getClass() .getName())); } } } mule-2.0.1/transports/cxf/src/main/resources/0000755000175000017500000000000011351410637021025 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/resources/META-INF/0000755000175000017500000000000011351410637022165 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/resources/META-INF/spring.schemas0000755000175000017500000000012110716267663025046 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/cxf/2.0/mule-cxf.xsd=META-INF/mule-cxf.xsdmule-2.0.1/transports/cxf/src/main/resources/META-INF/spring.handlers0000755000175000017500000000014110745677442025227 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/cxf/2.0=org.mule.transport.cxf.config.CxfNamespaceHandler mule-2.0.1/transports/cxf/src/main/resources/META-INF/services/0000755000175000017500000000000011351410637024010 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410637024577 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410637025541 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410637027556 5ustar charlescharlesmule-2.0.1/transports/cxf/src/main/resources/META-INF/services/org/mule/providers/cxf.properties0000644000175000017500000000061710754365306032470 0ustar charlescharlesconnector=org.mule.transport.cxf.CxfConnector dispatcher.factory=org.mule.transport.cxf.CxfMessageDispatcherFactory message.receiver=org.mule.transport.cxf.CxfMessageReceiver message.adapter=org.mule.transport.cxf.CxfMessageAdapter requester.factory=org.mule.transport.cxf.CxfMessageRequesterFactory inbound.transformer= outbound.transformer= endpoint.builder=org.mule.endpoint.UrlEndpointURIBuilder././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/cxf/src/main/resources/META-INF/services/org/mule/providers/wsdl-cxf.propertiesmule-2.0.1/transports/cxf/src/main/resources/META-INF/services/org/mule/providers/wsdl-cxf.propertie0000644000175000017500000000045410754365306033253 0ustar charlescharlesconnector=org.mule.transport.cxf.wsdl.CxfWsdlConnector dispatcher.factory=org.mule.transport.cxf.wsdl.CxfWsdlMessageDispatcherFactory message.adapter=org.mule.transport.cxf.CxfMessageAdapter inbound.transformer= outbound.transformer= endpoint.builder=org.mule.transport.soap.WsdlUrlEndpointURIBuildermule-2.0.1/transports/cxf/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410637026320 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/cxf/src/main/resources/META-INF/services/org/mule/i18n/cxf-messages.propertiesmule-2.0.1/transports/cxf/src/main/resources/META-INF/services/org/mule/i18n/cxf-messages.properties0000644000175000017500000000216410766654216033042 0ustar charlescharles1=Soap version {0} is not supported. 2=No service interfaces could be found for component "{0}" 3=Failed to register component "{0}" as a service 4=Cannot invoke WS call without an Operation. Set the 'method' param on your endpointUri or on the endpoint itself 5=Failed to process Soap Headers 6=Cannot remove a single attachment on a SOAP message. Set name to 'all' to remove all attchments 7=Couldn't open channel "{0}". 8=The service for name "{0}" is null. If this is a remote service try using the 'wsdl-xfire transport. 9=JSR 181 Annotations support requires at least Java 5. 10=Couldn't initialise JSR 181 Annotation processor {0} 11=Unable to initialise binding provider {0} 12= 13= 14= 15= 16= 17=The frontend {0} is invalid. "jaxws" or "simple" must be specified. 18=The port {0} was not found on the specified service. 19=You must specify a "port" property on outgoing CXF endpoints which use a generated client. 20=The specified wsdl could not be found: {0} 21=No operation was found or specified. You must specify an operation property on the message or endpoint. 22=A Java Component is required to use a CXF inbound endpoint.mule-2.0.1/transports/cxf/src/main/resources/META-INF/mule-cxf.xsd0000755000175000017500000001323711005452007024427 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/0000755000175000017500000000000011351410636017045 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/java/0000755000175000017500000000000011351410636017766 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/java/org/0000755000175000017500000000000011351410636020555 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/java/org/mule/0000755000175000017500000000000011351410636021517 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/0000755000175000017500000000000011351410636023553 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/0000755000175000017500000000000011351410636024333 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/ConfigurationTestCase.java0000755000175000017500000000354110767604414031460 0ustar charlescharles/* * $Id: ConfigurationTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.transport.Connector; import org.mule.tck.FunctionalTestCase; import org.mule.transport.cxf.CxfConnector; import java.util.Collection; import java.util.Iterator; import org.apache.cxf.Bus; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.interceptor.LoggingInInterceptor; public class ConfigurationTestCase extends FunctionalTestCase { public void testBusConfiguration() throws Exception { boolean found = false; Collection connectors = muleContext.getRegistry().lookupObjects(Connector.class); for (Iterator itr = connectors.iterator(); itr.hasNext();) { Connector c = (Connector) itr.next(); if (c instanceof CxfConnector) { System.out.println("Found connector"); Bus cxfBus = ((CxfConnector) c).getCxfBus(); for (Iterator itr2 = cxfBus.getInInterceptors().iterator(); itr2.hasNext();) { Interceptor i = (Interceptor) itr2.next(); if (i instanceof LoggingInInterceptor) { found = true; break; } } } } assertTrue("Did not find logging interceptor.", found); } protected String getConfigResources() { return "configuration-conf.xml"; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfBasicTestCase.java0000644000175000017500000000437310767604414030334 0ustar charlescharles/* * $Id: CxfBasicTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.module.xml.util.XMLUtils; import org.mule.tck.FunctionalTestCase; import org.mule.util.IOUtils; import javax.xml.transform.TransformerFactoryConfigurationError; import org.custommonkey.xmlunit.XMLUnit; public class CxfBasicTestCase extends FunctionalTestCase { private String echoWsdl; @Override protected void doSetUp() throws Exception { super.doSetUp(); echoWsdl = IOUtils.getResourceAsString("xfire-echo-service.wsdl", getClass()); XMLUnit.setIgnoreWhitespace(true); try { XMLUnit.getTransformerFactory(); } catch (TransformerFactoryConfigurationError e) { XMLUnit.setTransformerFactory(XMLUtils.TRANSFORMER_FACTORY_JDK5); } } public void testEchoService() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send("cxf:http://localhost:63081/services/Echo?method=echo", "Hello!", null); assertEquals("Hello!", result.getPayload()); } public void testEchoServiceSynchronous() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send("cxf:http://localhost:63083/services/Echo3?method=echo", "Hello!", null); assertEquals("Hello!", result.getPayload()); } public void testEchoWsdl() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.request("http://localhost:63081/services/Echo?wsdl", 5000); assertNotNull(result.getPayload()); XMLUnit.compareXML(echoWsdl, result.getPayloadAsString()); } protected String getConfigResources() { return "basic-conf.xml"; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/ServiceUsingAxisEndpointTestCase.javamule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/ServiceUsingAxisEndpointTestCase.java0000644000175000017500000000374410777664077033623 0ustar charlescharles/* * $Id: ServiceUsingAxisEndpointTestCase.java 11569 2008-04-11 13:31:43Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.List; import java.util.Map; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; public class ServiceUsingAxisEndpointTestCase extends FunctionalTestCase { public void testXFire() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm://xfire.in", new DefaultMuleMessage("Testing String")); assertNotNull(reply); assertNotNull(reply.getPayload()); assertEquals(reply.getPayloadAsString(), "Received: Testing String"); } public void testRequestWsdl() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); props.put("http.method", "GET"); MuleMessage reply = client.send("http://localhost:33382/services/XfireService?wsdl", "/services/Hello_Xfire?wsdl", props); assertNotNull(reply); assertNotNull(reply.getPayload()); Document document = DocumentHelper.parseText(reply.getPayloadAsString()); List nodes = document.selectNodes("//wsdl:definitions/wsdl:service"); assertEquals(((Element) nodes.get(0)).attribute("name").getStringValue(), "XfireService"); } protected String getConfigResources() { return "using-axis-conf.xml"; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/MtomTestCase.java0000755000175000017500000000473211005042656027556 0ustar charlescharles/* * $Id: MtomTestCase.java 11650 2008-04-27 09:21:50Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.tck.FunctionalTestCase; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.InputStream; import java.net.URL; import javax.activation.DataHandler; import javax.activation.FileDataSource; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.ws.BindingProvider; import javax.xml.ws.Holder; import javax.xml.ws.soap.SOAPBinding; import org.apache.cxf.endpoint.Client; import org.apache.cxf.feature.LoggingFeature; import org.apache.cxf.frontend.ClientProxy; import org.apache.cxf.helpers.IOUtils; import org.apache.cxf.mime.TestMtom; import org.apache.cxf.mime.TestMtomService; public class MtomTestCase extends FunctionalTestCase { public void testEchoService() throws Exception { URL wsdl = getClass().getResource("/wsdl/mtom_xop.wsdl"); assertNotNull(wsdl); TestMtomService svc = new TestMtomService(wsdl); TestMtom port = svc.getTestMtomPort(); BindingProvider bp = ((BindingProvider) port); bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:63081/services/mtom"); ((SOAPBinding) bp.getBinding()).setMTOMEnabled(true); Client client = ClientProxy.getClient(port); // new LoggingFeature().initialize(client, null); File file = new File("src/test/resources/mtom-conf.xml"); DataHandler dh = new DataHandler(new FileDataSource(file)); Holder name = new Holder("test"); Holder info = new Holder(dh); port.testXop(name, info); assertEquals("return detail + test", name.value); assertNotNull(info.value); InputStream input = info.value.getInputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream(); IOUtils.copy(input, bos); input.close(); } protected String getConfigResources() { return "mtom-conf.xml"; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/DatabindingTestCase.java0000755000175000017500000000173011005452007031034 0ustar charlescharles/* * $Id: CxfBasicTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class DatabindingTestCase extends FunctionalTestCase { public void testEchoWsdl() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.request("http://localhost:63081/services/Echo?wsdl", 5000); assertNotNull(result.getPayload()); } protected String getConfigResources() { return "databinding-conf.xml"; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/jaxws/0000755000175000017500000000000011351410636025467 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/jaxws/ClientTestCase.java0000755000175000017500000000331310767604414031220 0ustar charlescharles/* * $Id: ClientTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.jaxws; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; import org.apache.hello_world_soap_http.GreeterImpl; public class ClientTestCase extends FunctionalTestCase { public void testGeneratedClientWithQuartz() throws Exception { GreeterImpl impl = getGreeter(); Thread.sleep(3000); assertEquals(1, impl.getInvocationCount()); } private GreeterImpl getGreeter() throws Exception { Object instance = getComponent("greeterService"); return (GreeterImpl) instance; } public void testClientWithMuleClient() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); props.put("operation", "greetMe"); MuleMessage result = client.send("clientEndpoint", "Dan", props); assertEquals("Hello Dan", result.getPayload()); GreeterImpl impl = getGreeter(); Thread.sleep(3000); assertEquals(2, impl.getInvocationCount()); } protected String getConfigResources() { return "jaxws-client-conf.xml"; } }mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/jaxws/CxfJaxWsTestCase.java0000755000175000017500000000177610767604414031512 0ustar charlescharles/* * $Id: CxfJaxWsTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.jaxws; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class CxfJaxWsTestCase extends FunctionalTestCase { public void testEchoService() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send("cxf:http://localhost:63081/services/Echo?method=echo", "Hello!", null); assertEquals("Hello!", result.getPayload()); } protected String getConfigResources() { return "jaxws-conf.xml"; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/jaxws/ClientMessageGenerator.java0000755000175000017500000000143610777050076032744 0ustar charlescharles/* * $Id: ClientMessageGenerator.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.jaxws; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; public class ClientMessageGenerator implements Callable { public Object onCall(MuleEventContext eventContext) throws Exception { return generate(); } public String generate() { return "Dan"; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/WsdlCallTestCase.java0000644000175000017500000000756310767604414030363 0ustar charlescharles/* * $Id: WsdlCallTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import org.mule.transport.http.servlet.MuleReceiverServlet; import java.util.HashMap; import java.util.List; import java.util.Map; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.mortbay.http.HttpContext; import org.mortbay.http.SocketListener; import org.mortbay.jetty.Server; import org.mortbay.jetty.servlet.ServletHandler; import org.mortbay.util.InetAddrPort; public class WsdlCallTestCase extends FunctionalTestCase { public static final int HTTP_PORT = 63088; private Server httpServer; @Override protected void doSetUp() throws Exception { super.doSetUp(); httpServer = new Server(); SocketListener socketListener = new SocketListener(new InetAddrPort(HTTP_PORT)); httpServer.addListener(socketListener); HttpContext context = httpServer.getContext("/"); context.setRequestLog(null); ServletHandler handler = new ServletHandler(); handler.addServlet("MuleReceiverServlet", "/services/*", MuleReceiverServlet.class.getName()); context.addHandler(handler); httpServer.start(); } // @Override protected void doTearDown() throws Exception { super.doTearDown(); if (httpServer != null && httpServer.isStarted()) { httpServer.stop(); } } public void xtestRequestWsdlWithServlets() throws Exception { Map props = new HashMap(); props.put(HttpConnector.HTTP_METHOD_PROPERTY, "GET"); MuleClient client = new MuleClient(); MuleMessage result = client.send("http://localhost:" + HTTP_PORT + "/services/mycomponent?wsdl", null, props); assertNotNull(result); if (logger.isDebugEnabled()) { logger.debug(result.getPayloadAsString()); } String location = "http://localhost:" + HTTP_PORT + "/services/mycomponent?wsdl"; location = location.substring(0, location.length() - 5); assertTrue(result.getStringProperty(HttpConstants.HEADER_CONTENT_TYPE, "").startsWith("text/xml")); if (logger.isDebugEnabled()) { logger.debug(result.getPayloadAsString()); } Document document = DocumentHelper.parseText(result.getPayloadAsString()); List nodes = document.selectNodes("//wsdl:definitions/wsdl:service"); assertEquals(((Element) nodes.get(0)).attribute("name").getStringValue(), "mycomponent"); } public void testRequestWsdlWithHttp() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); props.put("http.method", "GET"); MuleMessage reply = client.send("http://localhost:63082/cxfService?wsdl", null, props); assertNotNull(reply); assertNotNull(reply.getPayload()); Document document = DocumentHelper.parseText(reply.getPayloadAsString()); List nodes = document.selectNodes("//wsdl:definitions/wsdl:service"); assertEquals(((Element) nodes.get(0)).attribute("name").getStringValue(), "TestServiceComponent"); } protected String getConfigResources() { return "wsdl-conf.xml"; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/SoapRequestNoMethodParamTestCase.javamule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/SoapRequestNoMethodParamTestCase.java0000644000175000017500000000346010767604414033540 0ustar charlescharles/* * $Id: SoapRequestNoMethodParamTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class SoapRequestNoMethodParamTestCase extends FunctionalTestCase { private static final String request = "Test String"; private static final String response = "Received: null"; public void testCXFSoapRequest() throws Exception { MuleClient client = new MuleClient(); MuleMessage msg = client.send("http://localhost:63381/services/TestComponent", new DefaultMuleMessage(request)); assertNotNull(msg); assertNotNull(msg.getPayload()); assertEquals(response, msg.getPayloadAsString()); } protected String getConfigResources() { return "soap-request-conf.xml"; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/client/0000755000175000017500000000000011351410636025611 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/client/GeneratedClientTestCase.java0000755000175000017500000000301510767604414033160 0ustar charlescharles/* * $Id: GeneratedClientTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.client; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class GeneratedClientTestCase extends FunctionalTestCase { public void testEchoService() throws Exception { // URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl"); // assertNotNull(wsdl); // SOAPService service = new SOAPService(wsdl, null); // Greeter soapPort = service.getSoapPort(); // String msg = "" + "" + " foo " + "" + ""; MuleClient client = new MuleClient(); MuleMessage result = client.send("http://localhost:63081/services/Echo", msg, null); byte[] res = (byte[]) result.getPayload(); String resString = new String(res); assertTrue(resString.indexOf(" foo ") != -1); } protected String getConfigResources() { return "bridge-conf.xml"; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfSoapEndpointTestCase.java0000644000175000017500000000704310767604414031713 0ustar charlescharles/* * $Id: CxfSoapEndpointTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class CxfSoapEndpointTestCase extends AbstractMuleTestCase { public void testEndpoint() throws Exception { String url = "cxf:http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2"; EndpointURI endpointUri = new MuleEndpointURI(url); endpointUri.initialise(); assertEquals("cxf", endpointUri.getSchemeMetaInfo()); // it's up to the client to actually strip off the method name if necessary assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2", endpointUri.getAddress()); assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); assertEquals(3, endpointUri.getParams().size()); url = "cxf:http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2"; endpointUri = new MuleEndpointURI(url); endpointUri.initialise(); assertEquals("cxf", endpointUri.getSchemeMetaInfo()); assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2", endpointUri.getAddress()); assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); assertEquals(3, endpointUri.getParams().size()); } public void testEndpointWithUserInfo() throws Exception { String url = "cxf:http://admin:pwd@www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2"; EndpointURI endpointUri = new MuleEndpointURI(url); endpointUri.initialise(); assertEquals("cxf", endpointUri.getSchemeMetaInfo()); // it's up to the client to actually strip off the method name if necessary assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2", endpointUri.getAddress()); assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); assertEquals(3, endpointUri.getParams().size()); assertEquals("admin:pwd", endpointUri.getUserInfo()); assertEquals("admin", endpointUri.getUser()); assertEquals("pwd", endpointUri.getPassword()); } public void testEndpointFinder() throws Exception { String url = "soap:http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2"; EndpointURI endpointUri = new MuleEndpointURI(url); endpointUri.initialise(); assertEquals("soap", endpointUri.getSchemeMetaInfo()); // it's up to the client to actually strip off the method name if necessary assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2", endpointUri.getAddress()); assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); assertEquals(3, endpointUri.getParams().size()); } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfConnectorTestCase.java0000644000175000017500000000211110767604414031231 0ustar charlescharles/* * $Id: CxfConnectorTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.apache.cxf.message.MessageImpl; public class CxfConnectorTestCase extends AbstractConnectorTestCase { public String getTestEndpointURI() { return "cxf:http://localhost:38009/cxf"; } public Object getValidMessage() throws Exception { return new MessageImpl(); } @Override public Connector createConnector() throws Exception { CxfConnector c = new CxfConnector(); c.setMuleContext(muleContext); c.setName("cxfConnector"); return c; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfComponentExceptionStrategyTestCase.javamule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfComponentExceptionStrategyTestCase0000644000175000017500000000563511004437405033726 0ustar charlescharles/* * $Id: CxfComponentExceptionStrategyTestCase.java 11646 2008-04-25 20:28:53Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.transport.DispatchException; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.cxf.testmodels.CustomFault; import org.mule.transport.cxf.testmodels.CxfEnabledFaultMessage; import org.apache.cxf.interceptor.Fault; public class CxfComponentExceptionStrategyTestCase extends FunctionalTestCase { public void testDefaultComponentExceptionStrategy() throws Exception { MuleClient client = new MuleClient(); try { client.send("cxf:http://localhost:63181/services/CxfDefault?method=testXFireException", "TEST", null); } catch (DispatchException ex) { final Throwable t = ex.getCause(); assertNotNull("Cause should've been filled in.", t); assertTrue(t instanceof CxfEnabledFaultMessage); } } /** * This doesn't work because of a bug in the CXF client code :-( * * @throws Exception */ public void xtestHandledException() throws Exception { MuleClient client = new MuleClient(); try { client.send( "cxf:http://localhost:63181/services/CxfWithExceptionStrategy?method=testXFireException", "TEST", null); } catch (DispatchException ex) { final Throwable t = ex.getCause(); t.printStackTrace(); assertNotNull("Cause should've been filled in.", t); assertTrue(t instanceof CxfEnabledFaultMessage); CxfEnabledFaultMessage cxfMsg = (CxfEnabledFaultMessage) t; CustomFault fault = cxfMsg.getFaultInfo(); assertNotNull(fault); assertEquals("Custom Exception Message", fault.getDescription()); } } public void testUnhandledException() throws Exception { MuleClient client = new MuleClient(); try { client.send( "cxf:http://localhost:63181/services/CxfWithExceptionStrategy?method=testNonXFireException", "TEST", null); } catch (DispatchException ex) { final Throwable t = ex.getCause(); assertNotNull("Cause should've been filled in.", t); assertTrue(t instanceof Fault); t.printStackTrace(); } } protected String getConfigResources() { return "exception-strategy-conf.xml"; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfConnectorVMFunctionalTestCase.javamule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfConnectorVMFunctionalTestCase.java0000644000175000017500000000206311004437405033512 0ustar charlescharles/* * $Id: CxfConnectorVMFunctionalTestCase.java 11646 2008-04-25 20:28:53Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.tck.providers.soap.AbstractSoapResourceEndpointFunctionalTestCase; public class CxfConnectorVMFunctionalTestCase extends AbstractSoapResourceEndpointFunctionalTestCase { @Override public void testRequest() throws Throwable { // TODO Auto-generated method stub super.testRequest(); } public String getConfigResources() { return getTransportProtocol() + "-mule-config.xml"; } protected String getTransportProtocol() { return "vm"; } protected String getSoapProvider() { return "cxf"; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/FeaturesTestCase.java0000644000175000017500000000261110745726444030425 0ustar charlescharles/* * $Id: FeaturesTestCase.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.tck.FunctionalTestCase; import org.mule.api.endpoint.ImmutableEndpoint; import java.util.Map; import java.util.List; import org.apache.cxf.feature.LoggingFeature; public class FeaturesTestCase extends FunctionalTestCase { protected String getConfigResources() { return "features-test.xml"; } public void testFeatures() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointBuilder("endpoint").buildInboundEndpoint(); assertNotNull(endpoint); Map properties = endpoint.getProperties(); assertNotNull(properties); assertEquals(1, properties.size()); assertNotNull(properties.get("features")); assertTrue(properties.get("features") instanceof List); List features = (List) properties.get("features"); assertEquals(2, features.size()); assertTrue(features.get(0) instanceof LoggingFeature); } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/issues/0000755000175000017500000000000011351410636025646 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/issues/ResponseTransformerMule2969TestCase.javamule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/issues/ResponseTransformerMule2969Tes0000644000175000017500000000231511002241057033434 0ustar charlescharles/* * $Id: ResponseTransformerMule2969TestCase.java 11606 2008-04-19 00:51:59Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.StringAppendTestTransformer; public class ResponseTransformerMule2969TestCase extends FunctionalTestCase { protected String getConfigResources() { return "response-transformer-mule2969.xml"; } public void testSyncResponse() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("cxf:http://localhost:4444/services/CXFService?method=echo", "request", null); assertNotNull(message); assertEquals("request" + StringAppendTestTransformer.DEFAULT_TEXT, message.getPayloadAsString()); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/issues/InboundTransformerMule3255TestCase.javamule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/issues/InboundTransformerMule3255Test0000644000175000017500000000213311005635015033407 0ustar charlescharles/* * $Id: InboundTransformerMule3255TestCase.java 11657 2008-04-29 15:09:01Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.issues; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class InboundTransformerMule3255TestCase extends FunctionalTestCase { protected String getConfigResources() { return "inbound-transformer-mule3255.xml"; } public void testSyncResponse() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = client.send("cxf:http://localhost:4444/services/CXFService?method=echo", "request", null); assertNotNull(message); assertEquals("request transformed", message.getPayload()); } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/bridge/0000755000175000017500000000000011351410636025567 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/bridge/BridgeTest.java0000755000175000017500000000233610767604414030506 0ustar charlescharles/* * $Id: BridgeTest.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.bridge; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class BridgeTest extends FunctionalTestCase { public void testEchoService() throws Exception { String msg = "" + "" + " foo " + "" + ""; MuleClient client = new MuleClient(); MuleMessage result = client.send("http://localhost:63081/services/Echo", msg, null); String resString = result.getPayloadAsString(); assertTrue(resString.indexOf(" foo ") != -1); } protected String getConfigResources() { return "bridge-conf.xml"; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/bridge/EchoComponent.java0000755000175000017500000000155510777050076031215 0ustar charlescharles/* * $Id: EchoComponent.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.bridge; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.Callable; import javax.xml.transform.Source; public class EchoComponent implements Callable { public Object onCall(MuleEventContext eventContext) throws Exception { MuleMessage message = eventContext.getMessage(); Source s = (Source) message.getPayload(); return s; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/MultipleConnectorsTestCase.java0000644000175000017500000000244310767604414032477 0ustar charlescharles/* * $Id: MultipleConnectorsTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class MultipleConnectorsTestCase extends FunctionalTestCase { protected String getConfigResources() { return "multiple-connectors.xml"; } public void testCxfConnector1() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("cxf1", new DefaultMuleMessage("mule")); assertEquals("Received: mule", reply.getPayloadAsString()); } public void testCxfConnector2() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("cxf2", new DefaultMuleMessage("mule")); assertEquals("Received: mule", reply.getPayloadAsString()); } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/wssec/0000755000175000017500000000000011351410636025457 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/wssec/ClientPasswordCallback.java0000755000175000017500000000225410766463006032716 0ustar charlescharles/* * $Id: ClientPasswordCallback.java 11366 2008-03-14 11:48:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.wssec; import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.UnsupportedCallbackException; import org.apache.ws.security.WSPasswordCallback; public class ClientPasswordCallback implements CallbackHandler { private static String password; public static void setPassword(String password) { ClientPasswordCallback.password = password; } public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; // set the password for our message. pc.setPassword(password); } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/wssec/ServerPasswordCallback.java0000755000175000017500000000225110766463006032743 0ustar charlescharles/* * $Id: ServerPasswordCallback.java 11366 2008-03-14 11:48:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.wssec; import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.UnsupportedCallbackException; import org.apache.ws.security.WSPasswordCallback; public class ServerPasswordCallback implements CallbackHandler { public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { WSPasswordCallback pc = (WSPasswordCallback) callbacks[0]; if (pc.getIdentifer().equals("joe")) { // set the password on the callback. This will be compared to the // password which was sent from the client. pc.setPassword("password"); } } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/wssec/UsernameTokenTestCase.java0000755000175000017500000000253310766463006032554 0ustar charlescharles/* * $Id: UsernameTokenTestCase.java 11366 2008-03-14 11:48:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.wssec; import org.mule.tck.FunctionalTestCase; import org.apache.hello_world_soap_http.GreeterImpl; public class UsernameTokenTestCase extends FunctionalTestCase { public void testUsernameToken() throws Exception { ClientPasswordCallback.setPassword("password"); GreeterImpl impl = getGreeter(); int i = 0; while (i < 100) { if (impl.getInvocationCount() > 0) { break; } Thread.sleep(50); } assertEquals(1, impl.getInvocationCount()); } private GreeterImpl getGreeter() throws Exception { Object instance = getComponent("greeterService"); return (GreeterImpl) instance; } protected String getConfigResources() { return "org/mule/transport/cxf/wssec/username-token-conf.xml"; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfConnectorHttpFunctionalTestCase.javamule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfConnectorHttpFunctionalTestCase.ja0000644000175000017500000000562611004467151033571 0ustar charlescharles/* * $Id: CxfConnectorHttpFunctionalTestCase.java 11649 2008-04-25 23:51:05Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.providers.soap.AbstractSoapUrlEndpointFunctionalTestCase; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; public class CxfConnectorHttpFunctionalTestCase extends AbstractSoapUrlEndpointFunctionalTestCase { protected String getTransportProtocol() { return "http"; } protected String getSoapProvider() { return "cxf"; } @Override public void testRequest() throws Throwable { // Fails on build server, but not locally... so do nothing for now. } /** * @throws Exception */ @SuppressWarnings("unchecked") public void testBinding() throws Exception { String url = "http://localhost:62108/"; String folder = "mule/"; String componentName = "mycomponent"; String fullPath = url + folder + componentName; MuleClient client = new MuleClient(); Map props = new HashMap(); props.put("http.method", "GET"); MuleMessage reply = client.send(fullPath + "?wsdl", folder + componentName + "?wsdl", props); assertNotNull(reply); assertNotNull(reply.getPayload()); Document document = DocumentHelper.parseText(reply.getPayloadAsString()); List nodes; nodes = document.selectNodes("//wsdl:definitions/wsdl:service"); Element element = (Element) nodes.get(0); assertEquals("TestServiceComponent", element.attribute("name").getStringValue()); nodes = document.selectNodes("//wsdl:definitions/wsdl:service/wsdl:port"); for (Iterator i = nodes.iterator(); i.hasNext();) { element = (Element) i.next(); if ((element.attribute("name").getStringValue().compareTo(componentName + "MulePort") == 0) || (element.attribute("name").getStringValue().compareTo(componentName + "LocalPort") == 0)) { Element tempElement = (Element) element.elements().get(0); String mulePort = tempElement.attribute("location").getStringValue(); assertEquals(fullPath, mulePort); } } } public String getConfigResources() { return getTransportProtocol() + "-mule-config.xml"; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfWsdlTestCase.java0000644000175000017500000000627610767604414030230 0ustar charlescharles/* * $Id: CxfWsdlTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.registry.Registry; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.module.client.MuleClient; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.AbstractConnector; import org.custommonkey.xmlunit.XMLAssert; import org.w3c.dom.Document; public class CxfWsdlTestCase extends AbstractMuleTestCase { public static final String TEST_URL = "wsdl-cxf:http://localhost:8080/mule-tests-external-cxf/services/TestService?WSDL&method=getTest"; public static final String TEST_URL_NOWSDL = "wsdl-cxf:http://localhost:8080/mule-tests-external-cxf/services/TestService?method=getTest"; public static final String TEST_URL_WSDL = "http://localhost:8080/mule-tests-external-cxf/services/TestService?wsdl"; public void testCxfWsdlService() throws Exception { MuleClient client = new MuleClient(); MuleMessage message = new DefaultMuleMessage("test1"); MuleMessage reply = client.send(TEST_URL, message); assertNotNull(reply); Document response = (Document) reply.getPayload(); assertNotNull(response); XMLAssert.assertXpathEvaluatesTo("test1", "//*[namespace-uri()='http://applications.external.tck.mule.org' and local-name()='key']", response); } /** * This tests the endpoint propery of wsdlUrl which specifies an alternative WSDL * location (see MULE-1368) */ public void testCxfWsdlServiceWithEndpointParam() throws Exception { Registry registry = muleContext.getRegistry(); EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(TEST_URL_NOWSDL, muleContext); endpointBuilder.setProperty("wsdlUrl", TEST_URL_WSDL); OutboundEndpoint endpoint = registry.lookupEndpointFactory().getOutboundEndpoint(endpointBuilder); MuleMessage message = new DefaultMuleMessage("test1"); MuleSession session = new DefaultMuleSession(message, ((AbstractConnector) endpoint.getConnector()).getSessionHandler(), muleContext); MuleEvent event = new DefaultMuleEvent(message, endpoint, session, true); MuleMessage reply = session.sendEvent(event); assertNotNull(reply); Document response = (Document) reply.getPayload(); assertNotNull(response); XMLAssert.assertXpathEvaluatesTo("test1", "//*[namespace-uri()='http://applications.external.tck.mule.org' and local-name()='key']", response); } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfBadSoapRequestTestCase.java0000644000175000017500000000460610767604414032174 0ustar charlescharles/* * $Id: CxfBadSoapRequestTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.List; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; public class CxfBadSoapRequestTestCase extends FunctionalTestCase { protected String getConfigResources() { return "soap-request-conf.xml"; } public void testSoapDocumentError() throws Exception { MuleClient client = new MuleClient(); String soapRequest = "" + "" + "" + "Bad Request" + "" + "" + ""; MuleMessage reply = client.send("http://localhost:63381/services/TestComponent", new DefaultMuleMessage( soapRequest)); assertNotNull(reply); assertNotNull(reply.getPayload()); Document document = DocumentHelper.parseText(reply.getPayloadAsString()); List fault = document.selectNodes("//soap:Envelope/soap:Body/soap:Fault/faultcode"); assertEquals(1, fault.size()); Element faultCodeElement = (Element) fault.get(0); assertEquals("soap:Client", faultCodeElement.getStringValue()); fault = document.selectNodes("//soap:Envelope/soap:Body/soap:Fault/faultstring"); assertEquals(1, fault.size()); Element faultStringElement = (Element) fault.get(0); assertEquals("Message part {http://www.muleumo.org}ssss was not recognized.", faultStringElement.getStringValue()); } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/testmodels/0000755000175000017500000000000011351410636026516 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/testmodels/CxfEnabledFaultMessage.javamule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/testmodels/CxfEnabledFaultMessage.jav0000644000175000017500000000230010767604414033520 0ustar charlescharles/* * $Id: CxfEnabledFaultMessage.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.testmodels; import javax.xml.namespace.QName; import org.apache.cxf.frontend.FaultInfoException; public class CxfEnabledFaultMessage extends FaultInfoException { CustomFault faultInfo; public CxfEnabledFaultMessage(String message, CustomFault fault) { super(message); this.faultInfo = fault; } public CxfEnabledFaultMessage(String message, Throwable t, CustomFault fault) { super(message, t); this.faultInfo = fault; } public CustomFault getFaultInfo() { return faultInfo; } public static QName getFaultName() { return new QName("http://org.mule.transport.cxf.xfire.testmodels/XFireTestService/", "XFireEnabledFaultMessage"); } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/testmodels/TestMtomImpl.java0000755000175000017500000000306511005042656031765 0ustar charlescharles/* * $Id: TestMtomImpl.java 11650 2008-04-27 09:21:50Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.testmodels; import java.io.IOException; import java.io.InputStream; import javax.activation.DataHandler; import javax.activation.FileDataSource; import javax.jws.WebService; import javax.xml.ws.Holder; import org.apache.cxf.mime.TestMtom; @WebService(serviceName = "TestMtomService", portName = "TestMtomPort", targetNamespace = "http://cxf.apache.org/mime", endpointInterface = "org.apache.cxf.mime.TestMtom", wsdlLocation = "testutils/mtom_xop.wsdl") public class TestMtomImpl implements TestMtom { public void testXop(Holder name, Holder attachinfo) { // TODO Auto-generated method stub name.value = "return detail + " + name.value; try { InputStream inputStream = attachinfo.value.getInputStream(); while (inputStream.read() != -1); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } attachinfo.value = new DataHandler(new FileDataSource("src/test/resources/mtom-conf.xml")); } }mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/testmodels/TestXFireComponent.java0000644000175000017500000000164210767604414033135 0ustar charlescharles/* * $Id: TestXFireComponent.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.testmodels; public class TestXFireComponent { public String testXFireException(String data) throws CxfEnabledFaultMessage { CustomFault fault = new CustomFault(); fault.setDescription("Custom Exception Message"); throw new CxfEnabledFaultMessage("XFire Exception Message", fault); } public String testNonXFireException(String data) { throw new UnsupportedOperationException("Non-XFire Enabled Exception"); } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/testmodels/CustomFault.java0000644000175000017500000000131310767604414031636 0ustar charlescharles/* * $Id: CustomFault.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.testmodels; public class CustomFault { private String description; public String getDescription() { return description; } public void setDescription(final String description) { this.description = description; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/testmodels/Echo.java0000755000175000017500000000135210777050076030254 0ustar charlescharles/* * $Id: Echo.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf.testmodels; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; @WebService public class Echo { @WebResult(name = "text") @WebMethod public String echo(@WebParam(name = "text") String s) { return s; } } mule-2.0.1/transports/cxf/src/test/java/org/mule/transport/cxf/CxfCustomHttpHeaderTestCase.java0000644000175000017500000000642110767604414032532 0ustar charlescharles/* * $Id: CxfCustomHttpHeaderTestCase.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.cxf; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.context.notification.MessageNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.context.notification.MessageNotification; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.concurrent.CountDownLatch; public class CxfCustomHttpHeaderTestCase extends FunctionalTestCase implements MessageNotificationListener { protected static final String endpointAddress = "http://localhost:63181/services/TestComponent?method=onReceive"; private MuleMessage notificationMsg = null; private CountDownLatch latch = null; protected void doSetUp() throws Exception { latch = new CountDownLatch(1); muleContext.registerListener(this); } protected void doTearDown() throws Exception { muleContext.unregisterListener(this); } public void testCxf() throws Exception { Object payload = new Object[]{"Test String"}; String myProperty = "myProperty"; HashMap props = new HashMap(); props.put(MuleProperties.MULE_USER_PROPERTY, "alan"); props.put(MuleProperties.MULE_METHOD_PROPERTY, "sayHello"); props.put(myProperty, myProperty); MuleClient client = new MuleClient(); MuleMessage reply = client.send("cxf:" + endpointAddress, payload, props); assertNotNull(reply); assertNotNull(reply.getPayload()); assertEquals("Test String Received", reply.getPayloadAsString()); // make sure all notifications have trickled in Thread.sleep(3000); // make sure we received a notification on xfire assertNotNull(notificationMsg); // MULE_USER should be allowed in assertEquals("alan", notificationMsg.getProperty(MuleProperties.MULE_USER_PROPERTY)); // mule properties should be removed assertNull(notificationMsg.getProperty(MuleProperties.MULE_IGNORE_METHOD_PROPERTY)); // custom properties should be allowed in assertEquals(myProperty, notificationMsg.getProperty(myProperty)); } public void onNotification(ServerNotification notification) { if (notification instanceof MessageNotification) { String uri = ((MessageNotification) notification).getEndpoint().getEndpointURI().toString(); if (endpointAddress.equals(uri)) { notificationMsg = (MuleMessage) notification.getSource(); latch.countDown(); } } else { fail("invalid notification: " + notification); } } protected String getConfigResources() { return "headers-conf.xml"; } } mule-2.0.1/transports/cxf/src/test/resources/0000755000175000017500000000000011351410636021057 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/resources/features-test.xml0000644000175000017500000000221510745726444024411 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/multiple-connectors.xml0000644000175000017500000000352410754365306025624 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/log4j.properties0000755000175000017500000000050210754365306024225 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/transports/cxf/src/test/resources/configuration-conf.xml0000755000175000017500000000141110754365306025404 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/bridge-conf.xml0000755000175000017500000000323210754365306023774 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/soap-request-conf.xml0000644000175000017500000000267510754365306025177 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/vm-mule-config.xml0000644000175000017500000000506710754365306024447 0ustar charlescharles org.mule.api.component.simple.EchoService org.mule.tck.testmodels.services.DateService mule-2.0.1/transports/cxf/src/test/resources/exception-strategy-conf.xml0000644000175000017500000000261710766460764026410 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/using-axis-conf.xml0000644000175000017500000000554410754365306024634 0ustar charlescharles s;string;in return;string mule-2.0.1/transports/cxf/src/test/resources/databinding-conf.xml0000755000175000017500000000313311005452007024765 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/org/0000755000175000017500000000000011351410636021646 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/resources/org/mule/0000755000175000017500000000000011351410636022610 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/resources/org/mule/transport/0000755000175000017500000000000011351410636024644 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/resources/org/mule/transport/cxf/0000755000175000017500000000000011351410636025424 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/resources/org/mule/transport/cxf/wssec/0000755000175000017500000000000011351410636026550 5ustar charlescharlesmule-2.0.1/transports/cxf/src/test/resources/org/mule/transport/cxf/wssec/username-token-conf.xml0000755000175000017500000000651511003303461033153 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/basic-conf.xml0000755000175000017500000000322010754365306023616 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/cxf-config.xml0000755000175000017500000000066510754365306023647 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/bus-conf.xml0000755000175000017500000000415210754365306023333 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/jaxws-conf.xml0000755000175000017500000000214010754365306023671 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/response-transformer-mule2969.xml0000644000175000017500000000337111002241057027265 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/mule-xfire-conf.xml0000644000175000017500000000137610754365306024621 0ustar charlescharles Testing XFire http headers mule-2.0.1/transports/cxf/src/test/resources/test-wsdl-conf.xml0000644000175000017500000000204310754365306024462 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/wsdl-conf.xml0000755000175000017500000000310110754365306023504 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/mtom-conf.xml0000755000175000017500000000211611004437405023501 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/inbound-transformer-mule3255.xml0000644000175000017500000000245411005635015027057 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/xfire-echo-service.wsdl0000644000175000017500000001020410711661761025444 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/http-mule-config.xml0000644000175000017500000000407610754365306025003 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/mule-test-exclusions.txt0000755000175000017500000000137311005635015025734 0ustar charlescharles# # Test cases listed in this file are not run. # # This class matches surefire's include pattern by accident. # Don't execute it as it's not a unit test. org.mule.transport.cxf.testmodels.TestXFireComponent # tests with external dependencies org.mule.transport.cxf.CxfWsdlTestCase # Cyclic dependency with axis ... hold for now org.mule.transport.cxf.ServiceUsingAxisEndpointTestCase # Not working yet... org.mule.transport.cxf.client.GeneratedClientTestCase org.mule.transport.cxf.bridge.BridgeTest # Doesn't work on build server for some reason? org.mule.transport.cxf.jaxws.ClientTestCase # Weird serialization issues.. We shouldn't be using # FunctionalTestComponent as the basis for a service... org.mule.transport.cxf.CxfCustomHttpHeaderTestCase mule-2.0.1/transports/cxf/src/test/resources/jaxws-client-conf.xml0000755000175000017500000000466211004437405025145 0ustar charlescharles mule-2.0.1/transports/cxf/src/test/resources/headers-conf.xml0000644000175000017500000000204410766460764024157 0ustar charlescharles mule-2.0.1/transports/cxf/pom.xml0000755000175000017500000003200111006063605016610 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-cxf SOAP Transport: CXF A Mule transport for web service connectivity using CXF. org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 org.apache.maven.plugins maven-javadoc-plugin 1.5 org.mule.transports mule-transport-soap ${version} stax stax-api 1.0.1 org.apache.cxf cxf-rt-core ${cxfVersion} org.apache.geronimo.specs geronimo-activation_1.1_spec org.apache.geronimo.specs geronimo-javamail_1.4_spec org.apache.geronimo.specs geronimo-stax-api_1.0_spec commons-logging commons-logging org.apache.cxf cxf-rt-frontend-simple ${cxfVersion} org.apache.geronimo.specs geronimo-activation_1.1_spec org.apache.geronimo.specs geronimo-javamail_1.4_spec org.apache.geronimo.specs geronimo-stax-api_1.0_spec commons-logging commons-logging org.apache.cxf cxf-rt-frontend-jaxws ${cxfVersion} org.apache.geronimo.specs geronimo-activation_1.1_spec org.apache.geronimo.specs geronimo-javamail_1.4_spec org.apache.geronimo.specs geronimo-stax-api_1.0_spec commons-logging commons-logging org.apache.cxf cxf-rt-databinding-aegis ${cxfVersion} org.apache.geronimo.specs geronimo-activation_1.1_spec org.apache.geronimo.specs geronimo-javamail_1.4_spec org.apache.geronimo.specs geronimo-stax-api_1.0_spec commons-logging commons-logging org.apache.cxf cxf-rt-databinding-jaxb ${cxfVersion} org.apache.geronimo.specs geronimo-activation_1.1_spec org.apache.geronimo.specs geronimo-javamail_1.4_spec org.apache.geronimo.specs geronimo-stax-api_1.0_spec commons-logging commons-logging org.apache.cxf cxf-rt-transports-local ${cxfVersion} org.apache.geronimo.specs geronimo-activation_1.1_spec org.apache.geronimo.specs geronimo-javamail_1.4_spec org.apache.geronimo.specs geronimo-stax-api_1.0_spec commons-logging commons-logging javax.mail mail provided org.apache.cxf cxf-rt-transports-http ${cxfVersion} org.apache.geronimo.specs geronimo-activation_1.1_spec org.apache.geronimo.specs geronimo-javamail_1.4_spec org.apache.geronimo.specs geronimo-stax-api_1.0_spec commons-logging commons-logging org.apache.cxf cxf-rt-ws-security ${cxfVersion} test xalan xalan org.apache.cxf cxf-testutils ${cxfVersion} test ant ant 1.6.5 xerces xercesImpl xml-apis xml-apis org.mule mule-core ${version} test test-jar org.mule.transports mule-transport-soap ${version} test-jar test org.mule.transports mule-transport-vm ${version} test org.mule.transports mule-transport-quartz ${version} test org.mule.modules mule-module-client ${version} test xmlunit xmlunit 1.1 test apache-incubating Apache Incubating Repository http://people.apache.org/repo/m2-incubating-repository/ java.net Java.net Repository http://download.java.net/maven/1/ legacy mule-2.0.1/transports/http/0000755000175000017500000000000011351410635015475 5ustar charlescharlesmule-2.0.1/transports/http/src/0000755000175000017500000000000011351410633016262 5ustar charlescharlesmule-2.0.1/transports/http/src/main/0000755000175000017500000000000011351410634017207 5ustar charlescharlesmule-2.0.1/transports/http/src/main/java/0000755000175000017500000000000011351410633020127 5ustar charlescharlesmule-2.0.1/transports/http/src/main/java/org/0000755000175000017500000000000011351410633020716 5ustar charlescharlesmule-2.0.1/transports/http/src/main/java/org/mule/0000755000175000017500000000000011351410633021660 5ustar charlescharlesmule-2.0.1/transports/http/src/main/java/org/mule/transport/0000755000175000017500000000000011351410633023714 5ustar charlescharlesmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/0000755000175000017500000000000011351410634024674 5ustar charlescharlesmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpRequest.java0000644000175000017500000001474410745677442030063 0ustar charlescharles/* * $Id: HttpRequest.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.util.FileUtils; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import org.apache.commons.httpclient.ChunkedInputStream; import org.apache.commons.httpclient.ContentLengthInputStream; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HeaderElement; import org.apache.commons.httpclient.HeaderGroup; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.ByteArrayOutputStream; /** * A http request wrapper */ public class HttpRequest { private RequestLine requestLine = null; private HeaderGroup headers = new HeaderGroup(); private InputStream entity = null; public HttpRequest(final RequestLine requestLine, final Header[] headers, final InputStream content) throws IOException { super(); if (requestLine == null) { throw new IllegalArgumentException("Request line may not be null"); } this.requestLine = requestLine; if (headers != null) { this.headers.setHeaders(headers); } if (content != null) { // only PUT and POST have content String methodname = requestLine.getMethod(); if (HttpConstants.METHOD_POST.equalsIgnoreCase(methodname) || HttpConstants.METHOD_PUT.equalsIgnoreCase(methodname)) { Header contentLength = this.headers.getFirstHeader(HttpConstants.HEADER_CONTENT_LENGTH); Header transferEncoding = this.headers.getFirstHeader(HttpConstants.HEADER_TRANSFER_ENCODING); InputStream in = content; if (transferEncoding != null) { if (transferEncoding.getValue().indexOf(HttpConstants.TRANSFER_ENCODING_CHUNKED) != -1) { in = new ChunkedInputStream(in); } } else if (contentLength != null) { long len = getContentLength(); if (len >= 0) { in = new ContentLengthInputStream(in, len); } } this.entity = in; } } } public HttpRequest(final RequestLine requestLine, final Header[] headers) throws IOException { this(requestLine, headers, null); } public RequestLine getRequestLine() { return this.requestLine; } public void setRequestLine(final RequestLine requestline) { if (requestline == null) { throw new IllegalArgumentException("Request line may not be null"); } this.requestLine = requestline; } public boolean containsHeader(final String name) { return this.headers.containsHeader(name); } public Header[] getHeaders() { return this.headers.getAllHeaders(); } public Header getFirstHeader(final String s) { return this.headers.getFirstHeader(s); } public void removeHeaders(final String s) { if (s == null) { return; } Header[] headers = this.headers.getHeaders(s); for (int i = 0; i < headers.length; i++) { this.headers.removeHeader(headers[i]); } } public void addHeader(final Header header) { if (header == null) { return; } this.headers.addHeader(header); } public void setHeader(final Header header) { if (header == null) { return; } removeHeaders(header.getName()); addHeader(header); } public Iterator getHeaderIterator() { return this.headers.getIterator(); } public String getContentType() { Header contenttype = this.headers.getFirstHeader(HttpConstants.HEADER_CONTENT_TYPE); if (contenttype != null) { return contenttype.getValue(); } else { return HttpConstants.DEFAULT_CONTENT_TYPE; } } public String getCharset() { String charset = null; Header contenttype = this.headers.getFirstHeader(HttpConstants.HEADER_CONTENT_TYPE); if (contenttype != null) { HeaderElement values[] = contenttype.getElements(); if (values.length == 1) { NameValuePair param = values[0].getParameterByName("charset"); if (param != null) { charset = param.getValue(); } } } if (charset != null) { return charset; } else { //TODO return RegistryContext.getConfiguration().getDefaultEncoding(); return FileUtils.DEFAULT_ENCODING; } } public long getContentLength() { Header contentLength = this.headers.getFirstHeader(HttpConstants.HEADER_CONTENT_LENGTH); if (contentLength != null) { try { return Long.parseLong(contentLength.getValue()); } catch (NumberFormatException e) { return -1; } } else { return -1; } } public InputStream getBody() { return this.entity; } public byte[] getBodyBytes() throws IOException { InputStream in = getBody(); if (in != null) { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); IOUtils.copy(in, buffer); return buffer.toByteArray(); } else { return null; } } public String getBodyString() throws IOException { byte[] raw = getBodyBytes(); if (raw != null) { return new String(raw, getCharset()); } else { return null; } } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/package.html0000644000175000017500000000016010745677442027174 0ustar charlescharles Mule Provides http transport including proxy support. mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/StreamPayloadRequestEntity.java0000755000175000017500000000263110754365306033072 0ustar charlescharles/* * $Id: StreamPayloadRequestEntity.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.MuleEvent; import org.mule.api.transport.OutputHandler; import java.io.IOException; import java.io.OutputStream; import org.apache.commons.httpclient.methods.RequestEntity; public class StreamPayloadRequestEntity implements RequestEntity { private OutputHandler outputHandler; private MuleEvent event; public StreamPayloadRequestEntity(OutputHandler outputHandler, MuleEvent event) { this.outputHandler = outputHandler; this.event = event; } public boolean isRepeatable() { return true; } public void writeRequest(OutputStream outputStream) throws IOException { outputHandler.write(event, outputStream); } public long getContentLength() { return -1L; } public String getContentType() { return event.getMessage().getStringProperty(HttpConstants.HEADER_CONTENT_TYPE, HttpConstants.DEFAULT_CONTENT_TYPE); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpsMessageReceiver.java0000644000175000017500000000514110757615756031661 0ustar charlescharles/* * $Id: HttpsMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import java.io.IOException; import java.net.Socket; import java.security.cert.Certificate; import javax.net.ssl.HandshakeCompletedEvent; import javax.net.ssl.HandshakeCompletedListener; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSocket; import javax.resource.spi.work.Work; public class HttpsMessageReceiver extends HttpMessageReceiver { public HttpsMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); } // @Override protected Work createWork(Socket socket) throws IOException { return new HttpsWorker(socket); } private class HttpsWorker extends HttpWorker implements HandshakeCompletedListener { private Certificate[] peerCertificateChain; private Certificate[] localCertificateChain; public HttpsWorker(Socket socket) throws IOException { super(socket); ((SSLSocket) socket).addHandshakeCompletedListener(this); } protected void preRouteMessage(MuleMessage message) { super.preRouteMessage(message); if (peerCertificateChain != null) { message.setProperty(HttpsConnector.PEER_CERTIFICATES, peerCertificateChain); } if (localCertificateChain != null) { message.setProperty(HttpsConnector.LOCAL_CERTIFICATES, localCertificateChain); } } public void handshakeCompleted(HandshakeCompletedEvent event) { localCertificateChain = event.getLocalCertificates(); try { peerCertificateChain = event.getPeerCertificates(); } catch (SSLPeerUnverifiedException e) { logger.debug("Cannot get peer certificate chain: "+ e.getMessage()); } } } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/transformers/0000755000175000017500000000000011351410634027421 5ustar charlescharles././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/transformers/HttpClientMethodResponseToObject.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/transformers/HttpClientMethodRespon0000644000175000017500000000466110745677442034003 0ustar charlescharles/* * $Id: HttpClientMethodResponseToObject.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.transformers; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import org.mule.transport.NullPayload; import org.mule.transport.http.HttpConstants; import org.mule.transport.http.ReleasingInputStream; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpMethod; /** * HttpClientMethodResponseToObject transforms a http client response * to a DefaultMuleMessage. */ public class HttpClientMethodResponseToObject extends AbstractTransformer { public HttpClientMethodResponseToObject() { registerSourceType(HttpMethod.class); setReturnClass(MuleMessage.class); } public Object doTransform(Object src, String encoding) throws TransformerException { Object msg; HttpMethod httpMethod = (HttpMethod)src; InputStream is; try { is = httpMethod.getResponseBodyAsStream(); } catch (IOException e) { throw new TransformerException(this, e); } if (is == null) { msg = NullPayload.getInstance(); } else { msg = new ReleasingInputStream(is, httpMethod); } // Standard headers Map headerProps = new HashMap(); Header[] headers = httpMethod.getResponseHeaders(); String name; for (int i = 0; i < headers.length; i++) { name = headers[i].getName(); if (name.startsWith(HttpConstants.X_PROPERTY_PREFIX)) { name = name.substring(2); } headerProps.put(name, headers[i].getValue()); } // Set Mule Properties return new DefaultMuleMessage(msg, headerProps); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/transformers/ObjectToHttpClientMethodRequest.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/transformers/ObjectToHttpClientMeth0000644000175000017500000003246310756770615033722 0ustar charlescharles/* * $Id: ObjectToHttpClientMethodRequest.java 10896 2008-02-20 09:23:25Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.transformers; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.OutputHandler; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.transport.NullPayload; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import org.mule.transport.http.StreamPayloadRequestEntity; import org.mule.transport.http.i18n.HttpMessages; import org.mule.util.StringUtils; import java.io.InputStream; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.net.URI; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpVersion; import org.apache.commons.httpclient.methods.ByteArrayRequestEntity; import org.apache.commons.httpclient.methods.DeleteMethod; import org.apache.commons.httpclient.methods.EntityEnclosingMethod; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.HeadMethod; import org.apache.commons.httpclient.methods.InputStreamRequestEntity; import org.apache.commons.httpclient.methods.OptionsMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.StringRequestEntity; import org.apache.commons.httpclient.methods.TraceMethod; import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.commons.lang.SerializationUtils; /** * ObjectToHttpClientMethodRequest transforms a MuleMessage into a * HttpClient HttpMethod that represents an HttpRequest. */ public class ObjectToHttpClientMethodRequest extends AbstractMessageAwareTransformer { public ObjectToHttpClientMethodRequest() { setReturnClass(HttpMethod.class); registerSourceType(MuleMessage.class); registerSourceType(byte[].class); registerSourceType(String.class); registerSourceType(InputStream.class); registerSourceType(OutputHandler.class); } protected int addParameters(String queryString, PostMethod postMethod) { // Parse the HTTP argument list and convert to a NameValuePair // collection if (StringUtils.isBlank(queryString)) { return 0; } String currentParam; int equals; equals = queryString.indexOf("&"); if (equals > -1) { currentParam = queryString.substring(0, equals); queryString = queryString.substring(equals + 1); } else { currentParam = queryString; queryString = StringUtils.EMPTY; } int parameterIndex = -1; while (StringUtils.isNotBlank(currentParam)) { String paramName, paramValue; equals = currentParam.indexOf("="); if (equals > -1) { paramName = currentParam.substring(0, equals); paramValue = currentParam.substring(equals + 1); parameterIndex++; postMethod.addParameter(paramName, paramValue); } equals = queryString.indexOf("&"); if (equals > -1) { currentParam = queryString.substring(0, equals); queryString = queryString.substring(equals + 1); } else { currentParam = queryString; queryString = StringUtils.EMPTY; } } return parameterIndex + 1; } public Object transform(MuleMessage msg, String outputEncoding) throws TransformerException { Object src = msg.getPayload(); String endpoint = msg.getStringProperty(MuleProperties.MULE_ENDPOINT_PROPERTY, null); if (endpoint == null) { throw new TransformerException( HttpMessages.eventPropertyNotSetCannotProcessRequest( MuleProperties.MULE_ENDPOINT_PROPERTY), this); } String method = msg.getStringProperty(HttpConnector.HTTP_METHOD_PROPERTY, "POST"); try { URI uri = new URI(endpoint); HttpMethod httpMethod; if (HttpConstants.METHOD_GET.equals(method)) { httpMethod = new GetMethod(uri.toString()); String paramName = msg.getStringProperty(HttpConnector.HTTP_GET_BODY_PARAM_PROPERTY, HttpConnector.DEFAULT_HTTP_GET_BODY_PARAM_PROPERTY); String query = uri.getQuery(); if (!(src instanceof NullPayload) && !StringUtils.EMPTY.equals(src)) { if (query == null) { query = paramName + "=" + src.toString(); } else { query += "&" + paramName + "=" + src.toString(); } } httpMethod.setQueryString(query); } else if (HttpConstants.METHOD_POST.equalsIgnoreCase(method)) { PostMethod postMethod = new PostMethod(uri.toString()); String paramName = msg.getStringProperty(HttpConnector.HTTP_POST_BODY_PARAM_PROPERTY, null); if (paramName == null) { // Call method to manage the parameter array addParameters(uri.getQuery(), postMethod); setupEntityMethod(src, outputEncoding, msg, uri, postMethod); } else { postMethod.addParameter(paramName, src.toString()); } httpMethod = postMethod; } else if (HttpConstants.METHOD_PUT.equalsIgnoreCase(method)) { PutMethod putMethod = new PutMethod(uri.toString()); setupEntityMethod(src, outputEncoding, msg, uri, putMethod); httpMethod = putMethod; } else if (HttpConstants.METHOD_DELETE.equalsIgnoreCase(method)) { httpMethod = new DeleteMethod(uri.toString()); } else if (HttpConstants.METHOD_HEAD.equalsIgnoreCase(method)) { httpMethod = new HeadMethod(uri.toString()); } else if (HttpConstants.METHOD_OPTIONS.equalsIgnoreCase(method)) { httpMethod = new OptionsMethod(uri.toString()); } else if (HttpConstants.METHOD_TRACE.equalsIgnoreCase(method)) { httpMethod = new TraceMethod(uri.toString()); } else { throw new TransformerException(HttpMessages.unsupportedMethod(method)); } // Allow the user to set HttpMethodParams as an object on the message HttpMethodParams params = (HttpMethodParams) msg.removeProperty(HttpConnector.HTTP_PARAMS_PROPERTY); if (params != null) { httpMethod.setParams(params); } else { // TODO we should probably set other properties here String httpVersion = msg.getStringProperty(HttpConnector.HTTP_VERSION_PROPERTY, HttpConstants.HTTP11); if (HttpConstants.HTTP10.equals(httpVersion)) { httpMethod.getParams().setVersion(HttpVersion.HTTP_1_0); } else { httpMethod.getParams().setVersion(HttpVersion.HTTP_1_1); } } setHeaders(httpMethod, msg); return httpMethod; } catch (Exception e) { throw new TransformerException(this, e); } } protected void setupEntityMethod(Object src, String encoding, MuleMessage msg, URI uri, EntityEnclosingMethod postMethod) throws UnsupportedEncodingException, TransformerException { // Dont set a POST payload if the body is a Null Payload. // This way client calls // can control if a POST body is posted explicitly if (!(msg.getPayload() instanceof NullPayload)) { // See if we have a MIME type set String mimeType = msg.getStringProperty(HttpConstants.HEADER_CONTENT_TYPE, null); if (src instanceof String) { // Ensure that we strip the encoding information from the // encoding type if (mimeType != null) { int parameterIndex = mimeType.indexOf(";"); if (parameterIndex > 0) { mimeType = mimeType.substring(0, parameterIndex); } } if (mimeType == null) { mimeType = HttpConstants.DEFAULT_CONTENT_TYPE; } postMethod.setRequestEntity(new StringRequestEntity(src.toString(), mimeType, encoding)); return; } if (mimeType == null) { mimeType = HttpConstants.DEFAULT_CONTENT_TYPE; } if (encoding != null && !"UTF-8".equals(encoding.toUpperCase()) && mimeType.indexOf("charset") == -1) { mimeType += "; charset=" + encoding; } if (src instanceof InputStream) { // TODO Danger here! We don't know if the content is // really text or not if (mimeType == null) { mimeType = HttpConstants.DEFAULT_CONTENT_TYPE; } postMethod.setRequestEntity(new InputStreamRequestEntity((InputStream) src, mimeType)); } else if (src instanceof byte[]) { if (mimeType == null) { mimeType = HttpConstants.DEFAULT_CONTENT_TYPE; } postMethod.setRequestEntity(new ByteArrayRequestEntity((byte[]) src, mimeType)); } else if (src instanceof OutputHandler) { MuleEvent event = RequestContext.getEvent(); postMethod.setRequestEntity(new StreamPayloadRequestEntity((OutputHandler) src, event)); } else { if (mimeType == null) { mimeType = HttpConstants.DEFAULT_CONTENT_TYPE; } byte[] buffer = SerializationUtils.serialize((Serializable) src); postMethod.setRequestEntity(new ByteArrayRequestEntity(buffer, mimeType)); } } } protected void setHeaders(HttpMethod httpMethod, MuleMessage msg) { // Standard requestHeaders String headerValue; String headerName; for (Iterator iterator = msg.getPropertyNames().iterator(); iterator.hasNext();) { headerName = (String) iterator.next(); headerValue = msg.getStringProperty(headerName, null); if (HttpConstants.REQUEST_HEADER_NAMES.get(headerName) == null) { if (headerName.startsWith(MuleProperties.PROPERTY_PREFIX)) { headerName = new StringBuffer(30).append("X-").append(headerName).toString(); } httpMethod.addRequestHeader(headerName, headerValue); } } Map customHeaders = (Map) msg.getProperty(HttpConnector.HTTP_CUSTOM_HEADERS_MAP_PROPERTY); if (customHeaders != null) { Map.Entry entry; for (Iterator iterator = customHeaders.entrySet().iterator(); iterator.hasNext();) { entry = (Map.Entry) iterator.next(); if (entry.getValue() != null) { httpMethod.addRequestHeader(entry.getKey().toString(), entry.getValue().toString()); } } } Set attNams = msg.getAttachmentNames(); if (msg.getPayload() instanceof InputStream && attNams != null && attNams.size() > 0) { // must set this for receiver to properly parse attachments httpMethod.addRequestHeader(HttpConstants.HEADER_CONTENT_TYPE, "multipart/related"); } } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/transformers/MuleMessageToHttpResponse.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/transformers/MuleMessageToHttpRespo0000644000175000017500000002425710774254333033753 0ustar charlescharles/* * $Id: MuleMessageToHttpResponse.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.transformers; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transformer.TransformerException; import org.mule.config.MuleManifest; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.transport.NullPayload; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import org.mule.transport.http.HttpResponse; import org.mule.util.StringUtils; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Collection; import java.util.Date; import java.util.Iterator; import java.util.Locale; import java.util.Map; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpVersion; /** * UMOMessageToHttpResponse converts a UMOMEssage into an Http * response. */ public class MuleMessageToHttpResponse extends AbstractMessageAwareTransformer { public static final String CUSTOM_HEADER_PREFIX = ""; // @GuardedBy("itself") private SimpleDateFormat format; private String server; public MuleMessageToHttpResponse() { registerSourceType(Object.class); setReturnClass(HttpResponse.class); } //@Override public void initialise() throws InitialisationException { format = new SimpleDateFormat(HttpConstants.DATE_FORMAT, Locale.US); // When running with the source code, Meta information is not set // so product name and version are not available, hence we hard code if (MuleManifest.getProductName() == null) { server = "Mule/SNAPSHOT"; } else { server = MuleManifest.getProductName() + "/" + MuleManifest.getProductVersion(); } } public Object transform(MuleMessage msg, String outputEncoding) throws TransformerException { Object src = msg.getPayload(); // Send back the exception payload if one has been set if (msg.getExceptionPayload() != null) { // src = context.getMessage().getExceptionPayload(); } // Note this transformer excepts Null as we must always return a result // from the Http // connector if a response transformer is present if (src instanceof NullPayload) { src = StringUtils.EMPTY; } try { HttpResponse response; if (src instanceof HttpResponse) { response = (HttpResponse)src; } else { response = createResponse(src, outputEncoding, msg); } // Ensure there's a content type header if (!response.containsHeader(HttpConstants.HEADER_CONTENT_TYPE)) { response.addHeader(new Header(HttpConstants.HEADER_CONTENT_TYPE, HttpConstants.DEFAULT_CONTENT_TYPE)); } // Ensure there's a content length or transfer encoding header if (!response.containsHeader(HttpConstants.HEADER_CONTENT_LENGTH) && !response.containsHeader(HttpConstants.HEADER_TRANSFER_ENCODING)) { if (response.hasBody()) { long len = response.getContentLength(); if (len < 0) { if (response.getHttpVersion().lessEquals(HttpVersion.HTTP_1_0)) { throw new IOException("Chunked encoding not supported for HTTP version " + response.getHttpVersion()); } Header header = new Header(HttpConstants.HEADER_TRANSFER_ENCODING, "chunked"); response.addHeader(header); } else { Header header = new Header(HttpConstants.HEADER_CONTENT_LENGTH, Long.toString(len)); response.setHeader(header); } } else { Header header = new Header(HttpConstants.HEADER_CONTENT_LENGTH, "0"); response.addHeader(header); } } if (!response.containsHeader(HttpConstants.HEADER_CONNECTION)) { // See if the the client explicitly handles connection persistence String connHeader = msg.getStringProperty(HttpConstants.HEADER_CONNECTION, null); if (connHeader != null) { if (connHeader.equalsIgnoreCase("keep-alive")) { Header header = new Header(HttpConstants.HEADER_CONNECTION, "keep-alive"); response.addHeader(header); response.setKeepAlive(true); } if (connHeader.equalsIgnoreCase("close")) { Header header = new Header(HttpConstants.HEADER_CONNECTION, "close"); response.addHeader(header); response.setKeepAlive(false); } } else { // Use protocol default connection policy if (response.getHttpVersion().greaterEquals(HttpVersion.HTTP_1_1)) { response.setKeepAlive(true); } else { response.setKeepAlive(false); } } } if ("HEAD".equalsIgnoreCase(msg.getStringProperty(HttpConnector.HTTP_METHOD_PROPERTY, null))) { // this is a head request, we don't want to send the actual content response.setBody((MuleMessage) null); } return response; } catch (IOException e) { throw new TransformerException(this, e); } } protected HttpResponse createResponse(Object src, String encoding, MuleMessage msg) throws IOException, TransformerException { HttpResponse response = new HttpResponse(); int status = msg.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, HttpConstants.SC_OK); String version = msg.getStringProperty(HttpConnector.HTTP_VERSION_PROPERTY, HttpConstants.HTTP11); String etag = msg.getStringProperty(HttpConstants.HEADER_ETAG, null); String date; synchronized (format) { date = format.format(new Date()); } String contentType = msg.getStringProperty(HttpConstants.HEADER_CONTENT_TYPE, HttpConstants.DEFAULT_CONTENT_TYPE); response.setStatusLine(HttpVersion.parse(version), status); response.setHeader(new Header(HttpConstants.HEADER_CONTENT_TYPE, contentType)); response.setHeader(new Header(HttpConstants.HEADER_DATE, date)); response.setHeader(new Header(HttpConstants.HEADER_SERVER, server)); if (msg.getProperty(HttpConstants.HEADER_EXPIRES) == null) { response.setHeader(new Header(HttpConstants.HEADER_EXPIRES, date)); } if (etag != null) { response.setHeader(new Header(HttpConstants.HEADER_ETAG, etag)); } response.setFallbackCharset(encoding); Collection headerNames = HttpConstants.RESPONSE_HEADER_NAMES.values(); String headerName, value; for (Iterator iterator = headerNames.iterator(); iterator.hasNext();) { headerName = (String)iterator.next(); value = msg.getStringProperty(headerName, null); if (value != null) { response.setHeader(new Header(headerName, value)); } } // Custom responseHeaderNames Map customHeaders = (Map)msg.getProperty(HttpConnector.HTTP_CUSTOM_HEADERS_MAP_PROPERTY); if (customHeaders != null) { Map.Entry entry; for (Iterator iterator = customHeaders.entrySet().iterator(); iterator.hasNext();) { entry = (Map.Entry)iterator.next(); if (entry.getValue() != null) { response.setHeader(new Header(entry.getKey().toString(), entry.getValue().toString())); } } } // Mule properties String user = msg.getStringProperty(MuleProperties.MULE_USER_PROPERTY, null); if (user != null) { response.setHeader(new Header(CUSTOM_HEADER_PREFIX + MuleProperties.MULE_USER_PROPERTY, user)); } if (msg.getCorrelationId() != null) { response.setHeader(new Header(CUSTOM_HEADER_PREFIX + MuleProperties.MULE_CORRELATION_ID_PROPERTY, msg.getCorrelationId())); response.setHeader(new Header(CUSTOM_HEADER_PREFIX + MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY, String.valueOf(msg.getCorrelationGroupSize()))); response.setHeader(new Header(CUSTOM_HEADER_PREFIX + MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY, String.valueOf(msg.getCorrelationSequence()))); } if (msg.getReplyTo() != null) { response.setHeader(new Header(CUSTOM_HEADER_PREFIX + MuleProperties.MULE_REPLY_TO_PROPERTY, msg.getReplyTo().toString())); } response.setBody(msg); return response; } public boolean isAcceptNull() { return true; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/transformers/HttpResponseToString.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/transformers/HttpResponseToString.j0000644000175000017500000000735710770356575033761 0ustar charlescharles/* * $Id: HttpResponseToString.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.transformers; import org.mule.RequestContext; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.OutputHandler; import org.mule.transformer.AbstractTransformer; import org.mule.transport.http.HttpConstants; import org.mule.transport.http.HttpResponse; import org.mule.transport.http.ResponseWriter; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.Iterator; import org.apache.commons.httpclient.ChunkedOutputStream; import org.apache.commons.httpclient.Header; import org.apache.commons.io.output.ByteArrayOutputStream; /** * Converts an Http Response object to String. Note that the response headers are * preserved. */ public class HttpResponseToString extends AbstractTransformer { public HttpResponseToString() { registerSourceType(HttpResponse.class); setReturnClass(String.class); } /** * Perform the transformation to always return a String object */ protected Object doTransform(Object src, String encoding) throws TransformerException { try { HttpResponse response = (HttpResponse)src; ByteArrayOutputStream bos = new ByteArrayOutputStream(8192); OutputStream outstream = bos; ResponseWriter writer = new ResponseWriter(outstream, encoding); writer.println(response.getStatusLine()); Iterator item = response.getHeaderIterator(); while (item.hasNext()) { Header header = (Header)item.next(); writer.print(header.toExternalForm()); } writer.println(); writer.flush(); if (response.hasBody()) { OutputHandler handler = response.getBody(); Header transferenc = response.getFirstHeader(HttpConstants.HEADER_TRANSFER_ENCODING); if (transferenc != null) { response.removeHeaders(HttpConstants.HEADER_CONTENT_LENGTH); if (transferenc.getValue().indexOf(HttpConstants.TRANSFER_ENCODING_CHUNKED) != -1) { outstream = new ChunkedOutputStream(outstream); } } handler.write(RequestContext.getEvent(), outstream); if (outstream instanceof ChunkedOutputStream) { ((ChunkedOutputStream)outstream).finish(); } } outstream.flush(); bos.flush(); byte[] result = bos.toByteArray(); outstream.close(); writer.close(); bos.close(); String output = null; try { output = new String(result, encoding); } catch (UnsupportedEncodingException uee) { // I believe this is never reached since a TransformerExcpetion // is thrown before at new ResponseWriter(outstream, encoding) if // encoding is not supported output = new String(result); } return output; } catch (IOException e) { throw new TransformerException(this, e); } } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpsConnector.java0000644000175000017500000001561610745677442030547 0ustar charlescharles/* * $Id: HttpsConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.TlsDirectKeyStore; import org.mule.api.security.TlsDirectTrustStore; import org.mule.api.security.TlsIndirectKeyStore; import org.mule.api.security.TlsProtocolHandler; import org.mule.api.security.provider.SecurityProviderFactory; import org.mule.api.security.tls.TlsConfiguration; import org.mule.transport.ssl.SslServerSocketFactory; import org.mule.transport.ssl.SslSocketFactory; import java.io.IOException; import java.net.ServerSocket; import java.net.URI; import java.security.Provider; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLServerSocket; import javax.net.ssl.TrustManagerFactory; /** HttpsConnector provides Https connectivity */ public class HttpsConnector extends HttpConnector implements TlsDirectKeyStore, TlsIndirectKeyStore, TlsDirectTrustStore, TlsProtocolHandler { public static final String HTTPS = "https"; public static final String PEER_CERTIFICATES = "PEER_CERTIFICATES"; public static final String LOCAL_CERTIFICATES = "LOCAL_CERTIFICATES"; private TlsConfiguration tls = new TlsConfiguration(TlsConfiguration.DEFAULT_KEYSTORE); public HttpsConnector() { setSocketFactory(new SslSocketFactory(tls)); setServerSocketFactory(new SslServerSocketFactory(tls)); // setting this true causes problems as socket closes before handshake finishes setValidateConnections(false); } // @Override protected ServerSocket getServerSocket(URI uri) throws IOException { SSLServerSocket serverSocket = (SSLServerSocket) super.getServerSocket(uri); serverSocket.setNeedClientAuth(isRequireClientAuthentication()); return serverSocket; } protected void doInitialise() throws InitialisationException { try { tls.initialise(false, TlsConfiguration.JSSE_NAMESPACE); } catch (CreateException e) { throw new InitialisationException(e, this); } super.doInitialise(); } public String getProtocol() { return HTTPS; } public String getClientKeyStore() { return tls.getClientKeyStore(); } public String getClientKeyStorePassword() { return tls.getClientKeyStorePassword(); } public String getClientKeyStoreType() { return this.tls.getClientKeyStoreType(); } public String getKeyManagerAlgorithm() { return tls.getKeyManagerAlgorithm(); } public KeyManagerFactory getKeyManagerFactory() { return tls.getKeyManagerFactory(); } public String getKeyPassword() { return tls.getKeyPassword(); } public String getKeyStore() { return tls.getKeyStore(); } public String getKeyStoreType() { return tls.getKeyStoreType(); } public String getProtocolHandler() { return tls.getProtocolHandler(); } public Provider getProvider() { return tls.getProvider(); } public SecurityProviderFactory getSecurityProviderFactory() { return tls.getSecurityProviderFactory(); } public String getSslType() { return tls.getSslType(); } public String getKeyStorePassword() { return tls.getKeyStorePassword(); } public String getTrustManagerAlgorithm() { return tls.getTrustManagerAlgorithm(); } public TrustManagerFactory getTrustManagerFactory() { return tls.getTrustManagerFactory(); } public String getTrustStore() { return tls.getTrustStore(); } public String getTrustStorePassword() { return tls.getTrustStorePassword(); } public String getTrustStoreType() { return tls.getTrustStoreType(); } public boolean isExplicitTrustStoreOnly() { return tls.isExplicitTrustStoreOnly(); } public boolean isRequireClientAuthentication() { return tls.isRequireClientAuthentication(); } public void setClientKeyStore(String clientKeyStore) throws IOException { tls.setClientKeyStore(clientKeyStore); } public void setClientKeyStorePassword(String clientKeyStorePassword) { tls.setClientKeyStorePassword(clientKeyStorePassword); } public void setClientKeyStoreType(String clientKeyStoreType) { this.tls.setClientKeyStoreType(clientKeyStoreType); } public void setExplicitTrustStoreOnly(boolean explicitTrustStoreOnly) { tls.setExplicitTrustStoreOnly(explicitTrustStoreOnly); } public void setKeyManagerAlgorithm(String keyManagerAlgorithm) { tls.setKeyManagerAlgorithm(keyManagerAlgorithm); } public void setKeyPassword(String keyPassword) { tls.setKeyPassword(keyPassword); } public void setKeyStore(String keyStore) throws IOException { tls.setKeyStore(keyStore); } public void setKeyStoreType(String keystoreType) { tls.setKeyStoreType(keystoreType); } public void setProtocolHandler(String protocolHandler) { tls.setProtocolHandler(protocolHandler); } public void setProvider(Provider provider) { tls.setProvider(provider); } public void setRequireClientAuthentication(boolean requireClientAuthentication) { tls.setRequireClientAuthentication(requireClientAuthentication); } public void setSecurityProviderFactory(SecurityProviderFactory spFactory) { tls.setSecurityProviderFactory(spFactory); } public void setSslType(String sslType) { tls.setSslType(sslType); } public void setKeyStorePassword(String storePassword) { tls.setKeyStorePassword(storePassword); } public void setTrustManagerAlgorithm(String trustManagerAlgorithm) { tls.setTrustManagerAlgorithm(trustManagerAlgorithm); } public void setTrustManagerFactory(TrustManagerFactory trustManagerFactory) { tls.setTrustManagerFactory(trustManagerFactory); } public void setTrustStore(String trustStore) throws IOException { tls.setTrustStore(trustStore); } public void setTrustStorePassword(String trustStorePassword) { tls.setTrustStorePassword(trustStorePassword); } public void setTrustStoreType(String trustStoreType) { tls.setTrustStoreType(trustStoreType); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/ReleasingInputStream.java0000755000175000017500000000202710754365306031663 0ustar charlescharles/* * $Id: ReleasingInputStream.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.model.streaming.DelegatingInputStream; import java.io.IOException; import java.io.InputStream; import org.apache.commons.httpclient.HttpMethod; public class ReleasingInputStream extends DelegatingInputStream { private final HttpMethod method; public ReleasingInputStream(InputStream is, HttpMethod method) { super(is); this.method = method; } public void close() throws IOException { super.close(); if (method != null) { method.releaseConnection(); } } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/PollingHttpMessageReceiver.java0000644000175000017500000000723010766204322033003 0ustar charlescharles/* * $Id: PollingHttpMessageReceiver.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.transport.AbstractPollingMessageReceiver; import org.mule.transport.DefaultMessageAdapter; import org.mule.util.MapUtils; import java.util.Collections; import java.util.Map; /** Will poll an http URL and use the response as the input for a service request. */ public class PollingHttpMessageReceiver extends AbstractPollingMessageReceiver { protected String etag = null; private boolean checkEtag; public PollingHttpMessageReceiver(Connector connector, Service service, final InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); long pollingFrequency = MapUtils.getLongValue(endpoint.getProperties(), "pollingFrequency", -1); if (pollingFrequency > 0) { this.setFrequency(pollingFrequency); } checkEtag = MapUtils.getBooleanValue(endpoint.getProperties(), "checkEtag", true); } protected void doDispose() { // nothing to do } protected void doConnect() throws Exception { // nothing to do } public void doDisconnect() throws Exception { // nothing to do } public void poll() throws Exception { MuleMessage req = new DefaultMuleMessage(new DefaultMessageAdapter("")); if (etag != null && checkEtag) { Map customHeaders = Collections.singletonMap(HttpConstants.HEADER_IF_NONE_MATCH, etag); req.setProperty(HttpConnector.HTTP_CUSTOM_HEADERS_MAP_PROPERTY, customHeaders); } req.setProperty(HttpConnector.HTTP_METHOD_PROPERTY, "GET"); MuleSession session = new DefaultMuleSession(service, connector.getMuleContext()); MuleEvent event = new DefaultMuleEvent(req, endpoint, session, true); // We need to create an outbound endpoint to do the polled request using // send() as thats the only way we can customize headers and use eTags MuleContext muleContext = endpoint.getMuleContext(); EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(endpoint, muleContext); OutboundEndpoint outboundEndpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( endpointBuilder); MuleMessage message = connector.send(outboundEndpoint, event); int status = message.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0); etag = message.getStringProperty(HttpConstants.HEADER_ETAG, null); if (status != 304 || !checkEtag) { routeMessage(message, endpoint.isSynchronous()); } } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/jetty/0000755000175000017500000000000011351410634026033 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/jetty/JettyHttpMessageReceiver.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/jetty/JettyHttpMessageReceiver.java0000644000175000017500000001510710757615756033660 0ustar charlescharles/* * $Id: JettyHttpMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.jetty; import org.mule.MuleServer; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.config.ThreadingProfile; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.LifecycleException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.http.i18n.HttpMessages; import org.mule.transport.http.servlet.MuleRESTReceiverServlet; import org.mule.transport.http.servlet.ServletConnector; import org.mule.util.StringUtils; import org.mortbay.http.HttpContext; import org.mortbay.http.SocketListener; import org.mortbay.jetty.Server; import org.mortbay.jetty.servlet.ServletHandler; import org.mortbay.util.InetAddrPort; /** * HttpMessageReceiver is a simple http server that can be used to * listen for http requests on a particular port */ public class JettyHttpMessageReceiver extends AbstractMessageReceiver { public static final String JETTY_SERVLET_CONNECTOR_NAME = "_jettyConnector"; private Server httpServer; public JettyHttpMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); if ("rest".equals(endpoint.getEndpointURI().getScheme())) { // We need tohave a Servlet Connector pointing to our servlet so the Servlets can // find the listeners for incoming requests ServletConnector scon = (ServletConnector) RegistryContext.getRegistry().lookupConnector(JETTY_SERVLET_CONNECTOR_NAME); if (scon != null) { throw new CreateException( HttpMessages.noServletConnectorFound(JETTY_SERVLET_CONNECTOR_NAME), this); } scon = new ServletConnector(); scon.setName(JETTY_SERVLET_CONNECTOR_NAME); scon.setServletUrl(endpoint.getEndpointURI().getAddress()); try { MuleContext muleContext = MuleServer.getMuleContext(); scon.setMuleContext(muleContext); //muleContext.applyLifecycle(scon); muleContext.getRegistry().registerConnector(scon); String path = endpoint.getEndpointURI().getPath(); if (StringUtils.isEmpty(path)) { path = "/"; } EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("servlet://" + path.substring(1), connector.getMuleContext()); endpointBuilder.setTransformers(endpoint.getTransformers()); InboundEndpoint ep = connector.getMuleContext() .getRegistry() .lookupEndpointFactory() .getInboundEndpoint(endpointBuilder); scon.registerListener(service, ep); } catch (Exception e) { throw new CreateException(e, this); } } } protected void doConnect() throws Exception { httpServer = new Server(); SocketListener socketListener = new SocketListener(new InetAddrPort(endpoint.getEndpointURI() .getPort())); // apply Threading settings ThreadingProfile tp = connector.getReceiverThreadingProfile(); socketListener.setMaxIdleTimeMs((int) tp.getThreadTTL()); int threadsActive = tp.getMaxThreadsActive(); int threadsMin = socketListener.getMinThreads(); if (threadsMin >= threadsActive) { socketListener.setMinThreads(threadsActive - 1); } socketListener.setMaxThreads(threadsActive); // thread priorities are evil and gone from ThreadingProfile // (google for priority inversion) // socketListener.setThreadsPriority(tp.getThreadPriority()); httpServer.addListener(socketListener); String path = endpoint.getEndpointURI().getPath(); if (StringUtils.isEmpty(path)) { path = "/"; } if (!path.endsWith("/")) { path += "/"; } HttpContext context = httpServer.getContext("/"); context.setRequestLog(null); ServletHandler handler = new ServletHandler(); if ("rest".equals(endpoint.getEndpointURI().getScheme())) { handler.addServlet("MuleRESTReceiverServlet", path + "*", MuleRESTReceiverServlet.class.getName()); } else { handler.addServlet("JettyReceiverServlet", path + "*", JettyReceiverServlet.class.getName()); } context.addHandler(handler); // setAttribute is already synchronized in Jetty context.setAttribute("messageReceiver", this); } protected void doDisconnect() throws Exception { // stop is automativcally called by Mule } /** * Template method to dispose any resources associated with this receiver. There * is not need to dispose the connector as this is already done by the framework */ protected void doDispose() { try { httpServer.stop(false); } catch (InterruptedException e) { logger.error("Error disposing Jetty recevier on: " + endpoint.getEndpointURI().toString(), e); } } protected void doStart() throws MuleException { try { httpServer.start(); } catch (Exception e) { throw new LifecycleException(CoreMessages.failedToStart("Jetty Http Receiver"), e, this); } } protected void doStop() throws MuleException { try { httpServer.stop(true); } catch (InterruptedException e) { throw new LifecycleException(CoreMessages.failedToStop("Jetty Http Receiver"), e, this); } } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/jetty/JettyReceiverServlet.java0000644000175000017500000000324110745677442033051 0ustar charlescharles/* * $Id: JettyReceiverServlet.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.jetty; import org.mule.api.endpoint.EndpointException; import org.mule.api.transport.MessageReceiver; import org.mule.transport.http.i18n.HttpMessages; import org.mule.transport.http.servlet.MuleReceiverServlet; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; public class JettyReceiverServlet extends MuleReceiverServlet { /** * Serial version */ private static final long serialVersionUID = 238326861089137293L; private MessageReceiver receiver; //@Override protected void doInit(ServletConfig servletConfig) throws ServletException { final ServletContext servletContext = servletConfig.getServletContext(); synchronized (servletContext) { receiver = (MessageReceiver) servletContext.getAttribute("messageReceiver"); } if (receiver == null) { throw new ServletException(HttpMessages.receiverPropertyNotSet().toString()); } } //@Override protected MessageReceiver getReceiverForURI(HttpServletRequest httpServletRequest) throws EndpointException { return receiver; } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/jetty/JettyConnector.java0000644000175000017500000000207610745677442031677 0ustar charlescharles/* * $Id: JettyConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.jetty; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpsConnector; /** * ServletConnector is a channel adapter between Mule and a servlet * engine. */ public class JettyConnector extends HttpConnector { public static final String JETTY = "jetty"; public static final String REST = "rest"; public JettyConnector() { super(); registerSupportedProtocol(HttpConnector.HTTP); registerSupportedProtocol(HttpsConnector.HTTPS); registerSupportedProtocol(REST); } public String getProtocol() { return JETTY; } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpMessageReceiver.java0000644000175000017500000004767110766204322031473 0ustar charlescharles/* * $Id: HttpMessageReceiver.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.MuleServer; import org.mule.NullSessionHandler; import org.mule.OptimizedRequestContext; import org.mule.RequestContext; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.MessageReceiver; import org.mule.transport.ConnectException; import org.mule.transport.NullPayload; import org.mule.transport.http.i18n.HttpMessages; import org.mule.transport.tcp.TcpMessageReceiver; import org.mule.util.MapUtils; import org.mule.util.ObjectUtils; import java.io.IOException; import java.net.Socket; import java.net.SocketAddress; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.resource.spi.work.Work; import org.apache.commons.httpclient.Cookie; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.cookie.MalformedCookieException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * HttpMessageReceiver is a simple http server that can be used to * listen for HTTP requests on a particular port. */ public class HttpMessageReceiver extends TcpMessageReceiver { protected final Log logger = LogFactory.getLog(getClass()); public HttpMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); } // @Override protected Work createWork(Socket socket) throws IOException { return new HttpWorker(socket); } // @Override protected void doConnect() throws ConnectException { // If we already have an endpoint listening on this socket don't try and // start another serversocket if (this.shouldConnect()) { super.doConnect(); } } protected boolean shouldConnect() { StringBuffer requestUri = new StringBuffer(80); requestUri.append(endpoint.getProtocol()).append("://"); requestUri.append(endpoint.getEndpointURI().getHost()); requestUri.append(':').append(endpoint.getEndpointURI().getPort()); requestUri.append('*'); MessageReceiver[] receivers = connector.getReceivers(requestUri.toString()); for (int i = 0; i < receivers.length; i++) { if (receivers[i].isConnected()) { return false; } } return true; } // @Override protected MuleMessage handleUnacceptedFilter(MuleMessage message) { if (logger.isDebugEnabled()) { logger.debug("Message request '" + message.getProperty(HttpConnector.HTTP_REQUEST_PROPERTY) + "' is being rejected since it does not match the filter on this endpoint: " + endpoint); } message.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, String.valueOf(HttpConstants.SC_NOT_ACCEPTABLE)); return message; } protected class HttpWorker implements Work { private HttpServerConnection conn; private String cookieSpec; private boolean enableCookies; private String remoteClientAddress; public HttpWorker(Socket socket) throws IOException { String encoding = endpoint.getEncoding(); if (encoding == null) { encoding = MuleServer.getMuleContext().getConfiguration().getDefaultEncoding(); } conn = new HttpServerConnection(socket, encoding); cookieSpec = MapUtils.getString(endpoint.getProperties(), HttpConnector.HTTP_COOKIE_SPEC_PROPERTY, ((HttpConnector) connector).getCookieSpec()); enableCookies = MapUtils.getBooleanValue(endpoint.getProperties(), HttpConnector.HTTP_ENABLE_COOKIES_PROPERTY, ((HttpConnector) connector).isEnableCookies()); final SocketAddress clientAddress = socket.getRemoteSocketAddress(); if (clientAddress != null) { remoteClientAddress = clientAddress.toString(); } } public void run() { try { do { conn.setKeepAlive(false); HttpRequest request = conn.readRequest(); if (request == null) { break; } conn.writeResponse(processRequest(request)); } while (conn.isKeepAlive()); } catch (Exception e) { handleException(e); } finally { logger.info("Closing HTTP connection."); conn.close(); conn = null; } } protected HttpResponse processRequest(HttpRequest request) throws MuleException, IOException { RequestLine requestLine = request.getRequestLine(); String method = requestLine.getMethod(); if (method.equals(HttpConstants.METHOD_HEAD)) { return doHead(requestLine); } else if (method.equals(HttpConstants.METHOD_GET) || method.equals(HttpConstants.METHOD_POST) || method.equals(HttpConstants.METHOD_OPTIONS) || method.equals(HttpConstants.METHOD_PUT) || method.equals(HttpConstants.METHOD_DELETE) || method.equals(HttpConstants.METHOD_TRACE) || method.equals(HttpConstants.METHOD_CONNECT)) { return doRequest(request, requestLine); } else { return doBad(requestLine); } } protected HttpResponse doHead(RequestLine requestLine) throws MuleException { MuleMessage message = new DefaultMuleMessage(NullPayload.getInstance()); MuleEvent event = new DefaultMuleEvent(message, endpoint, new DefaultMuleSession(message, new NullSessionHandler(), connector.getMuleContext()), true); OptimizedRequestContext.unsafeSetEvent(event); HttpResponse response = new HttpResponse(); response.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_OK); return transformResponse(response); } protected HttpResponse doRequest(HttpRequest request, RequestLine requestLine) throws IOException, MuleException { Map headers = parseHeaders(request); // TODO Mule 2.0 generic way to set stream message adapter MessageAdapter adapter = buildStandardAdapter(request, headers); MuleMessage message = new DefaultMuleMessage(adapter); if (logger.isDebugEnabled()) { logger.debug(message.getProperty(HttpConnector.HTTP_REQUEST_PROPERTY)); } // determine if the request path on this request denotes a different receiver MessageReceiver receiver = getTargetReceiver(message, endpoint); HttpResponse response; // the response only needs to be transformed explicitly if // A) the request was not served or B) a null result was returned if (receiver != null) { preRouteMessage(message); MuleMessage returnMessage = receiver.routeMessage(message, endpoint.isSynchronous(), null); Object tempResponse; if (returnMessage != null) { tempResponse = returnMessage.getPayload(); } else { tempResponse = NullPayload.getInstance(); } // This removes the need for users to explicitly adding the response transformer // ObjectToHttpResponse in their config if (tempResponse instanceof HttpResponse) { response = (HttpResponse)tempResponse; } else { response = transformResponse(returnMessage); } response.disableKeepAlive(!((HttpConnector)connector).isKeepAlive()); } else { response = buildFailureResponse(requestLine, message); } return response; } protected HttpResponse doOtherValid(RequestLine requestLine, String method) throws MuleException { MuleMessage message = new DefaultMuleMessage(NullPayload.getInstance()); MuleEvent event = new DefaultMuleEvent(message, endpoint, new DefaultMuleSession(message, new NullSessionHandler(), connector.getMuleContext()), true); OptimizedRequestContext.unsafeSetEvent(event); HttpResponse response = new HttpResponse(); response.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_METHOD_NOT_ALLOWED); response.setBody(HttpMessages.methodNotAllowed(method).toString() + HttpConstants.CRLF); return transformResponse(response); } protected HttpResponse doBad(RequestLine requestLine) throws MuleException { MuleMessage message = new DefaultMuleMessage(NullPayload.getInstance()); MuleEvent event = new DefaultMuleEvent(message, endpoint, new DefaultMuleSession(message, new NullSessionHandler(), connector.getMuleContext()), true); OptimizedRequestContext.unsafeSetEvent(event); HttpResponse response = new HttpResponse(); response.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_BAD_REQUEST); response.setBody(HttpMessages.malformedSyntax().toString() + HttpConstants.CRLF); return transformResponse(response); } protected MessageAdapter buildStandardAdapter(final HttpRequest request, final Map headers) throws MessagingException, TransformerException, IOException { final RequestLine requestLine = request.getRequestLine(); sendExpect100(headers, requestLine); Object body = request.getBody(); if (body == null) { body = requestLine.getUri(); } return connector.getMessageAdapter(new Object[]{body, headers}); } private void sendExpect100(Map headers, RequestLine requestLine) throws TransformerException, IOException { // respond with status code 100, for Expect handshake // according to rfc 2616 and http 1.1 // the processing will continue and the request will be fully // read immediately after if (HttpConstants.HTTP11.equals(headers.get(HttpConnector.HTTP_VERSION_PROPERTY))) { // just in case we have something other than String in // the headers map String expectHeaderValue = ObjectUtils.toString( headers.get(HttpConstants.HEADER_EXPECT)).toLowerCase(); if (HttpConstants.HEADER_EXPECT_CONTINUE_REQUEST_VALUE.equals(expectHeaderValue)) { HttpResponse expected = new HttpResponse(); expected.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_CONTINUE); final DefaultMuleEvent event = new DefaultMuleEvent(new DefaultMuleMessage(expected), endpoint, new DefaultMuleSession(service, connector.getMuleContext()), true); RequestContext.setEvent(event); conn.writeResponse(transformResponse(expected)); } } } protected HttpResponse buildFailureResponse(RequestLine requestLine, MuleMessage message) throws TransformerException { EndpointURI uri = endpoint.getEndpointURI(); String failedPath = uri.getScheme() + "://" + uri.getHost() + ":" + uri.getPort() + getRequestPath(message); if (logger.isDebugEnabled()) { logger.debug("Failed to bind to " + failedPath); } HttpResponse response = new HttpResponse(); response.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_NOT_FOUND); response.setBody(HttpMessages.cannotBindToAddress(failedPath).toString()); RequestContext.setEvent(new DefaultMuleEvent(new DefaultMuleMessage(response), endpoint, new DefaultMuleSession(service, connector.getMuleContext()), true)); // The DefaultResponseTransformer will set the necessary headers return transformResponse(response); } protected Map parseHeaders(HttpRequest request) throws MalformedCookieException { RequestLine requestLine = request.getRequestLine(); Map headers = new HashMap(); for (Iterator rhi = request.getHeaderIterator(); rhi.hasNext();) { Header header = (Header)rhi.next(); String headerName = header.getName(); Object headerValue = header.getValue(); // fix Mule headers? if (headerName.startsWith("X-MULE")) { headerName = headerName.substring(2); } // Parse cookies? else if (headerName.equals(HttpConnector.HTTP_COOKIES_PROPERTY)) { if (enableCookies) { Cookie[] cookies = CookieHelper.parseCookies(header, cookieSpec); if (cookies.length > 0) { // yum! headerValue = cookies; } else { // bad cookies?! continue; } } else { // no cookies for you! continue; } } // accept header & value headers.put(headerName, headerValue); } headers.put(HttpConnector.HTTP_METHOD_PROPERTY, requestLine.getMethod()); headers.put(HttpConnector.HTTP_REQUEST_PROPERTY, requestLine.getUri()); headers.put(HttpConnector.HTTP_VERSION_PROPERTY, requestLine.getHttpVersion().toString()); headers.put(HttpConnector.HTTP_COOKIE_SPEC_PROPERTY, cookieSpec); return headers; } protected void preRouteMessage(MuleMessage message) { message.setProperty(MuleProperties.MULE_REMOTE_CLIENT_ADDRESS, remoteClientAddress); } public void release() { conn.close(); conn = null; } } protected String getRequestPath(MuleMessage message) { String path = (String) message.getProperty(HttpConnector.HTTP_REQUEST_PROPERTY); int i = path.indexOf('?'); if (i > -1) { path = path.substring(0, i); } return path; } protected MessageReceiver getTargetReceiver(MuleMessage message, ImmutableEndpoint endpoint) throws ConnectException { String path = (String) message.getProperty(HttpConnector.HTTP_REQUEST_PROPERTY); int i = path.indexOf('?'); if (i > -1) { path = path.substring(0, i); } StringBuffer requestUri = new StringBuffer(80); if (path.indexOf("://")==-1) { requestUri.append(endpoint.getProtocol()).append("://"); requestUri.append(endpoint.getEndpointURI().getHost()); requestUri.append(':').append(endpoint.getEndpointURI().getPort()); } // first check that there is a receiver on the root address if (logger.isTraceEnabled()) { logger.trace("Looking up receiver on connector: " + connector.getName() + " with URI key: " + requestUri.toString()); } MessageReceiver receiver = connector.lookupReceiver(requestUri.toString()); // If no receiver on the root and there is a request path, look up the // received based on the root plus request path if (receiver == null && !"/".equals(path)) { // remove anything after the last '/' int x = path.lastIndexOf('/'); if (x > 1 && path.indexOf('.') > x) { requestUri.append(path.substring(0, x)); } else { requestUri.append(path); } if (logger.isDebugEnabled()) { logger.debug("Secondary lookup of receiver on connector: " + connector.getName() + " with URI key: " + requestUri.toString()); } // try again String uriStr = requestUri.toString(); receiver = connector.lookupReceiver(uriStr); if (receiver == null) { receiver = findReceiverByStem(connector.getReceivers(), uriStr); } if (receiver == null && logger.isWarnEnabled()) { logger.warn("No receiver found with secondary lookup on connector: " + connector.getName() + " with URI key: " + requestUri.toString()); logger.warn("Receivers on connector are: " + MapUtils.toString(connector.getReceivers(), true)); } } return receiver; } protected HttpResponse transformResponse(Object response) throws TransformerException { MuleMessage message; if(response instanceof MuleMessage) { message = (MuleMessage)response; } else { message = new DefaultMuleMessage(response); } //TODO RM*: Maybe we can have a generic Transformer wrapper rather that using DefaultMuleMessage (or another static utility //class message.applyTransformers(connector.getDefaultResponseTransformers(), HttpResponse.class); return (HttpResponse) message.getPayload(); } public static MessageReceiver findReceiverByStem(Map receivers, String uriStr) { int match = 0; MessageReceiver receiver = null; for (Iterator itr = receivers.entrySet().iterator(); itr.hasNext();) { Map.Entry e = (Map.Entry)itr.next(); String key = (String)e.getKey(); MessageReceiver candidate = (MessageReceiver)e.getValue(); if (uriStr.startsWith(key) && match < key.length()) { match = key.length(); receiver = candidate; } } return receiver; } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/CookieHelper.java0000644000175000017500000000614010757017357030127 0ustar charlescharles/* * $Id: CookieHelper.java 10899 2008-02-20 12:37:03Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import java.util.ArrayList; import java.util.List; import org.apache.commons.httpclient.Cookie; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HeaderElement; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.cookie.CookiePolicy; import org.apache.commons.httpclient.cookie.CookieSpec; import org.apache.commons.httpclient.cookie.MalformedCookieException; import org.apache.commons.httpclient.cookie.NetscapeDraftSpec; import org.apache.commons.httpclient.cookie.RFC2109Spec; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Helper functions for parsing cookie headers. * */ public class CookieHelper { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(CookieHelper.class); /** * Do not instantiate. */ private CookieHelper() { // no op } public static CookieSpec getCookieSpec(String spec) { if (spec != null && spec.equalsIgnoreCase(HttpConnector.COOKIE_SPEC_NETSCAPE)) { return new NetscapeDraftSpec(); } else { return new RFC2109Spec(); } } public static String getCookiePolicy(String spec) { if (spec != null && spec.equalsIgnoreCase(HttpConnector.COOKIE_SPEC_NETSCAPE)) { return CookiePolicy.NETSCAPE; } else { return CookiePolicy.RFC_2109; } } public static Cookie[] parseCookies(Header header, String spec) throws MalformedCookieException { List cookies = new ArrayList(); CookieSpec cookieSpec = getCookieSpec(spec); HeaderElement[] headerElements = header.getElements(); for (int j = 0; j < headerElements.length; j++) { HeaderElement headerElement = headerElements[j]; NameValuePair[] headerElementParameters = headerElement.getParameters(); Cookie cookie = new Cookie(); for (int k = 0; k < headerElementParameters.length; k++) { NameValuePair nameValuePair = headerElementParameters[k]; cookieSpec.parseAttribute(nameValuePair, cookie); } if (cookie.isExpired()) { if (logger.isDebugEnabled()) { logger.debug("Cookie: " + cookie.toString() + " has expired, not adding it."); } } else { cookies.add(cookie); } } return (Cookie[]) cookies.toArray(new Cookie[cookies.size()]); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpResponse.java0000644000175000017500000002304610770356575030223 0ustar charlescharles/* * $Id: HttpResponse.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.OutputHandler; import org.mule.transport.NullPayload; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.Iterator; import org.apache.commons.httpclient.ChunkedInputStream; import org.apache.commons.httpclient.ContentLengthInputStream; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HeaderElement; import org.apache.commons.httpclient.HeaderGroup; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.HttpVersion; import org.apache.commons.httpclient.NameValuePair; import org.apache.commons.httpclient.StatusLine; /** * A generic HTTP response wrapper. */ public class HttpResponse { public static final String DEFAULT_CONTENT_CHARSET = "ISO-8859-1"; private HttpVersion ver = HttpVersion.HTTP_1_1; private int statusCode = HttpStatus.SC_OK; private String phrase = HttpStatus.getStatusText(HttpStatus.SC_OK); private HeaderGroup headers = new HeaderGroup(); private boolean keepAlive = false; private boolean disableKeepAlive = false; private String fallbackCharset = DEFAULT_CONTENT_CHARSET; private OutputHandler outputHandler; public HttpResponse() { super(); } public HttpResponse(final StatusLine statusline, final Header[] headers, final InputStream content) throws IOException { super(); if (statusline == null) { throw new IllegalArgumentException("Status line may not be null"); } setStatusLine(HttpVersion.parse(statusline.getHttpVersion()), statusline.getStatusCode(), statusline.getReasonPhrase()); setHeaders(headers); if (content != null) { InputStream in = content; Header contentLength = this.headers.getFirstHeader(HttpConstants.HEADER_CONTENT_LENGTH); Header transferEncoding = this.headers.getFirstHeader(HttpConstants.HEADER_TRANSFER_ENCODING); if (transferEncoding != null) { if (transferEncoding.getValue().indexOf(HttpConstants.TRANSFER_ENCODING_CHUNKED) != -1) { in = new ChunkedInputStream(in); } } else if (contentLength != null) { long len = getContentLength(); if (len >= 0) { in = new ContentLengthInputStream(in, len); } } } } public void setStatusLine(final HttpVersion ver, int statuscode, final String phrase) { if (ver == null) { throw new IllegalArgumentException("HTTP version may not be null"); } if (statuscode <= 0) { throw new IllegalArgumentException("Status code may not be negative or zero"); } this.ver = ver; this.statusCode = statuscode; if (phrase != null) { this.phrase = phrase; } else { this.phrase = HttpStatus.getStatusText(statuscode); } } public void setStatusLine(final HttpVersion ver, int statuscode) { setStatusLine(ver, statuscode, null); } public String getPhrase() { return this.phrase; } /** * @deprecated use {@link #getStatusCode()} instead * @return HTTP status code */ public int getStatuscode() { return this.getStatusCode(); } public int getStatusCode() { return this.statusCode; } public HttpVersion getHttpVersion() { return this.ver; } public String getStatusLine() { StringBuffer buffer = new StringBuffer(64); buffer.append(this.ver); buffer.append(' '); buffer.append(this.statusCode); if (this.phrase != null) { buffer.append(' '); buffer.append(this.phrase); } return buffer.toString(); } public boolean containsHeader(final String name) { return this.headers.containsHeader(name); } public Header[] getHeaders() { return this.headers.getAllHeaders(); } public Header getFirstHeader(final String name) { return this.headers.getFirstHeader(name); } public void removeHeaders(final String s) { if (s == null) { return; } Header[] headers = this.headers.getHeaders(s); for (int i = 0; i < headers.length; i++) { this.headers.removeHeader(headers[i]); } } public void addHeader(final Header header) { if (header == null) { return; } this.headers.addHeader(header); } public void setHeader(final Header header) { if (header == null) { return; } removeHeaders(header.getName()); addHeader(header); } public void setHeaders(final Header[] headers) { if (headers == null) { return; } this.headers.setHeaders(headers); } public Iterator getHeaderIterator() { return this.headers.getIterator(); } public String getCharset() { String charset = getFallbackCharset(); Header contenttype = this.headers.getFirstHeader(HttpConstants.HEADER_CONTENT_TYPE); if (contenttype != null) { HeaderElement values[] = contenttype.getElements(); if (values.length == 1) { NameValuePair param = values[0].getParameterByName("charset"); if (param != null) { charset = param.getValue(); } } } return charset; } public long getContentLength() { Header contentLength = this.headers.getFirstHeader(HttpConstants.HEADER_CONTENT_LENGTH); if (contentLength != null) { try { return Long.parseLong(contentLength.getValue()); } catch (NumberFormatException e) { return -1; } } else { return -1; } } public boolean hasBody() { return outputHandler != null; } public OutputHandler getBody() throws TransformerException { return outputHandler; } public void setBody(MuleMessage msg) throws TransformerException { if (msg == null) return; Object payload = msg.getPayload(); if (payload instanceof String) { setBody(payload.toString()); } else if (payload instanceof NullPayload) { return; } else if (payload instanceof byte[]) { setBody((byte[]) payload); } else { setBody((OutputHandler) msg.getPayload(OutputHandler.class)); } } public void setBody(OutputHandler outputHandler) { this.outputHandler = outputHandler; } public void setBody(final String string) { byte[] raw; try { raw = string.getBytes(getCharset()); } catch (UnsupportedEncodingException e) { raw = string.getBytes(); } setBody(raw); } private void setBody(final byte[] raw) { if (!containsHeader(HttpConstants.HEADER_CONTENT_TYPE)) { setHeader(new Header(HttpConstants.HEADER_CONTENT_TYPE, HttpConstants.DEFAULT_CONTENT_TYPE)); } setHeader(new Header(HttpConstants.HEADER_CONTENT_LENGTH, Long.toString(raw.length))); this.outputHandler = new OutputHandler() { public void write(MuleEvent event, OutputStream out) throws IOException { out.write(raw); } }; } public String getBodyAsString() throws IOException { if (!hasBody()) return ""; ByteArrayOutputStream out = new ByteArrayOutputStream(); outputHandler.write(RequestContext.getEvent(), out); try { return new String(out.toByteArray(), getCharset()); } catch (UnsupportedEncodingException e) { return new String(out.toByteArray()); } } public boolean isKeepAlive() { return !disableKeepAlive && keepAlive; } public void setKeepAlive(boolean keepAlive) { this.keepAlive = keepAlive; } public void disableKeepAlive(boolean keepalive) { disableKeepAlive = keepalive; } public String getFallbackCharset() { return fallbackCharset; } public void setFallbackCharset(String overrideCharset) { this.fallbackCharset = overrideCharset; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcherFactory.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcherFactory.0000644000175000017500000000176610757615756033656 0ustar charlescharles/* * $Id: HttpClientMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * Creates a HttpClientMessageDispatcher to make client requests */ public class HttpClientMessageDispatcherFactory extends AbstractMessageDispatcherFactory { /** {@inheritDoc} */ public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new HttpClientMessageDispatcher(endpoint); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/i18n/0000755000175000017500000000000011351410633025452 5ustar charlescharlesmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/i18n/ServletMessages.java0000644000175000017500000000144310745677442031456 0ustar charlescharles/* * $Id: ServletMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class ServletMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("servlet"); public static Message failedToReadPayload(String string) { return createMessage(BUNDLE_PATH, 3, string); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/i18n/HttpMessages.java0000644000175000017500000000460010745677442030747 0ustar charlescharles/* * $Id: HttpMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; import java.net.URI; public class HttpMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("http"); public static Message requestFailedWithStatus(String string) { return createMessage(BUNDLE_PATH, 3, string); } public static Message unableToGetEndpointUri(String requestURI) { return createMessage(BUNDLE_PATH, 4, requestURI); } public static Message receiverPropertyNotSet() { return createMessage(BUNDLE_PATH, 7); } public static Message httpParameterNotSet(String string) { return createMessage(BUNDLE_PATH, 8, string); } public static Message noConnectorForProtocolServlet() { return createMessage(BUNDLE_PATH, 9); } public static Message noServletConnectorFound(String name) { return createMessage(BUNDLE_PATH, 10, name); } public static Message malformedSyntax() { return createMessage(BUNDLE_PATH, 11); } public static Message methodNotAllowed(String method) { return createMessage(BUNDLE_PATH, 12, method); } public static Message failedToConnect(URI uri) { return createMessage(BUNDLE_PATH, 13, uri); } public static Message cannotBindToAddress(String path) { return createMessage(BUNDLE_PATH, 14, path); } public static Message eventPropertyNotSetCannotProcessRequest(String property) { return createMessage(BUNDLE_PATH, 15, property); } public static Message unsupportedMethod(String method) { return createMessage(BUNDLE_PATH, 16, method); } public static Message couldNotSendExpect100() { return createMessage(BUNDLE_PATH, 17); } public static Message requestLineIsMalformed(String line) { return createMessage(BUNDLE_PATH, 18, line); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/0000755000175000017500000000000011351410634026360 5ustar charlescharlesmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/ServletConnector.java0000644000175000017500000000435110745677442032547 0ustar charlescharles/* * $Id: ServletConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.servlet; import org.mule.api.MuleException; import org.mule.api.lifecycle.InitialisationException; import org.mule.transport.AbstractConnector; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpsConnector; import java.util.Map; /** * ServletConnector is a channel adapter between Mule and a servlet * engine. It allows the MuleReceiverServlet to look up components interested in * requests it receives via the servlet container. * * @see MuleReceiverServlet */ public class ServletConnector extends AbstractConnector { public static final String SERVLET = "servlet"; // The real URL that the servlet container is bound on. // If this is not set the wsdl may not be generated correctly protected String servletUrl; public ServletConnector() { super(); registerSupportedProtocol(HttpConnector.HTTP); registerSupportedProtocol(HttpsConnector.HTTPS); } protected void doInitialise() throws InitialisationException { // template method, nothing to do } protected void doDispose() { // template method } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } protected void doStart() throws MuleException { // template method } protected void doStop() throws MuleException { // template method } public String getProtocol() { return SERVLET; } public Map getReceivers() { return receivers; } public String getServletUrl() { return servletUrl; } public void setServletUrl(String servletUrl) { this.servletUrl = servletUrl; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/HttpRequestToParameter.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/HttpRequestToParameter.java0000644000175000017500000000463010745677442033704 0ustar charlescharles/* * $Id: HttpRequestToParameter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.servlet; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractDiscoverableTransformer; import org.mule.util.SystemUtils; import java.io.BufferedReader; import java.io.IOException; import javax.servlet.http.HttpServletRequest; public class HttpRequestToParameter extends AbstractDiscoverableTransformer { public HttpRequestToParameter() { registerSourceType(HttpServletRequest.class); setReturnClass(String.class); } protected Object doTransform(Object src, String encoding) throws TransformerException { HttpServletRequest request = (HttpServletRequest)src; String payloadParam = (String)request.getAttribute(AbstractReceiverServlet.PAYLOAD_PARAMETER_NAME); if (null == payloadParam) { payloadParam = AbstractReceiverServlet.DEFAULT_PAYLOAD_PARAMETER_NAME; } String payload = request.getParameter(payloadParam); if (null == payload) { if (isText(request.getContentType())) { try { BufferedReader reader = request.getReader(); StringBuffer buffer = new StringBuffer(8192); String line = reader.readLine(); while (line != null) { buffer.append(line); line = reader.readLine(); if (line != null) buffer.append(SystemUtils.LINE_SEPARATOR); } payload = buffer.toString(); } catch (IOException e) { throw new TransformerException(this, e); } } } return payload; } protected boolean isText(String contentType) { if (contentType == null) { return true; } return (contentType.startsWith("text/")); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/HttpRequestToByteArray.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/HttpRequestToByteArray.java0000644000175000017500000000300510745677442033661 0ustar charlescharles/* * $Id: HttpRequestToByteArray.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.servlet; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractDiscoverableTransformer; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.ByteArrayOutputStream; /** * Converts an {@link javax.servlet.http.HttpServletRequest} into an array of bytes by extracting the payload of * the request. */ public class HttpRequestToByteArray extends AbstractDiscoverableTransformer { public HttpRequestToByteArray() { registerSourceType(HttpServletRequest.class); setReturnClass(byte[].class); } protected Object doTransform(Object src, String encoding) throws TransformerException { ByteArrayOutputStream baos = new ByteArrayOutputStream(8192); try { IOUtils.copy(((HttpServletRequest) src).getInputStream(), baos); } catch (IOException e) { throw new TransformerException(this, e); } return baos.toByteArray(); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/ServletMessageReceiver.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/ServletMessageReceiver.java0000644000175000017500000000315310757615756033670 0ustar charlescharles/* * $Id: ServletMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.servlet; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.transport.AbstractMessageReceiver; /** * ServletMessageReceiver is a receiver that is invoked from a Servlet * when an event is received. There is a one-to-one mapping between a * ServletMessageReceiver and a servlet in the serving webapp. */ public class ServletMessageReceiver extends AbstractMessageReceiver { public ServletMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); } protected void doDispose() { // template method } protected void doConnect() throws Exception { // nothing to do } protected void doDisconnect() throws Exception { // nothing to do } protected void doStart() throws MuleException { // nothing to do } protected void doStop() throws MuleException { // nothing to do } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/MuleReceiverServlet.java0000644000175000017500000003366610757615756033222 0ustar charlescharles/* * $Id: MuleReceiverServlet.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.servlet; import org.mule.DefaultMuleMessage; import org.mule.RegistryContext; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointException; import org.mule.api.transport.NoReceiverForEndpointException; import org.mule.api.transport.MessageReceiver; import org.mule.endpoint.DynamicURIInboundEndpoint; import org.mule.endpoint.MuleEndpointURI; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import org.mule.transport.http.HttpMessageReceiver; import org.mule.transport.http.i18n.HttpMessages; import org.mule.transport.service.TransportFactory; import org.mule.util.PropertiesUtils; import java.io.IOException; import java.util.Iterator; import java.util.Map; import java.util.Properties; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Receives Http requests via a Servlet and routes the to listeners with servlet:// * endpoints *

* There needs to be a ServletConnector configured on the Mule Server, this connector * must have the servletUrl property set that matches the Url for the container that this * Servlet is hosted in, i.e. something like http://192.168.10.21:8888 */ public class MuleReceiverServlet extends AbstractReceiverServlet { /** Serial version */ private static final long serialVersionUID = 6631307373079767439L; protected ServletConnector connector = null; protected void doInit(ServletConfig servletConfig) throws ServletException { String servletConnectorName = servletConfig.getInitParameter(SERVLET_CONNECTOR_NAME_PROPERTY); if (servletConnectorName == null) { connector = (ServletConnector) TransportFactory.getConnectorByProtocol("servlet"); if (connector == null) { throw new ServletException(HttpMessages.noConnectorForProtocolServlet().toString()); } } else { connector = (ServletConnector) RegistryContext.getRegistry().lookupConnector(servletConnectorName); if (connector == null) { throw new ServletException( HttpMessages.noServletConnectorFound(servletConnectorName).toString()); } } } protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { MessageReceiver receiver = getReceiverForURI(request); MuleMessage responseMessage = null; MuleMessage requestMessage = new DefaultMuleMessage(new HttpRequestMessageAdapter(request)); requestMessage.setProperty(HttpConnector.HTTP_METHOD_PROPERTY, "HEAD"); setupRequestMessage(request, requestMessage); receiver.routeMessage(requestMessage, true); if (responseMessage != null) { writeResponse(response, responseMessage); } else { response.setStatus(HttpConstants.SC_OK); } } catch (Exception e) { handleException(e, e.getMessage(), response); } } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { MessageReceiver receiver = getReceiverForURI(request); MuleMessage responseMessage; MuleMessage requestMessage = new DefaultMuleMessage(new HttpRequestMessageAdapter(request)); requestMessage.setProperty(HttpConnector.HTTP_METHOD_PROPERTY, "GET"); setupRequestMessage(request, requestMessage); responseMessage = receiver.routeMessage(requestMessage, true); writeResponse(response, responseMessage); } catch (Exception e) { handleException(e, e.getMessage(), response); } } private void setupRequestMessage(HttpServletRequest request, MuleMessage requestMessage) { requestMessage.setProperty(HttpConnector.HTTP_REQUEST_PROPERTY, request.getRequestURI()); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { MessageReceiver receiver = getReceiverForURI(request); MuleMessage responseMessage; MuleMessage requestMessage = new DefaultMuleMessage(new HttpRequestMessageAdapter(request)); requestMessage.setProperty(HttpConnector.HTTP_METHOD_PROPERTY, "POST"); setupRequestMessage(request, requestMessage); responseMessage = receiver.routeMessage(requestMessage, true); if (responseMessage != null) { writeResponse(response, responseMessage); } } catch (Exception e) { handleException(e, e.getMessage(), response); } } protected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { MessageReceiver receiver = getReceiverForURI(request); MuleMessage responseMessage; MuleMessage requestMessage = new DefaultMuleMessage(new HttpRequestMessageAdapter(request)); requestMessage.setProperty(HttpConnector.HTTP_METHOD_PROPERTY, "OPTIONS"); setupRequestMessage(request, requestMessage); responseMessage = receiver.routeMessage(requestMessage, true); if (responseMessage != null) { writeResponse(response, responseMessage); } } catch (Exception e) { handleException(e, e.getMessage(), response); } } protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { MessageReceiver receiver = getReceiverForURI(request); MuleMessage responseMessage; MuleMessage requestMessage = new DefaultMuleMessage(new HttpRequestMessageAdapter(request)); requestMessage.setProperty(HttpConnector.HTTP_METHOD_PROPERTY, "PUT"); setupRequestMessage(request, requestMessage); responseMessage = receiver.routeMessage(requestMessage, true); if (responseMessage != null) { writeResponse(response, responseMessage); } } catch (Exception e) { handleException(e, e.getMessage(), response); } } protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { MessageReceiver receiver = getReceiverForURI(request); MuleMessage responseMessage; MuleMessage requestMessage = new DefaultMuleMessage(new HttpRequestMessageAdapter(request)); requestMessage.setProperty(HttpConnector.HTTP_METHOD_PROPERTY, "DELETE"); setupRequestMessage(request, requestMessage); responseMessage = receiver.routeMessage(requestMessage, true); if (responseMessage != null) { writeResponse(response, responseMessage); } } catch (Exception e) { handleException(e, e.getMessage(), response); } } protected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { MessageReceiver receiver = getReceiverForURI(request); MuleMessage responseMessage; MuleMessage requestMessage = new DefaultMuleMessage(new HttpRequestMessageAdapter(request)); requestMessage.setProperty(HttpConnector.HTTP_METHOD_PROPERTY, "TRACE"); setupRequestMessage(request, requestMessage); responseMessage = receiver.routeMessage(requestMessage, true); if (responseMessage != null) { writeResponse(response, responseMessage); } } catch (Exception e) { handleException(e, e.getMessage(), response); } } protected void doConnect(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { MessageReceiver receiver = getReceiverForURI(request); MuleMessage responseMessage; MuleMessage requestMessage = new DefaultMuleMessage(new HttpRequestMessageAdapter(request)); requestMessage.setProperty(HttpConnector.HTTP_METHOD_PROPERTY, "CONNECT"); setupRequestMessage(request, requestMessage); responseMessage = receiver.routeMessage(requestMessage, true); if (responseMessage != null) { writeResponse(response, responseMessage); } } catch (Exception e) { handleException(e, e.getMessage(), response); } } protected MessageReceiver getReceiverForURI(HttpServletRequest httpServletRequest) throws EndpointException { String uri = getReceiverName(httpServletRequest); if (uri == null) { throw new EndpointException( HttpMessages.unableToGetEndpointUri(httpServletRequest.getRequestURI())); } MessageReceiver receiver = (MessageReceiver) getReceivers().get(uri); if (receiver == null) { // Nothing found lets try stripping the path and only use the last // path element int i = uri.lastIndexOf("/"); if (i > -1) { String tempUri = uri.substring(i + 1); receiver = (AbstractMessageReceiver) getReceivers().get(tempUri); } // Lets see if the uri matches up with the last part of // any of the receiver keys. if (receiver == null) { receiver = HttpMessageReceiver.findReceiverByStem(connector.getReceivers(), uri); } // This is some bizarre piece of code so the XFire Servlet code works. // We should remove this at some point (see XFireWsdlCallTestCase for a failure // if this code is removed). if (receiver == null) { receiver = HttpMessageReceiver.findReceiverByStem(connector.getReceivers(), uri); } // This is some bizarre piece of code so the XFire Servlet code works. // We should remove this at some point (see XFireWsdlCallTestCase for a failure // if this code is removed). if (receiver == null) { Map receivers = getReceivers(); Iterator iter = receivers.keySet().iterator(); while (iter.hasNext()) { String key = iter.next().toString(); i = key.lastIndexOf("/"); if (i > -1) { String key2 = key.substring(i + 1); if (key2.equals(uri)) { receiver = (AbstractMessageReceiver) receivers.get(key); break; } } } } if (receiver == null) { throw new NoReceiverForEndpointException("No receiver found for endpointUri: " + uri); } } receiver.setEndpoint(new DynamicURIInboundEndpoint(receiver.getEndpoint(), new MuleEndpointURI( getRequestUrl(httpServletRequest)))); return receiver; } protected String getRequestUrl(HttpServletRequest httpServletRequest) { StringBuffer url = new StringBuffer(); url.append(connector.getProtocol().toLowerCase()); url.append(":"); url.append(httpServletRequest.getScheme()); url.append("://"); url.append(httpServletRequest.getServerName()); url.append(":"); url.append(httpServletRequest.getServerPort()); url.append("/"); url.append(getReceiverName(httpServletRequest)); if (httpServletRequest.getQueryString() != null) { url.append("?"); url.append(httpServletRequest.getQueryString()); } return url.toString(); } protected String getReceiverName(HttpServletRequest httpServletRequest) { String name = httpServletRequest.getPathInfo(); if (name == null) { name = httpServletRequest.getServletPath(); if (name == null) { name = httpServletRequest.getParameter("endpoint"); if (name == null) { Properties params = PropertiesUtils.getPropertiesFromQueryString(httpServletRequest.getQueryString()); name = params.getProperty("endpoint"); if (name == null) { return null; } } } } if (name.startsWith("/")) { name = name.substring(1); } return name; } protected Map getReceivers() { return connector.getReceivers(); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/HttpRequestToInputStream.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/HttpRequestToInputStream.ja0000755000175000017500000000250410766463006033701 0ustar charlescharles/* * $Id: HttpRequestToInputStream.java 11366 2008-03-14 11:48:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.servlet; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractDiscoverableTransformer; import java.io.IOException; import java.io.InputStream; import javax.servlet.http.HttpServletRequest; /** * Converts an {@link javax.servlet.http.HttpServletRequest} into an {@link InputStream}. */ public class HttpRequestToInputStream extends AbstractDiscoverableTransformer { public HttpRequestToInputStream() { super(); setReturnClass(InputStream.class); registerSourceType(HttpServletRequest.class); } protected Object doTransform(Object src, String encoding) throws TransformerException { try { return ((HttpServletRequest) src).getInputStream(); } catch (IOException e) { throw new TransformerException(this, e); } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/AbstractReceiverServlet.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/AbstractReceiverServlet.jav0000644000175000017500000001520010763624216033666 0ustar charlescharles/* * $Id: AbstractReceiverServlet.java 11186 2008-03-05 23:11:10Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.servlet; import org.mule.RequestContext; import org.mule.api.MuleMessage; import org.mule.api.transport.OutputHandler; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import org.mule.transport.http.HttpResponse; import java.io.IOException; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletResponse; import org.apache.commons.httpclient.Header; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A base servlet used to receive requests from a servlet container and route * them into Mule */ public abstract class AbstractReceiverServlet extends HttpServlet { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); public static final String REQUEST_TIMEOUT_PROPERTY = "org.mule.servlet.timeout"; public static final String FEEDBACK_PROPERTY = "org.mule.servlet.feedback"; public static final String DEFAULT_CONTENT_TYPE_PROPERTY = "org.mule.servlet.default.content.type"; /** The name of the servlet connector to use with this Servlet */ public static final String SERVLET_CONNECTOR_NAME_PROPERTY = "org.mule.servlet.connector.name"; public static final String PAYLOAD_PARAMETER_NAME = "org.mule.servlet.payload.param"; public static final String DEFAULT_PAYLOAD_PARAMETER_NAME = "payload"; public static final long DEFAULT_GET_TIMEOUT = 10000L; protected String payloadParameterName; protected long timeout = DEFAULT_GET_TIMEOUT; protected boolean feedback = true; protected String defaultContentType = HttpConstants.DEFAULT_CONTENT_TYPE; public final void init() throws ServletException { doInit(); } public final void init(ServletConfig servletConfig) throws ServletException { String timeoutString = servletConfig.getInitParameter(REQUEST_TIMEOUT_PROPERTY); if (timeoutString != null) { timeout = Long.parseLong(timeoutString); } logger.info("Default request timeout for GET methods is: " + timeout); String feedbackString = servletConfig.getInitParameter(FEEDBACK_PROPERTY); if (feedbackString != null) { feedback = Boolean.valueOf(feedbackString).booleanValue(); } logger.info("feedback is set to: " + feedback); String ct = servletConfig.getInitParameter(DEFAULT_CONTENT_TYPE_PROPERTY); if (ct != null) { defaultContentType = ct; } logger.info("Default content type is: " + defaultContentType); payloadParameterName = servletConfig.getInitParameter(PAYLOAD_PARAMETER_NAME); if (payloadParameterName == null) { payloadParameterName = DEFAULT_PAYLOAD_PARAMETER_NAME; } logger.info("Using payload param name: " + payloadParameterName); doInit(servletConfig); } protected void doInit(ServletConfig servletConfig) throws ServletException { // nothing to do } protected void doInit() throws ServletException { // nothing to do } protected void writeResponse(HttpServletResponse servletResponse, MuleMessage message) throws Exception { if (message == null) { servletResponse.setStatus(HttpServletResponse.SC_NO_CONTENT); if (feedback) { servletResponse.setStatus(HttpServletResponse.SC_OK); servletResponse.getWriter().write("Action was processed successfully. There was no result"); } } else { HttpResponse httpResponse; if (message.getPayload() instanceof HttpResponse) { httpResponse = (HttpResponse)message.getPayload(); } else { httpResponse = new HttpResponse(); String ct = message.getStringProperty(HttpConstants.HEADER_CONTENT_TYPE, null); if(ct!=null) { httpResponse.setHeader(new Header(HttpConstants.HEADER_CONTENT_TYPE, ct)); } httpResponse.setStatusLine(httpResponse.getHttpVersion(), message.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, HttpServletResponse.SC_OK)); httpResponse.setBody(message); } Header contentTypeHeader = httpResponse.getFirstHeader(HttpConstants.HEADER_CONTENT_TYPE); String contentType = null; if (contentTypeHeader == null) { contentType = defaultContentType; } else { contentType = contentTypeHeader.getValue(); } if (!servletResponse.isCommitted()) { servletResponse.setStatus(httpResponse.getStatusCode()); } if (!contentType.startsWith("text")) { servletResponse.setContentType(contentType); OutputHandler outputHandler = httpResponse.getBody(); outputHandler.write(RequestContext.getEvent(), servletResponse.getOutputStream()); } else { servletResponse.setContentType(contentType); // Encoding: this method will check the charset on the content type servletResponse.getWriter().write(httpResponse.getBodyAsString()); } } servletResponse.flushBuffer(); } protected void handleException(Throwable exception, String message, HttpServletResponse response) { logger.error("message: " + exception.getMessage(), exception); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); try { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message + ": " + exception.getMessage()); } catch (IOException e) { logger.error("Failed to sendError on response: " + e.getMessage(), e); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/HttpRequestMessageAdapter.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/HttpRequestMessageAdapter.j0000644000175000017500000002026610745677442033661 0ustar charlescharles/* * $Id: HttpRequestMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.servlet; import org.mule.api.MessagingException; import org.mule.api.ThreadSafeAccess; import org.mule.api.config.MuleProperties; import org.mule.api.transport.MessageTypeNotSupportedException; import org.mule.api.transport.UniqueIdNotSupportedException; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractMessageAdapter; import org.mule.transport.http.HttpConstants; import java.util.Enumeration; import java.util.Iterator; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; /** * HttpRequestMessageAdapter is a Mule message adapter for * javax.servletHttpServletRequest objects. */ public class HttpRequestMessageAdapter extends AbstractMessageAdapter { /** * Serial version */ private static final long serialVersionUID = -4238448252206941125L; private HttpServletRequest request; public HttpRequestMessageAdapter(Object message) throws MessagingException { if (message instanceof HttpServletRequest) { setPayload((HttpServletRequest)message); final Map parameterMap = request.getParameterMap(); if (parameterMap != null && parameterMap.size() > 0) { for (Iterator iterator = parameterMap.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry)iterator.next(); String key = (String)entry.getKey(); Object value = entry.getValue(); if (value != null) { if (value.getClass().isArray() && ((Object[])value).length == 1) { setProperty(key, ((Object[])value)[0]); } else { setProperty(key, value); } } } } String key; for (Enumeration e = request.getAttributeNames(); e.hasMoreElements();) { key = (String)e.nextElement(); properties.setProperty(key, request.getAttribute(key)); } String realKey; for (Enumeration e = request.getHeaderNames(); e.hasMoreElements();) { key = (String)e.nextElement(); realKey = key; if (key.startsWith(HttpConstants.X_PROPERTY_PREFIX)) { realKey = key.substring(2); } setProperty(realKey, request.getHeader(key)); } } else { throw new MessageTypeNotSupportedException(message, getClass()); } } protected HttpRequestMessageAdapter(HttpRequestMessageAdapter template) { super(template); request = template.request; } /* * (non-Javadoc) * * @see org.mule.api.providers.UMOMessageAdapter#getMessage() */ public Object getPayload() { return request; } public boolean isBinary() { return !request.getContentType().startsWith("text"); } /* * (non-Javadoc) * * @see org.mule.api.providers.UMOMessageAdapter#setMessage(java.lang.Object) */ private void setPayload(HttpServletRequest message) throws MessagingException { // try // { request = message; // String httpRequest = null; // httpRequest = request.getScheme() + "://" + request.getServerName() + // ":" + request.getServerPort() + request.getServletPath(); // httpRequest += request.getPathInfo(); // if(StringUtils.isNotBlank(request.getQueryString())) { // httpRequest += "?" + request.getQueryString(); // } // setProperty(HttpConnector.HTTP_REQUEST_PROPERTY, httpRequest); // this.message = httpRequest; // Check if a payload parameter has been set, if so use it // otherwise we'll use the request payload // String payloadParam = (String)request // .getAttribute(AbstractReceiverServlet.PAYLOAD_PARAMETER_NAME); // // if (payloadParam == null) // { // payloadParam = AbstractReceiverServlet.DEFAULT_PAYLOAD_PARAMETER_NAME; // } // // String payload = request.getParameter(payloadParam); // if (payload == null) // { // if (isText(request.getContentType())) // { // BufferedReader reader = request.getReader(); // StringBuffer buffer = new StringBuffer(8192); // String line = reader.readLine(); // while (line != null) // { // buffer.append(line); // line = reader.readLine(); // if (line != null) buffer.append(SystemUtils.LINE_SEPARATOR); // } // this.message = buffer.toString(); // } // else // { // ByteArrayOutputStream baos = new ByteArrayOutputStream(8192); // IOUtils.copy(request.getInputStream(), baos); // this.message = baos.toByteArray(); // } // } // else // { // this.message = payload; // } // } // catch (IOException e) // { // throw new MessagingException( // ServletMessages.failedToReadPayload(request.getRequestURL().toString()), e); // } } public HttpServletRequest getRequest() { return request; } public String getUniqueId() { HttpSession session = null; try { // We wrap this call as on some App Servers (Websfear) it can cause an // NPE session = getRequest().getSession(); } catch (Exception e) { throw new UniqueIdNotSupportedException(this, CoreMessages.objectIsNull("Http session")); } if (session == null) { throw new UniqueIdNotSupportedException(this, CoreMessages.objectIsNull("Http session")); } return session.getId(); } /** * Sets a replyTo address for this message. This is useful in an asynchronous * environment where the caller doesn't wait for a response and the response * needs to be routed somewhere for further processing. The value of this field * can be any valid endpointUri url. * * @param replyTo the endpointUri url to reply to */ public void setReplyTo(Object replyTo) { if (replyTo != null && replyTo.toString().startsWith("http")) { setProperty(HttpConstants.HEADER_LOCATION, replyTo); } setProperty(MuleProperties.MULE_CORRELATION_ID_PROPERTY, replyTo); } /** * Sets a replyTo address for this message. This is useful in an asynchronous * environment where the caller doesn't wait for a response and the response * needs to be routed somewhere for further processing. The value of this field * can be any valid endpointUri url. * * @return the endpointUri url to reply to or null if one has not been set */ public Object getReplyTo() { String replyto = (String)getProperty(MuleProperties.MULE_REPLY_TO_PROPERTY); if (replyto == null) { replyto = (String)getProperty(HttpConstants.HEADER_LOCATION); } return replyto; } public ThreadSafeAccess newThreadCopy() { return new HttpRequestMessageAdapter(this); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/MuleRESTReceiverServlet.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/servlet/MuleRESTReceiverServlet.jav0000644000175000017500000001735710766204322033535 0ustar charlescharles/* * $Id: MuleRESTReceiverServlet.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.servlet; import org.mule.DefaultMuleMessage; import org.mule.MuleServer; import org.mule.RegistryContext; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointNotFoundException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageReceiver; import org.mule.transport.http.i18n.HttpMessages; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * MuleRESTReceiverServlet is used for sending a receiving events from * the Mule server via a serlet container. The servlet uses the REST style of request * processing GET METHOD will do a receive from an external source if an endpoint * parameter is set otherwise it behaves the same way as POST. you can either specify * the transport name i.e. to read from Jms orders.queue * http://www.mycompany.com/rest/jms/orders/queue

or a Mule endpoint name to * target a specific endpoint config. This would get the first email message received * by the orderEmailInbox endpoint.

* http://www.mycompany.com/rest/ordersEmailInbox

POST Do a sysnchrous call and * return a result http://www.clientapplication.com/service/clientquery?custId=1234 *

PUT Do an asysnchrous call without returning a result (other than an http * status code) http://www.clientapplication.com/service/orders?payload=more * beer

DELETE Same as GET only without returning a result */ public class MuleRESTReceiverServlet extends MuleReceiverServlet { /** * Serial version */ private static final long serialVersionUID = -2395763805839859649L; protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException { try { if (httpServletRequest.getParameter("endpoint") != null) { InboundEndpoint endpoint = getEndpointForURI(httpServletRequest); String timeoutString = httpServletRequest.getParameter("timeout"); long to = timeout; if (timeoutString != null) { to = Long.parseLong(timeoutString); } if (logger.isDebugEnabled()) { logger.debug("Making request using endpoint: " + endpoint.toString() + " timeout is: " + to); } MuleMessage returnMessage = endpoint.request(to); writeResponse(httpServletResponse, returnMessage); } else { MessageReceiver receiver = getReceiverForURI(httpServletRequest); httpServletRequest.setAttribute(PAYLOAD_PARAMETER_NAME, payloadParameterName); MuleMessage message = new DefaultMuleMessage(receiver.getConnector().getMessageAdapter( httpServletRequest)); MuleMessage returnMessage = receiver.routeMessage(message, true); writeResponse(httpServletResponse, returnMessage); } } catch (Exception e) { handleException(e, "Failed to route event through Servlet Receiver", httpServletResponse); } } protected void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException { try { MessageReceiver receiver = getReceiverForURI(httpServletRequest); httpServletRequest.setAttribute(PAYLOAD_PARAMETER_NAME, payloadParameterName); MuleMessage message = new DefaultMuleMessage(receiver.getConnector() .getMessageAdapter(httpServletRequest)); MuleMessage returnMessage = receiver.routeMessage(message, true); writeResponse(httpServletResponse, returnMessage); } catch (Exception e) { handleException(e, "Failed to Post event to Mule", httpServletResponse); } } protected void doPut(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException { try { MessageReceiver receiver = getReceiverForURI(httpServletRequest); httpServletRequest.setAttribute(PAYLOAD_PARAMETER_NAME, payloadParameterName); MuleMessage message = new DefaultMuleMessage(receiver.getConnector() .getMessageAdapter(httpServletRequest)); receiver.routeMessage(message, MuleServer.getMuleContext().getConfiguration().isDefaultSynchronousEndpoints()); httpServletResponse.setStatus(HttpServletResponse.SC_CREATED); if (feedback) { httpServletResponse.getWriter().write( "Item was created at endpointUri: " + receiver.getEndpointURI()); } } catch (Exception e) { handleException(e, "Failed to Post event to Mule" + e.getMessage(), httpServletResponse); } } protected void doDelete(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException { try { InboundEndpoint endpoint = getEndpointForURI(httpServletRequest); String timeoutString = httpServletRequest.getParameter("timeout"); long to = timeout; if (timeoutString != null) { to = new Long(timeoutString).longValue(); } if (logger.isDebugEnabled()) { logger.debug("Making request using endpoint: " + endpoint.toString() + " timeout is: " + to); } MuleMessage returnMessage = endpoint.request(to); if (returnMessage != null) { httpServletResponse.setStatus(HttpServletResponse.SC_OK); } else { httpServletResponse.setStatus(HttpServletResponse.SC_NO_CONTENT); } } catch (Exception e) { handleException(e, "Failed to Delete mule event via receive using uri: " + httpServletRequest.getPathInfo(), httpServletResponse); } } protected InboundEndpoint getEndpointForURI(HttpServletRequest httpServletRequest) throws MuleException { String endpointName = httpServletRequest.getParameter("endpoint"); if (endpointName == null) { throw new EndpointException(HttpMessages.httpParameterNotSet("endpoint")); } InboundEndpoint endpoint = RegistryContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(endpointName); if (endpoint == null) { // if we dont find an endpoint for the given name, lets check the // servlet receivers MessageReceiver receiver = (MessageReceiver)getReceivers().get(endpointName); if (receiver == null) { throw new EndpointNotFoundException(endpointName); } endpoint = receiver.getEndpoint(); } return endpoint; } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/ResponseWriter.java0000644000175000017500000000570210745677442030560 0ustar charlescharles/* * $Id: ResponseWriter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import java.io.BufferedWriter; import java.io.FilterWriter; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; /** * Provides a hybrid Writer/OutputStream for sending HTTP response data */ public class ResponseWriter extends FilterWriter { public static final String CRLF = "\r\n"; public static final String ISO_8859_1 = "ISO-8859-1"; private OutputStream outStream = null; private String encoding = null; public ResponseWriter(final OutputStream outStream) throws UnsupportedEncodingException { this(outStream, CRLF, ISO_8859_1); } public ResponseWriter(final OutputStream outStream, final String encoding) throws UnsupportedEncodingException { this(outStream, CRLF, encoding); } public ResponseWriter(final OutputStream outStream, final String lineSeparator, final String encoding) throws UnsupportedEncodingException { super(new BufferedWriter(new OutputStreamWriter(outStream, encoding))); this.outStream = outStream; this.encoding = encoding; } public String getEncoding() { return encoding; } public void close() throws IOException { if (outStream != null) { super.close(); outStream = null; } } /* * (non-Javadoc) * * @see java.io.Writer#flush() */ public void flush() throws IOException { if (outStream != null) { super.flush(); outStream.flush(); } } public void write(byte b) throws IOException { super.flush(); outStream.write(b); } public void write(byte[] b) throws IOException { super.flush(); outStream.write(b); } public void write(byte[] b, int off, int len) throws IOException { super.flush(); outStream.write(b, off, len); } public void print(String s) throws IOException { if (s == null) { s = "null"; } write(s); } public void print(int i) throws IOException { write(Integer.toString(i)); } public void println(int i) throws IOException { write(Integer.toString(i)); write(CRLF); } public void println(String s) throws IOException { print(s); write(CRLF); } public void println() throws IOException { write(CRLF); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageRequester.java0000644000175000017500000000744610757615756033062 0ustar charlescharles/* * $Id: HttpClientMessageRequester.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transformer.Transformer; import org.mule.api.transport.ReceiveException; import org.mule.transport.AbstractMessageRequester; import org.mule.transport.http.i18n.HttpMessages; import org.mule.transport.http.transformers.HttpClientMethodResponseToObject; import org.mule.util.StringUtils; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.GetMethod; /** * Rquests Mule events over HTTP. */ public class HttpClientMessageRequester extends AbstractMessageRequester { private final HttpConnector connector; private volatile HttpClient client = null; private final Transformer receiveTransformer; public HttpClientMessageRequester(InboundEndpoint endpoint) { super(endpoint); this.connector = (HttpConnector) endpoint.getConnector(); this.receiveTransformer = new HttpClientMethodResponseToObject(); } protected void doConnect() throws Exception { if (client == null) { client = connector.doClientConnect(); } } protected void doDisconnect() throws Exception { client = null; } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal cuases an exception */ protected MuleMessage doRequest(long timeout) throws Exception { HttpMethod httpMethod = new GetMethod(endpoint.getEndpointURI().getAddress()); connector.setupClientAuthorization(null, httpMethod, client, endpoint); boolean releaseConn = false; try { HttpClient client = new HttpClient(); client.executeMethod(httpMethod); if (httpMethod.getStatusCode() == HttpStatus.SC_OK) { MuleMessage res = (MuleMessage) receiveTransformer.transform(httpMethod); if (StringUtils.EMPTY.equals(res.getPayload())) { releaseConn = true; } return res; } else { releaseConn = true; throw new ReceiveException( HttpMessages.requestFailedWithStatus(httpMethod.getStatusLine().toString()), endpoint, timeout); } } catch (ReceiveException e) { releaseConn = true; throw e; } catch (Exception e) { releaseConn = true; throw new ReceiveException(endpoint, timeout, e); } finally { if (releaseConn) { httpMethod.releaseConnection(); } } } protected void doDispose() { // template method } }mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/RequestLine.java0000644000175000017500000000561310745677442030026 0ustar charlescharles/* * $Id: RequestLine.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.transport.http.i18n.HttpMessages; import java.util.NoSuchElementException; import java.util.StringTokenizer; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpVersion; import org.apache.commons.httpclient.ProtocolException; /** * Defines a HTTP request-line, consisting of method name, URI and protocol. */ public class RequestLine { private HttpVersion httpversion = null; private String method = null; private String uri = null; public static RequestLine parseLine(final String l) throws HttpException { String method; String uri; String protocol; try { if(l==null) { throw new ProtocolException(HttpMessages.requestLineIsMalformed(l).getMessage()); } StringTokenizer st = new StringTokenizer(l, " "); method = st.nextToken(); uri = st.nextToken(); protocol = st.nextToken(); } catch (NoSuchElementException e) { throw new ProtocolException(HttpMessages.requestLineIsMalformed(l).getMessage()); } return new RequestLine(method, uri, protocol); } public RequestLine(final String method, final String uri, final HttpVersion httpversion) { super(); if (method == null) { throw new IllegalArgumentException("Method may not be null"); } if (uri == null) { throw new IllegalArgumentException("URI may not be null"); } if (httpversion == null) { throw new IllegalArgumentException("HTTP version may not be null"); } this.method = method; this.uri = uri; this.httpversion = httpversion; } public RequestLine(final String method, final String uri, final String httpversion) throws ProtocolException { this(method, uri, HttpVersion.parse(httpversion)); } public String getMethod() { return this.method; } public HttpVersion getHttpVersion() { return this.httpversion; } public String getUri() { return this.uri; } public String toString() { StringBuffer sb = new StringBuffer(64); sb.append(this.method); sb.append(" "); sb.append(this.uri); sb.append(" "); sb.append(this.httpversion); return sb.toString(); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/config/0000755000175000017500000000000011351410634026141 5ustar charlescharlesmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/config/JettyNamespaceHandler.java0000644000175000017500000000164510745726444033243 0ustar charlescharles/* * $Id: JettyNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.transport.http.jetty.JettyConnector; /** * Reigsters a Bean Definition Parser for handling elements. */ public class JettyNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerMetaTransportEndpoints(JettyConnector.JETTY); registerConnectorDefinitionParser(JettyConnector.class); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/config/ServletNamespaceHandler.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/config/ServletNamespaceHandler.java0000644000175000017500000000177410745726444033573 0ustar charlescharles/* * $Id: ServletNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.endpoint.URIBuilder; import org.mule.transport.http.servlet.ServletConnector; /** * Reigsters a Bean Definition Parser for handling elements. */ public class ServletNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(ServletConnector.SERVLET, URIBuilder.SOCKET_ATTRIBUTES); registerConnectorDefinitionParser(ServletConnector.class); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/config/HttpNamespaceHandler.java0000644000175000017500000000552111003270417033036 0ustar charlescharles/* * $Id: HttpNamespaceHandler.java 11626 2008-04-22 05:01:03Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.collection.ChildListEntryDefinitionParser; import org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser; import org.mule.config.spring.parsers.specific.ComponentDefinitionParser; import org.mule.config.spring.parsers.specific.TransformerDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import org.mule.transport.http.components.RestServiceWrapper; import org.mule.transport.http.transformers.HttpClientMethodResponseToObject; import org.mule.transport.http.transformers.HttpResponseToString; import org.mule.transport.http.transformers.MuleMessageToHttpResponse; import org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest; /** * Reigsters a Bean Definition Parser for handling elements. */ public class HttpNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(HttpConnector.HTTP, URIBuilder.SOCKET_ATTRIBUTES) .addAlias("contentType", HttpConstants.HEADER_CONTENT_TYPE); registerConnectorDefinitionParser(HttpConnector.class); registerBeanDefinitionParser("rest-service-component", new ComponentDefinitionParser(RestServiceWrapper.class)); registerBeanDefinitionParser("payloadParameterName", new ChildListEntryDefinitionParser("payloadParameterNames", ChildMapEntryDefinitionParser.VALUE)); registerBeanDefinitionParser("requiredParameter", new ChildMapEntryDefinitionParser("requiredParams")); registerBeanDefinitionParser("optionalParameter", new ChildMapEntryDefinitionParser("optionalParams")); registerBeanDefinitionParser("http-client-response-to-object-transformer", new TransformerDefinitionParser(HttpClientMethodResponseToObject.class)); registerBeanDefinitionParser("http-response-to-string-transformer", new TransformerDefinitionParser(HttpResponseToString.class)); registerBeanDefinitionParser("object-to-http-client-request-transformer", new TransformerDefinitionParser(ObjectToHttpClientMethodRequest.class)); registerBeanDefinitionParser("message-to-http-response-transformer", new TransformerDefinitionParser(MuleMessageToHttpResponse.class)); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/config/HttpsNamespaceHandler.java0000644000175000017500000000323010770356575033240 0ustar charlescharles/* * $Id: HttpsNamespaceHandler.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.specific.tls.ClientKeyStoreDefinitionParser; import org.mule.config.spring.parsers.specific.tls.KeyStoreDefinitionParser; import org.mule.config.spring.parsers.specific.tls.ProtocolHandlerDefinitionParser; import org.mule.config.spring.parsers.specific.tls.TrustStoreDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.http.HttpsConnector; /** * Reigsters a Bean Definition Parser for handling elements. */ public class HttpsNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerStandardTransportEndpoints(HttpsConnector.HTTPS, URIBuilder.SOCKET_ATTRIBUTES); registerConnectorDefinitionParser(HttpsConnector.class); registerBeanDefinitionParser("tls-key-store", new KeyStoreDefinitionParser()); registerBeanDefinitionParser("tls-client", new ClientKeyStoreDefinitionParser()); registerBeanDefinitionParser("tls-server", new TrustStoreDefinitionParser()); registerBeanDefinitionParser("tls-protocol-handler", new ProtocolHandlerDefinitionParser()); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpMessageAdapter.java0000644000175000017500000001162710745677442031315 0ustar charlescharles/* * $Id: HttpMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.ThreadSafeAccess; import org.mule.transport.AbstractMessageAdapter; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HeaderElement; import org.apache.commons.httpclient.NameValuePair; /** * HttpMessageAdapter Wraps an incoming Http Request making the * payload and headers available as standard message adapter. */ public class HttpMessageAdapter extends AbstractMessageAdapter { /** * Serial version */ private static final long serialVersionUID = -1544495479333000422L; private boolean http11 = true; private Object message; public HttpMessageAdapter(Object message) { if (message instanceof Object[]) { // This case comes from the HttpMessageReceiver... Map headers = new HashMap(); this.message = ((Object[]) message)[0]; if (((Object[]) message).length > 1) { Object second = ((Object[]) message)[1]; if (second instanceof Map) { Map props = (Map) second; for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();) { Map.Entry e = (Map.Entry) iterator.next(); String key = (String) e.getKey(); Object value = e.getValue(); // skip incoming null values if (value != null) { headers.put(key, value); } } } else if (second instanceof Header[]) { Header[] inboundHeaders = (Header[]) second; for (int i = 0; i < inboundHeaders.length; i++) { headers.put(inboundHeaders[i].getName(), inboundHeaders[i].getValue()); } } addInboundProperties(headers); } } else if (message instanceof HttpResponse) { this.message = message; return; } else { this.message = message; } String temp = getStringProperty(HttpConnector.HTTP_VERSION_PROPERTY, null); if (HttpConstants.HTTP10.equalsIgnoreCase(temp)) { http11 = false; } // set the encoding Header contenttype = getHeader(HttpConstants.HEADER_CONTENT_TYPE); if (contenttype != null) { HeaderElement values[] = contenttype.getElements(); if (values.length == 1) { NameValuePair param = values[0].getParameterByName("charset"); if (param != null) { encoding = param.getValue(); } } } } protected HttpMessageAdapter(HttpMessageAdapter template) { super(template); message = template.message; http11 = template.http11; } /** @return the current message */ public Object getPayload() { return message; } /* * (non-Javadoc) * * @see org.mule.transport.UMOMessageAdapter#getProperty(java.lang.Object) */ public Object getProperty(String key) { if (HttpConstants.HEADER_KEEP_ALIVE.equals(key) || HttpConstants.HEADER_CONNECTION.equals(key)) { if (!http11) { String connection = super.getStringProperty(HttpConstants.HEADER_CONNECTION, null); if (connection != null && connection.equalsIgnoreCase("close")) { return "false"; } else { return "true"; } } else { return (super.getProperty(HttpConstants.HEADER_CONNECTION) != null ? "true" : "false"); } } else { return super.getProperty(key); } } public Header getHeader(String name) { String value = getStringProperty(name, null); if (value == null) { return null; } return new Header(name, value); } public ThreadSafeAccess newThreadCopy() { return new HttpMessageAdapter(this); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpConstants.java0000644000175000017500000002634610745677442030410 0ustar charlescharles/* * $Id: HttpConstants.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.config.MuleProperties; import org.mule.util.MapUtils; import java.util.Collections; import java.util.Map; import org.apache.commons.collections.map.CaseInsensitiveMap; /** * HttpConstants for request and response headers */ // @ThreadSafe public class HttpConstants { // HTTP prefix public static final String HTTP10 = "HTTP/1.0"; public static final String HTTP1X = "HTTP/1.x"; public static final String HTTP11 = "HTTP/1.1"; public static final String DEFAULT_HTTP_VERSION = HttpConstants.HTTP11; // Default HTTP port public static final int DEFAULT_HTTP_PORT = 80; // HTTP Methods public static final String METHOD_OPTIONS = "OPTIONS"; public static final String METHOD_GET = "GET"; public static final String METHOD_HEAD = "HEAD"; public static final String METHOD_POST = "POST"; public static final String METHOD_PUT = "PUT"; public static final String METHOD_DELETE = "DELETE"; public static final String METHOD_TRACE = "TRACE"; public static final String METHOD_CONNECT = "CONNECT"; // Date header format public static final String DATE_FORMAT = "EEE, dd MMM yyyy hh:mm:ss zzz"; // Newline public static final String CRLF = "\r\n"; // Mime/Content separator public static final String HEADER_CONTENT_SEPARATOR = CRLF + CRLF; // The default content type public static final String DEFAULT_CONTENT_TYPE = "text/plain"; // Headers public static final String HEADER_ACCEPT = "Accept"; // [Request] public static final String HEADER_ACCEPT_CHARSET = "Accept-Charset"; // [Request] public static final String HEADER_ACCEPT_ENCODING = "Accept-Encoding"; // [Request] public static final String HEADER_ACCEPT_LANGUAGE = "Accept-Language"; // [Request] public static final String HEADER_ACCEPT_RANGES = "Accept-Ranges"; // [Response] public static final String HEADER_AGE = "Age"; // [Response] public static final String HEADER_ALLOW = "Allow"; // [Entity] public static final String HEADER_AUTHORIZATION = "Authorization"; // [Request] public static final String HEADER_CACHE_CONTROL = "Cache-Control"; // [General] public static final String HEADER_CONNECTION = "Connection"; // [General] public static final String HEADER_CONTENT_ENCODING = "Content-Encoding"; // [Entity] public static final String HEADER_CONTENT_LANGUAGE = "Content-Language"; // [Entity] public static final String HEADER_CONTENT_LENGTH = "Content-Length"; // [Entity] public static final String HEADER_CONTENT_LOCATION = "Content-Location"; // [Entity] public static final String HEADER_CONTENT_MD5 = "Content-MD5"; // [Entity] public static final String HEADER_CONTENT_RANGE = "Content-Range"; // [Entity] public static final String HEADER_CONTENT_TYPE = "Content-Type"; // [Entity] public static final String HEADER_COOKIE = "Cookie"; // [Request] public static final String HEADER_COOKIE_SET = "Set-Cookie"; // [Response] public static final String HEADER_DATE = "Date"; // [General] public static final String HEADER_ETAG = "ETag"; // [Response] public static final String HEADER_EXPECT = "Expect"; // [Request] public static final String HEADER_EXPIRES = "Expires"; // [Entity] public static final String HEADER_FROM = "From"; // [Request] public static final String HEADER_HOST = "Host"; // [Request] public static final String HEADER_IF_MATCH = "If-Match"; // [Request] public static final String HEADER_IF_MODIFIED_SINCE = "If-Modified-Since"; // [Request] public static final String HEADER_IF_NONE_MATCH = "If-None-Match"; // [Request] public static final String HEADER_IF_RANGE = "If-Range"; // [Request] public static final String HEADER_IF_UNMODIFIED_SINCE = "If-Unmodified-Since"; // [Request] public static final String HEADER_KEEP_ALIVE = "Keep-Alive"; // [Entity] public static final String HEADER_LAST_MODIFIED = "Last-Modified"; // [Entity] public static final String HEADER_LOCATION = "Location"; // [Response] public static final String HEADER_MAX_FORWARDS = "Max-Forwards"; // [Request] public static final String HEADER_PRAGMA = "Pragma"; // [General] public static final String HEADER_PROXY_AUTHENTICATE = "Proxy-Authenticate"; // [Response] public static final String HEADER_PROXY_AUTHORIZATION = "Proxy-Authorization"; // [Request] public static final String HEADER_RANGE = "Range"; // [Request] public static final String HEADER_REFERER = "Referer"; // [Request] public static final String HEADER_RETRY_AFTER = "Retry-After"; // [Response] public static final String HEADER_SERVER = "Server"; // [Response] public static final String HEADER_SLUG = "Slug"; // [Response] public static final String HEADER_TE = "TE"; // [Request] public static final String HEADER_TRAILER = "Trailer"; // [General] public static final String HEADER_TRANSFER_ENCODING = "Transfer-Encoding"; // [General] public static final String HEADER_UPGRADE = "Upgrade"; // [General] public static final String HEADER_USER_AGENT = "User-Agent"; // [Request] public static final String HEADER_VARY = "Vary"; // [Response] public static final String HEADER_VIA = "Via"; // [General] public static final String HEADER_WARNING = "Warning"; // [General] public static final String HEADER_WWW_AUTHENTICATE = "WWW-Authenticate"; // [Response] // This is a POST-related request header value public static final String HEADER_EXPECT_CONTINUE_REQUEST_VALUE = "100-continue"; // [Request] // Chunked transfer encoding indicator public static final String TRANSFER_ENCODING_CHUNKED = "chunked"; // Key for X-MULE headers public static final String X_PROPERTY_PREFIX = "X-" + MuleProperties.PROPERTY_PREFIX; // case-insenitive Maps of header names to their normalized representations public static final Map REQUEST_HEADER_NAMES; public static final Map RESPONSE_HEADER_NAMES; public static final Map ALL_HEADER_NAMES; // Status codes public static final int SC_CONTINUE = 100; public static final int SC_SWITCHING_PROTOCOLS = 101; public static final int SC_PROCESSING = 102; public static final int SC_OK = 200; public static final int SC_CREATED = 201; public static final int SC_ACCEPTED = 202; public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203; public static final int SC_NO_CONTENT = 204; public static final int SC_RESET_CONTENT = 205; public static final int SC_PARTIAL_CONTENT = 206; public static final int SC_MULTI_STATUS = 207; public static final int SC_MULTIPLE_CHOICES = 300; public static final int SC_MOVED_PERMANENTLY = 301; public static final int SC_MOVED_TEMPORARILY = 302; public static final int SC_SEE_OTHER = 303; public static final int SC_NOT_MODIFIED = 304; public static final int SC_USE_PROXY = 305; public static final int SC_TEMPORARY_REDIRECT = 307; public static final int SC_BAD_REQUEST = 400; public static final int SC_UNAUTHORIZED = 401; public static final int SC_PAYMENT_REQUIRED = 402; public static final int SC_FORBIDDEN = 403; public static final int SC_NOT_FOUND = 404; public static final int SC_METHOD_NOT_ALLOWED = 405; public static final int SC_NOT_ACCEPTABLE = 406; public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407; public static final int SC_REQUEST_TIMEOUT = 408; public static final int SC_CONFLICT = 409; public static final int SC_GONE = 410; public static final int SC_LENGTH_REQUIRED = 411; public static final int SC_PRECONDITION_FAILED = 412; public static final int SC_REQUEST_TOO_LONG = 413; public static final int SC_REQUEST_URI_TOO_LONG = 414; public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415; public static final int SC_REQUESTED_RANGE_NOT_SATISFIABLE = 416; public static final int SC_EXPECTATION_FAILED = 417; public static final int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419; public static final int SC_METHOD_FAILURE = 420; public static final int SC_UNPROCESSABLE_ENTITY = 422; public static final int SC_LOCKED = 423; public static final int SC_FAILED_DEPENDENCY = 424; public static final int SC_INTERNAL_SERVER_ERROR = 500; public static final int SC_NOT_IMPLEMENTED = 501; public static final int SC_BAD_GATEWAY = 502; public static final int SC_SERVICE_UNAVAILABLE = 503; public static final int SC_GATEWAY_TIMEOUT = 504; public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505; public static final int SC_INSUFFICIENT_STORAGE = 507; static { String[] strings = new String[]{HEADER_ACCEPT, HEADER_ACCEPT_CHARSET, HEADER_ACCEPT_ENCODING, HEADER_ACCEPT_LANGUAGE, HEADER_AUTHORIZATION, HEADER_CACHE_CONTROL, HEADER_CONNECTION, HEADER_COOKIE, HEADER_DATE, HEADER_EXPECT, HEADER_FROM, HEADER_HOST, HEADER_IF_MATCH, HEADER_IF_MODIFIED_SINCE, HEADER_IF_NONE_MATCH, HEADER_IF_RANGE, HEADER_IF_UNMODIFIED_SINCE, HEADER_MAX_FORWARDS, HEADER_PRAGMA, HEADER_PROXY_AUTHORIZATION, HEADER_RANGE, HEADER_REFERER, HEADER_TE, HEADER_TRAILER, HEADER_TRANSFER_ENCODING, HEADER_UPGRADE, HEADER_USER_AGENT, HEADER_VIA, HEADER_WARNING, HEADER_CONTENT_LENGTH, HEADER_SLUG}; REQUEST_HEADER_NAMES = Collections.unmodifiableMap(MapUtils.mapWithKeysAndValues( CaseInsensitiveMap.class, strings, strings)); strings = new String[]{HEADER_ACCEPT_RANGES, HEADER_AGE, HEADER_ALLOW, HEADER_CACHE_CONTROL, HEADER_CONNECTION, HEADER_CONTENT_ENCODING, HEADER_CONTENT_LANGUAGE, HEADER_COOKIE_SET, HEADER_CONTENT_LOCATION, HEADER_CONTENT_MD5, HEADER_CONTENT_RANGE, HEADER_DATE, HEADER_ETAG, HEADER_EXPIRES, HEADER_LAST_MODIFIED, HEADER_LOCATION, HEADER_PRAGMA, HEADER_PROXY_AUTHENTICATE, HEADER_RETRY_AFTER, HEADER_SERVER, HEADER_TRAILER, HEADER_TRANSFER_ENCODING, HEADER_UPGRADE, HEADER_VARY, HEADER_VIA, HEADER_WARNING, HEADER_WWW_AUTHENTICATE}; RESPONSE_HEADER_NAMES = Collections.unmodifiableMap(MapUtils.mapWithKeysAndValues( CaseInsensitiveMap.class, strings, strings)); strings = new String[]{HEADER_ALLOW, HEADER_CACHE_CONTROL, HEADER_CONNECTION, HEADER_CONTENT_ENCODING, HEADER_CONTENT_LANGUAGE, HEADER_CONTENT_LENGTH, HEADER_CONTENT_LOCATION, HEADER_CONTENT_MD5, HEADER_CONTENT_RANGE, HEADER_CONTENT_TYPE, HEADER_DATE, HEADER_EXPIRES, HEADER_KEEP_ALIVE, HEADER_LAST_MODIFIED, HEADER_PRAGMA, HEADER_TRAILER, HEADER_TRANSFER_ENCODING, HEADER_UPGRADE, HEADER_VIA, HEADER_WARNING}; Map allHeaders = MapUtils.mapWithKeysAndValues(CaseInsensitiveMap.class, strings, strings); allHeaders.putAll(REQUEST_HEADER_NAMES); allHeaders.putAll(RESPONSE_HEADER_NAMES); ALL_HEADER_NAMES = Collections.unmodifiableMap(allHeaders); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageRequesterFactory.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageRequesterFactory.j0000644000175000017500000000175410757615756033716 0ustar charlescharles/* * $Id: HttpClientMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; /** * Creates a HttpClientMessageDispatcher to make client requests */ public class HttpClientMessageRequesterFactory extends AbstractMessageRequesterFactory { /** {@inheritDoc} */ public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new HttpClientMessageRequester(endpoint); } }mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/filters/0000755000175000017500000000000011351410634026344 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/filters/HttpRequestWildcardFilter.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/filters/HttpRequestWildcardFilter.j0000644000175000017500000000233610745677442033655 0ustar charlescharles/* * $Id: HttpRequestWildcardFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.filters; import org.mule.api.MuleMessage; import org.mule.routing.filters.WildcardFilter; import org.mule.transport.http.HttpConnector; /** * HttpRequestWildcardFilter filters out wildcard URL expressions. You * can use a comma-separated list of URL patterns such as "*.gif, *blah*". */ public class HttpRequestWildcardFilter extends WildcardFilter { public HttpRequestWildcardFilter() { super(); } public HttpRequestWildcardFilter(String pattern) { super(pattern); } public boolean accept(Object object) { if (object instanceof MuleMessage) { object = ((MuleMessage) object).getProperty(HttpConnector.HTTP_REQUEST_PROPERTY); } return super.accept(object); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpServerConnection.java0000644000175000017500000001670710763624216031711 0ustar charlescharles/* * $Id: HttpServerConnection.java 11186 2008-03-05 23:11:10Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.RequestContext; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.OutputHandler; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.Socket; import java.net.SocketException; import java.util.Iterator; import org.apache.commons.httpclient.ChunkedOutputStream; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpParser; import org.apache.commons.httpclient.StatusLine; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** A connection to the SimpleHttpServer. */ public class HttpServerConnection { private static final Log logger = LogFactory.getLog(HttpServerConnection.class); private Socket socket; private final InputStream in; private final OutputStream out; private boolean keepAlive = false; private final String encoding; public HttpServerConnection(final Socket socket, String encoding) throws IOException { super(); if (socket == null) { throw new IllegalArgumentException("Socket may not be null"); } this.socket = socket; this.socket.setTcpNoDelay(true); this.in = socket.getInputStream(); this.out = new DataOutputStream(socket.getOutputStream()); this.encoding = encoding; } public void close() { try { if (socket != null) { if (logger.isDebugEnabled()) { logger.debug("Closing: " + socket); } try { socket.shutdownOutput(); } catch (UnsupportedOperationException e) { //Can't shutdown in/output on SSL sockets } socket.close(); } } catch (IOException e) { if (logger.isDebugEnabled()) { logger.debug("(Ignored) Error closing the socket: " + e.getMessage()); } } finally { socket = null; } } public synchronized boolean isOpen() { return this.socket != null; } public void setKeepAlive(boolean b) { this.keepAlive = b; } public boolean isKeepAlive() { return this.keepAlive; } public InputStream getInputStream() { return this.in; } public OutputStream getOutputStream() { return this.out; } /** * Returns the ResponseWriter used to write the output to the socket. * * @return This connection's ResponseWriter */ public ResponseWriter getWriter() throws UnsupportedEncodingException { return new ResponseWriter(out); } public HttpRequest readRequest() throws IOException { try { String line = readLine(); if (line == null) { return null; } return new HttpRequest(RequestLine.parseLine(line), HttpParser.parseHeaders(this.in, encoding), this.in); } catch (IOException e) { close(); throw e; } } public HttpResponse readResponse() throws IOException { try { String line = readLine(); return new HttpResponse(new StatusLine(line), HttpParser.parseHeaders(this.in, encoding), this.in); } catch (IOException e) { close(); throw e; } } private String readLine() throws IOException { String line; do { line = HttpParser.readLine(in, encoding); } while (line != null && line.length() == 0); if (line == null) { setKeepAlive(false); return null; } return line; } public void writeRequest(final HttpRequest request) throws IOException { if (request == null) { return; } ResponseWriter writer = new ResponseWriter(this.out, encoding); writer.println(request.getRequestLine().toString()); Iterator item = request.getHeaderIterator(); while (item.hasNext()) { Header header = (Header) item.next(); writer.print(header.toExternalForm()); } writer.println(); writer.flush(); OutputStream outstream = this.out; InputStream content = request.getBody(); if (content != null) { Header transferenc = request.getFirstHeader(HttpConstants.HEADER_TRANSFER_ENCODING); if (transferenc != null) { request.removeHeaders(HttpConstants.HEADER_CONTENT_LENGTH); if (transferenc.getValue().indexOf(HttpConstants.TRANSFER_ENCODING_CHUNKED) != -1) { outstream = new ChunkedOutputStream(outstream); } } IOUtils.copy(content, outstream); if (outstream instanceof ChunkedOutputStream) { ((ChunkedOutputStream) outstream).finish(); } } outstream.flush(); } public void writeResponse(final HttpResponse response) throws IOException, TransformerException { if (response == null) { return; } setKeepAlive(response.isKeepAlive()); ResponseWriter writer = new ResponseWriter(this.out, encoding); OutputStream outstream = this.out; writer.println(response.getStatusLine()); Iterator item = response.getHeaderIterator(); while (item.hasNext()) { Header header = (Header) item.next(); writer.print(header.toExternalForm()); } writer.println(); writer.flush(); OutputHandler content = response.getBody(); if (content != null) { Header transferenc = response.getFirstHeader(HttpConstants.HEADER_TRANSFER_ENCODING); if (transferenc != null) { response.removeHeaders(HttpConstants.HEADER_CONTENT_LENGTH); if (transferenc.getValue().indexOf(HttpConstants.TRANSFER_ENCODING_CHUNKED) != -1) { outstream = new ChunkedOutputStream(outstream); } } content.write(RequestContext.getEvent(), outstream); if (outstream instanceof ChunkedOutputStream) { ((ChunkedOutputStream) outstream).finish(); } } outstream.flush(); } public int getSocketTimeout() throws SocketException { return this.socket.getSoTimeout(); } public void setSocketTimeout(int timeout) throws SocketException { this.socket.setSoTimeout(timeout); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/components/0000755000175000017500000000000011351410634027061 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/http/src/main/java/org/mule/transport/http/components/RestServiceException.javamule-2.0.1/transports/http/src/main/java/org/mule/transport/http/components/RestServiceException.jav0000644000175000017500000000200410745677442033716 0ustar charlescharles/* * $Id: RestServiceException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.components; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.config.i18n.Message; public class RestServiceException extends MessagingException { /** * Serial version */ private static final long serialVersionUID = -1026055907767407433L; public RestServiceException(Message message, MuleMessage umoMessage) { super(message, umoMessage); } public RestServiceException(Message message, MuleMessage umoMessage, Throwable cause) { super(message, umoMessage, cause); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/components/RestServiceWrapper.java0000644000175000017500000002740110767632003033535 0ustar charlescharles/* * $Id: RestServiceWrapper.java 11414 2008-03-18 03:16:19Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.components; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.routing.filter.Filter; import org.mule.component.AbstractComponent; import org.mule.config.i18n.CoreMessages; import org.mule.routing.filters.MessagePropertyFilter; import org.mule.routing.filters.RegExFilter; import org.mule.transport.NullPayload; import org.mule.util.expression.ExpressionEvaluator; import org.mule.util.expression.ExpressionEvaluatorManager; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This service can used to proxy REST style services as local Mule Components. It * can be configured with a service URL plus a number of properties that allow you to * configure the parameters and error conditions on the service. */ public class RestServiceWrapper extends AbstractComponent { public static final String REST_SERVICE_URL = "rest.service.url"; public static final String GET = "GET"; public static final String CONTENT_TYPE = "Content-Type"; public static final String CONTENT_TYPE_VALUE = "application/x-www-form-urlencoded"; public static final String HTTP_METHOD = "http.method"; /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); private String serviceUrl; private boolean urlFromMessage = false; private Map requiredParams = new HashMap(); private Map optionalParams = new HashMap(); private String httpMethod = "GET"; private List payloadParameterNames; private Filter errorFilter; private String errorExpression; public String getServiceUrl() { return serviceUrl; } public void setServiceUrl(String serviceUrl) { this.serviceUrl = serviceUrl; } public boolean isUrlFromMessage() { return urlFromMessage; } public void setUrlFromMessage(boolean urlFromMessage) { this.urlFromMessage = urlFromMessage; } public Map getRequiredParams() { return requiredParams; } /** * Required params that are pulled from the message. If these params don't exist * the call will fail Note that you can use * {@link org.mule.util.expression.ExpressionEvaluator} expressions such as * xpath, header, xquery, etc * * @param requiredParams */ public void setRequiredParams(Map requiredParams) { this.requiredParams = requiredParams; } /** * Optional params that are pulled from the message. If these params don't exist * execution will continue. Note that you can use {@link ExpressionEvaluator} * expressions such as xpath, header, xquery, etc * * @param requiredParams */ public Map getOptionalParams() { return optionalParams; } public void setOptionalParams(Map optionalParams) { this.optionalParams = optionalParams; } public String getHttpMethod() { return httpMethod; } public void setHttpMethod(String httpMethod) { this.httpMethod = httpMethod; } public List getPayloadParameterNames() { return payloadParameterNames; } public void setPayloadParameterNames(List payloadParameterNames) { this.payloadParameterNames = payloadParameterNames; } public Filter getFilter() { return errorFilter; } public void setFilter(Filter errorFilter) { this.errorFilter = errorFilter; } public String getErrorExpression() { return errorExpression; } public void setErrorExpression(String errorExpression) { this.errorExpression = errorExpression; } protected void doInitialise() throws InitialisationException { if (serviceUrl == null && !urlFromMessage) { throw new InitialisationException(CoreMessages.objectIsNull("serviceUrl"), this); } else if (serviceUrl != null) { try { new URL(serviceUrl); } catch (MalformedURLException e) { throw new InitialisationException(e, this); } } if (errorFilter == null) { if (errorExpression == null) { // We'll set a default filter that checks the return code errorFilter = new MessagePropertyFilter("http.status!=200"); logger.info("Setting default error filter to MessagePropertyFilter('http.status!=200')"); } else { errorFilter = new RegExFilter(errorExpression); } } } public MuleMessage doOnCall(MuleEvent event) { String tempUrl; MuleMessage result = null; try { Object request = event.transformMessage(); Object requestBody; if (urlFromMessage) { tempUrl = event.getMessage().getStringProperty(REST_SERVICE_URL, null); if (tempUrl == null) { throw new IllegalArgumentException(CoreMessages.propertyIsNotSetOnEvent(REST_SERVICE_URL) .toString()); } } else { tempUrl = serviceUrl; } StringBuffer urlBuffer = new StringBuffer(tempUrl); if (GET.equalsIgnoreCase(this.httpMethod)) { requestBody = NullPayload.getInstance(); setRESTParams(urlBuffer, event.getMessage(), request, requiredParams, false, null); setRESTParams(urlBuffer, event.getMessage(), request, optionalParams, true, null); } else // if post { StringBuffer requestBodyBuffer = new StringBuffer(); event.getMessage().setProperty(CONTENT_TYPE, CONTENT_TYPE_VALUE); setRESTParams(urlBuffer, event.getMessage(), request, requiredParams, false, requestBodyBuffer); setRESTParams(urlBuffer, event.getMessage(), request, optionalParams, true, requestBodyBuffer); requestBody = requestBodyBuffer.toString(); } tempUrl = urlBuffer.toString(); logger.info("Invoking REST service: " + tempUrl); event.getMessage().setProperty(HTTP_METHOD, httpMethod); result = RequestContext.getEventContext().sendEvent( new DefaultMuleMessage(requestBody, event.getMessage()), tempUrl); if (isErrorPayload(result)) { handleException(new RestServiceException(CoreMessages.failedToInvokeRestService(tempUrl), result), result); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; } private String getSeparator(String url) { String sep; if (url.indexOf("?") > -1) { sep = "&"; } else { sep = "?"; } return sep; } private String updateSeparator(String sep) { if (sep.compareTo("?") == 0 || sep.compareTo("") == 0) { return ("&"); } return sep; } // if requestBodyBuffer is null, it means that the request is a GET, otherwise it // is a POST and // requestBodyBuffer must contain the body of the http method at the end of this // function call private void setRESTParams(StringBuffer url, MuleMessage msg, Object body, Map args, boolean optional, StringBuffer requestBodyBuffer) { String sep; if (requestBodyBuffer == null) { sep = getSeparator(url.toString()); } else { sep = ""; } for (Iterator iterator = args.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); String name = (String) entry.getKey(); String exp = (String) entry.getValue(); Object value = ExpressionEvaluatorManager.evaluate(exp, msg); if (value == null) { if (!optional) { throw new IllegalArgumentException(CoreMessages.propertyIsNotSetOnEvent(exp).toString()); } } else if (requestBodyBuffer != null) // implies this is a POST { requestBodyBuffer.append(sep); requestBodyBuffer.append(name).append('=').append(value); } else { url.append(sep); url.append(name).append('=').append(value); } sep = updateSeparator(sep); } if (!optional && payloadParameterNames != null) { if (body instanceof Object[]) { Object[] requestArray = (Object[]) body; for (int i = 0; i < payloadParameterNames.size(); i++) { if (requestBodyBuffer != null) { requestBodyBuffer.append(sep).append(payloadParameterNames.get(i)).append('=').append( requestArray[i].toString()); } else { url.append(sep).append(payloadParameterNames.get(i)).append('=').append( requestArray[i].toString()); } sep = updateSeparator(sep); } } else { if (payloadParameterNames.get(0) != null) { if (requestBodyBuffer != null) { requestBodyBuffer.append(payloadParameterNames.get(0)).append('=').append(body.toString()); } else { url.append(sep).append(payloadParameterNames.get(0)).append('=').append(body.toString()); } } } } } protected boolean isErrorPayload(MuleMessage message) { return errorFilter != null && errorFilter.accept(message); } protected void handleException(RestServiceException e, MuleMessage result) throws Exception { throw e; } // @Override protected void doOnEvent(MuleEvent event) { try { onCall(event); } catch (MuleException e) { logger.error(e); } } // @Override protected void doDispose() { // no-op } // @Override protected void doStart() throws MuleException { // no-op } // @Override protected void doStop() throws MuleException { // no-op } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/MuleHttpMethodRetryHandler.java0000644000175000017500000000210210745677442033003 0ustar charlescharles/* * $Id:MuleHttpMethodRetryHandler.java 7555 2007-07-18 03:17:16Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import java.io.IOException; import java.net.SocketException; import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; import org.apache.commons.httpclient.HttpMethod; public class MuleHttpMethodRetryHandler extends DefaultHttpMethodRetryHandler { public boolean retryMethod(final HttpMethod method, final IOException exception, int executionCount) { // return false; if ((executionCount < this.getRetryCount()) && (exception instanceof SocketException)) { return true; } return super.retryMethod(method, exception, executionCount); } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpConnector.java0000644000175000017500000002733010757615756030363 0ustar charlescharles/* * $Id: HttpConnector.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageReceiver; import org.mule.config.i18n.CoreMessages; import org.mule.transport.tcp.TcpConnector; import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.commons.codec.binary.Base64; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpConnectionManager; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpState; import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.params.HttpConnectionManagerParams; import sun.rmi.transport.Endpoint; /** * HttpConnector provides a way of receiving and sending http requests * and responses. The Connector itself handles dispatching http requests. The * HttpMessageReceiver handles the receiving requests and processing * of headers This endpoint recognises the following properties -

*

    *
  • hostname - The hostname to send and receive http requests
  • *
  • port - The port to listen on. The industry standard is 80 and if this propert * is not set it will default to 80
  • *
  • proxyHostname - If you access the web through a proxy, this holds the server * address
  • *
  • proxyPort - The port the proxy is configured on
  • *
  • proxyUsername - If the proxy requires authentication supply a username
  • *
  • proxyPassword - If the proxy requires authentication supply a password
  • *
* */ public class HttpConnector extends TcpConnector { public static final String HTTP = "http"; public static final String HTTP_PREFIX = "http."; /** * MuleEvent property to pass back the status for the response */ public static final String HTTP_STATUS_PROPERTY = HTTP_PREFIX + "status"; public static final String HTTP_VERSION_PROPERTY = HTTP_PREFIX + "version"; public static final String HTTP_CUSTOM_HEADERS_MAP_PROPERTY = HTTP_PREFIX + "custom.headers"; public static final String HTTP_METHOD_PROPERTY = HTTP_PREFIX + "method"; public static final String HTTP_REQUEST_PROPERTY = HTTP_PREFIX + "request"; /** * Allows the user to set a {@link org.apache.commons.httpclient.params.HttpMethodParams} object in the client * request to be set on the HttpMethod request object */ public static final String HTTP_PARAMS_PROPERTY = HTTP_PREFIX + "params"; public static final String HTTP_GET_BODY_PARAM_PROPERTY = HTTP_PREFIX + "get.body.param"; public static final String DEFAULT_HTTP_GET_BODY_PARAM_PROPERTY = "body"; public static final String HTTP_POST_BODY_PARAM_PROPERTY = HTTP_PREFIX + "post.body.param"; public static final String HTTP_COOKIE_SPEC_PROPERTY = "cookieSpec"; public static final String HTTP_COOKIES_PROPERTY = "cookies"; public static final String HTTP_ENABLE_COOKIES_PROPERTY = "enableCookies"; public static final String COOKIE_SPEC_NETSCAPE = "netscape"; public static final String COOKIE_SPEC_RFC2109 = "rcf2109"; private String proxyHostname = null; private int proxyPort = HttpConstants.DEFAULT_HTTP_PORT; private String proxyUsername = null; private String proxyPassword = null; private String cookieSpec; private boolean enableCookies = false; protected HttpConnectionManager clientConnectionManager; //@Override protected void doInitialise() throws InitialisationException { super.doInitialise(); if (clientConnectionManager == null) { clientConnectionManager = new MultiThreadedHttpConnectionManager(); HttpConnectionManagerParams params = new HttpConnectionManagerParams(); if (getSendBufferSize() != INT_VALUE_NOT_SET) { params.setSendBufferSize(getSendBufferSize()); } if (getReceiveBufferSize() != INT_VALUE_NOT_SET) { params.setReceiveBufferSize(getReceiveBufferSize()); } if (getClientSoTimeout() != INT_VALUE_NOT_SET) { params.setSoTimeout(getClientSoTimeout()); } if (getSocketSoLinger() != INT_VALUE_NOT_SET) { params.setLinger(getSocketSoLinger()); } params.setTcpNoDelay(isSendTcpNoDelay()); params.setMaxTotalConnections(getDispatcherThreadingProfile().getMaxThreadsActive()); params.setDefaultMaxConnectionsPerHost(getDispatcherThreadingProfile().getMaxThreadsActive()); clientConnectionManager.setParams(params); } } /** * @see Connector#registerListener(Service, Endpoint) */ public MessageReceiver registerListener(Service service, InboundEndpoint endpoint) throws Exception { if (endpoint != null) { Map endpointProperties = endpoint.getProperties(); if (endpointProperties != null) { // normalize properties for HTTP Map newProperties = new HashMap(endpointProperties.size()); for (Iterator entries = endpointProperties.entrySet().iterator(); entries.hasNext();) { Map.Entry entry = (Map.Entry)entries.next(); Object key = entry.getKey(); Object normalizedKey = HttpConstants.ALL_HEADER_NAMES.get(key); if (normalizedKey != null) { // normalized property exists key = normalizedKey; } newProperties.put(key, entry.getValue()); } // set normalized properties back on the endpoint endpoint.getProperties().clear(); endpoint.getProperties().putAll(newProperties); } } // proceed as usual return super.registerListener(service, endpoint); } /** * The method determines the key used to store the receiver against. * * @param service the service for which the endpoint is being registered * @param endpoint the endpoint being registered for the service * @return the key to store the newly created receiver against */ protected Object getReceiverKey(Service service, InboundEndpoint endpoint) { String key = endpoint.getEndpointURI().toString(); int i = key.indexOf('?'); if (i > -1) { key = key.substring(0, i); } return key; } /** * @see org.mule.api.transport.Connector#getProtocol() */ public String getProtocol() { return HTTP; } /** * @return */ public String getProxyHostname() { return proxyHostname; } /** * @return */ public String getProxyPassword() { return proxyPassword; } /** * @return */ public int getProxyPort() { return proxyPort; } /** * @return */ public String getProxyUsername() { return proxyUsername; } /** * @param host */ public void setProxyHostname(String host) { proxyHostname = host; } /** * @param string */ public void setProxyPassword(String string) { proxyPassword = string; } /** * @param port */ public void setProxyPort(int port) { proxyPort = port; } /** * @param string */ public void setProxyUsername(String string) { proxyUsername = string; } public Map getReceivers() { return this.receivers; } public String getCookieSpec() { return cookieSpec; } public void setCookieSpec(String cookieSpec) { if (!(COOKIE_SPEC_NETSCAPE.equalsIgnoreCase(cookieSpec) || COOKIE_SPEC_RFC2109.equalsIgnoreCase(cookieSpec))) { throw new IllegalArgumentException( CoreMessages.propertyHasInvalidValue("cookieSpec", cookieSpec).toString()); } this.cookieSpec = cookieSpec; } public boolean isEnableCookies() { return enableCookies; } public void setEnableCookies(boolean enableCookies) { this.enableCookies = enableCookies; } public HttpConnectionManager getClientConnectionManager() { return clientConnectionManager; } public void setClientConnectionManager(HttpConnectionManager clientConnectionManager) { this.clientConnectionManager = clientConnectionManager; } protected HttpClient doClientConnect() throws Exception { HttpState state = new HttpState(); if (getProxyUsername() != null) { state.setProxyCredentials( new AuthScope(null, -1, null, null), new UsernamePasswordCredentials(getProxyUsername(), getProxyPassword())); } HttpClient client = new HttpClient(); client.setState(state); client.setHttpConnectionManager(getClientConnectionManager()); return client; } protected void setupClientAuthorization(MuleEvent event, HttpMethod httpMethod, HttpClient client, ImmutableEndpoint endpoint) throws UnsupportedEncodingException { httpMethod.setDoAuthentication(true); if (event != null && event.getCredentials() != null) { MuleMessage msg = event.getMessage(); String authScopeHost = msg.getStringProperty(HTTP_PREFIX + "auth.scope.host", null); int authScopePort = msg.getIntProperty(HTTP_PREFIX + "auth.scope.port", -1); String authScopeRealm = msg.getStringProperty(HTTP_PREFIX + "auth.scope.realm", null); String authScopeScheme = msg.getStringProperty(HTTP_PREFIX + "auth.scope.scheme", null); client.getState().setCredentials( new AuthScope(authScopeHost, authScopePort, authScopeRealm, authScopeScheme), new UsernamePasswordCredentials(event.getCredentials().getUsername(), new String( event.getCredentials().getPassword()))); client.getParams().setAuthenticationPreemptive(true); } else if (endpoint.getEndpointURI().getUserInfo() != null && endpoint.getProperty(HttpConstants.HEADER_AUTHORIZATION) == null) { // Add User Creds StringBuffer header = new StringBuffer(128); header.append("Basic "); header.append(new String(Base64.encodeBase64(endpoint.getEndpointURI().getUserInfo().getBytes( endpoint.getEncoding())))); httpMethod.addRequestHeader(HttpConstants.HEADER_AUTHORIZATION, header.toString()); } else { // don't use preemptive if there are no credentials to send client.getParams().setAuthenticationPreemptive(false); } } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcher.java0000644000175000017500000002534710757620024033151 0ustar charlescharles/* * $Id: HttpClientMessageDispatcher.java 10963 2008-02-22 19:18:44Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.DispatchException; import org.mule.api.transport.OutputHandler; import org.mule.message.DefaultExceptionPayload; import org.mule.transport.AbstractMessageDispatcher; import org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest; import org.mule.util.StringUtils; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.net.URISyntaxException; import java.util.Iterator; import java.util.Map; import org.apache.commons.httpclient.Cookie; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.cookie.CookiePolicy; import org.apache.commons.httpclient.methods.ByteArrayRequestEntity; import org.apache.commons.httpclient.methods.EntityEnclosingMethod; import org.apache.commons.httpclient.params.HttpMethodParams; import org.apache.commons.httpclient.protocol.Protocol; /** * HttpClientMessageDispatcher dispatches Mule events over HTTP. */ public class HttpClientMessageDispatcher extends AbstractMessageDispatcher { /** * Range start for http error status codes. */ public static final int ERROR_STATUS_CODE_RANGE_START = 400; private final HttpConnector connector; private volatile HttpClient client = null; private final Transformer sendTransformer; public HttpClientMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (HttpConnector) endpoint.getConnector(); this.sendTransformer = new ObjectToHttpClientMethodRequest(); } protected void doConnect() throws Exception { if (client == null) { client = connector.doClientConnect(); } } protected void doDisconnect() throws Exception { client = null; } protected void doDispatch(MuleEvent event) throws Exception { HttpMethod httpMethod = getMethod(event); try { execute(event, httpMethod); if (httpMethod.getStatusCode() >= ERROR_STATUS_CODE_RANGE_START) { logger.error(httpMethod.getResponseBodyAsString()); throw new DispatchException(event.getMessage(), event.getEndpoint(), new Exception( "Http call returned a status of: " + httpMethod.getStatusCode() + " " + httpMethod.getStatusText())); } } finally { httpMethod.releaseConnection(); } } protected HttpMethod execute(MuleEvent event, HttpMethod httpMethod) throws Exception { // TODO set connection timeout buffer etc try { URI uri = event.getEndpoint().getEndpointURI().getUri(); this.processCookies(event); // TODO can we use the return code for better reporting? client.executeMethod(getHostConfig(uri), httpMethod); return httpMethod; } catch (IOException e) { // TODO employ dispatcher reconnection strategy at this point throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } catch (Exception e) { throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } } protected void processCookies(MuleEvent event) { MuleMessage msg = event.getMessage(); Object cookieObject = msg.removeProperty(HttpConnector.HTTP_COOKIES_PROPERTY); if (cookieObject instanceof Cookie[]) { // cookies came in via a regular HTTP request Cookie[] cookies = (Cookie[]) cookieObject; if (cookies != null && cookies.length > 0) { String policy = (String) msg.removeProperty(HttpConnector.HTTP_COOKIE_SPEC_PROPERTY); client.getParams().setCookiePolicy(CookieHelper.getCookiePolicy(policy)); client.getState().addCookies(cookies); } } else if (cookieObject instanceof Map) { // cookies were configured on the endpoint client.getParams().setCookiePolicy(CookiePolicy.RFC_2109); String host = this.getEndpoint().getEndpointURI().getHost(); String path = this.getEndpoint().getEndpointURI().getPath(); Map cookieMap = (Map) cookieObject; Iterator keyIter = cookieMap.keySet().iterator(); while (keyIter.hasNext()) { String key = (String) keyIter.next(); String value = (String) cookieMap.get(key); Cookie cookie = new Cookie(host, key, value, path, null, false); client.getState().addCookie(cookie); } } else if (cookieObject != null) { throw new IllegalArgumentException("Invalid cookies " + cookieObject); } } protected HttpMethod getMethod(MuleEvent event) throws TransformerException { MuleMessage msg = event.getMessage(); setPropertyFromEndpoint(event, msg, HttpConnector.HTTP_CUSTOM_HEADERS_MAP_PROPERTY); HttpMethod httpMethod; Object body = event.transformMessage(); if (body instanceof HttpMethod) { httpMethod = (HttpMethod)body; } else { httpMethod = (HttpMethod) sendTransformer.transform(msg); } return httpMethod; } protected void setPropertyFromEndpoint(MuleEvent event, MuleMessage msg, String prop) { Object o = msg.getProperty(prop, null); if (o == null) { o = event.getEndpoint().getProperty(prop); if (o != null) { msg.setProperty(prop, o); } } } protected HttpMethod createEntityMethod(MuleEvent event, Object body, EntityEnclosingMethod postMethod) throws TransformerException { HttpMethod httpMethod; if (body instanceof String) { ObjectToHttpClientMethodRequest trans = new ObjectToHttpClientMethodRequest(); httpMethod = (HttpMethod)trans.transform(body.toString()); } else if (body instanceof byte[]) { byte[] buffer = event.transformMessageToBytes(); postMethod.setRequestEntity(new ByteArrayRequestEntity(buffer, event.getEncoding())); httpMethod = postMethod; } else { if (!(body instanceof OutputHandler)) { body = event.transformMessage(OutputHandler.class); } OutputHandler outputHandler = (OutputHandler)body; postMethod.setRequestEntity(new StreamPayloadRequestEntity(outputHandler, event)); postMethod.setContentChunked(true); httpMethod = postMethod; } return httpMethod; } /* * (non-Javadoc) * * @see org.mule.api.transport.Connector#send(org.mule.api.MuleEvent) */ protected MuleMessage doSend(MuleEvent event) throws Exception { HttpMethod httpMethod = getMethod(event); connector.setupClientAuthorization(event, httpMethod, client, endpoint); httpMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new MuleHttpMethodRetryHandler()); Object body = null; boolean releaseConn = false; try { httpMethod = execute(event, httpMethod); DefaultExceptionPayload ep = null; if (httpMethod.getStatusCode() >= ERROR_STATUS_CODE_RANGE_START) { ep = new DefaultExceptionPayload(new DispatchException(event.getMessage(), event.getEndpoint(), new Exception("Http call returned a status of: " + httpMethod.getStatusCode() + " " + httpMethod.getStatusText()))); } InputStream is = httpMethod.getResponseBodyAsStream(); if (is == null) { body = StringUtils.EMPTY; releaseConn = true; } else { is = new ReleasingInputStream(is, httpMethod); body = is; } Header[] headers = httpMethod.getResponseHeaders(); HttpMessageAdapter adapter = new HttpMessageAdapter(new Object[]{body, headers}); String status = String.valueOf(httpMethod.getStatusCode()); adapter.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, status); if (logger.isDebugEnabled()) { logger.debug("Http response is: " + status); } MuleMessage m = new DefaultMuleMessage(adapter); m.setExceptionPayload(ep); return m; } catch (Exception e) { releaseConn = true; if (e instanceof DispatchException) { throw (DispatchException) e; } throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } finally { if (releaseConn) { httpMethod.releaseConnection(); } } } protected HostConfiguration getHostConfig(URI uri) throws URISyntaxException { Protocol protocol = Protocol.getProtocol(uri.getScheme().toLowerCase()); String host = uri.getHost(); int port = uri.getPort(); HostConfiguration config = new HostConfiguration(); config.setHost(host, port, protocol); if (StringUtils.isNotBlank(connector.getProxyHostname())) { // add proxy support config.setProxy(connector.getProxyHostname(), connector.getProxyPort()); } return config; } protected void doDispose() { // template method } } mule-2.0.1/transports/http/src/main/java/org/mule/transport/http/HttpSessionHandler.java0000644000175000017500000000470510745677442031350 0ustar charlescharles/* * $Id: HttpSessionHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.transport.SessionHandler; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.commons.httpclient.Cookie; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Will read and write Http Cookie information to and from the Mule MuleSession */ public class HttpSessionHandler implements SessionHandler { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); public void retrieveSessionInfoFromMessage(MuleMessage message, MuleSession session) throws MuleException { Cookie[] cookies = (Cookie[])message.getProperty(HttpConnector.HTTP_COOKIES_PROPERTY); if (cookies != null) { for (int i = 0; i < cookies.length; i++) { Cookie cookie = cookies[i]; session.setProperty(cookie.getName(), cookie.getValue()); if (logger.isDebugEnabled()) { logger.debug("Added cookie to session: " + cookie.toString()); } } } } public void storeSessionInfoToMessage(MuleSession session, MuleMessage message) throws MuleException { Object name; Object value; List cookies = new ArrayList(); for (Iterator iterator = session.getPropertyNames(); iterator.hasNext();) { name = iterator.next(); value = session.getProperty(name); // TODO handle domain, path, secure (https) and expiry cookies.add(new Cookie(null, name.toString(), value.toString())); } if (cookies.size() > 0) { message.setProperty(HttpConnector.HTTP_COOKIES_PROPERTY, cookies.toArray(new Cookie[cookies.size()])); } } public String getSessionIDKey() { return "ID"; } } mule-2.0.1/transports/http/src/main/resources/0000755000175000017500000000000011351410634021221 5ustar charlescharlesmule-2.0.1/transports/http/src/main/resources/META-INF/0000755000175000017500000000000011351410635022362 5ustar charlescharlesmule-2.0.1/transports/http/src/main/resources/META-INF/mule-servlet.xsd0000644000175000017500000000562710737201302025534 0ustar charlescharles Servlet connector is a channel adapter between Mule and a servlet engine. It allows the MuleReceiverServlet to look up components interested in requests it receives via the servlet container. The real URL that the servlet container is bound on. If this is not set the wsdl may not be generated correctly mule-2.0.1/transports/http/src/main/resources/META-INF/spring.schemas0000644000175000017500000000054310632002341025223 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/http/2.0/mule-http.xsd=META-INF/mule-http.xsd http\://www.mulesource.org/schema/mule/https/2.0/mule-https.xsd=META-INF/mule-https.xsd http\://www.mulesource.org/schema/mule/jetty/2.0/mule-jetty.xsd=META-INF/mule-jetty.xsd http\://www.mulesource.org/schema/mule/servlet/2.0/mule-servlet.xsd=META-INF/mule-servlet.xsd mule-2.0.1/transports/http/src/main/resources/META-INF/spring.handlers0000644000175000017500000000063210754365306025421 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/http/2.0=org.mule.transport.http.config.HttpNamespaceHandler http\://www.mulesource.org/schema/mule/https/2.0=org.mule.transport.http.config.HttpsNamespaceHandler http\://www.mulesource.org/schema/mule/jetty/2.0=org.mule.transport.http.config.JettyNamespaceHandler http\://www.mulesource.org/schema/mule/servlet/2.0=org.mule.transport.http.config.ServletNamespaceHandler mule-2.0.1/transports/http/src/main/resources/META-INF/services/0000755000175000017500000000000011351410635024205 5ustar charlescharlesmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410635024774 5ustar charlescharlesmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410635025736 5ustar charlescharlesmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410635027753 5ustar charlescharlesmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/providers/jetty.properties0000644000175000017500000000111210756311723033231 0ustar charlescharlesconnector=org.mule.transport.http.jetty.JettyConnector dispatcher.factory=org.mule.transport.http.HttpClientMessageDispatcherFactory requester.factory=org.mule.transport.http.HttpClientMessageRequesterFactory message.receiver=org.mule.transport.http.jetty.JettyHttpMessageReceiver message.adapter=org.mule.transport.http.servlet.HttpRequestMessageAdapter outbound.transformer=org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest response.transformer=org.mule.transport.http.transformers.MuleMessageToHttpResponse endpoint.builder=org.mule.endpoint.UrlEndpointURIBuilder mule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/providers/http.properties0000644000175000017500000000125410756311723033060 0ustar charlescharlesconnector=org.mule.transport.http.HttpConnector dispatcher.factory=org.mule.transport.http.HttpClientMessageDispatcherFactory requester.factory=org.mule.transport.http.HttpClientMessageRequesterFactory message.receiver=org.mule.transport.http.HttpMessageReceiver message.adapter=org.mule.transport.http.HttpMessageAdapter stream.message.adapter=org.mule.transport.http.HttpStreamMessageAdapter outbound.transformer=org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest response.transformer=org.mule.transport.http.transformers.MuleMessageToHttpResponse session.handler=org.mule.transport.http.HttpSessionHandler endpoint.builder=org.mule.endpoint.UrlEndpointURIBuilder mule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/providers/https.properties0000644000175000017500000000125610756311723033245 0ustar charlescharlesconnector=org.mule.transport.http.HttpsConnector dispatcher.factory=org.mule.transport.http.HttpClientMessageDispatcherFactory requester.factory=org.mule.transport.http.HttpClientMessageRequesterFactory message.receiver=org.mule.transport.http.HttpsMessageReceiver message.adapter=org.mule.transport.http.HttpMessageAdapter stream.message.adapter=org.mule.transport.http.HttpStreamMessageAdapter outbound.transformer=org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest response.transformer=org.mule.transport.http.transformers.MuleMessageToHttpResponse session.handler=org.mule.transport.http.HttpSessionHandler endpoint.builder=org.mule.endpoint.UrlEndpointURIBuilder ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/providers/servlet.propertiesmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/providers/servlet.propertie0000644000175000017500000000061110745677442033411 0ustar charlescharlesconnector=org.mule.transport.http.servlet.ServletConnector # what does a blank entry do? dispatcher.factory= requester.factory=org.mule.transport.UnsupportedMessageRequesterFactory message.receiver=org.mule.transport.http.servlet.ServletMessageReceiver message.adapter=org.mule.transport.http.servlet.HttpRequestMessageAdapter endpoint.builder=org.mule.endpoint.ResourceNameEndpointURIBuilder mule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/providers/rest.properties0000644000175000017500000000111110756311723033046 0ustar charlescharlesconnector=org.mule.transport.http.jetty.JettyConnector dispatcher.factory=org.mule.transport.http.HttpClientMessageDispatcherFactory requester.factory=org.mule.transport.http.HttpClientMessageRequesterFactory message.receiver=org.mule.transport.http.jetty.JettyHttpMessageReceiver message.adapter=org.mule.transport.http.servlet.HttpRequestMessageAdapter outbound.transformer=org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest response.transformer=org.mule.transport.http.transformers.MuleMessageToHttpResponse endpoint.builder=org.mule.endpoint.UrlEndpointURIBuildermule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410635026515 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/i18n/http-messages.propertiesmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/i18n/http-messages.properti0000644000175000017500000000222510710670237033074 0ustar charlescharles1=Response transformer is required for the http endpoint. Check the connector configuration or service descriptor 2=Response transformer for "{0}" must return either a String or byte[] 3=HTTP request failed with return code: {0} 4=Unable to get endpointUri from HttpServletRequest. Servlet Request Url is: {0} 5=No endpointUri could be found on Uri "{0}". Format is /endpoint-identifer/endpointUri 6=Failed to read HttpRequest payload. Request is: {0} 7=Receiver property not set on ServletContext. "messageReceiver" property must be set. 8=Http parameter "{0}" not set on request. This property must be set. 9=No servlet connector found using protocol: servlet 10=No servlet connector found using name: "{0}" 11=The request could not be understood by the server due to malformed syntax. 12=The {0} method is not allowed for the resource requested. 13=Failed to connect to server using Uri: {0}. 14=Cannot bind to address "{0}" No component registered on that endpoint 15=Event property {0} not set, Mule can not process request 16=The HttpClientMessageDispatcher does not support the HTTP method {0}. 17=Could not send Expect-100 18=Http Request line is malformed: "{0}" ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/i18n/servlet-messages.propertiesmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/i18n/servlet-messages.prope0000644000175000017500000000033710272410730033055 0ustar charlescharles1=Unable to get endpointUri from HttpServletRequest. Servlet Request Url is: {0} 2=No endpointUri could be found on Uri '{0}'. Format is /endpoint-identifer/endpointUri 3=Failed to read HttpRequest payload. Request is: {0}mule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/config/0000755000175000017500000000000011351410635027203 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/config/registry-bootstrap.propertiesmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/config/registry-bootstrap.p0000644000175000017500000000021310763624216033253 0ustar charlescharlestransformer.1=org.mule.transport.http.servlet.HttpRequestToByteArray transformer.2=org.mule.transport.http.servlet.HttpRequestToInputStream././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/config/http-exception-mappings.propertiesmule-2.0.1/transports/http/src/main/resources/META-INF/services/org/mule/config/http-exception-mappi0000644000175000017500000000073110745677442033227 0ustar charlescharles#Http Error code mappings #This is the property to set the error code to no the message #it is the property name the Transport provider uses set the #set the error code on the underlying message error.code.property=http.status #a comma-separated list of other protocols these mappings can #be applied to apply.to=https #Exception to http status mappings java.lang.Exception=500 org.mule.api.security.SecurityException=403 org.mule.api.security.UnauthorisedException=401 mule-2.0.1/transports/http/src/main/resources/META-INF/mule-https.xsd0000644000175000017500000000525310754365306025223 0ustar charlescharles mule-2.0.1/transports/http/src/main/resources/META-INF/mule-jetty.xsd0000644000175000017500000000414210737201302025176 0ustar charlescharles mule-2.0.1/transports/http/src/main/resources/META-INF/mule-http.xsd0000644000175000017500000002212210744156467025037 0ustar charlescharles HTTP connector. The type of cookie used. Either "netscape" or "rfc2109". The proxy host name or address The password to use for proxy access. The proxy port number. The username to use for proxy access. Whether or not to support cookies. Built-in RestServiceWrapper can used to proxy REST style services as local Mule Components. mule-2.0.1/transports/http/src/test/0000755000175000017500000000000011351410632017240 5ustar charlescharlesmule-2.0.1/transports/http/src/test/java/0000755000175000017500000000000011351410631020160 5ustar charlescharlesmule-2.0.1/transports/http/src/test/java/org/0000755000175000017500000000000011351410631020747 5ustar charlescharlesmule-2.0.1/transports/http/src/test/java/org/mule/0000755000175000017500000000000011351410631021711 5ustar charlescharlesmule-2.0.1/transports/http/src/test/java/org/mule/transport/0000755000175000017500000000000011351410631023745 5ustar charlescharlesmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/0000755000175000017500000000000011351410632024725 5ustar charlescharlesmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/HttpNamespaceHandlerTestCase.java0000644000175000017500000000431711003375564033273 0ustar charlescharles/* * $Id: HttpNamespaceHandlerTestCase.java 11631 2008-04-22 14:51:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.transport.http.transformers.HttpClientMethodResponseToObject; import org.mule.transport.http.transformers.HttpResponseToString; import org.mule.transport.http.transformers.MuleMessageToHttpResponse; import org.mule.transport.http.transformers.ObjectToHttpClientMethodRequest; public class HttpNamespaceHandlerTestCase extends AbstractNamespaceHandlerTestCase { public HttpNamespaceHandlerTestCase() { super("http"); } public void testConnectorProperties() { HttpConnector connector = (HttpConnector) muleContext.getRegistry().lookupConnector("httpConnector"); testBasicProperties(connector); } public void testTransformersOnEndpoints() throws Exception { Object transformer1 = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("ep1").getTransformers().get(0); assertNotNull(transformer1); assertEquals(HttpClientMethodResponseToObject.class, transformer1.getClass()); Object transformer2 = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("ep2").getTransformers().get(0); assertNotNull(transformer2); assertEquals(HttpResponseToString.class, transformer2.getClass()); Object transformer3 = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("ep3").getTransformers().get(0); assertNotNull(transformer3); assertEquals(MuleMessageToHttpResponse.class, transformer3.getClass()); Object transformer4 = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("ep4").getTransformers().get(0); assertNotNull(transformer4); assertEquals(ObjectToHttpClientMethodRequest.class, transformer4.getClass()); } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/JettyNamespaceHandlerTestCase.java0000644000175000017500000000162610745677442033467 0ustar charlescharles/* * $Id: JettyNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.transport.http.jetty.JettyConnector; public class JettyNamespaceHandlerTestCase extends AbstractNamespaceHandlerTestCase { public JettyNamespaceHandlerTestCase() { super("jetty"); } public void testConnectorProperties() { JettyConnector connector = (JettyConnector) muleContext.getRegistry().lookupConnector("jettyConnector"); testBasicProperties(connector); } }mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/transformers/0000755000175000017500000000000011351410632027452 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/transformers/HttpResponseToStringTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/transformers/HttpResponseToStringTe0000644000175000017500000000733210763624216034036 0ustar charlescharles/* * $Id: HttpResponseToStringTestCase.java 11186 2008-03-05 23:11:10Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.transformers; import org.mule.DefaultMuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.http.HttpConstants; import org.mule.transport.http.HttpResponse; import org.mule.transport.http.ResponseWriter; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpVersion; public class HttpResponseToStringTestCase extends AbstractMuleTestCase { private final String _statusLine = "HTTP/1.1 200 OK"; private final String _headerCT = "Content-Type: text/plain"; private final String _headerTE = "Transfer-Encoding: chunked"; private final String _contentLength = "Content-Length: "; private final String _body = "

WOW

"; private String _resultChunked = _statusLine + ResponseWriter.CRLF + _headerCT + ResponseWriter.CRLF + _contentLength + _body.length() + ResponseWriter.CRLF + _headerTE + ResponseWriter.CRLF + ResponseWriter.CRLF; private String _resultNotChunked = _statusLine + ResponseWriter.CRLF + _headerCT + ResponseWriter.CRLF + _contentLength + _body.length() + ResponseWriter.CRLF + ResponseWriter.CRLF; private HttpResponse _resp = null; // @Override protected void doSetUp() throws Exception { super.doSetUp(); _resp = new HttpResponse(); _resp.setStatusLine(new HttpVersion(1, 1), 200); _resp.setHeader(new Header(HttpConstants.HEADER_CONTENT_TYPE, HttpConstants.DEFAULT_CONTENT_TYPE)); _resp.setBody(new DefaultMuleMessage(_body)); } /** * Check consistency of the transformed {@link HttpResponse} string when HTTP * transfer encoding is chunked * * @throws Exception */ public void testTransformChunked() throws Exception { HttpResponseToString trasf = new HttpResponseToString(); trasf.setReturnClass(String.class); _resp.setHeader(new Header(HttpConstants.HEADER_TRANSFER_ENCODING, HttpConstants.TRANSFER_ENCODING_CHUNKED)); _resultChunked += "31\r\n" + _body + "\r\n0\r\n\r\n"; String trasfRes = (String)trasf.doTransform(_resp, "ISO-8859-1"); assertEquals(_resultChunked, trasfRes); } /** * Check consistency of the transformed {@link HttpResponse} string when HTTP * transfer encoding is chunked * * @throws Exception */ public void testTransformNotChunked() throws Exception { HttpResponseToString trasf = new HttpResponseToString(); trasf.setReturnClass(String.class); _resultNotChunked += _body; String trasfRes = (String)trasf.doTransform(_resp, "ISO-8859-1"); assertEquals(_resultNotChunked, trasfRes); } /** * Expect a {@link TransformerException} when the encoding is not supported. */ public void testTransformException() { try { HttpResponseToString trasf = new HttpResponseToString(); trasf.doTransform(_resp, "ISO-8859-20"); fail(); } catch (TransformerException tfe) { // Expected } } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/transformers/ServletNamespaceHandlerTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/transformers/ServletNamespaceHandle0000644000175000017500000000203210745677442033773 0ustar charlescharles/* * $Id: ServletNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.transformers; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.servlet.ServletConnector; public abstract class ServletNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "servlet-namespace-config.xml"; } public void testConnectorProperties() { ServletConnector connector = (ServletConnector) muleContext.getRegistry().lookupConnector("servletConnector"); assertNotNull(connector); assertEquals("", connector.getServletUrl()); } }mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/HttpMessageReceiverTestCase.java0000644000175000017500000000340310757615756033164 0ustar charlescharles/* * $Id: HttpMessageReceiverTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.transport.AbstractMessageReceiverTestCase; import org.mule.transport.http.transformers.MuleMessageToHttpResponse; import org.mule.util.CollectionUtils; import com.mockobjects.dynamic.Mock; public class HttpMessageReceiverTestCase extends AbstractMessageReceiverTestCase { public MessageReceiver getMessageReceiver() throws Exception { Mock mockComponent = new Mock(Service.class); mockComponent.expectAndReturn("getResponseTransformer", null); mockComponent.expectAndReturn("getResponseRouter", null); return new HttpMessageReceiver(endpoint.getConnector(), (Service) mockComponent.proxy(), endpoint); } public InboundEndpoint getEndpoint() throws Exception { EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("http://localhost:6789", muleContext); endpointBuilder.setResponseTransformers(CollectionUtils.singletonList(new MuleMessageToHttpResponse())); endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(endpointBuilder); return endpoint; } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/HttpPlaceholderTestCase.java0000644000175000017500000000173410745677442032337 0ustar charlescharles/* * $Id: HttpPlaceholderTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.transport.http.HttpConnector; public class HttpPlaceholderTestCase extends AbstractNamespaceHandlerTestCase { public HttpPlaceholderTestCase() { super("http"); } protected String getConfigResources() { return "http-placeholder-test.xml"; } public void testConnectorProperties() { HttpConnector connector = (HttpConnector) muleContext.getRegistry().lookupConnector("httpConnector"); testBasicProperties(connector); } }mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/HttpsNamespaceHandlerTestCase.java0000644000175000017500000000350210745677442033465 0ustar charlescharles/* * $Id: HttpsNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.transport.http.HttpsConnector; public class HttpsNamespaceHandlerTestCase extends AbstractNamespaceHandlerTestCase { public HttpsNamespaceHandlerTestCase() { super("https"); } public void testConnectorProperties() { HttpsConnector connector = (HttpsConnector) muleContext.getRegistry().lookupConnector("httpsConnector"); testBasicProperties(connector); //The full path gets resolved, we're just checkng that the property got set assertTrue(connector.getKeyStore().endsWith("/serverKeystore")); assertEquals("mulepassword", connector.getKeyPassword()); assertEquals("mulepassword", connector.getKeyStorePassword()); //The full path gets resolved, we're just checkng that the property got set assertTrue(connector.getClientKeyStore().endsWith("/clientKeystore")); assertEquals("mulepassword", connector.getClientKeyStorePassword()); //The full path gets resolved, we're just checkng that the property got set assertTrue(connector.getTrustStore().endsWith("/trustStore")); assertEquals("mulepassword", connector.getTrustStorePassword()); assertTrue(connector.isExplicitTrustStoreOnly()); assertTrue(connector.isRequireClientAuthentication()); assertEquals("foo", connector.getProtocolHandler()); } }mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/HttpConnectorTestCase.java0000644000175000017500000000442410757615756032051 0ustar charlescharles/* * $Id: HttpConnectorTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.tcp.TcpConnector; import org.apache.commons.httpclient.params.HttpConnectionManagerParams; public class HttpConnectorTestCase extends AbstractConnectorTestCase { // @Override public Connector createConnector() throws Exception { HttpConnector c = new HttpConnector(); c.setName("HttpConnector"); return c; } public String getTestEndpointURI() { return "http://localhost:60127"; } public Object getValidMessage() throws Exception { return "Hello".getBytes(); } public void testValidListener() throws Exception { Service service = getTestService("orange", Orange.class); InboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( getTestEndpointURI()); getConnector().registerListener(service, endpoint); } public void testProperties() throws Exception { HttpConnector c = (HttpConnector) getConnector(); c.setSendBufferSize(1024); assertEquals(1024, c.getSendBufferSize()); c.setSendBufferSize(0); assertEquals(TcpConnector.DEFAULT_BUFFER_SIZE, c.getSendBufferSize()); int maxThreadsActive = c.getDispatcherThreadingProfile().getMaxThreadsActive(); HttpConnectionManagerParams params = c.getClientConnectionManager().getParams(); assertEquals(maxThreadsActive, params.getDefaultMaxConnectionsPerHost()); assertEquals(maxThreadsActive, params.getMaxTotalConnections()); // all kinds of timeouts are now being tested in TcpConnectorTestCase } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/AbstractNamespaceHandlerTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/AbstractNamespaceHandlerTestCase.ja0000644000175000017500000000362410745677442033604 0ustar charlescharles/* * $Id: AbstractNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConnector; public abstract class AbstractNamespaceHandlerTestCase extends FunctionalTestCase { private String prefix; protected AbstractNamespaceHandlerTestCase(String prefix) { this.prefix = prefix; } protected String getConfigResources() { return prefix + "-namespace-config.xml"; } protected void testBasicProperties(HttpConnector connector) { assertNotNull(connector); assertEquals(1234, connector.getClientSoTimeout()); assertEquals("netscape", connector.getCookieSpec()); assertEquals("bcd", connector.getProxyHostname()); assertEquals("cde", connector.getProxyPassword()); assertEquals(2345, connector.getProxyPort()); assertEquals("def", connector.getProxyUsername()); assertEquals(34, connector.getReceiveBacklog()); assertEquals(4567, connector.getReceiveBufferSize()); assertEquals(5678, connector.getSendBufferSize()); assertEquals(6789, connector.getSocketSoLinger()); assertEquals(7890, connector.getServerSoTimeout()); assertEquals(true, connector.isEnableCookies()); assertEquals(true, connector.isKeepAlive()); assertEquals(true, connector.isKeepSendSocketOpen()); assertEquals(true, connector.isSendTcpNoDelay()); assertEquals(false, connector.isValidateConnections()); } }././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/ServletNamespaceHandlerTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/ServletNamespaceHandlerTestCase.jav0000644000175000017500000000174610745677442033656 0ustar charlescharles/* * $Id: ServletNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.servlet.ServletConnector; public class ServletNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "servlet-namespace-config.xml"; } public void testConnectorProperties() { ServletConnector connector = (ServletConnector) muleContext.getRegistry().lookupConnector("servletConnector"); assertEquals("foo", connector.getServletUrl()); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/HttpRequestMessageAdapterTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/HttpRequestMessageAdapterTestCase.j0000644000175000017500000000734310754365306033656 0ustar charlescharles/* * $Id: HttpRequestMessageAdapterTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.MessagingException; import org.mule.api.transport.MessageAdapter; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.transport.http.servlet.HttpRequestMessageAdapter; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.StringReader; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; public class HttpRequestMessageAdapterTestCase extends AbstractMessageAdapterTestCase { public Object getValidMessage() throws Exception { return getMockRequest("test message"); } public MessageAdapter createAdapter(Object payload) throws MessagingException { return new HttpRequestMessageAdapter(payload); } public static HttpServletRequest getMockRequest(final String message) { Object proxy = Proxy.newProxyInstance(ServletConnectorTestCase.class.getClassLoader(), new Class[]{HttpServletRequest.class}, new InvocationHandler() { private String payload = message; private Map props = new HashMap(); public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("getInputStream".equals(method.getName())) { ServletInputStream s = new ServletInputStream() { ByteArrayInputStream is = new ByteArrayInputStream(payload.getBytes()); public int read() throws IOException { return is.read(); } }; return s; } else if ("getAttribute".equals(method.getName())) { return props.get(args[0]); } else if ("setAttribute".equals(method.getName())) { props.put(args[0], args[1]); } else if ("equals".equals(method.getName())) { return Boolean.valueOf(payload.equals(args[0].toString())); } else if ("toString".equals(method.getName())) { return payload; } else if ("getReader".equals(method.getName())) { return new BufferedReader(new StringReader(payload.toString())); } else if ("getAttributeNames".equals(method.getName())) { return new Hashtable().elements(); } else if ("getHeaderNames".equals(method.getName())) { return new Hashtable().elements(); } return null; } }); return (HttpServletRequest)proxy; } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/HttpEndpointTestCase.java0000644000175000017500000000704210745677442031673 0ustar charlescharles/* * $Id: HttpEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class HttpEndpointTestCase extends AbstractMuleTestCase { public void testHostPortOnlyUrl() throws Exception { EndpointURI endpointUri = new MuleEndpointURI("http://localhost:8080"); endpointUri.initialise(); assertEquals("http", endpointUri.getScheme()); assertEquals("http://localhost:8080", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(8080, endpointUri.getPort()); assertEquals("localhost", endpointUri.getHost()); assertEquals("http://localhost:8080", endpointUri.getAddress()); assertEquals(0, endpointUri.getParams().size()); } public void testHostPortOnlyUrlAndUserInfo() throws Exception { EndpointURI endpointUri = new MuleEndpointURI("http://admin:pwd@localhost:8080"); endpointUri.initialise(); assertEquals("http", endpointUri.getScheme()); assertEquals("http://localhost:8080", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(8080, endpointUri.getPort()); assertEquals("localhost", endpointUri.getHost()); assertEquals("http://localhost:8080", endpointUri.getAddress()); assertEquals(0, endpointUri.getParams().size()); assertEquals("admin:pwd", endpointUri.getUserInfo()); assertEquals("admin", endpointUri.getUser()); assertEquals("pwd", endpointUri.getPassword()); } public void testHostPortAndPathUrl() throws Exception { EndpointURI endpointUri = new MuleEndpointURI("http://localhost:8080/app/path"); endpointUri.initialise(); assertEquals("http", endpointUri.getScheme()); assertEquals("http://localhost:8080/app/path", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(8080, endpointUri.getPort()); assertEquals("localhost", endpointUri.getHost()); assertEquals("http://localhost:8080/app/path", endpointUri.getAddress()); assertEquals(endpointUri.getPath(), "/app/path"); assertEquals(0, endpointUri.getParams().size()); } public void testHostPortAndPathUrlAndUserInfo() throws Exception { EndpointURI endpointUri = new MuleEndpointURI("http://admin:pwd@localhost:8080/app/path"); endpointUri.initialise(); assertEquals("http", endpointUri.getScheme()); assertEquals("http://localhost:8080/app/path", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(8080, endpointUri.getPort()); assertEquals("localhost", endpointUri.getHost()); assertEquals("http://localhost:8080/app/path", endpointUri.getAddress()); assertEquals(endpointUri.getPath(), "/app/path"); assertEquals(0, endpointUri.getParams().size()); assertEquals("admin:pwd", endpointUri.getUserInfo()); assertEquals("admin", endpointUri.getUser()); assertEquals("pwd", endpointUri.getPassword()); } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/HttpsConnectorTestCase.java0000644000175000017500000000531310766204322032211 0ustar charlescharles/* * $Id: HttpsConnectorTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.MuleContext; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.tcp.TcpConnector; import java.io.IOException; public class HttpsConnectorTestCase extends AbstractConnectorTestCase { // @Override public Connector createConnector() throws Exception { return createConnector(muleContext, false); } public static HttpsConnector createConnector(MuleContext context, boolean initialised) throws IOException, InitialisationException { HttpsConnector cnn = new HttpsConnector(); cnn.setMuleContext(context); cnn.setName("HttpsConnector"); cnn.setKeyStore("serverKeystore"); cnn.setClientKeyStore("clientKeystore"); cnn.setClientKeyStorePassword("mulepassword"); cnn.setKeyPassword("mulepassword"); cnn.setKeyStorePassword("mulepassword"); cnn.setTrustStore("trustStore"); cnn.setTrustStorePassword("mulepassword"); cnn.getDispatcherThreadingProfile().setDoThreading(false); if (initialised) { cnn.initialise(); } return cnn; } public String getTestEndpointURI() { return "https://localhost:60127"; } public Object getValidMessage() throws Exception { return "Hello".getBytes(); } public void testValidListener() throws Exception { Service service = getTestService("orange", Orange.class); InboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( getTestEndpointURI()); getConnector().registerListener(service, endpoint); } public void testProperties() throws Exception { HttpsConnector c = (HttpsConnector)getConnector(); c.setSendBufferSize(1024); assertEquals(1024, c.getSendBufferSize()); c.setSendBufferSize(0); assertEquals(TcpConnector.DEFAULT_BUFFER_SIZE, c.getSendBufferSize()); // all kinds of timeouts are tested in TcpConnectorTestCase now } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/JettyEndpointTestCase.java0000644000175000017500000001136610745677442032057 0ustar charlescharles/* * $Id: JettyEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class JettyEndpointTestCase extends AbstractMuleTestCase { public void testHostPortOnlyUrl() throws Exception { EndpointURI endpointUri = new MuleEndpointURI("jetty:http://localhost:8080"); endpointUri.initialise(); assertEquals("http", endpointUri.getScheme()); assertEquals("http://localhost:8080", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(8080, endpointUri.getPort()); assertEquals("localhost", endpointUri.getHost()); assertEquals("http://localhost:8080", endpointUri.toString()); assertEquals(0, endpointUri.getParams().size()); assertEquals("jetty", endpointUri.getSchemeMetaInfo()); } public void testHostPortOnlyUrlAndUserInfo() throws Exception { EndpointURI endpointUri = new MuleEndpointURI("jetty:http://admin:pwd@localhost:8080"); endpointUri.initialise(); assertEquals("http", endpointUri.getScheme()); assertEquals("http://localhost:8080", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(8080, endpointUri.getPort()); assertEquals("localhost", endpointUri.getHost()); assertEquals("http://localhost:8080", endpointUri.getAddress()); assertEquals(0, endpointUri.getParams().size()); assertEquals("admin:pwd", endpointUri.getUserInfo()); assertEquals("admin", endpointUri.getUser()); assertEquals("pwd", endpointUri.getPassword()); assertEquals("jetty", endpointUri.getSchemeMetaInfo()); } public void testHostPortAndPathUrl() throws Exception { EndpointURI endpointUri = new MuleEndpointURI("jetty:http://localhost:8080/app/path"); endpointUri.initialise(); assertEquals("http", endpointUri.getScheme()); assertEquals("http://localhost:8080/app/path", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(8080, endpointUri.getPort()); assertEquals("localhost", endpointUri.getHost()); assertEquals("http://localhost:8080/app/path", endpointUri.getAddress()); assertEquals(endpointUri.getPath(), "/app/path"); assertEquals(0, endpointUri.getParams().size()); assertEquals("jetty", endpointUri.getSchemeMetaInfo()); } public void testHostPortAndPathUrlAndUserInfo() throws Exception { EndpointURI endpointUri = new MuleEndpointURI("jetty:http://admin:pwd@localhost:8080/app/path"); endpointUri.initialise(); assertEquals("http", endpointUri.getScheme()); assertEquals("http://localhost:8080/app/path", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(8080, endpointUri.getPort()); assertEquals("localhost", endpointUri.getHost()); assertEquals("http://localhost:8080/app/path", endpointUri.getAddress()); assertEquals(endpointUri.getPath(), "/app/path"); assertEquals(0, endpointUri.getParams().size()); assertEquals("admin:pwd", endpointUri.getUserInfo()); assertEquals("admin", endpointUri.getUser()); assertEquals("pwd", endpointUri.getPassword()); assertEquals("jetty", endpointUri.getSchemeMetaInfo()); } public void testRestHostPortAndPathUrlAndUserInfo() throws Exception { EndpointURI endpointUri = new MuleEndpointURI("jetty:rest://admin:pwd@localhost:8080/app/path"); endpointUri.initialise(); assertEquals("rest", endpointUri.getScheme()); assertEquals("rest://localhost:8080/app/path", endpointUri.getAddress()); assertNull(endpointUri.getEndpointName()); assertEquals(8080, endpointUri.getPort()); assertEquals("localhost", endpointUri.getHost()); assertEquals("rest://localhost:8080/app/path", endpointUri.getAddress()); assertEquals(endpointUri.getPath(), "/app/path"); assertEquals(0, endpointUri.getParams().size()); assertEquals("admin:pwd", endpointUri.getUserInfo()); assertEquals("admin", endpointUri.getUser()); assertEquals("pwd", endpointUri.getPassword()); assertEquals("jetty", endpointUri.getSchemeMetaInfo()); } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/filters/0000755000175000017500000000000011351410632026375 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/filters/HttpRequestWildcardFilterTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/filters/HttpRequestWildcardFilterTe0000644000175000017500000000467310763522057033746 0ustar charlescharles/* * $Id: HttpRequestWildcardFilterTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.filters; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import java.util.HashMap; import java.util.Map; public class HttpRequestWildcardFilterTestCase extends FunctionalTestCase { protected String getConfigResources() { return "http-wildcard-filter-test.xml"; } private static final String HTTP_ENDPOINT = "http://localhost:60201"; private static final String REF_ENDPOINT = "http://localhost:60199"; private static final String TEST_MESSAGE = "Hello=World"; private static final String TEST_BAD_MESSAGE = "xyz"; public void testReference() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send(REF_ENDPOINT, TEST_MESSAGE, null); assertEquals(TEST_MESSAGE, result.getPayloadAsString()); } public void testHttpPost() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send(HTTP_ENDPOINT, TEST_MESSAGE, null); assertEquals(TEST_MESSAGE, result.getPayloadAsString()); } public void testHttpGetNotFilter() throws Exception { Map props = new HashMap(); props.put(HttpConstants.METHOD_GET, "true"); MuleClient client = new MuleClient(); MuleMessage result = client.send(HTTP_ENDPOINT, TEST_MESSAGE, props); assertEquals(TEST_MESSAGE, result.getPayloadAsString()); } public void testHttpGetFilter() throws Exception { Map props = new HashMap(); props.put(HttpConstants.METHOD_GET, "true"); MuleClient client = new MuleClient(); MuleMessage result = client.send(HTTP_ENDPOINT, TEST_BAD_MESSAGE, props); assertEquals(HttpConstants.SC_NOT_ACCEPTABLE, result.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0)); assertNotNull(result.getExceptionPayload()); } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/StatusCodeMappingsTestCase.java0000644000175000017500000000356610745677442033037 0ustar charlescharles/* * $Id: StatusCodeMappingsTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.DefaultMuleException; import org.mule.api.routing.RoutingException; import org.mule.api.security.UnauthorisedException; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.MessageFactory; import org.mule.tck.AbstractMuleTestCase; public class StatusCodeMappingsTestCase extends AbstractMuleTestCase { public void testErrorMappings() { String code = ExceptionHelper.getErrorMapping("http", RoutingException.class); assertEquals("500", code); code = ExceptionHelper.getErrorMapping("HTTP", org.mule.api.security.SecurityException.class); assertEquals("403", code); code = ExceptionHelper.getErrorMapping("http", UnauthorisedException.class); assertEquals("401", code); code = ExceptionHelper.getErrorMapping("blah", DefaultMuleException.class); assertEquals( String.valueOf(new DefaultMuleException(MessageFactory.createStaticMessage("test")).getExceptionCode()), code); } public void testHttpsErrorMappings() { String code = ExceptionHelper.getErrorMapping("httpS", RoutingException.class); assertEquals("500", code); code = ExceptionHelper.getErrorMapping("HTTPS", org.mule.api.security.SecurityException.class); assertEquals("403", code); code = ExceptionHelper.getErrorMapping("https", UnauthorisedException.class); assertEquals("401", code); } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/0000755000175000017500000000000011351410632026240 5ustar charlescharles././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/NoTransformPassThroughComponent.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/NoTransformPassThroughCompon0000644000175000017500000000135310745677442034025 0ustar charlescharles/* * $Id: NoTransformPassThroughComponent.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.issues; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; public class NoTransformPassThroughComponent implements Callable { public Object onCall(MuleEventContext context) throws Exception { return context.getMessage(); } }././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/TypedPlaceholderMule1887TestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/TypedPlaceholderMule1887Test0000644000175000017500000000211210745677442033446 0ustar charlescharles/* * $Id: TypedPlaceholderMule1887TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.issues; import org.mule.transport.http.AbstractNamespaceHandlerTestCase; import org.mule.transport.http.HttpConnector; public class TypedPlaceholderMule1887TestCase extends AbstractNamespaceHandlerTestCase { public TypedPlaceholderMule1887TestCase() { super("http"); } protected String getConfigResources() { return "typed-placeholder-mule-1887-test.xml"; } public void testConnectorProperties() { HttpConnector connector = (HttpConnector) muleContext.getRegistry().lookupConnector("httpConnector"); testBasicProperties(connector); } }././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/RestEndpointMule1881TestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/RestEndpointMule1881TestCase0000644000175000017500000000251210745677442033426 0ustar charlescharles/* * $Id: RestEndpointMule1881TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.issues; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.http.jetty.JettyConnector; public class RestEndpointMule1881TestCase extends AbstractMuleTestCase { public void testJettyRestEndpointCreation() throws Exception { ImmutableEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "jetty:rest://localhost:8080/loanbroker"); assertNotNull(ep); assertTrue(ep.getConnector() instanceof JettyConnector); } public void testJettyHttpEndpointCreation() throws Exception { ImmutableEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "jetty:rest://localhost:8080/loanbroker"); assertNotNull(ep); assertTrue(ep.getConnector() instanceof JettyConnector); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/StreamingSpeedMule1389TestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/StreamingSpeedMule1389TestCa0000644000175000017500000000153710745677442033403 0ustar charlescharles/* * $Id: StreamingSpeedMule1389TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.issues; import org.mule.transport.tcp.integration.AbstractStreamingCapacityTestCase; public class StreamingSpeedMule1389TestCase extends AbstractStreamingCapacityTestCase { public StreamingSpeedMule1389TestCase() { super(100 * ONE_MB, "tcp://localhost:60210"); } protected String getConfigResources() { return "streaming-speed-mule-1389.xml"; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/StreamingDownloadMule1389TestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/StreamingDownloadMule1389Tes0000644000175000017500000000166610745677442033465 0ustar charlescharles/* * $Id: StreamingDownloadMule1389TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.issues; import org.mule.transport.tcp.issues.AbstractStreamingDownloadMule1389TestCase; /** * This fails to work as described in the issue. We need more info. */ public class StreamingDownloadMule1389TestCase extends AbstractStreamingDownloadMule1389TestCase { public StreamingDownloadMule1389TestCase() { super("http://localhost:60208"); } protected String getConfigResources() { return "streaming-download-mule-1389.xml"; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/HttpTransformersMule1822TestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/HttpTransformersMule1822Test0000644000175000017500000000533310754375733033536 0ustar charlescharles/* * $Id: HttpTransformersMule1822TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.issues; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.tck.functional.StringAppendTestTransformer; public class HttpTransformersMule1822TestCase extends FunctionalTestCase { public static final String OUTBOUND_MESSAGE = "Test message"; protected String getConfigResources() { return "http-transformers-mule-1822-test.xml"; } private MuleMessage sendTo(String uri) throws MuleException { MuleClient client = new MuleClient(); MuleMessage message = client.send(uri, OUTBOUND_MESSAGE, null); assertNotNull(message); return message; } /** * With no transformer we expect just the modification from the FTC * * @throws Exception */ public void testBase() throws Exception { assertEquals( FunctionalTestComponent.received(OUTBOUND_MESSAGE), sendTo("base").getPayloadAsString()); } /** * But response transformers on the base model should be applied * * @throws Exception */ public void testResponse() throws Exception { assertEquals( StringAppendTestTransformer.append(" response", StringAppendTestTransformer.append(" response 2", FunctionalTestComponent.received( OUTBOUND_MESSAGE))), sendTo("response").getPayloadAsString()); } /** * Shouldalso work with inbound transformers * * @throws Exception */ public void testBoth() throws Exception { assertEquals( StringAppendTestTransformer.append(" response", StringAppendTestTransformer.append(" response 2", FunctionalTestComponent.received( StringAppendTestTransformer.append(" transformed 2", StringAppendTestTransformer.appendDefault( OUTBOUND_MESSAGE))))), sendTo("both").getPayloadAsString()); } }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/NoTransformFunctionalTestComponent.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/NoTransformFunctionalTestCom0000644000175000017500000002370410746275214033777 0ustar charlescharles/* * $Id: NoTransformFunctionalTestComponent.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.issues; import org.mule.RequestContext; import org.mule.api.DefaultMuleException; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; import org.mule.config.i18n.MessageFactory; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalTestNotification; import org.mule.util.StringMessageUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * FunctionalTestComponent is a service that can be used by * functional tests. This service accepts an EventCallback that can be used to * assert the state of the current event. *

* Also, this service fires {@link org.mule.tck.functional.FunctionalTestNotification} via Mule for every message received. * Tests can register with Mule to receive these events by implementing * {@link org.mule.tck.functional.FunctionalTestNotificationListener}. * * @see org.mule.tck.functional.EventCallback * @see org.mule.tck.functional.FunctionalTestNotification * @see org.mule.tck.functional.FunctionalTestNotificationListener */ public class NoTransformFunctionalTestComponent implements Callable { protected transient Log logger = LogFactory.getLog(getClass()); public static final int STREAM_SAMPLE_SIZE = 4; public static final int STREAM_BUFFER_SIZE = 4096; private EventCallback eventCallback; private Object returnMessage = null; private boolean appendComponentName = false; private boolean throwException = false; /** * {@inheritDoc} */ public Object onCall(MuleEventContext context) throws Exception { String contents = context.getMessageAsString(); String msg = StringMessageUtils.getBoilerPlate("Message Received in service: " + context.getService().getName() + ". Content is: " + StringMessageUtils.truncate(contents, 100, true), '*', 80); logger.info(msg); if (eventCallback != null) { eventCallback.eventReceived(context, this); } Object replyMessage; if (returnMessage != null) { replyMessage = returnMessage; } else { replyMessage = received(contents) + (appendComponentName ? " " + context.getService().getName() : ""); } context.getMuleContext().fireNotification( new FunctionalTestNotification(context, replyMessage, FunctionalTestNotification.EVENT_RECEIVED)); if (throwException) { throw new DefaultMuleException(MessageFactory.createStaticMessage("Functional Test Service Exception")); } return replyMessage; } /** * Append " Received" to contents. Exposed as static method so tests can call to * construct string for comparison. * * @param contents * @return Extended message */ public static String received(String contents) { return contents + " Received"; } /** * @param data the event data received * @return the processed message * @throws Exception * * @deprecated Not sure why we have this duplicate method here. Need to investigate... */ public Object onReceive(Object data) throws Exception { MuleEventContext context = RequestContext.getEventContext(); String contents = data.toString(); String msg = StringMessageUtils.getBoilerPlate("Message Received in service: " + context.getService().getName() + ". Content is: " + StringMessageUtils.truncate(contents, 100, true), '*', 80); logger.info(msg); if (eventCallback != null) { eventCallback.eventReceived(context, this); } Object replyMessage; if (returnMessage != null) { replyMessage = returnMessage; } else { replyMessage = contents + " Received"; } context.getMuleContext().fireNotification( new FunctionalTestNotification(context, replyMessage, FunctionalTestNotification.EVENT_RECEIVED)); if (throwException) { if(returnMessage!=null && returnMessage instanceof Exception) { throw (Exception)returnMessage; } else { throw new DefaultMuleException(MessageFactory.createStaticMessage("Functional Test Service Exception")); } } return replyMessage; } /** * An event callback is called when a message is received by the service. * An MuleEvent callback isn't strictly required but it is usfal for performing assertions * on the current message being received. * Note that the FunctionalTestComponent should be made a singleton * {@link org.mule.api.UMODescriptor#setSingleton} when using MuleEvent callbacks *

* Another option is to register a {@link org.mule.tck.functional.FunctionalTestNotificationListener} with Mule and this * will deleiver a {@link org.mule.tck.functional.FunctionalTestNotification} for every message received by this service * * @return the callback to call when a message is received * @see org.mule.api.UMODescriptor * @see org.mule.tck.functional.FunctionalTestNotification * @see org.mule.tck.functional.FunctionalTestNotificationListener */ public EventCallback getEventCallback() { return eventCallback; } /** * An event callback is called when a message is received by the service. * An MuleEvent callback isn't strictly required but it is usfal for performing assertions * on the current message being received. * Note that the FunctionalTestComponent should be made a singleton * {@link org.mule.api.UMODescriptor#setSingleton} when using MuleEvent callbacks *

* Another option is to register a {@link org.mule.tck.functional.FunctionalTestNotificationListener} with Mule and this * will deleiver a {@link org.mule.tck.functional.FunctionalTestNotification} for every message received by this service * * @param eventCallback the callback to call when a message is received * @see org.mule.api.UMODescriptor * @see org.mule.tck.functional.FunctionalTestNotification * @see org.mule.tck.functional.FunctionalTestNotificationListener */ public void setEventCallback(EventCallback eventCallback) { this.eventCallback = eventCallback; } /** * Often you will may want to return a fixed message payload to simulate and external system call. * This can be done using the 'returnMessage' property. Note that you can return complex objects by * using the element in the Xml configuration. * * @return the message payload to always return from this service instance */ public Object getReturnMessage() { return returnMessage; } /** * Often you will may want to return a fixed message payload to simulate and external system call. * This can be done using the 'returnMessage' property. Note that you can return complex objects by * using the element in the Xml configuration. * * @param returnMessage the message payload to always return from this service instance */ public void setReturnMessage(Object returnMessage) { this.returnMessage = returnMessage; } /** * Sometimes you will want the service to always throw an exception, if this is the case you can * set the 'throwException' property to true. * * @return throwException true if an exception should always be thrown from this instance. * If the {@link #returnMessage} property is set and is of type * java.lang.Exception, that exception will be thrown. */ public boolean isThrowException() { return throwException; } /** * Sometimes you will want the service to always throw an exception, if this is the case you can * set the 'throwException' property to true. * * @param throwException true if an exception should always be thrown from this instance. * If the {@link #returnMessage} property is set and is of type * java.lang.Exception, that exception will be thrown. */ public void setThrowException(boolean throwException) { this.throwException = throwException; } /** * This will cause the service to append the compoent name to the end of the message * returned from this service. This only works when processing String messages. * This feature is useful when processing multiple messages using a pool of FunctionalTestComponents * to determine who processed the resulting message * * @return true if the service name will be appended to the return message */ public boolean isAppendComponentName() { return appendComponentName; } /** * This will cause the service to append the compoent name to the end of the message * returned from this service. This only works when processing String messages. * This feature is useful when processing multiple messages using a pool of FunctionalTestComponents * to determine who processed the resulting message * * @param appendComponentName true if the service name will be appended to the return message */ public void setAppendComponentName(boolean appendComponentName) { this.appendComponentName = appendComponentName; } }././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/HttpTransformersMule1815TestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/issues/HttpTransformersMule1815Test0000644000175000017500000000533710754375733033544 0ustar charlescharles/* * $Id: HttpTransformersMule1815TestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.issues; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.tck.functional.StringAppendTestTransformer; public class HttpTransformersMule1815TestCase extends FunctionalTestCase { public static final String OUTBOUND_MESSAGE = "Test message"; protected String getConfigResources() { return "http-transformers-mule-1815-test.xml"; } private MuleMessage sendTo(String uri) throws MuleException { MuleClient client = new MuleClient(); MuleMessage message = client.send(uri, OUTBOUND_MESSAGE, null); assertNotNull(message); return message; } /** * With no transformer we expect just the modification from the FTC * * @throws Exception */ public void testBase() throws Exception { assertEquals( FunctionalTestComponent.received(OUTBOUND_MESSAGE), sendTo("base").getPayloadAsString()); } /** * Adapted model, which should not apply transformers * * @throws Exception */ public void testAdapted() throws Exception { assertEquals( FunctionalTestComponent.received(OUTBOUND_MESSAGE), sendTo("adapted").getPayloadAsString()); } /** * Transformers on the adapted model should be ignored * * @throws Exception */ public void testIgnored() throws Exception { assertEquals( FunctionalTestComponent.received(OUTBOUND_MESSAGE), sendTo("ignored").getPayloadAsString()); } /** * But transformers on the base model should be applied * * @throws Exception */ public void testInbound() throws Exception { assertEquals( // this reads backwards - innermost is first in chain FunctionalTestComponent.received( StringAppendTestTransformer.append(" transformed 2", StringAppendTestTransformer.appendDefault( OUTBOUND_MESSAGE))), sendTo("inbound").getPayloadAsString()); } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/0000755000175000017500000000000011351410632027067 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpsFunctionalTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpsFunctionalTestCase.0000644000175000017500000000456610766654216033705 0ustar charlescharles/* * $Id: HttpsFunctionalTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.functional.EventCallback; import org.mule.tck.functional.FunctionalTestComponent; import org.mule.tck.testmodels.mule.TestSedaService; import org.mule.transport.http.HttpConstants; import org.mule.transport.http.HttpsConnector; import java.util.HashMap; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; public class HttpsFunctionalTestCase extends HttpFunctionalTestCase { protected String getConfigResources() { return "https-functional-test.xml"; } public void testSend() throws Exception { final TestSedaService testSedaService = (TestSedaService) muleContext.getRegistry().lookupService("testComponent"); FunctionalTestComponent testComponent = (FunctionalTestComponent) getComponent(testSedaService); assertNotNull(testComponent); final AtomicBoolean callbackMade = new AtomicBoolean(false); EventCallback callback = new EventCallback() { public void eventReceived(final MuleEventContext context, final Object component) throws Exception { MuleMessage msg = context.getMessage(); assertTrue(callbackMade.compareAndSet(false, true)); assertNotNull(msg.getProperty(HttpsConnector.LOCAL_CERTIFICATES)); } }; testComponent.setEventCallback(callback); MuleClient client = new MuleClient(); Map props = new HashMap(); props.put(HttpConstants.HEADER_CONTENT_TYPE, "text/plain;charset=UTF-8"); MuleMessage result = client.send("clientEndpoint", TEST_MESSAGE, props); assertNotNull(result); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); assertTrue("Callback never fired", callbackMade.get()); } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpCookieTestCase.java0000644000175000017500000000740610757607770033472 0ustar charlescharles/* * $Id: HttpCookieTestCase.java 10953 2008-02-22 18:10:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class HttpCookieTestCase extends FunctionalTestCase { private static final int LISTEN_PORT = 60212; private static final String COOKIE_HEADER = "Cookie:"; private CountDownLatch simpleServerLatch = new CountDownLatch(1); private CountDownLatch latch = new CountDownLatch(1); private boolean cookieFound = false; protected String getConfigResources() { return "http-cookie-test.xml"; } protected void doSetUp() throws Exception { super.doSetUp(); // start a simple HTTP server that parses the request sent from Mule new Thread(new SimpleHttpServer()).start(); } public void testCookies() throws Exception { // wait for the simple server thread started in doSetUp to come up assertTrue(simpleServerLatch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS)); MuleClient client = new MuleClient(); client.send("vm://vm-in", "foobar", null); assertTrue(latch.await(RECEIVE_TIMEOUT, TimeUnit.MILLISECONDS)); assertTrue(cookieFound); } private class SimpleHttpServer extends Object implements Runnable { public void run() { try { ServerSocket serverSocket = new ServerSocket(LISTEN_PORT); // now that we are up and running, the test may send simpleServerLatch.countDown(); Socket socket = serverSocket.accept(); InputStream in = socket.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line = reader.readLine(); while (line != null) { // Check that we receive a 'Cookie:' header as it would be // send by a regular http client if (line.indexOf(COOKIE_HEADER) > -1) { cookieFound = true; break; } line = reader.readLine(); // only read the header, i.e. if we encounter an empty line // stop reading (we're only interested in the headers anyway) if (line.trim().length() == 0) { line = null; } } OutputStream out = socket.getOutputStream(); out.write("HTTP/1.1 200 OK\n\n".getBytes()); in.close(); out.close(); socket.close(); serverSocket.close(); } catch (Exception ex) { throw new RuntimeException(ex); } finally { latch.countDown(); } } } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/JettyRestFunctionalTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/JettyRestFunctionalTestC0000644000175000017500000000124510745677442033763 0ustar charlescharles/* * $Id: JettyRestFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; public class JettyRestFunctionalTestCase extends HttpFunctionalTestCase { //@Override protected String getConfigResources() { return "jetty-rest-functional-test.xml"; } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpMethodTestCase.java0000644000175000017500000000717410763522057033472 0ustar charlescharles/* * $Id: HttpMethodTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.tck.FunctionalTestCase; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpMethodBase; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.DeleteMethod; import org.apache.commons.httpclient.methods.HeadMethod; import org.apache.commons.httpclient.methods.OptionsMethod; import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.TraceMethod; public class HttpMethodTestCase extends FunctionalTestCase { private HttpMethodBase method; protected String getConfigResources() { return "http-method-test.xml"; } protected void doFunctionalTearDown () throws Exception { if (method != null) { method.releaseConnection(); } } public void testHead() throws Exception { HttpClient client = new HttpClient(); method = new HeadMethod("http://localhost:60200"); int statusCode = client.executeMethod(method); assertEquals(Integer.toString(HttpStatus.SC_OK), Integer.toString(statusCode)); } public void testOptions() throws Exception { HttpClient client = new HttpClient(); method = new OptionsMethod("http://localhost:60200"); int statusCode = client.executeMethod(method); assertEquals(Integer.toString(HttpStatus.SC_OK), Integer.toString(statusCode)); } public void testPut() throws Exception { HttpClient client = new HttpClient(); method = new PutMethod("http://localhost:60200"); int statusCode = client.executeMethod(method); assertEquals(Integer.toString(HttpStatus.SC_OK), Integer.toString(statusCode)); } public void testDelete() throws Exception { HttpClient client = new HttpClient(); method = new DeleteMethod("http://localhost:60200"); int statusCode = client.executeMethod(method); assertEquals(Integer.toString(HttpStatus.SC_OK), Integer.toString(statusCode)); } public void testTrace() throws Exception { HttpClient client = new HttpClient(); method = new TraceMethod("http://localhost:60200"); int statusCode = client.executeMethod(method); assertEquals(Integer.toString(HttpStatus.SC_OK), Integer.toString(statusCode)); } public void testConnect() throws Exception { HttpClient client = new HttpClient(); method = new HttpMethodBase("http://localhost:60200") { public String getName() { return "CONNECT"; } }; int statusCode = client.executeMethod(method); assertEquals(Integer.toString(HttpStatus.SC_OK), Integer.toString(statusCode)); } public void testFoo() throws Exception { HttpClient client = new HttpClient(); method = new HttpMethodBase("http://localhost:60200") { public String getName() { return "FOO"; } }; int statusCode = client.executeMethod(method); assertEquals(Integer.toString(HttpStatus.SC_BAD_REQUEST), Integer.toString(statusCode)); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpServiceOverridesTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpServiceOverridesTest0000644000175000017500000000233610757033446034016 0ustar charlescharles/* * $Id: HttpServiceOverridesTestCase.java 10904 2008-02-20 14:20:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.api.transport.Connector; import org.mule.api.transport.SessionHandler; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConnector; public class HttpServiceOverridesTestCase extends FunctionalTestCase { protected String getConfigResources() { return "http-service-overrides.xml"; } public void testSessionHandler() { Connector connector = muleContext.getRegistry().lookupConnector("httpConnector"); assertTrue(connector instanceof HttpConnector); HttpConnector httpConnector = (HttpConnector) connector; SessionHandler sessionHandler = httpConnector.getSessionHandler(); assertTrue(sessionHandler instanceof TestSessionHandler); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpContentLengthPropagationTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpContentLengthPropaga0000644000175000017500000000345310764101307033750 0ustar charlescharles/* * $Id: HttpContentLengthPropagationTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.module.xml.transformer.XsltTransformer; import org.mule.tck.FunctionalTestCase; import org.mule.util.IOUtils; import java.io.InputStream; public class HttpContentLengthPropagationTestCase extends FunctionalTestCase { private static final String NAME_PAYLOAD = "test-xml-payload.xml"; private static final String NAME_STYLESHEET = "stylesheet.xsl"; protected String getConfigResources() { return "http-content-length-propagation-conf.xml"; } public void testContentLengthPropagation() throws Exception { InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(NAME_PAYLOAD); assertNotNull("Payload test file not found.", is); byte[] fileContents = IOUtils.toByteArray(is); MuleClient client = new MuleClient(); MuleMessage result = client.send("http://localhost:8085", new DefaultMuleMessage(fileContents)); XsltTransformer trans = new XsltTransformer(); trans.setXslFile(NAME_STYLESHEET); final byte[] locallyTransformedBytes = (byte[]) trans.doTransform(fileContents, "UTF-8"); assertEquals(new String(locallyTransformedBytes), result.getPayloadAsString()); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/PollingEtagTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/PollingEtagTestCase.java0000755000175000017500000000257410761053756033624 0ustar charlescharles/* * $Id: PollingEtagTestCase.java 11039 2008-02-26 18:18:22Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.CounterCallback; import org.mule.tck.functional.FunctionalTestComponent; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; public class PollingEtagTestCase extends FunctionalTestCase { private static final int WAIT_TIME = 2500; protected String getConfigResources() { return "polling-etag-test.xml"; } public void testPollingReceiversRestart() throws Exception { Object ftc = getComponent("Test"); assertTrue("FunctionalTestComponent expected", ftc instanceof FunctionalTestComponent); AtomicInteger pollCounter = new AtomicInteger(0); ((FunctionalTestComponent) ftc).setEventCallback(new CounterCallback(pollCounter)); // should be enough to poll for multiple messages Thread.sleep(WAIT_TIME); assertEquals(1, pollCounter.get()); } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/TestSessionHandler.java0000644000175000017500000000144710757033446033536 0ustar charlescharles/* * $Id: TestSessionHandler.java 10904 2008-02-20 14:20:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.transport.http.HttpSessionHandler; /** * This is a custom subclass of the regular HttpSessionHandler that's used in * HttpServiceOverridesTestCase to see if the service override properly instantiates * the right class. */ public class TestSessionHandler extends HttpSessionHandler { // no custom methods } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpEncodingFunctionalTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpEncodingFunctionalTe0000644000175000017500000000334410754375733033742 0ustar charlescharles/* * $Id: HttpEncodingFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import java.util.HashMap; import java.util.Map; public class HttpEncodingFunctionalTestCase extends HttpFunctionalTestCase { protected static String TEST_MESSAGE = "Test Http Request (Rdgrd), 57 = \u06f7\u06f5 in Arabic"; protected String getConfigResources() { return "http-encoding-test.xml"; } public void testSend() throws Exception { MuleClient client = new MuleClient(); Map messageProperties = new HashMap(); messageProperties.put(HttpConstants.HEADER_CONTENT_TYPE, getSendEncoding()); MuleMessage reply = client.send("clientEndpoint", TEST_MESSAGE, messageProperties); assertNotNull(reply); assertEquals("200", reply.getProperty(HttpConnector.HTTP_STATUS_PROPERTY)); assertEquals(TEST_MESSAGE + " Received", reply.getPayloadAsString()); assertEquals("text/baz;charset=UTF-16BE", reply.getProperty(HttpConstants.HEADER_CONTENT_TYPE).toString()); assertEquals("UTF-16BE", reply.getEncoding()); } protected String getSendEncoding() { return "text/plain;charset=UTF-8"; } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpStemTestCase.java0000755000175000017500000000302510754375733033163 0ustar charlescharles/* * $Id: HttpStemTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConnector; public class HttpStemTestCase extends FunctionalTestCase { protected String getConfigResources() { return "http-stem-test.xml"; } public void testStemMatchingHttp() throws Exception { MuleClient client = new MuleClient(); doTest(client, "http://localhost:60200/foo"); doTest(client, "http://localhost:60200/foo/bar"); } public void testStemMatchingJetty() throws Exception { MuleClient client = new MuleClient(); doTest(client, "http://localhost:60201/foo"); doTest(client, "http://localhost:60201/foo/bar"); } protected void doTest(MuleClient client, String url) throws Exception { MuleMessage result = client.send(url, "Hello World", null); assertEquals("Hello World", result.getPayloadAsString()); assertEquals(200, result.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0)); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/PollingReceiversRestartTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/PollingReceiversRestartT0000644000175000017500000000360610761053756034002 0ustar charlescharles/* * $Id: PollingReceiversRestartTestCase.java 11039 2008-02-26 18:18:22Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.CounterCallback; import org.mule.tck.functional.FunctionalTestComponent; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; public class PollingReceiversRestartTestCase extends FunctionalTestCase { private static final int WAIT_TIME = 2500; public PollingReceiversRestartTestCase() { setStartContext(false); } protected String getConfigResources() { return "polling-receivers-restart-test.xml"; } public void testPollingReceiversRestart() throws Exception { muleContext.start(); Object ftc = getComponent("Test"); assertTrue("FunctionalTestComponent expected", ftc instanceof FunctionalTestComponent); AtomicInteger pollCounter = new AtomicInteger(0); ((FunctionalTestComponent) ftc).setEventCallback(new CounterCallback(pollCounter)); // should be enough to poll for 2 messages Thread.sleep(WAIT_TIME); // stop muleContext.stop(); assertTrue("No polls performed", pollCounter.get() > 0); // and restart muleContext.start(); pollCounter.set(0); ((FunctionalTestComponent) ftc).setEventCallback(new CounterCallback(pollCounter)); Thread.sleep(WAIT_TIME); muleContext.dispose(); assertTrue("No polls performed", pollCounter.get() > 0); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpBadEncodingFunctionalTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpBadEncodingFunctiona0000644000175000017500000000252010754375733033677 0ustar charlescharles/* * $Id: HttpBadEncodingFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.transport.http.HttpConnector; public class HttpBadEncodingFunctionalTestCase extends HttpEncodingFunctionalTestCase { public void testSend() throws Exception { MuleClient client = new MuleClient(); // Send as bytes so that the StringRequestEntity isn't used. If it is used // it will throw an exception and stop us from testing the server side. DefaultMuleMessage msg = new DefaultMuleMessage(TEST_MESSAGE.getBytes()); msg.setEncoding("UTFF-912"); MuleMessage reply = client.send("clientEndpoint", msg); assertNotNull(reply); assertEquals("500", reply.getProperty(HttpConnector.HTTP_STATUS_PROPERTY)); assertNotNull(reply.getExceptionPayload()); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpContinueFunctionalTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpContinueFunctionalTe0000644000175000017500000000421010754375733033771 0ustar charlescharles/* * $Id: HttpContinueFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConnector; import java.util.HashMap; import java.util.Map; import org.apache.commons.httpclient.HttpVersion; import org.apache.commons.httpclient.params.HttpClientParams; import org.apache.commons.lang.time.StopWatch; public class HttpContinueFunctionalTestCase extends FunctionalTestCase { public static final String TEST_MESSAGE = "Foo Bar"; protected String getConfigResources() { return "http-functional-test.xml"; } /** * HttpClient has default 3 seconds wait for Expect-Continue calls. */ public static final int DEFAULT_HTTP_CLIENT_CONTINUE_WAIT = 3000; protected StopWatch stopWatch; public void testSendWithContinue() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); //Need to use Http1.1 for Expect: Continue HttpClientParams params = new HttpClientParams(); params.setVersion(HttpVersion.HTTP_1_1); params.setBooleanParameter(HttpClientParams.USE_EXPECT_CONTINUE, true); props.put(HttpConnector.HTTP_PARAMS_PROPERTY, params); stopWatch = new StopWatch(); stopWatch.start(); MuleMessage result = client.send("clientEndpoint", TEST_MESSAGE, props); stopWatch.stop(); assertNotNull(result); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); if (stopWatch.getTime() > DEFAULT_HTTP_CLIENT_CONTINUE_WAIT) { fail("Server did not handle Expect=100-continue header properly,"); } } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/ETagComponent.java0000755000175000017500000000263110754365306032457 0ustar charlescharles/* * $Id: ETagComponent.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.transport.DefaultMessageAdapter; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; public class ETagComponent implements org.mule.api.lifecycle.Callable { String ETAG_VALUE = "0123456789"; public Object onCall(MuleEventContext eventContext) throws Exception { MuleMessage msg = eventContext.getMessage(); String etag = msg.getStringProperty(HttpConstants.HEADER_IF_NONE_MATCH, null); if (etag != null && etag.equals(ETAG_VALUE)) { DefaultMessageAdapter res = new DefaultMessageAdapter(""); res.setIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, 304); msg = new DefaultMuleMessage(res); } msg.setProperty(HttpConstants.HEADER_ETAG, ETAG_VALUE); return msg; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpPollingFunctionalTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpPollingFunctionalTes0000644000175000017500000000176210754375733034005 0ustar charlescharles/* * $Id: HttpPollingFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class HttpPollingFunctionalTestCase extends FunctionalTestCase { public void testPollingHttpConnector() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.request("vm://toclient", 5000); assertNotNull(result.getPayload()); } protected String getConfigResources() { return "mule-http-polling-config.xml"; } }././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/TwoEndpointsSinglePortTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/TwoEndpointsSinglePortTe0000644000175000017500000000473210763522057033770 0ustar charlescharles/* * $Id: TwoEndpointsSinglePortTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.ArrayList; import java.util.List; public class TwoEndpointsSinglePortTestCase extends FunctionalTestCase { protected String getConfigResources() { return "two-endpoints-single-port.xml"; } public void testSendToEach() throws Exception { sendWithResponse("http://localhost:60211/mycomponent1", "test", "mycomponent1", 10); sendWithResponse("http://localhost:60211/mycomponent2", "test", "mycomponent2", 10); } public void testSendToEachWithBadEndpoint() throws Exception { MuleClient client = new MuleClient(); sendWithResponse("http://localhost:60211/mycomponent1", "test", "mycomponent1", 5); sendWithResponse("http://localhost:60211/mycomponent2", "test", "mycomponent2", 5); MuleMessage result = client.send("http://localhost:60211/mycomponent-notfound", "test", null); assertNotNull(result); assertNotNull(result.getExceptionPayload()); assertEquals(404, result.getIntProperty("http.status", 0)); // Test that after the exception the endpoints still receive events sendWithResponse("http://localhost:60211/mycomponent1", "test", "mycomponent1", 5); sendWithResponse("http://localhost:60211/mycomponent2", "test", "mycomponent2", 5); } protected void sendWithResponse(String endpoint, String message, String response, int noOfMessages) throws MuleException { MuleClient client = new MuleClient(); List results = new ArrayList(); for (int i = 0; i < noOfMessages; i++) { results.add(client.send(endpoint, message, null).getPayload(byte[].class)); } assertEquals(noOfMessages, results.size()); for (int i = 0; i < noOfMessages; i++) { assertEquals(response, new String((byte[])results.get(i))); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpFunctionalTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/HttpFunctionalTestCase.j0000644000175000017500000000246710763522057033664 0ustar charlescharles/* * $Id: HttpFunctionalTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConstants; import java.util.HashMap; import java.util.Map; public class HttpFunctionalTestCase extends FunctionalTestCase { protected static String TEST_MESSAGE = "Test Http Request (Rdgrd), 57 = \u06f7\u06f5 in Arabic"; protected String getConfigResources() { return "http-functional-test.xml"; } public void testSend() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); props.put(HttpConstants.HEADER_CONTENT_TYPE, "text/plain;charset=UTF-8"); MuleMessage result = client.send("clientEndpoint", TEST_MESSAGE, props); assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString()); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/JettyHttpFunctionalTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/functional/JettyHttpFunctionalTestC0000644000175000017500000000124610745677442033766 0ustar charlescharles/* * $Id: JettyHttpFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.functional; public class JettyHttpFunctionalTestCase extends HttpFunctionalTestCase { //@Override protected String getConfigResources() { return "jetty-http-functional-test.xml"; } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/ServletConnectorTestCase.java0000644000175000017500000000256310754365306032546 0ustar charlescharles/* * $Id: ServletConnectorTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.http.servlet.ServletConnector; public class ServletConnectorTestCase extends AbstractConnectorTestCase { // @Override public Connector createConnector() throws Exception { ServletConnector c = new ServletConnector(); c.setName("test"); return c; } public String getTestEndpointURI() { return "servlet://testServlet"; } public Object getValidMessage() throws Exception { return HttpRequestMessageAdapterTestCase.getMockRequest("test message"); } public void testConnectorMessageDispatcherFactory() throws Exception { // there is no DispatcherFactory for the servlet connector } public void testConnectorMessageDispatcher() throws Exception { // therefore we have no dispatchers } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/components/0000755000175000017500000000000011351410632027112 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/http/src/test/java/org/mule/transport/http/components/RestServiceComponentTestCase.javamule-2.0.1/transports/http/src/test/java/org/mule/transport/http/components/RestServiceComponentTest0000644000175000017500000000557310766654216034051 0ustar charlescharles/* * $Id: RestServiceComponentTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.components; import org.mule.api.component.Component; import org.mule.routing.filters.WildcardFilter; import org.mule.routing.filters.logic.NotFilter; import org.mule.tck.FunctionalTestCase; public class RestServiceComponentTestCase extends FunctionalTestCase { public static final String SERVICE_NAME = "WORMS"; public static final String SERVICE_URL = "http://www.webservicex.net/stockquote.asmx/GetQuote"; protected String getConfigResources() { return "rest-service-component-test.xml"; } public void testResetServiceNamespaceHandler() throws Exception { Component component = muleContext.getRegistry().lookupService(SERVICE_NAME).getComponent(); assertTrue(component instanceof RestServiceWrapper); RestServiceWrapper restServiceWrapper = (RestServiceWrapper) component; assertEquals(restServiceWrapper.getServiceUrl(), SERVICE_URL); assertEquals(restServiceWrapper.getHttpMethod(), "POST"); assertEquals(restServiceWrapper.isUrlFromMessage(), true); assertEquals(restServiceWrapper.getErrorExpression(), "ErrorExp"); assertNotNull(restServiceWrapper.getFilter()); assertEquals(NotFilter.class, restServiceWrapper.getFilter().getClass()); NotFilter filter = (NotFilter) restServiceWrapper.getFilter(); assertEquals(filter.getFilter().getClass(), WildcardFilter.class); WildcardFilter innerFilter = (WildcardFilter) filter.getFilter(); assertEquals(innerFilter.getPattern(), "*xyz*"); assertNotNull(restServiceWrapper.getPayloadParameterNames()); assertEquals(restServiceWrapper.getPayloadParameterNames().size(), 2); assertEquals(restServiceWrapper.getPayloadParameterNames().get(0), "test-property1"); assertEquals(restServiceWrapper.getPayloadParameterNames().get(1), "test-property2"); assertNotNull(restServiceWrapper.getRequiredParams()); assertEquals(restServiceWrapper.getRequiredParams().size(), 2); assertEquals(restServiceWrapper.getRequiredParams().get("r1"), "rv1"); assertEquals(restServiceWrapper.getRequiredParams().get("r2"), "rv2"); assertNotNull(restServiceWrapper.getOptionalParams()); assertEquals(restServiceWrapper.getOptionalParams().size(), 2); assertEquals(restServiceWrapper.getOptionalParams().get("o1"), "ov1"); assertEquals(restServiceWrapper.getOptionalParams().get("o2"), "ov2"); } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/components/RESTTestCase.java0000644000175000017500000000432210763522057032202 0ustar charlescharles/* * $Id: RESTTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http.components; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class RESTTestCase extends FunctionalTestCase { protected String getConfigResources() { return "rest-functional-test.xml"; } public void testRest1ParamPost() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm://in1", new DefaultMuleMessage("IBM")); assertNotNull(reply); assertNotNull(reply.getPayloadAsString()); assertTrue(reply.getPayloadAsString().indexOf("Symbol>IBM<") > -1); } public void testRest2ParamsPost() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm://in2", new DefaultMuleMessage(new Object[]{"MTL","MTL"})); assertNotNull(reply.getPayloadAsString()); assertTrue(reply.getPayloadAsString().indexOf(">1") > -1); } public void testRest1ParamGet() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm://in3", new DefaultMuleMessage(new Object[]{"IBM"})); assertNotNull(reply); assertNotNull(reply.getPayloadAsString()); assertTrue(reply.getPayloadAsString().indexOf("Symbol>IBM<") > -1); } public void testRest2ParamsGet() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm://in4", new DefaultMuleMessage(new Object[]{"MTL","MTL"})); assertNotNull(reply.getPayloadAsString()); assertTrue(reply.getPayloadAsString().indexOf(">1") > -1); } } mule-2.0.1/transports/http/src/test/java/org/mule/transport/http/HttpMessageAdapterTestCase.java0000644000175000017500000000210610754365306032765 0ustar charlescharles/* * $Id: HttpMessageAdapterTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.http; import org.mule.api.MessagingException; import org.mule.api.transport.MessageAdapter; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.transport.http.HttpMessageAdapter; public class HttpMessageAdapterTestCase extends AbstractMessageAdapterTestCase { protected static final String TEST_MESSAGE = "Hello"; private byte[] message = TEST_MESSAGE.getBytes(); public Object getValidMessage() throws Exception { return message; } public MessageAdapter createAdapter(Object payload) throws MessagingException { return new HttpMessageAdapter(payload); } } mule-2.0.1/transports/http/src/test/resources/0000755000175000017500000000000011351410633021253 5ustar charlescharlesmule-2.0.1/transports/http/src/test/resources/http-content-length-propagation-conf.xml0000644000175000017500000000325710766460764031201 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/stylesheet.xsl0000644000175000017500000557661110664616536024241 0ustar charlescharles

mule-2.0.1/transports/http/src/test/resources/serverKeystore0000644000175000017500000000335610443352122024240 0ustar charlescharles muleclient '3X.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'. muleserver ,6N00 +*d;j5V3g2+sDjav}tKmn@GFzS̛-ps냦""AYNZMgGqYS"IW٥ .17e7i??i~?k5ݺZT((`){B|.쵱L6&/rՒpFt$jXesἕVSQ 8,]tKϪ>țbE=K\{_\./S~If#9Ysk BCGEkFw BqTW>uΓ$6ռD.G@{-ɍ\@ҡ `>d gZ6Z?4( 3 .bzX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlOnOO}*Hgmule-2.0.1/transports/http/src/test/resources/http-stem-test.xml0000755000175000017500000000221310754365306024714 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/log4j.properties0000644000175000017500000000100610745677442024430 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN # display speed log4j.logger.org.mule.transport.http.issues.StreamingDownloadMule1389TestCase=INFO # MULE-2708 log4j.logger.org.mule.transport.http.issues.HttpTransformersMule1815TestCase=DEBUG mule-2.0.1/transports/http/src/test/resources/rest-functional-test.xml0000644000175000017500000000535410745174725026115 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/test-xml-payload.xml0000644000175000017500000014606210674545362025231 0ustar charlescharles 1LCRA 0000045657 0 GEN D N N Y PRN U 2007-03-30 PS PO Sourced from MAXIMO Requ 1LCRA 042037902 1 1LCRA 042037902 1 30 ABAIN ONL 0 2 0 0 ACCTSPAY Y 17460029154 USD CRRNT Y STANDARD T N 1478770 Y STANDARD AMOSES_2T 2007-03-30 AMOSES_2T 2007-03-30 AMOSES_2T 2007-03-30T10:17:24.000000-0500 2007-03-30 BSSCO N 2007-03-30 N 0 N N USD 2007-03-30 1 1 V V N 0 N N I 1 V N N 1LCRA 0000045657 REQLOAD 2007-03-30T09:19:55.000000-0500 1 Y 0 A Y Y Y HDR 0 LTC #1710 - ELECTROSWITCH - STORES 02 INVENTORY 1LCRA 0000045657 REQLOAD 2007-03-30T09:19:56.000000-0500 2 Y 0 A Y Y Y LIN 1 SWITCH, BREAKER CONTROL, 4-DECKS, ES 74PD204LC 1LCRA 0000045657 1478790 042037902 1 0 PRN 2007-04-04T08:43:48.000000-0500 AMOSES_2T 1LCRA 0000045657 1 A U 1LCRA 4606028015 12005 0 EA L P 1LCRA 0000000000000000000001710 0 80 0 1 1 0 N Y Y N SWITCH, BREAKER CONTROL, 4-DECKS, ES 74PD204LC 0 0 01 N L 28579 1LCRA 0000045657 1 1 A I U 0 0 0 N N 2006-03-06 1LCRA 02 2006-03-06 20 USD 0 USD 0 DST BST Q 0 0 0 0 0 0 0 0 N F 0 0 0 N N Y 02 N E Y N I N N N N N N E 0 0 0 0 0 0 0 N 0 N N N 0 N 0 1LCRA 0000045657 1 1 DST 1 20 USD 0 USD 0 02 154020 AAA 10000 0 V TENCO O N BPO 1LCRA 1478770 N M000060611 1 1 1 0 0 N 0 0 0 ABAIN N 0 0 20 100 N N 0 0 0 0 0 E 0 0 0 0 0 0 0 0 0 0 0 CRRNT 1 1 0 0 0 0 0 0 0 0 0 0 2007-03-30 V N Y E N N N N N A A 0 0 T N V N ENG ENG 0 mule-2.0.1/transports/http/src/test/resources/http-encoding-test.xml0000644000175000017500000000247310745174725025542 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/clientKeystore0000644000175000017500000000335610443352122024210 0ustar charlescharles muleclient 00 +*(+lAJv;ǸH H#Vpab^ko5t(vaH~3D9V&\b(hMRtF Y}0ɤ^qIT_ZTZ%0qe4kh#_skyXhغQrpcA *k`XgE  ۲i ⎝"&m- zi[I8_"#F>>'Lu@P`!D/4&) fbYFmpքzޭŏX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'. muleserver -X.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlOU_PT}Kmule-2.0.1/transports/http/src/test/resources/mule-http-polling-config.xml0000644000175000017500000000433110745677442026645 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/polling-receivers-restart-test.xml0000644000175000017500000000436510756631035030106 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/http-functional-test.xml0000644000175000017500000000202610745174725026110 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/jetty-rest-functional-test.xml0000644000175000017500000000277210745174725027253 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/http-cookie-test.xml0000644000175000017500000000340610757607770025226 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/streaming-download-mule-1389.xml0000644000175000017500000000143710745677442027165 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/jetty-http-functional-test.xml0000644000175000017500000000274610745174725027256 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/jetty-namespace-config.xml0000644000175000017500000000257510737201302026340 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/streaming-speed-mule-1389.xml0000644000175000017500000000323010745677442026447 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/http-method-test.xml0000644000175000017500000000163510745174725025233 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/polling-etag-test.xml0000755000175000017500000000426510756634324025363 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/https-namespace-config.xml0000644000175000017500000000304410763766522026356 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/muleclient.cer0000644000175000017500000000074310443352122024112 0ustar charlescharles00HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'.mule-2.0.1/transports/http/src/test/resources/trustStore0000644000175000017500000003736210443352122023406 0ustar charlescharlesqӓ=:0  *H 01 0 UUS10U VeriSign, Inc.1<0:U 3Class 1 Public Primary Certification Authority - G21:08U 1(c) 1998 VeriSign, Inc. - For authorized use only10U VeriSign Trust Network0 980518000000Z 280801235959Z01 0 UUS10U VeriSign, Inc.1<0:U 3Class 1 Public Primary Certification Authority - G21:08U 1(c) 1998 VeriSign, Inc. - For authorized use only10U VeriSign Trust Network00  *H 0к-v1ʔVooR6nuV UC!e~!k2?4A5ݪY?SmO*ZĦE]>d$vͫo{Qan4A @s=ku0  *H O g,٨-u~;r~\- km`|Ő# \JЯ]Ƕ  vOÛu[kܬrNOdt{•AesXJKl#P&D#q$GuȦ0  *H +9t^dXJ-73G\`'ER?dh|`3ibTk`BШ;\&#
ZW%v ,75xdT@Qɿ⊂7U!vhKK%f"VlYmepqv>wLPVH).JYIT,s:i9mpgH-{0  *H ~e~:qFǠ@&> Z7a[i;D S kI>5l\:/`KM _d{\w9YoӵMMBVv_8_u_{厀|Pwww.verisign.com/repository/TestCPS Incorp. By Ref. Liab. LTD.1F0DU =For VeriSign authorized testing only. No assurances (C)VS19970 980204000000Z 030304235959Z010U  VeriSign, Inc1G0EU >www.verisign.com/repository/TestCPS Incorp. By Ref. Liab. LTD.1F0DU =For VeriSign authorized testing only. No assurances (C)VS19970\0  *H K0HAƤ&'8œn@˟6~sNбFm@p(Y4Mێ'C;;rN`oQ0  *H Am$g$]upy;N4 د¯NJg {rGc{HL/وQ9 u?verisign class 1 ca individual subscriber-persona not validated ɮX.509j0f0Ϡ O[uj)0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority0 980512000000Z 080512235959Z010U VeriSign, Inc.10U VeriSign Trust Network1F0DU =www.verisign.com/repository/RPA Incorp. By Ref.,LIAB.LTD(c)981H0FU?VeriSign Class 1 CA Individual Subscriber-Persona Not Validated00  *H 0ZDUz-Ox6 JoTw*h1ApzKHV-BD\B/;' ]6B3nTOJƚj$e~7jJ 00 `HB05U.0,0*(&$http://crl.verisign.com/pca1.1.1.crl0GU @0>0< `HE0-0++www.verisign.com/repository/RPA0U00 U0  *H B|ߌyLMU/P^N.^2ye JRը1!l4x BZъު"!e3 3 >5d$[h|7d Ž33>>s muleclient ɯX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'.%2q^P' #˦B7verisign class 1 public primary certification authority ɮkX.509A0=0ͺVT"rU0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority0 960129000000Z 280801235959Z0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority00  *H 0mVa-Hqg޹뷞 8%Fs$] en VsߴX9knը?14׏4g NEVixG)6c\-{2{0*/1g0  *H L?hC3]Mz36ؕ"6hl|B.?OvJ͠ )"]݁#{%F0yK@<_SH䆴{5{%ӎ?84qthawte personal basic ca ɮX.509%0!00  *H 01 0 UZA10U Western Cape10U Cape Town10U Thawte Consulting1(0&U Certification Services Division1!0UThawte Personal Basic CA1(0& *H  personal-basic@thawte.com0 960101000000Z 201231235959Z01 0 UZA10U Western Cape10U Cape Town10U Thawte Consulting1(0&U Certification Services Division1!0UThawte Personal Basic CA1(0& *H  personal-basic@thawte.com00  *H 0SmPOH5ZoBGwurݍIWx?Qi v"jQK7 M458WJpYC}O= bzu݈NN@ۨ2to D يo)(;@(Z<յ ʤQL,YڹuB#.pG*verisign international server ca - class 3 ɮ6X.50900%K8BXݮ"n0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 3 Public Primary Certification Authority0 970417000000Z 111024235959Z010U VeriSign Trust Network10U VeriSign, Inc.1301U *VeriSign International Server CA - Class 31I0GU @www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign00  *H 0؂}9%e+Ӽ6;Ll[( ;MN9\IZӲp0B+QZ<:"OSO4{o00U00DU =0;09 `HE0*0(+https://www.verisign.com/CPS04U%-0+++ `HB `HE0 U0 `HB01U*0(0&$" http://crl.verisign.com/pca3.crl0  *H hBs#:T#>j:36 o)+rDѬ -8=܆aN&_^ $p&C=I.R_>f)N,Fus~ gTR muleserver ɯFX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlO?verisign class 3 ca individual subscriber-persona not validated ɮ'X.5095010#l+ t`0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 3 Public Primary Certification Authority0 970417000000Z 040107235959Z010U VeriSign Trust Network10U VeriSign, Inc.1301U *VeriSign International Server CA - Class 31I0GU @www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign00  *H 0؂}9%e+Ӽ6;Ll[( ;MN9\IZӲp0B+QZ<:"OSO4{o00U00 U0 `HB0 U%0 `HE `HB05U ,0(0$ `HE00(+https://www.verisign.com/CPS0+00VeriSign, Inc.0VeriSign's Certification Practice Statement, www.verisign.com/CPS, governs this certificate & is incorporated by reference herein. SOME WARRANTIES DISCLAIMED & LIABILITY LTD. (c)1997 VeriSign0  *H +Hrh tcXE"N3bZ!$lBE:gHk7K}xU1fF}x`UlUibp|MC (ьFP1f$J[Kf^eU_7?verisign class 2 ca individual subscriber-persona not validated ɮX.509V0R0R |΂Es0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 2 Public Primary Certification Authority0 980512000000Z 040106235959Z010U VeriSign, Inc.10U VeriSign Trust Network1F0DU =www.verisign.com/repository/RPA Incorp. By Ref.,LIAB.LTD(c)981402U+VeriSign Class 2 CA - Individual Subscriber00  *H 0T^%,Y_ kJK >~/e_c, k^Ih%$_#iM;}ڏ ϥX:Kخu""(`0!p^H!T_8)SzSX ]PK9Ti00 `HB05U.0,0*(&$http://crl.verisign.com/pca2.1.1.crl0GU @0>0< `HE0-0++www.verisign.com/repository/RPA0U00 U0  *H  cQ"U_8$^;ID7RuĊRXٮdV/4H׏bƅel@~h!4Z_p LܠA(/ F @LC@1Tmule-2.0.1/transports/http/src/test/resources/two-endpoints-single-port.xml0000644000175000017500000000326010766654216027071 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/https-functional-test.xml0000644000175000017500000000277710763766522026312 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/http-transformers-mule-1815-test.xml0000644000175000017500000001225510745677442030040 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/http-service-overrides.xml0000644000175000017500000000150410757047673026435 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/http-transformers-mule-1822-test.xml0000644000175000017500000001117010745174725030025 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/typed-placeholder-mule-1887-test.xml0000644000175000017500000000324710762044052027735 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/servlet-namespace-config.xml0000644000175000017500000000136010666164272026673 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/proxy.properties0000644000175000017500000000021510754365306024564 0ustar charlescharles# Set these properties for your HTTP proxy if necessary. proxyHostname=bcd proxyPort=2345 proxyUsername=def proxyPassword=cde keepAlive=true mule-2.0.1/transports/http/src/test/resources/http-wildcard-filter-test.xml0000644000175000017500000000263010745677442027027 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000150710761574603026144 0ustar charlescharles# # Test cases listed in this file are not run. # # this test depends on external services which may not always be available # even so, as soon as we disable it, it drifts out of maintenance... #org.mule.transport.http.components.RESTTestCase # MULE-1389 org.mule.transport.http.issues.StreamingDownloadMule1389TestCase # MULE-2208 org.mule.transport.http.functional.HttpsFunctionalTestCase # javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet # at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:829) # # com.sun.org.apache.bcel.internal.generic.ClassGenException: Branch target offset too large for short # # Explanation at: http://jakarta.apache.org/bcel/faq.html org.mule.transport.http.functional.HttpContentLengthPropagationTestCase mule-2.0.1/transports/http/src/test/resources/http-placeholder-test.xml0000644000175000017500000000324210762044052026215 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/muleserver.cer0000644000175000017500000000074310443352122024142 0ustar charlescharles00HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlOmule-2.0.1/transports/http/src/test/resources/http-namespace-config.xml0000644000175000017500000000413511003375564026163 0ustar charlescharles mule-2.0.1/transports/http/src/test/resources/rest-service-component-test.xml0000644000175000017500000000337310740651573027406 0ustar charlescharles mule-2.0.1/transports/http/pom.xml0000644000175000017500000001166711006063605017023 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-http HTTP Transport A Mule transport for Http Connectivity. This transport supplies a simple Http Server implementation. osgi org.apache.felix maven-bundle-plugin http, https, servlet, jetty META-INF.services.org.mule.i18n, !com.ccg.net.ethernet, !com.sun.activation.registries, !com.sun.net.ssl, !com.sun.net.ssl.internal.ssl, !javax.crypto, !javax.crypto.spec, !javax.naming, !javax.naming.spi, !javax.net, !javax.net.ssl, !javax.security.auth, !javax.security.cert, !javax.xml.namespace, !javax.xml.transform, !org.xml.sax, !sun.misc, * org.mule.transport.http.* org.mule.module.osgi, org.apache.commons.codec.*, org.apache.commons.httpclient.*, org.mortbay.http.*, org.mortbay.jetty.*, org.mortbay.log, org.mortbay.xml, org.mortbay.util org.mule mule-core ${version} org.mule.transports mule-transport-ssl ${version} commons-codec commons-codec commons-httpclient commons-httpclient jetty org.mortbay.jetty 5.1.12 org.apache.geronimo.specs geronimo-servlet_2.4_spec org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test org.mule.transports mule-transport-tcp ${version} test-jar test org.mule.modules mule-module-xml ${version} test org.mule.transports mule-transport-vm ${version} test org.mule.transports mule-transport-stdio ${version} test mule-2.0.1/transports/pom.xml0000644000175000017500000001353711006063605016042 0ustar charlescharles 4.0.0 org.mule mule 2.0.1 org.mule.transports mule-transports pom Mule Transports org.mule mule-core ${version} org.mule.modules mule-module-spring-config ${version} provided javax.activation activation provided org.mule.tests mule-tests-functional ${version} test osgi org.apache.felix maven-bundle-plugin Mule Transport org.mule.module.osgi.TransportActivator org.mule.module.osgi org.mule.providers.service, !com.ccg.net.ethernet, !com.sun.activation.registries, !com.sun.net.ssl, !com.sun.net.ssl.internal.ssl, !javax.crypto, !javax.crypto.spec, !javax.naming, !javax.naming.spi, !javax.net, !javax.net.ssl, !javax.security.auth, !javax.security.cert, !javax.xml.namespace, !javax.xml.transform, !org.xml.sax, !sun.misc, * jdk14 !skipJDK14 all-transports axis bpm ejb email file ftp http jbpm jdbc jms multicast quartz rmi soap ssl stdio tcp udp vm xmpp jdk15 1.5 cxf mule-2.0.1/transports/rmi/0000755000175000017500000000000011351410646015307 5ustar charlescharlesmule-2.0.1/transports/rmi/src/0000755000175000017500000000000011351410645016075 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/0000755000175000017500000000000011351410646017022 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/java/0000755000175000017500000000000011351410645017742 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/java/org/0000755000175000017500000000000011351410645020531 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/java/org/mule/0000755000175000017500000000000011351410645021473 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/java/org/mule/transport/0000755000175000017500000000000011351410645023527 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/java/org/mule/transport/jnp/0000755000175000017500000000000011351410645024316 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/java/org/mule/transport/jnp/config/0000755000175000017500000000000011351410645025563 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/java/org/mule/transport/jnp/config/JnpNamespaceHandler.java0000644000175000017500000000423110745726444032305 0ustar charlescharles/* * $Id: JnpNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jnp.config; import org.mule.config.spring.factories.InboundEndpointFactoryBean; import org.mule.config.spring.factories.OutboundEndpointFactoryBean; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.specific.endpoint.TransportEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.TransportGlobalEndpointDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.jnp.JnpConnector; import org.mule.transport.rmi.config.RmiNamespaceHandler; /** * Registers a Bean Definition Parser for handling <jnp:connector> elements. * */ public class JnpNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerMuleBeanDefinitionParser("endpoint", new TransportGlobalEndpointDefinitionParser(JnpConnector.JNP, TransportGlobalEndpointDefinitionParser.PROTOCOL, RmiNamespaceHandler.ADDRESS, RmiNamespaceHandler.PROPERTIES)).addAlias(RmiNamespaceHandler.OBJECT, URIBuilder.PATH); registerMuleBeanDefinitionParser("inbound-endpoint", new TransportEndpointDefinitionParser(JnpConnector.JNP, TransportGlobalEndpointDefinitionParser.PROTOCOL, InboundEndpointFactoryBean.class, RmiNamespaceHandler.ADDRESS, RmiNamespaceHandler.PROPERTIES)).addAlias(RmiNamespaceHandler.OBJECT, URIBuilder.PATH); registerMuleBeanDefinitionParser("outbound-endpoint", new TransportEndpointDefinitionParser(JnpConnector.JNP, TransportGlobalEndpointDefinitionParser.PROTOCOL, OutboundEndpointFactoryBean.class, RmiNamespaceHandler.ADDRESS, RmiNamespaceHandler.PROPERTIES)).addAlias(RmiNamespaceHandler.OBJECT, URIBuilder.PATH); registerConnectorDefinitionParser(JnpConnector.class); } }mule-2.0.1/transports/rmi/src/main/java/org/mule/transport/jnp/JnpConnector.java0000644000175000017500000000136510745677442027610 0ustar charlescharles/* * $Id: JnpConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jnp; import org.mule.transport.rmi.RmiConnector; /** * JnpConnector uses the Java Naming protocol to bind to remote * objects */ public class JnpConnector extends RmiConnector { public static final String JNP = "jnp"; public String getProtocol() { return JNP; } } mule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/0000755000175000017500000000000011351410646024317 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/RmiMessageReceiver.java0000644000175000017500000001045710757615756030734 0ustar charlescharles/* * $Id: RmiMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.DefaultMuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.transport.AbstractPollingMessageReceiver; import org.mule.transport.ConnectException; import org.mule.transport.rmi.i18n.RmiMessages; import org.mule.util.ClassUtils; import java.lang.reflect.Method; import java.rmi.RMISecurityManager; import java.rmi.Remote; import java.util.List; import org.apache.commons.collections.MapUtils; /** * Will repeatedly call a method on a Remote object. If the method takes parameters A * List of objects can be specified on the endpoint called * methodArgumentsList, If this property is ommitted it is assumed * that the method takes no parameters */ public class RmiMessageReceiver extends AbstractPollingMessageReceiver { protected RmiConnector connector; protected Remote remoteObject; protected Method invokeMethod; protected Object[] methodArguments = null; public RmiMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint, long frequency) throws CreateException { super(connector, service, endpoint); this.setFrequency(frequency); this.connector = (RmiConnector) connector; } protected void doDispose() { // template method } protected void doConnect() throws Exception { System.setProperty("java.security.policy", connector.getSecurityPolicy()); // Set security manager if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } String methodName = MapUtils.getString(endpoint.getEndpointURI().getParams(), MuleProperties.MULE_METHOD_PROPERTY, null); if (null == methodName) { methodName = (String) endpoint.getProperty(MuleProperties.MULE_METHOD_PROPERTY); if (null == methodName) { throw new ConnectException(RmiMessages.messageParamServiceMethodNotSet(), this); } } remoteObject = connector.getRemoteObject(getEndpoint()); List args = (List) endpoint.getProperty(RmiConnector.PROPERTY_SERVICE_METHOD_PARAMS_LIST); Class[] argTypes = new Class[]{}; if (args == null) { logger.info(RmiConnector.PROPERTY_SERVICE_METHOD_PARAMS_LIST + " not set on endpoint, assuming method call has no arguments"); methodArguments = ClassUtils.NO_ARGS; } else { argTypes = ClassUtils.getClassTypes(methodArguments); methodArguments = new Object[args.size()]; methodArguments = args.toArray(methodArguments); } invokeMethod = remoteObject.getClass().getMethod(methodName, argTypes); } protected void doDisconnect() { invokeMethod = null; remoteObject = null; } public void poll() { try { Object result = invokeMethod.invoke(remoteObject, getMethodArguments()); if (null != result) { final Object payload = connector.getMessageAdapter(result).getPayload(); routeMessage(new DefaultMuleMessage(payload), endpoint.isSynchronous()); } } catch (Exception e) { handleException(e); } } /** * Returns the method arguments to use when invoking the method on the Remote * object. This method can be overloaded to enable dynamic method arguments * * @return */ protected Object[] getMethodArguments() { return methodArguments; } } mule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/RmiMessageDispatcher.java0000644000175000017500000000663310757615756031257 0ustar charlescharles/* * $Id: RmiMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transformer.TransformerException; import org.mule.transport.AbstractMessageDispatcher; import java.lang.reflect.Method; import java.rmi.RMISecurityManager; import java.rmi.Remote; import java.util.Collections; /** * RmiMessageDispatcher will send transformed mule events over * RMI-JRMP. */ public class RmiMessageDispatcher extends AbstractMessageDispatcher { private final RmiConnector connector; protected volatile Remote remoteObject; protected volatile Method invokedMethod; public RmiMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (RmiConnector)endpoint.getConnector(); } protected void doConnect() throws Exception { if (remoteObject == null) { // Shouldn't all this be in the connector? String rmiPolicyPath = connector.getSecurityPolicy(); System.setProperty("java.security.policy", rmiPolicyPath); // Set security manager if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } remoteObject = connector.getRemoteObject(endpoint); } } protected void doDisconnect() throws Exception { remoteObject = null; invokedMethod = null; } private Object[] getArgs(MuleEvent event) throws TransformerException { Object payload = event.transformMessage(); if (payload instanceof Object[]) { return (Object[])payload; } else { return new Object[]{payload}; } } /* * (non-Javadoc) * * @see org.mule.api.transport.UMOConnectorSession#dispatch(org.mule.api.MuleEvent) */ protected void doDispatch(MuleEvent event) throws Exception { Object[] arguments = getArgs(event); if (invokedMethod == null) { invokedMethod = connector.getMethodObject(remoteObject, event); } invokedMethod.invoke(remoteObject, arguments); } /* * (non-Javadoc) * * @see org.mule.api.transport.UMOConnectorSession#send(org.mule.api.MuleEvent) */ public MuleMessage doSend(MuleEvent event) throws Exception { if (invokedMethod == null) { invokedMethod = connector.getMethodObject(remoteObject, event); } Object[] arguments = getArgs(event); Object result = invokedMethod.invoke(remoteObject, arguments); if (result == null) { return null; } else { return new DefaultMuleMessage(connector.getMessageAdapter(result).getPayload(), Collections.EMPTY_MAP); } } protected void doDispose() { // template method } } mule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/i18n/0000755000175000017500000000000011351410645025075 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/i18n/RmiMessages.java0000644000175000017500000000176610745677442030211 0ustar charlescharles/* * $Id: RmiMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class RmiMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("rmi"); public static Message messageParamServiceMethodNotSet() { return createMessage(BUNDLE_PATH, 1); } public static Message messageReceiverNeedsRmiAble() { return createMessage(BUNDLE_PATH, 10); } public static Message serviceClassInvocationFailed() { return createMessage(BUNDLE_PATH, 11); } } mule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/config/0000755000175000017500000000000011351410645025563 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/config/RmiNamespaceHandler.java0000644000175000017500000000440510745726444032310 0ustar charlescharles/* * $Id: RmiNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi.config; import org.mule.api.config.MuleProperties; import org.mule.config.spring.factories.InboundEndpointFactoryBean; import org.mule.config.spring.factories.OutboundEndpointFactoryBean; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.specific.endpoint.TransportEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.TransportGlobalEndpointDefinitionParser; import org.mule.endpoint.URIBuilder; import org.mule.transport.rmi.RmiConnector; /** * Registers a Bean Definition Parser for handling <rmi:connector> elements. * */ public class RmiNamespaceHandler extends AbstractMuleNamespaceHandler { public static final String OBJECT = "object"; public static final String[] PROPERTIES = new String[]{MuleProperties.MULE_METHOD_PROPERTY}; // , RmiConnector.PROPERTY_SERVICE_METHOD_PARAM_TYPES}; public static final String[] ADDRESS = new String[]{OBJECT, URIBuilder.HOST, URIBuilder.PORT}; public void init() { registerMuleBeanDefinitionParser("endpoint", new TransportGlobalEndpointDefinitionParser(RmiConnector.RMI, TransportGlobalEndpointDefinitionParser.PROTOCOL, ADDRESS, PROPERTIES)).addAlias(OBJECT, URIBuilder.PATH); registerMuleBeanDefinitionParser("inbound-endpoint", new TransportEndpointDefinitionParser(RmiConnector.RMI, TransportGlobalEndpointDefinitionParser.PROTOCOL, InboundEndpointFactoryBean.class, ADDRESS, PROPERTIES)).addAlias(OBJECT, URIBuilder.PATH); registerMuleBeanDefinitionParser("outbound-endpoint", new TransportEndpointDefinitionParser(RmiConnector.RMI, TransportGlobalEndpointDefinitionParser.PROTOCOL, OutboundEndpointFactoryBean.class, ADDRESS, PROPERTIES)).addAlias(OBJECT, URIBuilder.PATH); registerConnectorDefinitionParser(RmiConnector.class); } }mule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/RmiAble.java0000644000175000017500000000206310745677442026515 0ustar charlescharles/* * $Id: RmiAble.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; /** * A callback proxy for binding a RmiMessage receiver to a Remote object */ public interface RmiAble { /** * Set Mule receiver as parameter for callback * * @param receiver */ public void setReceiver(RmiMessageReceiver receiver); /** * Implementing method should route message back to Mule receiver and receive * possible reply for program that calls this Receiver * * @param message from calling program * @return possible reply from Mule to be routed back to calling program as * method result */ public Object route(Object message); } mule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/RmiConnector.java0000644000175000017500000002360110757615756027610 0ustar charlescharles/* * $Id: RmiConnector.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transport.DispatchException; import org.mule.api.transport.MessageReceiver; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractJndiConnector; import org.mule.transport.rmi.i18n.RmiMessages; import org.mule.util.ArrayUtils; import org.mule.util.ClassUtils; import org.mule.util.IOUtils; import java.io.IOException; import java.lang.reflect.Method; import java.net.InetAddress; import java.net.URL; import java.rmi.NotBoundException; import java.rmi.RMISecurityManager; import java.rmi.Remote; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; import javax.naming.NamingException; import org.apache.commons.collections.MapUtils; /** * RmiConnector can bind or send to a given RMI port on a given host. */ public class RmiConnector extends AbstractJndiConnector { public static final String RMI = "rmi"; public static final int DEFAULT_RMI_muleRegistry_PORT = 1099; public static final String PROPERTY_RMI_SECURITY_POLICY = "securityPolicy"; public static final String PROPERTY_RMI_SERVER_CODEBASE = "serverCodebase"; public static final String PROPERTY_SERVER_CLASS_NAME = "serverClassName"; /** * The property name that explicitly defines which argument types should be * passed to a remote object method invocation. This is a comma-separate list for * fully qualified classnames. If this property is not set on an outbound * endpoint, the argument types will be determined automatically from the payload * of the current message */ public static final String PROPERTY_SERVICE_METHOD_PARAM_TYPES = "methodArgumentTypes"; /** * The property name for a list of objects used to call a Remote object via an * RMI or EJB MessageReceiver */ public static final String PROPERTY_SERVICE_METHOD_PARAMS_LIST = "methodArgumentsList"; private String securityPolicy = null; private String serverCodebase = null; private String serverClassName = null; protected long pollingFrequency = 1000L; private SecurityManager securityManager = new RMISecurityManager(); protected void doInitialise() throws InitialisationException { if (securityPolicy != null) { System.setProperty("java.security.policy", securityPolicy); } // Set security manager if (securityManager != null) { System.setSecurityManager(securityManager); } initJndiContext(); } protected void doDispose() { // template method } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } protected void doStart() throws MuleException { // template method } protected void doStop() throws MuleException { // template method } public String getProtocol() { return RMI; } /** * @return Returns the securityPolicy. */ public String getSecurityPolicy() { return securityPolicy; } /** * @param path The securityPolicy to set. */ public void setSecurityPolicy(String path) { // verify securityPolicy existence if (path != null) { URL url = IOUtils.getResourceAsUrl(path, RmiConnector.class); if (url == null) { throw new IllegalArgumentException( "Error on initialization, RMI security policy does not exist"); } this.securityPolicy = url.toString(); } } /** * Method getServerCodebase * * @return */ public String getServerCodebase() { return (this.serverCodebase); } /** * Method setServerCodebase * * @param serverCodebase */ public void setServerCodebase(String serverCodebase) { this.serverCodebase = serverCodebase; } /** * Method getServerClassName * * @return */ public String getServerClassName() { return (this.serverClassName); } /** * Method setServerClassName * * @param serverClassName */ public void setServerClassName(String serverClassName) { this.serverClassName = serverClassName; } public SecurityManager getSecurityManager() { return securityManager; } public void setSecurityManager(SecurityManager securityManager) { this.securityManager = securityManager; } public MessageReceiver createReceiver(Service service, InboundEndpoint endpoint) throws Exception { final Object[] args = new Object[]{new Long(pollingFrequency)}; return getServiceDescriptor().createMessageReceiver(this, service, endpoint, args); } /** * Helper method for Dispatchers and Receives to extract the correct method from * a Remote object * * @param remoteObject The remote object on which to invoke the method * @param event The current event being processed * @return * @throws org.mule.api.MuleException * @throws NoSuchMethodException * @throws ClassNotFoundException */ public Method getMethodObject(Remote remoteObject, MuleEvent event) throws MuleException, NoSuchMethodException, ClassNotFoundException { EndpointURI endpointUri = event.getEndpoint().getEndpointURI(); String methodName = MapUtils.getString(endpointUri.getParams(), MuleProperties.MULE_METHOD_PROPERTY, null); if (null == methodName) { methodName = (String)event.getMessage().removeProperty(MuleProperties.MULE_METHOD_PROPERTY); if (null == methodName) { throw new DispatchException( RmiMessages.messageParamServiceMethodNotSet(), event.getMessage(), event.getEndpoint()); } } Class[] argTypes; // Parse method args Object args = event.getMessage().getProperty(RmiConnector.PROPERTY_SERVICE_METHOD_PARAM_TYPES); if (args instanceof List) { // MULE-1794 this used to take the first list entry as a string, splitting it // as for String below. argTypes = stringsToClasses((List) args); } else if (args instanceof String) { argTypes = stringsToClasses(Arrays.asList(((String) args).split(","))); } else { argTypes = ClassUtils.getClassTypes(event.transformMessage()); } try { return remoteObject.getClass().getMethod(methodName, argTypes); } catch (NoSuchMethodException e) { throw new NoSuchMethodException( CoreMessages.methodWithParamsNotFoundOnObject(methodName, ArrayUtils.toString(argTypes), remoteObject.getClass()).toString()); } catch (SecurityException e) { throw e; } } protected Class[] stringsToClasses(Collection strings) throws ClassNotFoundException { Class[] classes = new Class[strings.size()]; int index = 0; Iterator string = strings.iterator(); while (string.hasNext()) { classes[index++] = ClassUtils.loadClass((String) string.next(), getClass()); } return classes; } protected Object getRemoteRef(ImmutableEndpoint endpoint) throws IOException, NotBoundException, NamingException, InitialisationException { EndpointURI endpointUri = endpoint.getEndpointURI(); String serviceName = endpointUri.getPath(); try { // Test if we can find the object locally return getJndiContext().lookup(serviceName); } catch (NamingException e) { // Strip path seperator } try { serviceName = serviceName.substring(1); return getJndiContext().lookup(serviceName); } catch (NamingException e) { // Try with full host and path } int port = endpointUri.getPort(); if (port < 1) { if (logger.isWarnEnabled()) { logger.warn("RMI port not set on URI: " + endpointUri + ". Using default port: " + RmiConnector.DEFAULT_RMI_muleRegistry_PORT); } port = RmiConnector.DEFAULT_RMI_muleRegistry_PORT; } InetAddress inetAddress = InetAddress.getByName(endpointUri.getHost()); return getJndiContext(inetAddress.getHostAddress() + ":" + port).lookup(serviceName); } public Remote getRemoteObject(ImmutableEndpoint endpoint) throws IOException, NotBoundException, NamingException, InitialisationException { return (Remote)getRemoteRef(endpoint); } public long getPollingFrequency() { return pollingFrequency; } public void setPollingFrequency(long pollingFrequency) { this.pollingFrequency = pollingFrequency; } } mule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/RmiMessageDispatcherFactory.java0000644000175000017500000000165310757615756032604 0ustar charlescharles/* * $Id: RmiMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * Creates and RmiMessageDispatcher */ public class RmiMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new RmiMessageDispatcher(endpoint); } } mule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/RmiCallbackMessageReceiver.java0000644000175000017500000001260010757615756032341 0ustar charlescharles/* * $Id: RmiCallbackMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.ConnectException; import org.mule.transport.rmi.i18n.RmiMessages; import org.mule.util.ClassUtils; import java.lang.reflect.Method; import java.net.InetAddress; import javax.naming.Context; /** TODO */ public class RmiCallbackMessageReceiver extends AbstractMessageReceiver { /** * The property name for the service object implementing the callback interface * RmiAble This should be set on the inbound endpoint */ public static final String PROPERTY_SERVICE_CLASS_NAME = "serviceClassName"; protected RmiConnector connector; protected RmiAble remoteObject = null; private Context jndi = null; private String bindName = null; private int port; public RmiCallbackMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); this.connector = (RmiConnector) connector; logger.debug("Initializing with endpoint " + endpoint); String rmiPolicyPath = this.connector.getSecurityPolicy(); System.setProperty("java.security.policy", rmiPolicyPath); EndpointURI endpointUri = endpoint.getEndpointURI(); port = endpointUri.getPort(); if (port < 1) { port = RmiConnector.DEFAULT_RMI_muleRegistry_PORT; } logger.debug("Initialized successfully"); } protected void doDispose() { // template method } /** * Initializes endpoint * * @throws org.mule.transport.ConnectException * */ protected void doConnect() throws ConnectException { try { // Do not reinit if RMI is already bound to JNDI!!! // TODO Test how things work under heavy load!!! // Do we need threadlocals or so!?!? // TODO [aperepel] consider AtomicBooleans here // for 'initialised/initialising' status, etc. if (null == remoteObject) { try { InetAddress inetAddress = InetAddress.getByName(endpoint.getEndpointURI().getHost()); bindName = endpoint.getEndpointURI().getPath(); remoteObject = getRmiObject(); Method theMethod = remoteObject.getClass().getMethod("setReceiver", new Class[]{RmiCallbackMessageReceiver.class}); theMethod.invoke(remoteObject, new Object[]{this}); jndi = connector.getJndiContext(inetAddress.getHostAddress() + ":" + port); jndi.rebind(bindName, remoteObject); } catch (Exception e) { throw new ConnectException(e, this); } } } catch (Exception e) { throw new ConnectException(e, this); } } /** Unbinds Rmi class from registry */ protected void doDisconnect() { logger.debug("Disconnecting..."); try { jndi.unbind(bindName); } catch (Exception e) { logger.error(e); } logger.debug("Disconnected successfully."); } protected void doStart() throws MuleException { // nothing to do } protected void doStop() throws MuleException { // nothing to do } /** * Gets RmiAble objetc for registry to add in. * * @return java.rmi.Remote and RmiAble implementing class * @throws org.mule.api.lifecycle.ConnectException * */ private RmiAble getRmiObject() throws ConnectException { String className = (String) endpoint.getProperty(PROPERTY_SERVICE_CLASS_NAME); if (null == className) { throw new ConnectException(RmiMessages.messageReceiverNeedsRmiAble(), this); } RmiAble remote; try { remote = (RmiAble) ClassUtils.instanciateClass(className, new Object[]{}, this.getClass()); } catch (Exception e) { throw new ConnectException(RmiMessages.serviceClassInvocationFailed(), e, this); } return (remote); } /** * Routes message forward * * @param message * @return * @throws org.mule.api.MuleException */ public Object routeMessage(Object message) throws MuleException { MessageAdapter adapter = connector.getMessageAdapter(message); return (routeMessage(new DefaultMuleMessage(adapter))); } } mule-2.0.1/transports/rmi/src/main/java/org/mule/transport/rmi/RmiMessageAdapter.java0000644000175000017500000000367310745677442030547 0ustar charlescharles/* * $Id: RmiMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.api.ThreadSafeAccess; import org.mule.api.transport.MessageTypeNotSupportedException; import org.mule.transport.AbstractMessageAdapter; /** * Wraps an object obtained by calling a method on a Remote object */ public class RmiMessageAdapter extends AbstractMessageAdapter { /** * Serial version */ private static final long serialVersionUID = -1765089871661318129L; private final Object message; public RmiMessageAdapter(Object message) throws MessageTypeNotSupportedException { if (message == null) { throw new MessageTypeNotSupportedException(null, getClass()); } this.message = message; } protected RmiMessageAdapter(RmiMessageAdapter template) { super(template); message = template.message; } /** * Converts the message implementation into a String representation * * @param encoding The encoding to use when transforming the message (if * necessary). The parameter is used when converting from a byte array * @return String representation of the message payload * @throws Exception Implementation may throw an endpoint specific exception */ public String getPayloadAsString(String encoding) throws Exception { return message.toString(); } public Object getPayload() { return message; } public ThreadSafeAccess newThreadCopy() { return new RmiMessageAdapter(this); } } mule-2.0.1/transports/rmi/src/main/resources/0000755000175000017500000000000011351410646021034 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/resources/META-INF/0000755000175000017500000000000011351410646022174 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/resources/META-INF/spring.schemas0000644000175000017500000000024410754365306025053 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/jnp/2.0/mule-jnp.xsd=META-INF/mule-jnp.xsd http\://www.mulesource.org/schema/mule/rmi/2.0/mule-rmi.xsd=META-INF/mule-rmi.xsd mule-2.0.1/transports/rmi/src/main/resources/META-INF/mule-jnp.xsd0000644000175000017500000000276010735226404024452 0ustar charlescharles mule-2.0.1/transports/rmi/src/main/resources/META-INF/spring.handlers0000644000175000017500000000030210754365306025223 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/rmi/2.0=org.mule.transport.rmi.config.RmiNamespaceHandler http\://www.mulesource.org/schema/mule/jnp/2.0=org.mule.transport.jnp.config.JnpNamespaceHandler mule-2.0.1/transports/rmi/src/main/resources/META-INF/services/0000755000175000017500000000000011351410646024017 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410646024606 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410646025550 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410646027565 5ustar charlescharlesmule-2.0.1/transports/rmi/src/main/resources/META-INF/services/org/mule/providers/rmi.properties0000644000175000017500000000055310745677442032514 0ustar charlescharlesconnector=org.mule.transport.rmi.RmiConnector dispatcher.factory=org.mule.transport.rmi.RmiMessageDispatcherFactory requester.factory=org.mule.transport.UnsupportedMessageRequesterFactory message.receiver=org.mule.transport.rmi.RmiMessageReceiver message.adapter=org.mule.transport.rmi.RmiMessageAdapter endpoint.builder=org.mule.endpoint.SocketEndpointURIBuildermule-2.0.1/transports/rmi/src/main/resources/META-INF/services/org/mule/providers/jnp.properties0000644000175000017500000000055310745677442032514 0ustar charlescharlesconnector=org.mule.transport.jnp.JnpConnector dispatcher.factory=org.mule.transport.rmi.RmiMessageDispatcherFactory requester.factory=org.mule.transport.UnsupportedMessageRequesterFactory message.receiver=org.mule.transport.rmi.RmiMessageReceiver message.adapter=org.mule.transport.rmi.RmiMessageAdapter endpoint.builder=org.mule.endpoint.SocketEndpointURIBuildermule-2.0.1/transports/rmi/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410646026327 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/rmi/src/main/resources/META-INF/services/org/mule/i18n/rmi-messages.propertiesmule-2.0.1/transports/rmi/src/main/resources/META-INF/services/org/mule/i18n/rmi-messages.properties0000644000175000017500000000053610325446652033053 0ustar charlescharles1=Cannot invoke RMI call without an Operation. Set the 'method' param on your endpointUri or on the endpoint itself #2=Failed to bind to uri "{0}" #3=Failed to close socket 10=RmiMessageReceiver needs a RmiAble implementation class as a parameter 11=Error occured on RmiAble invocation. Does it have a parameterless constructor and implement RmiAble?mule-2.0.1/transports/rmi/src/main/resources/META-INF/mule-rmi.xsd0000644000175000017500000001066610735226404024456 0ustar charlescharles Period (ms) between polling connections. Bean reference to the security manager that should be used. The security policy (file name) used to enable connections. The target class name. The target method. mule-2.0.1/transports/rmi/src/test/0000755000175000017500000000000011351410645017054 5ustar charlescharlesmule-2.0.1/transports/rmi/src/test/java/0000755000175000017500000000000011351410645017775 5ustar charlescharlesmule-2.0.1/transports/rmi/src/test/java/org/0000755000175000017500000000000011351410645020564 5ustar charlescharlesmule-2.0.1/transports/rmi/src/test/java/org/mule/0000755000175000017500000000000011351410645021526 5ustar charlescharlesmule-2.0.1/transports/rmi/src/test/java/org/mule/transport/0000755000175000017500000000000011351410645023562 5ustar charlescharlesmule-2.0.1/transports/rmi/src/test/java/org/mule/transport/jnp/0000755000175000017500000000000011351410645024351 5ustar charlescharlesmule-2.0.1/transports/rmi/src/test/java/org/mule/transport/jnp/JnpEndpointTestCase.java0000644000175000017500000000577310745677442031134 0ustar charlescharles/* * $Id: JnpEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jnp; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class JnpEndpointTestCase extends AbstractMuleTestCase { public void testHostPortUrl() throws Exception { EndpointURI url = new MuleEndpointURI("jnp://localhost:1099"); url.initialise(); assertEquals("jnp", url.getScheme()); assertEquals("jnp://localhost:1099", url.getAddress()); assertNull(url.getEndpointName()); assertEquals(1099, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("jnp://localhost:1099", url.getAddress()); assertEquals(0, url.getParams().size()); } public void testQueryParams1() throws Exception { EndpointURI url = new MuleEndpointURI("jnp://localhost:1099/BeeShirtsjnpServer?method=testMethod"); url.initialise(); assertEquals("jnp", url.getScheme()); assertEquals("jnp://localhost:1099", url.getAddress()); assertEquals("/BeeShirtsjnpServer", url.getPath()); assertNull(url.getEndpointName()); assertEquals(1099, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("jnp://localhost:1099/BeeShirtsjnpServer?method=testMethod", url.toString()); assertEquals(1, url.getParams().size()); assertEquals("testMethod", url.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); } public void testQueryParams2() throws Exception { EndpointURI url = new MuleEndpointURI( "jnp://localhost:1099/BeeShirtsjnpServer?method=testMethod&endpointName=jnpProvider&blankParam="); url.initialise(); assertEquals("jnp", url.getScheme()); assertEquals("jnp://localhost:1099", url.getAddress()); assertEquals("/BeeShirtsjnpServer", url.getPath()); assertNotNull(url.getEndpointName()); assertEquals("jnpProvider", url.getEndpointName()); assertEquals(1099, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals( "jnp://localhost:1099/BeeShirtsjnpServer?method=testMethod&endpointName=jnpProvider&blankParam=", url.toString()); assertEquals("method=testMethod&endpointName=jnpProvider&blankParam=", url.getQuery()); assertEquals(3, url.getParams().size()); assertEquals("testMethod", url.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); assertEquals("", url.getParams().getProperty("blankParam")); } } mule-2.0.1/transports/rmi/src/test/java/org/mule/transport/jnp/JnpConnectorTestCase.java0000644000175000017500000000207610754365306031270 0ustar charlescharles/* * $Id: JnpConnectorTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jnp; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.jnp.JnpConnector; public class JnpConnectorTestCase extends AbstractConnectorTestCase { // @Override public Connector createConnector() throws Exception { JnpConnector c = new JnpConnector(); c.setName("JnpConnector"); c.setSecurityManager(null); return c; } public String getTestEndpointURI() { return "jnp://localhost:1099"; } public Object getValidMessage() throws Exception { return "Hello".getBytes(); } } mule-2.0.1/transports/rmi/src/test/java/org/mule/transport/jnp/JnpFunctionalTestCase.java0000644000175000017500000000126210745677442031443 0ustar charlescharles/* * $Id: JnpFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.jnp; import org.mule.transport.AbstractFunctionalTestCase; public class JnpFunctionalTestCase extends AbstractFunctionalTestCase { public JnpFunctionalTestCase() { super("jnp", "jnp-functional-test.xml"); } } mule-2.0.1/transports/rmi/src/test/java/org/mule/transport/AbstractFunctionalTestCase.java0000644000175000017500000001031310754375733031663 0ustar charlescharles/* * $Id: AbstractFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.transport.DispatchException; import org.mule.config.i18n.Message; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.rmi.i18n.RmiMessages; import java.util.HashMap; public abstract class AbstractFunctionalTestCase extends FunctionalTestCase { private String prefix; private String config; public AbstractFunctionalTestCase(String prefix, String config) { this.prefix = prefix; this.config = config; } // from earlier multiple target test case public void testCase() throws Exception { MuleClient client = new MuleClient(); // send Echo String MuleMessage message = client.send("vm://testin", new Integer(12), null); assertNotNull(message); Integer payload = (Integer)message.getPayload(); assertEquals(payload, new Integer(22)); // send String message = client.send("vm://testin", "test matching component first time", null); assertNotNull(message); assertEquals((String)message.getPayload(), "emit tsrif tnenopmoc gnihctam tset"); // send String message = client.send("vm://testin", "test mathching component second time", null); assertNotNull(message); assertEquals((String)message.getPayload(), "emit dnoces tnenopmoc gnihchtam tset"); // send Integer message = client.send("vm://testin", new Integer(15), null); assertNotNull(message); payload = (Integer)message.getPayload(); assertEquals(payload, new Integer(25)); } // from earlier invocation test case private MuleMessage send(String uri, String message) throws Exception { MuleClient client = new MuleClient(); return client.send(prefix + uri, message, new HashMap()); } public void testReverseString() throws Exception { MuleMessage message = send("://localhost/TestService?method=reverseString", "hello"); assertNotNull(message.getPayload()); assertEquals("olleh", message.getPayloadAsString()); } public void testUpperCaseString() throws Exception { MuleMessage message = send("://localhost/TestService?method=upperCaseString", "hello"); assertNotNull(message.getPayload()); assertEquals("HELLO", message.getPayloadAsString()); } public void testNoMethodSet() throws Exception { try { send("://localhost/TestService", "hello"); } catch (MuleException e) { assertTrue(e instanceof DispatchException); Message message = RmiMessages.messageParamServiceMethodNotSet(); assertTrue(e.getMessage().startsWith(message.toString())); } } public void testBadMethodName() throws Exception { try { send("://localhost/TestService?method=foo", "hello"); fail("expected error"); } catch (MuleException e) { assertTrue(e.getCause() instanceof NoSuchMethodException); } } protected String getConfigResources() { return config; } public void testBadMethodType() throws Exception { try { new MuleClient().send("BadType", "hello", null); fail("expected error"); } catch (MuleException e) { assertTrue(e.getCause() instanceof NoSuchMethodException); } } public void testCorrectMethodType() throws Exception { MuleMessage message = new MuleClient().send("GoodType", "hello", null); assertNotNull(message); assertEquals("olleh", message.getPayloadAsString()); } }mule-2.0.1/transports/rmi/src/test/java/org/mule/transport/issues/0000755000175000017500000000000011351410645025075 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/rmi/src/test/java/org/mule/transport/issues/RmiMethodTypeMule1857TestCase.javamule-2.0.1/transports/rmi/src/test/java/org/mule/transport/issues/RmiMethodTypeMule1857TestCase.java0000644000175000017500000000132210745677442033314 0ustar charlescharles/* * $Id: RmiMethodTypeMule1857TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.issues; import org.mule.transport.AbstractFunctionalTestCase; public class RmiMethodTypeMule1857TestCase extends AbstractFunctionalTestCase { public RmiMethodTypeMule1857TestCase() { super("rmi", "rmi-method-type-1857-test.xml"); } }mule-2.0.1/transports/rmi/src/test/java/org/mule/transport/rmi/0000755000175000017500000000000011351410645024351 5ustar charlescharlesmule-2.0.1/transports/rmi/src/test/java/org/mule/transport/rmi/RmiConnectorTestCase.java0000644000175000017500000000277410754365306031275 0ustar charlescharles/* * $Id: RmiConnectorTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.rmi.RmiConnector; public class RmiConnectorTestCase extends AbstractConnectorTestCase { // @Override public Connector createConnector() throws Exception { RmiConnector c = new RmiConnector(); c.setName("RmiConnector"); c.setSecurityManager(null); return c; } public String getTestEndpointURI() { return "rmi://localhost:1099"; } public Object getValidMessage() throws Exception { return "Hello".getBytes(); } public void testProperties() throws Exception { RmiConnector c = (RmiConnector)getConnector(); String securityPolicy = "rmi.policy"; String serverCodebase = "file:///E:/projects/MyTesting/JAVA/rmi/classes/"; c.setSecurityPolicy(securityPolicy); assertNotNull(c.getSecurityPolicy()); c.setServerCodebase(serverCodebase); assertEquals(serverCodebase, c.getServerCodebase()); } } mule-2.0.1/transports/rmi/src/test/java/org/mule/transport/rmi/RmiMessageAdapterTestCase.java0000644000175000017500000000204310754365306032215 0ustar charlescharles/* * $Id: RmiMessageAdapterTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.api.MessagingException; import org.mule.api.transport.MessageAdapter; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.transport.rmi.RmiMessageAdapter; public class RmiMessageAdapterTestCase extends AbstractMessageAdapterTestCase { public Object getValidMessage() throws Exception { return "Hello".getBytes(); } public MessageAdapter createAdapter(Object payload) throws MessagingException { return new RmiMessageAdapter(payload); } public Object getInvalidMessage() { return null; } } mule-2.0.1/transports/rmi/src/test/java/org/mule/transport/rmi/DummySecurityManager.java0000644000175000017500000000104110755041255031332 0ustar charlescharles/* * $Id: DummySecurityManager.java 10803 2008-02-14 13:31:25Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; public class DummySecurityManager extends SecurityManager { // nothing to do } mule-2.0.1/transports/rmi/src/test/java/org/mule/transport/rmi/RmiEndpointTestCase.java0000644000175000017500000000577410745677442031135 0ustar charlescharles/* * $Id: RmiEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class RmiEndpointTestCase extends AbstractMuleTestCase { public void testHostPortUrl() throws Exception { EndpointURI url = new MuleEndpointURI("rmi://localhost:1099"); url.initialise(); assertEquals("rmi", url.getScheme()); assertEquals("rmi://localhost:1099", url.getAddress()); assertNull(url.getEndpointName()); assertEquals(1099, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("rmi://localhost:1099", url.getAddress()); assertEquals(0, url.getParams().size()); } public void testQueryParams1() throws Exception { EndpointURI url = new MuleEndpointURI("rmi://localhost:1099/BeeShirtsRmiServer?method=testMethod"); url.initialise(); assertEquals("rmi", url.getScheme()); assertEquals("rmi://localhost:1099", url.getAddress()); assertEquals("/BeeShirtsRmiServer", url.getPath()); assertNull(url.getEndpointName()); assertEquals(1099, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("rmi://localhost:1099/BeeShirtsRmiServer?method=testMethod", url.toString()); assertEquals(1, url.getParams().size()); assertEquals("testMethod", url.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); } public void testQueryParams2() throws Exception { EndpointURI url = new MuleEndpointURI( "rmi://localhost:1099/BeeShirtsRmiServer?method=testMethod&endpointName=rmiProvider&blankParam="); url.initialise(); assertEquals("rmi", url.getScheme()); assertEquals("rmi://localhost:1099", url.getAddress()); assertEquals("/BeeShirtsRmiServer", url.getPath()); assertNotNull(url.getEndpointName()); assertEquals("rmiProvider", url.getEndpointName()); assertEquals(1099, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals( "rmi://localhost:1099/BeeShirtsRmiServer?method=testMethod&endpointName=rmiProvider&blankParam=", url.toString()); assertEquals("method=testMethod&endpointName=rmiProvider&blankParam=", url.getQuery()); assertEquals(3, url.getParams().size()); assertEquals("testMethod", url.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); assertEquals("", url.getParams().getProperty("blankParam")); } } mule-2.0.1/transports/rmi/src/test/java/org/mule/transport/rmi/MuleRMIFactory.java0000644000175000017500000000217210745677442030040 0ustar charlescharles/* * $Id: MuleRMIFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.jndi.MuleInitialContextFactory; import org.mule.tck.services.MatchingMethodsComponent; import org.mule.tck.services.SimpleMathsComponent; import javax.naming.InitialContext; public class MuleRMIFactory { public Object create() throws Exception { InitialContext ic = new InitialContext(); ic.addToEnvironment(InitialContext.INITIAL_CONTEXT_FACTORY, MuleInitialContextFactory.class.getName()); // Bind our service object ic.bind("SimpleMathsUMO", new SimpleMathsComponent()); ic.bind("MatchingUMO", new MatchingMethodsComponent()); ic.bind("TestService", new MatchingMethodsComponent()); return ic; } } mule-2.0.1/transports/rmi/src/test/java/org/mule/transport/rmi/RmiNamespaceHandlerTestCase.java0000644000175000017500000000450310745677442032534 0ustar charlescharles/* * $Id: RmiNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.tck.FunctionalTestCase; import org.mule.tck.jndi.InMemoryContext; import org.mule.transport.rmi.RmiConnector; public class RmiNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "rmi-namespace-config.xml"; } public void testConfig() throws Exception { RmiConnector c = (RmiConnector) muleContext.getRegistry().lookupConnector("rmiConnector"); assertNotNull(c); assertEquals(1234, c.getPollingFrequency()); assertEquals(DummySecurityManager.class, c.getSecurityManager().getClass()); String url = c.getSecurityPolicy(); assertNotNull(url); int index = url.lastIndexOf("/"); assertTrue(index > 0); assertEquals("rmi.policy", url.substring(index+1)); assertEquals("bcd", c.getServerClassName()); assertEquals("cde", c.getServerCodebase()); assertEquals("org.mule.tck.jndi.InMemoryContextFactory", c.getJndiInitialFactory()); assertEquals("efg", c.getJndiProviderUrl()); assertEquals("fgh", c.getJndiUrlPkgPrefixes()); assertEquals("hij", c.getJndiProviderProperties().get("ghi")); } public void testConfig2() throws Exception { RmiConnector c = (RmiConnector) muleContext.getRegistry().lookupConnector("rmiConnector2"); assertNotNull(c); assertEquals(1234, c.getPollingFrequency()); assertEquals(DummySecurityManager.class, c.getSecurityManager().getClass()); String url = c.getSecurityPolicy(); assertNotNull(url); int index = url.lastIndexOf("/"); assertTrue(index > 0); assertEquals("rmi.policy", url.substring(index+1)); assertEquals("bcd", c.getServerClassName()); assertEquals("cde", c.getServerCodebase()); assertTrue(c.getJndiContext() instanceof InMemoryContext); } } mule-2.0.1/transports/rmi/src/test/java/org/mule/transport/rmi/RmiFunctionalTestCase.java0000644000175000017500000000126210745677442031443 0ustar charlescharles/* * $Id: RmiFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.rmi; import org.mule.transport.AbstractFunctionalTestCase; public class RmiFunctionalTestCase extends AbstractFunctionalTestCase { public RmiFunctionalTestCase() { super("rmi", "rmi-functional-test.xml"); } } mule-2.0.1/transports/rmi/src/test/resources/0000755000175000017500000000000011351410645021066 5ustar charlescharlesmule-2.0.1/transports/rmi/src/test/resources/log4j.properties0000644000175000017500000000050210547540350024223 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/transports/rmi/src/test/resources/rmi-functional-test.xml0000644000175000017500000000456310745677442025544 0ustar charlescharles mule-2.0.1/transports/rmi/src/test/resources/rmi-method-type-1857-test.xml0000644000175000017500000000560110745677442026235 0ustar charlescharles mule-2.0.1/transports/rmi/src/test/resources/rmi.policy0000644000175000017500000000021610242002170023061 0ustar charlescharles/* AUTOMATICALLY GENERATED ON Tue May 03 13:51:07 CEST 2005*/ /* DO NOT EDIT */ grant { permission java.security.AllPermission; }; mule-2.0.1/transports/rmi/src/test/resources/jnp-functional-test.xml0000644000175000017500000000453510745677442025543 0ustar charlescharles mule-2.0.1/transports/rmi/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006310735201370025735 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/transports/rmi/src/test/resources/rmi-namespace-config.xml0000644000175000017500000000324010745677442025613 0ustar charlescharles mule-2.0.1/transports/rmi/pom.xml0000644000175000017500000000517611006063605016631 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-rmi RMI Transport A Mule transport for RMI Connectivity. org.apache.maven.plugins maven-jar-plugin test-jar org.mule mule-core ${version} org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test org.mule.transports mule-transport-vm ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.transport.rmi.* mule-2.0.1/transports/axis/0000755000175000017500000000000011351410663015463 5ustar charlescharlesmule-2.0.1/transports/axis/src/0000755000175000017500000000000011351410662016251 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/0000755000175000017500000000000011351410663017176 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/0000755000175000017500000000000011351410662020116 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/0000755000175000017500000000000011351410662020705 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/mule/0000755000175000017500000000000011351410662021647 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/mule/transport/0000755000175000017500000000000011351410662023703 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/0000755000175000017500000000000011351410662024645 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/0000755000175000017500000000000011351410663025612 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/package.html0000644000175000017500000000042010745677442030107 0ustar charlescharles Mule Provides an Axis soap transport for Mule. Managed objects can automatically be exposed as services just by subscribing to this provider. There is no need for service wsdd or even a servlet container. ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcherFactory.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcherFactory.j0000644000175000017500000000202210757615756033554 0ustar charlescharles/* * $Id: AxisMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * AxisMessageDispatcherFactory creates an AxisMessageDispatcher, used * for making SOAP calls using the Axis stack. */ public class AxisMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new AxisMessageDispatcher(endpoint); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisInitialisationCallback.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisInitialisationCallback.jav0000644000175000017500000000325210745677442033560 0ustar charlescharles/* * $Id: AxisInitialisationCallback.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.lifecycle.InitialisationCallback; import org.mule.api.lifecycle.InitialisationException; import org.apache.axis.handlers.soap.SOAPService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AxisInitialisationCallback is invoked when an Axis component is * created from its descriptor. */ public class AxisInitialisationCallback implements InitialisationCallback { protected static final Log logger = LogFactory.getLog(AxisInitialisationCallback.class); private SOAPService service; private boolean invoked = false; public AxisInitialisationCallback(SOAPService service) { this.service = service; } public void initialise(Object component) throws InitialisationException { // only call this once if (invoked) { return; } if (component instanceof AxisInitialisable) { if (logger.isDebugEnabled()) { logger.debug("Calling axis initialisation for component: " + component.getClass().getName()); } ((AxisInitialisable)component).initialise(service); } invoked = true; } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisFaultExceptionReader.java0000644000175000017500000000461410745677442033404 0ustar charlescharles/* * $Id: AxisFaultExceptionReader.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.config.ExceptionReader; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.axis.AxisFault; /** * Will format and display additional information stored with an Axis fault that is * usually hidden when logged. */ public class AxisFaultExceptionReader implements ExceptionReader { public String getMessage(Throwable t) { AxisFault e = (AxisFault)t; Map props = getInfo(e); StringBuffer msg = new StringBuffer(64); msg.append("("); for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry)iterator.next(); msg.append(entry.getKey()).append(": ").append(entry.getValue()).append(", "); } msg.append(")"); return e.getMessage() + msg.toString(); } public Throwable getCause(Throwable t) { AxisFault e = (AxisFault)t; Throwable cause = e.detail; if (cause == null) { cause = e.getCause(); } return cause; } public Class getExceptionType() { return AxisFault.class; } /** * Returns a map of the non-stanard information stored on the exception * * @return a map of the non-stanard information stored on the exception */ public Map getInfo(Throwable t) { AxisFault e = (AxisFault)t; Map info = new HashMap(); info.put("Fault", e.getFaultString()); info.put("Fault Code", e.getFaultCode().toString()); info.put("Fault Actor", e.getFaultActor()); info.put("Fault Node", e.getFaultNode()); info.put("Fault Reason", e.getFaultReason()); info.put("Fault Role", e.getFaultRole()); info.put("Fault Dump", e.dumpToString()); // Todo Do we need to out put headers and elements or are these part of the // dumpToString?? return info; } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisServiceComponent.java0000644000175000017500000007666410774254333032620 0ustar charlescharles/* * $Id: AxisServiceComponent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.MessagingException; import org.mule.api.MuleEventContext; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.MuleManifest; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; import org.mule.endpoint.MuleEndpointURI; import org.mule.transport.WriterMessageAdapter; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import org.mule.transport.soap.SoapConstants; import org.mule.transport.soap.axis.extensions.AxisMuleSession; import org.mule.transport.soap.axis.extensions.MuleConfigProvider; import org.mule.util.StringUtils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.StringWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.Map; import java.util.Properties; import javax.xml.namespace.QName; import org.apache.axis.AxisEngine; import org.apache.axis.AxisFault; import org.apache.axis.ConfigurationException; import org.apache.axis.Constants; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.description.OperationDesc; import org.apache.axis.description.ServiceDesc; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.i18n.Messages; import org.apache.axis.security.servlet.ServletSecurityProvider; import org.apache.axis.server.AxisServer; import org.apache.axis.transport.http.HTTPConstants; import org.apache.axis.transport.http.ServletEndpointContextImpl; import org.apache.axis.utils.Admin; import org.apache.axis.utils.XMLUtils; import org.apache.commons.logging.Log; import org.w3c.dom.Document; /** * AxisServiceComponent is a Mule component implementation of the Axis * servlet. This component supports all the features of the Axis servlet except - *
    *
  1. Jws class services are not supported as they don't add any value to the Mule * model
  2. *
  3. Currently there is no HttpSession support. This will be fixed when MuleSession * support is added to the Http Connector
  4. *
*/ public class AxisServiceComponent implements Initialisable, Callable { protected static final Log logger = org.apache.commons.logging.LogFactory.getLog(AxisServiceComponent.class); public static final String INIT_PROPERTY_TRANSPORT_NAME = "transport.name"; public static final String INIT_PROPERTY_USE_SECURITY = "use-servlet-security"; public static final String INIT_PROPERTY_ENABLE_LIST = "axis.enableListQuery"; public static final String DEFAULT_AXIS_HOME = "/axisHome"; private String transportName = "http"; private ServletSecurityProvider securityProvider = null; private boolean enableList = true; private String homeDir; private AxisServer axis; /** For IoC */ public AxisServiceComponent() { // do nothing } /** * Passes the context to the listener * * @param context the context to process * @return Object this object can be anything. When the * LifecycleAdapter for the component receives this * object it will first see if the Object is an MuleEvent * if not and the Object is not null a new context will be created using * the returned object as the payload. This new context will then get * published to the configured outbound endpoint if- *
    *
  1. One has been configured for the UMO.
  2. *
  3. the setStopFurtherProcessing(true) wasn't called * on the previous context.
  4. *
* @throws Exception if the context fails to process properly. If exceptions * aren't handled by the implementation they will be handled by the * exceptionListener associated with the component */ public Object onCall(MuleEventContext context) throws Exception { WriterMessageAdapter response = new WriterMessageAdapter(new StringWriter(4096)); String method = context.getMessage().getStringProperty(HttpConnector.HTTP_METHOD_PROPERTY, HttpConstants.METHOD_POST); if (HttpConstants.METHOD_GET.equalsIgnoreCase(method)) { doGet(context, response); } else { doPost(context, response); } response.getWriter().close(); return new DefaultMuleMessage(response); } public void initialise() throws InitialisationException { if (axis == null) { throw new InitialisationException(MessageFactory.createStaticMessage("No Axis instance, this component has not been initialized properly."), this); } } public void doGet(MuleEventContext context, WriterMessageAdapter response) throws MuleException, IOException { try { // We parse a new uri based on the listening host and port with the // request parameters appended // Using the soap prefix ensures that we use a soap endpoint builder EndpointURI endpointUri = context.getEndpointURI(); if (!"servlet".equalsIgnoreCase(context.getEndpointURI().getSchemeMetaInfo())) { String uri = SoapConstants.SOAP_ENDPOINT_PREFIX + context.getEndpointURI().getScheme() + "://" + context.getEndpointURI().getHost() + ":" + context.getEndpointURI().getPort(); uri += context.getMessage().getStringProperty(HttpConnector.HTTP_REQUEST_PROPERTY, ""); endpointUri = new MuleEndpointURI(uri); endpointUri.initialise(); } AxisEngine engine = getAxis(); String pathInfo = endpointUri.getPath(); boolean wsdlRequested = false; boolean listRequested = false; if (endpointUri.getAddress().endsWith(".jws")) { throw new AxisFault("Jws not supported by the Mule Axis service"); } String queryString = endpointUri.getQuery(); if (queryString != null) { if (queryString.equalsIgnoreCase(SoapConstants.WSDL_PROPERTY)) { wsdlRequested = true; } else { if (queryString.equalsIgnoreCase(SoapConstants.LIST_PROPERTY)) { listRequested = true; } } } boolean hasNoPath = (StringUtils.isEmpty(pathInfo) || pathInfo.equals("/")); if (!wsdlRequested && !listRequested && hasNoPath) { reportAvailableServices(context, response); } else { MessageContext msgContext = new MessageContext(engine); populateMessageContext(msgContext, context, endpointUri); msgContext.setProperty("transport.url", endpointUri.toString()); if (wsdlRequested) { processWsdlRequest(msgContext, response); } else if (listRequested) { processListRequest(response); } else { processMethodRequest(msgContext, context, response, endpointUri); } } } catch (AxisFault fault) { reportTroubleInGet(fault, response); } catch (Exception e) { reportTroubleInGet(e, response); } } private void reportTroubleInGet(Exception exception, WriterMessageAdapter response) { response.setProperty(HttpConstants.HEADER_CONTENT_TYPE, "text/html"); response.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, "500"); response.write("

" + Messages.getMessage("error00") + "

"); response.write("

" + Messages.getMessage("somethingWrong00") + "

"); if (exception instanceof AxisFault) { AxisFault fault = (AxisFault)exception; processAxisFault(fault); writeFault(response, fault); } else { logger.error(exception.getMessage(), exception); response.write("
Exception - " + exception + "
"); response.write("
"); } } protected void processAxisFault(AxisFault fault) { org.w3c.dom.Element runtimeException = fault .lookupFaultDetail(Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION); if (runtimeException != null) { logger.info(Messages.getMessage("axisFault00"), fault); fault.removeFaultDetail(Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION); } else if (logger.isDebugEnabled()) { logger.debug(Messages.getMessage("axisFault00"), fault); } } private void writeFault(WriterMessageAdapter response, AxisFault axisFault) { String localizedMessage = XMLUtils.xmlEncodeString(axisFault.getLocalizedMessage()); response.write("
Fault - " + localizedMessage + "
"); response.write(axisFault.dumpToString()); response.write("
"); } protected void processMethodRequest(MessageContext msgContext, MuleEventContext context, WriterMessageAdapter response, EndpointURI endpointUri) throws AxisFault { Properties params = endpointUri.getUserParams(); String method = (String)params.remove(MuleProperties.MULE_METHOD_PROPERTY); if (method == null) { method = endpointUri.getPath().substring(endpointUri.getPath().lastIndexOf("/") + 1); } StringBuffer args = new StringBuffer(64); Map.Entry entry; for (Iterator iterator = params.entrySet().iterator(); iterator.hasNext();) { entry = (Map.Entry)iterator.next(); args.append("<").append(entry.getKey()).append(">"); args.append(entry.getValue()); args.append(""); } if (method == null) { response.setProperty(HttpConstants.HEADER_CONTENT_TYPE, "text/html"); response.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, "400"); response.write("

" + Messages.getMessage("error00") + ": " + Messages.getMessage("invokeGet00") + "

"); response.write("

" + Messages.getMessage("noMethod01") + "

"); } else { invokeEndpointFromGet(msgContext, response, method, args.toString()); } } protected void processWsdlRequest(MessageContext msgContext, WriterMessageAdapter response) throws AxisFault { AxisEngine engine = getAxis(); try { engine.generateWSDL(msgContext); Document doc = (Document)msgContext.getProperty("WSDL"); if (doc != null) { response.setProperty(HttpConstants.HEADER_CONTENT_TYPE, "text/xml"); XMLUtils.DocumentToWriter(doc, response.getWriter()); } else { if (logger.isDebugEnabled()) { logger.debug("processWsdlRequest: failed to create WSDL"); } reportNoWSDL(response, "noWSDL02", null); } } catch (AxisFault axisFault) { if (axisFault.getFaultCode().equals(Constants.QNAME_NO_SERVICE_FAULT_CODE)) { processAxisFault(axisFault); response.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, "404"); reportNoWSDL(response, "noWSDL01", axisFault); } else { throw axisFault; } } } protected void invokeEndpointFromGet(MessageContext msgContext, WriterMessageAdapter response, String method, String args) throws AxisFault { String body = "<" + method + ">" + args + ""; String msgtxt = "" + body + "" + ""; Message responseMsg = null; try { ByteArrayInputStream istream = new ByteArrayInputStream(msgtxt.getBytes("ISO-8859-1")); AxisEngine engine = getAxis(); Message msg = new Message(istream, false); msgContext.setRequestMessage(msg); AxisServiceProxy.setProperties(RequestContext.getEvent().getEndpoint().getProperties()); engine.invoke(msgContext); responseMsg = msgContext.getResponseMessage(); response.setProperty(HTTPConstants.HEADER_CACHE_CONTROL, "no-cache"); response.setProperty(HTTPConstants.HEADER_PRAGMA, "no-cache"); if (responseMsg == null) { throw new Exception(Messages.getMessage("noResponse01")); } } catch (AxisFault fault) { processAxisFault(fault); configureResponseFromAxisFault(response, fault); responseMsg = new Message(fault); } catch (Exception e) { response.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, "500"); responseMsg = convertExceptionToAxisFault(e, responseMsg); } response.setProperty(HTTPConstants.HEADER_CONTENT_TYPE, "text/xml"); response.write(responseMsg.getSOAPPartAsString()); } protected void reportServiceInfo(WriterMessageAdapter response, SOAPService service, String serviceName) { response.setProperty(HttpConstants.HEADER_CONTENT_TYPE, "text/html"); response.write("

" + service.getName() + "

"); response.write("

" + Messages.getMessage("axisService00") + "

"); response.write("" + Messages.getMessage("perhaps00") + ""); } protected void processListRequest(WriterMessageAdapter response) throws AxisFault { AxisEngine engine = getAxis(); response.setProperty(HTTPConstants.HEADER_CONTENT_TYPE, "text/html"); if (enableList) { Document doc = Admin.listConfig(engine); if (doc != null) { XMLUtils.DocumentToWriter(doc, response.getWriter()); } else { response.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, "404"); response.write("

" + Messages.getMessage("error00") + "

"); response.write("

" + Messages.getMessage("noDeploy00") + "

"); } } else { response.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, "403"); response.write("

" + Messages.getMessage("error00") + "

"); response.write("

?list " + Messages.getMessage("disabled00") + "

"); } } private void reportNoWSDL(WriterMessageAdapter response, String moreDetailCode, AxisFault axisFault) { response.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, "404"); response.setProperty(HTTPConstants.HEADER_CONTENT_TYPE, "text/html"); response.write("

" + Messages.getMessage("error00") + "

"); response.write("

" + Messages.getMessage("noWSDL00") + "

"); if (moreDetailCode != null) { response.write("

" + Messages.getMessage(moreDetailCode) + "

"); } } protected void reportAvailableServices(MuleEventContext context, WriterMessageAdapter response) throws ConfigurationException, AxisFault { AxisEngine engine = getAxis(); response.setProperty(HttpConstants.HEADER_CONTENT_TYPE, "text/html"); response.write("

And now... Some Services

"); String version = MuleManifest.getProductVersion(); if (version == null) { version = "Version Not Set"; } response.write("
(Mule - " + version + ")
"); Iterator i; try { response .write("
Mule Component ServicesAxis Services
"); i = engine.getConfig().getDeployedServices(); listServices(i, response); response.write(""); i = ((MuleConfigProvider)engine.getConfig()).getAxisDeployedServices(); listServices(i, response); response.write("
"); } catch (ConfigurationException configException) { if (configException.getContainedException() instanceof AxisFault) { throw (AxisFault)configException.getContainedException(); } else { throw configException; } } } private void listServices(Iterator i, WriterMessageAdapter response) { response.write("
    "); while (i.hasNext()) { ServiceDesc sd = (ServiceDesc)i.next(); StringBuffer sb = new StringBuffer(512); sb.append("
  • "); String name = sd.getName(); sb.append(name); sb.append(" (wsdl)
  • "); response.write(sb.toString()); if (sd.getDocumentation() != null) { response.write("
      " + sd.getDocumentation() + "
    "); } ArrayList operations = sd.getOperations(); if (!operations.isEmpty()) { response.write("
      "); OperationDesc desc; for (Iterator it = operations.iterator(); it.hasNext();) { desc = (OperationDesc)it.next(); response.write("
    • " + desc.getName()); } response.write("
    "); } } response.write("
"); } protected void reportCantGetAxisService(MuleEventContext context, WriterMessageAdapter response) { response.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, "404"); response.setProperty(HttpConstants.HEADER_CONTENT_TYPE, "text/html"); response.write("

" + Messages.getMessage("error00") + "

"); response.write("

" + Messages.getMessage("noService06") + "

"); } protected void doPost(MuleEventContext context, WriterMessageAdapter response) throws Exception { String soapAction; Message responseMsg; AxisEngine engine = getAxis(); if (engine == null) { throw new MessagingException(CoreMessages.objectIsNull("Axis Engine"), context.getMessage()); } MessageContext msgContext = new MessageContext(engine); String contentType; try { EndpointURI endpointUri = getEndpoint(context); populateMessageContext(msgContext, context, endpointUri); if (securityProvider != null) { if (logger.isDebugEnabled()) { logger.debug("securityProvider:" + securityProvider); } msgContext.setProperty("securityProvider", securityProvider); } Object request = context.transformMessage(); if (request instanceof File) { request = new FileInputStream((File)request); } else if (request instanceof byte[]) { request = new ByteArrayInputStream((byte[])request); } Message requestMsg = new Message(request, false, context.getMessage().getStringProperty( HTTPConstants.HEADER_CONTENT_TYPE, null), context.getMessage().getStringProperty( HTTPConstants.HEADER_CONTENT_LOCATION, null)); if (logger.isDebugEnabled()) { logger.debug("Request Message:" + requestMsg); } msgContext.setRequestMessage(requestMsg); msgContext.setProperty("transport.url", endpointUri.toString()); soapAction = getSoapAction(context); if (soapAction != null) { msgContext.setUseSOAPAction(true); msgContext.setSOAPActionURI(soapAction); } msgContext.setSession(new AxisMuleSession(context.getSession())); if (logger.isDebugEnabled()) { logger.debug("Invoking Axis Engine."); } AxisServiceProxy.setProperties(RequestContext.getEvent().getEndpoint().getProperties()); engine.invoke(msgContext); if (logger.isDebugEnabled()) { logger.debug("Return from Axis Engine."); } if (RequestContext.getExceptionPayload() instanceof Exception) { throw (Exception)RequestContext.getExceptionPayload().getException(); } // remove temporary file used for soap message with attachment if (request instanceof File) { ((File)request).delete(); } responseMsg = msgContext.getResponseMessage(); if (responseMsg == null) { throw new Exception(Messages.getMessage("noResponse01")); } } catch (AxisFault fault) { logger.error(fault.toString() + " target service is: " + msgContext.getTargetService() + ". MuleEvent is: " + context.toString(), fault); processAxisFault(fault); configureResponseFromAxisFault(response, fault); responseMsg = msgContext.getResponseMessage(); if (responseMsg == null) { responseMsg = new Message(fault); } } catch (Exception e) { responseMsg = msgContext.getResponseMessage(); response.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, "500"); responseMsg = convertExceptionToAxisFault(e, responseMsg); } contentType = responseMsg.getContentType(msgContext.getSOAPConstants()); sendResponse(contentType, response, responseMsg); if (logger.isDebugEnabled()) { logger.debug("Response sent."); } } private EndpointURI getEndpoint(MuleEventContext context) throws EndpointException { String endpoint = context.getEndpointURI().getAddress(); String request = context.getMessage().getStringProperty(HttpConnector.HTTP_REQUEST_PROPERTY, null); if (request != null) { int i = endpoint.indexOf("/", endpoint.indexOf("://") + 3); if (i > -1) { endpoint = endpoint.substring(0, i); } endpoint += request; return new MuleEndpointURI(endpoint); } return context.getEndpointURI(); } private void configureResponseFromAxisFault(WriterMessageAdapter response, AxisFault fault) { int status = getHttpResponseStatus(fault); if (status == 401) { response.setProperty(HttpConstants.HEADER_WWW_AUTHENTICATE, "Basic realm=\"AXIS\""); } response.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, String.valueOf(status)); } private Message convertExceptionToAxisFault(Exception exception, Message responseMsg) { logger.error(exception.getMessage(), exception); if (responseMsg == null) { AxisFault fault = AxisFault.makeFault(exception); processAxisFault(fault); responseMsg = new Message(fault); } return responseMsg; } protected int getHttpResponseStatus(AxisFault af) { return af.getFaultCode().getLocalPart().startsWith("Server.Unauth") ? 401 : '\u01F4'; } private void sendResponse(String contentType, WriterMessageAdapter response, Message responseMsg) throws Exception { if (responseMsg == null) { response.setProperty(HttpConnector.HTTP_STATUS_PROPERTY, "204"); if (logger.isDebugEnabled()) { logger.debug("NO AXIS MESSAGE TO RETURN!"); } } else { if (logger.isDebugEnabled()) { logger.debug("Returned Content-Type:" + contentType); } response.setProperty(HttpConstants.HEADER_CONTENT_TYPE, contentType); ByteArrayOutputStream baos = new ByteArrayOutputStream(8192); responseMsg.writeTo(baos); response.write(baos.toString()); } } private void populateMessageContext(MessageContext msgContext, MuleEventContext context, EndpointURI endpointUri) throws AxisFault, ConfigurationException { MuleMessage msg = context.getMessage(); if (logger.isDebugEnabled()) { logger.debug("MessageContext:" + msgContext); logger.debug("HEADER_CONTENT_TYPE:" + msg.getStringProperty(HttpConstants.HEADER_CONTENT_TYPE, null)); logger.debug("HEADER_CONTENT_LOCATION:" + msg.getStringProperty(HttpConstants.HEADER_CONTENT_LOCATION, null)); logger.debug("Constants.MC_HOME_DIR:" + String.valueOf(getHomeDir())); logger.debug("Constants.MC_RELATIVE_PATH:" + endpointUri.getPath()); logger.debug("HTTPConstants.HEADER_AUTHORIZATION:" + msg.getStringProperty("Authorization", null)); logger.debug("Constants.MC_REMOTE_ADDR:" + endpointUri.getHost()); } msgContext.setTransportName(transportName); msgContext.setProperty("home.dir", getHomeDir()); msgContext.setProperty("path", endpointUri.getPath()); msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLET, this); msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETLOCATION, endpointUri.getPath()); // determine service name String serviceName = getServiceName(context, endpointUri); // Validate Service path against request path SOAPService service = msgContext.getAxisEngine().getConfig().getService( new QName(serviceName.substring(1))); // if using jms or vm we can skip this if (!("vm".equalsIgnoreCase(endpointUri.getScheme()) || "jms".equalsIgnoreCase(endpointUri.getScheme()))) { // Component Name is set by Mule so if its null we can skip this check if (service.getOption(AxisConnector.SERVICE_PROPERTY_COMPONENT_NAME) != null) { String servicePath = (String)service.getOption("servicePath"); if (StringUtils.isEmpty(endpointUri.getPath())) { if (!("/" + endpointUri.getAddress()).startsWith(servicePath + serviceName)) { throw new AxisFault("Failed to find service: " + "/" + endpointUri.getAddress()); } } else if (!endpointUri.getPath().startsWith(servicePath + serviceName)) { throw new AxisFault("Failed to find service: " + endpointUri.getPath()); } } } msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETPATHINFO, serviceName); msgContext.setProperty("serviceName", serviceName); msgContext.setProperty("Authorization", msg.getStringProperty("Authorization", null)); msgContext.setProperty("remoteaddr", endpointUri.getHost()); ServletEndpointContextImpl sec = new ServletEndpointContextImpl(); msgContext.setProperty("servletEndpointContext", sec); } private String getSoapAction(MuleEventContext context) throws AxisFault { String soapAction = context.getMessage().getStringProperty(SoapConstants.SOAP_ACTION_PROPERTY_CAPS, null); if (logger.isDebugEnabled()) { logger.debug("Header Soap Action:" + soapAction); } if (StringUtils.isEmpty(soapAction)) { soapAction = context.getEndpointURI().getAddress(); } return soapAction; } protected String getServiceName(MuleEventContext context, EndpointURI endpointUri) throws AxisFault { String serviceName = endpointUri.getPath(); if (StringUtils.isEmpty(serviceName)) { serviceName = getSoapAction(context); serviceName = serviceName.replaceAll("\"", ""); int i = serviceName.indexOf("/", serviceName.indexOf("//")); if (i < -1) { serviceName = serviceName.substring(i + 2); } } int i = serviceName.lastIndexOf('/'); if (i > -1) { serviceName = serviceName.substring(i); } i = serviceName.lastIndexOf('?'); if (i > -1) { serviceName = serviceName.substring(0, i); } return serviceName; } public String getTransportName() { return transportName; } public void setTransportName(String transportName) { this.transportName = transportName; } public boolean isEnableList() { return enableList; } public void setEnableList(boolean enableList) { this.enableList = enableList; } public String getHomeDir() { if (homeDir == null) { //TODO fix homeDir = RegistryContext.getConfiguration().getWorkingDirectory() + DEFAULT_AXIS_HOME; homeDir = DEFAULT_AXIS_HOME; } return homeDir; } public void setHomeDir(String homeDir) { this.homeDir = homeDir; } public AxisServer getAxis() { return axis; } public void setAxis(AxisServer axisServer) { this.axis = axisServer; } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisServiceProxy.java0000644000175000017500000002132710766654216031766 0ustar charlescharles/* * $Id: AxisServiceProxy.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.ExceptionPayload; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.component.JavaComponent; import org.mule.api.config.MuleProperties; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.service.Service; import org.mule.api.transport.MessageAdapter; import org.mule.config.ExceptionHelper; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.soap.SoapConstants; import org.mule.transport.soap.axis.extras.AxisCleanAndAddProperties; import org.mule.util.ClassUtils; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; /** * ServiceProxy is a proxy that wraps a soap endpointUri to look like * a Web service. Also provides helper methods for building and describing web * service interfaces in Mule. */ public class AxisServiceProxy { private static ThreadLocal properties = new ThreadLocal(); public static Object createProxy(AbstractMessageReceiver receiver, boolean synchronous, Class[] classes) { final ClassLoader cl = Thread.currentThread().getContextClassLoader(); return Proxy.newProxyInstance(cl, classes, createServiceHandler(receiver, synchronous)); } public static InvocationHandler createServiceHandler(AbstractMessageReceiver receiver, boolean synchronous) { return new AxisServiceHandler(receiver, synchronous); } private static class AxisServiceHandler implements InvocationHandler { private AbstractMessageReceiver receiver; private boolean synchronous = true; public AxisServiceHandler(AbstractMessageReceiver receiver, boolean synchronous) { this.receiver = receiver; this.synchronous = synchronous; } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { MessageAdapter messageAdapter = receiver.getConnector().getMessageAdapter(args); messageAdapter.setProperty(MuleProperties.MULE_METHOD_PROPERTY, method); // add all custom headers, filter out all mule headers (such as // MULE_SESSION) except // for MULE_USER header. Filter out other headers like "soapMethods" and // MuleProperties.MULE_METHOD_PROPERTY and "soapAction" // and also filter out any http related header messageAdapter.addProperties(AxisCleanAndAddProperties.cleanAndAdd(RequestContext.getEventContext())); MuleMessage message = receiver.routeMessage(new DefaultMuleMessage(messageAdapter), synchronous); if (message != null) { ExceptionPayload wsException = message.getExceptionPayload(); if (wsException != null) { MuleException umoException = ExceptionHelper.getRootMuleException(wsException.getException()); // if the exception has a cause, then throw only the cause if (umoException.getCause() != null) { throw umoException.getCause(); } else { throw umoException; } } return message.getPayload(); } else { return null; } } } /* This is a horrible hack, which is axis-specific (no general classes are affected). It was added to allow service interface to be configured on endpoints. The reason it needs to be via a global thread local is that: - the routine getInterfacesForComponent is called from "callback" objects, of which at least one is set in the axis connector. So the endpoint properties are unavailable when set. - the information passed to the callback is sufficient to identify the component, but not the endpoint, and we would like this configuration to be endpoint specific for two reasons: (i) it is more flexible and (ii) we want to avoid transport specific config on the component (setting it on the connector is way too constraining) - the only other solution (which also uses thread local globals) would be to use the request context, but this is called, amongst other places, from the create() method of the axis message receiver, so no request context is currently in scope. I apologise for this poor code, but after discussing it with rest of the 2.x team we decided that if it worked, it was probably sufficient, since axis 1 support is largely legacy-based. AC. */ public static void setProperties(Map properties) { AxisServiceProxy.properties.set(properties); } public static Class[] getInterfacesForComponent(Service service) throws MuleException, ClassNotFoundException { Class[] interfaces; List ifaces = null; Map localProperties = (Map) properties.get(); if (null != localProperties) { ifaces = (List) localProperties.get(SoapConstants.SERVICE_INTERFACES); } if (ifaces == null || ifaces.size() == 0) { final Class implementationClass; if (service.getComponent() instanceof JavaComponent) { try { implementationClass = ((JavaComponent) service.getComponent()).getObjectType(); } catch (Exception e) { throw new ClassNotFoundException("Unable to retrieve class from service factory", e); } } else { throw new ClassNotFoundException("Unable to retrieve class from service factory"); } // get all implemented interfaces from superclasses as well final List intfList = ClassUtils.getAllInterfaces(implementationClass); interfaces = (Class[])intfList.toArray(new Class[intfList.size()]); } else { interfaces = new Class[ifaces.size()]; for (int i = 0; i < ifaces.size(); i++) { String iface = (String)ifaces.get(i); interfaces[i] = ClassUtils.loadClass(iface, AxisServiceProxy.class); } } interfaces = removeInterface(interfaces, Callable.class); interfaces = removeInterface(interfaces, Disposable.class); interfaces = removeInterface(interfaces, Initialisable.class); return interfaces; } public static Class[] removeInterface(Class[] interfaces, Class iface) { if (interfaces == null) { return null; } List results = new ArrayList(); for (int i = 0; i < interfaces.length; i++) { Class anInterface = interfaces[i]; if (!anInterface.equals(iface)) { results.add(anInterface); } } Class[] arResults = new Class[results.size()]; if (arResults.length == 0) { return arResults; } else { results.toArray(arResults); return arResults; } } public static Method[] getMethods(Class[] interfaces) { List methodNames = new ArrayList(); for (int i = 0; i < interfaces.length; i++) { methodNames.addAll(Arrays.asList(interfaces[i].getMethods())); } Method[] results = new Method[methodNames.size()]; return (Method[])methodNames.toArray(results); } public static String[] getMethodNames(Class[] interfaces) { Method[] methods = getMethods(interfaces); String[] results = new String[methods.length]; for (int i = 0; i < results.length; i++) { results[i] = methods[i].getName(); } return results; } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageRequester.java0000644000175000017500000001244110757615756032613 0ustar charlescharles/* * $Id: AxisMessageRequester.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.endpoint.MuleEndpointURI; import org.mule.transport.AbstractMessageRequester; import java.util.Iterator; import java.util.Properties; import javax.xml.soap.SOAPEnvelope; import org.apache.axis.AxisProperties; import org.apache.axis.EngineConfiguration; import org.apache.axis.Message; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.configuration.FileProvider; /** * AxisMessageDispatcher is used to make soap requests via the Axis * soap client. */ public class AxisMessageRequester extends AbstractMessageRequester { protected EngineConfiguration clientConfig; protected AxisConnector connector; protected Service service; public AxisMessageRequester(InboundEndpoint endpoint) { super(endpoint); this.connector = (AxisConnector)endpoint.getConnector(); AxisProperties.setProperty("axis.doAutoTypes", Boolean.toString(connector.isDoAutoTypes())); } protected void doConnect() throws Exception { if (service == null) { service = createService(endpoint); } } protected void doDisconnect() throws Exception { if (service != null) { service = null; } } protected void doDispose() { // template method } protected synchronized EngineConfiguration getClientConfig(ImmutableEndpoint endpoint) { if (clientConfig == null) { // Allow the client config to be set on the endpoint String config; config = (String)endpoint.getProperty(AxisConnector.AXIS_CLIENT_CONFIG_PROPERTY); if (config != null) { clientConfig = new FileProvider(config); } else { clientConfig = connector.getClientProvider(); } } return clientConfig; } protected Service createService(ImmutableEndpoint endpoint) throws Exception { // Create a simple axis service without wsdl EngineConfiguration config = getClientConfig(endpoint); return new Service(config); } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal cuases an exception */ protected MuleMessage doRequest(long timeout) throws Exception { Call call = new Call(service); String uri = endpoint.getEndpointURI().toString(); call.setSOAPActionURI(uri); call.setTargetEndpointAddress(uri); Properties params = endpoint.getEndpointURI().getUserParams(); String method = (String)params.remove(MuleProperties.MULE_METHOD_PROPERTY); call.setOperationName(method); String args[] = new String[params.size()]; int i = 0; for (Iterator iterator = params.values().iterator(); iterator.hasNext(); i++) { args[i] = iterator.next().toString(); } call.setOperationName(method); call.setProperty(MuleProperties.MULE_ENDPOINT_PROPERTY, endpoint); Object result = call.invoke(method, args); return AxisMessageDispatcher.createMessage(result, call); } public MuleMessage request(String endpoint, Object[] args) throws Exception { Call call = new Call(service); call.setSOAPActionURI(endpoint); call.setTargetEndpointAddress(endpoint); if (!endpoint.startsWith("axis:")) { endpoint = "axis:" + endpoint; } EndpointURI ep = new MuleEndpointURI(endpoint); String method = (String)ep.getParams().remove(MuleProperties.MULE_METHOD_PROPERTY); call.setOperationName(method); call.setOperationName(method); Object result = call.invoke(method, args); return AxisMessageDispatcher.createMessage(result, call); } public MuleMessage request(String endpoint, SOAPEnvelope envelope) throws Exception { Call call = new Call(service); call.setSOAPActionURI(endpoint); call.setTargetEndpointAddress(endpoint); Object result = call.invoke(new Message(envelope)); return AxisMessageDispatcher.createMessage(result, call); } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/wsdl/0000755000175000017500000000000011351410663026563 5ustar charlescharles././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/wsdl/AxisWsdlMessageDispatcher.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/wsdl/AxisWsdlMessageDispatcher0000644000175000017500000000611510757615756033606 0ustar charlescharles/* * $Id: AxisWsdlMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.wsdl; import org.mule.api.MuleEvent; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.transport.soap.SoapConstants; import org.mule.transport.soap.axis.AxisMessageDispatcher; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; import javax.xml.namespace.QName; import org.apache.axis.client.AxisClient; import org.apache.axis.client.Service; import org.apache.axis.wsdl.gen.Parser; import org.apache.axis.wsdl.symbolTable.ServiceEntry; import org.apache.axis.wsdl.symbolTable.SymTabEntry; /** * Creates and Axis client services from WSDL and invokes it. */ public class AxisWsdlMessageDispatcher extends AxisMessageDispatcher { public AxisWsdlMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); } protected Service createService(MuleEvent event) throws Exception { String wsdlUrl = event.getEndpoint().getEndpointURI().getAddress(); // Parse the wsdl Parser parser = new Parser(); if (event.getEndpoint().getEndpointURI().getUserInfo() != null) { parser.setUsername(event.getEndpoint().getEndpointURI().getUser()); parser.setPassword(event.getEndpoint().getEndpointURI().getPassword()); } parser.run(wsdlUrl); // Retrieves the defined services Map map = parser.getSymbolTable().getHashMap(); List entries = new ArrayList(); for (Iterator it = map.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry)it.next(); Vector v = (Vector)entry.getValue(); for (Iterator it2 = v.iterator(); it2.hasNext();) { SymTabEntry e = (SymTabEntry)it2.next(); if (ServiceEntry.class.isInstance(e)) { entries.add(entry.getKey()); } } } // Currently, only one service should be defined if (entries.size() != 1) { throw new Exception("Need one and only one service entry, found " + entries.size()); } // Create the axis service Service service = new Service(parser, (QName)entries.get(0)); service.setEngineConfiguration(clientConfig); service.setEngine(new AxisClient(clientConfig)); // Really the Axis Client service should set this stuff event.getMessage().setProperty(SoapConstants.METHOD_NAMESPACE_PROPERTY, parser.getCurrentDefinition().getTargetNamespace()); // Todo how can we autogenerate the named params from the WSDL? return service; } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/wsdl/AxisWsdlConnector.java0000644000175000017500000000265310745677442033065 0ustar charlescharles/* * $Id: AxisWsdlConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.wsdl; import org.mule.transport.soap.axis.AxisConnector; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * TODO document */ public class AxisWsdlConnector extends AxisConnector { protected void registerProtocols() { // Default supported schemes, these can be restricted // through configuration List schemes = new ArrayList(); schemes.add("http"); schemes.add("https"); setSupportedSchemes(schemes); for (Iterator iterator = schemes.iterator(); iterator.hasNext();) { String s = (String)iterator.next(); registerSupportedProtocol(s); } // This allows the generic WSDL provider to created endpoints using this // connector registerSupportedProtocolWithoutPrefix("wsdl:http"); registerSupportedProtocolWithoutPrefix("wsdl:https"); } public String getProtocol() { return "wsdl-axis"; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/wsdl/AxisWsdlMessageDispatcherFactory.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/wsdl/AxisWsdlMessageDispatcher0000644000175000017500000000173410757615756033610 0ustar charlescharles/* * $Id: AxisWsdlMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.wsdl; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * Creates an WSDL Message dispatcher using the Axis client */ public class AxisWsdlMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new AxisWsdlMessageDispatcher(endpoint); } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/0000755000175000017500000000000011351410662030010 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/MuleMsgProvider.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/MuleMsgProvider.jav0000644000175000017500000001345310746275214033615 0ustar charlescharles/* * $Id: MuleMsgProvider.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.extensions; import org.mule.RegistryContext; import org.mule.RequestContext; import org.mule.api.service.Service; import org.mule.transport.soap.axis.AxisConnector; import org.mule.transport.soap.axis.AxisMessageReceiver; import org.mule.transport.soap.axis.AxisServiceProxy; import java.lang.reflect.Proxy; import org.apache.axis.AxisFault; import org.apache.axis.Constants; import org.apache.axis.MessageContext; import org.apache.axis.description.OperationDesc; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.providers.java.MsgProvider; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleMsgProvider is an Axis service endpoint that builds services * from Mule managed components. */ public class MuleMsgProvider extends MsgProvider { /** * Serial version */ private static final long serialVersionUID = -4399291846942449361L; private AxisConnector connector; private static Log logger = LogFactory.getLog(MuleMsgProvider.class); private String METHOD_BODYARRAY = "soapbodyelement"; private String METHOD_ELEMENTARRAY = "element"; private String METHOD_DOCUMENT = "document"; public MuleMsgProvider(AxisConnector connector) { this.connector = connector; } protected Object makeNewServiceObject(MessageContext messageContext, String s) throws Exception { String transUrl = (String)messageContext.getProperty("transport.url"); int i = transUrl.indexOf('?'); if (i > -1) { transUrl = transUrl.substring(0, i); } AxisMessageReceiver receiver = (AxisMessageReceiver)connector.lookupReceiver(transUrl); if (receiver == null) { receiver = (AxisMessageReceiver)connector.lookupReceiver(messageContext.getTargetService()); } if (receiver == null) { throw new AxisFault("Could not find Mule registered service: " + s); } Class[] classes = AxisServiceProxy.getInterfacesForComponent(receiver.getService()); return AxisServiceProxy.createProxy(receiver, true, classes); } protected Class getServiceClass(String s, SOAPService soapService, MessageContext messageContext) throws AxisFault { Service component = RegistryContext.getRegistry().lookupService(soapService.getName()); try { Class[] classes = AxisServiceProxy.getInterfacesForComponent(component); return Proxy.getProxyClass(Thread.currentThread().getContextClassLoader(), classes); } catch (Exception e) { throw new AxisFault("Failed to implementation class for component: " + e.getMessage(), e); } } /** * @param msgContext * @deprecated I dont think this is necessary, but leaving it here for a while */ protected void setOperationStyle(MessageContext msgContext) { /* * Axis requires that the OperationDesc.operationStyle be set to match the * method signature This does not appear to be an automated process so * determine from the 4 allowed forms public Element [] method(Element [] * bodies); public SOAPBodyElement [] method (SOAPBodyElement [] bodies); * public Document method(Document body); public void method(SOAPEnvelope * req, SOAPEnvelope resp); */ int methodType = msgContext.getOperation().getMessageOperationStyle(); if (methodType > -1) { // Already set, nothing more to do return; } OperationDesc operation = msgContext.getOperation(); String methodSignature = operation.getMethod().toString().toLowerCase(); if (methodSignature.indexOf(METHOD_BODYARRAY) != -1) { methodType = OperationDesc.MSG_METHOD_BODYARRAY; } else if (methodSignature.indexOf(METHOD_ELEMENTARRAY) != -1) { methodType = OperationDesc.MSG_METHOD_ELEMENTARRAY; } else if (methodSignature.indexOf(METHOD_DOCUMENT) != -1) { methodType = OperationDesc.MSG_METHOD_DOCUMENT; } else { methodType = OperationDesc.MSG_METHOD_SOAPENVELOPE; } operation.setMessageOperationStyle(methodType); logger.debug("Now Invoking service (Method Format) " + operation.getMethod().toString()); logger.debug("Now Invoking service (MethodType) " + String.valueOf(operation.getMessageOperationStyle())); } public void invoke(MessageContext msgContext) throws AxisFault { // Make sure that the method style is correctly set (This does not appear to // be handled by default) // setOperationStyle(msgContext); super.invoke(msgContext); if (RequestContext.getExceptionPayload() != null) { Throwable t = RequestContext.getExceptionPayload().getException(); if (t instanceof Exception) { AxisFault fault = AxisFault.makeFault((Exception)t); if (t instanceof RuntimeException) { fault.addFaultDetail(Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION, "true"); } throw fault; } else { throw (Error)t; } } } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/package.html0000644000175000017500000000026010745677442032310 0ustar charlescharles Mule Axis specific extensions and component implementation that enables Mule components to act as Axis soap services. ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/MuleHttpSender.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/MuleHttpSender.java0000644000175000017500000010117410745677442033603 0ustar charlescharles/* * $Id: MuleHttpSender.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.extensions; import org.mule.transport.soap.SoapConstants; import org.mule.util.StringUtils; import org.mule.util.SystemUtils; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.net.URL; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import javax.xml.soap.MimeHeader; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPException; import org.apache.axis.AxisFault; import org.apache.axis.Constants; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.client.Call; import org.apache.axis.components.logger.LogFactory; import org.apache.axis.components.net.BooleanHolder; import org.apache.axis.components.net.DefaultSocketFactory; import org.apache.axis.components.net.SocketFactory; import org.apache.axis.components.net.SocketFactoryFactory; import org.apache.axis.encoding.Base64; import org.apache.axis.handlers.BasicHandler; import org.apache.axis.soap.SOAP12Constants; import org.apache.axis.soap.SOAPConstants; import org.apache.axis.transport.http.ChunkedInputStream; import org.apache.axis.transport.http.ChunkedOutputStream; import org.apache.axis.transport.http.HTTPConstants; import org.apache.axis.transport.http.HTTPSender; import org.apache.axis.transport.http.SocketHolder; import org.apache.axis.transport.http.SocketInputStream; import org.apache.axis.utils.Messages; import org.apache.axis.utils.TeeOutputStream; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.logging.Log; /** * MuleHttpSender is a rewrite of the Axis HttpSender. Unfortunately, * the Axis implementation is not extensible so this class is a copy of it with * modifications. The enhancements made are to allow for asynchronous Http method * calls which Mule initiates when the endpoint is asynchronous. * * @deprecated Use the UniversalSender instead */ public class MuleHttpSender extends BasicHandler { /** * Serial version */ private static final long serialVersionUID = -1730816323289419500L; protected static final Log log = LogFactory.getLog(HTTPSender.class.getName()); private static final String ACCEPT_HEADERS = HTTPConstants.HEADER_ACCEPT // limit to the types that are // meaningful to us. + ": " + HTTPConstants.HEADER_ACCEPT_APPL_SOAP + ", " + HTTPConstants.HEADER_ACCEPT_APPLICATION_DIME + ", " + HTTPConstants.HEADER_ACCEPT_MULTIPART_RELATED + ", " + HTTPConstants.HEADER_ACCEPT_TEXT_ALL + "\r\n" + HTTPConstants.HEADER_USER_AGENT // Tell // who // we // are. + ": " + Messages.getMessage("axisUserAgent") + "\r\n"; private static final String CACHE_HEADERS = HTTPConstants.HEADER_CACHE_CONTROL // stop caching proxies from caching // SOAP request. + ": " + HTTPConstants.HEADER_CACHE_CONTROL_NOCACHE + "\r\n" + HTTPConstants.HEADER_PRAGMA + ": " + HTTPConstants.HEADER_CACHE_CONTROL_NOCACHE + "\r\n"; private static final String CHUNKED_HEADER = HTTPConstants.HEADER_TRANSFER_ENCODING + ": " + HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED + "\r\n"; private static final String HEADER_CONTENT_TYPE_LC = HTTPConstants.HEADER_CONTENT_TYPE.toLowerCase(); private static final String HEADER_LOCATION_LC = HTTPConstants.HEADER_LOCATION.toLowerCase(); private static final String HEADER_CONTENT_LOCATION_LC = HTTPConstants.HEADER_CONTENT_LOCATION.toLowerCase(); private static final String HEADER_CONTENT_LENGTH_LC = HTTPConstants.HEADER_CONTENT_LENGTH.toLowerCase(); private static final String HEADER_TRANSFER_ENCODING_LC = HTTPConstants.HEADER_TRANSFER_ENCODING.toLowerCase(); /** * the url; used for error reporting */ URL targetURL; /** * invoke creates a socket connection, sends the request SOAP message and then * reads the response SOAP message back from the SOAP server * * @param msgContext the messsage context * @throws AxisFault */ public void invoke(MessageContext msgContext) throws AxisFault { if (log.isDebugEnabled()) { log.debug(Messages.getMessage("enter00", "HTTPSender::invoke")); } try { Call call = (Call)msgContext.getProperty("call_object"); String transURL = msgContext.getStrProp(MessageContext.TRANS_URL); String uri = transURL; if (call != null && call.useSOAPAction()) { uri = call.getSOAPActionURI(); } msgContext.setProperty(SoapConstants.SOAP_ACTION_PROPERTY_CAPS, uri); BooleanHolder useFullURL = new BooleanHolder(false); StringBuffer otherHeaders = new StringBuffer(64); targetURL = new URL(transURL); String host = targetURL.getHost(); int port = targetURL.getPort(); SocketHolder socketHolder = new SocketHolder(null); // Send the SOAP request to the server InputStream inp = writeToSocket(socketHolder, msgContext, targetURL, otherHeaders, host, port, msgContext.getTimeout(), useFullURL); if (msgContext.isClient() && call != null) { if (Boolean.TRUE.equals(call.getProperty("axis.one.way"))) { return; } } // Read the response back from the server Hashtable headers = new Hashtable(); inp = readHeadersFromSocket(socketHolder, msgContext, inp, headers); readFromSocket(socketHolder, msgContext, inp, headers); } catch (Exception e) { log.debug(e); throw AxisFault.makeFault(e); } if (log.isDebugEnabled()) { log.debug(Messages.getMessage("exit00", "HTTPDispatchHandler::invoke")); } } /** * Creates a socket connection to the SOAP server * * @param protocol "http" for standard, "https" for ssl. * @param host host name * @param port port to connect to * @param otherHeaders buffer for storing additional headers that need to be sent * @param useFullURL flag to indicate if the complete URL has to be sent * @throws java.io.IOException */ protected void getSocket(SocketHolder sockHolder, MessageContext msgContext, String protocol, String host, int port, int timeout, StringBuffer otherHeaders, BooleanHolder useFullURL) throws Exception { Hashtable options = getOptions(); if (timeout > 0) { if (options == null) { options = new Hashtable(); } options.put(DefaultSocketFactory.CONNECT_TIMEOUT, Integer.toString(timeout)); } SocketFactory factory = SocketFactoryFactory.getFactory(protocol, options); if (factory == null) { throw new IOException(Messages.getMessage("noSocketFactory", protocol)); } // log.fatal("Axis client: connect on socket: " + host + ":" + port); Socket sock = null; try { sock = factory.create(host, port, otherHeaders, useFullURL); } catch (Exception e) { Thread.sleep(1000); try { sock = factory.create(host, port, otherHeaders, useFullURL); } catch (Exception e1) { log.fatal("Axis client Failed: connect on socket: " + host + ":" + port, e); throw e; } } if (timeout > 0) { sock.setSoTimeout(timeout); } sockHolder.setSocket(sock); } /** * Send the soap request message to the server * * @param msgContext message context * @param tmpURL url to connect to * @param otherHeaders other headers if any * @param host host name * @param port port * @param useFullURL flag to indicate if the whole url needs to be sent * @throws IOException */ private InputStream writeToSocket(SocketHolder sockHolder, MessageContext msgContext, URL tmpURL, StringBuffer otherHeaders, String host, int port, int timeout, BooleanHolder useFullURL) throws Exception { String userID = msgContext.getUsername(); String passwd = msgContext.getPassword(); // Get SOAPAction, default to "" String action = msgContext.useSOAPAction() ? msgContext.getSOAPActionURI() : ""; if (action == null) { action = ""; } // if UserID is not part of the context, but is in the URL, use // the one in the URL. if ((userID == null) && (tmpURL.getUserInfo() != null)) { String info = tmpURL.getUserInfo(); int sep = info.indexOf(':'); if ((sep >= 0) && (sep + 1 < info.length())) { userID = info.substring(0, sep); passwd = info.substring(sep + 1); } else { userID = info; } } if (userID != null) { StringBuffer tmpBuf = new StringBuffer(64); tmpBuf.append(userID).append(":").append((passwd == null) ? "" : passwd); otherHeaders.append(HTTPConstants.HEADER_AUTHORIZATION).append(": Basic ").append( Base64.encode(tmpBuf.toString().getBytes())).append("\r\n"); } // don't forget the cookies! // mmm... cookies if (msgContext.getMaintainSession()) { String cookie = msgContext.getStrProp(HTTPConstants.HEADER_COOKIE); String cookie2 = msgContext.getStrProp(HTTPConstants.HEADER_COOKIE2); if (cookie != null) { otherHeaders.append(HTTPConstants.HEADER_COOKIE).append(": ").append(cookie).append("\r\n"); } if (cookie2 != null) { otherHeaders.append(HTTPConstants.HEADER_COOKIE2).append(": ").append(cookie2).append("\r\n"); } } StringBuffer header2 = new StringBuffer(64); String webMethod = null; boolean posting = true; Message reqMessage = msgContext.getRequestMessage(); boolean http10 = true; // True if this is to use HTTP 1.0 / false HTTP // 1.1 boolean httpChunkStream = false; // Use HTTP chunking or not. boolean httpContinueExpected = false; // Under HTTP 1.1 if false you // *MAY* need to wait for a 100 // rc, // if true the server MUST reply with 100 continue. String httpConnection = null; String httpver = msgContext.getStrProp(MessageContext.HTTP_TRANSPORT_VERSION); if (null == httpver) { httpver = HTTPConstants.HEADER_PROTOCOL_V10; } httpver = httpver.trim(); if (httpver.equals(HTTPConstants.HEADER_PROTOCOL_V11)) { http10 = false; } // process user defined headers for information. Hashtable userHeaderTable = (Hashtable)msgContext.getProperty(HTTPConstants.REQUEST_HEADERS); if (userHeaderTable != null) { if (null == otherHeaders) { otherHeaders = new StringBuffer(1024); } for (java.util.Iterator e = userHeaderTable.entrySet().iterator(); e.hasNext();) { java.util.Map.Entry me = (java.util.Map.Entry)e.next(); Object keyObj = me.getKey(); if (null == keyObj) { continue; } String key = keyObj.toString().trim(); if (key.equalsIgnoreCase(HTTPConstants.HEADER_TRANSFER_ENCODING)) { if (!http10) { String val = me.getValue().toString(); if (null != val && val.trim().equalsIgnoreCase(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED)) { httpChunkStream = true; } } } else if (key.equalsIgnoreCase(HTTPConstants.HEADER_CONNECTION)) { if (!http10) { String val = me.getValue().toString(); if (val.trim().equalsIgnoreCase(HTTPConstants.HEADER_CONNECTION_CLOSE)) { httpConnection = HTTPConstants.HEADER_CONNECTION_CLOSE; } } // HTTP 1.0 will always close. // HTTP 1.1 will use persistent. //no need to specify } else { if (!http10 && key.equalsIgnoreCase(HTTPConstants.HEADER_EXPECT)) { String val = me.getValue().toString(); if (null != val && val.trim().equalsIgnoreCase(HTTPConstants.HEADER_EXPECT_100_Continue)) { httpContinueExpected = true; } } otherHeaders.append(key).append(": ").append(me.getValue()).append("\r\n"); } } } if (!http10) { // Force close for now. // TODO HTTP/1.1 httpConnection = HTTPConstants.HEADER_CONNECTION_CLOSE; } header2.append(" "); header2.append(http10 ? HTTPConstants.HEADER_PROTOCOL_10 : HTTPConstants.HEADER_PROTOCOL_11).append( "\r\n"); MimeHeaders mimeHeaders = reqMessage.getMimeHeaders(); if (posting) { String contentType; if (mimeHeaders.getHeader(HTTPConstants.HEADER_CONTENT_TYPE) != null) { contentType = mimeHeaders.getHeader(HTTPConstants.HEADER_CONTENT_TYPE)[0]; } else { contentType = reqMessage.getContentType(msgContext.getSOAPConstants()); } header2.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ").append(contentType).append("\r\n"); } header2.append(ACCEPT_HEADERS).append(HTTPConstants.HEADER_HOST) // used for virtual connections .append(": ") .append(host) .append((port == -1) ? ("") : (":" + port)) .append("\r\n") .append(CACHE_HEADERS) .append(HTTPConstants.HEADER_SOAP_ACTION) // The SOAP action. .append(": \"") .append(action) .append("\"\r\n"); if (posting) { if (!httpChunkStream) { // Content length MUST be sent on HTTP 1.0 requests. header2.append(HTTPConstants.HEADER_CONTENT_LENGTH).append(": ").append( reqMessage.getContentLength()).append("\r\n"); } else { // Do http chunking. header2.append(CHUNKED_HEADER); } } // Transfer MIME headers of SOAPMessage to HTTP headers. if (mimeHeaders != null) { for (Iterator i = mimeHeaders.getAllHeaders(); i.hasNext();) { MimeHeader mimeHeader = (MimeHeader)i.next(); String headerName = mimeHeader.getName(); if (headerName.equals(HTTPConstants.HEADER_CONTENT_TYPE) || headerName.equals(HTTPConstants.HEADER_SOAP_ACTION)) { continue; } header2.append(mimeHeader.getName()) .append(": ") .append(mimeHeader.getValue()) .append("\r\n"); } } if (null != httpConnection) { header2.append(HTTPConstants.HEADER_CONNECTION); header2.append(": "); header2.append(httpConnection); header2.append("\r\n"); } getSocket(sockHolder, msgContext, targetURL.getProtocol(), host, port, timeout, otherHeaders, useFullURL); if (null != otherHeaders) { // Add other headers to the end. // for pre java1.4 support, we have to turn the string buffer // argument into // a string before appending. header2.append(otherHeaders.toString()); } header2.append("\r\n"); // The empty line to start the BODY. StringBuffer header = new StringBuffer(128); // If we're SOAP 1.2, allow the web method to be set from the // MessageContext. if (msgContext.getSOAPConstants() == SOAPConstants.SOAP12_CONSTANTS) { webMethod = msgContext.getStrProp(SOAP12Constants.PROP_WEBMETHOD); } if (webMethod == null) { webMethod = HTTPConstants.HEADER_POST; } else { posting = webMethod.equals(HTTPConstants.HEADER_POST); } header.append(webMethod).append(" "); if (useFullURL.value) { header.append(tmpURL.toExternalForm()); } else { header.append(StringUtils.isEmpty(tmpURL.getFile()) ? "/" : tmpURL.getFile()); } header.append(header2.toString()); OutputStream out = sockHolder.getSocket().getOutputStream(); if (!posting) { out.write(header.toString().getBytes(HTTPConstants.HEADER_DEFAULT_CHAR_ENCODING)); out.flush(); return null; } InputStream inp = null; if (httpChunkStream || httpContinueExpected) { out.write(header.toString().getBytes(HTTPConstants.HEADER_DEFAULT_CHAR_ENCODING)); } if (httpContinueExpected) { // We need to get a reply from the server as // to whether // it wants us send anything more. out.flush(); Hashtable cheaders = new Hashtable(); inp = readHeadersFromSocket(sockHolder, msgContext, null, cheaders); int returnCode = -1; Integer Irc = (Integer)msgContext.getProperty(HTTPConstants.MC_HTTP_STATUS_CODE); if (null != Irc) { returnCode = Irc.intValue(); } if (100 == returnCode) { // got 100 we may continue. // Need TODO a little msgContext house keeping.... msgContext.removeProperty(HTTPConstants.MC_HTTP_STATUS_CODE); msgContext.removeProperty(HTTPConstants.MC_HTTP_STATUS_MESSAGE); } else { // If no 100 Continue then we must not send anything! String statusMessage = (String)msgContext.getProperty(HTTPConstants.MC_HTTP_STATUS_MESSAGE); AxisFault fault = new AxisFault("HTTP", "(" + returnCode + ")" + statusMessage, null, null); fault.setFaultDetailString(Messages.getMessage("return01", String.valueOf(returnCode), "")); throw fault; } } ByteArrayOutputStream baos = null; if (log.isDebugEnabled()) { log.debug(Messages.getMessage("xmlSent00")); log.debug("---------------------------------------------------"); baos = new ByteArrayOutputStream(); } if (httpChunkStream) { ChunkedOutputStream chunkedOutputStream = new ChunkedOutputStream(out); out = new BufferedOutputStream(chunkedOutputStream, Constants.HTTP_TXR_BUFFER_SIZE); try { if (baos != null) { out = new TeeOutputStream(out, baos); } reqMessage.writeTo(out); } catch (SOAPException e) { log.error(Messages.getMessage("exception00"), e); } out.flush(); chunkedOutputStream.eos(); } else { out = new BufferedOutputStream(out, Constants.HTTP_TXR_BUFFER_SIZE); try { if (!httpContinueExpected) { out.write(header.toString().getBytes(HTTPConstants.HEADER_DEFAULT_CHAR_ENCODING)); } if (baos != null) { out = new TeeOutputStream(out, baos); } reqMessage.writeTo(out); } catch (SOAPException e) { throw e; } finally { // Flush ONLY once. out.flush(); } } if (log.isDebugEnabled() && baos != null) { log.debug(header + new String(baos.toByteArray())); } return inp; } private InputStream readHeadersFromSocket(SocketHolder sockHolder, MessageContext msgContext, InputStream inp, Hashtable headers) throws IOException { byte b = 0; int len = 0; int colonIndex = -1; String name, value; int returnCode = 0; if (null == inp) { inp = new BufferedInputStream(sockHolder.getSocket().getInputStream()); } if (headers == null) { headers = new Hashtable(); } // Should help performance. Temporary fix only till its all stream // oriented. // Need to add logic for getting the version # and the return code // but that's for tomorrow! /* Logic to read HTTP response headers */ boolean readTooMuch = false; for (ByteArrayOutputStream buf = new ByteArrayOutputStream(4097);;) { if (!readTooMuch) { b = (byte)inp.read(); } if (b == -1) { break; } readTooMuch = false; if ((b != '\r') && (b != '\n')) { if ((b == ':') && (colonIndex == -1)) { colonIndex = len; } len++; buf.write(b); } else if (b == '\r') { continue; } else { // b== '\n' if (len == 0) { break; } b = (byte)inp.read(); readTooMuch = true; // A space or tab at the begining of a line means the header // continues. if ((b == ' ') || (b == '\t')) { continue; } buf.close(); byte[] hdata = buf.toByteArray(); buf.reset(); if (colonIndex != -1) { name = new String(hdata, 0, colonIndex, HTTPConstants.HEADER_DEFAULT_CHAR_ENCODING); value = new String(hdata, colonIndex + 1, len - 1 - colonIndex, HTTPConstants.HEADER_DEFAULT_CHAR_ENCODING); colonIndex = -1; } else { name = new String(hdata, 0, len, HTTPConstants.HEADER_DEFAULT_CHAR_ENCODING); value = ""; } if (log.isDebugEnabled()) { log.debug(name + value); } if (msgContext.getProperty(HTTPConstants.MC_HTTP_STATUS_CODE) == null) { // Reader status code int start = name.indexOf(' ') + 1; String tmp = name.substring(start).trim(); int end = tmp.indexOf(' '); if (end != -1) { tmp = tmp.substring(0, end); } returnCode = Integer.parseInt(tmp); msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_CODE, new Integer(returnCode)); msgContext.setProperty(HTTPConstants.MC_HTTP_STATUS_MESSAGE, name.substring(start + end + 1)); } else { headers.put(name.toLowerCase(), value); } len = 0; } } return inp; } /** * Reads the SOAP response back from the server * * @param msgContext message context * @throws IOException */ private InputStream readFromSocket(SocketHolder socketHolder, MessageContext msgContext, InputStream inp, Hashtable headers) throws IOException { Message outMsg = null; byte b; Integer rc = (Integer)msgContext.getProperty(HTTPConstants.MC_HTTP_STATUS_CODE); int returnCode = 0; if (rc != null) { returnCode = rc.intValue(); } else { // No return code?? Should have one by now. } /* All HTTP headers have been read. */ String contentType = (String)headers.get(HEADER_CONTENT_TYPE_LC); contentType = (null == contentType) ? null : contentType.trim(); String location = (String)headers.get(HEADER_LOCATION_LC); location = (null == location) ? null : location.trim(); if ((returnCode > 199) && (returnCode < 300)) { if (returnCode == 202) { return inp; } // SOAP return is OK - so fall through } else if (msgContext.getSOAPConstants() == SOAPConstants.SOAP12_CONSTANTS) { // For now, if we're SOAP 1.2, fall through, since the range of // valid result codes is much greater } else if ((contentType != null) && !contentType.startsWith("text/html") && ((returnCode > 499) && (returnCode < 600))) { // SOAP Fault should be in here - so fall through } else if ((location != null) && ((returnCode == 302) || (returnCode == 307))) { // Temporary Redirect (HTTP: 302/307) // close old connection inp.close(); socketHolder.getSocket().close(); // remove former result and set new target url msgContext.removeProperty(HTTPConstants.MC_HTTP_STATUS_CODE); msgContext.setProperty(MessageContext.TRANS_URL, location); // next try invoke(msgContext); return inp; } else if (returnCode == 100) { msgContext.removeProperty(HTTPConstants.MC_HTTP_STATUS_CODE); msgContext.removeProperty(HTTPConstants.MC_HTTP_STATUS_MESSAGE); readHeadersFromSocket(socketHolder, msgContext, inp, headers); return readFromSocket(socketHolder, msgContext, inp, headers); } else { // Unknown return code - so wrap up the content into a // SOAP Fault. ByteArrayOutputStream buf = new ByteArrayOutputStream(4097); while (-1 != (b = (byte)inp.read())) { buf.write(b); } String statusMessage = msgContext.getStrProp(HTTPConstants.MC_HTTP_STATUS_MESSAGE); AxisFault fault = new AxisFault("HTTP", "(" + returnCode + ")" + statusMessage, null, null); fault.setFaultDetailString(Messages.getMessage("return01", String.valueOf(returnCode), buf.toString())); fault.addFaultDetail(Constants.QNAME_FAULTDETAIL_HTTPERRORCODE, Integer.toString(returnCode)); throw fault; } String contentLocation = (String)headers.get(HEADER_CONTENT_LOCATION_LC); contentLocation = (null == contentLocation) ? null : contentLocation.trim(); String contentLength = (String)headers.get(HEADER_CONTENT_LENGTH_LC); contentLength = (null == contentLength) ? null : contentLength.trim(); String transferEncoding = (String)headers.get(HEADER_TRANSFER_ENCODING_LC); if (null != transferEncoding) { transferEncoding = transferEncoding.trim().toLowerCase(); if (transferEncoding.equals(HTTPConstants.HEADER_TRANSFER_ENCODING_CHUNKED)) { inp = new ChunkedInputStream(inp); } } outMsg = new Message(new SocketInputStream(inp, socketHolder.getSocket()), false, contentType, contentLocation); // Transfer HTTP headers of HTTP message to MIME headers of SOAP message MimeHeaders mimeHeaders = outMsg.getMimeHeaders(); for (Enumeration e = headers.keys(); e.hasMoreElements();) { String key = (String)e.nextElement(); mimeHeaders.addHeader(key, ((String)headers.get(key)).trim()); } outMsg.setMessageType(Message.RESPONSE); msgContext.setResponseMessage(outMsg); if (log.isDebugEnabled()) { if (null == contentLength) { log.debug(SystemUtils.LINE_SEPARATOR + Messages.getMessage("no00", "Content-Length")); } log.debug(SystemUtils.LINE_SEPARATOR + Messages.getMessage("xmlRecd00")); log.debug("-----------------------------------------------"); log.debug(outMsg.getSOAPEnvelope().toString()); } // if we are maintaining session state, // handle cookies (if any) if (msgContext.getMaintainSession()) { handleCookie(HTTPConstants.HEADER_COOKIE, HTTPConstants.HEADER_SET_COOKIE, headers, msgContext); handleCookie(HTTPConstants.HEADER_COOKIE2, HTTPConstants.HEADER_SET_COOKIE2, headers, msgContext); } return inp; } /** * little helper function for cookies * * @param cookieName * @param setCookieName * @param headers * @param msgContext */ public void handleCookie(String cookieName, String setCookieName, Hashtable headers, MessageContext msgContext) { if (headers.containsKey(setCookieName.toLowerCase())) { String cookie = (String)headers.get(setCookieName.toLowerCase()); cookie = cookie.trim(); // chop after first ; a la Apache SOAP (see HTTPUtils.java there) int index = cookie.indexOf(';'); if (index != -1) { cookie = cookie.substring(0, index); } msgContext.setProperty(cookieName, cookie); } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/AxisMuleSession.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/AxisMuleSession.jav0000644000175000017500000000364210745677442033633 0ustar charlescharles/* * $Id: AxisMuleSession.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.extensions; import org.mule.api.MuleSession; import java.util.Enumeration; import org.apache.commons.collections.iterators.IteratorEnumeration; /** * Provides an adapter to a DefaultMuleSession so that Axis can write to the session */ public class AxisMuleSession implements org.apache.axis.session.Session { private MuleSession session; private Object lock=new Object(); public AxisMuleSession(MuleSession session) { this.session = session; } public Object get(String string) { synchronized(lock) { return session.getProperty(string); } } public void set(String string, Object object) { synchronized(lock) { session.setProperty(string, object); } } public void remove(String string) { synchronized(lock) { session.removeProperty(string); } } public Enumeration getKeys() { synchronized(lock) { return new IteratorEnumeration(session.getPropertyNames()); } } public void setTimeout(int i) { // TODO not supported } public int getTimeout() { return 0; } public void touch() { // nothing here to touch } public void invalidate() { synchronized(lock) { session.setValid(false); } } public Object getLockObject() { return lock; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/MuleRPCProvider.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/MuleRPCProvider.jav0000644000175000017500000001645610746275214033521 0ustar charlescharles/* * $Id: MuleRPCProvider.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.extensions; import org.mule.MuleServer; import org.mule.RequestContext; import org.mule.api.service.Service; import org.mule.transport.soap.axis.AxisConnector; import org.mule.transport.soap.axis.AxisMessageReceiver; import org.mule.transport.soap.axis.AxisServiceProxy; import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Iterator; import javax.xml.namespace.QName; import javax.xml.rpc.holders.Holder; import org.apache.axis.AxisFault; import org.apache.axis.Constants; import org.apache.axis.MessageContext; import org.apache.axis.constants.Style; import org.apache.axis.description.OperationDesc; import org.apache.axis.description.ParameterDesc; import org.apache.axis.description.ServiceDesc; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.message.RPCElement; import org.apache.axis.message.RPCHeaderParam; import org.apache.axis.message.RPCParam; import org.apache.axis.message.SOAPEnvelope; import org.apache.axis.providers.java.RPCProvider; import org.apache.axis.soap.SOAPConstants; import org.apache.axis.utils.JavaUtils; /** * MuleProvider is an Axis service endpoint that builds services from * Mule managed components. */ public class MuleRPCProvider extends RPCProvider { /** * Serial version */ private static final long serialVersionUID = -4987111047650933518L; private AxisConnector connector; public MuleRPCProvider(AxisConnector connector) { this.connector = connector; } protected Object makeNewServiceObject(MessageContext messageContext, String s) throws Exception { String transUrl = (String)messageContext.getProperty("transport.url"); int i = transUrl.indexOf("?"); if (i > -1) { transUrl = transUrl.substring(0, i); } AxisMessageReceiver receiver = (AxisMessageReceiver)connector.lookupReceiver(transUrl); if (receiver == null) { receiver = (AxisMessageReceiver)connector.lookupReceiver(messageContext.getTargetService()); } if (receiver == null) { throw new AxisFault("Could not find Mule registered service: " + s); } Class[] classes = AxisServiceProxy.getInterfacesForComponent(receiver.getService()); return AxisServiceProxy.createProxy(receiver, true, classes); } protected Class getServiceClass(String s, SOAPService soapService, MessageContext messageContext) throws AxisFault { Service component = MuleServer.getMuleContext().getRegistry().lookupService(soapService.getName()); try { Class[] classes = AxisServiceProxy.getInterfacesForComponent(component); return Proxy.getProxyClass(Thread.currentThread().getContextClassLoader(), classes); } catch (Exception e) { throw new AxisFault("Failed to implementation class for component: " + e.getMessage(), e); } } public void invoke(MessageContext msgContext) throws AxisFault { super.invoke(msgContext); if (RequestContext.getExceptionPayload() != null) { Throwable t = RequestContext.getExceptionPayload().getException(); if (t instanceof Exception) { AxisFault fault = AxisFault.makeFault((Exception)t); if (t instanceof RuntimeException) { fault.addFaultDetail(Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION, "true"); } throw fault; } else { throw (Error)t; } } } protected RPCElement createResponseBody(RPCElement body, MessageContext msgContext, OperationDesc operation, ServiceDesc serviceDesc, Object objRes, SOAPEnvelope resEnv, ArrayList outs) throws Exception { String methodName = operation.getName(); /* Now put the result in the result SOAPEnvelope */ RPCElement resBody = new RPCElement(methodName + "Response"); resBody.setPrefix(body.getPrefix()); resBody.setNamespaceURI(body.getNamespaceURI()); resBody.setEncodingStyle(msgContext.getEncodingStyle()); try { // Return first if (operation.getMethod().getReturnType() != Void.TYPE) { QName returnQName = operation.getReturnQName(); if (returnQName == null) { String nsp = body.getNamespaceURI(); if (nsp == null || nsp.length() == 0) { nsp = serviceDesc.getDefaultNamespace(); } returnQName = new QName(msgContext.isEncoded() ? "" : nsp, methodName + "Return"); } RPCParam param = new RPCParam(returnQName, objRes); param.setParamDesc(operation.getReturnParamDesc()); if (!operation.isReturnHeader()) { // For SOAP 1.2 rpc style, add a result if (msgContext.getSOAPConstants() == SOAPConstants.SOAP12_CONSTANTS && (serviceDesc.getStyle().equals(Style.RPC))) { RPCParam resultParam = new RPCParam(Constants.QNAME_RPC_RESULT, returnQName); resultParam.setXSITypeGeneration(Boolean.FALSE); resBody.addParam(resultParam); } resBody.addParam(param); } else { resEnv.addHeader(new RPCHeaderParam(param)); } } // Then any other out params if (!outs.isEmpty()) { for (Iterator i = outs.iterator(); i.hasNext();) { // We know this has a holder, so just unwrap the value RPCParam param = (RPCParam)i.next(); Holder holder = (Holder)param.getObjectValue(); Object value = JavaUtils.getHolderValue(holder); ParameterDesc paramDesc = param.getParamDesc(); param.setObjectValue(value); if (paramDesc != null && paramDesc.isOutHeader()) { resEnv.addHeader(new RPCHeaderParam(param)); } else { resBody.addParam(param); } } } } catch (Exception e) { throw e; } return resBody; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/WSDDJavaMuleProvider.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/WSDDJavaMuleProvide0000644000175000017500000000373310745677442033501 0ustar charlescharles/* * $Id: WSDDJavaMuleProvider.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.extensions; import org.mule.transport.soap.axis.AxisConnector; import org.apache.axis.EngineConfiguration; import org.apache.axis.deployment.wsdd.WSDDConstants; import org.apache.axis.deployment.wsdd.WSDDProvider; import org.apache.axis.deployment.wsdd.WSDDService; /** * WSDDJavaMuleProvider is a factory class for creating the * MuleProvider. * * @see MuleRPCProvider */ public class WSDDJavaMuleProvider extends WSDDProvider { private AxisConnector connector; public WSDDJavaMuleProvider(AxisConnector connector) { this.connector = connector; } /** * Factory method for creating an MuleRPCProvider. * * @param wsddService a WSDDService value * @param engineConfiguration an EngineConfiguration value * @return a Handler value * @exception Exception if an error occurs */ public org.apache.axis.Handler newProviderInstance(WSDDService wsddService, EngineConfiguration engineConfiguration) throws Exception { String serviceStyle = wsddService.getStyle().toString(); if (serviceStyle.equals("message")) { return new MuleMsgProvider(connector); } return new MuleRPCProvider(connector); } /** * @return String * @see org.apache.axis.deployment.wsdd.WSDDProvider#getName() */ public String getName() { return WSDDConstants.PROVIDER_RPC; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/MuleSoapHeadersHandler.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/MuleSoapHeadersHand0000644000175000017500000001444710745677442033602 0ustar charlescharles/* * $Id: MuleSoapHeadersHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.extensions; import org.mule.api.MuleEvent; import org.mule.api.config.MuleProperties; import org.mule.transport.soap.MuleSoapHeaders; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPMessage; import org.apache.axis.AxisFault; import org.apache.axis.MessageContext; import org.apache.axis.handlers.BasicHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleSoapHeadersHandler is an Axis handler that can read and write * Mule header properties to a SOAP message. */ public class MuleSoapHeadersHandler extends BasicHandler { /** * Serial version */ private static final long serialVersionUID = 1813393257662701953L; /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(MuleSoapHeadersHandler.class); public void invoke(MessageContext msgContext) throws AxisFault { boolean setMustUnderstand = msgContext.isPropertyTrue("MULE_HEADER_MUST_UNDERSTAND"); try { if (msgContext.isClient()) { if (!msgContext.getPastPivot()) { processClientRequest(msgContext, setMustUnderstand); if (logger.isDebugEnabled()) { logger.debug("After Client Request, Message is:\n" + msgContext.getRequestMessage().getSOAPPartAsString()); } } else { processClientResponse(msgContext); if (logger.isDebugEnabled()) { logger.debug("After Client Response, Message is:\n" + msgContext.getRequestMessage().getSOAPPartAsString()); } } } else { if (!msgContext.getPastPivot()) { processServerRequest(msgContext); if (logger.isDebugEnabled()) { logger.debug("After Server Request, Message is:\n" + msgContext.getRequestMessage().getSOAPPartAsString()); } } else { processServerResponse(msgContext, setMustUnderstand); if (logger.isDebugEnabled()) { logger.debug("After Server Response, Message is:\n" + msgContext.getRequestMessage().getSOAPPartAsString()); } } } } catch (Exception e) { throw AxisFault.makeFault(e); } } /** * Method processClientRequest * * @param msgContext */ protected synchronized void processClientRequest(MessageContext msgContext, boolean setMustUnderstand) throws Exception { SOAPMessage msg = msgContext.getMessage(); if (msg == null) { return; } MuleEvent event = (MuleEvent)msgContext.getProperty(MuleProperties.MULE_EVENT_PROPERTY); if (event == null) { return; } else { synchronized (msgContext) { MuleSoapHeaders headers = new MuleSoapHeaders(event); headers.addHeaders(msgContext.getMessage().getSOAPPart().getEnvelope()); } } } /** * Method processClientResponse * * @param msgContext */ protected void processClientResponse(MessageContext msgContext) throws Exception { SOAPMessage msg = msgContext.getMessage(); if (msg == null) { return; } SOAPEnvelope env = msg.getSOAPPart().getEnvelope(); MuleSoapHeaders headers = new MuleSoapHeaders(env.getHeader()); if (headers.getCorrelationId() != null) { msgContext.setProperty(MuleProperties.MULE_CORRELATION_ID_PROPERTY, headers.getCorrelationId()); } if (headers.getCorrelationGroup() != null) { msgContext.setProperty(MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY, headers .getCorrelationGroup()); } if (headers.getCorrelationSequence() != null) { msgContext.setProperty(MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY, headers .getCorrelationSequence()); } if (headers.getReplyTo() != null) { msgContext.setProperty(MuleProperties.MULE_REPLY_TO_PROPERTY, headers.getReplyTo()); } } /** * Method processServerRequest * * @param msgContext * @throws Exception */ protected void processServerRequest(MessageContext msgContext) throws Exception { SOAPMessage msg = msgContext.getMessage(); if (msg == null) { return; } MuleSoapHeaders headers = new MuleSoapHeaders(msg.getSOAPPart().getEnvelope().getHeader()); msgContext.setProperty(MuleSoapHeaders.ENV_REQUEST_HEADERS, headers); } /** * Method processServerResponse * * @param msgContext */ protected void processServerResponse(MessageContext msgContext, boolean setMustUnderstand) throws Exception { SOAPMessage msg = msgContext.getMessage(); if (msg == null) { return; } MuleSoapHeaders headers = (MuleSoapHeaders)msgContext .getProperty(MuleSoapHeaders.ENV_REQUEST_HEADERS); if (headers == null) { return; } else { headers.addHeaders(msgContext.getMessage().getSOAPPart().getEnvelope()); } } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/WSDDFileProvider.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/WSDDFileProvider.ja0000644000175000017500000000323210745677442033421 0ustar charlescharles/* * $Id: WSDDFileProvider.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.extensions; import javax.xml.namespace.QName; import org.apache.axis.ConfigurationException; import org.apache.axis.configuration.FileProvider; import org.apache.axis.handlers.soap.SOAPService; /** * Override the File provider to stop exceptions being thrown in Axis if the service * does not exist. Mule adds services after the WSDD has been loaded. */ public class WSDDFileProvider extends FileProvider { /** * Constructor which accesses a file in the current directory of the engine or at * an absolute path. */ public WSDDFileProvider(String filename) { super(filename); } /** * Constructor which accesses a file relative to a specific base path. */ public WSDDFileProvider(String basepath, String filename) throws ConfigurationException { super(basepath, filename); } /** * retrieve an instance of the named service * * @param qname the name of the service * @return the service object or null if it doesn't exist * @throws org.apache.axis.ConfigurationException */ public SOAPService getService(QName qname) throws ConfigurationException { return getDeployment().getService(qname); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/MuleConfigProvider.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/MuleConfigProvider.0000644000175000017500000000416010745677442033576 0ustar charlescharles/* * $Id: MuleConfigProvider.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.extensions; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.axis.AxisEngine; import org.apache.axis.ConfigurationException; import org.apache.axis.EngineConfiguration; import org.apache.axis.configuration.SimpleProvider; /** * MuleConfigProvider is needed because the Simple Provider does not * list services in the defaultConfiguration. */ public class MuleConfigProvider extends SimpleProvider { private EngineConfiguration engineConfiguration; public MuleConfigProvider(EngineConfiguration engineConfiguration) { super(engineConfiguration); this.engineConfiguration = engineConfiguration; } /** * Configure an AxisEngine. Right now just calls the default configuration if * there is one, since we don't do anything special. */ public void configureEngine(AxisEngine engine) throws ConfigurationException { synchronized (this) { engineConfiguration.configureEngine(engine); super.configureEngine(engine); } } public Iterator getAxisDeployedServices() throws ConfigurationException { return engineConfiguration.getDeployedServices(); } public Iterator getAllDeployedServices() throws ConfigurationException { List services = new ArrayList(); Iterator iter = engineConfiguration.getDeployedServices(); while (iter.hasNext()) { services.add(iter.next()); } iter = super.getDeployedServices(); while (iter.hasNext()) { services.add(iter.next()); } return services.iterator(); } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/MuleTransport.java0000644000175000017500000001074510745677442033522 0ustar charlescharles/* * $Id: MuleTransport.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.extensions; import org.mule.api.DefaultMuleException; import org.mule.config.i18n.CoreMessages; import org.mule.transport.soap.axis.AxisConnector; import java.util.HashMap; import java.util.Map; import org.apache.axis.client.Transport; /** * A container for all Mule supported transports for Axis. */ public class MuleTransport extends Transport { private static Map transports = null; public MuleTransport() { transportName = "MuleTransport"; } public MuleTransport(String protocol) { transportName = protocol; } private static void initTransports() { transports = new HashMap(); transports.put("http", HTTP.class); transports.put("https", HTTPS.class); transports.put("servlet", SERVLET.class); transports.put("tcp", TCP.class); transports.put("ssl", SSL.class); transports.put("jms", JMS.class); transports.put("vm", VM.class); transports.put("xmpp", XMPP.class); transports.put("smtp", SMTP.class); transports.put("smtps", SMTPS.class); transports.put("pop3", POP3.class); transports.put("pop3s", POP3S.class); transports.put("imap", IMAP.class); transports.put("imaps", IMAPS.class); } /** * @param protocol the Axis soap transport to use * @return The corresponding transport class * @throws DefaultMuleException if the transport is not supported by Axis * @throws NullPointerException if the transport protocol is null */ public static Class getTransportClass(String protocol) throws DefaultMuleException { if (protocol == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("protocol").toString()); } if (!isTransportSupported(protocol)) { throw new DefaultMuleException( CoreMessages.schemeNotCompatibleWithConnector(protocol, AxisConnector.class)); } return (Class)transports.get(protocol); } public static boolean isTransportSupported(String protocol) { if (transports == null) { initTransports(); } return transports.get(protocol) != null; } public static class HTTP extends MuleTransport { public HTTP() { super("http"); } } public static class HTTPS extends MuleTransport { public HTTPS() { super("https"); } } public static class TCP extends MuleTransport { public TCP() { super("tcp"); } } public static class SSL extends MuleTransport { public SSL() { super("ssl"); } } public static class JMS extends MuleTransport { public JMS() { super("jms"); } } public static class POP3 extends MuleTransport { public POP3() { super("pop3"); } } public static class SMTP extends MuleTransport { public SMTP() { super("smtp"); } } public static class POP3S extends MuleTransport { public POP3S() { super("pop3s"); } } public static class SMTPS extends MuleTransport { public SMTPS() { super("smtps"); } } public static class IMAP extends MuleTransport { public IMAP() { super("imap"); } } public static class IMAPS extends MuleTransport { public IMAPS() { super("imaps"); } } public static class XMPP extends MuleTransport { public XMPP() { super("xmpp"); } } public static class VM extends MuleTransport { public VM() { super("vm"); } } public static class SERVLET extends MuleTransport { public SERVLET() { super("servlet"); } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/UniversalSender.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extensions/UniversalSender.jav0000644000175000017500000002740210757615756033654 0ustar charlescharles/* * $Id: UniversalSender.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.extensions; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.MuleServer; import org.mule.RegistryContext; import org.mule.RequestContext; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.OutboundRouter; import org.mule.api.routing.OutboundRouterCollection; import org.mule.api.service.Service; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.endpoint.MuleEndpointURI; import org.mule.transport.http.HttpConstants; import org.mule.transport.soap.SoapConstants; import org.mule.transport.soap.axis.AxisConnector; import org.mule.transport.soap.axis.extras.AxisCleanAndAddProperties; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.axis.AxisFault; import org.apache.axis.Message; import org.apache.axis.MessageContext; import org.apache.axis.client.Call; import org.apache.axis.handlers.BasicHandler; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * An Axis handler that will dispatch the SOAP event via a Mule endpoint */ public class UniversalSender extends BasicHandler { /** * Serial version */ private static final long serialVersionUID = 7943380365092172940L; /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); protected Map endpointsCache = new HashMap(); public void invoke(MessageContext msgContext) throws AxisFault { boolean sync = true; Call call = (Call)msgContext.getProperty("call_object"); if (call == null) { throw new IllegalStateException( "The call_object property must be set on the message context to the client Call object"); } if (Boolean.TRUE.equals(call.getProperty("axis.one.way"))) { sync = false; } // Get the event stored in call // If a receive call is made there will be no event // MuleEvent event = // (MuleEvent)call.getProperty(MuleProperties.MULE_EVENT_PROPERTY); // Get the dispatch endpoint String uri = msgContext.getStrProp(MessageContext.TRANS_URL); ImmutableEndpoint requestEndpoint = (ImmutableEndpoint)call .getProperty(MuleProperties.MULE_ENDPOINT_PROPERTY); OutboundEndpoint endpoint; // put username and password in URI if they are set on the current event if (msgContext.getUsername() != null) { String[] tempEndpoint = uri.split("//"); String credentialString = msgContext.getUsername() + ":" + msgContext.getPassword(); uri = tempEndpoint[0] + "//" + credentialString + "@" + tempEndpoint[1]; try { endpoint = lookupEndpoint(uri); } catch (MuleException e) { requestEndpoint.getConnector().handleException(e); return; } } else { try { endpoint = lookupEndpoint(uri); } catch (MuleException e) { requestEndpoint.getConnector().handleException(e); return; } } try { if (requestEndpoint.getConnector() instanceof AxisConnector) { msgContext.setTypeMappingRegistry(((AxisConnector)requestEndpoint.getConnector()) .getAxis().getTypeMappingRegistry()); } Map props = new HashMap(); Object payload = null; int contentLength = 0; String contentType = null; if (msgContext.getRequestMessage().countAttachments() > 0) { File temp = File.createTempFile("soap", ".tmp"); temp.deleteOnExit(); // TODO cleanup files earlier (IOUtils has a // file tracker) FileOutputStream fos = new FileOutputStream(temp); msgContext.getRequestMessage().writeTo(fos); fos.close(); contentLength = (int)temp.length(); payload = new FileInputStream(temp); contentType = "multipart/related"; } else { ByteArrayOutputStream baos = new ByteArrayOutputStream(8192); msgContext.getRequestMessage().writeTo(baos); baos.close(); payload = baos.toByteArray(); } // props.putAll(event.getProperties()); for (Iterator iterator = msgContext.getPropertyNames(); iterator.hasNext();) { String name = (String)iterator.next(); if (!name.equals("call_object") && !name.equals("wsdl.service")) { props.put(name, msgContext.getProperty(name)); } } // add all custom headers, filter out all mule headers (such as // MULE_SESSION) except // for MULE_USER header. Filter out other headers like "soapMethods" and // MuleProperties.MULE_METHOD_PROPERTY and "soapAction" // and also filter out any http related header if ((RequestContext.getEvent() != null) && (RequestContext.getEvent().getMessage() != null)) { props = AxisCleanAndAddProperties.cleanAndAdd(RequestContext.getEventContext()); } // with jms and vm the default SOAPAction will result in the name of the endpoint, which we may not necessarily want. This should be set manually on the endpoint String scheme = requestEndpoint.getEndpointURI().getScheme(); if (!("vm".equalsIgnoreCase(scheme) || "jms".equalsIgnoreCase(scheme))) { if (call.useSOAPAction()) { uri = call.getSOAPActionURI(); } props.put(SoapConstants.SOAP_ACTION_PROPERTY_CAPS, uri); } if (contentLength > 0) { props.put(HttpConstants.HEADER_CONTENT_LENGTH, Integer.toString(contentLength)); // necessary // for // supporting // httpclient } if (props.get(HttpConstants.HEADER_CONTENT_TYPE) == null) { if (contentType == null) { contentType = "text/xml"; } props.put(HttpConstants.HEADER_CONTENT_TYPE, contentType); } MuleMessage message = new DefaultMuleMessage(payload, props); MuleSession session = RequestContext.getEventContext().getSession(); logger.info("Making Axis soap request on: " + uri); if (logger.isDebugEnabled()) { logger.debug("Soap request is:\n" + new String((payload instanceof byte[] ? (byte[])payload : payload.toString().getBytes()))); } if (sync) { MuleContext muleContext = MuleServer.getMuleContext(); EndpointBuilder builder = new EndpointURIEndpointBuilder(endpoint, muleContext); builder.setRemoteSync(true); OutboundEndpoint syncEndpoint = muleContext.getRegistry() .lookupEndpointFactory() .getOutboundEndpoint(builder); MuleEvent dispatchEvent = new DefaultMuleEvent(message, syncEndpoint, session, sync); MuleMessage result = endpoint.send(dispatchEvent); if (result != null) { byte[] response = result.getPayloadAsBytes(); Message responseMessage = new Message(response); msgContext.setResponseMessage(responseMessage); } else { logger .warn("No response message was returned from synchronous call to: " + uri); } // remove temp file created for streaming if (payload instanceof File) { ((File)payload).delete(); } } else { MuleEvent dispatchEvent = new DefaultMuleEvent(message, endpoint, session, sync); endpoint.dispatch(dispatchEvent); } } catch (AxisFault axisFault) { throw axisFault; } catch (Exception e) { throw new AxisFault(e.getMessage(), new Throwable(e)); } } protected OutboundEndpoint lookupEndpoint(String uri) throws MuleException { Service axis = RegistryContext.getRegistry().lookupService(AxisConnector.AXIS_SERVICE_COMPONENT_NAME); EndpointURI endpoint = new MuleEndpointURI(uri); MuleContext muleContext = MuleServer.getMuleContext(); OutboundEndpoint ep; if (axis != null) { synchronized (endpointsCache) { ep = (OutboundEndpoint) endpointsCache.get(endpoint.getAddress()); if (ep == null) { updateEndpointCache(axis.getOutboundRouter()); ep = (OutboundEndpoint) endpointsCache.get(endpoint.getAddress()); if (ep == null) { logger.debug("Dispatch Endpoint uri: " + uri + " not found on the cache. Creating the endpoint instead."); ep = muleContext.getRegistry().lookupEndpointFactory() .getOutboundEndpoint(uri); } else { logger.info("Found endpoint: " + uri + " on the Axis service component"); } } else { logger.info("Found endpoint: " + uri + " on the Axis service component"); } } } else { ep = muleContext.getRegistry().lookupEndpointFactory() .getOutboundEndpoint(uri); } return ep; } private void updateEndpointCache(OutboundRouterCollection router) { endpointsCache.clear(); for (Iterator iterator = router.getRouters().iterator(); iterator.hasNext();) { OutboundRouter r = (OutboundRouter)iterator.next(); for (Iterator iterator1 = r.getEndpoints().iterator(); iterator1.hasNext();) { ImmutableEndpoint endpoint = (ImmutableEndpoint)iterator1.next(); endpointsCache.put(endpoint.getEndpointURI().getAddress(), endpoint); } } } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/i18n/0000755000175000017500000000000011351410662026370 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/i18n/AxisMessages.java0000644000175000017500000000203210745677442031645 0ustar charlescharles/* * $Id: AxisMessages.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class AxisMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("axis"); public static Message objectMustImplementAnInterface(String name) { return createMessage(BUNDLE_PATH, 1, name); } public static String serverProviderAndServerConfigConfigured() { return getString(BUNDLE_PATH, 2); } public static String clientProviderAndClientConfigConfigured() { return getString(BUNDLE_PATH, 3); } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/config/0000755000175000017500000000000011351410663027057 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/config/AxisNamespaceHandler.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/config/AxisNamespaceHandler.ja0000644000175000017500000001116610745726444033434 0ustar charlescharles/* * $Id: AxisNamespaceHandler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.MapEntryCombiner; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.collection.ChildListEntryDefinitionParser; import org.mule.config.spring.parsers.delegate.ParentContextDefinitionParser; import org.mule.config.spring.parsers.processors.AttributeConcatenation; import org.mule.config.spring.parsers.specific.properties.ElementInNestedMapDefinitionParser; import org.mule.config.spring.parsers.specific.properties.ListPropertyDefinitionParser; import org.mule.config.spring.parsers.specific.properties.NestedListDefinitionParser; import org.mule.config.spring.parsers.specific.properties.NestedMapWithAttributesDefinitionParser; import org.mule.config.spring.parsers.specific.properties.SimplePropertyDefinitionParser; import org.mule.transport.soap.SoapConstants; import org.mule.transport.soap.axis.AxisConnector; import org.mule.transport.soap.axis.AxisMessageReceiver; import java.util.HashMap; import java.util.Map; import org.apache.axis.constants.Style; import org.apache.axis.constants.Use; import org.w3c.dom.Element; /** * Registers a Bean Definition Parser for handling <axis:connector> elements. */ public class AxisNamespaceHandler extends AbstractMuleNamespaceHandler { public static final String PROPERTIES = "properties"; public static final Map USE_MAP = new HashMap(); public static final Map STYLE_MAP = new HashMap(); static { USE_MAP.put("LITERAL", Use.LITERAL_STR); USE_MAP.put("ENCODED", Use.ENCODED_STR); STYLE_MAP.put("DOCUMENT", Style.DOCUMENT_STR); STYLE_MAP.put("MESSAGE", Style.MESSAGE_STR); STYLE_MAP.put("RPC", Style.RPC_STR); STYLE_MAP.put("WRAPPED", Style.WRAPPED_STR); } public void init() { registerMetaTransportEndpoints(AxisConnector.AXIS).addMapping(AxisConnector.USE, USE_MAP).addMapping(AxisConnector.STYLE, STYLE_MAP); registerConnectorDefinitionParser(AxisConnector.class); registerBeanDefinitionParser("supported-scheme", new ChildListEntryDefinitionParser("supportedSchemes", "value")); registerBeanDefinitionParser("soap-method", new ElementInNestedMapDefinitionParser(PROPERTIES, AxisConnector.SOAP_METHODS, "method")); registerBeanDefinitionParser("soap-parameter", new SoapParameterDefinitionParser()); registerBeanDefinitionParser("soap-return", new SoapReturnDefinitionParser()); registerMuleBeanDefinitionParser("soap-service", new NestedListDefinitionParser(PROPERTIES, SoapConstants.SERVICE_INTERFACES, "interface")); registerMuleBeanDefinitionParser("options", new NestedMapWithAttributesDefinitionParser(PROPERTIES, AxisMessageReceiver.AXIS_OPTIONS)); registerMuleBeanDefinitionParser("option", new SimplePropertyDefinitionParser()); registerMuleBeanDefinitionParser("bean-type", new ParentContextDefinitionParser("connector", new ChildListEntryDefinitionParser(AxisMessageReceiver.BEAN_TYPES, "interface")) .otherwise(new NestedListDefinitionParser(PROPERTIES, AxisMessageReceiver.BEAN_TYPES, "interface"))); } private static class SoapParameterDefinitionParser extends ListPropertyDefinitionParser { public static final String PARAMETER = "parameter"; public SoapParameterDefinitionParser() { super(PARAMETER); registerPreProcessor(new AttributeConcatenation(PARAMETER, ";", new String[]{PARAMETER, "type", "mode"})); } } private static class SoapReturnDefinitionParser extends ListPropertyDefinitionParser { public SoapReturnDefinitionParser() { super(MapEntryCombiner.VALUE); registerPreProcessor(new PreProcessor() { public void preProcess(PropertyConfiguration config, Element element) { element.setAttribute(MapEntryCombiner.VALUE, "return;" + element.getAttribute("type")); } }); } } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extras/0000755000175000017500000000000011351410663027120 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extras/AxisCleanAndAddProperties.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/extras/AxisCleanAndAddProperti0000644000175000017500000000430610745677442033516 0ustar charlescharles/* * $Id: AxisCleanAndAddProperties.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.extras; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import org.mule.transport.soap.SoapConstants; import org.mule.transport.soap.axis.AxisConnector; import org.mule.util.StringUtils; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class AxisCleanAndAddProperties { // add all custom headers, filter out all mule headers (such as // MULE_SESSION) except // for MULE_USER header. Filter out other headers like "soapMethods" and // MuleProperties.MULE_METHOD_PROPERTY and "soapAction" // and also filter out any http related header public static Map cleanAndAdd(MuleEventContext muleEventContext){ Map props = new HashMap(); MuleMessage currentMessage = muleEventContext.getMessage(); for (Iterator iterator = currentMessage.getPropertyNames().iterator(); iterator.hasNext();) { String name = (String)iterator.next(); if (!StringUtils.equals(name, AxisConnector.SOAP_METHODS) && !StringUtils.equals(name, SoapConstants.SOAP_ACTION_PROPERTY) && !StringUtils.equals(name, MuleProperties.MULE_METHOD_PROPERTY) && (!name.startsWith(MuleProperties.PROPERTY_PREFIX) || StringUtils.equals(name, MuleProperties.MULE_USER_PROPERTY)) && !HttpConstants.ALL_HEADER_NAMES.containsValue(name) && !StringUtils.equals(name, HttpConnector.HTTP_STATUS_PROPERTY)) { props.put(name, currentMessage.getProperty(name)); } } return props; } }mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisConnector.java0000644000175000017500000006164510767256152031263 0ustar charlescharles/* * $Id: AxisConnector.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleException; import org.mule.api.context.notification.MuleContextNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import org.mule.component.DefaultJavaComponent; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.MuleContextNotification; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.model.seda.SedaService; import org.mule.object.SingletonObjectFactory; import org.mule.transport.AbstractConnector; import org.mule.transport.http.servlet.ServletConnector; import org.mule.transport.service.TransportFactory; import org.mule.transport.soap.axis.extensions.MuleConfigProvider; import org.mule.transport.soap.axis.extensions.MuleTransport; import org.mule.transport.soap.axis.extensions.WSDDFileProvider; import org.mule.transport.soap.axis.extensions.WSDDJavaMuleProvider; import org.mule.transport.soap.axis.i18n.AxisMessages; import org.mule.util.ClassUtils; import org.mule.util.MuleUrlStreamHandlerFactory; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import org.apache.axis.client.Call; import org.apache.axis.configuration.SimpleProvider; import org.apache.axis.deployment.wsdd.WSDDConstants; import org.apache.axis.deployment.wsdd.WSDDProvider; import org.apache.axis.encoding.TypeMappingRegistryImpl; import org.apache.axis.encoding.ser.BeanDeserializerFactory; import org.apache.axis.encoding.ser.BeanSerializerFactory; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.server.AxisServer; import org.apache.axis.wsdl.fromJava.Namespaces; import org.apache.axis.wsdl.fromJava.Types; /** * AxisConnector is used to maintain one or more Services for Axis * server instance. *

* Some of the Axis specific service initialisation code was adapted from the Ivory * project (http://ivory.codehaus.org). Thanks guys :) */ public class AxisConnector extends AbstractConnector implements MuleContextNotificationListener { /* Register the AxisFault Exception reader if this class gets loaded */ static { ExceptionHelper.registerExceptionReader(new AxisFaultExceptionReader()); } public static final QName QNAME_MULE_PROVIDER = new QName(WSDDConstants.URI_WSDD_JAVA, "Mule"); public static final QName QNAME_MULE_TYPE_MAPPINGS = new QName("http://www.muleumo.org/ws/mappings", "Mule"); public static final String DEFAULT_MULE_NAMESPACE_URI = "http://www.muleumo.org"; public static final String DEFAULT_MULE_AXIS_SERVER_CONFIG = "mule-axis-server-config.wsdd"; public static final String DEFAULT_MULE_AXIS_CLIENT_CONFIG = "mule-axis-client-config.wsdd"; public static final String AXIS_SERVICE_COMPONENT_NAME = "_axisServiceComponent"; public static final String AXIS_SERVICE_PROPERTY = "_axisService"; public static final String AXIS_CLIENT_CONFIG_PROPERTY = "clientConfig"; public static final String SERVICE_PROPERTY_COMPONENT_NAME = "componentName"; public static final String SERVICE_PROPERTY_SERVCE_PATH = "servicePath"; public static final String AXIS = "axis"; // used by dispatcher and receiver public static final String SOAP_METHODS = "soapMethods"; public static final String STYLE = "style"; public static final String USE = "use"; private String serverConfig = DEFAULT_MULE_AXIS_SERVER_CONFIG; private AxisServer axis = null; private SimpleProvider serverProvider = null; private String clientConfig = DEFAULT_MULE_AXIS_CLIENT_CONFIG; private SimpleProvider clientProvider = null; private List beanTypes; private Service axisComponent; //this will store the name of the descriptor of the current connector's AxisServiceComponent //private String specificAxisServiceComponentName; /** * These protocols will be set on client invocations. By default Mule uses it's * own transports rather that Axis's. This is only because it gives us more * flexibility inside Mule and simplifies the code */ private Map axisTransportProtocols = null; /** * A store of registered servlet services that need to have their endpoints * re-written with the 'real' http url instead of the servlet:// one. This is * only required to ensure wsdl is generated correctly. I would like a clearer * way of doing this so I can remove this workaround */ private List servletServices = new ArrayList(); private List supportedSchemes = null; private boolean doAutoTypes = true; private boolean treatMapAsNamedParams = true; public AxisConnector() { super(); this.registerProtocols(); } protected void registerProtocols() { if (supportedSchemes == null) { // Default supported schemes, these can be restricted // through configuration supportedSchemes = new ArrayList(); supportedSchemes.add("http"); supportedSchemes.add("https"); supportedSchemes.add("servlet"); supportedSchemes.add("vm"); supportedSchemes.add("jms"); supportedSchemes.add("xmpp"); supportedSchemes.add("ssl"); supportedSchemes.add("tcp"); supportedSchemes.add("smtp"); supportedSchemes.add("smtps"); supportedSchemes.add("pop3"); supportedSchemes.add("pop3s"); supportedSchemes.add("imap"); supportedSchemes.add("imaps"); } for (Iterator iterator = supportedSchemes.iterator(); iterator.hasNext();) { String s = (String) iterator.next(); registerSupportedProtocol(s); } } protected void doInitialise() throws InitialisationException { axisTransportProtocols = new HashMap(); //specificAxisServiceComponentName = AXIS_SERVICE_COMPONENT_NAME + "_" + name; axisTransportProtocols = new HashMap(); try { for (Iterator iterator = supportedSchemes.iterator(); iterator.hasNext();) { String s = (String) iterator.next(); axisTransportProtocols.put(s, MuleTransport.getTransportClass(s)); registerSupportedProtocol(s); } muleContext.registerListener(this); } catch (Exception e) { throw new InitialisationException(e, this); } // TODO DO: call registerSupportedProtocol if axisTransportProtocols are set from external? if (clientProvider == null) { clientProvider = createAxisProvider(clientConfig); } else { if (!DEFAULT_MULE_AXIS_CLIENT_CONFIG.equals(clientConfig)) { logger.warn(AxisMessages.clientProviderAndClientConfigConfigured()); } } if (axis == null) { if (serverProvider == null) { serverProvider = this.createAxisProvider(serverConfig); } else { if (!DEFAULT_MULE_AXIS_SERVER_CONFIG.equals(serverConfig)) { logger.warn(AxisMessages.serverProviderAndServerConfigConfigured()); } } // Create the AxisServer axis = new AxisServer(serverProvider); // principle of least surprise: doAutoTypes only has effect on our self-configured AxisServer axis.setOption("axis.doAutoTypes", Boolean.valueOf(doAutoTypes)); } // Register the Mule service serverProvider WSDDProvider.registerProvider(QNAME_MULE_PROVIDER, new WSDDJavaMuleProvider(this)); try { registerTransportTypes(); } catch (ClassNotFoundException e) { throw new InitialisationException( CoreMessages.cannotLoadFromClasspath(e.getMessage()), e, this); } // Register all our UrlStreamHandlers here so they can be resolved. This is necessary // to make Mule work in situations where modification of system properties at runtime // is not reliable, e.g. when running in maven's surefire test executor. MuleUrlStreamHandlerFactory.registerHandler("jms", new org.mule.transport.soap.axis.transport.jms.Handler()); MuleUrlStreamHandlerFactory.registerHandler("pop3", new org.mule.transport.soap.axis.transport.pop3.Handler()); MuleUrlStreamHandlerFactory.registerHandler("smtp", new org.mule.transport.soap.axis.transport.smtp.Handler()); MuleUrlStreamHandlerFactory.registerHandler("vm", new org.mule.transport.soap.axis.transport.vm.Handler()); try { registerTypes((TypeMappingRegistryImpl) axis.getTypeMappingRegistry(), beanTypes); } catch (ClassNotFoundException e) { throw new InitialisationException(e, this); } } protected void registerTransportTypes() throws ClassNotFoundException { // Register Transport handlers // By default these will all be handled by Mule, however some companies may // have their own they wish to use for (Iterator iterator = getAxisTransportProtocols().keySet().iterator(); iterator.hasNext();) { String protocol = (String) iterator.next(); Object temp = getAxisTransportProtocols().get(protocol); Class clazz; if (temp instanceof String) { clazz = ClassUtils.loadClass(temp.toString(), getClass()); } else { clazz = (Class) temp; } Call.setTransportForProtocol(protocol, clazz); } } protected SimpleProvider createAxisProvider(String config) throws InitialisationException { // Use our custom file provider that does not require services to be declared // in the WSDD. This only affects the // client side as the client will fallback to the FileProvider when invoking // a service. WSDDFileProvider fileProvider = new WSDDFileProvider(config); fileProvider.setSearchClasspath(true); /* * Wrap the FileProvider with a SimpleProvider so we can programmatically * configure the Axis server (you can only use wsdd descriptors with the * FileProvider) */ return new MuleConfigProvider(fileProvider); } public String getProtocol() { return AXIS; } /** * The method determines the key used to store the receiver against. * * @param component the component for which the endpoint is being registered * @param endpoint the endpoint being registered for the component * @return the key to store the newly created receiver against. In this case it * is the component name, which is equivalent to the Axis service name. */ protected Object getReceiverKey(Service component, InboundEndpoint endpoint) { if (endpoint.getEndpointURI().getPort() == -1) { return component.getName(); } else { return endpoint.getEndpointURI().getAddress() + "/" + component.getName(); } } protected void unregisterReceiverWithMuleService(MessageReceiver receiver, EndpointURI ep) throws MuleException { String endpointKey = getCounterEndpointKey(receiver.getEndpointURI()); for (Iterator iterator = axisComponent.getInboundRouter().getEndpoints().iterator(); iterator.hasNext();) { ImmutableEndpoint umoEndpoint = (ImmutableEndpoint) iterator.next(); if (endpointKey.startsWith(umoEndpoint.getEndpointURI().getAddress())) { logger.info("Unregistering Axis endpoint: " + endpointKey + " for service: " + ((AxisMessageReceiver) receiver).getSoapService().getName()); } try { umoEndpoint.getConnector() .unregisterListener(receiver.getService(), receiver.getEndpoint()); } catch (Exception e) { logger.error("Failed to unregister Axis endpoint: " + endpointKey + " for service: " + receiver.getService().getName() + ". Error is: " + e.getMessage(), e); } } } protected void registerReceiverWithMuleService(MessageReceiver receiver, EndpointURI ep) throws MuleException { // If this is the first receiver we need to create the Axis service // component this will be registered with Mule when the Connector starts // See if the axis descriptor has already been added. This allows // developers to override the default configuration, say to increase // the threadpool if (axisComponent == null) { axisComponent = getOrCreateAxisComponent(); } else { // Lets unregister the 'template' instance, configure it and // then register again later muleContext.getRegistry().unregisterService(AXIS_SERVICE_PROPERTY + getName()); } String serviceName = ((AxisMessageReceiver) receiver).getSoapService().getName(); // No determine if the endpointUri requires a new connector to be // registed in the case of http we only need to register the new endpointUri // if the port is different If we're using VM or Jms we just use the resource // info directly without appending a service name String endpoint; String scheme = ep.getScheme().toLowerCase(); if (scheme.equals("jms") || scheme.equals("vm")) { endpoint = ep.toString(); } else { endpoint = receiver.getEndpointURI().getAddress() + "/" + serviceName; } if (logger.isDebugEnabled()) { logger.debug("Modified endpoint with " + scheme + " scheme to " + endpoint); } boolean sync = receiver.getEndpoint().isSynchronous(); EndpointBuilder serviceEndpointbuilder = new EndpointURIEndpointBuilder(endpoint, muleContext); serviceEndpointbuilder.setSynchronous(sync); serviceEndpointbuilder.setName(ep.getScheme() + ":" + serviceName); // Set the transformers on the endpoint too serviceEndpointbuilder.setTransformers(receiver.getEndpoint().getTransformers().isEmpty() ? null : receiver.getEndpoint().getTransformers()); serviceEndpointbuilder.setResponseTransformers(receiver.getEndpoint().getResponseTransformers().isEmpty() ? null : receiver.getEndpoint().getResponseTransformers()); // set the filter on the axis endpoint on the real receiver endpoint serviceEndpointbuilder.setFilter(receiver.getEndpoint().getFilter()); // set the Security filter on the axis endpoint on the real receiver // endpoint serviceEndpointbuilder.setSecurityFilter(receiver.getEndpoint().getSecurityFilter()); // TODO Do we really need to modify the existing receiver endpoint? What happens if we don't security, // filters and transformers will get invoked twice? EndpointBuilder receiverEndpointBuilder = new EndpointURIEndpointBuilder(receiver.getEndpoint(), muleContext); // Remove the Axis filter now receiverEndpointBuilder.setFilter(null); // Remove the Axis Receiver Security filter now receiverEndpointBuilder.setSecurityFilter(null); InboundEndpoint serviceEndpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint(serviceEndpointbuilder); InboundEndpoint receiverEndpoint = muleContext.getRegistry() .lookupEndpointFactory() .getInboundEndpoint(receiverEndpointBuilder); receiver.setEndpoint(receiverEndpoint); axisComponent.getInboundRouter().addEndpoint(serviceEndpoint); } private String getCounterEndpointKey(EndpointURI endpointURI) { StringBuffer endpointKey = new StringBuffer(64); endpointKey.append(endpointURI.getScheme()); endpointKey.append("://"); endpointKey.append(endpointURI.getHost()); if (endpointURI.getPort() > -1) { endpointKey.append(":"); endpointKey.append(endpointURI.getPort()); } return endpointKey.toString(); } // This initialization could be performed in the initialize() method. Putting it here essentially makes // it a lazy-create/lazy-init // Another option would be to put it in the default-axis-config.xml (MULE-2102) with lazy-init="true" // but that makes us depend on Spring. // Another consideration is how/when this implicit component gets disposed. protected Service getOrCreateAxisComponent() throws MuleException { Service c = muleContext.getRegistry().lookupService(AXIS_SERVICE_PROPERTY + getName()); if (c == null) { // TODO MULE-2228 Simplify this API c = new SedaService(); c.setName(AXIS_SERVICE_PROPERTY + getName()); c.setModel(muleContext.getRegistry().lookupSystemModel()); Map props = new HashMap(); props.put(AXIS, axis); SingletonObjectFactory of = new SingletonObjectFactory(AxisServiceComponent.class, props); of.initialise(); c.setComponent(new DefaultJavaComponent(of)); } return c; } /** * Template method to perform any work when starting the connectoe * * @throws org.mule.api.MuleException if the method fails */ protected void doStart() throws MuleException { axis.start(); } /** * Template method to perform any work when stopping the connectoe * * @throws org.mule.api.MuleException if the method fails */ protected void doStop() throws MuleException { axis.stop(); // Model model = muleContext.getRegistry().lookupModel(); // model.unregisterComponent(model.getDescriptor(AXIS_SERVICE_COMPONENT_NAME)); } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } protected void doDispose() { // template method } public String getServerConfig() { return serverConfig; } public void setServerConfig(String serverConfig) { this.serverConfig = serverConfig; } public List getBeanTypes() { return beanTypes; } public void setBeanTypes(List beanTypes) { this.beanTypes = beanTypes; } public String getClientConfig() { return clientConfig; } public void setClientConfig(String clientConfig) { this.clientConfig = clientConfig; } public AxisServer getAxis() { return axis; } public void setAxis(AxisServer axisServer) { this.axis = axisServer; } public SimpleProvider getServerProvider() { return serverProvider; } public void setServerProvider(SimpleProvider serverProvider) { this.serverProvider = serverProvider; } public SimpleProvider getClientProvider() { return clientProvider; } public void setClientProvider(SimpleProvider clientProvider) { this.clientProvider = clientProvider; } public Map getAxisTransportProtocols() { return axisTransportProtocols; } public void setAxisTransportProtocols(Map axisTransportProtocols) { this.axisTransportProtocols.putAll(axisTransportProtocols); } void addServletService(SOAPService service) { servletServices.add(service); } public List getSupportedSchemes() { return supportedSchemes; } public void setSupportedSchemes(List supportedSchemes) { this.supportedSchemes = supportedSchemes; } public boolean isDoAutoTypes() { return doAutoTypes; } public void setDoAutoTypes(boolean doAutoTypes) { this.doAutoTypes = doAutoTypes; } void registerTypes(TypeMappingRegistryImpl registry, List types) throws ClassNotFoundException { if (types != null) { Class clazz; for (Iterator iterator = types.iterator(); iterator.hasNext();) { clazz = ClassUtils.loadClass(iterator.next().toString(), getClass()); String localName = Types.getLocalNameFromFullName(clazz.getName()); QName xmlType = new QName(Namespaces.makeNamespace(clazz.getName()), localName); registry.getDefaultTypeMapping().register(clazz, xmlType, new BeanSerializerFactory(clazz, xmlType), new BeanDeserializerFactory(clazz, xmlType)); } } } public boolean isTreatMapAsNamedParams() { return treatMapAsNamedParams; } public void setTreatMapAsNamedParams(boolean treatMapAsNamedParams) { this.treatMapAsNamedParams = treatMapAsNamedParams; } public void onNotification(ServerNotification notification) { if (notification.getAction() == MuleContextNotification.CONTEXT_STARTED) { // We need to register the Axis service component once the muleContext // starts because when the model starts listeners on components are started, thus // all listener need to be registered for this connector before the Axis service // component is registered. // The implication of this is that to add a new service and a // different http port the model needs to be restarted before the listener is available if (muleContext.getRegistry().lookupService(AXIS_SERVICE_PROPERTY + getName()) == null) { try { // Descriptor might be null if no inbound endpoints have been // register for the Axis connector if (axisComponent == null) { axisComponent = getOrCreateAxisComponent(); } muleContext.getRegistry().registerService(axisComponent); // We have to perform a small hack here to rewrite servlet:// // endpoints with the // real http:// address for (Iterator iterator = servletServices.iterator(); iterator.hasNext();) { SOAPService service = (SOAPService) iterator.next(); ServletConnector servletConnector = (ServletConnector) TransportFactory.getConnectorByProtocol("servlet"); String url = servletConnector.getServletUrl(); if (url != null) { service.getServiceDescription().setEndpointURL(url + "/" + service.getName()); } else { logger.error("The servletUrl property on the ServletConntector has not been set this means that wsdl generation for service '" + service.getName() + "' may be incorrect"); } } servletServices.clear(); } catch (MuleException e) { handleException(e); } } } } public boolean isSyncEnabled(String protocol) { protocol = protocol.toLowerCase(); if (protocol.equals("http") || protocol.equals("https") || protocol.equals("ssl") || protocol.equals("tcp") || protocol.equals("servlet")) { return true; } else { return super.isSyncEnabled(protocol); } } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/transport/0000755000175000017500000000000011351410662027645 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/transport/smtp/0000755000175000017500000000000011351410662030630 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/transport/smtp/Handler.java0000644000175000017500000000156310745677442033076 0ustar charlescharles/* * $Id: Handler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.transport.smtp; import org.mule.transport.soap.axis.transport.VoidURLConnection; import java.net.URL; import java.net.URLConnection; /** * A Dummy Url handler for handling smtp. This is needed becuase Axis uses * urlStreamHandlers to parse non-http urls. */ public class Handler extends java.net.URLStreamHandler { protected URLConnection openConnection(URL url) { return new VoidURLConnection(url); } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/transport/pop3/0000755000175000017500000000000011351410662030526 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/transport/pop3/Handler.java0000644000175000017500000000156310745677442032774 0ustar charlescharles/* * $Id: Handler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.transport.pop3; import org.mule.transport.soap.axis.transport.VoidURLConnection; import java.net.URL; import java.net.URLConnection; /** * A Dummy Url handler for handling pop3. This is needed becuase Axis uses * urlStreamHandlers to parse non-http urls. */ public class Handler extends java.net.URLStreamHandler { protected URLConnection openConnection(URL url) { return new VoidURLConnection(url); } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/transport/jms/0000755000175000017500000000000011351410662030436 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/transport/jms/Handler.java0000644000175000017500000000156110745677442032702 0ustar charlescharles/* * $Id: Handler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.transport.jms; import org.mule.transport.soap.axis.transport.VoidURLConnection; import java.net.URL; import java.net.URLConnection; /** * A Dummy Url handler for handling jms. This is needed becuase Axis uses * urlStreamHandlers to parse non-http urls. */ public class Handler extends java.net.URLStreamHandler { protected URLConnection openConnection(URL url) { return new VoidURLConnection(url); } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/transport/vm/0000755000175000017500000000000011351410662030267 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/transport/vm/Handler.java0000644000175000017500000000155710745677442032540 0ustar charlescharles/* * $Id: Handler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.transport.vm; import org.mule.transport.soap.axis.transport.VoidURLConnection; import java.net.URL; import java.net.URLConnection; /** * A Dummy Url handler for handling vm. This is needed becuase Axis uses * urlStreamHandlers to parse non-http urls. */ public class Handler extends java.net.URLStreamHandler { protected URLConnection openConnection(URL url) { return new VoidURLConnection(url); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/transport/VoidURLConnection.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/transport/VoidURLConnection.ja0000644000175000017500000000163010745677442033506 0ustar charlescharles/* * $Id: VoidURLConnection.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.transport; import java.net.URL; /** * A fake url connection used to bypass Axis's use of the URLStreamHandler to mask * uris as Urls. This was also necessary because of the uncessary use of static * blocking in the axis URLStreamHandler objects. */ public class VoidURLConnection extends java.net.URLConnection { public VoidURLConnection(URL url) { super(url); } public void connect() { // nothing to do } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcher.java0000644000175000017500000005267610757615756032740 0ustar charlescharles/* * $Id: AxisMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.DispatchException; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractMessageDispatcher; import org.mule.transport.NullPayload; import org.mule.transport.soap.NamedParameter; import org.mule.transport.soap.SoapConstants; import org.mule.transport.soap.SoapMethod; import org.mule.transport.soap.i18n.SoapMessages; import org.mule.util.BeanUtils; import org.mule.util.StringUtils; import org.mule.util.TemplateParser; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.activation.DataHandler; import javax.xml.namespace.QName; import org.apache.axis.AxisProperties; import org.apache.axis.EngineConfiguration; import org.apache.axis.MessageContext; import org.apache.axis.attachments.AttachmentPart; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.configuration.FileProvider; import org.apache.axis.constants.Style; import org.apache.axis.constants.Use; import org.apache.axis.wsdl.fromJava.Namespaces; import org.apache.axis.wsdl.fromJava.Types; /** * AxisMessageDispatcher is used to make soap requests via the Axis * soap client. */ public class AxisMessageDispatcher extends AbstractMessageDispatcher { protected EngineConfiguration clientConfig; protected AxisConnector connector; protected Service service; private Map callParameters; public AxisMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); this.connector = (AxisConnector)endpoint.getConnector(); AxisProperties.setProperty("axis.doAutoTypes", Boolean.toString(connector.isDoAutoTypes())); } protected void doConnect() throws Exception { if (service == null) { service = createService(endpoint); } } protected void doDisconnect() throws Exception { if (service != null) { service = null; } } protected void doDispose() { // template method } protected synchronized EngineConfiguration getClientConfig(ImmutableEndpoint endpoint) { if (clientConfig == null) { // Allow the client config to be set on the endpoint String config; config = (String)endpoint.getProperty(AxisConnector.AXIS_CLIENT_CONFIG_PROPERTY); if (config != null) { clientConfig = new FileProvider(config); } else { clientConfig = connector.getClientProvider(); } } return clientConfig; } protected Service createService(ImmutableEndpoint endpoint) throws Exception { // Create a simple axis service without wsdl EngineConfiguration config = getClientConfig(endpoint); return new Service(config); } protected void doDispatch(MuleEvent event) throws Exception { Object[] args = getArgs(event); Call call = getCall(event, args); // dont use invokeOneWay here as we are already in a thread pool. // Axis creates a new thread for every invoke one way call. nasty! // Mule overides the default Axis HttpSender to return immediately if // the axis.one.way property is set call.setProperty("axis.one.way", Boolean.TRUE); call.setProperty(MuleProperties.MULE_EVENT_PROPERTY, event); call.invoke(args); } protected MuleMessage doSend(MuleEvent event) throws Exception { Call call; Object result; Object[] args = getArgs(event); call = getCall(event, args); result = call.invoke(args); if (result == null) { return null; } else { MuleMessage resultMessage = new DefaultMuleMessage(result, event.getMessage()); setMessageContextProperties(resultMessage, call.getMessageContext()); return resultMessage; } } protected Call getCall(MuleEvent event, Object[] args) throws Exception { EndpointURI endpointUri = event.getEndpoint().getEndpointURI(); Object method = getInitialMethod(event); // changes object state Call call = (Call) service.createCall(); parseStyle(event, call); parseUse(event, call); // set properties on the call from the endpoint properties BeanUtils.populateWithoutFail(call, event.getEndpoint().getProperties(), false); call.setTargetEndpointAddress(endpointUri.getAddress()); method = refineMethod(event, call, method); String methodNamespace = call.getOperationName().getNamespaceURI(); // set Mule event here so that handlers can extract info call.setProperty(MuleProperties.MULE_EVENT_PROPERTY, event); call.setProperty(MuleProperties.MULE_ENDPOINT_PROPERTY, event.getEndpoint()); setCustomProperties(event, call); call.setTimeout(new Integer(event.getTimeout())); setUserCredentials(endpointUri, call); Map methodCalls = (Map)event.getMessage().getProperty(AxisConnector.SOAP_METHODS); if (methodCalls == null && !(method instanceof SoapMethod)) { buildSoapMethods(event, call, method, methodNamespace, args); } setCallParams(call, event, call.getOperationName()); setSoapAction(event, endpointUri, call); addAttachments(event, call); return call; } protected void addAttachments(MuleEvent event, Call call) { // Add any attachments to the call for (Iterator iterator = event.getMessage().getAttachmentNames().iterator(); iterator.hasNext();) { String name = (String)iterator.next(); DataHandler dh = event.getMessage().getAttachment(name); AttachmentPart part = new AttachmentPart(dh); call.addAttachmentPart(part); } } protected void setSoapAction(MuleEvent event, EndpointURI endpointUri, Call call) { // Set custom soap action if set on the event or endpoint String soapAction = (String)event.getMessage().getProperty(SoapConstants.SOAP_ACTION_PROPERTY); if (soapAction != null) { soapAction = parseSoapAction(soapAction, call.getOperationName(), event); call.setSOAPActionURI(soapAction); call.setUseSOAPAction(Boolean.TRUE.booleanValue()); } else { call.setSOAPActionURI(endpointUri.getAddress()); } } protected void buildSoapMethods(MuleEvent event, Call call, Object method, String methodNamespace, Object[] args) { List params = new ArrayList(); for (int i = 0; i < args.length; i++) { if (args[i] == null) { QName qname = call.getTypeMapping().getTypeQName(Object.class); params.add("value" + i + ";qname{" + qname.getPrefix() + ":" + qname.getLocalPart() + ":" + qname.getNamespaceURI() + "};in"); } else if (args[i] instanceof DataHandler[]) { params.add("attachments;qname{DataHandler:http://xml.apache.org/xml-soap};in"); // Convert key/value pairs into the parameters } else if (args[i] instanceof Map && connector.isTreatMapAsNamedParams()) { for (Iterator iterator = ((Map)args[i]).entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry)iterator.next(); if (call.getTypeMapping().getTypeQName(entry.getValue().getClass()) != null) { QName type = call.getTypeMapping().getTypeQName(entry.getValue().getClass()); params.add("qname{" + entry.getKey().toString() + (methodNamespace == null ? "" : ":" + methodNamespace) + "};qname{" + type.getPrefix() + ":" + type.getLocalPart() + ":" + type.getNamespaceURI() + "};in"); } else { params.add("value" + i + ";qname{" + Types.getLocalNameFromFullName(args[i].getClass().getName()) + ":" + Namespaces.makeNamespace(args[i].getClass().getName()) + "};in"); params.add("qname{" + entry.getKey().toString() + (methodNamespace == null ? "" : ":" + methodNamespace) + "};qname{" + Types.getLocalNameFromFullName(args[i].getClass().getName()) + ":" + Namespaces.makeNamespace(args[i].getClass().getName()) + "};in"); } } } else if (call.getTypeMapping().getTypeQName(args[i].getClass()) != null) { QName qname = call.getTypeMapping().getTypeQName(args[i].getClass()); params.add("value" + i + ";qname{" + qname.getPrefix() + ":" + qname.getLocalPart() + ":" + qname.getNamespaceURI() + "};in"); } else { params.add("value" + i + ";qname{" + Types.getLocalNameFromFullName(args[i].getClass().getName()) + ":" + Namespaces.makeNamespace(args[i].getClass().getName()) + "};in"); } } HashMap map = new HashMap(); map.put(method, params); event.getMessage().setProperty(AxisConnector.SOAP_METHODS, map); } protected void setUserCredentials(EndpointURI endpointUri, Call call) { if (endpointUri.getUserInfo() != null) { call.setUsername(endpointUri.getUser()); call.setPassword(endpointUri.getPassword()); } } protected void setCustomProperties(MuleEvent event, Call call) { for (Iterator iter = event.getMessage().getPropertyNames().iterator(); iter.hasNext();) { String key = (String)iter.next(); if (!(key.startsWith(MuleProperties.PROPERTY_PREFIX))) { Object value = event.getMessage().getProperty(key); if (value != null) { call.setProperty(key, value); } } } } protected Object refineMethod(MuleEvent event, Call call, Object method) { if (method instanceof String) { // Set a custome method namespace if one is set. This will be used forthe // parameters too String methodNamespace = (String)event.getMessage().getProperty(SoapConstants.METHOD_NAMESPACE_PROPERTY); if (methodNamespace != null) { call.setOperationName(new QName(methodNamespace, method.toString())); } else { call.setOperationName(new QName(method.toString())); } } else if (method instanceof QName) { call.setOperationName((QName)method); method = ((QName)method).getLocalPart(); } else { call.setOperationName(((SoapMethod)method).getName()); } return method; } protected void parseUse(MuleEvent event, Call call) { // Set use: Endcoded/Literal String use = event.getMessage().getStringProperty(AxisConnector.USE, null); if (use != null) { Use u = Use.getUse(use); if (u == null) { throw new IllegalArgumentException( CoreMessages.valueIsInvalidFor(use, AxisConnector.USE).toString()); } else { call.setOperationUse(u); } } } protected void parseStyle(MuleEvent event, Call call) { // Note that Axis has specific rules to how these two variables are // combined. This is handled for us // Set style: RPC/wrapped/Doc/Message String style = event.getMessage().getStringProperty(AxisConnector.STYLE, null); if (style != null) { Style s = Style.getStyle(style); if (s == null) { throw new IllegalArgumentException( CoreMessages.valueIsInvalidFor(style, AxisConnector.STYLE).toString()); } else { call.setOperationStyle(s); } } } protected Object getInitialMethod(MuleEvent event) throws DispatchException { Object method = event.getMessage().getProperty(MuleProperties.MULE_METHOD_PROPERTY); if (method == null) { method = event.getEndpoint().getEndpointURI().getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY); } if (method == null) { throw new DispatchException( SoapMessages.cannotInvokeCallWithoutOperation(), event.getMessage(), event.getEndpoint()); } else if (method instanceof SoapMethod) { synchronized (this) { if (callParameters == null) { callParameters = new HashMap(); } callParameters.put(((SoapMethod)method).getName().getLocalPart(), method); } } return method; } private Object[] getArgs(MuleEvent event) throws TransformerException { Object payload = event.transformMessage(); Object[] args; if (payload instanceof Object[]) { args = (Object[])payload; } else { args = new Object[]{payload}; } if (event.getMessage().getAttachmentNames() != null && event.getMessage().getAttachmentNames().size() > 0) { ArrayList attachments = new ArrayList(); Iterator i = event.getMessage().getAttachmentNames().iterator(); while (i.hasNext()) { attachments.add(event.getMessage().getAttachment((String)i.next())); } ArrayList temp = new ArrayList(Arrays.asList(args)); temp.add(attachments.toArray(new DataHandler[0])); args = temp.toArray(); } return args; } protected void setMessageContextProperties(MuleMessage message, MessageContext ctx) { String temp = ctx.getStrProp(MuleProperties.MULE_CORRELATION_ID_PROPERTY); if (StringUtils.isNotBlank(temp)) { message.setCorrelationId(temp); } temp = ctx.getStrProp(MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY); if (StringUtils.isNotBlank(temp)) { message.setCorrelationGroupSize(Integer.parseInt(temp)); } temp = ctx.getStrProp(MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY); if (StringUtils.isNotBlank(temp)) { message.setCorrelationSequence(Integer.parseInt(temp)); } temp = ctx.getStrProp(MuleProperties.MULE_REPLY_TO_PROPERTY); if (StringUtils.isNotBlank(temp)) { message.setReplyTo(temp); } } protected void setMessageContextAttachments(MuleMessage message, MessageContext ctx) throws Exception { int x = 0; for (Iterator iterator = ctx.getMessage().getAttachments(); iterator.hasNext(); x++) { message.addAttachment(String.valueOf(x), ((AttachmentPart)iterator.next()).getActivationDataHandler()); } } protected static MuleMessage createMessage(Object result, Call call) { if (result == null) { result = NullPayload.getInstance(); } Map props = new HashMap(); Iterator iter = call.getMessageContext().getPropertyNames(); Object key; while (iter.hasNext()) { key = iter.next(); props.put(key, call.getMessageContext().getProperty(key.toString())); } props.put("soap.message", call.getMessageContext().getMessage()); call.clearHeaders(); call.clearOperation(); return new DefaultMuleMessage(result, props); } public String parseSoapAction(String soapAction, QName method, MuleEvent event) { EndpointURI endpointURI = event.getEndpoint().getEndpointURI(); Map properties = new HashMap(); MuleMessage msg = event.getMessage(); for (Iterator iterator = msg.getPropertyNames().iterator(); iterator.hasNext();) { String propertyKey = (String)iterator.next(); properties.put(propertyKey, msg.getProperty(propertyKey)); } properties.put(MuleProperties.MULE_METHOD_PROPERTY, method.getLocalPart()); properties.put("methodNamespace", method.getNamespaceURI()); properties.put("address", endpointURI.getAddress()); properties.put("scheme", endpointURI.getScheme()); properties.put("host", endpointURI.getHost()); properties.put("port", String.valueOf(endpointURI.getPort())); properties.put("path", endpointURI.getPath()); properties.put("hostInfo", endpointURI.getScheme() + "://" + endpointURI.getHost() + (endpointURI.getPort() > -1 ? ":" + String.valueOf(endpointURI.getPort()) : "")); if (event.getService() != null) { properties.put("serviceName", event.getService().getName()); } TemplateParser tp = TemplateParser.createSquareBracesStyleParser(); soapAction = tp.parse(properties, soapAction); if (logger.isDebugEnabled()) { logger.debug("SoapAction for this call is: " + soapAction); } return soapAction; } private void setCallParams(Call call, MuleEvent event, QName method) throws ClassNotFoundException { synchronized (this) { if (callParameters == null) { loadCallParams(event, method.getNamespaceURI()); } } SoapMethod soapMethod = (SoapMethod)event.getMessage() .removeProperty(MuleProperties.MULE_SOAP_METHOD); if (soapMethod == null) { soapMethod = (SoapMethod)callParameters.get(method.getLocalPart()); } if (soapMethod != null) { for (Iterator iterator = soapMethod.getNamedParameters().iterator(); iterator.hasNext();) { NamedParameter parameter = (NamedParameter)iterator.next(); call.addParameter(parameter.getName(), parameter.getType(), parameter.getMode()); } if (soapMethod.getReturnType() != null) { call.setReturnType(soapMethod.getReturnType()); } else if (soapMethod.getReturnClass() != null) { call.setReturnClass(soapMethod.getReturnClass()); } call.setOperationName(soapMethod.getName()); } } private void loadCallParams(MuleEvent event, String namespace) throws ClassNotFoundException { Map methodCalls = (Map)event.getMessage().getProperty(AxisConnector.SOAP_METHODS); if (methodCalls == null) { return; } Map.Entry entry; SoapMethod soapMethod; callParameters = new HashMap(); for (Iterator iterator = methodCalls.entrySet().iterator(); iterator.hasNext();) { entry = (Map.Entry)iterator.next(); if (StringUtils.isEmpty(namespace)) { if (entry.getValue() instanceof List) { soapMethod = new SoapMethod(entry.getKey().toString(), (List)entry.getValue()); } else { soapMethod = new SoapMethod(entry.getKey().toString(), entry.getValue().toString()); } } else { if (entry.getValue() instanceof List) { soapMethod = new SoapMethod(new QName(namespace, entry.getKey().toString()), (List)entry.getValue()); } else { soapMethod = new SoapMethod(new QName(namespace, entry.getKey().toString()), entry.getValue().toString()); } } callParameters.put(soapMethod.getName().getLocalPart(), soapMethod); } } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageReceiver.java0000644000175000017500000003517010766654216032376 0ustar charlescharles/* * $Id: AxisMessageReceiver.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleException; import org.mule.api.component.Component; import org.mule.api.component.JavaComponent; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.component.AbstractJavaComponent; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractMessageReceiver; import org.mule.transport.soap.NamedParameter; import org.mule.transport.soap.SoapMethod; import org.mule.transport.soap.axis.extensions.MuleMsgProvider; import org.mule.transport.soap.axis.extensions.MuleRPCProvider; import org.mule.transport.soap.axis.i18n.AxisMessages; import org.mule.util.StringUtils; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.rpc.ParameterMode; import org.apache.axis.AxisProperties; import org.apache.axis.constants.Style; import org.apache.axis.constants.Use; import org.apache.axis.description.OperationDesc; import org.apache.axis.description.ParameterDesc; import org.apache.axis.handlers.soap.SOAPService; import org.apache.axis.providers.java.JavaProvider; import org.apache.axis.wsdl.fromJava.Namespaces; /** * AxisMessageReceiver is used to register a component as a service * with a Axis server. */ public class AxisMessageReceiver extends AbstractMessageReceiver { public static final String AXIS_OPTIONS = "axisOptions"; public static final String BEAN_TYPES = "beanTypes"; public static final String SERVICE_NAMESPACE = "serviceNamespace"; protected AxisConnector connector; protected SOAPService soapService; public AxisMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); this.connector = (AxisConnector) connector; try { AxisServiceProxy.setProperties(endpoint.getProperties()); create(); } catch (Exception e) { throw new CreateException(e, this); } } protected void create() throws Exception { AxisProperties.setProperty("axis.doAutoTypes", String.valueOf(connector.isDoAutoTypes())); // TODO RM: these are endpoint properties now // String style = (String)descriptor.getProperties().get("style"); // String use = (String)descriptor.getProperties().get("use"); // String doc = (String)descriptor.getProperties().get("documentation"); String style = (String) endpoint.getProperties().get(AxisConnector.STYLE); String use = (String) endpoint.getProperties().get(AxisConnector.USE); String doc = (String) endpoint.getProperties().get("documentation"); EndpointURI uri = endpoint.getEndpointURI(); String serviceName = service.getName(); SOAPService existing = this.connector.getAxis().getService(serviceName); if (existing != null) { soapService = existing; logger.debug("Using existing service for " + serviceName); } else { // Check if the style is message. If so, we need to create // a message oriented provider if (style != null && style.equalsIgnoreCase("message")) { logger.debug("Creating Message Provider"); soapService = new SOAPService(new MuleMsgProvider(connector)); // } else if (style != null && style.equalsIgnoreCase("document")) { // logger.debug("Creating Doc Provider"); // service = new SOAPService(new MuleDocLitProvider(connector)); } else { logger.debug("Creating RPC Provider"); soapService = new SOAPService(new MuleRPCProvider(connector)); } soapService.setEngine(connector.getAxis()); } String servicePath = uri.getPath(); soapService.setOption(serviceName, this); soapService.setOption(AxisConnector.SERVICE_PROPERTY_SERVCE_PATH, servicePath); soapService.setOption(AxisConnector.SERVICE_PROPERTY_COMPONENT_NAME, serviceName); soapService.setName(serviceName); // Add any custom options from the Descriptor config Map options = (Map) endpoint.getProperties().get(AXIS_OPTIONS); // IF wsdl service name is not set, default to service name if (options == null) { options = new HashMap(2); } if (options.get("wsdlServiceElement") == null) { options.put("wsdlServiceElement", serviceName); } Map.Entry entry; for (Iterator iterator = options.entrySet().iterator(); iterator.hasNext();) { entry = (Map.Entry) iterator.next(); soapService.setOption(entry.getKey().toString(), entry.getValue()); logger.debug("Adding Axis option: " + entry); } // set method names Class[] interfaces = AxisServiceProxy.getInterfacesForComponent(service); if (interfaces.length == 0) { throw new InitialisationException( AxisMessages.objectMustImplementAnInterface(serviceName), service); } // You must supply a class name if you want to restrict methods // or specify the 'allowedMethods' property in the axisOptions property String methodNames = "*"; Map methods = (Map) endpoint.getProperties().get(AxisConnector.SOAP_METHODS); if (methods != null) { Iterator i = methods.keySet().iterator(); StringBuffer buf = new StringBuffer(64); while (i.hasNext()) { String name = (String) i.next(); Object m = methods.get(name); SoapMethod method = null; if (m instanceof List) { method = new SoapMethod(name, (List) m); } else { method = new SoapMethod(name, (String) m); } List namedParameters = method.getNamedParameters(); ParameterDesc[] parameters = new ParameterDesc[namedParameters.size()]; for (int j = 0; j < namedParameters.size(); j++) { NamedParameter parameter = (NamedParameter) namedParameters.get(j); byte mode = ParameterDesc.INOUT; if (parameter.getMode().equals(ParameterMode.IN)) { mode = ParameterDesc.IN; } else if (parameter.getMode().equals(ParameterMode.OUT)) { mode = ParameterDesc.OUT; } parameters[j] = new ParameterDesc(parameter.getName(), mode, parameter.getType()); } soapService.getServiceDescription().addOperationDesc( new OperationDesc(method.getName().getLocalPart(), parameters, method.getReturnType())); buf.append(method.getName().getLocalPart() + ","); } methodNames = buf.toString(); methodNames = methodNames.substring(0, methodNames.length() - 1); } else { String[] methodNamesArray = AxisServiceProxy.getMethodNames(interfaces); StringBuffer buf = new StringBuffer(64); for (int i = 0; i < methodNamesArray.length; i++) { buf.append(methodNamesArray[i]).append(","); } methodNames = buf.toString(); methodNames = methodNames.substring(0, methodNames.length() - 1); } String className = interfaces[0].getName(); // The namespace of the service. // Todo use the service qname in Mule 2.0 String namespace = (String) endpoint.getProperties().get(SERVICE_NAMESPACE); if (namespace == null) { namespace = Namespaces.makeNamespace(className); } // WSDL override // TODO RM: this is an endpoint property now? // String wsdlFile = (String)descriptor.getProperties().get("wsdlFile"); String wsdlFile = (String) endpoint.getProperties().get("wsdlFile"); if (wsdlFile != null) { soapService.getServiceDescription().setWSDLFile(wsdlFile); } /* * Now we set up the various options for the SOAPService. We set: * RPCProvider.OPTION_WSDL_SERVICEPORT In essense, this is our service name * RPCProvider.OPTION_CLASSNAME This tells the serverProvider (whether it be * an AvalonProvider or just JavaProvider) what class to load via * "makeNewServiceObject". RPCProvider.OPTION_SCOPE How long the object * loaded via "makeNewServiceObject" will persist - either request, session, * or application. We use the default for now. * RPCProvider.OPTION_WSDL_TARGETNAMESPACE A namespace created from the * package name of the service. RPCProvider.OPTION_ALLOWEDMETHODS What * methods the service can execute on our class. We don't set: * RPCProvider.OPTION_WSDL_PORTTYPE RPCProvider.OPTION_WSDL_SERVICEELEMENT */ setOptionIfNotset(soapService, JavaProvider.OPTION_WSDL_SERVICEPORT, serviceName); setOptionIfNotset(soapService, JavaProvider.OPTION_CLASSNAME, className); setOptionIfNotset(soapService, JavaProvider.OPTION_SCOPE, "Request"); if (StringUtils.isNotBlank(namespace)) { setOptionIfNotset(soapService, JavaProvider.OPTION_WSDL_TARGETNAMESPACE, namespace); } // Set the allowed methods, allow all if there are none specified. if (methodNames == null) { setOptionIfNotset(soapService, JavaProvider.OPTION_ALLOWEDMETHODS, "*"); } else { setOptionIfNotset(soapService, JavaProvider.OPTION_ALLOWEDMETHODS, methodNames); } // Note that Axis has specific rules to how these two variables are // combined. This is handled for us // Set style: RPC/wrapped/Doc/Message if (style != null) { Style s = Style.getStyle(style); if (s == null) { throw new CreateException( CoreMessages.valueIsInvalidFor(style, AxisConnector.STYLE), this); } else { soapService.setStyle(s); } } // Set use: Endcoded/Literal if (use != null) { Use u = Use.getUse(use); if (u == null) { throw new CreateException(CoreMessages.valueIsInvalidFor(use, AxisConnector.USE), this); } else { soapService.setUse(u); } } soapService.getServiceDescription().setDocumentation(doc); // Tell Axis to try and be intelligent about serialization. // TypeMappingRegistryImpl registry = (TypeMappingRegistryImpl) // service.getTypeMappingRegistry(); // TypeMappingImpl tm = (TypeMappingImpl) registry.(); // Handle complex bean type automatically // registry.setDoAutoTypes( true ); // Axis 1.2 fix to handle autotypes properly // AxisProperties.setProperty("axis.doAutoTypes", // String.valueOf(connector.isDoAutoTypes())); // TODO Load any explicitly defined bean types // List types = (List) descriptor.getProperties().get(BEAN_TYPES); // connector.registerTypes(registry, types); soapService.setName(serviceName); // Add initialisation callback for the Axis service Component component = service.getComponent(); if (component instanceof JavaComponent) { ((AbstractJavaComponent) component).getObjectFactory().addObjectInitialisationCallback( new AxisInitialisationCallback(soapService)); } if (uri.getScheme().equalsIgnoreCase("servlet")) { connector.addServletService(soapService); String endpointUrl = uri.getAddress() + "/" + serviceName; endpointUrl = endpointUrl.replaceFirst("servlet:", "http:"); soapService.getServiceDescription().setEndpointURL(endpointUrl); } else { soapService.getServiceDescription().setEndpointURL(uri.getAddress() + "/" + serviceName); } if (StringUtils.isNotBlank(namespace)) { soapService.getServiceDescription().setDefaultNamespace(namespace); } soapService.init(); soapService.stop(); } protected void doConnect() throws Exception { // Tell the axis configuration about our new service. connector.getServerProvider().deployService(soapService.getName(), soapService); connector.registerReceiverWithMuleService(this, endpoint.getEndpointURI()); } protected void doDisconnect() throws Exception { try { doStop(); } catch (MuleException e) { logger.error(e.getMessage(), e); } // TODO: how do you undeploy an Axis service? // Unregister the mule part of the service connector.unregisterReceiverWithMuleService(this, endpoint.getEndpointURI()); } protected void doStart() throws MuleException { if (soapService != null) { soapService.start(); } } protected void doStop() throws MuleException { if (soapService != null) { soapService.stop(); } } protected void doDispose() { // nothing to do } protected void setOptionIfNotset(SOAPService service, String option, Object value) { Object val = service.getOption(option); if (val == null) { service.setOption(option, value); } } public SOAPService getSoapService() { return soapService; } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageAdapter.java0000644000175000017500000001120010745677442032201 0ustar charlescharles/* * $Id: AxisMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MessagingException; import org.mule.api.ThreadSafeAccess; import org.mule.api.transformer.Transformer; import org.mule.transformer.simple.SerializableToByteArray; import org.mule.transport.AbstractMessageAdapter; import org.mule.transport.soap.MuleSoapHeaders; import org.mule.transport.soap.i18n.SoapMessages; import org.mule.util.StringUtils; import java.util.Iterator; import javax.activation.DataHandler; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import org.apache.axis.MessageContext; import org.apache.axis.attachments.AttachmentPart; /** * AxisMessageAdapter wraps a soap message. The payload of the adapter * is the raw message received from the transport, but you also have access to the * SOAPMessage object by using adapter.getSOAPMessage() */ public class AxisMessageAdapter extends AbstractMessageAdapter { /** * Serial version */ private static final long serialVersionUID = -923205879581370143L; private final Object payload; private final SOAPMessage soapMessage; private Transformer trans = new SerializableToByteArray(); public AxisMessageAdapter(Object message) throws MessagingException { this.payload = message; try { MessageContext ctx = MessageContext.getCurrentContext(); if (ctx != null) { MuleSoapHeaders header = new MuleSoapHeaders(ctx.getMessage().getSOAPPart().getEnvelope() .getHeader()); if (StringUtils.isNotBlank(header.getReplyTo())) { setReplyTo(header.getReplyTo()); } if (StringUtils.isNotBlank(header.getCorrelationGroup())) { setCorrelationGroupSize(Integer.parseInt(header.getCorrelationGroup())); } if (StringUtils.isNotBlank(header.getCorrelationSequence())) { setCorrelationSequence(Integer.parseInt(header.getCorrelationSequence())); } if (StringUtils.isNotBlank(header.getCorrelationId())) { setCorrelationId(header.getCorrelationId()); } this.soapMessage = ctx.getMessage(); int x = 1; try { for (Iterator i = this.soapMessage.getAttachments(); i.hasNext(); x++) { super.addAttachment(String.valueOf(x), ((AttachmentPart)i.next()) .getActivationDataHandler()); } } catch (Exception e) { // this will not happen logger.fatal("Failed to read attachments", e); } } else { this.soapMessage = null; } } catch (SOAPException e) { throw new MessagingException(SoapMessages.failedToProcessSoapHeaders(), message, e); } } public AxisMessageAdapter(AxisMessageAdapter template) { super(template); soapMessage = template.soapMessage; payload = template.payload; trans = template.trans; } /** @return the current message */ public Object getPayload() { return payload; } public SOAPMessage getSoapMessage() { return soapMessage; } public void addAttachment(String name, DataHandler dataHandler) throws Exception { if (null != soapMessage) { soapMessage.addAttachmentPart(new AttachmentPart(dataHandler)); } super.addAttachment(name, dataHandler); } public void removeAttachment(String name) throws Exception { if ("all".equalsIgnoreCase(name)) { soapMessage.removeAllAttachments(); attachments.clear(); } else { throw new SOAPException(SoapMessages.cannotRemoveSingleAttachment().toString()); } } public ThreadSafeAccess newThreadCopy() { return new AxisMessageAdapter(this); } } mule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisInitialisable.java0000644000175000017500000000152110745677442032072 0ustar charlescharles/* * $Id: AxisInitialisable.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.lifecycle.InitialisationException; import org.apache.axis.handlers.soap.SOAPService; /** * AxisInitialisable can be implemented by a Mule component that will * be used as an Axis service to customise the Axis Service object */ public interface AxisInitialisable { public void initialise(SOAPService service) throws InitialisationException; } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageRequesterFactory.javamule-2.0.1/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageRequesterFactory.ja0000644000175000017500000000200610757615756033610 0ustar charlescharles/* * $Id: AxisMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.transport.AbstractMessageRequesterFactory; /** * AxisMessageRequesterFactory creates an AxisMessageRequester, used * for making SOAP calls using the Axis stack. */ public class AxisMessageRequesterFactory extends AbstractMessageRequesterFactory { public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new AxisMessageRequester(endpoint); } }mule-2.0.1/transports/axis/src/main/resources/0000755000175000017500000000000011351410663021210 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/resources/mule-axis-client-config.wsdd0000644000175000017500000000336610745677442026546 0ustar charlescharles mule-2.0.1/transports/axis/src/main/resources/mule-axis-server-config.wsdd0000644000175000017500000000376110745677442026575 0ustar charlescharles http://xml.apache.org/axis/wsdd/ mule-2.0.1/transports/axis/src/main/resources/META-INF/0000755000175000017500000000000011351410663022350 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012410631537676025232 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/axis/2.0/mule-axis.xsd=META-INF/mule-axis.xsdmule-2.0.1/transports/axis/src/main/resources/META-INF/spring.handlers0000644000175000017500000000015110745677442025411 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/axis/2.0=org.mule.transport.soap.axis.config.AxisNamespaceHandler mule-2.0.1/transports/axis/src/main/resources/META-INF/services/0000755000175000017500000000000011351410663024173 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351410663024762 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351410663025724 5ustar charlescharlesmule-2.0.1/transports/axis/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351410663027741 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/axis/src/main/resources/META-INF/services/org/mule/providers/wsdl-axis.propertiesmule-2.0.1/transports/axis/src/main/resources/META-INF/services/org/mule/providers/wsdl-axis.propert0000644000175000017500000000112010745677442033303 0ustar charlescharlesconnector=org.mule.transport.soap.axis.wsdl.AxisWsdlConnector dispatcher.factory=org.mule.transport.soap.axis.wsdl.AxisWsdlMessageDispatcherFactory requester.factory=org.mule.transport.soap.axis.AxisMessageRequesterFactory message.adapter=org.mule.transport.soap.axis.AxisMessageAdapter inbound.transformer= outbound.transformer= endpoint.builder=org.mule.transport.soap.WsdlUrlEndpointURIBuilder service.error=The Axis WSDL client transport is currently disabled due to issues with the way the parser handles named parameters. please use the xfire implementaiton instead for now (wsdl-xfire)mule-2.0.1/transports/axis/src/main/resources/META-INF/services/org/mule/providers/axis.properties0000644000175000017500000000066210745677442033047 0ustar charlescharlesconnector=org.mule.transport.soap.axis.AxisConnector dispatcher.factory=org.mule.transport.soap.axis.AxisMessageDispatcherFactory requester.factory=org.mule.transport.soap.axis.AxisMessageRequesterFactory message.receiver=org.mule.transport.soap.axis.AxisMessageReceiver message.adapter=org.mule.transport.soap.axis.AxisMessageAdapter inbound.transformer= outbound.transformer= endpoint.builder=org.mule.endpoint.UrlEndpointURIBuildermule-2.0.1/transports/axis/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351410663026503 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/axis/src/main/resources/META-INF/services/org/mule/i18n/axis-messages.propertiesmule-2.0.1/transports/axis/src/main/resources/META-INF/services/org/mule/i18n/axis-messages.properti0000644000175000017500000000054510631537676033064 0ustar charlescharles1=Component "{0}" must implement at least one interface 2=Both properties 'serverProvider' and 'serverConfig' are configured. If you configure a 'serverProvider' the 'serverConfig' property will be ignored. 3=Both properties 'clientProvider' and 'clientConfig' are configured. If you configure a 'clientProvider' the 'clientConfig' property will be ignored.mule-2.0.1/transports/axis/src/main/resources/META-INF/mule-axis.xsd0000644000175000017500000002641411003265322024775 0ustar charlescharles Consume and provide web services via axis. Bean reference to the axis server that should be used. Configuration file to use when building the axis client. Bean reference to the client provider that should be used to create the axis client. Use this property to configure whether AxisServer should automatically map types. This property has only effect if you don't provide your own axisServer via the 'axisServer-ref' property. Configuration file to use when building the axis server. Bean reference to the server provider that should be used to create the AxisServer. The AxisConnector treats a Map as container for named parameters, which eventually will be unpacked. This will result into a problem if your exposed service needs to take a Map as a parameter, because the actual Map will never reach the service intact. In this case set this property to false. mule-2.0.1/transports/axis/src/test/0000755000175000017500000000000011351410661017227 5ustar charlescharlesmule-2.0.1/transports/axis/src/test/java/0000755000175000017500000000000011351410661020150 5ustar charlescharlesmule-2.0.1/transports/axis/src/test/java/org/0000755000175000017500000000000011351410661020737 5ustar charlescharlesmule-2.0.1/transports/axis/src/test/java/org/mule/0000755000175000017500000000000011351410661021701 5ustar charlescharlesmule-2.0.1/transports/axis/src/test/java/org/mule/transport/0000755000175000017500000000000011351410661023735 5ustar charlescharlesmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/0000755000175000017500000000000011351410661024677 5ustar charlescharlesmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/0000755000175000017500000000000011351410661025643 5ustar charlescharlesmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/Calculator.java0000644000175000017500000000123410745677442030621 0ustar charlescharles/* * $Id: Calculator.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; public class Calculator implements CalculatorInterface { public long add(long i1, long i2) { return i1 + i2; } public int subtract(int i1, int i2) { return i1 - i2; } } mule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorTestCase.java0000644000175000017500000000213410754365306032734 0ustar charlescharles/* * $Id: AxisConnectorTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.transport.Connector; import org.mule.transport.AbstractConnectorTestCase; import org.mule.transport.soap.axis.AxisConnector; /** * Test case for AxisConnector's basic behaviour */ public class AxisConnectorTestCase extends AbstractConnectorTestCase { public String getTestEndpointURI() { return "axis:http://localhost:38009/axis"; } public Connector createConnector() throws Exception { AxisConnector c = new AxisConnector(); c.setName("axisConnector"); return c; } public Object getValidMessage() throws Exception { return "Test Message"; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/SoapActionTemplateTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/SoapActionTemplateTestCase.jav0000644000175000017500000000356410757615756033572 0ustar charlescharles/* * $Id: SoapActionTemplateTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleEvent; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.tck.AbstractMuleTestCase; import javax.xml.namespace.QName; /** * TODO document me */ public class SoapActionTemplateTestCase extends AbstractMuleTestCase { public void testHostInfoReplace() throws Exception { OutboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( "axis:http://mycompany.com:8080/services/myService?method=foo"); AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep); MuleEvent event = getTestEvent("test,", ep); String result = dispatcher.parseSoapAction("[hostInfo]/[method]", new QName("foo"), event); assertEquals("http://mycompany.com:8080/foo", result); } public void testHostReplace() throws Exception { OutboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( "axis:http://mycompany.com:8080/services/myService?method=foo"); AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep); MuleEvent event = getTestEvent("test,", ep); event.getService().setName("myService"); String result = dispatcher.parseSoapAction("[scheme]://[host]:[port]/[serviceName]/[method]", new QName("foo"), event); assertEquals("http://mycompany.com:8080/myService/foo", result); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorVMFunctionalTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorVMFunctionalTestC0000644000175000017500000000174510745677442033627 0ustar charlescharles/* * $Id: AxisConnectorVMFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.tck.providers.soap.AbstractSoapResourceEndpointFunctionalTestCase; import org.mule.transport.vm.VMConnector; public class AxisConnectorVMFunctionalTestCase extends AbstractSoapResourceEndpointFunctionalTestCase { protected String getTransportProtocol() { return VMConnector.VM; } protected String getSoapProvider() { return "axis"; } public String getConfigResources() { return "axis-" + getTransportProtocol() + "-mule-config.xml"; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisNamespaceHandlerTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisNamespaceHandlerTestCase.j0000644000175000017500000001264010745677442033516 0ustar charlescharles/* * $Id: AxisNamespaceHandlerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.FunctionalTestCase; import org.mule.transport.soap.SoapConstants; import org.mule.transport.soap.axis.AxisConnector; import org.mule.transport.soap.axis.AxisMessageReceiver; import org.mule.transport.soap.axis.mock.MockAxisServer; import org.mule.transport.soap.axis.mock.MockProvider; import java.util.Map; import java.util.List; import org.apache.axis.constants.Use; import org.apache.axis.constants.Style; public class AxisNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "axis-namespace-config.xml"; } public void testConfig() { AxisConnector connector = (AxisConnector)muleContext.getRegistry().lookupConnector("axisConnector"); assertNotNull(connector); assertEquals("test-axis-config.wsdd", connector.getServerConfig()); assertEquals("test-axis-config.wsdd", connector.getClientConfig()); assertFalse(connector.isTreatMapAsNamedParams()); assertFalse(connector.isDoAutoTypes()); assertEquals(2, connector.getBeanTypes().size()); assertTrue(connector.getBeanTypes().contains("org.mule.tck.testmodels.fruit.Apple")); assertTrue(connector.getBeanTypes().contains("org.mule.tck.testmodels.fruit.Banana")); assertEquals(1, connector.getSupportedSchemes().size()); assertEquals("http", connector.getSupportedSchemes().get(0)); } public void testInjectedObjects() { AxisConnector connector = (AxisConnector)muleContext.getRegistry().lookupConnector("axisConnector2"); assertNotNull(connector); assertEquals(MockAxisServer.class, connector.getAxis().getClass()); assertEquals(MockProvider.class, connector.getClientProvider().getClass()); } public void testEndpointProperties() throws Exception { ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointBuilder("endpoint").buildOutboundEndpoint(); Map props = endpoint.getProperties(); assertEquals("[methodNamespace][method]", assertKey(props, SoapConstants.SOAP_ACTION_PROPERTY, String.class)); assertEquals("direct", assertKey(props, SoapConstants.SOAP_ACTION_PROPERTY_CAPS, String.class)); assertEquals("clientConfig", assertKey(props, "clientConfig", String.class)); assertEquals(Use.ENCODED_STR, assertKey(props, AxisConnector.USE, String.class)); assertEquals(Style.DOCUMENT_STR, assertKey(props, AxisConnector.STYLE, String.class)); assertEquals("value1", assertKey(props, "key1", String.class)); assertEquals("value2", assertKey(props, "key2", String.class)); Map options = (Map) assertKey(props, AxisMessageReceiver.AXIS_OPTIONS, Map.class); assertEquals(10, options.size()); assertEquals("value1", assertKey(options, "key1", String.class)); assertEquals("value2", assertKey(options, "key2", String.class)); assertEquals("Application", assertKey(options, "scope", String.class)); assertEquals("echo,getdate", assertKey(options, "allowedMethods", String.class)); assertEquals("wsdlPortType", assertKey(options, "wsdlPortType", String.class)); assertEquals("wsdlServiceElement", assertKey(options, "wsdlServiceElement", String.class)); assertEquals("wsdlTargetNamespace", assertKey(options, "wsdlTargetNamespace", String.class)); assertEquals("wsdlInputSchema", assertKey(options, "wsdlInputSchema", String.class)); assertEquals("wsdlSoapActionMode", assertKey(options, "wsdlSoapActionMode", String.class)); assertEquals("extraClasses", assertKey(options, "extraClasses", String.class)); Map methods = (Map) assertKey(props, AxisConnector.SOAP_METHODS, Map.class); List method1 = (List) assertKey(methods, "method1", List.class); assertEquals(3, method1.size()); assertEquals("symbol;string;IN", method1.get(0)); assertEquals("GetQuoteResult;string;OUT", method1.get(1)); assertEquals("return;string", method1.get(2)); List method2 = (List) assertKey(methods, "method2", List.class); assertEquals(2, method2.size()); assertEquals("param;string;IN", method2.get(0)); assertEquals("addedFromSpring;string;in", method2.get(1)); List interfaces = (List) assertKey(props, SoapConstants.SERVICE_INTERFACES, List.class); assertEquals(2, interfaces.size()); assertEquals("class1", interfaces.get(0)); assertEquals("class2", interfaces.get(1)); } protected Object assertKey(Map props, String name, Class clazz) { assertNotNull(props); assertTrue(name + " not in properties", props.containsKey(name)); Object value = props.get(name); assertNotNull(name + " value null", value); assertTrue(value.getClass() + " not subclass of " + clazz, clazz.isAssignableFrom(value.getClass())); return value; } } mule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisExternalServerTest.java0000644000175000017500000001140210754375733033162 0ustar charlescharles/* * $Id: AxisExternalServerTest.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.soap.NamedParameter; import org.mule.transport.soap.SoapMethod; import org.mule.transport.soap.axis.AxisConnector; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; /** * Requires an external Axis server running in Tomcat with the Calculator.jws service * deployed to it. */ public class AxisExternalServerTest extends AbstractMuleTestCase { public void testAxisServiceRPC() throws Exception { String URL = "axis:http://localhost:8080/axis/Calculator.jws?method=add"; MuleClient client = new MuleClient(); MuleMessage result = client.send(URL, new Object[]{new Integer(4), new Integer(3)}, null); assertNotNull(result); assertEquals(result.getPayload(), new Integer(7)); } public void testAxisServiceDocLitWrapped() throws Exception { String URL = "axis:http://localhost:8080/axis/Calculator.jws?method=add"; MuleClient client = new MuleClient(); Map props = new HashMap(); props.put(AxisConnector.STYLE, "wrapped"); props.put(AxisConnector.USE, "literal"); MuleMessage result = client.send(URL, new Object[]{new Integer(3), new Integer(3)}, props); assertNotNull(result); assertEquals(result.getPayload(), new Integer(6)); } public void testAxisServiceDocLitWrappedWithNamedParams() throws Exception { String URL = "axis:http://localhost:8080/axis/Calculator.jws"; MuleClient client = new MuleClient(); SoapMethod method = new SoapMethod(new QName("http://muleumo.org/Calc", "add")); method.addNamedParameter(new QName("Number1"), NamedParameter.XSD_INT, "in"); method.addNamedParameter(new QName("Number2"), NamedParameter.XSD_INT, "in"); method.setReturnType(NamedParameter.XSD_INT); Map props = new HashMap(); props.put(AxisConnector.STYLE, "wrapped"); props.put(AxisConnector.USE, "literal"); props.put(MuleProperties.MULE_METHOD_PROPERTY, method); MuleMessage result = client.send(URL, new Object[]{new Integer(3), new Integer(3)}, props); assertNotNull(result); assertEquals(result.getPayload(), new Integer(6)); } public void testAxisServiceDocLitWrappedWithNamedParamsinXml() throws Exception { MuleClient client = new MuleClient( "axis-client-endpoint-config.xml"); MuleMessage result = client.send("calculatorAddEndpoint", new Object[]{new Integer(3), new Integer(3)}, null); assertNotNull(result); assertEquals(result.getPayload(), new Integer(6)); } // The service is not hosted as Doc/Lit, so Axis will not allow us // to send a Doc/Lit request style soap message // public void testAxisServiceDocLit() throws Exception // { // String URL = "axis:http://localhost:8080/axis/Calculator.jws"; // MuleClient client = new MuleClient(); // Map props = new HashMap(); // props.put("style", "document"); // props.put("use", "literal"); // // SoapMethod method = new SoapMethod(new // QName("http://localhost:8080/axis/Calculator.jws", "add")); // method.addNamedParameter(new QName("i1"), NamedParameter.XSD_INT, "in"); // method.addNamedParameter(new QName("i2"), NamedParameter.XSD_INT, "in"); // method.setReturnType(NamedParameter.XSD_INT); // props.put(MuleProperties.MULE_METHOD_PROPERTY, method); // // MuleMessage result = client.send(URL, new Object[]{new Integer(3), new // Integer(3)}, props); // assertNotNull(result); // // assertEquals(result.getPayload(), new Integer(6)); // } // wsdl-axis is currently disabled due to the problems axis had with this // feature // public void testAxisServiceUsingWSDL() throws Exception // { // String URL = // "wsdl-axis:http://localhost:8080/axis/Calculator.jws?wsdl&method=add"; // MuleClient client = new MuleClient(); // // MuleMessage result = client.send(URL, new Object[]{new Integer(4), new // Integer(4)}, null); // assertNotNull(result); // // assertEquals(result.getPayload(), new Integer(8)); // } } mule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/VmToAxisProxyTestCase.java0000644000175000017500000000211010754375733032730 0ustar charlescharles/* * $Id: VmToAxisProxyTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class VmToAxisProxyTestCase extends FunctionalTestCase { protected String getConfigResources() { return "vm-to-axis-proxy-mule-config.xml"; } public void testWSProxy() throws Exception { if (isOffline("org.mule.transport.soap.axis.VmToAxisProxyTestCase.testWSProxy()")) { return; } MuleClient client = new MuleClient(); MuleMessage result = client.send("vm://proxy", "ibm", null); assertNotNull(result); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorHttpFunctionalTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorHttpFunctionalTes0000644000175000017500000000461610757615756033740 0ustar charlescharles/* * $Id: AxisConnectorHttpFunctionalTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.config.ExceptionHelper; import org.mule.tck.MuleTestUtils; import org.mule.tck.providers.soap.AbstractSoapUrlEndpointFunctionalTestCase; public class AxisConnectorHttpFunctionalTestCase extends AbstractSoapUrlEndpointFunctionalTestCase { public static class ComponentWithoutInterfaces { public String echo(String msg) { return msg; } } public String getConfigResources() { return "axis-" + getTransportProtocol() + "-mule-config.xml"; } protected String getTransportProtocol() { return "http"; } protected String getSoapProvider() { return "axis"; } /** * The Axis service requires that the service implements at least one interface * This just tests that we get the correct exception if no interfaces are * implemented * * @throws Throwable */ public void testComponentWithoutInterfaces() throws Throwable { try { // TODO MULE-2228 Simplify this API Service c = MuleTestUtils.getTestService("testComponentWithoutInterfaces", ComponentWithoutInterfaces.class, null, muleContext, false); InboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(getComponentWithoutInterfacesEndpoint()); c.getInboundRouter().addEndpoint(ep); muleContext.getRegistry().registerService(c); fail("Expected exception"); } catch (MuleException e) { e = ExceptionHelper.getRootMuleException(e); assertTrue(e instanceof InitialisationException); assertTrue(e.getMessage(), e.getMessage().indexOf("must implement at least one interface") > -1); } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisServletBindingTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisServletBindingTestCase.jav0000644000175000017500000000677210745677442033603 0ustar charlescharles/* * $Id: AxisServletBindingTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.tck.providers.soap.AbstractSoapFunctionalTestCase; import org.mule.transport.http.servlet.MuleReceiverServlet; import org.mortbay.http.HttpContext; import org.mortbay.http.SocketListener; import org.mortbay.jetty.Server; import org.mortbay.jetty.servlet.ServletHandler; import org.mortbay.util.InetAddrPort; public class AxisServletBindingTestCase extends AbstractSoapFunctionalTestCase { public static final int HTTP_PORT = 62088; private Server httpServer; // @Override protected void doSetUp() throws Exception { super.doSetUp(); httpServer = new Server(); SocketListener socketListener = new SocketListener(new InetAddrPort(HTTP_PORT)); httpServer.addListener(socketListener); HttpContext context = httpServer.getContext("/"); context.setRequestLog(null); ServletHandler handler = new ServletHandler(); handler.addServlet("MuleReceiverServlet", "/services/*", MuleReceiverServlet.class.getName()); context.addHandler(handler); httpServer.start(); } // @Override protected void doTearDown() throws Exception { super.doTearDown(); // this generates an exception in GenericServlet which we can safely ignore if (httpServer != null) { httpServer.stop(false); httpServer.destroy(); } } public String getConfigResources() { return "axis-test-servlet-mule-config.xml"; } protected String getRequestResponseEndpoint() { return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=echo"; } protected String getReceiveEndpoint() { return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getDate"; } protected String getReceiveComplexEndpoint() { return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getPerson¶m=Fred"; } protected String getSendReceiveComplexEndpoint1() { return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=addPerson"; } protected String getSendReceiveComplexEndpoint2() { return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getPerson¶m=Dino"; } protected String getReceiveComplexCollectionEndpoint() { return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getPeople"; } protected String getDispatchAsyncComplexEndpoint1() { return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=addPerson"; } protected String getDispatchAsyncComplexEndpoint2() { return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getPerson¶m=Betty"; } protected String getTestExceptionEndpoint() { return "axis:http://localhost:" + HTTP_PORT + "/services/mycomponent?method=getDate"; } protected String getWsdlEndpoint() { return "http://localhost:" + HTTP_PORT + "/services/mycomponent?wsdl"; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisServletWithSecurityTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisServletWithSecurityTestCas0000644000175000017500000000556710754375733033747 0ustar charlescharles/* * $Id: AxisServletWithSecurityTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.servlet.MuleReceiverServlet; import java.beans.ExceptionListener; import java.util.HashMap; import java.util.Map; import org.mortbay.http.HttpContext; import org.mortbay.http.SocketListener; import org.mortbay.jetty.Server; import org.mortbay.jetty.servlet.ServletHandler; import org.mortbay.util.InetAddrPort; public class AxisServletWithSecurityTestCase extends FunctionalTestCase { public static final int HTTP_PORT = 18088; private Server httpServer; // @Override protected void doSetUp() throws Exception { httpServer = new Server(); SocketListener socketListener = new SocketListener(new InetAddrPort(HTTP_PORT)); httpServer.addListener(socketListener); HttpContext context = httpServer.getContext("/"); context.setRequestLog(null); ServletHandler handler = new ServletHandler(); handler.addServlet("MuleReceiverServlet", "/services/*", MuleReceiverServlet.class.getName()); context.addHandler(handler); httpServer.start(); } // @Override protected void doTearDown() throws Exception { if (httpServer != null) { httpServer.stop(false); httpServer.destroy(); } } public void testSecurityWithServletsUsingGet() throws Exception { Map props = new HashMap(); props.put(HttpConnector.HTTP_METHOD_PROPERTY, "GET"); MuleClient client = new MuleClient(); MuleMessage result = client.send("http://ross:ross@localhost:" + HTTP_PORT + "/services/mycomponent?method=echo", "test", props); ExceptionListener exceptionListener = muleContext.getRegistry().lookupConnector("servletConnector").getExceptionListener(); assertTrue(exceptionListener instanceof UnitTestExceptionStrategy); UnitTestExceptionStrategy utExStrat = (UnitTestExceptionStrategy)exceptionListener; assertEquals(1, utExStrat.getMessagingExceptions().size()); assertNotNull(result); // assertTrue(result.getPayload() instanceof byte[]); } protected String getConfigResources() { return "axis-servlet-security-config.xml"; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorHttpsTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorHttpsTestCase.jav0000644000175000017500000000270510754375733033627 0ustar charlescharles/* * $Id: AxisConnectorHttpsTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpsConnector; public class AxisConnectorHttpsTestCase extends FunctionalTestCase { public void testHttpsConnection() throws Exception{ MuleClient client = new MuleClient(); MuleMessage m = client.send("axis:https://localhost:62000/TestUMO?method=echo",new DefaultMuleMessage("hello")); assertNotNull(m); // check that our https connector is being used MuleEvent event = RequestContext.getEvent(); assertTrue (event.getEndpoint().getConnector() instanceof HttpsConnector); assertTrue(event.getEndpoint().getConnector().getName().equals("myHttpsConnector")); } protected String getConfigResources() { return "axis-https-connector-config.xml"; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisServiceUsingCxfEndpointTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisServiceUsingCxfEndpointTes0000644000175000017500000000373210766272451033660 0ustar charlescharles/* * $Id: AxisServiceUsingCxfEndpointTestCase.java 11351 2008-03-13 18:40:41Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.List; import java.util.Map; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; public class AxisServiceUsingCxfEndpointTestCase extends FunctionalTestCase { public void testAxis() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm://axis.in", new DefaultMuleMessage("Test String")); assertNotNull(reply); assertNotNull(reply.getPayload()); assertEquals(reply.getPayloadAsString(), "Received: Test String"); logger.info(reply.getPayloadAsString()); } public void testRequestWsdl() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); props.put("http.method", "GET"); MuleMessage reply = client.send("http://localhost:63381/services/AxisService?WSDL", "", props); assertNotNull(reply); assertNotNull(reply.getPayload()); Document document = DocumentHelper.parseText(reply.getPayloadAsString()); List nodes; nodes = document.selectNodes("//wsdl:definitions/wsdl:service"); assertEquals(((Element)nodes.get(0)).attribute("name").getStringValue(), "AxisService"); } protected String getConfigResources() { return "axis-using-cxf-config.xml"; } } mule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/issues/0000755000175000017500000000000011351410661027156 5ustar charlescharles././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/issues/EndpointRetrievalMule2021TestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/issues/EndpointRetrievalMule200000644000175000017500000000654410761043432033537 0ustar charlescharles/* * $Id: EndpointRetrievalMule2021TestCase.java 11035 2008-02-26 17:06:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.issues; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.transport.Connector; import org.mule.tck.FunctionalTestCase; import org.mule.transport.soap.axis.AxisConnector; public class EndpointRetrievalMule2021TestCase extends FunctionalTestCase { protected String getConfigResources() { return "endpoint-retrieval-mule-2021-test.xml"; } public void testLookupEndpoint() throws MuleException { Object endpoint1 = muleContext.getRegistry().lookupObject("Endpoint"); // This returns the builder rather than the endpoint assertTrue(endpoint1 instanceof EndpointBuilder); assertFalse(endpoint1 instanceof ImmutableEndpoint); EndpointBuilder endpointBuiler = muleContext.getRegistry().lookupEndpointBuilder("Endpoint"); // There should however be an endpoint builder with this id/name assertNotNull(endpointBuiler); ImmutableEndpoint endpoint2 = (ImmutableEndpoint) muleContext.getRegistry().lookupObject( "axis:http://localhost:18081/mule/Service?method=toString"); // Null expected because lookupEndpoint does not create endpoints from uri's. assertNull(endpoint2); } public void testGetOutboundEndpoint() throws MuleException { ImmutableEndpoint endpoint1 = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( "Endpoint"); assertEndpointOk(endpoint1); ImmutableEndpoint endpoint2 = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( "axis:http://localhost:18081/mule/Service?method=toString"); assertEndpointOk(endpoint2); } public void testGetInboundEndpoint() throws MuleException { ImmutableEndpoint endpoint1 = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "Endpoint"); assertEndpointOk(endpoint1); ImmutableEndpoint endpoint2 = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "axis:http://localhost:18081/mule/Service?method=toString"); assertEndpointOk(endpoint2); } public void testGetResponseEndpoint() throws MuleException { ImmutableEndpoint endpoint1 = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "Endpoint"); assertEndpointOk(endpoint1); ImmutableEndpoint endpoint2 = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( "axis:http://localhost:18081/mule/Service?method=toString"); assertEndpointOk(endpoint2); } private void assertEndpointOk(ImmutableEndpoint endpoint) { assertNotNull("Endpoint is null", endpoint); Connector connector = endpoint.getConnector(); assertTrue("Connector not AXIS", connector instanceof AxisConnector); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisMessageDispatcherTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisMessageDispatcherTestCase.0000644000175000017500000000350010757615756033543 0ustar charlescharles/* * $Id: AxisMessageDispatcherTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.tck.AbstractMuleTestCase; import java.util.List; import java.util.Map; import org.apache.axis.client.Call; import org.apache.axis.client.Service; public class AxisMessageDispatcherTestCase extends AbstractMuleTestCase { public void testNullParametersInCallAllowed() throws Exception { OutboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( "axis:http://www.muleumo.org/services/myService?method=myTestMethod"); AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep); dispatcher.service = new Service(); MuleEvent event = getTestEvent("testPayload", ep); // there should be no NullPointerException Call call = dispatcher.getCall(event, new Object[]{null}); assertNotNull(call); MuleMessage msg = event.getMessage(); assertNotNull(msg); final Map soapMethods = (Map)msg.getProperty(AxisConnector.SOAP_METHODS); assertEquals(1, soapMethods.size()); final List values = (List)soapMethods.get("myTestMethod"); assertNotNull(values); assertEquals(1, values.size()); assertEquals("value0;qname{:anyType:http://www.w3.org/2001/XMLSchema};in", values.get(0)); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisNamedParametersTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisNamedParametersTestCase.ja0000644000175000017500000000427210754375733033535 0ustar charlescharles/* * $Id: AxisNamedParametersTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.soap.NamedParameter; import org.mule.transport.soap.SoapMethod; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; public class AxisNamedParametersTestCase extends FunctionalTestCase { protected String getConfigResources() { return "axis-named-param-mule-config.xml"; } public void testNamedParameters() throws Exception { MuleClient client = new MuleClient(); // The service itself will throw an exception if the parameters in the // request SOAP message are not named MuleMessage result = client.send("vm://mycomponent1", "Hello Named", null); assertEquals("Hello Named", result.getPayload()); } public void testNamedParametersViaClient() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); // create the soap method passing in the method name and return type SoapMethod soapMethod = new SoapMethod(new QName("echo"), NamedParameter.XSD_STRING); // add one or more parameters soapMethod.addNamedParameter(new QName("value"), NamedParameter.XSD_STRING, ParameterMode.IN); // set the soap method as a property and pass the properties // when making the call props.put(MuleProperties.MULE_SOAP_METHOD, soapMethod); MuleMessage result = client.send("axis:http://localhost:62111/mule/mycomponent2?method=echo", "Hello Named", props); assertEquals("Hello Named", result.getPayload()); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorJmsFunctionalTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorJmsFunctionalTest0000644000175000017500000000121610745677442033724 0ustar charlescharles/* * $Id: AxisConnectorJmsFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; public class AxisConnectorJmsFunctionalTestCase extends AxisConnectorVMFunctionalTestCase { protected String getTransportProtocol() { return "jms"; } } mule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/functional/0000755000175000017500000000000011351410661030005 5ustar charlescharles././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/functional/SoapAttachmentsFunctionalTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/functional/SoapAttachmentsFunc0000644000175000017500000000465110766204322033654 0ustar charlescharles/* * $Id: SoapAttachmentsFunctionalTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.functional; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.tck.FunctionalTestCase; import org.mule.transport.AbstractConnector; import org.mule.transport.soap.axis.AxisMessageDispatcher; import java.io.File; import javax.activation.DataHandler; import javax.activation.FileDataSource; public class SoapAttachmentsFunctionalTestCase extends FunctionalTestCase { private static final int SEND_COUNT = 5; private int callbackCount = 0; protected String getConfigResources() { return "axis-soap-attachments.xml"; } public void testSend() throws Exception { sendTestData(SEND_COUNT); assertEquals(SEND_COUNT, callbackCount); } protected void sendTestData(int iterations) throws Exception { OutboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( "axis:http://localhost:60198/mule/services/testComponent?method=receiveMessageWithAttachments"); AxisMessageDispatcher client = new AxisMessageDispatcher(ep); for (int i = 0; i < iterations; i++) { MuleMessage msg = new DefaultMuleMessage("testPayload"); File tempFile = File.createTempFile("test", ".att"); tempFile.deleteOnExit(); msg.addAttachment("testAttachment", new DataHandler(new FileDataSource(tempFile))); DefaultMuleSession session = new DefaultMuleSession(msg, ((AbstractConnector) ep.getConnector()).getSessionHandler(), muleContext); DefaultMuleEvent event = new DefaultMuleEvent(msg, ep, session, true); MuleMessage result = client.send(event); assertNotNull(result); assertNotNull(result.getPayload()); assertEquals(result.getPayloadAsString(), "Done"); callbackCount++; } } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/functional/SoapAttachmentsFunctionalTestComponent.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/functional/SoapAttachmentsFunc0000644000175000017500000000171710745677442033672 0ustar charlescharles/* * $Id: SoapAttachmentsFunctionalTestComponent.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.functional; import org.mule.tck.functional.FunctionalTestComponent; import javax.activation.DataHandler; public class SoapAttachmentsFunctionalTestComponent extends FunctionalTestComponent implements SoapAttachmentsFunctionalTest { public String receiveMessageWithAttachments(String payload, DataHandler[] attachments) { if (payload != null && attachments != null && attachments.length > 0) { return "Done"; } return null; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/functional/AxisSoapHeadersTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/functional/AxisSoapHeadersTest0000644000175000017500000000617610754375733033645 0ustar charlescharles/* * $Id: AxisSoapHeadersTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.functional; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class AxisSoapHeadersTestCase extends FunctionalTestCase { protected String getConfigResources() { return "axis-soapheader-test.xml"; } public void testSoapRequest() throws Exception { MuleClient client = new MuleClient(); Map properties = new HashMap(); properties.put("http.method", "POST"); DefaultMuleMessage soapRequest = null; soapRequest = new DefaultMuleMessage( "" + "" + "" + "storeModuleInformation" + // this should be ignored "" + "http://localhost:62182/reply" + "" + "" + "Test Message" + ""); MuleMessage reply = client.send("http://localhost:62181/services/component", soapRequest, properties); // Put this in so that no spurious exceptions are thrown // TODO research and see why sometimes we get 404 or Connection refused // errors without this line. Note that the test completes even when the // exceptions are thrown. Thread.sleep(2000); assertEquals( reply.getPayloadAsString(), "Test Message"); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/functional/WsdlGenerationTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/functional/WsdlGenerationTestC0000644000175000017500000001256110763522057033636 0ustar charlescharles/* * $Id: WsdlGenerationTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.functional; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConnector; import java.util.HashMap; import java.util.Map; import org.dom4j.Document; import org.dom4j.DocumentHelper; public class WsdlGenerationTestCase extends FunctionalTestCase { /** * The generated proxy names have increasing counter if run from the top-level m2 * build, can be e.g. $Proxy12. Check optionally for 3 digits to be on the safe * side. */ private static final String PROXY_REGEX = "^\\$Proxy(\\d+\\d*\\d*)$"; protected String getConfigResources() { return "axis-wsdl-test.xml"; } public void testWsdl1() throws Exception { Map props = new HashMap(); props.put(HttpConnector.HTTP_METHOD_PROPERTY, "GET"); MuleClient client = new MuleClient(); MuleMessage result = client.send("http://localhost:62081/services/EchoService1?wsdl", null, props); assertNotNull(result); String wsdl = result.getPayloadAsString(); Document doc = DocumentHelper.parseText(wsdl); assertEquals("http://foo", doc.valueOf("/wsdl:definitions/@targetNamespace")); // standalone m2 test run can produce $Proxy0, $Proxy1, $Proxy3, etc. assertTrue(doc.valueOf("/wsdl:definitions/wsdl:portType/@name").matches(PROXY_REGEX)); assertEquals( "http://foo", doc.valueOf("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='echo']/wsdl:input[@name='echoRequest']/wsdlsoap:body/@namespace")); assertEquals( "http://foo", doc.valueOf("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='echo']/wsdl:output[@name='echoResponse']/wsdlsoap:body/@namespace")); assertEquals("EchoService1", doc.valueOf("/wsdl:definitions/wsdl:service/@name")); assertEquals("EchoService1", doc.valueOf("/wsdl:definitions/wsdl:service/wsdl:port/@name")); assertEquals("http://localhost:62081/services/EchoService1", doc.valueOf("/wsdl:definitions/wsdl:service/wsdl:port/wsdlsoap:address/@location")); } public void testWsdl2() throws Exception { Map props = new HashMap(); props.put(HttpConnector.HTTP_METHOD_PROPERTY, "GET"); MuleClient client = new MuleClient(); MuleMessage result = client.send("http://localhost:62082/services/EchoService2?wsdl", null, props); assertNotNull(result); String wsdl = result.getPayloadAsString(); Document doc = DocumentHelper.parseText(wsdl); assertEquals("http://simple.component.api.mule.org", doc.valueOf("/wsdl:definitions/@targetNamespace")); assertEquals("mulePortType", doc.valueOf("/wsdl:definitions/wsdl:portType/@name")); assertEquals( "http://simple.component.api.mule.org", doc.valueOf("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='echo']/wsdl:input[@name='echoRequest']/wsdlsoap:body/@namespace")); assertEquals( "http://simple.component.api.mule.org", doc.valueOf("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='echo']/wsdl:output[@name='echoResponse']/wsdlsoap:body/@namespace")); assertEquals("muleService", doc.valueOf("/wsdl:definitions/wsdl:service/@name")); assertEquals("muleServicePort", doc.valueOf("/wsdl:definitions/wsdl:service/wsdl:port/@name")); assertEquals("http://localhost:62082/services/EchoService2", doc.valueOf("/wsdl:definitions/wsdl:service/wsdl:port/wsdlsoap:address/@location")); } public void testWsdl3() throws Exception { Map props = new HashMap(); props.put(HttpConnector.HTTP_METHOD_PROPERTY, "GET"); MuleClient client = new MuleClient(); MuleMessage result = client.send("http://localhost:62083/services/EchoService3?wsdl", null, props); assertNotNull(result); String wsdl = result.getPayloadAsString(); Document doc = DocumentHelper.parseText(wsdl); assertEquals("http://foo.com", doc.valueOf("/wsdl:definitions/@targetNamespace")); assertEquals("mulePortType1", doc.valueOf("/wsdl:definitions/wsdl:portType/@name")); assertEquals( "http://foo.com", doc.valueOf("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='echo']/wsdl:input[@name='echoRequest']/wsdlsoap:body/@namespace")); assertEquals( "http://foo.com", doc.valueOf("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='echo']/wsdl:output[@name='echoResponse']/wsdlsoap:body/@namespace")); assertEquals("muleService1", doc.valueOf("/wsdl:definitions/wsdl:service/@name")); assertEquals("muleServicePort1", doc.valueOf("/wsdl:definitions/wsdl:service/wsdl:port/@name")); assertEquals("http://localhost:62083/services/EchoService3", doc.valueOf("/wsdl:definitions/wsdl:service/wsdl:port/wsdlsoap:address/@location")); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/functional/SoapAttachmentsFunctionalTest.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/functional/SoapAttachmentsFunc0000644000175000017500000000123510745677442033665 0ustar charlescharles/* * $Id: SoapAttachmentsFunctionalTest.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.functional; import javax.activation.DataHandler; public interface SoapAttachmentsFunctionalTest { public String receiveMessageWithAttachments(String payload, DataHandler[] attachments); } mule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/CalculatorInterface.java0000644000175000017500000000111510745677442032440 0ustar charlescharles/* * $Id: CalculatorInterface.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; public interface CalculatorInterface { public long add(long i1, long i2); public int subtract(int i1, int i2); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/UnitTestExceptionStrategy.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/UnitTestExceptionStrategy.java0000644000175000017500000000272610746275214033710 0ustar charlescharles/* * $Id: UnitTestExceptionStrategy.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.MuleMessage; import org.mule.service.DefaultServiceExceptionStrategy; import java.util.ArrayList; import java.util.List; public class UnitTestExceptionStrategy extends DefaultServiceExceptionStrategy { /** * Record all exceptions that this ExceptionStrategy handles so Unit Test * can query them and make their assertions. */ private List messagingExceptions = null; public UnitTestExceptionStrategy() { super(); messagingExceptions = new ArrayList(); } protected void logFatal(MuleMessage message, Throwable t) { logger.debug("logFatal", t); } protected void logException(Throwable t) { logger.debug("logException", t); } public void handleMessagingException(MuleMessage message, Throwable t) { messagingExceptions.add(t); super.handleMessagingException(message, t); } public List getMessagingExceptions() { return messagingExceptions; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisEndpointMule2164TestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisEndpointMule2164TestCase.j0000644000175000017500000000514310745677442033244 0ustar charlescharles/* * $Id: AxisEndpointMule2164TestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; public class AxisEndpointMule2164TestCase extends AbstractMuleTestCase { public void testAxisHttpEndpointURICopy() throws Exception { // Create MuleEndpointURI and test values MuleEndpointURI endpointUri = new MuleEndpointURI("axis:http://localhost:8080?param=1"); endpointUri.initialise(); assertEquals("http", endpointUri.getScheme()); assertEquals("axis", endpointUri.getSchemeMetaInfo()); assertEquals("axis:http", endpointUri.getFullScheme()); assertEquals("http://localhost:8080?param=1", endpointUri.getAddress()); // Reconstruct MuleEndpointURI and test values EndpointURI newEndpointUri = new MuleEndpointURI(endpointUri); newEndpointUri.initialise(); assertEquals("http", newEndpointUri.getScheme()); assertEquals("axis", newEndpointUri.getSchemeMetaInfo()); assertEquals("axis:http", newEndpointUri.getFullScheme()); assertEquals("http://localhost:8080?param=1", newEndpointUri.getAddress()); assertEquals(endpointUri, newEndpointUri); } public void testAxisJmsEndpointURICopy() throws Exception { // Create MuleEndpointURI and test values MuleEndpointURI endpointUri = new MuleEndpointURI("axis:jms://myComponent"); assertEquals("jms", endpointUri.getScheme()); assertEquals("axis", endpointUri.getSchemeMetaInfo()); assertEquals("axis:jms", endpointUri.getFullScheme()); assertEquals("jms://myComponent", endpointUri.getAddress()); endpointUri.initialise(); // Reconstruct MuleEndpointURI and test values EndpointURI newEndpointUri = new MuleEndpointURI(endpointUri); newEndpointUri.initialise(); assertEquals("jms", newEndpointUri.getScheme()); assertEquals("axis", newEndpointUri.getSchemeMetaInfo()); assertEquals("axis:jms", newEndpointUri.getFullScheme()); assertEquals("jms://myComponent", newEndpointUri.getAddress()); assertEquals(endpointUri, newEndpointUri); } } mule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisEndpointTestCase.java0000644000175000017500000001024710745677442032575 0ustar charlescharles/* * $Id: AxisEndpointTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.api.registry.ServiceDescriptorFactory; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; import org.mule.transport.service.TransportServiceDescriptor; public class AxisEndpointTestCase extends AbstractMuleTestCase { public void testEndpoint() throws Exception { String url = "axis:http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2"; EndpointURI endpointUri = new MuleEndpointURI(url); endpointUri.initialise(); assertEquals("axis", endpointUri.getSchemeMetaInfo()); // it's up to the client to actually strip off the method name if // necessary assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2", endpointUri.getAddress()); assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); assertEquals(3, endpointUri.getParams().size()); url = "axis:http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2"; endpointUri = new MuleEndpointURI(url); endpointUri.initialise(); assertEquals("axis", endpointUri.getSchemeMetaInfo()); assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2", endpointUri.getAddress()); assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); assertEquals(3, endpointUri.getParams().size()); } public void testEndpointWithUserInfo() throws Exception { String url = "axis:http://admin:pwd@www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2"; EndpointURI endpointUri = new MuleEndpointURI(url); endpointUri.initialise(); assertEquals("axis", endpointUri.getSchemeMetaInfo()); // it's up to the client to actually strip off the method name if // necessary assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2", endpointUri.getAddress()); assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); assertEquals(3, endpointUri.getParams().size()); assertEquals("admin:pwd", endpointUri.getUserInfo()); assertEquals("admin", endpointUri.getUser()); assertEquals("pwd", endpointUri.getPassword()); } public void testEndpointFinder() throws Exception { String url = "soap:http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2"; EndpointURI endpointUri = new MuleEndpointURI(url); endpointUri.initialise(); assertEquals("soap", endpointUri.getSchemeMetaInfo()); // it's up to the client to actually strip off the method name if // necessary assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething¶m1=1¶m2=2", endpointUri.getAddress()); assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY)); assertEquals(3, endpointUri.getParams().size()); TransportServiceDescriptor sd = (TransportServiceDescriptor) muleContext.getRegistry().lookupServiceDescriptor(ServiceDescriptorFactory.PROVIDER_SERVICE_TYPE, "soap", null); if (sd != null) { //TODO TC: How do we assert this state in the new model? //assertEquals("axis", sd.getProtocol()); //assertEquals("org.mule.transport.soap.axis.AxisConnector", sd.getConnector()); } } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorJmsEndpointFormatTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorJmsEndpointFormat0000644000175000017500000000543610754375733033721 0ustar charlescharles/* * $Id: AxisConnectorJmsEndpointFormatTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.transport.DispatchException; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.NullPayload; public class AxisConnectorJmsEndpointFormatTestCase extends FunctionalTestCase { public void testAxisOverJmsWithQueueNameSameAsComponentName() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send("componentName", new DefaultMuleMessage("test1")); assertNotNull(result.getPayload()); assertEquals("test1", result.getPayloadAsString()); } public void testAxisOverJmsWithQueueNameDifferentFromComponentName() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send("soapActionDefined", new DefaultMuleMessage("test2")); assertNotNull(result.getPayload()); assertEquals("test2", result.getPayloadAsString()); } public void testAxisOverJmsWithoutSettingMethodOnEndpoint() throws Exception { MuleClient client = new MuleClient(); Exception exception = null; try { client.send("noMethodDefined", new DefaultMuleMessage("test3")); } catch (Exception e) { exception = e; } assertNotNull(exception); assertTrue(exception instanceof DispatchException); assertTrue(exception.getMessage().startsWith("Cannot invoke WS call without an Operation.")); } public void testAxisOverJmsWithoutSettingSoapAction() throws Exception { MuleClient client = new MuleClient(); Exception exception = null; try { MuleMessage msg = client.send("noSoapActionDefined", new DefaultMuleMessage("test4")); assertEquals(NullPayload.getInstance(), msg.getPayload()); } catch (Exception e) { exception = e; } assertNotNull(exception); assertTrue(exception instanceof DispatchException); assertTrue(exception.getCause().getMessage().startsWith("The AXIS engine could not find a target service to invoke!")); } protected String getConfigResources() { return "axis-jms-endpoint-format-config.xml"; } }mule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/mock/0000755000175000017500000000000011351410661026574 5ustar charlescharlesmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/mock/MockProvider.java0000644000175000017500000000116510745677442032070 0ustar charlescharles/* * $Id: MockProvider.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.mock; import org.apache.axis.configuration.SimpleProvider; public class MockProvider extends SimpleProvider { public MockProvider() { super(); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/mock/MockEngineConfiguration.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/mock/MockEngineConfiguration.j0000644000175000017500000000426610745677442033550 0ustar charlescharles/* * $Id: MockEngineConfiguration.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.mock; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import org.apache.axis.AxisEngine; import org.apache.axis.ConfigurationException; import org.apache.axis.EngineConfiguration; import org.apache.axis.Handler; import org.apache.axis.encoding.TypeMappingRegistry; import org.apache.axis.handlers.soap.SOAPService; public class MockEngineConfiguration extends Object implements EngineConfiguration { public void configureEngine(AxisEngine engine) throws ConfigurationException { // don't do it } public Iterator getDeployedServices() throws ConfigurationException { return null; } public Hashtable getGlobalOptions() throws ConfigurationException { return null; } public Handler getGlobalRequest() throws ConfigurationException { return null; } public Handler getGlobalResponse() throws ConfigurationException { return null; } public Handler getHandler(QName qname) throws ConfigurationException { return null; } public List getRoles() { return null; } public SOAPService getService(QName qname) throws ConfigurationException { return null; } public SOAPService getServiceByNamespaceURI(String namespace) throws ConfigurationException { return null; } public Handler getTransport(QName qname) throws ConfigurationException { return null; } public TypeMappingRegistry getTypeMappingRegistry() throws ConfigurationException { return null; } public void writeEngineConfig(AxisEngine engine) throws ConfigurationException { // does nothing } } mule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/mock/MockAxisServer.java0000644000175000017500000000130210745677442032362 0ustar charlescharles/* * $Id: MockAxisServer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.mock; import org.apache.axis.EngineConfiguration; import org.apache.axis.server.AxisServer; public class MockAxisServer extends AxisServer { public MockAxisServer(EngineConfiguration engineConfig) { super(engineConfig); } } mule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/style/0000755000175000017500000000000011351410661027003 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/style/DefaultMessageService.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/style/DefaultMessageService.ja0000644000175000017500000000560510745677442033561 0ustar charlescharles/* * $Id: DefaultMessageService.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ /* * Copyright 2002-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or =mplied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mule.transport.soap.axis.style; import javax.xml.soap.Name; import javax.xml.soap.SOAPBody; import javax.xml.soap.SOAPElement; import javax.xml.soap.SOAPEnvelope; import javax.xml.soap.SOAPException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * Simple message-style service sample. */ public class DefaultMessageService implements MessageService { private static Log logger = LogFactory.getLog(DefaultMessageService.class); /** * Service method, which simply echoes back any XML it receives. * * @param bodyElements an array of DOM Elements, one for each SOAP body =lement * @return an array of DOM Elements to be sent in the response body */ public org.apache.axis.message.SOAPBodyElement[] soapBodyElement(org.apache.axis.message.SOAPBodyElement[] bodyElements) { // Echo back logger.debug("bodyElementTest Called"); return bodyElements; } public Document document(Document body) { // Echo back logger.debug("documentTest Called"); body.setNodeValue("TEST RESPONSE"); return body; } public Element[] elementArray(Element[] elems) { // Echo back logger.debug("echoElements Called"); return elems; } public void soapRequestResponse(SOAPEnvelope req, SOAPEnvelope resp) throws SOAPException { // Echo back logger.debug("envelopeTest Called"); SOAPBody body = resp.getBody(); Name ns0 = resp.createName("TestNS0", "ns0", "http://example.com"); Name ns1 = resp.createName("TestNS1", "ns1", "http://example.com"); SOAPElement bodyElmnt = body.addBodyElement(ns0); SOAPElement el = bodyElmnt.addChildElement(ns1); el.addTextNode("TEST RESPONSE"); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/style/AxisMessageStyleServiceTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/style/AxisMessageStyleServiceT0000644000175000017500000001477010763522057033647 0ustar charlescharles/* * $Id: AxisMessageStyleServiceTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.style; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.soap.NamedParameter; import org.mule.transport.soap.SoapMethod; import org.mule.util.StringUtils; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import org.apache.axis.client.Call; import org.apache.axis.client.Service; public class AxisMessageStyleServiceTestCase extends FunctionalTestCase { private static String expectedResult = "TEST RESPONSE"; public String getConfigResources() { return "style/axis-mule-message-config.xml"; } protected String getServiceEndpoint() { return "http://localhost:63080/ServiceEntryPoint"; } public void testDocumentWithNamesapce() throws Exception { doSoapRequest(new QName("http://muleumo.org", "document"), "axis:" + getServiceEndpoint(), false, false, false); } public void testDocumentWithQName() throws Exception { doSoapRequest(new QName("http://muleumo.org", "document"), "axis:" + getServiceEndpoint(), false, false, true); } public void testDocumentWithAxisApi() throws Exception { doSoapRequest(new QName("http://muleumo.org", "document"), getServiceEndpoint(), true, false, false); } public void testDocumentWithSoapMethod() throws Exception { doSoapRequest(new QName("http://muleumo.org", "document"), "axis:" + getServiceEndpoint(), false, true, false); } public void testElementArrayWithSoapMethod() throws Exception { doSoapRequest(new QName("http://muleumo.org", "elementArray"), "axis:" + getServiceEndpoint(), false, true, false); } public void testElementArrayWithNamesapce() throws Exception { doSoapRequest(new QName("http://muleumo.org", "elementArray"), "axis:" + getServiceEndpoint(), false, false, false); } public void testElementArrayWithQName() throws Exception { doSoapRequest(new QName("http://muleumo.org", "elementArray"), "axis:" + getServiceEndpoint(), false, false, true); } public void testElementArrayWithAxisApi() throws Exception { doSoapRequest(new QName("http://muleumo.org", "elementArray"), getServiceEndpoint(), true, false, false); } public void testSoapBodyElementWithSoapMethod() throws Exception { doSoapRequest(new QName("http://muleumo.org", "soapBodyElement"), "axis:" + getServiceEndpoint(), false, true, false); } public void testSoapBodyElementWithNamesapce() throws Exception { doSoapRequest(new QName("http://muleumo.org", "soapBodyElement"), "axis:" + getServiceEndpoint(), false, false, false); } public void testSoapBodyElementWithQName() throws Exception { doSoapRequest(new QName("http://muleumo.org", "soapBodyElement"), "axis:" + getServiceEndpoint(), false, false, true); } public void testSoapBodyElementWithAxisApi() throws Exception { doSoapRequest(new QName("http://muleumo.org", "soapBodyElement"), getServiceEndpoint(), true, false, false); } // TODO does work , complains about generated namespace...TestNS1 // public void testSoapRequestResponseWithSoapMethod() throws Exception { // doSoapRequest(new QName("http://muleumo.org", "soapRequestResponse"), "axis:" // + getServiceEndpoint(), false, true, false); // } // // public void testSoapRequestResponseWithNamesapce() throws Exception { // doSoapRequest(new QName("http://muleumo.org", "soapRequestResponse"), "axis:" // + getServiceEndpoint(), false, false, false); // } // // public void testSoapRequestResponseWithQName() throws Exception { // doSoapRequest(new QName("http://muleumo.org", "soapRequestResponse"), "axis:" // + getServiceEndpoint(), false, false, true); // } public void testSoapRequestResponseWithAxisApi() throws Exception { doSoapRequest(new QName("http://muleumo.org", "soapRequestResponse"), getServiceEndpoint(), true, false, false); } protected void doSoapRequest(QName method, String endpoint, boolean useAxisApi, boolean useSoapMethod, boolean useQNameMethod) throws Exception { if (useAxisApi) { Service service = new Service(); Call call = (Call)service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint)); call.setOperationName(method); String ret = (String)call.invoke(new Object[]{expectedResult}); assertNotNull(ret); assertEquals(ret, expectedResult); } else { // Now try with the MuleClient MuleClient client = new MuleClient(); Map props = new HashMap(); if (useSoapMethod) { SoapMethod soapMethod = new SoapMethod(method); soapMethod.addNamedParameter(new QName(method.getNamespaceURI(), method.getLocalPart()), NamedParameter.XSD_STRING, ParameterMode.IN); props.put(MuleProperties.MULE_METHOD_PROPERTY, soapMethod); } else if (useQNameMethod) { props.put(MuleProperties.MULE_METHOD_PROPERTY, method); } else { endpoint += "?method=" + method.getLocalPart(); if (StringUtils.isNotBlank(method.getNamespaceURI())) { props.put("methodNamespace", method.getNamespaceURI()); } } MuleMessage result = client.send(endpoint, expectedResult, props); assertNotNull(result); assertEquals(expectedResult, result.getPayloadAsString()); } } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/style/AxisMessageStyleServiceWithoutNamespaceTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/style/AxisMessageStyleServiceW0000644000175000017500000000151310761157761033645 0ustar charlescharles/* * $Id: AxisMessageStyleServiceWithoutNamespaceTestCase.java 11059 2008-02-27 03:58:41Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis.style; public class AxisMessageStyleServiceWithoutNamespaceTestCase extends AxisMessageStyleServiceTestCase { public String getConfigResources() { return "style/axis-mule-message-config-without-namespace.xml"; } protected String getServiceEndpoint() { return "http://localhost:8088/ServiceEntryPoint"; } } mule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/style/MessageService.java0000644000175000017500000000321410745677442032575 0ustar charlescharles/* * $Id: MessageService.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ /* * Copyright 2002-2004 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or =mplied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mule.transport.soap.axis.style; import javax.xml.soap.SOAPEnvelope; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * Simple message-style service sample. */ public interface MessageService { /** * Service methods, echo back any XML received. */ public org.apache.axis.message.SOAPBodyElement[] soapBodyElement(org.apache.axis.message.SOAPBodyElement[] bodyElements); public Document document(Document body); public Element[] elementArray(Element[] elems); public void soapRequestResponse(SOAPEnvelope req, SOAPEnvelope resp) throws javax.xml.soap.SOAPException; } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorJmsTopicsFunctionalTestCase.javamule-2.0.1/transports/axis/src/test/java/org/mule/transport/soap/axis/AxisConnectorJmsTopicsFunction0000644000175000017500000000504710745677442033737 0ustar charlescharles/* * $Id: AxisConnectorJmsTopicsFunctionalTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.soap.axis; public class AxisConnectorJmsTopicsFunctionalTestCase extends AxisConnectorJmsFunctionalTestCase { protected String getRequestResponseEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent?method=echo&resourceInfo=topic"; } protected String getReceiveEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent2?method=getDate&resourceInfo=topic"; } protected String getReceiveComplexEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=getPerson¶m=Fred&resourceInfo=topic"; } protected String getSendReceiveComplexEndpoint1() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=addPerson&resourceInfo=topic"; } protected String getSendReceiveComplexEndpoint2() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=getPerson¶m=Dino&resourceInfo=topic&resourceInfo=topic"; } protected String getReceiveComplexCollectionEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=getPeople&resourceInfo=topic"; } protected String getDispatchAsyncComplexEndpoint1() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=addPerson&resourceInfo=topic"; } protected String getDispatchAsyncComplexEndpoint2() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=getPerson¶m=Betty&resourceInfo=topic"; } protected String getTestExceptionEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent3?method=addPerson&resourceInfo=topic"; } protected String getWsdlEndpoint() { return getSoapProvider() + ":" + getTransportProtocol() + "://mycomponent?wsdl"; } public String getConfigResources() { return "axis-jms-topics-mule-config.xml"; } } mule-2.0.1/transports/axis/src/test/resources/0000755000175000017500000000000011351410662021242 5ustar charlescharlesmule-2.0.1/transports/axis/src/test/resources/log4j.properties0000644000175000017500000000050210577411741024404 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/transports/axis/src/test/resources/axis-jms-endpoint-format-config.xml0000644000175000017500000000404010766460764030105 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-test-servlet-mule-config.xml0000644000175000017500000000235210745174725027611 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-jms-topics-mule-config.xml0000644000175000017500000000473610745677442027254 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-jms-mule-config.xml0000644000175000017500000000557210766654216025751 0ustar charlescharles org.mule.api.component.simple.EchoService org.mule.tck.testmodels.services.DateService mule-2.0.1/transports/axis/src/test/resources/axis-https-connector-config.xml0000644000175000017500000000271110763766522027343 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-soap-attachments.xml0000644000175000017500000000267610745677442026235 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-servlet-security-config.xml0000644000175000017500000000466010745677442027551 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axisServerKeystore0000644000175000017500000000335610643202414025052 0ustar charlescharles muleclient '3X.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'. muleserver ,6N00 +*d;j5V3g2+sDjav}tKmn@GFzS̛-ps냦""AYNZMgGqYS"IW٥ .17e7i??i~?k5ݺZT((`){B|.쵱L6&/rՒpFt$jXesἕVSQ 8,]tKϪ>țbE=K\{_\./S~If#9Ysk BCGEkFw BqTW>uΓ$6ռD.G@{-ɍ\@ҡ `>d gZ6Z?4( 3 .bzX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlOnOO}*Hgmule-2.0.1/transports/axis/src/test/resources/vm-to-axis-proxy-mule-config.xml0000644000175000017500000000577210745677442027406 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-http-mule-config.xml0000644000175000017500000000434210745677442026134 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-soapheader-test.xml0000644000175000017500000000212410745677442026036 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/test-service.wsdl0000644000175000017500000000511210656165101024553 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-vm-mule-config.xml0000644000175000017500000000430310745677442025574 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/endpoint-retrieval-mule-2021-test.xml0000644000175000017500000000134110665301621030076 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-doc-lit-mule-config.xml0000644000175000017500000000323510745174725026504 0ustar charlescharles java.lang.Exception mule-2.0.1/transports/axis/src/test/resources/axis-client-endpoint-config.xml0000644000175000017500000000221210742703177027273 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-wsdl-test.xml0000644000175000017500000000344510745677442024703 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-namespace-config.xml0000644000175000017500000000730310745677442026151 0ustar charlescharles addedFromSpring;string;in mule-2.0.1/transports/axis/src/test/resources/axisTrustStore0000644000175000017500000003736210643202414024220 0ustar charlescharlesqӓ=:0  *H 01 0 UUS10U VeriSign, Inc.1<0:U 3Class 1 Public Primary Certification Authority - G21:08U 1(c) 1998 VeriSign, Inc. - For authorized use only10U VeriSign Trust Network0 980518000000Z 280801235959Z01 0 UUS10U VeriSign, Inc.1<0:U 3Class 1 Public Primary Certification Authority - G21:08U 1(c) 1998 VeriSign, Inc. - For authorized use only10U VeriSign Trust Network00  *H 0к-v1ʔVooR6nuV UC!e~!k2?4A5ݪY?SmO*ZĦE]>d$vͫo{Qan4A @s=ku0  *H O g,٨-u~;r~\- km`|Ő# \JЯ]Ƕ  vOÛu[kܬrNOdt{•AesXJKl#P&D#q$GuȦ0  *H +9t^dXJ-73G\`'ER?dh|`3ibTk`BШ;\&#

ZW%v ,75xdT@Qɿ⊂7U!vhKK%f"VlYmepqv>wLPVH).JYIT,s:i9mpgH-{0  *H ~e~:qFǠ@&> Z7a[i;D S kI>5l\:/`KM _d{\w9YoӵMMBVv_8_u_{厀|Pwww.verisign.com/repository/TestCPS Incorp. By Ref. Liab. LTD.1F0DU =For VeriSign authorized testing only. No assurances (C)VS19970 980204000000Z 030304235959Z010U  VeriSign, Inc1G0EU >www.verisign.com/repository/TestCPS Incorp. By Ref. Liab. LTD.1F0DU =For VeriSign authorized testing only. No assurances (C)VS19970\0  *H K0HAƤ&'8œn@˟6~sNбFm@p(Y4Mێ'C;;rN`oQ0  *H Am$g$]upy;N4 د¯NJg {rGc{HL/وQ9 u?verisign class 1 ca individual subscriber-persona not validated ɮX.509j0f0Ϡ O[uj)0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority0 980512000000Z 080512235959Z010U VeriSign, Inc.10U VeriSign Trust Network1F0DU =www.verisign.com/repository/RPA Incorp. By Ref.,LIAB.LTD(c)981H0FU?VeriSign Class 1 CA Individual Subscriber-Persona Not Validated00  *H 0ZDUz-Ox6 JoTw*h1ApzKHV-BD\B/;' ]6B3nTOJƚj$e~7jJ 00 `HB05U.0,0*(&$http://crl.verisign.com/pca1.1.1.crl0GU @0>0< `HE0-0++www.verisign.com/repository/RPA0U00 U0  *H B|ߌyLMU/P^N.^2ye JRը1!l4x BZъު"!e3 3 >5d$[h|7d Ž33>>s muleclient ɯX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'.%2q^P' #˦B7verisign class 1 public primary certification authority ɮkX.509A0=0ͺVT"rU0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority0 960129000000Z 280801235959Z0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority00  *H 0mVa-Hqg޹뷞 8%Fs$] en VsߴX9knը?14׏4g NEVixG)6c\-{2{0*/1g0  *H L?hC3]Mz36ؕ"6hl|B.?OvJ͠ )"]݁#{%F0yK@<_SH䆴{5{%ӎ?84qthawte personal basic ca ɮX.509%0!00  *H 01 0 UZA10U Western Cape10U Cape Town10U Thawte Consulting1(0&U Certification Services Division1!0UThawte Personal Basic CA1(0& *H  personal-basic@thawte.com0 960101000000Z 201231235959Z01 0 UZA10U Western Cape10U Cape Town10U Thawte Consulting1(0&U Certification Services Division1!0UThawte Personal Basic CA1(0& *H  personal-basic@thawte.com00  *H 0SmPOH5ZoBGwurݍIWx?Qi v"jQK7 M458WJpYC}O= bzu݈NN@ۨ2to D يo)(;@(Z<յ ʤQL,YڹuB#.pG*verisign international server ca - class 3 ɮ6X.50900%K8BXݮ"n0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 3 Public Primary Certification Authority0 970417000000Z 111024235959Z010U VeriSign Trust Network10U VeriSign, Inc.1301U *VeriSign International Server CA - Class 31I0GU @www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign00  *H 0؂}9%e+Ӽ6;Ll[( ;MN9\IZӲp0B+QZ<:"OSO4{o00U00DU =0;09 `HE0*0(+https://www.verisign.com/CPS04U%-0+++ `HB `HE0 U0 `HB01U*0(0&$" http://crl.verisign.com/pca3.crl0  *H hBs#:T#>j:36 o)+rDѬ -8=܆aN&_^ $p&C=I.R_>f)N,Fus~ gTR muleserver ɯFX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlO?verisign class 3 ca individual subscriber-persona not validated ɮ'X.5095010#l+ t`0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 3 Public Primary Certification Authority0 970417000000Z 040107235959Z010U VeriSign Trust Network10U VeriSign, Inc.1301U *VeriSign International Server CA - Class 31I0GU @www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign00  *H 0؂}9%e+Ӽ6;Ll[( ;MN9\IZӲp0B+QZ<:"OSO4{o00U00 U0 `HB0 U%0 `HE `HB05U ,0(0$ `HE00(+https://www.verisign.com/CPS0+00VeriSign, Inc.0VeriSign's Certification Practice Statement, www.verisign.com/CPS, governs this certificate & is incorporated by reference herein. SOME WARRANTIES DISCLAIMED & LIABILITY LTD. (c)1997 VeriSign0  *H +Hrh tcXE"N3bZ!$lBE:gHk7K}xU1fF}x`UlUibp|MC (ьFP1f$J[Kf^eU_7?verisign class 2 ca individual subscriber-persona not validated ɮX.509V0R0R |΂Es0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 2 Public Primary Certification Authority0 980512000000Z 040106235959Z010U VeriSign, Inc.10U VeriSign Trust Network1F0DU =www.verisign.com/repository/RPA Incorp. By Ref.,LIAB.LTD(c)981402U+VeriSign Class 2 CA - Individual Subscriber00  *H 0T^%,Y_ kJK >~/e_c, k^Ih%$_#iM;}ڏ ϥX:Kخu""(`0!p^H!T_8)SzSX ]PK9Ti00 `HB05U.0,0*(&$http://crl.verisign.com/pca2.1.1.crl0GU @0>0< `HE0-0++www.verisign.com/repository/RPA0U00 U0  *H  cQ"U_8$^;ID7RuĊRXٮdV/4H׏bƅel@~h!4Z_p LܠA(/ F @LC@1Tmule-2.0.1/transports/axis/src/test/resources/test-axis-config.wsdd0000644000175000017500000000057510631537676025337 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000075310766272451026134 0ustar charlescharles# # Test cases listed in this file are not run. # # Skip these until the tests-external profile works org.mule.transport.soap.axis.AxisExternalServerTest org.mule.transport.soap.axis.VmToAxisProxyTestCase # MULE-2607 org.mule.transport.soap.axis.AxisServletBindingTestCase # MULE-2164 org.mule.transport.soap.axis.AxisEndpointMule2164TestCase # This works, but it requires tools.jar on the classpath which not everyone has org.mule.transport.soap.axis.AxisServiceUsingCxfEndpointTestCasemule-2.0.1/transports/axis/src/test/resources/axis-calculator-config.xml0000644000175000017500000000614510745677442026351 0ustar charlescharles Number1;int;in Number2;int;in return;int mule-2.0.1/transports/axis/src/test/resources/style/0000755000175000017500000000000011351410662022402 5ustar charlescharlesmule-2.0.1/transports/axis/src/test/resources/style/axis-mule-message-config-without-namespace.xml0000644000175000017500000000263610766460764033400 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/style/axis-mule-message-config.xml0000644000175000017500000000222510766460764027737 0ustar charlescharles mule-2.0.1/transports/axis/src/test/resources/axis-named-param-mule-config.xml0000644000175000017500000000303010745677442027330 0ustar charlescharles mule-2.0.1/transports/axis/pom.xml0000644000175000017500000001425711006063605017006 0ustar charlescharles 4.0.0 org.mule.transports mule-transports 2.0.1 mule-transport-axis SOAP Transport: Axis A Mule transport for Soap Connectivity using Axis. tests-external org.mule.tests mule-tests-external-axis ${version} war org.mule.tests mule-tests-external-common ${version} jar osgi org.apache.felix maven-bundle-plugin org.mule.transport.soap.axis.* org.mule.transports mule-transport-soap ${version} org.mule.transports mule-transport-http ${version} org.mule.transports mule-transport-soap ${version} test-jar test org.apache.axis axis 1.4 commons-logging commons-logging org.apache.axis axis-jaxrpc 1.4 org.apache.axis axis-saaj 1.4 provided wsdl4j wsdl4j 1.6.1 commons-httpclient commons-httpclient test commons-logging commons-logging org.mule.modules mule-module-client ${version} javax.mail mail provided org.mule.modules mule-module-spring-extras ${version} test org.mule.transports mule-transport-jms ${version} test org.mule.transports mule-transport-vm ${version} test org.mule.modules mule-module-acegi ${version} test org.apache.activemq activemq-core test mule-2.0.1/modules/0000755000175000017500000000000011351411165013746 5ustar charlescharlesmule-2.0.1/modules/spring-extras/0000755000175000017500000000000011351411154016552 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/0000755000175000017500000000000011351411154017341 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/0000755000175000017500000000000011351411154020265 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/java/0000755000175000017500000000000011351411154021206 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/java/org/0000755000175000017500000000000011351411154021775 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/java/org/mule/0000755000175000017500000000000011351411154022737 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/0000755000175000017500000000000011351411154024224 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/0000755000175000017500000000000011351411154025526 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/package.html0000644000175000017500000000031410754375733030027 0ustar charlescharles Mule Provides extensions to use the Spring framework with Mule such as utilising the spring container to build components managed by Mule. mule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/0000755000175000017500000000000011351411154027032 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/package.html0000644000175000017500000000033010754375733031331 0ustar charlescharles Mule A Spring EventMulticaster that allows any Spring bean to send and receive mule events through the ApplicationContext and event listeners. mule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/MuleEventListener.java0000644000175000017500000000133410754375733033332 0ustar charlescharles/* * $Id: MuleEventListener.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; import org.springframework.context.ApplicationListener; /** * MuleEventListener is a interface that identifies an object as * wanting to receive Mule Events */ public interface MuleEventListener extends ApplicationListener { // just a marker } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/MuleSubscriptionEventListener.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/MuleSubscriptionEventLi0000644000175000017500000000234310754375733033577 0ustar charlescharles/* * $Id: MuleSubscriptionEventListener.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; /** * MuleSubscriptionEventListener is a Spring ApplicationListener that * is used to register interest about Mule events. The developer can supply an array * of endpoints that it wishes to subscribe to. i.e. new String[]{ * "file/C:/dev/test/data", "my.jms.queue", "http://www.mycompaony.com/events"}; You * can aslo specify logical endpoints that are configured on the Mule Server so you * can use more friendly names such as new String[]{ "testData", "OrdersJms", * "eventsHttp"}; By specifying '*' as the subscription, all events will be received * by this listener. */ public interface MuleSubscriptionEventListener extends MuleEventListener { public String[] getSubscriptions(); public void setSubscriptions(String[] subscriptions); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/MuleEventMulticaster.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/MuleEventMulticaster.ja0000644000175000017500000007316310774254333033515 0ustar charlescharles/* * $Id: MuleEventMulticaster.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.RequestContext; import org.mule.api.MuleContext; import org.mule.api.MuleEventContext; import org.mule.api.MuleException; import org.mule.api.MuleRuntimeException; import org.mule.api.MuleSession; import org.mule.api.config.MuleProperties; import org.mule.api.config.ThreadingProfile; import org.mule.api.context.MuleContextAware; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointFactory; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.model.Model; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.routing.filter.ObjectFilter; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.Connector; import org.mule.component.DefaultJavaComponent; import org.mule.config.QueueProfile; import org.mule.endpoint.MuleEndpointURI; import org.mule.model.seda.SedaModel; import org.mule.model.seda.SedaService; import org.mule.module.spring.i18n.SpringMessages; import org.mule.object.SingletonObjectFactory; import org.mule.routing.filters.WildcardFilter; import org.mule.transport.AbstractConnector; import org.mule.util.ClassUtils; import java.beans.ExceptionListener; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArraySet; import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ApplicationEventMulticaster; import org.springframework.context.event.ContextClosedEvent; import org.springframework.context.event.ContextRefreshedEvent; /** * MuleEventMulticaster is an implementation of a Spring * ApplicationeventMulticaster. This implementation allows Mule event to be sent and * received through the Spring ApplicationContext. This allows any Spring bean to * receive and send events from any transport that Mule supports such as Jms, Http, * Tcp, Pop3, Smtp, File, etc. All a bean needs to do to receive and send events is * to implement MuleEventListener. Beans can also have subscriptions to certain * events by implementing MuleSubscriptionEventListener, where the bean can provide a * list of endpoints on which to receive events i.e. * <bean id="myListener" class="com.foo.MyListener"> * <property name="subscriptions"> * <list> * <value>jms://customer.support</value> * <value>pop3://support:123456@mail.mycompany.com</value> * </list> * </property> * </bean> * *

Endpoints are specified as a Mule Url which is used to register a listener * for the subscription In the previous version of the MuleEventMulticaster it was * possible to specify wildcard endpoints. This is still possible but you need to * tell the multicaster which specific endpoints to listen on and then your * subscription listeners can use wildcards. To register the specific endpoints on * the MuleEvent Multicaster you use the subscriptions property.

* <bean id="applicationEventMulticaster" class="org.mule.module.spring.events.MuleEventMulticaster"> * <property name="subscriptions"> * <list> * <value>jms://orders.queue</value> * <value>jms://another.orders.queue</value> * </list> * </property> * </bean> *

* <bean id="myListener" class="com.foo.MyListener"> * <property name="subscriptions"> * <list> * <value>jms://*.orders.*.</value> * </list> * </property> * </bean> *

* * * @see MuleEventListener * @see MuleSubscriptionEventListener * @see ApplicationEventMulticaster */ public class MuleEventMulticaster implements ApplicationEventMulticaster, ApplicationContextAware, MuleContextAware, Callable, Initialisable { public static final String EVENT_MULTICASTER_DESCRIPTOR_NAME = "muleEventMulticasterDescriptor"; /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(MuleEventMulticaster.class); /** * The set of listeners for this Multicaster */ protected final Set listeners = new CopyOnWriteArraySet(); /** * Determines whether events will be processed asynchronously */ protected boolean asynchronous = false; /** * An ExecutorService for handling asynchronous events */ protected ExecutorService asyncPool = null; /** * A list of endpoints the eventMulticaster will receive events on Note that if * this eventMulticaster has a Mule Descriptor associated with it, these * endpoints are ignored and the ones on the Mule Descriptor are used. These are * here for convenience, the event multicaster will use these to create a default * MuleDescriptor for itself at runtime */ protected String[] subscriptions = null; /** * The Spring acpplication context */ protected ApplicationContext applicationContext; /** * The mule instance compoennt for the Multicaster */ protected Service service; /** * The filter used to match subscriptions */ protected Class subscriptionFilter = WildcardFilter.class; /** * Used to store parsed endpoints */ protected ExceptionListener exceptionListener = new LoggingExceptionListener(); protected MuleContext muleContext; public void setMuleContext(MuleContext context) { this.muleContext = context; } public void initialise() throws InitialisationException { if (asynchronous) { if (asyncPool == null) { asyncPool = muleContext.getDefaultThreadingProfile().createPool("spring-events"); } } else { if (asyncPool != null) { asyncPool.shutdown(); asyncPool = null; } } } /** * Adds a listener to the the Multicaster. If asynchronous is set to true, an * AsynchronousMessageListener is used to wrap the listener. This * listener will be initialised with a threadpool. The configuration for the * threadpool can be set on this multicaster or inherited from the MuleManager * configuration, which is good for most cases. * * @param listener the ApplicationListener to register with this Multicaster * @see AsynchronousEventListener * @see ThreadingProfile */ public void addApplicationListener(ApplicationListener listener) { Object listenerToAdd = listener; if (asynchronous) { listenerToAdd = new AsynchronousEventListener(asyncPool, listener); } listeners.add(listenerToAdd); } /** * Removes a listener from the multicaster * * @param listener the listener to remove */ public void removeApplicationListener(ApplicationListener listener) { for (Iterator iterator = listeners.iterator(); iterator.hasNext();) { ApplicationListener applicationListener = (ApplicationListener) iterator.next(); if (applicationListener instanceof AsynchronousEventListener) { if (((AsynchronousEventListener) applicationListener).getListener().equals(listener)) { listeners.remove(applicationListener); return; } } else { if (applicationListener.equals(listener)) { listeners.remove(applicationListener); return; } } } listeners.remove(listener); } /** * Removes all the listeners from the multicaster */ public void removeAllListeners() { listeners.clear(); } /** * Method is used to dispatch events to listeners registered with the * EventManager or dispatches events to Mule depending on the type and state of * the event received. If the event is not a Mule event it will be dispatched to * any listeners registered that are NOT MuleEventListeners. If the event is a * Mule event and there is no source event attached to it, it is assumed that the * event was dispatched by an object in the context using context.publishEvent() * and will be dispatched by Mule. If the event does have a source event attached * to it, it is assumed that the event was dispatched by Mule and will be * delivered to any listeners subscribed to the event. * * @param e the application event received by the context */ public void multicastEvent(ApplicationEvent e) { MuleApplicationEvent muleEvent = null; // if the context gets refreshed we need to reinitialise if (e instanceof ContextRefreshedEvent) { try { registerMulticasterComponent(); } catch (MuleException ex) { throw new MuleRuntimeException(SpringMessages.failedToReinitMule(), ex); } } else if (e instanceof ContextClosedEvent) { muleContext.dispose(); return; } else if (e instanceof MuleApplicationEvent) { muleEvent = (MuleApplicationEvent) e; // If there is no Mule event the event didn't originate from Mule // so its an outbound event if (muleEvent.getMuleEventContext() == null) { try { dispatchEvent(muleEvent); } catch (ApplicationEventException e1) { exceptionListener.exceptionThrown(e1); } return; } } for (Iterator iterator = listeners.iterator(); iterator.hasNext();) { ApplicationListener listener = (ApplicationListener) iterator.next(); if (muleEvent != null) { // As the asynchronous listener wraps the real listener we need // to check the type of the wrapped listener, but invoke the Async // listener if (listener instanceof AsynchronousEventListener) { AsynchronousEventListener asyncListener = (AsynchronousEventListener) listener; if (asyncListener.getListener() instanceof MuleSubscriptionEventListener) { if (isSubscriptionMatch(muleEvent.getEndpoint(), ((MuleSubscriptionEventListener) asyncListener.getListener()).getSubscriptions())) { asyncListener.onApplicationEvent(muleEvent); } } else if (asyncListener.getListener() instanceof MuleEventListener) { asyncListener.onApplicationEvent(muleEvent); } else if (!(asyncListener.getListener() instanceof MuleEventListener)) { asyncListener.onApplicationEvent(e); } // Synchronous MuleEvent listener Checks } else if (listener instanceof MuleSubscriptionEventListener) { if (isSubscriptionMatch(muleEvent.getEndpoint(), ((MuleSubscriptionEventListener) listener).getSubscriptions())) { listener.onApplicationEvent(muleEvent); } } else if (listener instanceof MuleEventListener) { listener.onApplicationEvent(muleEvent); } } else if (listener instanceof AsynchronousEventListener && !(((AsynchronousEventListener) listener).getListener() instanceof MuleEventListener)) { listener.onApplicationEvent(e); } else if (!(listener instanceof MuleEventListener)) { listener.onApplicationEvent(e); } else { // Finally only propagate the Application event if the // ApplicationEvent interface is explicitly implemented for (int i = 0; i < listener.getClass().getInterfaces().length; i++) { if (listener.getClass().getInterfaces()[i].equals(ApplicationListener.class)) { listener.onApplicationEvent(e); break; } } } } } /** * Matches a subscription to the current event endpointUri * * @param endpoint endpoint * @param subscriptions subscriptions * @return true if there's a match */ private boolean isSubscriptionMatch(String endpoint, String[] subscriptions) { for (int i = 0; i < subscriptions.length; i++) { String subscription = subscriptions[i]; // Subscriptions can be full Mule Urls or resource specific such as // my.queue // if it is a MuleEndpointURI we need to extract the Resource // specific part // if (MuleEndpointURI.isMuleUri(subscription)) { // EndpointURI ep = (EndpointURI) endpointsCache.get(subscription); // if (ep == null) { // try { // ep = new MuleEndpointURI(subscription); // } catch (MalformedEndpointException e) { // throw new IllegalArgumentException(e.getMessage()); // } // endpointsCache.put(subscription, ep); // } // subscription = ep.getAddress(); // } ObjectFilter filter = createFilter(subscription); if (filter.accept(endpoint)) { return true; } } return false; } /** * Determines whether events will be processed asynchronously * * @return tru if asynchronous. The default is false */ public boolean isAsynchronous() { return asynchronous; } /** * Determines whether events will be processed asynchronously * * @param asynchronous true if aysnchronous */ public void setAsynchronous(boolean asynchronous) { this.asynchronous = asynchronous; } /** * This is the callback method used by Mule to give Mule events to this * Multicaster * * @param context the context received by Mule */ public Object onCall(MuleEventContext context) throws TransformerException, MalformedEndpointException { multicastEvent(new MuleApplicationEvent(context.transformMessage(), context, applicationContext)); context.setStopFurtherProcessing(true); return null; } /** * Will dispatch an application event through Mule * * @param applicationEvent the Spring event to be dispatched * @throws ApplicationEventException if the event cannot be dispatched i.e. if * the underlying transport throws an exception */ protected void dispatchEvent(MuleApplicationEvent applicationEvent) throws ApplicationEventException { OutboundEndpoint endpoint; try { endpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( applicationEvent.getEndpoint()); } catch (MuleException e) { throw new ApplicationEventException("Failed to get endpoint for endpointUri: " + applicationEvent.getEndpoint(), e); } if (endpoint != null) { try { // if (applicationEvent.getEndpoint() != null) { // endpoint.setEndpointURI(applicationEvent.getEndpoint()); // } DefaultMuleMessage message = new DefaultMuleMessage(applicationEvent.getSource(), applicationEvent.getProperties()); // has dispatch been triggered using beanFactory.publish() // without a current event if (applicationEvent.getMuleEventContext() != null) { // tell mule not to try and route this event itself applicationEvent.getMuleEventContext().setStopFurtherProcessing(true); applicationEvent.getMuleEventContext().dispatchEvent(message, endpoint); } else { MuleSession session = new DefaultMuleSession(message, ((AbstractConnector) endpoint.getConnector()).getSessionHandler(), service, muleContext); RequestContext.setEvent(new DefaultMuleEvent(message, endpoint, session, false)); // transform if necessary if (endpoint.getTransformers() != null) { message = new DefaultMuleMessage(applicationEvent.getSource(), applicationEvent.getProperties()); message.applyTransformers(endpoint.getTransformers()); } endpoint.dispatch(new DefaultMuleEvent(message, endpoint, session, false)); } } catch (Exception e1) { throw new ApplicationEventException("Failed to dispatch event: " + e1.getMessage(), e1); } } else { throw new ApplicationEventException("Failed endpoint using name: " + applicationEvent.getEndpoint()); } } /** * Set the current Spring application context * * @param applicationContext application context * @throws BeansException */ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } protected void registerMulticasterComponent() throws MuleException { // A discriptor hasn't been explicitly configured, so create a default if (service == null) { service = getDefaultService(); setSubscriptionsOnService(service); muleContext.getRegistry().registerService(service); } } protected void setSubscriptionsOnService(Service service) throws MuleException { String[] subscriptions; List endpoints = new ArrayList(); for (Iterator iterator = listeners.iterator(); iterator.hasNext();) { ApplicationListener listener = (ApplicationListener) iterator.next(); if (listener instanceof AsynchronousEventListener) { listener = ((AsynchronousEventListener) listener).getListener(); } if (listener instanceof MuleSubscriptionEventListener) { subscriptions = ((MuleSubscriptionEventListener) listener).getSubscriptions(); for (int i = 0; i < subscriptions.length; i++) { if (subscriptions[i].indexOf("*") == -1 && MuleEndpointURI.isMuleUri(subscriptions[i])) { boolean isSoap = registerAsSoap(subscriptions[i], listener); if (!isSoap) { endpoints.add(subscriptions[i]); } } } } } if (endpoints.size() > 0) { String endpoint; for (Iterator iterator = endpoints.iterator(); iterator.hasNext();) { endpoint = (String) iterator.next(); InboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( endpoint); // check whether the endpoint has already been set on the // MuleEventMulticastor if (service.getInboundRouter().getEndpoint(ep.getName()) == null) { service.getInboundRouter().addEndpoint(ep); } } } } private boolean registerAsSoap(String endpoint, Object listener) throws MuleException { if (endpoint.startsWith("glue") || endpoint.startsWith("soap") || endpoint.startsWith("axis") || endpoint.startsWith("xfire")) { EndpointURI ep = new MuleEndpointURI(endpoint); // get the service name from the URI path String serviceName = null; if (ep.getPath() != null) { String path = ep.getPath(); if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); } int i = path.lastIndexOf("/"); if (i > -1) { serviceName = path.substring(i + 1); } } else { serviceName = service.getName(); } // now strip off the service name String newEndpoint = endpoint; int i = newEndpoint.indexOf(serviceName); newEndpoint = newEndpoint.substring(0, i - 1); SedaService s = new SedaService(); s.setName(serviceName); s.setModel(muleContext.getRegistry().lookupSystemModel()); s.setQueueProfile(new QueueProfile()); s.getInboundRouter().addEndpoint( muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(newEndpoint)); s.setComponent(new DefaultJavaComponent(new SingletonObjectFactory(listener))); muleContext.getRegistry().registerService(s); return true; } else { return false; } } protected void registerConnectors() throws MuleException { if (!muleContext.isInitialised()) { // Next see if there are any UMOConnectors to register Map connectors = applicationContext.getBeansOfType(Connector.class, true, true); if (connectors.size() > 0) { Map.Entry entry; Connector c; for (Iterator iterator = connectors.entrySet().iterator(); iterator.hasNext();) { entry = (Map.Entry) iterator.next(); c = (Connector) entry.getValue(); if (c.getName() == null) { c.setName(entry.getKey().toString()); } muleContext.getRegistry().registerConnector(c); } } } } protected void registerTransformers() throws MuleException { if (!muleContext.isInitialised()) { // Next see if there are any UMOConnectors to register Map transformers = applicationContext.getBeansOfType(Transformer.class, true, true); if (transformers.size() > 0) { Map.Entry entry; Transformer t; for (Iterator iterator = transformers.entrySet().iterator(); iterator.hasNext();) { entry = (Map.Entry) iterator.next(); t = (Transformer) entry.getValue(); if (t.getName() == null) { t.setName(entry.getKey().toString()); } muleContext.getRegistry().registerTransformer(t); } } } } protected Service getDefaultService() throws MuleException { // When the the beanFactory is refreshed all the beans get // reloaded so we need to unregister the service from Mule Model model = muleContext.getRegistry().lookupModel(MuleProperties.OBJECT_SYSTEM_MODEL); if (model == null) { model = new SedaModel(); model.setName(MuleProperties.OBJECT_SYSTEM_MODEL); muleContext.getRegistry().registerModel(model); } Service service = muleContext.getRegistry().lookupService(EVENT_MULTICASTER_DESCRIPTOR_NAME); if (service != null) { muleContext.getRegistry().unregisterService(service.getName()); } service = new SedaService(); service.setName(EVENT_MULTICASTER_DESCRIPTOR_NAME); service.setModel(model); if (subscriptions == null) { logger.info("No receive endpoints have been set, using default '*'"); service.getInboundRouter().addEndpoint( muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint("vm://*")); } else { // Set multiple inbound subscriptions on the descriptor InboundRouterCollection messageRouter = service.getInboundRouter(); for (int i = 0; i < subscriptions.length; i++) { String subscription = subscriptions[i]; EndpointFactory endpointFactory = muleContext.getRegistry().lookupEndpointFactory(); EndpointBuilder endpointBuilder = endpointFactory.getEndpointBuilder(subscription); endpointBuilder.setSynchronous(!asynchronous); InboundEndpoint endpoint = endpointFactory.getInboundEndpoint(endpointBuilder); messageRouter.addEndpoint(endpoint); } } service.setComponent(new DefaultJavaComponent(new SingletonObjectFactory(this))); return service; } protected ObjectFilter createFilter(String pattern) { try { if (getSubscriptionFilter() == null) { setSubscriptionFilter(WildcardFilter.class); } ObjectFilter filter = (ObjectFilter) ClassUtils.instanciateClass(getSubscriptionFilter(), new Object[]{pattern}); return filter; } catch (Exception e) { exceptionListener.exceptionThrown(e); return new WildcardFilter(pattern); } } /** * the type of filter used to filter subscriptions * * @return the class of the filter to use. The default is WildcardFilter * @see WildcardFilter */ public Class getSubscriptionFilter() { return subscriptionFilter; } /** * sets the type of filter used to filter subscriptions * * @param subscriptionFilter the class of the filter to use. */ public void setSubscriptionFilter(Class subscriptionFilter) { this.subscriptionFilter = subscriptionFilter; } /** * A list of endpoints the eventMulticaster will receive events on Note that if * this eventMulticaster has a Mule Descriptor associated with it, these * endpoints are ignored and the ones on the Mule Descriptor are used. These are * here for convenience, the event multicaster will use these to create a default * MuleDescriptor for itself at runtime * * @return endpoints List being listened on */ public String[] getSubscriptions() { return subscriptions; } /** * A list of endpoints the eventMulticaster will receive events on Note that if * this eventMulticaster has a Mule Descriptor associated with it, these * endpoints are ignored and the ones on the Mule Descriptor are used. These are * here for convenience, the event multicaster will use these to create a default * MuleDescriptor for itself at runtime * * @param subscriptions a list of enpoints to listen on */ public void setSubscriptions(String[] subscriptions) { this.subscriptions = subscriptions; } protected void setExceptionListener(ExceptionListener listener) { if (listener != null) { this.exceptionListener = listener; } else { throw new IllegalArgumentException("exceptionListener may not be null"); } } private class LoggingExceptionListener implements ExceptionListener { public void exceptionThrown(Exception e) { logger.error(e.getMessage(), e); } } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/ApplicationEventException.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/ApplicationEventExcepti0000644000175000017500000000161010754375733033564 0ustar charlescharles/* * $Id: ApplicationEventException.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; /** * ApplicationEventException TODO */ public class ApplicationEventException extends Exception { /** * Serial version */ private static final long serialVersionUID = 718759087364948708L; public ApplicationEventException(String message) { super(message); } public ApplicationEventException(String message, Throwable cause) { super(message, cause); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/MuleApplicationEvent.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/MuleApplicationEvent.ja0000644000175000017500000000437710754375733033473 0ustar charlescharles/* * $Id: MuleApplicationEvent.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; import org.mule.api.MuleEventContext; import org.mule.api.endpoint.MalformedEndpointException; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationEvent; /** * MuleApplicationEvent is an Spring ApplicationEvent used to wrap a * DefaultMuleEvent */ public class MuleApplicationEvent extends ApplicationEvent { /** * Serial version */ private static final long serialVersionUID = 5297176859050194632L; private final MuleEventContext context; private final String endpoint; private final ApplicationContext applicationContext; private final Map properties = Collections.synchronizedMap(new HashMap()); public MuleApplicationEvent(Object message, String endpoint) { super(message); this.endpoint = endpoint; this.applicationContext = null; this.context = null; } MuleApplicationEvent(Object message, MuleEventContext context, ApplicationContext appContext) throws MalformedEndpointException { super(message); this.context = context; this.endpoint = context.getEndpointURI().toString(); this.applicationContext = appContext; } public MuleEventContext getMuleEventContext() { return context; } public String getEndpoint() { return endpoint; } public ApplicationContext getApplicationContext() { return applicationContext; } public Map getProperties() { return properties; } public void setProperty(Object key, Object value) { this.properties.put(key, value); } public Object getProperty(Object key) { return properties.get(key); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/AsynchronousEventListener.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/events/AsynchronousEventListen0000644000175000017500000000515010754375733033654 0ustar charlescharles/* * $Id: AsynchronousEventListener.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService; import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; /** * AsynchronousEventListener will proces a received MuleEvent in a * separate Thread. The thread pool passed in the constructor will determine how many * threads can be executed at any time. */ public class AsynchronousEventListener implements MuleEventListener { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(AsynchronousEventListener.class); /** * The listener to delegate to */ private final ApplicationListener listener; /** * the pool that manages the threads of execution */ private final ExecutorService threadPool; public AsynchronousEventListener(ExecutorService threadPool, ApplicationListener listener) { this.threadPool = threadPool; this.listener = listener; } public void onApplicationEvent(ApplicationEvent event) { try { threadPool.execute(new Worker(listener, event)); } catch (RejectedExecutionException e) { logger.error("Failed to execute worker for event: " + event.toString(), e); } } public ApplicationListener getListener() { return listener; } private static class Worker implements Runnable { private final ApplicationListener listener; private final ApplicationEvent event; public Worker(ApplicationListener listener, ApplicationEvent event) { this.listener = listener; this.event = event; } public void run() { try { listener.onApplicationEvent(event); } catch (Exception e) { logger.error("Failed to forward event: " + event.toString(), e); } } } } mule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/i18n/0000755000175000017500000000000011351411154026305 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/i18n/SpringMessages.java0000644000175000017500000000141110754375733032121 0ustar charlescharles/* * $Id: SpringMessages.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class SpringMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("spring"); public static Message failedToReinitMule() { return createMessage(BUNDLE_PATH, 1); } } mule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/transaction/0000755000175000017500000000000011351411154030053 5ustar charlescharles././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/transaction/SpringTransactionManagerFactory.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/transaction/SpringTransactionM0000644000175000017500000000207610754375733033612 0ustar charlescharles/* * $Id: SpringTransactionManagerFactory.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.transaction; import org.mule.api.transaction.TransactionManagerFactory; import javax.transaction.TransactionManager; /** * A holder to a transaction manager set via a Spring Application context */ public class SpringTransactionManagerFactory implements TransactionManagerFactory { private TransactionManager transactionManager; synchronized public void setTransactionManager(TransactionManager transactionManager) { this.transactionManager = transactionManager; } synchronized public TransactionManager create() throws Exception { return transactionManager; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/transaction/SpringTransactionFactory.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/transaction/SpringTransactionF0000644000175000017500000000674410754375733033611 0ustar charlescharles/* * $Id: SpringTransactionFactory.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.transaction; import org.mule.api.MuleContext; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transaction.TransactionFactory; import org.mule.transaction.AbstractSingleResourceTransaction; import org.springframework.jdbc.datasource.ConnectionHolder; import org.springframework.jms.connection.JmsResourceHolder; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.TransactionSynchronizationManager; /** * TODO: document this class */ public class SpringTransactionFactory implements TransactionFactory { private PlatformTransactionManager manager; public SpringTransactionFactory() { super(); } public Transaction beginTransaction(MuleContext muleContext) throws TransactionException { Transaction tx = new SpringTransaction(); tx.begin(); return tx; } public boolean isTransacted() { return true; } /** * @return Returns the manager. */ synchronized public PlatformTransactionManager getManager() { return manager; } /** * @param manager The manager to set. */ synchronized public void setManager(PlatformTransactionManager manager) { this.manager = manager; } /** * TODO: document this class */ public class SpringTransaction extends AbstractSingleResourceTransaction { protected final TransactionStatus status; public SpringTransaction() { status = manager.getTransaction(null); } protected void doBegin() throws TransactionException { // nothing to do } protected void doCommit() throws TransactionException { manager.commit(status); } protected void doRollback() throws TransactionException { manager.rollback(status); } public Object getResource(Object key) { Object res = TransactionSynchronizationManager.getResource(key); if (res != null) { if (!(res instanceof ConnectionHolder)) { if (res instanceof JmsResourceHolder) { return ((JmsResourceHolder)res).getConnection(); } } else { return ((ConnectionHolder)res).getConnection(); } } return res; } public boolean hasResource(Object key) { return getResource(key) != null; } public void bindResource(Object key, Object resource) throws TransactionException { throw new UnsupportedOperationException(); } public void setRollbackOnly() { super.setRollbackOnly(); status.setRollbackOnly(); } } } mule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/remoting/0000755000175000017500000000000011351411154027352 5ustar charlescharles././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/remoting/ObjectToRemoteInvocationTransformer.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/remoting/ObjectToRemoteInvocat0000644000175000017500000000463510756365256033541 0ustar charlescharles/* * $Id: ObjectToRemoteInvocationTransformer.java 10866 2008-02-18 20:29:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.remoting; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.ObjectInputStream; import org.springframework.remoting.support.RemoteInvocation; public class ObjectToRemoteInvocationTransformer extends AbstractTransformer { public ObjectToRemoteInvocationTransformer() { super(); this.registerSourceType(RemoteInvocation.class); this.registerSourceType(byte[].class); this.registerSourceType(InputStream.class); this.setReturnClass(RemoteInvocation.class); } protected Object doTransform(Object src, String encoding) throws TransformerException { if (src instanceof RemoteInvocation) { return src; } Object o = null; if (src instanceof InputStream) { try { o = new ObjectInputStream((InputStream) src).readObject(); } catch (Exception e) { throw new TransformerException(this, e); } } else { byte[] data = (byte[]) src; ByteArrayInputStream bais = new ByteArrayInputStream(data); try { ObjectInputStream ois = new ObjectInputStream(bais); o = ois.readObject(); } catch (Exception e) { throw new TransformerException(this, e); } } RemoteInvocation ri = (RemoteInvocation) o; if (logger.isDebugEnabled()) { logger.debug("request to execute " + ri.getMethodName()); for (int i = 0; i < ri.getArguments().length; i++) { Object a = ri.getArguments()[i]; logger.debug("with argument (" + a.toString() + ")"); } } return ri; } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/remoting/ObjectToRemoteInvocationResultTransformer.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/remoting/ObjectToRemoteInvocat0000644000175000017500000000353110754375733033532 0ustar charlescharles/* * $Id: ObjectToRemoteInvocationResultTransformer.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.remoting; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import java.io.ObjectOutputStream; import org.apache.commons.io.output.ByteArrayOutputStream; import org.springframework.remoting.support.RemoteInvocationResult; public class ObjectToRemoteInvocationResultTransformer extends AbstractTransformer { public ObjectToRemoteInvocationResultTransformer() { super(); setReturnClass(byte[].class); } protected Object doTransform(Object src, String encoding) throws TransformerException { try { if (logger.isDebugEnabled()) { logger.debug("ObjectToRemoteInvocationResult.doTransform(" + src + ")"); } RemoteInvocationResult rval; if (src instanceof RemoteInvocationResult) { rval = (RemoteInvocationResult)src; } else { rval = new RemoteInvocationResult(src); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(rval); oos.close(); return baos.toByteArray(); } catch (Exception e) { throw new TransformerException(this, e); } } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/remoting/SpringRemoteInvokerComponent.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/remoting/SpringRemoteInvokerCo0000644000175000017500000001120710774254333033550 0ustar charlescharles/* * $Id: SpringRemoteInvokerComponent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.remoting; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import org.mule.util.ClassUtils; import org.springframework.beans.factory.InitializingBean; import org.springframework.remoting.support.RemoteInvocation; import org.springframework.remoting.support.RemoteInvocationBasedExporter; import org.springframework.remoting.support.RemoteInvocationExecutor; import org.springframework.remoting.support.RemoteInvocationResult; public class SpringRemoteInvokerComponent implements Initialisable, Callable { private Delegate delegate; private Class serviceClass; private Class serviceInterface; private Object serviceBean; private boolean registerTraceInterceptor = false; private RemoteInvocationExecutor remoteInvocationExecutor; private class Delegate extends RemoteInvocationBasedExporter implements InitializingBean { private Object proxy; public void afterPropertiesSet() { this.proxy = getProxyForService(); } public Object execute(RemoteInvocation invocation) { try { Object value = invoke(invocation, proxy); return value; } catch (Throwable ex) { ex.printStackTrace(); return new RemoteInvocationResult(ex); } } } public SpringRemoteInvokerComponent() { delegate = new Delegate(); } public void initialise() throws InitialisationException { if (serviceClass == null && serviceBean == null) { throw new InitialisationException(CoreMessages.propertiesNotSet("serviceClass or serviceBean"), this); } if (serviceInterface == null) { throw new InitialisationException(CoreMessages.propertiesNotSet("serviceInterface"), this); } if (serviceClass != null) { Object service = null; try { service = ClassUtils.instanciateClass(serviceClass, null); } catch (Exception e) { throw new InitialisationException(e, this); } delegate.setService(service); } else if (serviceBean != null) { delegate.setService(serviceBean); } delegate.setServiceInterface(serviceInterface); delegate.setRegisterTraceInterceptor(registerTraceInterceptor); if (remoteInvocationExecutor != null) { delegate.setRemoteInvocationExecutor(remoteInvocationExecutor); } delegate.afterPropertiesSet(); } public Class getServiceClass() { return serviceClass; } public void setServiceClass(Class serviceClass) { this.serviceClass = serviceClass; } public Object getServiceBean() { return serviceBean; } public void setServiceBean(Object serviceBean) { this.serviceBean = serviceBean; } public Class getServiceInterface() { return serviceInterface; } public void setServiceInterface(Class serviceInterface) { this.serviceInterface = serviceInterface; } public boolean isRegisterTraceInterceptor() { return registerTraceInterceptor; } public void setRegisterTraceInterceptor(boolean registerTraceInterceptor) { this.registerTraceInterceptor = registerTraceInterceptor; } public RemoteInvocationExecutor getRemoteInvocationExecutor() { return remoteInvocationExecutor; } public void setRemoteInvocationExecutor(RemoteInvocationExecutor remoteInvocationExecutor) { this.remoteInvocationExecutor = remoteInvocationExecutor; } public Object onCall(MuleEventContext eventContext) throws Exception { Object transformedMessage = eventContext.transformMessage(); RemoteInvocation ri = (RemoteInvocation) transformedMessage; Object rval = delegate.execute(ri); return rval; } } mule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/interceptor/0000755000175000017500000000000011351411154030064 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/interceptor/InvocationAdapter.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/interceptor/InvocationAdapter.0000644000175000017500000000243410762020555033510 0ustar charlescharles/* * $Id: InvocationAdapter.java 11130 2008-02-29 15:14:53Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.interceptor; import org.mule.api.MuleException; import org.mule.interceptor.RequestContextInvocation; import org.mule.interceptor.InterceptorException; import org.aopalliance.intercept.MethodInvocation; public class InvocationAdapter extends RequestContextInvocation { private MethodInvocation invocation; private Object result; public InvocationAdapter(MethodInvocation invocation) { this.invocation = invocation; } public Object execute() throws MuleException { try { result = invocation.proceed(); return result; } catch (MuleException e) { throw e; } catch (Throwable e) { throw new InterceptorException(e); } } public Object getResult() { return result; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/interceptor/InterceptorAdapter.javamule-2.0.1/modules/spring-extras/src/main/java/org/mule/module/spring/interceptor/InterceptorAdapter0000644000175000017500000000302210762020555033611 0ustar charlescharles/* * $Id: InterceptorAdapter.java 11130 2008-02-29 15:14:53Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.interceptor; import org.mule.api.interceptor.Interceptor; import org.mule.api.MuleMessage; import org.aopalliance.intercept.MethodInterceptor; import org.aopalliance.intercept.MethodInvocation; /** * This adapts an implementation of the {@link Interceptor} interface for use with the Spring AOP * interceptor framework. Note that the Interceptor implementation can return null if it does not * want to change the result - the appropriate {@link MuleMessage} will then be constructed correctly * by Mule. */ public class InterceptorAdapter implements MethodInterceptor { private Interceptor interceptor; public Object invoke(MethodInvocation invocation) throws Throwable { InvocationAdapter adapter = new InvocationAdapter(invocation); MuleMessage message = interceptor.intercept(adapter); if (null == message) { return adapter.getResult(); } else { return message; } } public void setInterceptor(Interceptor interceptor) { this.interceptor = interceptor; } } mule-2.0.1/modules/spring-extras/src/main/resources/0000755000175000017500000000000011351411154022277 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/resources/META-INF/0000755000175000017500000000000011351411154023437 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/resources/META-INF/services/0000755000175000017500000000000011351411154025262 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351411154026051 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351411154027013 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351411154027572 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/modules/spring-extras/src/main/resources/META-INF/services/org/mule/i18n/spring-messages.propertiesmule-2.0.1/modules/spring-extras/src/main/resources/META-INF/services/org/mule/i18n/spring-messages.0000644000175000017500000000011110754365306032710 0ustar charlescharles1=Failed to reinitialise Mule after the Application Context was refreshedmule-2.0.1/modules/spring-extras/src/test/0000755000175000017500000000000011351411154020320 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/test/java/0000755000175000017500000000000011351411153021240 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/test/java/org/0000755000175000017500000000000011351411153022027 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/test/java/org/mule/0000755000175000017500000000000011351411153022771 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/0000755000175000017500000000000011351411153024256 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/0000755000175000017500000000000011351411154025561 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/events/0000755000175000017500000000000011351411154027065 5ustar charlescharles././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/events/TestApplicationEventBean.javamule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/events/TestApplicationEventBea0000644000175000017500000000323410754375733033551 0ustar charlescharles/* * $Id: TestApplicationEventBean.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; import org.mule.tck.functional.EventCallback; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; /** * TestApplicationEventBean is a bean for testing Spring * ApplicationListeners with the MuleEventMulticaster */ public class TestApplicationEventBean implements ApplicationListener { private final Log logger = LogFactory.getLog(this.getClass()); private EventCallback eventCallback; public void onApplicationEvent(ApplicationEvent event) { logger.debug("Received Spring event: " + event.getClass().getName()); if (eventCallback != null) { try { eventCallback.eventReceived(null, event); } catch (Exception e1) { throw new RuntimeException("Callback failed: " + e1.getMessage(), e1); } } } public EventCallback getEventCallback() { return eventCallback; } public void setEventCallback(EventCallback eventCallback) { this.eventCallback = eventCallback; } } mule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/events/TestAllEventBean.java0000644000175000017500000000315410754375733033115 0ustar charlescharles/* * $Id: TestAllEventBean.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; import org.mule.tck.functional.EventCallback; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; /** * TestMuleEventBean is a MuleEventBean for testing with the * MuleEventMulticaster. */ public class TestAllEventBean implements MuleEventListener, ApplicationListener { private final Log logger = LogFactory.getLog(this.getClass()); private EventCallback eventCallback; public void onApplicationEvent(ApplicationEvent event) { logger.debug("Received message: " + event); if (eventCallback != null) { try { eventCallback.eventReceived(null, event); } catch (Exception e1) { throw new RuntimeException("Callback failed: " + e1.getMessage(), e1); } } } public EventCallback getEventCallback() { return eventCallback; } public void setEventCallback(EventCallback eventCallback) { this.eventCallback = eventCallback; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/events/AsyncSpringEventsTestCase.javamule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/events/AsyncSpringEventsTestCa0000644000175000017500000000244310754375733033566 0ustar charlescharles/* * $Id: AsyncSpringEventsTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; public class AsyncSpringEventsTestCase extends SpringEventsTestCase { // @Override protected String getConfigResources() { return "async-mule-events-app-context.xml"; } /* * TODO this test seems to suffer from a bug with listener interface handling? * TestAllEventBean needs to implement both ApplicationListener and * MuleEventListener, but when it does so only MuleEvents arrive. If the class * implements only ApplicationListener, only Spring events arrive. Mysteriously * enough this seems to work fine for the synchronous case, which makes me think * there is still something deeper going on. */ // @Override public void testReceivingAllEvents() throws Exception { // TODO fix synchronisation issue // super.testReceivingAllEvents(); } } mule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/events/TestMuleEventBean.java0000644000175000017500000000320010754375733033277 0ustar charlescharles/* * $Id: TestMuleEventBean.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; import org.mule.tck.functional.EventCallback; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationEvent; /** * TestMuleEventBean is a MuleEventBean for testing with the * MuleEventMulticaster. */ public class TestMuleEventBean implements MuleEventListener { private final Log logger = LogFactory.getLog(this.getClass()); private EventCallback eventCallback; public void onApplicationEvent(ApplicationEvent event) { MuleApplicationEvent e = (MuleApplicationEvent)event; logger.debug("Received message on: " + e.getEndpoint()); if (eventCallback != null) { try { eventCallback.eventReceived(e.getMuleEventContext(), event); } catch (Exception e1) { throw new RuntimeException("Callback failed: " + e1.getMessage(), e1); } } } public EventCallback getEventCallback() { return eventCallback; } public void setEventCallback(EventCallback eventCallback) { this.eventCallback = eventCallback; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/events/TestSubscriptionEventBean.javamule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/events/TestSubscriptionEventBe0000644000175000017500000000155110754375733033631 0ustar charlescharles/* * $Id: TestSubscriptionEventBean.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; /** * TestSubscriptionEventBean TODO */ public class TestSubscriptionEventBean extends TestMuleEventBean implements MuleSubscriptionEventListener { private String[] subscriptions; public void setSubscriptions(String[] subscriptions) { this.subscriptions = subscriptions; } public String[] getSubscriptions() { return subscriptions; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/events/SpringEventsTestCase.javamule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/events/SpringEventsTestCase.ja0000644000175000017500000003601010756365256033507 0ustar charlescharles/* * $Id: SpringEventsTestCase.java 10866 2008-02-18 20:29:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.events; import org.mule.api.MuleEventContext; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.tck.functional.EventCallback; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.util.ExceptionUtils; import org.mule.util.concurrent.Latch; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.Executors; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationEvent; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.support.AbstractApplicationContext; public class SpringEventsTestCase extends FunctionalTestCase { private static final int NUMBER_OF_MESSAGES = 10; private volatile AtomicInteger eventCounter1; private volatile AtomicInteger eventCounter2; // @Override protected void doSetUp() throws Exception { super.doSetUp(); eventCounter1 = new AtomicInteger(0); eventCounter2 = new AtomicInteger(0); } // @Override protected void doTearDown() throws Exception { super.doTearDown(); } protected String getConfigResources() { return "mule-events-app-context.xml"; } public void testManagerIsInstanciated() throws Exception { assertTrue(muleContext.isInitialised()); assertTrue(muleContext.isStarted()); assertNotNull(muleContext.getRegistry().lookupObject( AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME)); } public void testRemovingListeners() throws Exception { TestSubscriptionEventBean subscriptionBean = (TestSubscriptionEventBean) muleContext.getRegistry() .lookupObject("testSubscribingEventBean1"); assertNotNull(subscriptionBean); MuleEventMulticaster multicaster = (MuleEventMulticaster) muleContext.getRegistry().lookupObject( AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME); assertNotNull(multicaster); Latch whenFinished = new Latch(); subscriptionBean.setEventCallback(new CountingEventCallback(eventCounter1, 1, whenFinished)); multicaster.removeApplicationListener(subscriptionBean); MuleClient client = new MuleClient(); client.send("vm://event.multicaster", "Test Spring MuleEvent", null); assertEquals(0, eventCounter1.get()); multicaster.addApplicationListener(subscriptionBean); client.send("vm://event.multicaster", "Test Spring MuleEvent", null); assertTrue(whenFinished.await(3000, TimeUnit.MILLISECONDS)); assertEquals(1, eventCounter1.get()); eventCounter1.set(0); multicaster.removeAllListeners(); client.send("vm://event.multicaster", "Test Spring MuleEvent", null); assertEquals(0, eventCounter1.get()); multicaster.addApplicationListener(subscriptionBean); // context.refresh(); subscriptionBean.setEventCallback(null); } public void testReceivingANonSubscriptionMuleEvent() throws Exception { TestMuleEventBean bean = (TestMuleEventBean) muleContext.getRegistry().lookupObject( "testNonSubscribingMuleEventBean"); assertNotNull(bean); // register a callback Latch whenFinished = new Latch(); bean.setEventCallback(new CountingEventCallback(eventCounter1, 1, whenFinished)); MuleClient client = new MuleClient(); client.send("vm://event.multicaster", "Test Spring MuleEvent", null); whenFinished.await(3000, TimeUnit.MILLISECONDS); assertEquals(1, eventCounter1.get()); } public void testReceivingASpringEvent() throws Exception { TestApplicationEventBean bean = (TestApplicationEventBean) muleContext.getRegistry().lookupObject( "testEventSpringBean"); assertNotNull(bean); final Latch whenFinished = new Latch(); EventCallback callback = new EventCallback() { public void eventReceived(MuleEventContext context, Object o) throws Exception { assertNull(context); if (o instanceof TestApplicationEvent) { if (eventCounter1.incrementAndGet() == 1) { whenFinished.countDown(); } } } }; bean.setEventCallback(callback); ApplicationContext context = ((MuleEventMulticaster) muleContext.getRegistry().lookupObject( "applicationEventMulticaster")).applicationContext; context.publishEvent(new TestApplicationEvent(context)); whenFinished.await(3000, TimeUnit.MILLISECONDS); assertEquals(1, eventCounter1.get()); } public void testReceivingAllEvents() throws Exception { TestAllEventBean bean = (TestAllEventBean) muleContext.getRegistry().lookupObject("testAllEventBean"); assertNotNull(bean); Latch whenFinished = new Latch(); bean.setEventCallback(new CountingEventCallback(eventCounter1, 2, whenFinished)); MuleClient client = new MuleClient(); client.send("vm://event.multicaster", "Test Spring MuleEvent", null); ApplicationContext context = ((MuleEventMulticaster) muleContext.getRegistry().lookupObject( "applicationEventMulticaster")).applicationContext; context.publishEvent(new TestApplicationEvent(context)); whenFinished.await(3000, TimeUnit.MILLISECONDS); assertEquals(2, eventCounter1.get()); } public void testReceivingASubscriptionEvent() throws Exception { TestSubscriptionEventBean subscriptionBean = (TestSubscriptionEventBean) muleContext.getRegistry() .lookupObject("testSubscribingEventBean1"); assertNotNull(subscriptionBean); Latch whenFinished = new Latch(); subscriptionBean.setEventCallback(new CountingEventCallback(eventCounter1, 1, whenFinished)); MuleClient client = new MuleClient(); client.send("vm://event.multicaster", "Test Spring MuleEvent", null); whenFinished.await(3000, TimeUnit.MILLISECONDS); assertEquals(1, eventCounter1.get()); } public void testReceiveAndPublishEvent() throws Exception { TestSubscriptionEventBean bean1 = (TestSubscriptionEventBean) muleContext.getRegistry().lookupObject( "testSubscribingEventBean1"); assertNotNull(bean1); final Latch whenFinished1 = new Latch(); EventCallback callback = new EventCallback() { public void eventReceived(MuleEventContext context, Object o) throws Exception { MuleApplicationEvent returnEvent = new MuleApplicationEvent("MuleEvent from a spring bean", "vm://testBean2"); MuleApplicationEvent e = (MuleApplicationEvent) o; e.getApplicationContext().publishEvent(returnEvent); if (eventCounter1.incrementAndGet() == NUMBER_OF_MESSAGES) { whenFinished1.countDown(); } } }; bean1.setEventCallback(callback); TestSubscriptionEventBean bean2 = (TestSubscriptionEventBean) muleContext.getRegistry().lookupObject( "testSubscribingEventBean2"); assertNotNull(bean2); Latch whenFinished2 = new Latch(); bean2.setEventCallback(new CountingEventCallback(eventCounter2, NUMBER_OF_MESSAGES, whenFinished2)); // send asynchronously this.doSend("vm://event.multicaster", "Test Spring MuleEvent", NUMBER_OF_MESSAGES); whenFinished1.await(3000, TimeUnit.MILLISECONDS); whenFinished2.await(3000, TimeUnit.MILLISECONDS); assertEquals(NUMBER_OF_MESSAGES, eventCounter1.get()); assertEquals(NUMBER_OF_MESSAGES, eventCounter2.get()); } public void testPublishOnly() throws Exception { final MuleApplicationEvent event = new MuleApplicationEvent("MuleEvent from a spring bean", "vm://testBean2"); TestSubscriptionEventBean bean2 = (TestSubscriptionEventBean) muleContext.getRegistry().lookupObject( "testSubscribingEventBean2"); assertNotNull(bean2); Latch whenFinished = new Latch(); bean2.setEventCallback(new CountingEventCallback(eventCounter1, NUMBER_OF_MESSAGES, whenFinished)); // publish asynchronously this.doPublish(event, NUMBER_OF_MESSAGES); whenFinished.await(3000, TimeUnit.MILLISECONDS); assertEquals(NUMBER_OF_MESSAGES, eventCounter1.get()); } public void testPublishWithEventAwareTransformer() throws Exception { CountDownLatch transformerLatch = new CountDownLatch(1); TestEventAwareTransformer trans = new TestEventAwareTransformer(); trans.setLatch(transformerLatch); muleContext.getRegistry().registerTransformer(trans); MuleApplicationEvent event = new MuleApplicationEvent("MuleEvent from a spring bean", "vm://testBean2?transformers=dummyTransformer"); TestSubscriptionEventBean bean2 = (TestSubscriptionEventBean) muleContext.getRegistry().lookupObject( "testSubscribingEventBean2"); assertNotNull(bean2); Latch whenFinished = new Latch(); bean2.setEventCallback(new CountingEventCallback(eventCounter1, 1, whenFinished)); // publish asynchronously this.doPublish(event, 1); whenFinished.await(3000, TimeUnit.MILLISECONDS); assertTrue(transformerLatch.await(3000, TimeUnit.MILLISECONDS)); assertEquals(1, eventCounter1.get()); } // asynchronously publish the given event to the ApplicationContext for // 'count' // number of times protected void doPublish(final ApplicationEvent event, final int count) { Runnable publisher = new Runnable() { public void run() { for (int i = 0; i < count; i++) { ApplicationContext context = null; try { context = ((MuleEventMulticaster) muleContext.getRegistry().lookupObject( "applicationEventMulticaster")).applicationContext; } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } context.publishEvent(event); } } }; Executors.newSingleThreadExecutor().execute(publisher); } // asynchronously send the payload to the given Mule URL for 'count' number // of // times protected void doSend(final String url, final Object payload, final int count) { Runnable sender = new Runnable() { public void run() { try { MuleClient client = new MuleClient(); for (int i = 0; i < count; i++) { client.send(url, payload, null); } } catch (MuleException ex) { fail(ExceptionUtils.getStackTrace(ex)); } } }; // execute in background Executors.newSingleThreadExecutor().execute(sender); } /* * This callback counts how many times an MuleEvent was received. If a maximum * number has been reached, the given CountDownLatch is counted down. When * passing in a Latch (CountDownLatch(1)) this acts just like a sempahore for the * caller. */ public static class CountingEventCallback implements EventCallback { private final AtomicInteger counter; private final int maxCount; private final CountDownLatch finished; public CountingEventCallback(AtomicInteger counter, int maxCount, CountDownLatch whenFinished) { super(); this.counter = counter; this.maxCount = maxCount; this.finished = whenFinished; } public void eventReceived(MuleEventContext context, Object o) throws Exception { // apparently beans get an extra ContextRefreshedEvent during // startup; // this messes up our event counts. if (!(o instanceof ContextRefreshedEvent)) { if (counter.incrementAndGet() == maxCount && finished != null) { finished.countDown(); } } } } /* * A simple Transformer that counts down a Latch to indicate that it has been * called. */ public static class TestEventAwareTransformer extends AbstractMessageAwareTransformer { private CountDownLatch latch; public TestEventAwareTransformer() { this.setName("dummyTransformer"); } // @Override public Object clone() throws CloneNotSupportedException { TestEventAwareTransformer clone = (TestEventAwareTransformer) super.clone(); // we MUST share the latch for this test since we obviously want to // wait // for it. clone.setLatch(latch); return clone; } public CountDownLatch getLatch() { return latch; } public void setLatch(CountDownLatch latch) { this.latch = latch; } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { assertNotNull(message); if (latch != null) { latch.countDown(); } return message; } } /* * A simple custom ApplicationEvent for sending */ public static class TestApplicationEvent extends ApplicationEvent { private static final long serialVersionUID = 1L; public TestApplicationEvent(Object source) { super(source); } } } mule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/transaction/0000755000175000017500000000000011351411154030106 5ustar charlescharles././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/transaction/SpringTransactionFactoryTestCase.javamule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/transaction/SpringTransactionF0000644000175000017500000000415010754375733033631 0ustar charlescharles/* * $Id: SpringTransactionFactoryTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.transaction; import org.mule.api.transaction.Transaction; import org.mule.tck.AbstractMuleTestCase; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionStatus; public class SpringTransactionFactoryTestCase extends AbstractMuleTestCase { public void testCommit() throws Exception { Mock mockPTM = new Mock(PlatformTransactionManager.class); Mock mockTS = new Mock(TransactionStatus.class); mockPTM.expectAndReturn("getTransaction", C.same(null), mockTS.proxy()); mockPTM.expect("commit", C.same(mockTS.proxy())); SpringTransactionFactory factory = new SpringTransactionFactory(); factory.setManager((PlatformTransactionManager)mockPTM.proxy()); Transaction tx = factory.beginTransaction(muleContext); // TransactionCoordination.getInstance().bindTransaction(tx); tx.commit(); } public void testRollback() throws Exception { Mock mockPTM = new Mock(PlatformTransactionManager.class); Mock mockTS = new Mock(TransactionStatus.class); mockPTM.expectAndReturn("getTransaction", C.same(null), mockTS.proxy()); mockPTM.expect("rollback", C.same(mockTS.proxy())); mockTS.expect("setRollbackOnly"); SpringTransactionFactory factory = new SpringTransactionFactory(); factory.setManager((PlatformTransactionManager)mockPTM.proxy()); Transaction tx = factory.beginTransaction(muleContext); // TransactionCoordination.getInstance().bindTransaction(tx); tx.rollback(); } } mule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/remoting/0000755000175000017500000000000011351411154027405 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/remoting/ComplexData.java0000644000175000017500000000322310754375733032473 0ustar charlescharles/* * $Id: ComplexData.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.remoting; import org.mule.util.StringUtils; import java.io.Serializable; public class ComplexData implements Serializable { private static final long serialVersionUID = -886414019167115007L; private String someString = "Default String"; private Integer someInteger = new Integer(13); public ComplexData() { super(); } public ComplexData(String someString, Integer someInteger) { super(); setSomeString(someString); setSomeInteger(someInteger); } public String toString() { try { String currentString = StringUtils.defaultIfEmpty(someString, "NULL"); return "[ComplexData: [someString=" + currentString + "][someInteger=" + someInteger + "]]"; } catch (Exception e) { throw new RuntimeException(e); } } public Integer getSomeInteger() { return someInteger; } public void setSomeInteger(Integer someInteger) { this.someInteger = someInteger; } public String getSomeString() { return someString; } public void setSomeString(String someString) { this.someString = someString; } } mule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/remoting/WorkInterface.java0000644000175000017500000000117610754375733033042 0ustar charlescharles/* * $Id: WorkInterface.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.remoting; public interface WorkInterface { String executeByteArray(byte[] input); String executeString(String input); ComplexData executeComplexity(ComplexData input); } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/remoting/SpringRemotingTestCase.javamule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/remoting/SpringRemotingTestCas0000644000175000017500000000274110754375733033614 0ustar charlescharles/* * $Id: SpringRemotingTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.remoting; import org.mule.tck.FunctionalTestCase; import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean; public class SpringRemotingTestCase extends FunctionalTestCase { private static final String SPRING_HTTP_ENDPOINT = "http://localhost:8003/springService"; protected String getConfigResources() { return "spring-remoting-mule-config.xml"; } public void testHttpInvokeSpringService() throws Exception { ComplexData cd = new ComplexData("Foo", new Integer(13)); HttpInvokerProxyFactoryBean invoker = new HttpInvokerProxyFactoryBean(); invoker.setServiceInterface(WorkInterface.class); invoker.setServiceUrl(SPRING_HTTP_ENDPOINT); invoker.afterPropertiesSet(); WorkInterface worker = (WorkInterface)invoker.getObject(); ComplexData data = worker.executeComplexity(cd); assertNotNull(data); assertEquals(data.getSomeString(), "Foo Received"); assertEquals(data.getSomeInteger(), new Integer(14)); } } mule-2.0.1/modules/spring-extras/src/test/java/org/mule/module/spring/remoting/DoSomeWork.java0000644000175000017500000000200710754375733032322 0ustar charlescharles/* * $Id: DoSomeWork.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.spring.remoting; /** * A server-side service to receive and process ComplexData. */ public class DoSomeWork implements WorkInterface { public String executeByteArray(byte[] input) { return executeString(new String(input)); } public String executeString(String input) { return "You said " + input; } public ComplexData executeComplexity(ComplexData input) { input.setSomeString(input.getSomeString() + " Received"); input.setSomeInteger(new Integer(input.getSomeInteger().intValue() + 1)); return input; } } mule-2.0.1/modules/spring-extras/src/test/resources/0000755000175000017500000000000011351411154022332 5ustar charlescharlesmule-2.0.1/modules/spring-extras/src/test/resources/spring-remoting-mule-config.xml0000644000175000017500000000675710766654216030443 0ustar charlescharles mule-2.0.1/modules/spring-extras/src/test/resources/async-mule-events-app-context.xml0000644000175000017500000000732310766204322030706 0ustar charlescharles true vm://* vm://event.* vm://testBean2 mule-2.0.1/modules/spring-extras/src/test/resources/mule-events-app-context.xml0000644000175000017500000000716010756365256027607 0ustar charlescharles vm://* vm://event.* vm://testBean2 mule-2.0.1/modules/spring-extras/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006310756365256027226 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/modules/spring-extras/pom.xml0000644000175000017500000001033511006063605020072 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-spring-extras Spring Extras Non-core functionality provided by Spring such as transactions, remoting, data sources, etc. osgi org.apache.felix maven-bundle-plugin org.mule.module.spring.config, org.mule.module.spring.events, org.mule.module.spring.remoting, org.mule.module.spring.transaction org.springframework spring-aop org.springframework spring-jdbc org.springframework spring-jms commons-pool commons-pool org.springframework spring-support org.springframework spring-web org.mule.modules mule-module-builders ${version} org.mule.modules mule-module-management ${version} org.apache.geronimo.specs geronimo-jms_1.1_spec commons-collections commons-collections 3.2 org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test org.mule.transports mule-transport-http ${version} test org.mule.transports mule-transport-vm ${version} test mule-2.0.1/modules/spring-config/0000755000175000017500000000000011351411153016510 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/0000755000175000017500000000000011351411144017277 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/0000755000175000017500000000000011351411153020223 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/java/0000755000175000017500000000000011351411144021144 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/java/org/0000755000175000017500000000000011351411144021733 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/java/org/mule/0000755000175000017500000000000011351411144022675 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/0000755000175000017500000000000011351411144024142 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/0000755000175000017500000000000011351411153025444 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/package.html0000644000175000017500000000037510740712271027740 0ustar charlescharles Mule Support claases for Load Mule from Spring. For Mule 2.0 you can load a Mule instance either from the new Mule Namespace aware configuration, Spring beans or Mule 1.x Xml configuration. ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/SpringXmlConfigurationBuilder.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/SpringXmlConfigurationBuilder.0000644000175000017500000001007110753670035033441 0ustar charlescharles/* * $Id: SpringXmlConfigurationBuilder.java 10761 2008-02-10 21:43:57Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationException; import org.mule.api.registry.Registry; import org.mule.config.ConfigResource; import org.mule.config.builders.AbstractResourceConfigurationBuilder; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; /** * SpringXmlConfigurationBuilder enables Mule to be configured from a * Spring XML Configuration file used with Mule name-spaces. Multiple configuration * files can be loaded from this builder (specified as a comma-separated list). */ public class SpringXmlConfigurationBuilder extends AbstractResourceConfigurationBuilder { protected String defaultConfigResourceName = "default-mule-config.xml"; protected ApplicationContext parentContext; public SpringXmlConfigurationBuilder(String configResources, ApplicationContext parentContext) throws ConfigurationException { super(configResources); this.parentContext = parentContext; } public SpringXmlConfigurationBuilder(String[] configResources, ApplicationContext parentContext) throws ConfigurationException { super(configResources); this.parentContext = parentContext; } public SpringXmlConfigurationBuilder(String[] configResources) throws ConfigurationException { this(configResources, null); } public SpringXmlConfigurationBuilder(String configResources) throws ConfigurationException { this(configResources, null); } public SpringXmlConfigurationBuilder(ConfigResource[] configResources, ApplicationContext parentContext) { super(configResources); this.parentContext = parentContext; } public SpringXmlConfigurationBuilder(ConfigResource[] configResources) { this(configResources, null); } protected void doConfigure(MuleContext muleContext) throws Exception { ConfigResource[] all = new ConfigResource[configResources.length + 1]; all[0] = new ConfigResource(defaultConfigResourceName); System.arraycopy(configResources, 0, all, 1, configResources.length); createSpringParentRegistry(muleContext, muleContext.getRegistry(), all); } /** * Creates a Spring ApplicationContext from the configuration resources provided * and sets it as the parent Registry. This releationshio is setup with the * MuleApplicationContext constructor to ensure that the Registry can be used * during the initialization phase of Spring. * * @param muleContext * @param registry * @param all * @see MuleApplicationContext#setupParentSpringRegistry(Registry registry */ protected void createSpringParentRegistry(MuleContext muleContext, Registry registry, ConfigResource[] all) { try { if (parentContext != null) { new MuleApplicationContext(muleContext, registry, all, parentContext); } else { new MuleApplicationContext(muleContext, registry, all); } } catch (BeansException e) { // If creation of MuleApplicationContext fails, remove // TransientRegistry->SpringRegistry parent relationship registry.setParent(null); throw e; } } public void setDefaultConfigResourceName(String defaultConfigResourceName) { this.defaultConfigResourceName = defaultConfigResourceName; } public void setParentContext(ApplicationContext parentContext) { this.parentContext = parentContext; } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/MuleApplicationContext.java0000644000175000017500000002004410760605416032754 0ustar charlescharles/* * $Id: MuleApplicationContext.java 10997 2008-02-25 18:38:06Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.MuleContext; import org.mule.api.registry.Registry; import org.mule.config.ConfigResource; import org.mule.util.ClassUtils; import org.mule.util.IOUtils; import java.io.IOException; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.support.AbstractBeanFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ApplicationContext; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.Resource; import org.springframework.core.io.UrlResource; /** * MuleApplicationContext is a simple extension application context * that allows resources to be loaded from the Classpath of file system using the * MuleBeanDefinitionReader. * */ public class MuleApplicationContext extends AbstractXmlApplicationContext { public static final String LEGACY_BEAN_READER_CLASS = "org.mule.config.spring.MuleBeanDefinitionReader"; private MuleContext muleContext; private Resource[] springResources; /** * Parses configuration files creating a spring ApplicationContext which is used * as a parent registry using the SpringRegistry registry implementation to wraps * the spring ApplicationContext * * @param registry * @param configResources * @see org.mule.config.spring.SpringRegistry */ public MuleApplicationContext(MuleContext muleContext, Registry registry, ConfigResource[] configResources) { this(muleContext, registry, configResources, true); } /** * Parses configuration files creating a spring ApplicationContext which is used * as a parent registry using the SpringRegistry registry implementation to wraps * the spring ApplicationContext * * @param registry * @param configLocations * @param parent * @see org.mule.config.spring.SpringRegistry */ public MuleApplicationContext(MuleContext muleContext, Registry registry, ConfigResource[] configResources, ApplicationContext parent) { super(parent); setupParentSpringRegistry(registry); this.muleContext = muleContext; this.springResources = convert(configResources); refresh(); } /** * @param registry * @param configLocations */ public MuleApplicationContext(MuleContext muleContext, Registry registry, Resource[] configResources) { this(muleContext, registry, configResources, true); } /** * @param registry * @param configResources * @param refresh * @throws BeansException */ public MuleApplicationContext(MuleContext muleContext, Registry registry, ConfigResource[] configResources, boolean refresh) throws BeansException { this.muleContext = muleContext; setupParentSpringRegistry(registry); this.springResources = convert(configResources); if (refresh) { refresh(); } } /** * @param registry * @param configLocations * @param parent */ public MuleApplicationContext(MuleContext muleContext, Registry registry, Resource[] springResources, ApplicationContext parent) throws IOException { super(parent); this.muleContext = muleContext; setupParentSpringRegistry(registry); this.springResources = springResources; refresh(); } /** * @param registry * @param configLocations * @param refresh * @throws BeansException */ public MuleApplicationContext(MuleContext muleContext, Registry registry, Resource[] springResources, boolean refresh) throws BeansException { setupParentSpringRegistry(registry); this.muleContext = muleContext; this.springResources = springResources; if (refresh) { refresh(); } } /** * Sets up TransientRegistry SpringRegistry parent relationship here. This is * required here before "refresh()" rather than in the configuration builder * after parsing the spring config because spring executes the initialize phase * for objects it manages during "refresh()" and during intialization of mule * artifacts need to be able to lookup other artifacts both in TransientRegistry * and in spring (using SpringRegistry facade) by using the mule Registry * interface. * * @param registry */ protected void setupParentSpringRegistry(Registry registry) { registry.setParent(new SpringRegistry(this)); } protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory) { super.prepareBeanFactory(beanFactory); beanFactory.addBeanPostProcessor(new MuleContextPostProcessor(muleContext)); } private Resource[] convert(ConfigResource[] resources) { Resource[] configResources = new Resource[resources.length]; for (int i = 0; i < resources.length; i++) { ConfigResource resource = resources[i]; if(resource.getUrl()!=null) { configResources[i] = new UrlResource(resource.getUrl()); } else { try { configResources[i] = new ByteArrayResource(IOUtils.toByteArray(resource.getInputStream()), resource.getResourceName()); } catch (IOException e) { //ignore, should never happen } } } return configResources; } //@Override protected Resource[] getConfigResources() { return springResources; } protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws IOException { XmlBeanDefinitionReader beanDefinitionReader; //If the migration module is on the classpath, lets use the MuleBeanDefinitionReader, that allws use //to process Mule 1.x configuration as well as Mule 2.x. if (ClassUtils.isClassOnPath(LEGACY_BEAN_READER_CLASS, getClass())) { try { beanDefinitionReader = (XmlBeanDefinitionReader) ClassUtils.instanciateClass( LEGACY_BEAN_READER_CLASS, new Object[] {beanFactory, springResources}); } catch (Exception e) { throw new RuntimeException(e); } } else { beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory); } //hook in our custom hierarchical reader beanDefinitionReader.setDocumentReaderClass(MuleBeanDefinitionDocumentReader.class); //add error reporting beanDefinitionReader.setProblemReporter(new MissingParserProblemReporter()); beanDefinitionReader.loadBeanDefinitions(springResources); } //@Override protected DefaultListableBeanFactory createBeanFactory() { //Copy all postProcessors defined in the defaultMuleConfig so that they get applied to the child container DefaultListableBeanFactory bf = super.createBeanFactory(); if(getParent()!=null) { //Copy over all processors AbstractBeanFactory beanFactory = (AbstractBeanFactory)getParent().getAutowireCapableBeanFactory(); bf.copyConfigurationFrom(beanFactory); } return bf; } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/jndi/0000755000175000017500000000000011351411152026367 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/jndi/DefaultNameParser.java0000644000175000017500000000146310740712271032607 0ustar charlescharles/* * $Id: DefaultNameParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.jndi; import javax.naming.CompositeName; import javax.naming.Name; import javax.naming.NameParser; import javax.naming.NamingException; /** * A default implementation of {@link NameParser} * */ public class DefaultNameParser implements NameParser { public Name parse(String name) throws NamingException { return new CompositeName(name); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/jndi/SpringInitialContextFactory.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/jndi/SpringInitialContextFacto0000644000175000017500000000770610740712271033431 0ustar charlescharles/* * $Id: SpringInitialContextFactory.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.jndi; import java.util.HashMap; import java.util.Hashtable; import java.util.Map; import javax.naming.Context; import javax.naming.NamingException; import javax.naming.spi.InitialContextFactory; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.BeanFactory; import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceEditor; /** * TODO */ public class SpringInitialContextFactory implements InitialContextFactory { private static final transient Log log = LogFactory.getLog(SpringInitialContextFactory.class); private static Map cache = new HashMap(); private static Context singleton; /** * A factory method which can be used to initialise a singleton JNDI context from * inside a Spring.xml such that future calls to new InitialContext() will reuse * it */ public static Context makeInitialContext() { singleton = new DefaultSpringJndiContext(); return singleton; } public Context getInitialContext(Hashtable environment) throws NamingException { if (singleton != null) { return singleton; } Resource resource = null; Object value = environment.get(Context.PROVIDER_URL); String key = "jndi.xml"; if (value == null) { resource = new ClassPathResource(key); } else { if (value instanceof Resource) { resource = (Resource) value; } else { ResourceEditor editor = new ResourceEditor(); key = value.toString(); editor.setAsText(key); resource = (Resource) editor.getValue(); } } BeanFactory context = loadContext(resource, key); Context answer = (Context) context.getBean("jndi"); if (answer == null) { log.warn("No JNDI context available in JNDI resource: " + resource); answer = new DefaultSpringJndiContext(environment, new ConcurrentHashMap()); } return answer; } protected BeanFactory loadContext(Resource resource, String key) { synchronized (cache) { BeanFactory answer = (BeanFactory) cache.get(key); if (answer == null) { answer = createContext(resource); cache.put(key, answer); } return answer; } } protected BeanFactory createContext(Resource resource) { log.info("Loading JNDI context from: " + resource); return new SpringInitialContextApplicationContext(new Resource[]{resource}); } /** * Simple implementation of AbstractXmlApplicationContext that allows * {@link Resource} to be used in the constructor */ class SpringInitialContextApplicationContext extends AbstractXmlApplicationContext { private Resource[] configResources; public SpringInitialContextApplicationContext(Resource[] resources) { super(); configResources = resources; refresh(); } protected Resource[] getConfigResources() { return configResources; } } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/jndi/DefaultSpringJndiContext.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/jndi/DefaultSpringJndiContext.0000644000175000017500000003520410740712271033324 0ustar charlescharles/* * $Id: DefaultSpringJndiContext.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.jndi; import java.io.Serializable; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import javax.naming.Binding; import javax.naming.CompositeName; import javax.naming.Context; import javax.naming.LinkRef; import javax.naming.Name; import javax.naming.NameClassPair; import javax.naming.NameNotFoundException; import javax.naming.NameParser; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.NotContextException; import javax.naming.OperationNotSupportedException; import javax.naming.Reference; import javax.naming.spi.NamingManager; /** * TODO */ /** * A simple spring based JNDI context which is mutable * * Borrowed from the XBean (xbean.codehaus.org) project. Thanks guys! */ public class DefaultSpringJndiContext implements Context, Serializable { private static final long serialVersionUID = -5754338187296859149L; protected static final NameParser nameParser = new DefaultNameParser(); private boolean freeze = false; protected final Hashtable environment; // environment for this context protected final Map bindings; // bindings at my level protected final Map treeBindings; // all bindings under me private boolean frozen = false; private String nameInNamespace = ""; public static final String SEPARATOR = "/"; public DefaultSpringJndiContext() { environment = new Hashtable(); bindings = new HashMap(); treeBindings = new HashMap(); } public DefaultSpringJndiContext(Hashtable env) { if (env == null) { this.environment = new Hashtable(); } else { this.environment = new Hashtable(env); } this.bindings = new HashMap(); this.treeBindings = new HashMap(); } public DefaultSpringJndiContext(Hashtable environment, Map bindings) { if (environment == null) { this.environment = new Hashtable(); } else { this.environment = new Hashtable(environment); } this.bindings = bindings; treeBindings = new HashMap(); frozen = true; } public DefaultSpringJndiContext(Hashtable environment, Map bindings, String nameInNamespace) { this(environment, bindings); this.nameInNamespace = nameInNamespace; } protected DefaultSpringJndiContext(DefaultSpringJndiContext clone, Hashtable env) { this.bindings = clone.bindings; this.treeBindings = clone.treeBindings; this.environment = new Hashtable(env); } protected DefaultSpringJndiContext(DefaultSpringJndiContext clone, Hashtable env, String nameInNamespace) { this(clone, env); this.nameInNamespace = nameInNamespace; } public Object addToEnvironment(String propName, Object propVal) throws NamingException { return environment.put(propName, propVal); } public Hashtable getEnvironment() throws NamingException { return (Hashtable) environment.clone(); } public Object removeFromEnvironment(String propName) throws NamingException { return environment.remove(propName); } public Object lookup(String name) throws NamingException { if (name.length() == 0) { return this; } Object result = treeBindings.get(name); if (result == null) { result = bindings.get(name); } if (result == null) { int pos = name.indexOf(':'); if (pos > 0) { String scheme = name.substring(0, pos); Context ctx = NamingManager.getURLContext(scheme, environment); if (ctx == null) { throw new NamingException("scheme " + scheme + " not recognized"); } return ctx.lookup(name); } else { // Split out the first name of the path // and look for it in the bindings map. CompositeName path = new CompositeName(name); if (path.size() == 0) { return this; } else { String first = path.get(0); Object obj = bindings.get(first); if (obj == null) { throw new NameNotFoundException(name); } else if (obj instanceof Context && path.size() > 1) { Context subContext = (Context) obj; obj = subContext.lookup(path.getSuffix(1)); } return obj; } } } if (result instanceof LinkRef) { LinkRef ref = (LinkRef) result; result = lookup(ref.getLinkName()); } if (result instanceof Reference) { try { result = NamingManager.getObjectInstance(result, null, null, this.environment); } catch (NamingException e) { throw e; } catch (Exception e) { throw (NamingException) new NamingException("could not look up : " + name).initCause(e); } } if (result instanceof DefaultSpringJndiContext) { String prefix = getNameInNamespace(); if (prefix.length() > 0) { prefix = prefix + SEPARATOR; } result = new DefaultSpringJndiContext((DefaultSpringJndiContext) result, environment, prefix + name); } return result; } public Object lookup(Name name) throws NamingException { return lookup(name.toString()); } public Object lookupLink(String name) throws NamingException { return lookup(name); } public Name composeName(Name name, Name prefix) throws NamingException { Name result = (Name) prefix.clone(); result.addAll(name); return result; } public String composeName(String name, String prefix) throws NamingException { CompositeName result = new CompositeName(prefix); result.addAll(new CompositeName(name)); return result.toString(); } public NamingEnumeration list(String name) throws NamingException { Object o = lookup(name); if (o == this) { return new DefaultSpringJndiContext.ListEnumeration(); } else if (o instanceof Context) { return ((Context) o).list(""); } else { throw new NotContextException(); } } public NamingEnumeration listBindings(String name) throws NamingException { Object o = lookup(name); if (o == this) { return new DefaultSpringJndiContext.ListBindingEnumeration(); } else if (o instanceof Context) { return ((Context) o).listBindings(""); } else { throw new NotContextException(); } } public Object lookupLink(Name name) throws NamingException { return lookupLink(name.toString()); } public NamingEnumeration list(Name name) throws NamingException { return list(name.toString()); } public NamingEnumeration listBindings(Name name) throws NamingException { return listBindings(name.toString()); } public void bind(Name name, Object value) throws NamingException { bind(name.toString(), value); } public void bind(String name, Object value) throws NamingException { checkFrozen(); internalBind(name, value); } public void close() throws NamingException { // ignore } public Context createSubcontext(Name name) throws NamingException { throw new OperationNotSupportedException(); } public Context createSubcontext(String name) throws NamingException { throw new OperationNotSupportedException(); } public void destroySubcontext(Name name) throws NamingException { throw new OperationNotSupportedException(); } public void destroySubcontext(String name) throws NamingException { throw new OperationNotSupportedException(); } public String getNameInNamespace() throws NamingException { return nameInNamespace; } public NameParser getNameParser(Name name) throws NamingException { return nameParser; } public NameParser getNameParser(String name) throws NamingException { return nameParser; } public void rebind(Name name, Object value) throws NamingException { rebind(name.toString(), value); } public void rebind(String name, Object value) throws NamingException { checkFrozen(); internalBind(name, value, true); } public void rename(Name oldName, Name newName) throws NamingException { checkFrozen(); Object value = lookup(oldName); unbind(oldName); bind(newName, value); } public void rename(String oldName, String newName) throws NamingException { Object value = lookup(oldName); unbind(oldName); bind(newName, value); } public void unbind(Name name) throws NamingException { unbind(name.toString()); } public void unbind(String name) throws NamingException { checkFrozen(); internalBind(name, null, true); } private abstract class LocalNamingEnumeration implements NamingEnumeration { private Iterator i = bindings.entrySet().iterator(); public boolean hasMore() throws NamingException { return i.hasNext(); } public boolean hasMoreElements() { return i.hasNext(); } protected Map.Entry getNext() { return (Map.Entry) i.next(); } public void close() throws NamingException { } } private class ListEnumeration extends DefaultSpringJndiContext.LocalNamingEnumeration { public Object next() throws NamingException { return nextElement(); } public Object nextElement() { Map.Entry entry = getNext(); return new NameClassPair((String) entry.getKey(), entry.getValue().getClass().getName()); } } private class ListBindingEnumeration extends DefaultSpringJndiContext.LocalNamingEnumeration { public Object next() throws NamingException { return nextElement(); } public Object nextElement() { Map.Entry entry = getNext(); return new Binding((String) entry.getKey(), entry.getValue()); } } public Map getEntries() { return new HashMap(bindings); } public void setEntries(Map entries) throws NamingException { if (entries != null) { for (Iterator iter = entries.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); internalBind(name, value); } } } public boolean isFreeze() { return freeze; } public void setFreeze(boolean freeze) { this.freeze = freeze; } /** * internalBind is intended for use only during setup or possibly by suitably synchronized superclasses. * It binds every possible lookup into a map in each context. To do this, each context * strips off one name segment and if necessary creates a new context for it. Then it asks that context * to bind the remaining name. It returns a map containing all the bindings from the next context, plus * the context it just created (if it in fact created it). (the names are suitably extended by the segment * originally lopped off). * * @param name * @param value * @return * @throws javax.naming.NamingException */ protected Map internalBind(String name, Object value) throws NamingException { return internalBind(name, value, false); } protected Map internalBind(String name, Object value, boolean allowRebind) throws NamingException { if (name == null || name.length() == 0){ throw new NamingException("Invalid Name " + name); } if (frozen){ throw new NamingException("Read only"); } Map newBindings = new HashMap(); int pos = name.indexOf('/'); if (pos == -1) { Object oldValue = treeBindings.put(name, value); if (!allowRebind && oldValue != null) { throw new NamingException("Something already bound at " + name); } bindings.put(name, value); newBindings.put(name, value); } else { String segment = name.substring(0, pos); if (segment == null || segment.length()==0){ throw new NamingException("Invalid segment " + segment); } Object o = treeBindings.get(segment); if (o == null) { o = newContext(); treeBindings.put(segment, o); bindings.put(segment, o); newBindings.put(segment, o); } else if (!(o instanceof DefaultSpringJndiContext)) { throw new NamingException("Something already bound where a subcontext should go"); } DefaultSpringJndiContext defaultContext = (DefaultSpringJndiContext) o; String remainder = name.substring(pos + 1); Map subBindings = defaultContext.internalBind(remainder, value, allowRebind); for (Iterator iterator = subBindings.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); String subName = segment + "/" + (String) entry.getKey(); Object bound = entry.getValue(); treeBindings.put(subName, bound); newBindings.put(subName, bound); } } return newBindings; } protected void checkFrozen() throws OperationNotSupportedException { if (isFreeze()) { throw new OperationNotSupportedException("JNDI context is frozen!"); } } protected DefaultSpringJndiContext newContext() { return new DefaultSpringJndiContext(); } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/factories/0000755000175000017500000000000011351411152027422 5ustar charlescharles././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/factories/OutboundEndpointFactoryBean.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/factories/OutboundEndpointFact0000644000175000017500000000233510757615756033477 0ustar charlescharles/* * $Id: OutboundEndpointFactoryBean.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.factories; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.endpoint.EndpointURIEndpointBuilder; /** * Spring FactoryBean used to create concrete instances of outbound endpoints */ public class OutboundEndpointFactoryBean extends AbstractEndpointFactoryBean { public OutboundEndpointFactoryBean(EndpointURIEndpointBuilder global) throws EndpointException { super(global); } public OutboundEndpointFactoryBean() { super(); } public Class getObjectType() { return OutboundEndpoint.class; } public Object doGetObject() throws Exception { return muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(this); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/factories/InboundEndpointFactoryBean.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/factories/InboundEndpointFacto0000644000175000017500000000312110766204322033426 0ustar charlescharles/* * $Id: InboundEndpointFactoryBean.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.factories; import org.mule.api.config.ConfigurationException; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointFactory; import org.mule.api.endpoint.InboundEndpoint; import org.mule.config.i18n.MessageFactory; import org.mule.endpoint.EndpointURIEndpointBuilder; /** * Spring FactoryBean used to create concrete instances of inbound endpoints */ public class InboundEndpointFactoryBean extends AbstractEndpointFactoryBean { public InboundEndpointFactoryBean(EndpointURIEndpointBuilder global) throws EndpointException { super(global); } public InboundEndpointFactoryBean() { super(); } public Class getObjectType() { return InboundEndpoint.class; } public Object doGetObject() throws Exception { EndpointFactory ef = muleContext.getRegistry().lookupEndpointFactory(); if (ef != null) { return ef.getInboundEndpoint(this); } else { throw new ConfigurationException(MessageFactory.createStaticMessage("EndpointFactory not found in Registry")); } } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/factories/EndpointFactoryBean.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/factories/EndpointFactoryBean.0000644000175000017500000000521310774254333033340 0ustar charlescharles/* * $Id: EndpointFactoryBean.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.factories; import org.mule.api.context.MuleContextAware; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.FactoryBean; /** * Endpoint factory bean which uses type attribute to determine endpoint type (Used by 1to2migration module) */ public class EndpointFactoryBean extends EndpointURIEndpointBuilder implements FactoryBean, MuleContextAware, Initialisable { // as in ImmutableMuleEndpoint (but those not public) public static final String ENDPOINT_TYPE_SENDER = "sender"; public static final String ENDPOINT_TYPE_RECEIVER = "receiver"; public static final String ALWAYS_CREATE_STRING = "ALWAYS_CREATE"; public static final String NEVER_CREATE_STRING = "NEVER_CREATE"; protected final Log logger = LogFactory.getLog(getClass()); private String type; public EndpointFactoryBean() { super(); } public Object getObject() throws Exception { if (ENDPOINT_TYPE_RECEIVER.equals(type)) { logger.debug("Endpont type is \"receiver\", building inbound endpoint"); return muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(this); } else if (ENDPOINT_TYPE_SENDER.equals(type)) { logger.debug("Endpont type is \"sender\", building inbound endpoint"); return muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(this); } else { throw new IllegalArgumentException("The endpoint type: " + type + "is not recognized."); } } public Class getObjectType() { // TODO MULE-2292 Use role-specific interface return ImmutableEndpoint.class; } public boolean isSingleton() { return true; } public void initialise() throws InitialisationException { // nothing to do, subclasses may override } public void setType(String type) { this.type = type; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/factories/AbstractEndpointFactoryBean.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/factories/AbstractEndpointFact0000644000175000017500000000315610774254333033432 0ustar charlescharles/* * $Id: AbstractEndpointFactoryBean.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.factories; import org.mule.api.endpoint.EndpointException; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.FactoryBean; /** * Abstract spring FactoryBean used to creating endpoints via spring. */ public abstract class AbstractEndpointFactoryBean extends EndpointURIEndpointBuilder implements FactoryBean, Initialisable { protected final Log logger = LogFactory.getLog(getClass()); public AbstractEndpointFactoryBean(EndpointURIEndpointBuilder global) throws EndpointException { super(global); } public AbstractEndpointFactoryBean() { super(); } public Object getObject() throws Exception { return doGetObject(); } public boolean isSingleton() { return true; } public void initialise() throws InitialisationException { // subclasses may override this method } protected abstract Object doGetObject() throws Exception; } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/MuleConfigurationConfigurator.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/MuleConfigurationConfigurator.0000644000175000017500000000712510777050076033505 0ustar charlescharles/* * $Id: MuleConfigurationConfigurator.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationException; import org.mule.api.config.MuleConfiguration; import org.mule.api.context.MuleContextAware; import org.mule.config.DefaultMuleConfiguration; import org.mule.config.i18n.MessageFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.SmartFactoryBean; /** * This class is a "SmartFactoryBean" which allows a few XML attributes to be set on the * otherwise read-only MuleConfiguration. It looks up the MuleConfiguration from the * MuleContext and does some class-casting to be able to modify it. Note that this will * only work if the MuleContext has not yet been started, otherwise the modifications * will be ignored (and warnings logged). */ public class MuleConfigurationConfigurator implements MuleContextAware, SmartFactoryBean { private MuleContext muleContext; // We instantiate DefaultMuleConfiguration to make sure we get the default values for // any properties not set by the user. private DefaultMuleConfiguration config = new DefaultMuleConfiguration(); protected transient Log logger = LogFactory.getLog(MuleConfigurationConfigurator.class); public void setMuleContext(MuleContext context) { this.muleContext = context; } public boolean isEagerInit() { return true; } public boolean isPrototype() { return false; } public Object getObject() throws Exception { MuleConfiguration configuration = muleContext.getConfiguration(); if (configuration instanceof DefaultMuleConfiguration) { ((DefaultMuleConfiguration) configuration).setDefaultSynchronousEndpoints(config.isDefaultSynchronousEndpoints()); ((DefaultMuleConfiguration) configuration).setDefaultSynchronousEventTimeout(config.getDefaultSynchronousEventTimeout()); ((DefaultMuleConfiguration) configuration).setDefaultRemoteSync(config.isDefaultRemoteSync()); ((DefaultMuleConfiguration) configuration).setDefaultTransactionTimeout(config.getDefaultTransactionTimeout()); return configuration; } else { throw new ConfigurationException(MessageFactory.createStaticMessage("Unable to set properties on read-only MuleConfiguration: " + configuration.getClass())); } } public Class getObjectType() { return MuleConfiguration.class; } public boolean isSingleton() { return true; } public void setDefaultSynchronousEndpoints(boolean synchronous) { config.setDefaultSynchronousEndpoints(synchronous); } public void setDefaultSynchronousEventTimeout(int synchronousEventTimeout) { config.setDefaultSynchronousEventTimeout(synchronousEventTimeout); } public void setDefaultRemoteSync(boolean remoteSync) { config.setDefaultRemoteSync(remoteSync); } public void setDefaultTransactionTimeout(int defaultTransactionTimeout) { config.setDefaultTransactionTimeout(defaultTransactionTimeout); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/ServerNotificationManagerConfigurator.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/ServerNotificationManagerConfi0000644000175000017500000000506310777050076033500 0ustar charlescharles/* * $Id: ServerNotificationManagerConfigurator.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextAware; import org.mule.context.notification.ServerNotificationManager; import java.util.Collection; import java.util.Map; import org.springframework.beans.factory.SmartFactoryBean; public class ServerNotificationManagerConfigurator implements MuleContextAware, SmartFactoryBean { private MuleContext muleContext; private Boolean dynamic; private Map interfaceToEvents; private Collection interfaces; private Collection pairs; public void setMuleContext(MuleContext context) { this.muleContext = context; } public Object getObject() throws Exception { ServerNotificationManager notificationManager = muleContext.getNotificationManager(); if (dynamic != null) { notificationManager.setNotificationDynamic(dynamic.booleanValue()); } if (interfaceToEvents != null) { notificationManager.setInterfaceToTypes(interfaceToEvents); } if (interfaces != null) { notificationManager.setDisabledInterfaces(interfaces); } if (pairs != null) { notificationManager.setAllListenerSubscriptionPairs(pairs); } return notificationManager; } public Class getObjectType() { return ServerNotificationManager.class; } public boolean isSingleton() { return true; } public void setNotificationDynamic(boolean dynamic) { this.dynamic = new Boolean(dynamic); } public void setInterfaceToTypes(Map interfaceToEvents) throws ClassNotFoundException { this.interfaceToEvents = interfaceToEvents; } public void setAllListenerSubscriptionPairs(Collection pairs) { this.pairs = pairs; } public void setDisabledInterfaces(Collection interfaces) throws ClassNotFoundException { this.interfaces = interfaces; } public boolean isEagerInit() { return true; } public boolean isPrototype() { return false; } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/handlers/0000755000175000017500000000000011351411152027243 5ustar charlescharles././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/handlers/AbstractMuleNamespaceHandler.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/handlers/AbstractMuleNamespace0000644000175000017500000002161611003247564033407 0ustar charlescharles/* * $Id: AbstractMuleNamespaceHandler.java 11620 2008-04-22 02:37:40Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.handlers; import org.mule.config.spring.factories.InboundEndpointFactoryBean; import org.mule.config.spring.factories.OutboundEndpointFactoryBean; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParserConfiguration; import org.mule.config.spring.parsers.PostProcessor; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.ValueMap; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.TransportEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.TransportGlobalEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.support.AddressedEndpointDefinitionParser; import org.mule.endpoint.EndpointURIEndpointBuilder; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.xml.BeanDefinitionParser; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * This Namespace handler extends the default Spring {@link org.springframework.beans.factory.xml.NamespaceHandlerSupport} * to allow certain elements in document to be ignored by the handler. */ public abstract class AbstractMuleNamespaceHandler extends NamespaceHandlerSupport { public static final String GLOBAL_ENDPOINT = "endpoint"; public static final String INBOUND_ENDPOINT = "inbound-endpoint"; public static final String OUTBOUND_ENDPOINT = "outbound-endpoint"; /** * @param name The name of the element to be ignored. */ protected final void registerIgnoredElement(String name) { registerBeanDefinitionParser(name, new IgnoredDefinitionParser()); } protected MuleDefinitionParserConfiguration registerConnectorDefinitionParser(Class connectorClass) { return registerConnectorDefinitionParser( new MuleOrphanDefinitionParser(connectorClass, true)); } protected MuleDefinitionParserConfiguration registerConnectorDefinitionParser(MuleDefinitionParser parser) { registerBeanDefinitionParser("connector", parser); return parser; } protected MuleDefinitionParserConfiguration registerMuleBeanDefinitionParser(String name, MuleDefinitionParser parser) { registerBeanDefinitionParser(name, parser); return parser; } protected MuleDefinitionParserConfiguration registerStandardTransportEndpoints(String protocol, String[] requiredAttributes) { return new RegisteredMdps(protocol, AddressedEndpointDefinitionParser.PROTOCOL, requiredAttributes); } protected MuleDefinitionParserConfiguration registerMetaTransportEndpoints(String protocol) { return new RegisteredMdps(protocol, AddressedEndpointDefinitionParser.META, new String[]{}); } private class IgnoredDefinitionParser implements BeanDefinitionParser { public BeanDefinition parse(Element element, ParserContext parserContext) { return null; } } protected Class getInboundEndpointFactoryBeanClass() { return InboundEndpointFactoryBean.class; } protected Class getOutboundEndpointFactoryBeanClass() { return OutboundEndpointFactoryBean.class; } protected Class getGlobalEndpointBuilderBeanClass() { return EndpointURIEndpointBuilder.class; } private class RegisteredMdps implements MuleDefinitionParserConfiguration { private Set bdps = new HashSet(); private RegisteredMdps(String protocol, boolean isMeta, String[] requiredAttributes) { registerBeanDefinitionParser("endpoint", add(new TransportGlobalEndpointDefinitionParser(protocol, isMeta, AbstractMuleNamespaceHandler.this.getGlobalEndpointBuilderBeanClass(), requiredAttributes, new String[]{}))); registerBeanDefinitionParser("inbound-endpoint", add(new TransportEndpointDefinitionParser(protocol, isMeta, AbstractMuleNamespaceHandler.this.getInboundEndpointFactoryBeanClass(), requiredAttributes, new String[]{}))); registerBeanDefinitionParser("outbound-endpoint", add(new TransportEndpointDefinitionParser(protocol, isMeta, AbstractMuleNamespaceHandler.this.getOutboundEndpointFactoryBeanClass(), requiredAttributes, new String[]{}))); } private MuleDefinitionParser add(MuleDefinitionParser bdp) { bdps.add(bdp); return bdp; } public MuleDefinitionParserConfiguration registerPreProcessor(PreProcessor preProcessor) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).registerPreProcessor(preProcessor); } return this; } public MuleDefinitionParserConfiguration registerPostProcessor(PostProcessor postProcessor) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).registerPostProcessor(postProcessor); } return this; } public MuleDefinitionParserConfiguration addReference(String propertyName) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).addReference(propertyName); } return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, Map mappings) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).addMapping(propertyName, mappings); } return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, String mappings) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).addMapping(propertyName, mappings); } return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, ValueMap mappings) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).addMapping(propertyName, mappings); } return this; } public MuleDefinitionParserConfiguration addAlias(String alias, String propertyName) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).addAlias(alias, propertyName); } return this; } public MuleDefinitionParserConfiguration addCollection(String propertyName) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).addCollection(propertyName); } return this; } public MuleDefinitionParserConfiguration addIgnored(String propertyName) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).addIgnored(propertyName); } return this; } public MuleDefinitionParserConfiguration removeIgnored(String propertyName) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).removeIgnored(propertyName); } return this; } public MuleDefinitionParserConfiguration setIgnoredDefault(boolean ignoreAll) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).setIgnoredDefault(ignoreAll); } return this; } public MuleDefinitionParserConfiguration addBeanFlag(String flag) { for (Iterator bdp = bdps.iterator(); bdp.hasNext();) { ((MuleDefinitionParserConfiguration) bdp.next()).addBeanFlag(flag); } return this; } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/handlers/CustomNamespaceHandler.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/handlers/CustomNamespaceHandle0000644000175000017500000000176510746275214033420 0ustar charlescharles/* * $Id: CustomNamespaceHandler.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.handlers; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; import org.mule.config.spring.parsers.specific.ServiceDefinitionParser; import org.mule.model.seda.SedaService; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; public class CustomNamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("model", new OrphanDefinitionParser(true)); registerBeanDefinitionParser("service", new ServiceDefinitionParser(SedaService.class)); } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/handlers/SimpleNamespaceHandler.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/handlers/SimpleNamespaceHandle0000644000175000017500000000207010746275214033365 0ustar charlescharles/* * $Id: SimpleNamespaceHandler.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.handlers; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; import org.mule.config.spring.parsers.specific.ServiceDefinitionParser; import org.mule.model.direct.DirectService; import org.mule.model.direct.DirectModel; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; public class SimpleNamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("model", new OrphanDefinitionParser(DirectModel.class, true)); registerBeanDefinitionParser("service", new ServiceDefinitionParser(DirectService.class)); } }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/handlers/MuleNamespaceHandler.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/handlers/MuleNamespaceHandler.0000644000175000017500000007224211003252442033267 0ustar charlescharles/* * $Id: MuleNamespaceHandler.java 11621 2008-04-22 03:01:54Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.handlers; import org.mule.DefaultExceptionStrategy; import org.mule.api.config.MuleProperties; import org.mule.component.DefaultJavaComponent; import org.mule.component.PooledJavaComponent; import org.mule.component.SimpleCallableJavaComponent; import org.mule.component.simple.EchoComponent; import org.mule.component.simple.LogComponent; import org.mule.component.simple.NullComponent; import org.mule.component.simple.PassThroughComponent; import org.mule.config.QueueProfile; import org.mule.config.spring.factories.InboundEndpointFactoryBean; import org.mule.config.spring.factories.OutboundEndpointFactoryBean; import org.mule.config.spring.parsers.collection.ChildListDefinitionParser; import org.mule.config.spring.parsers.collection.ChildListEntryDefinitionParser; import org.mule.config.spring.parsers.collection.ChildMapDefinitionParser; import org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser; import org.mule.config.spring.parsers.delegate.InheritDefinitionParser; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; import org.mule.config.spring.parsers.generic.NameTransferDefinitionParser; import org.mule.config.spring.parsers.generic.NamedDefinitionParser; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.mule.config.spring.parsers.processors.CheckExclusiveAttributes; import org.mule.config.spring.parsers.specific.BindingDefinitionParser; import org.mule.config.spring.parsers.specific.ComponentDefinitionParser; import org.mule.config.spring.parsers.specific.ComponentDelegatingDefinitionParser; import org.mule.config.spring.parsers.specific.ConfigurationDefinitionParser; import org.mule.config.spring.parsers.specific.DefaultThreadingProfileDefinitionParser; import org.mule.config.spring.parsers.specific.ExceptionTXFilterDefinitionParser; import org.mule.config.spring.parsers.specific.FilterDefinitionParser; import org.mule.config.spring.parsers.specific.GlobalPropertyDefinitionParser; import org.mule.config.spring.parsers.specific.IgnoreObjectMethodsDefinitionParser; import org.mule.config.spring.parsers.specific.ModelDefinitionParser; import org.mule.config.spring.parsers.specific.NotificationDefinitionParser; import org.mule.config.spring.parsers.specific.NotificationDisableDefinitionParser; import org.mule.config.spring.parsers.specific.ObjectFactoryDefinitionParser; import org.mule.config.spring.parsers.specific.PoolingProfileDefinitionParser; import org.mule.config.spring.parsers.specific.RouterDefinitionParser; import org.mule.config.spring.parsers.specific.ServiceDefinitionParser; import org.mule.config.spring.parsers.specific.ServiceOverridesDefinitionParser; import org.mule.config.spring.parsers.specific.SimpleComponentDefinitionParser; import org.mule.config.spring.parsers.specific.ThreadingProfileDefinitionParser; import org.mule.config.spring.parsers.specific.TransactionDefinitionParser; import org.mule.config.spring.parsers.specific.TransactionManagerDefinitionParser; import org.mule.config.spring.parsers.specific.TransformerDefinitionParser; import org.mule.config.spring.parsers.specific.TransformerRefDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.GenericEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.EndpointRefParser; import org.mule.config.spring.parsers.specific.endpoint.support.OrphanEndpointDefinitionParser; import org.mule.config.spring.util.SpringBeanLookup; import org.mule.context.notification.ListenerSubscriptionPair; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.model.resolvers.ArrayEntryPointResolver; import org.mule.model.resolvers.CallableEntryPointResolver; import org.mule.model.resolvers.DefaultEntryPointResolverSet; import org.mule.model.resolvers.ExplicitMethodEntryPointResolver; import org.mule.model.resolvers.LegacyEntryPointResolverSet; import org.mule.model.resolvers.MethodHeaderPropertyEntryPointResolver; import org.mule.model.resolvers.NoArgumentsEntryPointResolver; import org.mule.model.resolvers.ReflectionEntryPointResolver; import org.mule.model.seda.SedaModel; import org.mule.model.seda.SedaService; import org.mule.object.PrototypeObjectFactory; import org.mule.object.SingletonObjectFactory; import org.mule.routing.ExpressionMessageInfoMapping; import org.mule.routing.ForwardingCatchAllStrategy; import org.mule.routing.LoggingCatchAllStrategy; import org.mule.routing.filters.EqualsFilter; import org.mule.routing.filters.ExceptionTypeFilter; import org.mule.routing.filters.ExpressionFilter; import org.mule.routing.filters.MessagePropertyFilter; import org.mule.routing.filters.PayloadTypeFilter; import org.mule.routing.filters.RegExFilter; import org.mule.routing.filters.WildcardFilter; import org.mule.routing.filters.logic.AndFilter; import org.mule.routing.filters.logic.NotFilter; import org.mule.routing.filters.logic.OrFilter; import org.mule.routing.inbound.CorrelationEventResequencer; import org.mule.routing.inbound.DefaultInboundRouterCollection; import org.mule.routing.inbound.ForwardingConsumer; import org.mule.routing.inbound.IdempotentReceiver; import org.mule.routing.inbound.IdempotentSecureHashReceiver; import org.mule.routing.inbound.InboundPassThroughRouter; import org.mule.routing.inbound.MessageChunkingAggregator; import org.mule.routing.inbound.SelectiveConsumer; import org.mule.routing.inbound.SimpleCollectionAggregator; import org.mule.routing.inbound.WireTap; import org.mule.routing.nested.DefaultNestedRouter; import org.mule.routing.outbound.ChainingRouter; import org.mule.routing.outbound.DefaultOutboundRouterCollection; import org.mule.routing.outbound.EndpointSelector; import org.mule.routing.outbound.ExceptionBasedRouter; import org.mule.routing.outbound.FilteringListMessageSplitter; import org.mule.routing.outbound.FilteringOutboundRouter; import org.mule.routing.outbound.MessageChunkingRouter; import org.mule.routing.outbound.MulticastingRouter; import org.mule.routing.outbound.OutboundPassThroughRouter; import org.mule.routing.outbound.StaticRecipientList; import org.mule.routing.outbound.TemplateEndpointRouter; import org.mule.routing.response.DefaultResponseRouterCollection; import org.mule.routing.response.SimpleCollectionResponseAggregator; import org.mule.routing.response.SingleResponseRouter; import org.mule.security.PasswordBasedEncryptionStrategy; import org.mule.security.SecretKeyEncryptionStrategy; import org.mule.security.filters.MuleEncryptionEndpointSecurityFilter; import org.mule.service.DefaultServiceExceptionStrategy; import org.mule.transaction.lookup.GenericTransactionManagerLookupFactory; import org.mule.transaction.lookup.JBossTransactionManagerLookupFactory; import org.mule.transaction.lookup.JRunTransactionManagerLookupFactory; import org.mule.transaction.lookup.Resin3TransactionManagerLookupFactory; import org.mule.transaction.lookup.WeblogicTransactionManagerLookupFactory; import org.mule.transaction.lookup.WebsphereTransactionManagerLookupFactory; import org.mule.transformer.NoActionTransformer; import org.mule.transformer.codec.Base64Decoder; import org.mule.transformer.codec.Base64Encoder; import org.mule.transformer.codec.XmlEntityDecoder; import org.mule.transformer.codec.XmlEntityEncoder; import org.mule.transformer.compression.GZipCompressTransformer; import org.mule.transformer.compression.GZipUncompressTransformer; import org.mule.transformer.encryption.DecryptionTransformer; import org.mule.transformer.encryption.EncryptionTransformer; import org.mule.transformer.simple.AutoTransformer; import org.mule.transformer.simple.ByteArrayToHexString; import org.mule.transformer.simple.ByteArrayToObject; import org.mule.transformer.simple.ByteArrayToSerializable; import org.mule.transformer.simple.ExpressionTransformer; import org.mule.transformer.simple.HexStringToByteArray; import org.mule.transformer.simple.MessagePropertiesTransformer; import org.mule.transformer.simple.ObjectToByteArray; import org.mule.transformer.simple.ObjectToString; import org.mule.transformer.simple.SerializableToByteArray; import org.mule.transformer.simple.StringAppendTransformer; /** * This is the core namespace handler for Mule and configures all Mule configuration elements under the * http://www.mulesource.org/schema/mule/core/2.0 Namespace. */ public class MuleNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerIgnoredElement("mule"); registerIgnoredElement("description"); //Common elements registerBeanDefinitionParser("configuration", new ConfigurationDefinitionParser()); registerBeanDefinitionParser("global-property", new GlobalPropertyDefinitionParser()); registerBeanDefinitionParser("default-threading-profile", new DefaultThreadingProfileDefinitionParser(MuleProperties.OBJECT_DEFAULT_THREADING_PROFILE)); registerBeanDefinitionParser("default-dispatcher-threading-profile", new DefaultThreadingProfileDefinitionParser(MuleProperties.OBJECT_DEFAULT_MESSAGE_DISPATCHER_THREADING_PROFILE)); registerBeanDefinitionParser("default-receiver-threading-profile", new DefaultThreadingProfileDefinitionParser(MuleProperties.OBJECT_DEFAULT_MESSAGE_RECEIVER_THREADING_PROFILE)); registerBeanDefinitionParser("default-component-threading-profile", new DefaultThreadingProfileDefinitionParser(MuleProperties.OBJECT_DEFAULT_COMPONENT_THREADING_PROFILE)); registerBeanDefinitionParser("component-threading-profile", new ThreadingProfileDefinitionParser("threadingProfile", MuleProperties.OBJECT_DEFAULT_COMPONENT_THREADING_PROFILE)); registerBeanDefinitionParser("custom-exception-strategy", new ChildDefinitionParser("exceptionListener", null)); registerBeanDefinitionParser("default-service-exception-strategy", new ChildDefinitionParser("exceptionListener", DefaultServiceExceptionStrategy.class)); registerBeanDefinitionParser("commit-transaction", new ExceptionTXFilterDefinitionParser("commitTxFilter")); registerBeanDefinitionParser("rollback-transaction", new ExceptionTXFilterDefinitionParser("rollbackTxFilter")); registerBeanDefinitionParser("default-connector-exception-strategy", new ChildDefinitionParser("exceptionListener", DefaultExceptionStrategy.class)); registerBeanDefinitionParser("pooling-profile", new PoolingProfileDefinitionParser()); registerBeanDefinitionParser("queue-profile", new ChildDefinitionParser("queueProfile", QueueProfile.class)); registerMuleBeanDefinitionParser("notifications", new NamedDefinitionParser(MuleProperties.OBJECT_NOTIFICATION_MANAGER)).addAlias("dynamic", "notificationDynamic"); registerBeanDefinitionParser("notification", new NotificationDefinitionParser()); registerBeanDefinitionParser("disable-notification", new NotificationDisableDefinitionParser()); registerMuleBeanDefinitionParser("notification-listener", new ChildDefinitionParser("allListenerSubscriptionPair", ListenerSubscriptionPair.class)).addAlias("ref", "listener").addReference("listener"); //Connector elements registerBeanDefinitionParser("dispatcher-threading-profile", new ThreadingProfileDefinitionParser("dispatcherThreadingProfile", MuleProperties.OBJECT_DEFAULT_MESSAGE_DISPATCHER_THREADING_PROFILE)); registerBeanDefinitionParser("receiver-threading-profile", new ThreadingProfileDefinitionParser("receiverThreadingProfile", MuleProperties.OBJECT_DEFAULT_MESSAGE_RECEIVER_THREADING_PROFILE)); registerBeanDefinitionParser("service-overrides", new ServiceOverridesDefinitionParser()); registerBeanDefinitionParser("custom-connector", new MuleOrphanDefinitionParser(true)); //Transformer elements registerBeanDefinitionParser("transformers", new ParentDefinitionParser()); registerMuleBeanDefinitionParser("response-transformers", new ParentDefinitionParser()); registerBeanDefinitionParser("transformer", new TransformerRefDefinitionParser()); registerBeanDefinitionParser("custom-transformer", new TransformerDefinitionParser()); registerBeanDefinitionParser("auto-transformer", new TransformerDefinitionParser(AutoTransformer.class)); registerBeanDefinitionParser("no-action-transformer", new TransformerDefinitionParser(NoActionTransformer.class)); registerBeanDefinitionParser("message-properties-transformer", new TransformerDefinitionParser(MessagePropertiesTransformer.class)); registerBeanDefinitionParser("expression-transformer", new TransformerDefinitionParser(ExpressionTransformer.class)); registerBeanDefinitionParser("return-argument", new ChildDefinitionParser("argument", ExpressionTransformer.Argument.class)); registerBeanDefinitionParser("base64-encoder-transformer", new TransformerDefinitionParser(Base64Encoder.class)); registerBeanDefinitionParser("base64-decoder-transformer", new TransformerDefinitionParser(Base64Decoder.class)); registerBeanDefinitionParser("xml-entity-encoder-transformer", new TransformerDefinitionParser(XmlEntityEncoder.class)); registerBeanDefinitionParser("xml-entity-decoder-transformer", new TransformerDefinitionParser(XmlEntityDecoder.class)); registerBeanDefinitionParser("gzip-compress-transformer", new TransformerDefinitionParser(GZipCompressTransformer.class)); registerBeanDefinitionParser("gzip-uncompress-transformer", new TransformerDefinitionParser(GZipUncompressTransformer.class)); registerBeanDefinitionParser("encrypt-transformer", new TransformerDefinitionParser(EncryptionTransformer.class)); registerBeanDefinitionParser("decrypt-transformer", new TransformerDefinitionParser(DecryptionTransformer.class)); registerBeanDefinitionParser("byte-array-to-hex-string-transformer", new TransformerDefinitionParser(ByteArrayToHexString.class)); registerBeanDefinitionParser("hex-string-to-byte-array-transformer", new TransformerDefinitionParser(HexStringToByteArray.class)); registerBeanDefinitionParser("byte-array-to-object-transformer", new TransformerDefinitionParser(ByteArrayToObject.class)); registerBeanDefinitionParser("object-to-byte-array-transformer", new TransformerDefinitionParser(ObjectToByteArray.class)); registerBeanDefinitionParser("object-to-string-transformer", new TransformerDefinitionParser(ObjectToString.class)); registerBeanDefinitionParser("byte-array-to-serializable-transformer", new TransformerDefinitionParser(ByteArrayToSerializable.class)); registerBeanDefinitionParser("serializable-to-byte-array-transformer", new TransformerDefinitionParser(SerializableToByteArray.class)); registerBeanDefinitionParser("byte-array-to-string-transformer", new TransformerDefinitionParser(ObjectToString.class)); registerBeanDefinitionParser("string-to-byte-array-transformer", new TransformerDefinitionParser(ObjectToByteArray.class)); registerBeanDefinitionParser("append-string-transformer", new TransformerDefinitionParser(StringAppendTransformer.class)); //Transaction Managers registerBeanDefinitionParser("custom-transaction-manager", new TransactionManagerDefinitionParser()); registerBeanDefinitionParser("jndi-transaction-manager", new TransactionManagerDefinitionParser(GenericTransactionManagerLookupFactory.class)); registerBeanDefinitionParser("weblogic-transaction-manager", new TransactionManagerDefinitionParser(WeblogicTransactionManagerLookupFactory.class)); registerBeanDefinitionParser("jboss-transaction-manager", new TransactionManagerDefinitionParser(JBossTransactionManagerLookupFactory.class)); registerBeanDefinitionParser("jrun-transaction-manager", new TransactionManagerDefinitionParser(JRunTransactionManagerLookupFactory.class)); registerBeanDefinitionParser("resin-transaction-manager", new TransactionManagerDefinitionParser(Resin3TransactionManagerLookupFactory.class)); registerBeanDefinitionParser("websphere-transaction-manager", new TransactionManagerDefinitionParser(WebsphereTransactionManagerLookupFactory.class)); //Endpoint elements registerBeanDefinitionParser("endpoint", new OrphanEndpointDefinitionParser(EndpointURIEndpointBuilder.class)); registerBeanDefinitionParser("inbound-endpoint", new GenericEndpointDefinitionParser(InboundEndpointFactoryBean.class)); registerBeanDefinitionParser("outbound-endpoint", new GenericEndpointDefinitionParser(OutboundEndpointFactoryBean.class)); registerBeanDefinitionParser("custom-transaction", new TransactionDefinitionParser()); // Models registerBeanDefinitionParser("model", new ModelDefinitionParser()); registerBeanDefinitionParser("seda-model", new InheritDefinitionParser(new OrphanDefinitionParser(SedaModel.class, true), new NamedDefinitionParser())); registerBeanDefinitionParser("entry-point-resolver-set", new ChildDefinitionParser("entryPointResolverSet", DefaultEntryPointResolverSet.class)); registerBeanDefinitionParser("legacy-entry-point-resolver-set", new ChildDefinitionParser("entryPointResolverSet", LegacyEntryPointResolverSet.class)); registerBeanDefinitionParser("custom-entry-point-resolver-set", new ChildDefinitionParser("entryPointResolverSet")); registerBeanDefinitionParser("custom-entry-point-resolver", new ChildDefinitionParser("entryPointResolver")); registerBeanDefinitionParser("callable-entry-point-resolver", new ChildDefinitionParser("entryPointResolver", CallableEntryPointResolver.class)); registerMuleBeanDefinitionParser("property-entry-point-resolver", new ChildDefinitionParser("entryPointResolver", MethodHeaderPropertyEntryPointResolver.class)).addAlias("property", "methodProperty"); registerBeanDefinitionParser("method-entry-point-resolver", new ChildDefinitionParser("entryPointResolver", ExplicitMethodEntryPointResolver.class)); registerBeanDefinitionParser("reflection-entry-point-resolver", new ChildDefinitionParser("entryPointResolver", ReflectionEntryPointResolver.class)); registerBeanDefinitionParser("no-arguments-entry-point-resolver", new ChildDefinitionParser("entryPointResolver", NoArgumentsEntryPointResolver.class)); registerBeanDefinitionParser("array-entry-point-resolver", new ChildDefinitionParser("entryPointResolver", ArrayEntryPointResolver.class)); registerMuleBeanDefinitionParser("include-entry-point", new ParentDefinitionParser()); registerMuleBeanDefinitionParser("exclude-entry-point", new ParentDefinitionParser()).addAlias("method", "ignoredMethod"); registerMuleBeanDefinitionParser("exclude-object-methods", new IgnoreObjectMethodsDefinitionParser()); // Services registerBeanDefinitionParser("seda-service", new ServiceDefinitionParser(SedaService.class)); registerBeanDefinitionParser("service", new ServiceDefinitionParser(SedaService.class)); registerBeanDefinitionParser("custom-service", new ServiceDefinitionParser()); // Components registerBeanDefinitionParser("component", new ComponentDelegatingDefinitionParser(DefaultJavaComponent.class)); registerBeanDefinitionParser("pooled-component", new ComponentDelegatingDefinitionParser(PooledJavaComponent.class)); registerMuleBeanDefinitionParser("binding", new BindingDefinitionParser("nestedRouter.routers", DefaultNestedRouter.class)).addCollection("nestedRouter.routers"); // Simple Components registerBeanDefinitionParser("bridge-component", new ComponentDefinitionParser(PassThroughComponent.class)); registerBeanDefinitionParser("pass-through-component", new ComponentDefinitionParser(PassThroughComponent.class)); registerBeanDefinitionParser("log-component", new SimpleComponentDefinitionParser(SimpleCallableJavaComponent.class, LogComponent.class)); registerBeanDefinitionParser("null-component",new SimpleComponentDefinitionParser(SimpleCallableJavaComponent.class, NullComponent.class)); // We need to use DefaultJavaComponent for the echo comonent because some tests invoke EchoComponent with method name and therefore we need an entry point resolver registerBeanDefinitionParser("echo-component", new SimpleComponentDefinitionParser(DefaultJavaComponent.class, EchoComponent.class)); // Object Factories registerBeanDefinitionParser("singleton-object", new ObjectFactoryDefinitionParser(SingletonObjectFactory.class, "objectFactory")); registerBeanDefinitionParser("prototype-object", new ObjectFactoryDefinitionParser(PrototypeObjectFactory.class, "objectFactory")); registerBeanDefinitionParser("spring-object", new ObjectFactoryDefinitionParser(SpringBeanLookup.class, "objectFactory")); // Life-cycle Adapters Factories registerBeanDefinitionParser("custom-lifecycle-adapter-factory", new ChildDefinitionParser("lifecycleAdapterFactory")); //Routers registerBeanDefinitionParser("inbound", new ChildDefinitionParser("inboundRouter", DefaultInboundRouterCollection.class)); registerBeanDefinitionParser("outbound", new ChildDefinitionParser("outboundRouter", DefaultOutboundRouterCollection.class)); registerBeanDefinitionParser("async-reply", new ChildDefinitionParser("responseRouter", DefaultResponseRouterCollection.class)); //Inbound Routers registerBeanDefinitionParser("forwarding-router", new RouterDefinitionParser(ForwardingConsumer.class)); registerBeanDefinitionParser("inbound-pass-through-router", new RouterDefinitionParser(InboundPassThroughRouter.class)); registerBeanDefinitionParser("idempotent-receiver-router", new RouterDefinitionParser(IdempotentReceiver.class)); registerBeanDefinitionParser("idempotent-secure-hash-receiver-router", new RouterDefinitionParser(IdempotentSecureHashReceiver.class)); registerBeanDefinitionParser("selective-consumer-router", new RouterDefinitionParser(SelectiveConsumer.class)); registerBeanDefinitionParser("wire-tap-router", new RouterDefinitionParser(WireTap.class)); registerBeanDefinitionParser("custom-correlation-aggregator-router", new RouterDefinitionParser()); registerBeanDefinitionParser("collection-aggregator-router", new RouterDefinitionParser(SimpleCollectionAggregator.class)); registerBeanDefinitionParser("message-chunking-aggregator-router", new RouterDefinitionParser(MessageChunkingAggregator.class)); registerBeanDefinitionParser("correlation-resequencer-router", new RouterDefinitionParser(CorrelationEventResequencer.class)); registerBeanDefinitionParser("custom-inbound-router", new RouterDefinitionParser(null)); //Outbound Routers registerBeanDefinitionParser("outbound-pass-through-router", new RouterDefinitionParser(OutboundPassThroughRouter.class)); registerBeanDefinitionParser("filtering-router", new RouterDefinitionParser(FilteringOutboundRouter.class)); registerBeanDefinitionParser("chaining-router", new RouterDefinitionParser(ChainingRouter.class)); registerBeanDefinitionParser("endpoint-selector-router", new RouterDefinitionParser(EndpointSelector.class)); registerBeanDefinitionParser("exception-based-router", new RouterDefinitionParser(ExceptionBasedRouter.class)); registerBeanDefinitionParser("list-message-splitter-router", new RouterDefinitionParser(FilteringListMessageSplitter.class)); registerBeanDefinitionParser("message-chunking-router", new RouterDefinitionParser(MessageChunkingRouter.class)); registerBeanDefinitionParser("multicasting-router", new RouterDefinitionParser(MulticastingRouter.class)); registerBeanDefinitionParser("static-recipient-list-router", new RouterDefinitionParser(StaticRecipientList.class)); registerBeanDefinitionParser("recipients", new ChildListDefinitionParser("recipients")); registerBeanDefinitionParser("template-endpoint-router", new RouterDefinitionParser(TemplateEndpointRouter.class)); registerBeanDefinitionParser("custom-outbound-router", new RouterDefinitionParser(null)); registerBeanDefinitionParser("reply-to", new EndpointRefParser("replyTo")); //Response Routers registerBeanDefinitionParser("custom-async-reply-router", new RouterDefinitionParser(null)); registerBeanDefinitionParser("single-async-reply-router", new RouterDefinitionParser(SingleResponseRouter.class)); registerBeanDefinitionParser("collection-async-reply-router", new RouterDefinitionParser(SimpleCollectionResponseAggregator.class)); //Message Info Mappings registerBeanDefinitionParser("expression-message-info-mapping", new ChildDefinitionParser("messageInfoMapping", ExpressionMessageInfoMapping.class)); registerBeanDefinitionParser("custom-message-info-mapping", new ChildDefinitionParser("messageInfoMapping")); //Catch all Strategies registerBeanDefinitionParser("logging-catch-all-strategy", new ChildDefinitionParser("catchAllStrategy", LoggingCatchAllStrategy.class)); registerBeanDefinitionParser("custom-catch-all-strategy", new ChildDefinitionParser("catchAllStrategy", null)); registerBeanDefinitionParser("forwarding-catch-all-strategy", new ChildDefinitionParser("catchAllStrategy", ForwardingCatchAllStrategy.class)); registerBeanDefinitionParser("custom-forwarding-catch-all-strategy", new ChildDefinitionParser("catchAllStrategy", null)); //Common Filters registerMuleBeanDefinitionParser("filter", new ParentDefinitionParser()).addAlias("ref", "filter"); registerBeanDefinitionParser("and-filter", new FilterDefinitionParser(AndFilter.class)); registerBeanDefinitionParser("or-filter", new FilterDefinitionParser(OrFilter.class)); registerBeanDefinitionParser("not-filter", new FilterDefinitionParser(NotFilter.class)); registerBeanDefinitionParser("regex-filter", new FilterDefinitionParser(RegExFilter.class)); registerBeanDefinitionParser("exception-type-filter", new FilterDefinitionParser(ExceptionTypeFilter.class)); registerBeanDefinitionParser("message-property-filter", new FilterDefinitionParser(MessagePropertyFilter.class)); registerBeanDefinitionParser("payload-type-filter", new FilterDefinitionParser(PayloadTypeFilter.class)); registerBeanDefinitionParser("wildcard-filter", new FilterDefinitionParser(WildcardFilter.class)); registerBeanDefinitionParser("equals-filter", new FilterDefinitionParser(EqualsFilter.class)); registerBeanDefinitionParser("expression-filter", new FilterDefinitionParser(ExpressionFilter.class)); registerBeanDefinitionParser("custom-filter", new FilterDefinitionParser()); //Utils / Standard Types registerMuleBeanDefinitionParser("properties", new ChildMapDefinitionParser("properties")).addCollection("properties"); registerMuleBeanDefinitionParser("property", new ChildMapEntryDefinitionParser("properties")).addCollection("properties"); registerMuleBeanDefinitionParser("add-message-properties", new ChildMapDefinitionParser("addProperties")).addCollection("addProperties"); registerMuleBeanDefinitionParser("add-message-property", new ChildMapEntryDefinitionParser("addProperties")).addCollection("addProperties"); registerBeanDefinitionParser("delete-message-property", new ChildListEntryDefinitionParser("deleteProperties", ChildMapEntryDefinitionParser.KEY)); registerMuleBeanDefinitionParser("jndi-provider-properties", new ChildMapDefinitionParser("jndiProviderProperties")).addCollection("jndiProviderProperties"); registerMuleBeanDefinitionParser("jndi-provider-property", new ChildMapEntryDefinitionParser("jndiProviderProperties")).addCollection("jndiProviderProperties"); registerBeanDefinitionParser("environment", new ChildMapDefinitionParser("environment")); //Security registerMuleBeanDefinitionParser("security-manager", new NamedDefinitionParser(MuleProperties.OBJECT_SECURITY_MANAGER)).addIgnored("type").addIgnored("name"); registerBeanDefinitionParser("custom-security-provider", new NameTransferDefinitionParser("providers")); registerMuleBeanDefinitionParser("custom-encryption-strategy", new NameTransferDefinitionParser("encryptionStrategies")).addAlias("strategy", "encryptionStrategy"); registerBeanDefinitionParser("password-encryption-strategy", new ChildDefinitionParser("encryptionStrategy", PasswordBasedEncryptionStrategy.class)); registerMuleBeanDefinitionParser("secret-key-encryption-strategy", new ChildDefinitionParser("encryptionStrategy", SecretKeyEncryptionStrategy.class)).registerPreProcessor(new CheckExclusiveAttributes(new String[][]{new String[]{"key"}, new String[]{"keyFactory-ref"}})); registerBeanDefinitionParser("encryption-security-filter", new ChildDefinitionParser("securityFilter", MuleEncryptionEndpointSecurityFilter.class)); } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/editors/0000755000175000017500000000000011351411153027115 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/editors/QNamePropertyEditor.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/editors/QNamePropertyEditor.ja0000644000175000017500000000506210754365306033367 0ustar charlescharles/* * $Id: QNamePropertyEditor.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.editors; import java.beans.PropertyEditorSupport; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import javax.xml.namespace.QName; /** * This handles qname{....} syntax as used in stockquote-soap-config.xml */ public class QNamePropertyEditor extends PropertyEditorSupport { private boolean explicit = false; public QNamePropertyEditor() { super(); } public QNamePropertyEditor(boolean explicit) { this(); this.explicit = explicit; } //@Override public void setAsText(String text) throws IllegalArgumentException { if (text.startsWith("qname{")) { setValue(parseQName(text.substring(6, text.length() - 1))); } else if (!explicit) { setValue(parseQName(text)); } else { setValue(new QName(text)); } } protected QName parseQName(String val) { StringTokenizer st = new StringTokenizer(val, ":"); List elements = new ArrayList(); while (st.hasMoreTokens()) { elements.add(st.nextToken()); } switch (elements.size()) { case 1 : { return new QName((String)elements.get(0)); } case 2 : { return new QName((String)elements.get(0), (String)elements.get(1)); } case 3 : { return new QName((String)elements.get(1) + ":" + (String)elements.get(2), (String)elements.get(0)); } case 4 : { return new QName((String)elements.get(2) + ":" + (String)elements.get(3), (String)elements.get(1), (String)elements.get(0)); } default : { return null; } } } public static QName convert(String value) { QNamePropertyEditor editor = new QNamePropertyEditor(); editor.setAsText(value); return (QName) editor.getValue(); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/editors/EndpointURIPropertyEditor.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/editors/EndpointURIPropertyEdi0000644000175000017500000000204310745677442033413 0ustar charlescharles/* * $Id: EndpointURIPropertyEditor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.editors; import org.mule.api.endpoint.EndpointException; import org.mule.endpoint.MuleEndpointURI; import java.beans.PropertyEditorSupport; /** * Translates a connector name property into the corresponding {@link org.mule.api.transport.Connector} * instance. */ public class EndpointURIPropertyEditor extends PropertyEditorSupport { public void setAsText(String text) { try { setValue(new MuleEndpointURI(text)); } catch (EndpointException e) { throw new IllegalArgumentException(e.getMessage()); } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/editors/ConnectorPropertyEditor.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/editors/ConnectorPropertyEdito0000644000175000017500000000226410745677442033555 0ustar charlescharles/* * $Id: ConnectorPropertyEditor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.editors; import org.mule.RegistryContext; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import java.beans.PropertyEditorSupport; /** * Translates a connector name property into the corresponding {@link org.mule.api.transport.Connector} * instance. * * TODO - Why isn't this simply a reference? */ public class ConnectorPropertyEditor extends PropertyEditorSupport { public void setAsText(String text) { Connector connector = RegistryContext.getRegistry().lookupConnector(text); if (connector == null) { throw new IllegalArgumentException(CoreMessages.objectNotRegistered("Connector", text).getMessage()); } setValue(connector); } }././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/editors/URIBuilderPropertyEditor.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/editors/URIBuilderPropertyEdit0000644000175000017500000000151210745677442033405 0ustar charlescharles/* * $Id: URIBuilderPropertyEditor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.editors; import org.mule.endpoint.URIBuilder; import java.beans.PropertyEditorSupport; /** * Translates a connector name property into the corresponding {@link org.mule.api.transport.Connector} * instance. */ public class URIBuilderPropertyEditor extends PropertyEditorSupport { public void setAsText(String text) { setValue(new URIBuilder(text)); } }././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/MuleBeanDefinitionDocumentReader.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/MuleBeanDefinitionDocumentRead0000644000175000017500000000342710771011472033376 0ustar charlescharles/* * $Id: MuleBeanDefinitionDocumentReader.java 11469 2008-03-21 19:57:46Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate; import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader; import org.springframework.beans.factory.xml.XmlReaderContext; import org.springframework.util.StringUtils; import org.w3c.dom.Element; /** * Allows us to hook in our own Hierarchical Parser delegate. this enables the * parsing of custom spring bean elements nested within each other */ public class MuleBeanDefinitionDocumentReader extends DefaultBeanDefinitionDocumentReader { protected BeanDefinitionParserDelegate createHelper(XmlReaderContext readerContext, Element root) { BeanDefinitionParserDelegate delegate = new MuleHierarchicalBeanDefinitionParserDelegate(readerContext, this); delegate.initDefaults(root); return delegate; } /** * Override to reject configuration files with no namespace, e.g. mule legacy * configuration file. */ protected void parseBeanDefinitions(Element root, BeanDefinitionParserDelegate delegate) { if (!StringUtils.hasLength(root.getNamespaceURI())) { getReaderContext().error("Unable to locate NamespaceHandler for namespace [null]", root); } else { super.parseBeanDefinitions(root, delegate); } } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/SpringRegistry.java0000644000175000017500000001756410766637211031335 0ustar charlescharles/* * $Id: SpringRegistry.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.MuleException; import org.mule.api.agent.Agent; import org.mule.api.config.MuleConfiguration; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.LifecycleManager; import org.mule.api.model.Model; import org.mule.api.registry.RegistrationException; import org.mule.api.registry.ServiceDescriptor; import org.mule.api.registry.ServiceDescriptorFactory; import org.mule.api.registry.ServiceException; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; import org.mule.lifecycle.ContainerManagedLifecyclePhase; import org.mule.lifecycle.GenericLifecycleManager; import org.mule.registry.AbstractRegistry; import org.mule.util.SpiUtils; import org.mule.util.StringUtils; import java.util.Collection; import java.util.Map; import java.util.Properties; import javax.transaction.TransactionManager; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.context.ConfigurableApplicationContext; public class SpringRegistry extends AbstractRegistry { public static final String REGISTRY_ID = "org.mule.Registry.Spring"; protected ConfigurableApplicationContext applicationContext; public SpringRegistry() { super(REGISTRY_ID); } public SpringRegistry(String id) { super(id); } public SpringRegistry(ConfigurableApplicationContext applicationContext) { super(REGISTRY_ID); this.applicationContext = applicationContext; } public SpringRegistry(String id, ConfigurableApplicationContext applicationContext) { super(id); this.applicationContext = applicationContext; } protected LifecycleManager createLifecycleManager() { GenericLifecycleManager lcm = new GenericLifecycleManager(); lcm.registerLifecycle(new ContainerManagedLifecyclePhase(Initialisable.PHASE_NAME, Initialisable.class, Disposable.PHASE_NAME)); lcm.registerLifecycle(new ContainerManagedLifecyclePhase(Disposable.PHASE_NAME, Disposable.class, Initialisable.PHASE_NAME)); return lcm; } protected Object doLookupObject(String key) { if (StringUtils.isBlank(key)) { logger.warn( MessageFactory.createStaticMessage("Detected a lookup attempt with an empty or null key"), new Throwable().fillInStackTrace()); return null; } try { return applicationContext.getBean(key); } catch (NoSuchBeanDefinitionException e) { logger.debug(e); return null; } } protected Collection doLookupObjects(Class type) { Map map = applicationContext.getBeansOfType(type); // MULE-2762 //if (logger.isDebugEnabled()) //{ // MapUtils.debugPrint(System.out, "Beans of type " + type, map); //} return map.values(); } public ServiceDescriptor lookupServiceDescriptor(String type, String name, Properties overrides) throws ServiceException { Properties props = SpiUtils.findServiceDescriptor(type, name); if (props == null) { throw new ServiceException(CoreMessages.failedToLoad(type + " " + name)); } return ServiceDescriptorFactory.create(type, name, props, overrides, this); } /** {@inheritDoc} */ public TransactionManager getTransactionManager() { try { return (TransactionManager) lookupObject(TransactionManager.class); } catch (RegistrationException e) { throw new RuntimeException(e); } } public Collection getModels() { return applicationContext.getBeansOfType(Model.class).values(); } /** {@inheritDoc} */ public Collection getConnectors() { return applicationContext.getBeansOfType(Connector.class).values(); } public Collection getAgents() { return applicationContext.getBeansOfType(Agent.class).values(); } /** {@inheritDoc} */ public Collection getEndpoints() { return applicationContext.getBeansOfType(ImmutableEndpoint.class).values(); } /** {@inheritDoc} */ public Collection getTransformers() { return applicationContext.getBeansOfType(Transformer.class).values(); } public boolean isReadOnly() { return true; } public boolean isRemote() { return false; } public void registerConnector(Connector connector) throws MuleException { unsupportedOperation("registerConnector", connector); } public void unregisterConnector(String connectorName) throws MuleException { unsupportedOperation("unregisterConnector", connectorName); } public void registerEndpoint(ImmutableEndpoint endpoint) throws MuleException { unsupportedOperation("registerEndpoint", endpoint); } public void unregisterEndpoint(String endpointName) { unsupportedOperation("unregisterEndpoint", endpointName); } protected void doRegisterTransformer(Transformer transformer) throws MuleException { unsupportedOperation("registerTransformer", transformer); } public void unregisterTransformer(String transformerName) { unsupportedOperation("unregistertransformer", transformerName); } /** {@inheritDoc} */ public void registerService(Service service) throws MuleException { unsupportedOperation("registerService", service); } public void unregisterService(String serviceName) { unsupportedOperation("unregisterService", serviceName); } public void registerModel(Model model) throws MuleException { unsupportedOperation("registerModel", model); } public void unregisterModel(String modelName) { unsupportedOperation("unregisterModel", modelName); } public void registerAgent(Agent agent) throws MuleException { unsupportedOperation("registerAgent", agent); } public void unregisterAgent(String agentName) throws MuleException { unsupportedOperation("unregisterAgent", agentName); } protected void doRegisterObject(String key, Object value, Object metadata) throws RegistrationException { unsupportedOperation("doRegisterObject", key); } public void unregisterObject(String key) { unsupportedOperation("unregisterObject", key); } public void registerObjects(Map objects) throws RegistrationException { unsupportedOperation("registryObjects", objects); } public void setConfiguration(MuleConfiguration config) { unsupportedOperation("setConfiguration", config); } public void registerEndpointBuilder(String name, EndpointBuilder builder) throws MuleException { unsupportedOperation("registerEndpointBuilder", builder); } protected void doDispose() { super.doDispose(); applicationContext.close(); } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/processors/0000755000175000017500000000000011351411152027645 5ustar charlescharles././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/processors/PropertyPlaceholderProcessor.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/processors/PropertyPlaceholder0000644000175000017500000000621710762044052033573 0ustar charlescharles/* * $Id: PropertyPlaceholderProcessor.java 11134 2008-02-29 18:00:10Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.processors; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.config.PropertyFactory; import org.mule.api.context.MuleContextAware; import org.mule.config.i18n.CoreMessages; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Properties; import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; /** * TODO */ public class PropertyPlaceholderProcessor extends PropertyPlaceholderConfigurer implements MuleContextAware { private MuleContext muleContext; private Map factories = new HashMap(); //@Override protected Properties mergeProperties() throws IOException { RegistryProperties props = new RegistryProperties(); props.putAll(super.mergeProperties()); // MuleContext/MuleConfiguration properties props.put("mule.working.dir", muleContext.getConfiguration().getWorkingDirectory()); if (factories != null) { for (Iterator iterator = factories.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); if (entry.getKey() == null) { throw new NullPointerException(CoreMessages.objectIsNull("Factories.Key").getMessage()); } if (entry.getValue() == null) { throw new NullPointerException(CoreMessages.objectIsNull("Factories.Value").getMessage()); } try { props.put(entry.getKey(), ((PropertyFactory) entry.getValue()).create(props)); } catch (Exception e) { throw new IOException("Failed to invoke PropertyFactory: " + entry.getValue() + ". Error is: " + e.toString()); } } } return props; } public Map getFactories() { return factories; } public void setFactories(Map factories) { this.factories = factories; } private class RegistryProperties extends Properties { public String getProperty(String key) { Object oval = super.get(key); if (oval == null) { oval = RegistryContext.getRegistry().lookupObject(key); } String sval = (oval instanceof String) ? (String)oval : null; return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval; } } public void setMuleContext(MuleContext muleContext) { this.muleContext = muleContext; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/processors/MuleObjectNameProcessor.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/processors/MuleObjectNameProce0000644000175000017500000000444610765313375033443 0ustar charlescharles/* * $Id: MuleObjectNameProcessor.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.processors; import org.mule.api.agent.Agent; import org.mule.api.model.Model; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.api.transport.Connector; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; /** * MuleObjectNameProcessor is used to set spring ids to Mule object * names so the the bean id and name property on the object don't both have to be * set. */ public class MuleObjectNameProcessor implements BeanPostProcessor { private boolean overwrite = false; public Object postProcessBeforeInitialization(Object o, String s) throws BeansException { if (o instanceof Connector) { if (((Connector)o).getName() == null || overwrite) { ((Connector)o).setName(s); } } else if (o instanceof Transformer) { if (((Transformer)o).getName() == null || overwrite) { ((Transformer)o).setName(s); } } else if (o instanceof Service) { if (((Service)o).getName() == null || overwrite) { ((Service)o).setName(s); } } else if (o instanceof Model) { if (((Model)o).getName() == null || overwrite) { ((Model)o).setName(s); } } else if (o instanceof Agent) { ((Agent)o).setName(s); } return o; } public Object postProcessAfterInitialization(Object o, String s) throws BeansException { return o; } public boolean isOverwrite() { return overwrite; } public void setOverwrite(boolean overwrite) { this.overwrite = overwrite; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/MuleHierarchicalBeanDefinitionParserDelegate.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/MuleHierarchicalBeanDefinition0000644000175000017500000002522110771011472033376 0ustar charlescharles/* * $Id: MuleHierarchicalBeanDefinitionParserDelegate.java 11469 2008-03-21 19:57:46Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.config.spring.util.SpringXMLUtils; import org.mule.util.StringUtils; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinitionHolder; import org.springframework.beans.factory.parsing.BeanComponentDefinition; import org.springframework.beans.factory.support.BeanDefinitionReaderUtils; import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate; import org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader; import org.springframework.beans.factory.xml.NamespaceHandler; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.beans.factory.xml.XmlReaderContext; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * This parser enables Mule to parse heirarchical bean structures using spring Namespace handling * There are 4 base DefinitionParsers supplied in Mule that most Parsers will extend from, these are * {@link org.mule.config.spring.parsers.AbstractChildDefinitionParser} * {@link org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser} * {@link org.mule.config.spring.parsers.generic.ChildDefinitionParser} * {@link org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser} */ public class MuleHierarchicalBeanDefinitionParserDelegate extends BeanDefinitionParserDelegate { public static final String BEANS = "beans"; // cannot find this in Spring api! public static final String MULE_REPEAT_PARSE = "org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.MULE_REPEAT_PARSE"; public static final String MULE_NO_RECURSE = "org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE"; public static final String MULE_FORCE_RECURSE = "org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.MULE_FORCE_RECURSE"; public static final String MULE_NO_REGISTRATION = "org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_REGISTRATION"; public static final String MULE_POST_CHILDREN = "org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.MULE_POST_CHILDREN"; private DefaultBeanDefinitionDocumentReader spring; protected static final Log logger = LogFactory.getLog(MuleHierarchicalBeanDefinitionParserDelegate.class); public MuleHierarchicalBeanDefinitionParserDelegate(XmlReaderContext readerContext, DefaultBeanDefinitionDocumentReader spring) { super(readerContext); this.spring = spring; } public BeanDefinition parseCustomElement(Element element, BeanDefinition parent) { if (logger.isDebugEnabled()) { logger.debug("parsing: " + SpringXMLUtils.elementToString(element)); } if (SpringXMLUtils.isBeansNamespace(element)) { return handleSpringElements(element, parent); } else { String namespaceUri = element.getNamespaceURI(); NamespaceHandler handler = getReaderContext().getNamespaceHandlerResolver().resolve(namespaceUri); if (handler == null) { getReaderContext().error("Unable to locate NamespaceHandler for namespace [" + namespaceUri + "]", element); return null; } boolean noRecurse = false; boolean forceRecurse = false; BeanDefinition finalChild; do { ParserContext parserContext = new ParserContext(getReaderContext(), this, parent); finalChild = handler.parse(element, parserContext); registerBean(element, finalChild); noRecurse = noRecurse || testFlag(finalChild, MULE_NO_RECURSE); forceRecurse = forceRecurse || testFlag(finalChild, MULE_FORCE_RECURSE); } while (null != finalChild && testFlag(finalChild, MULE_REPEAT_PARSE)); // Only iterate and parse child mule name-spaced elements. Spring does not do // hierarchical parsing by default so we need to maintain this behavior // for non-mule elements to ensure that we don't break the parsing of any // other custom name-spaces e.g spring-jee. // We also avoid parsing inside elements that have constructed a factory bean // because that means we're dealing with (something like) ChildMapDefinitionParser, // which handles iteration internally (this is a hack needed because Spring doesn't // expose the DP for "" elements directly). boolean isRecurse; if (noRecurse) { // no recursion takes precedence, as recursion is set by default isRecurse = false; } else { if (forceRecurse) { isRecurse = true; } else { // default behaviour if no control specified isRecurse = SpringXMLUtils.isMuleNamespace(element); } } if (isRecurse) { NodeList list = element.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { if (list.item(i) instanceof Element) { parseCustomElement((Element) list.item(i), finalChild); } } } // If a parser requests post-processing we call again after children called if (testFlag(finalChild, MULE_POST_CHILDREN)) { ParserContext parserContext = new ParserContext(getReaderContext(), this, parent); finalChild = handler.parse(element, parserContext); } return finalChild; } } protected BeanDefinition handleSpringElements(Element element, BeanDefinition parent) { // these are only called if they are at a "top level" - if they are nested inside // other spring elements then spring will handle them itself if (SpringXMLUtils.isLocalName(element, BEANS)) { // the delegate doesn't support the full spring schema, but it seems that // we can invoke the DefaultBeanDefinitionDocumentReader via registerBeanDefinitions // but we need to create a new DOM document from the element first try { Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); doc.appendChild(doc.importNode(element, true)); spring.registerBeanDefinitions(doc, getReaderContext()); } catch (ParserConfigurationException e) { throw new RuntimeException(e); } return parent; } else if (SpringXMLUtils.isLocalName(element, PROPERTY_ELEMENT)) { parsePropertyElement(element, parent); return parent; } // i am trying to keep these to a minimum - using anything but "bean" is a recipe // for disaster - we already have problems with "property", for example. // else if (isLocalName(element, MAP_ELEMENT)) // { // // currently unused? // parseMapElement(element, bd); // } // else if (isLocalName(element, LIST_ELEMENT)) // { // // currently unused? // parseListElement(element, bd); // } // else if (isLocalName(element, SET_ELEMENT)) // { // // currently unused? // parseSetElement(element, bd); // } else if (SpringXMLUtils.isLocalName(element, BEAN_ELEMENT)) { BeanDefinitionHolder holder = parseBeanDefinitionElement(element, parent); registerBeanDefinitionHolder(holder); return holder.getBeanDefinition(); } else { throw new IllegalStateException("Unexpected Spring element: " + SpringXMLUtils.elementToString(element)); } } protected void registerBean(Element ele, BeanDefinition bd) { if (bd == null) { return; } // Check to see if the Bean Definition represents a compound element - one represents a subset of // configuration for the parent bean. Compound bean definitions should not be registered since the properties // set on them are really set on the parent bean. if (! testFlag(bd, MULE_NO_REGISTRATION)) { String name = generateChildBeanName(ele); logger.debug("register " + name + ": " + bd.getBeanClassName()); registerBeanDefinitionHolder(new BeanDefinitionHolder(bd, name)); } } protected void registerBeanDefinitionHolder(BeanDefinitionHolder bdHolder) { //bdHolder = decorateBeanDefinitionIfRequired(ele, bdHolder); // Register the final decorated instance. BeanDefinitionReaderUtils.registerBeanDefinition(bdHolder, getReaderContext().getRegistry()); // Send registration event. getReaderContext().fireComponentRegistered(new BeanComponentDefinition(bdHolder)); } protected String generateChildBeanName(Element e) { String id = SpringXMLUtils.getNameOrId(e); if (StringUtils.isBlank(id)) { String parentId = SpringXMLUtils.getNameOrId((Element) e.getParentNode()); return "." + parentId + ":" + e.getLocalName(); } else { return id; } } public static void setFlag(BeanDefinition bean, String flag) { bean.setAttribute(flag, Boolean.TRUE); } public static boolean testFlag(BeanDefinition bean, String flag) { return null != bean && bean.hasAttribute(flag) && bean.getAttribute(flag) instanceof Boolean && ((Boolean) bean.getAttribute(flag)).booleanValue(); } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/MuleResourceLoader.java0000644000175000017500000000455410740712271032066 0ustar charlescharles/* * $Id: MuleResourceLoader.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.Resource; import org.springframework.core.io.support.ResourcePatternResolver; /** * MuleResourceLoader is a custom Spring resource loader that calls * standard Mule methods for loading resource files. */ public class MuleResourceLoader extends DefaultResourceLoader implements ResourcePatternResolver { protected transient Log logger = LogFactory.getLog(MuleResourceLoader.class); public Resource getResource(String rsc) { return getResourceByPath(rsc); } protected Resource getResourceByPath(String path) { InputStream is = null; try { is = IOUtils.getResourceAsStream(path, getClass()); } catch (IOException e) { logger.error("Unable to load Spring resource " + path + " : " + e.getMessage()); return null; } if (is != null) { return new InputStreamResource(is); } else { logger.error("Unable to locate Spring resource " + path); return null; } } public Resource[] getResources(String rsc) throws IOException { if (rsc == null) { throw new IOException("No resources to read"); } String[] resourcesNames = org.springframework.util.StringUtils.tokenizeToStringArray(rsc, ",;", true, true); Resource[] resources = new Resource[resourcesNames.length]; for (int i = 0; i < resourcesNames.length; ++i) { resources[i] = getResourceByPath(resourcesNames[i]); } return resources; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/MissingParserProblemReporter.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/MissingParserProblemReporter.j0000644000175000017500000000455710740712271033472 0ustar charlescharles/* * $Id: MissingParserProblemReporter.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.springframework.beans.factory.parsing.FailFastProblemReporter; import org.springframework.beans.factory.parsing.Problem; import org.w3c.dom.Element; /** * A very simple extension to {@link org.springframework.beans.factory.parsing.FailFastProblemReporter} * that intercepts errors related to missing definition parsers to give a more helpful message. * In the future we may want to replace this by something more sophisticated that allows * different problems to be resolved by different "pluggable" components... */ public class MissingParserProblemReporter extends FailFastProblemReporter { public static final String NO_PARSER_PREFIX = "Cannot locate BeanDefinitionParser"; // @Override public void fatal(Problem problem) { if (isMissingParser(problem)) { problem = extendProblemDetails(problem); } super.fatal(problem); } protected boolean isMissingParser(Problem problem) { // Spring doesn't give us much useful data here - parseState and rootCause are null String message = problem.getMessage(); return (null != message && message.startsWith(NO_PARSER_PREFIX)); } protected Problem extendProblemDetails(Problem problem) { try { String element = ((Element) problem.getLocation().getSource()).getLocalName(); String namespace = ((Element) problem.getLocation().getSource()).getNamespaceURI(); String message = "The element '" + element + "' does not have an associated Bean Definition Parser." +" Is the module or transport associated with " + namespace + " present on the classpath?"; return new Problem(message, problem.getLocation(), problem.getParseState(), problem.getRootCause()); } catch (Exception e) { // fall back to previous message return problem; } } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/MuleContextPostProcessor.java0000644000175000017500000000316310745677442033354 0ustar charlescharles/* * $Id: MuleContextPostProcessor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextAware; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; /** * Responsible for passing in the MuleContext instance for all objects in the * registry that want it. For an object to get an instance of the MuleContext * it must implement MuleContextAware. * * @see MuleContextAware * @see org.mule.api.MuleContext */ public class MuleContextPostProcessor implements BeanPostProcessor { private MuleContext muleContext; public MuleContextPostProcessor(MuleContext muleContext) { this.muleContext = muleContext; } public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (bean instanceof MuleContextAware) { if (muleContext == null) { return bean; } ((MuleContextAware) bean).setMuleContext(muleContext); } return bean; } public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { return bean; } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/0000755000175000017500000000000011351411152027122 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/0000755000175000017500000000000011351411146030712 5ustar charlescharles././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/InheritedModelDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/InheritedMode0000644000175000017500000000234710740712271033367 0ustar charlescharles/* * $Id: InheritedModelDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Allows the Inherited model type to be used. This parser simply looks up the real Model bean and * passes that back. */ public class InheritedModelDefinitionParser extends AbstractBeanDefinitionParser { protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { String parent = element.getAttribute("name"); element.setAttribute("id", parent); return (AbstractBeanDefinition)parserContext.getRegistry().getBeanDefinition(parent); } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ForwardingRouterDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ForwardingRou0000644000175000017500000000471110767256152033446 0ustar charlescharles/* * $Id: ForwardingRouterDefinitionParser.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.component.simple.NullComponent; import org.mule.config.spring.parsers.delegate.AbstractSerialDelegatingDefinitionParser; import org.mule.config.spring.parsers.generic.GrandchildDefinitionParser; import org.mule.object.AbstractObjectFactory; import org.mule.object.SingletonObjectFactory; import org.mule.routing.inbound.ForwardingConsumer; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * In addition to a ForwardingConsumer router, implicitly create a NullComponent service as a placeholder. * * We use AbstractSerialDelegatingDefinitionParser to be able to create 2 beans from a single element. * * We use a ParentDefinitionParser for the NullComponent, because it needs to be set not on * (the surrounding element), but on (one level up). * * * * * * * */ public class ForwardingRouterDefinitionParser extends AbstractSerialDelegatingDefinitionParser { public ForwardingRouterDefinitionParser() { super(); addDelegate(new RouterDefinitionParser(ForwardingConsumer.class)); addDelegate(new NullComponentPlaceholder()); } class NullComponentPlaceholder extends GrandchildDefinitionParser { public NullComponentPlaceholder() { super("componentFactory", SingletonObjectFactory.class); } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { builder.addPropertyValue(AbstractObjectFactory.ATTRIBUTE_OBJECT_CLASS_NAME, NullComponent.class.getName()); super.parseChild(element, parserContext, builder); } } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ThreadingProfileDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ThreadingProf0000644000175000017500000000231010745677442033410 0ustar charlescharles/* * $Id: ThreadingProfileDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.config.ThreadingProfile; import org.mule.config.ChainedThreadingProfile; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.processors.ConstructorReference; /** * This parser is responsible for processing the configuration elements. */ public class ThreadingProfileDefinitionParser extends ChildDefinitionParser { public ThreadingProfileDefinitionParser(String propertyName, String defaults) { super(propertyName, ChainedThreadingProfile.class); addMapping("poolExhaustedAction", ThreadingProfile.POOL_EXHAUSTED_ACTIONS); registerPostProcessor(new ConstructorReference(defaults)); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ObjectFactoryDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ObjectFactory0000644000175000017500000000412010767256152033406 0ustar charlescharles/* * $Id: ObjectFactoryDefinitionParser.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.AbstractChildDefinitionParser; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.object.AbstractObjectFactory; import org.springframework.beans.factory.config.BeanDefinition; import org.w3c.dom.Element; public class ObjectFactoryDefinitionParser extends AbstractChildDefinitionParser { protected Class beanClass = null; protected String setterMethod = null; public ObjectFactoryDefinitionParser(Class beanClass, String setterMethod) { this(beanClass); this.setterMethod = setterMethod; } public ObjectFactoryDefinitionParser(Class beanClass) { super(); this.beanClass = beanClass; setAllowClassAttribute(false); addAlias(AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS, AbstractObjectFactory.ATTRIBUTE_OBJECT_CLASS_NAME); addAlias(AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF, "factoryBean"); } public String getPropertyName(Element element) { if (setterMethod != null) { return setterMethod; } else { BeanDefinition parent = getParentBeanDefinition(element); String setter = (String) parent.getAttribute(ObjectFactoryWrapper.OBJECT_FACTORY_SETTER); return setter; } } protected Class getBeanClass(Element element) { return beanClass; } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ConfigurationDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/Configuration0000644000175000017500000000315110766637211033460 0ustar charlescharles/* * $Id:ConfigurationDefinitionParser.java 5187 2007-02-16 18:00:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.config.MuleConfiguration; import org.mule.api.config.MuleProperties; import org.mule.config.spring.parsers.generic.NamedDefinitionParser; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Parses the element. If this element appears in multiple Xml config files each will its configuration * to a single {@link MuleConfiguration} object. * * @see MuleConfiguration */ public class ConfigurationDefinitionParser extends NamedDefinitionParser { public ConfigurationDefinitionParser() { super(MuleProperties.OBJECT_MULE_CONFIGURATION); singleton=true; } protected Class getBeanClass(Element element) { return MuleConfiguration.class; } //@Override protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) throws BeanDefinitionStoreException { return MuleProperties.OBJECT_MULE_CONFIGURATION; } }././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ServiceDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ServiceDefini0000644000175000017500000000302210756631035033362 0ustar charlescharles/* * $Id: ServiceDefinitionParser.java 10890 2008-02-19 19:46:37Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; import org.mule.config.spring.parsers.processors.ProvideDefaultName; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; public class ServiceDefinitionParser extends OrphanDefinitionParser { // for custom services public ServiceDefinitionParser() { super(true); registerPreProcessor(new ProvideDefaultName("service")); } public ServiceDefinitionParser(Class clazz) { super(clazz, true); registerPreProcessor(new ProvideDefaultName("service")); } //@java.lang.Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Element parent = (Element) element.getParentNode(); String modelName = parent.getAttribute(ATTRIBUTE_NAME); builder.addPropertyReference("model", modelName); super.doParse(element, parserContext, builder); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/PoolingProfileDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/PoolingProfil0000644000175000017500000000176210740712271033432 0ustar charlescharles/* * $Id: PoolingProfileDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.PoolingProfile; /** * This parser is responsible for processing the configuration elements. */ public class PoolingProfileDefinitionParser extends ConfigurationChildDefinitionParser { public PoolingProfileDefinitionParser() { super("poolingProfile", PoolingProfile.class); addMapping("initialisationPolicy", PoolingProfile.POOL_INITIALISATION_POLICIES); addMapping("exhaustedAction", PoolingProfile.POOL_EXHAUSTED_ACTIONS); } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/package.html0000644000175000017500000000017410740712271033201 0ustar charlescharles Mule Targetted support for specific components in the Mule system. ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/TransformerRefDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/TransformerRe0000644000175000017500000000306610745677442033456 0ustar charlescharles/* * $Id: TransformerRefDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.delegate.ParentContextDefinitionParser; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; /** * Handle response transformers correctly */ public class TransformerRefDefinitionParser extends ParentContextDefinitionParser { public TransformerRefDefinitionParser() { super(TransformerDefinitionParser.RESPONSE_TRANSFORMERS, addAlias(new ParentDefinitionParser(), AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF, TransformerDefinitionParser.RESPONSE_TRANSFORMER)); otherwise(addAlias(new ParentDefinitionParser(), AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF, TransformerDefinitionParser.TRANSFORMER)); } private static MuleDefinitionParser addAlias(MuleDefinitionParser parser, String alias, String name) { parser.addAlias(alias, name); return parser; } }././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/FilterDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/FilterDefinit0000644000175000017500000000327210757023422033376 0ustar charlescharles/* * $Id: FilterDefinitionParser.java 10901 2008-02-20 13:11:46Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.routing.filter.Filter; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.delegate.ParentContextDefinitionParser; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; /** * This allows a filter to be defined globally, or embedded within an endpoint. */ public class FilterDefinitionParser extends ParentContextDefinitionParser { public static final String FILTER = "filter"; public static final String ATTRIBUTE_NAME = AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME; public FilterDefinitionParser(Class filter) { super(MuleOrphanDefinitionParser.ROOT_ELEMENT, new MuleOrphanDefinitionParser(filter, false)); otherwise(new ChildDefinitionParser(FILTER, filter, Filter.class, false)); addIgnored(ATTRIBUTE_NAME); } /** * For custom transformers */ public FilterDefinitionParser() { super(MuleOrphanDefinitionParser.ROOT_ELEMENT, new MuleOrphanDefinitionParser(false)); otherwise(new ChildDefinitionParser(FILTER, null, Filter.class, true)); addIgnored(ATTRIBUTE_NAME); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/IgnoreObjectMethodsDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/IgnoreObjectM0000644000175000017500000000242210744121360033325 0ustar charlescharles/* * $Id: IgnoreObjectMethodsDefinitionParser.java 10386 2008-01-18 13:00:32Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.mule.config.spring.parsers.processors.ExtendTarget; public class IgnoreObjectMethodsDefinitionParser extends ParentDefinitionParser { public static final String IGNORED_METHOD = "ignoredMethod"; public IgnoreObjectMethodsDefinitionParser() { registerPostProcessor(new ExtendTarget(IGNORED_METHOD, "toString")); registerPostProcessor(new ExtendTarget(IGNORED_METHOD, "hashCode")); registerPostProcessor(new ExtendTarget(IGNORED_METHOD, "wait")); registerPostProcessor(new ExtendTarget(IGNORED_METHOD, "notify")); registerPostProcessor(new ExtendTarget(IGNORED_METHOD, "notifyAll")); registerPostProcessor(new ExtendTarget(IGNORED_METHOD, "getClass")); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/NotificationDisableDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/NotificationD0000644000175000017500000000503710745677442033417 0ustar charlescharles /* * $Id: NotificationDisableDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.collection.ChildListEntryDefinitionParser; import org.mule.config.spring.parsers.delegate.AttributeSelectionDefinitionParser; import org.mule.config.spring.parsers.processors.CheckExclusiveAttributes; import org.mule.config.spring.parsers.processors.CheckRequiredAttributes; public class NotificationDisableDefinitionParser extends AttributeSelectionDefinitionParser { public static final String DISABLED_EVENT = "disabledType"; public static final String DISABLED_INTERFACE = "disabledInterface"; public NotificationDisableDefinitionParser() { super(NotificationDefinitionParser.EVENT, addMappingToConstructorArg( new ChildListEntryDefinitionParser(DISABLED_EVENT, NotificationDefinitionParser.EVENT))); addDelegate(NotificationDefinitionParser.EVENT_CLASS, new ChildListEntryDefinitionParser(DISABLED_EVENT, NotificationDefinitionParser.EVENT_CLASS)); MuleDefinitionParser parser = new ChildListEntryDefinitionParser(DISABLED_INTERFACE, NotificationDefinitionParser.INTERFACE); parser.addMapping(NotificationDefinitionParser.INTERFACE, NotificationDefinitionParser.INTERFACE_MAP); addDelegate(NotificationDefinitionParser.INTERFACE, parser); addDelegate(NotificationDefinitionParser.INTERFACE_CLASS, new ChildListEntryDefinitionParser(DISABLED_INTERFACE, NotificationDefinitionParser.INTERFACE_CLASS)); registerPreProcessor(new CheckExclusiveAttributes(NotificationDefinitionParser.ALL_ATTRIBUTES)); registerPreProcessor(new CheckRequiredAttributes(NotificationDefinitionParser.ALL_ATTRIBUTES)); } private static MuleDefinitionParser addMappingToConstructorArg(MuleDefinitionParser parser) { parser.addMapping(NotificationDefinitionParser.EVENT, NotificationDefinitionParser.EVENT_MAP); return parser; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/DataObjectDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/DataObjectDef0000644000175000017500000001171311002723722033256 0ustar charlescharles/* * $Id: DataObjectDefinitionParser.java 11613 2008-04-20 20:30:10Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.util.ClassUtils; import org.mule.util.IOUtils; import org.mule.util.StringUtils; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContext; import org.w3c.dom.Element; /** * Represents a static config data object where the body of the element can be the data of a file * attribute can be set. Data will be loaded from file into an {@link java.io.InputStream} */ public class DataObjectDefinitionParser extends ChildDefinitionParser { /** * The class will be inferred from the class attribute * * @param setterMethod The target method (where the child will be injected) */ public DataObjectDefinitionParser(String setterMethod) { super(setterMethod, DataObjectFactoryBean.class); } /** * The class (which is inferred from the class attribute if null here) is checked to be * a subclass of the constraint * * @param setterMethod The target method (where the child will be injected) * @param constraint Superclass of clazz (may be null) */ public DataObjectDefinitionParser(String setterMethod, Class constraint) { super(setterMethod, DataObjectFactoryBean.class, constraint); } /** * The class (which is inferred from the class attribute if null here) is checked to be * a subclass of the constraint. * * @param setterMethod The target method (where the child will be injected) * @param constraint Superclass of clazz (may be null) * @param allowClassAttribute Is class read from class attribute (if present, takes precedence over clazz) */ public DataObjectDefinitionParser(String setterMethod, Class constraint, boolean allowClassAttribute) { super(setterMethod, DataObjectFactoryBean.class, constraint, allowClassAttribute); } //@Override protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { if(StringUtils.isNotEmpty(element.getTextContent())) { assembler.extendBean("data", element.getTextContent(), false); } super.postProcess(context, assembler, element); } public static class DataObjectFactoryBean implements FactoryBean, ApplicationContextAware { private String ref; private boolean binary; private String file; private Object data; private ApplicationContext context; public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { context = applicationContext; } public Object getObject() throws Exception { if(data!=null) { return data; } if(file!=null) { if(binary) { data = IOUtils.toByteArray(IOUtils.getResourceAsStream(file, getClass())); } else { data = IOUtils.getResourceAsString(file, getClass()); } } else if(ref!=null) { data = context.getBean(ref); } if(data==null) { throw new IllegalArgumentException("Data is null was not found"); } return data; } public Class getObjectType() { return Object.class; } public boolean isSingleton() { return true; } public String getFile() { return file; } public void setFile(String file) { this.file = file; } public String getRef() { return ref; } public void setRef(String ref) { this.ref = ref; } public Object getData() { return data; } public void setData(Object data) { this.data = data; } public boolean isBinary() { return binary; } public void setBinary(boolean binary) { this.binary = binary; } } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/0000755000175000017500000000000011351411145032531 5ustar charlescharles././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/TransportEndpointDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/Tran0000644000175000017500000000712610761550001033365 0ustar charlescharles/* * $Id:TransportEndpointDefinitionParser.java 8321 2007-09-10 19:22:52Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint; import org.mule.config.spring.parsers.specific.endpoint.support.AddressedEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.support.ChildEndpointDefinitionParser; import org.mule.endpoint.URIBuilder; /** * This is intended for use by endpoint-specific parsers for non-global endpoint * elements. * *

It generates both an endpoint (which should subclass * {@link org.mule.api.endpoint.ImmutableEndpoint}) and a * {@link org.mule.endpoint.URIBuilder}. The URI is * then injected into the endpoint. So the associated schema can enable any of the * suitable {@link org.mule.endpoint.URIBuilder# ALL_ATTRIBUTES} * or add appropriate mappings. */ public class TransportEndpointDefinitionParser extends AddressedEndpointDefinitionParser { public TransportEndpointDefinitionParser(String protocol, Class endpoint, String[] requiredAddressAttributes) { this(protocol, PROTOCOL, endpoint, requiredAddressAttributes); } public TransportEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, Class endpoint, String[] requiredAddressAttributes) { this(metaOrProtocol, isMeta, endpoint, requiredAddressAttributes, new String[]{}); } /** * @param metaOrProtocol The transport metaOrProtocol ("tcp" etc) * @param isMeta Whether transport is "meta" or not (eg cxf) * @param endpoint The endpoint class to construct * @param requiredAddressAttributes A list of attribute names that are required if "address" * isn't present * @param requiredProperties A list of property names that are required if "address" isn't present */ public TransportEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, Class endpoint, String[] requiredAddressAttributes, String[] requiredProperties) { super(metaOrProtocol, isMeta, new ChildEndpointDefinitionParser(endpoint), requiredAddressAttributes, requiredProperties); } public TransportEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, Class endpoint, String[] endpointAttributes, String[][] requiredAddressAttributes, String[][] requiredProperties) { this(metaOrProtocol, isMeta, endpoint, endpointAttributes, URIBuilder.ALL_ATTRIBUTES, requiredAddressAttributes, requiredProperties); } public TransportEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, Class endpoint, String[] endpointAttributes, String[] addressAttributes, String[][] requiredAddressAttributes, String[][] requiredProperties) { super(metaOrProtocol, isMeta, new ChildEndpointDefinitionParser(endpoint), endpointAttributes, addressAttributes, requiredAddressAttributes, requiredProperties); } } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/TransportGlobalEndpointDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/Tran0000644000175000017500000000774211002521757033376 0ustar charlescharles/* * $Id: TransportGlobalEndpointDefinitionParser.java 11611 2008-04-20 02:01:19Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint; import org.mule.config.spring.parsers.specific.endpoint.support.AddressedEndpointDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.support.OrphanEndpointDefinitionParser; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.endpoint.URIBuilder; /** * A parser for global endpoints. Note that the blocking of "ref" is left to the schema. */ public class TransportGlobalEndpointDefinitionParser extends AddressedEndpointDefinitionParser { public TransportGlobalEndpointDefinitionParser(String protocol, String[] requiredAddressAttributes) { this(protocol, PROTOCOL, requiredAddressAttributes); } public TransportGlobalEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, String[] requiredAddressAttributes) { this(metaOrProtocol, isMeta, requiredAddressAttributes, new String[]{}); } /** * @param metaOrProtocol The transport metaOrProtocol ("tcp" etc) * @param isMeta Whether transport is "meta" or not (eg cxf) * @param requiredAddressAttributes A list of attribute names that are required if "address" * isn't present * @param requiredProperties A list of property names that are required if "address" isn't present */ public TransportGlobalEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, String[] requiredAddressAttributes, String[] requiredProperties) { super(metaOrProtocol, isMeta, new OrphanEndpointDefinitionParser(EndpointURIEndpointBuilder.class), requiredAddressAttributes, requiredProperties); } /** * @param metaOrProtocol The transport metaOrProtocol ("tcp" etc) * @param isMeta Whether transport is "meta" or not (eg cxf) * @param requiredAddressAttributes A list of attribute names that are required if "address" * isn't present * @param requiredProperties A list of property names that are required if "address" isn't present */ public TransportGlobalEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, Class clazz, String[] requiredAddressAttributes, String[] requiredProperties) { super(metaOrProtocol, isMeta, new OrphanEndpointDefinitionParser(clazz), requiredAddressAttributes, requiredProperties); } public TransportGlobalEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, String[] endpointAttributes, String[][] requiredAddressAttributes, String[][] requiredProperties) { this(metaOrProtocol, isMeta, URIBuilder.ALL_ATTRIBUTES, endpointAttributes, requiredAddressAttributes, requiredProperties); } public TransportGlobalEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, String[] endpointAttributes, String[] addressAttributes, String[][] requiredAddressAttributes, String[][] requiredProperties) { super(metaOrProtocol, isMeta, new OrphanEndpointDefinitionParser(EndpointURIEndpointBuilder.class), addressAttributes, endpointAttributes, requiredAddressAttributes, requiredProperties); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/support/mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/supp0000755000175000017500000000000011351411145033441 5ustar charlescharles././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/support/EndpointUtils.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/supp0000644000175000017500000000615510745726444033473 0ustar charlescharles/* * $Id: EndpointUtils.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint.support; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.PostProcessor; import org.mule.util.StringUtils; import org.w3c.dom.Element; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.xml.ParserContext; /** * Routines and constants common to the two endpoint definition parsers. * * @see ChildEndpointDefinitionParser * @see OrphanEndpointDefinitionParser */ public class EndpointUtils { private static Log logger = LogFactory.getLog(EndpointUtils.class); public static final String CONNECTOR_ATTRIBUTE = "connector-ref"; public static final String TRANSFORMERS_ATTRIBUTE = "transformer-refs"; public static final String URI_BUILDER_ATTRIBUTE = "URIBuilder"; public static final String ADDRESS_ATTRIBUTE = "address"; private static void processTransformerDependencies(BeanAssembler assembler, Element element) { if (StringUtils.isNotBlank(element.getAttribute(TRANSFORMERS_ATTRIBUTE))) { String[] trans = StringUtils.split(element.getAttribute(TRANSFORMERS_ATTRIBUTE), " ,;"); for (int i = 0; i < trans.length; i++) { String ref = trans[i]; if (logger.isDebugEnabled()) { logger.debug("transformer dep: " + ref); } assembler.getBean().addDependsOn(ref); } } } private static void processConnectorDependency(BeanAssembler assembler, Element element) { if (StringUtils.isNotBlank(element.getAttribute(CONNECTOR_ATTRIBUTE))) { String ref = element.getAttribute(CONNECTOR_ATTRIBUTE); if (logger.isDebugEnabled()) { logger.debug("connector dep: " + ref); } assembler.getBean().addDependsOn(ref); } } public static void addPostProcess(MuleDefinitionParser parser) { parser.registerPostProcessor(new PostProcessor() { public void postProcess(ParserContext unused, BeanAssembler assembler, Element element) { EndpointUtils.processConnectorDependency(assembler, element); EndpointUtils.processTransformerDependencies(assembler, element); } }); } public static void addProperties(MuleDefinitionParser parser) { parser.addAlias(ADDRESS_ATTRIBUTE, URI_BUILDER_ATTRIBUTE); parser.addMapping("createConnector", "GET_OR_CREATE=0,ALWAYS_CREATE=1,NEVER_CREATE=2"); } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/support/AddressedEndpointDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/supp0000644000175000017500000002255410766204322033461 0ustar charlescharles/* * $Id:AddressedEndpointDefinitionParser.java 8321 2007-09-10 19:22:52Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint.support; import org.mule.api.config.MuleProperties; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.MuleChildDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.delegate.AbstractSingleParentFamilyDefinitionParser; import org.mule.config.spring.parsers.generic.AttributePropertiesDefinitionParser; import org.mule.config.spring.parsers.processors.BlockAttribute; import org.mule.config.spring.parsers.processors.CheckExclusiveAttributes; import org.mule.config.spring.parsers.processors.CheckRequiredAttributes; import org.mule.endpoint.AbstractEndpointBuilder; import org.mule.endpoint.URIBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Combine a * {@link org.mule.config.spring.parsers.specific.endpoint.support.ChildAddressDefinitionParser} and * either a * {@link org.mule.config.spring.parsers.specific.endpoint.support.OrphanEndpointDefinitionParser} * or a * {@link org.mule.config.spring.parsers.specific.endpoint.support.ChildEndpointDefinitionParser} * in one parser. This lets us put the address attributes in the endpoint element. */ public class AddressedEndpointDefinitionParser extends AbstractSingleParentFamilyDefinitionParser { protected Log logger = LogFactory.getLog(getClass()); public static final boolean META = ChildAddressDefinitionParser.META; public static final boolean PROTOCOL = ChildAddressDefinitionParser.PROTOCOL; public static final String PROPERTIES = "properties"; public static final String[] RESTRICTED_ENDPOINT_ATTRIBUTES = new String[]{MuleProperties.SYNCHRONOUS_PROPERTY, AbstractEndpointBuilder.PROPERTY_REMOTE_SYNC, AbstractEndpointBuilder.PROPERTY_REMOTE_SYNC_TIMEOUT, "encoding", "connector", "createConnector", "transformer", "responseTransformer"}; // this is an example of parsing a single element with several parsers. in this case // (because we extend AbstractSingleParentFamilyDefinitionParser) the first parser is expected to // create the "parent". then subsequent parsers will be called as children. // because all are generated from one element we need to be careful to block attributes // that are irrelevant to a particular parser. public AddressedEndpointDefinitionParser(String protocol, MuleDefinitionParser endpointParser) { this(protocol, PROTOCOL, endpointParser); } public AddressedEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, MuleDefinitionParser endpointParser) { this(metaOrProtocol, isMeta, endpointParser, new String[]{}, new String[]{}); } public AddressedEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, MuleDefinitionParser endpointParser, String[] requiredAddressAttributes, String[] requiredProperties) { this(metaOrProtocol, isMeta, endpointParser, RESTRICTED_ENDPOINT_ATTRIBUTES, URIBuilder.ALL_ATTRIBUTES, new String[][]{requiredAddressAttributes}, new String[][]{requiredProperties}); } /** * @param metaOrProtocol The transport metaOrProtocol ("tcp" etc) * @param isMeta Whether transport is "meta" or not (eg cxf) * @param endpointParser The parser for the endpoint * @param endpointAttributes A list of attribute names which will be set as properties on the * endpoint builder * @param addressAttributes A list of attribute names which will be set as properties on the * endpoint URI builder * @param requiredAddressAttributes A list of attribute names that are required if "address" * isn't present * @param requiredProperties A list of property names that are required if "address" isn't present */ public AddressedEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, MuleDefinitionParser endpointParser, String[] endpointAttributes, String[] addressAttributes, String[][] requiredAddressAttributes, String[][] requiredProperties) { // the first delegate, the parent, is an endpoint; we block everything except the endpoint attributes enableAttributes(endpointParser, endpointAttributes); enableAttribute(endpointParser, AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); addDelegate(endpointParser); // we handle the address and properties separately, setting the // properties directly on the endpoint (rather than as part of the address) MuleChildDefinitionParser addressParser = new AddressParser(metaOrProtocol, isMeta, addressAttributes, requiredAddressAttributes); // this handles the exception thrown if a ref is found in the address parser addHandledException(BlockAttribute.BlockAttributeException.class); addChildDelegate(addressParser); MuleChildDefinitionParser propertiesParser = new PropertiesParser(PROPERTIES, endpointAttributes, requiredAddressAttributes, requiredProperties); addChildDelegate(propertiesParser); } private static class AddressParser extends ChildAddressDefinitionParser { public AddressParser(String metaOrProtocol, boolean isMeta, String[] addressAttributes, String[][] requiredAddressAttributes) { super(metaOrProtocol, isMeta); // this handles the "ref problem" - we don't want this parsers to be used if a "ref" // defines the address so add a preprocessor to check for that and indicate that the // exception should be handled internally, rather than shown to the user. // we do this before the extra processors below so that this is called last, // allowing other processors to check for conflicts between ref and other attributes registerPreProcessor(new BlockAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF)); // the address parser sees only the endpoint attributes enableAttributes(this, addressAttributes); // we require either a reference, an address, or the attributes specified // (properties can be used in parallel with "address") String[][] addressAttributeSets = new String[(null != requiredAddressAttributes ? requiredAddressAttributes.length : 0) + 2][]; addressAttributeSets[0] = new String[]{URIBuilder.ADDRESS}; addressAttributeSets[1] = new String[]{AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF}; if (null != requiredAddressAttributes) { enableAttributes(this, requiredAddressAttributes); System.arraycopy(requiredAddressAttributes, 0, addressAttributeSets, 2, requiredAddressAttributes.length); } registerPreProcessor(new CheckRequiredAttributes(addressAttributeSets)); // and they must be exclusive registerPreProcessor(new CheckExclusiveAttributes(addressAttributeSets)); } } private static class PropertiesParser extends AttributePropertiesDefinitionParser { public PropertiesParser(String setter, String[] endpointAttributes, String[][] requiredAddressAttributes, String[][] requiredProperties) { super(setter); // the properties parser gets to see everything that the other parsers don't - if you // don't want something, don't enable it in the schema! disableAttributes(this, endpointAttributes); disableAttributes(this, URIBuilder.ALL_ATTRIBUTES); disableAttributes(this, requiredAddressAttributes); disableAttribute(this, AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); disableAttribute(this, AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF); if (null != requiredProperties && requiredProperties.length > 0 && null != requiredProperties[0] && requiredProperties[0].length > 0) { // if "ref" is present then we don't complain if required properties are missing, since they // must have been provided on the global endpoint String[][] requiredPropertiesSets = new String[requiredProperties.length + 1][]; requiredPropertiesSets[0] = new String[]{AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF}; System.arraycopy(requiredProperties, 0, requiredPropertiesSets, 1, requiredProperties.length); registerPreProcessor(new CheckRequiredAttributes(requiredPropertiesSets)); } } } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/support/OrphanAddressDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/supp0000644000175000017500000000231410745677442033467 0ustar charlescharles/* * $Id: OrphanAddressDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint.support; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; import org.mule.config.spring.parsers.processors.AddAttribute; import org.mule.endpoint.URIBuilder; /** * Generate an Endpoint URI from simple address components. */ public class OrphanAddressDefinitionParser extends OrphanDefinitionParser { public static final boolean META = true; public static final boolean PROTOCOL = false; public OrphanAddressDefinitionParser(String metaOrProtocol, boolean isMeta) { super(URIBuilder.class, true); registerPreProcessor( new AddAttribute( isMeta ? URIBuilder.META : URIBuilder.PROTOCOL, metaOrProtocol)); } }././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/support/ChildAddressDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/supp0000644000175000017500000000251510745677442033472 0ustar charlescharles/* * $Id:ChildAddressDefinitionParser.java 8321 2007-09-10 19:22:52Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint.support; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.processors.AddAttribute; import org.mule.endpoint.URIBuilder; /** * Generate an Endpoint URI from simple address components. */ public class ChildAddressDefinitionParser extends ChildDefinitionParser { public static final boolean META = true; public static final boolean PROTOCOL = false; public ChildAddressDefinitionParser(String protocol) { this(protocol, PROTOCOL); } public ChildAddressDefinitionParser(String metaOrProtocol, boolean isMeta) { super(EndpointUtils.URI_BUILDER_ATTRIBUTE, URIBuilder.class); registerPreProcessor( new AddAttribute( isMeta ? URIBuilder.META : URIBuilder.PROTOCOL, metaOrProtocol)); } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/support/OrphanEndpointDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/supp0000644000175000017500000000256210740712271033455 0ustar charlescharles/* * $Id: OrphanEndpointDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint.support; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; /** * A parser for "orphan" (top-level) endpoints - ie GlobalEndpoints. * Because we have automatic String -> MuleEnpointURI conversion via property editors * this can be used in a variety of ways. It should work directly with a simple String * address attribute or, in combination with a child element (handled by * {@link ChildAddressDefinitionParser}, * or embedded in * {@link AddressedEndpointDefinitionParser} * for a more compact single-element approach. * *

This class does not support references to other endpoints.

*/ public class OrphanEndpointDefinitionParser extends OrphanDefinitionParser { public OrphanEndpointDefinitionParser(Class endpoint) { super(endpoint, false); EndpointUtils.addProperties(this); EndpointUtils.addPostProcess(this); } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/support/ChildEndpointDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/supp0000644000175000017500000000643310776757700033475 0ustar charlescharles/* * $Id: ChildEndpointDefinitionParser.java 11544 2008-04-08 21:12:32Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint.support; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.generic.AutoIdUtils; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.util.StringUtils; import org.mule.endpoint.AbstractEndpointBuilder; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * A parser for "embedded" endpoints - ie inbound, outbound and response endpoints. * Because we have automatic String -> MuleEnpointURI conversion via property editors * this can be used in a variety of ways. It should work directly with a simple String * address attribute or, in combination with a child element (handled by * {@link ChildAddressDefinitionParser}, * or embedded in * {@link AddressedEndpointDefinitionParser} * for a more compact single-element approach. * *

This class does support references to other endpoints.

* TODO - check that references are global! */ public class ChildEndpointDefinitionParser extends ChildDefinitionParser { public ChildEndpointDefinitionParser(Class endpoint) { super("endpoint", endpoint); addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF); EndpointUtils.addProperties(this); EndpointUtils.addPostProcess(this); } // @Override public BeanDefinitionBuilder createBeanDefinitionBuilder(Element element, Class beanClass) { BeanDefinitionBuilder builder = super.createBeanDefinitionBuilder(element, beanClass); String global = element.getAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF); if (StringUtils.isNotBlank(global)) { builder.addConstructorArgReference(global); builder.addDependsOn(global); } return builder; } // @Override public String getBeanName(Element element) { if (null != element.getAttributeNode(AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF)) { return AutoIdUtils.uniqueValue("ref:" + element.getAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF)); } else { return super.getBeanName(element); } } //@Override protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { // Not sure if this is required. Adding for now for backwards compatability if (element.getParentNode().getNodeName().equals("chaining-router") || element.getParentNode().getNodeName().equals("exception-based-router")) { builder.addPropertyValue(AbstractEndpointBuilder.PROPERTY_REMOTE_SYNC, Boolean.TRUE); } super.parseChild(element, parserContext, builder); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/EndpointRefParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/Endp0000644000175000017500000000400011004137577033345 0ustar charlescharles/* * $Id: EndpointRefParser.java 11642 2008-04-24 17:12:31Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.mule.config.spring.parsers.processors.CheckExclusiveAttributes; import org.mule.util.StringUtils; import org.springframework.beans.factory.BeanCreationException; import org.w3c.dom.Element; /** * Configures a reference to an endpoint on a parent bean. This is typically used in configuration * where a reference to the actual endpoint is not wanted (i.e. Reply-To endpoints should be set as a string * on a message). * * Note that endpoint Reference elements should always have an 'address' and 'ref' attributes available. These * are mutually exclusive. * * Any other attributes on the element processed by this parser will also be set on the parent object. */ public class EndpointRefParser extends ParentDefinitionParser { public EndpointRefParser(String propertyName) { addAlias("address", propertyName); addAlias("ref", propertyName); addAlias("reference", propertyName); registerPreProcessor(new CheckExclusiveAttributes(new String[][]{new String[]{"ref"}, new String[]{"address"}})); } //@Override protected void preProcess(Element element) { //This causes the Bean framework to process the "ref" as a string rather than a ref to another object if(StringUtils.isNotEmpty(element.getAttribute("ref"))) { element.setAttribute("reference", element.getAttribute("ref")); element.removeAttribute("ref"); } super.preProcess(element); } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/GenericGlobalEndpointDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/Gene0000644000175000017500000000153710745677442033364 0ustar charlescharles/* * $Id: GenericGlobalEndpointDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint; import org.mule.config.spring.parsers.specific.endpoint.support.OrphanEndpointDefinitionParser; import org.mule.endpoint.EndpointURIEndpointBuilder; public class GenericGlobalEndpointDefinitionParser extends OrphanEndpointDefinitionParser { public GenericGlobalEndpointDefinitionParser() { super(EndpointURIEndpointBuilder.class); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/GenericEndpointDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/Gene0000644000175000017500000000141210740712271033335 0ustar charlescharles/* * $Id:GenericEndpointDefinitionParser.java 8321 2007-09-10 19:22:52Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint; import org.mule.config.spring.parsers.specific.endpoint.support.ChildEndpointDefinitionParser; public class GenericEndpointDefinitionParser extends ChildEndpointDefinitionParser { public GenericEndpointDefinitionParser(Class endpoint) { super(endpoint); } } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/EndpointPropertyElementDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/endpoint/Endp0000644000175000017500000000403711003247564033354 0ustar charlescharles/* * $Id: EndpointPropertyElementDefinitionParser.java 11620 2008-04-22 02:37:40Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.endpoint; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.assembly.MapEntryCombiner; import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser; import org.mule.config.spring.parsers.delegate.AbstractSingleParentFamilyChildDefinitionParser; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.processors.AddAttribute; /** * This parser parses nested endpoint elements adding the resulting beans to the map * of properties on the EndpointBuilder rather than attempting to inject them on the * EndpointBuilder itself. */ public class EndpointPropertyElementDefinitionParser extends AbstractSingleParentFamilyChildDefinitionParser { public static final String ENDPOINT_PROPERTIES_ATTRIBUTE = "properties"; public EndpointPropertyElementDefinitionParser(String propertyKey, Class beanClass) { setReturnFirstResult(false); addDelegate(new ChildSingletonMapDefinitionParser(ENDPOINT_PROPERTIES_ATTRIBUTE)).registerPreProcessor( new AddAttribute(MapEntryCombiner.KEY, propertyKey)) .addCollection(ENDPOINT_PROPERTIES_ATTRIBUTE) .setIgnoredDefault(true) .removeIgnored(MapEntryCombiner.KEY) .addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); addChildDelegate(new ChildDefinitionParser(MapEntryCombiner.VALUE, beanClass)).addIgnored( AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME).addIgnored(MapEntryCombiner.KEY); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ExceptionTXFilterDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ExceptionTXFi0000644000175000017500000000203310770773146033343 0ustar charlescharles/* * $Id: ExceptionTXFilterDefinitionParser.java 11468 2008-03-21 17:54:46Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.routing.filters.WildcardFilter; /** * TODO */ public class ExceptionTXFilterDefinitionParser extends ChildDefinitionParser { /** * The class will be inferred from the class attribute * * @param setterMethod The target method (where the child will be injected) */ public ExceptionTXFilterDefinitionParser(String setterMethod) { super(setterMethod, WildcardFilter.class); addAlias("exception-pattern", "pattern"); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ConfigurationChildDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/Configuration0000644000175000017500000000326410745677442033474 0ustar charlescharles/* * $Id: ConfigurationChildDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.config.MuleProperties; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.w3c.dom.Element; /** * Extend {@link org.mule.config.spring.parsers.generic.ChildDefinitionParser} to include * logic for identifying parent configuration element (since this only applies to "default" * elements there's an ugliness here - contradicitions (non-default children of configuration) * are avoided by the mule.xsd schema). */ public class ConfigurationChildDefinitionParser extends ChildDefinitionParser { /** Name of the mule:configuration element **/ public static final String CONFIGURATION = "configuration"; public ConfigurationChildDefinitionParser(String setterMethod, Class clazz) { super(setterMethod, clazz); } protected String getParentBeanName(Element element) { //The mule:configuration element is a fixed name element so we need to handle the //special case here if (CONFIGURATION.equals(element.getParentNode().getLocalName())) { return MuleProperties.OBJECT_MULE_CONFIGURATION; } else { return super.getParentBeanName(element); } } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/RouterDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/RouterDefinit0000644000175000017500000000241310776710212033426 0ustar charlescharles/* * $Id: RouterDefinitionParser.java 11531 2008-04-08 15:34:34Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.routing.inbound.AbstractEventAggregator; /** * Generic router definition parser for parsing all Router elements. */ public class RouterDefinitionParser extends ChildDefinitionParser { public static final String ROUTER = "router"; public RouterDefinitionParser(Class clazz) { super(ROUTER, clazz); standardOptions(); } // specifically for subclasses of CorrelationAggregator (requires a "class=..." in the config) public RouterDefinitionParser() { super(ROUTER, null, AbstractEventAggregator.class, true); standardOptions(); } protected void standardOptions() { addMapping("enableCorrelation", "IF_NOT_SET=0,ALWAYS=1,NEVER=2"); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ComponentDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ComponentDefi0000644000175000017500000000264310766654216033414 0ustar charlescharles/* * $Id: ComponentDefinitionParser.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; public class ComponentDefinitionParser extends ChildDefinitionParser { public ComponentDefinitionParser(Class clazz) { super("component", clazz); this.singleton = true; addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS); } // @Override protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Element parent = (Element) element.getParentNode(); String serviceName = parent.getAttribute(ATTRIBUTE_NAME); builder.addPropertyReference("service", serviceName); super.parseChild(element, parserContext, builder); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/TransactionConfigDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/TransactionCo0000644000175000017500000000163410745677442033433 0ustar charlescharles/* * $Id:TransactionConfigDefinitionParser.java 5187 2007-02-16 18:00:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.transaction.MuleTransactionConfig; public class TransactionConfigDefinitionParser extends ChildDefinitionParser { public TransactionConfigDefinitionParser() { super("transactionConfig", MuleTransactionConfig.class); addMapping("action", "NONE=0,ALWAYS_BEGIN=1,BEGIN_OR_JOIN=2,ALWAYS_JOIN=3,JOIN_IF_POSSIBLE=4"); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ModelDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ModelDefiniti0000644000175000017500000000231510756614703033366 0ustar charlescharles/* * $Id: ModelDefinitionParser.java 10889 2008-02-19 18:02:43Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.delegate.InheritDefinitionParser; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; import org.mule.config.spring.parsers.generic.NamedDefinitionParser; import org.mule.config.spring.parsers.processors.ProvideDefaultName; import org.mule.model.seda.SedaModel; public class ModelDefinitionParser extends InheritDefinitionParser { public ModelDefinitionParser() { super(makeOrphan(), new NamedDefinitionParser()); } private static OrphanDefinitionParser makeOrphan() { OrphanDefinitionParser orphan = new OrphanDefinitionParser(SedaModel.class, true); orphan.registerPreProcessor(new ProvideDefaultName("model")); return orphan; } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/0000755000175000017500000000000011351411146033106 5ustar charlescharles././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/NestedMapDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/Ne0000644000175000017500000000353510745677442033424 0ustar charlescharles/* * $Id: NestedMapDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.properties; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.assembly.MapEntryCombiner; import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser; import org.mule.config.spring.parsers.delegate.AbstractSingleParentFamilyDefinitionParser; import org.mule.config.spring.parsers.processors.AddAttribute; /** * This extends a map that is itself a property (with key mapKey). It does not have any * container element. */ public class NestedMapDefinitionParser extends AbstractSingleParentFamilyDefinitionParser { // we use this so that "key" can be used as the attribute name! public static final String HIDDEN_KEY = "hiddenKey"; public NestedMapDefinitionParser(String mapSetter, String mapKey) { addDelegate(new ChildSingletonMapDefinitionParser(mapSetter)) .registerPreProcessor(new AddAttribute(HIDDEN_KEY, mapKey)) .addCollection(mapSetter) .setIgnoredDefault(true) .addAlias(HIDDEN_KEY, MapEntryCombiner.KEY) .removeIgnored(HIDDEN_KEY) .addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); addChildDelegate(new SimplePropertyDefinitionParser()) .addIgnored(HIDDEN_KEY) .addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/SimplePropertyDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/Si0000644000175000017500000000241510745677442033431 0ustar charlescharles/* * $Id: SimplePropertyDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.properties; import org.mule.config.spring.parsers.assembly.MapEntryCombiner; import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser; import org.w3c.dom.Element; public class SimplePropertyDefinitionParser extends ChildSingletonMapDefinitionParser { public SimplePropertyDefinitionParser() { super(MapEntryCombiner.VALUE); } protected void preProcess(Element element) { super.preProcess(element); // this is crazy, but because we use a single property config for target and bean, and both // are the same, and target properties are transient, and we only want target value to be // a collection, we have to do this here! getTargetPropertyConfiguration().addCollection(MapEntryCombiner.VALUE); } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/NestedListDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/Ne0000644000175000017500000000453110745677442033421 0ustar charlescharles/* * $Id: NestedListDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.properties; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.assembly.MapEntryCombiner; import org.mule.config.spring.parsers.collection.ChildListEntryDefinitionParser; import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser; import org.mule.config.spring.parsers.delegate.AbstractSingleParentFamilyDefinitionParser; import org.mule.config.spring.parsers.processors.AddAttribute; /** * This extends a list that is itself a property (with key mapKey). It does not have any * container element. * * This could also be achieved with * new ChildSingletonMapDefinitionParser("properties") * .registerPreProcessor(new AddAttribute(MapEntryCombiner.KEY, "soap11Transports")) * .addCollection(MapEntryCombiner.VALUE) * .addCollection("properties"); * I think, but the following avoids worries about special attribute names. */ public class NestedListDefinitionParser extends AbstractSingleParentFamilyDefinitionParser { // we use this so that they can be used as the attribute name! public static final String HIDDEN_KEY = "hiddenKey"; public static final String HIDDEN_VALUE = "hiddenValue"; public NestedListDefinitionParser(String mapSetter, String mapKey, String attribute) { addDelegate(new ChildSingletonMapDefinitionParser(mapSetter)) .registerPreProcessor(new AddAttribute(HIDDEN_KEY, mapKey)) .addCollection(mapSetter) .setIgnoredDefault(true) .addAlias(HIDDEN_KEY, MapEntryCombiner.KEY) .removeIgnored(HIDDEN_KEY) .addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); addChildDelegate(new ChildListEntryDefinitionParser(HIDDEN_VALUE, attribute)) .addAlias(HIDDEN_VALUE, MapEntryCombiner.VALUE) .addCollection(HIDDEN_VALUE); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/ListPropertyDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/Li0000644000175000017500000000341010741221621033372 0ustar charlescharles/* * $Id: ListPropertyDefinitionParser.java 10268 2008-01-09 19:42:09Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.properties; import org.mule.config.spring.parsers.assembly.MapEntryCombiner; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.w3c.dom.Element; /** * This allows a child element to extends a list of values, via an attribute, on a parent setter. * Typically it is used with * {@link org.mule.config.spring.parsers.specific.properties.ElementInNestedMapDefinitionParser} * whose setter is {@link org.mule.config.spring.parsers.assembly.MapEntryCombiner#VALUE}. */ public class ListPropertyDefinitionParser extends ParentDefinitionParser { public ListPropertyDefinitionParser(String attribute) { this(MapEntryCombiner.VALUE, attribute); } /** * This method is to explain how things work. If you need to call it, then you also need to replace * override the class ({#link #getBeanClass}). * * @param setter * @param attribute */ protected ListPropertyDefinitionParser(String setter, String attribute) { setIgnoredDefault(true); removeIgnored(attribute); addCollection(attribute); if (!setter.equals(attribute)) { addAlias(attribute, setter); } } protected Class getBeanClass(Element element) { return MapEntryCombiner.class; } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/NestedMapWithAttributesDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/Ne0000644000175000017500000000426610745677442033426 0ustar charlescharles/* * $Id: NestedMapWithAttributesDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.properties; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.assembly.MapEntryCombiner; import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser; import org.mule.config.spring.parsers.delegate.AbstractSingleParentFamilyDefinitionParser; import org.mule.config.spring.parsers.generic.AttributePropertiesDefinitionParser; import org.mule.config.spring.parsers.processors.AddAttribute; /** * This generates a nested map (an element of the parent map, with the key "mapKey", which is a map itself) * and then adds any attributes as name/value pairs. Embedded elements can then insert further entries using * {@link org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser} or, if the entry is * just a simple value, {@link org.mule.config.spring.parsers.specific.properties.SimplePropertyDefinitionParser}. * The target setter is {@link org.mule.config.spring.parsers.assembly.MapEntryCombiner#VALUE}. */ public class NestedMapWithAttributesDefinitionParser extends AbstractSingleParentFamilyDefinitionParser { public NestedMapWithAttributesDefinitionParser(String mapSetter, String mapKey) { addDelegate(new ChildSingletonMapDefinitionParser(mapSetter)) .addCollection(mapSetter) .setIgnoredDefault(true) .removeIgnored(MapEntryCombiner.KEY) .registerPreProcessor(new AddAttribute(MapEntryCombiner.KEY, mapKey)); addChildDelegate(new AttributePropertiesDefinitionParser(MapEntryCombiner.VALUE)) .addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME) .addIgnored(MapEntryCombiner.KEY); } } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/ElementInNestedMapDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/properties/El0000644000175000017500000000415510745677442033421 0ustar charlescharles/* * $Id: ElementInNestedMapDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.properties; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.assembly.MapEntryCombiner; import org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser; import org.mule.config.spring.parsers.delegate.AbstractSingleParentFamilyDefinitionParser; import org.mule.config.spring.parsers.processors.AddAttribute; /** * This constructs a nested map - keyed by "mapKey" - and then adds an entry in that * named from the attribute "keyAttribute". Child elements can then set a value (or * values, if it is a collection) on {@link org.mule.config.spring.parsers.assembly.MapEntryCombiner#VALUE} */ public class ElementInNestedMapDefinitionParser extends AbstractSingleParentFamilyDefinitionParser { public ElementInNestedMapDefinitionParser(String mapSetter, String mapKey, String keyAttribute) { // children (parameters) want to append to the inner map, not the outer one setReturnFirstResult(false); addDelegate(new ChildSingletonMapDefinitionParser(mapSetter)) .registerPreProcessor(new AddAttribute(MapEntryCombiner.KEY, mapKey)) .addCollection(mapSetter) .setIgnoredDefault(true) .removeIgnored(MapEntryCombiner.KEY) .addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); addChildDelegate(new ChildSingletonMapDefinitionParser(MapEntryCombiner.VALUE)) .addAlias(keyAttribute, MapEntryCombiner.KEY) .addCollection(MapEntryCombiner.VALUE) .addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/NotificationDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/NotificationD0000644000175000017500000001510510771256706033407 0ustar charlescharles/* * $Id: NotificationDefinitionParser.java 11483 2008-03-22 19:28:06Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.context.notification.ConnectionNotificationListener; import org.mule.api.context.notification.CustomNotificationListener; import org.mule.api.context.notification.ExceptionNotificationListener; import org.mule.api.context.notification.ManagementNotificationListener; import org.mule.api.context.notification.MessageNotificationListener; import org.mule.api.context.notification.ModelNotificationListener; import org.mule.api.context.notification.MuleContextNotificationListener; import org.mule.api.context.notification.RegistryNotificationListener; import org.mule.api.context.notification.RoutingNotificationListener; import org.mule.api.context.notification.SecurityNotificationListener; import org.mule.api.context.notification.ServiceNotificationListener; import org.mule.api.context.notification.TransactionNotificationListener; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser; import org.mule.config.spring.parsers.processors.CheckExclusiveAttributes; import org.mule.config.spring.parsers.processors.CheckRequiredAttributes; import org.mule.context.notification.ConnectionNotification; import org.mule.context.notification.CustomNotification; import org.mule.context.notification.ExceptionNotification; import org.mule.context.notification.ManagementNotification; import org.mule.context.notification.MessageNotification; import org.mule.context.notification.ModelNotification; import org.mule.context.notification.MuleContextNotification; import org.mule.context.notification.RegistryNotification; import org.mule.context.notification.RoutingNotification; import org.mule.context.notification.SecurityNotification; import org.mule.context.notification.ServiceNotification; import org.mule.context.notification.TransactionNotification; import java.util.HashMap; import java.util.Map; import org.w3c.dom.Element; public class NotificationDefinitionParser extends ChildMapEntryDefinitionParser { public static final Map EVENT_MAP; public static final Map INTERFACE_MAP; public static final String INTERFACE = "interface"; public static final String INTERFACE_CLASS = "interface-class"; public static final String EVENT = "event"; public static final String EVENT_CLASS = "event-class"; public static final String[][] INTERFACE_ATTRIBUTES = new String[][]{new String[]{INTERFACE}, new String[]{INTERFACE_CLASS}}; public static final String[][] EVENT_ATTRIBUTES = new String[][]{new String[]{EVENT}, new String[]{EVENT_CLASS}}; public static final String[][] ALL_ATTRIBUTES = new String[][]{ new String[]{EVENT}, new String[]{EVENT_CLASS}, new String[]{INTERFACE}, new String[]{INTERFACE_CLASS}}; static { EVENT_MAP = new HashMap(); EVENT_MAP.put("MANAGER", MuleContextNotification.class.getName()); EVENT_MAP.put("MODEL", ModelNotification.class.getName()); EVENT_MAP.put("SERVICE", ServiceNotification.class.getName()); EVENT_MAP.put("SECURITY", SecurityNotification.class.getName()); EVENT_MAP.put("MANAGEMENT", ManagementNotification.class.getName()); EVENT_MAP.put("CONNECTION", ConnectionNotification.class.getName()); EVENT_MAP.put("REGISTRY", RegistryNotification.class.getName()); EVENT_MAP.put("CUSTOM", CustomNotification.class.getName()); EVENT_MAP.put("MESSAGE", MessageNotification.class.getName()); EVENT_MAP.put("EXCEPTION", ExceptionNotification.class.getName()); EVENT_MAP.put("TRANSACTION", TransactionNotification.class.getName()); EVENT_MAP.put("ROUTING", RoutingNotification.class.getName()); INTERFACE_MAP = new HashMap(); INTERFACE_MAP.put("MANAGER", MuleContextNotificationListener.class.getName()); INTERFACE_MAP.put("MODEL", ModelNotificationListener.class.getName()); INTERFACE_MAP.put("SERVICE", ServiceNotificationListener.class.getName()); INTERFACE_MAP.put("SECURITY", SecurityNotificationListener.class.getName()); INTERFACE_MAP.put("MANAGEMENT", ManagementNotificationListener.class.getName()); INTERFACE_MAP.put("CONNECTION", ConnectionNotificationListener.class.getName()); INTERFACE_MAP.put("REGISTRY", RegistryNotificationListener.class.getName()); INTERFACE_MAP.put("CUSTOM", CustomNotificationListener.class.getName()); INTERFACE_MAP.put("MESSAGE", MessageNotificationListener.class.getName()); INTERFACE_MAP.put("EXCEPTION", ExceptionNotificationListener.class.getName()); INTERFACE_MAP.put("TRANSACTION", TransactionNotificationListener.class.getName()); INTERFACE_MAP.put("ROUTING", RoutingNotificationListener.class.getName()); } public NotificationDefinitionParser() { super("interfaceToType", INTERFACE_CLASS, EVENT_CLASS); addMapping(EVENT, EVENT_MAP); addAlias(EVENT, VALUE); addMapping(INTERFACE, INTERFACE_MAP); addAlias(INTERFACE, KEY); registerPreProcessor(new CheckExclusiveAttributes(INTERFACE_ATTRIBUTES)); registerPreProcessor(new CheckExclusiveAttributes(EVENT_ATTRIBUTES)); registerPreProcessor(new CheckRequiredAttributes(INTERFACE_ATTRIBUTES)); registerPreProcessor(new CheckRequiredAttributes(EVENT_ATTRIBUTES)); registerPreProcessor(new SetDefaults()); } /** * If only one of event or interface is set, use it as default for the other */ private class SetDefaults implements PreProcessor { public void preProcess(PropertyConfiguration config, Element element) { copy(element, INTERFACE, EVENT, EVENT_CLASS); copy(element, EVENT, INTERFACE, INTERFACE_CLASS); } private void copy(Element element, String from, String to, String blocker) { if (element.hasAttribute(from) && !element.hasAttribute(to) && !element.hasAttribute(blocker)) { element.setAttribute(to, element.getAttribute(from)); } } } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/AgentDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/AgentDefiniti0000644000175000017500000000176010757023422033360 0ustar charlescharles/* * $Id: AgentDefinitionParser.java 10901 2008-02-20 13:11:46Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; import org.mule.config.spring.parsers.processors.ProvideDefaultNameFromElement; public class AgentDefinitionParser extends MuleOrphanDefinitionParser { public AgentDefinitionParser() { super(true); registerPreProcessor(new ProvideDefaultNameFromElement()); } public AgentDefinitionParser(Class beanClass) { super(beanClass, true); registerPreProcessor(new ProvideDefaultNameFromElement()); } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/tls/0000755000175000017500000000000011351411145031513 5ustar charlescharles././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/tls/KeyStoreDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/tls/KeyStoreD0000644000175000017500000000173110763766522033333 0ustar charlescharles/* * $Id: KeyStoreDefinitionParser.java 11202 2008-03-06 13:10:42Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.tls; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; public class KeyStoreDefinitionParser extends ParentDefinitionParser { public KeyStoreDefinitionParser() { addAlias("path", "keyStore"); addAlias(AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS, "keyStoreType"); addAlias("storePassword", "keyStorePassword"); addAlias("algorithm", "keyManagerAlgorithm"); } }././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/tls/ClientKeyStoreDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/tls/ClientKey0000644000175000017500000000171010763766522033346 0ustar charlescharles/* * $Id: ClientKeyStoreDefinitionParser.java 11202 2008-03-06 13:10:42Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.tls; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; public class ClientKeyStoreDefinitionParser extends ParentDefinitionParser { public ClientKeyStoreDefinitionParser() { addAlias("path", "clientKeyStore"); addAlias("storePassword", "clientKeyStorePassword"); addAlias(AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS, "clientKeyStoreType"); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/tls/ProtocolHandlerDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/tls/ProtocolH0000644000175000017500000000136410770356575033376 0ustar charlescharles/* * $Id: ProtocolHandlerDefinitionParser.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.tls; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; public class ProtocolHandlerDefinitionParser extends ParentDefinitionParser { public ProtocolHandlerDefinitionParser() { addAlias("property", "protocolHandler"); } }././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/tls/TrustStoreDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/tls/TrustStor0000644000175000017500000000221010763766522033444 0ustar charlescharles/* * $Id: TrustStoreDefinitionParser.java 11202 2008-03-06 13:10:42Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific.tls; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; public class TrustStoreDefinitionParser extends ParentDefinitionParser { public TrustStoreDefinitionParser() { addAlias("path", "trustStore"); addAlias("storePassword", "trustStorePassword"); // these used by server trust store type addAlias(AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS, "trustStoreType"); addAlias("algorithm", "trustManagerAlgorithm"); addAlias("factory", "trustManagerFactory"); addAlias("explicitOnly", "explicitTrustStoreOnly"); } }././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/GlobalPropertyDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/GlobalPropert0000644000175000017500000000324610770767514033437 0ustar charlescharles/* * $Id: GlobalPropertyDefinitionParser.java 11463 2008-03-21 17:24:28Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; import org.springframework.util.SystemPropertyUtils; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; public class GlobalPropertyDefinitionParser extends MuleOrphanDefinitionParser { private final String VALUE_ATTR = "value"; private final String NAME_ATTR = "name"; public GlobalPropertyDefinitionParser() { super(true); addIgnored(NAME_ATTR); addIgnored(VALUE_ATTR); } protected Class getBeanClass(Element element) { return String.class; } protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { String name = element.getAttribute(NAME_ATTR); if(name.indexOf(' ') != -1) { logger.warn("Environment property name should not contain spaces: \"" + name + "\""); } String value = element.getAttribute(VALUE_ATTR); assembler.getBean().addConstructorArg(SystemPropertyUtils.resolvePlaceholders(value)); super.postProcess(context, assembler, element); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ComponentDelegatingDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ComponentDele0000644000175000017500000001302010767355640033405 0ustar charlescharles/* * $Id: ComponentDelegatingDefinitionParser.java 11379 2008-03-17 02:46:56Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.delegate.AbstractParallelDelegatingDefinitionParser; import org.mule.config.spring.util.SpringXMLUtils; import org.mule.util.StringUtils; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; /** * Allows for parsing either a shortcut component configuration by delegating to two * different component parses depending on the existence of the class attribute. If * the class attribute is used then an embedded object factory element cannot be * used. * *
 * <component class="">
 * 
* * or one with an embedded object factory element. * *
 * <component>
 *     <singleon-object class=".."/>
 * </component>
 * 
*/ public class ComponentDelegatingDefinitionParser extends AbstractParallelDelegatingDefinitionParser { private MuleDefinitionParser normalConfig; private MuleDefinitionParser shortcutConfig; public ComponentDelegatingDefinitionParser(Class clazz) { normalConfig = new ComponentDefinitionParser(clazz); shortcutConfig = new ShortcutComponentDefinitionParser(clazz); addDelegate(normalConfig); addDelegate(shortcutConfig); registerPreProcessor(new CheckExclusiveClassAttributeObjectFactory()); } protected MuleDefinitionParser getDelegate(Element element, ParserContext parserContext) { if (StringUtils.isEmpty(element.getAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS))) { return normalConfig; } else { return shortcutConfig; } } /** * Given that the service object-factory is extensible and new object factory * types can be implemented and used by substitution, the only extensible way of * checking for the existence of an object-factory child element is by exclusion.
* This pre-processor checks for the existence of a "class" attribute on * the service, and throws an exception if the service has any child elements * that are not binding's. */ class CheckExclusiveClassAttributeObjectFactory implements PreProcessor { private static final String BINDING_CHILD_ELEMENT = "binding"; private static final String POOLING_PROFILE_CHILD_ELEMENT = "pooling-profile"; private static final String LIFECYCLE_ADAPTER_FACTORT_CHILD_ELEMENT = "lifecycle-adapter-factory"; private static final String ENTRY_POINT_RESOLVER_CHILD_ELEMENT = "entry-point-resolver"; private static final String ENTRY_POINT_RESOLVER_SET_CHILD_ELEMENT = "entry-point-resolver-set"; public void preProcess(PropertyConfiguration config, Element element) { NamedNodeMap attributes = element.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { String alias = SpringXMLUtils.attributeName((Attr) attributes.item(i)); if (alias.equals(AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS)) { for (int j = 0; j < element.getChildNodes().getLength(); j++) { Node child = element.getChildNodes().item(j); if (child instanceof Element && !(child.getLocalName().equals(BINDING_CHILD_ELEMENT) || child.getLocalName().equals(POOLING_PROFILE_CHILD_ELEMENT) || child.getLocalName().equals(ENTRY_POINT_RESOLVER_CHILD_ELEMENT) || child.getLocalName().equals(ENTRY_POINT_RESOLVER_SET_CHILD_ELEMENT) || child.getLocalName() .endsWith(LIFECYCLE_ADAPTER_FACTORT_CHILD_ELEMENT))) { StringBuffer message = new StringBuffer("The child element '"); message.append(child.getLocalName()); message.append("' cannot appear with the 'class' attribute"); message.append(" in element "); message.append(SpringXMLUtils.elementToString(element)); message.append("."); throw new CheckExclusiveClassAttributeObjectFactoryException(message.toString()); } } } } } } class CheckExclusiveClassAttributeObjectFactoryException extends IllegalStateException { private static final long serialVersionUID = 4625276914151932111L; private CheckExclusiveClassAttributeObjectFactoryException(String message) { super(message); } } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ConnectionStrategyDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ConnectionStr0000644000175000017500000000265710745677442033462 0ustar charlescharles/* * $Id: ConnectionStrategyDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.transport.ConnectionStrategy; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.transport.SimpleRetryConnectionStrategy; /** * Handles the parsing of , , * elements in Mule Xml configuration. */ public class ConnectionStrategyDefinitionParser extends ChildDefinitionParser { public static final Class DEFAULT_CONNECTION_STRATEGY = SimpleRetryConnectionStrategy.class; public ConnectionStrategyDefinitionParser(String propertyName) { super(propertyName, DEFAULT_CONNECTION_STRATEGY, ConnectionStrategy.class, true); } /** * Default connection strategies are available in the registry, but have n0 parent */ public ConnectionStrategyDefinitionParser() { super(null, DEFAULT_CONNECTION_STRATEGY, ConnectionStrategy.class, true); } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ServiceOverridesDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ServiceOverri0000644000175000017500000000530110757033446033437 0ustar charlescharles/* * $Id: ServiceOverridesDefinitionParser.java 10904 2008-02-20 14:20:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.config.MuleProperties; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.util.StringUtils; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Sets a Map of service overrides on the parent connector */ public class ServiceOverridesDefinitionParser extends ChildDefinitionParser { public ServiceOverridesDefinitionParser() { super("serviceOverrides", HashMap.class); } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Map overrides = new HashMap(); addOverride(overrides, element, "messageReceiver", MuleProperties.CONNECTOR_MESSAGE_RECEIVER_CLASS); addOverride(overrides, element, "transactedMessageReceiver", MuleProperties.CONNECTOR_TRANSACTED_MESSAGE_RECEIVER_CLASS); addOverride(overrides, element, "dispatcherFactory", MuleProperties.CONNECTOR_DISPATCHER_FACTORY); addOverride(overrides, element, "messageAdapter", MuleProperties.CONNECTOR_MESSAGE_ADAPTER); addOverride(overrides, element, "inboundTransformer", MuleProperties.CONNECTOR_INBOUND_TRANSFORMER); addOverride(overrides, element, "outboundTransformer", MuleProperties.CONNECTOR_OUTBOUND_TRANSFORMER); addOverride(overrides, element, "responseTransformer", MuleProperties.CONNECTOR_RESPONSE_TRANSFORMER); addOverride(overrides, element, "endpointBuilder", MuleProperties.CONNECTOR_ENDPOINT_BUILDER); addOverride(overrides, element, "serviceFinder", MuleProperties.SERVICE_FINDER); addOverride(overrides, element, "sessionHandler", MuleProperties.CONNECTOR_SESSION_HANDLER); builder.setSource(overrides); getBeanAssembler(element, builder).extendTarget(getPropertyName(element), overrides, false); } protected void addOverride(Map overrides, Element e, String attributeName, String overrideName) { String value = e.getAttribute(attributeName); if (!StringUtils.isBlank(value)) { overrides.put(overrideName, value); } } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ObjectFactoryWrapper.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ObjectFactory0000644000175000017500000000416010745726444033414 0ustar charlescharles/* * $Id: ObjectFactoryWrapper.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Use this BeanDefinitionParser when you need a "wrapper" element for an ObjectFactory. * For example, suppose we have the following class: * * class Car * { * private ObjectFactory wheel; * } * * The following registration in the namespace: * * registerBeanDefinitionParser("wheel", new ObjectFactoryWrapper("wheel")); * * would allow a config such as: * * * * * * * * * * * */ public class ObjectFactoryWrapper extends ParentDefinitionParser { public static final String OBJECT_FACTORY_SETTER = "objectFactoryPropertyName"; private String objectFactoryPropertyName; public ObjectFactoryWrapper(String objectFactoryPropertyName) { super(); this.objectFactoryPropertyName = objectFactoryPropertyName; } protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { super.postProcess(context, assembler, element); BeanDefinition parent = getParentBeanDefinition(element); parent.setAttribute(OBJECT_FACTORY_SETTER, objectFactoryPropertyName); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/TransactionManagerDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/TransactionMa0000644000175000017500000000207010745677442033422 0ustar charlescharles/* * $Id: TransactionManagerDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; public class TransactionManagerDefinitionParser extends MuleOrphanDefinitionParser { public TransactionManagerDefinitionParser() { super(true); setConstraints(); } public TransactionManagerDefinitionParser(Class clazz) { super(clazz, true); setConstraints(); } protected void setConstraints() { addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/BindingDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/BindingDefini0000644000175000017500000000245410776710212033341 0ustar charlescharles/* * $Id: BindingDefinitionParser.java 11531 2008-04-08 15:34:34Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.routing.inbound.AbstractEventAggregator; /** * Binding definition parser for parsing all binding elements configured as part of the service. */ public class BindingDefinitionParser extends ChildDefinitionParser { public BindingDefinitionParser(String setterMethod, Class clazz) { super(setterMethod, clazz); standardOptions(); } // specifically for subclasses of CorrelationAggregator (requires a "class=..." in the config) public BindingDefinitionParser(String setterMethod) { super(setterMethod, null, AbstractEventAggregator.class, true); standardOptions(); } protected void standardOptions() { addMapping("enableCorrelation", "IF_NOT_SET=0,ALWAYS=1,NEVER=2"); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/SimpleComponentDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/SimpleCompone0000644000175000017500000000622510767256152033432 0ustar charlescharles/* * $Id: SimpleComponentDefinitionParser.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.component.DefaultJavaComponent; import org.mule.object.AbstractObjectFactory; import org.mule.object.SingletonObjectFactory; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.GenericBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Used to parse shortcut elements for simple built-in components such as * {@link org.mule.component.simple.BridgeComponent}, * {@link import org.mule.component.simple.EchoComponent} and * {@link import org.mule.component.simple.LogComponent}. This allows shortcuts like * for example <mule:bridge-service/> to be used instead of having to * use the <mule:service/> element and specify the class name (and * scope) for built-in components that don't require configuration.

This * DefinitionParser should only be used for state-less components.

In order * to further customize components and use serviceFactory properties the * <mule:service/> element should be used. */ public class SimpleComponentDefinitionParser extends ComponentDefinitionParser { private static Class OBJECT_FACTORY_TYPE = SingletonObjectFactory.class; private Class componentInstanceClass; public SimpleComponentDefinitionParser(Class component, Class componentInstanceClass) { super(DefaultJavaComponent.class); this.componentInstanceClass = componentInstanceClass; } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Element parent = (Element) element.getParentNode(); String serviceName = parent.getAttribute(ATTRIBUTE_NAME); builder.addPropertyReference("service", serviceName); // Create a BeanDefinition for the nested object factory and set it a // property value for the component AbstractBeanDefinition objectFactoryBeanDefinition = new GenericBeanDefinition(); objectFactoryBeanDefinition.setBeanClass(OBJECT_FACTORY_TYPE); objectFactoryBeanDefinition.getPropertyValues().addPropertyValue(AbstractObjectFactory.ATTRIBUTE_OBJECT_CLASS, componentInstanceClass); objectFactoryBeanDefinition.setInitMethodName(Initialisable.PHASE_NAME); objectFactoryBeanDefinition.setDestroyMethodName(Disposable.PHASE_NAME); builder.addPropertyValue("objectFactory", objectFactoryBeanDefinition); super.parseChild(element, parserContext, builder); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ShortcutComponentDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/ShortcutCompo0000644000175000017500000000435610767256152033474 0ustar charlescharles/* * $Id: ShortcutComponentDefinitionParser.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.object.AbstractObjectFactory; import org.mule.object.PrototypeObjectFactory; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.GenericBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; public class ShortcutComponentDefinitionParser extends ComponentDefinitionParser { private static Class OBJECT_FACTORY_TYPE = PrototypeObjectFactory.class; public ShortcutComponentDefinitionParser(Class clazz) { super(clazz); } // @Override protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Element parent = (Element) element.getParentNode(); String serviceName = parent.getAttribute(ATTRIBUTE_NAME); builder.addPropertyReference("service", serviceName); String className = element.getAttributeNode(AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS).getValue(); GenericBeanDefinition objectFactoryBeanDefinition = new GenericBeanDefinition(); objectFactoryBeanDefinition.setBeanClass(OBJECT_FACTORY_TYPE); objectFactoryBeanDefinition.getPropertyValues().addPropertyValue( AbstractObjectFactory.ATTRIBUTE_OBJECT_CLASS_NAME, className); objectFactoryBeanDefinition.setInitMethodName(Initialisable.PHASE_NAME); objectFactoryBeanDefinition.setDestroyMethodName(Disposable.PHASE_NAME); builder.addPropertyValue("objectFactory", objectFactoryBeanDefinition); super.parseChild(element, parserContext, builder); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/TransactionDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/TransactionDe0000644000175000017500000000524610745677442033425 0ustar charlescharles/* * $Id: TransactionDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.delegate.AbstractSingleParentFamilyDefinitionParser; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.processors.BlockAttribute; /** * Generates a transaction config with embedded factory. If no factory is defined, it's taken from the * factory-class or factory-ref attributes. */ public class TransactionDefinitionParser extends AbstractSingleParentFamilyDefinitionParser { public static final String FACTORY = "factory"; public static final String FACTORY_REF = FACTORY + "-ref"; public static final String FACTORY_CLASS = FACTORY + "-" + AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS; public static final String ACTION = "action"; public static final String TIMEOUT = "timeout"; public TransactionDefinitionParser() { commonInit(null); } public TransactionDefinitionParser(Class factoryClass) { commonInit(factoryClass); MuleDefinitionParser factoryParser = getDelegate(1); // don't allow these if the class is specified in the constructor factoryParser.registerPreProcessor(new BlockAttribute(new String[]{FACTORY_CLASS, FACTORY_REF})); } private void commonInit(Class factoryClass) { addDelegate(new TransactionConfigDefinitionParser()) .setIgnoredDefault(true) .removeIgnored(FACTORY_REF) .removeIgnored(ACTION) .removeIgnored(TIMEOUT); addDelegateAsChild(new ChildDefinitionParser(FACTORY, factoryClass)) .setIgnoredDefault(false) .addIgnored(FACTORY_REF) .addIgnored(ACTION) .addIgnored(TIMEOUT) .addAlias(FACTORY_CLASS, AbstractMuleBeanDefinitionParser.ATTRIBUTE_CLASS) // the ref is set on the parent .registerPreProcessor(new BlockAttribute(FACTORY)); addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); addHandledException(BlockAttribute.BlockAttributeException.class); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/DefaultThreadingProfileDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/DefaultThread0000644000175000017500000000255410745677442033402 0ustar charlescharles/* * $Id: DefaultThreadingProfileDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.config.ThreadingProfile; import org.mule.config.ChainedThreadingProfile; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; import org.mule.config.spring.parsers.processors.IdAttribute; import org.mule.config.spring.parsers.processors.NameAttribute; /** * This parser is responsible for processing the configuration elements. */ // shouldn't this extend MuleOrphanDefinitionParser? public class DefaultThreadingProfileDefinitionParser extends OrphanDefinitionParser { public DefaultThreadingProfileDefinitionParser(String propertyName) { super(ChainedThreadingProfile.class, true); addMapping("poolExhaustedAction", ThreadingProfile.POOL_EXHAUSTED_ACTIONS); registerPostProcessor(new IdAttribute(propertyName)); registerPostProcessor(new NameAttribute(propertyName)); } }././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/TransformerDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/specific/TransformerDe0000644000175000017500000000346010761307335033423 0ustar charlescharles/* * $Id: TransformerDefinitionParser.java 11080 2008-02-27 16:25:01Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.config.spring.parsers.delegate.ParentContextDefinitionParser; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; /** * This allows a transformer to be defined globally, or embedded within an endpoint * (as either a normal or response transformer). */ public class TransformerDefinitionParser extends ParentContextDefinitionParser { public static final String TRANSFORMER = "transformer"; public static final String RESPONSE_TRANSFORMER = "responseTransformer"; public static final String RESPONSE_TRANSFORMERS = "response-transformers"; public TransformerDefinitionParser(Class transformer) { super(MuleOrphanDefinitionParser.ROOT_ELEMENT, new MuleOrphanDefinitionParser(transformer, false)); and(RESPONSE_TRANSFORMERS, new ChildDefinitionParser(RESPONSE_TRANSFORMER, transformer)); otherwise(new ChildDefinitionParser(TRANSFORMER, transformer)); } /** * For custom transformers */ public TransformerDefinitionParser() { super(MuleOrphanDefinitionParser.ROOT_ELEMENT, new MuleOrphanDefinitionParser(false)); and(RESPONSE_TRANSFORMERS, new ChildDefinitionParser(RESPONSE_TRANSFORMER)); otherwise(new ChildDefinitionParser(TRANSFORMER)); } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/0000755000175000017500000000000011351411145030743 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration/mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration0000755000175000017500000000000011351411144033532 5ustar charlescharles././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration/SingleProperty.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration0000644000175000017500000000125410740712271033544 0ustar charlescharles/* * $Id: SingleProperty.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly.configuration; public interface SingleProperty { boolean isCollection(); void setCollection(); boolean isIgnored(); void setIgnored(); boolean isReference(); void setReference(); } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration/PrefixValueMap.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration0000644000175000017500000000134010740712271033540 0ustar charlescharles/* * $Id: PrefixValueMap.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly.configuration; public class PrefixValueMap implements ValueMap { private String prefix; public PrefixValueMap(String prefix) { this.prefix = prefix; } public Object rewrite(String value) { return prefix + value; } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration/TempWrapperPropertyConfiguration.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration0000644000175000017500000000721710770772470033563 0ustar charlescharles/* * $Id: TempWrapperPropertyConfiguration.java 11465 2008-03-21 17:49:44Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly.configuration; import java.util.Map; /** * Wrap a PropertyConfiguration so that changes are kept in the wrapper */ public class TempWrapperPropertyConfiguration implements PropertyConfiguration { protected PropertyConfiguration delegate; protected SimplePropertyConfiguration extra = new SimplePropertyConfiguration(); private boolean greedyIgnore; public TempWrapperPropertyConfiguration(PropertyConfiguration delegate) { this(delegate, true); } public TempWrapperPropertyConfiguration(PropertyConfiguration delegate, boolean greedyIgnore) { this.delegate = delegate; this.greedyIgnore = greedyIgnore; } public void addReference(String propertyName) { extra.addReference(propertyName); } public void addMapping(String propertyName, Map mappings) { extra.addMapping(propertyName, mappings); } public void addMapping(String propertyName, String mappings) { extra.addMapping(propertyName, mappings); } public void addMapping(String propertyName, ValueMap mappings) { extra.addMapping(propertyName, mappings); } public void addAlias(String alias, String propertyName) { extra.addAlias(alias, propertyName); } public void addCollection(String propertyName) { extra.addCollection(propertyName); } public void addIgnored(String propertyName) { extra.addIgnored(propertyName); } public void removeIgnored(String propertyName) { extra.removeIgnored(propertyName); } public void setIgnoredDefault(boolean ignoreAll) { extra.setIgnoredDefault(ignoreAll); } public String getAttributeMapping(String alias) { return extra.getAttributeMapping(alias, delegate.getAttributeMapping(alias)); } public String getAttributeAlias(String mapping) { return extra.getAttributeMapping(mapping, delegate.getAttributeAlias(mapping)); } public boolean isCollection(String propertyName) { return extra.isCollection(propertyName) || delegate.isCollection(propertyName); } public boolean isIgnored(String propertyName) { if (greedyIgnore) { return extra.isIgnored(propertyName) || delegate.isIgnored(propertyName); } else { return extra.isIgnored(propertyName) && delegate.isIgnored(propertyName); } } public boolean isReference(String attributeName) { return extra.isReference(attributeName) || delegate.isReference(attributeName); } public SingleProperty getSingleProperty(String propertyName) { return new SinglePropertyWrapper(propertyName, this); } public String translateName(String oldName) { return extra.translateName(delegate.translateName(oldName)); } public Object translateValue(String name, String value) { Object intermediate = delegate.translateValue(name, value); if (intermediate.equals(value)) { return extra.translateValue(name, value); } else { return intermediate; } } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration/ValueMap.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration0000644000175000017500000000112410740712271033540 0ustar charlescharles/* * $Id: ValueMap.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly.configuration; /** * Allow arbitrary processing of a value */ public interface ValueMap { Object rewrite(String value); } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration/ReusablePropertyConfiguration.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration0000644000175000017500000000634010770772470033557 0ustar charlescharles/* * $Id: ReusablePropertyConfiguration.java 11465 2008-03-21 17:49:44Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly.configuration; import java.util.Map; /** * Allow initial mutation; first call of reset stores values as reference and allows * further temporary mutation; further calls to reset return to reference. */ public class ReusablePropertyConfiguration implements PropertyConfiguration { private PropertyConfiguration reference; private PropertyConfiguration delegate; public ReusablePropertyConfiguration() { this(new SimplePropertyConfiguration()); } public ReusablePropertyConfiguration(PropertyConfiguration delegate) { this.delegate = delegate; } public void reset() { if (null == reference) { reference = delegate; } delegate = new TempWrapperPropertyConfiguration(reference); } public void addReference(String propertyName) { delegate.addReference(propertyName); } public void addMapping(String propertyName, Map mappings) { delegate.addMapping(propertyName, mappings); } public void addMapping(String propertyName, String mappings) { delegate.addMapping(propertyName, mappings); } public void addMapping(String propertyName, ValueMap mappings) { delegate.addMapping(propertyName, mappings); } public void addAlias(String alias, String propertyName) { delegate.addAlias(alias, propertyName); } public void addCollection(String propertyName) { delegate.addCollection(propertyName); } public void addIgnored(String propertyName) { delegate.addIgnored(propertyName); } public void removeIgnored(String propertyName) { delegate.removeIgnored(propertyName); } public void setIgnoredDefault(boolean ignoreAll) { delegate.setIgnoredDefault(ignoreAll); } public String getAttributeMapping(String alias) { return delegate.getAttributeMapping(alias); } public String getAttributeAlias(String mapping) { return delegate.getAttributeAlias(mapping); } public boolean isCollection(String propertyName) { return delegate.isCollection(propertyName); } public boolean isIgnored(String propertyName) { return delegate.isIgnored(propertyName); } public boolean isReference(String attributeName) { return delegate.isReference(attributeName); } public SingleProperty getSingleProperty(String propertyName) { return new SinglePropertyWrapper(propertyName, this); } public String translateName(String oldName) { return delegate.translateName(oldName); } public Object translateValue(String name, String value) { return delegate.translateValue(name, value); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration/SimplePropertyConfiguration.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration0000644000175000017500000001766010770772470033566 0ustar charlescharles/* * $Id: SimplePropertyConfiguration.java 11465 2008-03-21 17:49:44Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly.configuration; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.Iterator; import org.springframework.core.Conventions; import org.springframework.util.StringUtils; /** * A direct implementation of {@link PropertyConfiguration} */ public class SimplePropertyConfiguration implements PropertyConfiguration { private List references = new ArrayList(); private Properties nameMappings = new Properties(); private Map valueMappings = new HashMap(); private Set collections = new HashSet(); private Map ignored = new HashMap(); private boolean ignoreAll = false; public void addReference(String propertyName) { references.add(dropRef(propertyName)); } public void addMapping(String propertyName, Map mappings) { valueMappings.put(propertyName, new NamedValueMap(propertyName, mappings)); } public void addMapping(String propertyName, String mappings) { valueMappings.put(propertyName, new NamedValueMap(propertyName, mappings)); } public void addMapping(String propertyName, ValueMap mappings) { valueMappings.put(propertyName, new NamedValueMap(propertyName, mappings)); } public void addAlias(String alias, String propertyName) { nameMappings.put(alias, propertyName); } public void addCollection(String propertyName) { collections.add(dropRef(propertyName)); } public void addIgnored(String propertyName) { ignored.put(dropRef(propertyName), Boolean.TRUE); } public void removeIgnored(String propertyName) { ignored.put(dropRef(propertyName), Boolean.FALSE); } public void setIgnoredDefault(boolean ignoreAll) { this.ignoreAll = ignoreAll; } public String getAttributeMapping(String alias) { return getAttributeMapping(alias, alias); } public String getAttributeAlias(String name) { for (Iterator iterator = nameMappings.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry)iterator.next(); if(entry.getValue().equals(name)) { return entry.getKey().toString(); } } return name; } public String getAttributeMapping(String alias, String deflt) { return nameMappings.getProperty(alias, deflt); } public boolean isCollection(String propertyName) { return collections.contains(dropRef(propertyName)); } public boolean isIgnored(String propertyName) { String name = dropRef(propertyName); if (ignored.containsKey(name)) { return ((Boolean) ignored.get(name)).booleanValue(); } else { return ignoreAll; } } /** * A property can be explicitly registered as a bean reference via registerBeanReference() * or it can simply use the "-ref" suffix. * @param attributeName true if the name appears to correspond to a reference */ public boolean isReference(String attributeName) { return (references.contains(dropRef(attributeName)) || attributeName.endsWith(AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF_SUFFIX) || attributeName.endsWith(AbstractMuleBeanDefinitionParser.ATTRIBUTE_REFS_SUFFIX) || attributeName.equals(AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF)); } public SingleProperty getSingleProperty(String name) { return new SinglePropertyWrapper(name, this); } /** * Extract a JavaBean property name from the supplied attribute name. *

The default implementation uses the {@link org.springframework.core.Conventions#attributeNameToPropertyName(String)} * method to perform the extraction. *

The name returned must obey the standard JavaBean property name * conventions. For example for a class with a setter method * 'setBingoHallFavourite(String)', the name returned had * better be 'bingoHallFavourite' (with that exact casing). * * @param oldName the attribute name taken straight from the XML element being parsed; will never be null * @return the extracted JavaBean property name; must never be null */ public String translateName(String oldName) { // Remove the bean reference suffix if any. String name = dropRef(oldName); // Map to the real property name if necessary. name = getAttributeMapping(name); // JavaBeans property convention. name = Conventions.attributeNameToPropertyName(name); if (!StringUtils.hasText(name)) { throw new IllegalStateException("Illegal property name for " + oldName + ": cannot be null or empty."); } return name; } protected String dropRef(String name) { return org.mule.util.StringUtils.chomp( org.mule.util.StringUtils.chomp(name, AbstractMuleBeanDefinitionParser.ATTRIBUTE_REF_SUFFIX), AbstractMuleBeanDefinitionParser.ATTRIBUTE_REFS_SUFFIX); } public Object translateValue(String name, String value) { NamedValueMap vm = (NamedValueMap) valueMappings.get(name); if (vm != null) { return vm.getValue(value); } else { return value; } } public static class NamedValueMap { private String propertyName; private ValueMap valueMap; public NamedValueMap(String propertyName, String mappingsString) { this.propertyName = propertyName; valueMap = new MapValueMap(mappingsString); } public NamedValueMap(String propertyName, Map valueMap) { this.propertyName = propertyName; this.valueMap = new MapValueMap(valueMap); } public NamedValueMap(String propertyName, ValueMap valueMap) { this.propertyName = propertyName; this.valueMap = valueMap; } public String getPropertyName() { return propertyName; } public Object getValue(String key) { return valueMap.rewrite(key); } } public static class MapValueMap implements ValueMap { private Map map; public MapValueMap(Map map) { this.map = map; } public MapValueMap(String definition) { map = new HashMap(); String[] values = StringUtils.tokenizeToStringArray(definition, ","); for (int i = 0; i < values.length; i++) { String value = values[i]; int x = value.indexOf("="); if (x == -1) { throw new IllegalArgumentException("Mappings string not properly defined: " + definition); } map.put(value.substring(0, x), value.substring(x+1)); } } public Object rewrite(String value) { Object result = map.get(value); if (null == result) { return value; } else { return result.toString(); } } } }././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration/SinglePropertyWrapper.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration0000644000175000017500000000242510740712271033545 0ustar charlescharles/* * $Id: SinglePropertyWrapper.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly.configuration; public class SinglePropertyWrapper implements SingleProperty { private String oldName; private PropertyConfiguration config; public SinglePropertyWrapper(String oldName, PropertyConfiguration config) { this.oldName = oldName; this.config = config; } public boolean isCollection() { return config.isCollection(oldName); } public void setCollection() { config.addCollection(oldName); } public boolean isIgnored() { return config.isIgnored(oldName); } public void setIgnored() { config.addIgnored(oldName); } public boolean isReference() { return config.isReference(oldName); } public void setReference() { config.addReference(oldName); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration/SinglePropertyLiteral.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration0000644000175000017500000000276510740712271033554 0ustar charlescharles/* * $Id: SinglePropertyLiteral.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly.configuration; public class SinglePropertyLiteral implements SingleProperty { private boolean isCollection; private boolean isIgnored; private boolean isReference; public SinglePropertyLiteral(boolean isCollection, boolean isIgnored, boolean isReference) { this.isCollection = isCollection; this.isIgnored = isIgnored; this.isReference = isReference; } public SinglePropertyLiteral(boolean isReference) { this(false, false, isReference); } public SinglePropertyLiteral() { this(false, false, false); } public boolean isCollection() { return isCollection; } public void setCollection() { this.isCollection = true; } public boolean isIgnored() { return isIgnored; } public void setIgnored() { this.isIgnored = true; } public boolean isReference() { return isReference; } public void setReference() { this.isReference = true; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration/ListValueMap.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration0000644000175000017500000000177010745677442033566 0ustar charlescharles/* * $Id: ListValueMap.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly.configuration; import java.util.LinkedList; import java.util.List; import java.util.StringTokenizer; /** * Be careful - this doesn't work with endpoint properties because they need to be converted to a URI. */ public class ListValueMap implements ValueMap { public Object rewrite(String value) { List list = new LinkedList(); StringTokenizer tokenizer = new StringTokenizer(value); while (tokenizer.hasMoreTokens()) { list.add(tokenizer.nextToken()); } return list; } }././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration/PropertyConfiguration.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/configuration0000644000175000017500000000573410770772470033565 0ustar charlescharles/* * $Id: PropertyConfiguration.java 11465 2008-03-21 17:49:44Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly.configuration; import java.util.Map; /** * This collects together various constraints/rewrites that can be applied to attributes. It * was extracted from AbstractMuleBeanDefinitionParser and should be used as a delegate * (see that class for an example). * *

Ignored, reference and collection flags are all keyed off the "old" name (before any alias * or mapping), with any "-ref" dropped. No normalisation of mapping or aliases is attempted.

*/ public interface PropertyConfiguration { void addReference(String propertyName); void addMapping(String propertyName, Map mappings); void addMapping(String propertyName, String mappings); void addMapping(String propertyName, ValueMap mappings); void addAlias(String alias, String propertyName); /** * This will automatically generate a list and accumulate values. * If the value is a map then instead of generating a list of maps we combine map entries together. */ void addCollection(String propertyName); void addIgnored(String propertyName); void removeIgnored(String propertyName); void setIgnoredDefault(boolean ignoreAll); String getAttributeMapping(String alias); String getAttributeAlias(String name); boolean isCollection(String propertyName); boolean isIgnored(String propertyName); /** * A property can be explicitly registered as a bean reference via registerBeanReference() * or it can simply use the "-ref" suffix. * @param attributeName true if the name appears to correspond to a reference */ boolean isReference(String attributeName); SingleProperty getSingleProperty(String propertyName); /** * Extract a JavaBean property name from the supplied attribute name. *

The default implementation uses the {@link org.springframework.core.Conventions#attributeNameToPropertyName(String)} * method to perform the extraction. *

The name returned must obey the standard JavaBean property name * conventions. For example for a class with a setter method * 'setBingoHallFavourite(String)', the name returned had * better be 'bingoHallFavourite' (with that exact casing). * * @param oldName the attribute name taken straight from the XML element being parsed; will never be null * @return the extracted JavaBean property name; must never be null */ String translateName(String oldName); Object translateValue(String name, String value); } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/AttributeMapBeanAssembler.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/AttributeMapB0000644000175000017500000000275110740712271033403 0ustar charlescharles/* * $Id: AttributeMapBeanAssembler.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; /** * This can be used inside a {@link org.mule.config.spring.parsers.generic.ChildDefinitionParser} - it * takes named properties and, instead of inserting them individually on the target, it packages them as * a Map and inserts that. */ public class AttributeMapBeanAssembler extends AbstractMapBeanAssembler { public AttributeMapBeanAssembler(PropertyConfiguration beanConfig, BeanDefinitionBuilder bean, PropertyConfiguration targetConfig, BeanDefinition target) { super(beanConfig, bean, targetConfig, target); } /** * We override this method to insert a map instead of the definition. */ public void insertBeanInTarget(String oldName) { assertTargetPresent(); insertDefinitionAsMap(oldName); } }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/AttributeMapBeanAssemblerFactory.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/AttributeMapB0000644000175000017500000000207210740712271033377 0ustar charlescharles/* * $Id: AttributeMapBeanAssemblerFactory.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; public class AttributeMapBeanAssemblerFactory implements BeanAssemblerFactory { public BeanAssembler newBeanAssembler( PropertyConfiguration beanConfig, BeanDefinitionBuilder bean, PropertyConfiguration targetConfig, BeanDefinition target) { return new AttributeMapBeanAssembler(beanConfig, bean, targetConfig, target); } }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/BeanAssemblerFactory.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/BeanAssembler0000644000175000017500000000163710740712271033405 0ustar charlescharles/* * $Id: BeanAssemblerFactory.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; public interface BeanAssemblerFactory { BeanAssembler newBeanAssembler( PropertyConfiguration beanConfig, BeanDefinitionBuilder bean, PropertyConfiguration targetConfig, BeanDefinition target); } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/BeanAssembler.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/BeanAssembler0000644000175000017500000000765210745726444033424 0ustar charlescharles/* * $Id: BeanAssembler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.w3c.dom.Attr; /** * Bean Assembler provides a high-level interface to constructing beans. It encapsulates all * the "smart" logic about collections, maps, references, etc. * *

A bean assembly contains a bean (the thing we are constructing), a target (where we put the * bean once it is ready) and appropriate configuration information (there is a configuration * for both bean and target, but currently they are set to the same instance by the classes that * use this). */ public interface BeanAssembler { public BeanDefinitionBuilder getBean(); public BeanDefinition getTarget(); /** * Add a property defined by an attribute to the bean we are constructing. * *

Since an attribute value is always a string, we don't have to deal with complex types * here - the only issue is whether or not we have a reference. References are detected * by explicit annotation or by the "-ref" at the end of an attribute name. We do not * check the Spring repo to see if a name already exists since that could lead to * unpredictable behaviour. * (see {@link org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration}) * @param attribute The attribute to add */ void extendBean(Attr attribute); /** * Allow direct access to bean for more complex cases * * @param newName The property name to add * @param newValue The property value to add * @param isReference If true, a bean reference is added (and newValue must be a String) */ void extendBean(String newName, Object newValue, boolean isReference); /** * Add a property defined by an attribute to the parent of the bean we are constructing. * *

This is unusual. Normally you want {@link #extendBean(org.w3c.dom.Attr)}. * @param attribute The attribute to add */ void extendTarget(Attr attribute); /** * Allow direct access to target for more complex cases * * @param newName The property name to add * @param newValue The property value to add * @param isReference If true, a bean reference is added (and newValue must be a String) */ void extendTarget(String newName, Object newValue, boolean isReference); void extendTarget(String oldName, String newName, Object newValue); /** * Insert the bean we have built into the target (typically the parent bean). * *

This is the most complex case because the bean can have an aribtrary type. * @param oldName The identifying the bean (typically element name). */ void insertBeanInTarget(String oldName); /** * Copy the properties from the bean we have been building into the target (typically * the parent bean). In other words, the bean is a facade for the target. * *

This assumes that the source bean has been constructed correctly (ie the decisions about * what is ignored, a map, a list, etc) have already been made. All it does (apart from a * direct copy) is merge collections with those on the target when necessary. */ void copyBeanToTarget(); /** * Set a flag on the bean - this is used to communicate with * {@link org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate} * * @param flag The flag to set */ void setBeanFlag(String flag); } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/AbstractMapBeanAssembler.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/AbstractMapBe0000644000175000017500000000370710745677442033371 0ustar charlescharles/* * $Id: AbstractMapBeanAssembler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.util.MapCombiner; import java.util.Iterator; import java.util.List; import java.util.Map; import org.springframework.beans.PropertyValue; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.ManagedList; import org.springframework.beans.factory.support.ManagedMap; public abstract class AbstractMapBeanAssembler extends DefaultBeanAssembler { public AbstractMapBeanAssembler(PropertyConfiguration beanConfig, BeanDefinitionBuilder bean, PropertyConfiguration targetConfig, BeanDefinition target) { super(beanConfig, bean, targetConfig, target); } protected void insertDefinitionAsMap(String oldName) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(MapCombiner.class); Map map = new ManagedMap(); for (Iterator pvs = getBean().getBeanDefinition().getPropertyValues().getPropertyValueList().iterator(); pvs.hasNext();) { PropertyValue pv = (PropertyValue) pvs.next(); map.put(pv.getName(), pv.getValue()); } List list = new ManagedList(); list.add(map); builder.addPropertyValue(MapCombiner.LIST, list); setBean(builder); super.insertBeanInTarget(oldName); } }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/DefaultBeanAssembler.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/DefaultBeanAs0000644000175000017500000004342710745726444033357 0ustar charlescharles/* * $Id: DefaultBeanAssembler.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.SingleProperty; import org.mule.config.spring.parsers.assembly.configuration.SinglePropertyLiteral; import org.mule.config.spring.parsers.assembly.configuration.SinglePropertyWrapper; import org.mule.config.spring.parsers.collection.ChildListEntryDefinitionParser; import org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser; import org.mule.config.spring.util.SpringXMLUtils; import org.mule.util.ClassUtils; import org.mule.util.MapCombiner; import java.lang.reflect.Method; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.PropertyValue; import org.springframework.beans.PropertyValues; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.MapFactoryBean; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.ManagedList; import org.springframework.beans.factory.support.ManagedMap; import org.w3c.dom.Attr; public class DefaultBeanAssembler implements BeanAssembler { private static Log logger = LogFactory.getLog(DefaultBeanAssembler.class); private PropertyConfiguration beanConfig; private BeanDefinitionBuilder bean; private PropertyConfiguration targetConfig; private BeanDefinition target; public DefaultBeanAssembler(PropertyConfiguration beanConfig, BeanDefinitionBuilder bean, PropertyConfiguration targetConfig, BeanDefinition target) { this.beanConfig = beanConfig; this.bean = bean; this.targetConfig = targetConfig; this.target = target; } public BeanDefinitionBuilder getBean() { return bean; } protected void setBean(BeanDefinitionBuilder bean) { this.bean = bean; } public BeanDefinition getTarget() { return target; } protected PropertyConfiguration getBeanConfig() { return beanConfig; } protected PropertyConfiguration getTargetConfig() { return targetConfig; } /** * Add a property defined by an attribute to the bean we are constructing. * *

Since an attribute value is always a string, we don't have to deal with complex types * here - the only issue is whether or not we have a reference. References are detected * by explicit annotation or by the "-ref" at the end of an attribute name. We do not * check the Spring repo to see if a name already exists since that could lead to * unpredictable behaviour. * (see {@link org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration}) * @param attribute The attribute to add */ public void extendBean(Attr attribute) { String oldName = SpringXMLUtils.attributeName(attribute); if (!beanConfig.isIgnored(oldName)) { logger.debug(attribute + " for " + bean.getBeanDefinition().getBeanClassName()); String oldValue = attribute.getNodeValue(); String newName = bestGuessName(beanConfig, oldName, bean.getBeanDefinition().getBeanClassName()); Object newValue = beanConfig.translateValue(oldName, oldValue); addPropertyWithReference(bean.getBeanDefinition().getPropertyValues(), beanConfig.getSingleProperty(oldName), newName, newValue); } } /** * Allow direct access to bean for major hacks * * @param newName The property name to add * @param newValue The property value to add * @param isReference If true, a bean reference is added (and newValue must be a String) */ public void extendBean(String newName, Object newValue, boolean isReference) { addPropertyWithReference(bean.getBeanDefinition().getPropertyValues(), new SinglePropertyLiteral(isReference), newName, newValue); } /** * Add a property defined by an attribute to the parent of the bean we are constructing. * *

This is unusual. Normally you want {@link #extendBean(org.w3c.dom.Attr)}. * @param attribute The attribute to add */ public void extendTarget(Attr attribute) { String oldName = SpringXMLUtils.attributeName(attribute); String oldValue = attribute.getNodeValue(); String newName = bestGuessName(targetConfig, oldName, bean.getBeanDefinition().getBeanClassName()); Object newValue = targetConfig.translateValue(oldName, oldValue); addPropertyWithReference(target.getPropertyValues(), targetConfig.getSingleProperty(oldName), newName, newValue); } /** * Allow direct access to target for major hacks * * @param newName The property name to add * @param newValue The property value to add * @param isReference If true, a bean reference is added (and newValue must be a String) */ public void extendTarget(String newName, Object newValue, boolean isReference) { assertTargetPresent(); addPropertyWithReference(target.getPropertyValues(), new SinglePropertyLiteral(isReference), newName, newValue); } public void extendTarget(String oldName, String newName, Object newValue) { assertTargetPresent(); addPropertyWithReference(target.getPropertyValues(), new SinglePropertyWrapper(oldName, getTargetConfig()), newName, newValue); } /** * Insert the bean we have built into the target (typically the parent bean). * *

This is the most complex case because the bean can have an aribtrary type. * * @param oldName The identifying the bean (typically element name). */ public void insertBeanInTarget(String oldName) { logger.debug("insert " + bean.getBeanDefinition().getBeanClassName() + " -> " + target.getBeanClassName()); assertTargetPresent(); String beanClass = bean.getBeanDefinition().getBeanClassName(); PropertyValues sourceProperties = bean.getRawBeanDefinition().getPropertyValues(); String newName = bestGuessName(targetConfig, oldName, target.getBeanClassName()); MutablePropertyValues targetProperties = target.getPropertyValues(); PropertyValue pv = targetProperties.getPropertyValue(newName); Object oldValue = null == pv ? null : pv.getValue(); if (! targetConfig.isIgnored(oldName)) { if (targetConfig.isCollection(oldName) || beanClass.equals(ChildListEntryDefinitionParser.ListEntry.class.getName())) { if (null == oldValue) { if (beanClass.equals(ChildMapEntryDefinitionParser.KeyValuePair.class.getName()) || beanClass.equals(MapEntryCombiner.class.getName()) || beanClass.equals(MapFactoryBean.class.getName())) { // a collection of maps requires an extra intermediate object that does the // lazy combination/caching of maps when first used BeanDefinitionBuilder combiner = BeanDefinitionBuilder.rootBeanDefinition(MapCombiner.class); targetProperties.addPropertyValue(newName, combiner.getBeanDefinition()); MutablePropertyValues combinerProperties = combiner.getBeanDefinition().getPropertyValues(); oldValue = new ManagedList(); pv = new PropertyValue(MapCombiner.LIST, oldValue); combinerProperties.addPropertyValue(pv); } else { oldValue = new ManagedList(); pv = new PropertyValue(newName, oldValue); targetProperties.addPropertyValue(pv); } } List list = retrieveList(oldValue); if (ChildMapEntryDefinitionParser.KeyValuePair.class.getName().equals(beanClass)) { list.add(new ManagedMap()); retrieveMap(list.get(list.size() - 1)).put( sourceProperties.getPropertyValue(ChildMapEntryDefinitionParser.KEY).getValue(), sourceProperties.getPropertyValue(ChildMapEntryDefinitionParser.VALUE).getValue()); } else if (beanClass.equals(ChildListEntryDefinitionParser.ListEntry.class.getName())) { list.add(sourceProperties.getPropertyValue(ChildListEntryDefinitionParser.VALUE).getValue()); } else { list.add(bean.getBeanDefinition()); } } else { // not a collection if (ChildMapEntryDefinitionParser.KeyValuePair.class.getName().equals(beanClass)) { if (null == pv || null == oldValue) { pv = new PropertyValue(newName, new ManagedMap()); targetProperties.addPropertyValue(pv); } retrieveMap(pv.getValue()).put( sourceProperties.getPropertyValue(ChildMapEntryDefinitionParser.KEY).getValue(), sourceProperties.getPropertyValue(ChildMapEntryDefinitionParser.VALUE).getValue()); } else { targetProperties.addPropertyValue(newName, bean.getBeanDefinition()); } } } } private static List retrieveList(Object value) { if (value instanceof List) { return (List) value; } else if (isDefinitionOf(value, MapCombiner.class)) { return (List) unpackDefinition(value, MapCombiner.LIST); } else { throw new ClassCastException("Collection not of expected type: " + value); } } private static Map retrieveMap(Object value) { if (value instanceof Map) { return (Map) value; } else if (isDefinitionOf(value, MapFactoryBean.class)) { return (Map) unpackDefinition(value, "sourceMap"); } else { throw new ClassCastException("Map not of expected type: " + value); } } private static boolean isDefinitionOf(Object value, Class clazz) { return value instanceof BeanDefinition && ((BeanDefinition) value).getBeanClassName().equals(clazz.getName()); } private static Object unpackDefinition(Object definition, String name) { return ((BeanDefinition) definition).getPropertyValues().getPropertyValue(name).getValue(); } /** * Copy the properties from the bean we have been building into the target (typically * the parent bean). In other words, the bean is a facade for the target. * *

This assumes that the source bean has been constructed correctly (ie the decisions about * what is ignored, a map, a list, etc) have already been made. All it does (apart from a * direct copy) is merge collections with those on the target when necessary. */ public void copyBeanToTarget() { logger.debug("copy " + bean.getBeanDefinition().getBeanClassName() + " -> " + target.getBeanClassName()); assertTargetPresent(); MutablePropertyValues targetProperties = target.getPropertyValues(); MutablePropertyValues beanProperties = bean.getBeanDefinition().getPropertyValues(); for (int i=0;i < beanProperties.size(); i++) { PropertyValue propertyValue = beanProperties.getPropertyValues()[i]; addPropertyWithoutReference(targetProperties, new SinglePropertyLiteral(), propertyValue.getName(), propertyValue.getValue()); } } public void setBeanFlag(String flag) { MuleHierarchicalBeanDefinitionParserDelegate.setFlag(bean.getRawBeanDefinition(), flag); } protected void assertTargetPresent() { if (null == target) { throw new IllegalStateException("Bean assembler does not have a target"); } } protected void addPropertyWithReference(MutablePropertyValues properties, SingleProperty config, String name, Object value) { if (!config.isIgnored()) { if (config.isReference()) { if (value instanceof String) { if (((String) value).trim().indexOf(" ") > -1) { config.setCollection(); } for (StringTokenizer refs = new StringTokenizer((String) value); refs.hasMoreTokens();) { String ref = refs.nextToken(); if (logger.isDebugEnabled()) { logger.debug("possible non-dependent reference: " + name + "/" + ref); } addPropertyWithoutReference(properties, config, name, new RuntimeBeanReference(ref)); } } else { throw new IllegalArgumentException("Bean reference must be a String: " + name + "/" + value); } } else { addPropertyWithoutReference(properties, config, name, value); } } } protected void addPropertyWithoutReference(MutablePropertyValues properties, SingleProperty config, String name, Object value) { if (!config.isIgnored()) { if (logger.isDebugEnabled()) { logger.debug(name + ": " + value); } Object oldValue = null; if (properties.contains(name)) { oldValue = properties.getPropertyValue(name).getValue(); } // merge collections if (config.isCollection() || oldValue instanceof Collection || value instanceof Collection) { Collection values = new ManagedList(); if (null != oldValue) { properties.removePropertyValue(name); if (oldValue instanceof Collection) { values.addAll((Collection) oldValue); } else { values.add(oldValue); } } if (value instanceof Collection) { values.addAll((Collection) value); } else { values.add(value); } properties.addPropertyValue(name, values); } else { properties.addPropertyValue(name, value); } } } protected static String bestGuessName(PropertyConfiguration config, String oldName, String className) { String newName = config.translateName(oldName); if (! methodExists(className, newName)) { String plural = newName + "s"; if (methodExists(className, plural)) { // this lets us avoid setting addCollection in the majority of cases config.addCollection(oldName); return plural; } if (newName.endsWith("y")) { String pluraly = newName.substring(0, newName.length()-1) + "ies"; if (methodExists(className, pluraly)) { // this lets us avoid setting addCollection in the majority of cases config.addCollection(oldName); return pluraly; } } } return newName; } protected static boolean methodExists(String className, String newName) { try { // is there a better way than this?! // BeanWrapperImpl instantiates an instance, which we don't want. // if there really is no better way, i guess it should go in // class or bean utils. Class clazz = ClassUtils.getClass(className); Method[] methods = clazz.getMethods(); String setter = "set" + newName; for (int i = 0; i < methods.length; ++i) { if (methods[i].getName().equalsIgnoreCase(setter)) { return true; } } } catch (Exception e) { logger.debug("Could not access bean class " + className, e); } return false; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/MapEntryCombiner.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/MapEntryCombi0000644000175000017500000000652010745677442033426 0ustar charlescharles/* * $Id: MapEntryCombiner.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Set; /** * This is used internally by {@link org.mule.config.spring.parsers.assembly.DefaultBeanAssembler} * along with {@link org.mule.config.spring.parsers.collection.ChildSingletonMapDefinitionParser}. * It creates a map with a single key/value pair. This may seem odd, but the result is not * manipulated within the assembler - that means that, unlike * {@link org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser}, this element * can contain nested values. Note that most uses will set * {@link org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration#isCollection(String)} * so that several entries can be combined. */ public class MapEntryCombiner implements Map { public static final String KEY = "key"; public static final String VALUE = "value"; private Object key; private Object value; private Map cachedMerge = new HashMap(); private boolean isMerged = false; private synchronized Map getCachedMerge() { if (!isMerged) { cachedMerge.put(key, value); isMerged = true; } return cachedMerge; } public Object getKey() { assertNotMerged(); return key; } public void setKey(Object key) { assertNotMerged(); this.key = key; } public Object getValue() { assertNotMerged(); return value; } public void setValue(Object value) { assertNotMerged(); this.value = value; } private synchronized void assertNotMerged() { if (isMerged) { throw new IllegalStateException("Maps have already been merged"); } } // map delegates (except hashCode and equals) public int size() { return getCachedMerge().size(); } public void clear() { getCachedMerge().clear(); } public boolean isEmpty() { return getCachedMerge().isEmpty(); } public boolean containsKey(Object key) { return getCachedMerge().containsKey(key); } public boolean containsValue(Object value) { return getCachedMerge().containsValue(value); } public Collection values() { return getCachedMerge().values(); } public void putAll(Map t) { getCachedMerge().putAll(t); } public Set entrySet() { return getCachedMerge().entrySet(); } public Set keySet() { return getCachedMerge().keySet(); } public Object get(Object key) { return getCachedMerge().get(key); } public Object remove(Object key) { return getCachedMerge().remove(key); } public Object put(Object key, Object value) { return getCachedMerge().put(key, value); } }././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/DefaultBeanAssemblerFactory.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/DefaultBeanAs0000644000175000017500000000205410740712271033332 0ustar charlescharles/* * $Id: DefaultBeanAssemblerFactory.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; public class DefaultBeanAssemblerFactory implements BeanAssemblerFactory { public BeanAssembler newBeanAssembler( PropertyConfiguration beanConfig, BeanDefinitionBuilder bean, PropertyConfiguration targetConfig, BeanDefinition target) { return new DefaultBeanAssembler(beanConfig, bean, targetConfig, target); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/TwoStageMapBeanAssembler.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/TwoStageMapBe0000644000175000017500000000623110740712271033337 0ustar charlescharles/* * $Id: TwoStageMapBeanAssembler.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; /** * This is used by {@link org.mule.config.spring.parsers.delegate.MapDefinitionParserMutator} - it takes * a normal bean definition and re-packages it as a map (rather than individual values). The difference * between this and {@link org.mule.config.spring.parsers.assembly.AttributeMapBeanAssemblerFactory} is * that this allows child elements to generate the properties (it's an ugly consequence of the fact that * BDPs are called before nested children - this is a hack that gets "re-called" after the children to * complete the work). */ public class TwoStageMapBeanAssembler extends AbstractMapBeanAssembler { private TwoStageMapBeanAssemblerFactory.BeanAssemblerStore store; public TwoStageMapBeanAssembler(TwoStageMapBeanAssemblerFactory.BeanAssemblerStore store, PropertyConfiguration beanConfig, BeanDefinitionBuilder bean, PropertyConfiguration targetConfig, BeanDefinition target) { super(beanConfig, bean, targetConfig, target); this.store = store; } /** * We overwrite this method to populate a map instead of inserting the definition. * However, the bean definition is not complete until all child elements have been * parsed - and that parsing happens after this routine is called. So on first * pass we set a flag in the definition. This is picked up by the main * driver loop ({@link org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate}) * and our enclosing bean definition parser is called again. At the same time, to * avoid complicating otherwise "normal" BDPs, we pass this assembler to a callback, * so that it can be called the second time in a more direct way. */ public void insertBeanInTarget(String oldName) { assertTargetPresent(); if (MuleHierarchicalBeanDefinitionParserDelegate.testFlag(getBean().getBeanDefinition(), MuleHierarchicalBeanDefinitionParserDelegate.MULE_POST_CHILDREN)) { insertDefinitionAsMap(oldName); } else { // called for the first time, so set the flag and store this assembler for // later processing MuleHierarchicalBeanDefinitionParserDelegate.setFlag(getBean().getBeanDefinition(), MuleHierarchicalBeanDefinitionParserDelegate.MULE_POST_CHILDREN); store.saveBeanAssembler(this); } } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/TwoStageMapBeanAssemblerFactory.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/assembly/TwoStageMapBe0000644000175000017500000000251710740712271033342 0ustar charlescharles/* * $Id: TwoStageMapBeanAssemblerFactory.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; public class TwoStageMapBeanAssemblerFactory implements BeanAssemblerFactory { private BeanAssemblerStore store; public TwoStageMapBeanAssemblerFactory(BeanAssemblerStore store) { this.store = store; } public BeanAssembler newBeanAssembler( PropertyConfiguration beanConfig, BeanDefinitionBuilder bean, PropertyConfiguration targetConfig, BeanDefinition target) { return new TwoStageMapBeanAssembler(store, beanConfig, bean, targetConfig, target); } public interface BeanAssemblerStore { public void saveBeanAssembler(BeanAssembler beanAssembler); } }mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/package.html0000644000175000017500000000021210740712271031405 0ustar charlescharles Mule Classes that help to construct a Mule model via Spring's XML specification. ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/MuleChildDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/MuleChildDefinitionPar0000644000175000017500000000155710740712271033406 0ustar charlescharles/* * $Id: MuleChildDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.springframework.beans.factory.config.BeanDefinition; /** * Extra functionality exposed by child parsers */ public interface MuleChildDefinitionParser extends MuleDefinitionParser { public void forceParent(BeanDefinition parent); public PropertyConfiguration getTargetPropertyConfiguration(); } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/PreProcessor.java0000644000175000017500000000135410740712271032425 0ustar charlescharles/* * $Id:PreProcessor.java 8321 2007-09-10 19:22:52Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.w3c.dom.Element; /** * This interface allows pre-processing of the element. */ public interface PreProcessor { public void preProcess(PropertyConfiguration config, Element element); }././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/AbstractMuleBeanDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/AbstractMuleBeanDefini0000644000175000017500000004444310774776012033372 0ustar charlescharles/* * $Id:AbstractMuleBeanDefinitionParser.java 5187 2007-02-16 18:00:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.assembly.BeanAssemblerFactory; import org.mule.config.spring.parsers.assembly.DefaultBeanAssemblerFactory; import org.mule.config.spring.parsers.assembly.configuration.ReusablePropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.ValueMap; import org.mule.config.spring.parsers.generic.AutoIdUtils; import org.mule.util.ClassUtils; import org.mule.util.XMLUtils; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * This parser extends the Spring provided {@link AbstractBeanDefinitionParser} to provide additional features for * consistently customising bean representations for Mule bean definition parsers. Most custom bean definition parsers * in Mule will use this base class. The following enhancements are made - * *

    *
  1. A property name which ends with the suffix "-ref" is assumed to be a reference to another bean. * Alternatively, a property can be explicitly registered as a bean reference via registerBeanReference() * *

    For example, * <bpm:connector bpms-ref="testBpms"/> * will automatically set a property "bpms" on the connector to reference a bean named "testBpms" *

  2. * *
  3. Attribute mappings can be registered to control how an attribute name in Mule Xml maps to the bean name in the * object being created. * *

    For example - * addAlias("poolExhaustedAction", "poolExhaustedActionString"); * Maps the 'poolExhaustedAction' to the 'poolExhaustedActionString' property on the bean being created. *

  4. * *
  5. Value Mappings can be used to map key value pairs from selection lists in the XML schema to property values on the * bean being created. These are a comma-separated list of key=value pairs. * *

    For example - * addMapping("action", "NONE=0,ALWAYS_BEGIN=1,BEGIN_OR_JOIN=2,JOIN_IF_POSSIBLE=3"); * The first argument is the bean name to set, the second argument is the set of possible key=value pairs *

  6. * *
  7. Provides an automatic way of setting the 'init-method' and 'destroy-method' for this object. This will then automatically * wire the bean into the lifecycle of the Application context.
  8. * *
  9. The 'singleton' property provides a fixed way to make sure the bean is always a singleton or not.
  10. * *
  11. Collections will be automatically created and extended if the setter matches "property+s".
  12. *
* *

Note that this class is not multi-thread safe. The internal state is reset before each "use" * by {@link #preProcess(org.w3c.dom.Element)} which assumes sequential access.

* * @see AbstractBeanDefinitionParser */ public abstract class AbstractMuleBeanDefinitionParser extends AbstractBeanDefinitionParser implements MuleDefinitionParser { public static final String ROOT_ELEMENT = "mule"; public static final String ATTRIBUTE_ID = "id"; public static final String ATTRIBUTE_NAME = "name"; public static final String ATTRIBUTE_CLASS = "class"; public static final String ATTRIBUTE_REF = "ref"; public static final String ATTRIBUTE_REFS = "refs"; public static final String ATTRIBUTE_REF_SUFFIX = "-" + ATTRIBUTE_REF; public static final String ATTRIBUTE_REFS_SUFFIX = "-" + ATTRIBUTE_REFS; /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); private BeanAssemblerFactory beanAssemblerFactory = new DefaultBeanAssemblerFactory(); protected ReusablePropertyConfiguration beanPropertyConfiguration = new ReusablePropertyConfiguration(); private ParserContext parserContext; private BeanDefinitionRegistry registry; private LinkedList preProcessors = new LinkedList(); private List postProcessors = new LinkedList(); private Set beanAttributes = new HashSet(); // By default Mule objects are not singletons protected boolean singleton = false; /** Allow the bean class to be set explicitly via the "class" attribute. */ private boolean allowClassAttribute = true; private Class classConstraint = null; public AbstractMuleBeanDefinitionParser() { addIgnored(ATTRIBUTE_ID); addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_FORCE_RECURSE); } public MuleDefinitionParserConfiguration addReference(String propertyName) { beanPropertyConfiguration.addReference(propertyName); return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, Map mappings) { beanPropertyConfiguration.addMapping(propertyName, mappings); return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, String mappings) { beanPropertyConfiguration.addMapping(propertyName, mappings); return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, ValueMap mappings) { beanPropertyConfiguration.addMapping(propertyName, mappings); return this; } /** * @param alias The attribute name * @param propertyName The bean property name * @return This instance, allowing chaining during use, avoiding subclasses */ public MuleDefinitionParserConfiguration addAlias(String alias, String propertyName) { beanPropertyConfiguration.addAlias(alias, propertyName); return this; } /** * @param propertyName Property that is a collection * @return This instance, allowing chaining during use, avoiding subclasses */ public MuleDefinitionParserConfiguration addCollection(String propertyName) { beanPropertyConfiguration.addCollection(propertyName); return this; } /** * @param propertyName Property that is to be ignored * @return This instance, allowing chaining during use, avoiding subclasses */ public MuleDefinitionParserConfiguration addIgnored(String propertyName) { beanPropertyConfiguration.addIgnored(propertyName); return this; } public MuleDefinitionParserConfiguration removeIgnored(String propertyName) { beanPropertyConfiguration.removeIgnored(propertyName); return this; } public MuleDefinitionParserConfiguration setIgnoredDefault(boolean ignoreAll) { beanPropertyConfiguration.setIgnoredDefault(ignoreAll); return this; } protected void processProperty(Attr attribute, BeanAssembler assembler) { assembler.extendBean(attribute); } /** * Hook method that derived classes can implement to inspect/change a * bean definition after parsing is complete. * * @param assembler the parsed (and probably totally defined) bean definition being built * @param element the XML element that was the source of the bean definition's metadata */ protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { element.setAttribute(ATTRIBUTE_NAME, getBeanName(element)); for (Iterator attributes = beanAttributes.iterator(); attributes.hasNext();) { assembler.setBeanFlag((String) attributes.next()); } for (Iterator processes = postProcessors.iterator(); processes.hasNext();) { ((PostProcessor) processes.next()).postProcess(context, assembler, element); } } /** * Hook method that derived classes can implement to modify internal state before processing. * * Here we make sure that the internal property configuration state is reset to the * initial configuration for each element (it may be modified by the BeanAssembler) * and that other mutable instance variables are cleared. */ protected void preProcess(Element element) { parserContext = null; registry = null; beanPropertyConfiguration.reset(); Iterator processes = preProcessors.iterator(); while (processes.hasNext()) { ((PreProcessor) processes.next()).preProcess(beanPropertyConfiguration, element); } } /** * Creates a {@link BeanDefinitionBuilder} instance for the * {@link #getBeanClass bean Class} and passes it to the * {@link #doParse} strategy method. * * @param element the element that is to be parsed into a single BeanDefinition * @param parserContext the object encapsulating the current state of the parsing process * @return the BeanDefinition resulting from the parsing of the supplied {@link Element} * @throws IllegalStateException if the bean {@link Class} returned from * {@link #getBeanClass(org.w3c.dom.Element)} is null * @see #doParse */ protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { preProcess(element); setParserContext(parserContext); setRegistry(parserContext.getRegistry()); checkElementNameUnique(element); Class beanClass = getClassInternal(element); BeanDefinitionBuilder builder = createBeanDefinitionBuilder(element, beanClass); builder.setSource(parserContext.extractSource(element)); builder.setSingleton(isSingleton()); List interfaces = ClassUtils.getAllInterfaces(beanClass); if(interfaces!=null) { if(interfaces.contains(Initialisable.class)) { builder.setInitMethodName(Initialisable.PHASE_NAME); } if(interfaces.contains(Disposable.class)) { builder.setDestroyMethodName(Disposable.PHASE_NAME); } } if (parserContext.isNested()) { // Inner bean definition must receive same singleton status as containing bean. builder.setSingleton(parserContext.getContainingBeanDefinition().isSingleton()); } doParse(element, parserContext, builder); return builder.getBeanDefinition(); } protected void setRegistry(BeanDefinitionRegistry registry) { this.registry = registry; } protected BeanDefinitionRegistry getRegistry() { if (null == registry) { throw new IllegalStateException("Set the registry from within doParse"); } return registry; } protected void checkElementNameUnique(Element element) { if (null != element.getAttributeNode(ATTRIBUTE_NAME)) { String name = element.getAttribute(ATTRIBUTE_NAME); if (getRegistry().containsBeanDefinition(name)) { throw new IllegalArgumentException("A service named " + name + " already exists."); } } } protected BeanDefinitionBuilder createBeanDefinitionBuilder(Element element, Class beanClass) { return BeanDefinitionBuilder.rootBeanDefinition(beanClass); } protected Class getClassInternal(Element element) { Class beanClass = null; if (isAllowClassAttribute()) { beanClass = getBeanClassFromAttribute(element); } if (beanClass == null) { beanClass = getBeanClass(element); } if (null != beanClass && null != classConstraint && !classConstraint.isAssignableFrom(beanClass)) { throw new IllegalStateException(beanClass + " not a subclass of " + classConstraint + " for " + XMLUtils.elementToString(element)); } if (null == beanClass) { throw new IllegalStateException("No class for element " + XMLUtils.elementToString(element)); } return beanClass; } /** * Determine the bean class corresponding to the supplied {@link Element} based on an * explicit "class" attribute. * * @param element the Element that is being parsed * @return the {@link Class} of the bean that is being defined via parsing the supplied Element * (must not be null) * @see #parseInternal(org.w3c.dom.Element,ParserContext) */ protected Class getBeanClassFromAttribute(Element element) { String att= beanPropertyConfiguration.getAttributeAlias(ATTRIBUTE_CLASS); String className = element.getAttribute(att); Class clazz = null; if (org.mule.util.StringUtils.isNotBlank(className)) { try { element.removeAttribute(att); //RM* Todo probably need to use OSGi Loader here clazz = ClassUtils.loadClass(className, getClass()); } catch (ClassNotFoundException e) { logger.error("could not load class: " + className, e); } } return clazz; } /** * Determine the bean class corresponding to the supplied {@link Element}. * * @param element the Element that is being parsed * @return the {@link Class} of the bean that is being defined via parsing the supplied Element * (must not be null) * @see #parseInternal(org.w3c.dom.Element,ParserContext) */ protected abstract Class getBeanClass(Element element); /** * Parse the supplied {@link Element} and populate the supplied * {@link BeanDefinitionBuilder} as required. *

The default implementation delegates to the doParse * version without ParserContext argument. * * @param element the XML element being parsed * @param parserContext the object encapsulating the current state of the parsing process * @param builder used to define the BeanDefinition */ protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { BeanAssembler assembler = getBeanAssembler(element, builder); NamedNodeMap attributes = element.getAttributes(); for (int x = 0; x < attributes.getLength(); x++) { Attr attribute = (Attr) attributes.item(x); processProperty(attribute, assembler); } postProcess(getParserContext(), assembler, element); } //@Override protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) throws BeanDefinitionStoreException { return getBeanName(element); } protected boolean isSingleton() { return singleton; } /** * Restricted use - does not include a target. * If possible, use {@link org.mule.config.spring.parsers.AbstractHierarchicalDefinitionParser#getBeanAssembler(org.w3c.dom.Element, org.springframework.beans.factory.support.BeanDefinitionBuilder)} * * @param bean The bean being constructed * @return An assembler that automates Mule-specific logic for bean construction */ protected BeanAssembler getBeanAssembler(Element element, BeanDefinitionBuilder bean) { return getBeanAssemblerFactory().newBeanAssembler( beanPropertyConfiguration, bean, beanPropertyConfiguration, null); } protected boolean isAllowClassAttribute() { return allowClassAttribute; } protected void setAllowClassAttribute(boolean allowClassAttribute) { this.allowClassAttribute = allowClassAttribute; } protected Class getClassConstraint() { return classConstraint; } protected void setClassConstraint(Class classConstraint) { this.classConstraint = classConstraint; } protected ParserContext getParserContext() { return parserContext; } protected void setParserContext(ParserContext parserContext) { this.parserContext = parserContext; } /** * @param element The element to test * @return true if the element's parent is or similar */ protected boolean isTopLevel(Element element) { return element.getParentNode().getLocalName().equals(ROOT_ELEMENT); } public AbstractBeanDefinition muleParse(Element element, ParserContext parserContext) { return parseInternal(element, parserContext); } public MuleDefinitionParserConfiguration registerPreProcessor(PreProcessor preProcessor) { preProcessors.addFirst(preProcessor); return this; } public MuleDefinitionParserConfiguration registerPostProcessor(PostProcessor postProcessor) { postProcessors.add(postProcessor); return this; } public BeanAssemblerFactory getBeanAssemblerFactory() { return beanAssemblerFactory; } public void setBeanAssemblerFactory(BeanAssemblerFactory beanAssemblerFactory) { this.beanAssemblerFactory = beanAssemblerFactory; } public String getBeanName(Element element) { return AutoIdUtils.getUniqueName(element, "mule-bean"); } public MuleDefinitionParserConfiguration addBeanFlag(String flag) { beanAttributes.add(flag); return this; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/MuleDefinitionParserConfiguration.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/MuleDefinitionParserCo0000644000175000017500000000352610745427133033441 0ustar charlescharles/* * $Id: MuleDefinitionParserConfiguration.java 10461 2008-01-22 17:56:43Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.assembly.configuration.ValueMap; import java.util.Map; /** * @see org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration */ public interface MuleDefinitionParserConfiguration { /** * These are prepended to existing processors * @param preProcessor */ MuleDefinitionParserConfiguration registerPreProcessor(PreProcessor preProcessor); /** * These are appended to existing processors * @param postProcessor */ MuleDefinitionParserConfiguration registerPostProcessor(PostProcessor postProcessor); MuleDefinitionParserConfiguration addReference(String propertyName); MuleDefinitionParserConfiguration addMapping(String propertyName, Map mappings); MuleDefinitionParserConfiguration addMapping(String propertyName, String mappings); MuleDefinitionParserConfiguration addMapping(String propertyName, ValueMap mappings); MuleDefinitionParserConfiguration addAlias(String alias, String propertyName); MuleDefinitionParserConfiguration addCollection(String propertyName); MuleDefinitionParserConfiguration addIgnored(String propertyName); MuleDefinitionParserConfiguration removeIgnored(String propertyName); MuleDefinitionParserConfiguration setIgnoredDefault(boolean ignoreAll); MuleDefinitionParserConfiguration addBeanFlag(String flag); }mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/0000755000175000017500000000000011351411147031330 5ustar charlescharles././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/CheckRequiredAttributes.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/CheckRequir0000644000175000017500000001021610754365306033473 0ustar charlescharles/* * $Id: CheckRequiredAttributes.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.util.SpringXMLUtils; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * All attributes from at least one set must be provided */ public class CheckRequiredAttributes implements PreProcessor { // maps from attribute name to attribute set index (integer) private Map knownAttributes = new HashMap(); // maps from attribute set index to number of attributes in that set private Map numberOfAttributes = new HashMap(); // description of acceptable attributes private String summary; public CheckRequiredAttributes(String[][] attributeSets) { StringBuffer buffer = new StringBuffer(); for (int set = 0; set < attributeSets.length; set++) { String[] attributes = attributeSets[set]; // ignore empty sets if (attributes.length > 0) { Integer index = new Integer(set); numberOfAttributes.put(index, new Integer(attributes.length)); if (set > 0) { buffer.append("; "); } for (int attribute = 0; attribute < attributes.length; attribute++) { knownAttributes.put(attributes[attribute], index); if (attribute > 0) { buffer.append(", "); } // don't translate to alias because the error message is in terms of the attributes // the user enters - we don't want to expose the details of translations buffer.append(attributes[attribute]); } } } summary = buffer.toString(); } public void preProcess(PropertyConfiguration config, Element element) { // map from attribute set index to count Map foundAttributesCount = new HashMap(); NamedNodeMap attributes = element.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { String alias = SpringXMLUtils.attributeName((Attr) attributes.item(i)); if (knownAttributes.containsKey(alias)) { Integer index = (Integer) knownAttributes.get(alias); if (!foundAttributesCount.containsKey(index)) { foundAttributesCount.put(index, new Integer(0)); } foundAttributesCount.put(index, new Integer(1 + ((Integer) foundAttributesCount.get(index)).intValue())); } } // if there are no attributes to check for, we are ok boolean ok = knownAttributes.size() == 0; Iterator indices = foundAttributesCount.keySet().iterator(); while (indices.hasNext() && !ok) { Object index = indices.next(); Object count = foundAttributesCount.get(index); ok = numberOfAttributes.get(index).equals(count); } if (!ok) { throw new CheckRequiredAttributesException(element, summary); } } public static class CheckRequiredAttributesException extends IllegalStateException { private CheckRequiredAttributesException(Element element, String summary) { super("Element " + SpringXMLUtils.elementToString(element) + " must have all attributes for one of the sets: " + summary + "."); } } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/ConstructorReference.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/Constructor0000644000175000017500000000203310745726444033615 0ustar charlescharles/* * $Id: ConstructorReference.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PostProcessor; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.w3c.dom.Element; import org.springframework.beans.factory.xml.ParserContext; public class ConstructorReference implements PostProcessor { public String reference; public ConstructorReference(String reference) { this.reference = reference; } public void postProcess(ParserContext unused, BeanAssembler assembler, Element element) { assembler.getBean().addConstructorArgReference(reference); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/RequireAttribute.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/RequireAttr0000644000175000017500000000501110743406323033523 0ustar charlescharles/* * $Id: RequireAttribute.java 10346 2008-01-16 13:55:31Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.util.SpringXMLUtils; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * Throws an exception if any of the required attributes (after translation) are missing. * Designed to cooperates with * {@link org.mule.config.spring.parsers.delegate.AbstractSerialDelegatingDefinitionParser#addHandledException(Class)} */ public class RequireAttribute implements PreProcessor { private Set required; public RequireAttribute(String required) { this(new String[]{required}); } public RequireAttribute(String[] required) { this.required = new HashSet(Arrays.asList(required)); } public void preProcess(PropertyConfiguration config, Element element) { NamedNodeMap attributes = element.getAttributes(); Iterator names = required.iterator(); while (names.hasNext()) { String name = (String) names.next(); boolean found = false; for (int i = 0; i < attributes.getLength() && !found; i++) { String alias = SpringXMLUtils.attributeName((Attr) attributes.item(i)); // don't translate to alias because the error message is in terms of the attributes // the user enters - we don't want to expose the details of translations // found = name.equals(config.translateName(alias)); found = name.equals(alias); } if (!found) { throw new RequireAttributeException("Attribute " + name + " is required here."); } } } public static class RequireAttributeException extends IllegalStateException { public RequireAttributeException(String message) { super(message); } } }././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/AttributeConcatenation.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/AttributeCo0000644000175000017500000000332210745677442033522 0ustar charlescharles/* * $Id: AttributeConcatenation.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.util.StringUtils; import org.w3c.dom.Element; public class AttributeConcatenation implements PreProcessor { private String target; private String separator; private String[] sources; public AttributeConcatenation(String target, String separator, String[] sources) { this.target = target; this.separator = separator; this.sources = sources; } public void preProcess(PropertyConfiguration config, Element element) { StringBuffer concat = new StringBuffer(); boolean first = true; for (int i = 0; i < sources.length; ++i) { String value = config.translateValue(sources[i], element.getAttribute(sources[i])).toString(); if (StringUtils.isNotEmpty(value)) { if (first) { first = false; } else { concat.append(separator); } concat.append(value); } } element.setAttribute(target, concat.toString()); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/NamedSetterChildElementIterator.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/NamedSetter0000644000175000017500000000354510761002550033473 0ustar charlescharles/* * $Id: NamedSetterChildElementIterator.java 11023 2008-02-26 12:26:16Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.assembly.BeanAssemblerFactory; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.springframework.beans.factory.config.BeanDefinition; import org.w3c.dom.Element; /** * This iterates over the child elements, generates beans, and sets them on the current bean via the * setter given. So presumably there's either a single child or the destination is a collection. * *

Since this handles the iteration over children explicitly you need to set the flag * {@link org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate#MULE_NO_RECURSE} * on the parser. * * @see org.mule.config.spring.parsers.processors.AbstractChildElementIterator - please read the * documentation for that processor */ public class NamedSetterChildElementIterator extends AbstractChildElementIterator { private String setter; public NamedSetterChildElementIterator(String setter, BeanAssemblerFactory beanAssemblerFactory, PropertyConfiguration configuration) { super(beanAssemblerFactory, configuration); this.setter = setter; } protected void insertBean(BeanAssembler targetAssembler, BeanDefinition childBean, Element parent, Element child) { targetAssembler.extendTarget(setter, setter, childBean); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/AddAttribute.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/AddAttribut0000644000175000017500000000246410745726444033507 0ustar charlescharles/* * $Id: AddAttribute.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PostProcessor; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.w3c.dom.Element; import org.springframework.beans.factory.xml.ParserContext; public class AddAttribute implements PreProcessor, PostProcessor { private String name; private String value; public AddAttribute(String name, String value) { this.name = name; this.value = value; } public void postProcess(ParserContext unused, BeanAssembler assembler, Element element) { element.setAttribute(name, value); } public void preProcess(PropertyConfiguration config, Element element) { element.setAttribute(name, value); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/ProvideDefaultName.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/ProvideDefa0000644000175000017500000000223710756614703033462 0ustar charlescharles/* * $Id: ProvideDefaultName.java 10889 2008-02-19 18:02:43Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.generic.AutoIdUtils; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.w3c.dom.Element; public class ProvideDefaultName implements PreProcessor { private String prefix; public ProvideDefaultName(String prefix) { this.prefix = prefix; } public void preProcess(PropertyConfiguration config, Element element) { element.setAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME, AutoIdUtils.getUniqueName(element, prefix)); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/NameAttribute.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/NameAttribu0000644000175000017500000000132010754365306033475 0ustar charlescharles/* * $Id: NameAttribute.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; public class NameAttribute extends AddAttribute { public NameAttribute(String name) { super(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME, name); } }././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/IdAttribute.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/IdAttribute0000644000175000017500000000130510754365306033505 0ustar charlescharles/* * $Id: IdAttribute.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; public class IdAttribute extends AddAttribute { public IdAttribute(String id) { super(AbstractMuleBeanDefinitionParser.ATTRIBUTE_ID, id); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/AbstractChildElementIterator.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/AbstractChi0000644000175000017500000000726110762063120033447 0ustar charlescharles/* * $Id: AbstractChildElementIterator.java 11138 2008-02-29 20:08:48Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PostProcessor; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.assembly.BeanAssemblerFactory; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.beans.factory.config.BeanDefinition; /** * This iterates over child elements, parsing them and calling * {@link #insertBean(org.mule.config.spring.parsers.assembly.BeanAssembler, org.springframework.beans.factory.config.BeanDefinition, org.w3c.dom.Element, org.w3c.dom.Element)}. * *

There are two ways we can parse a tree of elements - have an external loop or let each parser iterate * over its own children. Mule uses the first strategy, but some (most? all?) third party BDPs use the * second. This processor lets us use third party beans inside the Mule framework. * *

So this is a very specialised parser that should only be used when trying to inter-operate with beans from * third party packages which themselves control how their children are parsed. * *

Since for Mule beans the iteration over child elements (at least currently) is done via * {@link org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate} the calling parser needs to set * the flag {@link org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate#MULE_NO_RECURSE} - this * stops the Mule recursion from working. * *

NOTE - IMHO (ac) the Mule approach was probably a mistake; this processor could be used as a way to * slowly migrate the Mule code to the more common approach. */ public abstract class AbstractChildElementIterator implements PostProcessor { private BeanAssemblerFactory beanAssemblerFactory; private PropertyConfiguration configuration; public AbstractChildElementIterator(BeanAssemblerFactory beanAssemblerFactory, PropertyConfiguration configuration) { this.beanAssemblerFactory = beanAssemblerFactory; this.configuration = configuration; } public void postProcess(ParserContext context, BeanAssembler assembler, Element element) { NodeList children = element.getChildNodes(); for (int i = 0; i < children.getLength(); ++i) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { processChildElement(context, assembler, element, (Element) child); } } } protected void processChildElement(ParserContext context, BeanAssembler assembler, Element parent, Element child) { BeanDefinition childBean = context.getDelegate().parseCustomElement(child, assembler.getBean().getBeanDefinition()); BeanAssembler targetAssembler = beanAssemblerFactory.newBeanAssembler(null, null, configuration, assembler.getBean().getRawBeanDefinition()); insertBean(targetAssembler, childBean, parent, child); } protected abstract void insertBean(BeanAssembler targetAssembler, BeanDefinition childBean, Element parent, Element child); } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/ExtendTarget.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/ExtendTarge0000644000175000017500000000224710745726444033511 0ustar charlescharles/* * $Id: ExtendTarget.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PostProcessor; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.springframework.beans.factory.xml.ParserContext; public class ExtendTarget implements PostProcessor { private String name; private String value; public ExtendTarget(String name, String value) { this.name = name; this.value = value; } public void postProcess(ParserContext unused, BeanAssembler assembler, Element element) { Attr attribute = element.getOwnerDocument().createAttribute(name); attribute.setNodeValue(value); assembler.extendTarget(attribute); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/CheckExclusiveAttribute.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/CheckExclus0000644000175000017500000000544110740712271033463 0ustar charlescharles/* * $Id:CheckExclusiveAttributes.java 8321 2007-09-10 19:22:52Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.util.SpringXMLUtils; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * If this attribute is present, no other can be */ public class CheckExclusiveAttribute implements PreProcessor { public static final int NONE = -1; private String attribute; public CheckExclusiveAttribute(String attribute) { this.attribute = attribute; } public void preProcess(PropertyConfiguration config, Element element) { List foundAttributes = new LinkedList(); boolean found = false; NamedNodeMap attributes = element.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { String alias = SpringXMLUtils.attributeName((Attr) attributes.item(i)); if (! config.isIgnored(alias)) { if (attribute.equals(alias)) { found = true; } else { foundAttributes.add(alias); } } } if (found && foundAttributes.size() > 0) { StringBuffer message = new StringBuffer("The attribute '"); message.append(attribute); message.append("' cannot appear with the attribute"); if (foundAttributes.size() > 1) { message.append("s"); } Iterator others = foundAttributes.iterator(); while (others.hasNext()) { message.append(" '"); message.append(others.next()); message.append("'"); } message.append(" in element "); message.append(SpringXMLUtils.elementToString(element)); message.append("."); throw new CheckExclusiveAttributeException(message.toString()); } } public static class CheckExclusiveAttributeException extends IllegalStateException { private CheckExclusiveAttributeException(String message) { super(message); } } }././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/BlockAttribute.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/BlockAttrib0000644000175000017500000000410010740712271033451 0ustar charlescharles/* * $Id: BlockAttribute.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.util.SpringXMLUtils; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * Throws an exception if any of the disallowed attributes (after translation) is present. * Designed to cooperates with * {@link org.mule.config.spring.parsers.delegate.AbstractSerialDelegatingDefinitionParser#addHandledException(Class)} */ public class BlockAttribute implements PreProcessor { private Set disallowed; public BlockAttribute(String disallowed) { this(new String[]{disallowed}); } public BlockAttribute(String[] disallowed) { this.disallowed = new HashSet(Arrays.asList(disallowed)); } public void preProcess(PropertyConfiguration config, Element element) { NamedNodeMap attributes = element.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { String alias = SpringXMLUtils.attributeName((Attr) attributes.item(i)); String name = config.translateName(alias); if (disallowed.contains(name)) { throw new BlockAttributeException("Attribute " + alias + " is not allowed here."); } } } public static class BlockAttributeException extends IllegalStateException { private BlockAttributeException(String message) { super(message); } } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/CheckExclusiveAttributes.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/CheckExclus0000644000175000017500000000714110740712271033462 0ustar charlescharles/* * $Id:CheckExclusiveAttributes.java 8321 2007-09-10 19:22:52Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.util.SpringXMLUtils; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * Attributes from two different sets cannot appear together */ public class CheckExclusiveAttributes implements PreProcessor { public static final int NONE = -1; private Map knownAttributes = new HashMap(); public CheckExclusiveAttributes(String[][] attributeSets) { for (int set = 0; set < attributeSets.length; set++) { String[] attributes = attributeSets[set]; for (int attribute = 0; attribute < attributes.length; attribute++) { knownAttributes.put(attributes[attribute], new Integer(set)); } } } public void preProcess(PropertyConfiguration config, Element element) { List foundAttributes = new LinkedList(); int foundSetIndex = NONE; NamedNodeMap attributes = element.getAttributes(); for (int i = 0; i < attributes.getLength(); i++) { String alias = SpringXMLUtils.attributeName((Attr) attributes.item(i)); // don't translate to alias because the error message is in terms of the attributes // the user enters - we don't want to expose the details of translations // String name = null == config ? alias : config.translateName(alias); if (knownAttributes.containsKey(alias)) { int index = ((Integer) knownAttributes.get(alias)).intValue(); if (foundSetIndex != NONE && foundSetIndex != index) { StringBuffer message = new StringBuffer("The attribute '"); message.append(alias); message.append("' cannot appear with the attribute"); if (foundAttributes.size() > 1) { message.append("s"); } Iterator found = foundAttributes.iterator(); while (found.hasNext()) { message.append(" '"); message.append(found.next()); message.append("'"); } message.append(" in element "); message.append(SpringXMLUtils.elementToString(element)); message.append("."); throw new CheckExclusiveAttributesException(message.toString()); } else { foundSetIndex = index; foundAttributes.add(alias); } } } } public static class CheckExclusiveAttributesException extends IllegalStateException { private CheckExclusiveAttributesException(String message) { super(message); } } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/ProvideDefaultNameFromElement.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/processors/ProvideDefa0000644000175000017500000000222610770356575033466 0ustar charlescharles/* * $Id: ProvideDefaultNameFromElement.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.generic.AutoIdUtils; import org.w3c.dom.Element; public class ProvideDefaultNameFromElement implements PreProcessor { public void preProcess(PropertyConfiguration config, Element element) { if (AutoIdUtils.blankAttribute(element, AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME)) { element.setAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME, element.getLocalName()); } } }././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/IndependentDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/IndependentDefinitionP0000644000175000017500000000206610745677442033465 0ustar charlescharles/* * $Id: IndependentDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.BeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; public class IndependentDefinitionParser implements BeanDefinitionParser { public BeanDefinition parse(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(Object.class); return builder.getBeanDefinition(); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/MuleDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/MuleDefinitionParser.j0000644000175000017500000000376310745726444033421 0ustar charlescharles/* * $Id: MuleDefinitionParser.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.BeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * This is the interface all Mule BDPs implement. It is a bit odd because it had to be retro-fitted * to existing code. In particular {@link org.springframework.beans.factory.xml.BeanDefinitionParser#parse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)} * and {@link #muleParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)} * seem to duplicate each other. This is because many Mule classes subclass a Spring helper which makes * parse() final. So instead we need to use {@link #muleParse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)}, * to allow over-rides. * *

In case that's not clear - always call {@link # muleParse (org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)} * rather than {@link org.springframework.beans.factory.xml.BeanDefinitionParser#parse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext)}. * The {@link org.springframework.beans.factory.xml.BeanDefinitionParser} is here only to allow the BDP * to be handed over to Spring. */ public interface MuleDefinitionParser extends BeanDefinitionParser, MuleDefinitionParserConfiguration { AbstractBeanDefinition muleParse(Element element, ParserContext parserContext); String getBeanName(Element element); } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/0000755000175000017500000000000011351411151030673 5ustar charlescharles././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/SingleParentFamilyDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/SingleParentF0000644000175000017500000000343710740712271033336 0ustar charlescharles/* * $Id: SingleParentFamilyDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.MuleChildDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParserConfiguration; public class SingleParentFamilyDefinitionParser extends AbstractSingleParentFamilyDefinitionParser { public SingleParentFamilyDefinitionParser(MuleDefinitionParser parent) { // avoid the overriden method here super.addDelegate(parent); parent.setIgnoredDefault(false); } protected MuleDefinitionParserConfiguration addDelegate(MuleDefinitionParser delegate) { throw new UnsupportedOperationException("Delegates must be associated with attribute names"); } public SingleParentFamilyDefinitionParser addChildDelegate(String attribute, MuleChildDefinitionParser delegate) { return addChildDelegate(new String[]{attribute}, delegate); } public SingleParentFamilyDefinitionParser addChildDelegate(String[] attributes, MuleChildDefinitionParser delegate) { super.addChildDelegate(delegate); delegate.setIgnoredDefault(true); for (int i = 0; i < attributes.length; i++) { getDelegate(0).addIgnored(attributes[i]); delegate.removeIgnored(attributes[i]); } return this; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/MapDefinitionParserMutator.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/MapDefinition0000644000175000017500000000661610745726444033401 0ustar charlescharles/* * $Id: MapDefinitionParserMutator.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.MuleChildDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.assembly.TwoStageMapBeanAssemblerFactory; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * This changes a {@link org.mule.config.spring.parsers.generic.ChildDefinitionParser} * so that it generates a map instead of a bean definition. This is useful for converting * parsers to work with the object factory (which requires a map). */ public class MapDefinitionParserMutator extends AbstractDelegatingDefinitionParser implements TwoStageMapBeanAssemblerFactory.BeanAssemblerStore, MuleChildDefinitionParser { private String setter; private Element currentElement; private Map pendingAssemblers = new HashMap(); public MapDefinitionParserMutator(String setter, ChildDefinitionParser delegate) { super(new MuleDefinitionParser[]{delegate}); this.setter = setter; // this is where we set the callback delegate.setBeanAssemblerFactory(new TwoStageMapBeanAssemblerFactory(this)); } public AbstractBeanDefinition muleParse(Element element, ParserContext parserContext) { if (pendingAssemblers.containsKey(element)) { // this is the second call, after the children have been processed BeanAssembler beanAssembler = (BeanAssembler) pendingAssemblers.get(element); pendingAssemblers.remove(element); beanAssembler.insertBeanInTarget(setter); return null; } else { // first call, so process in normal manner, but set current element so that // when the store callback is called, we can associate the assembler with this // element currentElement = element; return getChildDelegate().muleParse(element, parserContext); } } public void saveBeanAssembler(BeanAssembler beanAssembler) { // this is called by the bean assembler from inside parseDelegate above. pendingAssemblers.put(currentElement, beanAssembler); } protected ChildDefinitionParser getChildDelegate() { return (ChildDefinitionParser) getDelegate(0); } public void forceParent(BeanDefinition parent) { getChildDelegate().forceParent(parent); } public PropertyConfiguration getTargetPropertyConfiguration() { return getChildDelegate().getTargetPropertyConfiguration(); } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractSingleParentFamilyDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractSingl0000644000175000017500000000555210740712271033375 0ustar charlescharles/* * $Id: AbstractSingleParentFamilyDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.MuleChildDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParserConfiguration; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * This allows several parsers to be used on a single element, creating a parent bean with * the first parser and then extending that with child parsers. * *

Note that this make a lot of assumptions about what type of parser is used. */ public abstract class AbstractSingleParentFamilyDefinitionParser extends AbstractFirstResultSerialDefinitionParser { public AbstractSingleParentFamilyDefinitionParser() { super(); } public AbstractSingleParentFamilyDefinitionParser(boolean doReset) { super(doReset); } protected MuleChildDefinitionParser addChildDelegate(MuleChildDefinitionParser delegate) { return (MuleChildDefinitionParser) super.addDelegate(delegate); } protected MuleDefinitionParserConfiguration addDelegate(MuleDefinitionParser delegate) { if (size() > 0) { return addDelegateAsChild(delegate); } else { return super.addDelegate(delegate); } } protected MuleDefinitionParserConfiguration addDelegateAsChild(MuleDefinitionParser delegate) { if (delegate instanceof MuleChildDefinitionParser) { return addChildDelegate((MuleChildDefinitionParser) delegate); } else { throw new IllegalStateException("Children must implement child interface"); } } protected AbstractBeanDefinition doSingleBean(int index, MuleDefinitionParser parser, Element element, ParserContext parserContext) { if (0 != index) { ((MuleChildDefinitionParser) parser).forceParent(firstDefinition); // we need this because we often block "everything but" which would mean // being unable to set ourselves on the parent ((MuleChildDefinitionParser) parser).getTargetPropertyConfiguration().setIgnoredDefault(false); } return super.doSingleBean(index, parser, element, parserContext); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AttributeSelectionDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AttributeSele0000644000175000017500000000435310740712271033407 0ustar charlescharles/* * $Id: AttributeSelectionDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.util.SpringXMLUtils; import org.mule.util.CollectionUtils; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * Select sub parser depending on presence of a particular attribute */ public class AttributeSelectionDefinitionParser extends AbstractParallelDelegatingDefinitionParser { private Map attributeToParserIndex = new HashMap(); public AttributeSelectionDefinitionParser(String attribute, MuleDefinitionParser delegate) { super(); addDelegate(attribute, delegate); } public void addDelegate(String attribute, MuleDefinitionParser delegate) { addDelegate(delegate); attributeToParserIndex.put(attribute, new Integer(size() - 1)); delegate.setIgnoredDefault(true); delegate.removeIgnored(attribute); } protected MuleDefinitionParser getDelegate(Element element, ParserContext parserContext) { NamedNodeMap attributes = element.getAttributes(); for (int i = 0; i < attributes.getLength(); ++i) { String attribute = SpringXMLUtils.attributeName((Attr) attributes.item(i)); if (attributeToParserIndex.containsKey(attribute)) { return getDelegate(((Integer) attributeToParserIndex.get(attribute)).intValue()); } } throw new IllegalArgumentException("Element " + SpringXMLUtils.elementToString(element) + " does not contain any attribute from " + CollectionUtils.toString(attributeToParserIndex.keySet(), 10, false)); } }././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractPluggableDelegate.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractPlugg0000644000175000017500000000647410745726444033417 0ustar charlescharles/* * $Id: AbstractPluggableDelegate.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParserConfiguration; import org.mule.config.spring.parsers.PostProcessor; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.ValueMap; import java.util.Map; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Support for extending a * {@link org.mule.config.spring.parsers.MuleDefinitionParser} without * needing to subclass. */ public abstract class AbstractPluggableDelegate implements MuleDefinitionParser { private MuleDefinitionParser delegate; public AbstractPluggableDelegate(MuleDefinitionParser delegate) { this.delegate = delegate; } public AbstractBeanDefinition muleParse(Element element, ParserContext parserContext) { return delegate.muleParse(element, parserContext); } public MuleDefinitionParserConfiguration registerPreProcessor(PreProcessor preProcessor) { delegate.registerPreProcessor(preProcessor); return this; } public MuleDefinitionParserConfiguration registerPostProcessor(PostProcessor postProcessor) { delegate.registerPostProcessor(postProcessor); return this; } public MuleDefinitionParserConfiguration addReference(String propertyName) { delegate.addReference(propertyName); return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, Map mappings) { delegate.addMapping(propertyName, mappings); return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, String mappings) { delegate.addMapping(propertyName, mappings); return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, ValueMap mappings) { delegate.addMapping(propertyName, mappings); return this; } public MuleDefinitionParserConfiguration addAlias(String alias, String propertyName) { delegate.addAlias(alias, propertyName); return this; } public MuleDefinitionParserConfiguration addCollection(String propertyName) { delegate.addCollection(propertyName); return this; } public MuleDefinitionParserConfiguration addIgnored(String propertyName) { delegate.addIgnored(propertyName); return this; } public MuleDefinitionParserConfiguration removeIgnored(String propertyName) { delegate.removeIgnored(propertyName); return this; } public MuleDefinitionParserConfiguration setIgnoredDefault(boolean ignoreAll) { delegate.setIgnoredDefault(ignoreAll); return this; } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractFirstResultSerialDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractFirst0000644000175000017500000000471610740737111033411 0ustar charlescharles/* * $Id: AbstractFirstResultSerialDefinitionParser.java 10258 2008-01-08 18:17:45Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Extend {@link org.mule.config.spring.parsers.delegate.AbstractSerialDelegatingDefinitionParser} * to return the first definition as the final result */ public class AbstractFirstResultSerialDefinitionParser extends AbstractSerialDelegatingDefinitionParser { protected AbstractBeanDefinition firstDefinition; private boolean returnFirstResult = true; public AbstractFirstResultSerialDefinitionParser() { super(); } public AbstractFirstResultSerialDefinitionParser(boolean doReset) { super(doReset); } public void setReturnFirstResult(boolean returnFirstResult) { this.returnFirstResult = returnFirstResult; } protected AbstractBeanDefinition doSingleBean(int index, MuleDefinitionParser parser, Element element, ParserContext parserContext) { try { AbstractBeanDefinition result = null; try { result = super.doSingleBean(index, parser, element, parserContext); } catch (RuntimeException e) { if (!isExceptionHandled(e)) { throw e; } } if (0 == index) { firstDefinition = result; } if (size() == index + 1) { if (returnFirstResult) { return firstDefinition; } else { return result; } } else { return null; } } catch (RuntimeException e) { firstDefinition = null; throw e; } } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/InheritDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/InheritDefini0000644000175000017500000000271310754365306033362 0ustar charlescharles/* * $Id: InheritDefinitionParser.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.generic.NamedDefinitionParser; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; /** * This encapsulates two definition parsers - orphan and named - and returns the * named definition parser if the "inherit" attribute is set. This allows a named * orphan to be defined (inherit="false") and then extended (inherit="true"). * The two sub-parsers must be consistent, as described in * {@link org.mule.config.spring.parsers.delegate.AbstractParallelDelegatingDefinitionParser} */ public class InheritDefinitionParser extends BooleanAttributeSelectionDefinitionParser { public static final String INHERIT = "inherit"; public InheritDefinitionParser(OrphanDefinitionParser orphan, NamedDefinitionParser named) { this(false, orphan, named); } public InheritDefinitionParser(boolean deflt, OrphanDefinitionParser orphan, NamedDefinitionParser named) { super(INHERIT, deflt, named, orphan); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AllAttributeChildDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AllAttributeC0000644000175000017500000001321110745726444033337 0ustar charlescharles/* * $Id: AllAttributeChildDefinitionParser.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParserConfiguration; import org.mule.config.spring.parsers.PostProcessor; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.SimplePropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.ValueMap; import org.mule.config.spring.parsers.collection.DynamicAttributeDefinitionParser; import org.mule.config.spring.parsers.generic.AutoIdUtils; import org.mule.config.spring.util.SpringXMLUtils; import java.util.Map; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * This is a very hurried demonstration. It needs improving! */ public class AllAttributeChildDefinitionParser extends AbstractBeanDefinitionParser implements MuleDefinitionParser { private DynamicAttributeDefinitionParser delegate; private PropertyConfiguration configuration = new SimplePropertyConfiguration(); public AllAttributeChildDefinitionParser(DynamicAttributeDefinitionParser delegate) { addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_ID); addIgnored(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); this.delegate = delegate; } protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { NamedNodeMap attributes = element.getAttributes(); for (int i = 0; i < attributes.getLength(); ++i) { String name = SpringXMLUtils.attributeName((Attr) attributes.item(i)); if (!isIgnored(name)) { delegate.setAttributeName(name); delegate.muleParse(element, parserContext); } } return null; } public AbstractBeanDefinition muleParse(Element element, ParserContext parserContext) { return parseInternal(element, parserContext); } public MuleDefinitionParserConfiguration registerPreProcessor(PreProcessor preProcessor) { delegate.registerPreProcessor(preProcessor); return this; } public MuleDefinitionParserConfiguration registerPostProcessor(PostProcessor postProcessor) { delegate.registerPostProcessor(postProcessor); return this; } public MuleDefinitionParserConfiguration addReference(String propertyName) { configuration.addReference(propertyName); return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, Map mappings) { configuration.addMapping(propertyName, mappings); return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, String mappings) { configuration.addMapping(propertyName, mappings); return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, ValueMap mappings) { configuration.addMapping(propertyName, mappings); return this; } public MuleDefinitionParserConfiguration addAlias(String alias, String propertyName) { configuration.addAlias(alias, propertyName); return this; } public MuleDefinitionParserConfiguration addCollection(String propertyName) { configuration.addCollection(propertyName); return this; } public MuleDefinitionParserConfiguration addIgnored(String propertyName) { configuration.addIgnored(propertyName); return this; } public MuleDefinitionParserConfiguration removeIgnored(String propertyName) { configuration.removeIgnored(propertyName); return this; } public MuleDefinitionParserConfiguration setIgnoredDefault(boolean ignoreAll) { configuration.setIgnoredDefault(ignoreAll); return this; } public String getAttributeMapping(String alias) { return configuration.getAttributeMapping(alias); } public boolean isCollection(String propertyName) { return configuration.isCollection(propertyName); } public boolean isIgnored(String propertyName) { return configuration.isIgnored(propertyName); } public boolean isBeanReference(String attributeName) { return configuration.isReference(attributeName); } public String translateName(String oldName) { return configuration.translateName(oldName); } public Object translateValue(String name, String value) { return configuration.translateValue(name, value); } public String getBeanName(Element element) { return AutoIdUtils.getUniqueName(element, "all-attribute"); } public MuleDefinitionParserConfiguration addBeanFlag(String flag) { delegate.addBeanFlag(flag); return this; } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/BooleanAttributeSelectionDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/BooleanAttrib0000644000175000017500000000330110745677442033367 0ustar charlescharles/* * $Id: BooleanAttributeSelectionDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; public class BooleanAttributeSelectionDefinitionParser extends AbstractParallelDelegatingDefinitionParser { private String attribute; private boolean dflt; private MuleDefinitionParser whenTrue; private MuleDefinitionParser whenFalse; public BooleanAttributeSelectionDefinitionParser(String attribute, boolean dflt, MuleDefinitionParser whenTrue, MuleDefinitionParser whenFalse) { super(new MuleDefinitionParser[]{whenTrue, whenFalse}); this.attribute = attribute; this.dflt = dflt; this.whenTrue = whenTrue; this.whenFalse = whenFalse; addIgnored(attribute); } protected MuleDefinitionParser getDelegate(Element element, ParserContext parserContext) { boolean value = dflt; if (null != element && element.hasAttribute(attribute)) { value = Boolean.valueOf(element.getAttribute(attribute)).booleanValue(); } if (value) { return whenTrue; } else { return whenFalse; } } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractParallelDelegatingDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractParal0000644000175000017500000000344110745726444033367 0ustar charlescharles/* * $Id: AbstractParallelDelegatingDefinitionParser.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * This allows a definition parsers to be dynamically represented by one instance * selected from a set of parsers, depending on the context. For example, a single * Mule model may be defined across several file - the first file used defines the * model and subsequent uses extend it (for this particular case, see * {@link InheritDefinitionParser}). * *

Note that the sub-parsers must be consistent. That includes matching the * same schema, for example. */ public abstract class AbstractParallelDelegatingDefinitionParser extends AbstractDelegatingDefinitionParser { protected AbstractParallelDelegatingDefinitionParser() { super(); } protected AbstractParallelDelegatingDefinitionParser(MuleDefinitionParser[] delegates) { super(delegates); } public AbstractBeanDefinition muleParse(Element element, ParserContext parserContext) { return getDelegate(element, parserContext).muleParse(element, parserContext); } protected abstract MuleDefinitionParser getDelegate(Element element, ParserContext parserContext); } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractSerialDelegatingDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractSeria0000644000175000017500000001676210745726444033405 0ustar charlescharles/* * $Id: AbstractSerialDelegatingDefinitionParser.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParserConfiguration; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.util.StringUtils; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import edu.emory.mathcs.backport.java.util.Arrays; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * This allows a set of definition parsers to be used, one after another, to process * the same element. This lets multiple beans be generated from a single element. * *

Since each bean typically needs a spearate name, this class guarantees that the * name and id attributes are reset before each call. Delegates can then modify these * on the element without worrying about interfering with other parsers.

* *

Typically, subclasses will add additional processing with * {@link org.mule.config.spring.parsers.PreProcessor} and * {@link org.mule.config.spring.parsers.PostProcessor} anonymous classes.

*/ public abstract class AbstractSerialDelegatingDefinitionParser extends AbstractDelegatingDefinitionParser { private int index = 0; private boolean first; private boolean doReset; private String originalId; private String originalName; private Set handledExceptions = new HashSet(); public AbstractSerialDelegatingDefinitionParser() { this(true); // by default, reset name } /** * @param doReset Should the name be reset after called. This is typically true (it protects the * parent from changes made by children) unless this is itself nested. */ public AbstractSerialDelegatingDefinitionParser(boolean doReset) { this.doReset = doReset; } public AbstractBeanDefinition muleParse(Element element, ParserContext parserContext) { if (index == 0 || index >= size()) { first = true; index = 0; } else { first = false; } AbstractBeanDefinition bean = null; while (null == bean && index < size()) { try { MuleDefinitionParser parser = getDelegate(index); bean = doSingleBean(index++, parser, element, parserContext); } catch (RuntimeException e) { if (isExceptionHandled(e)) { bean = null; } else { throw e; } } } if (null != bean) { if (index == size()) { bean.removeAttribute(MuleHierarchicalBeanDefinitionParserDelegate.MULE_REPEAT_PARSE); } else { bean.setAttribute(MuleHierarchicalBeanDefinitionParserDelegate.MULE_REPEAT_PARSE, Boolean.TRUE); } } return bean; } protected boolean isExceptionHandled(Exception e) { return handledExceptions.contains(e.getClass()); } protected AbstractBeanDefinition doSingleBean(int index, MuleDefinitionParser parser, Element element, ParserContext parserContext) { return parser.muleParse(element, parserContext); } protected MuleDefinitionParserConfiguration addDelegate(MuleDefinitionParser delegate) { delegate.registerPreProcessor(new PreProcessor() { public void preProcess(PropertyConfiguration config, Element element) { if (first) { originalId = element.getAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_ID); originalName = element.getAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); } else if (doReset) { resetNameAndId(element); } } }); return super.addDelegate(delegate); } protected void resetNameAndId(Element element) { resetAttribute(element, AbstractMuleBeanDefinitionParser.ATTRIBUTE_ID, originalId); resetAttribute(element, AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME, originalName); } protected void resetAttribute(Element element, String name, String value) { if (StringUtils.isEmpty(value)) { if (element.hasAttribute(name)) { element.removeAttribute(name); } } else { element.setAttribute(name, value); } } protected void addHandledException(Class exception) { handledExceptions.add(exception); } /** * A utility class for selecting certain attributes. If the attributes are enabled, * the default is set to block others; if specific attributes are disabled the default * is set to allow others. * * @param delegate * @param attributes * @param enable */ public static void enableAttributes(MuleDefinitionParser delegate, String[] attributes, boolean enable) { // if enabling specific attributes, block globally delegate.setIgnoredDefault(enable); Iterator names = Arrays.asList(attributes).iterator(); while (names.hasNext()) { String name = (String) names.next(); if (enable) { delegate.removeIgnored(name); } else { delegate.addIgnored(name); } } } public static void enableAttributes(MuleDefinitionParser delegate, String[][] attributes) { for (int i = 0; i < attributes.length; ++i) { enableAttributes(delegate, attributes[i], true); } } public static void enableAttributes(MuleDefinitionParser delegate, String[] attributes) { enableAttributes(delegate, attributes, true); } public static void enableAttribute(MuleDefinitionParser delegate, String attribute) { enableAttributes(delegate, new String[]{attribute}, true); } public static void disableAttributes(MuleDefinitionParser delegate, String[][] attributes) { for (int i = 0; i < attributes.length; ++i) { enableAttributes(delegate, attributes[i], false); } } public static void disableAttributes(MuleDefinitionParser delegate, String[] attributes) { enableAttributes(delegate, attributes, false); } public static void disableAttribute(MuleDefinitionParser delegate, String attribute) { enableAttributes(delegate, new String[]{attribute}, false); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractDelegatingDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractDeleg0000644000175000017500000001326210754403514033340 0ustar charlescharles/* * $Id: AbstractDelegatingDefinitionParser.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParserConfiguration; import org.mule.config.spring.parsers.PostProcessor; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.ValueMap; import org.mule.config.spring.parsers.generic.AutoIdUtils; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; import org.mule.util.ArrayUtils; import java.util.Map; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * This allows a definition parsers to be dynamically represented by different * definition parsers, depending on the context. For example, a single model may * be defined across file - the first use defines the model and subsequent uses * extend it (for this particular case, see {@link InheritDefinitionParser}). * *

Note that the sub-parsers must be consistent. That includes matching the * same schema, for example.

*/ public abstract class AbstractDelegatingDefinitionParser extends AbstractBeanDefinitionParser implements MuleDefinitionParser { private MuleDefinitionParser[] delegates; protected AbstractDelegatingDefinitionParser() { this(new MuleDefinitionParser[0]); } protected AbstractDelegatingDefinitionParser(MuleDefinitionParser[] delegates) { this.delegates = delegates; addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_FORCE_RECURSE); } protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { return muleParse(element, parserContext); } protected MuleDefinitionParserConfiguration addDelegate(MuleDefinitionParser delegate) { delegates = (MuleDefinitionParser[]) ArrayUtils.add(delegates, delegate); return delegate; } protected int size() { return delegates.length; } protected MuleDefinitionParser getDelegate(int index) { return delegates[index]; } public MuleDefinitionParserConfiguration registerPreProcessor(PreProcessor preProcessor) { for (int i = 0; i < delegates.length; ++i) { delegates[i].registerPreProcessor(preProcessor); } return this; } public MuleDefinitionParserConfiguration registerPostProcessor(PostProcessor postProcessor) { for (int i = 0; i < delegates.length; ++i) { delegates[i].registerPostProcessor(postProcessor); } return this; } public MuleDefinitionParserConfiguration addReference(String propertyName) { for (int i = 0; i < delegates.length; ++i) { delegates[i].addReference(propertyName); } return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, Map mappings) { for (int i = 0; i < delegates.length; ++i) { delegates[i].addMapping(propertyName, mappings); } return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, String mappings) { for (int i = 0; i < delegates.length; ++i) { delegates[i].addMapping(propertyName, mappings); } return this; } public MuleDefinitionParserConfiguration addMapping(String propertyName, ValueMap mappings) { for (int i = 0; i < delegates.length; ++i) { delegates[i].addMapping(propertyName, mappings); } return this; } public MuleDefinitionParserConfiguration addAlias(String alias, String propertyName) { for (int i = 0; i < delegates.length; ++i) { delegates[i].addAlias(alias, propertyName); } return this; } public MuleDefinitionParserConfiguration addCollection(String propertyName) { for (int i = 0; i < delegates.length; ++i) { delegates[i].addCollection(propertyName); } return this; } public MuleDefinitionParserConfiguration addIgnored(String propertyName) { for (int i = 0; i < delegates.length; ++i) { delegates[i].addIgnored(propertyName); } return this; } public MuleDefinitionParserConfiguration removeIgnored(String propertyName) { for (int i = 0; i < delegates.length; ++i) { delegates[i].removeIgnored(propertyName); } return this; } public MuleDefinitionParserConfiguration setIgnoredDefault(boolean ignoreAll) { for (int i = 0; i < delegates.length; ++i) { delegates[i].setIgnoredDefault(ignoreAll); } return this; } public String getBeanName(Element element) { return AutoIdUtils.getUniqueName(element, "delegate"); } public MuleDefinitionParserConfiguration addBeanFlag(String flag) { for (int i = 0; i < delegates.length; ++i) { delegates[i].addBeanFlag(flag); } return this; } }././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractSingleParentFamilyChildDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/AbstractSingl0000644000175000017500000000270010740712271033365 0ustar charlescharles/* * $Id: AbstractSingleParentFamilyChildDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.MuleChildDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParserConfiguration; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.springframework.beans.factory.config.BeanDefinition; public class AbstractSingleParentFamilyChildDefinitionParser extends AbstractSingleParentFamilyDefinitionParser implements MuleChildDefinitionParser { protected MuleDefinitionParserConfiguration addDelegate(MuleDefinitionParser delegate) { return addDelegateAsChild(delegate); } public void forceParent(BeanDefinition parent) { ((MuleChildDefinitionParser) getDelegate(0)).forceParent(parent); } public PropertyConfiguration getTargetPropertyConfiguration() { return ((MuleChildDefinitionParser) getDelegate(0)).getTargetPropertyConfiguration(); } }././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/ParentContextDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/delegate/ParentContext0000644000175000017500000001354511003375564033437 0ustar charlescharles/* * $Id: ParentContextDefinitionParser.java 11631 2008-04-22 14:51:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.delegate; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.mule.config.spring.parsers.MuleDefinitionParserConfiguration; import org.mule.config.spring.parsers.PostProcessor; import org.mule.config.spring.parsers.PreProcessor; import org.mule.config.spring.parsers.assembly.configuration.ValueMap; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * This encapsulates several definition parsers, selected depending on the parent * element in the DOM. */ public class ParentContextDefinitionParser extends AbstractParallelDelegatingDefinitionParser { private Map parsers = new HashMap(); private MuleDefinitionParser otherwise = null; public ParentContextDefinitionParser(String context, MuleDefinitionParser parser) { and(context, parser); } public ParentContextDefinitionParser and(String context, MuleDefinitionParser parser) { StringTokenizer names = new StringTokenizer(context); while (names.hasMoreTokens()) { parsers.put(names.nextToken(), parser); } addDelegate(parser); return this; } public ParentContextDefinitionParser otherwise(MuleDefinitionParser otherwise) { this.otherwise = otherwise; return this; } protected MuleDefinitionParser getDelegate(Element element, ParserContext parserContext) { String context = element.getParentNode().getLocalName(); if (parsers.containsKey(context)) { return (MuleDefinitionParser) parsers.get(context); } else if (null != otherwise) { return otherwise; } else { throw new IllegalStateException("No parser defined for " + element.getLocalName() + " in the context " + context); } } protected MuleDefinitionParser getOtherwise() { return otherwise; } // @Override public MuleDefinitionParserConfiguration addAlias(String alias, String propertyName) { super.addAlias(alias, propertyName); if (otherwise != null) { otherwise.addAlias(alias, propertyName); } return this; } // @Override public MuleDefinitionParserConfiguration addBeanFlag(String flag) { super.addBeanFlag(flag); if (otherwise != null) { otherwise.addBeanFlag(flag); } return this; } // @Override public MuleDefinitionParserConfiguration addCollection(String propertyName) { super.addCollection(propertyName); if (otherwise != null) { otherwise.addCollection(propertyName); } return this; } // @Override public MuleDefinitionParserConfiguration addIgnored(String propertyName) { super.addIgnored(propertyName); if (otherwise != null) { otherwise.addIgnored(propertyName); } return this; } // @Override public MuleDefinitionParserConfiguration addMapping(String propertyName, Map mappings) { super.addMapping(propertyName, mappings); if (otherwise != null) { otherwise.addMapping(propertyName, mappings); } return this; } // @Override public MuleDefinitionParserConfiguration addMapping(String propertyName, String mappings) { super.addMapping(propertyName, mappings); if (otherwise != null) { otherwise.addMapping(propertyName, mappings); } return this; } // @Override public MuleDefinitionParserConfiguration addMapping(String propertyName, ValueMap mappings) { super.addMapping(propertyName, mappings); if (otherwise != null) { otherwise.addMapping(propertyName, mappings); } return this; } // @Override public MuleDefinitionParserConfiguration addReference(String propertyName) { super.addReference(propertyName); if (otherwise != null) { otherwise.addReference(propertyName); } return this; } // @Override public MuleDefinitionParserConfiguration registerPostProcessor(PostProcessor postProcessor) { super.registerPostProcessor(postProcessor); if (otherwise != null) { otherwise.registerPostProcessor(postProcessor); } return this; } // @Override public MuleDefinitionParserConfiguration registerPreProcessor(PreProcessor preProcessor) { super.registerPreProcessor(preProcessor); if (otherwise != null) { otherwise.registerPreProcessor(preProcessor); } return this; } // @Override public MuleDefinitionParserConfiguration removeIgnored(String propertyName) { super.removeIgnored(propertyName); if (otherwise != null) { otherwise.removeIgnored(propertyName); } return this; } // @Override public MuleDefinitionParserConfiguration setIgnoredDefault(boolean ignoreAll) { super.setIgnoredDefault(ignoreAll); if (otherwise != null) { otherwise.setIgnoredDefault(ignoreAll); } return this; } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/0000755000175000017500000000000011351411146031260 5ustar charlescharles././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/DynamicAttributeDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/DynamicAttr0000644000175000017500000000174310740712271033433 0ustar charlescharles/* * $Id: DynamicAttributeDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.collection; import org.mule.config.spring.parsers.MuleDefinitionParser; import org.springframework.beans.factory.config.BeanDefinition; public interface DynamicAttributeDefinitionParser extends MuleDefinitionParser { void setAttributeName(String attributeName); /** * This is implemented in {@link org.mule.config.spring.parsers.AbstractHierarchicalDefinitionParser} * and allows us to "fake" a parent when processing the same element. */ void forceParent(BeanDefinition parent); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/package.htmlmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/package.htm0000644000175000017500000000022710740712271033372 0ustar charlescharles Mule Support for building collections, or adding an element to a collection in a parent bean. ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/OrphanMapDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/OrphanMapDe0000644000175000017500000000474710745677442033400 0ustar charlescharles/* * $Id: OrphanMapDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.collection; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import java.util.Map; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.config.MapFactoryBean; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Creates a single, stand-alone map object and processes standard Spring sub elements */ public class OrphanMapDefinitionParser extends AbstractMuleBeanDefinitionParser { private Class mapClass; private String name; private boolean dynamicName = false; public OrphanMapDefinitionParser(Class mapClass) { this.mapClass = mapClass; dynamicName = true; } public OrphanMapDefinitionParser(Class mapClass, String name) { this.mapClass = mapClass; this.name = name; } protected Class getBeanClass(Element element) { return MapFactoryBean.class; } protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Map parsedMap = parserContext.getDelegate().parseMapElement(element, builder.getRawBeanDefinition()); builder.addPropertyValue("sourceMap", parsedMap); builder.addPropertyValue("targetMapClass", mapClass.getName()); getBeanAssembler(element, builder).setBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE); } //@Override protected void preProcess(Element element) { super.preProcess(element); if (dynamicName) { name = null; } } //@java.lang.Override protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) throws BeanDefinitionStoreException { return name; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildListDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildListDe0000644000175000017500000000326610761005105033340 0ustar charlescharles/* * $Id: ChildListDefinitionParser.java 11024 2008-02-26 12:47:01Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.collection; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.config.ListFactoryBean; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; public class ChildListDefinitionParser extends ChildDefinitionParser { public ChildListDefinitionParser(String setterMethod) { super(setterMethod, ArrayList.class); addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE); } protected Class getBeanClass(Element element) { return ListFactoryBean.class; } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.parseChild(element, parserContext, builder); List parsedList = parserContext.getDelegate().parseListElement(element, builder.getRawBeanDefinition()); builder.addPropertyValue("sourceList", parsedList); builder.addPropertyValue("targetListClass", super.getBeanClass(element)); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildMapDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildMapDef0000644000175000017500000000347710745677442033341 0ustar charlescharles/* * $Id: ChildMapDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.collection; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.config.MapFactoryBean; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Creates a single Map and processes standard Spring sub elements. The map is injected * into the parent object (the enclosing XML element). */ public class ChildMapDefinitionParser extends ChildDefinitionParser { public ChildMapDefinitionParser(String setterMethod) { super(setterMethod, HashMap.class); addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE); } protected Class getBeanClass(Element element) { return MapFactoryBean.class; } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.parseChild(element, parserContext, builder); Map parsedMap = parserContext.getDelegate().parseMapElement(element, builder.getRawBeanDefinition()); builder.addPropertyValue("sourceMap", parsedMap); builder.addPropertyValue("targetMapClass", super.getBeanClass(element)); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildPropertiesDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildProper0000644000175000017500000000340710745677442033445 0ustar charlescharles/* * $Id: ChildPropertiesDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.collection; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import java.util.Properties; import org.springframework.beans.factory.config.PropertiesFactoryBean; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Creates a single Properties object and processes standard Spring sub elements. The properties are * injected into the parent object (the enclosing XML element). */ public class ChildPropertiesDefinitionParser extends ChildDefinitionParser { public ChildPropertiesDefinitionParser(String setterMethod) { super(setterMethod, /*clazz*/null); addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_RECURSE); } protected Class getBeanClass(Element element) { return PropertiesFactoryBean.class; } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.parseChild(element, parserContext, builder); Properties parsedProps = parserContext.getDelegate().parsePropsElement(element); builder.addPropertyValue("properties", parsedProps); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/AttributeListEntryDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/AttributeLi0000644000175000017500000000452010745726444033454 0ustar charlescharles/* * $Id: AttributeListEntryDefinitionParser.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.collection; import org.mule.config.spring.parsers.AbstractChildDefinitionParser; import org.mule.config.spring.util.SpringXMLUtils; import org.mule.util.StringUtils; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Attr; import org.w3c.dom.Element; public class AttributeListEntryDefinitionParser extends AbstractChildDefinitionParser implements DynamicAttributeDefinitionParser { private String setterMethod; private String attributeName; /** * Only for use with dynamic naming */ public AttributeListEntryDefinitionParser(String setterMethod) { this(setterMethod, null); } public AttributeListEntryDefinitionParser(String setterMethod, String attributeName) { this.setterMethod = setterMethod; setAttributeName(attributeName); } public String getPropertyName(Element element) { return setterMethod; } protected Class getBeanClass(Element element) { return ChildListEntryDefinitionParser.ListEntry.class; } public void setAttributeName(String attributeName) { this.attributeName = attributeName; } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Attr attribute = element.getAttributeNode(attributeName); if (null == attribute || StringUtils.isEmpty(attribute.getNodeValue())) { throw new IllegalStateException( "No value for " + attributeName + " in " + SpringXMLUtils.elementToString(element)); } String value = attribute.getNodeValue(); builder.setSource(new ChildListEntryDefinitionParser.ListEntry(value)); this.postProcess(parserContext, getBeanAssembler(element, builder), element); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildMapEntryDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildMapEnt0000644000175000017500000000321210740712271033335 0ustar charlescharles/* * $Id: ChildMapEntryDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.collection; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; public class ChildMapEntryDefinitionParser extends ChildDefinitionParser { public static final String KEY = "key"; public static final String VALUE = "value"; public ChildMapEntryDefinitionParser(String mapName) { super(mapName, KeyValuePair.class); } public ChildMapEntryDefinitionParser(String mapName, String keyName, String valueName) { this(mapName); addAlias(keyName, KEY); addAlias(valueName, VALUE); } public static class KeyValuePair { private String key; private Object value; public KeyValuePair() { } public KeyValuePair(String key, Object value) { this.key = key; this.value = value; } public String getKey() { return key; } public Object getValue() { return value; } public void setKey(String key) { this.key = key; } public void setValue(Object value) { this.value = value; } } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildListEntryDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildListEn0000644000175000017500000000522010745726444033364 0ustar charlescharles/* * $Id: ChildListEntryDefinitionParser.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.collection; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.util.SpringXMLUtils; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Process an element as a value that is appended to a list in the parent object (the * enclosing XML element). */ public class ChildListEntryDefinitionParser extends ChildDefinitionParser { public static final String VALUE = "value"; private boolean fromText = true; /** * Takes value from enclosed text * * @param propertyName */ public ChildListEntryDefinitionParser(String propertyName) { super(propertyName, ListEntry.class); setIgnoredDefault(true); } /** * Takes value from attribute * * @param propertyName * @param attributeName */ public ChildListEntryDefinitionParser(String propertyName, String attributeName) { this(propertyName); addAlias(attributeName, VALUE); removeIgnored(attributeName); fromText = false; } protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { if (fromText) { assembler.extendBean(VALUE, SpringXMLUtils.getTextChild(element), false); } super.postProcess(context, assembler, element); } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.parseChild(element, parserContext, builder); //To change body of overridden methods use File | Settings | File Templates. } public static class ListEntry { private Object value; public ListEntry() { super(); } public ListEntry(Object proxied) { this(); value = proxied; } public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/AttributeMapDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/AttributeMa0000644000175000017500000000475110745726444033453 0ustar charlescharles/* * $Id: AttributeMapDefinitionParser.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.collection; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.util.SpringXMLUtils; import org.springframework.beans.factory.config.MapFactoryBean; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.ManagedMap; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; /** * Creates a single, stand-alone map object and processes all attributes to this map */ public class AttributeMapDefinitionParser extends ChildDefinitionParser { public AttributeMapDefinitionParser(String setter) { super(setter, ManagedMap.class); } protected Class getBeanClass(Element element) { return MapFactoryBean.class; } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { ManagedMap values = new ManagedMap(); NamedNodeMap attributes = element.getAttributes(); for (int x = 0; x < attributes.getLength(); x++) { Attr attribute = (Attr) attributes.item(x); String oldName = SpringXMLUtils.attributeName(attribute); //TODO How can I use bestGuessName String name = beanPropertyConfiguration.translateName(oldName); Object value = beanPropertyConfiguration.translateValue(oldName, attribute.getNodeValue()); if (beanPropertyConfiguration.isReference(oldName)) { values.put(name, new RuntimeBeanReference(attribute.getNodeValue())); } else { values.put(name, value); } } builder.addPropertyValue("sourceMap", values); builder.addPropertyValue("targetMapClass", super.getBeanClass(element)); postProcess(parserContext, getBeanAssembler(element, builder), element); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildSingletonMapDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/collection/ChildSingle0000644000175000017500000000164710745677442033423 0ustar charlescharles/* * $Id: ChildSingletonMapDefinitionParser.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.collection; import org.mule.config.spring.parsers.assembly.MapEntryCombiner; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; public class ChildSingletonMapDefinitionParser extends ChildDefinitionParser { public static final String KEY = "key"; public static final String VALUE = "value"; public ChildSingletonMapDefinitionParser(String setterMethod) { super(setterMethod, MapEntryCombiner.class); } }mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/PostProcessor.java0000644000175000017500000000153310745726444032637 0ustar charlescharles/* * $Id: PostProcessor.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.w3c.dom.Element; import org.springframework.beans.factory.xml.ParserContext; /** * This interface allows post-processing of the bean assmebler to be injected into * definition parsers */ public interface PostProcessor { public void postProcess(ParserContext context, BeanAssembler assembler, Element element); } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/0000755000175000017500000000000011351411152030536 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/package.html0000644000175000017500000000014510740712271033026 0ustar charlescharles Mule General support for bean construction. ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/MuleOrphanDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/MuleOrphanDefi0000644000175000017500000000325510770356575033355 0ustar charlescharles/* * $Id: MuleOrphanDefinitionParser.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.generic; import org.mule.config.spring.util.SpringXMLUtils; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * A parser for direct children of the element. */ public class MuleOrphanDefinitionParser extends OrphanDefinitionParser { /** * This constructor assumes that the class name will be explicitly specified as an attribute on the element. */ public MuleOrphanDefinitionParser(boolean singleton) { super(singleton); } public MuleOrphanDefinitionParser(Class beanClass, boolean singleton) { super(beanClass, singleton); } protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { assertMuleParent(element); return super.parseInternal(element, parserContext); } protected void assertMuleParent(Element element) { if (!isTopLevel(element)) { throw new IllegalStateException("This element should be embedded inside the Mule <" + ROOT_ELEMENT + "> element: " + SpringXMLUtils.elementToString(element)); } } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/ParentDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/ParentDefiniti0000644000175000017500000000633610745726444033421 0ustar charlescharles/* * $Id: ParentDefinitionParser.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.generic; import org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate; import org.mule.config.spring.parsers.AbstractHierarchicalDefinitionParser; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.springframework.util.Assert; import org.w3c.dom.Element; /** * Processes child property elements in Xml but sets the properties on the parent object. This is * useful when an object has lots of properties and it's more readable to break those properties into * groups that can be represented as a sub-element in Xml. */ public class ParentDefinitionParser extends AbstractHierarchicalDefinitionParser { public ParentDefinitionParser() { addBeanFlag(MuleHierarchicalBeanDefinitionParserDelegate.MULE_NO_REGISTRATION); } protected Class getBeanClass(Element element) { try { return Class.forName(getParentBeanDefinition(element).getBeanClassName()); } catch (Exception e) { // Should continue to work, but automatic collection detection etc will fail logger.debug("No class for " + element); return Object.class; } } protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { preProcess(element); setParserContext(parserContext); setRegistry(parserContext.getRegistry()); Class beanClass = getBeanClass(element); Assert.state(beanClass != null, "Class returned from getBeanClass(Element) must not be null, element is: " + element.getNodeName()); BeanDefinitionBuilder builder = createBeanDefinitionBuilder(element, beanClass); builder.setSource(parserContext.extractSource(element)); if (parserContext.isNested()) { // Inner bean definition must receive same singleton status as containing bean. builder.setSingleton(parserContext.getContainingBeanDefinition().isSingleton()); } doParse(element, parserContext, builder); BeanAssembler beanAssembler = getBeanAssembler(element, builder); beanAssembler.copyBeanToTarget(); return (AbstractBeanDefinition) beanAssembler.getTarget(); } protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { // by default the name matches the "real" bean if (null == element.getAttributeNode(ATTRIBUTE_NAME)) { element.setAttribute(ATTRIBUTE_NAME, getParentBeanName(element)); } super.postProcess(context, assembler, element); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/NameTransferDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/NameTransferDe0000644000175000017500000001307210746275214033340 0ustar charlescharles/* * $Id:NameTransferDefinitionParser.java 7863 2007-08-13 20:20:43Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.generic; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.assembly.BeanAssemblerFactory; import org.mule.config.spring.parsers.assembly.DefaultBeanAssembler; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.SingleProperty; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * This extends {@link ParentDefinitionParser} so that the "name" attribute is set locally, * not on the parent. * *

It's easier to understand with an example. Consider a custom security provider, set with the * following XML:

*
 <mule:security-manager>
     <mule:custom-security-provider name="dummySecurityProvider"
                                    provider-ref="dummySecurityProvider"/>
 </mule:security-manager>
*

What is happening here? First, the custom-security-provider is being handled by this class. * Since this class extends ParentDefinitionParser, the provider value is set on the parent (the * security manager). But we want the name attribute to be set on the provider (the referenced * bean). So the "name" is set on the provider, not on the manager. Then the provider is set on * the manager.

*/ public class NameTransferDefinitionParser extends ParentDefinitionParser { private String name; private String componentAttributeValue; private String componentAttributeName; /** * @param componentAttributeName The attribute name (after processing, which will strip "-ref", * add plurals, etc) that identifies the service which will receive the "name". */ public NameTransferDefinitionParser(String componentAttributeName) { this.componentAttributeName = componentAttributeName; setBeanAssemblerFactory(new LocalBeanAssemblerFactory()); } // this is a bit of a hack - we transfer the name to the provider // reset for each use protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { name = null; componentAttributeValue = null; AbstractBeanDefinition bd = super.parseInternal(element, parserContext); element.removeAttribute(ATTRIBUTE_NAME); return bd; } // only set name if not already given private void setName() { BeanDefinition beanDef = getParserContext().getRegistry().getBeanDefinition(componentAttributeValue); MutablePropertyValues propertyValues = beanDef.getPropertyValues(); if (!propertyValues.contains(ATTRIBUTE_NAME)) { logger.debug("Setting " + ATTRIBUTE_NAME + " on " + componentAttributeValue + " to " + name); propertyValues.addPropertyValue(ATTRIBUTE_NAME, name); } else { logger.debug("Not setting " + ATTRIBUTE_NAME + " on " + componentAttributeValue + " as already " + propertyValues.getPropertyValue(ATTRIBUTE_NAME)); } } private class LocalBeanAssembler extends DefaultBeanAssembler { public LocalBeanAssembler(PropertyConfiguration beanConfig, BeanDefinitionBuilder bean, PropertyConfiguration targetConfig, BeanDefinition target) { super(beanConfig, bean, targetConfig, target); } protected void addPropertyWithReference(MutablePropertyValues properties, SingleProperty config, String name, Object value) { // intercept setting of name if (ATTRIBUTE_NAME.equals(name) && value instanceof String) { NameTransferDefinitionParser.this.name = (String) value; // name is set after service if (null != componentAttributeValue) { setName(); } } else { super.addPropertyWithReference(properties, config, name, value); // intercept setting of service if (componentAttributeName.equals(name) && value instanceof String) { componentAttributeValue = (String) value; // name was set before service if (null != NameTransferDefinitionParser.this.name) { setName(); } } } } } private class LocalBeanAssemblerFactory implements BeanAssemblerFactory { public BeanAssembler newBeanAssembler(PropertyConfiguration beanConfig, BeanDefinitionBuilder bean, PropertyConfiguration targetConfig, BeanDefinition target) { return new LocalBeanAssembler(beanConfig, bean, targetConfig, target); } } }././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/AutoIdUtils.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/AutoIdUtils.ja0000644000175000017500000000470010745677442033307 0ustar charlescharles/* * $Id: AutoIdUtils.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.generic; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.util.StringUtils; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import org.w3c.dom.Element; public class AutoIdUtils { public static final String ATTRIBUTE_ID = AbstractMuleBeanDefinitionParser.ATTRIBUTE_ID; public static final String ATTRIBUTE_NAME = AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME; private static final AtomicInteger counter = new AtomicInteger(0); public static final String PREFIX = "org.mule.autogen."; public static boolean blankAttribute(Element element, String attribute) { return StringUtils.isBlank(element.getAttribute(attribute)); } public static void ensureUniqueId(Element element, String type) { if (null != element && blankAttribute(element, ATTRIBUTE_ID)) { if (blankAttribute(element, ATTRIBUTE_NAME)) { element.setAttribute(ATTRIBUTE_ID, uniqueValue(PREFIX + type)); } else { element.setAttribute(ATTRIBUTE_ID, element.getAttribute(ATTRIBUTE_NAME)); } } } public static String getUniqueName(Element element, String type) { if (!blankAttribute(element, ATTRIBUTE_NAME)) { return element.getAttribute(ATTRIBUTE_NAME); } else if (!blankAttribute(element, ATTRIBUTE_ID)) { return element.getAttribute(ATTRIBUTE_ID); } else { return uniqueValue(PREFIX + type); } } public static String uniqueValue(String value) { return value + "." + counter.incrementAndGet(); } public static void forceUniqueId(Element element, String type) { if (null != element) { String id = uniqueValue(PREFIX + type); element.setAttribute(ATTRIBUTE_ID, id); element.setAttribute(ATTRIBUTE_NAME, id); } } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/AttributePropertiesDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/AttributePrope0000644000175000017500000000174310740712271033446 0ustar charlescharles/* * $Id: AttributePropertiesDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.generic; import org.mule.config.spring.parsers.assembly.AttributeMapBeanAssemblerFactory; public class AttributePropertiesDefinitionParser extends ChildDefinitionParser { public AttributePropertiesDefinitionParser(String setterMethod) { this(setterMethod, java.lang.Object.class); } public AttributePropertiesDefinitionParser(String setterMethod, Class clazz) { super(setterMethod, clazz); setBeanAssemblerFactory(new AttributeMapBeanAssemblerFactory()); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/DescendentDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/DescendentDefi0000644000175000017500000000253510740712271033341 0ustar charlescharles/* * $Id: DescendentDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.generic; import org.mule.util.StringUtils; import org.w3c.dom.Element; import org.w3c.dom.Node; /** * An extension to {@line ChildDefinitionParser} which recurses up the DOM * tree until it finds a named parent. */ public class DescendentDefinitionParser extends ChildDefinitionParser { public DescendentDefinitionParser(String setterMethod, Class clazz) { super(setterMethod, clazz); } protected String getParentBeanName(Element element) { Node node = element; while (null != node && node instanceof Element) { String name = super.getParentBeanName((Element) node); if (!StringUtils.isBlank(name)) { return name; } node = element.getParentNode(); } throw new IllegalStateException("Bean: " + element.getNodeName() + " has no grandparent"); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/GrandchildDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/GrandchildDefi0000644000175000017500000000347410740712271033327 0ustar charlescharles/* * $Id: GrandchildDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.generic; import org.w3c.dom.Element; import org.w3c.dom.Node; /** * Same as ChildDefinitionParser but injects the child element into the grandparent object * (2 levels up in the XML tree). */ public class GrandchildDefinitionParser extends ChildDefinitionParser { public GrandchildDefinitionParser(String setterMethod, Class clazz) { super(setterMethod, clazz); } public GrandchildDefinitionParser(String setterMethod, Class clazz, Class constraint, boolean allowClassAttribute) { super(setterMethod, clazz, constraint, allowClassAttribute); } protected String getParentBeanName(Element element) { Node parent = element.getParentNode(); if (parent == null) { logger.error("No parent node found for element " + element); return null; } Node grandparent = parent.getParentNode(); if (grandparent == null) { logger.error("No parent node found for element " + parent); return null; } Node grandparentNameAttribute = grandparent.getAttributes().getNamedItem("name"); if (grandparentNameAttribute == null) { logger.error("Grandparent node has no 'name' attribute: " + grandparent); return null; } return grandparentNameAttribute.getNodeValue(); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/OrphanDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/OrphanDefiniti0000644000175000017500000000365710740712271033406 0ustar charlescharles/* * $Id: OrphanDefinitionParser.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.generic; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.w3c.dom.Element; /** * Contructs a single, standalone bean from an element - it is not injected into any other object. * This parser can be configured to automatically set the class of the object, the init and destroy methods * and whether this object is a singleton. * *

Typically, you should use {@link MuleOrphanDefinitionParser} * instead of this class, since these elements occur in the top level element.

*/ public class OrphanDefinitionParser extends AbstractMuleBeanDefinitionParser { private Class beanClass = null; private boolean dynamicClass = false; /** * This constructor assumes that the class name will be explicitly specified as an attribute on the element. */ public OrphanDefinitionParser(boolean singleton) { this.singleton = singleton; dynamicClass = true; } public OrphanDefinitionParser(Class beanClass, boolean singleton) { this.beanClass = beanClass; this.singleton = singleton; } // @Override protected void preProcess(Element element) { super.preProcess(element); // top level beans need an ID element AutoIdUtils.ensureUniqueId(element, "bean"); if (dynamicClass) { beanClass = null; } } // @Override protected Class getBeanClass(Element element) { return beanClass; } }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/NamedDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/NamedDefinitio0000644000175000017500000000440410745726444033365 0ustar charlescharles/* * $Id: NamedDefinitionParser.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.generic; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Behaves as {@link org.mule.config.spring.parsers.generic.ParentDefinitionParser}, * but allows any named bean to be the parent, rather than using the enclosing element in the DOM tree. */ public class NamedDefinitionParser extends ParentDefinitionParser { private String name; private boolean isDynamic = false; public NamedDefinitionParser() { isDynamic = true; } public NamedDefinitionParser(String name) { addIgnored(ATTRIBUTE_NAME); this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } protected String getParentBeanName(Element element) { return name; } protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { if (isDynamic) { if (element.hasAttribute(ATTRIBUTE_NAME)) { setName(element.getAttribute(ATTRIBUTE_NAME)); element.removeAttribute(ATTRIBUTE_NAME); } else { throw new IllegalStateException("Missing name attribute for " + element.getLocalName()); } } return super.parseInternal(element, parserContext); } protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { super.postProcess(context, assembler, element); // may be used as top level element, so set ID from name AutoIdUtils.ensureUniqueId(element, "named"); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/ChildDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/generic/ChildDefinitio0000644000175000017500000000637210741672767033376 0ustar charlescharles/* * $Id: ChildDefinitionParser.java 10285 2008-01-11 13:58:15Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.generic; import org.mule.config.spring.parsers.AbstractChildDefinitionParser; import org.w3c.dom.Element; /** * Creates a definition parser that will construct a single child element and inject it into * the parent object (the enclosing XML element). * * The parser will set all attributes defined in the Xml as bean properties and will * process any nested elements as bean properties too, except the correct Definition parser * for the element will be looked up automatically. */ public class ChildDefinitionParser extends AbstractChildDefinitionParser { protected Class clazz; protected String setterMethod; /** * The class will be inferred from the class attribute * @param setterMethod The target method (where the child will be injected) */ public ChildDefinitionParser(String setterMethod) { this(setterMethod, null, null, true); } /** * @param setterMethod The target method (where the child will be injected) * @param clazz The class created by this element/parser */ public ChildDefinitionParser(String setterMethod, Class clazz) { this(setterMethod, clazz, null, null == clazz); } /** * The class (which is inferred from the class attribute if null here) is checked to be * a subclass of the constraint * @param setterMethod The target method (where the child will be injected) * @param clazz The class created by this element/parser (may be null) * @param constraint Superclass of clazz (may be null) */ public ChildDefinitionParser(String setterMethod, Class clazz, Class constraint) { this(setterMethod, clazz, constraint, null == clazz); } /** * The class (which is inferred from the class attribute if null here) is checked to be * a subclass of the constraint. * * @param setterMethod The target method (where the child will be injected) * @param clazz The class created by this element/parser (may be null) * @param constraint Superclass of clazz (may be null) * @param allowClassAttribute Is class read from class attribute (if present, takes precedence over clazz) */ public ChildDefinitionParser(String setterMethod, Class clazz, Class constraint, boolean allowClassAttribute) { this.clazz = clazz; this.setterMethod = setterMethod; setClassConstraint(constraint); setAllowClassAttribute(allowClassAttribute); } protected void preProcess(Element element) { super.preProcess(element); if (isAllowClassAttribute()) { clazz = null; // reset for this element } } protected Class getBeanClass(Element element) { return clazz; } public String getPropertyName(Element e) { return setterMethod; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/AbstractChildDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/AbstractChildDefinitio0000644000175000017500000001022210766654216033427 0ustar charlescharles/* * $Id: AbstractChildDefinitionParser.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.generic.AutoIdUtils; import org.mule.config.spring.util.SpringXMLUtils; import org.mule.util.StringUtils; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * This definition parser supports the definition of beans that are then set on the parent bean - * it extends {@link org.mule.config.spring.parsers.AbstractHierarchicalDefinitionParser} with * methods that assume the data are associated with a single property. * * This supports collections and Maps. For collections if a child element is repeated it will be assumed * that it is a collection. * * If the Bean Class for this element is set to * {@link org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser.KeyValuePair} it is assumed that a Map * is being processed and any child elements will be added to the parent Map. Similarly for * {@link org.mule.config.spring.parsers.collection.ChildListEntryDefinitionParser}. * * A single method needs to be overriden called {@link #getPropertyName} that determines the name of the property to * set on the parent bean with this bean. Note that the property name can be dynamically resolved depending on the parent * element. * * @see org.mule.config.spring.parsers.generic.ChildDefinitionParser * @see org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser.KeyValuePair * @see AbstractMuleBeanDefinitionParser */ public abstract class AbstractChildDefinitionParser extends AbstractHierarchicalDefinitionParser implements MuleChildDefinitionParser { protected final void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { setRegistry(parserContext.getRegistry()); parseChild(element, parserContext, builder); } protected void parseChild(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { builder.setSingleton(isSingleton()); super.doParse(element, parserContext, builder); } protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { super.postProcess(context, assembler, element); // legacy handling of orphan beans - avoid setting parent String propertyName = getPropertyName(element); if (null != propertyName) { // If this is a singleton we need to inject it into parent using a // RuntimeBeanReference so that the bean does not get created twice, once // with a name and once as an (inner bean). if (!assembler.getBean().getBeanDefinition().isSingleton()) { assembler.insertBeanInTarget(propertyName); } else { assembler.getTarget().getPropertyValues().addPropertyValue(propertyName, new RuntimeBeanReference(element.getAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME))); } } } public String getBeanName(Element e) { String name = SpringXMLUtils.getNameOrId(e); if (StringUtils.isBlank(name)) { String parentId = getParentBeanName(e); if (!parentId.startsWith(".")) { parentId = "." + parentId; } return AutoIdUtils.uniqueValue(parentId + ":" + e.getLocalName()); } else { return name; } } public abstract String getPropertyName(Element element); } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/AbstractHierarchicalDefinitionParser.javamule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/parsers/AbstractHierarchicalDe0000644000175000017500000001026610745726444033410 0ustar charlescharles/* * $Id: AbstractHierarchicalDefinitionParser.java 10494 2008-01-23 21:09:56Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.ReusablePropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.TempWrapperPropertyConfiguration; import org.mule.config.spring.util.SpringXMLUtils; import org.mule.util.StringUtils; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * This definition parser introduces the notion of Hierarchical processing to nested XML elements. Definition * parsers that extend this can refer to parent beans. It does not assume that the parser is restricted * to a single property. * * Calling classes must set the registry at the start of processing. * * @see org.mule.config.spring.parsers.generic.ChildDefinitionParser * @see org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser.KeyValuePair * @see org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser */ public abstract class AbstractHierarchicalDefinitionParser extends AbstractMuleBeanDefinitionParser { private ReusablePropertyConfiguration targetPropertyConfiguration = new ReusablePropertyConfiguration( new TempWrapperPropertyConfiguration(beanPropertyConfiguration, false)); private BeanDefinition forcedParent = null; public PropertyConfiguration getTargetPropertyConfiguration() { return targetPropertyConfiguration; } protected String getParentBeanName(Element element) { return ((Element) element.getParentNode()).getAttribute(ATTRIBUTE_NAME); } public BeanDefinition getParentBeanDefinition(Element element) { if (null != forcedParent) { return forcedParent; } else { String parentBean = getParentBeanName(element); if (StringUtils.isBlank(parentBean)) { throw new IllegalStateException("No parent for " + SpringXMLUtils.elementToString(element)); } return getRegistry().getBeanDefinition(parentBean); } } /** * The bean assembler gives more reliable/automatic processing of collections, maps, etc. * * @param element The current element * @param bean The bean being constructed * @return An assembler that includes Mule-specific construction logic */ protected BeanAssembler getBeanAssembler(Element element, BeanDefinitionBuilder bean) { BeanDefinition target = getParentBeanDefinition(element); return getBeanAssemblerFactory().newBeanAssembler( beanPropertyConfiguration, bean, targetPropertyConfiguration, target); } /** * Provide access to bean assembler from non-hierarchical case. Legacy support for * "mixed" definition parsers. * * @deprecated * @param element * @param bean * @return */ protected BeanAssembler getOrphanBeanAssembler(Element element, BeanDefinitionBuilder bean) { return super.getBeanAssembler(element, bean); } public void forceParent(BeanDefinition parent) { forcedParent = parent; } protected void preProcess(Element element) { super.preProcess(element); targetPropertyConfiguration.reset(); } // reset the forced parent protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { super.postProcess(context, assembler, element); forcedParent = null; } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/util/0000755000175000017500000000000011351411153026421 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/util/CachedResource.java0000644000175000017500000000463210740712271032156 0ustar charlescharles/* * $Id: CachedResource.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.util; import org.mule.util.IOUtils; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.io.UnsupportedEncodingException; import org.springframework.core.io.AbstractResource; /** * Spring 2.x is picky about open/closed input streams, as it requires a closed * stream (fully read resource) to enable automatic validation detection (DTD or * XSD). Otherwise, a caller has to specify the mode explicitly.

Code relying on * Spring 1.2.x behavior may now break with * {@link org.springframework.beans.factory.BeanDefinitionStoreException}. This * class is called in to remedy this and should be used instead of, e.g. * {@link org.springframework.core.io.InputStreamResource}.

The resource is * fully stored in memory. */ public class CachedResource extends AbstractResource { private static final String DEFAULT_DESCRIPTION = "cached in-memory resource"; private final byte[] buffer; private final String description; public CachedResource(byte[] source) { this(source, null); } public CachedResource(String source, String encoding) throws UnsupportedEncodingException { this(source.trim().getBytes(encoding), DEFAULT_DESCRIPTION); } public CachedResource(byte[] source, String description) { this.buffer = source; this.description = description; } public CachedResource(Reader reader, String encoding) throws IOException { this(IOUtils.toByteArray(reader, encoding), DEFAULT_DESCRIPTION); } public String getDescription() { return (description == null) ? "" : description; } public InputStream getInputStream() throws IOException { // This HAS to be a new InputStream, otherwise SAX // parser breaks with 'Premature end of file at line -1" // This behavior is not observed with Spring pre-2.x return new ByteArrayInputStream(buffer); } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/util/SpringXMLUtils.java0000644000175000017500000000457110740712271032145 0ustar charlescharles/* * $Id: SpringXMLUtils.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.util; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.util.StringUtils; import org.mule.util.XMLUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.xml.BeanDefinitionParserDelegate; import org.w3c.dom.Element; /** * These only depend on standard (JSE) XML classes and are used by Spring config code. * For a more extensive (sub-)class, see the XMLUtils class in the XML module. */ public class SpringXMLUtils extends XMLUtils { private static final Log logger = LogFactory.getLog(SpringXMLUtils.class); public static final String MULE_DEFAULT_NAMESPACE = "http://www.mulesource.org/schema/mule/core"; public static final String MULE_NAMESPACE_PREFIX = "http://www.mulesource.org/schema/mule/"; public static boolean isMuleNamespace(Element element) { String ns = element.getNamespaceURI(); return ns != null && ns.startsWith(MULE_NAMESPACE_PREFIX); } public static boolean isBeansNamespace(Element element) { String ns = element.getNamespaceURI(); return ns != null && ns.equals(BeanDefinitionParserDelegate.BEANS_NAMESPACE_URI); } public static String getNameOrId(Element element) { String id = element.getAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_ID); String name = element.getAttribute(AbstractMuleBeanDefinitionParser.ATTRIBUTE_NAME); if (StringUtils.isBlank(id)) { if (StringUtils.isBlank(name)) { return ""; } else { return name; } } else { if (!StringUtils.isBlank(name) && !name.equals(id)) { logger.warn("Id (" + id + ") and name (" + name + ") differ for " + elementToString(element)); } return id; } } } mule-2.0.1/modules/spring-config/src/main/java/org/mule/config/spring/util/SpringBeanLookup.java0000644000175000017500000000601610774254333032526 0ustar charlescharles/* * $Id: SpringBeanLookup.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.util; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.MessageFactory; import org.mule.object.AbstractObjectFactory; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; /** * This is an implementation of the ObjectFactory interface which simply delegates to * the Spring ApplicationContext. Since the delegation happens each time a call to * getOrCreate() is made, this will correctly handle Spring beans which are * non-singletons (factory beans, etc.) * * Singleton usage: * * * * * * * * * * * * Non-singleton usage: * * * * * * * * * * */ public class SpringBeanLookup extends AbstractObjectFactory implements ApplicationContextAware { private ApplicationContext applicationContext; private String bean; public void initialise() throws InitialisationException { if (bean == null) { throw new InitialisationException(MessageFactory.createStaticMessage("Bean name has not been set."), this); } if (applicationContext == null) { throw new InitialisationException( MessageFactory.createStaticMessage("ApplicationContext has not been injected."), this); } } public void dispose() { // Not implemented for Spring Beans } public Class getObjectClass() { return applicationContext.getType(bean); } public Object getInstance() throws Exception { Object instance = applicationContext.getBean(bean); fireInitialisationCallbacks(instance); return instance; } public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } public String getBean() { return bean; } public void setBean(String bean) { this.bean = bean; } // @Override public boolean isSingleton() { return applicationContext.isSingleton(bean); } } mule-2.0.1/modules/spring-config/src/main/resources/0000755000175000017500000000000011351411153022235 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/resources/META-INF/0000755000175000017500000000000011351411153023375 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/main/resources/META-INF/mule.xsd0000644000175000017500000053606111004136303025066 0ustar charlescharles Either the root element of a Mule configuration, or a "top-level" element in a Spring configuration, that contains further Mule elements. This can hold any kind of documentation consistent with the overall XML format). It is intended to be "human readable" only and is not used by the system. Allow embedding of further spring documents. We support direct use of spring beans via this tag. We support direct use of property placeholders via this tag. An global property is a named string. It can be used inserted in most attribute values using the ${...} syntax. So the attribute value "${foo}" would be replaced by the value associated with the property named "foo". Defaults and general settings for the entire Mule system. Register listeners for notifications and associate interfaces with particular events. A placeholder for arbitrary extensions as children of the mule element. Other transports and modules may extend this if they need to add global elements to the configuration (but consider the more specific elements like abstract-connector first). A placeholder for connector elements. Connector elements allow properties to be configured across all endpoints that use the same transport. If multiple connectors are defined for the same transport then each endpoint must name which connector is being used. Identifies the connector so that other elements can reference it. A placeholder for global endpoint elements. Global endpoints are named templates that allow us to define an endpoint once and refer to it in several places. Currently the same template is used for both inbound and outbound endpoints. Identifies the endpoint so that other elements can reference it. This name can also be referenced in MuleClient. A placeholder for inbound endpoint elements. Inbound endpoints receive messages from the underlying transport. The message payload is then delivered to the component for processing. Identifies the inbound endpoint in the registry, but is of relatively little use - it cannot be referred to from MuleClient, for example. For more useful aliases, use global endpoints. A placeholder for outbound endpoint elements. Outbound endpoints dispatch messages to the underlying transport. Identifies the outbound endpoint in the registry, but is of relatively little use - it cannot be referred to from MuleClient, for example. For more useful aliases, use global endpoints. A placeholder for transformer elements. Transformers convert message payloads. Identifies the transformer so that other elements can reference it. Required if the transformer is defined at the global level. The class of the message generated by the transformer. This is used if transformers are auto-selected (which is somewhat incomplete at the moment?). Many transformers only accept certain classes. Such transformers are never called with inappropriate input (whatever the value of this attribute). If a transformer forms part of a chain and cannot accept the current message class, then this flag controls whether the remaining part of the chain is evaluated. If true, the next transformer is called. If false the chain ends, keeping the result generated up to that point. The name of the property. This is used inside ${...}. The value of the property. This replaces each occurence of ${...}. A placeholder for catch-all strategy elements. A placeholder for inbound router elements. Inbound routers control how incoming messages are handled. A placeholder for filter elements. Filters are used to make decisions within the Mule framework. Identifies the filter so that other elements can reference it. Required if the filter is defined at the global level. Inverts the filter's condition. If true, the output message will be sent to all routers, otherwise only the first matching router is used. A placeholder for outbound router elements. Outbound routers control how outgoing messages are delivered to the outbound endpoints. A placeholder for transaction manager elements. Transaction managers are used to co-ordinate transactions. The default threading profile, used by components and by endpoints for dispatching and receiving if no more specific configuration is given. The default dispatching threading profile, modifies the default-threading-profile values and is used by endpoints for dispatching if no more specific configuration is given. The default receiving threading profile, modifies the default-threading-profile values and is used by endpoints for receiving if no more specific configuration is given. The default component threading profile, modifies the default-threading-profile values and is used if no more specific configuration is given. If true then connections to endpoints will wait for a response. If true then connections to endpoints will wait for a response from the remote service. The default period (ms) to wait for a synchronous response. The default timeout for transactions, used if no more specific configuration is given. Associate an event with an interface. Listeners which implement the interface will receive instances of the event. Block the association of an event with a particular interface. This filters events after the association with a particular interface (and so takes precedence). Register a bean as a listener with the notification system. Events are dispatched by reflection - the listener will receive all events associated with any interfaces it implements. The relationship between interfaces and events is configured by the notification and disable-notification elements. The bean that will receive notifications. An optional string that is compared with the event's resource identifier. Only events with matching identifiers will be sent. If no value is given, all events are sent. If the notification manager is dynamic then programatic updates to the manager (ie via Java code) will affect all messages. Otherwise, some parts of the system may cache state for efficiency and so not generate newly enabled notifications. The default value is false. The class associated with a notification event that will be delivered to the interface. This can be used instead of the event attribute to specify a custom class. The notification event to deliver. The interface (class name) that will receive the notification event. The interface that will receive the notification event. The class associated with an event that will no longer be delivered to any interface. This can be used instead of the event attribute to specify a custom class. The event to not deliver. The interface (class name) that will no longer receive an event. The interface that will no longer receive an event. The interface that will no longer receive an event. A placeholder for model elements. A model provides basic settings and processing for all the services it contains. The name used to identify this model. A SEDA (Staged Event Drivern Architecture) model has separate threads and queues for each component. If true then this model element is an extension of a previous model element with the same name. The default model is a SEDA model. A placeholder for queue profile elements. A queue profile controls how messages are queued before being processed. A placeholder for entry point resolver set elements. These combine a group of entry point resolvers, trying them in turn until one succeeds. An extensible set of entry point resolvers (which determine how a message is passed to a component in Java) that already contains resolvers to implement the standard logic. This is already provided by default and is only needed explicitly if it will be extended with other entry point resolvers. This element can be set on the model or component; the model value provides a default which individual component values can override. An extensible set of entry point resolvers. These determine how a message is passed to a component in Java. Each entry point resolver is tried in turn until one succeeds in delivering the messge to the component. This element can be set on the model or component; the model value provides a default which individual component values can override. A custom entry point resolver set. This allows user-supplied code to determine how a message is passed to a component in Java. This element can be set on the model or component; the model value provides a default which individual component values can override. An implementation of the EntryPointResolverSet interface. A placeholder for an entry point resolver element. Entry point resolvers define how payloads are delivered to Java code (ie they choose the method to call). An entry point resolver for components that implement the Callable interface. This passes a MuleEventContext to the component. This element can be set on the model or component; the model value provides a default which individual component values can override. This element can also be used directly or as part of a set of resolvers; the resolvers in a set are used in turn until one is successful. A custom entry point resolver. This allows user-supplied code to determine how a message is passed to a component in Java. This element can be set on the model or component; the model value provides a default which individual component values can override. This element can also be used directly or as part of a set of resolvers; the resolvers in a set are used in turn until one is successful. An implementation of the EntryPointResolver interface. Should the message be transformer before being delivered to the component? By default, messages are transformed. Should the resolver call void methods? By default, void methods are not considered as possible candidates for message delivery. Use a message property to select the component method to be called. This element can be set on the model or component; the model value provides a default which individual component values can override. This element can also be used directly or as part of a set of resolvers; the resolvers in a set are used in turn until one is successful. The name of the message property used to select a method on the component. Deliver the message to a named method. This element can be set on the model or component; the model value provides a default which individual component values can override. This element can also be used directly or as part of a set of resolvers; the resolvers in a set are used in turn until one is successful. Generate a list of candidate methods from the component via reflections. This element can be set on the model or component; the model value provides a default which individual component values can override. This element can also be used directly or as part of a set of resolvers; the resolvers in a set are used in turn until one is successful. If specified, methods in the Java Object interface are not included in the list of possible methods that can receive the message. Explicitly exclude a named method from receiving the message. Deliver the message to a method which takes a single array as argument. This element can be set on the model or component; the model value provides a default which individual component values can override. This element can also be used directly or as part of a set of resolvers; the resolvers in a set are used in turn until one is successful. Call a method without arguments (the message is not passed to the component). A possible method for delivery. The name of the method. A placeholder for a service element. Services combine message routing with a Java (typically) component. The name used to identify this service. Base support for a model-based wrapper around the POJO service (SEDA, Streaming, etc.) This can hold any kind of documentation consistent with the overall XML format). It is intended to be "human readable" only and is not used by the system. The elements within "inbound" describe how messages enter the service. The elements within "outbound" describe how messages leave the service. The elements within "async-reply" describe how asynchronous replies are handled. The initial state of the service. Usually a service is started automatically, but this attribute can block any initial startup ("stopped") or stop the service immediately after initial startup ("paused"). A placeholder for an exception strategy element. Exception strategies define how Mule should react to errors. Defines when a current transaction gets rolled-back depending on the name of the exception caught. Users can set a comma delimited list of wildcard patterns that wil be matched angainst the fully qualified classname of the current exception. Patterns defined for this element will leave the current transaction (if any) untouched and llow it to be committed. Defines when a current transaction gets rolled-back depending on the name of the exception caught. Users can set a comma delimited list of wildcard patterns that wil be matched angainst the fully qualified classname of the current exception. Patterns defined for this element will rollback the current transaction (if any). Determines whether ExceptionNotifications wil be fired from this strategy when an exception occurs. A comma-separate list of wildcard expressions that will be matched against the fully qualified cassname of the current exception received by the ExceptionStrategy. The timeout (ms) to wait for a reply. If the router times out before all expected events have been received should an exception be thrown or should the current events be returned for processing. The default is false. A placeholder for an async reply router element. Asynchronous replies are handled via this router. The standard SEDA service. A service describes how to receive messages, deliver them to a component, and handle the results (if any). The timeout used when taking messages from the SEDA queue. A user-implemeted service (typically used only in testing). The class to use for the service. A placeholder for component threading profile element. Threading profils define how thread pools interact with the component. A placeholder for component element. A component processes data. Typically it is a Java object. A simple POJO (Plain Old Java Object) component that will be invoked by Mule when a message is received. The instance can be specified via a factory, or via a class. A binding associates a Mule endpoint with an injected Java interface (this is like using Spring to inject a bean, but instead of calling a method on the bean a message is sent to an endpoint). Specify a component class. This is a shortcut that is equivalent to providing a prototype-object element. A pooled POJO (Plain Old Java Object) component that will be invoked by Mule when a message is received. The instance can be specified via a factory, or via a class. Characteristics of the object pool The interface to be injected. A proxy will be created that implements this interface by calling out to the endpoint. The method on the interface that should be used. This can be omitted if the interface has a single method. This transfers a message from inbound to outbound endpoints. This name is provided for backwards compatability - it is equivalent to not specifying any component. This logs the message and returns the payload back as the result. This logs the message content (or content length if it is a large message). This will throw an exception if it receives a message. A placeholder for transaction elements. Transactions allow a series of operations to be grouped together. NONE - Never participate in a transaction; ALWAYS_BEGIN - Always start a new transaction when receiving an event. An exception will be thrown if a transaction already exists; BEGIN_OR_JOIN - If a transaction is already in progress when an event is received, join the transaction, otherwise start a new transaction; ALWAYS_JOIN - Always expects a transaction to be in progress when an event is received, if there is no transaction an exception is thrown; JOIN_IF_POSSIBLE - Will join the current transaction if one is available otherwise no transaction is created. Timeout for transaction (ms). Allow access to user-defined or otherwise unsupported third party transactions. A class that implements the TransactionFactory interface. This will be instantiated and used to generate a transaction. The attribute and the "factory-ref" attribute are mutually exclusive; one of the two is required. A bean that implements the TransactionFactory interface. This will be used to generate a transaction. The attribute and the "factory-class" attribute are mutually exclusive; one of the two is required. An optional name for the transaction manager. The default value is "transactionManager". The Websphere transaction manager. The JBoss transaction manager. The JNDI environment. The Weblogic transaction manager. The JRun transaction manager. The Resin transaction manager. Retrieve a named transaction manager factory from JNDI. The name of the manager factory to retrieve (eg java:/TransactionManager). A user-implemented transaction manager. The class to instantiate to create a transaction manager. An endpoint "template" which can be used to construct an inbound or outbound endpoint elsewhere in the configuration by referencing the endpoint's name. Each transport implements its own endpoint element, with a more friendly syntax, but this generic element can be used with any transport by supplying the correct address URI. For example, "vm://foo" describes a VM transport endpoint. An inbound endpoint receives messages from the associated transport. Each transport implements its own inbound endpoint element, with a more friendly syntax, but this generic element can be used with any transport by supplying the correct address URI. For example, "vm://foo" describes a VM transport endpoint. An outbound endpoint sends messages to the associated transport. Each transport implements its own outbound endpoint element, with a more friendly syntax, but this generic element can be used with any transport by supplying the correct address URI. For example, "vm://foo" describes a VM transport endpoint. A placeholder for security filter elements. Security filters can control access to the system, etc. A reference to a global endpoint. If this attribute is used then the endpoint is used as a template to construct this endpoint. A template fixes the address (protocol, path, host, etc), and may specify initial values for various properties, but further properties can be defined locally (as long as they don't change the address in any way). The generic address for this endpoint. If this attribute is used then the protocol must be specified as part of the URI. Alternatively, most transports provide alternative attributes for specifying the address (path, host etc). Note that the address attribute cannot be combined with "ref" or with the transport-provided alternative attributes. If true the result from the component processing the incoming message will be returned as a response. If true the component will wait for a response to the outgoing message before replying to the incoming message. The timeout for the remoteSync wait (ms). String encoding used for messages. The name of the connector associated with this endpoint. This must be specified if more than one connector is defined for this transport. A list of transformers which will be applied in order to the message before it is delivered to the component. A list of transformers which will be applied in order to the synchronous response before it is returned via the transport. The destination address for a reply message. The reference name of a global endpoint to use. If this EndpointRef will be associated to a message such as a Reply-To address, this endpoint ref has to be available on the remote Mule instance that reads the Reply-To address. This allows the user to specify either a simple list of (normal) transformers or separate bracketed lists of normal and response transformers. A list of transformer elements that will be applied to the message before it is delivered to the component. Note that a list of transformers can also be specified directly (without the "transformers" element), but then it is not possible to also specify response transformers (using the "response-transformers" element). A list of transformer elements that will be applied to the response message returned from the component. A list of transformers - normal or response, depending on context. A filter that is defined elsewhere (at the global level, or as a Spring bean). The name of the filter to use. Invert the enclosed filter (so if it returns true for some message, this will return false, and vice-versa). Return true only if all the enclosed filters return true. Return true if any of the enclosed filters returns true. A filter that matches string messages against wildcards. It performs matches with "*", i.e. "jms.events.*" would catch "jms.events.customer" and "jms.events.receipts". This filter accepts a comma-separated list of patterns, so more than one filter pattern can be matched for a given argument: "jms.events.*, jms.actions.*" will match "jms.events.system" and "jms.actions" but not "jms.queue". A filter that can evaluate a range of expressions. It supports some base expression types such as 'header', 'payload' (payload type), 'regex' and 'wildcard'. The expression evaluator to use. The expression filter supports some types such as header, payload, exception, wildcard and regex, that are in-built filters not registered with the ExpressionEvaluatorManager. All others are registered with the ExpressionEvaluatorManager. Where XPath, bean and ongl are used, the expression should be a boolean expression. The expression that will be evaluated. This should always be a boolean expression. Must be set if the evaluator is set to 'custom'. Also the custom evaluator must be registered with the ExpressionEvaluatorManager if it is to be used here. If the specified expression returns null should the filter return true or false. A filter that matches string messages against a regular expression. The Java regular expression engine (java.util.regex.Pattern) is used. The pattern to use when matching. A filter that matches properties on an event. This can be very useful as the event properties represent all the meta information about the event from the underlying transport, so for an event received over HTTP you can check for HTTP headers etc. The pattern should be expressed as a key/value pair, i.e. "propertyName=value". If you want to compare more than one property you can use the logic filters for And, Or and Not expressions. By default the comparison is case sensitive; you can set the caseSensitive property to override this. If false, the comparison ignores case. A filter that matches the type of an exception. A filter that matches the type of the payload. The expected class used in the comparison. A user-implemented filter. An implementation of the Filter interface. A filter that provides password based encyption. The name of the encryption strategy to use. This should be configured using the password-encryption-strategy element, inside a security-manager element at the top level. A reference to a transformer defined elsewhere. The name of the transformer to use, A transformer that uses the transform discovery mechanism to convert the message payload. This transformer works much better when transforming custom object types rather that java types since there is less chance for ambiguity. A user-implemented transformer. An implementation of the Transformer interface. A transformer that can add or delete message properties. Delete a message property. Add a message property. Add a set of message properties. If false, a property is not added if the message already contains a property with that name. A transformer that has no effect. A transformer that base64 encodes a string or byte array message. A transformer that base64 decodes a message to give an array of bytes. A transformer that encodes a string using XML entities. A transformer that decodes a string containing XML entities. A transformer that compresses a byte array using gzip. A transformer that uncompresses a byte array using gzip. A transformer that converts a byte array to a string of hexadecimal digits. A transformer that converts a string of hexadecimal digits to a byte array. A transformer that converts a byte array to an object (either deserializing or converting to a string). A transformer that serializes all objects except strings (which are converted using getBytes()). A transformer that gives a human-readable description of various types (useful for debugging). A transformer that converts a byte array to an object (ie deserializing the object). A transformer that converts an object to a byte array (ie serializing the object). A transformer that converts a byte array to a string. A transformer that converts a string to a byte array. A transformer that appends a string to a string payload. The string to append. A transformer that encrypts a message. A transformer that decrypts a message. The name of the encryption strategy to use. This should be configured using the password-encryption-strategy element, inside a security-manager element at the top level. A transformer that evaluates one or more expressions on the current event. Each expression equates to a parameter in the return message. The return message for 2 or more expressions will be an Object[]. An optional expression means that if the expression evaluates to null, it will continue to the next expression without error. The expression evaluator to use. Expression Evaluators must be registered with the ExpressionEvaluatrManager before thay can be used. Using the custom evaluator allows the developer to define their on in the 'custom-evaluator' attribute. Note that some evaluators such as xpath, groovy and bean are loaded from other mule modules (xml and scripting respectively), these modules wll need to be on your classpath before the evaluator can be used. The expression to evaluate. The syntax of this will change depeneding on the evaluator being used. The name of the custom evaluator to use. This attribute is only used when the evaluator attribute is set to 'custom'. Users can plug in their own expression evaluators by registering them with the ExpressionEvaluatorManager. Configure the queue used on a component. The maximum size of the queue. Whether the queue is persistent. A security manager is a container for security providers. More than one security manager may be configured; each contains providers from a particular module and has that module's type. This element is abstract - a security related module or transport will provide a suitable implementation. This is an empty holder that can be extended by modules that want to provide security managers. Typically it will contain elements called module:type-security-provider which extend securityProviderType where "module" might be "acegi" and "type" might de "delegate", for example. Alternatively (or in addition) it may contain encryption strategies, which should follow a similar scheme and extend encryptionStrategyType. The default security manager. The default security manager (type mule:defaultSecurityManagerType) provides basic support for security functions. Other modules (eg Acegi, JAAS, PGP) provide more advanced functionality. Allow any implementation of UMOSecurityProvider to be used. Allow any implementation of UMOEncryptionStrategy to be used. Provides secret key-based encryption using JCE. Provides password-based encryption using JCE. Users must specify a password and optionally a salt and iteration count as well. The default algorithm is PBEWithMD5AndDES, but users can specify any valid algorithm supported by JCE. A security provider is a source of a particular security-related functionality. An encryption strategy provides support for a particular encryption algorithm. The name of the security provider to use. A reference to the encryption strategy (which may be a Spring bean that implements the EncryptionStrategy interface). The password to use. The salt to use (this helps prevent dictionary attacks). The number of itreations to use. The key to use. This and the keyFactory-ref attribute are mutually exclusive. The name of the key factory to use. This should implement the ObjectFactory interface and return a byte array. This and the key attribute are mutually exclusive. The threading profile to use on the component. The maximum number of threads that will be used. The maximum number of idle threads stored in the pool. The time excess threads in the pool live before being discarded. How tasks should be handled when no more threads are available. How long to wait (when the pool exhausted action is WAIT). Whether threading should be used at all (default is true). The size of the queue used (when the pool exhausted action is WAIT). Provide default exception handling via an endpoint. Provide default exception handling via an endpoint. A user-defined exception stratgey. A class that implements the ExceptionListener interface. In addition, if an outbound-endpoint element is specified, it is set as an "endpoint" bean property. A user-defined connector. A class that implements the Connector interface. Configures a Single Response Router. This will return the first event it receives on a reply endpoint and will discard the rest. Configures a Collection Response Router. This will return a MuleMEssageCollection message type that will contain all events recieved for the current correlation. Allows expressions to be configured to extract the message information. This allows configuraton of a custom implementation of MessageInfoMapping An implementation of the MessageInfoMapping interface. An implementation of the LifecycleAdapter interface. A factory which will be used by Mule to create new instances of this object Properties to be set on the created object Name of Spring bean to look up Class name Class name A placeholder for agents. Not used in core, but common to several modules. Configure client key stores. TLS/SSL connections are made on behalf of an entity, which can be anonymous or identified by a certificate - this interface specifies how a keystore can be used to provide the certificates (and associated private keys) necessary for identification. This is also used as the trust store if no other trust store is specified and the explicitTrustStoreOnly parameter in the server trust store configuration is false. WARNING - due to restrictions in library implementations the values specified here typically apply to all connectors using this transport. The location (which will be resolved relative to the current classpath and file system, if possible) of the keystore that contains public certificates and private keys for identification. The password used to protect the keystore. The type of keystore used (a Java class name). Configure key stores. TLS/SSL connections are made on behalf of an entity, which can be anonymous or identified by a certificate - this interface specifies how a keystore can be used to provide the certificates (and associated private keys) necessary for identification. The location (which will be resolved relative to the current classpath and file system, if possible) of the keystore that contains public certificates and private keys for identification. The type of keystore used (a Java class name). The password used to protect the private key. The password used to protect the keystore. The algorithm used by the key store. Configure a trust store. TLS/SSL connections are made to trusted systems - the public certificates of trusted systems are store in a keystore (called a trust store) and used to verify that the connection made to a remote system "really is" the expected identity. The location (which will be resolved relative to the current classpath and file system, if possible) of the keystore that contains public certificates of trusted servers. The password used to protected the trust store. Configure the global Java protocol handler. WARNING - Untested. Set the java.protocol.handler.pkgs system property. A type that defines an Ant-style property placeholder A custom xsd:NMTOKEN-like type that also allows for Ant-style property placeholders and a leading [ A custom xsd:string-like type that cannot be empty (is there a better way?) A custom xsd:NMTOKEN type that also allows for Ant-style property placeholders. A custom xsd:int type that also allows for Ant-style property placeholders and restrict the int value to a valid port number A custom xsd:int type that also allows for Ant-style property placeholders A custom xsd:long type that also allows for Ant-style property placeholders A custom xsd:boolean type that also allows for Ant-style property placeholders Set Mule properties. These are name/value pairs that can be set on components, services, etc, and which provide a generic way of configuring the system. In Mule v2 you typically shouldn't need to use generic properties like this, since almost all functionality is exposed via dedicated elements. However, they can be useful in configuring obscure or overlooked options and in configuring transports from the generic endpoint elements. Set a Mule property. This is a name/value pair that can be set on components, services, etc, and which provide a generic way of configuring the system. In Mule v2 you typically shouldn't need to use a generic property like this, since almost all functionality is exposed via dedicated elements. However, it can be useful in configuring obscure or overlooked options and in configuring transports from the generic endpoint elements. Direct setting of a JNDI property. Direct setting of JNDI properties (this allows access to the full Spring map entry). Set the complete context directly, via a bean reference. The initial context factory to use. The value of the property should be the fully qualified class name of the factory class that will create an initial context. The service provider to use. The value of the property should contain a URL string (e.g. "ldap://somehost:389"). The list of package prefixes to use when loading in URL context factories. The value of the property should be a colon-separated list of package prefixes for the class name of the factory class that will create a URL context factory. mule-2.0.1/modules/spring-config/src/main/resources/META-INF/spring.schemas0000644000175000017500000000040110740712271026245 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/core/2.0/mule.xsd=META-INF/mule.xsd http\://www.mulesource.org/schema/mule/simple/2.0/mule-simple.xsd=META-INF/mule-simple.xsd http\://www.mulesource.org/schema/mule/custom/2.0/mule-custom.xsd=META-INF/mule-custom.xsd mule-2.0.1/modules/spring-config/src/main/resources/META-INF/spring.handlers0000644000175000017500000000046710740712271026436 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/core/2.0=org.mule.config.spring.handlers.MuleNamespaceHandler http\://www.mulesource.org/schema/mule/simple/2.0=org.mule.config.spring.handlers.SimpleNamespaceHandler http\://www.mulesource.org/schema/mule/custom/2.0=org.mule.config.spring.handlers.CustomNamespaceHandler mule-2.0.1/modules/spring-config/src/main/resources/META-INF/mule-custom.xsd0000644000175000017500000000260210756631035026402 0ustar charlescharles mule-2.0.1/modules/spring-config/src/main/resources/META-INF/mule-simple.xsd0000644000175000017500000000260310756631035026362 0ustar charlescharles mule-2.0.1/modules/spring-config/src/main/resources/default-mule-config.xml0000644000175000017500000001260710766460477026642 0ustar charlescharles mule-2.0.1/modules/spring-config/src/test/0000755000175000017500000000000011351411144020256 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/test/java/0000755000175000017500000000000011351411144021177 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/test/java/org/0000755000175000017500000000000011351411144021766 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/test/java/org/mule/0000755000175000017500000000000011351411144022730 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/0000755000175000017500000000000011351411144024175 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/0000755000175000017500000000000011351411144025477 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/0000755000175000017500000000000011351411144027156 5ustar charlescharlesmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/specific/0000755000175000017500000000000011351411144030743 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/specific/URIBuilderTestCase.javamule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/specific/URIBuilderTes0000644000175000017500000000444710777050076033337 0ustar charlescharles/* * $Id: URIBuilderTestCase.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.specific; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.URIBuilder; import org.mule.tck.AbstractMuleTestCase; import java.util.HashMap; import java.util.Map; public class URIBuilderTestCase extends AbstractMuleTestCase { private static final Map queries; static { queries = new HashMap(); queries.put("aname", "avalue"); queries.put("bname", "bvalue"); } public void testAddressForProtocol() { URIBuilder uri = new URIBuilder(); uri.setProtocol("foo"); uri.setAddress("foo://bar"); assertEquals("foo://bar", uri.toString()); } public void testAddressForMeta() { URIBuilder uri = new URIBuilder(); uri.setMeta("foo"); uri.setAddress("baz://bar"); assertEquals("foo:baz://bar", uri.toString()); } public void testQueriesWithAddress() { URIBuilder uri = new URIBuilder(); uri.setAddress("foo://bar"); uri.setQueryMap(queries); assertEquals("foo://bar?aname=avalue&bname=bvalue", uri.toString()); } public void testLiteralQueries() { URIBuilder uri = new URIBuilder(); uri.setAddress("foo://bar?cname=cvalue"); uri.setQueryMap(queries); assertEquals("foo://bar?cname=cvalue&aname=avalue&bname=bvalue", uri.toString()); } public void testFromString() { URIBuilder uri = new URIBuilder("test://bar"); EndpointURI endpointURI = uri.getEndpoint(); assertEquals("test://bar", endpointURI.getUri().toString()); assertEquals("test", endpointURI.getSchemeMetaInfo()); uri = new URIBuilder("meta:test://bar"); endpointURI = uri.getEndpoint(); assertEquals("test://bar", endpointURI.getUri().toString()); assertEquals("meta", endpointURI.getSchemeMetaInfo()); } }mule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/assembly/0000755000175000017500000000000011351411144030775 5ustar charlescharles././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/assembly/ReusablePropertyConfigurationTestCase.javamule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/assembly/ReusablePrope0000644000175000017500000000402310740712271033475 0ustar charlescharles/* * $Id: ReusablePropertyConfigurationTestCase.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.parsers.assembly.configuration.ReusablePropertyConfiguration; public class ReusablePropertyConfigurationTestCase extends AbstractBasePropertyConfigurationTestCase { public static final String REFERENCE = "reference"; public static final String WRAPPER = "wrapper"; public void testReusable() { ReusablePropertyConfiguration config = new ReusablePropertyConfiguration(); setTestValues(REFERENCE, config); // as normal verifyTestValues(REFERENCE, config); // transparent wrapper verifyIgnored(REFERENCE, config); config.reset(); verifyTestValues(REFERENCE, config); // original values still visible via wrapper setTestValues(WRAPPER, config); // add extra values verifyTestValues(REFERENCE, config); // original values still visible via wrapper verifyTestValues(WRAPPER, config); // new values also visible via wrapper verifyIgnored(WRAPPER, config); config.reset(); verifyMissing(WRAPPER, config); // new values deleted verifyTestValues(REFERENCE, config); // original values still visible via wrapper setTestValues(WRAPPER, config); // add extra values verifyTestValues(REFERENCE, config); // original values still visible via wrapper verifyTestValues(WRAPPER, config); // new values also visible via wrapper config.reset(); verifyMissing(WRAPPER, config); // new values deleted verifyTestValues(REFERENCE, config); // original values still visible via wrapper } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/assembly/TempWrapperPropertyConfigurationTestCase.javamule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/assembly/TempWrapperPr0000644000175000017500000000326110740712271033500 0ustar charlescharles/* * $Id: TempWrapperPropertyConfigurationTestCase.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.SimplePropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.TempWrapperPropertyConfiguration; public class TempWrapperPropertyConfigurationTestCase extends AbstractBasePropertyConfigurationTestCase { public static final String REFERENCE = "reference"; public static final String WRAPPER = "wrapper"; public void testTempWrapper() { PropertyConfiguration reference = new SimplePropertyConfiguration(); setTestValues(REFERENCE, reference); // as normal PropertyConfiguration wrapper = new TempWrapperPropertyConfiguration(reference); verifyTestValues(REFERENCE, wrapper); // transparent wrapper setTestValues(WRAPPER, wrapper); // add extra values verifyTestValues(REFERENCE, wrapper); // original values still visible via wrapper verifyTestValues(WRAPPER, wrapper); // new values also visible via wrapper verifyMissing(WRAPPER, reference); // new values not in reference verifyTestValues(REFERENCE, reference); // reference values still ok } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/assembly/SimplePropertyConfigurationTestCase.javamule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/assembly/SimplePropert0000644000175000017500000000204410740712271033533 0ustar charlescharles/* * $Id: SimplePropertyConfigurationTestCase.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import org.mule.config.spring.parsers.assembly.configuration.SimplePropertyConfiguration; public class SimplePropertyConfigurationTestCase extends AbstractBasePropertyConfigurationTestCase { public static final String SIMPLE = "simple"; public void testSimple() { PropertyConfiguration config = new SimplePropertyConfiguration(); setTestValues(SIMPLE, config); verifyTestValues(SIMPLE, config); verifyIgnored(SIMPLE, config); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/assembly/AbstractBasePropertyConfigurationTestCase.javamule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/assembly/AbstractBaseP0000644000175000017500000001371410740712271033412 0ustar charlescharles/* * $Id: AbstractBasePropertyConfigurationTestCase.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.assembly; import org.mule.config.spring.parsers.assembly.configuration.PrefixValueMap; import org.mule.config.spring.parsers.assembly.configuration.PropertyConfiguration; import java.util.HashMap; import java.util.Map; import junit.framework.TestCase; public abstract class AbstractBasePropertyConfigurationTestCase extends TestCase { public static final String ALIAS = "Alias"; public static final String NAME = "Name"; public static final String COLLECTION = "Collection"; public static final String IGNORED = "Ignored"; public static final String NOT_IGNORED = "Not Ignored"; public static final String MAP_CAPS = "MapCaps"; public static final String MAP_DIGITS = "MapNumbers"; public static final String MAP_PREFIX = "MapPrefix"; public static final String REFERENCE = "Reference"; public static final String UNUSED = "Unused"; public static final String TO_DIGITS = "one=1,two=2,three=3"; public static final Map TO_CAPS; public static final String PREFIX = "prefix"; static { TO_CAPS = new HashMap(); String alphabet = "abcdefghijklmnopqrstuvwxyz"; for (int i = 0; i < alphabet.length(); i++) { String letter = alphabet.substring(i, i+1); TO_CAPS.put(letter.toLowerCase(), letter.toUpperCase()); } } protected void setTestValues(String prefix, PropertyConfiguration config) { config.addAlias(prefix + ALIAS, prefix + NAME); config.addCollection(prefix + COLLECTION); config.addIgnored(prefix + IGNORED); config.removeIgnored(prefix + NOT_IGNORED); config.addMapping(prefix + MAP_CAPS, TO_CAPS); config.addMapping(prefix + MAP_DIGITS, TO_DIGITS); config.addMapping(prefix + MAP_PREFIX, new PrefixValueMap(PREFIX)); config.addReference(prefix + REFERENCE); } protected void verifyTestValues(String prefix, PropertyConfiguration config) { assertEquals(prefix + NAME, config.getAttributeMapping(prefix + ALIAS)); assertEquals(prefix + NAME, config.translateName(prefix + ALIAS)); assertEquals(prefix + UNUSED, config.getAttributeMapping(prefix + UNUSED)); assertEquals(true, config.isCollection(prefix + COLLECTION)); assertEquals(false, config.isCollection(prefix + UNUSED)); assertEquals(true, config.isIgnored(prefix + IGNORED)); assertEquals(false, config.isIgnored(prefix + UNUSED)); assertEquals(false, config.isIgnored(prefix + NOT_IGNORED)); assertEquals("A", config.translateValue(prefix + MAP_CAPS, "a")); assertEquals("a", config.translateValue(prefix + UNUSED, "a")); assertEquals("Z", config.translateValue(prefix + MAP_CAPS, "z")); assertEquals("z", config.translateValue(prefix + UNUSED, "z")); assertEquals("1", config.translateValue(prefix + MAP_CAPS, "1")); assertEquals("1", config.translateValue(prefix + MAP_DIGITS, "one")); assertEquals("2", config.translateValue(prefix + MAP_DIGITS, "two")); assertEquals("3", config.translateValue(prefix + MAP_DIGITS, "three")); assertEquals("four", config.translateValue(prefix + MAP_DIGITS, "four")); assertEquals("one", config.translateValue(prefix + UNUSED, "one")); assertEquals(PREFIX + "foo", config.translateValue(prefix + MAP_PREFIX, "foo")); } protected void verifyIgnored(String prefix, PropertyConfiguration config) { config.setIgnoredDefault(false); assertEquals(true, config.isIgnored(prefix + IGNORED)); assertEquals(false, config.isIgnored(prefix + UNUSED)); assertEquals(false, config.isIgnored(prefix + NOT_IGNORED)); config.setIgnoredDefault(true); assertEquals(true, config.isIgnored(prefix + IGNORED)); assertEquals(true, config.isIgnored(prefix + UNUSED)); assertEquals(false, config.isIgnored(prefix + NOT_IGNORED)); config.setIgnoredDefault(false); config.removeIgnored(prefix + IGNORED); assertEquals(false, config.isIgnored(prefix + IGNORED)); config.addIgnored(prefix + IGNORED); } protected void verifyMissing(String prefix, PropertyConfiguration config) { assertEquals(prefix + ALIAS, config.getAttributeMapping(prefix + ALIAS)); assertEquals(prefix + ALIAS, config.translateName(prefix + ALIAS)); assertEquals(prefix + UNUSED, config.getAttributeMapping(prefix + UNUSED)); assertEquals(false, config.isCollection(prefix + COLLECTION)); assertEquals(false, config.isCollection(prefix + UNUSED)); assertEquals(false, config.isIgnored(prefix + IGNORED)); assertEquals(false, config.isIgnored(prefix + UNUSED)); assertEquals("a", config.translateValue(prefix + MAP_CAPS, "a")); assertEquals("a", config.translateValue(prefix + UNUSED, "a")); assertEquals("z", config.translateValue(prefix + MAP_CAPS, "z")); assertEquals("z", config.translateValue(prefix + UNUSED, "z")); assertEquals("1", config.translateValue(prefix + MAP_CAPS, "1")); assertEquals("one", config.translateValue(prefix + MAP_DIGITS, "one")); assertEquals("two", config.translateValue(prefix + MAP_DIGITS, "two")); assertEquals("three", config.translateValue(prefix + MAP_DIGITS, "three")); assertEquals("four", config.translateValue(prefix + MAP_DIGITS, "four")); assertEquals("one", config.translateValue(prefix + UNUSED, "one")); assertEquals("foo", config.translateValue(prefix + MAP_PREFIX, "foo")); } }mule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/processors/0000755000175000017500000000000011351411144031360 5ustar charlescharles././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/processors/AbstractPreProcessorTestCase.javamule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/processors/AbstractPre0000644000175000017500000000416610740712271033532 0ustar charlescharles/* * $Id: AbstractPreProcessorTestCase.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.tck.AbstractMuleTestCase; import org.mule.config.spring.parsers.PreProcessor; import org.mule.util.ArrayUtils; import java.util.StringTokenizer; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; public abstract class AbstractPreProcessorTestCase extends AbstractMuleTestCase { protected void assertBad(String[][] constraint, String attributes, String text) throws ParserConfigurationException { try { assertOk(constraint, attributes); fail("Expected failure with " + attributes + " and " + ArrayUtils.toString(constraint)); } catch (Exception e) { assertTrue(e.getMessage(), e.getMessage().indexOf(text) > -1); } } protected void assertOk(String[][] constraint, String attributes) throws ParserConfigurationException { createCheck(constraint).preProcess(null, createElement(attributes)); } protected abstract PreProcessor createCheck(String[][] constraint); protected Element createElement(String attributes) throws ParserConfigurationException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = builder.newDocument(); Element element = document.createElement("element"); StringTokenizer tokens = new StringTokenizer(attributes); while (tokens.hasMoreTokens()) { element.setAttribute(tokens.nextToken(), "value"); } return element; } }././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/processors/CheckExclusiveAttributesTestCase.javamule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/processors/CheckExclus0000644000175000017500000000350310740712271033513 0ustar charlescharles/* * $Id: CheckExclusiveAttributesTestCase.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PreProcessor; import javax.xml.parsers.ParserConfigurationException; public class CheckExclusiveAttributesTestCase extends AbstractPreProcessorTestCase { public void testAttributes() throws ParserConfigurationException { String[][] a1b2 = new String[][]{new String[]{"a1"}, new String[]{"b1", "b2"}}; String text = "cannot appear with the attribute"; assertOk(a1b2, ""); assertOk(a1b2, "x"); assertOk(a1b2, "b2"); assertOk(a1b2, "x b1"); assertOk(a1b2, "a1"); assertOk(a1b2, "a1 x"); assertOk(a1b2, "b1 b2"); assertBad(a1b2, "a1 b1", text); assertBad(a1b2, "a1 b2", text); assertBad(a1b2, "a1 b1 b2", text); assertBad(a1b2, "a1 b2 x", text); String[][] a1b0 = new String[][]{new String[]{"a1"}, new String[]{}}; assertOk(a1b0, ""); assertOk(a1b0, "x"); assertOk(a1b0, "b2"); assertOk(a1b0, "x b1"); assertOk(a1b0, "a1"); assertOk(a1b0, "a1 x"); assertOk(a1b0, "b1 b2"); assertOk(a1b0, "a1 b1"); assertOk(a1b0, "a1 b2"); assertOk(a1b0, "a1 b1 b2"); assertOk(a1b0, "a1 b2 x"); } protected PreProcessor createCheck(String[][] constraint) { return new CheckExclusiveAttributes(constraint); } }././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/processors/CheckRequiredAttributesTestCase.javamule-2.0.1/modules/spring-config/src/test/java/org/mule/config/spring/parsers/processors/CheckRequir0000644000175000017500000000610210740712271033515 0ustar charlescharles/* * $Id: CheckRequiredAttributesTestCase.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.spring.parsers.processors; import org.mule.config.spring.parsers.PreProcessor; import javax.xml.parsers.ParserConfigurationException; public class CheckRequiredAttributesTestCase extends AbstractPreProcessorTestCase { public void testTwoSets() throws ParserConfigurationException { String[][] a1b2 = new String[][]{new String[]{"a1"}, new String[]{"b1", "b2"}}; String text12 = "must have all attributes for one of the sets: a1; b1, b2"; assertBad(a1b2, "", text12); assertBad(a1b2, "x", text12); assertBad(a1b2, "b2", text12); assertBad(a1b2, "x b1", text12); assertOk(a1b2, "a1"); assertOk(a1b2, "a1 x"); assertOk(a1b2, "b1 b2"); assertOk(a1b2, "a1 b1"); assertOk(a1b2, "a1 b2"); assertOk(a1b2, "a1 b1 b2"); assertOk(a1b2, "a1 b2 x"); String[][] a1b0 = new String[][]{new String[]{"a1"}, new String[]{}}; String text10 = "must have all attributes for one of the sets: a1"; assertBad(a1b0, "", text10); assertBad(a1b0, "x", text10); assertBad(a1b0, "b2", text10); assertBad(a1b0, "x b1", text10); assertOk(a1b0, "a1"); assertOk(a1b0, "a1 x"); assertBad(a1b0, "b1 b2", text10); assertOk(a1b0, "a1 b1"); assertOk(a1b0, "a1 b2"); assertOk(a1b0, "a1 b1 b2"); assertOk(a1b0, "a1 b2 x"); } public void testSingleSet() throws ParserConfigurationException { String[][] a1 = new String[][]{new String[]{"a1"}}; String text1 = "must have all attributes for one of the sets: a1"; assertBad(a1, "", text1); assertBad(a1, "x", text1); assertBad(a1, "b2", text1); assertBad(a1, "x b1", text1); assertOk(a1, "a1"); assertOk(a1, "a1 x"); assertBad(a1, "b1 b2", text1); assertOk(a1, "a1 b1"); assertOk(a1, "a1 b2"); assertOk(a1, "a1 b1 b2"); assertOk(a1, "a1 b2 x"); String[][] b2 = new String[][]{new String[]{"b1", "b2"}}; String text2 = "must have all attributes for one of the sets: b1, b2"; assertBad(b2, "", text2); assertBad(b2, "x", text2); assertBad(b2, "b2", text2); assertBad(b2, "x b1", text2); assertBad(b2, "a1", text2); assertBad(b2, "a1 x", text2); assertOk(b2, "b1 b2"); assertBad(b2, "a1 b1", text2); assertBad(b2, "a1 b2", text2); assertOk(b2, "a1 b1 b2"); assertBad(b2, "a1 b2 x", text2); } protected PreProcessor createCheck(String[][] constraint) { return new CheckRequiredAttributes(constraint); } } mule-2.0.1/modules/spring-config/src/test/resources/0000755000175000017500000000000011351411144022270 5ustar charlescharlesmule-2.0.1/modules/spring-config/pom.xml0000644000175000017500000000641111006063605020031 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-spring-config Spring Config Mule Builder for use with Spring 2.X Namespace based XML configuration. maven-surefire-plugin **/* osgi org.apache.felix maven-bundle-plugin org.mule.module.spring.config, org.mule.module.spring.events, org.mule.module.spring.remoting, org.mule.module.spring.transaction org.springframework spring-core org.springframework spring-beans org.springframework spring-context org.mule mule-core ${version} org.mule mule-core ${version} test test-jar mule-2.0.1/modules/all-modules/0000755000175000017500000000000011351411165016164 5ustar charlescharlesmule-2.0.1/modules/all-modules/pom.xml0000644000175000017500000001033311006063605017500 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-modules-all pom All Mule Modules This is a meta module that allows easy referencing of all modules. This is needed in our various distributions we publish. org.mule.modules mule-module-acegi ${version} org.mule.modules mule-module-boot ${version} org.mule.modules mule-module-builders ${version} org.mule.modules mule-module-client ${version} org.mule.modules mule-module-jaas ${version} org.mule.modules mule-module-jbossts ${version} org.mule.modules.jca mule-module-jca-generic ${version} org.mule.modules.jca mule-module-jca-jboss ${version} org.mule.modules mule-module-management ${version} org.mule.modules mule-module-ognl ${version} org.mule.modules mule-module-pgp ${version} org.mule.modules mule-module-scripting ${version} org.mule.modules mule-module-spring-config ${version} org.mule.modules mule-module-spring-extras ${version} org.mule.modules mule-module-xml ${version} osgi org.mule.modules mule-module-osgi ${version} mule-2.0.1/modules/builders/0000755000175000017500000000000011351411156015557 5ustar charlescharlesmule-2.0.1/modules/builders/src/0000755000175000017500000000000011351411156016346 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/0000755000175000017500000000000011351411156017272 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/java/0000755000175000017500000000000011351411156020213 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/java/org/0000755000175000017500000000000011351411156021002 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/java/org/mule/0000755000175000017500000000000011351411156021744 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/java/org/mule/config/0000755000175000017500000000000011351411156023211 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/java/org/mule/config/builders/0000755000175000017500000000000011351411156025022 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/builders/src/main/java/org/mule/config/builders/MuleXmlBuilderContextServlet.javamule-2.0.1/modules/builders/src/main/java/org/mule/config/builders/MuleXmlBuilderContextServlet.java0000644000175000017500000000340410664630335033502 0ustar charlescharles/* * $Id: MuleXmlBuilderContextServlet.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.builders; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class MuleXmlBuilderContextServlet extends HttpServlet { /** * Serial version */ private static final long serialVersionUID = -2446689032349402434L; private MuleXmlBuilderContextListener contextListener; public void init() throws ServletException { if (contextListener != null) { contextListener.destroy(); contextListener = null; } contextListener = new MuleXmlBuilderContextListener(); contextListener.initialize(getServletContext()); } protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { getServletContext().log( "(" + request.getRequestURI() + ")" + "MuleXmlBuilderContextServlet.service(HttpServletRequest request, HttpServletResponse response) call ignored."); response.sendError(HttpServletResponse.SC_BAD_REQUEST); } public void destroy() { if (contextListener != null) { contextListener.destroy(); } } } mule-2.0.1/modules/builders/src/main/java/org/mule/config/builders/i18n/0000755000175000017500000000000011351411156025601 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/java/org/mule/config/builders/i18n/BuildersMessages.java0000644000175000017500000000245010664630335031716 0ustar charlescharles/* * $Id: BuildersMessages.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.builders.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class BuildersMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("builders"); public static Message failedToParseConfigResource(String description) { return createMessage(BUNDLE_PATH, 1, description); } public static Message propertyTemplateMalformed(String string) { return createMessage(BUNDLE_PATH, 2, string); } public static Message systemPropertyNotSet(String property) { return createMessage(BUNDLE_PATH, 3, property); } public static Message mustSpecifyContainerRefOrClassAttribute(String containerAttrib, String refAttrib, String config) { return createMessage(BUNDLE_PATH, 4, containerAttrib, refAttrib, config); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/modules/builders/src/main/java/org/mule/config/builders/WebappMuleXmlConfigurationBuilder.javamule-2.0.1/modules/builders/src/main/java/org/mule/config/builders/WebappMuleXmlConfigurationBuilder0000644000175000017500000002016311002162333033521 0ustar charlescharles/* * $Id: WebappMuleXmlConfigurationBuilder.java 11600 2008-04-18 18:13:47Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.builders; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationException; import org.mule.api.registry.Registry; import org.mule.config.ConfigResource; import org.mule.config.spring.MuleApplicationContext; import org.mule.config.spring.SpringXmlConfigurationBuilder; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import javax.servlet.ServletContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.access.BeanFactoryLocator; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextException; import org.springframework.context.access.ContextSingletonBeanFactoryLocator; import org.springframework.core.io.AbstractResource; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; import org.springframework.web.context.ContextLoader; import org.springframework.web.context.support.ServletContextResource; /** * WebappMuleXmlConfigurationBuilder will first try and load config * resources using the ServletContext and if this fails then it will attempt to load * config resource from the classpath. *

  • ServletContext resources should be relative to the webapp root directory and * start with '/'. *
  • Classpath resources should be in the webapp classpath and should not start * with '/'. * * @see org.mule.config.builders.SpringXmlConfigurationBuilder */ public class WebappMuleXmlConfigurationBuilder extends SpringXmlConfigurationBuilder { /** * Logger used by this class */ protected transient final Log logger = LogFactory.getLog(getClass()); private ServletContext context; public WebappMuleXmlConfigurationBuilder(ServletContext servletContext, String configResources) throws ConfigurationException { super(configResources); context = servletContext; } public WebappMuleXmlConfigurationBuilder(ServletContext servletContext, String[] configResources) throws ConfigurationException { super(configResources); context = servletContext; } protected ConfigResource[] loadConfigResources(String[] configs) throws ConfigurationException { try { configResources = new ConfigResource[configs.length]; for (int i = 0; i < configs.length; i++) { configResources[i] = new ServletContextOrClassPathConfigResource(configs[i]); } return configResources; } catch (IOException e) { throw new ConfigurationException(e); } } protected void createSpringParentRegistry(MuleContext muleContext, Registry registry, ConfigResource[] all) { Resource[] servletContextResources = new Resource[all.length]; for (int i = 0; i < all.length; i++) { servletContextResources[i] = new ServletContextOrClassPathResource(context, all[i].getResourceName()); } parentContext = loadParentContext(context); try { if (parentContext != null) { new MuleApplicationContext(muleContext, registry, servletContextResources, parentContext); } else { new MuleApplicationContext(muleContext, registry, servletContextResources); } } catch (BeansException e) { // If creation of MuleApplicationContext fails, remove // TransientRegistry->SpringRegistry parent relationship registry.setParent(null); throw e; } catch (IOException e) { registry.setParent(null); throw new ApplicationContextException("Failed to load config resource", e); } } /** * Used to lookup parent spring ApplicationContext. This allows a parent spring * ApplicatonContet to be provided in the same way you would configure a parent * ApplicationContext for a spring WebAppplicationContext * * @param servletContext * @return * @throws BeansException */ protected ApplicationContext loadParentContext(ServletContext servletContext) throws BeansException { ApplicationContext parentContext = null; String locatorFactorySelector = servletContext.getInitParameter(ContextLoader.LOCATOR_FACTORY_SELECTOR_PARAM); String parentContextKey = servletContext.getInitParameter(ContextLoader.LOCATOR_FACTORY_KEY_PARAM); if (parentContextKey != null) { // locatorFactorySelector may be null, indicating the default // "classpath*:beanRefContext.xml" BeanFactoryLocator locator = ContextSingletonBeanFactoryLocator.getInstance(locatorFactorySelector); if (logger.isDebugEnabled()) { logger.debug("Getting parent context definition: using parent context key of '" + parentContextKey + "' with BeanFactoryLocator"); } parentContext = (ApplicationContext) locator.useBeanFactory(parentContextKey).getFactory(); } return parentContext; } class ServletContextOrClassPathConfigResource extends ConfigResource { public ServletContextOrClassPathConfigResource(String resourceName) throws IOException { super(resourceName, null); } } /** * Combines {@link ServletContextResource} and {@link ClassPathResource} to * create a {@link Resource} implementation that first tries to load a resource * using the {@link ServletContext} and then fails back to use try to load the * resource from the classpath. */ class ServletContextOrClassPathResource extends AbstractResource { private final ServletContext servletContext; private final String path; public ServletContextOrClassPathResource(ServletContext servletContext, String path) { Assert.notNull(servletContext, "Cannot resolve ServletContextResource without ServletContext"); this.servletContext = servletContext; // check path Assert.notNull(path, "path is required"); this.path = StringUtils.cleanPath(path); } public InputStream getInputStream() throws IOException { InputStream is = getServletContextInputStream(); if (is == null) { is = getClasspathInputStream(); } if (is == null) { throw new FileNotFoundException(getDescription() + " cannot be opened because it does not exist"); } return is; } protected InputStream getServletContextInputStream() { String servletContextPath = path; if (!servletContextPath.startsWith("/")) { servletContextPath = "/" + servletContextPath; } return servletContext.getResourceAsStream(servletContextPath); } protected InputStream getClasspathInputStream() { String classpathPath = path; if (classpathPath.startsWith("/")) { classpathPath = classpathPath.substring(1); } return ClassUtils.getDefaultClassLoader().getResourceAsStream(classpathPath); } public String getDescription() { return path; } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/builders/src/main/java/org/mule/config/builders/MuleXmlBuilderContextListener.javamule-2.0.1/modules/builders/src/main/java/org/mule/config/builders/MuleXmlBuilderContextListener.jav0000644000175000017500000001102310754375733033506 0ustar charlescharles/* * $Id: MuleXmlBuilderContextListener.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.builders; import org.mule.MuleServer; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.config.ConfigurationException; import org.mule.api.context.MuleContextFactory; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.context.DefaultMuleContextFactory; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleXmlBuilderContextListener is a bootstrap listener used to * construct a MuleManager instance. This listener delegates to the * MuleXmlConfigurationBuilder. *

    * The location of the configuration file can be specified in a init parameter called * org.mule.config, the value can be a path on the local file system or on * the classpath. If a config parameter is not specified a default mule-config.xml * will be used. *

    * * @see SpringXmlConfigurationBuilder */ public class MuleXmlBuilderContextListener implements ServletContextListener { /** * One or more Mule config files. */ public static final String INIT_PARAMETER_MULE_CONFIG = "org.mule.config"; private MuleContext muleContext; protected transient final Log logger = LogFactory.getLog(MuleXmlBuilderContextListener.class); public void contextInitialized(ServletContextEvent event) { initialize(event.getServletContext()); } public void initialize(ServletContext context) { String config = context.getInitParameter(INIT_PARAMETER_MULE_CONFIG); if (config == null) { config = getDefaultConfigResource(); System.out.println("No Mule config file(s) specified, using default: " + config); } else { System.out.println("Mule config file(s): " + config); } try { muleContext = createManager(config, context); muleContext.start(); } catch (MuleException ex) { context.log(ex.getMessage(), ex); // Logging is not configured OOTB for Tomcat, so we'd better make a // start-up failure plain to see. ex.printStackTrace(); } catch (Error error) { // WSAD doesn't always report the java.lang.Error, log it context.log(error.getMessage(), error); // Logging is not configured OOTB for Tomcat, so we'd better make a // start-up failure plain to see. error.printStackTrace(); throw error; } } /** * Used to actually construct the UMOManager instance * * @param configResource the location of the config resource, this can be on the * local file system or on the classpath. * @return A configured UMOManager instance * @throws InitialisationException */ protected MuleContext createManager(String configResource, ServletContext context) throws ConfigurationException, InitialisationException { WebappMuleXmlConfigurationBuilder builder = new WebappMuleXmlConfigurationBuilder(context, configResource); MuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); return muleContextFactory.createMuleContext(builder); } /** * If no config location resource is configured on the servlet context, the value * returned from this method will be used to initialise the MuleManager. * * @return the default config resource location */ protected String getDefaultConfigResource() { return MuleServer.DEFAULT_CONFIGURATION; } public void contextDestroyed(ServletContextEvent event) { destroy(); } public void destroy() { if (muleContext != null) { if (!muleContext.isDisposing() || !muleContext.isDisposed()) { muleContext.dispose(); } } } } mule-2.0.1/modules/builders/src/main/resources/0000755000175000017500000000000011351411156021304 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/resources/META-INF/0000755000175000017500000000000011351411156022444 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/resources/META-INF/MANIFEST.MF0000644000175000017500000000016310754375733024116 0ustar charlescharlesBundle-SymbolicName: org.mule.module.builders Export-Package: org.mule.config.builders, org.mule.config.convertersmule-2.0.1/modules/builders/src/main/resources/META-INF/services/0000755000175000017500000000000011351411156024267 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351411156025056 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351411156026020 5ustar charlescharlesmule-2.0.1/modules/builders/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351411156026577 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/builders/src/main/resources/META-INF/services/org/mule/i18n/builders-messages.propertiesmule-2.0.1/modules/builders/src/main/resources/META-INF/services/org/mule/i18n/builders-messages.pro0000644000175000017500000000062410621717250032744 0ustar charlescharles1=Failed to parse configuration resource "{0}" 2=Property Template malformed for element "{0}" 3=The required System property "{0}" has not been set 4=You must either specify container reference attribute "{0}" or class attribute "{1}" for configuration at "{2}".\ The container ref attibute is used to load this object from a container so make sure you have at least one container context configured. mule-2.0.1/modules/builders/src/test/0000755000175000017500000000000011351411156017325 5ustar charlescharlesmule-2.0.1/modules/builders/src/test/java/0000755000175000017500000000000011351411156020246 5ustar charlescharlesmule-2.0.1/modules/builders/src/test/java/org/0000755000175000017500000000000011351411156021035 5ustar charlescharlesmule-2.0.1/modules/builders/src/test/java/org/mule/0000755000175000017500000000000011351411156021777 5ustar charlescharlesmule-2.0.1/modules/builders/src/test/java/org/mule/test/0000755000175000017500000000000011351411156022756 5ustar charlescharlesmule-2.0.1/modules/builders/src/test/java/org/mule/test/config/0000755000175000017500000000000011351411156024223 5ustar charlescharlesmule-2.0.1/modules/builders/pom.xml0000644000175000017500000000261511006063605017077 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-builders Mule Configuration Builders Standard configuration builders for Mule org.mule mule-core ${version} org.mule.modules mule-module-spring-config ${version} org.apache.geronimo.specs geronimo-servlet_2.4_spec provided org.springframework spring-web mule-2.0.1/modules/pgp/0000755000175000017500000000000011351411134014530 5ustar charlescharlesmule-2.0.1/modules/pgp/src/0000755000175000017500000000000011351411133015316 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/0000755000175000017500000000000011351411133016242 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/java/0000755000175000017500000000000011351411133017163 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/java/org/0000755000175000017500000000000011351411133017752 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/java/org/mule/0000755000175000017500000000000011351411133020714 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/java/org/mule/module/0000755000175000017500000000000011351411133022201 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/0000755000175000017500000000000011351411133022767 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/PGPKeyRingImpl.java0000644000175000017500000001034510774254333026415 0ustar charlescharles/* * $Id: PGPKeyRingImpl.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import org.mule.util.IOUtils; import cryptix.pki.ExtendedKeyStore; import cryptix.pki.KeyBundle; import java.io.InputStream; import java.security.Principal; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class PGPKeyRingImpl implements PGPKeyRing, Initialisable { protected static final Log logger = LogFactory.getLog(PGPKeyRingImpl.class); private String publicKeyRingFileName; private HashMap principalsKeyBundleMap; private String secretKeyRingFileName; private String secretAliasId; private KeyBundle secretKeyBundle; private String secretPassphrase; public PGPKeyRingImpl() { super(); } public String getSecretKeyRingFileName() { return secretKeyRingFileName; } public void setSecretKeyRingFileName(String value) { this.secretKeyRingFileName = value; } public String getSecretAliasId() { return secretAliasId; } public void setSecretAliasId(String value) { this.secretAliasId = value; } public String getSecretPassphrase() { return secretPassphrase; } public void setSecretPassphrase(String value) { this.secretPassphrase = value; } private void readPrivateKeyBundle() throws Exception { InputStream in = IOUtils.getResourceAsStream(secretKeyRingFileName, getClass()); ExtendedKeyStore ring = (ExtendedKeyStore) ExtendedKeyStore.getInstance("OpenPGP/KeyRing"); ring.load(in, null); in.close(); secretKeyBundle = ring.getKeyBundle(secretAliasId); } public KeyBundle getSecretKeyBundle() { return secretKeyBundle; } /** @return */ public String getPublicKeyRingFileName() { return publicKeyRingFileName; } /** @param value */ public void setPublicKeyRingFileName(String value) { this.publicKeyRingFileName = value; } public KeyBundle getKeyBundle(String principalId) { return (KeyBundle) principalsKeyBundleMap.get(principalId); } public void initialise() throws InitialisationException { try { java.security.Security.addProvider(new cryptix.jce.provider.CryptixCrypto()); java.security.Security.addProvider(new cryptix.openpgp.provider.CryptixOpenPGP()); principalsKeyBundleMap = new HashMap(); readPublicKeyRing(); readPrivateKeyBundle(); } catch (Exception e) { logger.error("errore in inizializzazione:" + e.getMessage(), e); throw new InitialisationException(CoreMessages.failedToCreate("PGPKeyRingImpl"), e, this); } } private void readPublicKeyRing() throws Exception { logger.debug(System.getProperties().get("user.dir")); InputStream in = IOUtils.getResourceAsStream(publicKeyRingFileName, getClass()); ExtendedKeyStore ring = (ExtendedKeyStore) ExtendedKeyStore.getInstance("OpenPGP/KeyRing"); ring.load(in, null); in.close(); for (Enumeration e = ring.aliases(); e.hasMoreElements();) { String aliasId = (String) e.nextElement(); KeyBundle bundle = ring.getKeyBundle(aliasId); if (bundle != null) { for (Iterator users = bundle.getPrincipals(); users.hasNext();) { Principal princ = (Principal) users.next(); principalsKeyBundleMap.put(princ.getName(), bundle); } } } } } mule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/PGPSecurityProvider.java0000644000175000017500000001030110774254333027535 0ustar charlescharles/* * $Id: PGPSecurityProvider.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; import org.mule.api.security.SecurityContextFactory; import org.mule.api.security.SecurityException; import org.mule.api.security.SecurityProvider; import org.mule.api.security.UnauthorisedException; import org.mule.api.security.UnknownAuthenticationTypeException; import org.mule.config.i18n.CoreMessages; import org.mule.module.pgp.i18n.PGPMessages; import cryptix.message.Message; import cryptix.message.MessageException; import cryptix.message.SignedMessage; import cryptix.pki.KeyBundle; public class PGPSecurityProvider implements SecurityProvider { private String name = "PGPSecurityProvider"; private PGPKeyRing keyManager; private SecurityContextFactory factory; /* * (non-Javadoc) * * @see org.mule.api.security.SecurityProvider#setName(java.lang.String) */ public void setName(String name) { this.name = name; } /* * (non-Javadoc) * * @see org.mule.api.security.SecurityProvider#getName() */ public String getName() { return name; } /* * (non-Javadoc) * * @see org.mule.api.security.SecurityProvider#authenticate(org.mule.api.security.Authentication) */ public Authentication authenticate(Authentication authentication) throws SecurityException { PGPAuthentication auth = (PGPAuthentication) authentication; String userId = (String) auth.getPrincipal(); if (userId == null) { throw new UnauthorisedException(CoreMessages.objectIsNull("UserId")); } KeyBundle userKeyBundle = keyManager.getKeyBundle(userId); if (userKeyBundle == null) { throw new UnauthorisedException(PGPMessages.noPublicKeyForUser(userId)); } Message msg = (Message) auth.getCredentials(); if (!((msg != null) && msg instanceof SignedMessage)) { throw new UnauthorisedException(PGPMessages.noSignedMessageFound()); } try { if (!((SignedMessage) msg).verify(userKeyBundle)) { throw new UnauthorisedException(PGPMessages.invalidSignature()); } } catch (MessageException e) { throw new UnauthorisedException(PGPMessages.errorVerifySignature(), e); } auth.setAuthenticated(true); auth.setDetails(userKeyBundle); return auth; } /* * (non-Javadoc) * * @see org.mule.api.security.SecurityProvider#supports(java.lang.Class) */ public boolean supports(Class aClass) { return PGPAuthentication.class.isAssignableFrom(aClass); } /* * (non-Javadoc) * * @see org.mule.api.security.SecurityProvider#createSecurityContext(org.mule.api.security.Authentication) */ public SecurityContext createSecurityContext(Authentication auth) throws UnknownAuthenticationTypeException { return factory.create(auth); } public void initialise() throws InitialisationException { try { java.security.Security.addProvider(new cryptix.jce.provider.CryptixCrypto()); java.security.Security.addProvider(new cryptix.openpgp.provider.CryptixOpenPGP()); factory = new PGPSecurityContextFactory(); } catch (Exception e) { throw new InitialisationException(CoreMessages.failedToCreate("PGPProvider"), e, this); } } public PGPKeyRing getKeyManager() { return keyManager; } public void setKeyManager(PGPKeyRing keyManager) { this.keyManager = keyManager; } } mule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/PGPAuthentication.java0000644000175000017500000000407410754375733027212 0ustar charlescharles/* * $Id: PGPAuthentication.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.api.security.Authentication; import java.util.Map; import cryptix.message.Message; import cryptix.pki.KeyBundle; public class PGPAuthentication implements Authentication { boolean authenticated = false; private String userName; private Message message; private KeyBundle userKeyBundle = null; public PGPAuthentication(String userName, Message message) { this.userName = userName; this.message = message; } /* * (non-Javadoc) * * @see org.mule.api.security.Authentication#setAuthenticated(boolean) */ public void setAuthenticated(boolean b) { authenticated = b; } /* * (non-Javadoc) * * @see org.mule.api.security.Authentication#isAuthenticated() */ public boolean isAuthenticated() { return authenticated; } /* * (non-Javadoc) * * @see org.mule.api.security.Authentication#getCredentials() */ public Object getCredentials() { return message; } /* * (non-Javadoc) * * @see org.mule.api.security.Authentication#getDetails() */ public Object getDetails() { return userKeyBundle; } protected void setDetails(KeyBundle kb) { userKeyBundle = kb; } /* * (non-Javadoc) * * @see org.mule.api.security.Authentication#getPrincipal() */ public Object getPrincipal() { return userName; } public Map getProperties() { // TODO return null; } public void setProperties(Map securityMode) { // TODO } } mule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/i18n/0000755000175000017500000000000011351411133023546 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/i18n/PGPMessages.java0000644000175000017500000000230210754375733026551 0ustar charlescharles/* * $Id: PGPMessages.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class PGPMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("pgp"); public static Message noPublicKeyForUser(String userId) { return createMessage(BUNDLE_PATH, 1, userId); } public static Message noSignedMessageFound() { return createMessage(BUNDLE_PATH, 2); } public static Message invalidSignature() { return createMessage(BUNDLE_PATH, 3); } public static Message errorVerifySignature() { return createMessage(BUNDLE_PATH, 4); } public static Message encryptionStrategyNotSet() { return createMessage(BUNDLE_PATH, 5); } } mule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/PGPKeyRing.java0000644000175000017500000000125010754375733025574 0ustar charlescharles/* * $Id: PGPKeyRing.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import cryptix.pki.KeyBundle; public interface PGPKeyRing { public abstract String getSecretPassphrase(); public abstract KeyBundle getSecretKeyBundle(); public abstract KeyBundle getKeyBundle(String principalId); } mule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/config/0000755000175000017500000000000011351411133024234 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/config/PgpNamespaceHandler.java0000644000175000017500000000320410754375733030764 0ustar charlescharles/* * $Id: PgpNamespaceHandler.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp.config; import org.mule.api.config.MuleProperties; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.generic.NamedDefinitionParser; import org.mule.config.spring.parsers.generic.ParentDefinitionParser; import org.mule.module.pgp.KeyBasedEncryptionStrategy; import org.mule.module.pgp.PGPSecurityProvider; import org.mule.module.pgp.filters.PGPSecurityFilter; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; public class PgpNamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("security-manager", new NamedDefinitionParser(MuleProperties.OBJECT_SECURITY_MANAGER)); registerBeanDefinitionParser("security-provider", new ChildDefinitionParser("provider", PGPSecurityProvider.class)); registerBeanDefinitionParser("security-filters", new ParentDefinitionParser()); registerBeanDefinitionParser("security-filter", new ChildDefinitionParser("securityFilter", PGPSecurityFilter.class)); registerBeanDefinitionParser("keybased-encryption-strategy", new ChildDefinitionParser("encryptionStrategy", KeyBasedEncryptionStrategy.class)); } } mule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/filters/0000755000175000017500000000000011351411133024437 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/filters/PGPSecurityFilter.java0000644000175000017500000001547310754375733030665 0ustar charlescharles/* * $Id: PGPSecurityFilter.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp.filters; import org.mule.api.EncryptionStrategy; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; import org.mule.api.security.UnauthorisedException; import org.mule.api.security.UnknownAuthenticationTypeException; import org.mule.config.i18n.CoreMessages; import org.mule.module.pgp.PGPAuthentication; import org.mule.module.pgp.PGPCryptInfo; import org.mule.module.pgp.PGPKeyRing; import org.mule.module.pgp.i18n.PGPMessages; import org.mule.security.AbstractEndpointSecurityFilter; import java.io.ByteArrayInputStream; import java.util.Collection; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import cryptix.message.LiteralMessage; import cryptix.message.Message; import cryptix.message.MessageFactory; import cryptix.message.SignedMessage; import cryptix.pki.KeyBundle; public class PGPSecurityFilter extends AbstractEndpointSecurityFilter { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(PGPSecurityFilter.class); private EncryptionStrategy strategy; private String strategyName; private boolean signRequired; private PGPKeyRing keyManager; /* * (non-Javadoc) * * @see org.mule.security.AbstractEndpointSecurityFilter#authenticateInbound(org.mule.api.MuleEvent) */ protected void authenticateInbound(MuleEvent event) throws SecurityException, UnauthorisedException, UnknownAuthenticationTypeException { MuleMessage message = event.getMessage(); String userId = (String)getCredentialsAccessor().getCredentials(event); byte[] creds = null; try { creds = message.getPayloadAsBytes(); creds = strategy.decrypt(creds, null); } catch (Exception e1) { throw new UnauthorisedException( CoreMessages.failedToReadPayload(), event.getMessage(), e1); } final Authentication authResult; Authentication umoAuthentication; try { umoAuthentication = new PGPAuthentication(userId, decodeMsgRaw(creds)); } catch (Exception e1) { throw new UnauthorisedException( CoreMessages.failedToReadPayload(), event.getMessage(), e1); } try { authResult = getSecurityManager().authenticate(umoAuthentication); } catch (Exception e) { // Authentication failed if (logger.isDebugEnabled()) { logger.debug("Authentication request for user: " + userId + " failed: " + e.toString()); } throw new UnauthorisedException(CoreMessages.authFailedForUser(userId), event.getMessage(), e); } // Authentication success if (logger.isDebugEnabled()) { logger.debug("Authentication success: " + authResult.toString()); } SecurityContext context = getSecurityManager().createSecurityContext(authResult); event.getSession().setSecurityContext(context); try { updatePayload(event.getMessage(), getUnencryptedMessageWithoutSignature((PGPAuthentication)authResult)); // TODO RequestContext.rewriteEvent(new DefaultMuleMessage( // getUnencryptedMessageWithoutSignature((PGPAuthentication)authResult))); } catch (Exception e2) { throw new UnauthorisedException(event.getMessage(), context, event.getEndpoint(), this); } } private Message decodeMsgRaw(byte[] raw) throws Exception { MessageFactory mf = MessageFactory.getInstance("OpenPGP"); ByteArrayInputStream in = new ByteArrayInputStream(raw); Collection msgs = mf.generateMessages(in); return (Message)msgs.iterator().next(); } private String getUnencryptedMessageWithoutSignature(PGPAuthentication auth) throws Exception { Message msg = (Message)auth.getCredentials(); if (msg instanceof SignedMessage) { msg = ((SignedMessage)msg).getContents(); } if (msg instanceof LiteralMessage) { return ((LiteralMessage)msg).getTextData(); } else { throw new Exception("Wrong data"); } } /* * (non-Javadoc) * * @see org.mule.security.AbstractEndpointSecurityFilter#authenticateOutbound(org.mule.api.MuleEvent) */ protected void authenticateOutbound(MuleEvent event) throws SecurityException, UnauthorisedException { logger.debug("authenticateOutbound:" + event.getId()); if (!isAuthenticate()) { return; } MuleMessage message = event.getMessage(); KeyBundle userKeyBundle = keyManager.getKeyBundle((String)getCredentialsAccessor().getCredentials( event)); final PGPCryptInfo cryptInfo = new PGPCryptInfo(userKeyBundle, signRequired); try { updatePayload(event.getMessage(), strategy.encrypt(message.getPayloadAsBytes(), cryptInfo)); } catch (Exception e1) { throw new UnauthorisedException(CoreMessages.failedToReadPayload(), event.getMessage(), e1); } } protected void doInitialise() throws InitialisationException { if (strategyName != null) { strategy = endpoint.getMuleContext().getSecurityManager().getEncryptionStrategy(strategyName); } if (strategy == null) { throw new InitialisationException(PGPMessages.encryptionStrategyNotSet(), this); } } public EncryptionStrategy getStrategy() { return strategy; } public void setStrategy(EncryptionStrategy strategy) { this.strategy = strategy; } public void setStrategyName(String name) { strategyName = name; } public boolean isSignRequired() { return signRequired; } public void setSignRequired(boolean signRequired) { this.signRequired = signRequired; } public PGPKeyRing getKeyManager() { return keyManager; } public void setKeyManager(PGPKeyRing keyManager) { this.keyManager = keyManager; } } mule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/KeyBasedEncryptionStrategy.java0000644000175000017500000001134210774254333031137 0ustar charlescharles/* * $Id: KeyBasedEncryptionStrategy.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.CredentialsAccessor; import org.mule.api.security.CryptoFailureException; import org.mule.config.i18n.CoreMessages; import org.mule.security.AbstractNamedEncryptionStrategy; import cryptix.message.EncryptedMessage; import cryptix.message.EncryptedMessageBuilder; import cryptix.message.LiteralMessageBuilder; import cryptix.message.Message; import cryptix.message.MessageFactory; import cryptix.message.SignedMessageBuilder; import cryptix.openpgp.PGPArmouredMessage; import cryptix.pki.KeyBundle; import java.io.ByteArrayInputStream; import java.util.Collection; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class KeyBasedEncryptionStrategy extends AbstractNamedEncryptionStrategy { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(KeyBasedEncryptionStrategy.class); private PGPKeyRing keyManager; private CredentialsAccessor credentialsAccessor; public byte[] encrypt(byte[] data, Object cryptInfo) throws CryptoFailureException { try { PGPCryptInfo pgpCryptInfo; KeyBundle publicKey; if (cryptInfo == null) { MuleEvent event = RequestContext.getEvent(); publicKey = keyManager.getKeyBundle((String)credentialsAccessor.getCredentials( event)); pgpCryptInfo = new PGPCryptInfo(publicKey, false); } else { pgpCryptInfo = (PGPCryptInfo)cryptInfo; publicKey = pgpCryptInfo.getKeyBundle(); } LiteralMessageBuilder lmb = LiteralMessageBuilder.getInstance("OpenPGP"); lmb.init(data); Message msg = lmb.build(); if (pgpCryptInfo.isSignRequested()) { SignedMessageBuilder smb = SignedMessageBuilder.getInstance("OpenPGP"); smb.init(msg); smb.addSigner(keyManager.getSecretKeyBundle(), keyManager.getSecretPassphrase().toCharArray()); msg = smb.build(); } EncryptedMessageBuilder emb = EncryptedMessageBuilder.getInstance("OpenPGP"); emb.init(msg); emb.addRecipient(publicKey); msg = emb.build(); return new PGPArmouredMessage(msg).getEncoded(); } catch (Exception e) { throw new CryptoFailureException(this, e); } } public byte[] decrypt(byte[] data, Object cryptInfo) throws CryptoFailureException { try { MessageFactory mf = MessageFactory.getInstance("OpenPGP"); ByteArrayInputStream in = new ByteArrayInputStream(data); Collection msgs = mf.generateMessages(in); Message msg = (Message)msgs.iterator().next(); if (msg instanceof EncryptedMessage) { msg = ((EncryptedMessage)msg).decrypt(keyManager.getSecretKeyBundle(), keyManager.getSecretPassphrase().toCharArray()); return new PGPArmouredMessage(msg).getEncoded(); } } catch (Exception e) { throw new CryptoFailureException(this, e); } return data; } public void initialise() throws InitialisationException { try { java.security.Security.addProvider(new cryptix.jce.provider.CryptixCrypto()); java.security.Security.addProvider(new cryptix.openpgp.provider.CryptixOpenPGP()); } catch (Exception e) { throw new InitialisationException( CoreMessages.failedToCreate("KeyBasedEncryptionStrategy"), e, this); } } public PGPKeyRing getKeyManager() { return keyManager; } public void setKeyManager(PGPKeyRing keyManager) { this.keyManager = keyManager; } public CredentialsAccessor getCredentialsAccessor() { return credentialsAccessor; } public void setCredentialsAccessor(CredentialsAccessor credentialsAccessor) { this.credentialsAccessor = credentialsAccessor; } } mule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/PGPSecurityContext.java0000644000175000017500000000241010754375733027377 0ustar charlescharles/* * $Id: PGPSecurityContext.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; public class PGPSecurityContext implements SecurityContext { private volatile PGPAuthentication authentication; public PGPSecurityContext(PGPAuthentication authentication) { this.authentication = authentication; } /* * (non-Javadoc) * * @see org.mule.api.security.SecurityContext#setAuthentication(org.mule.api.security.Authentication) */ public void setAuthentication(Authentication authentication) { this.authentication = (PGPAuthentication)authentication; } /* * (non-Javadoc) * * @see org.mule.api.security.SecurityContext#getAuthentication() */ public Authentication getAuthentication() { return authentication; } } mule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/PGPSecurityContextFactory.java0000644000175000017500000000173110754375733030734 0ustar charlescharles/* * $Id: PGPSecurityContextFactory.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; import org.mule.api.security.SecurityContextFactory; public class PGPSecurityContextFactory implements SecurityContextFactory { /* * (non-Javadoc) * * @see org.mule.api.security.SecurityContextFactory#create(org.mule.api.security.Authentication) */ public SecurityContext create(Authentication authentication) { return new PGPSecurityContext((PGPAuthentication)authentication); } } mule-2.0.1/modules/pgp/src/main/java/org/mule/module/pgp/PGPCryptInfo.java0000644000175000017500000000212610754375733026144 0ustar charlescharles/* * $Id: PGPCryptInfo.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import cryptix.pki.KeyBundle; public class PGPCryptInfo { KeyBundle keyBundle; boolean signRequested; public PGPCryptInfo(KeyBundle keyBundle, boolean signRequested) { super(); this.keyBundle = keyBundle; this.signRequested = signRequested; } public KeyBundle getKeyBundle() { return keyBundle; } public void setKeyBundle(KeyBundle keyBundle) { this.keyBundle = keyBundle; } public boolean isSignRequested() { return signRequested; } public void setSignRequested(boolean signRequested) { this.signRequested = signRequested; } } mule-2.0.1/modules/pgp/src/main/resources/0000755000175000017500000000000011351411133020254 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/resources/META-INF/0000755000175000017500000000000011351411134021415 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012210642451104024262 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/pgp/2.0/mule-pgp.xsd=META-INF/mule-pgp.xsd mule-2.0.1/modules/pgp/src/main/resources/META-INF/spring.handlers0000644000175000017500000000013610754375733024465 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/pgp/2.0=org.mule.module.pgp.config.PgpNamespaceHandler mule-2.0.1/modules/pgp/src/main/resources/META-INF/services/0000755000175000017500000000000011351411134023240 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351411134024027 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351411134024771 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351411134025550 5ustar charlescharlesmule-2.0.1/modules/pgp/src/main/resources/META-INF/services/org/mule/i18n/pgp-messages.properties0000644000175000017500000000043010621717250032265 0ustar charlescharles1=No public key known for User Id '{0}' 2=No signed message found 3=Invalid signature for message 4=Error verifying signature on Signed Message 5=No encryption strategy has been set. You need to set either the "strategyName" to lookup or a UMOEncryptionStrategy object "strategy" mule-2.0.1/modules/pgp/src/main/resources/META-INF/mule-pgp.xsd0000644000175000017500000000651210767500113023675 0ustar charlescharles A security manager for PGP related functionality. TODO TODO mule-2.0.1/modules/pgp/src/test/0000755000175000017500000000000011351411133016275 5ustar charlescharlesmule-2.0.1/modules/pgp/src/test/java/0000755000175000017500000000000011351411132017215 5ustar charlescharlesmule-2.0.1/modules/pgp/src/test/java/org/0000755000175000017500000000000011351411133020005 5ustar charlescharlesmule-2.0.1/modules/pgp/src/test/java/org/mule/0000755000175000017500000000000011351411133020747 5ustar charlescharlesmule-2.0.1/modules/pgp/src/test/java/org/mule/module/0000755000175000017500000000000011351411133022234 5ustar charlescharlesmule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/0000755000175000017500000000000011351411133023022 5ustar charlescharlesmule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/PgpNamespaceHandlerTestCase.java0000644000175000017500000000434510754375733031215 0ustar charlescharles/* * $Id: PgpNamespaceHandlerTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.api.EncryptionStrategy; import org.mule.api.security.SecurityManager; import org.mule.api.security.SecurityProvider; import org.mule.tck.FunctionalTestCase; public class PgpNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "pgp-namespace-config.xml"; } public void testPgpProvider() { knownProperties(getProvider("pgpSecurityProvider")); } public void testKeyBasedEncryptionStrategy() { knownProperties(getEncryptionStrategy("keyBasedEncryptionStrategy")); } protected SecurityProvider getProvider(String name) { SecurityManager securityManager = muleContext.getSecurityManager(); return securityManager.getProvider(name); } protected void knownProperties(SecurityProvider provider) { assertNotNull(provider); assertTrue(provider instanceof PGPSecurityProvider); PGPSecurityProvider pgpProvider = (PGPSecurityProvider) provider; assertNotNull(pgpProvider.getKeyManager()); assertTrue(pgpProvider.getKeyManager() instanceof PGPKeyRingImpl); } protected EncryptionStrategy getEncryptionStrategy(String name) { SecurityManager securityManager = muleContext.getSecurityManager(); return securityManager.getEncryptionStrategy(name); } protected void knownProperties(EncryptionStrategy encryptionStrategy) { assertNotNull(encryptionStrategy); assertTrue(encryptionStrategy instanceof KeyBasedEncryptionStrategy); KeyBasedEncryptionStrategy keyBased = (KeyBasedEncryptionStrategy) encryptionStrategy; assertNotNull(keyBased.getKeyManager()); assertTrue(keyBased.getKeyManager() instanceof PGPKeyRingImpl); } } mule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/PGPSecurityFilterTestCase.java0000644000175000017500000000535110754375733030676 0ustar charlescharles/* * $Id: PGPSecurityFilterTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.api.ExceptionPayload; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.util.FileUtils; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileReader; import java.net.URL; import java.util.HashMap; import java.util.Map; public class PGPSecurityFilterTestCase extends FunctionalTestCase { protected static final String TARGET = "/encrypted.txt"; protected static final String DIRECTORY = "output"; protected static final String MESSAGE_EXCEPTION = "No signed message found. Message payload is of type: String"; protected String getConfigResources() { return "test-pgp-encrypt-config.xml"; } public void testAuthenticationAuthorised() throws Exception { URL url = Thread.currentThread().getContextClassLoader().getResource("./encrypted-signed.asc"); int length = (int) FileUtils.newFile(url.getFile()).length(); byte[] msg = new byte[length]; FileInputStream in = new FileInputStream(url.getFile()); in.read(msg); in.close(); Map props = new HashMap(); props.put("TARGET_FILE", TARGET); MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm://echo", new String(msg), props); assertNull(reply.getExceptionPayload()); try { //check if file exists FileReader outputFile = new FileReader(DIRECTORY+TARGET); outputFile.close(); //delete file not to be confused with tests to be performed later File f = FileUtils.newFile(DIRECTORY+TARGET); f.delete(); } catch (FileNotFoundException fileNotFound) { fail("File not successfully created"); } } public void testAuthenticationNotAuthorised() throws Exception { MuleClient client = new MuleClient(); MuleMessage reply = client.send("vm://echo", "An unsigned message", null); assertNotNull(reply.getExceptionPayload()); ExceptionPayload excPayload = reply.getExceptionPayload(); assertEquals(MESSAGE_EXCEPTION, excPayload.getMessage()); } } mule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/FakeCredentialAccessor.java0000644000175000017500000000215510754375733030241 0ustar charlescharles/* * $Id: FakeCredentialAccessor.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.api.MuleEvent; import org.mule.api.security.CredentialsAccessor; public class FakeCredentialAccessor implements CredentialsAccessor { /* * (non-Javadoc) * * @see org.mule.api.security.CredentialsAccessor#getCredentials(org.mule.api.MuleEvent) */ public Object getCredentials(MuleEvent event) { return "Mule client "; } /* * (non-Javadoc) * * @see org.mule.api.security.CredentialsAccessor#setCredentials(org.mule.api.MuleEvent, * java.lang.Object) */ public void setCredentials(MuleEvent event, Object credentials) { // dummy } } mule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/GenerateTestMessage.java0000644000175000017500000002303010770356575027610 0ustar charlescharles/* * $Id: GenerateTestMessage.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import cryptix.message.EncryptedMessageBuilder; import cryptix.message.LiteralMessageBuilder; import cryptix.message.Message; import cryptix.message.MessageException; import cryptix.message.SignedMessageBuilder; import cryptix.openpgp.PGPArmouredMessage; import cryptix.pki.ExtendedKeyStore; import cryptix.pki.KeyBundle; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.Principal; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import java.util.Enumeration; import java.util.Iterator; public class GenerateTestMessage { private static ExtendedKeyStore clientPublicRing, clientPrivateRing; private static ExtendedKeyStore serverPrivateRing; private static KeyBundle serverPublicKey; private static KeyBundle clientPrivateKey; public static void readKeyrings() { clientPublicRing = readKeyRing("clientPublic.gpg"); clientPrivateRing = readKeyRing("clientPrivate.gpg"); serverPrivateRing = readKeyRing("serverPrivate.gpg"); } public static ExtendedKeyStore readKeyRing(String filename) { ExtendedKeyStore ring = null; try { FileInputStream in = new FileInputStream(filename); ring = (ExtendedKeyStore)ExtendedKeyStore.getInstance("OpenPGP/KeyRing"); ring.load(in, null); in.close(); } catch (IOException ioe) { System.err.println("IOException... You did remember to run the " + "GenerateAndWriteKey example first, right?"); ioe.printStackTrace(); System.exit(-1); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP KeyRing. " + "This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } catch (KeyStoreException kse) { System.err.println("Reading keyring failed."); kse.printStackTrace(); System.exit(-1); } catch (CertificateException ce) { System.err.println("Reading keyring failed."); ce.printStackTrace(); System.exit(-1); } return ring; } public static KeyBundle findKeyBundle(ExtendedKeyStore ring, String principal) throws Exception { for (Enumeration e = ring.aliases(); e.hasMoreElements();) { String aliasId = (String)e.nextElement(); KeyBundle bundle = ring.getKeyBundle(aliasId); if (bundle != null) { for (Iterator users = bundle.getPrincipals(); users.hasNext();) { Principal princ = (Principal)users.next(); System.out.println("aliasId:" + aliasId + ", user:" + princ.toString()); if (princ.toString().equals(principal)) { return bundle; } } } } throw new Exception("KeyBundle not found for " + principal); } public static void decodeKeyRings() throws Exception { serverPublicKey = findKeyBundle(clientPublicRing, "Mule server "); clientPrivateKey = findKeyBundle(clientPrivateRing, "Mule client "); System.out.println("Server private keyring:"); findKeyBundle(serverPrivateRing, "Mule server "); } public static void writeMsg() { Message msg = null; try { String data = "This is a test message.\n" + "This is another line.\n"; LiteralMessageBuilder lmb = LiteralMessageBuilder.getInstance("OpenPGP"); lmb.init(data); msg = lmb.build(); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP LiteralMessageBuilder." + " This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } catch (MessageException me) { System.err.println("Creating the literal message failed."); me.printStackTrace(); System.exit(-1); } // ********************************************************************** // Sign the message. // // Note that signing usually comes before encryption, such that // unauthorized parties cannot see who signed the message. // ********************************************************************** try { SignedMessageBuilder smb = SignedMessageBuilder.getInstance("OpenPGP"); // use the following line for compatibility with older PGP versions // SignedMessageBuilder smb = // SignedMessageBuilder.getInstance("OpenPGP/V3"); smb.init(msg); smb.addSigner(clientPrivateKey, "TestingPassphrase".toCharArray()); msg = smb.build(); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP SignedMessageBuilder. " + "This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } catch (UnrecoverableKeyException uke) { System.err.println("Incorrect passphrase."); uke.printStackTrace(); System.exit(-1); } catch (MessageException me) { System.err.println("Generating the message failed."); me.printStackTrace(); System.exit(-1); } // ********************************************************************** // Armour the message and write it to disk // ********************************************************************** try { PGPArmouredMessage armoured; armoured = new PGPArmouredMessage(msg); FileOutputStream out = new FileOutputStream("signed.asc"); out.write(armoured.getEncoded()); out.close(); } catch (MessageException me) { System.err.println("Writing the encrypted message failed."); me.printStackTrace(); System.exit(-1); } catch (IOException ioe) { System.err.println("Writing the encrypted message failed."); ioe.printStackTrace(); System.exit(-1); } // ********************************************************************** // Encrypt the message. // ********************************************************************** try { EncryptedMessageBuilder emb = EncryptedMessageBuilder.getInstance("OpenPGP"); emb.init(msg); emb.addRecipient(serverPublicKey); msg = emb.build(); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP " + "EncryptedMessageBuilder. " + "This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } catch (MessageException me) { System.err.println("Creating the encrypted message failed."); me.printStackTrace(); System.exit(-1); } // ********************************************************************** // Armour the message and write it to disk // ********************************************************************** try { PGPArmouredMessage armoured; armoured = new PGPArmouredMessage(msg); FileOutputStream out = new FileOutputStream("encrypted-signed.asc"); out.write(armoured.getEncoded()); out.close(); } catch (MessageException me) { System.err.println("Writing the encrypted message failed."); me.printStackTrace(); System.exit(-1); } catch (IOException ioe) { System.err.println("Writing the encrypted message failed."); ioe.printStackTrace(); System.exit(-1); } } public static void main(String[] args) throws Exception { java.security.Security.addProvider(new cryptix.jce.provider.CryptixCrypto()); java.security.Security.addProvider(new cryptix.openpgp.provider.CryptixOpenPGP()); readKeyrings(); decodeKeyRings(); writeMsg(); } } mule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/GenerateTestKeyrings.java0000644000175000017500000004447010754375733030031 0ustar charlescharles/* * $Id: GenerateTestKeyrings.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import java.io.FileOutputStream; import java.io.IOException; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.Principal; import java.security.PrivateKey; import java.security.PublicKey; import java.security.SecureRandom; import java.security.cert.Certificate; import java.security.cert.CertificateException; import cryptix.openpgp.PGPKeyBundle; import cryptix.pki.CertificateBuilder; import cryptix.pki.ExtendedKeyStore; import cryptix.pki.KeyBundleException; import cryptix.pki.KeyBundleFactory; import cryptix.pki.PrincipalBuilder; import cryptix.pki.PrincipalException; public class GenerateTestKeyrings { private static PGPKeyBundle serverPublicKey, serverPrivateKey; private static PGPKeyBundle clientPublicKey, clientPrivateKey; public static void generateServerKey() { SecureRandom sr = new SecureRandom(); try { KeyBundleFactory kbf = KeyBundleFactory.getInstance("OpenPGP"); serverPublicKey = (PGPKeyBundle)kbf.generateEmptyKeyBundle(); serverPrivateKey = (PGPKeyBundle)kbf.generateEmptyKeyBundle(); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP KeyBundleFactory. " + "This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } catch (KeyBundleException kbe) { System.err.println("Generating an empty KeyBundle failed."); kbe.printStackTrace(); System.exit(-1); } // ********************************************************************** // Now generate the signing key. // // We'll use a 1024 bit DSA key here. You can use other algorithms if // you want, by using for example: // kpg = KeyPairGenerator.getInstance("OpenPGP/Signing/RSA"); // kpg = KeyPairGenerator.getInstance("OpenPGP/Signing/ElGamal"); // // (Note that ElGamal signature were not supported yet at the time of // writing this example class.) // ********************************************************************** KeyPairGenerator kpg = null; try { kpg = KeyPairGenerator.getInstance("OpenPGP/Signing/RSA"); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP KeyPairGenerator. " + "This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } kpg.initialize(1024, sr); KeyPair kp = kpg.generateKeyPair(); PublicKey pubkey = kp.getPublic(); PrivateKey privkey = kp.getPrivate(); // ********************************************************************** // Now build the primary userid for this key. // ********************************************************************** Principal userid = null; try { PrincipalBuilder princbuilder = PrincipalBuilder.getInstance("OpenPGP/UserID"); userid = princbuilder.build("Mule server "); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP PrincipalBuilder. " + "This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } catch (PrincipalException pe) { System.err.println("Generating the user id failed."); pe.printStackTrace(); System.exit(-1); } // ********************************************************************** // We need to sign the generated user id with our key, which will // bring us a so called 'certificate'. // // This btw is a self-signed certificate, you can also have certificates // signed by other people. See the ReadAndSignKey example for that. // ********************************************************************** Certificate cert = null; try { CertificateBuilder certbuilder = CertificateBuilder.getInstance("OpenPGP/Self"); cert = certbuilder.build(pubkey, userid, privkey, sr); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP CertificateBuilder. " + "This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } catch (CertificateException ce) { System.err.println("Generating the self certification sig failed."); ce.printStackTrace(); System.exit(-1); } // ********************************************************************** // Building up the keybundle is easy now. We only need to add the // certificate, as this will automagically add the public key and the // user id to the keybundle. // ********************************************************************** try { serverPublicKey.addCertificate(cert); serverPrivateKey.addCertificate(cert); } catch (KeyBundleException kbe) { System.err.println("Adding the self certificate to the keybundle failed."); kbe.printStackTrace(); System.exit(-1); } // ********************************************************************** // Of course we still need to add the private key to the private // keybundle, while encrypting it with a passphrase. // ********************************************************************** try { serverPrivateKey.addPrivateKey(privkey, pubkey, "TestingPassphrase".toCharArray(), sr); } catch (KeyBundleException kbe) { System.err.println("Adding the private key to the keybundle failed."); kbe.printStackTrace(); System.exit(-1); } } public static void generateClientKey() { SecureRandom sr = new SecureRandom(); try { KeyBundleFactory kbf = KeyBundleFactory.getInstance("OpenPGP"); clientPublicKey = (PGPKeyBundle)kbf.generateEmptyKeyBundle(); clientPrivateKey = (PGPKeyBundle)kbf.generateEmptyKeyBundle(); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP KeyBundleFactory. " + "This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } catch (KeyBundleException kbe) { System.err.println("Generating an empty KeyBundle failed."); kbe.printStackTrace(); System.exit(-1); } // ********************************************************************** // Now generate the signing key. // // We'll use a 1024 bit DSA key here. You can use other algorithms if // you want, by using for example: // kpg = KeyPairGenerator.getInstance("OpenPGP/Signing/RSA"); // kpg = KeyPairGenerator.getInstance("OpenPGP/Signing/ElGamal"); // // (Note that ElGamal signature were not supported yet at the time of // writing this example class.) // ********************************************************************** KeyPairGenerator kpg = null; try { kpg = KeyPairGenerator.getInstance("OpenPGP/Signing/RSA"); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP KeyPairGenerator. " + "This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } kpg.initialize(1024, sr); KeyPair kp = kpg.generateKeyPair(); PublicKey pubkey = kp.getPublic(); PrivateKey privkey = kp.getPrivate(); // ********************************************************************** // Now build the primary userid for this key. // ********************************************************************** Principal userid = null; try { PrincipalBuilder princbuilder = PrincipalBuilder.getInstance("OpenPGP/UserID"); userid = princbuilder.build("Mule client "); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP PrincipalBuilder. " + "This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } catch (PrincipalException pe) { System.err.println("Generating the user id failed."); pe.printStackTrace(); System.exit(-1); } // ********************************************************************** // We need to sign the generated user id with our key, which will // bring us a so called 'certificate'. // // This btw is a self-signed certificate, you can also have certificates // signed by other people. See the ReadAndSignKey example for that. // ********************************************************************** Certificate cert = null; try { CertificateBuilder certbuilder = CertificateBuilder.getInstance("OpenPGP/Self"); cert = certbuilder.build(pubkey, userid, privkey, sr); } catch (NoSuchAlgorithmException nsae) { System.err.println("Cannot find the OpenPGP CertificateBuilder. " + "This usually means that the Cryptix OpenPGP provider is not " + "installed correctly."); nsae.printStackTrace(); System.exit(-1); } catch (CertificateException ce) { System.err.println("Generating the self certification sig failed."); ce.printStackTrace(); System.exit(-1); } // ********************************************************************** // Building up the keybundle is easy now. We only need to add the // certificate, as this will automagically add the public key and the // user id to the keybundle. // ********************************************************************** try { clientPublicKey.addCertificate(cert); clientPrivateKey.addCertificate(cert); } catch (KeyBundleException kbe) { System.err.println("Adding the self certificate to the keybundle failed."); kbe.printStackTrace(); System.exit(-1); } // ********************************************************************** // Of course we still need to add the private key to the private // keybundle, while encrypting it with a passphrase. // ********************************************************************** try { clientPrivateKey.addPrivateKey(privkey, pubkey, "TestingPassphrase".toCharArray(), sr); } catch (KeyBundleException kbe) { System.err.println("Adding the private key to the keybundle failed."); kbe.printStackTrace(); System.exit(-1); } } public static void writeKeyrings() { ExtendedKeyStore clientPubRing = null; ExtendedKeyStore clientPrivRing = null; ExtendedKeyStore serverPubRing = null; ExtendedKeyStore serverPrivRing = null; try { clientPubRing = (ExtendedKeyStore)ExtendedKeyStore.getInstance("OpenPGP/KeyRing"); clientPrivRing = (ExtendedKeyStore)ExtendedKeyStore.getInstance("OpenPGP/KeyRing"); serverPubRing = (ExtendedKeyStore)ExtendedKeyStore.getInstance("OpenPGP/KeyRing"); serverPrivRing = (ExtendedKeyStore)ExtendedKeyStore.getInstance("OpenPGP/KeyRing"); } catch (KeyStoreException kse) { System.err.println("KeyStoreException on creating a keyring. " + "This means that the KeyStore implementation could not be " + "found and that there is potentially a problem with the " + "provider"); kse.printStackTrace(); System.exit(-1); } // ********************************************************************** // Before using them, KeyStore objects have to be initialized. // Because we want to create empty keystores, we are going to // initialize them with null arguments. // Unfortunately we have to catch all sorts of exceptions that are // impossible to happen. // ********************************************************************** try { clientPubRing.load(null, null); clientPrivRing.load(null, null); serverPubRing.load(null, null); serverPrivRing.load(null, null); } catch (IOException ioe) { System.err.println("KeyStoreException on keyring init. " + "There should be no way for this exception to turn up."); ioe.printStackTrace(); System.exit(-1); } catch (NoSuchAlgorithmException nsae) { System.err.println("NoSuchAlgorithmException on keyring init. " + "There should be no way for this exception to turn up."); nsae.printStackTrace(); System.exit(-1); } catch (CertificateException ce) { System.err.println("CertificateException on keyring init. " + "There should be no way for this exception to turn up."); ce.printStackTrace(); System.exit(-1); } // ********************************************************************** // Filling up the keyrings is pretty easy now. Just add the right // keybundles to the rings. // ********************************************************************** try { clientPubRing.setKeyBundleEntry(clientPublicKey); clientPubRing.setKeyBundleEntry(serverPublicKey); clientPrivRing.setKeyBundleEntry(clientPrivateKey); serverPubRing.setKeyBundleEntry(clientPublicKey); serverPubRing.setKeyBundleEntry(serverPublicKey); serverPrivRing.setKeyBundleEntry(serverPrivateKey); } catch (KeyStoreException kse) { System.err.println("KeyStoreException on adding a key."); kse.printStackTrace(); System.exit(-1); } // ********************************************************************** // Now we're going to write the keyring files. // The second argument of the store method is a passphrase. Because // PGP keyrings are stored unencrypted, a 'null' value has to be // provided here. // ********************************************************************** FileOutputStream out; try { out = new FileOutputStream("clientPublic.gpg"); // pkr = public key // ring clientPubRing.store(out, null); out.close(); out = new FileOutputStream("clientPrivate.gpg"); // skr = secret // key ring clientPrivRing.store(out, null); out.close(); out = new FileOutputStream("serverPublic.gpg"); serverPubRing.store(out, null); out.close(); out = new FileOutputStream("serverPrivate.gpg"); serverPrivRing.store(out, null); out.close(); } catch (IOException ioe) { System.err.println("IOException on writing a keyring."); ioe.printStackTrace(); System.exit(-1); } catch (NoSuchAlgorithmException nsae) { System.err.println("NoSuchAlgorithmException on writing a keyring." + " Given that no encryption is used while writing the keystore, " + "this should not happen!"); nsae.printStackTrace(); System.exit(-1); } catch (CertificateException ce) { System.err.println("CertificateException on writing a keyring."); ce.printStackTrace(); System.exit(-1); } catch (KeyStoreException kse) { System.err.println("KeyStoreException on writing a keyring."); kse.printStackTrace(); System.exit(-1); } } public static void main(String[] args) { java.security.Security.addProvider(new cryptix.jce.provider.CryptixCrypto()); java.security.Security.addProvider(new cryptix.openpgp.provider.CryptixOpenPGP()); generateServerKey(); generateClientKey(); writeKeyrings(); } } mule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/EchoMsg.java0000644000175000017500000000150510754375733025240 0ustar charlescharles/* * $Id: EchoMsg.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; public class EchoMsg implements Callable { /* * (non-Javadoc) * * @see org.mule.api.lifecycle.Callable#onCall(org.mule.api.MuleEventContext) */ public Object onCall(MuleEventContext eventContext) throws Exception { return eventContext.getMessageAsString(null); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/KBEStrategyUsingEncryptionTransformerTestCase.javamule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/KBEStrategyUsingEncryptionTransformerTestCa0000644000175000017500000000456610767500113033523 0ustar charlescharles/* * $Id: KBEStrategyUsingEncryptionTransformerTestCase.java 11389 2008-03-17 14:29:31Z marie.rizzo $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import java.net.URL; import org.mule.DefaultMuleEvent; import org.mule.RequestContext; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transformer.encryption.EncryptionTransformer; import org.mule.transformer.simple.ByteArrayToObject; public class KBEStrategyUsingEncryptionTransformerTestCase extends AbstractMuleTestCase { private KeyBasedEncryptionStrategy kbStrategy; protected void doSetUp() throws Exception { PGPKeyRingImpl keyM = new PGPKeyRingImpl(); URL url; url = Thread.currentThread().getContextClassLoader().getResource("./serverPublic.gpg"); keyM.setPublicKeyRingFileName(url.getFile()); url = Thread.currentThread().getContextClassLoader().getResource("./serverPrivate.gpg"); keyM.setSecretKeyRingFileName(url.getFile()); keyM.setSecretAliasId("0x6168F39C"); keyM.setSecretPassphrase("TestingPassphrase"); keyM.initialise(); kbStrategy = new KeyBasedEncryptionStrategy(); kbStrategy.setKeyManager(keyM); kbStrategy.setCredentialsAccessor(new FakeCredentialAccessor()); kbStrategy.initialise(); } protected void doTearDown() throws Exception { kbStrategy = null; } public void testEncrypt() throws Exception { String msg = "Test Message"; DefaultMuleEvent event = (DefaultMuleEvent)getTestEvent(msg, getTestService("orange", Orange.class)); RequestContext.setEvent(event); EncryptionTransformer etrans = new EncryptionTransformer(); etrans.setStrategy(kbStrategy); Object result = etrans.doTransform(msg.getBytes(), "UTF-8"); assertNotNull(result); String encrypted = (String) new ByteArrayToObject().doTransform(result,"UTF-8"); assertTrue(encrypted.startsWith("-----BEGIN PGP MESSAGE-----")); } }mule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/KeyBasedEncryptionStrategyTestCase.java0000644000175000017500000000510410754375733032633 0ustar charlescharles/* * $Id: KeyBasedEncryptionStrategyTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.FileUtils; import java.io.FileInputStream; import java.net.URL; public class KeyBasedEncryptionStrategyTestCase extends AbstractMuleTestCase { private KeyBasedEncryptionStrategy kbStrategy; /* * (non-Javadoc) * * @see org.mule.tck.AbstractMuleTestCase#setUp() */ protected void doSetUp() throws Exception { PGPKeyRingImpl keyM = new PGPKeyRingImpl(); URL url; url = Thread.currentThread().getContextClassLoader().getResource("./serverPublic.gpg"); keyM.setPublicKeyRingFileName(url.getFile()); url = Thread.currentThread().getContextClassLoader().getResource("./serverPrivate.gpg"); keyM.setSecretKeyRingFileName(url.getFile()); keyM.setSecretAliasId("0x6168F39C"); keyM.setSecretPassphrase("TestingPassphrase"); keyM.initialise(); kbStrategy = new KeyBasedEncryptionStrategy(); kbStrategy.setKeyManager(keyM); kbStrategy.initialise(); } /* * (non-Javadoc) * * @see org.mule.tck.AbstractMuleTestCase#tearDown() */ protected void doTearDown() throws Exception { kbStrategy = null; } public void testDecrypt() throws Exception { URL url = Thread.currentThread().getContextClassLoader().getResource("./encrypted-signed.asc"); int length = (int) FileUtils.newFile(url.getFile()).length(); byte[] msg = new byte[length]; FileInputStream in = new FileInputStream(url.getFile()); in.read(msg); in.close(); String result = new String(kbStrategy.decrypt(msg, null)); System.out.println(result); assertNotNull(result); } public void testEncrypt() throws Exception { String msg = "Test Message"; PGPCryptInfo cryptInfo = new PGPCryptInfo(kbStrategy.getKeyManager().getKeyBundle( "Mule client "), true); String result = new String(kbStrategy.encrypt(msg.getBytes(), cryptInfo)); System.out.println(result); assertNotNull(result); } } mule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/PGPSecurityProviderTestCase.java0000644000175000017500000000462410754375733031245 0ustar charlescharles/* * $Id: PGPSecurityProviderTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.api.security.Authentication; import org.mule.tck.AbstractMuleTestCase; import java.io.FileInputStream; import java.net.URL; import cryptix.message.Message; import cryptix.message.MessageFactory; public class PGPSecurityProviderTestCase extends AbstractMuleTestCase { private PGPSecurityProvider securityProvider; private Message message; protected void doSetUp() throws Exception { PGPKeyRingImpl keyM = new PGPKeyRingImpl(); URL url; url = Thread.currentThread().getContextClassLoader().getResource("./serverPublic.gpg"); keyM.setPublicKeyRingFileName(url.getFile()); url = Thread.currentThread().getContextClassLoader().getResource("./serverPrivate.gpg"); keyM.setSecretKeyRingFileName(url.getFile()); keyM.setSecretAliasId("0x6168F39C"); keyM.setSecretPassphrase("TestingPassphrase"); keyM.initialise(); securityProvider = new PGPSecurityProvider(); securityProvider.setKeyManager(keyM); securityProvider.initialise(); MessageFactory mf = MessageFactory.getInstance("OpenPGP"); url = Thread.currentThread().getContextClassLoader().getResource("./signed.asc"); FileInputStream in = new FileInputStream(url.getFile()); message = (Message)mf.generateMessages(in).iterator().next(); } /* * (non-Javadoc) * * @see org.mule.tck.AbstractMuleTestCase#tearDown() */ protected void doTearDown() throws Exception { securityProvider = null; message = null; } public void testAuthenticate() { try { Authentication auth = new PGPAuthentication("Mule client ", message); auth = securityProvider.authenticate(auth); assertTrue(auth.isAuthenticated()); } catch (Exception e) { e.printStackTrace(); assertTrue(false); } } } mule-2.0.1/modules/pgp/src/test/java/org/mule/module/pgp/PGPKeyRingTestCase.java0000644000175000017500000000346210754375733027272 0ustar charlescharles/* * $Id: PGPKeyRingTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.pgp; import org.mule.tck.AbstractMuleTestCase; import java.net.URL; import cryptix.pki.KeyBundle; public class PGPKeyRingTestCase extends AbstractMuleTestCase { private PGPKeyRing keyManager; /* * (non-Javadoc) * * @see org.mule.tck.AbstractMuleTestCase#setUp() */ protected void doSetUp() throws Exception { PGPKeyRingImpl keyM = new PGPKeyRingImpl(); URL url; url = Thread.currentThread().getContextClassLoader().getResource("./serverPublic.gpg"); keyM.setPublicKeyRingFileName(url.getFile()); url = Thread.currentThread().getContextClassLoader().getResource("./serverPrivate.gpg"); keyM.setSecretKeyRingFileName(url.getFile()); keyM.setSecretAliasId("0x6168F39C"); keyM.setSecretPassphrase("TestingPassphrase"); keyM.initialise(); keyManager = keyM; } /* * (non-Javadoc) * * @see org.mule.tck.AbstractMuleTestCase#tearDown() */ protected void doTearDown() throws Exception { keyManager = null; } public void testClientKey() { KeyBundle clientKey = keyManager.getKeyBundle("Mule client "); assertNotNull(clientKey); } public void testServerKey() { KeyBundle serverKey = keyManager.getSecretKeyBundle(); assertNotNull(serverKey); } } mule-2.0.1/modules/pgp/src/test/resources/0000755000175000017500000000000011351411133020307 5ustar charlescharlesmule-2.0.1/modules/pgp/src/test/resources/log4j.properties0000644000175000017500000000050210547540350023453 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/modules/pgp/src/test/resources/test-pgp-encrypt-config.xml0000644000175000017500000000534110754375733025551 0ustar charlescharles mule-2.0.1/modules/pgp/src/test/resources/encrypted-signed.asc0000644000175000017500000000116610227236400024252 0ustar charlescharles-----BEGIN PGP MESSAGE----- Version: Cryptix OpenPGP 0.20050405 hIsDVrQxLmFo85wBA/j4xDDcPGvtSfwspkOQOf3YgPJ6sJ+x1n3Gv9jcTeuuGSRl J3i0iWqDkm1RVOzQldMJsymgGciho5xk/DPgT8q+chevTWZpLH9lx1INb++EDWaO 3M96bpo5xgue6v4ayisJ6ho17Gs1Pb4ERm5Iw74QOTy3+/y/yyGlx6NHfhucpO+q t2S/zTpcaLMHYz6vdKGMFdVFdsV7qXp8CS4egbdfQ3Vu+KSIKlj5QxDbnXbIkSyJ RBqbnJDhCtErk924SH3N6XxJarteNjZqpDegGglKd/rcMdGATASLYQy72AiKBYIc eeP9pL7eDBNamcyzzxCEi3h7HxiU/mm62gBUm4EIBnrOxsl4Yi5unD+sdsttCbhb YwY25Z1fEo/E7bg/AvAovH3dLlLteJHRYhwGg2jjLbI93EuNWg1nRyl7LYH79tOx WQxN8q9ayGlwWOShZFnR+dPE7GWsYcF0z5wHEPBoZXQzS9++APbC67xtTZwXVA== =qWta -----END PGP MESSAGE----- mule-2.0.1/modules/pgp/src/test/resources/clientPublic.gpg0000644000175000017500000000130210227236400023422 0ustar charlescharlesBV,R 1Z* bT#4\a+мP}SsbDT!EgtnLHkDk1"w#DUUq!lK? 6-v+9Vji.9|_ܟ9agG}P!"Mule client BV,   |ٟPwx'&>trzƩRWm~=`~+9gbl*1DŽ|@}oMV-8\g ,Dm74[8S :I)N}v'<^:w$`Y[uBV+= w@w,DS7 4r7^n!5)|#~ZU8*F!u4LT+ Sv Y[;'xQlA0 ?t#>{el`"Mule server BV+   V1.ahIzjq\Oծ@ җ)쀴`z rK] V4 gn4 *^aqJ]t )='pĒWh^AQZʉY(3D2TBYȸ!mule-2.0.1/modules/pgp/src/test/resources/serverPublic.gpg0000644000175000017500000000130210227236400023452 0ustar charlescharlesBV,R 1Z* bT#4\a+мP}SsbDT!EgtnLHkDk1"w#DUUq!lK? 6-v+9Vji.9|_ܟ9agG}P!"Mule client BV,   |ٟPwx'&>trzƩRWm~=`~+9gbl*1DŽ|@}oMV-8\g ,Dm74[8S :I)N}v'<^:w$`Y[uBV+= w@w,DS7 4r7^n!5)|#~ZU8*F!u4LT+ Sv Y[;'xQlA0 ?t#>{el`"Mule server BV+   V1.ahIzjq\Oծ@ җ)쀴`z rK] V4 gn4 *^aqJ]t )='pĒWh^AQZʉY(3D2TBYȸ!mule-2.0.1/modules/pgp/src/test/resources/pgp-namespace-config.xml0000644000175000017500000000266110754375733025046 0ustar charlescharles mule-2.0.1/modules/pgp/src/test/resources/clientPrivate.gpg0000644000175000017500000000130110227236400023615 0ustar charlescharlesBV,R 1Z* bT#4\a+мP}SsbDT!EgtnLHkDk1"w#DUUq!lK? 6-v+9Vji.9|_ܟ9agG}P!T1tpj{tYxR\l6܈%r i0>1Ml BULyBEx͈onG.Y#iyZGVVP"Mule client BV,   |ٟPwx'&>trzƩRWm~=`~+9gbl*1DŽ|@}oMV-8\g ,Dm74[8S :I)N}v'<^:w$`Y[umule-2.0.1/modules/pgp/src/test/resources/serverPrivate.gpg0000644000175000017500000000130110227236400023645 0ustar charlescharlesBV+= w@w,DS7 4r7^n!5)|#~ZU8*F!u4LT+ Sv Y[;'xQlA0 ?t#>{el`2)=_8~f P"3 T|F(JZ9[FIk3zQgJ_Fe1&f&䞮QpV"̢@׳9#J=;!JEon3{'VT(:Nô"Mule server BV+   V1.ahIzjq\Oծ@ җ)쀴`z rK] V4 gn4 *^aqJ]t )='pĒWh^AQZʉY(3D2TBYȸ!mule-2.0.1/modules/pgp/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000043310767624265025207 0ustar charlescharles# # Test cases listed in this file are not run. # # these fail unless a security patch is applied to JAVA_HOME/lib org.mule.module.pgp.KeyBasedEncryptionStrategyTestCase org.mule.module.pgp.PGPSecurityFilterTestCase org.mule.module.pgp.KBEStrategyUsingEncryptionTransformerTestCase mule-2.0.1/modules/pgp/src/test/resources/securityContext.xml0000644000175000017500000000120010754375733024263 0ustar charlescharles mule-2.0.1/modules/pgp/src/test/resources/signed.asc0000644000175000017500000000065210227236400022256 0ustar charlescharles-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This is a test message. This is another line. -----BEGIN PGP SIGNATURE----- Version: Cryptix OpenPGP 0.20050405 iJwEAQECAAYFAkJX5WAACgkQfNmfUHeIePhktgQApk7rPw4VMUzNUU/GGDi6LRwo KAKQE5ttTkTswtepOhhBFcMzoGXZN5hs/muoB6ATBJq1c1UqEaePcfPCEcLQzAoP ZqbVIjIEPJT839Ykb15yPEzBu0j/NnJEeR+QR8BuW1n2HljNpLgEP+ieNWC3RNzN m1W838VXoARXtq0kh2w= =kfPL -----END PGP SIGNATURE----- mule-2.0.1/modules/pgp/pom.xml0000644000175000017500000000762611006063605016063 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-pgp PGP Security A Mule implementation of PGP security using cryptix libraries. org.mule.modules mule-module-spring-config ${version} provided org.mule.tests mule-tests-functional ${version} test cryptix-jce cryptix-jce-api 20050328 cryptix-jce cryptix-jce-provider 20050328 cryptix-openpgp cryptix-message-api 20050405 cryptix-openpgp cryptix-openpgp-provider 20050405 cryptix-openpgp cryptix-pki-api 20050405 org.mule.transports mule-transport-file ${version} org.mule.modules mule-module-client ${version} org.mule.modules mule-module-spring-extras ${version} org.mule.transports mule-transport-vm ${version} test org.mule.transports mule-transport-tcp ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.module.pgp.* mule-2.0.1/modules/management/0000755000175000017500000000000011351411162016057 5ustar charlescharlesmule-2.0.1/modules/management/src/0000755000175000017500000000000011351411157016652 5ustar charlescharlesmule-2.0.1/modules/management/src/main/0000755000175000017500000000000011351411160017570 5ustar charlescharlesmule-2.0.1/modules/management/src/main/java/0000755000175000017500000000000011351411157020517 5ustar charlescharlesmule-2.0.1/modules/management/src/main/java/org/0000755000175000017500000000000011351411157021306 5ustar charlescharlesmule-2.0.1/modules/management/src/main/java/org/mule/0000755000175000017500000000000011351411157022250 5ustar charlescharlesmule-2.0.1/modules/management/src/main/java/org/mule/module/0000755000175000017500000000000011351411157023535 5ustar charlescharlesmule-2.0.1/modules/management/src/main/java/org/mule/module/management/0000755000175000017500000000000011351411160025643 5ustar charlescharlesmule-2.0.1/modules/management/src/main/java/org/mule/module/management/package.html0000644000175000017500000000014310764100742030132 0ustar charlescharles Mule system management extensions such as Jmx support. mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/0000755000175000017500000000000011351411160026725 5ustar charlescharlesmule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/package.html0000644000175000017500000000021110764100742031210 0ustar charlescharles Mule Jmx Management beans for mule components, the model and the Mule server. mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/ConnectorService.java0000644000175000017500000000350010774254333033060 0ustar charlescharles/* * $Id: ConnectorService.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.MuleException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transport.Connector; import org.mule.util.ObjectNameHelper; import java.beans.ExceptionListener; public class ConnectorService implements ConnectorServiceMBean { private final Connector connector; private final String name; public ConnectorService(final Connector connector) { this.connector = connector; name = ObjectNameHelper.getConnectorName(connector); } public boolean isStarted() { return connector.isStarted(); } public boolean isDisposed() { return connector.isDisposed(); } public boolean isDisposing() { return connector.isDisposing(); } public String getName() { return name; } public String getProtocol() { return connector.getProtocol(); } public ExceptionListener getExceptionListener() { return connector.getExceptionListener(); } public void startConnector() throws MuleException { connector.start(); } public void stopConnector() throws MuleException { connector.stop(); } public void dispose() { connector.dispose(); } public void initialise() throws InitialisationException { connector.initialise(); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/MuleConfigurationService.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/MuleConfigurationServic0000644000175000017500000000517610766637211033507 0ustar charlescharles/* * $Id: MuleConfigurationService.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.config.MuleConfiguration; /** * MuleConfigurationService exposes the MuleConfiguration settings as * a management service * * TODO MULE-3110 I'm not sure this is relevant anymore since the MuleConfiguration should * be immutable after startup. */ public class MuleConfigurationService implements MuleConfigurationServiceMBean { private MuleConfiguration muleConfiguration; public MuleConfigurationService(MuleConfiguration muleConfiguration) { this.muleConfiguration = muleConfiguration; } public boolean isSynchronous() { return muleConfiguration.isDefaultSynchronousEndpoints(); } // public void setSynchronous(boolean synchronous) // { // muleConfiguration.setDefaultSynchronousEndpoints(synchronous); // } public int getSynchronousEventTimeout() { return muleConfiguration.getDefaultSynchronousEventTimeout(); } // public void setSynchronousEventTimeout(int synchronousEventTimeout) // { // muleConfiguration.setDefaultSynchronousEventTimeout(synchronousEventTimeout); // } public boolean isRemoteSync() { return muleConfiguration.isDefaultRemoteSync(); } // public void setRemoteSync(boolean remoteSync) // { // muleConfiguration.setDefaultRemoteSync(remoteSync); // } public String getWorkingDirectory() { return muleConfiguration.getWorkingDirectory(); } // public void setWorkingDirectory(String workingDirectory) // { // muleConfiguration.setWorkingDirectory(workingDirectory); // } public int getTransactionTimeout() { return muleConfiguration.getDefaultTransactionTimeout(); } // public void setTransactionTimeout(int transactionTimeout) // { // muleConfiguration.setDefaultTransactionTimeout(transactionTimeout); // } public boolean isClientMode() { return muleConfiguration.isClientMode(); } public String getEncoding() { return muleConfiguration.getDefaultEncoding(); } // public void setEncoding(String encoding) // { // muleConfiguration.setDefaultEncoding(encoding); // } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/ModelServiceMBean.java0000644000175000017500000000224210764100742033064 0ustar charlescharles/* * $Id: ModelServiceMBean.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.MuleException; /** * ModelServiceMBean JMX Service interface for the Model. */ public interface ModelServiceMBean { void start() throws MuleException; void stop() throws MuleException; // boolean isComponentRegistered(String name); // // UMODescriptor getComponentDescriptor(String name); // // void startComponent(String name) throws MuleException; // // void stopComponent(String name) throws MuleException; // // void pauseComponent(String name) throws MuleException; // // void resumeComponent(String name) throws MuleException; // // void unregisterComponent(String name) throws MuleException; String getName(); String getType(); } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/RouterStatsMBean.java0000644000175000017500000000131210764100742032777 0ustar charlescharles/* * $Id: RouterStatsMBean.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import java.util.Map; /** * RouterStatsMBean TODO */ public interface RouterStatsMBean { long getCaughtMessages(); long getNotRouted(); long getTotalReceived(); long getTotalRouted(); Map getRouted(); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/EndpointServiceMBean.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/EndpointServiceMBean.ja0000644000175000017500000000163110764100742033256 0ustar charlescharles/* * $Id: EndpointServiceMBean.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; /** * The EndpointServiceMBean allows you to check the confiugration of an endpoint and * conect/disconnect endpoints manually. */ public interface EndpointServiceMBean { String getAddress(); String getName(); boolean isConnected(); void connect() throws Exception; void disconnect() throws Exception; boolean isInbound(); boolean isOutbound(); boolean isSynchronous(); String getComponentName(); } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/RouterStats.java0000644000175000017500000000342410764100742032102 0ustar charlescharles/* * $Id: RouterStats.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.management.stats.RouterStatistics; import java.util.Map; /** * RouterStats TODO */ public class RouterStats implements RouterStatsMBean { private RouterStatistics statistics; public RouterStats(RouterStatistics statistics) { this.statistics = statistics; } /* * (non-Javadoc) * * @see org.mule.management.mbeans.RouterStatsMBean#getCaughtMessages() */ public long getCaughtMessages() { return statistics.getCaughtMessages(); } /* * (non-Javadoc) * * @see org.mule.management.mbeans.RouterStatsMBean#getNotRouted() */ public long getNotRouted() { return statistics.getNotRouted(); } /* * (non-Javadoc) * * @see org.mule.management.mbeans.RouterStatsMBean#getTotalReceived() */ public long getTotalReceived() { return statistics.getTotalReceived(); } /* * (non-Javadoc) * * @see org.mule.management.mbeans.RouterStatsMBean#getTotalRouted() */ public long getTotalRouted() { return statistics.getTotalRouted(); } /* * (non-Javadoc) * * @see org.mule.management.mbeans.RouterStatsMBean#getRouted() */ public Map getRouted() { return statistics.getRouted(); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/MuleConfigurationServiceMBean.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/MuleConfigurationServic0000644000175000017500000000254510766637211033504 0ustar charlescharles/* * $Id: MuleConfigurationServiceMBean.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; /** * MuleConfigurationServiceMBean is a JMx service interface for the * Mule server configuration. * * TODO MULE-3110 I'm not sure this is relevant anymore since the MuleConfiguration should * be immutable after startup. */ public interface MuleConfigurationServiceMBean { public boolean isSynchronous(); //public void setSynchronous(boolean synchronous); public int getSynchronousEventTimeout(); //public void setSynchronousEventTimeout(int synchronousEventTimeout); public boolean isRemoteSync(); //public void setRemoteSync(boolean remoteSync); public String getWorkingDirectory(); //public void setWorkingDirectory(String workingDirectory); public int getTransactionTimeout(); //public void setTransactionTimeout(int transactionTimeout); public String getEncoding(); //public void setEncoding(String encoding); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/ServiceServiceMBean.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/ServiceServiceMBean.jav0000644000175000017500000000444210764100742033267 0ustar charlescharles/* * $Id: ServiceServiceMBean.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.MuleException; import org.mule.api.lifecycle.Startable; import org.mule.api.lifecycle.Stoppable; import javax.management.ObjectName; /** * ServiceServiceMBean defines the management interface for a mule * managed service. */ public interface ServiceServiceMBean extends Stoppable, Startable, ServiceStatsMBean { /** * The statistics for this service * * @return statistics for this service * @see ServiceStats */ ObjectName getStatistics(); /** * The name of this service * * @return The name of this service */ String getName(); /** * The number of queued events for this service * * @return The number of queued events for this service */ int getQueueSize(); /** * Pauses event processing for theComponent. Unlike stop(), a paused service * will still consume messages from the underlying transport, but those messages * will be queued until the service is resumed. In order to persist these * queued messages you can set the 'recoverableMode' property on the * Muleconfiguration to true. this causes all internal queues to store their * state. * * @throws MuleException if the service failed to pause. * @see org.mule.config.MuleConfiguration */ void pause() throws MuleException; /** * Resumes the Service that has been paused. If the service is not paused * nothing is executed. * * @throws MuleException if the service failed to resume */ void resume() throws MuleException; boolean isPaused(); boolean isStopped(); void dispose() throws MuleException; /** * Causes the service to stop without processing its event queue first */ void forceStop() throws MuleException; boolean isStopping(); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/MBeanServerFactory.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/MBeanServerFactory.java0000644000175000017500000000176710764100742033314 0ustar charlescharles/* * $Id: MBeanServerFactory.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import java.util.List; import javax.management.MBeanServer; public class MBeanServerFactory { public static MBeanServer getOrCreateMBeanServer() { MBeanServer server; List servers = javax.management.MBeanServerFactory.findMBeanServer(null); if (servers != null && servers.size() > 0) { server = (MBeanServer) servers.get(0); } else { server = javax.management.MBeanServerFactory.createMBeanServer(); } return server; } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/EndpointService.java0000644000175000017500000000701710765313375032717 0ustar charlescharles/* * $Id: EndpointService.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageReceiver; import org.mule.config.i18n.CoreMessages; import org.mule.util.ObjectNameHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * The EndpointServiceMBean allows you to check the confiugration of an endpoint and * conect/disconnect endpoints manually. */ public class EndpointService implements EndpointServiceMBean { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); private ImmutableEndpoint endpoint; private MessageReceiver receiver; private String name; private String componentName; public EndpointService(ImmutableEndpoint endpoint) { this.endpoint = endpoint; init(); } public EndpointService(MessageReceiver receiver) { if (receiver == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("Receiver").getMessage()); } this.endpoint = receiver.getEndpoint(); this.receiver = receiver; this.componentName = receiver.getService().getName(); init(); } private void init() { if (endpoint == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("Endpoint").getMessage()); } if (receiver == null && endpoint instanceof InboundEndpoint) { throw new IllegalArgumentException( "Recevier is null for Endpoint MBean but the endpoint itself is a receiving endpoint"); } name = ObjectNameHelper.getEndpointName(endpoint.getEndpointURI()); } public String getAddress() { return endpoint.getEndpointURI().getAddress(); } public String getName() { return name; } public boolean isConnected() { return receiver == null || receiver.isConnected(); } public void connect() throws Exception { if (receiver != null && !receiver.isConnected()) { receiver.connect(); } else if (logger.isDebugEnabled()) { logger.debug("Endpoint is already connected"); } } public void disconnect() throws Exception { if (receiver != null && receiver.isConnected()) { receiver.disconnect(); } else if (logger.isDebugEnabled()) { logger.debug("Endpoint is already disconnected"); } } public boolean isInbound() { return endpoint instanceof InboundEndpoint; } public boolean isOutbound() { return endpoint instanceof OutboundEndpoint; } public boolean isSynchronous() { return endpoint.isSynchronous(); } public String getComponentName() { return componentName; } public void setComponentName(String componentName) { this.componentName = componentName; } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/ServiceStatsMBean.java0000644000175000017500000000216610764100742033127 0ustar charlescharles/* * $Id: ServiceStatsMBean.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; /** * ServiceStatsMBean TODO */ public interface ServiceStatsMBean { void clearStatistics(); long getAverageExecutionTime(); long getAverageQueueSize(); long getMaxQueueSize(); long getMaxExecutionTime(); long getFatalErrors(); long getMinExecutionTime(); long getTotalExecutionTime(); long getQueuedEvents(); long getAsyncEventsReceived(); long getSyncEventsReceived(); long getReplyToEventsSent(); long getSyncEventsSent(); long getAsyncEventsSent(); long getTotalEventsSent(); long getTotalEventsReceived(); long getExecutedEvents(); long getExecutionErrors(); } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/StatisticsServiceMBean.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/StatisticsServiceMBean.0000644000175000017500000000144310764100742033316 0ustar charlescharles/* * $Id: StatisticsServiceMBean.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.management.stats.Statistics; /** * StatisticsServiceMBean is a JMX interfaces for querying Mule event * processing statistics. */ public interface StatisticsServiceMBean extends Statistics { String printCSVSummary (); String printHtmlSummary (); String printXmlSummary (); } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/ConnectorServiceMBean.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/ConnectorServiceMBean.j0000644000175000017500000000167510764100742033277 0ustar charlescharles/* * $Id: ConnectorServiceMBean.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.MuleException; import org.mule.api.lifecycle.Initialisable; import java.beans.ExceptionListener; public interface ConnectorServiceMBean extends Initialisable { boolean isStarted(); boolean isDisposed(); boolean isDisposing(); String getName(); String getProtocol(); ExceptionListener getExceptionListener(); void startConnector() throws MuleException; void stopConnector() throws MuleException; void dispose(); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/RegistryServiceMBean.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/RegistryServiceMBean.ja0000644000175000017500000000140710764100742033307 0ustar charlescharles/* * $Id: RegistryServiceMBean.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.MuleException; /** * RegistryServiceMBean JMX Service interface for the Registry */ public interface RegistryServiceMBean { void start() throws MuleException; void stop() throws MuleException; //String getPersistenceMode(); String getName(); } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/YourKitProfilerServiceMBean.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/YourKitProfilerServiceM0000644000175000017500000002646410764100742033443 0ustar charlescharles/* * $Id: YourKitProfilerServiceMBean.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import com.yourkit.api.ProfilingModes; public interface YourKitProfilerServiceMBean { public static final long ALLOCATION_RECORDING_ALL = ProfilingModes.ALLOCATION_RECORDING_ALL; public static final long ALLOCATION_RECORDING_ADAPTIVE = ProfilingModes.ALLOCATION_RECORDING_ADAPTIVE; public static final long CPU_SAMPLING = ProfilingModes.CPU_SAMPLING; public static final long CPU_TRACING = ProfilingModes.CPU_TRACING; public static final long MONITOR_PROFILING = ProfilingModes.MONITOR_PROFILING; public static final long CPU_J2EE = ProfilingModes.CPU_J2EE; public static final long SNAPSHOT_WITHOUT_HEAP = ProfilingModes.SNAPSHOT_WITHOUT_HEAP; public static final long SNAPSHOT_WITH_HEAP = ProfilingModes.SNAPSHOT_WITH_HEAP; public static final long SNAPSHOT_HPROF = ProfilingModes.SNAPSHOT_HPROF; /** * this mark is added to getStatus to indicate that captureEverySec was stated */ public static final long SNAPSHOT_CAPTURING = 256; /** * @return name of host where controlled profiled application is running. The method never returns null. */ public String getHost(); /** * @return port profiler agent listens on. */ public int getPort(); /** * This method is just a convenient replacement of captureSnapshot(YourKitProfilerServiceMBean.SNAPSHOT_WITH_HEAP) * * @return absolute path to the captured snapshot. */ public String captureMemorySnapshot() throws Exception; /** * Captures snapshot: write profiling information to file. *

    * If some profiling is being performed (e.g. started with {@link #startCPUProfiling(long, String)}, {@link #startMonitorProfiling()} * or {@link #startAllocationRecording(long)}, or remotely), it won't stop after the capture. To stop it, explicitly call * {@link #stopCPUProfiling()}, {@link #stopMonitorProfiling()} or {@link #stopAllocationRecording()}. * * @param snapshotFlags defines how much information should be stored: *

      *
    • YourKitProfilerServiceMBean.SNAPSHOT_WITHOUT_HEAP - capture snapshot with all the recorded information * (CPU profiling, monitors, telemetry), but without the heap dump. *
    • YourKitProfilerServiceMBean.SNAPSHOT_WITH_HEAP - capture snapshot with all the recorded information * (CPU profiling, monitors, telemetry, allocations), as well as with the heap dump. *
    • YourKitProfilerServiceMBean.SNAPSHOT_HPROF - capture snapshot in HPROF format * (it will including the heap dump only). *
    * @return absolute path to the captured snapshot. * @throws Exception if capture failed. The possible reasons are: *
      *
    • there's no Java application with properly configured profiler agent listening on port at host *
    • profiled application has terminated *
    • agent cannot capture snapshot for some reason *
    */ public String captureSnapshot(long snapshotFlags) throws Exception; /** * Advance current object generation number. * Since that moment, all newly created objects will belong to the new generation. * Note that generations are also automatically advanced on capturing snapshots. * Generations are only available if the profiled application runs on Java 5 or newer. * * @param description optional description associated with the generation */ public void advanceGeneration(String description); /** * Start object allocation recording. * * @param mode YourKitProfilerServiceMBean.ALLOCATION_RECORDING_ALL or YourKitProfilerServiceMBean.ALLOCATION_RECORDING_ADAPTIVE * @throws Exception if capture failed. The possible reasons are: *
      *
    • there's no Java application with properly configured profiler agent listening on port at host *
    • profiled application has terminated *
    • agent cannot capture snapshot for some reason *
    * @see #captureMemorySnapshot() * @see #stopCPUProfiling() */ public void startAllocationRecording(long mode) throws Exception; /** * @throws Exception if capture failed. The possible reasons are: *
      *
    • there's no Java application with properly configured profiler agent listening on port at host *
    • profiled application has terminated *
    • agent cannot capture snapshot for some reason *
    */ public void stopAllocationRecording() throws Exception; /** * Start CPU profiling. * * @param mode YourKitProfilerServiceMBean.CPU_SAMPLING or YourKitProfilerServiceMBean.CPU_TRACING or * YourKitProfilerServiceMBean.CPU_SAMPLING | YourKitProfilerServiceMBean.CPU_J2EE * or YourKitProfilerServiceMBean.CPU_TRACING | YourKitProfilerServiceMBean.CPU_J2EE * @param filters string containing '\n'-separated list of classes whose methods should not be profiled. * Wildcards are accepted ('*'). More methods are profiled, bigger the overhead. The filters are used with * YourKitProfilerServiceMBean.CPU_TRACING only; with YourKitProfilerServiceMBean.CPU_SAMPLING the value is ignored. * If null or empty string passed, all methods will be profiled (not recommended due to high overhead). * For example, you can pass DEFAULT_FILTERS. * @throws Exception if capture failed. The possible reasons are: *
      *
    • there's no Java application with properly configured profiler agent listening on port at host *
    • specified profiling mode is not supported by the JVM of the profiled application, e.g. tracing is * supported with Java 5 and newer and thus is not available with Java 1.4. *
    • profiled application has terminated *
    • agent cannot capture snapshot for some reason *
    * @see #captureSnapshot(long) * @see #stopCPUProfiling() */ public void startCPUProfiling(long mode, String filters) throws Exception; /** * Stop CPU profiling. * * @throws Exception if capture failed. The possible reasons are: *
      *
    • there's no Java application with properly configured profiler agent listening on port at host *
    • profiled application has terminated *
    • agent cannot capture snapshot for some reason *
    * @see #captureSnapshot(long) * @see #startCPUProfiling(long , String) */ public void stopCPUProfiling() throws Exception; /** * Force GC * * @return Message contains size of objects in heap before GC, bytes and size of objects in heap after GC, bytes * @throws Exception */ public String forceGC() throws Exception; /** * Start monitor profiling (requires that the profiled application runs on Java 5 or newer) * * @throws Exception if capture failed. The possible reasons are: *
      *
    • there's no Java application with properly configured profiler agent listening on port at host *
    • specified profiling mode is not supported by the JVM of the profiled application, e.g. tracing is * supported with Java 5 and newer and thus is not available with Java 1.4. *
    • CPU profiling has already been started *
    • profiled application has terminated *
    • agent cannot capture snapshot for some reason *
    * @see #stopMonitorProfiling() * @see #captureSnapshot(long) */ public void startMonitorProfiling() throws Exception; /** * Stop monitor profiling (requires that the profiled application runs on Java 5 or newer) * * @throws Exception if capture failed. The possible reasons are: *
      *
    • there's no Java application with properly configured profiler agent listening on port at host *
    • profiled application has terminated *
    • agent cannot capture snapshot for some reason *
    * @see #startMonitorProfiling() * @see #captureSnapshot(long) */ public void stopMonitorProfiling() throws Exception; /** * Starts new daemon thread which calls {@link #captureMemorySnapshot()} every N seconds. * * @param seconds delay between calls * @see #captureMemorySnapshot() */ public void startCapturingMemSnapshot(final int seconds); /** * Stops daemon thread started by {@link #startCapturingMemSnapshot(int)} * * @see # startCapturingMemSnapshot (int) */ public void stopCapturingMemSnapshot(); /** * Get current profiling status. The following code snippet demonstrates how to use this method: *
         * long status = controller.getStatus();
         * 

    * if ((status & YourKitProfilerServiceMBean.ALLOCATION_RECORDING_ADAPTIVE) != 0) { * System.out.println("Allocation recording is on (adaptive)"); * } * else if ((status & YourKitProfilerServiceMBean.ALLOCATION_RECORDING_ALL) != 0) { * System.out.println("Allocation recording is on (all objects)"); * } * else { * System.out.println("Allocation recording is off"); * } *

    * if ((status & YourKitProfilerServiceMBean.CPU_TRACING) != 0) { * System.out.println("CPU profiling is on (tracing)"); * } * else if ((status & YourKitProfilerServiceMBean.CPU_SAMPLING) != 0) { * System.out.println("CPU profiling is on (sampling)"); * } * else { * System.out.println("CPU profiling is off"); * } *

    * if ((status & YourKitProfilerServiceMBean.MONITOR_PROFILING) != 0) { * System.out.println("Monitor profiling is on"); * } * else { * System.out.println("Monitor profiling is off"); * } * if ((status & YourKitProfilerServiceMBean.SNAPSHOT_CAPTURING) != 0) { * System.out.println("Snaphot capturing is on"); * } * else { * System.out.println("Snaphot capturing is off"); * } *

    * * @return a bit mask to check against Profiling Modes * @throws java.lang.Exception */ public long getStatus() throws java.lang.Exception; } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/MuleServiceMBean.java0000644000175000017500000000260110764100742032725 0ustar charlescharles/* * $Id: MuleServiceMBean.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.MuleException; import java.util.Date; /** * MuleServiceMBean is a JMX service interface for the UMOManager * */ public interface MuleServiceMBean { boolean isInitialised(); boolean isStopped(); Date getStartTime(); String getVersion(); String getVendor(); void start() throws MuleException; void stop() throws MuleException; void dispose() throws MuleException; long getFreeMemory(); long getMaxMemory(); long getTotalMemory(); String getServerId(); String getHostname(); String getHostIp(); String getOsVersion(); String getJdkVersion(); String getCopyright(); String getLicense(); String getBuildDate(); String getBuildNumber(); String getInstanceId(); /** * Contains value of option -builder * * @return builder class name */ String getConfigBuilderClassName(); } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/RegistryService.java0000644000175000017500000000243610764100742032736 0ustar charlescharles/* * $Id: RegistryService.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.MuleException; import org.mule.api.registry.Registry; /** * RegistryService exposes service information and actions on * the Registry */ public class RegistryService implements RegistryServiceMBean { private Registry registry; public RegistryService(Registry registry) { this.registry = registry; } public void start() throws MuleException { // registry.start(); } public void stop() throws MuleException { //registry.stop(); } /* public ComponentReference getRootObject() { return registry.getRegistryStore().getRootObject(); } */ // public String getPersistenceMode() // { // return registry.getPersistenceMode(); // } public String getName() { return "Registry"; } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/MuleService.java0000644000175000017500000001243510766637211032040 0ustar charlescharles/* * $Id: MuleService.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.MuleServer; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.config.MuleManifest; import org.mule.util.IOUtils; import org.mule.util.StringMessageUtils; import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Date; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleService exposes certain Mule server functions for management */ public class MuleService implements MuleServiceMBean { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); private String version; private String vendor; private String jdk; private String host; private String ip; private String os; private String buildNumber; private String buildDate; // TODO private String copyright = "Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com"; private String license; private MuleContext muleContext; public MuleService(MuleContext muleContext) { this.muleContext = muleContext; String patch = System.getProperty("sun.os.patch.level", null); jdk = System.getProperty("java.version") + " (" + System.getProperty("java.vm.info") + ")"; os = System.getProperty("os.name"); if (patch != null && !"unknown".equalsIgnoreCase(patch)) { os += " - " + patch; } os += " (" + System.getProperty("os.version") + ", " + System.getProperty("os.arch") + ")"; buildNumber = MuleManifest.getBuildNumber(); buildDate = MuleManifest.getBuildDate(); try { InetAddress iad = InetAddress.getLocalHost(); host = iad.getCanonicalHostName(); ip = iad.getHostAddress(); } catch (UnknownHostException e) { // ignore } } public boolean isInitialised() { return muleContext!=null && muleContext.isInitialised(); } public boolean isStopped() { return muleContext!=null && !muleContext.isStarted(); } public Date getStartTime() { if (!isStopped()) { return new Date(muleContext.getStartDate()); } else { return null; } } public String getVersion() { if (version == null) { version = MuleManifest.getProductVersion(); if (version == null) { version = "Mule Version Info Not Set"; } } return version; } public String getVendor() { if (vendor == null) { vendor = MuleManifest.getVendorName(); if (vendor == null) { vendor = "Mule Vendor Info Not Set"; } } return vendor; } public void start() throws MuleException { muleContext.start(); } public void stop() throws MuleException { muleContext.stop(); } public void dispose() throws MuleException { muleContext.dispose(); } public long getFreeMemory() { return Runtime.getRuntime().freeMemory(); } public long getMaxMemory() { return Runtime.getRuntime().maxMemory(); } public long getTotalMemory() { return Runtime.getRuntime().totalMemory(); } public String getServerId() { return muleContext.getConfiguration().getId(); } public String getHostname() { return host; } public String getHostIp() { return ip; } public String getOsVersion() { return os; } public String getJdkVersion() { return jdk; } public String getCopyright() { return copyright; } public String getLicense() { if (license == null) { try { license = IOUtils.getResourceAsString("MULE_LICENSE.txt", getClass()); license = StringMessageUtils.getBoilerPlate(license, ' ', 80); } catch (IOException e) { logger.warn("Failed to load MULE_LICENSE.txt", e); } if (license == null) { license = "Failed to load license"; } } return license; } /** * @deprecated use getBuildNumber() instead */ public String getBuildDate() { return buildDate; } public String getBuildNumber() { return buildNumber; } public String getInstanceId() { return muleContext.getConfiguration().getId(); } public String getConfigBuilderClassName() { return MuleServer.getConfigBuilderClassName(); } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/ServiceService.java0000644000175000017500000001763610774254333032545 0ustar charlescharles/* * $Id: ServiceService.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.MuleServer; import org.mule.api.MuleException; import org.mule.api.service.Service; import org.mule.management.stats.ServiceStatistics; import org.mule.model.seda.SedaService; import org.mule.service.AbstractService; import javax.management.MBeanRegistration; import javax.management.MBeanServer; import javax.management.ObjectName; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * ServiceService exposes service information about a Mule Managed * service. */ public class ServiceService implements ServiceServiceMBean, MBeanRegistration, ServiceStatsMBean { /** * logger used by this class */ private static Log LOGGER = LogFactory.getLog(ServiceService.class); private MBeanServer server; private String name; private ObjectName statsName; private ObjectName objectName; private ServiceStatistics statistics; public ServiceService(String name) { this.name = name; this.statistics = getComponent().getStatistics(); } public int getQueueSize() { Service c = getComponent(); if (c instanceof SedaService) { return ((SedaService)c).getQueueSize(); } else { return -1; } } /** * Pauses event processing for theComponent. Unlike stop(), a paused service * will still consume messages from the underlying transport, but those messages * will be queued until the service is resumed.

    In order to persist these * queued messages you can set the 'recoverableMode' property on the * Muleconfiguration to true. this causes all internal queues to store their * state. * * @throws org.mule.api.MuleException if the service failed to pause. * @see org.mule.config.MuleConfiguration */ public void pause() throws MuleException { getComponent().pause(); } /** * Resumes the Service that has been paused. If the service is not paused * nothing is executed. * * @throws org.mule.api.MuleException if the service failed to resume */ public void resume() throws MuleException { getComponent().resume(); } public boolean isPaused() { return getComponent().isPaused(); } public boolean isStopped() { return getComponent().isStopped(); } public void stop() throws MuleException { getComponent().stop(); } public void forceStop() throws MuleException { getComponent().forceStop(); } public boolean isStopping() { return getComponent().isStopping(); } public void dispose() throws MuleException { getComponent().dispose(); } public void start() throws MuleException { getComponent().start(); } /* * (non-Javadoc) * * @see org.mule.management.mbeans.ServiceServiceMBean#getStatistics() */ public ObjectName getStatistics() { return statsName; } /* * (non-Javadoc) * * @see javax.management.MBeanRegistration#preRegister(javax.management.MBeanServer, * javax.management.ObjectName) */ public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { this.server = server; this.objectName = name; return name; } /* * (non-Javadoc) * * @see javax.management.MBeanRegistration#postRegister(java.lang.Boolean) */ public void postRegister(Boolean registrationDone) { try { if (getComponent().getStatistics() != null) { statsName = new ObjectName(objectName.getDomain() + ":type=org.mule.Statistics,service=" + getName()); // unregister old version if exists if (this.server.isRegistered(statsName)) { this.server.unregisterMBean(statsName); } this.server.registerMBean(new ServiceStats(getComponent().getStatistics()), this.statsName); } } catch (Exception e) { LOGGER.error("Error post-registering the MBean", e); } } /* * (non-Javadoc) * * @see javax.management.MBeanRegistration#preDeregister() */ public void preDeregister() throws Exception { try { if (this.server.isRegistered(statsName)) { this.server.unregisterMBean(statsName); } } catch (Exception ex) { LOGGER.error("Error unregistering ServiceService child " + statsName.getCanonicalName(), ex); } } /* * (non-Javadoc) * * @see javax.management.MBeanRegistration#postDeregister() */ public void postDeregister() { // nothing to do } private AbstractService getComponent() { return (AbstractService)MuleServer.getMuleContext().getRegistry().lookupService(getName()); } // ///// Service stats impl ///////// /** * */ public void clearStatistics() { statistics.clear(); } /** * @return */ public long getAsyncEventsReceived() { return statistics.getAsyncEventsReceived(); } /** * @return */ public long getAsyncEventsSent() { return statistics.getAsyncEventsSent(); } /** * @return */ public long getAverageExecutionTime() { return statistics.getAverageExecutionTime(); } /** * @return */ public long getAverageQueueSize() { return statistics.getAverageQueueSize(); } /** * @return */ public long getExecutedEvents() { return statistics.getExecutedEvents(); } /** * @return */ public long getExecutionErrors() { return statistics.getExecutionErrors(); } /** * @return */ public long getFatalErrors() { return statistics.getFatalErrors(); } /** * @return */ public long getMaxExecutionTime() { return statistics.getMaxExecutionTime(); } /** * @return */ public long getMaxQueueSize() { return statistics.getMaxQueueSize(); } /** * @return */ public long getMinExecutionTime() { return statistics.getMinExecutionTime(); } /** * @return */ public String getName() { return name; } /** * @return */ public long getQueuedEvents() { return statistics.getQueuedEvents(); } /** * @return */ public long getReplyToEventsSent() { return statistics.getReplyToEventsSent(); } /** * @return */ public long getSyncEventsReceived() { return statistics.getSyncEventsReceived(); } /** * @return */ public long getSyncEventsSent() { return statistics.getSyncEventsSent(); } /** * @return */ public long getTotalEventsReceived() { return statistics.getTotalEventsReceived(); } /** * @return */ public long getTotalEventsSent() { return statistics.getTotalEventsSent(); } /** * @return */ public long getTotalExecutionTime() { return statistics.getTotalExecutionTime(); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/YourKitProfilerService.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/YourKitProfilerService.0000644000175000017500000001046010764100742033371 0ustar charlescharles/* * $Id: YourKitProfilerService.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.module.management.i18n.ManagementMessages; import com.yourkit.api.Controller; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class YourKitProfilerService implements YourKitProfilerServiceMBean { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); private final Controller controller; private AtomicBoolean capturing = new AtomicBoolean(false); public YourKitProfilerService() throws Exception { controller = new Controller(); } /** * {@inheritDoc} */ public String getHost() { return controller.getHost(); } /** * {@inheritDoc} */ public int getPort() { return controller.getPort(); } /** * {@inheritDoc} */ public String captureMemorySnapshot() throws Exception { return controller.captureMemorySnapshot(); } /** * {@inheritDoc} */ public String captureSnapshot(long snapshotFlags) throws Exception { return controller.captureSnapshot(snapshotFlags); } /** * {@inheritDoc} */ public void startAllocationRecording(long mode) throws Exception { controller.startAllocationRecording(mode); } /** * {@inheritDoc} */ public void stopAllocationRecording() throws Exception { controller.stopAllocationRecording(); } /** * {@inheritDoc} */ public void startCPUProfiling(long mode, String filters) throws Exception { controller.startCPUProfiling(mode, filters); } /** * {@inheritDoc} */ public void stopCPUProfiling() throws Exception { controller.stopCPUProfiling(); } /** * {@inheritDoc} */ public void startMonitorProfiling() throws Exception { controller.startMonitorProfiling(); } /** * {@inheritDoc} */ public void stopMonitorProfiling() throws Exception { controller.stopMonitorProfiling(); } /** * {@inheritDoc} */ public void advanceGeneration(String description) { controller.advanceGeneration(description); } /** * {@inheritDoc} */ public String forceGC() throws Exception { long[] heapSizes = controller.forceGC(); return ManagementMessages.forceGC(heapSizes).getMessage(); } /** * {@inheritDoc} */ public void startCapturingMemSnapshot(final int seconds) { if (!this.capturing.compareAndSet(false, true)) { return; } final Thread thread = new Thread( new Runnable() { public void run() { try { while (capturing.get()) { controller.captureMemorySnapshot(); Thread.sleep(seconds * 1000 /* millis in second */); } } catch (Exception e) { logger.error("Failed to capture memory snapshot", e); } } } ); thread.setDaemon(true); // let the application normally terminate thread.start(); } /** * {@inheritDoc} */ public void stopCapturingMemSnapshot() { this.capturing.set(false); } /** * {@inheritDoc} */ public long getStatus() throws java.lang.Exception { return (this.capturing.get()) ? (controller.getStatus() | SNAPSHOT_CAPTURING) : controller.getStatus(); } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/ServiceStats.java0000644000175000017500000001562710764100742032232 0ustar charlescharles/* * $Id: ServiceStats.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.management.stats.ServiceStatistics; import org.mule.management.stats.RouterStatistics; import javax.management.MBeanRegistration; import javax.management.MBeanServer; import javax.management.ObjectName; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * ServiceStats TODO */ public class ServiceStats implements ServiceStatsMBean, MBeanRegistration { /** * logger used by this class */ private static Log LOGGER = LogFactory.getLog(ServiceStats.class); private MBeanServer server; private ObjectName name; private ObjectName inboundName; private ObjectName outboundName; private ServiceStatistics statistics; public ServiceStats(ServiceStatistics statistics) { this.statistics = statistics; } /** * */ public void clearStatistics() { statistics.clear(); } /** * @return */ public long getAsyncEventsReceived() { return statistics.getAsyncEventsReceived(); } /** * @return */ public long getAsyncEventsSent() { return statistics.getAsyncEventsSent(); } /** * @return */ public long getAverageExecutionTime() { return statistics.getAverageExecutionTime(); } /** * @return */ public long getAverageQueueSize() { return statistics.getAverageQueueSize(); } /** * @return */ public long getExecutedEvents() { return statistics.getExecutedEvents(); } /** * @return */ public long getExecutionErrors() { return statistics.getExecutionErrors(); } /** * @return */ public long getFatalErrors() { return statistics.getFatalErrors(); } /** * @return */ public long getMaxExecutionTime() { return statistics.getMaxExecutionTime(); } /** * @return */ public long getMaxQueueSize() { return statistics.getMaxQueueSize(); } /** * @return */ public long getMinExecutionTime() { return statistics.getMinExecutionTime(); } /** * @return */ public String getName() { return statistics.getName(); } /** * @return */ public long getQueuedEvents() { return statistics.getQueuedEvents(); } /** * @return */ public long getReplyToEventsSent() { return statistics.getReplyToEventsSent(); } /** * @return */ public long getSyncEventsReceived() { return statistics.getSyncEventsReceived(); } /** * @return */ public long getSyncEventsSent() { return statistics.getSyncEventsSent(); } /** * @return */ public long getTotalEventsReceived() { return statistics.getTotalEventsReceived(); } /** * @return */ public long getTotalEventsSent() { return statistics.getTotalEventsSent(); } /** * @return */ public long getTotalExecutionTime() { return statistics.getTotalExecutionTime(); } /* * (non-Javadoc) * * @see javax.management.MBeanRegistration#preRegister(javax.management.MBeanServer, * javax.management.ObjectName) */ public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { this.server = server; this.name = name; return name; } /* * (non-Javadoc) * * @see javax.management.MBeanRegistration#postRegister(java.lang.Boolean) */ public void postRegister(Boolean registrationDone) { try { RouterStatistics is = this.statistics.getInboundRouterStat(); if (is != null) { inboundName = new ObjectName(name.getDomain() + ":type=org.mule.Statistics,service=" + statistics.getName() + ",router=inbound"); // unregister old version if exists if (this.server.isRegistered(inboundName)) { this.server.unregisterMBean(inboundName); } this.server.registerMBean(new RouterStats(is), this.inboundName); } RouterStatistics os = this.statistics.getOutboundRouterStat(); if (os != null) { outboundName = new ObjectName(name.getDomain() + ":type=org.mule.Statistics,service=" + statistics.getName() + ",router=outbound"); // unregister old version if exists if (this.server.isRegistered(outboundName)) { this.server.unregisterMBean(outboundName); } this.server.registerMBean(new RouterStats(os), this.outboundName); } } catch (Exception e) { LOGGER.error("Error post-registering MBean", e); } } /* * (non-Javadoc) * * @see javax.management.MBeanRegistration#preDeregister() */ public void preDeregister() throws Exception { // nothing to do } /* * (non-Javadoc) * * @see javax.management.MBeanRegistration#postDeregister() */ public void postDeregister() { try { if (this.server.isRegistered(inboundName)) { this.server.unregisterMBean(inboundName); } } catch (Exception ex) { LOGGER.error("Error unregistering ServiceStats child " + inboundName.getCanonicalName(), ex); } try { if (this.server.isRegistered(outboundName)) { this.server.unregisterMBean(outboundName); } } catch (Exception ex) { LOGGER.error("Error unregistering ServiceStats child " + inboundName.getCanonicalName(), ex); } } /* * (non-Javadoc) * * @see org.mule.management.mbeans.ServiceStatsMBean#getInboundRouter() */ public ObjectName getRouterInbound() { return this.inboundName; } /* * (non-Javadoc) * * @see org.mule.management.mbeans.ServiceStatsMBean#getOutboundRouter() */ public ObjectName getRouterOutbound() { return this.outboundName; } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/StatisticsService.java0000644000175000017500000000562610764100742033264 0ustar charlescharles/* * $Id: StatisticsService.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.MuleContext; import org.mule.management.stats.AllStatistics; import org.mule.management.stats.printers.CSVPrinter; import org.mule.management.stats.printers.HtmlTablePrinter; import org.mule.management.stats.printers.XMLPrinter; import java.io.StringWriter; import java.util.Collection; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * StatisicsService exposes Mule processing statistics */ public class StatisticsService implements StatisticsServiceMBean { /** * Serial version */ private static final long serialVersionUID = -4949499389883146363L; /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(StatisticsService.class); private AllStatistics stats = new AllStatistics(); private MuleContext muleContext = null; public void setMuleContext(MuleContext context) { this.muleContext = context; if (muleContext == null) { stats = new AllStatistics(); } else { stats = this.muleContext.getStatistics(); } } /** * @see org.mule.api.management.stats.Statistics#clear() */ public void clear() { stats.clear(); } /** * @see org.mule.api.management.stats.Statistics#isEnabled() */ public boolean isEnabled() { return stats.isEnabled(); } /** * @see org.mule.api.management.stats.Statistics#setEnabled(boolean) */ public void setEnabled(boolean b) { stats.setEnabled(b); } public Collection getComponentStatistics() { return stats.getComponentStatistics(); } public void logSummary() { stats.logSummary(); } public String printCSVSummary () { StringWriter w = new StringWriter(2048); CSVPrinter printer = new CSVPrinter(w); printer.setPrintHeaders(true); stats.logSummary(printer); return w.toString(); } public String printHtmlSummary () { StringWriter w = new StringWriter(8192); HtmlTablePrinter printer = new HtmlTablePrinter(w); stats.logSummary(printer); return w.toString(); } public String printXmlSummary() { StringWriter w = new StringWriter(8192); XMLPrinter printer = new XMLPrinter(w); stats.logSummary(printer); return w.toString(); } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/mbean/ModelService.java0000644000175000017500000000414110764100742032161 0ustar charlescharles/* * $Id: ModelService.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.mbean; import org.mule.api.MuleException; import org.mule.api.model.Model; /** * ModelService exposes service information and actions on the Mule * Model. */ public class ModelService implements ModelServiceMBean { private Model model; public ModelService(Model model) { this.model = model; } public void start() throws MuleException { model.start(); } public void stop() throws MuleException { model.stop(); } // public void startComponent(String name) throws MuleException // { // model.startComponent(name); // } // // public void stopComponent(String name) throws MuleException // { // model.stopComponent(name); // } // // public void pauseComponent(String name) throws MuleException // { // model.pauseComponent(name); // } // // public void resumeComponent(String name) throws MuleException // { // model.resumeComponent(name); // } // // public void unregisterComponent(String name) throws MuleException // { // RegistryContext.getRegistry().unregisterService(name); // //model.unregisterComponent(model.getDescriptor(name)); // } // // public boolean isComponentRegistered(String name) // { // return model.isComponentRegistered(name); // } // // public UMODescriptor getComponentDescriptor(String name) // { // return RegistryContext.getRegistry().lookupService(name); // // //return model.getDescriptor(name); // } public String getName() { return model.getName(); } public String getType() { return model.getType(); } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/0000755000175000017500000000000011351411160027357 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/JmxModernSupport.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/JmxModernSupport.java0000644000175000017500000000260610764100742033536 0ustar charlescharles/* * $Id: JmxModernSupport.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.support; import java.util.Arrays; import java.util.Collection; import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; /** * Support class using JMX 1.2 and newer calls. */ public class JmxModernSupport extends AbstractJmxSupport { /** {@inheritDoc} */ public String escape(String input) { return ObjectName.quote(input); } /** * For modern JMX implementation just delegate to a standard factory method. * @param name object name * @return ObjectName for MBeanServer * @throws MalformedObjectNameException for invalid names */ public ObjectName getObjectName(String name) throws MalformedObjectNameException { return ObjectName.getInstance(name); } /** {@inheritDoc} */ protected Collection getDomains(final MBeanServer server) { return Arrays.asList(server.getDomains()); } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/package.html0000644000175000017500000000020410764100742031644 0ustar charlescharles Mule Support classes and interface for Mule management subsystem ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/AutoDiscoveryJmxSupportFactory.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/AutoDiscoveryJmxSuppo0000644000175000017500000000573110764100742033626 0ustar charlescharles/* * $Id: AutoDiscoveryJmxSupportFactory.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.support; import org.mule.util.ClassUtils; import java.io.ObjectStreamException; import java.lang.reflect.Method; import javax.management.ObjectName; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Will discover if newer JMX version is available, otherwise fallback to JMX 1.1 * style support. */ // @Immutable public class AutoDiscoveryJmxSupportFactory implements JmxSupportFactory { /** * Safe initialization for a singleton. */ private static final JmxSupportFactory instance = new AutoDiscoveryJmxSupportFactory(); /** * logger used by this class */ private transient Log logger = LogFactory.getLog(getClass()); /** * A cached JMX support class instance. */ private JmxSupport jmxSupport; /** Constructs a new AutoDiscoveryJmxSupportFactory. */ protected AutoDiscoveryJmxSupportFactory () { final boolean jmxModernAvailable = isModernSpecAvailable(); // tertiary operand does not work anymore after hiererachy refactoring ?! if (jmxModernAvailable) { jmxSupport = new JmxModernSupport(); } else { jmxSupport = new JmxLegacySupport(); } if (logger.isDebugEnabled()) { logger.debug("JMX support instance is " + jmxSupport); } } /** * Obtain an instance of the factory class. * @return a cached singleton instance */ public static JmxSupportFactory getInstance() { return instance; } /** * Will try to detect if JMX 1.2 or later is available, otherwise will fallback * to the JMX 1.1 version of the support class. * * @return matching support class instance * @see JmxLegacySupport */ public JmxSupport getJmxSupport () { return this.jmxSupport; } /** * Is JMX 1.2 and up available for use? * @return false if only JMX 1.1 can be used */ protected boolean isModernSpecAvailable () { Class clazz = ObjectName.class; // method escape() is available since JMX 1.2 Method method = ClassUtils.getMethod(clazz, "quote", new Class[]{String.class}); return method != null; } /** * Safe deserialization. * @throws ObjectStreamException will never throw it for this class * @return singleton instance for this classloader/JVM */ private Object readResolve() throws ObjectStreamException { return instance; } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/JmxSupport.java0000644000175000017500000000316610764100742032373 0ustar charlescharles/* * $Id: JmxSupport.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.support; import org.mule.api.MuleContext; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; /** * Mule JMX supporting interface. */ public interface JmxSupport { /** Default Mule domain prefix for all instances. */ String DEFAULT_JMX_DOMAIN_PREFIX = "Mule"; /** * Uses JMX 1.2 and higher standard escape method and semantics. * @param name value to escape for JMX compliance * @return value valid for JMX */ String escape(String name); /** * Calculates the domain name for the current Mule instance. The rules are: *

      *
    • Default Mule domain *
    • If this server's instance ID is available, append "." (dot) and the ID *
    • If no instance ID is available, don't append anything *
    * @return JMX domain name */ String getDomainName(MuleContext context); /** * Create an object name. May cache the result. * @param name jmx object name * @return object name for MBeanServer consumption * @throws MalformedObjectNameException for invalid names */ ObjectName getObjectName(String name) throws MalformedObjectNameException; } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/SimplePasswordJmxAuthenticator.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/SimplePasswordJmxAuth0000644000175000017500000000566310764100742033601 0ustar charlescharles/* * $Id: SimplePasswordJmxAuthenticator.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.support; import org.mule.module.management.agent.JmxAgent; import org.mule.util.ObjectUtils; import org.mule.util.StringUtils; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import javax.management.remote.JMXAuthenticator; import javax.management.remote.JMXPrincipal; import javax.security.auth.Subject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A JMX authenticator for a simple username/password scheme. * Passwords are neither encrypted, nor obfuscated. */ public class SimplePasswordJmxAuthenticator implements JMXAuthenticator { /** * Logger used by this class. */ protected static final Log logger = LogFactory.getLog(JmxAgent.class); /** * An in-memory credentials storage. */ private Map credentials = new HashMap(); /** * {@inheritDoc} */ public Subject authenticate (Object authToken) { if (authToken == null) { throw new SecurityException("No authentication token available"); } if (!(authToken instanceof String[]) || ((String[]) authToken).length != 2) { throw new SecurityException("Unsupported credentials format"); } String[] authentication = (String[]) authToken; String username = StringUtils.defaultString(authentication[0]); String password = StringUtils.defaultString(authentication[1]); if (!credentials.containsKey(username)) { throw new SecurityException("Unauthenticated user: " + username); } if (!password.equals(ObjectUtils.toString(credentials.get(username)))) { throw new SecurityException("Invalid password"); } Set principals = new HashSet(); principals.add(new JMXPrincipal(username)); return new Subject(true, principals, Collections.EMPTY_SET, Collections.EMPTY_SET); } /** * Setter for property 'credentials'. * * @param newCredentials Value to set for property 'credentials'. */ public void setCredentials (final Map newCredentials) { this.credentials.clear(); if (newCredentials == null || newCredentials.isEmpty()) { logger.warn("Credentials cache has been purged, remote access will no longer be available"); } else { this.credentials.putAll(newCredentials); } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/JmxSupportFactory.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/JmxSupportFactory.jav0000644000175000017500000000127110764100742033555 0ustar charlescharles/* * $Id: JmxSupportFactory.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.support; /** * Factory for instantiating JMX helper classes. */ public interface JmxSupportFactory { /** * Create an instance of a JMX support class. * @return class instance */ JmxSupport getJmxSupport (); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/JmxLegacySupport.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/JmxLegacySupport.java0000644000175000017500000000424010764100742033512 0ustar charlescharles/* * $Id: JmxLegacySupport.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.support; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; /** * Support class for JMX 1.1 based systems. */ public class JmxLegacySupport extends AbstractJmxSupport { /** * Uses simpler rules for escaping non-JMX compliant chars. * Much of the work has already been performed in {@link org.mule.util.ObjectNameHelper}. * * @param name value to escape for JMX compliance * @return value valid for JMX */ public String escape(String name) { // do nothing at the moment, as ObjectNameHelper handles most of the conversion scenarios // kept as a placeholder and no-op to keep newer JMX classes from kicking in. return name; } /** * For modern JMX implementation just delegate to a standard factory method. * * @param name object name * @return ObjectName for MBeanServer * @throws javax.management.MalformedObjectNameException * for invalid names */ public ObjectName getObjectName(String name) throws MalformedObjectNameException { return new ObjectName(name); } /** {@inheritDoc} */ protected Collection getDomains(final MBeanServer server) { // list all MBean names and collect unique domains Set set = server.queryNames(null, null); Set domains = new HashSet(); for (Iterator it = set.iterator(); it.hasNext();) { ObjectName objectName = (ObjectName) it.next(); domains.add(objectName.getDomain()); } return domains; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/JmxRegistrationContext.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/JmxRegistrationContex0000644000175000017500000000754310764100742033635 0ustar charlescharles/* * $Id: JmxRegistrationContext.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.support; import org.mule.api.MuleContext; import org.mule.api.context.notification.MuleContextNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.context.notification.MuleContextNotification; import org.mule.context.notification.NotificationException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Stores JMX info pertinent to the currently intialising Mule manager with * JMX management enabled. The info is being kept for the duration of Mule server life, * and cleared on manager disposal. *

    * The main reason for that class is that JmxAgent prepares only the JMX foundation, while * the agents following it may require some contextual information about Mule's JMX, such as * a currently resolved Mule domain name (if non-clashing JMX domains support is enabled, which * is by default). Otherwise, they are left unaware of the previous work, and a random number * of JMX domains might be created for Mule. */ public class JmxRegistrationContext { /** * The logger used for this class */ private final transient Log logger = LogFactory.getLog(getClass()); /** * Normally ThreadLocal is fine, as Mule is being initialised and destroyed * by a single thread. We only need to share this info between random agents * during startup. */ private static final ThreadLocal contexts = new ThreadLocal(); private String resolvedDomain; /** Do not instantiate JmxRegistrationContext. */ private JmxRegistrationContext(MuleContext context) { try { // register the cleanup hook, otherwise server stop/start cycles may produce // Mule JMX domains with ever increasing suffix. context.registerListener(new MuleContextNotificationListener() { public void onNotification(ServerNotification notification) { MuleContextNotification mn = (MuleContextNotification) notification; if (MuleContextNotification.CONTEXT_DISPOSED == mn.getAction()) { // just in case someone is holding a ref to the context instance resolvedDomain = null; // disassociate contexts.set(null); } } }); } catch (NotificationException e) { logger.warn("Did not cleanup properly.", e); } } /** * Get current context or create one if none exist for the current startup cycle. * @return jmx registration context */ public static JmxRegistrationContext getCurrent(MuleContext context) { JmxRegistrationContext ctx = (JmxRegistrationContext) contexts.get(); if (ctx == null) { ctx = new JmxRegistrationContext(context); } contexts.set(ctx); return ctx; } /** * Getter for property 'resolvedDomain'. * * @return Value for property 'resolvedDomain'. */ public String getResolvedDomain() { return resolvedDomain; } /** * Setter for property 'resolvedDomain'. * * @param resolvedDomain Value to set for property 'resolvedDomain'. */ public void setResolvedDomain(String resolvedDomain) { this.resolvedDomain = resolvedDomain; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/AbstractJmxSupport.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/support/AbstractJmxSupport.ja0000644000175000017500000000574510766204322033536 0ustar charlescharles/* * $Id: AbstractJmxSupport.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.support; import org.mule.api.MuleContext; import org.mule.util.StringUtils; import java.util.Collection; import java.util.List; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; public abstract class AbstractJmxSupport implements JmxSupport { /** * Resolve JMX domain clash by adding an incremented number suffix to the name. E.g. if * 'Mule.TradeProcessor' is already registered with the accessible MBeanServer, will return * 'Mule.TradeProcessor.1'. If the latter one is already registered, will return * 'Mule.TradeProcessor.2' and so on. *

    * If no clash detected, returns the domain name unmodified. * @param domain domain name causing a conflict * @return resolved non-conflicting domain name */ protected String resolveDomainClash(String domain) { List servers = MBeanServerFactory.findMBeanServer(null); if (servers.isEmpty()) { throw new IllegalStateException("MBeanServer is not available."); } MBeanServer server = (MBeanServer) servers.get(0); Collection registeredDomains = getDomains(server); int counter = 1; // Just append . suffix to the domain for a start if (registeredDomains.contains(domain)) { domain += "." + counter; } // recheck in case there were any suffixed domains already while (registeredDomains.contains(domain)) { // append . until we succeed domain = domain.substring(0, domain.lastIndexOf(".") + 1) + ++counter; } return domain; } /** * List all domains of this MBean server. * @param server server to contact * @return a collection of unique JMX domains */ protected abstract Collection getDomains(MBeanServer server); /** {@inheritDoc} */ public String getDomainName(MuleContext context) { // TODO add some config options to the JmxAgent String domain = DEFAULT_JMX_DOMAIN_PREFIX; String instanceId = StringUtils.defaultString(context.getConfiguration().getId()); if (instanceId.length() > 0) { domain += "." + instanceId; } JmxRegistrationContext ctx = JmxRegistrationContext.getCurrent(context); String resolvedDomain = ctx.getResolvedDomain(); if (StringUtils.isBlank(resolvedDomain)) { domain = resolveDomainClash(domain); ctx.setResolvedDomain(domain); } return domain; } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/i18n/0000755000175000017500000000000011351411157026430 5ustar charlescharlesmule-2.0.1/modules/management/src/main/java/org/mule/module/management/i18n/ManagementMessages.java0000644000175000017500000000225710764100742033047 0ustar charlescharles/* * $Id: ManagementMessages.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class ManagementMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("management"); public static Message createOrLocateShouldBeSet() { return createMessage(BUNDLE_PATH, 1); } public static Message cannotLocateOrCreateServer() { return createMessage(BUNDLE_PATH, 2); } public static Message noMBeanServerAvailable() { return createMessage(BUNDLE_PATH, 3); } public static Message forceGC(long[] heapSizes) { return createMessage(BUNDLE_PATH, 4, String.valueOf(heapSizes[0]), String.valueOf(heapSizes[1])); } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/config/0000755000175000017500000000000011351411160027110 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/config/JmxAgentDefinitionParser.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/config/JmxAgentDefinitionPars0000644000175000017500000000433210764100742033421 0ustar charlescharles/* * $Id: JmxAgentDefinitionParser.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.config; import org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.processors.ProvideDefaultNameFromElement; import org.mule.module.management.agent.JmxAgent; import org.mule.util.StringUtils; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class JmxAgentDefinitionParser extends AbstractMuleBeanDefinitionParser { public static final String CONNECTOR_SERVER = "connector-server"; public JmxAgentDefinitionParser() { singleton = true; addAlias("server", "mBeanServer"); registerPreProcessor(new ProvideDefaultNameFromElement()); } protected Class getBeanClass(Element element) { return JmxAgent.class; } protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); if (CONNECTOR_SERVER.equals(node.getLocalName())) { assembler.extendBean("connectorServerUrl", ((Element) node).getAttribute("url"), false); String rebind = ((Element) node).getAttribute("rebind"); if (!StringUtils.isEmpty(rebind)) { Map csProps = new HashMap(); csProps.put("jmx.remote.jndi.rebind", rebind); assembler.extendBean("connectorServerProperties", csProps, false); } } } super.postProcess(context, assembler, element); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/config/ManagementNamespaceHandler.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/config/ManagementNamespaceHan0000644000175000017500000000623611003213046033357 0ustar charlescharles/* * $Id: ManagementNamespaceHandler.java 11618 2008-04-21 22:33:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.config; import org.mule.agent.EndpointNotificationLoggerAgent; import org.mule.agent.Log4jNotificationLoggerAgent; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.collection.ChildMapDefinitionParser; import org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser; import org.mule.config.spring.parsers.specific.AgentDefinitionParser; import org.mule.config.spring.parsers.specific.ObjectFactoryWrapper; import org.mule.module.management.agent.DefaultJmxSupportAgent; import org.mule.module.management.agent.JmxServerNotificationAgent; import org.mule.module.management.agent.Log4jAgent; import org.mule.module.management.agent.Mx4jAgent; import org.mule.module.management.agent.RmiRegistryAgent; import org.mule.module.management.agent.YourKitProfilerAgent; /** * Handles all configuration elements in the Mule Management module. */ public class ManagementNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerBeanDefinitionParser("jmx-server", new JmxAgentDefinitionParser()); registerBeanDefinitionParser("mBeanServer", new ObjectFactoryWrapper("MBeanServerObjectFactory")); registerBeanDefinitionParser("credentials", new ChildMapDefinitionParser("credentials")); registerBeanDefinitionParser("jmx-log4j", new AgentDefinitionParser(Log4jAgent.class)); registerBeanDefinitionParser("jmx-mx4j-adaptor", new AgentDefinitionParser(Mx4jAgent.class)); registerBeanDefinitionParser("jmx-notifications", new AgentDefinitionParser(JmxServerNotificationAgent.class)); registerMuleBeanDefinitionParser("jmx-default-config", new AgentDefinitionParser(DefaultJmxSupportAgent.class)).addAlias("registerMx4jAdapter", "loadMx4jAgent"); registerBeanDefinitionParser("level-mapping", new ChildMapEntryDefinitionParser("levelMappings", "severity", "eventId")); // these two are identical? registerBeanDefinitionParser("log4j-notifications", new AgentDefinitionParser(Log4jNotificationLoggerAgent.class)); registerBeanDefinitionParser("chainsaw-notifications", new AgentDefinitionParser(Log4jNotificationLoggerAgent.class)); registerBeanDefinitionParser("publish-notifications", new AgentDefinitionParser(EndpointNotificationLoggerAgent.class)); registerBeanDefinitionParser("rmi-server", new AgentDefinitionParser(RmiRegistryAgent.class)); registerBeanDefinitionParser("yourkit-profiler", new AgentDefinitionParser(YourKitProfilerAgent.class)); registerBeanDefinitionParser("custom-agent", new AgentDefinitionParser()); //This gets processed by the jmx-server parser registerIgnoredElement("connector-server"); } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/0000755000175000017500000000000011351411160026741 5ustar charlescharles././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/JmxServerNotificationAgent.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/JmxServerNotificationAg0000644000175000017500000001551510764100742033447 0ustar charlescharles/* * $Id: JmxServerNotificationAgent.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import org.mule.agent.AbstractNotificationLoggerAgent; import org.mule.api.context.notification.ServerNotification; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import org.mule.module.management.support.AutoDiscoveryJmxSupportFactory; import org.mule.module.management.support.JmxSupport; import org.mule.module.management.support.JmxSupportFactory; import java.util.ArrayList; import java.util.List; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.Notification; import javax.management.NotificationBroadcasterSupport; import javax.management.NotificationEmitter; import javax.management.ObjectName; /** * An agent that propergates Mule Server notifications to Jmx. * */ public class JmxServerNotificationAgent extends AbstractNotificationLoggerAgent { public static final String LISTENER_JMX_OBJECT_NAME = "type=org.mule.Notification,name=MuleNotificationListener"; public static final String BROADCASTER_JMX_OBJECT_NAME = "type=org.mule.Notification,name=MuleNotificationBroadcaster"; public static final String DEFAULT_AGENT_NAME = "Jmx Notification Agent"; private MBeanServer mBeanServer; private BroadcastNotificationService broadcastNotificationMbean; private boolean registerListenerMbean = true; private ObjectName listenerObjectName; private ObjectName broadcasterObjectName; private JmxSupportFactory jmxSupportFactory = AutoDiscoveryJmxSupportFactory.getInstance(); private JmxSupport jmxSupport; public JmxServerNotificationAgent() { super(DEFAULT_AGENT_NAME); } /** * {@inheritDoc} */ protected void doInitialise() throws InitialisationException { try { jmxSupport = jmxSupportFactory.getJmxSupport(); mBeanServer = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0); broadcasterObjectName = ObjectName.getInstance(jmxSupport.getDomainName(muleContext) + ":" + BROADCASTER_JMX_OBJECT_NAME); broadcastNotificationMbean = new BroadcastNotificationService(); mBeanServer.registerMBean(broadcastNotificationMbean, broadcasterObjectName); if (registerListenerMbean) { listenerObjectName = ObjectName.getInstance(jmxSupport.getDomainName(muleContext) + ":" + LISTENER_JMX_OBJECT_NAME); NotificationListener mbean = new NotificationListener(); broadcastNotificationMbean.addNotificationListener(mbean, null, null); mBeanServer.registerMBean(mbean, listenerObjectName); } } catch (Exception e) { throw new InitialisationException(CoreMessages.failedToStart("JMX Server Notification Agent"), e, this); } } /** * {@inheritDoc} */ public void dispose() { try { if (listenerObjectName != null) { mBeanServer.unregisterMBean(listenerObjectName); } } catch (Exception e) { logger.warn(e.getMessage(), e); } try { mBeanServer.unregisterMBean(broadcasterObjectName); } catch (Exception e) { logger.warn(e.getMessage(), e); } super.dispose(); } /** * {@inheritDoc} */ protected void logEvent(ServerNotification e) { broadcastNotificationMbean.sendNotification(new Notification(e.getClass().getName(), e, e.getTimestamp(), e.toString())); } /** * Should be a 1 line description of the agent. * * @return description */ public String getDescription() { return DEFAULT_AGENT_NAME + (registerListenerMbean ? " (Listener MBean registered)" : ""); } /** * Getter for property 'jmxSupportFactory'. * * @return Value for property 'jmxSupportFactory'. */ public JmxSupportFactory getJmxSupportFactory() { return jmxSupportFactory; } /** * Setter for property 'jmxSupportFactory'. * * @param jmxSupportFactory Value to set for property 'jmxSupportFactory'. */ public void setJmxSupportFactory(JmxSupportFactory jmxSupportFactory) { this.jmxSupportFactory = jmxSupportFactory; } public static interface BroadcastNotificationServiceMBean extends NotificationEmitter { // no methods } public static class BroadcastNotificationService extends NotificationBroadcasterSupport implements BroadcastNotificationServiceMBean { // no methods } public static interface NotificationListenerMBean { /** * Getter for property 'notificsationList'. * * @return Value for property 'notificsationList'. */ List getNotificationsList(); /** * Getter for property 'listSize'. * * @return Value for property 'listSize'. */ int getListSize(); /** * Setter for property 'listSize'. * * @param listSize Value to set for property 'listSize'. */ void setListSize(int listSize); } public static class NotificationListener implements NotificationListenerMBean, javax.management.NotificationListener { private int listSize = 100; private List notifs; /** * {@inheritDoc} */ public void handleNotification(Notification notification, Object o) { if (getList().size() == listSize) { getList().remove(listSize - 1); } getList().add(0, notification); } /** * {@inheritDoc} */ public List getNotificationsList() { return notifs; } /** * {@inheritDoc} */ public int getListSize() { return listSize; } /** * {@inheritDoc} */ public void setListSize(int listSize) { this.listSize = listSize; } /** * Getter for property 'list'. * * @return Value for property 'list'. */ protected List getList() { if (notifs == null) { notifs = new ArrayList(listSize); } return notifs; } } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/package.html0000644000175000017500000000017510764100742031235 0ustar charlescharles Mule Management agents including agents for Jdmk, MX4J, and Log4J ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/WrapperManagerAgent.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/WrapperManagerAgent.jav0000644000175000017500000001707210774254333033363 0ustar charlescharles/* * $Id: WrapperManagerAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import org.mule.AbstractAgent; import org.mule.api.MuleException; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import org.mule.module.management.i18n.ManagementMessages; import org.mule.module.management.support.AutoDiscoveryJmxSupportFactory; import org.mule.module.management.support.JmxSupport; import org.mule.module.management.support.JmxSupportFactory; import java.util.List; import javax.management.InstanceNotFoundException; import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.tanukisoftware.wrapper.jmx.WrapperManager; import org.tanukisoftware.wrapper.jmx.WrapperManagerMBean; /** * This agent integrates Java Service Wrapper into Mule. See * http://wrapper.tanukisoftware.org * for more details. */ public class WrapperManagerAgent extends AbstractAgent { /** * MBean name to register under. */ public static final String WRAPPER_OBJECT_NAME = "name=WrapperManager"; /** * For cases when Mule is embedded in another process and that external process * had registered the MBean. */ public static final String DEFAULT_WRAPPER_MBEAN_NAME = "org.tanukisoftware.wrapper:type=WrapperManager"; private static final Log logger = LogFactory.getLog(WrapperManagerAgent.class); /** * This property is set by the native launcher, used for extra checks. */ private static final String WRAPPER_SYSTEM_PROPERTY_NAME = "wrapper.native_library"; private MBeanServer mBeanServer; private ObjectName wrapperName; private JmxSupportFactory jmxSupportFactory = AutoDiscoveryJmxSupportFactory.getInstance(); private JmxSupport jmxSupport = jmxSupportFactory.getJmxSupport(); // atomic reference to avoid unnecessary construction calls private final AtomicReference/**/ wrapperManagerRef = new AtomicReference(); public WrapperManagerAgent() { super("Wrapper Manager"); } public void initialise() throws InitialisationException { try { final List servers = MBeanServerFactory.findMBeanServer(null); if (servers.isEmpty()) { throw new InitialisationException(ManagementMessages.noMBeanServerAvailable(), this); } mBeanServer = (MBeanServer) servers.get(0); /* Perform an extra check ourselves. If 'wrapper.native_library' property has not been set, which is the case for embedded scenarios, don't even try to construct the wrapper manager bean, as it performs a number of checks internally and outputs a very verbose warning. */ boolean launchedByWrapper; if (System.getProperty(WRAPPER_SYSTEM_PROPERTY_NAME) == null) { launchedByWrapper = false; } // Check if an external process registered a wrapper MBean under default name. else if (mBeanServer.isRegistered(jmxSupport.getObjectName(DEFAULT_WRAPPER_MBEAN_NAME))) { logger.info("Mule is embedded in a container already launched by a wrapper." + "Duplicates will not be registered. Use the " + DEFAULT_WRAPPER_MBEAN_NAME + " MBean " + "instead for control."); unregisterMeQuietly(); return; } else { lazyInitWrapperManager(); launchedByWrapper = ((WrapperManagerMBean) wrapperManagerRef.get()).isControlledByNativeWrapper(); } if (!launchedByWrapper) { logger.info("This JVM hasn't been launched by the wrapper, the agent will not run."); unregisterMeQuietly(); return; } wrapperName = jmxSupport.getObjectName(jmxSupport.getDomainName(muleContext) + ":" + WRAPPER_OBJECT_NAME); unregisterMBeansIfNecessary(); mBeanServer.registerMBean(wrapperManagerRef.get(), wrapperName); } catch (InitialisationException iex) { // rethrow throw iex; } catch (Exception e) { throw new InitialisationException(CoreMessages.failedToStart("wrapper agent"), e, this); } } public void start() throws MuleException { // nothing to do } public void stop() throws MuleException { // nothing to do } /* @see org.mule.api.lifecycle.Disposable#dispose() */ public void dispose() { try { unregisterMBeansIfNecessary(); } catch (Exception e) { logger.error("Couldn't unregister MBean: " + (wrapperName != null ? wrapperName.getCanonicalName() : "null"), e); } } /* @see org.mule.api.context.Agent#registered() */ public void registered() { // nothing to do } /* @see org.mule.api.context.Agent#unregistered() */ public void unregistered() { // nothing to do } // ///////////////////////////////////////////////////////////////////////// // Getters and setters // ///////////////////////////////////////////////////////////////////////// /* @see org.mule.api.context.Agent#getDescription() */ public String getDescription() { WrapperManagerMBean wm = (WrapperManagerMBean) wrapperManagerRef.get(); if (wm == null) { return "Wrapper Manager"; } else return "Wrapper Manager: Mule PID #" + wm.getJavaPID() + ", Wrapper PID #" + wm.getWrapperPID(); } protected void lazyInitWrapperManager() { WrapperManagerMBean wm = (WrapperManagerMBean) wrapperManagerRef.get(); if (wm != null) { return; } wm = new WrapperManager(); wrapperManagerRef.compareAndSet(null, wm); } /** * Unregister all MBeans if there are any left over the old deployment */ protected void unregisterMBeansIfNecessary() throws MalformedObjectNameException, InstanceNotFoundException, MBeanRegistrationException { if (mBeanServer == null || wrapperName == null) { return; } if (mBeanServer.isRegistered(wrapperName)) { mBeanServer.unregisterMBean(wrapperName); } } /** * Quietly unregister ourselves. */ protected void unregisterMeQuietly() { try { // remove the agent from the list, it's not functional muleContext.getRegistry().unregisterAgent(this.getName()); } catch (MuleException e) { // not interested, really } } }././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/FixedHostRmiClientSocketFactory.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/FixedHostRmiClientSocke0000644000175000017500000000474010764100742033372 0ustar charlescharles/* * $Id: FixedHostRmiClientSocketFactory.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import java.io.IOException; import java.io.Serializable; import java.net.Socket; import java.rmi.server.RMIClientSocketFactory; /** * This implementation will enforce specific overrideHost/ip for RMI calls on multi-NIC servers. * TODO MULE-1440 this should probably be moved into the RMI transport. */ public class FixedHostRmiClientSocketFactory implements RMIClientSocketFactory, Serializable { /** * Host to use instead of the default one. */ private String overrideHost; /** * Default constructor. */ public FixedHostRmiClientSocketFactory () { } /** * Create a new instance. * @param overrideHost host/ip to enforce */ public FixedHostRmiClientSocketFactory (final String overrideHost) { this.overrideHost = overrideHost; } /** * Create a client socket connected to the specified overrideHost and port. * * @param host the host name IGNORED if an override configured * @param port the port number * @return a socket connected to the specified overrideHost and port. * @throws java.io.IOException if an I/O error occurs during socket creation */ public Socket createSocket (String host, int port) throws IOException { /* NOTE this is StringUtils.defaultIfEmpty(overrideHost, host) This socket factory is required on the client, minimize the dependency graph */ final String hostToUse = (overrideHost == null || overrideHost.trim().length() == 0) ? host : overrideHost; return new Socket(hostToUse, port); } /** * Getter for property 'overrideHost'. * * @return Value for property 'overrideHost'. */ public String getOverrideHost () { return overrideHost; } /** * Setter for property 'overrideHost'. * * @param overrideHost Value to set for property 'overrideHost'. */ public void setOverrideHost (final String overrideHost) { this.overrideHost = overrideHost; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/DefaultJmxSupportAgent.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/DefaultJmxSupportAgent.0000644000175000017500000002266410774254333033412 0ustar charlescharles/* * $Id: DefaultJmxSupportAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import org.mule.AbstractAgent; import org.mule.RegistryContext; import org.mule.api.MuleException; import org.mule.api.agent.Agent; import org.mule.api.lifecycle.InitialisationException; import org.mule.util.StringUtils; import java.rmi.server.RMIClientSocketFactory; import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; import javax.management.remote.rmi.RMIConnectorServer; public class DefaultJmxSupportAgent extends AbstractAgent { public static final String DEFAULT_HOST = "localhost"; public static final String DEFAULT_PORT = "1099"; private boolean loadJdmkAgent = false; private boolean loadMx4jAgent = false; private boolean loadProfilerAgent = false; private String port; private String host; public DefaultJmxSupportAgent() { super("jmx-default-config"); } /** * Username/password combinations for JMX Remoting * authentication. */ private Map credentials = new HashMap(); /** * Should be a 1 line description of the agent * * @return agent description */ public String getDescription() { return "Default Jmx Agent Support"; } /** {@inheritDoc} */ public void registered() { // nothing to do } /** {@inheritDoc} */ public void unregistered() { // nothing to do } /** {@inheritDoc} */ public void start() throws MuleException { // nothing to do } /** {@inheritDoc} */ public void stop() throws MuleException { // nothing to do } /** * A lifecycle method where implementor should free up any resources. If an * exception is thrown it should just be logged and processing should continue. * This method should not throw Runtime exceptions. */ public void dispose() { // nothing to do } /** * Method used to perform any initialisation work. If a fatal error occurs during * initialisation an InitialisationException should be thrown, * causing the Mule instance to shutdown. If the error is recoverable, say by * retrying to connect, a RecoverableException should be thrown. * There is no guarantee that by throwing a Recoverable exception that the Mule * instance will not shut down. * * @throws org.mule.api.lifecycle.InitialisationException * if a fatal error occurs * causing the Mule instance to shutdown */ public void initialise() throws InitialisationException { try { Agent agent = createRmiAgent(); if (!isAgentRegistered(agent)) { RegistryContext.getRegistry().registerAgent(agent); } agent = createJmxAgent(); if (!isAgentRegistered(agent)) { RegistryContext.getRegistry().registerAgent(agent); } agent = createLog4jAgent(); if (!isAgentRegistered(agent)) { RegistryContext.getRegistry().registerAgent(agent); } agent = createJmxNotificationAgent(); if (!isAgentRegistered(agent)) { RegistryContext.getRegistry().registerAgent(agent); } if (loadJdmkAgent) { agent = createJdmkAgent(); if (!isAgentRegistered(agent)) { RegistryContext.getRegistry().registerAgent(agent); } } if (loadMx4jAgent) { agent = createMx4jAgent(); if (!isAgentRegistered(agent)) { RegistryContext.getRegistry().registerAgent(agent); } } if (loadProfilerAgent) { agent = createProfilerAgent(); if (!isAgentRegistered(agent)) { RegistryContext.getRegistry().registerAgent(agent); } } // remove this agent once it has registered the other agents //TODO RM* this currently does nothing!!! muleContext.getRegistry().unregisterAgent(name); } catch (MuleException e) { throw new InitialisationException(e, this); } } public JmxAgent createJmxAgent() { JmxAgent agent = new JmxAgent(); String remotingUri = null; if (StringUtils.isBlank(host) && StringUtils.isBlank(port)) { remotingUri = JmxAgent.DEFAULT_REMOTING_URI; } else if (StringUtils.isNotBlank(host)) { // enable support for multi-NIC servers by configuring // a custom RMIClientSocketFactory Map props = agent.getConnectorServerProperties(); Map mergedProps = new HashMap(props.size() + 1); mergedProps.putAll(props); RMIClientSocketFactory factory = new FixedHostRmiClientSocketFactory(host); mergedProps.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, factory); agent.setConnectorServerProperties(mergedProps); } // if defaults haven't been used if (StringUtils.isBlank(remotingUri)) { remotingUri = MessageFormat.format("service:jmx:rmi:///jndi/rmi://{0}:{1}/server", new Object[]{StringUtils.defaultString(host, DEFAULT_HOST), StringUtils.defaultString(port, DEFAULT_PORT)}); } if (credentials != null && !credentials.isEmpty()) { agent.setCredentials(credentials); } agent.setConnectorServerUrl(remotingUri); return agent; } protected Log4jAgent createLog4jAgent() { return new Log4jAgent(); } protected RmiRegistryAgent createRmiAgent() { final RmiRegistryAgent agent = new RmiRegistryAgent(); agent.setHost(StringUtils.defaultString(host, DEFAULT_HOST)); agent.setPort(StringUtils.defaultString(port, DEFAULT_PORT)); return agent; } protected JmxServerNotificationAgent createJmxNotificationAgent() { return new JmxServerNotificationAgent(); } protected Mx4jAgent createMx4jAgent() { return new Mx4jAgent(); } protected JdmkAgent createJdmkAgent() { return new JdmkAgent(); } protected YourKitProfilerAgent createProfilerAgent() { return new YourKitProfilerAgent(); } protected boolean isAgentRegistered(Agent agent) { return muleContext.getRegistry().lookupAgent(agent.getName()) != null; } /** * Getter for property 'loadJdmkAgent'. * * @return Value for property 'loadJdmkAgent'. */ public boolean isLoadJdmkAgent() { return loadJdmkAgent; } /** * Setter for property 'loadJdmkAgent'. * * @param loadJdmkAgent Value to set for property 'loadJdmkAgent'. */ public void setLoadJdmkAgent(boolean loadJdmkAgent) { this.loadJdmkAgent = loadJdmkAgent; } /** * Getter for property 'loadMx4jAgent'. * * @return Value for property 'loadMx4jAgent'. */ public boolean isLoadMx4jAgent() { return loadMx4jAgent; } /** * Setter for property 'loadMx4jAgent'. * * @param loadMx4jAgent Value to set for property 'loadMx4jAgent'. */ public void setLoadMx4jAgent(boolean loadMx4jAgent) { this.loadMx4jAgent = loadMx4jAgent; } /** * Getter for property 'loadProfilerAgent'. * @return Value for property 'loadProfilerAgent'. */ public boolean isLoadProfilerAgent() { return loadProfilerAgent; } /** * Setter for property 'loadProfilerAgent'. * @param loadProfilerAgent Value to set for property 'loadProfilerAgent'. */ public void setLoadProfilerAgent(boolean loadProfilerAgent) { this.loadProfilerAgent = loadProfilerAgent; } /** * Getter for property 'port'. * * @return Value for property 'port'. */ public String getPort() { return port; } /** * Setter for property 'port'. * * @param port Value to set for property 'port'. */ public void setPort(final String port) { this.port = port; } /** * Getter for property 'host'. * * @return Value for property 'host'. */ public String getHost() { return host; } /** * Setter for property 'host'. * * @param host Value to set for property 'host'. */ public void setHost(final String host) { this.host = host; } /** * Setter for property 'credentials'. * * @param credentials Value to set for property 'credentials'. */ public void setCredentials(final Map credentials) { this.credentials = credentials; } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/Log4jAgent.java0000644000175000017500000000737310774254333031573 0ustar charlescharles/* * $Id: Log4jAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import org.mule.AbstractAgent; import org.mule.api.MuleException; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import org.mule.module.management.support.AutoDiscoveryJmxSupportFactory; import org.mule.module.management.support.JmxSupport; import org.mule.module.management.support.JmxSupportFactory; import java.util.Iterator; import java.util.Set; import javax.management.InstanceNotFoundException; import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.MalformedObjectNameException; import javax.management.ObjectInstance; import javax.management.ObjectName; import org.apache.log4j.jmx.HierarchyDynamicMBean; /** * Log4jAgent exposes the configuration of the Log4J instance running * in Mule for Jmx management */ public class Log4jAgent extends AbstractAgent { private MBeanServer mBeanServer; public static final String JMX_OBJECT_NAME = "log4j:type=Hierarchy"; private JmxSupportFactory jmxSupportFactory = AutoDiscoveryJmxSupportFactory.getInstance(); private JmxSupport jmxSupport = jmxSupportFactory.getJmxSupport(); public Log4jAgent() { super("jmx-log4j"); } public void initialise() throws InitialisationException { try { mBeanServer = (MBeanServer)MBeanServerFactory.findMBeanServer(null).get(0); final ObjectName objectName = jmxSupport.getObjectName(JMX_OBJECT_NAME); // unregister existing Log4j MBean first if required unregisterMBeansIfNecessary(); mBeanServer.registerMBean(new HierarchyDynamicMBean(), objectName); } catch (Exception e) { throw new InitialisationException(CoreMessages.failedToStart("JMX Agent"), e, this); } } /** * Unregister all log4j MBeans if there are any left over the old deployment */ protected void unregisterMBeansIfNecessary() throws MalformedObjectNameException, InstanceNotFoundException, MBeanRegistrationException { if (mBeanServer.isRegistered(jmxSupport.getObjectName(JMX_OBJECT_NAME))) { // unregister all log4jMBeans and loggers Set log4jMBeans = mBeanServer.queryMBeans(jmxSupport.getObjectName("log4j*:*"), null); for (Iterator it = log4jMBeans.iterator(); it.hasNext();) { ObjectInstance objectInstance = (ObjectInstance)it.next(); ObjectName theName = objectInstance.getObjectName(); mBeanServer.unregisterMBean(theName); } } } public void start() throws MuleException { // nothing to do } public void stop() throws MuleException { // nothing to do } /* * (non-Javadoc) * * @see org.mule.api.lifecycle.Disposable#dispose() */ public void dispose() { // nothing to do } /* * (non-Javadoc) * * @see org.mule.api.context.Agent#registered() */ public void registered() { // nothing to do } /* * (non-Javadoc) * * @see org.mule.api.context.Agent#unregistered() */ public void unregistered() { // nothing to do } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/JmxAgent.java0000644000175000017500000005352110776664712031356 0ustar charlescharles/* * $Id: JmxAgent.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import org.mule.AbstractAgent; import org.mule.RegistryContext; import org.mule.api.MuleException; import org.mule.api.MuleRuntimeException; import org.mule.api.context.notification.MuleContextNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.model.Model; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageReceiver; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.MuleContextNotification; import org.mule.context.notification.NotificationException; import org.mule.module.management.i18n.ManagementMessages; import org.mule.module.management.mbean.ConnectorService; import org.mule.module.management.mbean.ConnectorServiceMBean; import org.mule.module.management.mbean.EndpointService; import org.mule.module.management.mbean.EndpointServiceMBean; import org.mule.module.management.mbean.ModelService; import org.mule.module.management.mbean.ModelServiceMBean; import org.mule.module.management.mbean.MuleConfigurationService; import org.mule.module.management.mbean.MuleConfigurationServiceMBean; import org.mule.module.management.mbean.MuleService; import org.mule.module.management.mbean.MuleServiceMBean; import org.mule.module.management.mbean.ServiceService; import org.mule.module.management.mbean.ServiceServiceMBean; import org.mule.module.management.mbean.StatisticsService; import org.mule.module.management.support.AutoDiscoveryJmxSupportFactory; import org.mule.module.management.support.JmxSupport; import org.mule.module.management.support.JmxSupportFactory; import org.mule.module.management.support.SimplePasswordJmxAuthenticator; import org.mule.transport.AbstractConnector; import org.mule.util.ClassUtils; import org.mule.util.StringUtils; import java.rmi.server.ExportException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.management.InstanceAlreadyExistsException; import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.MalformedObjectNameException; import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; import javax.management.remote.JMXAuthenticator; import javax.management.remote.JMXConnectorServer; import javax.management.remote.JMXConnectorServerFactory; import javax.management.remote.JMXServiceURL; import javax.management.remote.rmi.RMIConnectorServer; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * JmxAgent registers Mule Jmx management beans with an MBean server. */ public class JmxAgent extends AbstractAgent { public static final String DEFAULT_REMOTING_URI = "service:jmx:rmi:///jndi/rmi://localhost:1099/server"; // populated with values below in a static initializer public static final Map DEFAULT_CONNECTOR_SERVER_PROPERTIES; /** * Default JMX Authenticator to use for securing remote access. */ public static final String DEFAULT_JMX_AUTHENTICATOR = SimplePasswordJmxAuthenticator.class.getName(); /** * Logger used by this class */ protected static final Log logger = LogFactory.getLog(JmxAgent.class); /** * Should MBeanServer be discovered. */ protected boolean locateServer = true; private boolean createServer = true; private String connectorServerUrl; private MBeanServer mBeanServer; private JMXConnectorServer connectorServer; private Map connectorServerProperties = null; private boolean enableStatistics = true; private List registeredMBeans = new ArrayList(); private final AtomicBoolean serverCreated = new AtomicBoolean(false); private final AtomicBoolean initialized = new AtomicBoolean(false); private JmxSupportFactory jmxSupportFactory = AutoDiscoveryJmxSupportFactory.getInstance(); private JmxSupport jmxSupport = jmxSupportFactory.getJmxSupport(); /** * Username/password combinations for JMX Remoting authentication. */ private Map credentials = new HashMap(); static { Map props = new HashMap(1); props.put(RMIConnectorServer.JNDI_REBIND_ATTRIBUTE, "true"); DEFAULT_CONNECTOR_SERVER_PROPERTIES = Collections.unmodifiableMap(props); } public JmxAgent() { super("jmx-agent"); connectorServerProperties = new HashMap(DEFAULT_CONNECTOR_SERVER_PROPERTIES); } /** * {@inheritDoc} * * @see org.mule.api.agent.Agent#getDescription() */ public String getDescription() { if (connectorServerUrl != null) { return name + ": " + connectorServerUrl; } else { return "JMX Agent"; } } /** * The JmxAgent needs a RmiRegistryAgent to be started before it can properly work. */ public List getDependentAgents() { return Arrays.asList(new Class[] { RmiRegistryAgent.class }); } /** * {@inheritDoc} * */ public void initialise() throws InitialisationException { if (initialized.get()) { return; } if (mBeanServer == null && !locateServer && !createServer) { throw new InitialisationException(ManagementMessages.createOrLocateShouldBeSet(), this); } if (mBeanServer == null && locateServer) { List l = MBeanServerFactory.findMBeanServer(null); if (l != null && l.size() > 0) { mBeanServer = (MBeanServer) l.get(0); } } if (mBeanServer == null && createServer) { mBeanServer = MBeanServerFactory.createMBeanServer(); serverCreated.set(true); } if (mBeanServer == null) { throw new InitialisationException(ManagementMessages.cannotLocateOrCreateServer(), this); } // We need to register all the services once the server has initialised MuleContextNotificationListener l = new MuleContextNotificationListener() { public void onNotification(ServerNotification notification) { if (notification.getAction() == MuleContextNotification.CONTEXT_STARTED_MODELS) { try { registerWrapperService(); registerStatisticsService(); registerMuleService(); registerConfigurationService(); registerModelServices(); registerServiceServices(); registerEndpointServices(); registerConnectorServices(); } catch (Exception e) { throw new MuleRuntimeException(CoreMessages.objectFailedToInitialise("MBeans"), e); } } } }; if (StringUtils.isBlank(muleContext.getConfiguration().getId())) { // TODO i18n the message properly throw new IllegalArgumentException( "Manager ID is mandatory when running with JmxAgent. Give your Mule configuration a valid ID."); } try { muleContext.registerListener(l); } catch (NotificationException e) { throw new InitialisationException(e, this); } initialized.compareAndSet(false, true); } /** * {@inheritDoc} (non-Javadoc) * * @see org.mule.api.lifecycle.Startable#start() */ public void start() throws MuleException { try { logger.info("Creating and starting JMX agent connector Server"); if (connectorServerUrl != null) { JMXServiceURL url = new JMXServiceURL(connectorServerUrl); if (connectorServerProperties == null) { connectorServerProperties = new HashMap(DEFAULT_CONNECTOR_SERVER_PROPERTIES); } // TODO custom authenticator may have its own security config, // refactor if (!credentials.isEmpty()) { JMXAuthenticator jmxAuthenticator = (JMXAuthenticator)ClassUtils.instanciateClass( DEFAULT_JMX_AUTHENTICATOR, ClassUtils.NO_ARGS); // TODO support for custom authenticators ((SimplePasswordJmxAuthenticator)jmxAuthenticator).setCredentials(credentials); connectorServerProperties.put(JMXConnectorServer.AUTHENTICATOR, jmxAuthenticator); } connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, connectorServerProperties, mBeanServer); connectorServer.start(); } } catch (ExportException e) { throw new JmxManagementException(CoreMessages.failedToStart("Jmx Agent"), e); } catch (Exception e) { throw new JmxManagementException(CoreMessages.failedToStart("Jmx Agent"), e); } } public void stop() throws MuleException { if (connectorServer != null) { try { connectorServer.stop(); } catch (Exception e) { throw new JmxManagementException(CoreMessages.failedToStop("Jmx Connector"), e); } } } /** * {@inheritDoc} */ public void dispose() { if (mBeanServer != null) { for (Iterator iterator = registeredMBeans.iterator(); iterator.hasNext();) { ObjectName objectName = (ObjectName) iterator.next(); try { mBeanServer.unregisterMBean(objectName); } catch (Exception e) { logger.warn("Failed to unregister MBean: " + objectName + ". Error is: " + e.getMessage()); } } if (serverCreated.get()) { MBeanServerFactory.releaseMBeanServer(mBeanServer); } mBeanServer = null; } initialized.set(false); } /** * {@inheritDoc} */ public void registered() { // nothing to do } /** * {@inheritDoc} */ public void unregistered() { // nothing to do } /** * Register a Java Service Wrapper agent. * @throws MuleException if registration failed */ protected void registerWrapperService() throws MuleException { // WrapperManager to support restarts final WrapperManagerAgent wmAgent = new WrapperManagerAgent(); if (muleContext.getRegistry().lookupAgent(wmAgent.getName()) == null) { muleContext.getRegistry().registerAgent(wmAgent); } } protected void registerStatisticsService() throws NotCompliantMBeanException, MBeanRegistrationException, InstanceAlreadyExistsException, MalformedObjectNameException { ObjectName on = jmxSupport.getObjectName(jmxSupport.getDomainName(muleContext) + ":type=org.mule.Statistics,name=AllStatistics"); StatisticsService mBean = new StatisticsService(); mBean.setMuleContext(muleContext); mBean.setEnabled(isEnableStatistics()); logger.debug("Registering statistics with name: " + on); mBeanServer.registerMBean(mBean, on); registeredMBeans.add(on); } protected void registerModelServices() throws NotCompliantMBeanException, MBeanRegistrationException, InstanceAlreadyExistsException, MalformedObjectNameException { for (Iterator iterator = muleContext.getRegistry().lookupObjects(Model.class).iterator(); iterator.hasNext();) { Model model = (Model) iterator.next(); ModelServiceMBean serviceMBean = new ModelService(model); String rawName = serviceMBean.getName() + "(" + serviceMBean.getType() + ")"; String name = jmxSupport.escape(rawName); ObjectName on = jmxSupport.getObjectName(jmxSupport.getDomainName(muleContext) + ":type=org.mule.Model,name=" + name); logger.debug("Registering model with name: " + on); mBeanServer.registerMBean(serviceMBean, on); registeredMBeans.add(on); } } protected void registerMuleService() throws NotCompliantMBeanException, MBeanRegistrationException, InstanceAlreadyExistsException, MalformedObjectNameException { ObjectName on = jmxSupport.getObjectName(jmxSupport.getDomainName(muleContext) + ":type=org.mule.MuleContext,name=MuleServerInfo"); MuleServiceMBean serviceMBean = new MuleService(muleContext); logger.debug("Registering mule with name: " + on); mBeanServer.registerMBean(serviceMBean, on); registeredMBeans.add(on); } protected void registerConfigurationService() throws NotCompliantMBeanException, MBeanRegistrationException, InstanceAlreadyExistsException, MalformedObjectNameException { ObjectName on = jmxSupport.getObjectName(jmxSupport.getDomainName(muleContext) + ":type=org.mule.Configuration,name=GlobalConfiguration"); MuleConfigurationServiceMBean serviceMBean = new MuleConfigurationService(RegistryContext.getConfiguration()); logger.debug("Registering configuration with name: " + on); mBeanServer.registerMBean(serviceMBean, on); registeredMBeans.add(on); } protected void registerServiceServices() throws NotCompliantMBeanException, MBeanRegistrationException, InstanceAlreadyExistsException, MalformedObjectNameException { String rawName; for (Iterator iterator = muleContext.getRegistry().lookupObjects(Service.class).iterator(); iterator.hasNext();) { rawName = ((Service) iterator.next()).getName(); final String name = jmxSupport.escape(rawName); ObjectName on = jmxSupport.getObjectName(jmxSupport.getDomainName(muleContext) + ":type=org.mule.Service,name=" + name); ServiceServiceMBean serviceMBean = new ServiceService(rawName); logger.debug("Registering service with name: " + on); mBeanServer.registerMBean(serviceMBean, on); registeredMBeans.add(on); } } protected void registerEndpointServices() throws NotCompliantMBeanException, MBeanRegistrationException, InstanceAlreadyExistsException, MalformedObjectNameException { Iterator iter = muleContext.getRegistry().lookupObjects(Connector.class).iterator(); Connector connector; while (iter.hasNext()) { connector = (Connector) iter.next(); if (connector instanceof AbstractConnector) { for (Iterator iterator = ((AbstractConnector) connector).getReceivers().values().iterator(); iterator.hasNext();) { EndpointServiceMBean mBean = new EndpointService((MessageReceiver) iterator.next()); final String rawName = mBean.getName(); final String name = jmxSupport.escape(rawName); if (logger.isInfoEnabled()) { logger.info("Attempting to register service with name: " + jmxSupport.getDomainName(muleContext) + ":type=org.mule.Endpoint,service=" + jmxSupport.escape(mBean.getComponentName()) + ",name=" + name); } ObjectName on = jmxSupport.getObjectName( jmxSupport.getDomainName(muleContext) + ":type=org.mule.Endpoint,service=" + jmxSupport.escape(mBean.getComponentName()) + ",name=" + name); mBeanServer.registerMBean(mBean, on); registeredMBeans.add(on); logger.info("Registered Endpoint Service with name: " + on); } } else { logger.warn("Connector: " + connector + " is not an istance of AbstractConnector, cannot obtain Endpoint MBeans from it"); } } } protected void registerConnectorServices() throws MalformedObjectNameException, NotCompliantMBeanException, MBeanRegistrationException, InstanceAlreadyExistsException { Iterator iter = muleContext.getRegistry().lookupObjects(Connector.class).iterator(); while (iter.hasNext()) { Connector connector = (Connector) iter.next(); ConnectorServiceMBean mBean = new ConnectorService(connector); final String rawName = mBean.getName(); final String name = jmxSupport.escape(rawName); final String stringName = jmxSupport.getDomainName(muleContext) + ":type=org.mule.Connector,name=" + name; if (logger.isDebugEnabled()) { logger.debug("Attempting to register service with name: " + stringName); } ObjectName oName = jmxSupport.getObjectName(stringName); mBeanServer.registerMBean(mBean, oName); registeredMBeans.add(oName); logger.info("Registered Connector Service with name " + oName); } } /** * @return Returns the createServer. */ public boolean isCreateServer() { return createServer; } /** * @param createServer The createServer to set. */ public void setCreateServer(boolean createServer) { this.createServer = createServer; } /** * @return Returns the locateServer. */ public boolean isLocateServer() { return locateServer; } /** * @param locateServer The locateServer to set. */ public void setLocateServer(boolean locateServer) { this.locateServer = locateServer; } /** * @return Returns the connectorServerUrl. */ public String getConnectorServerUrl() { return connectorServerUrl; } /** * @param connectorServerUrl The connectorServerUrl to set. */ public void setConnectorServerUrl(String connectorServerUrl) { this.connectorServerUrl = connectorServerUrl; } /** * @return Returns the enableStatistics. */ public boolean isEnableStatistics() { return enableStatistics; } /** * @param enableStatistics The enableStatistics to set. */ public void setEnableStatistics(boolean enableStatistics) { this.enableStatistics = enableStatistics; } /** * @return Returns the mBeanServer. */ public MBeanServer getMBeanServer() { return mBeanServer; } /** * @param mBeanServer The mBeanServer to set. */ public void setMBeanServer(MBeanServer mBeanServer) { this.mBeanServer = mBeanServer; } /** * Getter for property 'connectorServerProperties'. * * @return Value for property 'connectorServerProperties'. */ public Map getConnectorServerProperties() { return connectorServerProperties; } /** * Setter for property 'connectorServerProperties'. Set to {@code null} to use defaults ({@link * #DEFAULT_CONNECTOR_SERVER_PROPERTIES}). Pass in an empty map to use no parameters. Passing a non-empty map will * replace defaults. * * @param connectorServerProperties Value to set for property 'connectorServerProperties'. */ public void setConnectorServerProperties(Map connectorServerProperties) { this.connectorServerProperties = connectorServerProperties; } /** * Getter for property 'jmxSupportFactory'. * * @return Value for property 'jmxSupportFactory'. */ public JmxSupportFactory getJmxSupportFactory() { return jmxSupportFactory; } /** * Setter for property 'jmxSupportFactory'. * * @param jmxSupportFactory Value to set for property 'jmxSupportFactory'. */ public void setJmxSupportFactory(JmxSupportFactory jmxSupportFactory) { this.jmxSupportFactory = jmxSupportFactory; } /** * Setter for property 'credentials'. * * @param newCredentials Value to set for property 'credentials'. */ public void setCredentials(final Map newCredentials) { this.credentials.clear(); if (newCredentials != null && !newCredentials.isEmpty()) { this.credentials.putAll(newCredentials); } } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/IBMSslAdapterServerSocketFactory.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/IBMSslAdapterServerSock0000644000175000017500000002475210764100742033307 0ustar charlescharles/* * $Id: IBMSslAdapterServerSocketFactory.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import org.mule.api.security.provider.AutoDiscoverySecurityProviderFactory; import org.mule.api.security.provider.SecurityProviderFactory; import org.mule.api.security.provider.SecurityProviderInfo; import org.mule.util.FileUtils; import org.mule.util.IOUtils; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.net.InetAddress; import java.net.ServerSocket; import java.security.KeyStore; import java.security.Security; import java.security.UnrecoverableKeyException; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLServerSocket; import javax.net.ssl.SSLServerSocketFactory; import javax.net.ssl.TrustManagerFactory; import mx4j.log.Log; import mx4j.log.Logger; import mx4j.tools.adaptor.ssl.SSLAdaptorServerSocketFactoryMBean; /** * This MBean creates SSLServerSocket instances. *

    * It can be configured to use a specific keystore and SSL protocol version to create * SSLServerSockets that will use the keystore information to encrypt data.
    *

    A keystore can be created with this command: * *

     *  keytool -genkey -v -keystore store.key -storepass storepwd -keypass keypwd -dname "CN=Simone Bordet, OU=Project Administrator, O=MX4J, L=Torino, S=TO, C=IT" -validity 365
     * 
    * * or with this minimal command (that will prompt you for further information): * *
     *  keytool -genkey -keystore store.key
     * 
    * *

    A keystore may contains more than one entry, but only the first entry will be * used for encryption, no matter which is the alias for that entry.

    Following * the first example of generation of the keystore, this MBean must be instantiated * and then setup by invoking the following methods: *

      *
    • {@link #setKeyStoreName}("store.key"); *
    • {@link #setKeyStorePassword}("storepwd"); *
    • {@link #setKeyManagerPassword}("keypwd"); *
    * before {@link #createServerSocket} is called. */ public class IBMSslAdapterServerSocketFactory implements SSLAdaptorServerSocketFactoryMBean { // it will always be IBM, anyway private SecurityProviderFactory spFactory = new AutoDiscoverySecurityProviderFactory(); private SecurityProviderInfo spInfo = spFactory.getSecurityProviderInfo(); private String m_keyStoreType = "JKS"; private String m_trustStoreType = "JKS"; private String m_keyStoreName; private String m_trustStoreName; private String m_keyStorePassword; private String m_trustStorePassword; private String m_keyManagerAlgorithm = spInfo.getKeyManagerAlgorithm(); // the same? private String m_trustManagerAlgorithm = spInfo.getKeyManagerAlgorithm(); private String m_keyManagerPassword; // IMPORTANT Sun-specific version works with TLS protocol, // but fails in Internet Explorer and IBM-specific provider. // SSL works fine though private String m_sslProtocol = "SSL"; public IBMSslAdapterServerSocketFactory() { Security.addProvider(spFactory.getProvider()); } public void setKeyStoreType(String keyStoreType) { if (keyStoreType == null || keyStoreType.trim().length() == 0) { throw new IllegalArgumentException("Invalid KeyStore type"); } m_keyStoreType = keyStoreType; } public void setTrustStoreType(String trustStoreType) { if (trustStoreType == null || trustStoreType.trim().length() == 0) { throw new IllegalArgumentException("Invalid TrustStore type"); } m_trustStoreType = trustStoreType; } public void setKeyStoreName(String name) { if (name == null || name.trim().length() == 0) { throw new IllegalArgumentException("Invalid KeyStore name"); } m_keyStoreName = name; } public void setTrustStoreName(String name) { if (name == null || name.trim().length() == 0) { throw new IllegalArgumentException("Invalid TrustStore name"); } m_trustStoreName = name; } public void setKeyStorePassword(String password) { if (password == null || password.trim().length() == 0) { throw new IllegalArgumentException("Invalid KeyStore password"); } m_keyStorePassword = password; } public void setTrustStorePassword(String password) { if (password == null || password.trim().length() == 0) { throw new IllegalArgumentException("Invalid TrustStore password"); } m_trustStorePassword = password; } public void setKeyManagerAlgorithm(String algorithm) { if (algorithm == null || algorithm.trim().length() == 0) { throw new IllegalArgumentException("Invalid KeyManager algorithm"); } m_keyManagerAlgorithm = algorithm; } public void setTrustManagerAlgorithm(String algorithm) { if (algorithm == null || algorithm.trim().length() == 0) { throw new IllegalArgumentException("Invalid TrustManager algorithm"); } m_trustManagerAlgorithm = algorithm; } public void setKeyManagerPassword(String password) { if (password == null || password.trim().length() == 0) { throw new IllegalArgumentException("Invalid KeyManager password"); } m_keyManagerPassword = password; } public void setSSLProtocol(String protocol) { if (protocol == null || protocol.trim().length() == 0) { throw new IllegalArgumentException("Invalid SSL protocol"); } m_sslProtocol = protocol; } /** * Returns a SSLServerSocket on the given port. */ public ServerSocket createServerSocket(int port, int backlog, String host) throws IOException { if (m_keyStoreName == null) { throw new IOException("KeyStore file name cannot be null"); } if (m_keyStorePassword == null) { throw new IOException("KeyStore password cannot be null"); } Logger logger = getLogger(); if (logger.isEnabledFor(Logger.TRACE)) { logger.trace("Creating SSLServerSocket"); logger.trace("\tKeyStore " + m_keyStoreName + ", type " + m_keyStoreType); logger.trace("\tKeyManager algorithm is " + m_keyManagerAlgorithm); logger.trace("\tTrustStore " + m_trustStoreName + ", type " + m_trustStoreType); logger.trace("\tTrustManager algorithm is " + m_trustManagerAlgorithm); logger.trace("\tSSL protocol version is " + m_sslProtocol); } try { KeyStore keystore = KeyStore.getInstance(m_keyStoreType); InputStream keyStoreStream = IOUtils.getResourceAsStream(m_keyStoreName, getClass()); // Must check for nullity, otherwise a new empty keystore is created by // KeyStore.load if (keyStoreStream == null) { // Let's look at the file system, maybe that the name provided is in // fact a file path File fle = FileUtils.newFile(m_keyStoreName); if (fle.exists()) keyStoreStream = new FileInputStream(fle); } if (keyStoreStream == null) throw new IOException("Cannot find KeyStore " + m_keyStoreName); keystore.load(keyStoreStream, m_keyStorePassword.toCharArray()); try { keyStoreStream.close(); } catch (IOException x) { // ignore } KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(m_keyManagerAlgorithm); // Use the keystore password as default if not given keyFactory.init(keystore, m_keyManagerPassword == null ? m_keyStorePassword.toCharArray() : m_keyManagerPassword.toCharArray()); TrustManagerFactory trustFactory = null; if (m_trustStoreName != null) { // User specified a trust store, retrieve it if (m_trustStorePassword == null) { throw new IOException("TrustStore password cannot be null"); } KeyStore trustStore = KeyStore.getInstance(m_trustStoreType); InputStream trustStoreStream = IOUtils.getResourceAsStream(m_trustStoreName, getClass()); // Check for nullity if (trustStoreStream == null) { throw new IOException("Cannot find TrustStore " + m_trustStoreName); } trustStore.load(trustStoreStream, m_trustStorePassword.toCharArray()); trustFactory = TrustManagerFactory.getInstance(m_trustManagerAlgorithm); trustFactory.init(trustStore); } SSLContext context = SSLContext.getInstance(m_sslProtocol); // Below call does not handle TrustManagers, needed when server must // authenticate clients. context.init(keyFactory.getKeyManagers(), trustFactory == null ? null : trustFactory.getTrustManagers(), null); SSLServerSocketFactory ssf = context.getServerSocketFactory(); SSLServerSocket serverSocket = (SSLServerSocket)ssf.createServerSocket(port, backlog, InetAddress.getByName(host)); return serverSocket; } catch (IOException x) { logger.error("", x); throw x; } catch (UnrecoverableKeyException x) { // Wrong password for the key logger.error("Probably a bad key password", x); throw new IOException("Probably a bad key password: " + x.toString()); } catch (Exception x) { logger.error("Unexpected exception", x); throw new IOException(x.toString()); } } private Logger getLogger() { return Log.getLogger(getClass().getName()); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/JmxManagementException.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/JmxManagementException.0000644000175000017500000000374310764100742033373 0ustar charlescharles/* * $Id: JmxManagementException.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import org.mule.config.i18n.Message; import org.mule.module.management.ManagementException; import javax.management.ObjectName; /** * JmxManagementException is thrown by the Jmx agents if an error * occurs while executing an operation. */ public class JmxManagementException extends ManagementException { /** * Serial version */ private static final long serialVersionUID = 7912469454512394420L; private ObjectName objectName; /** * @param message the exception message */ public JmxManagementException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public JmxManagementException(Message message, Throwable cause) { super(message, cause); } /** * @param message the exception message */ public JmxManagementException(Message message, ObjectName objectName) { super(message); this.objectName = objectName; } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public JmxManagementException(Message message, ObjectName objectName, Throwable cause) { super(message, cause); this.objectName = objectName; } public JmxManagementException(Throwable cause) { super(cause); } public ObjectName getObjectName() { return objectName; } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/RmiRegistryAgent.java0000644000175000017500000001134410774254333033065 0ustar charlescharles/* * $Id: RmiRegistryAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import org.mule.AbstractAgent; import org.mule.api.MuleException; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.MessageFactory; import org.mule.util.StringUtils; import java.net.URI; import java.net.URISyntaxException; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.rmi.server.ExportException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Binds to an existing RMI registry or creates a new one on a defined URI. The * default is rmi://localhost:1099 */ public class RmiRegistryAgent extends AbstractAgent { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); public static final String DEFAULT_HOSTNAME = "localhost"; public static final int DEFAULT_PORT = 1099; private static final String PROTOCOL_PREFIX = "rmi://"; public static final String DEFAULT_SERVER_URI = PROTOCOL_PREFIX + DEFAULT_HOSTNAME + ":" + DEFAULT_PORT; private Registry rmiRegistry; private String serverUri; private String host; private String port; private boolean createRegistry = true; public RmiRegistryAgent() { super("rmi-server"); } public String getDescription() { return "Rmi Registry: " + serverUri; } public void registered() { // nothing to do } public void unregistered() { // nothing to do } public void start() throws MuleException { if (serverUri == null) { throw new InitialisationException(MessageFactory.createStaticMessage("serverUri has not been set, this agent has not been initialized properly."), this); } URI uri; try { uri = new URI(serverUri); } catch (URISyntaxException e) { throw new InitialisationException(e, this); } if (rmiRegistry == null) { try { if (createRegistry) { try { rmiRegistry = LocateRegistry.createRegistry(uri.getPort()); } catch (ExportException e) { logger.info("Registry on " + serverUri + " already bound. Attempting to use that instead"); rmiRegistry = LocateRegistry.getRegistry(uri.getHost(), uri.getPort()); } } else { rmiRegistry = LocateRegistry.getRegistry(uri.getHost(), uri.getPort()); } } catch (RemoteException e) { throw new InitialisationException(e, this); } } } public void stop() throws MuleException { // TODO how do you unbind a registry?? rmiRegistry = null; } public void dispose() { // nothing to do } public void initialise() throws InitialisationException { if (StringUtils.isBlank(serverUri)) { String theHost = StringUtils.defaultIfEmpty(host, DEFAULT_HOSTNAME); String thePort = StringUtils.defaultIfEmpty(port, String.valueOf(DEFAULT_PORT)); serverUri = PROTOCOL_PREFIX + theHost + ":" + thePort; } } public Registry getRmiRegistry() { return rmiRegistry; } public void setRmiRegistry(Registry rmiRegistry) { this.rmiRegistry = rmiRegistry; } public String getServerUri() { return serverUri; } public void setServerUri(String serverUri) { this.serverUri = serverUri; } public boolean isCreateRegistry() { return createRegistry; } public void setCreateRegistry(boolean createRegistry) { this.createRegistry = createRegistry; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public String getPort() { return port; } public void setPort(String port) { this.port = port; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/YourKitProfilerAgent.javamule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/YourKitProfilerAgent.ja0000644000175000017500000001331010774254333033362 0ustar charlescharles/* * $Id: YourKitProfilerAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import org.mule.MuleServer; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.agent.Agent; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import org.mule.module.management.i18n.ManagementMessages; import org.mule.module.management.mbean.YourKitProfilerService; import org.mule.module.management.support.AutoDiscoveryJmxSupportFactory; import org.mule.module.management.support.JmxSupport; import org.mule.module.management.support.JmxSupportFactory; import org.mule.util.ClassUtils; import java.util.Collections; import java.util.List; import javax.management.InstanceNotFoundException; import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class YourKitProfilerAgent implements Agent { /** * MBean name to register under. */ public static final String PROFILER_OBJECT_NAME = "name=Profiler"; private String name = "yourkit-profiler"; private MBeanServer mBeanServer; private ObjectName profilerName; private JmxSupportFactory jmxSupportFactory = AutoDiscoveryJmxSupportFactory.getInstance(); private JmxSupport jmxSupport = jmxSupportFactory.getJmxSupport(); /** * Logger used by this class */ protected static final Log logger = LogFactory.getLog(YourKitProfilerAgent.class); /* * (non-Javadoc) * * @see org.mule.api.context.Agent#getName() */ public String getName() { return this.name; } /* * (non-Javadoc) * * @see org.mule.api.context.Agent#setName(java.lang.String) */ public void setName(String name) { this.name = name; } /* * (non-Javadoc) * * @see org.mule.api.context.Agent#getDescription() */ public String getDescription() { return "Profiler JMX Agent"; } public List getDependentAgents() { return Collections.EMPTY_LIST; } public void initialise() throws InitialisationException { if(!isApiAvailable()) { logger.warn("Cannot find YourKit API. Profiler JMX Agent will be unregistered."); unregisterMeQuietly(); return; } final List servers = MBeanServerFactory.findMBeanServer(null); if(servers.isEmpty()) { throw new InitialisationException(ManagementMessages.noMBeanServerAvailable(), this); } try { mBeanServer = (MBeanServer) servers.get(0); MuleContext muleContext = MuleServer.getMuleContext(); profilerName = jmxSupport.getObjectName(jmxSupport.getDomainName(muleContext) + ":" + PROFILER_OBJECT_NAME); // unregister existing YourKit MBean first if required unregisterMBeansIfNecessary(); mBeanServer.registerMBean(new YourKitProfilerService(), profilerName); } catch(Exception e) { throw new InitialisationException(CoreMessages.failedToStart(this.getName()), e, this); } } /** * Unregister Profiler MBean if there are any left over the old deployment */ protected void unregisterMBeansIfNecessary() throws MalformedObjectNameException, InstanceNotFoundException, MBeanRegistrationException { if(mBeanServer == null || profilerName == null) { return; } if(mBeanServer.isRegistered(profilerName)) { mBeanServer.unregisterMBean(profilerName); } } /** * Quietly unregister ourselves. */ protected void unregisterMeQuietly() { try { // remove the agent from the list, it's not functional RegistryContext.getRegistry().unregisterAgent(this.getName()); } catch (MuleException e) { // not interested, really } } private boolean isApiAvailable() { try{ ClassUtils.getClass("com.yourkit.api.Controller"); return true; } catch(ClassNotFoundException e) { return false; } } public void start() throws MuleException { // nothing to do } public void stop() throws MuleException { // nothing to do } /* * (non-Javadoc) * * @see org.mule.api.lifecycle.Disposable#dispose() */ public void dispose() { try { unregisterMBeansIfNecessary(); } catch (Exception e) { logger.error("Couldn't unregister MBean: " + (profilerName != null ? profilerName.getCanonicalName() : "null"), e); } } /* * (non-Javadoc) * * @see org.mule.api.context.Agent#registered() */ public void registered() { // nothing to do } /* * (non-Javadoc) * * @see org.mule.api.context.Agent#unregistered() */ public void unregistered() { // nothing to do } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/JdmkAgent.java0000644000175000017500000001247110774254333031474 0ustar charlescharles/* * $Id: JdmkAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import org.mule.AbstractAgent; import org.mule.api.MuleException; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import org.mule.util.ClassUtils; import org.mule.util.StringUtils; import java.net.URI; import javax.management.InstanceNotFoundException; import javax.management.MBeanException; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.ObjectName; import javax.management.ReflectionException; /** * JdmkAgent configures an Jdmk Http Adaptor for Jmx management, * statistics and configuration viewing of a Mule instance. *

    * TODO MULE-1353 */ public class JdmkAgent extends AbstractAgent { /** A FQN of the adaptor class to instantiate via reflection. */ public static final String CLASSNAME_ADAPTER = "com.sun.jdmk.comm.HtmlAdaptorServer"; private static final String PROTOCOL_PREFIX = "http://"; public static final String DEFAULT_HOSTNAME = "localhost"; public static final int DEFAULT_PORT = 9092; public static final String DEFAULT_JMX_ADAPTOR_URL = PROTOCOL_PREFIX + DEFAULT_HOSTNAME + ":" + DEFAULT_PORT; private String jmxAdaptorUrl; private String host; private String port; private MBeanServer mBeanServer; private ObjectName adaptorName; public JdmkAgent() { super("jdmk-agent"); } protected Object createAdaptor() throws Exception { final URI uri = new URI(jmxAdaptorUrl); final int port = uri.getPort(); return ClassUtils.instanciateClass(CLASSNAME_ADAPTER, new Object[] {new Integer(port)}, this.getClass()); } public String getDescription() { return "Jdmk Http adaptor: " + jmxAdaptorUrl; } public void start() throws MuleException { try { mBeanServer.invoke(adaptorName, "start", null, null); } catch (InstanceNotFoundException e) { throw new JmxManagementException( CoreMessages.failedToStart("Jdmk agent"), adaptorName, e); } catch (MBeanException e) { throw new JmxManagementException( CoreMessages.failedToStart("Jdmk agent"), adaptorName, e); } catch (ReflectionException e) { // ignore } } public void stop() throws MuleException { if (mBeanServer == null) { return; } try { mBeanServer.invoke(adaptorName, "stop", null, null); } catch (InstanceNotFoundException e) { throw new JmxManagementException( CoreMessages.failedToStop("Jdmk agent"), adaptorName, e); } catch (MBeanException e) { throw new JmxManagementException( CoreMessages.failedToStop("Jdmk agent"), adaptorName, e); } catch (ReflectionException e) { // ignore } } public void dispose() { try { stop(); } catch (Exception e) { // TODO: log an exception } } public void registered() { // nothing to do } public void unregistered() { // nothing to do } public void initialise() throws InitialisationException { try { mBeanServer = (MBeanServer)MBeanServerFactory.findMBeanServer(null).get(0); final Object adaptor = createAdaptor(); if (StringUtils.isBlank(jmxAdaptorUrl)) { if (StringUtils.isNotBlank(host) && StringUtils.isNotBlank(port)) { jmxAdaptorUrl = PROTOCOL_PREFIX + host + ":" + port; } else { jmxAdaptorUrl = DEFAULT_JMX_ADAPTOR_URL; } } // TODO use Jmx support classes adaptorName = new ObjectName("Adaptor:class=" + adaptor.getClass().getName()); mBeanServer.registerMBean(adaptor, adaptorName); } catch (Exception e) { throw new InitialisationException(CoreMessages.failedToStart("Jdmk Agent"), e, this); } } /** * @return Returns the jmxAdaptorUrl. */ public String getJmxAdaptorUrl() { return jmxAdaptorUrl; } /** * @param jmxAdaptorUrl The jmxAdaptorUrl to set. */ public void setJmxAdaptorUrl(String jmxAdaptorUrl) { this.jmxAdaptorUrl = jmxAdaptorUrl; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public String getPort() { return port; } public void setPort(String port) { this.port = port; } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/agent/Mx4jAgent.java0000644000175000017500000002645610774254333031441 0ustar charlescharles/* * $Id: Mx4jAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management.agent; import org.mule.AbstractAgent; import org.mule.api.MuleException; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.MuleManifest; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; import org.mule.module.management.mbean.MBeanServerFactory; import org.mule.module.management.support.AutoDiscoveryJmxSupportFactory; import org.mule.module.management.support.JmxSupport; import org.mule.module.management.support.JmxSupportFactory; import org.mule.module.xml.util.XMLUtils; import org.mule.util.BeanUtils; import org.mule.util.ClassUtils; import org.mule.util.StringUtils; import org.mule.util.SystemUtils; import java.net.URI; import java.util.HashMap; import java.util.Map; import javax.management.InstanceNotFoundException; import javax.management.MBeanException; import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import javax.management.ReflectionException; import javax.xml.transform.TransformerFactoryConfigurationError; import mx4j.log.CommonsLogger; import mx4j.log.Log; import mx4j.tools.adaptor.http.HttpAdaptor; import mx4j.tools.adaptor.http.XSLTProcessor; import mx4j.tools.adaptor.ssl.SSLAdaptorServerSocketFactory; import mx4j.tools.adaptor.ssl.SSLAdaptorServerSocketFactoryMBean; import org.apache.commons.logging.LogFactory; /** * Mx4jAgent configures an Mx4J Http Adaptor for Jmx management, * statistics and configuration viewing of a Mule instance. *

    * TODO MULE-1353 */ public class Mx4jAgent extends AbstractAgent { public static final String HTTP_ADAPTER_OBJECT_NAME = "name=Mx4jHttpAdapter"; protected static final String DEFAULT_PATH_IN_JAR = StringUtils.replaceChars(ClassUtils.getPackageName(Mx4jAgent.class), '.', '/') + "/http/xsl"; private static final org.apache.commons.logging.Log logger = LogFactory.getLog(Mx4jAgent.class); private static final String PROTOCOL_PREFIX = "http://"; public static final String DEFAULT_HOSTNAME = "localhost"; public static final int DEFAULT_PORT = 9999; public static final String DEFAULT_JMX_ADAPTOR_URL = PROTOCOL_PREFIX + DEFAULT_HOSTNAME + ":" + DEFAULT_PORT; private String jmxAdaptorUrl; private String host; private String port; private HttpAdaptor adaptor; private MBeanServer mBeanServer; private ObjectName adaptorName; // Adaptor overrides private String login; private String password; private String authenticationMethod = "basic"; // TODO AH check how an embedded scenario can be handled (no mule home) private String xslFilePath = System.getProperty("mule.home") + "/lib/mule/mule-module-management-" + MuleManifest.getProductVersion() + ".jar"; private String pathInJar = DEFAULT_PATH_IN_JAR; private boolean cacheXsl = true; // SSL/TLS socket factory config private Map socketFactoryProperties = new HashMap(); private JmxSupportFactory jmxSupportFactory = AutoDiscoveryJmxSupportFactory.getInstance(); private JmxSupport jmxSupport; public Mx4jAgent() { super("jmx-mx4j-adaptor"); } protected HttpAdaptor createAdaptor() throws Exception { Log.redirectTo(new CommonsLogger()); URI uri = new URI(StringUtils.stripToEmpty(jmxAdaptorUrl)); adaptor = new HttpAdaptor(uri.getPort(), uri.getHost()); // Set the XSLT Processor with any local overrides XSLTProcessor processor; try { processor = new XSLTProcessor(); } catch (TransformerFactoryConfigurationError e) { System.setProperty("javax.xml.transform.TransformerFactory", XMLUtils.TRANSFORMER_FACTORY_JDK5); processor = new XSLTProcessor(); } if (StringUtils.isNotBlank(xslFilePath)) { processor.setFile(xslFilePath.trim()); } if (StringUtils.isNotBlank(pathInJar)) { processor.setPathInJar(pathInJar.trim()); } processor.setUseCache(cacheXsl); adaptor.setProcessor(processor); // Set endpoint authentication if required if (login != null) { adaptor.addAuthorization(login, password); adaptor.setAuthenticationMethod(authenticationMethod); } if (socketFactoryProperties != null && !socketFactoryProperties.isEmpty()) { SSLAdaptorServerSocketFactoryMBean factory; if (SystemUtils.isIbmJDK()) { factory = new IBMSslAdapterServerSocketFactory(); } else { // BEA are using Sun's JSSE, so no extra checks necessary factory = new SSLAdaptorServerSocketFactory(); } BeanUtils.populateWithoutFail(factory, socketFactoryProperties, true); adaptor.setSocketFactory(factory); } return adaptor; } public void initialise() throws InitialisationException { try { jmxSupport = jmxSupportFactory.getJmxSupport(); mBeanServer = MBeanServerFactory.getOrCreateMBeanServer(); if (StringUtils.isBlank(jmxAdaptorUrl)) { if (StringUtils.isNotBlank(host) && StringUtils.isNotBlank(port)) { jmxAdaptorUrl = PROTOCOL_PREFIX + host + ":" + port; } else { jmxAdaptorUrl = DEFAULT_JMX_ADAPTOR_URL; } } adaptor = createAdaptor(); adaptorName = jmxSupport.getObjectName(jmxSupport.getDomainName(muleContext) + ":" + HTTP_ADAPTER_OBJECT_NAME); unregisterMBeansIfNecessary(); mBeanServer.registerMBean(adaptor, adaptorName); } catch (Exception e) { throw new InitialisationException(CoreMessages.failedToStart("mx4j agent"), e, this); } } public void start() throws MuleException { if (mBeanServer == null) { throw new InitialisationException(MessageFactory.createStaticMessage("mBeanServer has not yet been created"), this); } try { mBeanServer.invoke(adaptorName, "start", null, null); } catch (InstanceNotFoundException e) { throw new JmxManagementException( CoreMessages.failedToStart("Mx4j agent"), adaptorName, e); } catch (MBeanException e) { throw new JmxManagementException( CoreMessages.failedToStart("Mx4j agent"), adaptorName, e); } catch (ReflectionException e) { // ignore } } public void stop() throws MuleException { if (mBeanServer == null) { return; } try { mBeanServer.invoke(adaptorName, "stop", null, null); } catch (InstanceNotFoundException e) { throw new JmxManagementException( CoreMessages.failedToStop("Mx4j agent"), adaptorName, e); } catch (MBeanException e) { throw new JmxManagementException( CoreMessages.failedToStop("Mx4j agent"), adaptorName, e); } catch (ReflectionException e) { // ignore } } /** * Unregister all Mx4j MBeans if there are any left over the old deployment */ protected void unregisterMBeansIfNecessary() throws MalformedObjectNameException, InstanceNotFoundException, MBeanRegistrationException { if (mBeanServer != null && mBeanServer.isRegistered(adaptorName)) { mBeanServer.unregisterMBean(adaptorName); } } /* @see org.mule.api.lifecycle.Disposable#dispose() */ public void dispose() { try { stop(); } catch (Exception e) { logger.warn("Failed to stop Mx4jAgent: " + e.getMessage()); } finally { try { unregisterMBeansIfNecessary(); } catch (Exception e) { logger.error("Couldn't unregister MBean: " + (adaptorName != null ? adaptorName.getCanonicalName() : "null"), e); } } } /* @see org.mule.api.context.Agent#registered() */ public void registered() { // nothing to do } /* @see org.mule.api.context.Agent#unregistered() */ public void unregistered() { // nothing to do } // ///////////////////////////////////////////////////////////////////////// // Getters and setters // ///////////////////////////////////////////////////////////////////////// /* @see org.mule.api.context.Agent#getDescription() */ public String getDescription() { return "MX4J Http adaptor: " + jmxAdaptorUrl; } /** @return Returns the jmxAdaptorUrl. */ public String getJmxAdaptorUrl() { return jmxAdaptorUrl; } /** @param jmxAdaptorUrl The jmxAdaptorUrl to set. */ public void setJmxAdaptorUrl(String jmxAdaptorUrl) { this.jmxAdaptorUrl = jmxAdaptorUrl; } public Map getSocketFactoryProperties() { return socketFactoryProperties; } public void setSocketFactoryProperties(Map socketFactoryProperties) { this.socketFactoryProperties = socketFactoryProperties; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getAuthenticationMethod() { return authenticationMethod; } public void setAuthenticationMethod(String authenticationMethod) { this.authenticationMethod = authenticationMethod; } public String getXslFilePath() { return xslFilePath; } public void setXslFilePath(String xslFilePath) { this.xslFilePath = xslFilePath; } public String getPathInJar() { return pathInJar; } public void setPathInJar(String pathInJar) { this.pathInJar = pathInJar; } public boolean isCacheXsl() { return cacheXsl; } public void setCacheXsl(boolean cacheXsl) { this.cacheXsl = cacheXsl; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public String getPort() { return port; } public void setPort(String port) { this.port = port; } } mule-2.0.1/modules/management/src/main/java/org/mule/module/management/ManagementException.java0000644000175000017500000000224510764100742032454 0ustar charlescharles/* * $Id: ManagementException.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.management; import org.mule.api.MuleException; import org.mule.config.i18n.Message; /** * ManagementException is a general exception thrown by management * extensions. */ public abstract class ManagementException extends MuleException { /** * @param message the exception message */ protected ManagementException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ protected ManagementException(Message message, Throwable cause) { super(message, cause); } protected ManagementException(Throwable cause) { super(cause); } } mule-2.0.1/modules/management/src/main/resources/0000755000175000017500000000000011351411161021603 5ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/META-INF/0000755000175000017500000000000011351411161022743 5ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/META-INF/MANIFEST.MF0000644000175000017500000000000010553776311024401 0ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/META-INF/spring.schemas0000644000175000017500000000014610754365306025632 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/management/2.0/mule-management.xsd=META-INF/mule-management.xsdmule-2.0.1/modules/management/src/main/resources/META-INF/spring.handlers0000644000175000017500000000016310764100742025776 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/management/2.0=org.mule.module.management.config.ManagementNamespaceHandler mule-2.0.1/modules/management/src/main/resources/META-INF/services/0000755000175000017500000000000011351411160024565 5ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351411160025354 5ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351411160026316 5ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351411160027075 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/META-INF/services/org/mule/i18n/management-messages.propertiesmule-2.0.1/modules/management/src/main/resources/META-INF/services/org/mule/i18n/management-messages0000644000175000017500000000041710717053565032763 0ustar charlescharles1=At least one of "createServer" or "locateServer" property should be set to true 2=Could not locate nor create the MBeanServer 3=An MBeanServer is required for this agent. Ensure JmxAgent was configured before this one 4=GC: Heap size {0} has been reduced to {1}, bytes;mule-2.0.1/modules/management/src/main/resources/META-INF/mule-management.xsd0000755000175000017500000002437510763321016026562 0ustar charlescharles Identifies the agent in the registry. mule-2.0.1/modules/management/src/main/resources/org/0000755000175000017500000000000011351411161022372 5ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/org/mule/0000755000175000017500000000000011351411161023334 5ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/org/mule/module/0000755000175000017500000000000011351411161024621 5ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/0000755000175000017500000000000011351411161026735 5ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/0000755000175000017500000000000011351411161030033 5ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/0000755000175000017500000000000011351411161031012 5ustar charlescharlesmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/0000755000175000017500000000000011351411162031621 5ustar charlescharles././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/stylesheet.cssmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/styleshee0000644000175000017500000001255410664630335033573 0ustar charlescharles/* * $Id: stylesheet.css 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ /* * Copyright (C) The MX4J Contributors. * All rights reserved. * * This software is distributed under the terms of the MX4J License version 1.0. * See the terms of the MX4J License in the documentation provided with this software. * Author: Carlos Quiroz * Revision: 1.2 */ body { background: #ffffff; color: #000000; font-family: tahoma,verdana,helvetica,arial,sans-serif; margin-top: 5px; margin-left: 5px; margin-right: 5px; margin-bottom: 5px; } /* Footer class */ div.footer { background: #ffffff; color: #000000; height: 25px; padding-top: 2px; padding-bottom: 2px; font-weight: bold; font-size: 14px; text-align: center; } /* Tabs styles */ td.fronttab { background: #82a5d3; color: #000000; height: 25px; padding-left: 10px; padding-right: 10px; padding-bottom: 2px; font-size: 14px; font-weight: bold; } td.backtab { background: #c0c0c0; color: #000000; height: 25px; padding-left: 10px; padding-right: 10px; padding-bottom: 2px; font-size: 14px; } a.tabs { color: #000000; text-decoration: none; font-size: 14px; } /* End of tabs styles */ /* Header styles */ td.darker { background: #808080; height: 10px; } td.topheading { background: #ffffff; color: #000000; padding-left: 10px; padding-right: 10px; font-size: 16px; font-weight: bold; } /* End of Header styles */ td.domainline { background: #778899; color: #000000; padding-left: 10px; } td.page_title { background: #82a5d3; color: #000000; height: 30px; padding-left: 10px; padding-right: 10px; padding-top: 2px; padding-bottom: 2px; font-weight: bold; font-size: 14px; } div.subtitle { font-size: 12px; } td.input_title { background: #ffffff; color: #000000; height: 30px; padding-left: 10px; padding-right: 10px; padding-top: 2px; padding-bottom: 2px; font-weight: bold; font-size: 14px; } /* Server by domain styles */ td.serverbydomain_domainline { background: #778899; color: #ffffff; height: 20px; padding-left: 10px; padding-right: 10px; font-weight: bold; font-size: 14px; } a.serverbydomain_statistics { color: #ffffff; visited: #ffffff; } tr.clearline { background: #ffffff; color: #000000; padding-left: 10px; padding-right: 10px; padding-top: 2px; padding-bottom: 2px; } tr.darkline { background: #e6e6fa; color: #000000; padding-left: 10px; padding-right: 10px; padding-top: 2px; padding-bottom: 2px; } td.serverbydomain_row { font-size: 12px; padding-left: 10px; } /* MBean section title */ td.mbeans { background: #778899; color: #ffffff; height: 20px; padding-left: 10px; padding-right: 10px; font-weight: bold; font-size: 14px; } p.darklinebottom { background: #808080; color: #000000; height: 20px; padding-left: 10px; font-weight: bold; } div.tableheader { font-weight: bold; padding-top: 2px; padding-bottom: 2px; font-size: 14px; } td.mbean_row { font-size: 12px; padding-left: 10px; } td.attributes_setall { background: #ffffff; padding-right: 10px; padding-top: 5px; padding-bottom: 5px; } /* MBean section title */ td.mbeans { background: #778899; color: #ffffff; height: 20px; padding-left: 10px; padding-right: 10px; font-weight: bold; font-size: 14px; } div.tableheader { font-weight: bold; padding-top: 2px; padding-bottom: 2px; font-size: 14px; } div.tablesubheader { font-weight: bold; padding-top: 2px; padding-bottom: 2px; font-size: 12px; } td.mbean_row { font-size: 12px; padding-left: 10px; } td.aggregationrow { font-size: 12px; padding-left: 10px; } td.constructorrow { font-size: 12px; padding-left: 10px; } td.statistics { background: #778899; color: #ffffff; height: 20px; padding-left: 10px; padding-right: 10px; font-weight: bold; font-size: 14px; white-space: nowrap; } td.statisticsrow { font-size: 12px; white-space: nowrap; padding-left: 10px; vertical-align: top; } td.statisticssubrow { font-size: 12px; } td.attributes_setall { background: #ffffff; padding-right: 10px; padding-top: 5px; padding-bottom: 5px; } tr.about { background: #ffffff; } h1.about { padding-left: 20px; padding-right: 20px; padding-top: 20px; padding-bottom: 20px; font-size: 18px; background: #ffffff; color: #000000; } h2.about { padding-left: 20px; padding-right: 20px; padding-top: 15px; padding-bottom: 15px; font-size: 16px; background: #ffffff; color: #000000; } h3.about { padding-left: 20px; padding-right: 20px; padding-top: 15px; padding-bottom: 15px; font-size: 14px; background: #ffffff; color: #000000; } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/identity.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/identity.0000644000175000017500000000200710664630335033465 0ustar charlescharles ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/timer_create.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/timer_cre0000644000175000017500000000726710664630335033544 0ustar charlescharles stylesheet.css text/css timer_create.title timer_create.operation.mbeanview
    timer_create.operation.title
    timer_create.operation.success timer_create.operation.error
    timer
    ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/mule-ext.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/mule-ext.0000644000175000017500000001431011005745371033371 0ustar charlescharles No configuration available No configuration available No configuration available No configuration available No configuration available No configuration available No configuration available No configuration available No configuration available No configuration available No configuration available No configuration available No configuration available ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/delete.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/delete.xs0000644000175000017500000000615310664630335033457 0ustar charlescharles stylesheet.css text/css delete.title
    delete.operation.title
    delete.operation.success delete.operation.error
    mbean
    ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/relation.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/relation.0000644000175000017500000001745610664630335033467 0ustar charlescharles stylesheet.css text/css relation.title
    relation.typename.title
    relation.metadata.title
    relation.relationids.title
    darkline clearline
    relation.rolename.title relation.classname.title
    relation.description.title relation.mindegree.title
    relation.maxdegree.title relation.readable.title relation.writable.title
    darkline clearline
    relation
    relation.inprogress
    ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/setattribute.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/setattrib0000644000175000017500000000775010664630335033571 0ustar charlescharles stylesheet.css text/css setattribute.title darkline clearline
    setattribute.operation.title
    setattribute.operation.success setattribute.operation.error
    mbean
    ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/setattributes.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/setattrib0000644000175000017500000001045710664630335033567 0ustar charlescharles stylesheet.css text/css setattributes.title darkline clearline
    setattributes.operation.title
    setattributes.operation.success
    setattributes.operation.error
    mbean
    ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/mbean.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/mbean.xsl0000644000175000017500000004361410664630335033456 0ustar charlescharles stylesheet.css text/css mbean.title

    true false true true false mbean.parameters.unknown
    mbean.operations.title
    mbean.operations.invoke clearline darkline true false
    mbean.operations.name
    mbean.operations.returntype
    mbean.operations.description
    mbean.operations.parameter
    mbean.operations.parameterid mbean.operations.parametername mbean.operations.parameterdescription mbean.operations.parameterclass
    clearline darkline
    mbean.constructors.class
    mbean.constructors.description
    mbean.constructors.parameter
    mbean.constructors.parameterid mbean.constructors.parametername mbean.constructors.parameterdescription mbean.constructors.parameterclass
    mbean.constructors.objectname
    mbean.constructors.create
    mbean
    mbean.mbean.title
    mbean.mbean.attributes
    mbean.mbean.constructors
    ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/favicon.icomule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/favicon.i0000644000175000017500000006117610570062154033440 0ustar charlescharles 00h ( 00 h^"00 %'  nM h^(0`pxx~x~xx耇猈w~猈xx臇xxx~xx燇莇xxxwx~xȇw~xxxxwxxȇ猎猈xxx~xxx~x~燇x~xx~~xxx~~xxx爀qy99?9?9?9?1?8?( @xp莈舎xxxx燌猎xxxxx~~xxxx~x~xwxȎ舎wxxxx~??????( pxp~xxzzx(0`       %%%(&(*)*757???EDDIIINMNSQSYWX]\]fefiiimmmpopqpqtstwwwέzή|Ю}Ѱ~ճѱԲӴԴҴյضնָֹظغټֻܾٽܾپšÜĞŜơ˳ǡɢʧ̦˪̪ͭϮѲӷӳԵպֺؽF%9N$DNXc?DN922G2%2S222XI9[22X2?NW%`%2NBGS2%N2??D?2e$B==992$%=?=%2^$$288/N$$XD8$$282%X?$$2%$$2%22%P[#$$$$$$XX%2?$D2$$"$$"#D%2=$?J$$"$""$92$%X2$2JF?DJSU%$$$"$$$9%$$$2$$$$$$$$$$$22$$$"$"$"9d$$$$$$$$$$$$$$$$$$$$"$"""#=9$$$$$$"$""""$"$$$$$$$""""$3$$$$$""""""""""$$$"$""""""$$$"""$""$""""""""""""$""""""$#$$$$$"""###"""""""""$"""""$$$$"""""####"####"""""""####X$$"$"""###########"#######"=H[2$$$""""#####"##########"##3YU%$2WG$$$"$"######"##3#"#"######=`V$$$$%2VU$$$$"""""##"/H[YE=938=E`5$$$$$$$$$"$$""###"@$$"$$$$$"$$"""##3`G$$$$$$"$"$""#8Y#$""$"$"$""3HX##$""$"$#H^#$"$#BUD$$3U^93#Da9U[XPaqy99?9?9?9?1?8?( @  %#%%$%*(*,*,0.0424>=>JIIPOPRQQVUVYYY]\]`_`dbdihirqqutuέ{έ|Ю{Ю}Ѱ~ұԳӴԵԶոֹٻ׺ٽڿšžĞǣʹȣɦʩ̩̬ЮгвӶԷӶ׽H &&4J&;AA/&/4;F,&//,A,& D/;&I; F4A5;&;&&&D,4; .;++;85  ,5/A>  ;,-,GA/+F&A& 44 DFC49D ;9 4,0,;4&;F4??????(  1/1202RQRZYZ```lllyyyέ{ή|Я~ѱӳԶոڽ›šĤȦίΰϰбѴԺռؾ#$ ""  zzx(0` %ٻ޾TܽRśLέ ۿ۾dۿdŝS˩ۿ عĜƠȦݾЮ|ڹͬ8şϯ}ػĝkջzյ۾ˢ]ӳصںܿƟ$ʦJַճٿM˨NӲڿȤQԴЯ|ֵVȠҰѰ7Ȣ[ұȣŞڼֶ˫0zؾа~ұ~ț$ǣǠԲ˩rʪٺĝÜ ʣЮ|ěXͱѰ}şsӸSմܿĠвڼٽ ƝҰ~ۿLӵoЯ|ڼڿ ٽ9Ҳմؿɦںعھھ"׸ӲE҆Ϯ{׹Ü8ոӴß׽ִԵػ)˪6ӳϮ|\ɫiѯ}յ۾›)ոԵȤ"̬jЯ}ӱϮ^ٽlȤϯ|Ϯ|ٹfкNӱԲٽͬGԴѱ̬_ۿϮ|έ{նԵέ{Ϯ|ָrʹ9ӱҰ~ٻWֶѰ~Úڽظέ{έ{ԴЯ~έ{Ϯ|׶Ǥ?lѰ}׷.?ӳЮ|ڻԶʧϯ}Ϯ|έ{έ{Ϯ{ή|Ϯ|ÞչǠϮ|ַ1׹'Դέ{ַÝ^Ӳή{Ϯ|έ{Ϯ|Ϯ|έ|Ѱ~ھ^عέ{մ8ַ!Գέ{նӵбֹ#ֹҳ׺ ֺέ{έ{ϭ{έ{έ{έ{ϭ{׷ؼ5ȷ<ֵή|ϯ|̬mԴϭ|Ѱ~ܻٶշ׸ۺŚڽšYع+Þjӱ~Ϯ|Ϯ|Ϯ|έ{ή|Ϯ|έ{ԳոƭsϭzϮ|ή|Я|Ѱ~ϭ{Ϯ|Ϯ|ή|ή|ή|έ{Ϯ|έ{Ϯ{Я|մҰϮ|Ϯ|ή|ή|έ{ή|ή|ή|Ҳlٵέ{Ϯ|Ϯ|Ϯ|ή|ϭ{Ϯ|ή|Ϯ|ή|Ϯ|ϭ{ή|Ϯ|Ϯ|Ϯ|Ϯ|έ{Ϯ|ή|Ϯ|ή|έ{ή|Ϯ|ή|ն׻*׶Ϯ|Ϯ|ή|Ϯ|Ϯ|έ{ή|ή|Ϯ|ή|Ϯ|έ{Ϯ|ή|Ϯ|ή|Ϯ|έ{Ϯ|Ϯ|Ϯ|Ϯ|έ{ή|Ϯ|ϭ|ѱֹU˲iϭ{Ϯ|Ϯ|ή|ή|Ϯ|έ{ή|Ϯ|ή|ή|Ϯ|ϭ{ή|Ϯ|Ϯ|ή|ή|έ{Ϯ|Ϯ|Ϯ|Ϯ|έ{ή|ή|Ϯ|ϯ|Ěf644 жlέ{έ{έ{έ{ϭ{έ{έ{ϭ{έ{ϭ{έ{ϭ{έ{ϭ{έ{έ{έ{ϭ{έ{έ{έ{ϭ{ϭ{έ{έ{ϭ{ϭ{Я}ո{˫}KѰ}Ϯ|Ϯ|ή|ή|Ϯ|έ{Ϯ|Ϯ|Ϯ|Ϯ|Ϯ|έ{Ϯ|Ϯ|Ϯ|Ϯ|Ϯ|ϭ{Ϯ|Ϯ|Ϯ|Ϯ|έ{ή|Ϯ|έ|Я}նwڽqέzϮ|ή|ή|ή|Ϯ|έ{ή|Ϯ|ή|ή|ή|έ{Ϯ|Ϯ|Ϯ|ή|Ϯ|ϭ{Ϯ|ή|ή|Ϯ|ϭ{ή|ή|Ϯ|Я}׽d~Ҷʧέ{Ϯ|ή|Ϯ|ή|ή|έ{ή|Ϯ|ή|Ϯ|ή|ϭ{Ϯ|Ϯ|Ϯ|ή|ή|ϭ{ή|Ϯ|ή|Ϯ|ϭ{Ϯ|Ϯ|έ{ַ/:ĩӳȰaѴǢ[Գή|Ϯ|ή|Ϯ|Ϯ|ή|έ{ή|Ϯ|Ϯ|ή|ή|έ{Ϯ|Ϯ|Ϯ|Ϯ|Ϯ|ϭ{Ϯ|Ϯ|Ϯ|Ϯ|ϭ{Ϯ|έ{ӳ˜˲ؽЯ|έ{ӲěĞ@ơ%ո ׻!ڽέ{ή|Ϯ|ή|Ϯ|ή|ή|έ{ή|Ϯ|Ϯ|ή|έ{Ю|ѯ~Ѱ}ѯ~Ϯ{ϭ{ϭ{ή|Ϯ|Ϯ|ή|έ{Ю}ַά׹ ȡέ{έ{έ{Ϯ|Ұ}յƟ›Я}έ{έ{ϭ{έ{έ{ϭ{ϭ{έ{ϭ{έ{έ{Ѱ~šϯjڿ`Ͱy۾ں׶״ִںػ˨ɧ3ʬLطή|Ϯ|έ{Ϯ|Ϯ|ϭ{ϭzή|ϭ{ή|Ϯ|Ϯ|Ϯ|Ϯ|Ϯ|έ{ή|ή{ٻ̧nƢȧʬؽ;ҳ;Ӵ;̫*շٽʨtЯ|ή|έ{Ϯ|Ϯ|ή|ή|Ϯ|ϭ{Ϯ|Ϯ|ή|Ϯ|Ϯ|Ϯ|ή|մѳΰָ ۿϮ|ϭ{ή|ή|Ϯ|Ϯ|Ϯ|ϭ{Ϯ|ή|Ϯ|ή|ϭ{յǞƞ%շӸbѰ}έ{ή{Ϯ|Ϯ|Ϯ|ή|ϭ{Ϯ|ϭ|έ|Գ™ţ?ոոЮѱέ{έ{έ{έ{έ{έ{ϭ{Ѱŝή\ڿĞѱЯ}ή|έ{Ϯ|Ѱ~ٹƟЯRۿٺϮ|ϭ{ӴÜEػ(ٽɦַѰұǡ}ֺ̫ܼӵӴɥơȧIϲ̪”̬)ǣԲǡ*p??( @ ܾ,ܿ7Ȣۿ6@Ǣëۿ% ;ܿRƟ)ƟЯ}śxǢ~ѰĞBFӲٹֹմָھڿֶɥbvջxұȟ%ȣf׸ÝʦYغšڽrk` §յھzÝ+ӲHɣYַھٽնټ~¬׸ٻ"ӵPټlҲʧ)ɦ4Ѱ~ٹշֶŠ(ӳşڿϮ|ܿٻή|Եַ׹ѳ6ӳٻۿӲέ|ұέ{Я}ÜcԳɤœ ұյָٻή{έ{έ{έ{ԵֺDzOϮ|(ҲҲԵ:ֹP׹Jھ4նԵš\Ю|Ϯ|ϭ{ή|ϭ|ٽʮϮ|ϯ}׹Ю|Ϯ|ӲЮ{ѯ|ӲԵַӳϮ|Ϯ|έ{ή|ή|ѱfęέ|Ϯ|έ{Ϯ|ή|ή|ϭ{Ϯ|ή|Ϯ|ϭ{Ϯ|ή|Ϯ|έ{ή|ή|׹>Ϯ{ϭ{έ{έ{έ{έ{έ{ϭ{έ{ϭ{έ{έ{έ{ϭ{ϭ{ϭ{έ{ϭ|ҳĩAϮ|Ϯ|ή|ϭ{Ϯ|Ϯ|Ϯ|ϭ{Ϯ|Ϯ|Ϯ|ϭ{Ϯ|Ϯ|Ϯ|ϭ{ή|Ϯ|׸ß гCϮ{Ϯ|ή|ϭ{ή|Ϯ|ή|έ{Ϯ|Ϯ|Ϯ|ϭ{Ϯ|Ϯ|Ϯ|ϭ{ή|Ϯ|Ӵ׽w`&̯›έ{Ϯ|ή|έ{ή|Ϯ|ή|έ{Ϯ|Ϯ|Ϯ|έ{Ϯ|ή|Ϯ|ϭ{Ϯ|Ϯ|ٽعԴֻ׽%ո ؾ=ӳέ{ϭ{ϭ{έ{έ{έ{έ{ϭ{Ю}Я}Ю|έ{ϭ{ϭ{ϭ{έ{Я~ػğ&մή|Ϯ|Ѱ~غշέ{ή|Ϯ|ή|ϭ{ή|ή|ѰĝÝSؼ@UÝĝֶٻƠPոȤrϮ|έ{Ϯ|Ϯ|Ϯ|ϭ{Ϯ|Ϯ|Ϯ|ϭ{Ϯ|ʦEָۿϭ{ή|Ϯ|Ϯ|ϭ{Ϯ|Ϯ|Ϯ{غÙRֹğJԵέ{έ{έ{έ{ϭ{׹ɣ{ֹȤϮ|έ{ԴغĝdšڼЯ}ڽٽǢfͪټɦ&ǡ.ͮ{ƞ=????????(  @۽ ˜ۿ ›/+* jٻ™ۿ:$ټš%ٽ|iԹĝLؼۿټ><>vna ̴wھjػշÜtӳūxşuյغ8Я}Ϯ|ָlaR̯׺ѰӳննtӴϮ|ή|ӴUx_ҳέ{ή|έ{ή|έ{ή|ϭ{ή|Զj^UHx!Ϯ{ή|Ϯ|Ϯ|Ϯ|Ϯ|Ϯ|Ϯ|Ϯ|׻zrFkū ոpέ{έ{ή|έ{Ϯ|Ϯ|Ϯ|ϭ{ӳ׹1ۿdϮ|ұаϮ|Ϯ|Ҳٽz׻%ټ8׸b׹Zػ׺׹έ{ϭ{Ѱغ׻ZҲָpھʧpÛQpxxp././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/about.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/about.xsl0000644000175000017500000002031410664630335033476 0ustar charlescharles stylesheet.css text/css about.title
    about
    about.main.title

    about.main.mule.version
    about.main.mule.title

    about.main.mx4j.url about.main.mx4j.title MX4J

    about.main.jmx.url about.main.jmx.title JMX

    about.main.implementation

    about.main.implementationversion

    about.main.serverid

    ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/viewcollection.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/viewcolle0000644000175000017500000001466410664630335033563 0ustar charlescharles stylesheet.css text/css viewcollection.title 30 0 mbean clearline darkline getattribute?objectname= &attribute= &format=collection&template=viewcollection&locale= viewcollection.main
    viewcollection.main.title
    viewcollection.main.viewcollectiontitle
    viewcollection.main.index
    viewcollection.main.value
    viewcollection.main.valueclass
    ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/server.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/server.xs0000644000175000017500000000747010664630335033526 0ustar charlescharles stylesheet.css text/css server.title darkline clearline server.unregister server
    server.mbeans.title
    server.filter.title
    ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/common.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/common.xs0000644000175000017500000004312210664630335033502 0ustar charlescharles en <xsl:call-template name="str"> <xsl:with-param name="id"> <xsl:value-of select="$head.title"/> </xsl:with-param> <xsl:with-param name="p0"> <xsl:call-template name="productDescription"/> </xsl:with-param> </xsl:call-template>

    common.subtitle
    common.logo.gif common.logo.width common.logo.height {$str.logo}

     
    fronttab backtab fronttab backtab fronttab backtab fronttab backtab fronttab backtab fronttab backtab fronttab backtab fronttab backtab
    common.tabs.serverview common.tabs.serverview common.tabs.mbeanview common.tabs.timerview common.tabs.monitorview common.tabs.relationview common.tabs.mletview common.tabs.statisticsview common.tabs.about
    common.serverview.return 1 common.mbeanview.return common true false true false - - - {0} {1}
    ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/viewmap.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/viewmap.x0000644000175000017500000001577710664630335033516 0ustar charlescharles stylesheet.css text/css viewmap.title 30 0 mbean clearline darkline getattribute?objectname= &attribute= &format=map&template=viewmap&locale= viewmap.main
    viewmap.main.title
    viewmap.main.viewmaptitle
    viewmap.main.key
    viewmap.main.keyclass
    viewmap.main.value
    viewmap.main.valueclass
    ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/xalan-ext.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/xalan-ext0000644000175000017500000000274610664630335033471 0ustar charlescharles No encode function available ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/emptymbean.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/emptymbea0000644000175000017500000000614210664630335033545 0ustar charlescharles stylesheet.css text/css emptymbean.title
    mbean
    emptymbean.subtitle
    emptymbean.querycontructors emptymbean.query
    ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/mbean_attributes.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/mbean_att0000644000175000017500000004157610664630335033526 0ustar charlescharles mbean_attributes.array.view mbean_attributes.array.null mbean_attributes.collection.view mbean_attributes.collection.null mbean_attributes.map.view mbean_attributes.map.null mbean_attributes.compositedata.view mbean_attributes.compositedata.null mbean_attributes.tabulardata.view mbean_attributes.tabulardata.null none true false true false true false true mbean_attributes.form.unknowntype mbean_attributes.submit.set javax.management.ObjectName mbean_attributes.WO.readonly mbean_attributes.RO.readonly clearline darkline
    mbean_attributes.attribute.name
    mbean_attributes.attribute.description
    mbean_attributes.attribute.type
    mbean_attributes.attribute.value
    mbean_attributes.attribute.newvalue
    mbean_attributes.attribute.arrayof mbean_attributes.attribute.arrayof boolean char float double byte short int long
    mbean_attributes.attribute.setall
    mule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/mlet.xsl0000644000175000017500000000654410664630335033336 0ustar charlescharles stylesheet.css text/css mlet.title
    darkline clearline mlet.mbean.unregister mlet
    mlet.main.title
    ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/statistics.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/statistic0000644000175000017500000000723410664630335033574 0ustar charlescharles stylesheet.css text/css statistics.title
    invoke.operation.error
    invoke.operation.error.message invoke.operation.error.noresult
    statistics
    statistics.subtitle
    ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/constructors.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/construct0000644000175000017500000002623710664630335033615 0ustar charlescharles stylesheet.css text/css constructors.title constructors.parameters.title
    constructors.parameters.id constructors.parameters.type constructors.parameters.value
    true false true true false constructors.parameters.unknowntype
    darkline clearline true false
    constructors.constructors.intro
    constructors.constructors.objectnameinput
    constructors.constructors.createnew
    constructors.error.exception
    mbean
    constructors.main.title
    ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/create.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/create.xs0000644000175000017500000000650510664630335033461 0ustar charlescharles stylesheet.css text/css create.title
    create.operation.title
    create.operation.success create.operation.error
    mbean
    ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/viewarray.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/viewarray0000644000175000017500000001343510664630335033576 0ustar charlescharles stylesheet.css text/css viewarray.title 30 0 mbean clearline darkline getattribute?objectname= &attribute= &format=array&template=viewarray&locale= viewarray.main
    viewarray.main.title
    viewarray.main.arraytitle
    viewarray.main.index
    viewarray.main.value
    ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/invoke.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/invoke.xs0000644000175000017500000001242410664630335033506 0ustar charlescharles stylesheet.css text/css invoke.title
    invoke.operation.title
    invoke.operation.success invoke.operation.error
    invoke.operation.success.result invoke.operation.success.noresult invoke.operation.error.message invoke.operation.error.noresult
    mbean
    ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/timer.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/timer.xsl0000644000175000017500000001216310664630335033507 0ustar charlescharles stylesheet.css text/css timer.title timer.domain.title
    timer.domain.objectname
    darkline clearline timer.mbean.unregister timer
    timer.main.title
    timer.main.createlabel timer.main.createbutton
    ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/emptystatistics.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/emptystat0000644000175000017500000000666010664630335033621 0ustar charlescharles stylesheet.css text/css emptymbean.title
    statistics
    emptymbean.subtitle
    emptystatistics.querystatistics emptystatistics.query
    ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/serverbydomain.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/serverbyd0000644000175000017500000001575710664630335033603 0ustar charlescharles stylesheet.css text/css serverbydomain.title
    serverbydomain.error.query
    serverbydomain.domain.label serverbydomain.domain.label darkline clearline

    serverbydomain.mbean.unregister

    server serverbydomain.server.query
    serverbydomain.server.title
    serverbydomain.server.filter
    ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/strings_en.xmlmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/strings_e0000644000175000017500000003375410664630335033570 0ustar charlescharles Mule ESB and Integration Platform JMX Management Console Server view MBean view Timers Monitors Relations MLet Statistics About Return to server view Built using {0} HttpAdaptor Return to MBean view logo.png 100 50 http://mule.mulesource.org {0}: JMX Management Console - Agent View Exception during query: {0} Domain: {0} MBean By Domain: Filter: Query Unregister {0}: JMX Management Console - MBean View MBean: Query constructors for class: Query {0}: JMX Management Console - MBean View Unknown type Operations Name Return type Description Parameters id Name Description Class Invoke Class ObjectName: Description Parameters id Name Description Class Create new MBean: {0} Description {0} Attributes Constructors Name Description Type Value New Value Array of {0} Set all Read-only attribute Write-only attribute Set Unknown type View array View map View collection Array is null Map is null Collection is null {0}: JMX Management Console - MBean View MBean operation: set attributes on MBean {0} Attribute {0} set to {1} Exception during set attribute {0}, message: {1} {0}: JMX Management Console - Exception Error during request Code: {0} Message: {0} ObjectName: Create new Constructor for class {0} {0}: JMX Management Console - MBean Constructor's View Constructors for class {0} Exception: {0} Parameters id Type Value Unkown type {0}: JMX Management Console - MBean View MBean successfully created Error during MBean creation, message: {0} MBean operation: create MBean of class {0} and object name {1} {0}: JMX Management Console - MBean View MBean delete, objectname {0} MBean successfully deleted Error during MBean deletion, message: {0} {0}: JMX Management Console - Timer Service Timers By Domain: ObjectName: New timer Unregister Timers for domain: {0} ObjectName {0}: JMX Management Console - Timer Creation Timer creation with object name {0} Timer created Exception during timer creation, message: {0} Configure timer {0}: JMX Management Console - Array View MBean {0} Array attribute {0} of type {1} Index Value first previous next last {0}: JMX Management Console - Collection View MBean {0} Collection of class {0} on attribute {1} Index Value class Value first previous next last {0}: JMX Management Console - Map View MBean {0} Map of class {0} on attribute {1} Key Key class Value class Value first previous next last {0}: JMX Management Console - Monitor Service Unregister Monitors By Domain: ObjectName: New StringMonitor ObjectName: New GaugeMonitor ObjectName: New CounterMonitor {0}: JMX Management Console - Monitor Creation creation with object name {0} Monitor type {0} successfully created Exception during {0} creation, mesage: {1} Configure Monitor StringMonitor GaugeMonitor CounterMonitor {0}: JMX Management Console - MLet Service {0}: JMX Management Console - MLet Service MLet Service: (Not yet implemented) {0}: JMX Management Console - MBean View MBean operation: invoke method {0} on MBean {1} Invocation successful Result value:
    {0}
    No result Error during MBean operation invocation Message:
    {0}
    No result {0}: JMX Management Console - About About JMX Management Console: JMX Management Console http://mule.mulesource.org {0} version {1} Built using {0} HttpAdaptor http://mx4j.sourceforge.net Based on the {0} specification http://www.javasoft.com/jmx JMX Implementation: Implementation Version: MBeanServer ID: {0}: JMX Management Console - Relation Service RelationTypeName: Relation Type metaData: RelationIds: Role Name: MBeanClass: Description: Min Degree: Max Degree: Readable: Writable: relation Relation Service: (In progress) {0}: JMX Management Console - Agent View Unregister MBeans: Filter: {0}: JMX Management Console - MBean View MBean operation: set attribute {0} on MBean {1} Attribute {0} set to {1} Error during set attribute, message: {0} {0}: JMX Management Console - Statistics Domain: Query domain for statistics: Query {0}: JMX Management Console - Statistics Domain:
    ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/monitor_create.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/monitor_c0000644000175000017500000001167210664630335033557 0ustar charlescharles stylesheet.css text/css monitor_create.title monitor_create.operation.stringmonitor monitor_create.operation.gaugemonitor monitor_create.operation.countermonitor monitor_create.operation.mbeanview
    monitor_create.operation.title
    monitor_create.operation.success monitor_create.operation.error
    monitor
    mule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/logo.png0000644000175000017500000002002610570062154033274 0ustar charlescharlesPNG  IHDR[J1gAMA a pHYsodtEXtSoftwareMicrosoft Office5qIDATx^]Xڎcl11jcFh-17z5\c&Q(`AlAXPDD)‚X@ m} 4p5ؙ9;kOC@ttTeR%(&4 U|Li|,:?>0:1D#dGHs$R7W㵮%&+3lby1K_ёz_PgFY+N9nqAF^!2@|j^:[:iv1N'iEV:ĒuoEzsauX{ANw?|ll+aZm} eBuwgbWnƢtWDL%Z>V.kdMNDVnqi|1)<O%덑#̾2jJ]zu|@`wvKW?nBS MohB5ǝPwK*з17Ss=جKnc9:5kcj?|.cKOeh'-_J^+)ɀ9gb09R:&.-)?!(DÌ7٬MD+)ʱ/]Q<hr8ykK_ ؍SDw<w L.wZ{0-G\X`@/\mI kLAf@$\nY[[7<d xS9jal2ϘP\.q~sB4ϫt 3t<6S!s!Uz|9V(Eե;tC]?S$#LpmxeIƳ5o)&Q,VƟ9+v3P+.3bK&ٱ5!s|6̯\mXb3'(z+^")`bkg5=V[{`8 mٟmeVN\+'wEWXԍFݨZVd@ܬ[7uvv~*$,'Onf5y=g-F>_WOk ve=Sc1b1jԨo& О ʕ+O'}%=I:vH @ƎKFlٲU:t;h1r6GYObҥKW!6bؼ#FgҤIsŶ~ˆ ~ǘ1cyzzv`kS 5IU0gΜ-ݻwH֭IFMH-Hf-z{ރ|8GӦM 7olҫ+sIg`U3BJ3Ŝ 4 s >UA8оã5MQF4-Zȹ}% 4d 5hZCK|||)&֯iӆ{C{A xO6ifɒ%.W^퉋 興_~eqӦM)pгưkd222Wk]nXhqMg[b|LI>Zb~7HaҴYqܱ}P7y7nt=g@B/֭S_ KÇk4hI&㶱mے3goz.7H` __qbpuu2ɀsk:v00 |͇v6v`eAb[c؜6YT\bMPA^Yq?Sg"Cߞ}|fp3|@BBBx{{8qbIMiܠ1iժ1_kEl!$Bոqcq3 ]9-&JXц*$7eAkDA@M;}#̲Ͽ{w.H|z_uU+'7oՙFgh`ebaITy0u"ho"-j$D66҅BUjD$A-E4\6'<|,^8NGNHHh U#jҢ=E[jM= KLr)LxňQBӟ`79S;:]#20&bOE)U 0_ۢE ҸQj U+:+7 Fa&MpP?٣g)`ޏ۶n[ڨQ#AС 58rKJP> d|cٓM QV!?EX?Ty!2 YjYw&LԙS?'09Z穨lktGbŊӦG !D[AnQȠ{^(b8h+~\9r;w;i޽}zp T4j>oI%0-ZVYg,ް|d>D㩀'5T@f>}CVRT֬Y:1kfΜ֖.MmZ]!ŋCL|X!G.cZ)ZΙԬY3^Bۗ< { lگbsbBw"zE-H6ט 8Lme ]| 0X-"A٭K7^2 0/Oxg|1=l w,I(xu\۽kG`c =!U26)I@bb}2XMϐ$'PfG'f\5jEٜ+ 9/\S]s5֮f>h1Q;"Oc TPYHL=DGSU+AvڵmW w{g{-]V% Bf v~̨1 ȵj&Wȧr}0,3X!v-@r s밲Ů@ꤜ <'^D"crdpVskBǏH}!05>En5$Cm@(ݻu/& G^t$>?O˖-|N2Ktt` :,;|sz:"Dlc`Z) Wpx1F37fT)d2w8YTܸ^Ťc@:t*3-ԃ/Ar?)c̉>dpќT_j:'z[S2~VfU|t;)UH^uɐ8oヤE=սWѣGsAjaa=S GCU0H!8r«3^{B YJ8[Q94z^@)Ĥ2#UQHL:x`k:W,dAG!+2dá鿋չ.%߃̰FfGd@R y _wu x'GJ_Zs!yf0ǚziuR4%lAa dgS#[$}e QQQIHN;?"{ճӫѣ"yc Ppd-dT%[5V.:K˵eVC7 rמg& D4B/Y9TƑ1ٞ/ uQN4:ݺvʩ@4quYѪdXSdXZ=.&&jGvR}`;gcZyMC>ԛ,s1 %g2ib Pz+{%DR{DT>o Li2@Y!o[e 6,Ϻ×V]2B.N%c N5,\g8d$k*nq Ҭ~Z{܆Y Dm1co=R *@V+P54Tb_ae9cf0Zlf`Qyp]GZw^ ,~ȹr<)?e47?2PU&ՕypeCfd mkĺjT\\7E_Xd&R Ϟz>񿕿Xze;nP\I-xi+_AĚ:wwybMS@Ϙ1cU&QHr] 1o$Ri:pw|8k s)TTv%2\ߋ\wZ(*{]EO+T')u}~՛<&^=Lnaeqzx>o9`g\sg?pYE <ϸ<73x3ѡ +" Pe`AJ$މ{ K*h?RWqtt՗2t(5¿ ew3kd簚XIFAg1!F(EȀXEgV$L}m׾Yl-oU k$YZZay &fGDt&@Kp@Ry*{8TdE) zDb "]IdL$r0,}q{~Ӑ 1J7~g&C;Bb!/n wQ#=OGdO@xҴISP$s` 2k7a $ b{6}t~;w_xqԩo^( /e#f+!͒{" {r0s0mrSP3fB^Gn΢L D.kB`~LoD"U/ &Ukx LTx=sS~ $8XXs(t(̬c:C6CU{J<)/'EunB|J.Acx~Cރ+@SVnVV֜Ν:"85 ֟S5_}1#U7. HU+WUYF4+ ͣiBndyS! ̫{ՕbAFJn@$"Sξ2h=pJLZ^3S)2 hf:)43g*TIʩ )d~*֢i \ Șc\WZ5k6A^2BgQ:~ڴ5ݾ, \v!#_ c㌻C{й La`=y35/\06@Y,s Nı˒E ϼ}/a~i׀DHZٔ6mwؾ$9}_-X koE-qt%WYݰz vPe3@l /~W lTwwۀ2z p,C;ՙ~o4ip j stylesheet.css text/css error.title
    error.title
    error.httpexception.code
    error.httpexception.message
    ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/monitor.xslmule-2.0.1/modules/management/src/main/resources/org/mule/module/management/agent/http/xsl/monitor.x0000644000175000017500000001535710664630335033527 0ustar charlescharles stylesheet.css text/css monitor.title
    darkline clearline monitor.mbean.unregister monitor monitor.main.createstring.button monitor.main.creategauge.button monitor.main.createcounter.button
    monitor.main.title
    monitor.main.createstring.label
    monitor.main.creategauge.label
    monitor.main.createcounter.label
    mule-2.0.1/modules/management/src/test/0000755000175000017500000000000011351411157017631 5ustar charlescharlesmule-2.0.1/modules/management/src/test/java/0000755000175000017500000000000011351411156020551 5ustar charlescharlesmule-2.0.1/modules/management/src/test/java/org/0000755000175000017500000000000011351411156021340 5ustar charlescharlesmule-2.0.1/modules/management/src/test/java/org/mule/0000755000175000017500000000000011351411156022302 5ustar charlescharlesmule-2.0.1/modules/management/src/test/java/org/mule/management/0000755000175000017500000000000011351411157024417 5ustar charlescharlesmule-2.0.1/modules/management/src/test/java/org/mule/management/AbstractMuleJmxTestCase.java0000644000175000017500000000615110766637211032000 0ustar charlescharles/* * $Id: AbstractMuleJmxTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management; import org.mule.RegistryContext; import org.mule.module.management.agent.RmiRegistryAgent; import org.mule.module.management.support.AutoDiscoveryJmxSupportFactory; import org.mule.module.management.support.JmxSupport; import org.mule.module.management.support.JmxSupportFactory; import org.mule.tck.AbstractMuleTestCase; import java.util.Iterator; import java.util.List; import java.util.Set; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; import javax.management.ObjectInstance; /** * This base test case will create a new MBean Server if necessary, * and will clean up any registered MBeans in its tearDown() method. */ public abstract class AbstractMuleJmxTestCase extends AbstractMuleTestCase { protected MBeanServer mBeanServer; protected JmxSupportFactory jmxSupportFactory = AutoDiscoveryJmxSupportFactory.getInstance(); protected JmxSupport jmxSupport = jmxSupportFactory.getJmxSupport(); protected void doSetUp() throws Exception { RmiRegistryAgent rmiRegistryAgent = new RmiRegistryAgent(); rmiRegistryAgent.setMuleContext(muleContext); rmiRegistryAgent.initialise(); RegistryContext.getRegistry().registerAgent(rmiRegistryAgent); // simulate a running environment with Log4j MBean already registered List servers = MBeanServerFactory.findMBeanServer(null); if (servers.size() == 0) { MBeanServerFactory.createMBeanServer(); } mBeanServer = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0); } protected void unregisterMBeansByMask(final String mask) throws Exception { Set objectInstances = mBeanServer.queryMBeans(jmxSupport.getObjectName(mask), null); for (Iterator it = objectInstances.iterator(); it.hasNext();) { ObjectInstance instance = (ObjectInstance) it.next(); mBeanServer.unregisterMBean(instance.getObjectName()); } } protected void doTearDown() throws Exception { // Don't unregister MBean's here as ManamagmentContext disposal disposes agents which unregister // their MBeans and give errors if they can't find the MBeans they registered. // Any MBean's that are registered manually in TestCase should be unregistered in the same test case. // Release MBeanServer so MBeanServer instance can't get passed over from one // test to another in same circumstances. MBeanServerFactory.releaseMBeanServer(mBeanServer); mBeanServer = null; } public void testDummy() { // this method only exists to silence the test runner } } mule-2.0.1/modules/management/src/test/java/org/mule/management/support/0000755000175000017500000000000011351411157026133 5ustar charlescharles././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/modules/management/src/test/java/org/mule/management/support/SimplePasswordJmxAuthenticatorTestCase.javamule-2.0.1/modules/management/src/test/java/org/mule/management/support/SimplePasswordJmxAuthenticat0000644000175000017500000001173010764100742033707 0ustar charlescharles/* * $Id: SimplePasswordJmxAuthenticatorTestCase.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.support; import org.mule.module.management.support.SimplePasswordJmxAuthenticator; import org.mule.tck.AbstractMuleTestCase; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Set; import javax.management.remote.JMXPrincipal; import javax.security.auth.Subject; public class SimplePasswordJmxAuthenticatorTestCase extends AbstractMuleTestCase { private static final String[] VALID_AUTH_TOKEN = {"mule", "mulepassword"}; private SimplePasswordJmxAuthenticator authenticator; protected void doSetUp () throws Exception { super.doSetUp(); authenticator = new SimplePasswordJmxAuthenticator(); } public void testSuccessfulAuthentication() { Map credentials = getValidCredentials(); authenticator.setCredentials(credentials); Subject subject = authenticator.authenticate(VALID_AUTH_TOKEN); assertNotNull(subject); assertTrue(subject.isReadOnly()); final Set publicCredentials = subject.getPublicCredentials(); assertNotNull(publicCredentials); assertEquals(0, publicCredentials.size()); final Set privateCredentials = subject.getPrivateCredentials(); assertNotNull(privateCredentials); assertEquals(0, privateCredentials.size()); final Set principals = subject.getPrincipals(); assertNotNull(principals); assertEquals(1, principals.size()); final Object ref = principals.iterator().next(); assertTrue(ref instanceof JMXPrincipal); final JMXPrincipal jmxPrincipal = (JMXPrincipal) ref; final String name = jmxPrincipal.getName(); assertNotNull(name); assertEquals(VALID_AUTH_TOKEN[0], name); } public void testNullOrEmptyCredentialsConfigured() { final Map credentials = Collections.EMPTY_MAP; // shouldn't fail authenticator.setCredentials(credentials); try { authenticator.authenticate(VALID_AUTH_TOKEN); fail("Should've thrown an exception"); } catch (SecurityException e) { // expected } // shouldn't fail authenticator.setCredentials(null); try { authenticator.authenticate(VALID_AUTH_TOKEN); fail("Should've thrown an exception"); } catch (SecurityException e) { // expected } } public void testNullAuthToken() { try { authenticator.authenticate(null); fail("Should've thrown an exception"); } catch (SecurityException e) { // expected } } public void testInvalidAuthToken () { try { final String token = "not a String array"; authenticator.authenticate(token); fail("Should've thrown an exception"); } catch (SecurityException e) { // expected } } public void testAuthTokenTooLong() { try { final String[] token = {"token", "too", "long"}; authenticator.authenticate(token); fail("Should've thrown an exception"); } catch (SecurityException e) { // expected } } public void testAuthTokenTooShort() { try { final String[] token = {"token_too_short"}; authenticator.authenticate(token); fail("Should've thrown an exception"); } catch (SecurityException e) { // expected } } public void testNoSuchUser() { try { final String[] token = {"nosuchuser", "thepassword"}; authenticator.authenticate(token); fail("Should've thrown an exception"); } catch (SecurityException e) { // expected } } public void testInvalidPassword() { authenticator.setCredentials(getValidCredentials()); try { final String[] token = {"mule", "wrongpassword"}; authenticator.authenticate(token); fail("Should've thrown an exception"); } catch (SecurityException e) { // expected } } protected Map getValidCredentials () { final Map credentials = new HashMap(1); credentials.put(VALID_AUTH_TOKEN[0], VALID_AUTH_TOKEN[1]); return credentials; } }mule-2.0.1/modules/management/src/test/java/org/mule/management/support/JmxMissingIdTestCase.java0000644000175000017500000000424110766637211033012 0ustar charlescharles/* * $Id: JmxSupportTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.support; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextBuilder; import org.mule.config.DefaultMuleConfiguration; import org.mule.context.DefaultMuleContextBuilder; import org.mule.context.DefaultMuleContextFactory; import org.mule.module.management.agent.JmxAgent; import junit.framework.TestCase; public class JmxMissingIdTestCase extends TestCase { MuleContext muleContext; public void testContextIdAndJmxAgentIsOk() throws Exception { DefaultMuleConfiguration config = new DefaultMuleConfiguration(); config.setId("MY_SERVER"); MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder(); contextBuilder.setMuleConfiguration(config); muleContext = new DefaultMuleContextFactory().createMuleContext(contextBuilder); JmxAgent jmxAgent = new JmxAgent(); muleContext.getRegistry().registerAgent(jmxAgent); muleContext.start(); } public void testNoContextIdAndJmxAgentMustFail() throws Exception { try { DefaultMuleConfiguration config = new DefaultMuleConfiguration(); config.setId(null); MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder(); contextBuilder.setMuleConfiguration(config); muleContext = new DefaultMuleContextFactory().createMuleContext(contextBuilder); JmxAgent jmxAgent = new JmxAgent(); muleContext.getRegistry().registerAgent(jmxAgent); muleContext.start(); fail("Should have failed."); } catch (Exception e) { // this form makes code coverage happier assertTrue(true); } } } mule-2.0.1/modules/management/src/test/java/org/mule/management/support/JmxSupportTestCase.java0000644000175000017500000000754410766637211032611 0ustar charlescharles/* * $Id: JmxSupportTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.support; import org.mule.api.context.MuleContextBuilder; import org.mule.config.DefaultMuleConfiguration; import org.mule.management.AbstractMuleJmxTestCase; import org.mule.module.management.agent.JmxAgent; import org.mule.module.management.mbean.StatisticsService; import org.mule.module.management.support.JmxModernSupport; import java.util.Arrays; import java.util.List; import javax.management.ObjectName; public class JmxSupportTestCase extends AbstractMuleJmxTestCase { private final String MANAGER_ID = "Test_Instance"; private final String TEST_DOMAIN = JmxModernSupport.DEFAULT_JMX_DOMAIN_PREFIX + "." + MANAGER_ID; //@Override protected void configureMuleContext(MuleContextBuilder contextBuilder) { super.configureMuleContext(contextBuilder); DefaultMuleConfiguration config = new DefaultMuleConfiguration(); config.setId(MANAGER_ID); contextBuilder.setMuleConfiguration(config); } public void testClashingDomains() throws Exception { // pre-register the same domain to simulate a clashing domain ObjectName name = ObjectName.getInstance(TEST_DOMAIN + ":name=TestDuplicates"); mBeanServer.registerMBean(new StatisticsService(), name); JmxAgent agent = new JmxAgent(); agent.setMuleContext(muleContext); agent.initialise(); muleContext.getRegistry().registerAgent(agent); muleContext.start(); List domains = Arrays.asList(mBeanServer.getDomains()); assertTrue("Should have contained an original domain.", domains.contains(TEST_DOMAIN)); assertTrue("Should have contained a new domain.", domains.contains(TEST_DOMAIN + ".1")); } public void testClashingSuffixedDomains() throws Exception { // get original, pre-test number of domains int numOriginalDomains = mBeanServer.getDomains().length; // pre-register the same domain to simulate a clashing domain ObjectName name = ObjectName.getInstance(TEST_DOMAIN + ":name=TestDuplicates"); mBeanServer.registerMBean(new StatisticsService(), name); // add another domain with suffix already applied name = ObjectName.getInstance(TEST_DOMAIN + ".1" + ":name=TestDuplicates"); mBeanServer.registerMBean(new StatisticsService(), name); assertEquals("Wrong number of domains created.", numOriginalDomains + 2, mBeanServer.getDomains().length); JmxAgent agent = new JmxAgent(); agent.setMuleContext(muleContext); agent.initialise(); muleContext.getRegistry().registerAgent(agent); muleContext.start(); List domains = Arrays.asList(mBeanServer.getDomains()); // one extra domain created by Mule's clash resolution assertEquals("Wrong number of domains created.", numOriginalDomains + 3, domains.size()); assertTrue("Should have contained an original domain.", domains.contains(TEST_DOMAIN)); assertTrue("Should have contained an original suffixed domain.", domains.contains(TEST_DOMAIN + ".1")); assertTrue("Should have contained a new domain.", domains.contains(TEST_DOMAIN + ".2")); } protected void doTearDown() throws Exception { // This MBean was registered manually so needs to be unregistered manually in tearDown() unregisterMBeansByMask(TEST_DOMAIN + ":name=TestDuplicates"); super.doTearDown(); } } mule-2.0.1/modules/management/src/test/java/org/mule/management/config/0000755000175000017500000000000011351411157025664 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/modules/management/src/test/java/org/mule/management/config/ManagementNamespaceHandlerTestCase.javamule-2.0.1/modules/management/src/test/java/org/mule/management/config/ManagementNamespaceHandlerTes0000644000175000017500000001214110766204322033454 0ustar charlescharles/* * $Id: ManagementNamespaceHandlerTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.config; import org.mule.RegistryContext; import org.mule.agent.EndpointNotificationLoggerAgent; import org.mule.agent.Log4jNotificationLoggerAgent; import org.mule.api.agent.Agent; import org.mule.api.registry.Registry; import org.mule.config.spring.SpringRegistry; import org.mule.module.management.agent.JmxAgent; import org.mule.module.management.agent.JmxServerNotificationAgent; import org.mule.module.management.agent.Log4jAgent; import org.mule.module.management.agent.Mx4jAgent; import org.mule.module.management.support.AutoDiscoveryJmxSupportFactory; import org.mule.module.management.support.JmxSupport; import org.mule.module.management.support.JmxSupportFactory; import org.mule.tck.FunctionalTestCase; import org.mule.tck.testmodels.mule.TestAgent; import java.util.Collection; import java.util.Iterator; public class ManagementNamespaceHandlerTestCase extends FunctionalTestCase { private static final int CHAINSAW_PORT = 8080; protected JmxSupportFactory jmxSupportFactory = AutoDiscoveryJmxSupportFactory.getInstance(); protected JmxSupport jmxSupport = jmxSupportFactory.getJmxSupport(); protected String getConfigResources() { return "management-namespace-config.xml"; } public void testSimpleJmxAgentConfig() throws Exception { Agent agent = muleContext.getRegistry().lookupAgent("jmx-server"); assertNotNull(agent); assertEquals(JmxAgent.class, agent.getClass()); JmxAgent jmxAgent = (JmxAgent) agent; assertEquals(true, jmxAgent.isCreateServer()); assertEquals(true, jmxAgent.isLocateServer()); assertEquals(true, jmxAgent.isEnableStatistics()); agent = muleContext.getRegistry().lookupAgent("jmx-log4j"); assertNotNull(agent); assertEquals(Log4jAgent.class, agent.getClass()); agent = muleContext.getRegistry().lookupAgent("jmx-mx4j-adaptor"); assertNotNull(agent); assertEquals(Mx4jAgent.class, agent.getClass()); Mx4jAgent mx4jAgent = (Mx4jAgent) agent; assertEquals(mx4jAgent.getJmxAdaptorUrl(), "http://127.0.0.1:8000"); agent = muleContext.getRegistry().lookupAgent("jmx-notifications"); assertNotNull(agent); assertEquals(JmxServerNotificationAgent.class, agent.getClass()); agent = muleContext.getRegistry().lookupAgent("log4j-notifications"); assertNotNull(agent); assertEquals(Log4jNotificationLoggerAgent.class, agent.getClass()); agent = muleContext.getRegistry().lookupAgent("chainsaw-notifications"); assertNotNull(agent); assertEquals(Log4jNotificationLoggerAgent.class, agent.getClass()); Log4jNotificationLoggerAgent lnlAgent = (Log4jNotificationLoggerAgent) agent; assertEquals(lnlAgent.getChainsawPort(), CHAINSAW_PORT); assertEquals(lnlAgent.getChainsawHost(), "127.0.0.1"); agent = muleContext.getRegistry().lookupAgent("publish-notifications"); assertNotNull(agent); assertEquals(EndpointNotificationLoggerAgent.class, agent.getClass()); EndpointNotificationLoggerAgent enlAgent = (EndpointNotificationLoggerAgent) agent; assertEquals(enlAgent.getEndpointAddress(), "test://test"); agent = muleContext.getRegistry().lookupAgent("test-custom-agent"); assertNotNull(agent); assertEquals(TestAgent.class, agent.getClass()); assertEquals("woggle", ((TestAgent) agent).getFrobbit()); // needs profiler installed // agent = muleContext.getRegistry().lookupAgent("yourkit-profiler"); // assertNotNull(agent); // assertEquals(YourKitProfilerAgent.class, agent.getClass()); } public void testAgentsOrder() throws Exception { Registry registry = RegistryContext.getRegistry(); SpringRegistry springRegistry = (SpringRegistry) registry.getParent(); assertNotNull(springRegistry); Collection agents = springRegistry.lookupObjects(Agent.class); assertEquals(agents.size(), 8); Iterator iter = agents.iterator(); assertTrue(iter.next() instanceof JmxAgent); assertTrue(iter.next() instanceof Log4jAgent); assertTrue(iter.next() instanceof Mx4jAgent); assertTrue(iter.next() instanceof TestAgent); assertTrue(iter.next() instanceof JmxServerNotificationAgent); Log4jNotificationLoggerAgent log4jAgent = (Log4jNotificationLoggerAgent) iter.next(); assertEquals(log4jAgent.getName(), "log4j-notifications"); log4jAgent = (Log4jNotificationLoggerAgent) iter.next(); assertEquals(log4jAgent.getName(), "chainsaw-notifications"); assertTrue(iter.next() instanceof EndpointNotificationLoggerAgent); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/modules/management/src/test/java/org/mule/management/config/ManagementDefaultNamespaceHandlerTestCase.javamule-2.0.1/modules/management/src/test/java/org/mule/management/config/ManagementDefaultNamespaceHan0000644000175000017500000000542511003213046033431 0ustar charlescharles/* * $Id: ManagementDefaultNamespaceHandlerTestCase.java 11618 2008-04-21 22:33:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.config; import org.mule.api.agent.Agent; import org.mule.module.management.agent.JmxAgent; import org.mule.module.management.agent.JmxServerNotificationAgent; import org.mule.module.management.agent.Log4jAgent; import org.mule.module.management.agent.Mx4jAgent; import org.mule.tck.FunctionalTestCase; import java.util.Collection; import javax.management.MBeanServer; import javax.management.ObjectName; public class ManagementDefaultNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "management-default-namespace-config.xml"; } public void testDefaultJmxAgentConfig() throws Exception { Agent agent = muleContext.getRegistry().lookupAgent("jmx-agent"); assertNotNull(agent); assertEquals(JmxAgent.class, agent.getClass()); JmxAgent jmxAgent = (JmxAgent) agent; assertEquals(true, jmxAgent.isCreateServer()); assertEquals(true, jmxAgent.isLocateServer()); assertEquals(true, jmxAgent.isEnableStatistics()); MBeanServer mBeanServer = jmxAgent.getMBeanServer(); String domainName = jmxAgent.getJmxSupportFactory().getJmxSupport().getDomainName(muleContext); Collection beans = mBeanServer.queryMBeans(ObjectName.getInstance(domainName + ":*"), null); String message = domainName + ": " + beans.toString(); assertEquals(message, 7, beans.size()); agent = muleContext.getRegistry().lookupAgent("jmx-log4j"); assertNotNull(agent); assertEquals(Log4jAgent.class, agent.getClass()); agent = muleContext.getRegistry().lookupAgent(JmxServerNotificationAgent.DEFAULT_AGENT_NAME); assertNotNull(agent); assertEquals(JmxServerNotificationAgent.class, agent.getClass()); agent = muleContext.getRegistry().lookupAgent("jmx-mx4j-adaptor"); assertNotNull(agent); assertEquals(Mx4jAgent.class, agent.getClass()); agent = muleContext.getRegistry().lookupAgent("jmx-default-config"); // see TODO in agent // assertNull(agent); //Assertion to check that all Mule MBeans were unregistered during disposal phase. muleContext.dispose(); assertEquals(0, mBeanServer.queryMBeans(ObjectName.getInstance(domainName + ":*"), null).size()); } } mule-2.0.1/modules/management/src/test/java/org/mule/management/mbeans/0000755000175000017500000000000011351411157025664 5ustar charlescharlesmule-2.0.1/modules/management/src/test/java/org/mule/management/mbeans/YourKitProfilerTestCase.java0000644000175000017500000000216210764100742033277 0ustar charlescharles/* * $Id: YourKitProfilerTestCase.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.mbeans; import org.mule.management.AbstractMuleJmxTestCase; import org.mule.module.management.mbean.YourKitProfilerServiceMBean; import java.lang.reflect.Method; public class YourKitProfilerTestCase extends AbstractMuleJmxTestCase { /** * Each method doen't have to be more than 32 * There is a need for intergration with HQ * * @throws Exception */ public void testMethodLenght() throws Exception { Method[] methods = YourKitProfilerServiceMBean.class.getMethods(); for (int i = 0; i < methods.length; i++) { assertTrue(methods[i].getName(),methods[i].getName().length() < 32); } } } mule-2.0.1/modules/management/src/test/java/org/mule/management/mbeans/ServiceStatsTestCase.java0000644000175000017500000000434610764100742032613 0ustar charlescharles/* * $Id: ServiceStatsTestCase.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.mbeans; import org.mule.management.AbstractMuleJmxTestCase; import org.mule.management.stats.RouterStatistics; import org.mule.management.stats.SedaServiceStatistics; import org.mule.module.management.mbean.ServiceStats; import java.util.Set; import javax.management.ObjectName; public class ServiceStatsTestCase extends AbstractMuleJmxTestCase { public void testUndeploy() throws Exception { final String domainOriginal = "TEST_DOMAIN_1"; // inbound/outbound router statistics are required final SedaServiceStatistics statistics = new SedaServiceStatistics("TEST_IN", 0, 0); statistics.setInboundRouterStat(new RouterStatistics(RouterStatistics.TYPE_INBOUND)); statistics.setOutboundRouterStat(new RouterStatistics(RouterStatistics.TYPE_OUTBOUND)); ServiceStats stats = new ServiceStats(statistics); final ObjectName name = ObjectName.getInstance(domainOriginal + ":type=TEST_NAME"); mBeanServer.registerMBean(stats, name); Set mbeans = mBeanServer.queryMBeans(ObjectName.getInstance(domainOriginal + ":*"), null); // Expecting following mbeans to be registered: // 1) org.mule.management.mbeans.ServiceStats@TEST_DOMAIN_1:type=TEST_NAME // 2) org.mule.management.mbeans.RouterStats@TEST_DOMAIN_1:type=org.mule.Statistics,service=TEST_IN,router=inbound // 3) org.mule.management.mbeans.RouterStats@TEST_DOMAIN_1:type=org.mule.Statistics,service=TEST_IN,router=outbound assertEquals("Unexpected components registered in the domain.", 3, mbeans.size()); mBeanServer.unregisterMBean(name); mbeans = mBeanServer.queryMBeans(ObjectName.getInstance(domainOriginal + ":*"), null); assertEquals("There should be no MBeans left in the domain", 0, mbeans.size()); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/test/java/org/mule/management/mbeans/ConnectorServiceTestCase.javamule-2.0.1/modules/management/src/test/java/org/mule/management/mbeans/ConnectorServiceTestCase.java0000644000175000017500000000450510766637211033454 0ustar charlescharles/* * $Id: ConnectorServiceTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.mbeans; import org.mule.api.transport.Connector; import org.mule.management.AbstractMuleJmxTestCase; import org.mule.module.management.agent.JmxAgent; import org.mule.tck.testmodels.mule.TestConnector; import java.util.Set; import javax.management.ObjectName; public class ConnectorServiceTestCase extends AbstractMuleJmxTestCase { public void testUndeploy() throws Exception { final Connector connector = new TestConnector(); connector.setName("TEST_CONNECTOR"); final JmxAgent jmxAgent = new JmxAgent(); muleContext.getRegistry().registerConnector(connector); muleContext.getRegistry().registerAgent(jmxAgent); muleContext.start(); final String query = jmxSupport.getDomainName(muleContext) + ":*"; final ObjectName objectName = jmxSupport.getObjectName(query); Set mbeans = mBeanServer.queryMBeans(objectName, null); // Expecting following mbeans to be registered: // 1) org.mule.management.mbeans.StatisticsService@Mule.ConnectorServiceTest:type=org.mule.Statistics,name=AllStatistics // 2) org.mule.management.mbeans.MuleConfigurationService@Mule.ConnectorServiceTest:type=org.mule.Configuration,name=GlobalConfiguration // 3) org.mule.management.mbeans.ModelService@Mule.ConnectorServiceTest:type=org.mule.Model,name="_muleSystemModel(seda)" // 4) org.mule.management.mbeans.MuleService@Mule.ConnectorServiceTest:type=org.mule.MuleContext,name=MuleServerInfo // 5) org.mule.management.mbeans.ConnectorService@Mule.ConnectorServiceTest:type=org.mule.Connector,name="TEST.CONNECTOR" assertEquals("Unexpected number of components registered in the domain.", 5, mbeans.size()); muleContext.dispose(); mbeans = mBeanServer.queryMBeans(objectName, null); assertEquals("There should be no MBeans left in the domain", 0, mbeans.size()); } } mule-2.0.1/modules/management/src/test/java/org/mule/management/mbeans/ServiceServiceTestCase.java0000644000175000017500000000523610767256152033126 0ustar charlescharles/* * $Id: ServiceServiceTestCase.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.mbeans; import org.mule.api.config.ThreadingProfile; import org.mule.component.DefaultJavaComponent; import org.mule.management.AbstractMuleJmxTestCase; import org.mule.model.seda.SedaModel; import org.mule.model.seda.SedaService; import org.mule.module.management.mbean.ServiceService; import org.mule.object.SingletonObjectFactory; import java.util.Set; import javax.management.ObjectName; public class ServiceServiceTestCase extends AbstractMuleJmxTestCase { public void testUndeploy() throws Exception { final String domainOriginal = "TEST_DOMAIN_1"; final SedaService component = new SedaService(); component.setName("TEST_SERVICE"); component.setComponent(new DefaultJavaComponent(new SingletonObjectFactory(Object.class))); component.setThreadingProfile(ThreadingProfile.DEFAULT_THREADING_PROFILE); SedaModel model = new SedaModel(); component.setModel(model); muleContext.getRegistry().registerModel(model); muleContext.getRegistry().registerService(component); muleContext.start(); final ServiceService service = new ServiceService("TEST_SERVICE"); final ObjectName name = ObjectName.getInstance(domainOriginal + ":type=TEST_SERVICE"); mBeanServer.registerMBean(service, name); Set mbeans = mBeanServer.queryMBeans(ObjectName.getInstance(domainOriginal + ":*"), null); // Expecting following mbeans to be registered: // 1) org.mule.management.mbeans.ServiceService@TEST_DOMAIN_1:type=TEST_SERVICE // 2) org.mule.management.mbeans.ServiceStats@TEST_DOMAIN_1:type=org.mule.Statistics,service=TEST_SERVICE // 3) org.mule.management.mbeans.RouterStats@TEST_DOMAIN_1:type=org.mule.Statistics,service=TEST_SERVICE,router=inbound // 4) org.mule.management.mbeans.RouterStats@TEST_DOMAIN_1:type=org.mule.Statistics,service=TEST_SERVICE,router=outbound assertEquals("Unexpected number of components registered in the domain.", 4, mbeans.size()); mBeanServer.unregisterMBean(name); mbeans = mBeanServer.queryMBeans(ObjectName.getInstance(domainOriginal + ":*"), null); assertEquals("There should be no MBeans left in the domain", 0, mbeans.size()); } } mule-2.0.1/modules/management/src/test/java/org/mule/management/agents/0000755000175000017500000000000011351411156025677 5ustar charlescharles././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/management/src/test/java/org/mule/management/agents/DefaultJmxSupportAgentTestCase.javamule-2.0.1/modules/management/src/test/java/org/mule/management/agents/DefaultJmxSupportAgentTestCas0000644000175000017500000000337610764100742033544 0ustar charlescharles/* * $Id: DefaultJmxSupportAgentTestCase.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.agents; import org.mule.module.management.agent.DefaultJmxSupportAgent; import org.mule.module.management.agent.FixedHostRmiClientSocketFactory; import org.mule.module.management.agent.JmxAgent; import org.mule.tck.AbstractMuleTestCase; import java.util.Map; import javax.management.remote.rmi.RMIConnectorServer; public class DefaultJmxSupportAgentTestCase extends AbstractMuleTestCase { public void testHostPropertyEnablesClientSocketFactory () throws Exception { DefaultJmxSupportAgent agent = new DefaultJmxSupportAgent(); agent.setHost("127.0.0.1"); JmxAgent jmxAgent = agent.createJmxAgent(); Map props = jmxAgent.getConnectorServerProperties(); assertNotNull(props); assertEquals("JMX ConnectorServer properties should've been merged", 2, props.size()); assertTrue("Property shouldn't have been removed", props.containsKey(RMIConnectorServer.JNDI_REBIND_ATTRIBUTE)); assertTrue("Property should've been added", props.containsKey(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE)); Object ref = props.get(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE); assertNotNull(ref); assertTrue(ref instanceof FixedHostRmiClientSocketFactory); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/test/java/org/mule/management/agents/RmiRegistryAgentTestCase.javamule-2.0.1/modules/management/src/test/java/org/mule/management/agents/RmiRegistryAgentTestCase.java0000644000175000017500000000313310774254333033447 0ustar charlescharles/* * $Id: RmiRegistryAgentTestCase.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.agents; import org.mule.module.management.agent.RmiRegistryAgent; import org.mule.tck.AbstractMuleTestCase; public class RmiRegistryAgentTestCase extends AbstractMuleTestCase { public void testHostSetOnly() throws Exception { RmiRegistryAgent agent = new RmiRegistryAgent(); agent.setHost("www.example.com"); agent.initialise(); assertEquals("rmi://www.example.com:1099", agent.getServerUri()); } public void testPortSetOnly() throws Exception { RmiRegistryAgent agent = new RmiRegistryAgent(); agent.setPort("1095"); agent.initialise(); assertEquals("rmi://localhost:1095", agent.getServerUri()); } public void testHostAndPortSet() throws Exception { RmiRegistryAgent agent = new RmiRegistryAgent(); agent.setPort("1095"); agent.setHost("www.example.com"); agent.initialise(); assertEquals("rmi://www.example.com:1095", agent.getServerUri()); } public void testStart() throws Exception { RmiRegistryAgent agent = new RmiRegistryAgent(); agent.initialise(); agent.start(); } } mule-2.0.1/modules/management/src/test/java/org/mule/management/agents/MuleAgentsTestCase.java0000644000175000017500000000463210766637211032262 0ustar charlescharles/* * $Id: MuleAgentsTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.agents; import org.mule.module.management.agent.JmxAgent; import org.mule.module.management.agent.Mx4jAgent; import org.mule.tck.AbstractMuleTestCase; import java.util.List; import javax.management.MBeanServer; import javax.management.MBeanServerFactory; public class MuleAgentsTestCase extends AbstractMuleTestCase { public MuleAgentsTestCase() { setStartContext(true); } public void testRemoveNonExistentAgent() throws Exception { muleContext.getRegistry().unregisterAgent("DOES_NOT_EXIST"); // should not throw NPE } public void testAgentsRegistrationOrder() throws Exception { JmxAgent agentFirst = new JmxAgent(); // If you specified "JmxAgent", it was the first one in the map, // but for "jmxAgent" the order was not preserved. // MX4JAgent depends on JmxAgent having finished initilisation // before proceeding, otherwise it is not able to find any // MBeanServer. agentFirst.setName("jmxAgent"); muleContext.getRegistry().registerAgent(agentFirst); Mx4jAgent agentSecond = new Mx4jAgent(); agentSecond.setName("mx4jAgent"); muleContext.getRegistry().registerAgent(agentSecond); // should not throw an exception } /** * Should not bark when the MBeanServer is injected and * {@code locateServer} and {@code createServer} both * set to false. */ public void testJmxAgentInjectedMBeanServer() throws Exception { JmxAgent jmxAgent = new JmxAgent(); List servers = MBeanServerFactory.findMBeanServer(null); MBeanServer server; server = servers == null || servers.isEmpty() ? MBeanServerFactory.createMBeanServer() : (MBeanServer) servers.get(0); jmxAgent.setCreateServer(false); jmxAgent.setLocateServer(false); jmxAgent.setMBeanServer(server); muleContext.getRegistry().registerAgent(jmxAgent); } } mule-2.0.1/modules/management/src/test/java/org/mule/management/agents/Mx4jAgentTestCase.java0000644000175000017500000000216010766637211032011 0ustar charlescharles/* * $Id: Mx4jAgentTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.agents; import org.mule.management.AbstractMuleJmxTestCase; import org.mule.module.management.agent.Mx4jAgent; import mx4j.tools.adaptor.http.HttpAdaptor; /** * Test that the lifecycle is properly managed. */ public class Mx4jAgentTestCase extends AbstractMuleJmxTestCase { public void testRedeploy() throws Exception { final String name = jmxSupport.getDomainName(muleContext) + ":" + Mx4jAgent.HTTP_ADAPTER_OBJECT_NAME; mBeanServer.registerMBean(new HttpAdaptor(), jmxSupport.getObjectName(name)); Mx4jAgent agent = new Mx4jAgent(); agent.setMuleContext(muleContext); agent.initialise(); } } mule-2.0.1/modules/management/src/test/java/org/mule/management/agents/Log4jAgentTestCase.java0000644000175000017500000000235710764100742032146 0ustar charlescharles/* * $Id: Log4jAgentTestCase.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.agents; import org.mule.management.AbstractMuleJmxTestCase; import org.mule.module.management.agent.Log4jAgent; import javax.management.ObjectName; import org.apache.log4j.jmx.HierarchyDynamicMBean; public class Log4jAgentTestCase extends AbstractMuleJmxTestCase { public void testRedeploy() throws Exception { mBeanServer.registerMBean(new HierarchyDynamicMBean(), ObjectName.getInstance(Log4jAgent.JMX_OBJECT_NAME)); Log4jAgent agent = new Log4jAgent(); agent.initialise(); } protected void doTearDown() throws Exception { // This MBean was registered manually so needs to be unregistered manually in tearDown() unregisterMBeansByMask(Log4jAgent.JMX_OBJECT_NAME); super.doTearDown(); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/modules/management/src/test/java/org/mule/management/agents/FixedHostRmiClienSocketFactoryTestCase.javamule-2.0.1/modules/management/src/test/java/org/mule/management/agents/FixedHostRmiClienSocketFactor0000644000175000017500000000604510764100742033462 0ustar charlescharles/* * $Id: FixedHostRmiClienSocketFactoryTestCase.java 11234 2008-03-06 23:44:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.agents; import org.mule.module.management.agent.FixedHostRmiClientSocketFactory; import org.mule.tck.AbstractMuleTestCase; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import java.nio.channels.ServerSocketChannel; public class FixedHostRmiClienSocketFactoryTestCase extends AbstractMuleTestCase { private static final int TEST_PORT = 60504; protected volatile ServerSocket serverSocket; protected void doSetUp () throws Exception { super.doSetUp(); setupDummyServer(); } protected void doTearDown () throws Exception { super.doTearDown(); if (null != serverSocket) { serverSocket.close(); } } public void testHostConstructorOverride () throws Exception { final String overrideHost = "127.0.0.1"; final FixedHostRmiClientSocketFactory factory = new FixedHostRmiClientSocketFactory(overrideHost); assertEquals(overrideHost, factory.getOverrideHost()); final Socket clientSocket = factory.createSocket("www.example.com", TEST_PORT); final InetAddress address = clientSocket.getInetAddress(); final String socketHost = address.getHostAddress(); assertEquals(overrideHost, socketHost); } /** * Setter property may be used to dynamically switch the client socket host. */ public void testHostSetterOverride () throws Exception { final String overrideHost = "127.0.0.1"; final FixedHostRmiClientSocketFactory factory = new FixedHostRmiClientSocketFactory(); factory.setOverrideHost(overrideHost); assertEquals(overrideHost, factory.getOverrideHost()); Socket clientSocket = null; try { clientSocket = factory.createSocket("www.example.com", TEST_PORT); final InetAddress address = clientSocket.getInetAddress(); final String socketHost = address.getHostAddress(); assertEquals(overrideHost, socketHost); } finally { if (null != clientSocket && !clientSocket.isClosed()) { clientSocket.close(); } } } /** * Simple socket to have something to ping. */ protected void setupDummyServer () throws Exception { ServerSocketChannel ssChannel = ServerSocketChannel.open(); ssChannel.configureBlocking(false); serverSocket = ssChannel.socket(); serverSocket.bind(new InetSocketAddress(TEST_PORT)); } } mule-2.0.1/modules/management/src/test/java/org/mule/management/agents/JmxAgentTestCase.java0000644000175000017500000001215010766637211031725 0ustar charlescharles/* * $Id: JmxAgentTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.agents; import org.mule.api.context.MuleContextBuilder; import org.mule.config.DefaultMuleConfiguration; import org.mule.module.management.agent.FixedHostRmiClientSocketFactory; import org.mule.module.management.agent.JmxAgent; import org.mule.module.management.agent.RmiRegistryAgent; import org.mule.tck.AbstractMuleTestCase; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.management.MBeanServerConnection; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import javax.management.remote.rmi.RMIConnectorServer; public class JmxAgentTestCase extends AbstractMuleTestCase { private static final String[] VALID_AUTH_TOKEN = {"mule", "mulepassword"}; private static final String DOMAIN = "JmxAgentTest"; private JMXServiceURL serviceUrl; private JmxAgent jmxAgent; //@Override protected void configureMuleContext(MuleContextBuilder contextBuilder) { super.configureMuleContext(contextBuilder); DefaultMuleConfiguration config = new DefaultMuleConfiguration(); config.setId(DOMAIN); contextBuilder.setMuleConfiguration(config); } protected void doSetUp() throws Exception { super.doSetUp(); serviceUrl = new JMXServiceURL(JmxAgent.DEFAULT_REMOTING_URI); muleContext.getRegistry().registerAgent(new RmiRegistryAgent()); jmxAgent = new JmxAgent(); jmxAgent.setConnectorServerUrl(JmxAgent.DEFAULT_REMOTING_URI); } protected void doTearDown() { jmxAgent.dispose(); } public void testDefaultProperties() throws Exception { jmxAgent.setCredentials(getValidCredentials()); muleContext.getRegistry().registerAgent(jmxAgent); muleContext.start(); } public void testSuccessfulRemoteConnection() throws Exception { configureProperties(); jmxAgent.setCredentials(getValidCredentials()); muleContext.getRegistry().registerAgent(jmxAgent); muleContext.start(); JMXConnector connector = null; try { Map props = Collections.singletonMap(JMXConnector.CREDENTIALS, VALID_AUTH_TOKEN); connector = JMXConnectorFactory.connect(serviceUrl, props); MBeanServerConnection connection = connector.getMBeanServerConnection(); // is it the right server? assertTrue(Arrays.asList(connection.getDomains()).toString(), Arrays.asList(connection.getDomains()).contains("Mule." + DOMAIN)); } finally { if (connector != null) { connector.close(); } } } public void testNoCredentialsProvided() throws Exception { configureProperties(); jmxAgent.setCredentials(getValidCredentials()); muleContext.getRegistry().registerAgent(jmxAgent); muleContext.start(); JMXConnector connector = null; try { connector = JMXConnectorFactory.connect(serviceUrl); fail("expected SecurityException"); } catch (SecurityException e) { // expected } finally { if (connector != null) { connector.close(); } } } public void testNonRestrictedAccess() throws Exception { configureProperties(); jmxAgent.setCredentials(null); muleContext.getRegistry().registerAgent(jmxAgent); muleContext.start(); JMXConnector connector = null; try { connector = JMXConnectorFactory.connect(serviceUrl); MBeanServerConnection connection = connector.getMBeanServerConnection(); // is it the right server? assertTrue(Arrays.asList(connection.getDomains()).contains("Mule." + DOMAIN)); } finally { if (connector != null) { connector.close(); } } } protected Map getValidCredentials() { final Map credentials = new HashMap(1); credentials.put(VALID_AUTH_TOKEN[0], VALID_AUTH_TOKEN[1]); return credentials; } protected void configureProperties() { // make multi-NIC dev box happy by sticking RMI clients to a single // local ip address Map props = new HashMap(); props.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, new FixedHostRmiClientSocketFactory("127.0.0.1")); jmxAgent.setConnectorServerProperties(props); } } mule-2.0.1/modules/management/src/test/resources/0000755000175000017500000000000011351411157021643 5ustar charlescharlesmule-2.0.1/modules/management/src/test/resources/log4j.properties0000644000175000017500000000055210755123151025003 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN #log4j.logger.org.mule.management=DEBUG mule-2.0.1/modules/management/src/test/resources/management-default-namespace-config.xml0000644000175000017500000000143711003357701031323 0ustar charlescharles mule-2.0.1/modules/management/src/test/resources/management-namespace-config.xml0000644000175000017500000000277310763321016027707 0ustar charlescharles mule-2.0.1/modules/management/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006210725515301026513 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/modules/management/pom.xml0000644000175000017500000000736411006063605017410 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-management Management Extensions Management Extensions for Mule org.mule mule-core ${version} org.mule.modules mule-module-xml ${version} org.mule.modules mule-module-spring-config ${version} provided org.apache.geronimo.specs geronimo-j2ee-management_1.0_spec mx4j mx4j tanukisoft wrapper 3.2.3 mx4j mx4j-jmx mx4j mx4j-impl 2.1.1 mx4j mx4j-tools 2.1.1 mx4j mx4j-remote 2.1.1 log4j log4j com.yourkit yjp-controller-api-redist 7.0.10 org.mule.tests mule-tests-functional ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.management.*, org.mule.management.agents.* mule-2.0.1/modules/client/0000755000175000017500000000000011351411165015224 5ustar charlescharlesmule-2.0.1/modules/client/src/0000755000175000017500000000000011351411163016011 5ustar charlescharlesmule-2.0.1/modules/client/src/main/0000755000175000017500000000000011351411164016736 5ustar charlescharlesmule-2.0.1/modules/client/src/main/java/0000755000175000017500000000000011351411163017656 5ustar charlescharlesmule-2.0.1/modules/client/src/main/java/org/0000755000175000017500000000000011351411163020445 5ustar charlescharlesmule-2.0.1/modules/client/src/main/java/org/mule/0000755000175000017500000000000011351411163021407 5ustar charlescharlesmule-2.0.1/modules/client/src/main/java/org/mule/module/0000755000175000017500000000000011351411163022674 5ustar charlescharlesmule-2.0.1/modules/client/src/main/java/org/mule/module/client/0000755000175000017500000000000011351411164024153 5ustar charlescharlesmule-2.0.1/modules/client/src/main/java/org/mule/module/client/package.html0000644000175000017500000000024710754375733026460 0ustar charlescharles Mule Simple interface for Mule clients to send and receive events from local or remote Mule Servers. mule-2.0.1/modules/client/src/main/java/org/mule/module/client/AbstractEventTransformer.java0000644000175000017500000000232610754375733032032 0ustar charlescharles/* * $Id: AbstractEventTransformer.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import java.lang.reflect.Method; /** * AbstractEventTransformer adds support for adding method details to * the result message. */ public abstract class AbstractEventTransformer extends AbstractTransformer { protected AbstractEventTransformer() { setReturnClass(MuleMessage.class); } public MuleMessage transform(Object src, Method method) throws TransformerException { MuleMessage message = (MuleMessage)transform(src); message.setProperty(MuleProperties.MULE_METHOD_PROPERTY, method.getName()); return message; } } mule-2.0.1/modules/client/src/main/java/org/mule/module/client/i18n/0000755000175000017500000000000011351411163024731 5ustar charlescharlesmule-2.0.1/modules/client/src/main/java/org/mule/module/client/i18n/ClientMessages.java0000644000175000017500000000266110754422723030521 0ustar charlescharles/* * $Id: ClientMessages.java 10791 2008-02-12 23:03:47Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class ClientMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("client"); public static Message failedToDispatchClientEvent() { return createMessage(BUNDLE_PATH, 1); } public static Message noArgsForProxy() { return createMessage(BUNDLE_PATH, 2); } public static Message managerIsAlreadyConfigured() { return createMessage(BUNDLE_PATH, 3); } public static Message unsupportedServerWireForat(String wireFormat) { return createMessage(BUNDLE_PATH, 4, wireFormat); } public static Message failedToDispatchActionNoResponseFromServer(String action, int timeout) { return createMessage(BUNDLE_PATH, 5, action, new Integer(timeout)); } public static Message failedToDeserializeHandshakeFromServer() { return createMessage(BUNDLE_PATH, 6); } } mule-2.0.1/modules/client/src/main/java/org/mule/module/client/EventObjectTransformer.java0000644000175000017500000000234610754375733031477 0ustar charlescharles/* * $Id: EventObjectTransformer.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client; import org.mule.DefaultMuleMessage; import org.mule.api.transformer.TransformerException; import java.util.EventObject; /** * EventObjectTransformer converts a * java.util.EventObject into a DefaultMuleMessage. This * transformer is used by the MuleProxyListener to marshall events into something * that Mule understands. * * @see MuleProxyListener * @see DefaultMuleMessage * @see EventObject */ public class EventObjectTransformer extends AbstractEventTransformer { public EventObjectTransformer() { registerSourceType(EventObject.class); } public Object doTransform(Object src, String encoding) throws TransformerException { return new DefaultMuleMessage(((EventObject)src).getSource()); } } mule-2.0.1/modules/client/src/main/java/org/mule/module/client/config/0000755000175000017500000000000011351411164025420 5ustar charlescharles././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/client/src/main/java/org/mule/module/client/config/RemoteDispatcherAgentDefinitionParser.javamule-2.0.1/modules/client/src/main/java/org/mule/module/client/config/RemoteDispatcherAgentDefinitio0000644000175000017500000000145710764101307033430 0ustar charlescharles/* * $Id: RemoteDispatcherAgentDefinitionParser.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client.config; import org.mule.config.spring.parsers.specific.AgentDefinitionParser; import org.mule.module.client.remoting.RemoteDispatcherAgent; public class RemoteDispatcherAgentDefinitionParser extends AgentDefinitionParser { public RemoteDispatcherAgentDefinitionParser() { super(RemoteDispatcherAgent.class); } } mule-2.0.1/modules/client/src/main/java/org/mule/module/client/config/ClientNamespaceHandler.java0000644000175000017500000000371410767262171032635 0ustar charlescharles/* * $Id: ClientNamespaceHandler.java 11377 2008-03-16 18:18:33Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client.config; import org.mule.config.spring.factories.InboundEndpointFactoryBean; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.specific.endpoint.GenericEndpointDefinitionParser; import org.mule.module.xml.transformer.wire.XStreamWireFormat; import org.mule.transformer.wire.SerializedMuleMessageWireFormat; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; /** * TODO */ public class ClientNamespaceHandler extends NamespaceHandlerSupport { /** * Invoked by the {@link org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader} after * construction but before any custom elements are parsed. * * @see org.springframework.beans.factory.xml.NamespaceHandlerSupport#registerBeanDefinitionParser(String, org.springframework.beans.factory.xml.BeanDefinitionParser) */ public void init() { registerBeanDefinitionParser("remote-dispatcher-agent", new RemoteDispatcherAgentDefinitionParser()); registerBeanDefinitionParser("remote-endpoint", new GenericEndpointDefinitionParser(InboundEndpointFactoryBean.class)); registerBeanDefinitionParser("xml-wire-format", new ChildDefinitionParser("wireFormat", XStreamWireFormat.class)); registerBeanDefinitionParser("serialization-wire-format", new ChildDefinitionParser("wireFormat", SerializedMuleMessageWireFormat.class)); registerBeanDefinitionParser("custom-wire-format", new ChildDefinitionParser("wireFormat")); } } mule-2.0.1/modules/client/src/main/java/org/mule/module/client/config/spring/0000755000175000017500000000000011351411164026722 5ustar charlescharlesmule-2.0.1/modules/client/src/main/java/org/mule/module/client/config/spring/handlers/0000755000175000017500000000000011351411164030522 5ustar charlescharlesmule-2.0.1/modules/client/src/main/java/org/mule/module/client/config/spring/parsers/0000755000175000017500000000000011351411164030401 5ustar charlescharlesmule-2.0.1/modules/client/src/main/java/org/mule/module/client/MuleClient.java0000644000175000017500000012327311002221144027055 0ustar charlescharles/* * $Id: MuleClient.java 11603 2008-04-18 22:36:20Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.MuleServer; import org.mule.api.FutureMessageResult; import org.mule.api.MessagingException; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.config.ConfigurationException; import org.mule.api.config.MuleConfiguration; import org.mule.api.config.MuleProperties; import org.mule.api.context.MuleContextBuilder; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.registry.RegistrationException; import org.mule.api.service.Service; import org.mule.api.transport.DispatchException; import org.mule.api.transport.ReceiveException; import org.mule.config.DefaultMuleConfiguration; import org.mule.config.i18n.CoreMessages; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.context.DefaultMuleContextBuilder; import org.mule.context.DefaultMuleContextFactory; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.endpoint.MuleEndpointURI; import org.mule.module.client.i18n.ClientMessages; import org.mule.security.MuleCredentials; import org.mule.transformer.TransformerUtils; import org.mule.transport.AbstractConnector; import org.mule.transport.NullPayload; import org.mule.util.StringUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.Callable; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleClient is a simple interface for Mule clients to send and * receive events from a Mule Server. In most Mule applications events are triggered * by some external occurrence such as a message being received on a queue or file * being copied to a directory. The Mule client allows the user to send and receive * events programmatically through its Api. *

    * The client defines a EndpointURI which is used to determine how a message is * sent of received. The url defines the protocol, the endpointUri destination of the * message and optionally the endpoint to use when dispatching the event. For * example: *

    * vm://my.object dispatches to a my.object destination * using the VM endpoint. There needs to be a global VM endpoint registered for the * message to be sent. *

    * jms://jmsProvider/orders.topic dispatches a JMS message via the * globally registered jmsProvider over a topic destination called * orders.topic. *

    * jms://orders.topic is equivalent to the above except that the * endpoint is determined by the protocol, so the first JMS endpoint is used. *

    * Note that there must be a configured MuleManager for this client to work. It will * use the one available using muleContext * * @see org.mule.endpoint.MuleEndpointURI */ public class MuleClient implements Disposable { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(MuleClient.class); /** * the local UMOManager instance */ private MuleContext muleContext; private List dispatchers = new ArrayList(); private MuleCredentials user; private DefaultMuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); private ConcurrentMap inboundEndpointCache = new ConcurrentHashMap(); private ConcurrentMap outboundEndpointCache = new ConcurrentHashMap(); /** * Creates a default Mule client that will use the default serverEndpoint to * connect to a remote server instance. * * @throws MuleException */ public MuleClient() throws MuleException { this(true); } public MuleClient(boolean startContext) throws MuleException { init(startContext); } public MuleClient(MuleContext context) throws MuleException { this.muleContext = context; init(false); } /** * Configures a Mule CLient instance using the the default * MuleXmlConfigurationBuilder to parse the config resources * * @param configResources a config resource location to configure this client * with * @throws ConfigurationException is there is a MuleManager instance already * running in this JVM or if the builder fails to configure the * Manager */ public MuleClient(String configResources) throws MuleException { this(configResources, new SpringXmlConfigurationBuilder(configResources)); } /** * Configures a new MuleClient and either uses an existing Manager running in * this JVM or creates a new empty muleContext * * @param user the username to use when connecting to a remote server instance * @param password the password for the user * @throws MuleException */ public MuleClient(String user, String password) throws MuleException { init(/* startManager */true); this.user = new MuleCredentials(user, password.toCharArray()); } /** * Configures a Mule Client instance * * @param configResources a config resource location to configure this client * with * @param builder the configuration builder to use * @throws ConfigurationException is there is a MuleManager instance already * running in this JVM or if the builder fails to configure the * Manager * @throws InitialisationException */ public MuleClient(String configResources, ConfigurationBuilder builder) throws ConfigurationException, InitialisationException { if (builder == null) { logger.info("Builder passed in was null, using default builder: " + SpringXmlConfigurationBuilder.class.getName()); builder = new SpringXmlConfigurationBuilder(configResources); } logger.info("Initializing Mule..."); muleContext = muleContextFactory.createMuleContext(builder); } /** * Configures a Mule Client instance * * @param configResources a config resource location to configure this client * with * @param builder the configuration builder to use * @param user the username to use when connecting to a remote server instance * @param password the password for the user * @throws ConfigurationException is there is a MuleManager instance already * running in this JVM or if the builder fails to configure the * Manager * @throws InitialisationException */ public MuleClient(String configResources, ConfigurationBuilder builder, String user, String password) throws ConfigurationException, InitialisationException { this(configResources, builder); this.user = new MuleCredentials(user, password.toCharArray()); } /** * Initialises a default MuleManager for use by the client. * * @param startManager start the Mule Manager if it has not yet been initialised * @throws MuleException */ private void init(boolean startManager) throws MuleException { // if we are creating a server for this client then set client mode // this will disable Admin connections by default; // If there is no local muleContext present create a default muleContext if (muleContext == null) { muleContext = MuleServer.getMuleContext(); } if (muleContext == null) { logger.info("No existing ManagementContext found, creating a new Mule instance"); MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder(); DefaultMuleConfiguration config = new DefaultMuleConfiguration(); config.setClientMode(true); contextBuilder.setMuleConfiguration(config); muleContext = muleContextFactory.createMuleContext(contextBuilder); } else { logger.info("Using existing MuleContext: " + muleContext); } if (!muleContext.isStarted() && startManager == true) { logger.info("Starting Mule..."); muleContext.start(); } } /** * Dispatches an event asynchronously to a endpointUri via a mule server. the Url * determines where to dispathc the event to, this can be in the form of * * @param url the Mule url used to determine the destination and transport of the * message * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. In * the case of Jms you could set the JMSReplyTo property in these * properties. * @throws org.mule.api.MuleException */ public void dispatch(String url, Object payload, Map messageProperties) throws MuleException { dispatch(url, new DefaultMuleMessage(payload, messageProperties)); } /** * Dispatches an event asynchronously to a endpointUri via a mule server. the Url * determines where to dispathc the event to, this can be in the form of * * @param url the Mule url used to determine the destination and transport of the * message * @param message the message to send * @throws org.mule.api.MuleException */ public void dispatch(String url, MuleMessage message) throws MuleException { MuleEvent event = getEvent(message, url, false); try { event.getSession().dispatchEvent(event); } catch (MuleException e) { throw e; } catch (Exception e) { throw new DispatchException(ClientMessages.failedToDispatchClientEvent(), event.getMessage(), event.getEndpoint(), e); } } /** * sends an event synchronously to a components * * @param component the name of the Mule components to send to * @param transformers a comma separated list of transformers to apply to the * result message * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. as * null * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public MuleMessage sendDirect(String component, String transformers, Object payload, Map messageProperties) throws MuleException { MuleMessage message = new DefaultMuleMessage(payload, messageProperties); return sendDirect(component, transformers, message); } /** * sends an event synchronously to a components * * @param componentName the name of the Mule components to send to * @param transformers a comma separated list of transformers to apply to the * result message * @param message the message to send * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public MuleMessage sendDirect(String componentName, String transformers, MuleMessage message) throws MuleException { Service service = muleContext.getRegistry().lookupService(componentName); if (service == null) { throw new MessagingException(CoreMessages.objectNotRegistered("Service", componentName), message); } List trans = null; if (transformers != null) { trans = TransformerUtils.getTransformers(transformers); } if (!muleContext.getConfiguration().isDefaultSynchronousEndpoints()) { logger.warn("The mule muleContext is not running synchronously, a null message payload will be returned"); } MuleSession session = new DefaultMuleSession(service, muleContext); ImmutableEndpoint endpoint = getDefaultClientEndpoint(service, message.getPayload()); MuleEvent event = new DefaultMuleEvent(message, endpoint, session, true); if (logger.isDebugEnabled()) { logger.debug("MuleClient sending event direct to: " + componentName + ". MuleEvent is: " + event); } MuleMessage result = event.getService().sendEvent(event); if (logger.isDebugEnabled()) { logger.debug("Result of MuleClient sendDirect is: " + (result == null ? "null" : result.getPayload())); } if (result != null && trans != null) { result.applyTransformers(trans); } return result; } /** * dispatches an event asynchronously to the components * * @param component the name of the Mule components to dispatch to * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. as * null * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public void dispatchDirect(String component, Object payload, Map messageProperties) throws MuleException { dispatchDirect(component, new DefaultMuleMessage(payload, messageProperties)); } /** * dispatches an event asynchronously to the components * * @param componentName the name of the Mule components to dispatch to * @param message the message to send * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public void dispatchDirect(String componentName, MuleMessage message) throws MuleException { Service service = muleContext.getRegistry().lookupService(componentName); if (service == null) { throw new MessagingException(CoreMessages.objectNotRegistered("Service", componentName), message); } MuleSession session = new DefaultMuleSession(service, muleContext); ImmutableEndpoint endpoint = getDefaultClientEndpoint(service, message.getPayload()); MuleEvent event = new DefaultMuleEvent(message, endpoint, session, true); if (logger.isDebugEnabled()) { logger.debug("MuleClient dispatching event direct to: " + componentName + ". MuleEvent is: " + event); } event.getService().dispatchEvent(event); } /** * sends an event request to a Url, making the result of the event trigger * available as a Future result that can be accessed later by client code. * * @param url the url to make a request on * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. as * null * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public FutureMessageResult sendAsync(final String url, final Object payload, final Map messageProperties) throws MuleException { return sendAsync(url, payload, messageProperties, 0); } /** * sends an event request to a Url, making the result of the event trigger * available as a Future result that can be accessed later by client code. * * @param url the url to make a request on * @param message the message to send * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public FutureMessageResult sendAsync(final String url, final MuleMessage message) throws MuleException { return sendAsync(url, message, MuleEvent.TIMEOUT_NOT_SET_VALUE); } /** * sends an event request to a Url, making the result of the event trigger * available as a Future result that can be accessed later by client code. * * @param url the url to make a request on * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. as * null * @param timeout how long to block in milliseconds waiting for a result * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public FutureMessageResult sendAsync(final String url, final Object payload, final Map messageProperties, final int timeout) throws MuleException { return sendAsync(url, new DefaultMuleMessage(payload, messageProperties), timeout); } /** * sends an event request to a Url, making the result of the event trigger * available as a Future result that can be accessed later by client code. * * @param url the url to make a request on * @param message the message to send * @param timeout how long to block in milliseconds waiting for a result * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public FutureMessageResult sendAsync(final String url, final MuleMessage message, final int timeout) throws MuleException { Callable call = new Callable() { public Object call() throws Exception { return send(url, message, timeout); } }; FutureMessageResult result = new FutureMessageResult(call); if (muleContext.getWorkManager() != null) { result.setExecutor(muleContext.getWorkManager()); } result.execute(); return result; } /** * sends an event to a components on a local Mule instance, while making the * result of the event trigger available as a Future result that can be accessed * later by client code. If forwardDirectRequests flag s set and the components * is not found on the local Mule instance it will forward to a remote server. * Users can endpoint a url to a remote Mule server in the constructor of a Mule * client, by default the default Mule server url tcp://localhost:60504 is used. * * @param component the name of the Mule components to send to * @param transformers a comma separated list of transformers to apply to the * result message * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. as * null * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public FutureMessageResult sendDirectAsync(final String component, String transformers, final Object payload, final Map messageProperties) throws MuleException { return sendDirectAsync(component, transformers, new DefaultMuleMessage(payload, messageProperties)); } /** * sends an event to a components on a local Mule instance, while making the * result of the event trigger available as a Future result that can be accessed * later by client code. If forwardDirectRequests flag s set and the components * is not found on the local Mule instance it will forward to a remote server. * Users can endpoint a url to a remote Mule server in the constructor of a Mule * client, by default the default Mule server url tcp://localhost:60504 is used. * * @param component the name of the Mule components to send to * @param transformers a comma separated list of transformers to apply to the * result message * @param message the message to send * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public FutureMessageResult sendDirectAsync(final String component, String transformers, final MuleMessage message) throws MuleException { Callable call = new Callable() { public Object call() throws Exception { return sendDirect(component, null, message); } }; FutureMessageResult result = new FutureMessageResult(call); if (muleContext.getWorkManager() != null) { result.setExecutor(muleContext.getWorkManager()); } if (StringUtils.isNotBlank(transformers)) { result.setTransformers(TransformerUtils.getTransformers(transformers)); } result.execute(); return result; } /** * Sends an event synchronously to a endpointUri via a mule server and a * resulting message is returned. * * @param url the Mule url used to determine the destination and transport of the * message * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. In * the case of Jms you could set the JMSReplyTo property in these * properties. * @return A return message, this could be null if the the components invoked * explicitly sets a return as null * @throws org.mule.api.MuleException */ public MuleMessage send(String url, Object payload, Map messageProperties) throws MuleException { return send(url, payload, messageProperties, MuleEvent.TIMEOUT_NOT_SET_VALUE); } /** * Sends an event synchronously to a endpointUri via a mule server and a * resulting message is returned. * * @param url the Mule url used to determine the destination and transport of the * message * @param message the Message for the event * @return A return message, this could be null if the the components invoked * explicitly sets a return as null * @throws org.mule.api.MuleException */ public MuleMessage send(String url, MuleMessage message) throws MuleException { return send(url, message, MuleEvent.TIMEOUT_NOT_SET_VALUE); } /** * Sends an event synchronously to a endpointUri via a mule server and a * resulting message is returned. * * @param url the Mule url used to determine the destination and transport of the * message * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. In * the case of Jms you could set the JMSReplyTo property in these * properties. * @param timeout The time in milliseconds the the call should block waiting for * a response * @return A return message, this could be null if the the components invoked * explicitly sets a return as null * @throws org.mule.api.MuleException */ public MuleMessage send(String url, Object payload, Map messageProperties, int timeout) throws MuleException { if (messageProperties == null) { messageProperties = new HashMap(); } if (messageProperties.get(MuleProperties.MULE_REMOTE_SYNC_PROPERTY) == null) { messageProperties.put(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, "true"); } MuleMessage message = new DefaultMuleMessage(payload, messageProperties); return send(url, message, timeout); } /** * Sends an event synchronously to a endpointUri via a mule server and a * resulting message is returned. * * @param url the Mule url used to determine the destination and transport of the * message * @param message The message to send * @param timeout The time in milliseconds the the call should block waiting for * a response * @return A return message, this could be null if the the components invoked * explicitly sets a return as null * @throws org.mule.api.MuleException */ public MuleMessage send(String url, MuleMessage message, int timeout) throws MuleException { MuleEvent event = getEvent(message, url, true); event.setTimeout(timeout); try { MuleMessage msg = event.getSession().sendEvent(event); if (msg == null) { msg = new DefaultMuleMessage(NullPayload.getInstance()); } return msg; } catch (MuleException e) { throw e; } catch (Exception e) { throw new DispatchException(ClientMessages.failedToDispatchClientEvent(), event.getMessage(), event.getEndpoint(), e); } } /** * Will receive an event from an endpointUri determined by the url * * @param url the Mule url used to determine the destination and transport of the * message * @param timeout how long to block waiting to receive the event, if set to 0 the * receive will not wait at all and if set to -1 the receive will wait * forever * @return the message received or null if no message was received * @throws org.mule.api.MuleException */ public MuleMessage request(String url, long timeout) throws MuleException { InboundEndpoint endpoint = getInboundEndpoint(url); try { MuleMessage message = endpoint.request(timeout); if (message != null && endpoint.getTransformers() != null) { message.applyTransformers(endpoint.getTransformers()); } return message; } catch (Exception e) { throw new ReceiveException(endpoint, timeout, e); } } /** * Will receive an event from an endpointUri determined by the url * * @param url the Mule url used to determine the destination and transport of the * message * @param transformers A comma separated list of transformers used to apply to * the result message * @param timeout how long to block waiting to receive the event, if set to 0 the * receive will not wait at all and if set to -1 the receive will wait * forever * @return the message received or null if no message was received * @throws org.mule.api.MuleException */ public MuleMessage request(String url, String transformers, long timeout) throws MuleException { return request(url, TransformerUtils.getTransformers(transformers), timeout); } /** * Will receive an event from an endpointUri determined by the url * * @param url the Mule url used to determine the destination and transport of the * message * @param transformers Transformers used to modify the result message * @param timeout how long to block waiting to receive the event, if set to 0 the * receive will not wait at all and if set to -1 the receive will wait * forever * @return the message received or null if no message was received * @throws org.mule.api.MuleException */ public MuleMessage request(String url, List transformers, long timeout) throws MuleException { MuleMessage message = request(url, timeout); if (message != null && transformers != null) { message.applyTransformers(transformers); } return message; } /** * Packages a mule event for the current request * * @param message the event payload * @param uri the destination endpointUri * @param synchronous whether the event will be synchronously processed * @return the MuleEvent * @throws MuleException */ protected MuleEvent getEvent(MuleMessage message, String uri, boolean synchronous) throws MuleException { ImmutableEndpoint endpoint = getOutboundEndpoint(uri); if (!endpoint.getConnector().isStarted() && muleContext.isStarted()) { endpoint.getConnector().start(); } try { DefaultMuleSession session = new DefaultMuleSession(message, ((AbstractConnector) endpoint.getConnector()).getSessionHandler(), muleContext); if (user != null) { message.setProperty(MuleProperties.MULE_USER_PROPERTY, MuleCredentials.createHeader( user.getUsername(), user.getPassword())); } DefaultMuleEvent event = new DefaultMuleEvent(message, endpoint, session, synchronous); return event; } catch (Exception e) { throw new DispatchException(CoreMessages.failedToCreate("Client event"), message, endpoint, e); } } protected InboundEndpoint getInboundEndpoint(String uri) throws MuleException { // There was a potential leak here between get() and putIfAbsent(). This // would cause the endpoint that was created to be used rather an endpoint // with the same key that has been created and put in the cache by another // thread. To avoid this we test for the result of putIfAbsent result and if // it is non-null then an endpoint was created and added concurrently and we // return this instance instead. InboundEndpoint endpoint = (InboundEndpoint) inboundEndpointCache.get(uri); if (endpoint == null) { endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(uri); InboundEndpoint concurrentlyAddedEndpoint = (InboundEndpoint) inboundEndpointCache.putIfAbsent(uri, endpoint); if (concurrentlyAddedEndpoint != null) { return concurrentlyAddedEndpoint; } } return endpoint; } protected OutboundEndpoint getOutboundEndpoint(String uri) throws MuleException { // There was a potential leak here between get() and putIfAbsent(). This // would cause the endpoint that was created to be used rather an endpoint // with the same key that has been created and put in the cache by another // thread. To avoid this we test for the result of putIfAbsent result and if // it is non-null then an endpoint was created and added concurrently and we // return this instance instead. OutboundEndpoint endpoint = (OutboundEndpoint) outboundEndpointCache.get(uri); if (endpoint == null) { endpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(uri); OutboundEndpoint concurrentlyAddedEndpoint = (OutboundEndpoint) outboundEndpointCache.putIfAbsent(uri, endpoint); if (concurrentlyAddedEndpoint != null) { return concurrentlyAddedEndpoint; } } return endpoint; } protected ImmutableEndpoint getDefaultClientEndpoint(Service service, Object payload) throws MuleException { // as we are bypassing the message transport layer we need to check that ImmutableEndpoint endpoint = (ImmutableEndpoint) service.getInboundRouter().getEndpoints().get(0); if (endpoint != null) { if (endpoint.getTransformers() != null) { // the original code here really did just check the first exception // as far as i can tell if (TransformerUtils.isSourceTypeSupportedByFirst(endpoint.getTransformers(), payload.getClass())) { return endpoint; } else { EndpointBuilder builder = new EndpointURIEndpointBuilder(endpoint, muleContext); builder.setTransformers(new LinkedList()); return muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(builder); } } else { return endpoint; } } else { EndpointBuilder builder = new EndpointURIEndpointBuilder("vm://mule.client", muleContext); builder.setName("muleClientProvider"); endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(builder); } return endpoint; } /** * Sends an event synchronously to a endpointUri via a mule server without * waiting for the result. * * @param url the Mule url used to determine the destination and transport of the * message * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. In * the case of Jms you could set the JMSReplyTo property in these * properties. * @throws org.mule.api.MuleException */ public void sendNoReceive(String url, Object payload, Map messageProperties) throws MuleException { if (messageProperties == null) { messageProperties = new HashMap(); } messageProperties.put(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, "false"); MuleMessage message = new DefaultMuleMessage(payload, messageProperties); MuleEvent event = getEvent(message, url, true); try { event.getSession().sendEvent(event); } catch (MuleException e) { throw e; } catch (Exception e) { throw new DispatchException(ClientMessages.failedToDispatchClientEvent(), event.getMessage(), event.getEndpoint(), e); } } /** * Overriding methods may want to return a custom muleContext here * * @return the UMOManager to use */ public MuleContext getMuleContext() { return muleContext; } /** * Registers a java object as a Umo pcomponent that listens for events on the * given url. By default the ThreadingProfile for the components will be set so * that there will only be one thread of execution. * * @param component any java object, Mule will it's endpointUri discovery to * determine which event to invoke based on the evnet payload type * @param name The identifying name of the components. This can be used to later * unregister it * @param listenerEndpoint The url endpointUri to listen to * @throws MuleException * @deprecated Use the RegistryContext to get the registry and register the * service there */ public void registerComponent(Object component, String name, EndpointURI listenerEndpoint) throws MuleException { throw new UnsupportedOperationException("registerComponent"); // builder.registerComponentInstance(service, name, listenerEndpoint, // null); } /** * Registers a java object as a Umo pcomponent that listens for and sends events * on the given urls. By default the ThreadingProfile for the components will be * set so that there will only be one thread of execution. * * @param component any java object, Mule will it's endpointUri discovery to * determine which event to invoke based on the evnet payload type * @param name The identifying name of the components. This can be used to later * unregister it * @param listenerEndpoint The url endpointUri to listen to * @param sendEndpoint The url endpointUri to dispatch to * @throws MuleException * @deprecated Use the RegistryContext to get the registry and register the * service there */ public void registerComponent(Object component, String name, MuleEndpointURI listenerEndpoint, MuleEndpointURI sendEndpoint) throws MuleException { throw new UnsupportedOperationException("registerComponent"); // builder.registerComponentInstance(service, name, listenerEndpoint, // sendEndpoint); } /** * Registers a user configured MuleDescriptor of a components to the server. If * users want to register object instances with the server rather than class * names that get created at runtime or reference to objects in the container, * the user must call the descriptors setImplementationInstance() method - * MyBean implementation = new MyBean(); * descriptor.setImplementationInstance(implementation); * * Calling this method is equivilent to calling Model.registerComponent(..) * * @param descriptor the componet descriptor to register * @throws MuleException the descriptor is invalid or cannot be initialised or * started * @see org.mule.api.model.Model * @deprecated Use the RegistryContext to get the registry and register the * service there */ // public void registerComponent(UMODescriptor descriptor) throws MuleException // { // throw new UnsupportedOperationException("registerComponent"); // //builder.registerComponent(descriptor); // } /** * Unregisters a previously register components. This will also unregister any * listeners for the components Calling this method is equivilent to calling * Model.unregisterComponent(..) * * @param name the name of the componet to unregister * @throws MuleException if unregistering the components fails, i.e. The * underlying transport fails to unregister a listener. If the * components does not exist, this method should not throw an * exception. * @see org.mule.api.model.Model * @deprecated Use the RegistryContext to get the registry and register the * service there */ public void unregisterComponent(String name) throws MuleException { throw new UnsupportedOperationException("registerComponent"); // builder.unregisterComponent(name); } public RemoteDispatcher getRemoteDispatcher(String serverEndpoint) throws MuleException { RemoteDispatcher rd = new RemoteDispatcher(serverEndpoint); rd.setExecutor(muleContext.getWorkManager()); dispatchers.add(rd); return rd; } public RemoteDispatcher getRemoteDispatcher(String serverEndpoint, String user, String password) throws MuleException { RemoteDispatcher rd = new RemoteDispatcher(serverEndpoint, new MuleCredentials(user, password.toCharArray())); rd.setExecutor(muleContext.getWorkManager()); dispatchers.add(rd); return rd; } /** * Will dispose the MuleManager instance *IF* a new instance was created for this * client. Otherwise this method only cleans up resources no longer needed */ public void dispose() { synchronized (dispatchers) { for (Iterator iterator = dispatchers.iterator(); iterator.hasNext();) { RemoteDispatcher remoteDispatcher = (RemoteDispatcher) iterator.next(); remoteDispatcher.dispose(); remoteDispatcher = null; } dispatchers.clear(); } // Dispose the muleContext only if the muleContext was created for this // client if (muleContext.getConfiguration().isClientMode()) { logger.info("Stopping Mule..."); muleContext.dispose(); } } public void setProperty(String key, Object value) { try { muleContext.getRegistry().registerObject(key, value); } catch (RegistrationException e) { logger.error(e); } } public Object getProperty(String key) { return muleContext.getRegistry().lookupObject(key); } public MuleConfiguration getConfiguration() { return muleContext.getConfiguration(); } } mule-2.0.1/modules/client/src/main/java/org/mule/module/client/RemoteDispatcher.java0000644000175000017500000004125710766204322030276 0ustar charlescharles/* * $Id: RemoteDispatcher.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.MuleServer; import org.mule.MuleSessionHandler; import org.mule.NullSessionHandler; import org.mule.RegistryContext; import org.mule.RequestContext; import org.mule.api.FutureMessageResult; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointFactory; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.Disposable; import org.mule.api.security.Credentials; import org.mule.api.transformer.wire.WireFormat; import org.mule.api.transport.DispatchException; import org.mule.module.client.i18n.ClientMessages; import org.mule.module.client.remoting.RemoteDispatcherException; import org.mule.module.client.remoting.ServerHandshake; import org.mule.module.client.remoting.UnsupportedWireFormatException; import org.mule.module.client.remoting.notification.RemoteDispatcherNotification; import org.mule.security.MuleCredentials; import org.mule.transformer.TransformerUtils; import org.mule.transport.AbstractConnector; import org.mule.util.ClassUtils; import org.mule.util.IOUtils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.Callable; import edu.emory.mathcs.backport.java.util.concurrent.Executor; import org.apache.commons.lang.SerializationUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * RemoteDispatcher is used to make and receive requests to a remote * Mule instance. It is used to proxy requests to Mule using the Server URL as the * transport channel. */ public class RemoteDispatcher implements Disposable { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(RemoteDispatcher.class); /** * dispatch destination */ private OutboundEndpoint asyncServerEndpoint; private OutboundEndpoint syncServerEndpoint; private Credentials credentials = null; /** * an ExecutorService for async messages (optional) */ private Executor asyncExecutor; /** * calls made to a remote server are serialised using a wireformat */ private WireFormat wireFormat; protected RemoteDispatcher(String endpoint, Credentials credentials) throws MuleException { this(endpoint); this.credentials = credentials; } protected RemoteDispatcher(String endpoint) throws MuleException { EndpointFactory endpointFactory = RegistryContext.getRegistry().lookupEndpointFactory(); asyncServerEndpoint = endpointFactory.getOutboundEndpoint(endpoint); EndpointBuilder endpointBuilder = endpointFactory.getEndpointBuilder(endpoint); endpointBuilder.setRemoteSync(true); syncServerEndpoint = RegistryContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( endpointBuilder); wireFormat = requestWireFormat(); } protected WireFormat requestWireFormat() throws MuleException { MuleMessage msg = new DefaultMuleMessage(ServerHandshake.SERVER_HANDSHAKE_PROPERTY); MuleMessage result = syncServerEndpoint.send(new DefaultMuleEvent(msg, syncServerEndpoint, new DefaultMuleSession(msg, new NullSessionHandler(), MuleServer.getMuleContext()), true)); if(result==null) { throw new RemoteDispatcherException(ClientMessages.failedToDispatchActionNoResponseFromServer("request wire format", 5000)); } ServerHandshake handshake; try { ByteArrayInputStream in = new ByteArrayInputStream(result.getPayloadAsBytes()); handshake = (ServerHandshake) SerializationUtils.deserialize(in); } catch (Exception e) { throw new RemoteDispatcherException(ClientMessages.failedToDeserializeHandshakeFromServer(), e); } try { WireFormat wf = (WireFormat)ClassUtils.instanciateClass(handshake.getWireFormatClass(), ClassUtils.NO_ARGS, getClass()); return wf; } catch (Exception e) { throw new UnsupportedWireFormatException(handshake.getWireFormatClass(), e); } } protected void setExecutor(Executor e) { this.asyncExecutor = e; } /** * Dispatcher an event asynchronously to a components on a remote Mule instance. * Users can endpoint a url to a remote Mule server in the constructor of a Mule * client, by default the default Mule server url tcp://localhost:60504 is used. * * @param component the name of the Mule components to dispatch to * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. as * null * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public void dispatchToRemoteComponent(String component, Object payload, Map messageProperties) throws MuleException { doToRemoteComponent(component, payload, messageProperties, false); } /** * sends an event synchronously to a components on a remote Mule instance. Users * can endpoint a url to a remote Mule server in the constructor of a Mule * client, by default the default Mule server url tcp://localhost:60504 is used. * * @param component the name of the Mule components to send to * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. as * null * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public MuleMessage sendToRemoteComponent(String component, Object payload, Map messageProperties) throws MuleException { return doToRemoteComponent(component, payload, messageProperties, true); } /** * sends an event to a components on a remote Mule instance, while making the * result of the event trigger available as a Future result that can be accessed * later by client code. Users can endpoint a url to a remote Mule server in the * constructor of a Mule client, by default the default Mule server url * tcp://localhost:60504 is used. * * @param component the name of the Mule components to send to * @param transformers a comma separated list of transformers to apply to the * result message * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. as * null * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found */ public FutureMessageResult sendAsyncToRemoteComponent(final String component, String transformers, final Object payload, final Map messageProperties) throws MuleException { Callable callable = new Callable() { public Object call() throws Exception { return doToRemoteComponent(component, payload, messageProperties, true); } }; FutureMessageResult result = new FutureMessageResult(callable); if (asyncExecutor != null) { result.setExecutor(asyncExecutor); } if (transformers != null) { result.setTransformers(TransformerUtils.getTransformers(transformers)); } result.execute(); return result; } public MuleMessage sendRemote(String endpoint, Object payload, Map messageProperties, int timeout) throws MuleException { return doToRemote(endpoint, payload, messageProperties, true, timeout); } public MuleMessage sendRemote(String endpoint, Object payload, Map messageProperties) throws MuleException { return doToRemote(endpoint, payload, messageProperties, true, MuleServer.getMuleContext().getConfiguration().getDefaultSynchronousEventTimeout()); } public void dispatchRemote(String endpoint, Object payload, Map messageProperties) throws MuleException { doToRemote(endpoint, payload, messageProperties, false, -1); } public FutureMessageResult sendAsyncRemote(final String endpoint, final Object payload, final Map messageProperties) throws MuleException { Callable callable = new Callable() { public Object call() throws Exception { return doToRemote(endpoint, payload, messageProperties, true, -1); } }; FutureMessageResult result = new FutureMessageResult(callable); if (asyncExecutor != null) { result.setExecutor(asyncExecutor); } result.execute(); return result; } public MuleMessage receiveRemote(String endpoint, int timeout) throws MuleException { RemoteDispatcherNotification action = new RemoteDispatcherNotification(null, RemoteDispatcherNotification.ACTION_RECEIVE, endpoint); action.setProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, "true"); action.setProperty(MuleProperties.MULE_EVENT_TIMEOUT_PROPERTY, new Long(timeout)); return dispatchAction(action, true, timeout); } public FutureMessageResult asyncReceiveRemote(final String endpoint, final int timeout) throws MuleException { Callable callable = new Callable() { public Object call() throws Exception { return receiveRemote(endpoint, timeout); } }; FutureMessageResult result = new FutureMessageResult(callable); if (asyncExecutor != null) { result.setExecutor(asyncExecutor); } result.execute(); return result; } protected MuleMessage doToRemoteComponent(String component, Object payload, Map messageProperties, boolean synchronous) throws MuleException { MuleMessage message = new DefaultMuleMessage(payload, messageProperties); message.setBooleanProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, synchronous); setCredentials(message); RemoteDispatcherNotification action = new RemoteDispatcherNotification(message, RemoteDispatcherNotification.ACTION_INVOKE, "mule://" + component); return dispatchAction(action, synchronous, MuleServer.getMuleContext().getConfiguration().getDefaultSynchronousEventTimeout()); } protected MuleMessage doToRemote(String endpoint, Object payload, Map messageProperties, boolean synchronous, int timeout) throws MuleException { MuleMessage message = new DefaultMuleMessage(payload, messageProperties); message.setProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, String.valueOf(synchronous)); setCredentials(message); RemoteDispatcherNotification action = new RemoteDispatcherNotification(message, (synchronous ? RemoteDispatcherNotification.ACTION_SEND : RemoteDispatcherNotification.ACTION_DISPATCH), endpoint); return dispatchAction(action, synchronous, timeout); } protected MuleMessage dispatchAction(RemoteDispatcherNotification action, boolean synchronous, int timeout) throws MuleException { OutboundEndpoint serverEndpoint; if (synchronous) { serverEndpoint = syncServerEndpoint; } else { serverEndpoint = asyncServerEndpoint; } MuleMessage serializeMessage = new DefaultMuleMessage(action); updateContext(serializeMessage, serverEndpoint, synchronous); ByteArrayOutputStream out = new ByteArrayOutputStream(); wireFormat.write(out, serializeMessage, serverEndpoint.getEncoding()); byte[] payload = out.toByteArray(); MuleMessage message = action.getMessage(); if (message == null) { message = new DefaultMuleMessage(payload); } else { message = new DefaultMuleMessage(payload, message); } message.addProperties(action.getProperties()); MuleSession session = new DefaultMuleSession(message, ((AbstractConnector)serverEndpoint.getConnector()).getSessionHandler(), MuleServer.getMuleContext()); MuleEvent event = new DefaultMuleEvent(message, serverEndpoint, session, true); event.setTimeout(timeout); if (logger.isDebugEnabled()) { logger.debug("MuleClient sending remote call to: " + action.getResourceIdentifier() + ". At " + serverEndpoint.toString() + " . Event is: " + event); } MuleMessage result; try { if (synchronous) { result = serverEndpoint.send(event); } else { serverEndpoint.dispatch(event); return null; } if (result != null) { if (result.getPayload() != null) { Object response; if (result.getPayload() instanceof InputStream) { byte[] b = IOUtils.toByteArray((InputStream)result.getPayload()); if(b.length==0) return null; ByteArrayInputStream in = new ByteArrayInputStream(b); response = wireFormat.read(in); } else { ByteArrayInputStream in = new ByteArrayInputStream(result.getPayloadAsBytes()); response = wireFormat.read(in); } if (response instanceof RemoteDispatcherNotification) { response = ((RemoteDispatcherNotification)response).getMessage(); } return (MuleMessage)response; } } } catch (Exception e) { throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } if (logger.isDebugEnabled()) { logger.debug("Result of MuleClient remote call is: " + (result == null ? "null" : result.getPayload())); } return result; } public void dispose() { // nothing to do here } protected void setCredentials(MuleMessage message) { if (credentials != null) { message.setProperty(MuleProperties.MULE_USER_PROPERTY, MuleCredentials.createHeader( credentials.getUsername(), credentials.getPassword())); } } public WireFormat getWireFormat() { return wireFormat; } public void setWireFormat(WireFormat wireFormat) { this.wireFormat = wireFormat; } protected void updateContext(MuleMessage message, ImmutableEndpoint endpoint, boolean synchronous) throws MuleException { RequestContext.setEvent(new DefaultMuleEvent(message, endpoint, new DefaultMuleSession(message, new MuleSessionHandler(), MuleServer.getMuleContext()), synchronous)); } } mule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/0000755000175000017500000000000011351411164025777 5ustar charlescharlesmule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/notification/0000755000175000017500000000000011351411164030465 5ustar charlescharles././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/notification/RemoteDispatcherNotification.javamule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/notification/RemoteDispatche0000644000175000017500000000507710764101307033503 0ustar charlescharles/* * $Id: RemoteDispatcherNotification.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client.remoting.notification; import org.mule.api.MuleMessage; import org.mule.api.context.notification.ServerNotification; import java.util.HashMap; import java.util.Map; /** * RemoteDispatcherNotification is used to invoke actions on a remote mule server */ public class RemoteDispatcherNotification extends ServerNotification { /** * Serial version */ private static final long serialVersionUID = -53091546441476249L; /** This is a low range since it was allocated before being refactred into the client module from core */ public static final int REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE = 600; public static final int ACTION_RECEIVE = REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE + 1; public static final int ACTION_DISPATCH = REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE + 2; public static final int ACTION_SEND = REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE + 3; public static final int ACTION_INVOKE = REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE + 4; public static final int ACTION_WIRE_FORMAT = REMOTE_DISPATCHER_EVENT_ACTION_START_RANGE + 5; static { registerAction("receive event", ACTION_RECEIVE); registerAction("dispatch event", ACTION_DISPATCH); registerAction("send event", ACTION_SEND); registerAction("invoke component", ACTION_INVOKE); registerAction("request wire format", ACTION_WIRE_FORMAT); } private Map properties = new HashMap(); private MuleMessage message; public RemoteDispatcherNotification(MuleMessage message, int action) { super(message, action); } public RemoteDispatcherNotification(MuleMessage message, int action, String resourceIdentifier) { super(message, action, resourceIdentifier); this.message = message; } public MuleMessage getMessage() { return message; } public void setProperty(Object key, Object value) { properties.put(key, value); } public Object getProperty(Object key) { return properties.get(key); } public Map getProperties() { return properties; } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/notification/RemoteDispatcherNotificationListener.javamule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/notification/RemoteDispatche0000644000175000017500000000154610764101307033500 0ustar charlescharles/* * $Id: RemoteDispatcherNotificationListener.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client.remoting.notification; import org.mule.api.context.notification.ServerNotificationListener; /** * ManagementNotificationListener is an observer interface that * objects can use to receive notifications about the state of the Mule instance and * its resources */ public interface RemoteDispatcherNotificationListener extends ServerNotificationListener { // no methods } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/UnsupportedWireFormatException.javamule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/UnsupportedWireFormatExcepti0000644000175000017500000000165010754422723033607 0ustar charlescharles/* * $Id: UnsupportedWireFormatException.java 10791 2008-02-12 23:03:47Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client.remoting; import org.mule.module.client.i18n.ClientMessages; /** * Exception is thrown when the server is using a wire format that the client does not support */ public class UnsupportedWireFormatException extends RemoteDispatcherException { /** * @param message the exception message */ public UnsupportedWireFormatException(String wireFormat, Exception e) { super(ClientMessages.unsupportedServerWireForat(wireFormat), e); } } mule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/ServerHandshake.java0000644000175000017500000000222510754422723031731 0ustar charlescharles/* * $Id: ServerHandshake.java 10791 2008-02-12 23:03:47Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client.remoting; import org.mule.api.config.MuleProperties; import org.mule.module.client.RemoteDispatcher; import java.io.Serializable; /** * The message type used for the handshake between the client {@link RemoteDispatcher} and the server * {@link org.mule.extras.client.remoting.RemoteDispatcherAgent}. */ public class ServerHandshake implements Serializable { public static final String SERVER_HANDSHAKE_PROPERTY = MuleProperties.PROPERTY_PREFIX + "CLIENT_HANDSHAKE"; private String wireFormatClass; public String getWireFormatClass() { return wireFormatClass; } public void setWireFormatClass(String wireFormatClass) { this.wireFormatClass = wireFormatClass; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/RemoteDispatcherException.javamule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/RemoteDispatcherException.ja0000644000175000017500000000221010754422723033440 0ustar charlescharles/* * $Id: RemoteDispatcherException.java 10791 2008-02-12 23:03:47Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client.remoting; import org.mule.api.MuleException; import org.mule.config.i18n.Message; /** * Exceptions thrown by the Client RemteDispatcher. Note that this exception is not used to wrap othor {@link UMOException} * instances. */ public class RemoteDispatcherException extends MuleException { /** * @param message the exception message */ public RemoteDispatcherException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public RemoteDispatcherException(Message message, Throwable cause) { super(message, cause); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/RemoteDispatcherComponent.javamule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/RemoteDispatcherComponent.ja0000644000175000017500000003151310774254333033456 0ustar charlescharles/* * $Id: RemoteDispatcherComponent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client.remoting; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.MuleServer; import org.mule.RequestContext; import org.mule.api.DefaultMuleException; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleEventContext; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointFactory; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transformer.TransformerException; import org.mule.api.transformer.wire.WireFormat; import org.mule.component.SimpleCallableJavaComponent; import org.mule.config.i18n.CoreMessages; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.message.DefaultExceptionPayload; import org.mule.model.seda.SedaService; import org.mule.module.client.remoting.notification.RemoteDispatcherNotification; import org.mule.object.PrototypeObjectFactory; import org.mule.transport.AbstractConnector; import org.mule.transport.NullPayload; import org.mule.util.MapUtils; import java.io.ByteArrayInputStream; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * RemoteDispatcherComponent is a MuleManager interal server component * responsible for receiving remote requests and dispatching them locally. This * allows developer to tunnel requests through http ssl to a Mule instance behind a * firewall */ public class RemoteDispatcherComponent implements Callable, Initialisable { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(RemoteDispatcherComponent.class); public static final String MANAGER_COMPONENT_NAME = "_muleManagerComponent"; /** * Use Serialization by default */ protected WireFormat wireFormat; protected String encoding; protected int synchronousEventTimeout = 5000; public void initialise() throws InitialisationException { if (wireFormat == null) { throw new InitialisationException(CoreMessages.objectIsNull("wireFormat"), this); } } public Object onCall(MuleEventContext context) throws Exception { if(context.transformMessageToString().equals(ServerHandshake.SERVER_HANDSHAKE_PROPERTY)) { return doHandshake(context); } Object result; logger.debug("Message received by RemoteDispatcherComponent"); ByteArrayInputStream in = new ByteArrayInputStream(context.transformMessageToBytes()); RemoteDispatcherNotification action = (RemoteDispatcherNotification) ((MuleMessage)wireFormat.read(in)).getPayload(); if (RemoteDispatcherNotification.ACTION_INVOKE == action.getAction()) { result = invokeAction(action, context); } else if (RemoteDispatcherNotification.ACTION_SEND == action.getAction() || RemoteDispatcherNotification.ACTION_DISPATCH == action.getAction()) { result = sendAction(action, context); } else if (RemoteDispatcherNotification.ACTION_RECEIVE == action.getAction()) { result = receiveAction(action, context); } else { result = handleException(null, new DefaultMuleException( CoreMessages.eventTypeNotRecognised("RemoteDispatcherNotification:" + action.getAction()))); } return result; } protected ServerHandshake doHandshake(MuleEventContext context) throws TransformerException { ServerHandshake handshake = new ServerHandshake(); handshake.setWireFormatClass(wireFormat.getClass().getName()); return handshake; } protected Object invokeAction(RemoteDispatcherNotification action, MuleEventContext context) throws MuleException { String destComponent; MuleMessage result = null; String endpoint = action.getResourceIdentifier(); if (action.getResourceIdentifier().startsWith("mule:")) { destComponent = endpoint.substring(endpoint.lastIndexOf("/") + 1); } else { destComponent = endpoint; } if (destComponent != null) { MuleSession session = new DefaultMuleSession(context.getMuleContext().getRegistry().lookupService(destComponent), context.getMuleContext()); // Need to do this otherise when the event is invoked the // transformer associated with the Mule Admin queue will be invoked, but // the message will not be of expected type MuleContext managementContext = MuleServer.getMuleContext(); EndpointBuilder builder = new EndpointURIEndpointBuilder(RequestContext.getEvent().getEndpoint(), managementContext); // TODO - is this correct? it stops any other transformer from being set builder.setTransformers(new LinkedList()); ImmutableEndpoint ep = managementContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(builder); MuleEvent event = new DefaultMuleEvent(action.getMessage(), ep, context.getSession(), context.isSynchronous()); event = RequestContext.setEvent(event); if (context.isSynchronous()) { result = session.getService().sendEvent(event); ByteArrayOutputStream out = new ByteArrayOutputStream(); wireFormat.write(out, result, getEncoding()); return out.toByteArray(); } else { session.getService().dispatchEvent(event); return null; } } else { return handleException(result, new DefaultMuleException( CoreMessages.couldNotDetermineDestinationComponentFromEndpoint(endpoint))); } } protected Object sendAction(RemoteDispatcherNotification action, MuleEventContext context) throws MuleException { MuleMessage result = null; OutboundEndpoint endpoint = null; MuleContext managementContext = context.getMuleContext(); try { if (RemoteDispatcherNotification.ACTION_DISPATCH == action.getAction()) { endpoint = managementContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint( action.getResourceIdentifier()); context.dispatchEvent(action.getMessage(), endpoint); return null; } else { EndpointFactory endpointFactory = managementContext.getRegistry().lookupEndpointFactory(); EndpointBuilder endpointBuilder = endpointFactory.getEndpointBuilder(action.getResourceIdentifier()); endpointBuilder.setRemoteSync(true); endpoint = managementContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(endpointBuilder); result = context.sendEvent(action.getMessage(), endpoint); if (result == null) { return null; } else { ByteArrayOutputStream out = new ByteArrayOutputStream(); wireFormat.write(out, result, getEncoding()); return out.toByteArray(); } } } catch (Exception e) { return handleException(result, e); } } protected Object receiveAction(RemoteDispatcherNotification action, MuleEventContext context) throws MuleException { MuleMessage result = null; try { ImmutableEndpoint endpoint = context.getMuleContext() .getRegistry() .lookupEndpointFactory() .getOutboundEndpoint(action.getResourceIdentifier()); long timeout = MapUtils.getLongValue(action.getProperties(), MuleProperties.MULE_EVENT_TIMEOUT_PROPERTY, getSynchronousEventTimeout()); result = endpoint.getConnector().request(action.getResourceIdentifier(), timeout); if (result != null) { // See if there is a default transformer on the connector List transformers = ((AbstractConnector) endpoint.getConnector()).getDefaultInboundTransformers(); if (transformers != null) { result.applyTransformers(transformers); } ByteArrayOutputStream out = new ByteArrayOutputStream(); wireFormat.write(out, result, getEncoding()); return out.toByteArray(); } else { return null; } } catch (Exception e) { return handleException(result, e); } } public static final Service getSerivce(InboundEndpoint endpoint, WireFormat wireFormat, String encoding, int eventTimeout, MuleContext managementContext) throws MuleException { try { Service service = new SedaService(); service.setName(MANAGER_COMPONENT_NAME); service.setModel(managementContext.getRegistry().lookupSystemModel()); Map props = new HashMap(); props.put("wireFormat", wireFormat); props.put("encoding", encoding); props.put("synchronousEventTimeout", new Integer(eventTimeout)); service.setComponent(new SimpleCallableJavaComponent(new PrototypeObjectFactory(RemoteDispatcherComponent.class, props))); service.setMuleContext(managementContext); service.getInboundRouter().addEndpoint(endpoint); return service; } catch (Exception e) { throw new InitialisationException(e, null); } } /** * Wraps an exception into a MuleMessage with an Exception payload and returns * the Xml representation of it * * @param result the result of the invocation or null if the exception occurred * before or during the invocation * @param e the Exception thrown * @return an Xml String message result */ protected Object handleException(MuleMessage result, Throwable e) { logger.error("Failed to process admin request: " + e.getMessage(), e); if (result == null) { result = new DefaultMuleMessage(NullPayload.getInstance(), (Map) null); } result.setExceptionPayload(new DefaultExceptionPayload(e)); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); wireFormat.write(out, result, getEncoding()); return out.toByteArray(); } catch (Exception e1) { // TODO MULE-863: Is this sufficient? // log the inner exception here since the earlier exception was logged earlier logger.error("Failed to format message, using direct string (details at debug level): " + e1.getMessage()); logger.debug(e1.toString(), e1); return e.getMessage(); } } public WireFormat getWireFormat() { return wireFormat; } public void setWireFormat(WireFormat wireFormat) { this.wireFormat = wireFormat; } public String getEncoding() { return encoding; } public void setEncoding(String encoding) { this.encoding = encoding; } public int getSynchronousEventTimeout() { return synchronousEventTimeout; } public void setSynchronousEventTimeout(int synchronousEventTimeout) { this.synchronousEventTimeout = synchronousEventTimeout; } } mule-2.0.1/modules/client/src/main/java/org/mule/module/client/remoting/RemoteDispatcherAgent.java0000644000175000017500000001032310774254333033075 0ustar charlescharles/* * $Id: RemoteDispatcherAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client.remoting; import org.mule.AbstractAgent; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transformer.wire.WireFormat; import org.mule.config.i18n.CoreMessages; import org.mule.module.client.remoting.notification.RemoteDispatcherNotification; import org.mule.module.client.remoting.notification.RemoteDispatcherNotificationListener; import org.mule.transformer.wire.SerializedMuleMessageWireFormat; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * RemoteDispatcherAgent manages the server endpoint that receives Admin and * remote client requests */ public class RemoteDispatcherAgent extends AbstractAgent { public static final String AGENT_NAME = "RemoteDispatcherServer"; /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(RemoteDispatcherAgent.class); private WireFormat wireFormat; private InboundEndpoint endpoint; public RemoteDispatcherAgent() { super(AGENT_NAME); } /** * Should be a 1 line description of the agent * * @return */ public String getDescription() { return getName() + ": accepting connections on " + endpoint.getEndpointURI().getAddress(); } public void start() throws MuleException { // nothing to do } public void stop() throws MuleException { // nothing to do } public void dispose() { // nothing to do (yet?) } public void registered() { // nothing to do (yet?) } public void unregistered() { // nothing to do (yet?) } public void initialise() throws InitialisationException { if (endpoint == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("remote-endpoint").getMessage()); } if (wireFormat == null) { wireFormat = new SerializedMuleMessageWireFormat(); } //Register the Remote Dispatcher Notification support muleContext.getNotificationManager().addInterfaceToType( RemoteDispatcherNotificationListener.class, RemoteDispatcherNotification.class); try { // Check for override if (muleContext.getRegistry().lookupService(RemoteDispatcherComponent.MANAGER_COMPONENT_NAME) != null) { logger.info("Mule manager component has already been initialised, ignoring server url"); } else { Service component = RemoteDispatcherComponent.getSerivce(endpoint, wireFormat, muleContext.getConfiguration().getDefaultEncoding(), muleContext.getConfiguration() .getDefaultSynchronousEventTimeout(), muleContext); muleContext.getRegistry().registerService(component); } } catch (MuleException e) { throw new InitialisationException(e, this); } } public String toString() { String address = "not set"; if(endpoint!=null) { address = endpoint.getEndpointURI().getAddress(); } return "RemoteDispatcherAgent{" + "remote-endpoint='" + address + "'" + "}"; } public WireFormat getWireFormat() { return wireFormat; } public void setWireFormat(WireFormat wireFormat) { this.wireFormat = wireFormat; } public InboundEndpoint getEndpoint() { return endpoint; } public void setEndpoint(InboundEndpoint endpoint) { this.endpoint = endpoint; } } mule-2.0.1/modules/client/src/main/java/org/mule/module/client/MuleProxyListener.java0000644000175000017500000001002210754375733030504 0ustar charlescharles/* * $Id: MuleProxyListener.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client; import org.mule.api.DefaultMuleException; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.transformer.Transformer; import org.mule.module.client.i18n.ClientMessages; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; /** * MuleProxyListener is a generic listent proxy that can be used to * foward calls as Mule events from any Observer/Observerable implementation. */ public class MuleProxyListener implements InvocationHandler { private Class listenerClass; private AbstractEventTransformer eventTransformer; private String componentName; private Object proxy; private MuleClient client; public MuleProxyListener(Class listenerClass, String componentName) throws MuleException { setListenerClass(listenerClass); setEventTransformer(new EventObjectTransformer()); setComponentName(componentName); setClient(new MuleClient()); createProxy(); } public MuleProxyListener(Class listenerClass, AbstractEventTransformer eventTransformer, String componentName) throws MuleException { setListenerClass(listenerClass); setEventTransformer(eventTransformer); setComponentName(componentName); setClient(new MuleClient()); createProxy(); } public MuleProxyListener(Class listenerClass, AbstractEventTransformer eventTransformer, String componentName, MuleClient client) { setListenerClass(listenerClass); setEventTransformer(eventTransformer); setComponentName(componentName); setClient(client); createProxy(); } protected void createProxy() { proxy = Proxy.newProxyInstance(listenerClass.getClassLoader(), new Class[]{listenerClass}, this); } public Class getListenerClass() { return listenerClass; } public void setListenerClass(Class listenerClass) { this.listenerClass = listenerClass; } public Transformer getEventTransformer() { return eventTransformer; } public void setEventTransformer(AbstractEventTransformer eventTransformer) { this.eventTransformer = eventTransformer; } public String getComponentName() { return componentName; } public void setComponentName(String componentName) { this.componentName = componentName; } public MuleClient getClient() { return client; } public void setClient(MuleClient client) { this.client = client; } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (args.length == 0) { throw new DefaultMuleException(ClientMessages.noArgsForProxy()); } MuleMessage message = eventTransformer.transform(args[0], method); if (!"void".equals(method.getReturnType().getName())) { MuleMessage result = client.sendDirect(componentName, null, message); if (MuleMessage.class.equals(method.getReturnType())) { return result; } else { return (result == null ? null : result.getPayload()); } } else { client.dispatchDirect(componentName, message); return null; } } public Object getProxy() { return proxy; } } mule-2.0.1/modules/client/src/main/resources/0000755000175000017500000000000011351411164020750 5ustar charlescharlesmule-2.0.1/modules/client/src/main/resources/META-INF/0000755000175000017500000000000011351411165022111 5ustar charlescharlesmule-2.0.1/modules/client/src/main/resources/META-INF/spring.schemas0000644000175000017500000000013310766463006024767 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/client/2.0/mule-client.xsd=META-INF/mule-client.xsd mule-2.0.1/modules/client/src/main/resources/META-INF/mule-client.xsd0000644000175000017500000000346710766463006025073 0ustar charlescharles mule-2.0.1/modules/client/src/main/resources/META-INF/spring.handlers0000644000175000017500000000015010766463006025143 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/client/2.0=org.mule.module.client.config.ClientNamespaceHandler mule-2.0.1/modules/client/src/main/resources/META-INF/services/0000755000175000017500000000000011351411165023734 5ustar charlescharlesmule-2.0.1/modules/client/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351411165024523 5ustar charlescharlesmule-2.0.1/modules/client/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351411165025465 5ustar charlescharlesmule-2.0.1/modules/client/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351411165026244 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/client/src/main/resources/META-INF/services/org/mule/i18n/client-messages.propertiesmule-2.0.1/modules/client/src/main/resources/META-INF/services/org/mule/i18n/client-messages.propert0000644000175000017500000000107310754110316032745 0ustar charlescharles1=Failed to dispatch client event 2=There is no event specified in the invoke args of the Client proxy listener. Parameter args[] length is zero 3=A Mule instance is already configured for the JVM. You need to call MuleManager.getInstance().dispose() to\ destroy the current instance before instanciating a new instance 4=The server is using a wire format that is not available on the client classpath: {0} 5=Failed to dispatch action "{0}" to server. No response from server. Timeout was set to "{1}" 6=Failed to deserialize remote dispatcher handshake from the servermule-2.0.1/modules/client/src/test/0000755000175000017500000000000011351411163016770 5ustar charlescharlesmule-2.0.1/modules/client/src/test/java/0000755000175000017500000000000011351411163017711 5ustar charlescharlesmule-2.0.1/modules/client/src/test/java/org/0000755000175000017500000000000011351411163020500 5ustar charlescharlesmule-2.0.1/modules/client/src/test/java/org/mule/0000755000175000017500000000000011351411163021442 5ustar charlescharlesmule-2.0.1/modules/client/src/test/java/org/mule/module/0000755000175000017500000000000011351411163022727 5ustar charlescharlesmule-2.0.1/modules/client/src/test/java/org/mule/module/client/0000755000175000017500000000000011351411163024205 5ustar charlescharlesmule-2.0.1/modules/client/src/test/java/org/mule/module/client/AbstractMuleClientTestCase.java0000644000175000017500000000357310765304425032253 0ustar charlescharles/* * $Id: AbstractMuleClientTestCase.java 11310 2008-03-10 19:16:37Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.tck.AbstractMuleTestCase; public abstract class AbstractMuleClientTestCase extends AbstractMuleTestCase { public void testInboundEndpointCache() throws MuleException { MuleClient muleClient = new MuleClient(); InboundEndpoint endpointa = muleClient.getInboundEndpoint("test://test1"); InboundEndpoint endpointd = muleClient.getInboundEndpoint("test://test2"); InboundEndpoint endpointb = muleClient.getInboundEndpoint("test://test1"); InboundEndpoint endpointc = muleClient.getInboundEndpoint("test://test1"); assertEquals(endpointa, endpointc); assertEquals(endpointb, endpointb); assertNotSame(endpointa, endpointd); } public void testOutboundEndpointCache() throws MuleException { MuleClient muleClient = new MuleClient(); OutboundEndpoint endpointa = muleClient.getOutboundEndpoint("test://test1"); OutboundEndpoint endpointb = muleClient.getOutboundEndpoint("test://test1"); OutboundEndpoint endpointd = muleClient.getOutboundEndpoint("test://test2"); OutboundEndpoint endpointc = muleClient.getOutboundEndpoint("test://test1"); assertEquals(endpointa, endpointc); assertEquals(endpointb, endpointb); assertNotSame(endpointa, endpointd); } } mule-2.0.1/modules/client/src/test/java/org/mule/module/client/MuleClientStandaloneTestCase.java0000644000175000017500000000244010777050076032573 0ustar charlescharles/* * $Id: MuleClientStandaloneTestCase.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client; import org.mule.api.MuleContext; import org.mule.api.MuleException; public class MuleClientStandaloneTestCase extends AbstractMuleClientTestCase { protected MuleContext createMuleContext() throws Exception { return null; } public void testCreateMuleClient() throws MuleException { MuleClient muleClient = new MuleClient(); assertNotSame(muleContext, muleClient.getMuleContext()); assertTrue(muleClient.getMuleContext().isInitialised()); assertTrue(muleClient.getMuleContext().isStarted()); muleClient.dispatch("test://test", "message", null); muleClient.send("test://test", "message", null); muleClient.dispose(); assertFalse(muleClient.getMuleContext().isInitialised()); assertFalse(muleClient.getMuleContext().isStarted()); } } mule-2.0.1/modules/client/src/test/java/org/mule/module/client/MuleClientTestCase.java0000644000175000017500000000214710777050076030566 0ustar charlescharles/* * $Id: MuleClientTestCase.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.client; import org.mule.api.MuleException; public class MuleClientTestCase extends AbstractMuleClientTestCase { public void testCreateMuleClient() throws MuleException { MuleClient muleClient = new MuleClient(); assertEquals(muleContext, muleClient.getMuleContext()); assertTrue(muleContext.isInitialised()); assertTrue(muleContext.isStarted()); muleClient.dispatch("test://test", "message", null); muleClient.send("test://test", "message", null); muleClient.dispose(); assertTrue(muleClient.getMuleContext().isInitialised()); assertTrue(muleClient.getMuleContext().isStarted()); } } mule-2.0.1/modules/client/pom.xml0000644000175000017500000000410411006063605016537 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-client Mule Client MuleClient is a simple interface for Mule clients to send and receive events from local or remote Mule Servers. org.mule.modules mule-module-builders ${version} org.mule.modules mule-module-xml ${version} org.mule mule-core ${version} test test-jar osgi org.apache.felix maven-bundle-plugin org.mule.module.client.* mule-2.0.1/modules/ognl/0000755000175000017500000000000011351411136014703 5ustar charlescharlesmule-2.0.1/modules/ognl/src/0000755000175000017500000000000011351411136015472 5ustar charlescharlesmule-2.0.1/modules/ognl/src/main/0000755000175000017500000000000011351411136016416 5ustar charlescharlesmule-2.0.1/modules/ognl/src/main/java/0000755000175000017500000000000011351411136017337 5ustar charlescharlesmule-2.0.1/modules/ognl/src/main/java/org/0000755000175000017500000000000011351411136020126 5ustar charlescharlesmule-2.0.1/modules/ognl/src/main/java/org/mule/0000755000175000017500000000000011351411136021070 5ustar charlescharlesmule-2.0.1/modules/ognl/src/main/java/org/mule/module/0000755000175000017500000000000011351411136022355 5ustar charlescharlesmule-2.0.1/modules/ognl/src/main/java/org/mule/module/ognl/0000755000175000017500000000000011351411136023314 5ustar charlescharlesmule-2.0.1/modules/ognl/src/main/java/org/mule/module/ognl/config/0000755000175000017500000000000011351411136024561 5ustar charlescharlesmule-2.0.1/modules/ognl/src/main/java/org/mule/module/ognl/config/OGNLNamespaceHandler.java0000644000175000017500000000324110763667515031322 0ustar charlescharles/* * $Id: OGNLNamespaceHandler.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.ognl.config; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.module.ognl.filters.OGNLFilter; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; /** * Registers Bean Definition Parsers for the "ognl" namespace. */ public class OGNLNamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("filter", new ChildDefinitionParser("filter", OGNLFilter.class)); registerBeanDefinitionParser("expression", new CDATABeanDefinitionParser("expression", String.class)); } private static class CDATABeanDefinitionParser extends ChildDefinitionParser { private CDATABeanDefinitionParser(String setterMethod, Class clazz) { super(setterMethod, clazz); } protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { assembler.extendTarget(setterMethod, element.getFirstChild().getNodeValue(), false); } } } mule-2.0.1/modules/ognl/src/main/java/org/mule/module/ognl/filters/0000755000175000017500000000000011351411136024764 5ustar charlescharlesmule-2.0.1/modules/ognl/src/main/java/org/mule/module/ognl/filters/OGNLFilter.java0000644000175000017500000000522210763667515027561 0ustar charlescharles/* * $Id: OGNLFilter.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.ognl.filters; import org.mule.api.MuleMessage; import org.mule.api.config.ConfigurationException; import org.mule.api.routing.filter.Filter; import ognl.Ognl; import ognl.OgnlException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class OGNLFilter implements Filter { protected final Log logger = LogFactory.getLog(this.getClass()); private volatile String expression; private volatile Object compiledExpression; public String getExpression() { return expression; } /** * Sets the expression for this filter. The argument must be a valid expression * as described in the OGNL documentation. * * @param expression the expression to use for message evaluation * @throws ConfigurationException if the expression cannot be parsed * @see {@link Ognl#parseExpression(String)} */ public void setExpression(String expression) throws ConfigurationException { try { this.compiledExpression = Ognl.parseExpression(expression); this.expression = expression; } catch (OgnlException ex) { throw new ConfigurationException(ex); } } public boolean accept(MuleMessage message) { // no message: nothing to filter if (message == null) { return false; } Object candidate = message.getPayload(); // no payload: still nothing to filter if (candidate == null) { return false; } // no expression configured: we reject by default if (compiledExpression == null) { logger.warn("No expression configured - rejecting message."); return false; } try { Object result = Ognl.getValue(compiledExpression, candidate); // we only need to take boolean expressoin results into account if (result instanceof Boolean) { return ((Boolean) result).booleanValue(); } } catch (OgnlException ex) { logger.error(ex); } // default action: reject return false; } } mule-2.0.1/modules/ognl/src/main/resources/0000755000175000017500000000000011351411136020430 5ustar charlescharlesmule-2.0.1/modules/ognl/src/main/resources/META-INF/0000755000175000017500000000000011351411136021570 5ustar charlescharlesmule-2.0.1/modules/ognl/src/main/resources/META-INF/MANIFEST.MF0000644000175000017500000000000010553776311023224 0ustar charlescharlesmule-2.0.1/modules/ognl/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012410754365306024451 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/ognl/2.0/mule-ognl.xsd=META-INF/mule-ognl.xsdmule-2.0.1/modules/ognl/src/main/resources/META-INF/mule-ognl.xsd0000644000175000017500000000241010761263355024220 0ustar charlescharles mule-2.0.1/modules/ognl/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014110763667515024634 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/ognl/2.0=org.mule.module.ognl.config.OGNLNamespaceHandler mule-2.0.1/modules/ognl/src/test/0000755000175000017500000000000011351411136016451 5ustar charlescharlesmule-2.0.1/modules/ognl/src/test/java/0000755000175000017500000000000011351411136017372 5ustar charlescharlesmule-2.0.1/modules/ognl/src/test/java/org/0000755000175000017500000000000011351411136020161 5ustar charlescharlesmule-2.0.1/modules/ognl/src/test/java/org/mule/0000755000175000017500000000000011351411136021123 5ustar charlescharlesmule-2.0.1/modules/ognl/src/test/java/org/mule/routing/0000755000175000017500000000000011351411136022612 5ustar charlescharlesmule-2.0.1/modules/ognl/src/test/java/org/mule/routing/filters/0000755000175000017500000000000011351411136024262 5ustar charlescharlesmule-2.0.1/modules/ognl/src/test/java/org/mule/routing/filters/OGNLFilterTestCase.java0000644000175000017500000001144310763667515030515 0ustar charlescharles/* * $Id: OGNLFilterTestCase.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.config.ConfigurationException; import org.mule.module.client.MuleClient; import org.mule.module.ognl.filters.OGNLFilter; import org.mule.routing.outbound.FilteringOutboundRouter; import org.mule.tck.FunctionalTestCase; public class OGNLFilterTestCase extends FunctionalTestCase { public static final String DEFAULT_INPUT_QUEUE = "vm://in"; public static final String DEFUALT_OUTPUT_QUEUE = "vm://out"; public static final String FIRST_MESSAGE = "foo"; public static final String SECOND_MESSAGE = "foobar"; public static final String THIRD_MESSAGE = "INPUT MESSAGE"; public static final long TIMEOUT = 2000; public static final String OGNL_EXSPRESSION = " equals(\"foo\") || content.endsWith(\"bar\") "; public static final String SERVICE_NAME = "OGNLServiceWrapper1"; protected String getConfigResources() { return "ognl-functional-test.xml"; } private OGNLFilter filter; // @Override protected void doSetUp() throws Exception { filter = new OGNLFilter(); } // @Override protected void doTearDown() throws Exception { filter = null; } public void testNewFilter() { assertFalse(filter.accept(null)); } public void testNoExpressionEmptyMessage() { MuleMessage message = new DefaultMuleMessage(null); assertFalse(filter.accept(message)); } public void testNoExpressionValidMessage() { MuleMessage message = new DefaultMuleMessage("foo"); assertFalse(filter.accept(message)); } public void testNamespaceHandler() { String expression = ((OGNLFilter) ((FilteringOutboundRouter) muleContext.getRegistry(). lookupService(SERVICE_NAME).getOutboundRouter().getRouters().get(0)). getFilter()).getExpression(); assertEquals(expression, OGNL_EXSPRESSION); } public void testFunctionalTest() throws Exception { MuleClient client = new MuleClient(); try { client.dispatch(DEFAULT_INPUT_QUEUE, FIRST_MESSAGE, null); MuleMessage message = client.request(DEFUALT_OUTPUT_QUEUE, TIMEOUT); assertNotNull(message); assertNotNull(message.getPayload()); assertNull(message.getExceptionPayload()); assertEquals(FIRST_MESSAGE, message.getPayload()); Dummy payload = new Dummy(); payload.setContent(SECOND_MESSAGE); client.dispatch(DEFAULT_INPUT_QUEUE, new DefaultMuleMessage(payload)); message = client.request(DEFUALT_OUTPUT_QUEUE, TIMEOUT); assertNotNull(message); assertNotNull(message.getPayload()); assertNull(message.getExceptionPayload()); assertEquals(SECOND_MESSAGE, ((Dummy) message.getPayload()).getContent()); client.dispatch(DEFAULT_INPUT_QUEUE, THIRD_MESSAGE, null); message = client.request(DEFUALT_OUTPUT_QUEUE, TIMEOUT); assertNull(message); } finally { client.dispose(); } } public void testInvalidObjectExpression() { try { filter.setExpression("foo:bar"); fail("should have failed with ConfigurationException"); } catch (ConfigurationException configex) { // expected } // make sure the filter is still unconfigured assertNull(filter.getExpression()); } // a simple POJO for testing object expressions private static class Dummy { private int id; private String content; public Dummy() { super(); } /** * @return Returns the content. */ public String getContent() { return content; } /** * @param content The content to set. */ public void setContent(String content) { this.content = content; } /** * @return Returns the id. */ public int getId() { return id; } /** * @param id The id to set. */ public void setId(int id) { this.id = id; } } } mule-2.0.1/modules/ognl/src/test/resources/0000755000175000017500000000000011351411136020463 5ustar charlescharlesmule-2.0.1/modules/ognl/src/test/resources/log4j.properties0000644000175000017500000000050210547540350023624 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/modules/ognl/src/test/resources/ognl-functional-test.xml0000644000175000017500000000300210745174725025274 0ustar charlescharles mule-2.0.1/modules/ognl/pom.xml0000644000175000017500000000564611006063605016234 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-ognl OGNL Filter Support for filtering events using OGNL notation. osgi org.apache.felix maven-bundle-plugin ognl.* ognl ognl 2.7.2 jboss javassist 3.6.ga org.mule mule-core ${version} org.mule.modules mule-module-spring-config ${version} provided org.mule.modules mule-module-client ${version} test org.mule.tests mule-tests-functional ${version} test org.mule.transports mule-transport-vm ${version} test mule-2.0.1/modules/scripting/0000755000175000017500000000000011351411143015744 5ustar charlescharlesmule-2.0.1/modules/scripting/src/0000755000175000017500000000000011351411142016532 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/0000755000175000017500000000000011351411143017457 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/java/0000755000175000017500000000000011351411142020377 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/java/org/0000755000175000017500000000000011351411142021166 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/java/org/mule/0000755000175000017500000000000011351411142022130 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/java/org/mule/module/0000755000175000017500000000000011351411142023415 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/0000755000175000017500000000000011351411142025417 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/expression/0000755000175000017500000000000011351411142027616 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/expression/GroovyExpressionEvaluator.javamule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/expression/GroovyExpressionEval0000644000175000017500000000224610770356575033750 0ustar charlescharles/* * $Id: GroovyExpressionEvaluator.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.scripting.expression; import org.mule.api.MuleMessage; /** * An {@link org.mule.util.expression.ExpressionEvaluator} that allows the user to define Groovy expressions to extract * data from the current message. * * If a POJO is passed in it is accessible from the 'payload' namespace. If a {@link MuleMessage} instance is used then * it is accessible from the message' namespace and the 'payload' namespace is also available. */ public class GroovyExpressionEvaluator extends AbstractScriptExpressionEvaluator { public static final String NAME = "groovy"; /** * Gets the name of the object * * @return the name of the object */ public String getName() { return NAME; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/expression/AbstractScriptExpressionEvaluator.javamule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/expression/AbstractScriptExpres0000644000175000017500000000710710764120222033670 0ustar charlescharles/* * $Id: AbstractScriptExpressionEvaluator.java 11239 2008-03-07 01:55:30Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.scripting.expression; import org.mule.api.MuleRuntimeException; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transport.MessageAdapter; import org.mule.config.i18n.CoreMessages; import org.mule.module.scripting.component.Scriptable; import org.mule.util.expression.ExpressionEvaluator; import java.util.Map; import java.util.WeakHashMap; import javax.script.Bindings; import javax.script.ScriptException; /** * An abstract {@link org.mule.util.expression.ExpressionEvaluator} that can be used for any JSR-233 script engine. * * If a POJO is passed in it is accessible from the 'payload' namespace. If a {@link MuleMessage} instance is used then * it is accessible from the message' namespace and the 'payload' namespace is also available. */ public abstract class AbstractScriptExpressionEvaluator implements ExpressionEvaluator, Disposable { protected Map cache = new WeakHashMap(8); /** * Extracts a single property from the message * * @param expression the property expression or expression * @param message the message to extract from * @return the result of the extraction or null if the property was not found */ public Object evaluate(String expression, Object message) { Scriptable script = getScript(expression); Bindings bindings = script.getScriptEngine().createBindings(); populateBindings(bindings, message); try { return script.runScript(bindings); } catch (ScriptException e) { return null; } } protected void populateBindings(Bindings namespace, Object message) { if(message instanceof MessageAdapter) { namespace.put("message", message); namespace.put("payload", ((MessageAdapter)message).getPayload()); } else { namespace.put("payload", message); } } /** * Sets the name of the object * * @param name the name of the object */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } protected Scriptable getScript(String expression) { Scriptable script = (Scriptable)cache.get(expression); if(script==null) { script = new Scriptable(); script.setScriptEngineName(getName()); script.setScriptText(expression); try { script.initialise(); } catch (InitialisationException e) { throw new MuleRuntimeException( CoreMessages.initialisationFailure("An error occurred initialising script."), e); } cache.put(expression, script); } return script; } /** * A lifecycle method where implementor should free up any resources. If an * exception is thrown it should just be logged and processing should continue. * This method should not throw Runtime exceptions. */ public void dispose() { cache.clear(); } }mule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/transformer/0000755000175000017500000000000011351411142027761 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/transformer/ScriptTransformer.javamule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/transformer/ScriptTransformer.j0000644000175000017500000000632610774254333033651 0ustar charlescharles/* * $Id: ScriptTransformer.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.scripting.transformer; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transformer.TransformerException; import org.mule.module.scripting.component.Scriptable; import org.mule.transformer.AbstractMessageAwareTransformer; import javax.script.Bindings; import javax.script.CompiledScript; import javax.script.ScriptEngine; import javax.script.ScriptException; /** * Runs a script to perform transformation on an object. */ public class ScriptTransformer extends AbstractMessageAwareTransformer { protected final Scriptable scriptable = new Scriptable(); public ScriptTransformer() { super(); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { Bindings bindings = this.getScriptEngine().createBindings(); this.populateBindings(bindings, message); try { return scriptable.runScript(bindings); } catch (ScriptException e) { throw new TransformerException(this, e); } } protected void populateBindings(Bindings namespace, MuleMessage message) { namespace.put("message", message); namespace.put("src", message.getPayload()); namespace.put("transformerNamespace", namespace); namespace.put("log", logger); } /** * Template method were deriving classes can do any initialisation after the * properties have been set on this transformer * * @throws org.mule.api.lifecycle.InitialisationException */ public void initialise() throws InitialisationException { super.initialise(); scriptable.initialise(); } public ScriptEngine getScriptEngine() { return scriptable.getScriptEngine(); } public void setScriptEngine(ScriptEngine scriptEngine) { scriptable.setScriptEngine(scriptEngine); } public CompiledScript getCompiledScript() { return scriptable.getCompiledScript(); } public void setCompiledScript(CompiledScript compiledScript) { scriptable.setCompiledScript(compiledScript); } public String getScriptText() { return scriptable.getScriptText(); } public void setScriptText(String scriptText) { scriptable.setScriptText(scriptText); } public String getScriptFile() { return scriptable.getScriptFile(); } public void setScriptFile(String scriptFile) { scriptable.setScriptFile(scriptFile); } public void setScriptEngineName(String scriptEngineName) { scriptable.setScriptEngineName(scriptEngineName); } public String getScriptEngineName() { return scriptable.getScriptEngineName(); } } mule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/builders/0000755000175000017500000000000011351411143027231 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/builders/ScriptConfigurationBuilder.javamule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/builders/ScriptConfigurationBui0000644000175000017500000000577410763667515033653 0ustar charlescharles/* * $Id: ScriptConfigurationBuilder.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.scripting.builders; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.config.ConfigResource; import org.mule.config.builders.AbstractResourceConfigurationBuilder; import org.mule.config.builders.i18n.BuildersMessages; import org.mule.module.scripting.component.Scriptable; import javax.script.Bindings; /** Configures Mule from one or more script files. */ public class ScriptConfigurationBuilder extends AbstractResourceConfigurationBuilder { public static final String SCRIPT_ENGINE_NAME_PROPERTY = "org.mule.script.engine"; private Scriptable scriptComponent = new Scriptable(); protected MuleContext muleContext = null; protected boolean initialised = false; public ScriptConfigurationBuilder(String configResource) throws MuleException { this(System.getProperty(SCRIPT_ENGINE_NAME_PROPERTY), configResource); } public ScriptConfigurationBuilder(String[] configResources) throws MuleException { this(System.getProperty(SCRIPT_ENGINE_NAME_PROPERTY), configResources); } public ScriptConfigurationBuilder(String scriptEngineName, String configResource) throws MuleException { super(configResource); if (scriptEngineName == null) { // we can guess engine by file extension logger.warn(BuildersMessages.systemPropertyNotSet(SCRIPT_ENGINE_NAME_PROPERTY).getMessage()); } scriptComponent.setScriptEngineName(scriptEngineName); } public ScriptConfigurationBuilder(String scriptEngineName, String[] configResources) throws MuleException { super(configResources); if (scriptEngineName == null) { // we can guess engine by file extension logger.warn(BuildersMessages.systemPropertyNotSet(SCRIPT_ENGINE_NAME_PROPERTY).getMessage()); } scriptComponent.setScriptEngineName(scriptEngineName); } protected void doConfigure(MuleContext muleContext) throws Exception { this.muleContext = muleContext; for (int i = 0; i < configResources.length; i++) { ConfigResource configResource = configResources[i]; scriptComponent.setScriptFile(configResource.getResourceName()); scriptComponent.initialise(); Bindings ns = scriptComponent.getScriptEngine().createBindings(); populateBindings(ns); scriptComponent.runScript(ns); } } protected void populateBindings(Bindings bindings) { bindings.put("muleContext", muleContext); } } mule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/component/0000755000175000017500000000000011351411142027421 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/component/package.html0000644000175000017500000000021310763667515031725 0ustar charlescharles Mule Base classes for script based components such as BeanShell or Groovy. mule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/component/Scriptable.java0000644000175000017500000001527410774254333032404 0ustar charlescharles/* * $Id: Scriptable.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.scripting.component; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; import javax.script.Bindings; import javax.script.Compilable; import javax.script.CompiledScript; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A JSR 223 Script service. Allows any JSR 223 compliant script engines such as * javaScript, Groovy or Rhino to be embedded as Mule components. */ public class Scriptable implements Initialisable { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); private String scriptText; private String scriptFile; private Reader script; private CompiledScript compiledScript; private ScriptEngine scriptEngine; private String scriptEngineName; public void initialise() throws InitialisationException { if (scriptEngine == null) { if (compiledScript == null) { if (scriptEngineName != null) { scriptEngine = createScriptEngineByName(scriptEngineName); } else if (scriptFile != null) { int i = scriptFile.lastIndexOf("."); if (i > -1) { logger.info("Script Engine name not set. Guessing by file extension."); scriptEngine = createScriptEngineByExtension(scriptFile.substring(i + 1)); if(scriptEngine != null) { setScriptEngineName(scriptEngine.getFactory().getEngineName()); } } } if (scriptEngine == null) { throw new InitialisationException( CoreMessages.propertiesNotSet("scriptEngine, scriptEngineName, compiledScript"), this); } } else { scriptEngine = compiledScript.getEngine(); } } if (compiledScript == null) { if (script == null) { if (scriptText == null && scriptFile == null) { throw new InitialisationException( CoreMessages.propertiesNotSet("scriptText, scriptFile"), this); } else if (scriptText != null) { script = new StringReader(scriptText); } else { InputStream is; try { is = IOUtils.getResourceAsStream(scriptFile, getClass()); script = new InputStreamReader(is); } catch (IOException e) { throw new InitialisationException( CoreMessages.cannotLoadFromClasspath(scriptFile), e, this); } } } try { compiledScript = compileScript(script); } catch (ScriptException e) { throw new InitialisationException(e, this); } } } public ScriptEngine getScriptEngine() { return scriptEngine; } public void setScriptEngine(ScriptEngine scriptEngine) { this.scriptEngine = scriptEngine; } public CompiledScript getCompiledScript() { return compiledScript; } public void setCompiledScript(CompiledScript compiledScript) { this.compiledScript = compiledScript; } public String getScriptText() { return scriptText; } public void setScriptText(String scriptText) { this.scriptText = scriptText; } public String getScriptFile() { return scriptFile; } public void setScriptFile(String scriptFile) { this.scriptFile = scriptFile; } public void setScriptEngineName(String scriptEngineName) { this.scriptEngineName = scriptEngineName; } public String getScriptEngineName() { return scriptEngineName; } protected CompiledScript compileScript(Compilable compilable, Reader scriptReader) throws ScriptException { return compilable.compile(scriptReader); } protected CompiledScript compileScript(Reader scriptReader) throws ScriptException { if (scriptEngine instanceof Compilable) { Compilable compilable = (Compilable)scriptEngine; return compileScript(compilable, scriptReader); } return null; } protected CompiledScript compileScript(Compilable compilable) throws ScriptException { return compileScript(compilable, script); } protected Object evaluteScript(Bindings bindings) throws ScriptException { return scriptEngine.eval(scriptText, bindings); } public Object runScript(Bindings bindings) throws ScriptException { Object result; if (compiledScript != null) { result = compiledScript.eval(bindings); } else { result = evaluteScript(bindings); } return result; } public Object runScript(CompiledScript compiledScript, Bindings bindings) throws ScriptException { Object result = null; if (compiledScript != null) { result = compiledScript.eval(bindings); } return result; } protected ScriptEngine createScriptEngineByName(String name) { return new ScriptEngineManager().getEngineByName(name); } protected ScriptEngine createScriptEngineByExtension(String ext) { return new ScriptEngineManager().getEngineByExtension(ext); } } mule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/component/ScriptComponent.java0000644000175000017500000000364410774254333033441 0ustar charlescharles/* * $Id: ScriptComponent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.scripting.component; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.InitialisationException; import org.mule.util.MuleLogger; import javax.script.Bindings; /** * A JSR 223 Script service. Allows any JSR 223 compliant script engines such as * JavaScript, Groovy or Rhino to be embedded as Mule components. */ public class ScriptComponent extends Scriptable implements Callable { private Bindings bindings; // @Override public void initialise() throws InitialisationException { super.initialise(); bindings = getScriptEngine().createBindings(); } public Object onCall(MuleEventContext eventContext) throws Exception { populateBindings(bindings, eventContext); Object result = runScript(bindings); if (result == null) { result = bindings.get("result"); } return result; } protected void populateBindings(Bindings namespace, MuleEventContext context) { namespace.put("eventContext", context); namespace.put("muleContext", context.getMuleContext()); namespace.put("message", context.getMessage()); namespace.put("descriptor", context.getService()); namespace.put("componentNamespace", this.bindings); namespace.put("log", new MuleLogger(logger)); namespace.put("result", new Object()); } public Bindings getBindings() { return bindings; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/component/GroovyRefreshableBeanBuilder.javamule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/component/GroovyRefreshableBean0000644000175000017500000000451310763667515033614 0ustar charlescharles/* * $Id: GroovyRefreshableBeanBuilder.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.scripting.component; import org.mule.api.DefaultMuleException; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; import org.mule.config.i18n.CoreMessages; import org.mule.util.StringUtils; import groovy.lang.GroovyObject; import groovy.lang.MetaMethod; public class GroovyRefreshableBeanBuilder implements Callable { private volatile Object refreshableBean; private String methodName; private static final String ON_CALL = "onCall"; private static final Class[] UMOEVENTCONTEXT = new Class[]{MuleEventContext.class}; public GroovyRefreshableBeanBuilder() { super(); } public Object onCall(MuleEventContext eventContext) throws Exception { if (refreshableBean instanceof GroovyObject) { GroovyObject script = (GroovyObject)refreshableBean; MetaMethod onCall = script.getMetaClass().pickMethod("onCall", UMOEVENTCONTEXT); if (onCall != null) { return script.invokeMethod(ON_CALL, eventContext); } else { if (StringUtils.isEmpty(methodName)) { throw new DefaultMuleException(CoreMessages.propertiesNotSet("methodName")); } return script.invokeMethod(methodName, eventContext.transformMessage()); } } throw new Exception(new DefaultMuleException("script engine not supported")); } public Object getRefreshableBean() { return refreshableBean; } public void setRefreshableBean(Object refreshableBean) { this.refreshableBean = refreshableBean; } public String getMethodName() { return methodName; } public void setMethodName(String methodName) { this.methodName = methodName; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/component/ScriptMessageBuilder.javamule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/component/ScriptMessageBuilder.0000644000175000017500000001037010774254333033522 0ustar charlescharles/* * $Id: ScriptMessageBuilder.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.scripting.component; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.component.builder.AbstractMessageBuilder; import org.mule.component.builder.MessageBuilderException; import javax.script.Bindings; import javax.script.Compilable; import javax.script.CompiledScript; import javax.script.ScriptEngine; import javax.script.ScriptException; /** * A message builder service that can execute message building as a script. */ public class ScriptMessageBuilder extends AbstractMessageBuilder implements Initialisable { /** Delegating script service that actually does the work */ protected Scriptable scriptable; public ScriptMessageBuilder() { this.scriptable = new Scriptable(); } public Object buildMessage(MuleMessage request, MuleMessage response) throws MessageBuilderException { Bindings bindings = scriptable.getScriptEngine().createBindings(); populateBindings(bindings, request, response); Object result = null; try { result = runScript(bindings); } catch (ScriptException e) { throw new MessageBuilderException(response, e); } if (result == null) { throw new IllegalArgumentException("A result payload must be returned from the groovy script"); } return result; } public void initialise() throws InitialisationException { scriptable.initialise(); } protected void populateBindings(Bindings namespace, MuleMessage request, MuleMessage response) { namespace.put("request", request); namespace.put("response", response); namespace.put("service", service); namespace.put("componentNamespace", namespace); namespace.put("log", logger); } public ScriptEngine getScriptEngine() { return scriptable.getScriptEngine(); } public void setScriptEngine(ScriptEngine scriptEngine) { scriptable.setScriptEngine(scriptEngine); } public CompiledScript getCompiledScript() { return scriptable.getCompiledScript(); } public void setCompiledScript(CompiledScript compiledScript) { scriptable.setCompiledScript(compiledScript); } public String getScriptText() { return scriptable.getScriptText(); } public void setScriptText(String scriptText) { scriptable.setScriptText(scriptText); } public String getScriptFile() { return scriptable.getScriptFile(); } public void setScriptFile(String scriptFile) { scriptable.setScriptFile(scriptFile); } public void setScriptEngineName(String scriptEngineName) { scriptable.setScriptEngineName(scriptEngineName); } protected void populateBindings(Bindings namespace, MuleEventContext context) { namespace.put("context", context); namespace.put("message", context.getMessage()); namespace.put("descriptor", context.getService()); namespace.put("componentNamespace", namespace); namespace.put("log", logger); namespace.put("result", new Object()); } protected void compileScript(Compilable compilable) throws ScriptException { scriptable.compileScript(compilable); } protected Object evaluteScript(Bindings namespace) throws ScriptException { return scriptable.evaluteScript(namespace); } protected Object runScript(Bindings namespace) throws ScriptException { return scriptable.runScript(namespace); } protected ScriptEngine createScriptEngine() { return scriptable.createScriptEngineByName(scriptable.getScriptEngineName()); } } mule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/config/0000755000175000017500000000000011351411142026664 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/config/ScriptDefinitionParser.javamule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/config/ScriptDefinitionParser.j0000644000175000017500000000235510763667515033525 0ustar charlescharles/* * $Id: ScriptDefinitionParser.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.scripting.config; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; import org.w3c.dom.Element; import org.springframework.beans.factory.xml.ParserContext; public class ScriptDefinitionParser extends MuleOrphanDefinitionParser { public ScriptDefinitionParser(boolean singleton) { super(singleton); addIgnored("name"); } protected Class getBeanClass(org.w3c.dom.Element element) { return String.class; } protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { assembler.getBean().addConstructorArg(element.getFirstChild().getNodeValue()); super.postProcess(context, assembler, element); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/config/GroovyRefreshableBeanBuilderParser.javamule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/config/GroovyRefreshableBeanBui0000644000175000017500000000176210763667515033522 0ustar charlescharles/* * $Id: GroovyRefreshableBeanBuilderParser.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.scripting.config; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; import org.mule.module.scripting.component.GroovyRefreshableBeanBuilder; import org.w3c.dom.Element; public class GroovyRefreshableBeanBuilderParser extends MuleOrphanDefinitionParser { public GroovyRefreshableBeanBuilderParser(boolean singleton) { super(singleton); addIgnored("name"); } protected Class getBeanClass(Element element) { return GroovyRefreshableBeanBuilder.class; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/config/ScriptingNamespaceHandler.javamule-2.0.1/modules/scripting/src/main/java/org/mule/module/scripting/config/ScriptingNamespaceHandle0000644000175000017500000000160110764042034033507 0ustar charlescharles/* * $Id: ScriptingNamespaceHandler.java 11230 2008-03-06 19:21:00Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.scripting.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; public class ScriptingNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerIgnoredElement("lang"); registerBeanDefinitionParser("script", new ScriptDefinitionParser(false)); registerBeanDefinitionParser("groovy-refreshable", new GroovyRefreshableBeanBuilderParser(false)); } } mule-2.0.1/modules/scripting/src/main/resources/0000755000175000017500000000000011351411143021471 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/resources/META-INF/0000755000175000017500000000000011351411143022631 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/resources/META-INF/MANIFEST.MF0000644000175000017500000000000010553776311024267 0ustar charlescharlesmule-2.0.1/modules/scripting/src/main/resources/META-INF/spring.schemas0000644000175000017500000000014410654121351025503 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/scripting/2.0/mule-scripting.xsd=META-INF/mule-scripting.xsd mule-2.0.1/modules/scripting/src/main/resources/META-INF/spring.handlers0000644000175000017500000000016010763667515025700 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/scripting/2.0=org.mule.module.scripting.config.ScriptingNamespaceHandler mule-2.0.1/modules/scripting/src/main/resources/META-INF/services/0000755000175000017500000000000011351411143024454 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351411143025243 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351411143026205 5ustar charlescharlesmule-2.0.1/modules/scripting/src/main/resources/META-INF/services/org/mule/config/0000755000175000017500000000000011351411143027452 5ustar charlescharles././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootmule-2.0.1/modules/scripting/src/main/resources/META-INF/services/org/mule/config/registry-bootstrap.propertiesmule-2.0.1/modules/scripting/src/main/resources/META-INF/services/org/mule/config/registry-bootstrap0000644000175000017500000000011110764075260033266 0ustar charlescharlesobject.1=org.mule.module.scripting.expression.GroovyExpressionEvaluator mule-2.0.1/modules/scripting/src/main/resources/META-INF/mule-scripting.xsd0000644000175000017500000000465610764041564026343 0ustar charlescharles This element allows the http://www.springframework.org/schema/lang namespace to be embedded. mule-2.0.1/modules/scripting/src/test/0000755000175000017500000000000011351411142017511 5ustar charlescharlesmule-2.0.1/modules/scripting/src/test/java/0000755000175000017500000000000011351411141020431 5ustar charlescharlesmule-2.0.1/modules/scripting/src/test/java/org/0000755000175000017500000000000011351411141021220 5ustar charlescharlesmule-2.0.1/modules/scripting/src/test/java/org/mule/0000755000175000017500000000000011351411142022163 5ustar charlescharlesmule-2.0.1/modules/scripting/src/test/java/org/mule/transformers/0000755000175000017500000000000011351411142024710 5ustar charlescharlesmule-2.0.1/modules/scripting/src/test/java/org/mule/transformers/script/0000755000175000017500000000000011351411142026214 5ustar charlescharles././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/modules/scripting/src/test/java/org/mule/transformers/script/GroovyScriptTransformerTestCase.javamule-2.0.1/modules/scripting/src/test/java/org/mule/transformers/script/GroovyScriptTransformerTestC0000644000175000017500000000327210764101307034011 0ustar charlescharles/* * $Id: GroovyScriptTransformerTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.script; import org.mule.api.transformer.Transformer; import org.mule.module.scripting.transformer.ScriptTransformer; import org.mule.transformer.AbstractTransformerTestCase; import java.util.ArrayList; import java.util.List; public class GroovyScriptTransformerTestCase extends AbstractTransformerTestCase { public Transformer getTransformer() throws Exception { ScriptTransformer transformer = new ScriptTransformer(); transformer.setScriptEngineName("groovy"); transformer.setName("StringToList"); transformer.setScriptFile("StringToList2.groovy"); transformer.initialise(); return transformer; } public Transformer getRoundTripTransformer() throws Exception { ScriptTransformer transformer = new ScriptTransformer(); transformer.setName("ListToStringTransformer"); transformer.setScriptFile("ListToString2.groovy"); transformer.initialise(); return transformer; } public Object getTestData() { return "this is groovy!"; } public Object getResultData() { List list = new ArrayList(); list.add("this"); list.add("is"); list.add("groovy!"); return list; } } mule-2.0.1/modules/scripting/src/test/java/org/mule/config/0000755000175000017500000000000011351411142023430 5ustar charlescharlesmule-2.0.1/modules/scripting/src/test/java/org/mule/config/builders/0000755000175000017500000000000011351411142025241 5ustar charlescharles././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootmule-2.0.1/modules/scripting/src/test/java/org/mule/config/builders/GroovyScriptConfigurationBuilderTestCase.javamule-2.0.1/modules/scripting/src/test/java/org/mule/config/builders/GroovyScriptConfigurationBuilder0000644000175000017500000000225110770372465033717 0ustar charlescharles/* * $Id: GroovyScriptConfigurationBuilderTestCase.java 11438 2008-03-20 05:25:09Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.builders; import org.mule.api.MuleException; import org.mule.api.config.ConfigurationBuilder; import org.mule.module.scripting.builders.ScriptConfigurationBuilder; import org.mule.tck.AbstractScriptConfigBuilderTestCase; public class GroovyScriptConfigurationBuilderTestCase extends AbstractScriptConfigBuilderTestCase { public String getConfigResources() { return "mule-config.groovy"; } // @Override public ConfigurationBuilder getBuilder() { try { return new ScriptConfigurationBuilder("groovy", getConfigResources()); } catch (MuleException e) { fail(e.getMessage()); return null; } } } mule-2.0.1/modules/scripting/src/test/java/org/mule/config/builders/ScriptSource.java0000644000175000017500000001723510746275214030560 0ustar charlescharles/* * $Id: ScriptSource.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.builders; import org.mule.api.MuleContext; public class ScriptSource { MuleContext muleContext; // TODO MULE-2205 Reimplement this using the registry instead of the QuickConfigurationBuilder. public ScriptSource() throws Exception { // // need this when running with JMX // //TODO MULE-1988 // muleContext.stop(); // muleContext.setId("GroovyScriptTestCase"); // muleContext.start(); // // //set global properties // muleContext.getRegistry().registerProperty("doCompression", "true"); // //disable the admin agent // //manager.getConfiguration().setServerUrl(""); // // //Set a dummy TX manager // muleContext.setTransactionManager(new TestTransactionManagerFactory().create()); // // //register agents // RmiRegistryAgent rmiAgent = new RmiRegistryAgent(); // rmiAgent.setName("rmiAgent"); // muleContext.getRegistry().registerAgent(rmiAgent); // // JmxAgent agent = new JmxAgent(); // agent.setName("jmxAgent"); // agent.setConnectorServerUrl("service:jmx:rmi:///jndi/rmi://localhost:1099/server"); // Map p = new HashMap(); // p.put("jmx.remote.jndi.rebind", "true"); // agent.setConnectorServerProperties(p); // muleContext.getRegistry().registerAgent(agent); // // //register connector // TestConnector c = new TestConnector(); // c.setName("dummyConnector"); // c.setExceptionListener(new TestExceptionStrategy()); // muleContext.getRegistry().registerConnector(c); // // //Register transformers // TestCompressionTransformer t = new TestCompressionTransformer(); // t.setReturnClass(String.class); // t.setBeanProperty2(12); // t.setContainerProperty(""); // t.setBeanProperty1("this was set from the manager properties!"); // muleContext.getRegistry().registerTransformer(t); // // //Register endpoints // JXPathFilter filter = new JXPathFilter("name"); // filter.setValue("bar"); // Map ns = new HashMap(); // ns.put("foo", "http://foo.com"); // filter.setNamespaces(ns); // builder.registerEndpoint("test://fruitBowlPublishQ", "fruitBowlEndpoint", false, null, filter); // builder.registerEndpoint("test://AppleQueue", "appleInEndpoint", true); // builder.registerEndpoint("test://AppleResponseQueue", "appleResponseEndpoint", false); // builder.registerEndpoint("test://apple.queue", "AppleQueue", false); // builder.registerEndpoint("test://banana.queue", "Banana_Queue", false); // builder.registerEndpoint("test://test.queue", "waterMelonEndpoint", false); // Endpoint ep = new MuleEndpoint("test://test.queue2", false); // ep.setName("testEPWithCS"); // SimpleRetryConnectionStrategy cs = new SimpleRetryConnectionStrategy(); // cs.setRetryCount(4); // cs.setRetryFrequency(3000); // ep.setConnectionStrategy(cs); // builder.getMuleContext().getRegistry().registerEndpoint(ep); // // Map props = new HashMap(); // props.put("testGlobal", "value1"); // builder.registerEndpoint("test://orangeQ", "orangeEndpoint", false, props); // // //register model // Model model = new SedaModel(); // model.setName("main"); // TestExceptionStrategy es = new TestExceptionStrategy(); // es.addEndpoint(new MuleEndpoint("test://service.exceptions", false)); // model.setExceptionListener(es); // model.setLifecycleAdapterFactory(new TestDefaultLifecycleAdapterFactory()); // model.setEntryPointResolver(new TestEntryPointResolver()); // muleContext.getRegistry().registerModel(model); // // //register components // Endpoint ep1 = muleContext.getRegistry().lookupEndpoint("appleInEndpoint"); // ep1.setTransformer(muleContext.getRegistry().lookupTransformer("TestCompressionTransformer")); // UMODescriptor d = builder.createDescriptor(Orange.class.getName(), "orangeComponent", null, ep1, props); // // DefaultServiceExceptionStrategy dces = new DefaultServiceExceptionStrategy(); // dces.addEndpoint(new MuleEndpoint("test://orange.exceptions", false)); // d.setExceptionListener(dces); // //Create the inbound router // InboundRouterCollection inRouter = new DefaultInboundRouterCollection(); // inRouter.setCatchAllStrategy(new ForwardingCatchAllStrategy()); // inRouter.getCatchAllStrategy().setEndpoint(new MuleEndpoint("test2://catch.all", false)); // Endpoint ep2 = builder.createEndpoint("test://orange/", "Orange", true, "TestCompressionTransformer"); // ep2.setResponseTransformer(muleContext.getRegistry().lookupTransformer("TestCompressionTransformer")); // inRouter.addEndpoint(ep2); // Endpoint ep3 = muleContext.getRegistry().lookupEndpoint("orangeEndpoint"); // ep3.setFilter(new PayloadTypeFilter(String.class)); // ep3.setTransformer(muleContext.getRegistry().lookupTransformer("TestCompressionTransformer")); // Map props2 = new HashMap(); // props2.put("testLocal", "value1"); // ep3.setProperties(props2); // inRouter.addEndpoint(ep3); // d.setInboundRouter(inRouter); // // //Nested Router // NestedRouterCollection nestedRouter = new DefaultNestedRouterCollection(); // DefaultNestedRouter nr1 = new DefaultNestedRouter(); // nr1.setEndpoint(new MuleEndpoint("test://do.wash", false)); // nr1.setInterface(FruitCleaner.class); // nr1.setMethod("wash"); // nestedRouter.addRouter(nr1); // DefaultNestedRouter nr2 = new DefaultNestedRouter(); // nr2.setEndpoint(new MuleEndpoint("test://do.polish", false)); // nr2.setInterface(FruitCleaner.class); // nr2.setMethod("polish"); // nestedRouter.addRouter(nr2); // d.setNestedRouter(nestedRouter); // ////Response Router // ResponseRouterCollection responseRouter = new DefaultResponseRouterCollection(); // responseRouter.addEndpoint(new MuleEndpoint("test://response1", true)); // responseRouter.addEndpoint(muleContext.getRegistry().lookupEndpoint("appleResponseEndpoint")); // responseRouter.addRouter(new TestResponseAggregator()); // responseRouter.setTimeout(10001); // d.setResponseRouter(responseRouter); // // //properties // Map cprops = new HashMap(); // //cprops.put("orange", new Orange()); // cprops.put("brand", "Juicy Baby!"); // cprops.put("segments", "9"); // cprops.put("radius", "4.21"); // Map nested = new HashMap(); // nested.put("prop1", "prop1"); // nested.put("prop2", "prop2"); // cprops.put("mapProperties", nested); // List nested2 = new ArrayList(); // nested2.add("prop1"); // nested2.add("prop2"); // nested2.add("prop3"); // cprops.put("listProperties", nested2); // List nested3 = new ArrayList(); // nested3.add("prop4"); // nested3.add("prop5"); // nested3.add("prop6"); // cprops.put("arrayProperties", nested3); // d.setProperties(cprops); // // d.setModelName("main"); // // //register components // muleContext.getRegistry().registerService(d); } }mule-2.0.1/modules/scripting/src/test/java/org/mule/script/0000755000175000017500000000000011351411141023466 5ustar charlescharlesmule-2.0.1/modules/scripting/src/test/java/org/mule/script/expression/0000755000175000017500000000000011351411141025665 5ustar charlescharles././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/modules/scripting/src/test/java/org/mule/script/expression/GroovyExpressionEvaluatorTestCase.javamule-2.0.1/modules/scripting/src/test/java/org/mule/script/expression/GroovyExpressionEvaluatorTestC0000644000175000017500000000350710764075260034027 0ustar charlescharles/* * $Id: GroovyExpressionEvaluatorTestCase.java 11233 2008-03-06 23:13:52Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.script.expression; import org.mule.DefaultMuleMessage; import org.mule.module.scripting.expression.GroovyExpressionEvaluator; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Banana; import org.mule.tck.testmodels.fruit.FruitBowl; public class GroovyExpressionEvaluatorTestCase extends AbstractMuleTestCase { public void testWithExpressions() { Apple apple = new Apple(); apple.wash(); Banana banana = new Banana(); banana.bite(); FruitBowl payload = new FruitBowl(apple, banana); DefaultMuleMessage msg = new DefaultMuleMessage(payload); GroovyExpressionEvaluator e = new GroovyExpressionEvaluator(); Object value = e.evaluate("payload.apple.washed", msg); assertNotNull(value); assertTrue(value instanceof Boolean); assertTrue(((Boolean) value).booleanValue()); value = e.evaluate("message.payload.banana.bitten", msg); assertNotNull(value); assertTrue(value instanceof Boolean); assertTrue(((Boolean) value).booleanValue()); value = e.evaluate("payload.apple.washed", payload); assertNotNull(value); assertTrue(value instanceof Boolean); assertTrue(((Boolean) value).booleanValue()); value = e.evaluate("bar", msg); assertNull(value); } } mule-2.0.1/modules/scripting/src/test/java/org/mule/components/0000755000175000017500000000000011351411141024347 5ustar charlescharlesmule-2.0.1/modules/scripting/src/test/java/org/mule/components/script/0000755000175000017500000000000011351411142025654 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/scripting/src/test/java/org/mule/components/script/GroovyMessageBuilderTestCase.javamule-2.0.1/modules/scripting/src/test/java/org/mule/components/script/GroovyMessageBuilderTestCase.j0000644000175000017500000000203310754375733033607 0ustar charlescharles/* * $Id: GroovyMessageBuilderTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.components.script; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class GroovyMessageBuilderTestCase extends FunctionalTestCase { protected String getConfigResources() { return "groovy-builder-config.xml"; } public void testFunctionBehaviour() throws Exception { MuleClient client = new MuleClient(); MuleMessage m = client.send("vm://groovy.1", "Test:", null); assertNotNull(m); assertEquals("Test: A Received B Received", m.getPayloadAsString()); } } mule-2.0.1/modules/scripting/src/test/java/org/mule/components/script/refreshable/0000755000175000017500000000000011351411142030136 5ustar charlescharles././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/modules/scripting/src/test/java/org/mule/components/script/refreshable/GroovyRefreshableBeanTestCase.javamule-2.0.1/modules/scripting/src/test/java/org/mule/components/script/refreshable/GroovyRefreshableB0000644000175000017500000000570610745677442033652 0ustar charlescharles/* * $Id: GroovyRefreshableBeanTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.components.script.refreshable; public class GroovyRefreshableBeanTestCase extends AbstractRefreshableBeanTestCase { public static final String RECEIVED = "Received"; public static final String RECEIVED2 = "Received2"; public static final String PAYLOAD = "Test:"; public static final String NAME_CALLABLE = "groovy-dynamic-script-callable.groovy"; public static final String NAME_BEAN = "groovy-dynamic-script-bean.groovy"; public static final String NAME_CHANGE_INTERFACE = "groovy-dynamic-script.groovy"; public static final String ON_CALL_RECEIVED = "import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; public class GroovyDynamicScript implements Callable { public Object onCall(MuleEventContext eventContext) throws Exception{ return eventContext.getMessage().getPayloadAsString() + \"" + RECEIVED + "\"; }}"; public static final String ON_CALL_RECEIVED2 = ON_CALL_RECEIVED.replaceAll(RECEIVED, RECEIVED2); public static final String RECEIVE_RECEIVED = "public class GroovyDynamicScript { public String receive(String src) { return src + \"" + RECEIVED + "\"; }}"; public static final String RECEIVE_RECEIVED2 = RECEIVE_RECEIVED.replaceAll(RECEIVED, RECEIVED2); protected String getConfigResources() { return "groovy-refreshable-config.xml"; } public void testFirstOnCallRefresh() throws Exception { runScriptTest(ON_CALL_RECEIVED, NAME_CALLABLE, "vm://groovy_refresh_callable", PAYLOAD, RECEIVED); } public void testCallFirstTest() throws Exception { testFirstOnCallRefresh(); } public void testSecondOnCallRefresh() throws Exception { runScriptTest(ON_CALL_RECEIVED2, NAME_CALLABLE, "vm://groovy_refresh_callable", PAYLOAD, RECEIVED2); } public void testFirstPojoRefresh() throws Exception { runScriptTest(RECEIVE_RECEIVED, NAME_BEAN, "vm://groovy_refresh_bean", PAYLOAD, RECEIVED); } public void testSecondPojoRefresh() throws Exception { runScriptTest(RECEIVE_RECEIVED2, NAME_BEAN, "vm://groovy_refresh_bean", PAYLOAD, RECEIVED2); } public void testFirstChangeInterfaces() throws Exception { runScriptTest(ON_CALL_RECEIVED, NAME_CHANGE_INTERFACE, "vm://groovy_refresh_changeInterfaces", PAYLOAD, RECEIVED); } public void testSecondChangeInterfaces() throws Exception { runScriptTest(RECEIVE_RECEIVED2, NAME_CHANGE_INTERFACE, "vm://groovy_refresh_changeInterfaces", PAYLOAD, RECEIVED2); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/modules/scripting/src/test/java/org/mule/components/script/refreshable/AbstractRefreshableBeanTestCase.javamule-2.0.1/modules/scripting/src/test/java/org/mule/components/script/refreshable/AbstractRefreshabl0000644000175000017500000000363610754375733033657 0ustar charlescharles/* * $Id: AbstractRefreshableBeanTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.components.script.refreshable; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.util.IOUtils; import java.io.FileWriter; import java.io.IOException; import java.net.URL; public abstract class AbstractRefreshableBeanTestCase extends FunctionalTestCase { protected static final int WAIT_TIME = 1000; protected void writeScript(String src, String path) throws IOException { FileWriter scriptFile = new FileWriter(path, false); scriptFile.write(src); scriptFile.flush(); scriptFile.close(); } protected String nameToPath(String name) { URL url = IOUtils.getResourceAsUrl(name, getClass()); String path = url.getFile(); logger.info(url + " -> " + path); return path; } // this is a bit of a messy hack. if it fails check you don't have more than one copy // of the files on your classpath protected void runScriptTest(String script, String name, String endpoint, String payload, String result) throws Exception { // we overwrite the existing resource on the classpath... writeScript(script, nameToPath(name)); Thread.sleep(WAIT_TIME); // wait for bean to refresh MuleClient client = new MuleClient(); MuleMessage m = client.send(endpoint, payload, null); assertNotNull(m); assertEquals(payload + result, m.getPayloadAsString()); } } mule-2.0.1/modules/scripting/src/test/resources/0000755000175000017500000000000011351411142021523 5ustar charlescharlesmule-2.0.1/modules/scripting/src/test/resources/log4j.properties0000644000175000017500000000050310665550311024667 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages #log4j.logger.org.mule=INFO mule-2.0.1/modules/scripting/src/test/resources/mule-config.groovy0000644000175000017500000002347110770372465025230 0ustar charlescharlespackage org.mule.config.builders; import org.mule.tck.testmodels.mule.TestTransactionManagerFactory import org.mule.tck.testmodels.mule.TestConnector import org.mule.tck.testmodels.mule.TestExceptionStrategy import org.mule.tck.testmodels.mule.TestCompressionTransformer import org.mule.routing.filters.MessagePropertyFilter import org.mule.api.endpoint.EndpointBuilder import org.mule.endpoint.EndpointURIEndpointBuilder import org.mule.model.seda.SedaModel import org.mule.tck.testmodels.fruit.FruitCleaner; import org.mule.tck.testmodels.fruit.Orange; import org.mule.tck.testmodels.mule.TestDefaultLifecycleAdapterFactory import org.mule.tck.testmodels.mule.TestEntryPointResolverSet import org.mule.object.SingletonObjectFactory import org.mule.routing.filters.PayloadTypeFilter import org.mule.routing.ForwardingCatchAllStrategy import org.mule.tck.testmodels.mule.TestResponseAggregator import org.mule.routing.outbound.OutboundPassThroughRouter import org.mule.api.endpoint.ImmutableEndpoint import org.mule.api.endpoint.InboundEndpoint import org.mule.api.endpoint.OutboundEndpoint import org.mule.api.model.Model import org.mule.api.service.Service import org.mule.component.DefaultJavaComponent import org.mule.model.seda.SedaService import org.mule.routing.inbound.DefaultInboundRouterCollection import org.mule.routing.nested.DefaultNestedRouterCollection import org.mule.routing.nested.DefaultNestedRouter import org.mule.routing.response.DefaultResponseRouterCollection import org.mule.service.DefaultServiceExceptionStrategy import org.mule.util.queue.QueueManager import org.mule.util.queue.TransactionalQueueManager import org.mule.util.queue.MemoryPersistenceStrategy import org.mule.security.MuleSecurityManager import org.mule.endpoint.DefaultEndpointFactory import org.mule.api.config.MuleProperties; import org.mule.api.config.ThreadingProfile; import org.mule.config.ChainedThreadingProfile; import org.mule.transport.SingleAttemptConnectionStrategy; import org.mule.transport.SimpleRetryConnectionStrategy; // Set up defaults / system objects QueueManager queueManager = new TransactionalQueueManager(); queueManager.persistenceStrategy = new MemoryPersistenceStrategy() muleContext.registry.registerObject(MuleProperties.OBJECT_QUEUE_MANAGER, queueManager); muleContext.registry.registerObject(MuleProperties.OBJECT_SECURITY_MANAGER, new MuleSecurityManager()); muleContext.registry.registerObject(MuleProperties.OBJECT_MULE_ENDPOINT_FACTORY, new DefaultEndpointFactory()); ThreadingProfile defaultThreadingProfile = new ChainedThreadingProfile(); defaultThreadingProfile.setThreadWaitTimeout(30); defaultThreadingProfile.setMaxThreadsActive(10); defaultThreadingProfile.setMaxThreadsIdle(10); defaultThreadingProfile.setMaxBufferSize(0); defaultThreadingProfile.setThreadTTL(60000); defaultThreadingProfile.setPoolExhaustedAction(ThreadingProfile.WHEN_EXHAUSTED_RUN); muleContext.registry.registerObject(MuleProperties.OBJECT_DEFAULT_COMPONENT_THREADING_PROFILE, new ChainedThreadingProfile(defaultThreadingProfile)); muleContext.registry.registerObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_RECEIVER_THREADING_PROFILE, new ChainedThreadingProfile(defaultThreadingProfile)); muleContext.registry.registerObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_DISPATCHER_THREADING_PROFILE, new ChainedThreadingProfile(defaultThreadingProfile)); muleContext.registry.registerObject(MuleProperties.OBJECT_DEFAULT_CONNECTION_STRATEGY, new SingleAttemptConnectionStrategy()); muleContext.registry.registerObject("doCompression", "true") epFactory = muleContext.registry.lookupEndpointFactory() InboundEndpoint createInboundEndpoint(String url, String name) { epBuilder= new EndpointURIEndpointBuilder(url, muleContext) epBuilder.name = name return epFactory.getInboundEndpoint(epBuilder) } OutboundEndpoint createOutboundEndpoint(String url, String name) { epBuilder= new EndpointURIEndpointBuilder(url, muleContext) epBuilder.name = name return epFactory.getOutboundEndpoint(epBuilder) } //Set a dummy TX manager muleContext.transactionManager = new TestTransactionManagerFactory().create() //register connector TestConnector c = new TestConnector(); c.name = "dummyConnector" c.exceptionListener = new TestExceptionStrategy() muleContext.registry.registerConnector(c); //Register transformers TestCompressionTransformer testCompressionTransformer = new TestCompressionTransformer(); testCompressionTransformer.name = "TestCompressionTransformer" testCompressionTransformer.returnClass = String.class testCompressionTransformer.beanProperty2 = 12 testCompressionTransformer.containerProperty = "myString" muleContext.registry.registerTransformer(testCompressionTransformer); //Register Filter filter = new MessagePropertyFilter(); filter.expression = "foo=bar" // Global Endpoint epBuilder= new EndpointURIEndpointBuilder("test://fruitBowlPublishQ", muleContext) epBuilder.filter = filter muleContext.registry.registerEndpointBuilder("fruitBowlEndpoint", epBuilder); // Global Endpoint epBuilder= new EndpointURIEndpointBuilder("test://test.queue", muleContext) muleContext.registry.registerEndpointBuilder("waterMelonEndpoint", epBuilder); // Global Endpoint epBuilder= new EndpointURIEndpointBuilder("test://AppleQueue", muleContext) epBuilder.name = "appleInEndpoint" muleContext.registry.registerEndpointBuilder("appleInEndpoint", epBuilder); // Global Endpoint epBuilder= new EndpointURIEndpointBuilder("test://orangeQ", muleContext) epBuilder.name = "orangeEndpoint" epBuilder.setProperty("testGlobal", "value1") muleContext.registry.registerEndpointBuilder("orangeEndpoint", epBuilder); epBuilder = new EndpointURIEndpointBuilder("test://test.queue2", muleContext); epBuilder.name = "testEPWithCS"; connectionStrategy = new SimpleRetryConnectionStrategy(); connectionStrategy.retryCount = 4 connectionStrategy.retryFrequency = 3000; epBuilder.connectionStrategy = connectionStrategy; muleContext.registry.registerEndpointBuilder("testEPWithCS", epBuilder); // Concrete Endpoints epBuilder= new EndpointURIEndpointBuilder("test://AppleResponseQueue", muleContext) epBuilder.name = "appleResponseEndpoint" appleResponseEndpoint = epFactory.getInboundEndpoint(epBuilder) epBuilder= new EndpointURIEndpointBuilder("test://orange", muleContext) epBuilder.name = "Orange" epBuilder.responseTransformers = [ muleContext.registry.lookupTransformer("TestCompressionTransformer") ] orangeEndpoint = epFactory.getInboundEndpoint(epBuilder) //register model Model model = new SedaModel(); exceptionStrategy = new TestExceptionStrategy(); exceptionStrategy.addEndpoint(createOutboundEndpoint("test://component.exceptions", null)); model.exceptionListener = exceptionStrategy model.lifecycleAdapterFactory = new TestDefaultLifecycleAdapterFactory() model.entryPointResolverSet = new TestEntryPointResolverSet() muleContext.registry.registerModel(model) // building service Service service = new SedaService(); service.model = model service.name = "orangeComponent" service.component = new DefaultJavaComponent(new SingletonObjectFactory(Orange.class.name)) epBuilder= new EndpointURIEndpointBuilder(muleContext.registry.lookupEndpointBuilder("orangeEndpoint")) epBuilder.muleContext = muleContext epBuilder.setProperty("testLocal", "value1") epBuilder.filter = new PayloadTypeFilter(String.class) epBuilder.transformers = [ muleContext.registry.lookupTransformer("TestCompressionTransformer") ] service.inboundRouter = new DefaultInboundRouterCollection() service.inboundRouter.addEndpoint(epFactory.getInboundEndpoint(epBuilder)) service.inboundRouter.addEndpoint(orangeEndpoint) catchAllStrategy = new ForwardingCatchAllStrategy() catchAllStrategy.endpoint = createOutboundEndpoint("test://catch.all", null) service.inboundRouter.catchAllStrategy = catchAllStrategy //Nested Router nestedRouter = new DefaultNestedRouterCollection(); nr = new DefaultNestedRouter(); nr.endpoint = createOutboundEndpoint("test://do.wash", null) nr.setInterface(FruitCleaner.class); nr.method = "wash" nestedRouter.addRouter(nr); nr = new DefaultNestedRouter(); nr.endpoint = createOutboundEndpoint("test://do.polish", null) nr.setInterface(FruitCleaner.class); nr.method = "polish" nestedRouter.addRouter(nr); service.component.nestedRouter = nestedRouter //Outbound Router outboundRouter = new OutboundPassThroughRouter() epBuilder = new EndpointURIEndpointBuilder(muleContext.registry.lookupEndpointBuilder("appleInEndpoint")) epBuilder.muleContext = muleContext epBuilder.transformers = [ muleContext.registry.lookupTransformer("TestCompressionTransformer") ] outboundRouter.addEndpoint(epFactory.getOutboundEndpoint(epBuilder)) service.outboundRouter.addRouter(outboundRouter) //Response Router responseRouter = new DefaultResponseRouterCollection(); responseRouter.addEndpoint(createInboundEndpoint("test://response1", null)); responseRouter.addEndpoint(appleResponseEndpoint); responseRouter.addRouter(new TestResponseAggregator()); responseRouter.timeout = 10001 service.responseRouter = responseRouter //Exception Strategy dces = new DefaultServiceExceptionStrategy(); dces.addEndpoint(createOutboundEndpoint("test://orange.exceptions", null)); service.exceptionListener = dces // properties // Since MULE-1933, Service no longer has properties and most properties are set on endpoint. // So lets continue to test properties, but on endpoints instead. endpointBuilderWithProps = new EndpointURIEndpointBuilder("test://endpointWithProps", muleContext) endpointBuilderWithProps.name = "endpointWithProps" endpointBuilderWithProps.properties = [ brand: "Juicy Baby!", segments: "9", radius: "4.21", mapProperties: [prop1: "prop1", prop2: "prop2"], listProperties: ["prop1", "prop2", "prop3"], arrayProperties: ["prop4", "prop5", "prop6"] ] muleContext.registry.registerEndpointBuilder("endpointWithProps",endpointBuilderWithProps) //register components muleContext.registry.registerService(service); mule-2.0.1/modules/scripting/src/test/resources/groovy-dynamic-script-bean.groovy0000644000175000017500000000044710777410426030172 0ustar charlescharlesimport org.mule.api.MuleEventContext import org.mule.api.lifecycle.Callable public class GroovyDynamicScript implements Callable { public Object onCall(MuleEventContext eventContext) throws Exception { return eventContext.getMessage().getPayloadAsString() + " Received2" } }mule-2.0.1/modules/scripting/src/test/resources/groovy-refreshable-config.xml0000644000175000017500000000761110764041564027340 0ustar charlescharles mule-2.0.1/modules/scripting/src/test/resources/groovy-builder-config.xml0000644000175000017500000000533710766654216026515 0ustar charlescharles return "$request.payload $response.payload Received" return "A" return "B" mule-2.0.1/modules/scripting/src/test/resources/groovy-dynamic-script.groovy0000644000175000017500000000044710777410426027267 0ustar charlescharlesimport org.mule.api.MuleEventContext import org.mule.api.lifecycle.Callable public class GroovyDynamicScript implements Callable { public Object onCall(MuleEventContext eventContext) throws Exception { return eventContext.getMessage().getPayloadAsString() + " Received2" } }mule-2.0.1/modules/scripting/src/test/resources/StringToList2.groovy0000644000175000017500000000004010703742731025466 0ustar charlescharlesreturn src.toString().tokenize()mule-2.0.1/modules/scripting/src/test/resources/groovy-dynamic-script-callable.groovy0000644000175000017500000000044710777410426031024 0ustar charlescharlesimport org.mule.api.MuleEventContext import org.mule.api.lifecycle.Callable public class GroovyDynamicScript implements Callable { public Object onCall(MuleEventContext eventContext) throws Exception { return eventContext.getMessage().getPayloadAsString() + " Received2" } }mule-2.0.1/modules/scripting/src/test/resources/ListToString2.groovy0000644000175000017500000000014110703742731025470 0ustar charlescharlesdef result = "" src.each { result += " $it" } return result.substring(1) // cut the leading spacemule-2.0.1/modules/scripting/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006210777617363026423 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/modules/scripting/pom.xml0000644000175000017500000002273211006063605017272 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-scripting JSR-223 Scripting Support for Scripting Mule Services and embedding Mule inside scripts org.springframework spring-aop ${springVersion} org.mule mule-core ${version} org.mule.modules mule-module-spring-config ${version} provided javax.activation activation provided org.mule.modules mule-module-builders ${version} net.sf.retrotranslator retrotranslator-runtime 1.2.1 javax.script script-api 1.0 jdk14 javax.script groovy-engine 1.1 jdk14 org.codehaus.groovy groovy-all 1.5.4 openejb openejb-loader org.apache.ant ant org.apache.ant ant-junit org.apache.ant ant-launcher jline jline axion axion bsf bsf com.tonicsystems jarjar commons-lang commons-lang commons-logging commons-logging commons-primitives commons-primitives jmock jmock jmock jmock-cglib javax.servlet jsp-api javax.servlet servlet-api mx4j mx4j nekohtml nekohtml qdox qdox qdox qdox radeox radeox radeox radeox-oro regexp regexp xml-apis xml-apis xerces xerces xpp3 xpp3 xstream xstream backport-util-concurrent backport-util-concurrent 3.1 org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test org.mule.modules mule-module-management ${version} test org.mule.transports mule-transport-vm ${version} test org.mule.transports mule-transport-tcp ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.components.script.*, org.mule.transformer.script.* mule-2.0.1/modules/boot/0000755000175000017500000000000011351411144014706 5ustar charlescharlesmule-2.0.1/modules/boot/src/0000755000175000017500000000000011351411143015474 5ustar charlescharlesmule-2.0.1/modules/boot/src/main/0000755000175000017500000000000011351411143016420 5ustar charlescharlesmule-2.0.1/modules/boot/src/main/java/0000755000175000017500000000000011351411143017341 5ustar charlescharlesmule-2.0.1/modules/boot/src/main/java/org/0000755000175000017500000000000011351411143020130 5ustar charlescharlesmule-2.0.1/modules/boot/src/main/java/org/mule/0000755000175000017500000000000011351411143021072 5ustar charlescharlesmule-2.0.1/modules/boot/src/main/java/org/mule/module/0000755000175000017500000000000011351411143022357 5ustar charlescharlesmule-2.0.1/modules/boot/src/main/java/org/mule/module/boot/0000755000175000017500000000000011351411143023322 5ustar charlescharlesmule-2.0.1/modules/boot/src/main/java/org/mule/module/boot/MuleBootstrap.java0000644000175000017500000001444310754375733027017 0ustar charlescharles/* * $Id: MuleBootstrap.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.boot; import org.mule.util.ClassUtils; import java.io.File; import java.net.URL; import java.util.Date; import java.util.Properties; import org.apache.commons.cli.BasicParser; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.tanukisoftware.wrapper.WrapperListener; import org.tanukisoftware.wrapper.WrapperManager; import org.tanukisoftware.wrapper.WrapperSimpleApp; /** * Determine which is the main class to run and delegate control to the Java Service * Wrapper. If OSGi is not being used to boot with, configure the classpath based on * the libraries in $MULE_HOME/lib/* *

    * Note: this class is intentionally kept free of any external library dependencies and * therefore repeats a few utility methods. */ public class MuleBootstrap { private static final String MULE_MODULE_BOOT_POM_FILE_PATH = "META-INF/maven/org.mule.module/mule-module-boot/pom.properties"; public static final String MAIN_CLASS_MULE_SERVER = "org.mule.module.boot.MuleServerWrapper"; public static final String MAIN_CLASS_OSGI_FRAMEWORK = "org.mule.module.osgi.OsgiFrameworkWrapper"; public static final String CLI_OPTIONS[][] = { {"main", "true", "Main Class"}, {"osgi", "false", "Run in an OSGi framework"}, {"nogui", "false", "Suppress graphical console"}, {"version", "false", "Show product and version information"} }; public static void main(String[] args) throws Exception { // Parse any command line options based on the list above. CommandLine commandLine = parseCommandLine(args); // Any unrecognized arguments get passed through to the next class (e.g., to Knopflerfish). String[] remainingArgs = commandLine.getArgs(); String mainClassName = commandLine.getOptionValue("main"); if (commandLine.hasOption("version")) { prepareBootstrapPhase(); WrapperManager.start(new VersionWrapper(), remainingArgs); } else if (commandLine.hasOption("osgi")) { boolean startGui = !commandLine.hasOption("nogui"); System.out.println("Starting the OSGi Framework..."); WrapperManager.start(new OsgiFrameworkWrapper(startGui), remainingArgs); } else if (mainClassName == null || mainClassName.equals(MAIN_CLASS_MULE_SERVER)) { prepareBootstrapPhase(); System.out.println("Starting the Mule Server..."); WrapperManager.start((WrapperListener) Class.forName(MAIN_CLASS_MULE_SERVER).newInstance(), remainingArgs); } else { // Add the main class name as the first argument to the Wrapper. String[] appArgs = new String[remainingArgs.length + 1]; appArgs[0] = mainClassName; System.arraycopy(remainingArgs, 0, appArgs, 1, remainingArgs.length); prepareBootstrapPhase(); System.out.println("Starting class " + mainClassName + "..."); WrapperSimpleApp.main(appArgs); } } private static void prepareBootstrapPhase() throws Exception { File muleHome = lookupMuleHome(); File muleBase = lookupMuleBase(); if (muleBase == null) { muleBase = muleHome; } MuleBootstrapUtils.addLocalJarFilesToClasspath(muleHome, muleBase); setSystemMuleVersion(); requestLicenseAcceptance(); MuleBootstrapUtils.addExternalJarFilesToClasspath(muleHome, null); } private static File lookupMuleHome() throws Exception { File muleHome = null; String muleHomeVar = System.getProperty("mule.home"); if (muleHomeVar != null && !muleHomeVar.trim().equals("") && !muleHomeVar.equals("%MULE_HOME%")) { muleHome = new File(muleHomeVar).getCanonicalFile(); } if (muleHome == null || !muleHome.exists() || !muleHome.isDirectory()) { throw new IllegalArgumentException("Either MULE_HOME is not set or does not contain a valid directory."); } return muleHome; } private static File lookupMuleBase() throws Exception { File muleBase = null; String muleBaseVar = System.getProperty("mule.base"); if (muleBaseVar != null && !muleBaseVar.trim().equals("") && !muleBaseVar.equals("%MULE_BASE%")) { muleBase = new File(muleBaseVar).getCanonicalFile(); } return muleBase; } private static void requestLicenseAcceptance() throws Exception { if (!LicenseHandler.isLicenseAccepted() && !LicenseHandler.getAcceptance()) { WrapperManager.stop(-1); } } private static void setSystemMuleVersion() { try { URL mavenPropertiesUrl = ClassUtils.getResource(MULE_MODULE_BOOT_POM_FILE_PATH, MuleServerWrapper.class); Properties mavenProperties = new Properties(); mavenProperties.load(mavenPropertiesUrl.openStream()); System.setProperty("mule.version", mavenProperties.getProperty("version")); System.setProperty("mule.reference.version", mavenProperties.getProperty("version") + '-' + (new Date()).getTime()); } catch (Exception ignore) { // ignore; } } /** * Parse any command line arguments using the Commons CLI library. */ private static CommandLine parseCommandLine(String[] args) throws ParseException { Options options = new Options(); for (int i = 0; i < CLI_OPTIONS.length; i++) { options.addOption(CLI_OPTIONS[i][0], "true".equalsIgnoreCase(CLI_OPTIONS[i][1]), CLI_OPTIONS[i][2]); } return new BasicParser().parse(options, args, true); } } mule-2.0.1/modules/boot/src/main/java/org/mule/module/boot/GuiInstallerLicenseHandler.java0000644000175000017500000000150610754375733031416 0ustar charlescharles/* * $Id $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.boot; public class GuiInstallerLicenseHandler { /** * The main method which is called by the GUI. It creates the LicenseHandler * object and then seeks to save the license by calling the method * saveLicenseAck. * */ public static void main(String args[]) throws Exception { System.setProperty("mule.home", args[0]); LicenseHandler.saveLicenseInfo(new LicenseHandler.LicenseInfo()); } } mule-2.0.1/modules/boot/src/main/java/org/mule/module/boot/LicenseHandler.java0000644000175000017500000002043510754375733027075 0ustar charlescharles/* * $Id $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.boot; import org.mule.util.ClassUtils; import org.mule.util.FileUtils; import org.mule.util.JarUtils; import org.mule.util.StringUtils; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.LinkedHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This class has methods for displaying the EULA and saving the license acceptance * acknowledgment. */ public final class LicenseHandler { private static final Log logger = LogFactory.getLog(LicenseHandler.class); private static final int MAX_ROWS_TO_DISPLAY = 80; private static final String DEFAULT_LICENSE_TYPE = "Common Public Attribution License Version 1.0 (CPAL)"; private static final String DEFAULT_LICENSE_VERSION = "UNKNOWN"; private static final String VERSION_TEXT_PREFIX = "Version "; private static final String LICENSE_TEXT_FILENAME = "LICENSE.txt"; private static final String LICENSE_TEXT_JAR_FILE_PATH = "META-INF/mule/" + LICENSE_TEXT_FILENAME; private static final String LICENSE_PROPERTIES_JAR_FILE_PATH = "META-INF/mule/license.props"; private LicenseHandler() { // used as utility class at this point only } public static boolean isLicenseAccepted() throws Exception { return ClassUtils.getResource(LICENSE_PROPERTIES_JAR_FILE_PATH, LicenseHandler.class) != null; } public static File getLicenseFile() { return new File(MuleBootstrapUtils.getMuleHomeFile(), LICENSE_TEXT_FILENAME); } /** * Display the EULA and get the user's acceptance. Note that only a missing * license file or a non-yes answer will cause this to return false. If the user * accepts, but we can't write the license ack file for some reason, we'll still * return true. * * @return boolean whether the license was accepted or not */ public static boolean getAcceptance() { boolean hasAccepted; try { if (!getLicenseFile().exists() || !MuleBootstrapUtils.getMuleLibDir().exists()) { System.out.println("\nYour Mule installation seems to be incomplete. Please try downloading it again from http://mule.mulesource.org/display/MULE/Download and start again."); hasAccepted = false; } else { System.out.println("\n\nPlease read over the following license agreement carefully:\n\n"); LicenseInfo licenseInfo = readLicenseFileAndDisplayToStdout(); hasAccepted = askUserForAcceptance(); if (hasAccepted) { saveLicenseInfo(licenseInfo); } } } catch (Exception e) { hasAccepted = false; System.out.println("\nSorry, we encountered an error in processing your license agreement - please try again."); e.printStackTrace(); } return hasAccepted; } public static void saveLicenseInfo(LicenseInfo licenseInfo) throws Exception { if (licenseInfo != null && !isLicenseAccepted()) { if (!MuleBootstrapUtils.getMuleLibDir().canWrite()) { throw new Exception("No write permissions for " + MuleBootstrapUtils.MULE_LOCAL_JAR_FILENAME + " to MULE_HOME. If you are using MULE_BASE and multiple deployments, please ask your administrator to run Mule for the first time."); } File tempJarFile = createTempLicenseJarFile(licenseInfo); MuleBootstrapUtils.getMuleLocalJarFile().delete(); FileUtils.renameFile(tempJarFile, MuleBootstrapUtils.getMuleLocalJarFile()); } } private static LicenseInfo readLicenseFileAndDisplayToStdout() throws IOException { String licenseType = null; String licenseVersion = null; BufferedReader stdin; BufferedReader fileReader = null; try { stdin = new BufferedReader(new InputStreamReader(System.in)); fileReader = new BufferedReader(new FileReader(getLicenseFile())); int row = 1; while (fileReader.ready()) { String line = fileReader.readLine(); if (row == 1 && line.length() > 0) { licenseType = line; } if (row == 2 && line.startsWith(VERSION_TEXT_PREFIX)) { licenseVersion = line.substring(VERSION_TEXT_PREFIX.length()); } if ((row % MAX_ROWS_TO_DISPLAY) == 0) { System.out.print("\nHit return to continue ... "); stdin.readLine(); } System.out.println(line); row++; } } finally { if (fileReader != null) { try { fileReader.close(); } catch (Exception ignore) { logger.debug("Error closing fileReader: " + ignore.getMessage()); } } } return new LicenseInfo(licenseType, licenseVersion); } private static boolean askUserForAcceptance() throws IOException { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.out.print("\n\nDo you accept the terms and conditions of this license agreement [y/n]?"); final String input = StringUtils.defaultString(stdin.readLine()); boolean hasAcccepted = input.toLowerCase().startsWith("y"); if (!hasAcccepted) { System.out.println("\nSorry, until you accept the terms and conditions of this EULA, you won't be able to start Mule"); } return hasAcccepted; } private static File createTempLicenseJarFile(LicenseInfo licenseInfo) throws Exception { LinkedHashMap jarEntries = new LinkedHashMap(); jarEntries.put(LICENSE_PROPERTIES_JAR_FILE_PATH, licenseInfo.toString()); jarEntries.put(LICENSE_TEXT_JAR_FILE_PATH, getLicenseFile()); File tempJar = File.createTempFile(MuleBootstrapUtils.MULE_LOCAL_JAR_FILENAME, null); try { JarUtils.createJarFileEntries(tempJar, jarEntries); } catch (IOException ioe) { if (tempJar != null) { throw new Exception("Unable to create temporary jar file to " + tempJar.getAbsolutePath()); } else { throw new Exception("Unable to create temporary jar file for " + MuleBootstrapUtils.MULE_LOCAL_JAR_FILENAME); } } return tempJar; } public static class LicenseInfo { private String licenseType = DEFAULT_LICENSE_TYPE; private String licenseVersion = DEFAULT_LICENSE_VERSION; private String licenseDate = (new java.util.Date()).toString(); public LicenseInfo() { // for default license } public LicenseInfo(String licenseType, String licenseVersion) { if (StringUtils.isNotBlank(licenseType)) { this.licenseType = licenseType; } if (StringUtils.isNotBlank(licenseVersion)) { this.licenseVersion = licenseVersion; } } public String toString() { return "LicenseType=" + licenseType + "\n" + "LicenseVersion=" + licenseVersion + "\n" + "LicenseDate=" + licenseDate + "\n"; } } } mule-2.0.1/modules/boot/src/main/java/org/mule/module/boot/VersionWrapper.java0000644000175000017500000000327010754375733027201 0ustar charlescharles/* * $Id: VersionWrapper.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.boot; import org.mule.config.i18n.CoreMessages; import org.tanukisoftware.wrapper.WrapperListener; import org.tanukisoftware.wrapper.WrapperManager; /** * There is a need to exit from wrapper * This is a good place for other information message */ public class VersionWrapper implements WrapperListener { public Integer start(String[] args) { try { System.out.println(CoreMessages.productInformation()); } catch (Exception e) { e.printStackTrace(); return new Integer(1); } return null; } public int stop(int exitCode) { return exitCode; } public void controlEvent(int event) { if (WrapperManager.isControlledByNativeWrapper()) { // The Wrapper will take care of this event } else { // We are not being controlled by the Wrapper, so // handle the event ourselves. if ((event == WrapperManager.WRAPPER_CTRL_C_EVENT) || (event == WrapperManager.WRAPPER_CTRL_CLOSE_EVENT) || (event == WrapperManager.WRAPPER_CTRL_SHUTDOWN_EVENT)) { WrapperManager.stop(0); } } } } mule-2.0.1/modules/boot/src/main/java/org/mule/module/boot/LibraryDownloader.java0000644000175000017500000002167410754375733027646 0ustar charlescharles/* * $Id * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.boot; import org.mule.util.ClassUtils; import org.mule.util.FileUtils; import org.mule.util.NumberUtils; import org.mule.util.StringUtils; import java.io.File; import java.io.IOException; import java.net.URL; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; import java.util.List; import java.util.Properties; import org.apache.commons.httpclient.ConnectTimeoutException; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpState; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.params.HttpConnectionManagerParams; public class LibraryDownloader { private static final int HTTP_CONNECTION_TIMEOUT = 10000; private static final String REPO_CENTRAL = "http://repo1.maven.org/maven2"; private static final String BOOTSTRAP_LIBRARY_DOWNLOAD_DESCRIPTION_PREFIX = "mule.bootstrap.library.download.description."; private static final String PROXY_ERROR_MESSAGE = "Unable to reach remote repository. This is most likely because you are behind a firewall and missing proxy settings in Mule." + "Proxy options can be passed during startup as follows:\n" + " -M-Dhttp.proxyHost=YOUR_HOST\n" + " -M-Dhttp.proxyPort=YOUR_PORT\n" + " -M-Dhttp.proxyUsername=YOUR_USERNAME\n" + " -M-Dhttp.proxyPassword=YOUR_PASSWORD\n"; private MuleBootstrapUtils.ProxyInfo proxyInfo; private HostConfiguration hostConfig; private HttpState httpState; private File muleHome; private File mavenRepo = null; private HttpClient client; private List libraryDownloadDescriptions = new ArrayList(); public LibraryDownloader(File muleHome) { this(muleHome, new MuleBootstrapUtils.ProxyInfo( System.getProperty("http.proxyHost"), System.getProperty("http.proxyPort"), System.getProperty("http.proxyUsername"), System.getProperty("http.proxyPassword"))); } public LibraryDownloader(File muleHome, String proxyHost, String proxyPort, String proxyUsername, String proxyPassword) { this(muleHome, new MuleBootstrapUtils.ProxyInfo(proxyHost, proxyPort, proxyUsername, proxyPassword)); } public LibraryDownloader(File muleHome, MuleBootstrapUtils.ProxyInfo proxyInfo) { this.muleHome = muleHome; this.proxyInfo = proxyInfo; configureMavenRepository(); configureHttpClient(); configureHttpProxy(); readLibraryDownloadDescriptions(); } public List downloadLibraries() throws IOException { List libraryUrls = new ArrayList(); Exception proxyException = null; try { Iterator iter = libraryDownloadDescriptions.iterator(); while (iter.hasNext()) { URL libraryUrl = downloadLibrary((Library) iter.next()); if (libraryUrl != null) { libraryUrls.add(libraryUrl); } } } catch (UnknownHostException uhe) { proxyException = uhe; } catch (ConnectTimeoutException cte) { proxyException = cte; } finally { if (proxyException != null) { System.err.println(); IOException ex = new IOException(PROXY_ERROR_MESSAGE); ex.initCause(proxyException); throw ex; } } return libraryUrls; } private void configureMavenRepository() { String mavenRepoVar = System.getProperty("m2.repo"); if (!StringUtils.isBlank(mavenRepoVar)) { mavenRepo = new File(mavenRepoVar).getAbsoluteFile(); if (!mavenRepo.exists() || !mavenRepo.isDirectory()) { mavenRepo = null; } } } private void configureHttpClient() { client = new HttpClient(); HttpConnectionManagerParams connParams = new HttpConnectionManagerParams(); connParams.setConnectionTimeout(HTTP_CONNECTION_TIMEOUT); client.getHttpConnectionManager().setParams(connParams); } private void configureHttpProxy() { hostConfig = new HostConfiguration(); if (StringUtils.isNotBlank(proxyInfo.host)) { hostConfig.setProxy(proxyInfo.host, NumberUtils.toInt(proxyInfo.port)); } httpState = new HttpState(); if (StringUtils.isNotBlank(proxyInfo.username)) { httpState.setProxyCredentials(new AuthScope(null, -1, null, null), new UsernamePasswordCredentials(proxyInfo.username, proxyInfo.password)); } } private void readLibraryDownloadDescriptions() { Properties properties = System.getProperties(); Enumeration keys = properties.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); if (key.startsWith(BOOTSTRAP_LIBRARY_DOWNLOAD_DESCRIPTION_PREFIX)) { String[] descriptions = properties.getProperty(key).split(","); if (descriptions != null && descriptions.length == 3) { libraryDownloadDescriptions.add(new Library(descriptions[0].trim(), descriptions[1].trim(), descriptions[2].trim())); } } } } private URL downloadLibrary(Library library) throws IOException { URL libraryUrl = null; if (! ClassUtils.isClassOnPath(library.testClassName, MuleBootstrapUtils.class)) { libraryUrl = downloadLibraryFromLocalRepository(library.jarPath, library.jarName); if (libraryUrl == null) { libraryUrl = downloadLibraryFromRemoteRepository(library.jarPath, library.jarName); } } return libraryUrl; } private URL downloadLibraryFromLocalRepository(String path, String destinationFileName) throws IOException { URL libraryUrl = null; if (mavenRepo != null) { File sourceFile = new File(mavenRepo, path + File.separator + destinationFileName).getCanonicalFile(); if (sourceFile.exists()) { System.out.print("Copying from local repository " + sourceFile.getAbsolutePath() + " ..."); File destinationFile = new File(new File(muleHome, DefaultMuleClassPathConfig.USER_DIR).getCanonicalFile(), destinationFileName).getCanonicalFile(); FileUtils.copyFile(sourceFile, destinationFile); System.out.println("done"); libraryUrl = destinationFile.toURL(); } } return libraryUrl; } private URL downloadLibraryFromRemoteRepository(String path, String destinationFileName) throws IOException { URL libraryUrl = null; HttpMethod httpMethod = new GetMethod(REPO_CENTRAL + path + '/' + destinationFileName); try { System.out.print("Downloading " + httpMethod.getURI() + " ..."); client.executeMethod(hostConfig, httpMethod, httpState); if (httpMethod.getStatusCode() == HttpStatus.SC_OK) { File destinationFile = new File(new File(muleHome, DefaultMuleClassPathConfig.USER_DIR), destinationFileName); FileUtils.copyStreamToFile(httpMethod.getResponseBodyAsStream(), destinationFile); System.out.println("done"); libraryUrl = destinationFile.toURL(); } else { System.out.println(); throw new IOException("HTTP request failed: " + httpMethod.getStatusLine().toString()); } } finally { httpMethod.releaseConnection(); } return libraryUrl; } private static class Library { public String testClassName; public String jarPath; public String jarName; public Library(String testClassName, String jarPath, String jarName) { this.testClassName = testClassName; this.jarPath = jarPath; this.jarName = jarName; } } } mule-2.0.1/modules/boot/src/main/java/org/mule/module/boot/OsgiFrameworkWrapper.java0000644000175000017500000001113310770356575030331 0ustar charlescharles/* * $Id: OsgiFrameworkWrapper.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.boot; import java.util.Iterator; import java.util.Map; import java.util.Properties; import org.tanukisoftware.wrapper.WrapperListener; import org.tanukisoftware.wrapper.WrapperManager; public class OsgiFrameworkWrapper implements WrapperListener { private final boolean startGui; /*--------------------------------------------------------------- * Constructors *-------------------------------------------------------------*/ public OsgiFrameworkWrapper(boolean startGui) { this.startGui = startGui; } /*--------------------------------------------------------------- * WrapperListener Methods *-------------------------------------------------------------*/ /** * The start method is called when the WrapperManager is signaled by the * native wrapper code that it can start its application. This * method call is expected to return, so a new thread should be launched * if necessary. * * @param args List of arguments used to initialize the application. * * @return Any error code if the application should exit on completion * of the start method. If there were no problems then this * method should return null. */ public Integer start( String[] args ) { Properties osgiSysProps = new Properties(); // Directory where bundle state info. is stored. // .xargs files will be read from the parent of this directory. osgiSysProps.put("org.osgi.framework.dir", "../conf/knopflerfish"); for (Iterator iter = osgiSysProps.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); System.setProperty((String) entry.getKey(), (String) entry.getValue()); } try { /* Disable this for now so that we can build mule-module-boot without OSGi Main.main(args); if (startGui) { Main.main(new String[]{"-istart", DESKTOP_BUNDLE}); } */ return null; } catch (Exception e) { e.printStackTrace(); return new Integer(1); } } /** * Called when the application is shutting down. The Wrapper assumes that * this method will return fairly quickly. If the shutdown code code * could potentially take a long time, then WrapperManager.signalStopping() * should be called to extend the timeout period. If for some reason, * the stop method can not return, then it must call * WrapperManager.stopped() to avoid warning messages from the Wrapper. * * @param exitCode The suggested exit code that will be returned to the OS * when the JVM exits. * * @return The exit code to actually return to the OS. In most cases, this * should just be the value of exitCode, however the user code has * the option of changing the exit code if there are any problems * during shutdown. */ public int stop( int exitCode ) { /* Disable this for now so that we can build mule-module-boot without OSGi Main.shutdown(exitCode); */ return exitCode; } /** * Called whenever the native wrapper code traps a system control signal * against the Java process. It is up to the callback to take any actions * necessary. Possible values are: WrapperManager.WRAPPER_CTRL_C_EVENT, * WRAPPER_CTRL_CLOSE_EVENT, WRAPPER_CTRL_LOGOFF_EVENT, or * WRAPPER_CTRL_SHUTDOWN_EVENT * * @param event The system control signal. */ public void controlEvent( int event ) { if (WrapperManager.isControlledByNativeWrapper()) { // The Wrapper will take care of this event } else { // We are not being controlled by the Wrapper, so // handle the event ourselves. if ((event == WrapperManager.WRAPPER_CTRL_C_EVENT) || (event == WrapperManager.WRAPPER_CTRL_CLOSE_EVENT) || (event == WrapperManager.WRAPPER_CTRL_SHUTDOWN_EVENT)){ WrapperManager.stop(0); } } } } mule-2.0.1/modules/boot/src/main/java/org/mule/module/boot/DefaultMuleClassPathConfig.java0000644000175000017500000001006710754375733031355 0ustar charlescharles/* * $Id: DefaultMuleClassPathConfig.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.boot; import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; /** * Constructs a default set of JAR Urls located under Mule home folder. */ public class DefaultMuleClassPathConfig { protected static final String MULE_DIR = "/lib/mule"; protected static final String USER_DIR = "/lib/user"; protected static final String OPT_DIR = "/lib/opt"; private List urls = new ArrayList(); /** * Constructs a new DefaultMuleClassPathConfig. * @param muleHome Mule home directory * @param muleBase Mule base directory */ public DefaultMuleClassPathConfig(File muleHome, File muleBase) { /** * Pick up any local jars, if there are any. Doing this here insures that any * local class that override the global classes will in fact do so. */ try { if (!muleHome.getCanonicalFile().equals(muleBase.getCanonicalFile())) { File userOverrideDir = new File(muleBase, USER_DIR); this.addFile(userOverrideDir); this.addFiles(this.listJars(userOverrideDir)); } } catch (IOException ioe) { System.out.println("Unable to check to see if there are local jars to load: " + ioe.toString()); } File userDir = new File(muleHome, USER_DIR); this.addFile(userDir); this.addFiles(this.listJars(userDir)); File muleDir = new File(muleHome, MULE_DIR); this.addFile(muleDir); this.addFiles(this.listJars(muleDir)); File optDir = new File(muleHome, OPT_DIR); this.addFile(optDir); this.addFiles(this.listJars(optDir)); } /** * Getter for property 'urls'. * * @return A copy of 'urls'. Items are java.net.URL */ public List getURLs() { return new ArrayList(this.urls); } /** * Setter for property 'urls'. * * @param urls Value to set for property 'urls'. */ public void addURLs(List urls) { if (urls != null && !urls.isEmpty()) { this.urls.addAll(urls); } } /** * Add a URL to Mule's classpath. * * @param url folder (should end with a slash) or jar path */ public void addURL(URL url) { this.urls.add(url); } public void addFiles(List files) { for (Iterator i = files.iterator(); i.hasNext();) { this.addFile((File)i.next()); } } public void addFile(File jar) { try { this.addURL(jar.getAbsoluteFile().toURI().toURL()); } catch (MalformedURLException mux) { throw new RuntimeException("Failed to construct a classpath URL", mux); } } /** * Find and if necessary filter the jars for classpath. * * @return a list of {@link File}s */ protected List listJars(File path) { File[] jars = path.listFiles(new FileFilter() { public boolean accept(File pathname) { try { return pathname.getCanonicalPath().endsWith(".jar"); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } } }); return jars == null ? Collections.EMPTY_LIST : Arrays.asList(jars); } } mule-2.0.1/modules/boot/src/main/java/org/mule/module/boot/MuleServerWrapper.java0000644000175000017500000000736210754375733027653 0ustar charlescharles/* * $Id: MuleServerWrapper.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.boot; import org.mule.MuleServer; import org.tanukisoftware.wrapper.WrapperListener; import org.tanukisoftware.wrapper.WrapperManager; public class MuleServerWrapper implements WrapperListener { private MuleServer mule; /*--------------------------------------------------------------- * Constructors *-------------------------------------------------------------*/ public MuleServerWrapper() { super(); } /*--------------------------------------------------------------- * WrapperListener Methods *-------------------------------------------------------------*/ /** * The start method is called when the WrapperManager is signaled by the native * wrapper code that it can start its application. This method call is expected * to return, so a new thread should be launched if necessary. * * @param args List of arguments used to initialize the application. * @return Any error code if the application should exit on completion of the * start method. If there were no problems then this method should return * null. */ public Integer start(String[] args) { try { mule = new MuleServer(args); mule.start(false, false); return null; } catch (Exception e) { e.printStackTrace(); return new Integer(1); } } /** * Called when the application is shutting down. The Wrapper assumes that this * method will return fairly quickly. If the shutdown code code could potentially * take a long time, then WrapperManager.signalStopping() should be called to * extend the timeout period. If for some reason, the stop method can not return, * then it must call WrapperManager.stopped() to avoid warning messages from the * Wrapper. * * @param exitCode The suggested exit code that will be returned to the OS when * the JVM exits. * @return The exit code to actually return to the OS. In most cases, this should * just be the value of exitCode, however the user code has the option of * changing the exit code if there are any problems during shutdown. */ public int stop(int exitCode) { mule.shutdown(); return exitCode; } /** * Called whenever the native wrapper code traps a system control signal against * the Java process. It is up to the callback to take any actions necessary. * Possible values are: WrapperManager.WRAPPER_CTRL_C_EVENT, * WRAPPER_CTRL_CLOSE_EVENT, WRAPPER_CTRL_LOGOFF_EVENT, or * WRAPPER_CTRL_SHUTDOWN_EVENT * * @param event The system control signal. */ public void controlEvent(int event) { if (WrapperManager.isControlledByNativeWrapper()) { // The Wrapper will take care of this event } else { // We are not being controlled by the Wrapper, so // handle the event ourselves. if ((event == WrapperManager.WRAPPER_CTRL_C_EVENT) || (event == WrapperManager.WRAPPER_CTRL_CLOSE_EVENT) || (event == WrapperManager.WRAPPER_CTRL_SHUTDOWN_EVENT)) { WrapperManager.stop(0); } } } } mule-2.0.1/modules/boot/src/main/java/org/mule/module/boot/GuiInstallerLibraryDownloader.java0000644000175000017500000000215410754375733032161 0ustar charlescharles/* * $Id: GuiInstallerLibraryDownloader.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.boot; import java.io.File; public class GuiInstallerLibraryDownloader { public static void main(String args[]) throws Exception { File muleHome = new File(args[0]); MuleBootstrapUtils.ProxyInfo proxyInfo = null; if (args.length > 2) { proxyInfo = new MuleBootstrapUtils.ProxyInfo(args[1], args[2]); } if (args.length > 4) { proxyInfo = new MuleBootstrapUtils.ProxyInfo(args[1], args[2], args[3], args[4]); } MuleBootstrapUtils.addLocalJarFilesToClasspath(muleHome, muleHome); MuleBootstrapUtils.addExternalJarFilesToClasspath(muleHome, proxyInfo); } } mule-2.0.1/modules/boot/src/main/java/org/mule/module/boot/MuleBootstrapUtils.java0000644000175000017500000001155010754375733030034 0ustar charlescharles/* * $Id: MuleBootstrapUtils.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.boot; import java.io.File; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; import java.util.Iterator; import java.util.List; public final class MuleBootstrapUtils { private static final String MULE_LIB_FILENAME = "lib" + File.separator + "mule"; private static final String MULE_HOME = System.getProperty("mule.home"); public static final String MULE_LOCAL_JAR_FILENAME = "mule-local-install.jar"; private MuleBootstrapUtils() { // utility class only } public static File getMuleHomeFile() { return new File(MULE_HOME); } public static File getMuleLibDir() { return new File(MULE_HOME + File.separator + MULE_LIB_FILENAME); } public static File getMuleLocalJarFile() { return new File(getMuleLibDir(), MULE_LOCAL_JAR_FILENAME); } public static void addLocalJarFilesToClasspath(File muleHome, File muleBase) throws Exception { DefaultMuleClassPathConfig classPath = new DefaultMuleClassPathConfig(muleHome, muleBase); addLibrariesToClasspath(classPath.getURLs()); } public static void addExternalJarFilesToClasspath(File muleHome, ProxyInfo proxyInfo) throws Exception { LibraryDownloader downloader = null; if (proxyInfo != null) { downloader = new LibraryDownloader(muleHome, proxyInfo.host, proxyInfo.port, proxyInfo.username, proxyInfo.password); } else { downloader = new LibraryDownloader(muleHome); } addLibrariesToClasspath(downloader.downloadLibraries()); } public static void addLibrariesToClasspath(List urls) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { ClassLoader sys = ClassLoader.getSystemClassLoader(); if (!(sys instanceof URLClassLoader)) { throw new IllegalArgumentException( "PANIC: Mule has been started with an unsupported classloader: " + sys.getClass().getName() + ". " + "Please report this error to usermulecodehausorg"); } // system classloader is in this case the one that launched the application, // which is usually something like a JDK-vendor proprietary AppClassLoader URLClassLoader sysCl = (URLClassLoader) sys; /* * IMPORTANT NOTE: The more 'natural' way would be to create a custom * URLClassLoader and configure it, but then there's a chicken-and-egg * problem, as all classes MuleBootstrap depends on would have been loaded by * a parent classloader, and not ours. There's no straightforward way to * change this, and is documented in a Sun's classloader guide. The solution * would've involved overriding the ClassLoader.findClass() method and * modifying the semantics to be child-first, but that way we are calling for * trouble. Hacking the primordial classloader is a bit brutal, but works * perfectly in case of running from the command-line as a standalone app. * All Mule embedding options then delegate the classpath config to the * embedder (a developer embedding Mule in the app), thus classloaders are * not modified in those scenarios. */ // get a Method ref from the normal class, but invoke on a proprietary parent // object, // as this method is usually protected in those classloaders Class refClass = URLClassLoader.class; Method methodAddUrl = refClass.getDeclaredMethod("addURL", new Class[]{URL.class}); methodAddUrl.setAccessible(true); for (Iterator it = urls.iterator(); it.hasNext();) { URL url = (URL) it.next(); methodAddUrl.invoke(sysCl, new Object[]{url}); } } public static class ProxyInfo { String host; String port; String username; String password; public ProxyInfo(String host, String port) { this(host, port, null, null); } public ProxyInfo(String host, String port, String username, String password) { this.host = host; this.port = port; this.username = username; this.password = password; } } } mule-2.0.1/modules/boot/src/main/resources/0000755000175000017500000000000011351411143020432 5ustar charlescharlesmule-2.0.1/modules/boot/src/main/resources/META-INF/0000755000175000017500000000000011351411143021572 5ustar charlescharlesmule-2.0.1/modules/boot/src/main/resources/META-INF/MANIFEST.MF0000644000175000017500000000000010553776311023230 0ustar charlescharlesmule-2.0.1/modules/boot/src/test/0000755000175000017500000000000011351411143016453 5ustar charlescharlesmule-2.0.1/modules/boot/src/test/java/0000755000175000017500000000000011351411143017374 5ustar charlescharlesmule-2.0.1/modules/boot/src/test/java/org/0000755000175000017500000000000011351411143020163 5ustar charlescharlesmule-2.0.1/modules/boot/src/test/java/org/mule/0000755000175000017500000000000011351411143021125 5ustar charlescharlesmule-2.0.1/modules/boot/src/test/java/org/mule/module/0000755000175000017500000000000011351411143022412 5ustar charlescharlesmule-2.0.1/modules/boot/src/test/java/org/mule/module/boot/0000755000175000017500000000000011351411143023355 5ustar charlescharlesmule-2.0.1/modules/boot/src/test/java/org/mule/module/boot/DefaultMuleClassPathConfigTestCase.java0000644000175000017500000000465410754375733033051 0ustar charlescharles/* * $Id: DefaultMuleClassPathConfigTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.boot; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.FileUtils; import org.mule.util.SystemUtils; import java.io.File; import java.net.URL; import java.util.List; public class DefaultMuleClassPathConfigTestCase extends AbstractMuleTestCase { /** * $MULE_BASE/lib/user folder should come before $MULE_HOME/lib/user. Note this * test checks folder only, not the jars. See * http://mule.mulesource.org/jira/browse/MULE-1311 for more details. * * @throws Exception in case of any error */ public void testMuleBaseUserFolderOverridesMuleHome() throws Exception { final File tempDir = SystemUtils.getJavaIoTmpDir(); final long now = System.currentTimeMillis(); final File currentTestFolder = new File(tempDir, "mule_test_delete_me_" + now); File testMuleHome = new File(currentTestFolder, "mule_home"); File testMuleBase = new File(currentTestFolder, "mule_base"); try { assertTrue("Couldn't create test Mule home folder.", testMuleHome.mkdirs()); assertTrue("Couldn't create test Mule base folder.", testMuleBase.mkdirs()); DefaultMuleClassPathConfig cp = new DefaultMuleClassPathConfig(testMuleHome, testMuleBase); List urls = cp.getURLs(); assertNotNull("Urls shouldn't be null.", urls); assertFalse("Urls shouldn't be empty.", urls.isEmpty()); URL muleBaseUserFolder = new File(testMuleBase, DefaultMuleClassPathConfig.USER_DIR) .getAbsoluteFile().toURI().toURL(); String expectedMuleBaseUserFolder = muleBaseUserFolder.toExternalForm(); String firstUrl = ((URL) urls.get(0)).toExternalForm(); assertEquals("$MULE_BASE/lib/user must come first.", expectedMuleBaseUserFolder, firstUrl); } finally { // tearDown() may be too late for these calls FileUtils.deleteTree(currentTestFolder); } } } mule-2.0.1/modules/boot/pom.xml0000644000175000017500000000455011006063605016231 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-boot jar Mule Bootstrap Classes used to boot up the Mule server org.mule mule-core ${version} tanukisoft wrapper 3.2.3 commons-cli commons-cli 1.0 commons-logging commons-logging commons-lang commons-lang commons-httpclient commons-httpclient org.mule mule-core ${version} test test-jar osgi org.knopflerfish osgi 2.0.1 mule-2.0.1/modules/persistence/0000755000175000017500000000000011351411132016264 5ustar charlescharlesmule-2.0.1/modules/persistence/src/0000755000175000017500000000000011351411132017053 5ustar charlescharlesmule-2.0.1/modules/persistence/src/main/0000755000175000017500000000000011351411132017777 5ustar charlescharlesmule-2.0.1/modules/persistence/src/main/java/0000755000175000017500000000000011351411132020720 5ustar charlescharlesmule-2.0.1/modules/persistence/src/main/java/org/0000755000175000017500000000000011351411132021507 5ustar charlescharlesmule-2.0.1/modules/persistence/src/main/java/org/mule/0000755000175000017500000000000011351411132022451 5ustar charlescharlesmule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/0000755000175000017500000000000011351411132024775 5ustar charlescharlesmule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/manager/0000755000175000017500000000000011351411132026407 5ustar charlescharles././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/manager/ObjectPersistenceManager.javamule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/manager/ObjectPersistenceManager.j0000644000175000017500000000534710664703640033517 0ustar charlescharles/* * $Id: ObjectPersistenceManager.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.persistence.manager; import org.mule.persistence.Persistable; import org.mule.persistence.PersistenceException; import org.mule.persistence.PersistenceTimer; import org.mule.umo.UMOException; import org.mule.umo.lifecycle.InitialisationException; import org.mule.umo.lifecycle.RecoverableException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * * */ public class ObjectPersistenceManager extends AbstractPersistenceManager { private Persistable source = null; /** * logger used by this class */ private static transient Log logger = LogFactory.getLog(ObjectPersistenceManager.class); public ObjectPersistenceManager() { this.storeType = DEFAULT_STORE_TYPE; } /** * {@inheritDoc} */ public void start() throws UMOException { super.start(); logger.info("Started"); } /** * {@inheritDoc} */ public void stop() throws UMOException { super.stop(); logger.info("Stopped"); } /** * {@inheritDoc} */ public void initialise() throws InitialisationException, RecoverableException { persistenceTimer = new PersistenceTimer(this); lastRequest = System.currentTimeMillis(); requestCount = 0; createStore(); } public void requestPersistence(Persistable source) { logger.info("Got request to persist"); synchronized (this) { this.lastRequest = System.currentTimeMillis(); this.requestCount++; /* We save the source as the only source, because * this version of the Manager only handles one. * * If you want the PersistencesManager to handle multiple * sources, use the QueuedPersistenceManager */ this.source = source; } } public void persist() { if (store == null) return; synchronized (this) { try { store.store(source, false); } catch (PersistenceException pe) { logger.error("Unable to persist: " + pe.toString()); } this.lastRequest = 0L; this.requestCount = 0; } } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/manager/QueuePersistenceManager.javamule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/manager/QueuePersistenceManager.ja0000644000175000017500000000504410664703640033530 0ustar charlescharles/* * $Id: QueuePersistenceManager.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.persistence.manager; import org.mule.persistence.Persistable; import org.mule.persistence.PersistenceTimer; import org.mule.umo.lifecycle.InitialisationException; import org.mule.umo.lifecycle.RecoverableException; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentLinkedQueue; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * * */ public class QueuePersistenceManager extends AbstractPersistenceManager { private ConcurrentLinkedQueue queue = null; /** * logger used by this class */ private static transient Log logger = LogFactory.getLog(QueuePersistenceManager.class); public QueuePersistenceManager() { this.storeType = DEFAULT_STORE_TYPE; } /** * {@inheritDoc} */ public void initialise() throws InitialisationException, RecoverableException { queue = new ConcurrentLinkedQueue(); persistenceTimer = new PersistenceTimer(this); lastRequest = System.currentTimeMillis(); requestCount = 0; persistenceTimer.start(); createStore(); ready = true; } public void requestPersistence(Persistable source) { logger.info("Got request to persist"); synchronized (this) { this.lastRequest = System.currentTimeMillis(); this.requestCount++; queue.add(source); } } public void persist() { if (store == null) return; Object source = queue.peek(); while (source != null) { try { logger.info((new java.util.Date()).toString() + ": doing persistence"); store.store((Persistable)source, false); queue.remove(source); source = queue.peek(); } catch (Exception e) { logger.info("Unknown error persisting: " + e.toString()); source = null; } } synchronized (this) { this.lastRequest = 0L; this.requestCount = 0; } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/manager/AbstractPersistenceManager.javamule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/manager/AbstractPersistenceManager0000644000175000017500000000537410664703640033624 0ustar charlescharles/* * $Id: AbstractPersistenceManager.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.persistence.manager; import org.mule.persistence.PersistenceManager; import org.mule.persistence.PersistenceStore; import org.mule.persistence.PersistenceTimer; import org.mule.persistence.file.FilePersistenceStore; import org.mule.persistence.xmldb.XmlDbPersistenceStore; import org.mule.umo.UMOException; import org.mule.umo.lifecycle.InitialisationException; import org.mule.umo.lifecycle.RecoverableException; import org.mule.util.StringUtils; /** * * */ public abstract class AbstractPersistenceManager implements PersistenceManager { protected String DEFAULT_STORE_TYPE = "file"; protected String storeType = null; protected PersistenceStore store = null; protected long lastRequest = 0L; protected int requestCount = 0; protected boolean inPersistence = false; protected PersistenceTimer persistenceTimer = null; protected boolean ready = false; protected void createStore() throws InitialisationException, RecoverableException { if (StringUtils.equals(storeType, "file")) { store = new FilePersistenceStore(); } else if (StringUtils.equals(storeType, "xmldb")) { store = new XmlDbPersistenceStore(); } if (store != null) { store.initialise(); } } /** * {@inheritDoc} */ public void start() throws UMOException { if (persistenceTimer != null) persistenceTimer.start(); ready = true; } /** * {@inheritDoc} */ public void stop() throws UMOException { if (persistenceTimer != null) { persistenceTimer.setDoStop(true); try { // Wait for the timer to stop Thread.sleep(persistenceTimer.getSleepInterval()); } catch (InterruptedException ie) { } } ready = false; } public void dispose() { } public boolean isReady() { return ready; } public void setStoreType(String storeType) { this.storeType = storeType; } public String getStoreType() { return storeType; } public int getRequestCount() { return requestCount; } public long getLastRequestTime() { return lastRequest; } } mule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/serializers/0000755000175000017500000000000011351411132027331 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/serializers/XStreamSerializer.javamule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/serializers/XStreamSerializer.java0000644000175000017500000000460410664703640033633 0ustar charlescharles/* * $Id: XStreamSerializer.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.persistence.serializers; import org.mule.MuleException; import org.mule.persistence.PersistenceHelper; import org.mule.persistence.PersistenceSerializer; import org.mule.transformers.xml.XStreamFactory; import org.mule.umo.lifecycle.InitialisationException; import org.mule.util.IOUtils; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.converters.Converter; import java.io.File; import java.io.FileOutputStream; /** * The purpose of the XStreamSerializer is to customize the persistence * of a Persistable object. Two examples of persistence serializers are the * XStreamSerializer and the JavaSeralizer. */ public class XStreamSerializer implements PersistenceSerializer { private XStreamFactory xstreamFactory = null; public XStreamSerializer() { } /** * {@inheritDoc} */ public void initialise() throws InitialisationException { try { xstreamFactory = new XStreamFactory(); } catch (Exception e) { String msg = "Unable to initialize the XStreamFactory: " + e.toString(); xstreamFactory = null; throw new InitialisationException(new MuleException(msg), this); } } public void serialize(File f, Object data) throws Exception { serialize(f, data, null); } public void serialize(File f, Object data, PersistenceHelper helper) throws Exception { XStream xstream = xstreamFactory.getInstance(); if (helper != null && helper instanceof Converter) { xstream.registerConverter((Converter)helper); /* TODO: get top tag out of there String cn = data.getClass().getName(); int pos = cn.lastIndexOf("."); if (pos > -1) cn = cn.substring(pos+1); xstream.alias(cn, data.getClass()); */ } IOUtils.write(xstream.toXML(data), new FileOutputStream(f)); } } mule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/serializers/JavaSerializer.java0000644000175000017500000000255510664703640033134 0ustar charlescharles/* * $Id: JavaSerializer.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.persistence.serializers; import org.mule.persistence.PersistenceHelper; import org.mule.persistence.PersistenceSerializer; import org.mule.umo.lifecycle.InitialisationException; import java.io.File; import java.io.FileOutputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; /** * The JavaSerializer is just an interface to serialize an object * to file. */ public class JavaSerializer implements PersistenceSerializer { public JavaSerializer() { } /** * {@inheritDoc} */ public void initialise() throws InitialisationException { } public void serialize(File f, Object data) throws Exception { serialize(f, data, null); } public void serialize(File f, Object data, PersistenceHelper helper) throws Exception { ObjectOutput out = new ObjectOutputStream(new FileOutputStream(f)); out.writeObject(data); out.close(); } } mule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/PersistenceTimer.java0000644000175000017500000000501310664703640031142 0ustar charlescharles/* * $Id: PersistenceTimer.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.persistence; /** * The PersistenceTimer optionally helps the PersistenceManager schedule * persistence. * * Possibly this can be replaced by the util/timer */ public class PersistenceTimer extends Thread { // How long to wait for before checking if we need to persist private int checkInterval = 20000; private int sleepInterval = 500; // Minimum interval between persist() calls private int minInterval = 20000; // Maximum interval between persist() calls private int maxInterval = 40000; //private int maxInterval = 600000; private boolean doStop = false; // Manager to which this Timer belongs private PersistenceManager manager = null; public PersistenceTimer(PersistenceManager manager) { super(); this.manager = manager; } public void run() { int currInterval = 0; while (true) { if (doStop) break; if (currInterval >= checkInterval) { currInterval = 0; if (mustPersist()) { manager.persist(); } } try { currInterval += sleepInterval; sleep(sleepInterval); } catch (InterruptedException e) { } } } private boolean mustPersist() { long now = System.currentTimeMillis(); /* logger.info("Checking if has to persist"); logger.info("" + now); logger.info("" + lastRequest); logger.info("" + (now - lastRequest)); logger.info("" + requestCount); */ if (manager.isReady()) if (now -manager.getLastRequestTime() > minInterval &&manager.getRequestCount() > 0) return true; else if (now -manager.getLastRequestTime() > maxInterval) return true; return false; } public int getSleepInterval() { return sleepInterval; } public void setDoStop(boolean doStop) { this.doStop = doStop; } } mule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/file/0000755000175000017500000000000011351411132025714 5ustar charlescharlesmule-2.0.1/modules/persistence/src/main/java/org/mule/persistence/file/FilePersistenceStore.java0000644000175000017500000001200410664703640032673 0ustar charlescharles/* * $Id: FilePersistenceStore.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.persistence.file; import org.mule.MuleException; import org.mule.RegistryContext; import org.mule.impl.ManagementContextAware; import org.mule.persistence.Persistable; import org.mule.persistence.PersistenceException; import org.mule.persistence.PersistenceHelper; import org.mule.persistence.PersistenceSerializer; import org.mule.persistence.PersistenceStore; import org.mule.persistence.serializers.XStreamSerializer; import org.mule.umo.UMOManagementContext; import org.mule.umo.lifecycle.InitialisationException; import org.mule.util.FileUtils; import java.io.File; import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** */ public class FilePersistenceStore implements PersistenceStore, ManagementContextAware { /** * Indicates whether the store is ready to save stuff or not */ private boolean ready = false; /** * Default directory for storing files */ private String DEFAULT_FILESTORE_DIRECTORY = "runtime"; /** * Prefix used for naming files */ private String DEFAULT_FILESTORE_FILE_PREFIX = "pstore"; /** * Current directory for storing files */ private String fileStoreDirectory = null; /** * File object pointing to the storage directory */ private File storeDir = null; /** * Serializer to use for writing the object out */ private PersistenceSerializer serializer = null; private UMOManagementContext managementContext; /** * logger used by this class */ private static transient Log logger = LogFactory.getLog(FilePersistenceStore.class); public FilePersistenceStore() { } public void setManagementContext(UMOManagementContext context) { this.managementContext = context; } /** * {@inheritDoc} */ public void initialise() throws InitialisationException { logger.info("Initialising"); String workDir = RegistryContext.getConfiguration().getWorkingDirectory(); String fileName = workDir + "/" + (fileStoreDirectory != null ? fileStoreDirectory : DEFAULT_FILESTORE_DIRECTORY); serializer = new XStreamSerializer(); try { logger.info("Creating directory " + fileName); storeDir = FileUtils.openDirectory(fileName); serializer.initialise(); ready = true; } catch (IOException ieo) { String msg = "Unable to find or create the file store directory: " + fileName; ready = false; storeDir = null; throw new InitialisationException(new MuleException(msg), this); } } /** * {@inheritDoc} */ public void dispose() { storeDir = null; ready = false; } /** * {@inheritDoc} */ public void store(Persistable object, boolean mayUpdate) throws PersistenceException { synchronized (this) { try { logger.info((new java.util.Date()).toString() + ": doing persistence"); if (object == null) { logger.error("Persistable is null!"); return; } Object data = object.getPersistableObject(); PersistenceHelper helper = object.getPersistenceHelper(); String fileName = storeDir.getCanonicalPath() + "/" + DEFAULT_FILESTORE_FILE_PREFIX + ".xml"; logger.info("Persisting to file " + fileName); serializer.serialize(FileUtils.createFile(fileName), data, helper); //FileUtils.stringToFile(fileName, xstream.toXML(data)); } catch (Exception e) { logger.error("Unable to persist: " + e.toString()); } } } /** * {@inheritDoc} */ public void remove(Persistable object) throws PersistenceException { } /** * {@inheritDoc} */ public boolean isReady() { return ready; } /** * {@inheritDoc} */ public int getState() { return 0; } /** * Returns the current file store directory */ public String getFileStoreDirectory() { return (fileStoreDirectory != null ? fileStoreDirectory : DEFAULT_FILESTORE_DIRECTORY); } /** * Sets the file store directory */ public void setFileStoreDirectory(String fileStoreDirectory) { this.fileStoreDirectory = fileStoreDirectory; } } mule-2.0.1/modules/persistence/src/main/java/org/mule/registry/0000755000175000017500000000000011351411132024321 5ustar charlescharlesmule-2.0.1/modules/persistence/src/main/java/org/mule/registry/persistence/0000755000175000017500000000000011351411132026645 5ustar charlescharlesmule-2.0.1/modules/persistence/src/main/java/org/mule/registry/persistence/Persistable.java0000644000175000017500000000317410664703640032010 0ustar charlescharles/* * $Id: Persistable.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.registry.persistence; import org.mule.umo.UMOException; import org.mule.umo.manager.UMOServerNotificationListener; /** * Persistable is an interface for a Mule object that wants * to be persisted somewhere. Right now, this interface is envisioned for * the registry itself, but it can be extended to other components. * * @author * @version $Revision: 8083 $ */ public interface Persistable { /** * Registers a listener from the Persistence Manager. This is * used by the component to alert the Manager to queue up the * persistence request. * * @param listener The listener that the component will talk to * @throws UMOException if the registration fails */ void registerPersistenceRequestListener(UMOServerNotificationListener listener) throws UMOException; /** * Return the data for persistence. It is the responsibility * of the component to handle any locks, copies, deep copies, * or synchronizations necessary in order to preserve a consistent * backup. * * @returns the data to be persisted * @throws UMOException if the registration fails */ Object getPersistableObject() throws UMOException; } mule-2.0.1/modules/persistence/pom.xml0000644000175000017500000000507011006063605017610 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-persistence Persistence Framework Framework for internal Mule-related persistence org.apache.felix maven-bundle-plugin org.mule.registry.*, org.mule.persistence.* org.mule.modules mule-module-management ${version} org.mule.modules mule-module-xml ${version} com.thoughtworks.xstream xstream 1.2.1 xpp3 xpp3_min 1.1.3.4.O org.osgi core 1.4 exist exist 1.1.1 exist exist-xmldb 1.1.1 exist exist-modules 1.1.1 mule-2.0.1/modules/acegi/0000755000175000017500000000000011351411156015016 5ustar charlescharlesmule-2.0.1/modules/acegi/src/0000755000175000017500000000000011351411155015604 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/0000755000175000017500000000000011351411155016530 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/java/0000755000175000017500000000000011351411155017451 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/java/org/0000755000175000017500000000000011351411155020240 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/java/org/mule/0000755000175000017500000000000011351411155021202 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/java/org/mule/module/0000755000175000017500000000000011351411155022467 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/0000755000175000017500000000000011351411155023537 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/AcegiSecurityContext.java0000644000175000017500000000271010754375733030530 0ustar charlescharles/* * $Id: AcegiSecurityContext.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; import org.acegisecurity.context.SecurityContextHolder; /** * AcegiSecurityContext is a SecurityContext wrapper used to * interface with an Acegi SecurityContext */ public class AcegiSecurityContext implements SecurityContext { private org.acegisecurity.context.SecurityContext delegate; private AcegiAuthenticationAdapter authentication; public AcegiSecurityContext(org.acegisecurity.context.SecurityContext delegate) { this.delegate = delegate; SecurityContextHolder.setContext(this.delegate); } public void setAuthentication(Authentication authentication) { this.authentication = ((AcegiAuthenticationAdapter)authentication); delegate.setAuthentication(this.authentication.getDelegate()); SecurityContextHolder.setContext(delegate); } public Authentication getAuthentication() { return this.authentication; } } mule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/AcegiSecurityContextFactory.java0000644000175000017500000000307510754375733032065 0ustar charlescharles/* * $Id: AcegiSecurityContextFactory.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; import org.mule.api.security.SecurityContextFactory; import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextImpl; /** * AcegiSecurityContextFactory creates an AcegiSecurityContext for an * UMOAuthentication object */ public class AcegiSecurityContextFactory implements SecurityContextFactory { public SecurityContext create(Authentication authentication) { org.acegisecurity.context.SecurityContext context = new SecurityContextImpl(); context.setAuthentication(((AcegiAuthenticationAdapter)authentication).getDelegate()); if (authentication.getProperties() != null) { if ((authentication.getProperties().containsKey("securityMode"))) { SecurityContextHolder.setStrategyName((String)authentication.getProperties().get( "securityMode")); } } SecurityContextHolder.setContext(context); return new AcegiSecurityContext(context); } } mule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/AcegiAuthenticationAdapter.java0000644000175000017500000000420610754375733031636 0ustar charlescharles/* * $Id: AcegiAuthenticationAdapter.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.api.security.Authentication; import java.util.Map; import org.acegisecurity.GrantedAuthority; /** * AcegiAuthenticationAdapter TODO */ public class AcegiAuthenticationAdapter implements Authentication { private org.acegisecurity.Authentication delegate; private Map properties; public AcegiAuthenticationAdapter(org.acegisecurity.Authentication authentication) { this.delegate = authentication; } public AcegiAuthenticationAdapter(org.acegisecurity.Authentication authentication, Map properties) { this.delegate = authentication; this.properties = properties; } public void setAuthenticated(boolean b) { delegate.setAuthenticated(b); } public boolean isAuthenticated() { return delegate.isAuthenticated(); } public GrantedAuthority[] getAuthorities() { return delegate.getAuthorities(); } public Object getCredentials() { return delegate.getCredentials(); } public Object getDetails() { return delegate.getDetails(); } public Object getPrincipal() { return delegate.getPrincipal(); } public int hashCode() { return delegate.hashCode(); } public boolean equals(Object another) { return delegate.equals(another); } public String getName() { return delegate.getName(); } public org.acegisecurity.Authentication getDelegate() { return delegate; } public Map getProperties() { return properties; } public void setProperties(Map properties) { this.properties = properties; } } mule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/i18n/0000755000175000017500000000000011351411155024316 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/i18n/AcegiMessages.java0000644000175000017500000000162710754375733027710 0ustar charlescharles/* * $Id: AcegiMessages.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class AcegiMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("acegi"); public static Message basicFilterCannotHandleHeader(String header) { return createMessage(BUNDLE_PATH, 1, header); } public static Message authRealmMustBeSetOnFilter() { return createMessage(BUNDLE_PATH, 2); } } mule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/config/0000755000175000017500000000000011351411155025004 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/config/AcegiNamespaceHandler.java0000644000175000017500000000330010754375733032007 0ustar charlescharles/* * $Id: AcegiNamespaceHandler.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi.config; import org.mule.api.config.MuleProperties; import org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.generic.DescendentDefinitionParser; import org.mule.config.spring.parsers.generic.NamedDefinitionParser; import org.mule.module.acegi.AcegiProviderAdapter; import org.mule.module.acegi.filters.http.HttpBasicAuthenticationFilter; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; /** * Registers a Bean Definition Parser for handling Acegi related elements. */ public class AcegiNamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("security-manager", new NamedDefinitionParser(MuleProperties.OBJECT_SECURITY_MANAGER)); registerBeanDefinitionParser("delegate-security-provider", new ChildDefinitionParser("provider", AcegiProviderAdapter.class)); registerBeanDefinitionParser("http-security-filter", new DescendentDefinitionParser("securityFilter", HttpBasicAuthenticationFilter.class)); registerBeanDefinitionParser("security-property", new ChildMapEntryDefinitionParser("securityProperty", "name", "value")); } }mule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/filters/0000755000175000017500000000000011351411155025207 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/filters/http/0000755000175000017500000000000011351411155026166 5ustar charlescharles././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootmule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/filters/http/HttpBasicAuthenticationFilter.javamule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/filters/http/HttpBasicAuthenticationFil0000644000175000017500000001716210754375733033355 0ustar charlescharles/* * $Id: HttpBasicAuthenticationFilter.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi.filters.http; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityException; import org.mule.api.security.SecurityProviderNotFoundException; import org.mule.api.security.SecurityContext; import org.mule.api.security.UnauthorisedException; import org.mule.api.security.UnknownAuthenticationTypeException; import org.mule.api.security.UnsupportedAuthenticationSchemeException; import org.mule.config.i18n.CoreMessages; import org.mule.module.acegi.AcegiAuthenticationAdapter; import org.mule.module.acegi.i18n.AcegiMessages; import org.mule.security.AbstractEndpointSecurityFilter; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import org.acegisecurity.AuthenticationException; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * HttpBasicAuthenticationFilter TODO */ public class HttpBasicAuthenticationFilter extends AbstractEndpointSecurityFilter { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(HttpBasicAuthenticationFilter.class); private String realm; private boolean realmRequired = true; public HttpBasicAuthenticationFilter() { super(); } public HttpBasicAuthenticationFilter(String realm) { this.realm = realm; } protected void doInitialise() throws InitialisationException { if (realm == null) { if (isRealmRequired()) { throw new InitialisationException(AcegiMessages.authRealmMustBeSetOnFilter(), this); } else { logger.warn("There is no security realm set, using default: null"); } } } public String getRealm() { return realm; } public void setRealm(String realm) { this.realm = realm; } public boolean isRealmRequired() { return realmRequired; } public void setRealmRequired(boolean realmRequired) { this.realmRequired = realmRequired; } /** * Authenticates the current message if authenticate is set to true. This method * will always populate the secure context in the session * * @param event the current message recieved * @throws org.mule.api.security.SecurityException if authentication fails */ public void authenticateInbound(MuleEvent event) throws SecurityException, SecurityProviderNotFoundException, UnknownAuthenticationTypeException { String header = event.getMessage().getStringProperty(HttpConstants.HEADER_AUTHORIZATION, null); if (logger.isDebugEnabled()) { logger.debug("Authorization header: " + header); } if ((header != null) && header.startsWith("Basic ")) { String base64Token = header.substring(6); String token = new String(Base64.decodeBase64(base64Token.getBytes())); String username = ""; String password = ""; int delim = token.indexOf(":"); if (delim != -1) { username = token.substring(0, delim); password = token.substring(delim + 1); } UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken( username, password); authRequest.setDetails(event.getMessage().getProperty(MuleProperties.MULE_ENDPOINT_PROPERTY)); Authentication authResult; Authentication umoAuthentication = new AcegiAuthenticationAdapter(authRequest); try { authResult = getSecurityManager().authenticate(umoAuthentication); } catch (AuthenticationException e) { // Authentication failed if (logger.isDebugEnabled()) { logger.debug("Authentication request for user: " + username + " failed: " + e.toString()); } setUnauthenticated(event); throw new UnauthorisedException(CoreMessages.authFailedForUser(username), e); } // Authentication success if (logger.isDebugEnabled()) { logger.debug("Authentication success: " + authResult.toString()); } SecurityContext context = getSecurityManager().createSecurityContext(authResult); context.setAuthentication(authResult); event.getSession().setSecurityContext(context); } else if (header == null) { setUnauthenticated(event); throw new UnauthorisedException(event.getMessage(), event.getSession().getSecurityContext(), getEndpoint(), this); } else { setUnauthenticated(event); throw new UnsupportedAuthenticationSchemeException( AcegiMessages.basicFilterCannotHandleHeader(header), event.getMessage()); } } protected void setUnauthenticated(MuleEvent event) { String realmHeader = "Basic realm="; if (realm != null) { realmHeader += "\"" + realm + "\""; } MuleMessage msg = event.getMessage(); msg.setProperty(HttpConstants.HEADER_WWW_AUTHENTICATE, realmHeader); msg.setIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, HttpConstants.SC_UNAUTHORIZED); } /** * Authenticates the current message if authenticate is set to true. This method * will always populate the secure context in the session * * @param event the current event being dispatched * @throws org.mule.api.security.SecurityException if authentication fails */ public void authenticateOutbound(MuleEvent event) throws SecurityException, SecurityProviderNotFoundException { if (event.getSession().getSecurityContext() == null) { if (isAuthenticate()) { throw new UnauthorisedException(event.getMessage(), event.getSession().getSecurityContext(), event.getEndpoint(), this); } else { return; } } Authentication auth = event.getSession().getSecurityContext().getAuthentication(); if (isAuthenticate()) { auth = getSecurityManager().authenticate(auth); if (logger.isDebugEnabled()) { logger.debug("Authentication success: " + auth.toString()); } } StringBuffer header = new StringBuffer(128); header.append("Basic "); String token = auth.getCredentials().toString(); header.append(new String(Base64.encodeBase64(token.getBytes()))); event.getMessage().setStringProperty(HttpConstants.HEADER_AUTHORIZATION, header.toString()); } } mule-2.0.1/modules/acegi/src/main/java/org/mule/module/acegi/AcegiProviderAdapter.java0000644000175000017500000000730310774254333030444 0ustar charlescharles/* * $Id: AcegiProviderAdapter.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; import org.mule.api.security.SecurityContextFactory; import org.mule.api.security.SecurityException; import org.mule.api.security.SecurityProvider; import org.mule.api.security.UnknownAuthenticationTypeException; import java.util.Map; import org.acegisecurity.AuthenticationException; import org.acegisecurity.providers.AuthenticationProvider; import org.acegisecurity.providers.UsernamePasswordAuthenticationToken; /** * AcegiProviderAdapter is a wrapper for an Acegi Security provider to * use with the SecurityManager */ public class AcegiProviderAdapter implements SecurityProvider, AuthenticationProvider { private AuthenticationProvider delegate; private String name; private SecurityContextFactory factory; private Map securityProperties; public AcegiProviderAdapter() { super(); } public AcegiProviderAdapter(AuthenticationProvider delegate) { this.delegate = delegate; } public AcegiProviderAdapter(AuthenticationProvider delegate, String name) { this.delegate = delegate; this.name = name; } public void initialise() throws InitialisationException { // all initialisation should be handled in the spring // intitialisation hook afterPropertiesSet() // register context factory factory = new AcegiSecurityContextFactory(); } public void setName(String name) { this.name = name; } public String getName() { return name; } public Authentication authenticate(Authentication authentication) throws SecurityException { org.acegisecurity.Authentication auth = null; if (authentication instanceof AcegiAuthenticationAdapter) { auth = ((AcegiAuthenticationAdapter)authentication).getDelegate(); } else { auth = new UsernamePasswordAuthenticationToken(authentication.getPrincipal(), authentication.getCredentials()); } auth = delegate.authenticate(auth); return new AcegiAuthenticationAdapter(auth, getSecurityProperties()); } public org.acegisecurity.Authentication authenticate(org.acegisecurity.Authentication authentication) throws AuthenticationException { return delegate.authenticate(authentication); } public boolean supports(Class aClass) { return Authentication.class.isAssignableFrom(aClass); } public AuthenticationProvider getDelegate() { return delegate; } public void setDelegate(AuthenticationProvider delegate) { this.delegate = delegate; } public SecurityContext createSecurityContext(Authentication auth) throws UnknownAuthenticationTypeException { /* * if (strategy != null){ return factory.create(auth, strategy); } else { */ return factory.create(auth); // } } public Map getSecurityProperties() { return securityProperties; } public void setSecurityProperties(Map securityProperties) { this.securityProperties = securityProperties; } } mule-2.0.1/modules/acegi/src/main/resources/0000755000175000017500000000000011351411155020542 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/resources/META-INF/0000755000175000017500000000000011351411156021703 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/resources/META-INF/spring.schemas0000644000175000017500000000013010634230661024547 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/acegi/2.0/mule-acegi.xsd=META-INF/mule-acegi.xsd mule-2.0.1/modules/acegi/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014410754375733024746 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/acegi/2.0=org.mule.module.acegi.config.AcegiNamespaceHandler mule-2.0.1/modules/acegi/src/main/resources/META-INF/services/0000755000175000017500000000000011351411155023525 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351411156024315 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351411156025257 5ustar charlescharlesmule-2.0.1/modules/acegi/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351411156026036 5ustar charlescharles././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/acegi/src/main/resources/META-INF/services/org/mule/i18n/acegi-messages.propertiesmule-2.0.1/modules/acegi/src/main/resources/META-INF/services/org/mule/i18n/acegi-messages.propertie0000644000175000017500000000015610621717250032653 0ustar charlescharles1=Http Basic filter doesn't know how to handle header '{0}' 2=The "realm" must be set on this security filter mule-2.0.1/modules/acegi/src/main/resources/META-INF/mule-acegi.xsd0000644000175000017500000000600710716342245024444 0ustar charlescharles This is the security provider type that is used to configure Acegi related functionality. An Acegi-based security provider that delegates authorization to some other provider. This appears to authenticate users via information in standard HTTP headers. mule-2.0.1/modules/acegi/src/test/0000755000175000017500000000000011351411155016563 5ustar charlescharlesmule-2.0.1/modules/acegi/src/test/java/0000755000175000017500000000000011351411154017503 5ustar charlescharlesmule-2.0.1/modules/acegi/src/test/java/org/0000755000175000017500000000000011351411154020272 5ustar charlescharlesmule-2.0.1/modules/acegi/src/test/java/org/mule/0000755000175000017500000000000011351411155021235 5ustar charlescharlesmule-2.0.1/modules/acegi/src/test/java/org/mule/security/0000755000175000017500000000000011351411155023104 5ustar charlescharlesmule-2.0.1/modules/acegi/src/test/java/org/mule/security/SecurityNamespaceHandlerTestCase.java0000644000175000017500000000440210757365472032350 0ustar charlescharles/* * $Id: SecurityNamespaceHandlerTestCase.java 10933 2008-02-21 21:20:58Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.EncryptionStrategy; import org.mule.api.security.SecurityManager; import org.mule.security.PasswordBasedEncryptionStrategy; import org.mule.security.SecretKeyEncryptionStrategy; import org.mule.tck.FunctionalTestCase; import java.util.Iterator; /** * TODO - move to functional tests packge one Ross has finished working there */ public class SecurityNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "security-namespace-config.xml"; } public void testSecurity() { SecurityManager securityManager = muleContext.getSecurityManager(); assertNotNull(securityManager.getProvider("dummySecurityProvider")); assertTrue(securityManager.getProvider("dummySecurityProvider") instanceof MockSecurityProvider); verifyEncryptionStrategy(securityManager, "dummyEncryptionStrategy", MockEncryptionStrategy.class); verifyEncryptionStrategy(securityManager, "passwordEncryptionStrategy", PasswordBasedEncryptionStrategy.class); verifyEncryptionStrategy(securityManager, "secretKeyEncryptionStrategy", SecretKeyEncryptionStrategy.class); } private void verifyEncryptionStrategy(SecurityManager securityManager, String name, Class clazz) { Iterator strategies = securityManager.getEncryptionStrategies().iterator(); logger.debug("Listing strategies"); while (strategies.hasNext()) { EncryptionStrategy strategy = (EncryptionStrategy) strategies.next(); logger.debug(strategy.getName() + " / " + strategy.toString() + " / " + strategy.getClass()); } assertNotNull(name, securityManager.getEncryptionStrategy(name)); assertTrue(securityManager.getEncryptionStrategy(name).getClass().equals(clazz)); } } mule-2.0.1/modules/acegi/src/test/java/org/mule/security/MockEncryptionStrategy.java0000644000175000017500000000206110774254333030450 0ustar charlescharles/* * $Id: MockEncryptionStrategy.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.EncryptionStrategy; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.CryptoFailureException; /** * Empty mock for tests */ public class MockEncryptionStrategy extends Named implements EncryptionStrategy { public byte[] encrypt(byte[] data, Object info) throws CryptoFailureException { return new byte[0]; } public byte[] decrypt(byte[] data, Object info) throws CryptoFailureException { return new byte[0]; } public void initialise() throws InitialisationException { // nothing to do } } mule-2.0.1/modules/acegi/src/test/java/org/mule/security/MockSecurityProvider.java0000644000175000017500000000243010774254333030115 0ustar charlescharles/* * $Id: MockSecurityProvider.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; import org.mule.api.security.SecurityProvider; import org.mule.api.security.UnknownAuthenticationTypeException; /** * Empty mock for test */ public class MockSecurityProvider extends Named implements SecurityProvider { public Authentication authenticate(Authentication authentication) throws org.mule.api.security.SecurityException { return null; } public boolean supports(Class aClass) { return false; } public SecurityContext createSecurityContext(Authentication auth) throws UnknownAuthenticationTypeException { return null; } public void initialise() throws InitialisationException { // nothing to do } } mule-2.0.1/modules/acegi/src/test/java/org/mule/security/MockKeyFactory.java0000644000175000017500000000116710760567260026662 0ustar charlescharles/* * $Id: MockKeyFactory.java 10988 2008-02-25 16:37:04Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; /** * Empty mock for tests */ public class MockKeyFactory extends Named implements SecretKeyFactory { public byte[] getKey() { return "key".getBytes(); } } mule-2.0.1/modules/acegi/src/test/java/org/mule/security/Named.java0000644000175000017500000000116610745677442025022 0ustar charlescharles/* * $Id: Named.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; public class Named { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } mule-2.0.1/modules/acegi/src/test/java/org/mule/module/0000755000175000017500000000000011351411154022521 5ustar charlescharlesmule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/0000755000175000017500000000000011351411155023572 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/AcegiAuthenticationNamespaceHandlerTestCase.javamule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/AcegiAuthenticationNamespaceHandlerTest0000644000175000017500000000220410754375733033417 0ustar charlescharles/* * $Id: AcegiAuthenticationNamespaceHandlerTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.tck.FunctionalTestCase; public class AcegiAuthenticationNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "acegi-authentication-config.xml"; } public void testAcegi() { // this code doesn't test anything and uses a deprecated api. was this a joke? // Collection endpoints = muleContext.getRegistry().getEndpoints(); // Iterator it = endpoints.iterator(); // while (it.hasNext()) // { // Endpoint endpoint = (Endpoint) it.next(); // logger.debug(endpoint.getName() + " : " + endpoint); // } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/AuthComponentAsynchFunctionalTestCase.javamule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/AuthComponentAsynchFunctionalTestCase.j0000644000175000017500000000575610754375733033414 0ustar charlescharles/* * $Id: AuthComponentAsynchFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.api.EncryptionStrategy; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.security.MuleCredentials; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextImpl; public class AuthComponentAsynchFunctionalTestCase extends FunctionalTestCase { protected String getConfigResources() { return "auth-component-asynch-test.xml"; } // @Override // Clear the security context after each test. public void doTearDown() { SecurityContextHolder.setContext(new SecurityContextImpl()); } public void testCaseGoodAuthenticationGoodAuthorisation() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("marie", "marie", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); client.dispatch("vm://test", "Marie", props); MuleMessage m = client.request("vm://output", 3000); assertNotNull(m); assertEquals((String)m.getPayload(), "Marie"); } public void testCaseGoodAuthenticationBadAuthorisation() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("anon", "anon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); client.dispatch("vm://test", "Marie", props); MuleMessage m = client.request("vm://output", 3000); assertNull(m); } public void testCaseBadAuthentication() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("anonX", "anonX", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); client.dispatch("vm://test", "USD,MTL", props); MuleMessage m = client.request("vm://output", 3000); assertNull(m); } } mule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/PlainTextFunctionalTestCase.java0000644000175000017500000000371210754375733032050 0ustar charlescharles/* * $Id: PlainTextFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; public class PlainTextFunctionalTestCase extends FunctionalTestCase { protected String getConfigResources() { return "encryption-test.xml"; } public void testAuthenticationFailureNoContext() throws Exception { MuleClient client = new MuleClient(); MuleMessage m = client.send("http://localhost:4567/index.html", "", null); assertNotNull(m); int status = m.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, -1); assertEquals(HttpConstants.SC_UNAUTHORIZED, status); } public void testAuthenticationFailureBadCredentials() throws Exception { MuleClient client = new MuleClient("anonX", "anonX"); MuleMessage m = client.send("http://localhost:4567/index.html", "", null); assertNotNull(m); int status = m.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, -1); assertEquals(HttpConstants.SC_UNAUTHORIZED, status); } public void testAuthenticationAuthorised() throws Exception { MuleClient client = new MuleClient("anon", "anon"); MuleMessage m = client.send("http://localhost:4567/index.html", "", null); assertNotNull(m); int status = m.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, -1); assertEquals(HttpConstants.SC_OK, status); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/SecureHttpPollingFunctionalTestCase.javamule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/SecureHttpPollingFunctionalTestCase.jav0000644000175000017500000000204110754375733033404 0ustar charlescharles/* * $Id: SecureHttpPollingFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; public class SecureHttpPollingFunctionalTestCase extends FunctionalTestCase { public void testPollingHttpConnectorSentCredentials() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.request("vm://toclient", 5000); assertNotNull(result.getPayload()); } protected String getConfigResources() { return "secure-http-polling-server.xml,secure-http-polling-client.xml"; } } mule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/EncryptionFunctionalTestCase.java0000644000175000017500000001023010754375733032263 0ustar charlescharles/* * $Id: EncryptionFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.api.EncryptionStrategy; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.security.CredentialsNotSetException; import org.mule.api.security.UnauthorisedException; import org.mule.config.ExceptionHelper; import org.mule.module.client.MuleClient; import org.mule.security.MuleCredentials; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConnector; import org.mule.transport.http.HttpConstants; import java.util.HashMap; import java.util.Map; public class EncryptionFunctionalTestCase extends FunctionalTestCase { protected String getConfigResources() { return "encryption-test.xml"; } public void testAuthenticationFailureNoContext() throws Exception { MuleClient client = new MuleClient(); MuleMessage m = client.send("vm://my.queue", "foo", null); assertNotNull(m); assertNotNull(m.getExceptionPayload()); assertEquals(ExceptionHelper.getErrorCode(CredentialsNotSetException.class), m.getExceptionPayload() .getCode()); } public void testAuthenticationFailureBadCredentials() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("anonX", "anonX", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://my.queue", "foo", props); assertNotNull(m); assertNotNull(m.getExceptionPayload()); assertEquals(ExceptionHelper.getErrorCode(UnauthorisedException.class), m.getExceptionPayload() .getCode()); } public void testAuthenticationAuthorised() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("anon", "anon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://my.queue", "foo", props); assertNotNull(m); assertNull(m.getExceptionPayload()); } public void testAuthenticationFailureBadCredentialsHttp() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("anonX", "anonX", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("http://localhost:4567/index.html", "", props); assertNotNull(m); int status = m.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, -1); assertEquals(HttpConstants.SC_UNAUTHORIZED, status); } public void testAuthenticationAuthorisedHttp() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("anon", "anon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("http://localhost:4567/index.html", "", props); assertNotNull(m); int status = m.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, -1); assertEquals(HttpConstants.SC_OK, status); } } mule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/AcegiNamespaceHandlerTestCase.java0000644000175000017500000000370610754375733032243 0ustar charlescharles/* * $Id: AcegiNamespaceHandlerTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.api.security.SecurityManager; import org.mule.api.security.SecurityProvider; import org.mule.tck.FunctionalTestCase; import java.util.Iterator; import org.acegisecurity.providers.dao.DaoAuthenticationProvider; public class AcegiNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "acegi-namespace-config.xml"; } public void testAcegi() { knownProperties(getProvider("memory-dao")); } protected SecurityProvider getProvider(String name) { SecurityManager securityManager = muleContext.getSecurityManager(); return securityManager.getProvider(name); } public void testCustom() { Iterator providers = muleContext.getSecurityManager().getProviders().iterator(); while (providers.hasNext()) { SecurityProvider provider = (SecurityProvider) providers.next(); logger.debug(provider); logger.debug(provider.getName()); } knownProperties(getProvider("customProvider")); knownProperties(getProvider("willOverwriteName")); } protected void knownProperties(SecurityProvider provider) { assertNotNull(provider); assertTrue(provider instanceof AcegiProviderAdapter); AcegiProviderAdapter adapter = (AcegiProviderAdapter) provider; assertNotNull(adapter.getDelegate()); assertTrue(adapter.getDelegate() instanceof DaoAuthenticationProvider); } }././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/AuthComponentSynchFunctionalTestCase.javamule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/AuthComponentSynchFunctionalTestCase.ja0000644000175000017500000000566410754375733033412 0ustar charlescharles/* * $Id: AuthComponentSynchFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.api.EncryptionStrategy; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.security.MuleCredentials; import org.mule.tck.FunctionalTestCase; import org.mule.transport.NullPayload; import java.util.HashMap; import java.util.Map; import org.acegisecurity.context.SecurityContextHolder; import org.acegisecurity.context.SecurityContextImpl; public class AuthComponentSynchFunctionalTestCase extends FunctionalTestCase { protected String getConfigResources() { return "auth-component-synch-test.xml"; } // @Override // Clear the security context after each test. public void doTearDown() { SecurityContextHolder.setContext(new SecurityContextImpl()); } public void testCaseGoodAuthenticationGoodAuthorisation() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("marie", "marie", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Marie", props); assertNotNull(m); assertTrue(m.getPayload().equals("Marie")); } public void testCaseGoodAuthenticationBadAuthorisation() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("anon", "anon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Marie", props); assertEquals(NullPayload.getInstance(), m.getPayload()); } public void testCaseBadAuthentication() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("anonX", "anonX", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Marie", props); assertNotNull(m.getPayload()); } } mule-2.0.1/modules/acegi/src/test/java/org/mule/module/acegi/HttpFilterFunctionalTestCase.java0000644000175000017500000000660610754375733032232 0ustar charlescharles/* * $Id: HttpFilterFunctionalTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.acegi; import org.mule.tck.FunctionalTestCase; import org.mule.transport.http.HttpConstants; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.methods.GetMethod; public class HttpFilterFunctionalTestCase extends FunctionalTestCase { protected String getConfigResources() { return "http-filter-test.xml"; } public void testAuthenticationFailureNoContext() throws Exception { HttpClient client = new HttpClient(); client.getParams().setAuthenticationPreemptive(true); GetMethod get = new GetMethod("http://localhost:4567/index.html"); get.setDoAuthentication(false); try { int status = client.executeMethod(get); assertEquals(HttpConstants.SC_UNAUTHORIZED, status); assertEquals("/index.html", get.getResponseBodyAsString()); } finally { get.releaseConnection(); } } public void testAuthenticationFailureBadCredentials() throws Exception { doRequest(null, "localhost", "anonX", "anonX", "http://localhost:4567/index.html", true, false, 401); } public void testAuthenticationAuthorised() throws Exception { doRequest(null, "localhost", "anon", "anon", "http://localhost:4567/index.html", false, true, 200); } public void testAuthenticationAuthorisedWithHandshake() throws Exception { doRequest(null, "localhost", "anon", "anon", "http://localhost:4567/index.html", true, false, 200); } public void testAuthenticationAuthorisedWithHandshakeAndBadRealm() throws Exception { doRequest("blah", "localhost", "anon", "anon", "http://localhost:4567/index.html", true, false, 401); } public void testAuthenticationAuthorisedWithHandshakeAndRealm() throws Exception { doRequest("mule-realm", "localhost", "ross", "ross", "http://localhost:4567/index.html", true, false, 200); } private void doRequest(String realm, String host, String user, String pass, String url, boolean handshake, boolean preemtive, int result) throws Exception { HttpClient client = new HttpClient(); client.getParams().setAuthenticationPreemptive(preemtive); client.getState().setCredentials(new AuthScope(host, -1, realm), new UsernamePasswordCredentials(user, pass)); GetMethod get = new GetMethod(url); get.setDoAuthentication(handshake); try { int status = client.executeMethod(get); assertEquals(result, status); } finally { get.releaseConnection(); } } } mule-2.0.1/modules/acegi/src/test/resources/0000755000175000017500000000000011351411155020575 5ustar charlescharlesmule-2.0.1/modules/acegi/src/test/resources/auth-component-synch-test.xml0000644000175000017500000000345710746074653026407 0ustar charlescharles mule-2.0.1/modules/acegi/src/test/resources/log4j.properties0000644000175000017500000000057510671314614023747 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN #log4j.logger.org.mule.config.spring.parsers.generic=DEBUG mule-2.0.1/modules/acegi/src/test/resources/acegi-namespace-config.xml0000644000175000017500000000506510754375733025613 0ustar charlescharles ross=ross,ROLE_ADMIN anon=anon,ROLE_ANONYMOUS mule-2.0.1/modules/acegi/src/test/resources/secure-http-polling-server.xml0000644000175000017500000000356310745174725026556 0ustar charlescharles mule-2.0.1/modules/acegi/src/test/resources/http-filter-test.xml0000644000175000017500000000364110745677442024565 0ustar charlescharles ross=ross,ROLE_ADMIN anon=anon,ROLE_ANONYMOUS mule-2.0.1/modules/acegi/src/test/resources/encryption-test.xml0000644000175000017500000000451210745677442024513 0ustar charlescharles ross=ross,ROLE_ADMIN anon=anon,ROLE_ANONYMOUS mule-2.0.1/modules/acegi/src/test/resources/secure-http-polling-client.xml0000644000175000017500000000343010745677442026523 0ustar charlescharles mule-2.0.1/modules/acegi/src/test/resources/security-namespace-config.xml0000644000175000017500000000242610760567260026403 0ustar charlescharles mule-2.0.1/modules/acegi/src/test/resources/acegi-authentication-config.xml0000644000175000017500000000361110745677442026673 0ustar charlescharles ross=ross,ROLE_ADMIN anon=anon,ROLE_ANONYMOUS mule-2.0.1/modules/acegi/src/test/resources/auth-component-security.xml0000644000175000017500000000420310745677442026147 0ustar charlescharles marie=marie,ROLE_ADMIN anon=anon,ROLE_ANONYMOUS echoComponentSecurity echoComponent mule-2.0.1/modules/acegi/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006210703240551025445 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/modules/acegi/src/test/resources/auth-component-asynch-test.xml0000644000175000017500000000451510746074653026544 0ustar charlescharles mule-2.0.1/modules/acegi/pom.xml0000644000175000017500000001301411006063605016331 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-acegi Acegi Security Mule Acegi Support exposes Acegi Authentication providers and Method interceptors to authentication event traffic via endpoints and method level authorisation on components. org.mule.modules mule-module-spring-config ${version} org.mule.tests mule-tests-functional ${version} test org.mule.transports mule-transport-http ${version} org.mule.modules mule-module-spring-extras ${version} org.acegisecurity acegi-security 1.0.1 commons-lang commons-lang commons-collections commons-collections commons-logging commons-logging org.springframework spring-core org.springframework spring-beans org.springframework spring-context org.springframework spring-remoting org.springframework spring-dao org.springframework spring-aop org.springframework spring-webmvc org.springframework spring-web org.springframework spring-jdbc org.springframework spring-support log4j log4j org.mule.modules mule-module-client ${version} test org.mule.transports mule-transport-vm ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.module.acegi.* mule-2.0.1/modules/osgi/0000755000175000017500000000000011351411141014701 5ustar charlescharlesmule-2.0.1/modules/osgi/src/0000755000175000017500000000000011351411141015470 5ustar charlescharlesmule-2.0.1/modules/osgi/src/main/0000755000175000017500000000000011351411141016414 5ustar charlescharlesmule-2.0.1/modules/osgi/src/main/java/0000755000175000017500000000000011351411141017335 5ustar charlescharlesmule-2.0.1/modules/osgi/src/main/java/org/0000755000175000017500000000000011351411141020124 5ustar charlescharlesmule-2.0.1/modules/osgi/src/main/java/org/mule/0000755000175000017500000000000011351411141021066 5ustar charlescharlesmule-2.0.1/modules/osgi/src/main/java/org/mule/module/0000755000175000017500000000000011351411141022353 5ustar charlescharlesmule-2.0.1/modules/osgi/src/main/java/org/mule/module/osgi/0000755000175000017500000000000011351411141023314 5ustar charlescharlesmule-2.0.1/modules/osgi/src/main/java/org/mule/module/osgi/MuleManagerActivator.java0000644000175000017500000000176610754375733030271 0ustar charlescharles/* * $Id: MuleManagerActivator.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.osgi; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class MuleManagerActivator implements BundleActivator { // Services-based Mule Manager. MuleSoaManager manager; public void start(BundleContext bc) throws Exception { manager = new MuleSoaManager(); managementContext.setBundleContext(bc); MuleManager.setInstance(manager); managementContext.start(); } public void stop(BundleContext bc) throws Exception { managementContext.stop(); } } mule-2.0.1/modules/osgi/src/main/java/org/mule/module/osgi/MuleSoaManager.java0000644000175000017500000001045010754375733027045 0ustar charlescharles/* * $Id: MuleSoaManager.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.osgi; import org.mule.config.i18n.Message; import org.mule.providers.service.TransportServiceDescriptor; import org.mule.registry.ServiceDescriptor; import org.mule.registry.ServiceException; import org.mule.umo.UMOException; import org.mule.umo.lifecycle.InitialisationException; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; import org.osgi.util.tracker.ServiceTracker; import org.springframework.osgi.context.BundleContextAware; /** * Service-based Mule Manager to be used in an OSGi environment. */ public class MuleSoaManager extends MuleManager implements BundleContextAware { BundleContext context; ServiceTracker connectors; ServiceTracker endpoints; ServiceTracker transformers; private static Log logger = LogFactory.getLog(MuleSoaManager.class); public void setBundleContext(BundleContext arg0) { this.context = context; } /** * Looks up the service descriptor from the OSGi registry each time, does not use a cache. * * @return The service descriptor or null if not found. */ // //@Override public ServiceDescriptor lookupServiceDescriptor(String type, String name, Properties overrides) throws ServiceException { try { // Get all services which match the interface. ServiceReference[] services; if (context != null) { services = context.getServiceReferences(TransportServiceDescriptor.class.getName(), null); } else { throw new InitialisationException(Message.createStaticMessage("BundleContext has not been set for Manager."), this); } // Match the service by name. String servicePid; for (int i=0; i 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-osgi OSGi Support Classes used for Mule's OSGi support org.apache.felix maven-bundle-plugin org.mule.providers.service, * --> org.mule.module.osgi, org.mule.module.osgi.util org.osgi osgi_R4_core 1.0 org.osgi osgi_R4_compendium 1.0 org.springframework.osgi spring-osgi-core 1.0-SNAPSHOT mule-2.0.1/modules/jca/0000755000175000017500000000000011351411136014501 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/0000755000175000017500000000000011351411135016163 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/0000755000175000017500000000000011351411135016752 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/rar/0000755000175000017500000000000011351411135017536 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/rar/META-INF/0000755000175000017500000000000011351411135020676 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/rar/META-INF/weblogic-ra.xml0000644000175000017500000000114510754375733023637 0ustar charlescharles mule/MuleJCA true org.mule.module.jca.MuleConnectionFactory mule/ConnectionFactory mule-2.0.1/modules/jca/jca-core/src/rar/META-INF/ra.xml0000644000175000017500000001471510767507530022051 0ustar charlescharles Mule Universal Resource Adapter Mule Universal Resource Adapter MuleSource Inc. MULE 1.3 Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com The software in this package is published under the terms of the CPAL v1.0 license, a copy of which has been included with this distribution in the LICENSE.txt file. true org.mule.module.jca.MuleResourceAdapter A comma separated list of configuration resources to configure a Mule Manager instance. These can be a list of files on the classpath or filesystem. And the type of file referenced depends on the configurationBuilder set on this Adapter. Configurations java.lang.String mule-config.xml A fully qualified classname of the configuration builder. Mule has Xml, Spring and Groovy configuration builders. By default This ResourceAdapter will use org.mule.config.builders.MuleXmlConfigurationBuilder. If there is a Mule instance already available to this ResourceAdapter this property will be ignored. ConfigurationBuilder java.lang.String org.mule.config.spring.SpringXmlConfigurationBuilder The default user name that will be used to log on to the Mule server. UserName java.lang.String The password for the default User. Password java.lang.String The JCA model used for JcaComponent's. The default value is set here, but this can be overridden in ActivationSpec configuration for a given MDB. modelName java.lang.String jcaModel org.mule.module.jca.MuleManagedConnectionFactory org.mule.module.jca.MuleConnectionFactory org.mule.module.jca.DefaultMuleConnectionFactory org.mule.module.jca.MuleConnection org.mule.module.jca.DefaultMuleConnection NoTransaction BasicPassword javax.resource.spi.security.PasswordCredential false org.mule.api.lifecycle.Callable org.mule.module.jca.MuleActivationSpec A valid Mule endpoint URI such as, pop3://user:password@mail.host.com or vm://test.component endpoint mule-2.0.1/modules/jca/jca-core/src/rar/META-INF/geronimo-ra.xml0000644000175000017500000000310710754375733023663 0ustar charlescharles Mule RA admin admin DefaultWorkManager org.mule.module.jca.MuleConnectionFactory DefaultMuleConnectionFactory 10 5000 mule/ConnectionFactory javax.resource.spi.security.PasswordCredential mule-2.0.1/modules/jca/jca-core/src/rar/license/0000755000175000017500000000000011351411135021160 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/rar/license/LICENSE0000644000175000017500000006623410664630335022213 0ustar charlescharlesCommon Public Attribution License Version 1.0 (CPAL) 1. "Definitions" 1.0.1 "Commercial Use" means distribution or otherwise making the Covered Code available to a third party. 1.1 "Contributor" means each entity that creates or contributes to the creation of Modifications. 1.2 "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. 1.3 "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. 1.4 "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data. 1.5 "Executable" means Covered Code in any form other than Source Code. 1.6 "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. 1.7 "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. 1.8 "License" means this document. 1.8.1 "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 1.9 "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is: A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. B. Any new file that contains any part of the Original Code or previous Modifications. 1.10 "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. 1.10.1 "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. 1.11 "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. 1.12 "You" (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. Source Code License. 2.1 The Initial Developer Grant. The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and (b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof). (c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License. (d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices. 2.2 Contributor Grant. Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). (c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code. (d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor. 3. Distribution Obligations. 3.1 Application of License. The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. 3.2 Availability of Source Code. Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. 3.3 Description of Modifications. You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. 3.4 Intellectual Property Matters (a) Third Party Claims. If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. (b) Contributor APIs. If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file. (c) Representations. Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License. 3.5 Required Notices. You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 3.6 Distribution of Executable Versions. You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer, Original Developer or any Contributor. You hereby agree to indemnify the Initial Developer, Original Developer and every Contributor for any liability incurred by the Initial Developer, Original Developer or such Contributor as a result of any such terms You offer. 3.7 Larger Works. You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. 4. Inability to Comply Due to Statute or Regulation. If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Application of this License. This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code. 6. Versions of the License. 6.1 New Versions. MuleSource, Inc. ("MuleSource") may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. 6.2 Effect of New Versions. Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Socialtext. No one other than MuleSource has the right to modify the terms applicable to Covered Code created under this License. 6.3 Derivative Works. If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases "MuleSource", "CPAL" or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the CPAL. (Filling in the name of the Initial Developer, Original Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.) 7. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER, ORIGINAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 8. TERMINATION. 8.1 This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 8.2 If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer, Original Developer or a Contributor (the Initial Developer, Original Developer or Contributor against whom You file such action is referred to as "Participant") alleging that: (a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above. (b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant. 8.3 If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license. 8.4 In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination. 9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ORIGINAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 10. U.S. GOVERNMENT END USERS. The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. 11. MISCELLANEOUS. This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. 12. RESPONSIBILITY FOR CLAIMS. As between Initial Developer, Original Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer, Original Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. 13. MULTIPLE-LICENSED CODE. Initial Developer may designate portions of the Covered Code as Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the CPAL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A. 14. ADDITIONAL TERM: ATTRIBUTION (a) As a modest attribution to the organizer of the development of the Original Code ("Original Developer"), in the hope that its promotional value may help justify the time, money and effort invested in writing the Original Code, the Original Developer may include in Exhibit B ("Attribution Information") a requirement that each time an Executable and Source Code or a Larger Work is launched or initially run (which includes initiating a session), a prominent display of the Original Developer's Attribution Information (as defined below) must occur on the graphic user interface employed by the end user to access such Covered Code (which may include display on a splash screen), if any. The size of the graphic image should be consistent with the size of the other elements of the Attribution Information. If the access by the end user to the Executable and Source Code does not create a graphic user interface for access to the Covered Code, this obligation shall not apply. If the Original Code displays such Attribution Information in a particular form (such as in the form of a splash screen, notice at login, an "about" display, or dedicated attribution area on user interface screens), continued use of such form for that Attribution Information is one way of meeting this requirement for notice. (b) Attribution information may only include a copyright notice, a brief phrase, graphic image and a URL ("Attribution Information") and is subject to the Attribution Limits as defined below. For these purposes, prominent shall mean display for sufficient duration to give reasonable notice to the user of the identity of the Original Developer and that if You include Attribution Information or similar information for other parties, You must ensure that the Attribution Information for the Original Developer shall be no less prominent than such Attribution Information or similar information for the other party. For greater certainty, the Original Developer may choose to specify in Exhibit B below that the above attribution requirement only applies to an Executable and Source Code resulting from the Original Code or any Modification, but not a Larger Work. The intent is to provide for reasonably modest attribution, therefore the Original Developer cannot require that You display, at any time, more than the following information as Attribution Information: (a) a copyright notice including the name of the Original Developer; (b) a word or one phrase (not exceeding 10 words); (c) one graphic image provided by the Original Developer; and (d) a URL (collectively, the "Attribution Limits"). (c) If Exhibit B does not include any Attribution Information, then there are no requirements for You to display any Attribution Information of the Original Developer. (d) You acknowledge that all trademarks, service marks and/or trade names contained within the Attribution Information distributed with the Covered Code are the exclusive property of their owners and may only be used with the permission of their owners, or under circumstances otherwise permitted by law or as expressly set out in this License. 15. ADDITIONAL TERM: NETWORK USE. The term "External Deployment" means the use, distribution, or communication of the Original Code or Modifications in any way such that the Original Code or Modifications may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Code or Modifications as a distribution under section 3.1 and make Source Code available under Section 3.2. EXHIBIT A. Common Public Attribution License Version 1.0. "The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mulesource.com/CPAL/. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is MuleSource Mule The Initial Developer of the Original Code is MuleSource Inc. All portions of the code are Copyright (c) 2003-2007 MuleSource Inc. All Rights Reserved. EXHIBIT B. Attribution Information Subject to the limitations and other requirements in Section 14 of the License, the Original Developer requires You to display the following Attribution Information: Attribution Copyright Notice: Copyright (c) 2003-2007 MuleSource Inc. Attribution Phrase (not exceeding 10 words): Powered by Mule. MuleSource is Open for Integration. Attribution URL: http://www.mulesource.com Graphic Image provided in the Covered Code as file: http://www.mulesource.com/images/mulesource_license_logo.gif Redistributions of the Covered Code in binary form or source code form, must ensure that the first time the resulting executable program is launched, a user interface, if any, shall include the attribution information set forth below prominently. If the executable program does not launch a user interface, the Company name and URL shall be included in the notice section of each file of the Covered Code. : Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL. mule-2.0.1/modules/jca/jca-core/src/main/0000755000175000017500000000000011351411135017676 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/java/0000755000175000017500000000000011351411134020616 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/java/org/0000755000175000017500000000000011351411134021405 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/0000755000175000017500000000000011351411134022347 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/0000755000175000017500000000000011351411134023634 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/0000755000175000017500000000000011351411135024372 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/DelegateWorkManager.java0000644000175000017500000000614410774254333031127 0ustar charlescharles/* * $Id: DelegateWorkManager.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.api.MuleException; import javax.resource.spi.work.ExecutionContext; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkException; import javax.resource.spi.work.WorkListener; import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionException; /** * DelegateWorkManager is a wrapper around a WorkManager provided by a * JCA container. */ public class DelegateWorkManager implements org.mule.api.context.WorkManager { private final javax.resource.spi.work.WorkManager workManager; public DelegateWorkManager(javax.resource.spi.work.WorkManager workManager2) { this.workManager = workManager2; } public void doWork(Work work) throws WorkException { workManager.doWork(work); } public void doWork(Work work, long l, ExecutionContext executionContext, WorkListener workListener) throws WorkException { workManager.doWork(work, l, executionContext, workListener); } public long startWork(Work work) throws WorkException { return workManager.startWork(work); } public long startWork(Work work, long l, ExecutionContext executionContext, WorkListener workListener) throws WorkException { return workManager.startWork(work, l, executionContext, workListener); } public void scheduleWork(Work work) throws WorkException { workManager.scheduleWork(work); } public void scheduleWork(Work work, long l, ExecutionContext executionContext, WorkListener workListener) throws WorkException { workManager.scheduleWork(work, l, executionContext, workListener); } public void execute(Runnable command) { try { this.scheduleWork(new RunnableWorkAdapter(command)); } catch (WorkException wex) { // unfortunately RejectedExecutionException is the closest thing we have // as proper RuntimeException throw new RejectedExecutionException(wex); } } public void start() throws MuleException { // nothing to do } public void stop() throws MuleException { // nothing to do } public void dispose() { // nothing to do } protected static class RunnableWorkAdapter implements Work { private final Runnable command; public RunnableWorkAdapter(Runnable command) { super(); this.command = command; } public void release() { // nothing to do } public void run() { command.run(); } } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleEndpointKey.java0000644000175000017500000000427010754375733030337 0ustar charlescharles/* * $Id: MuleEndpointKey.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import javax.resource.spi.endpoint.MessageEndpointFactory; /** * MuleEndpointKey TODO */ public class MuleEndpointKey { final private MessageEndpointFactory messageEndpointFactory; final private MuleActivationSpec activationSpec; /** * @param messageEndpointFactory * @param activationSpec */ public MuleEndpointKey(MessageEndpointFactory messageEndpointFactory, MuleActivationSpec activationSpec) { this.messageEndpointFactory = messageEndpointFactory; this.activationSpec = activationSpec; } /** * @return Returns the activationSpec. */ public MuleActivationSpec getActivationSpec() { return activationSpec; } /** * @return Returns the messageEndpointFactory. */ public MessageEndpointFactory getMessageEndpointFactory() { return messageEndpointFactory; } /** * @see java.lang.Object#hashCode() */ public int hashCode() { return messageEndpointFactory.hashCode() ^ activationSpec.hashCode(); } /** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass() != obj.getClass()) { return false; } MuleEndpointKey o = (MuleEndpointKey)obj; return o.activationSpec == activationSpec && o.messageEndpointFactory == messageEndpointFactory; } public String toString() { return "MuleEndpointKey{" + "messageEndpointFactory=" + messageEndpointFactory + ", activationSpec=" + activationSpec + "}"; } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/package.html0000644000175000017500000000035010754375733026674 0ustar charlescharles Mule A Resource Adapter implementation that allows a Mule instance to be deployed to a J2ee application server and exposes Mule services via the JCA connector architecture. mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleResourceAdapter.java0000644000175000017500000003165310770356575031204 0ustar charlescharles/* * $Id: MuleResourceAdapter.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.context.MuleContextBuilder; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.model.Model; import org.mule.api.service.Service; import org.mule.config.DefaultMuleConfiguration; import org.mule.context.DefaultMuleContextBuilder; import org.mule.context.DefaultMuleContextFactory; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.endpoint.URIBuilder; import org.mule.util.ClassUtils; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import javax.resource.NotSupportedException; import javax.resource.ResourceException; import javax.resource.spi.ActivationSpec; import javax.resource.spi.BootstrapContext; import javax.resource.spi.ResourceAdapter; import javax.resource.spi.ResourceAdapterInternalException; import javax.resource.spi.endpoint.MessageEndpointFactory; import javax.transaction.xa.XAResource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleResourceAdapter TODO */ public class MuleResourceAdapter implements ResourceAdapter, Serializable { /** * Serial version */ private static final long serialVersionUID = 5727648958127416509L; /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(this.getClass()); protected transient MuleContext muleContext; protected transient BootstrapContext bootstrapContext; protected MuleConnectionRequestInfo info = new MuleConnectionRequestInfo(); protected final Map endpoints = new HashMap(); protected String defaultJcaModelName; public MuleResourceAdapter() { RegistryContext.getOrCreateRegistry(); } private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); this.logger = LogFactory.getLog(this.getClass()); } /** * @see javax.resource.spi.ResourceAdapter#start(javax.resource.spi.BootstrapContext) */ public void start(BootstrapContext bootstrapContext) throws ResourceAdapterInternalException { this.bootstrapContext = bootstrapContext; if (info.getConfigurations() != null) { ConfigurationBuilder configBuilder = null; try { configBuilder = (ConfigurationBuilder) ClassUtils.instanciateClass(info.getConfigurationBuilder(), new Object[]{info.getConfigurations()}); } catch (Exception e) { throw new ResourceAdapterInternalException("Failed to instanciate configurationBuilder class: " + info.getConfigurationBuilder(), e); } try { logger.info("Initializing Mule..."); MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder(); DefaultMuleConfiguration config = new DefaultMuleConfiguration(); config.setSystemModelType(JcaModel.JCA_MODEL_TYPE); contextBuilder.setMuleConfiguration(config); muleContext = new DefaultMuleContextFactory().createMuleContext(configBuilder, contextBuilder); } catch (MuleException e) { logger.error(e); throw new ResourceAdapterInternalException( "Failed to load configurations: " + info.getConfigurations(), e); } try { logger.info("Starting Mule..."); muleContext.start(); } catch (MuleException e) { logger.error(e); throw new ResourceAdapterInternalException("Failed to start management context", e); } } } /** * @see javax.resource.spi.ResourceAdapter#stop() */ public void stop() { logger.info("Stopping Mule..."); muleContext.dispose(); muleContext = null; bootstrapContext = null; } /** * @return the bootstrap context for this adapter */ public BootstrapContext getBootstrapContext() { return bootstrapContext; } /** * @see javax.resource.spi.ResourceAdapter#endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory, * javax.resource.spi.ActivationSpec) */ public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec activationSpec) throws ResourceException { if (activationSpec.getResourceAdapter() != this) { throw new ResourceException("ActivationSpec not initialized with this ResourceAdapter instance"); } if (activationSpec.getClass().equals(MuleActivationSpec.class)) { MuleActivationSpec muleActivationSpec = (MuleActivationSpec) activationSpec; try { // Resolve modelName String modelName = resolveModelName(muleActivationSpec); // Lookup/create JCA Model JcaModel model = getJcaModel(modelName); // Create Endpoint InboundEndpoint endpoint = createMessageInflowEndpoint(muleActivationSpec); // Create Service Service service = createJcaService(endpointFactory, model, endpoint); // Keep reference to JcaService descriptor for endpointDeactivation MuleEndpointKey key = new MuleEndpointKey(endpointFactory, muleActivationSpec); endpoints.put(key, service); } catch (Exception e) { logger.error(e.getMessage(), e); } } else { throw new NotSupportedException("That type of ActicationSpec not supported: " + activationSpec.getClass()); } } /** * @see javax.resource.spi.ResourceAdapter#endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory, * javax.resource.spi.ActivationSpec) */ public void endpointDeactivation(MessageEndpointFactory endpointFactory, ActivationSpec activationSpec) { if (activationSpec.getClass().equals(MuleActivationSpec.class)) { MuleActivationSpec muleActivationSpec = (MuleActivationSpec) activationSpec; MuleEndpointKey key = new MuleEndpointKey(endpointFactory, (MuleActivationSpec) activationSpec); Service service = (Service) endpoints.remove(key); if (service == null) { logger.warn("No endpoint was registered with key: " + key); return; } // Resolve modelName String modelName = null; try { modelName = resolveModelName(muleActivationSpec); } catch (ResourceException e) { logger.error(e.getMessage(), e); } try { muleContext.getRegistry().unregisterService(service.getName()); } catch (MuleException e) { logger.error(e.getMessage(), e); } } } protected String resolveModelName(MuleActivationSpec activationSpec) throws ResourceException { // JCA specification mentions activationSpec properties inheriting // resourceAdaptor properties, but this doesn't seem to work, at // least with JBOSS, so do it manually. String modelName = activationSpec.getModelName(); if (modelName == null) { modelName = defaultJcaModelName; } if (modelName == null) { throw new ResourceException( "The 'modelName' property has not been configured for either the MuleResourceAdaptor or MuleActicationSpec."); } return modelName; } protected JcaModel getJcaModel(String modelName) throws MuleException, ResourceException { Model model = muleContext.getRegistry().lookupModel(modelName); if (model != null) { if (model instanceof JcaModel) { return (JcaModel) model; } else { throw new ResourceException("Model:-" + modelName + " is not compatible with JCA type"); } } else { JcaModel jcaModel = new JcaModel(); jcaModel.setName(modelName); muleContext.getRegistry().registerModel(jcaModel); return jcaModel; } } protected Service createJcaService(MessageEndpointFactory endpointFactory, JcaModel model, InboundEndpoint endpoint) throws MuleException { String name = "JcaService#" + endpointFactory.hashCode(); Service service = new JcaService(); service.setName(name); service.getInboundRouter().addEndpoint(endpoint); // Set endpointFactory rather than endpoint here, so we can obtain a // new endpoint instance from factory for each incoming message in // JcaComponet as reccomended by JCA specification service.setComponent(new JcaComponent(endpointFactory, model.getEntryPointResolverSet(), service, new DelegateWorkManager(bootstrapContext.getWorkManager()))); service.setModel(model); muleContext.getRegistry().registerService(service); return service; } protected InboundEndpoint createMessageInflowEndpoint(MuleActivationSpec muleActivationSpec) throws MuleException { EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(new URIBuilder( muleActivationSpec.getEndpoint()), muleContext); // Use asynchronous endpoint as we need to dispatch to service // rather than send. endpointBuilder.setSynchronous(false); return muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(endpointBuilder); } /** * We only connect to one resource manager per ResourceAdapter instance, so any ActivationSpec will return * the same XAResource. * * @see javax.resource.spi.ResourceAdapter#getXAResources(javax.resource.spi.ActivationSpec[]) */ public XAResource[] getXAResources(ActivationSpec[] activationSpecs) throws ResourceException { return new XAResource[]{}; } /** * @return */ public String getPassword() { return info.getPassword(); } /** * @return */ public String getConfigurations() { return info.getConfigurations(); } /** * @return */ public String getUserName() { return info.getUserName(); } /** * @param password */ public void setPassword(String password) { info.setPassword(password); } /** * @param configurations */ public void setConfigurations(String configurations) { info.setConfigurations(configurations); } /** * @param userid */ public void setUserName(String userid) { info.setUserName(userid); } public String getConfigurationBuilder() { return info.getConfigurationBuilder(); } public void setConfigurationBuilder(String configbuilder) { info.setConfigurationBuilder(configbuilder); } /** * @return Returns the info. */ public MuleConnectionRequestInfo getInfo() { return info; } public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof MuleResourceAdapter)) { return false; } final MuleResourceAdapter muleResourceAdapter = (MuleResourceAdapter) o; if (info != null ? !info.equals(muleResourceAdapter.info) : muleResourceAdapter.info != null) { return false; } return true; } public int hashCode() { return (info != null ? info.hashCode() : 0); } public String getModelName() { return defaultJcaModelName; } public void setModelName(String modelName) { this.defaultJcaModelName = modelName; } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/JcaService.java0000644000175000017500000000456310767632003027274 0ustar charlescharles/* * $Id: JcaService.java 11414 2008-03-18 03:16:19Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.service.ServiceException; import org.mule.module.jca.i18n.JcaMessages; import org.mule.service.AbstractService; /** * JcaService Is the type of service used in Mule when embedded inside * an app server using JCA. In the future we might want to use one of the existing * models. */ public class JcaService extends AbstractService { /** * Serial version */ private static final long serialVersionUID = -1510441245219710451L; /** * This is the synchronous call method and not supported by components managed in * a JCA container * * @param event * @return * @throws MuleException */ public MuleMessage sendEvent(MuleEvent event) throws MuleException { throw new UnsupportedOperationException("sendEvent()"); } public boolean isPaused() { // JcaService is a wrapper for a hosted service implementation and // therefore cannot be paused by mule return false; } protected void waitIfPaused(MuleEvent event) throws InterruptedException { // JcaService is a wrapper for a hosted service implementation and // therefore cannot be paused by mule } protected void doPause() throws MuleException { throw new ServiceException(JcaMessages.cannotPauseResumeJcaComponent(), null, this); } protected void doResume() throws MuleException { throw new ServiceException(JcaMessages.cannotPauseResumeJcaComponent(), null, this); } protected void doDispatch(MuleEvent event) throws MuleException { component.onCall(event); } /** * Implementation of template method which is never call because send() is * overwritten */ protected MuleMessage doSend(MuleEvent event) throws MuleException { return null; } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/DefaultMuleConnection.java0000644000175000017500000002032310766204322031473 0ustar charlescharles/* * $Id: DefaultMuleConnection.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.DispatchException; import org.mule.api.transport.ReceiveException; import org.mule.config.i18n.CoreMessages; import org.mule.module.client.i18n.ClientMessages; import org.mule.module.jca.i18n.JcaMessages; import org.mule.security.MuleCredentials; import org.mule.transport.AbstractConnector; import java.util.Map; import javax.resource.ResourceException; /** * MuleConnection TODO */ public class DefaultMuleConnection implements MuleConnection { private final MuleCredentials credentials; private final MuleContext muleContext; private MuleManagedConnection managedConnection; public DefaultMuleConnection(MuleManagedConnection managedConnection, MuleContext muleContext, MuleCredentials credentials) { this.muleContext = muleContext; this.credentials = credentials; this.managedConnection = managedConnection; } /** * Dispatches an event asynchronously to a endpointUri via a mule server. the Url * determines where to dispathc the event to, this can be in the form of * * @param url the Mule url used to determine the destination and transport of the * message * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. In * the case of Jms you could set the JMSReplyTo property in these * properties. * @throws org.mule.api.MuleException */ public void dispatch(String url, Object payload, Map messageProperties) throws MuleException { MuleMessage message = new DefaultMuleMessage(payload, messageProperties); MuleEvent event = getEvent(message, url, false); try { event.getSession().dispatchEvent(event); } catch (MuleException e) { throw e; } catch (Exception e) { throw new DispatchException( ClientMessages.failedToDispatchClientEvent(), event.getMessage(), event.getEndpoint(), e); } } /** * Sends an object (payload) synchronous to the given url and returns a * MuleMessage response back. * * @param url the Mule url used to determine the destination and transport of the * message * @param payload the object that is the payload of the event * @param messageProperties any properties to be associated with the payload. In * the case of Jms you could set the JMSReplyTo property in these * properties. * @return a umomessage response. * @throws org.mule.api.MuleException */ public MuleMessage send(String url, Object payload, Map messageProperties) throws MuleException { MuleMessage message = new DefaultMuleMessage(payload, messageProperties); MuleEvent event = getEvent(message, url, true); MuleMessage response; try { response = event.getSession().sendEvent(event); } catch (MuleException e) { throw e; } catch (Exception e) { throw new DispatchException( ClientMessages.failedToDispatchClientEvent(), event.getMessage(), event.getEndpoint(), e); } return response; } /** * Will receive an event from an endpointUri determined by the url * * @param url the Mule url used to determine the destination and transport of the * message * @param timeout how long to block waiting to receive the event, if set to 0 the * receive will not wait at all and if set to -1 the receive will wait * forever * @return the message received or null if no message was received * @throws org.mule.api.MuleException */ public MuleMessage request(String url, long timeout) throws MuleException { InboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(url); try { return endpoint.request(timeout); } catch (Exception e) { throw new ReceiveException(endpoint, timeout, e); } } /** * Packages a mule event for the current request * * @param message the event payload * @param uri the destination endpointUri * @param synchronous whether the event will be synchronously processed * @return the MuleEvent * @throws MuleException in case of Mule error */ protected MuleEvent getEvent(MuleMessage message, String uri, boolean synchronous) throws MuleException { ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(uri); //Connector connector = endpoint.getConnector(); // if (!connector.isStarted() && manager.isStarted()) // { // connector.start(); // } try { MuleSession session = new DefaultMuleSession(message, ((AbstractConnector)endpoint.getConnector()).getSessionHandler(), muleContext); if (credentials != null) { message.setProperty(MuleProperties.MULE_USER_PROPERTY, "Plain " + credentials.getToken()); } return new DefaultMuleEvent(message, endpoint, session, synchronous); } catch (Exception e) { throw new DispatchException( CoreMessages.failedToCreate("Client event"), message, endpoint, e); } } /** * Retrieves a ManagedConnection. * * @return a ManagedConnection instance representing the physical connection to * the EIS */ public MuleManagedConnection getManagedConnection() { return managedConnection; } /** * Closes the connection. */ public void close() throws ResourceException { if (managedConnection == null) { return; // connection is already closed } managedConnection.removeConnection(this); // Send a close event to the App Server managedConnection.fireCloseEvent(this); managedConnection = null; } /** * Associates connection handle with new managed connection. * * @param newMc new managed connection */ public void associateConnection(MuleManagedConnection newMc) throws ResourceException { checkIfValid(); // dissociate handle from current managed connection managedConnection.removeConnection(this); // associate handle with new managed connection newMc.addConnection(this); managedConnection = newMc; } /** * Checks the validity of the physical connection to the EIS. * * @throws javax.resource.ResourceException in case of any error */ void checkIfValid() throws ResourceException { if (managedConnection == null) { throw new ResourceException( JcaMessages.objectMarkedInvalid("muleManagedConnection").toString()); } } /** * Sets the physical connection to the EIS as invalid. The physical connection to * the EIS cannot be used any more. */ void invalidate() { managedConnection = null; } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleConnectionRequestInfo.java0000644000175000017500000001047510754375733032376 0ustar charlescharles/* * $Id: MuleConnectionRequestInfo.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextAware; import org.mule.config.spring.SpringXmlConfigurationBuilder; import org.mule.util.StringUtils; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import javax.resource.spi.ConnectionRequestInfo; /** * MuleConnectionRequestInfo TODO */ public class MuleConnectionRequestInfo implements ConnectionRequestInfo, Cloneable, Serializable, MuleContextAware { /** * Serial version */ private static final long serialVersionUID = 910828075890304726L; private String configurationBuilder = SpringXmlConfigurationBuilder.class.getName(); private String configurations; private String username; private String password; private MuleContext muleContext; public MuleConnectionRequestInfo() { super(); } private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); } public String getConfigurationBuilder() { return configurationBuilder; } public void setConfigurationBuilder(String configurationBuilder) { this.configurationBuilder = configurationBuilder; } public String getConfigurations() { return configurations; } public String[] getConfigurationsAsArray() { return StringUtils.splitAndTrim(configurations, ","); } public void setConfigurations(String configurations) { this.configurations = configurations; } public String getUserName() { return username; } public void setUserName(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public MuleContext getMuleContext() { return muleContext; } public void setMuleContext(MuleContext context) { this.muleContext = context; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass() != obj.getClass()) { return false; } final MuleConnectionRequestInfo muleConnectionRequestInfo = (MuleConnectionRequestInfo)obj; if (configurationBuilder != null ? !configurationBuilder.equals(muleConnectionRequestInfo.configurationBuilder) : muleConnectionRequestInfo.configurationBuilder != null) { return false; } if (configurations != null ? !configurations.equals(muleConnectionRequestInfo.configurations) : muleConnectionRequestInfo.configurations != null) { return false; } if (password != null ? !password.equals(muleConnectionRequestInfo.password) : muleConnectionRequestInfo.password != null) { return false; } if (username != null ? !username.equals(muleConnectionRequestInfo.username) : muleConnectionRequestInfo.username != null) { return false; } return true; } public int hashCode() { int result = (configurationBuilder != null ? configurationBuilder.hashCode() : 0); result = 29 * result + (configurations != null ? configurations.hashCode() : 0); result = 29 * result + (username != null ? username.hashCode() : 0); return 29 * result + (password != null ? password.hashCode() : 0); } protected Object clone() throws CloneNotSupportedException { return super.clone(); } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/JcaModel.java0000644000175000017500000000131210754375733026733 0ustar charlescharles/* * $Id: JcaModel.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.model.AbstractModel; /** * Creates a model suitable for Jca execution */ public class JcaModel extends AbstractModel { public static final String JCA_MODEL_TYPE = "jca"; public String getType() { return JCA_MODEL_TYPE; } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/JcaComponent.java0000644000175000017500000001266510771736371027650 0ustar charlescharles/* * $Id: JcaComponent.java 11488 2008-03-24 14:38:49Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.OptimizedRequestContext; import org.mule.RequestContext; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.component.LifecycleAdapter; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.model.EntryPointResolverSet; import org.mule.api.service.Service; import org.mule.component.AbstractJavaComponent; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; import org.mule.module.jca.i18n.JcaMessages; import javax.resource.spi.UnavailableException; import javax.resource.spi.endpoint.MessageEndpoint; import javax.resource.spi.endpoint.MessageEndpointFactory; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkEvent; import javax.resource.spi.work.WorkListener; import javax.resource.spi.work.WorkManager; public class JcaComponent extends AbstractJavaComponent implements WorkListener { protected MessageEndpointFactory messageEndpointFactory; protected WorkManager workManager; public JcaComponent(MessageEndpointFactory messageEndpointFactory, EntryPointResolverSet entryPointResolverSet, Service service, WorkManager workManager) { this.messageEndpointFactory = messageEndpointFactory; this.entryPointResolverSet = entryPointResolverSet; this.service = service; this.workManager = workManager; } /* * The service ins actually managed by the Application Server container,Since the * instance might be pooled by the server, we should use the * MessageEndPointFactory to delegate the request for creation to the container. * The container might create a Proxy object to intercept the actual method call * to implement transaction,security related functionalities */ public Object getManagedInstance() throws UnavailableException, MuleException { return messageEndpointFactory.createEndpoint(null); } public MuleMessage doOnCall(MuleEvent event) { try { workManager.scheduleWork(new MuleJcaWorker(event), WorkManager.INDEFINITE, null, this); } catch (Exception e) { logger.error(CoreMessages.failedToInvoke("UMO Service: " + service.getName())); } return null; } public Class getObjectType() { return MessageEndpoint.class; } // @Override protected LifecycleAdapter borrowComponentLifecycleAdaptor() throws Exception { // Template method unused because doOnCall and doOnEvent have been overridden return null; } // @Override protected void returnComponentLifecycleAdaptor(LifecycleAdapter lifecycleAdapter) { // Template method unused because doOnCall and doOnEvent have been overridden } // @Override protected void doInitialise() throws InitialisationException { // no-op no object-factory } public class MuleJcaWorker implements Work { private MuleEvent event; MuleJcaWorker(MuleEvent event) { this.event = event; } public void release() { // TODO Auto-generated method stub } public void run() { if (logger.isTraceEnabled()) { logger.trace("MuleJcaWorker: async MuleEvent for Mule JCA EndPoint " + service.getName()); } try { // Invoke method event = OptimizedRequestContext.criticalSetEvent(event); entryPointResolverSet.invoke(getManagedInstance(), RequestContext.getEventContext()); } catch (Exception e) { if (e instanceof UnavailableException) { Message message = JcaMessages.cannotAllocateManagedInstance(); logger.error(message); service.getExceptionListener().exceptionThrown(new MessagingException(message, e)); } else if (e instanceof MessagingException) { logger.error("Failed to execute JCAEndPoint " + e.getMessage(), e); service.getExceptionListener().exceptionThrown(e); } else { service.getExceptionListener().exceptionThrown( new MessagingException(CoreMessages.eventProcessingFailedFor(service.getName()), e)); } } } } public void workAccepted(WorkEvent arg0) { // TODO Auto-generated method stub } public void workCompleted(WorkEvent arg0) { // TODO Auto-generated method stub } public void workRejected(WorkEvent arg0) { // TODO Auto-generated method stub } public void workStarted(WorkEvent arg0) { // TODO Auto-generated method stub } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/RaHelper.java0000644000175000017500000000645010754375733026767 0ustar charlescharles/* * $Id: RaHelper.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.config.i18n.CoreMessages; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Iterator; import java.util.Set; import javax.resource.ResourceException; import javax.resource.spi.ConnectionRequestInfo; import javax.resource.spi.ManagedConnectionFactory; import javax.resource.spi.security.PasswordCredential; import javax.security.auth.Subject; /** * RaHelper is a collection of helper methods used by this RA * implementation */ // @ThreadSafe public class RaHelper { public static PasswordCredential getPasswordCredential(final ManagedConnectionFactory mcf, final Subject subject, ConnectionRequestInfo info) throws ResourceException { if (subject == null) { if (info == null) { return null; } else { MuleConnectionRequestInfo muleInfo = (MuleConnectionRequestInfo)info; // Can't create a PC with null values if (muleInfo.getUserName() == null || muleInfo.getPassword() == null) { // logger.info("\tUtil::GetPasswordCred: User or password is // null"); return null; } char[] password = muleInfo.getPassword().toCharArray(); PasswordCredential pc = new PasswordCredential(muleInfo.getUserName(), password); pc.setManagedConnectionFactory(mcf); return pc; } } else { PasswordCredential pc = (PasswordCredential)AccessController.doPrivileged(new PrivilegedAction() { public Object run() { Set creds = subject.getPrivateCredentials(PasswordCredential.class); Iterator iter = creds.iterator(); while (iter.hasNext()) { PasswordCredential candidate = (PasswordCredential)iter.next(); if (candidate != null) { ManagedConnectionFactory candidatemcf = candidate.getManagedConnectionFactory(); if (candidatemcf != null && candidatemcf.equals(mcf)) { return candidate; } } } return null; } }); if (pc == null) { throw new java.lang.SecurityException(CoreMessages.authNoCredentials().getMessage()); } else { return pc; } } } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleManagedConnection.java0000644000175000017500000003311710754375733031464 0ustar charlescharles/* * $Id: MuleManagedConnection.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.module.jca.i18n.JcaMessages; import org.mule.security.MuleCredentials; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import javax.resource.NotSupportedException; import javax.resource.ResourceException; import javax.resource.spi.ConnectionEvent; import javax.resource.spi.ConnectionEventListener; import javax.resource.spi.ConnectionRequestInfo; import javax.resource.spi.ManagedConnection; import javax.resource.spi.ManagedConnectionMetaData; import javax.resource.spi.security.PasswordCredential; import javax.security.auth.Subject; import javax.transaction.xa.XAResource; /** * MuleManagedConnection TODO */ public class MuleManagedConnection implements ManagedConnection { private MuleManagedConnectionFactory mcf; private List listeners = new ArrayList(); private Set connectionSet; private PrintWriter logWriter; private boolean destroyed; private PasswordCredential passCred; /** * Constructor. * * @param mcf the ManagedConnectionFactory that created this instance * @param subject security context as JAAS subject * @param cxRequestInfo ConnectionRequestInfo instance * @throws javax.resource.ResourceException in case of any error */ MuleManagedConnection(MuleManagedConnectionFactory mcf, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException { this.mcf = mcf; // Note: this will select the credential that matches this MC's MCF. // The credential's MCF is set by the application server. this.passCred = RaHelper.getPasswordCredential(mcf, subject, cxRequestInfo); connectionSet = new HashSet(); } /** * Creates a new connection handle to the Mail Server represented by the * ManagedConnection instance. This connection handle is used by the application * code to refer to the underlying physical connection. * * @param subject security context as JAAS subject * @param connectionRequestInfo ConnectionRequestInfo instance * @return Connection instance representing the connection handle * @throws ResourceException if the method fails to get a connection */ public Object getConnection(Subject subject, ConnectionRequestInfo connectionRequestInfo) throws ResourceException { checkIfDestroyed(); PasswordCredential pc = RaHelper.getPasswordCredential(mcf, subject, connectionRequestInfo); if (!passCred.equals(pc)) { // TODO change the message, we are not dealing with an endpoint here throw new javax.resource.spi.SecurityException( JcaMessages.authDeniedOnEndpoint(this).getMessage()); } String user; String password; MuleConnectionRequestInfo info = (MuleConnectionRequestInfo)connectionRequestInfo; user = info.getUserName(); password = info.getPassword(); if (user == null) { // Use default values user = mcf.getUsername(); password = mcf.getPassword(); } MuleCredentials creds = null; if (user != null) { if (password == null) { password = ""; } creds = new MuleCredentials(user, password.toCharArray()); } MuleConnection connection = new DefaultMuleConnection(this, info.getMuleContext(), creds); addConnection(connection); return connection; } /** * Destroys the physical connection. * * @throws ResourceException if the method fails to destroy the connection */ public void destroy() throws ResourceException { if (destroyed) { return; } destroyed = true; invalidateConnections(); } /** * Initiates a cleanup of the client-specific state maintained by a * ManagedConnection instance. The cleanup should invalidate all connection * handles created using this ManagedConnection instance. * * @throws ResourceException if the cleanup fails */ public void cleanup() throws ResourceException { checkIfDestroyed(); invalidateConnections(); } private void invalidateConnections() { Iterator it = connectionSet.iterator(); while (it.hasNext()) { DefaultMuleConnection connection = (DefaultMuleConnection)it.next(); connection.invalidate(); } connectionSet.clear(); } /** * Used by the container to change the association of an application-level * connection handle with a ManagedConnection instance. The container should find * the right ManagedConnection instance and call the associateConnection method. * * @param connection application-level connection handle * @throws ResourceException if the attempt to change the association fails */ public void associateConnection(Object connection) throws ResourceException { checkIfDestroyed(); if (connection instanceof MuleConnection) { MuleConnection cnn = (MuleConnection)connection; cnn.associateConnection(this); } else { throw new IllegalStateException( JcaMessages.objectMarkedInvalid(DefaultMuleConnection.class.getName() + ": " + (connection == null ? "null" : connection.getClass().getName())).toString()); } } /** * Adds a connection event listener to the ManagedConnection instance. The * registered ConnectionEventListener instances are notified of connection close * and error events as well as local-transaction-related events on the Managed * Connection. * * @param listener a new ConnectionEventListener to be registered */ public void addConnectionEventListener(ConnectionEventListener listener) { listeners.add(listener); } /** * Removes an already registered connection event listener from the * ManagedConnection instance. * * @param listener already registered connection event listener to be removed */ public void removeConnectionEventListener(ConnectionEventListener listener) { listeners.remove(listener); } /** * Returns a javax.transaction.xa.XAresource instance. An application server * enlists this XAResource instance with the Transaction Manager if the * ManagedConnection instance is being used in a JTA transaction that is being * coordinated by the Transaction Manager.

    Because this implementation does * not support transactions, the method throws an exception. * * @return the XAResource instance * @throws ResourceException if transactions are not supported */ // TODO public XAResource getXAResource() throws ResourceException { throw new NotSupportedException("getXAResource"); } /** * Returns a javax.resource.spi.LocalTransaction instance. The LocalTransaction * interface is used by the container to manage local transactions for a RM * instance.

    Because this implementation does not support transactions, the * method throws an exception. * * @return javax.resource.spi.LocalTransaction instance * @throws ResourceException if transactions are not supported */ public javax.resource.spi.LocalTransaction getLocalTransaction() throws ResourceException { throw new NotSupportedException("getLocalTransaction"); } /** * Gets the metadata information for this connection's underlying EIS resource * manager instance. The ManagedConnectionMetaData interface provides information * about the underlying EIS instance associated with the ManagedConnection * instance. * * @return ManagedConnectionMetaData ManagedConnectionMetaData instance * @throws ResourceException if the metadata cannot be retrieved */ public ManagedConnectionMetaData getMetaData() throws ResourceException { checkIfDestroyed(); return new MuleManagedConnectionMetaData(this); } /** * Sets the log writer for this ManagedConnection instance. The log writer is a * character output stream to which all logging and tracing messages for this * ManagedConnection instance will be printed. * * @param out character output stream to be associated * @throws ResourceException if the method fails */ public void setLogWriter(PrintWriter out) throws ResourceException { this.logWriter = out; } /** * Gets the log writer for this ManagedConnection instance. * * @return the character output stream associated with this ManagedConnection * instance * @throws ResourceException if the method fails */ public PrintWriter getLogWriter() throws ResourceException { return logWriter; } /** * Gets the user name of the user associated with the ManagedConnection instance. * * @return the username for this connection */ public String getUsername() { if (passCred != null) { return passCred.getUserName(); } else { return null; } } /** * Gets the password for the user associated with the ManagedConnection instance. * * @return the password for this connection */ public PasswordCredential getPasswordCredential() { return passCred; } /** * Associate connection handle with the physical connection. * * @param connection connection handle */ public void addConnection(MuleConnection connection) { connectionSet.add(connection); } /** * Check validation of the physical connection. * * @throws ResourceException if the connection has been destroyed */ private void checkIfDestroyed() throws ResourceException { if (destroyed) { throw new ResourceException( JcaMessages.objectIsDisposed("MuleManagedConnection").toString()); } } /** * Removes the associated connection handle from the connections set to the * physical connection. * * @param connection the connection handle */ public void removeConnection(MuleConnection connection) { connectionSet.remove(connection); } /** * Checks validation of the physical connection. * * @return true if the connection has been destroyed; false otherwise */ boolean isDestroyed() { return destroyed; } /** * Returns the ManagedConnectionFactory that created this instance of * ManagedConnection. * * @return the ManagedConnectionFactory for this connection */ public MuleManagedConnectionFactory getManagedConnectionFactory() { return this.mcf; } void fireBeginEvent() { ConnectionEvent event = new ConnectionEvent(MuleManagedConnection.this, ConnectionEvent.LOCAL_TRANSACTION_STARTED); Iterator iterator = listeners.iterator(); while (iterator.hasNext()) { ConnectionEventListener l = (ConnectionEventListener)iterator.next(); l.localTransactionStarted(event); } } void fireCommitEvent() { ConnectionEvent event = new ConnectionEvent(MuleManagedConnection.this, ConnectionEvent.LOCAL_TRANSACTION_COMMITTED); Iterator iterator = listeners.iterator(); while (iterator.hasNext()) { ConnectionEventListener l = (ConnectionEventListener)iterator.next(); l.localTransactionCommitted(event); } } void fireRollbackEvent() { ConnectionEvent event = new ConnectionEvent(MuleManagedConnection.this, ConnectionEvent.LOCAL_TRANSACTION_ROLLEDBACK); Iterator iterator = listeners.iterator(); while (iterator.hasNext()) { ConnectionEventListener l = (ConnectionEventListener)iterator.next(); l.localTransactionRolledback(event); } } void fireCloseEvent(MuleConnection connection) { ConnectionEvent event = new ConnectionEvent(MuleManagedConnection.this, ConnectionEvent.CONNECTION_CLOSED); event.setConnectionHandle(connection); Iterator iterator = listeners.iterator(); while (iterator.hasNext()) { ConnectionEventListener l = (ConnectionEventListener)iterator.next(); l.connectionClosed(event); } } void fireErrorOccurredEvent(Exception error) { ConnectionEvent event = new ConnectionEvent(MuleManagedConnection.this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, error); Iterator iterator = listeners.iterator(); while (iterator.hasNext()) { ConnectionEventListener l = (ConnectionEventListener)iterator.next(); l.connectionErrorOccurred(event); } } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/i18n/0000755000175000017500000000000011351411135025151 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/i18n/JcaMessages.java0000644000175000017500000000242010764126714030214 0ustar charlescharles/* * $Id: JcaMessages.java 11240 2008-03-07 02:51:56Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class JcaMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("jca"); public static Message authDeniedOnEndpoint(Object endpoint) { return createMessage(BUNDLE_PATH, 1, endpoint); } public static Message objectMarkedInvalid(String string) { return createMessage(BUNDLE_PATH, 2, string); } public static Object objectIsDisposed(Object object) { return createMessage(BUNDLE_PATH, 3, object); } public static Message cannotPauseResumeJcaComponent() { return createMessage(BUNDLE_PATH, 4); } public static Message cannotAllocateManagedInstance() { return createMessage(BUNDLE_PATH, 5); } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/DefaultMuleConnectionFactory.java0000644000175000017500000000643010754375733033042 0ustar charlescharles/* * $Id: DefaultMuleConnectionFactory.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import java.io.IOException; import java.io.ObjectInputStream; import javax.naming.Reference; import javax.resource.ResourceException; import javax.resource.spi.ConnectionManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * DefaultMuleConnectionFactory an implementation of the * MuleconnectionFactory interface used by clients of this ResourceAdapter to obtain * a connection to Mule resources. */ public class DefaultMuleConnectionFactory implements MuleConnectionFactory { /** * Serial version */ private static final long serialVersionUID = 1552386015565975623L; /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(this.getClass()); private transient ConnectionManager manager; private transient MuleManagedConnectionFactory factory; private Reference reference; private MuleConnectionRequestInfo info; public DefaultMuleConnectionFactory(MuleManagedConnectionFactory factory, ConnectionManager manager, MuleConnectionRequestInfo info) { this.factory = factory; this.manager = manager; this.info = info; } private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); // TODO this is incomplete: // MuleManagedConnectionFactory is Serializable but marked transient?! this.logger = LogFactory.getLog(this.getClass()); } public MuleConnection createConnection() throws ResourceException { return createConnection(info); } public MuleConnection createConnection(MuleConnectionRequestInfo info) throws ResourceException { // TODO try { return (MuleConnection)manager.allocateConnection(factory, info); // } // catch (ResourceException e) { // // logger.warn("Connection could not be created: " + e.getMessage(), e); // throw new DefaultMuleException(e.getMessage()); // } } public ConnectionManager getManager() { return manager; } public void setManager(ConnectionManager manager) { this.manager = manager; } public MuleManagedConnectionFactory getFactory() { return factory; } public void setFactory(MuleManagedConnectionFactory factory) { this.factory = factory; } public Reference getReference() { return reference; } public void setReference(Reference reference) { this.reference = reference; } public MuleConnectionRequestInfo getInfo() { return info; } public void setInfo(MuleConnectionRequestInfo info) { this.info = info; } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/DefaultConnectionManager.java0000644000175000017500000001034210754375733032157 0ustar charlescharles/* * $Id: DefaultConnectionManager.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import java.io.IOException; import java.io.ObjectInputStream; import javax.resource.ResourceException; import javax.resource.spi.ConnectionEvent; import javax.resource.spi.ConnectionEventListener; import javax.resource.spi.ConnectionManager; import javax.resource.spi.ConnectionRequestInfo; import javax.resource.spi.ManagedConnection; import javax.resource.spi.ManagedConnectionFactory; import javax.security.auth.Subject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * DefaultConnectionManager TODO */ public class DefaultConnectionManager implements ConnectionManager, ConnectionEventListener { /** * Serial version */ private static final long serialVersionUID = 1967602190602154760L; private transient Log logger = LogFactory.getLog(this.getClass()); public DefaultConnectionManager() { super(); } private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); this.logger = LogFactory.getLog(this.getClass()); } /** * @see javax.resource.spi.ConnectionManager#allocateConnection(javax.resource.spi.ManagedConnectionFactory, * javax.resource.spi.ConnectionRequestInfo) */ public Object allocateConnection(ManagedConnectionFactory connectionFactory, ConnectionRequestInfo info) throws ResourceException { Subject subject = null; ManagedConnection connection = connectionFactory.createManagedConnection(subject, info); connection.addConnectionEventListener(this); return connection.getConnection(subject, info); } /** * @see javax.resource.spi.ConnectionEventListener#connectionClosed(javax.resource.spi.ConnectionEvent) */ public void connectionClosed(ConnectionEvent event) { try { ((ManagedConnection)event.getSource()).cleanup(); } catch (ResourceException e) { logger.warn("Error occured during the cleanup of a managed connection: ", e); } try { ((ManagedConnection)event.getSource()).destroy(); } catch (ResourceException e) { logger.warn("Error occured during the destruction of a managed connection: ", e); } } /** * @see javax.resource.spi.ConnectionEventListener#localTransactionStarted(javax.resource.spi.ConnectionEvent) */ public void localTransactionStarted(ConnectionEvent event) { // TODO maybe later? } /** * @see javax.resource.spi.ConnectionEventListener#localTransactionCommitted(javax.resource.spi.ConnectionEvent) */ public void localTransactionCommitted(ConnectionEvent event) { // TODO maybe later? } /** * @see javax.resource.spi.ConnectionEventListener#localTransactionRolledback(javax.resource.spi.ConnectionEvent) */ public void localTransactionRolledback(ConnectionEvent event) { // TODO maybe later? } /** * @see javax.resource.spi.ConnectionEventListener#connectionErrorOccurred(javax.resource.spi.ConnectionEvent) */ public void connectionErrorOccurred(ConnectionEvent event) { logger.warn("Managed connection experiened an error: ", event.getException()); try { ((ManagedConnection)event.getSource()).cleanup(); } catch (ResourceException e) { logger.warn("Error occured during the cleanup of a managed connection: ", e); } try { ((ManagedConnection)event.getSource()).destroy(); } catch (ResourceException e) { logger.warn("Error occured during the destruction of a managed connection: ", e); } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleManagedConnectionMetaData.javamule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleManagedConnectionMetaData.java0000644000175000017500000000312610754375733033062 0ustar charlescharles/* * $Id: MuleManagedConnectionMetaData.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.config.MuleManifest; import org.mule.module.jca.i18n.JcaMessages; import javax.resource.ResourceException; import javax.resource.spi.ManagedConnectionMetaData; /** * MuleManagedConnectionMetaData TODO */ public class MuleManagedConnectionMetaData implements ManagedConnectionMetaData { private final MuleManagedConnection managedConnection; public MuleManagedConnectionMetaData(MuleManagedConnection mc) { this.managedConnection = mc; } public String getEISProductName() throws ResourceException { return MuleManifest.getVendorName(); } public String getEISProductVersion() throws ResourceException { return MuleManifest.getProductVersion(); } // TODO public int getMaxConnections() throws ResourceException { return 0; } public String getUserName() throws ResourceException { if (managedConnection.isDestroyed()) { throw new IllegalStateException( JcaMessages.objectIsDisposed(managedConnection).toString()); } return managedConnection.getUsername(); } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleConnection.java0000644000175000017500000000221710757615756030211 0ustar charlescharles/* * $Id: MuleConnection.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import java.util.Map; import javax.resource.ResourceException; /** * MuleConnection defines the client connection methods for the JCA * CCI contract */ public interface MuleConnection { void dispatch(String url, Object payload, Map messageProperties) throws MuleException; MuleMessage request(String url, long timeout) throws MuleException; MuleManagedConnection getManagedConnection(); void close() throws ResourceException; void associateConnection(MuleManagedConnection newMc) throws ResourceException; MuleMessage send(String url, Object payload, Map messageProperties) throws MuleException; } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleConnectionFactory.java0000644000175000017500000000237510754375733031541 0ustar charlescharles/* * $Id: MuleConnectionFactory.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import java.io.Serializable; import javax.resource.Referenceable; import javax.resource.ResourceException; import javax.resource.spi.ConnectionManager; /** * MuleConnectionFactory defines the connection factory interface that * the RA clients will obtain a reference to. */ public interface MuleConnectionFactory extends Serializable, Referenceable { MuleConnection createConnection() throws ResourceException; MuleConnection createConnection(MuleConnectionRequestInfo info) throws ResourceException; ConnectionManager getManager(); void setManager(ConnectionManager manager); MuleManagedConnectionFactory getFactory(); void setFactory(MuleManagedConnectionFactory factory); MuleConnectionRequestInfo getInfo(); void setInfo(MuleConnectionRequestInfo info); } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleActivationSpec.java0000644000175000017500000001102610754375733031017 0ustar charlescharles/* * $Id: MuleActivationSpec.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointURI; import org.mule.endpoint.MuleEndpointURI; import org.mule.util.StringUtils; import java.io.Serializable; import java.util.Properties; import javax.resource.ResourceException; import javax.resource.spi.ActivationSpec; import javax.resource.spi.InvalidPropertyException; import javax.resource.spi.ResourceAdapter; /** * MuleActivationSpec defines the contract between a Message Driven * Bean (MDB) and the Mule Resource Adapter. This spec holds the configuration values * used to register inbound communication with the Resource Adapter */ public class MuleActivationSpec implements ActivationSpec, Serializable { /** * Serial version */ private static final long serialVersionUID = 735353511874563914L; private Properties propertiesMap; private String endpointName; private String connectorName; private int createConnector; private MuleResourceAdapter resourceAdapter; private String endpoint; private EndpointURI endpointURI; private String modelName; public Properties getPropertiesMap() { return propertiesMap; } public void setPropertiesMap(Properties propertiesMap) { this.propertiesMap = propertiesMap; } public void setPropertiesMap(String properties) { String[] pairs = StringUtils.splitAndTrim(properties, ","); Properties props = new Properties(); for (int i = 0; i < pairs.length; i++) { String pair = pairs[i]; int x = pair.indexOf('='); if (x == -1) { props.setProperty(pair, null); } else { props.setProperty(pair.substring(0, x), pair.substring(x + 1)); } } this.setPropertiesMap(props); } public String getEndpointName() { return endpointName; } public void setEndpointName(String endpointName) { this.endpointName = endpointName; } public String getConnectorName() { return connectorName; } public void setConnectorName(String connectorName) { this.connectorName = connectorName; } public int getCreateConnector() { return createConnector; } public void setCreateConnector(int createConnector) { this.createConnector = createConnector; } public String getEndpoint() { return endpoint; } public void setEndpoint(String endpoint) { this.endpoint = endpoint; } public void validate() throws InvalidPropertyException { try { this.endpointURI = new MuleEndpointURI(endpoint); } catch (EndpointException e) { throw new InvalidPropertyException(e); } if (propertiesMap != null) { propertiesMap.putAll(this.endpointURI.getParams()); } else { propertiesMap = this.endpointURI.getParams(); } if (endpoint == null) { throw new InvalidPropertyException("endpoint is null"); } if (endpointURI == null) { throw new InvalidPropertyException("endpointURI is null"); } } public ResourceAdapter getResourceAdapter() { return resourceAdapter; } public void setResourceAdapter(ResourceAdapter resourceAdapter) throws ResourceException { // spec section 5.3.3 if (this.resourceAdapter != null) { throw new ResourceException("ResourceAdapter already set"); } if (!(resourceAdapter instanceof MuleResourceAdapter)) { throw new ResourceException("ResourceAdapter is not of type: " + MuleResourceAdapter.class.getName()); } this.resourceAdapter = (MuleResourceAdapter)resourceAdapter; } public String getModelName() { return modelName; } public void setModelName(String modelName) { this.modelName = modelName; } } mule-2.0.1/modules/jca/jca-core/src/main/java/org/mule/module/jca/MuleManagedConnectionFactory.java0000644000175000017500000002234710754375733033017 0ustar charlescharles/* * $Id: MuleManagedConnectionFactory.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.IOException; import java.io.ObjectInputStream; import java.io.PrintWriter; import java.util.Iterator; import java.util.Set; import javax.resource.ResourceException; import javax.resource.spi.ConnectionManager; import javax.resource.spi.ConnectionRequestInfo; import javax.resource.spi.ManagedConnection; import javax.resource.spi.ManagedConnectionFactory; import javax.resource.spi.security.PasswordCredential; import javax.security.auth.Subject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleManagedConnectionFactory TODO */ public class MuleManagedConnectionFactory implements ManagedConnectionFactory { /** * Serial version */ private static final long serialVersionUID = -1460847590293644271L; private transient PrintWriter out; private transient PropertyChangeSupport changes = new PropertyChangeSupport(this); // userName property value private String username = null; // password property value private String password = null; /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(this.getClass()); public MuleManagedConnectionFactory() { super(); } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); this.logger = LogFactory.getLog(this.getClass()); this.changes = new PropertyChangeSupport(this); this.out = null; } public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((password == null) ? 0 : password.hashCode()); return PRIME * result + ((username == null) ? 0 : username.hashCode()); } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass() != obj.getClass()) { return false; } final MuleManagedConnectionFactory other = (MuleManagedConnectionFactory)obj; if (password == null) { if (other.password != null) { return false; } } else if (!password.equals(other.password)) { return false; } if (username == null) { if (other.username != null) { return false; } } else if (!username.equals(other.username)) { return false; } return true; } /** * Creates a Connection Factory instance. The ConnectionFactory instance is * initialized with the passed ConnectionManager. In the managed scenario, * ConnectionManager is provided by the application server. * * @param cxManager ConnectionManager to be associated with created EIS * connection factory instance * @return EIS-specific Connection Factory instance * @throws javax.resource.ResourceException if the attempt to create a connection * factory fails */ public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException { try { return new DefaultMuleConnectionFactory(this, cxManager, null); } catch (Exception e) { throw new ResourceException(e); } } /** * Creates a Connection Factory instance. The Connection Factory instance is * initialized with a default ConnectionManager. In the non-managed scenario, the * ConnectionManager is provided by the resource adapter. * * @return EIS-specific Connection Factory instance * @throws ResourceException if the attempt to create a connection factory fails */ public Object createConnectionFactory() throws ResourceException { return new DefaultMuleConnectionFactory(this, null, null); } /** * ManagedConnectionFactory uses the security information (passed as Subject) and * additional ConnectionRequestInfo (which is specific to ResourceAdapter and * opaque to application server) to create this new connection. * * @param subject caller's security information * @param cxRequestInfo additional resource adapter specific connection request * information * @return ManagedConnection instance * @throws ResourceException if the attempt to create a connection fails */ public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException { return new MuleManagedConnection(this, subject, cxRequestInfo); } /** * Returns a matched managed connection from the candidate set of connections. * ManagedConnectionFactory uses the security info (as in Subject) and * information provided through ConnectionRequestInfo and additional Resource * Adapter specific criteria to do matching. A MC that has the requested store is * returned as a match * * @param connectionSet candidate connection set * @param subject caller's security information * @param cxRequestInfo additional resource adapter specific connection request * information * @return ManagedConnection if resource adapter finds an acceptable match, * otherwise null * @throws ResourceException if the match fails */ public ManagedConnection matchManagedConnections(Set connectionSet, Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException { PasswordCredential pc = RaHelper.getPasswordCredential(this, subject, cxRequestInfo); Iterator it = connectionSet.iterator(); while (it.hasNext()) { Object obj = it.next(); if (obj instanceof MuleManagedConnection) { MuleManagedConnection mc = (MuleManagedConnection)obj; PasswordCredential mcpc = mc.getPasswordCredential(); if (mcpc != null && pc != null && mcpc.equals(pc)) { return mc; } } } return null; } /** * Sets the log writer for this ManagedConnectionFactory instance. The log writer * is a character output stream to which all logging and tracing messages for * this ManagedConnectionfactory instance will be printed. * * @param out an output stream for error logging and tracing * @throws ResourceException if the method fails */ public void setLogWriter(PrintWriter out) throws ResourceException { this.out = out; } /** * Gets the log writer for this ManagedConnectionFactory instance. * * @return PrintWriter an output stream for error logging and tracing * @throws ResourceException if the method fails */ public PrintWriter getLogWriter() throws ResourceException { return this.out; } /** * Associate PropertyChangeListener with the ManagedConnectionFactory, in order * to notify about properties changes. * * @param lis the PropertyChangeListener to be associated with the * ManagedConnectionFactory */ public void addPropertyChangeListener(PropertyChangeListener lis) { changes.addPropertyChangeListener(lis); } /** * Delete association of PropertyChangeListener with the * ManagedConnectionFactory. * * @param lis the PropertyChangeListener to be removed */ public void removePropertyChangeListener(PropertyChangeListener lis) { changes.removePropertyChangeListener(lis); } /** * Returns the value of the userName property. * * @return the value of the userName property */ public String getUsername() { return this.username; } /** * Sets the value of the userName property. * * @param username String containing the value to be assigned to userName */ public void setUsername(String username) { this.username = username; } /** * Returns the value of the password property. * * @return the value of the password property */ public String getPassword() { return this.password; } /** * Sets the value of the password property. * * @param password String containing the value to be assigned to password */ public void setPassword(String password) { this.password = password; } } mule-2.0.1/modules/jca/jca-core/src/main/resources/0000755000175000017500000000000011351411135021710 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/resources/META-INF/0000755000175000017500000000000011351411135023050 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/resources/META-INF/services/0000755000175000017500000000000011351411135024673 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351411135025462 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351411135026424 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/resources/META-INF/services/org/mule/models/0000755000175000017500000000000011351411135027707 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/main/resources/META-INF/services/org/mule/models/jca.properties0000644000175000017500000000004210754375733032601 0ustar charlescharlesmodel=org.mule.module.jca.JcaModelmule-2.0.1/modules/jca/jca-core/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351411135027203 5ustar charlescharles././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/jca/jca-core/src/main/resources/META-INF/services/org/mule/i18n/jca-messages.propertiesmule-2.0.1/modules/jca/jca-core/src/main/resources/META-INF/services/org/mule/i18n/jca-messages.prop0000644000175000017500000000046410764126714032470 0ustar charlescharles1=Authentication denied on endpoint {0} 2=The object "{0}" has been marked invalid. One reason for this could be that the system is shutting down 3=Could not perform requested action. Object "{0}" has been disposed 4=JCA Components cannot be paused or resumed 5=Request Failed to allocate Managed Instance" mule-2.0.1/modules/jca/jca-core/src/main/resources/mule-config.xml0000644000175000017500000000162410767507530024661 0ustar charlescharles mule-2.0.1/modules/jca/jca-core/src/test/0000755000175000017500000000000011351411134017730 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/test/java/0000755000175000017500000000000011351411134020651 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/test/java/org/0000755000175000017500000000000011351411134021440 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/test/java/org/mule/0000755000175000017500000000000011351411134022402 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/test/java/org/mule/module/0000755000175000017500000000000011351411134023667 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/test/java/org/mule/module/jca/0000755000175000017500000000000011351411134024424 5ustar charlescharlesmule-2.0.1/modules/jca/jca-core/src/test/java/org/mule/module/jca/MuleResourceAdapterTestCase.java0000644000175000017500000002571410766654216032672 0ustar charlescharles/* * $Id: MuleResourceAdapterTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.model.Model; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.service.Service; import org.mule.model.seda.SedaModel; import org.mule.tck.AbstractMuleTestCase; import java.lang.reflect.Method; import java.util.Timer; import javax.resource.ResourceException; import javax.resource.spi.ActivationSpec; import javax.resource.spi.BootstrapContext; import javax.resource.spi.InvalidPropertyException; import javax.resource.spi.ResourceAdapter; import javax.resource.spi.UnavailableException; import javax.resource.spi.XATerminator; import javax.resource.spi.endpoint.MessageEndpoint; import javax.resource.spi.endpoint.MessageEndpointFactory; import javax.resource.spi.work.WorkManager; import javax.transaction.xa.XAResource; public class MuleResourceAdapterTestCase extends AbstractMuleTestCase { private MuleResourceAdapter resourceAdapter; protected void doSetUp() throws Exception { resourceAdapter = new MuleResourceAdapter(); resourceAdapter.muleContext = muleContext; resourceAdapter.bootstrapContext = new MockBoostrapContext(); } protected void doTearDown() throws Exception { resourceAdapter = null; } public void testResolveModelName() throws ResourceException { MuleActivationSpec activationSpec = new MuleActivationSpec(); activationSpec.setModelName("activationSpecModelName"); resourceAdapter.setModelName("resourceAdaptorModelName"); String modelName = resourceAdapter.resolveModelName(activationSpec); assertEquals("activationSpecModelName", modelName); } public void testResolveModelNameFromResourceAdaptor() throws ResourceException { MuleActivationSpec activationSpec = new MuleActivationSpec(); resourceAdapter.setModelName("resourceAdaptorModelName"); String modelName = resourceAdapter.resolveModelName(activationSpec); assertEquals("resourceAdaptorModelName", modelName); } public void testResolveModelNameFromActivationSpec() throws ResourceException { MuleActivationSpec activationSpec = new MuleActivationSpec(); activationSpec.setModelName("activationSpecModelName"); String modelName = resourceAdapter.resolveModelName(activationSpec); assertEquals("activationSpecModelName", modelName); } public void testResolveModelModelNameMissing() { MuleActivationSpec activationSpec = new MuleActivationSpec(); try { resourceAdapter.resolveModelName(activationSpec); fail("Exception expected: No modelName set."); } catch (ResourceException e) { // expected } } public void testGetJcaModelCreateNew() throws MuleException, ResourceException { JcaModel jcaModel = resourceAdapter.getJcaModel("jca"); assertEquals("jca", jcaModel.getName()); } public void testGetJcaModelUseExisting() throws MuleException, ResourceException { Model jcaModel = new JcaModel(); jcaModel.setName("jca"); muleContext.getRegistry().registerModel(jcaModel); JcaModel jcaModel2 = resourceAdapter.getJcaModel("jca"); assertEquals("jca", jcaModel2.getName()); assertEquals(jcaModel, jcaModel2); } public void testGetJcaModel3ExistingWrongType() throws MuleException { Model sedaModel = new SedaModel(); sedaModel.setName("jca"); muleContext.getRegistry().registerModel(sedaModel); try { resourceAdapter.getJcaModel("jca"); fail("Exception Expected: Model is not JcaModel"); } catch (Exception e) { // expected } } public void testCreateMessageInflowEndpoint() throws MuleException { MuleActivationSpec activationSpec = new MuleActivationSpec(); activationSpec.setEndpoint("test://testEndpoint"); ImmutableEndpoint endpoint = resourceAdapter.createMessageInflowEndpoint(activationSpec); testEndpoint(endpoint); } public void testCreateJcaComponent() throws Exception { MessageEndpointFactory endpointFactory = new MockEndpointFactory(); JcaModel jcaModel = resourceAdapter.getJcaModel("jca"); MuleActivationSpec activationSpec = new MuleActivationSpec(); activationSpec.setEndpoint("test://testEndpoint"); InboundEndpoint endpoint = resourceAdapter.createMessageInflowEndpoint(activationSpec); Service service = resourceAdapter.createJcaService(endpointFactory, jcaModel, endpoint); // Check service assertNotNull(service); assertEquals("JcaService#" + endpointFactory.hashCode(), service.getName()); assertNotNull(service); assertTrue(service instanceof JcaService); assertNotNull(service.getComponent()); assertTrue(service.getComponent() instanceof JcaComponent); assertNotNull(((JcaComponent) service.getComponent()).workManager); testJcaService(service); testEndpoint(service); // Check endpoint ImmutableEndpoint endpoint2 = (ImmutableEndpoint) service.getInboundRouter().getEndpoints().get(0); assertEquals(endpoint, endpoint2); // Check service implementation assertEquals(endpointFactory, ((JcaComponent) service.getComponent()).messageEndpointFactory); } public void testendpointActivationOK() throws Exception { MuleActivationSpec activationSpec = new MuleActivationSpec(); activationSpec.setResourceAdapter(resourceAdapter); activationSpec.setModelName("jcaModel"); activationSpec.setEndpoint("test://testEndpoint"); MessageEndpointFactory endpointFactory = new MockEndpointFactory(); assertEquals(0, resourceAdapter.endpoints.size()); resourceAdapter.endpointActivation(endpointFactory, activationSpec); assertEquals(1, resourceAdapter.endpoints.size()); MuleEndpointKey key = new MuleEndpointKey(endpointFactory, activationSpec); Service service = (Service) resourceAdapter.endpoints.get(key); assertEquals("JcaService#" + endpointFactory.hashCode(), service.getName()); testJcaService(service); testEndpoint(service); assertTrue(service.getComponent() instanceof JcaComponent); assertEquals(endpointFactory, ((JcaComponent) service.getComponent()).messageEndpointFactory); // Additional activation with same endpointFactory does not increase size of // endpoint cache. resourceAdapter.endpointActivation(endpointFactory, activationSpec); assertEquals(1, resourceAdapter.endpoints.size()); // Additional activation with new DefaultEndpointFactory instance increments size of // endpoint cahce resourceAdapter.endpointActivation(new MockEndpointFactory(), activationSpec); assertEquals(2, resourceAdapter.endpoints.size()); } public void testendpointActivationIncorrectActivationSpec() { try { ActivationSpec activationSpec = new MockActivationSpec(); activationSpec.setResourceAdapter(resourceAdapter); resourceAdapter.endpointActivation(new MockEndpointFactory(), activationSpec); fail("Exception expected: Invalid ActivationSpec type"); } catch (ResourceException e) { // expected } assertEquals(0, resourceAdapter.endpoints.size()); } public void testendpointDeactivationOK() throws ResourceException { MuleActivationSpec activationSpec = new MuleActivationSpec(); activationSpec.setResourceAdapter(resourceAdapter); activationSpec.setModelName("jcaModel"); activationSpec.setEndpoint("test://test"); MessageEndpointFactory endpointFactory = new MockEndpointFactory(); assertEquals(0, resourceAdapter.endpoints.size()); resourceAdapter.endpointActivation(endpointFactory, activationSpec); assertEquals(1, resourceAdapter.endpoints.size()); resourceAdapter.endpointDeactivation(endpointFactory, activationSpec); assertEquals(0, resourceAdapter.endpoints.size()); } protected void testEndpoint(Service service) { InboundRouterCollection inboundRouterCollection = service.getInboundRouter(); ImmutableEndpoint endpoint = (ImmutableEndpoint) inboundRouterCollection.getEndpoints().get(0); testEndpoint(endpoint); } protected void testEndpoint(ImmutableEndpoint endpoint) { assertNotNull(endpoint); assertNotNull(endpoint.getConnector()); assertEquals("testEndpoint", endpoint.getEndpointURI().getAddress()); assertEquals(false, endpoint.isSynchronous()); } protected void testJcaService(Service service) { // Check for a single inbound router, no outbound routers and no nested // routers assertNotNull(service); assertNotNull(service.getInboundRouter()); // InboundPassThroughRouter is now set in runtime rather than in service creation as in 1.4.x // assertEquals(1, service.getInboundRouter().getRouters().size()); assertEquals(0, service.getInboundRouter().getRouters().size()); } } class MockEndpointFactory implements MessageEndpointFactory { public MessageEndpoint createEndpoint(XAResource arg0) throws UnavailableException { // TODO Auto-generated method stub return null; } public boolean isDeliveryTransacted(Method arg0) throws NoSuchMethodException { // TODO Auto-generated method stub return false; } } class MockActivationSpec implements ActivationSpec { public void validate() throws InvalidPropertyException { // TODO Auto-generated method stub } public ResourceAdapter getResourceAdapter() { // TODO Auto-generated method stub return null; } public void setResourceAdapter(ResourceAdapter arg0) throws ResourceException { // TODO Auto-generated method stub } } class MockBoostrapContext implements BootstrapContext { public Timer createTimer() throws UnavailableException { // TODO Auto-generated method stub return null; } public WorkManager getWorkManager() { return new TestJCAWorkManager(); } public XATerminator getXATerminator() { // TODO Auto-generated method stub return null; } } mule-2.0.1/modules/jca/jca-core/src/test/java/org/mule/module/jca/JcaServiceTestCase.java0000644000175000017500000001035710766654216030772 0ustar charlescharles/* * $Id: JcaServiceTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.service.Service; import org.mule.model.resolvers.DefaultEntryPointResolverSet; import org.mule.tck.AbstractMuleTestCase; import java.lang.reflect.Method; import javax.resource.ResourceException; import javax.resource.spi.UnavailableException; import javax.resource.spi.endpoint.MessageEndpoint; import javax.resource.spi.endpoint.MessageEndpointFactory; import javax.transaction.xa.XAResource; public class JcaServiceTestCase extends AbstractMuleTestCase // AbstractServiceTestCase { // Cannot extend AbstractServiceTestCase because of inconsistent behaviour. See // MULE-2843 private Service service; private TestJCAWorkManager workManager; protected void doSetUp() throws Exception { // Create and register JcaModel workManager = new TestJCAWorkManager(); JcaModel jcaModel = new JcaModel(); muleContext.getRegistry().registerModel(jcaModel); // Create, register, initialise and start JcaService String name = "JcaService#"; service = new JcaService(); service.setName(name); service.setModel(jcaModel); service.setComponent(new JcaComponent(new TestMessageEndpointFactory(), new DefaultEntryPointResolverSet(), service, workManager)); muleContext.getRegistry().registerService(service); assertNotNull(service); } protected void doTearDown() throws Exception { workManager = null; service = null; } public void testSendEvent() throws Exception { service.start(); ImmutableEndpoint endpoint = getTestInboundEndpoint("jcaInFlowEndpoint"); MuleEvent event = getTestEvent("Message", endpoint); try { service.sendEvent(event); fail("Exception expected, JcaService does not support sendEvent()"); } catch (Exception e) { // expected } } public void testDispatchEvent() throws Exception { service.start(); ImmutableEndpoint endpoint = getTestInboundEndpoint("jcaInFlowEndpoint"); MuleEvent event = getTestEvent("Message", endpoint); service.dispatchEvent(event); assertEquals(1, workManager.getScheduledWorkList().size()); assertEquals(0, workManager.getStartWorkList().size()); assertEquals(0, workManager.getDoWorkList().size()); } public void testPause() { try { service.pause(); fail("Exception expected, JcaService does not support pause()"); } catch (MuleException e) { // expected } } public void testResume() { try { service.resume(); fail("Exception expected, JcaService does not support resume()"); } catch (MuleException e) { // expected } } class TestMessageEndpointFactory implements MessageEndpointFactory { public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException { return null; } public boolean isDeliveryTransacted(Method method) throws NoSuchMethodException { return false; } } class TestMessageEndoint implements MessageEndpoint { public void afterDelivery() throws ResourceException { // TODO Auto-generated method stub } public void beforeDelivery(Method method) throws NoSuchMethodException, ResourceException { // TODO Auto-generated method stub } public void release() { // TODO Auto-generated method stub } } } mule-2.0.1/modules/jca/jca-core/src/test/java/org/mule/module/jca/TestJCAWorkManager.java0000644000175000017500000000372110754375733030711 0ustar charlescharles/* * $Id: TestJCAWorkManager.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jca; import java.util.ArrayList; import java.util.List; import javax.resource.spi.work.ExecutionContext; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkException; import javax.resource.spi.work.WorkListener; import javax.resource.spi.work.WorkManager; public class TestJCAWorkManager implements WorkManager { private List doWorkList = new ArrayList(); private List scheduledWorkList = new ArrayList(); private List startWorkList = new ArrayList(); public void doWork(Work arg0) throws WorkException { doWorkList.add(arg0); } public void doWork(Work arg0, long arg1, ExecutionContext arg2, WorkListener arg3) throws WorkException { doWorkList.add(arg0); } public void scheduleWork(Work arg0) throws WorkException { scheduledWorkList.add(arg0); } public void scheduleWork(Work arg0, long arg1, ExecutionContext arg2, WorkListener arg3) throws WorkException { scheduledWorkList.add(arg0); } public long startWork(Work arg0) throws WorkException { startWorkList.add(arg0); return 0; } public long startWork(Work arg0, long arg1, ExecutionContext arg2, WorkListener arg3) throws WorkException { startWorkList.add(arg0); return 0; } public List getDoWorkList() { return doWorkList; } public List getScheduledWorkList() { return scheduledWorkList; } public List getStartWorkList() { return startWorkList; } } mule-2.0.1/modules/jca/jca-core/pom.xml0000644000175000017500000000124111006063605017500 0ustar charlescharles 4.0.0 org.mule.modules.jca mule-module-jca-parent 2.0.1 mule-module-jca-core Common artifacts for JCA Resource Adapters jar Sources and resources for a Resource Adapter mule-2.0.1/modules/jca/jca-generic/0000755000175000017500000000000011351411136016650 5ustar charlescharlesmule-2.0.1/modules/jca/jca-generic/src/0000755000175000017500000000000011351411135017436 5ustar charlescharlesmule-2.0.1/modules/jca/jca-generic/src/main/0000755000175000017500000000000011351411135020362 5ustar charlescharlesmule-2.0.1/modules/jca/jca-generic/src/main/resources/0000755000175000017500000000000011351411135022374 5ustar charlescharlesmule-2.0.1/modules/jca/jca-generic/src/main/resources/META-INF/0000755000175000017500000000000011351411136023535 5ustar charlescharlesmule-2.0.1/modules/jca/jca-generic/src/main/resources/META-INF/oc4j-connectors.xml0000644000175000017500000000142310621717250027276 0ustar charlescharles mule-2.0.1/modules/jca/jca-generic/src/main/resources/META-INF/oc4j-ra.xml0000644000175000017500000000226210754375733025542 0ustar charlescharles org.mule.module.jca.MuleConnectionFactory mule-2.0.1/modules/jca/jca-generic/pom.xml0000644000175000017500000000177711006063605020202 0ustar charlescharles 4.0.0 org.mule.modules.jca mule-module-jca-parent 2.0.1 mule-module-jca-generic Generic JCA Resource Adapter jar A Resource Adapter implementation that allows a Mule instance to be deployed to a Java EE application server and exposes Mule services via the JCA connector architecture. org.mule.modules.jca mule-module-jca-core ${version} mule-2.0.1/modules/jca/pom.xml0000644000175000017500000000514211006063605016021 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-jca-parent org.mule.modules.jca JCA Resource Adapter Parent pom This module is the parent for the core jca module (jca-core) and all appserver specific jca modules. It serves mainly as a container for dependencies which are common to all jca modules jca-core jca-generic jca-jboss org.mule.modules mule-module-client ${version} org.mule.transports mule-transport-ssl ${version} org.mule.transports mule-transport-udp ${version} org.mule.transports mule-transport-multicast ${version} org.mule.transports mule-transport-jms ${version} org.mule.transports mule-transport-ejb ${version} org.mule.transports mule-transport-email ${version} org.mule mule-core ${version} test test-jar mule-2.0.1/modules/jca/jca-jboss/0000755000175000017500000000000011351411136016354 5ustar charlescharlesmule-2.0.1/modules/jca/jca-jboss/src/0000755000175000017500000000000011351411136017143 5ustar charlescharlesmule-2.0.1/modules/jca/jca-jboss/src/main/0000755000175000017500000000000011351411136020067 5ustar charlescharlesmule-2.0.1/modules/jca/jca-jboss/src/main/resources/0000755000175000017500000000000011351411136022101 5ustar charlescharlesmule-2.0.1/modules/jca/jca-jboss/src/main/resources/mule-jboss-ds.xml0000644000175000017500000000310510754375733025330 0ustar charlescharles mule/ConnectionFactory mule-jca-jboss-${version}.rar org.mule.module.jca.MuleConnectionFactory mule-2.0.1/modules/jca/jca-jboss/pom.xml0000644000175000017500000000232511006063605017674 0ustar charlescharles 4.0.0 org.mule.modules.jca mule-module-jca-parent 2.0.1 mule-module-jca-jboss JCA Resource Adapter for JBoss jar A Resource Adapter implementation that allows a Mule instance to be deployed to a JBoss application server and exposes Mule services via the JCA connector architecture. src/main/resources true org.mule.modules.jca mule-module-jca-core ${version} mule-2.0.1/modules/pom.xml0000644000175000017500000000256511006063605015272 0ustar charlescharles 4.0.0 org.mule mule 2.0.1 org.mule.modules mule-modules pom Mule Modules Modules which extend the Mule Core but do not qualify as Transports acegi all-modules builders boot client jaas jboss-transactions jca management ognl pgp scripting spring-extras spring-config xml osgi osgi mule-2.0.1/modules/xml/0000755000175000017500000000000011351411141014540 5ustar charlescharlesmule-2.0.1/modules/xml/src/0000755000175000017500000000000011351411140015326 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/0000755000175000017500000000000011351411141016253 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/0000755000175000017500000000000011351411140017173 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/0000755000175000017500000000000011351411140017762 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/mule/0000755000175000017500000000000011351411140020724 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/mule/module/0000755000175000017500000000000011351411140022211 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/0000755000175000017500000000000011351411141023012 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/expression/0000755000175000017500000000000011351411140025210 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/expression/XPathExpressionEvaluator.java0000644000175000017500000000461310764057561033072 0ustar charlescharles/* * $Id: XPathExpressionEvaluator.java 11231 2008-03-06 21:17:37Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.expression; import org.mule.module.xml.i18n.XmlMessages; import org.dom4j.Node; import org.jaxen.JaxenException; import org.jaxen.XPath; import org.jaxen.dom.DOMXPath; import org.jaxen.dom4j.Dom4jXPath; import org.w3c.dom.Document; /** * Will select the text of a single node based on the property name */ public class XPathExpressionEvaluator extends AbstractXPathExpressionEvaluator { public static final String NAME = "xpath"; protected XPath createXPath(String expression, Object object) throws JaxenException { if(object instanceof Document) { return new DOMXPath(expression); } else if (object instanceof org.dom4j.Document) { return new Dom4jXPath(expression); } // else if (object instanceof nu.xom.Document) // { // return new XOMXPath(expression); // } // else if (object instanceof org.jdom.Document) // { // return new JDOMXPath(expression); // } else { throw new IllegalArgumentException(XmlMessages.domTypeNotSupported(object.getClass()).getMessage()); } } protected Object extractResultFromNode(Object result) { if(result instanceof Node) { return ((Node)result).getText(); } else if(result instanceof org.w3c.dom.Node) { return ((org.w3c.dom.Node)result).getFirstChild().getNodeValue(); } // else if(result instanceof nu.xom.Node) // { // return ((nu.xom.Node)result).getText(); // } // else if(result instanceof org.jdom.Node) // { // return ((org.jdom.Node)result).getText(); // } else { throw new IllegalArgumentException(XmlMessages.domTypeNotSupported(result.getClass()).getMessage()); } } /** {@inheritDoc} */ public String getName() { return NAME; } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/expression/JXPathExpressionEvaluator.java0000644000175000017500000000437310764057561033207 0ustar charlescharles/* * $Id: JXPathExpressionEvaluator.java 11231 2008-03-06 21:17:37Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.expression; import org.mule.api.transport.MessageAdapter; import org.mule.util.expression.ExpressionEvaluator; import org.apache.commons.jxpath.JXPathContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; /** * Will extract properties based on Xpath expressions. Will work on Xml/Dom and beans */ public class JXPathExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "jxpath"; /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); public Object evaluate(String name, Object message) { Object result = null; Object payload = message; if (message instanceof MessageAdapter) { payload = ((MessageAdapter) message).getPayload(); } if (payload instanceof String) { Document doc; try { doc = DocumentHelper.parseText((String) payload); } catch (DocumentException e) { logger.error(e); return null; } result = doc.valueOf(name); } else { JXPathContext context = JXPathContext.newContext(payload); try { result = context.getValue(name); } catch (Exception e) { // ignore } } return result; } /** {@inheritDoc} */ public String getName() { return NAME; } /** {@inheritDoc} */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/expression/BeanPayloadExpressionEvaluator.javamule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/expression/BeanPayloadExpressionEvaluator.j0000644000175000017500000000220210764057561033525 0ustar charlescharles/* * $Id: BeanPayloadExpressionEvaluator.java 11231 2008-03-06 21:17:37Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.expression; import org.jaxen.JaxenException; import org.jaxen.XPath; import org.jaxen.javabean.JavaBeanXPath; /** TODO */ public class BeanPayloadExpressionEvaluator extends AbstractXPathExpressionEvaluator { public static final String NAME = "bean"; protected XPath createXPath(String expression, Object object) throws JaxenException { expression = expression.replaceAll("[.]", "/"); return new JavaBeanXPath(expression); } protected Object extractResultFromNode(Object result) { return ((org.jaxen.javabean.Element)result).getObject(); } /** {@inheritDoc} */ public String getName() { return NAME; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/expression/AbstractXPathExpressionEvaluator.javamule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/expression/AbstractXPathExpressionEvaluator0000644000175000017500000000661210764057561033637 0ustar charlescharles/* * $Id: AbstractXPathExpressionEvaluator.java 11231 2008-03-06 21:17:37Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.expression; import org.mule.api.MuleMessage; import org.mule.api.MuleRuntimeException; import org.mule.api.lifecycle.Disposable; import org.mule.module.xml.i18n.XmlMessages; import org.mule.util.expression.ExpressionEvaluator; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.WeakHashMap; import org.jaxen.JaxenException; import org.jaxen.XPath; /** * Provides a base class for XPath property extractors. The XPath engine used is jaxen (http://jaxen.org) which supports * XPath queries on other object models such as JavaBeans as well as Xml */ public abstract class AbstractXPathExpressionEvaluator implements ExpressionEvaluator, Disposable { private Map cache = new WeakHashMap(8); /** {@inheritDoc} */ public Object evaluate(String expression, Object message) { try { if(message instanceof MuleMessage) { message = ((MuleMessage)message).getPayload(); } XPath xpath = getXPath(expression, message); List result = xpath.selectNodes(message); result = extractResultsFromNodes(result); if(result.size()==1) { return result.get(0); } else if(result.size()==0) { return null; } else { return result; } } catch (JaxenException e) { throw new MuleRuntimeException(XmlMessages.failedToProcessXPath(expression), e); } } /** {@inheritDoc} */ public final void setName(String name) { throw new UnsupportedOperationException("setName"); } protected XPath getXPath(String expression, Object object) throws JaxenException { XPath xpath = (XPath)cache.get(expression + getClass().getName()); if(xpath==null) { xpath = createXPath(expression, object); cache.put(expression + getClass().getName(), xpath); } return xpath; } protected abstract XPath createXPath(String expression, Object object) throws JaxenException; protected List extractResultsFromNodes(List results) { if(results==null) { return null; } List newResults = new ArrayList(results.size()); for (Iterator iterator = results.iterator(); iterator.hasNext();) { Object o = iterator.next(); newResults.add(extractResultFromNode(o)); } return newResults; } /** * A lifecycle method where implementor should free up any resources. If an * exception is thrown it should just be logged and processing should continue. * This method should not throw Runtime exceptions. */ public void dispose() { cache.clear(); } protected abstract Object extractResultFromNode(Object result); } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/0000755000175000017500000000000011351411140025353 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/wire/0000755000175000017500000000000011351411140026321 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/wire/XStreamWireFormat.java0000644000175000017500000000360610767262171032576 0ustar charlescharles/* * $Id: XStreamWireFormat.java 11377 2008-03-16 18:18:33Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer.wire; import org.mule.module.xml.transformer.ObjectToXml; import org.mule.module.xml.transformer.XStreamFactory; import org.mule.module.xml.transformer.XmlToObject; import org.mule.transformer.wire.TransformerPairWireFormat; import java.util.List; import java.util.Map; /** * Serializes objects using XStream. This is equivelent of using the ObjectToXml and * XmlToObject except that there is no source or return type checking. */ public class XStreamWireFormat extends TransformerPairWireFormat { public XStreamWireFormat() throws IllegalAccessException, InstantiationException, ClassNotFoundException { this(XStreamFactory.XSTREAM_XPP_DRIVER, null, null); } public XStreamWireFormat(String driverClassName, Map aliases, List converters) throws IllegalAccessException, InstantiationException, ClassNotFoundException { XmlToObject in = new XmlToObject(); in.setDriverClassName(driverClassName); in.setAliases(aliases); in.setConverters(converters); setInboundTransformer(in); ObjectToXml out = new ObjectToXml(); out.setDriverClassName(driverClassName); out.setAliases(aliases); out.setConverters(converters); // TODO This is currently needed as a workaround for MULE-2881, this needs to // be removed is this is not the solution to MULE-2881 out.setAcceptUMOMessage(true); setOutboundTransformer(out); } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/package.html0000644000175000017500000000012610764101307027643 0ustar charlescharles Xml and Xslt Transformer implementations. mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/DocumentToOutputHandler.java0000644000175000017500000000360410764101307033031 0ustar charlescharles/* * $Id: DocumentToOutputHandler.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer; import org.mule.api.MuleEvent; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.OutputHandler; import java.io.IOException; import java.io.OutputStream; import org.dom4j.Document; public class DocumentToOutputHandler extends AbstractXmlTransformer implements DiscoverableTransformer { private int priorityWeighting = DiscoverableTransformer.DEFAULT_PRIORITY_WEIGHTING; public DocumentToOutputHandler() { registerSourceType(Document.class); registerSourceType(org.w3c.dom.Document.class); setReturnClass(OutputHandler.class); } public Object doTransform(final Object src, final String encoding) throws TransformerException { return new OutputHandler() { public void write(MuleEvent event, OutputStream out) throws IOException { try { out.write(convertToBytes(src, encoding).getBytes()); } catch (javax.xml.transform.TransformerException e) { throw new IOException(e.toString()); } } }; } public int getPriorityWeighting() { return priorityWeighting; } public void setPriorityWeighting(int priorityWeighting) { this.priorityWeighting = priorityWeighting; } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/XmlPrettyPrinter.java0000644000175000017500000001506710764101307031553 0ustar charlescharles/* * $Id: XmlPrettyPrinter.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import org.mule.util.StringUtils; import org.apache.commons.io.output.ByteArrayOutputStream; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; public class XmlPrettyPrinter extends AbstractTransformer { protected OutputFormat outputFormat = OutputFormat.createPrettyPrint(); public XmlPrettyPrinter() { super(); this.registerSourceType(String.class); this.registerSourceType(org.dom4j.Document.class); this.setReturnClass(String.class); } public synchronized OutputFormat getOutputFormat() { return outputFormat; } // @Override protected Object doTransform(Object src, String encoding) throws TransformerException { try { ByteArrayOutputStream resultStream = new ByteArrayOutputStream(); Document document = null; if (src instanceof String) { String text = (String) src; document = DocumentHelper.parseText(text); } else if (src instanceof org.dom4j.Document) { document = (Document) src; } XMLWriter writer = new XMLWriter(resultStream, this.getOutputFormat()); writer.write(document); writer.close(); return resultStream.toString(encoding); } catch (Exception e) { throw new TransformerException(this, e); } } /** * @see OutputFormat#getEncoding() */ public synchronized String getEncoding() { return outputFormat.getEncoding(); } /** * @see OutputFormat#setEncoding(String) */ public synchronized void setEncoding(String encoding) { outputFormat.setEncoding(encoding); } /** * @see OutputFormat#getIndent() */ public synchronized boolean getIndentEnabled() { return outputFormat.getIndent() != null; } /** * @see OutputFormat#setIndent(boolean) */ public synchronized void setIndentEnabled(boolean doIndent) { outputFormat.setIndent(doIndent); } /** * @see OutputFormat#getIndent() */ public synchronized String getIndentString() { return outputFormat.getIndent(); } /** * @see OutputFormat#setIndent(boolean) */ public synchronized void setIndentString(String indentString) { outputFormat.setIndent(indentString); } /** * @see OutputFormat#setIndentSize(int) */ public synchronized int getIndentSize() { return StringUtils.defaultIfEmpty(outputFormat.getIndent(), "").length(); } /** * @see OutputFormat#setIndentSize(int) */ public synchronized void setIndentSize(int indentSize) { outputFormat.setIndentSize(indentSize); } /** * @see OutputFormat#getLineSeparator() */ public synchronized String getLineSeparator() { return outputFormat.getLineSeparator(); } /** * @see OutputFormat#setLineSeparator(String) */ public synchronized void setLineSeparator(String separator) { outputFormat.setLineSeparator(separator); } /** * @see OutputFormat#getNewLineAfterNTags() */ public synchronized int getNewLineAfterNTags() { return outputFormat.getNewLineAfterNTags(); } /** * @see OutputFormat#setNewLineAfterNTags(int) */ public synchronized void setNewLineAfterNTags(int tagCount) { outputFormat.setNewLineAfterNTags(tagCount); } /** * @see OutputFormat#isExpandEmptyElements() */ public synchronized boolean isExpandEmptyElements() { return outputFormat.isExpandEmptyElements(); } /** * @see OutputFormat#setExpandEmptyElements(boolean) */ public synchronized void setExpandEmptyElements(boolean expandEmptyElements) { outputFormat.setExpandEmptyElements(expandEmptyElements); } /** * @see OutputFormat#isNewlines() */ public synchronized boolean isNewlines() { return outputFormat.isNewlines(); } /** * @see OutputFormat#setNewlines(boolean) */ public synchronized void setNewlines(boolean newlines) { outputFormat.setNewlines(newlines); } /** * @see OutputFormat#isOmitEncoding() */ public synchronized boolean isOmitEncoding() { return outputFormat.isOmitEncoding(); } /** * @see OutputFormat#setOmitEncoding(boolean) */ public synchronized void setOmitEncoding(boolean omitEncoding) { outputFormat.setOmitEncoding(omitEncoding); } /** * @see OutputFormat#getEncoding() */ public synchronized boolean isPadText() { return outputFormat.isPadText(); } /** * @see OutputFormat#getEncoding() */ public synchronized void setPadText(boolean padText) { outputFormat.setPadText(padText); } /** * @see OutputFormat#getEncoding() */ public synchronized boolean isSuppressDeclaration() { return outputFormat.isSuppressDeclaration(); } /** * @see OutputFormat#getEncoding() */ public synchronized void setSuppressDeclaration(boolean suppressDeclaration) { outputFormat.setSuppressDeclaration(suppressDeclaration); } /** * @see OutputFormat#isTrimText() */ public synchronized boolean isTrimText() { return outputFormat.isTrimText(); } /** * @see OutputFormat#setTrimText(boolean) */ public synchronized void setTrimText(boolean trimText) { outputFormat.setTrimText(trimText); } /** * @see OutputFormat#isXHTML() */ public synchronized boolean isXHTML() { return outputFormat.isXHTML(); } /** * @see OutputFormat#setXHTML(boolean) */ public synchronized void setXHTML(boolean xhtml) { outputFormat.setXHTML(xhtml); } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/XmlToObject.java0000644000175000017500000000602310766014216030425 0ustar charlescharles/* * $Id: XmlToObject.java 11336 2008-03-12 17:53:18Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.UnsupportedEncodingException; /** * XmlToObject converts xml created by the ObjectToXml transformer in to a * java object graph. This transformer uses XStream. Xstream uses some clever tricks so * objects that get marshalled to XML do not need to implement any interfaces including * Serializable and you don't even need to specify a default constructor. * * @see org.mule.transformer.xml.ObjectToXml */ public class XmlToObject extends AbstractXStreamTransformer { private final DomDocumentToXml domTransformer = new DomDocumentToXml(); public XmlToObject() { registerSourceType(String.class); registerSourceType(byte[].class); registerSourceType(InputStream.class); registerSourceType(org.w3c.dom.Document.class); registerSourceType(org.dom4j.Document.class); setReturnClass(Object.class); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { Object src = message.getPayload(); if (src instanceof byte[]) { try { Reader xml = new InputStreamReader(new ByteArrayInputStream((byte[]) src), outputEncoding); return getXStream().fromXML(xml); } catch (UnsupportedEncodingException uee) { throw new TransformerException(this, uee); } } else if(src instanceof InputStream) { InputStream input = (InputStream) src; try { Reader xml = new InputStreamReader(input, outputEncoding); return getXStream().fromXML(xml); } catch (UnsupportedEncodingException uee) { throw new TransformerException(this, uee); } finally { try { input.close(); } catch (IOException e) { logger.warn("Exception closing stream: ", e); } } } else if (src instanceof String) { return getXStream().fromXML(src.toString()); } else { return getXStream().fromXML((String) domTransformer.transform(src)); } } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/AbstractXmlTransformer.java0000644000175000017500000002427010764101307032702 0ustar charlescharles/* * $Id: AbstractXmlTransformer.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer; import org.mule.module.xml.util.XMLUtils; import org.mule.transformer.AbstractTransformer; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.StringReader; import java.io.StringWriter; import javax.xml.transform.OutputKeys; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.commons.io.output.ByteArrayOutputStream; import org.dom4j.Document; import org.dom4j.io.DocumentResult; import org.dom4j.io.DocumentSource; /** * AbstractXmlTransformer offers some XSLT transform on a DOM (or * other XML-ish) object. */ public abstract class AbstractXmlTransformer extends AbstractTransformer { private String outputEncoding; public AbstractXmlTransformer() { registerSourceType(String.class); registerSourceType(byte[].class); registerSourceType(DocumentSource.class); registerSourceType(Document.class); registerSourceType(org.w3c.dom.Document.class); registerSourceType(org.w3c.dom.Element.class); registerSourceType(InputStream.class); setReturnClass(byte[].class); } public Source getXmlSource(Object src) { if (src instanceof byte[]) { return new StreamSource(new ByteArrayInputStream((byte[]) src)); } else if (src instanceof InputStream) { return new StreamSource((InputStream) src); } else if (src instanceof String) { return new StreamSource(new StringReader((String) src)); } else if (src instanceof DocumentSource) { return (Source) src; } else if (src instanceof Document) { return new DocumentSource((Document) src); } else if (src instanceof org.w3c.dom.Document || src instanceof org.w3c.dom.Element) { return new DOMSource((org.w3c.dom.Node) src); } else { return null; } } /** Result callback interface used when processing XML through JAXP */ protected static interface ResultHolder { /** * @return A Result to use in a transformation (e.g. writing a DOM to a * stream) */ Result getResult(); /** @return The actual result as produced after the call to 'transform'. */ Object getResultObject(); } /** * @param desiredClass Java class representing the desired format * @return Callback interface representing the desiredClass - or null if the * return class isn't supported (or is null). */ protected static ResultHolder getResultHolder(Class desiredClass) { if (desiredClass == null) { return null; } if (byte[].class.equals(desiredClass) || InputStream.class.isAssignableFrom(desiredClass)) { return new ResultHolder() { ByteArrayOutputStream resultStream = new ByteArrayOutputStream(); StreamResult result = new StreamResult(resultStream); public Result getResult() { return result; } public Object getResultObject() { return resultStream.toByteArray(); } }; } else if (String.class.equals(desiredClass)) { return new ResultHolder() { StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); public Result getResult() { return result; } public Object getResultObject() { return writer.getBuffer().toString(); } }; } else if (org.w3c.dom.Document.class.isAssignableFrom(desiredClass)) { return new ResultHolder() { DOMResult result = new DOMResult(); public Result getResult() { return result; } public Object getResultObject() { return result.getNode(); } }; } else if (org.dom4j.io.DocumentResult.class.isAssignableFrom(desiredClass)) { return new ResultHolder() { DocumentResult result = new DocumentResult(); public Result getResult() { return result; } public Object getResultObject() { return result; } }; } else if (org.dom4j.Document.class.isAssignableFrom(desiredClass)) { return new ResultHolder() { DocumentResult result = new DocumentResult(); public Result getResult() { return result; } public Object getResultObject() { return result.getDocument(); } }; } return null; } /** * Converts an XML in-memory representation to a String * * @param obj Object to convert (could be byte[], String, DOM, DOM4J) * @return String including XML header using default (UTF-8) encoding * @throws TransformerFactoryConfigurationError * On error * @throws javax.xml.transform.TransformerException * On error * @deprecated Replaced by convertToText(Object obj, String ouputEncoding) */ protected String convertToText(Object obj) throws TransformerFactoryConfigurationError, javax.xml.transform.TransformerException { return convertToText(obj, null); } /** * Converts an XML in-memory representation to a String using a specific encoding. * If using an encoding which cannot represent specific characters, these are * written as entities, even if they can be represented as a Java String. * * @param obj Object to convert (could be byte[], String, DOM, or DOM4J Document). * If the object is a byte[], the character * encoding used MUST match the declared encoding standard, or a parse error will occur. * @param outputEncoding Name of the XML encoding to use, e.g. US-ASCII, or null for UTF-8 * @return String including XML header using the specified encoding * @throws TransformerFactoryConfigurationError * On error * @throws javax.xml.transform.TransformerException * On error */ protected String convertToText(Object obj, String outputEncoding) throws TransformerFactoryConfigurationError, javax.xml.transform.TransformerException { // Catch the direct translations if (obj instanceof String) { return (String) obj; } else if (obj instanceof Document) { return ((Document) obj).asXML(); } // No easy fix, so use the transformer. Source src = getXmlSource(obj); if (src == null) { return null; } StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); Transformer idTransformer = TransformerFactory.newInstance().newTransformer(); if (outputEncoding != null) { idTransformer.setOutputProperty(OutputKeys.ENCODING, outputEncoding); } idTransformer.transform(src, result); return writer.getBuffer().toString(); } /** * Converts an XML in-memory representation to a String using a specific encoding. * * @param obj Object to convert (could be byte[], String, DOM, or DOM4J Document). * If the object is a byte[], the character * encoding used MUST match the declared encoding standard, or a parse error will occur. * @param outputEncoding Name of the XML encoding to use, e.g. US-ASCII, or null for UTF-8 * @return String including XML header using the specified encoding * @throws TransformerFactoryConfigurationError * On error * @throws javax.xml.transform.TransformerException * On error */ protected String convertToBytes(Object obj, String outputEncoding) throws TransformerFactoryConfigurationError, javax.xml.transform.TransformerException { // Always use the transformer, even for byte[] (to get the encoding right!) Source src = getXmlSource(obj); if (src == null) { return null; } StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); Transformer idTransformer = XMLUtils.getTransformer(); idTransformer.setOutputProperty(OutputKeys.ENCODING, outputEncoding); idTransformer.transform(src, result); return writer.getBuffer().toString(); } /** @return the outputEncoding */ public String getOutputEncoding() { return outputEncoding; } /** @param outputEncoding the outputEncoding to set */ public void setOutputEncoding(String outputEncoding) { this.outputEncoding = outputEncoding; } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/XmlToDomDocument.java0000644000175000017500000000417310764101307031435 0ustar charlescharles/* * $Id: XmlToDomDocument.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.TransformerException; import org.mule.module.xml.util.XMLUtils; import javax.xml.transform.OutputKeys; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import org.w3c.dom.Document; /** XmlToDomDocument transforms a XML String to org.w3c.dom.Document. */ public class XmlToDomDocument extends AbstractXmlTransformer implements DiscoverableTransformer { private int priorityWeighting = DiscoverableTransformer.DEFAULT_PRIORITY_WEIGHTING; public Object doTransform(Object src, String encoding) throws TransformerException { try { Source sourceDoc = getXmlSource(src); if (sourceDoc == null) { return null; } // If returnClass is not set, assume W3C DOM // This is the original behaviour ResultHolder holder = getResultHolder(returnClass); if (holder == null) { holder = getResultHolder(Document.class); } Transformer idTransformer = XMLUtils.getTransformer(); idTransformer.setOutputProperty(OutputKeys.ENCODING, encoding); idTransformer.transform(sourceDoc, holder.getResult()); return holder.getResultObject(); } catch (Exception e) { throw new TransformerException(this, e); } } public int getPriorityWeighting() { return priorityWeighting; } public void setPriorityWeighting(int priorityWeighting) { this.priorityWeighting = priorityWeighting; } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/DomDocumentToXml.java0000644000175000017500000000326610764101307031437 0ustar charlescharles/* * $Id: DomDocumentToXml.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.TransformerException; /** DomDocumentToXml Transform a org.w3c.dom.Document to XML String */ public class DomDocumentToXml extends AbstractXmlTransformer implements DiscoverableTransformer { private int priorityWeighting = DiscoverableTransformer.DEFAULT_PRIORITY_WEIGHTING; public DomDocumentToXml() { setReturnClass(String.class); } public Object doTransform(Object src, String encoding) throws TransformerException { try { // We now offer XML in byte OR String form. // String remains the default like before. if (byte[].class.equals(returnClass)) { return convertToBytes(src, encoding); } else { return convertToText(src, encoding); } } catch (Exception e) { throw new TransformerException(this, e); } } public int getPriorityWeighting() { return priorityWeighting; } public void setPriorityWeighting(int priorityWeighting) { this.priorityWeighting = priorityWeighting; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/AbstractXStreamTransformer.javamule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/AbstractXStreamTransformer.java0000644000175000017500000000640210764101307033522 0ustar charlescharles/* * $Id: AbstractXStreamTransformer.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.MessageFactory; import org.mule.transformer.AbstractMessageAwareTransformer; import com.thoughtworks.xstream.XStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference; /** * AbstractXStreamTransformer is a base class for all XStream based * transformers. It takes care of creating and configuring the XStream parser. */ public abstract class AbstractXStreamTransformer extends AbstractMessageAwareTransformer { private final AtomicReference/* XStream */xstream = new AtomicReference(); private volatile String driverClassName = XStreamFactory.XSTREAM_XPP_DRIVER; private volatile Map aliases = null; private volatile List converters = null; public final XStream getXStream() throws TransformerException { XStream instance = (XStream) xstream.get(); if (instance == null) { try { instance = new XStreamFactory(driverClassName, aliases, converters).getInstance(); if (!xstream.compareAndSet(null, instance)) { instance = (XStream)xstream.get(); } } catch (Exception e) { throw new TransformerException(MessageFactory.createStaticMessage("Unable to initialize XStream"), e); } } return instance; } public Object clone() throws CloneNotSupportedException { AbstractXStreamTransformer clone = (AbstractXStreamTransformer) super.clone(); clone.setDriverClassName(driverClassName); if (aliases != null) { clone.setAliases(new HashMap(aliases)); } if (converters != null) { clone.setConverters(new ArrayList(converters)); } return clone; } public String getDriverClassName() { return driverClassName; } public void setDriverClassName(String driverClassName) { this.driverClassName = driverClassName; // force XStream instance update this.xstream.set(null); } public Map getAliases() { return aliases; } public void setAliases(Map aliases) { this.aliases = aliases; // force XStream instance update this.xstream.set(null); } public List getConverters() { return converters; } public void setConverters(List converters) { this.converters = converters; // force XStream instance update this.xstream.set(null); } protected boolean requiresCurrentEvent() { return false; } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/ObjectToXml.java0000644000175000017500000000436310764101307030426 0ustar charlescharles/* * $Id: ObjectToXml.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; /** * ObjectToXml converts any object to XML using Xstream. Xstream uses * some clever tricks so objects that get marshalled to XML do not need to implement * any interfaces including Serializable and you don't even need to specify a default * constructor. If MuleMessage is configured as a source type on this * transformer by calling setAcceptUMOMessage(true) then the MuleMessage * will be serialised. This is useful for transports such as TCP where the message * headers would normally be lost. */ public class ObjectToXml extends AbstractXStreamTransformer { public ObjectToXml() { this.registerSourceType(Object.class); this.setReturnClass(String.class); } public boolean isAcceptUMOMessage() { return this.sourceTypes.contains(MuleMessage.class); } public void setAcceptUMOMessage(boolean value) { if (value) { this.registerSourceType(MuleMessage.class); } else { this.unregisterSourceType(MuleMessage.class); } } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { Object src = message.getPayload(); /* * If the MuleMessage source type has been registered that we can assume that * the whole message is to be serialised to Xml, not just the payload. This * can be useful for protocols such as tcp where the protocol does not * support headers, thus the whole messgae needs to be serialized */ if (this.isAcceptUMOMessage()) { src = message; } return this.getXStream().toXML(src); } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/JXPathExtractor.java0000644000175000017500000000711010764101307031257 0ustar charlescharles/* * $Id: JXPathExtractor.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import java.util.ArrayList; import java.util.List; import org.apache.commons.jxpath.JXPathContext; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Node; import org.dom4j.XPath; /** * The JXPathExtractor is a simple transformer that evaluates an xpath expression * against the given bean and that returns the result.

    By default, a single * result will be returned. If multiple values are expected, set the * {@link #singleResult} property to false. In this case a * {@link List} of values will be returned. Note the property is currently ignored * for non-String/XML payloads. */ public class JXPathExtractor extends AbstractTransformer { private volatile String expression; private volatile boolean singleResult = true; /** * Evaluate the expression in the context of the given object and returns the * result. If the given object is a string, it assumes it is an valid xml and * parses it before evaluating the xpath expression. */ public Object doTransform(Object src, String encoding) throws TransformerException { try { Object result; if (src instanceof String) { Document doc = DocumentHelper.parseText((String)src); if (singleResult) { result = doc.valueOf(expression); } else { XPath xpath = doc.createXPath(expression); // TODO handle non-list cases, see // http://www.dom4j.org/apidocs/org/dom4j/XPath.html#evaluate(java.lang.Object) List obj = (List)xpath.evaluate(doc); result = new ArrayList(obj.size()); for (int i = 0; i < obj.size(); i++) { final Node node = (Node)obj.get(i); ((List)result).add(node.getText()); } } } else { JXPathContext context = JXPathContext.newContext(src); result = context.getValue(expression); } return result; } catch (Exception e) { throw new TransformerException(this, e); } } /** * @return Returns the expression. */ public String getExpression() { return expression; } /** * @param expression The expression to set. */ public void setExpression(String expression) { this.expression = expression; } /** * Should a single value be returned. * * @return value */ public boolean isSingleResult() { return singleResult; } /** * If multiple results are expected from the {@link #expression} evaluation, set * this to false. * * @param singleResult flag */ public void setSingleResult(boolean singleResult) { this.singleResult = singleResult; } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/XsltTransformer.java0000644000175000017500000003651010774254333031421 0ustar charlescharles/* * $Id: XsltTransformer.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer; import org.mule.RequestContext; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.module.xml.util.XMLUtils; import org.mule.util.ClassUtils; import org.mule.util.IOUtils; import org.mule.util.StringUtils; import org.mule.util.expression.ExpressionEvaluatorManager; import java.io.IOException; import java.io.InputStream; import java.io.StringReader; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import javax.xml.transform.ErrorListener; import javax.xml.transform.OutputKeys; import javax.xml.transform.Source; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactoryConfigurationError; import javax.xml.transform.URIResolver; import javax.xml.transform.stream.StreamSource; import org.apache.commons.pool.BasePoolableObjectFactory; import org.apache.commons.pool.impl.GenericObjectPool; /** * XsltTransformer performs an XSLT transform on a DOM (or other XML-ish) * object. * * This transformer maintains a pool of {@link javax.xml.Transformer} objects to speed up processing of concurrent requests. * The pool can be configured using {@link #setMaxIdleTransformers()} and {@link #setMaxIdleTransformers()}. * * Parameter can also be set as part of the transformation context and these can be mapped to conent in the current message using * property extractors or can be fixed values. * * * For example, the current event's message has a property named "myproperty", also you want to generate a uuid as a * parameter. To do this you can define context properties that can provide an expression to be evaluated on the current * message. *

    *

    * Example Configuration: *

    * *
     *  <mxml:xslt-transformer name="MyXsltTransformer" xslFile="myXslFile.xsl"&gt
     *      <context-property name="myParameter" value="${head:myproperty}"/&gt
     *      <context-property name="myParameter2" value="${function:uuid}"/&gt
     *  </mxml:xslt-transformer&gt
     * 
    * *

    * The 'header' expression pulls a header from the current message and 'function' can execute a set of arbitrary functions. * You can also pass in static values by ommitting the expression prefix '${'. *

    * * In addition to being able to pass in an XSLT file you can also define templates inline. For example - * *
     *  <mxml:xslt-transformer name="MyXsltTransformer"&gt
     *      <mxml:xslt-text&gt
     *          
    
     *                
     *
     *               
     *                   
     *                       
     *                   
     *               
     *           
     *  </mxml:xslt-text&gt
     * 
    * */ public class XsltTransformer extends AbstractXmlTransformer { // keep at least 1 XSLT Transformer ready by default private static final int MIN_IDLE_TRANSFORMERS = 1; // keep max. 32 XSLT Transformers around by default private static final int MAX_IDLE_TRANSFORMERS = 32; // MAX_IDLE is also the total limit private static final int MAX_ACTIVE_TRANSFORMERS = MAX_IDLE_TRANSFORMERS; // Prefix to use in a parameter to specify it is an expression that must be evaluated private static final String PARAM_EXTRACTOR_TOKEN = "${"; protected final GenericObjectPool transformerPool; private volatile String xslTransformerFactoryClassName; private volatile String xslFile; private volatile String xslt; private volatile Map contextProperties; public XsltTransformer() { super(); transformerPool = new GenericObjectPool(new PooledXsltTransformerFactory()); transformerPool.setMinIdle(MIN_IDLE_TRANSFORMERS); transformerPool.setMaxIdle(MAX_IDLE_TRANSFORMERS); transformerPool.setMaxActive(MAX_ACTIVE_TRANSFORMERS); } public void initialise() throws InitialisationException { try { transformerPool.addObject(); } catch (Throwable te) { throw new InitialisationException(te, this); } } /** * Transform, using XSLT, a XML String to another String. * * @param src The source XML (String, byte[], DOM, etc.) * @return The result String (or DOM) */ public Object doTransform(Object src, String encoding) throws TransformerException { try { Source sourceDoc = this.getXmlSource(src); if (sourceDoc == null) { return null; } ResultHolder holder = getResultHolder(returnClass); if (holder == null) { holder = getResultHolder(src.getClass()); } DefaultErrorListener errorListener = new DefaultErrorListener(this); javax.xml.transform.Transformer transformer = null; Object result; try { transformer = (javax.xml.transform.Transformer) transformerPool.borrowObject(); transformer.setErrorListener(errorListener); transformer.setOutputProperty(OutputKeys.ENCODING, encoding); // set transformation parameters if (contextProperties != null) { for (Iterator i = contextProperties.entrySet().iterator(); i.hasNext();) { Map.Entry parameter = (Entry) i.next(); String key = (String) parameter.getKey(); transformer.setParameter(key, evaluateTransformParameter(key, parameter.getValue())); } } transformer.transform(sourceDoc, holder.getResult()); result = holder.getResultObject(); if (errorListener.isError()) { throw errorListener.getException(); } } finally { if (transformer != null) { // clear transformation parameters before returning transformer to the // pool transformer.clearParameters(); transformerPool.returnObject(transformer); } } return result; } catch (Exception e) { throw new TransformerException(this, e); } } /** * Returns the name of the currently configured javax.xml.transform.Transformer * factory class used to create XSLT Transformers. * * @return a TransformerFactory class name or null if none has been * configured */ public String getXslTransformerFactory() { return xslTransformerFactoryClassName; } /** * Configures the javax.xml.transform.Transformer factory class * * @param xslTransformerFactory the name of the TransformerFactory class to use */ public void setXslTransformerFactory(String xslTransformerFactory) { this.xslTransformerFactoryClassName = xslTransformerFactory; } /** * @return Returns the xslFile. */ public String getXslFile() { return xslFile; } /** * @param xslFile The xslFile to set. */ public void setXslFile(String xslFile) { this.xslFile = xslFile; } public String getXslt() { return xslt; } public void setXslt(String xslt) { this.xslt = xslt; } /** * Returns the StreamSource corresponding to xslFile * * @return The StreamSource */ protected StreamSource getStreamSource() throws InitialisationException { if (xslt != null) { return new StreamSource(new StringReader(xslt)); } if (xslFile == null) { throw new InitialisationException(CoreMessages.objectIsNull("xslFile"), this); } InputStream is; try { is = IOUtils.getResourceAsStream(xslFile, getClass()); //if (logger.isDebugEnabled()) //{ // logger.debug("XSLT = " + IOUtils.getResourceAsString(xslFile, getClass())); //} } catch (IOException e) { throw new InitialisationException(e, this); } if (is != null) { return new StreamSource(is); } else { throw new InitialisationException(CoreMessages.failedToLoad(xslFile), this); } } protected class PooledXsltTransformerFactory extends BasePoolableObjectFactory { public Object makeObject() throws Exception { StreamSource source = XsltTransformer.this.getStreamSource(); String factoryClassName = XsltTransformer.this.getXslTransformerFactory(); TransformerFactory factory; if (StringUtils.isNotEmpty(factoryClassName)) { factory = (TransformerFactory) ClassUtils.instanciateClass(factoryClassName, ClassUtils.NO_ARGS, this.getClass()); } else { // fall back to JDK default try { factory = TransformerFactory.newInstance(); } catch (TransformerFactoryConfigurationError e) { System.setProperty("javax.xml.transform.TransformerFactory", XMLUtils.TRANSFORMER_FACTORY_JDK5); factory = TransformerFactory.newInstance(); } } factory.setURIResolver(new URIResolver() { public Source resolve(String href, String base) throws javax.xml.transform.TransformerException { try { return new StreamSource(IOUtils.getResourceAsStream(href, getClass())); } catch (IOException e) { throw new javax.xml.transform.TransformerException(e); } } }); return factory.newTransformer(source); } } protected class DefaultErrorListener implements ErrorListener { private TransformerException e = null; private final Transformer trans; public DefaultErrorListener(Transformer trans) { this.trans = trans; } public TransformerException getException() { return e; } public boolean isError() { return e != null; } public void error(javax.xml.transform.TransformerException exception) throws javax.xml.transform.TransformerException { e = new TransformerException(trans, exception); } public void fatalError(javax.xml.transform.TransformerException exception) throws javax.xml.transform.TransformerException { e = new TransformerException(trans, exception); } public void warning(javax.xml.transform.TransformerException exception) throws javax.xml.transform.TransformerException { logger.warn(exception.getMessage()); } } /** * @return The current maximum number of allowable active transformer objects in * the pool */ public int getMaxActiveTransformers() { return transformerPool.getMaxActive(); } /** * Sets the the current maximum number of active transformer objects allowed in the * pool * * @param maxActiveTransformers New maximum size to set */ public void setMaxActiveTransformers(int maxActiveTransformers) { transformerPool.setMaxActive(maxActiveTransformers); } /** * @return The current maximum number of allowable idle transformer objects in the * pool */ public int getMaxIdleTransformers() { return transformerPool.getMaxIdle(); } /** * Sets the the current maximum number of idle transformer objects allowed in the pool * * @param maxIdleTransformers New maximum size to set */ public void setMaxIdleTransformers(int maxIdleTransformers) { transformerPool.setMaxIdle(maxIdleTransformers); } /** * Gets the parameters to be used when applying the transformation * * @see javax.xml.transform.Transformer#setParameter(java.lang.String, * java.lang.Object) * @return a map of the parameter names and associated values */ public Map getContextProperties() { return contextProperties; } /** * Sets the parameters to be used when applying the transformation * * @see javax.xml.transform.Transformer#setParameter(java.lang.String, * java.lang.Object) * @param contextProperties a map of the parameter names and associated values */ public void setContextProperties(Map contextProperties) { this.contextProperties = contextProperties; } /** * Returns the value to be set for the parameter. This method is called for each * parameter before it is set on the transformer. The purpose of this method is to * allow dynamic parameters related to the event (usually message properties) to be * used. Any attribute of the current MuleEvent can be accessed using Property Extractors * such as JXpath, bean path or header retrieval. * * @param name the name of the parameter. The name isn't used for this implementation but is exposed as a * param for classes that may need it. * @param value the value of the paramter * @return the object to be set as the parameter value * @throws TransformerException */ protected Object evaluateTransformParameter(String name, Object value) throws TransformerException { if (value instanceof String) { String stringValue = (String) value; if (!stringValue.startsWith(PARAM_EXTRACTOR_TOKEN)) { return stringValue; } else { MuleEventContext context = RequestContext.getEventContext(); if (context == null) { throw new TransformerException(CoreMessages.noCurrentEventForTransformer(), this); } return ExpressionEvaluatorManager.evaluate(value.toString(), context.getMessage()); } } return value; } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/transformer/XStreamFactory.java0000644000175000017500000000711310764101307031143 0ustar charlescharles/* * $Id: XStreamFactory.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.transformer; import org.mule.util.ClassUtils; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.converters.Converter; import com.thoughtworks.xstream.converters.collections.MapConverter; import com.thoughtworks.xstream.io.HierarchicalStreamDriver; import com.thoughtworks.xstream.mapper.Mapper; import java.util.Iterator; import java.util.List; import java.util.Map; /** * Initializes the XStream utility for converting Objects to XML and XML to Objects. */ // @Immutable public class XStreamFactory { public static final String XSTREAM_DOM_DRIVER = "com.thoughtworks.xstream.io.xml.DomDriver"; public static final String XSTREAM_DOM4J_DRIVER = "com.thoughtworks.xstream.io.xml.Dom4JDriver"; public static final String XSTREAM_JDOM_DRIVER = "com.thoughtworks.xstream.io.xml.JDomDriver"; public static final String XSTREAM_STAX_DRIVER = "com.thoughtworks.xstream.io.xml.StaxDriver"; public static final String XSTREAM_XPP_DRIVER = "com.thoughtworks.xstream.io.xml.XppDriver"; private final XStream xstream; public XStreamFactory() throws ClassNotFoundException, InstantiationException, IllegalAccessException { this(XSTREAM_XPP_DRIVER, null, null); } public XStreamFactory(String driverClassName, Map aliases, List converters) throws ClassNotFoundException, InstantiationException, IllegalAccessException { Class driverClass = ClassUtils.loadClass(driverClassName, this.getClass()); xstream = new XStream((HierarchicalStreamDriver)driverClass.newInstance()); // We must always register this converter as the Mule Message uses // ConcurrentHashMaps, but XStream currently does not support them out of the // box. xstream.registerConverter(new XStreamFactory.ConcurrentHashMapConverter(xstream.getMapper()), -1); if (aliases != null) { for (Iterator iterator = aliases.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry)iterator.next(); Class aliasClass = ClassUtils.loadClass(entry.getValue().toString(), getClass()); xstream.alias(entry.getKey().toString(), aliasClass); } } if (converters != null) { for (Iterator iterator = converters.iterator(); iterator.hasNext();) { Class converterClazz = ClassUtils.loadClass(iterator.next().toString(), getClass()); xstream.registerConverter((Converter)converterClazz.newInstance()); } } } public final XStream getInstance() { return xstream; } private class ConcurrentHashMapConverter extends MapConverter { public ConcurrentHashMapConverter(Mapper mapper) throws ClassNotFoundException { super(mapper); } public boolean canConvert(Class aClass) { String className = aClass.getName(); return className.equals("java.util.concurrent.ConcurrentHashMap") || className.equals("edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap"); } } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/i18n/0000755000175000017500000000000011351411140023570 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/i18n/XmlMessages.java0000644000175000017500000000164210763667515026717 0ustar charlescharles/* * $Id: XmlMessages.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; /** TODO */ public class XmlMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("xml"); public static Message failedToProcessXPath(String expression) { return createMessage(BUNDLE_PATH, 1, expression); } public static Message domTypeNotSupported(Class type) { return createMessage(BUNDLE_PATH, 2, type); } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/config/0000755000175000017500000000000011351411140024256 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/config/XsltTransformerDefinitionParser.javamule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/config/XsltTransformerDefinitionParser.java0000644000175000017500000000153511003270417033474 0ustar charlescharles/* * $Id: XsltTransformerDefinitionParser.java 11626 2008-04-22 05:01:03Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.config; import org.mule.config.spring.parsers.specific.TransformerDefinitionParser; import org.mule.module.xml.transformer.XsltTransformer; public class XsltTransformerDefinitionParser extends TransformerDefinitionParser { public XsltTransformerDefinitionParser() { super(XsltTransformer.class); addAlias("transformerFactoryClass", "xslTransformerFactory"); } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/config/XmlNamespaceHandler.java0000644000175000017500000000651111003270417031003 0ustar charlescharles/* * $Id: XmlNamespaceHandler.java 11626 2008-04-22 05:01:03Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.config; import org.mule.config.spring.handlers.AbstractMuleNamespaceHandler; import org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.specific.RouterDefinitionParser; import org.mule.config.spring.parsers.specific.TransformerDefinitionParser; import org.mule.module.xml.filters.IsXmlFilter; import org.mule.module.xml.filters.JXPathFilter; import org.mule.module.xml.routing.FilteringXmlMessageSplitter; import org.mule.module.xml.routing.RoundRobinXmlSplitter; import org.mule.module.xml.transformer.DocumentToOutputHandler; import org.mule.module.xml.transformer.DomDocumentToXml; import org.mule.module.xml.transformer.JXPathExtractor; import org.mule.module.xml.transformer.ObjectToXml; import org.mule.module.xml.transformer.XmlPrettyPrinter; import org.mule.module.xml.transformer.XmlToDomDocument; import org.mule.module.xml.transformer.XmlToObject; public class XmlNamespaceHandler extends AbstractMuleNamespaceHandler { public void init() { registerBeanDefinitionParser("jxpath-filter", new ChildDefinitionParser("filter", JXPathFilter.class)); registerBeanDefinitionParser("is-xml-filter", new ChildDefinitionParser("filter", IsXmlFilter.class)); registerBeanDefinitionParser("message-splitter", new RouterDefinitionParser(FilteringXmlMessageSplitter.class)); registerMuleBeanDefinitionParser("round-robin-splitter", new RouterDefinitionParser(RoundRobinXmlSplitter.class)).addAlias("endpointFiltering", "enableEndpointFiltering"); registerBeanDefinitionParser("dom-to-xml-transformer", new TransformerDefinitionParser(DomDocumentToXml.class)); registerBeanDefinitionParser("dom-to-output-handler-transformer", new TransformerDefinitionParser(DocumentToOutputHandler.class)); registerBeanDefinitionParser("jxpath-extractor-transformer", new TransformerDefinitionParser(JXPathExtractor.class)); registerBeanDefinitionParser("object-to-xml-transformer", new TransformerDefinitionParser(ObjectToXml.class)); registerBeanDefinitionParser("xml-to-dom-transformer", new TransformerDefinitionParser(XmlToDomDocument.class)); registerBeanDefinitionParser("xml-to-object-transformer", new TransformerDefinitionParser(XmlToObject.class)); registerBeanDefinitionParser("xml-prettyprinter-transformer", new TransformerDefinitionParser(XmlPrettyPrinter.class)); registerBeanDefinitionParser("xslt-transformer", new XsltTransformerDefinitionParser()); registerBeanDefinitionParser("namespace", new ChildMapEntryDefinitionParser("namespaces", "prefix", "uri")); registerBeanDefinitionParser("context-property", new ChildMapEntryDefinitionParser("contextProperties", "key", "value")); registerBeanDefinitionParser("xslt-text", new XsltTextDefinitionParser("xslt", String.class)); } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/config/XsltTextDefinitionParser.java0000644000175000017500000000733410763667515032146 0ustar charlescharles/* * $Id: XsltTextDefinitionParser.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.config; import org.mule.config.spring.parsers.assembly.BeanAssembler; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.module.xml.util.XMLUtils; import javax.xml.transform.Result; import javax.xml.transform.Source; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.apache.commons.io.output.ByteArrayOutputStream; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * TODO */ public class XsltTextDefinitionParser extends ChildDefinitionParser { public static final String STYLESHEET = "stylesheet"; public static final int UNDEFINED = -1; /** * The class will be inferred from the class attribute * * @param setterMethod The target method (where the child will be injected) */ public XsltTextDefinitionParser(String setterMethod) { super(setterMethod); } /** * @param setterMethod The target method (where the child will be injected) * @param clazz The class created by this element/parser */ public XsltTextDefinitionParser(String setterMethod, Class clazz) { super(setterMethod, clazz); } protected void postProcess(ParserContext context, BeanAssembler assembler, Element element) { NodeList children = element.getChildNodes(); if (0 != children.getLength()) { Element stylesheet = null; for (int i = 0; i < children.getLength(); i++) { if (Node.ELEMENT_NODE == children.item(i).getNodeType()) { assertArgument(null == stylesheet, "XSLT transformer can have at most one child element"); stylesheet = (Element) children.item(i); } } if (null != stylesheet) { assertArgument(STYLESHEET.equals(stylesheet.getLocalName()), "XSLT transformer child element must be named " + STYLESHEET); assembler.extendTarget("xslt", domToString(stylesheet), false); // block processing by Spring element.removeChild(stylesheet); } } super.postProcess(context, assembler, element); } //@Override public String getPropertyName(Element e) { //We need to set this to null since we have already set the property on the parent in the postProcess() method return null; } protected String domToString(Element dom) { try { // maybe change the transformer to avoid this step? Source source = new DOMSource(dom); ByteArrayOutputStream output = new ByteArrayOutputStream(); Result result = new StreamResult(output); XMLUtils.getTransformer().transform(source, result); return output.toString(); } catch (Exception e) { throw (IllegalStateException) new IllegalStateException(e.getMessage()).initCause(e); } } protected void assertArgument(boolean condition, String message) { if (!condition) { throw new IllegalArgumentException(message); } } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/filters/0000755000175000017500000000000011351411141024462 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/filters/package.html0000644000175000017500000000016210763667515026772 0ustar charlescharles Filters that apply specifically to xml using xml querying mechanisms. mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/filters/JXPathFilter.java0000644000175000017500000002123710763667515027666 0ustar charlescharles/* * $Id: JXPathFilter.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import org.mule.util.StringMessageUtils; import java.util.Iterator; import java.util.Map; import org.apache.commons.jxpath.AbstractFactory; import org.apache.commons.jxpath.JXPathContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.XPath; /** * JXPathFilter evaluates an XPath expression against a W3C Document, * XML string, or Java bean and returns true if the result is as expected. */ public class JXPathFilter implements Filter { protected transient Log logger = LogFactory.getLog(getClass()); private String pattern; private String expectedValue; private Map namespaces = null; private Map contextProperties = null; private AbstractFactory factory; private boolean lenient = true; public JXPathFilter() { super(); } public JXPathFilter(String pattern) { this.pattern = pattern; } public JXPathFilter(String pattern, String expectedValue) { this.pattern = pattern; this.expectedValue = expectedValue; } public boolean accept(MuleMessage obj) { if (obj.getPayload() instanceof byte[]) { try { return accept(obj.getPayloadAsString()); } catch (Exception e) { logger.warn("JxPath filter rejected message because it could not convert from byte[] to String" + e.getMessage(), e); return false; } } return accept(obj.getPayload()); } private boolean accept(Object obj) { if (obj == null) { logger.warn("Applying JXPathFilter to null object."); return false; } if (pattern == null) { logger.warn("Expression for JXPathFilter is not set."); return false; } if (expectedValue == null) { // Handle the special case where the expected value really is null. if (pattern.endsWith("= null") || pattern.endsWith("=null")) { expectedValue = "null"; pattern = pattern.substring(0, pattern.lastIndexOf("=")); } else { if (logger.isInfoEnabled()) { logger.info("Expected value for JXPathFilter is not set, using 'true' by default"); } expectedValue = Boolean.TRUE.toString(); } } Object xpathResult = null; boolean accept = false; // Payload is a DOM Document if (obj instanceof Document) { if (namespaces == null) { // no namespace defined, let's perform a direct evaluation xpathResult = ((Document) obj).valueOf(pattern); } else { // create an xpath expression with namespaces and evaluate it XPath xpath = DocumentHelper.createXPath(pattern); xpath.setNamespaceURIs(namespaces); xpathResult = xpath.valueOf(obj); } } // Payload is a String of XML else if (obj instanceof String) { try { return accept(DocumentHelper.parseText((String) obj)); } catch (DocumentException e) { logger.warn("JXPathFilter unable to parse XML document: " + e.getMessage(), e); if (logger.isDebugEnabled()) { logger.debug("XML = " + StringMessageUtils.truncate((String) obj, 200, false)); } return false; } } // Payload is a Java object else { if (logger.isDebugEnabled()) { logger.debug("Passing object of type " + obj.getClass().getName() + " to JXPathContext"); } JXPathContext context = JXPathContext.newContext(obj); initialise(context); xpathResult = context.getValue(pattern); } if (logger.isDebugEnabled()) { logger.debug("JXPathFilter Expression result = '" + xpathResult + "' - Expected value = '" + expectedValue + "'"); } // Compare the XPath result with the expected result. if (xpathResult != null) { accept = xpathResult.toString().equals(expectedValue); } else { // A null result was actually expected. if (expectedValue.equals("null")) { accept = true; } // A null result was not expected, something probably went wrong. else { logger.warn("JXPathFilter expression evaluates to null: " + pattern); } } if (logger.isDebugEnabled()) { logger.debug("JXPathFilter accept object : " + accept); } return accept; } /** * Initializes the JXPathContext based on any relevant properties set for the * filter. * * @param context the JXPathContext to initialize */ protected void initialise(JXPathContext context) { Map.Entry entry; if (namespaces != null) { if (logger.isDebugEnabled()) { logger.debug("Initializing JXPathContext with namespaces: " + namespaces); } for (Iterator iterator = namespaces.entrySet().iterator(); iterator.hasNext();) { entry = (Map.Entry) iterator.next(); context.registerNamespace(entry.getKey().toString(), entry.getValue().toString()); } } if (contextProperties != null) { if (logger.isDebugEnabled()) { logger.debug("Initializing JXPathContext with properties: " + contextProperties); } for (Iterator iterator = contextProperties.entrySet().iterator(); iterator.hasNext();) { entry = (Map.Entry) iterator.next(); context.setValue(entry.getKey().toString(), entry.getValue()); } } if (factory != null) { context.setFactory(factory); } context.setLenient(lenient); } /** @return XPath expression */ public String getPattern() { return pattern; } /** @param pattern The XPath expression */ public void setPattern(String pattern) { this.pattern = pattern; } /** @return The expected result value of the XPath expression */ public String getExpectedValue() { return expectedValue; } /** Sets the expected result value of the XPath expression */ public void setExpectedValue(String expectedValue) { this.expectedValue = expectedValue; } /** * @return The expected result value of the XPath expression * @deprecated Use getExpectedValue(). */ public String getValue() { return getExpectedValue(); } /** * Sets the expected result value of the XPath expression * * @deprecated Use setExpectedValue(String expectedValue). */ public void setValue(String value) { setExpectedValue(value); } public Map getNamespaces() { return namespaces; } public void setNamespaces(Map namespaces) { this.namespaces = namespaces; } public Map getContextProperties() { return contextProperties; } public void setContextProperties(Map contextProperties) { this.contextProperties = contextProperties; } public AbstractFactory getFactory() { return factory; } public void setFactory(AbstractFactory factory) { this.factory = factory; } public boolean isLenient() { return lenient; } public void setLenient(boolean lenient) { this.lenient = lenient; } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/filters/JXPathMessageFilter.java0000644000175000017500000000125410763667515031170 0ustar charlescharles/* * $Id: JXPathMessageFilter.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.filters; /** * @inheritDoc * @deprecated Please use org.mule.routing.filters.xml.JXPathFilter * instead. */ public class JXPathMessageFilter extends JXPathFilter { // nothing here any more. } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/filters/IsXmlFilter.java0000644000175000017500000000444610763667515027567 0ustar charlescharles/* * $Id: IsXmlFilter.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import java.io.ByteArrayInputStream; import java.io.StringReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; /** * IsXmlFilter accepts a String or byte[] if its contents are valid * (well-formed) XML. */ // @ThreadSafe public class IsXmlFilter implements Filter { private final XMLInputFactory factory = XMLInputFactory.newInstance(); // TODO: add validation against a DTD, see MULE-1055 public IsXmlFilter() { super(); } public boolean accept(MuleMessage obj) { return accept(obj.getPayload()); } private boolean accept(Object obj) { XMLStreamReader parser = null; try { if (obj instanceof String) { parser = factory.createXMLStreamReader(new StringReader((String)obj)); } else if (obj instanceof byte[]) { parser = factory.createXMLStreamReader(new ByteArrayInputStream((byte[])obj)); } else { // neither String nor byte[] return false; } while (parser.next() != XMLStreamConstants.END_DOCUMENT) { // meep meep! } return true; } catch (XMLStreamException ex) { return false; } finally { if (parser != null) { try { parser.close(); } catch (XMLStreamException ignored) { // bummer } } } } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/routing/0000755000175000017500000000000011351411141024501 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/routing/FilteringXmlMessageSplitter.java0000644000175000017500000002625610763667515033047 0ustar charlescharles/* * $Id: FilteringXmlMessageSplitter.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.routing; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.routing.outbound.AbstractMessageSplitter; import org.mule.util.ExceptionUtils; import org.mule.util.IOUtils; import org.mule.util.StringUtils; import java.io.InputStream; import java.io.StringReader; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.Node; import org.dom4j.XPath; import org.dom4j.io.SAXReader; /** * FilteringXmlMessageSplitter will split a DOM4J document into nodes * based on the "splitExpression" property.

    Optionally, you can specify a * namespaces property map that contain prefix/namespace mappings. * Mind if you have a default namespace declared you should map it to some namespace, * and reference it in the splitExpression property.

    The splitter * can optionally validate against an XML schema. By default schema validation is * turned off.

    You may reference an external schema from the classpath by using * the externalSchemaLocation property.

    Note that each part * returned is actually returned as a new Document. */ public class FilteringXmlMessageSplitter extends AbstractMessageSplitter { // xml parser feature names for optional XSD validation public static final String APACHE_XML_FEATURES_VALIDATION_SCHEMA = "http://apache.org/xml/features/validation/schema"; public static final String APACHE_XML_FEATURES_VALIDATION_SCHEMA_FULL_CHECKING = "http://apache.org/xml/features/validation/schema-full-checking"; // JAXP property for specifying external XSD location public static final String JAXP_PROPERTIES_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; // JAXP properties for specifying external XSD language (as required by newer // JAXP implementation) public static final String JAXP_PROPERTIES_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; public static final String JAXP_PROPERTIES_SCHEMA_LANGUAGE_VALUE = "http://www.w3.org/2001/XMLSchema"; protected final ThreadLocal propertiesContext = new ThreadLocal(); protected final ThreadLocal nodesContext = new ThreadLocal(); protected volatile String splitExpression = ""; protected volatile Map namespaces = null; protected volatile boolean validateSchema = false; protected volatile String externalSchemaLocation = ""; public void setSplitExpression(String splitExpression) { this.splitExpression = StringUtils.trimToEmpty(splitExpression); } public void setNamespaces(Map namespaces) { this.namespaces = namespaces; } public Map getNamespaces() { return Collections.unmodifiableMap(namespaces); } public String getSplitExpression() { return splitExpression; } public boolean isValidateSchema() { return validateSchema; } public void setValidateSchema(boolean validateSchema) { this.validateSchema = validateSchema; } public String getExternalSchemaLocation() { return externalSchemaLocation; } /** * Set classpath location of the XSD to check against. If the resource cannot be * found, an exception will be thrown at runtime. * * @param externalSchemaLocation location of XSD */ public void setExternalSchemaLocation(String externalSchemaLocation) { this.externalSchemaLocation = externalSchemaLocation; } /** * Template method can be used to split the message up before the getMessagePart * method is called . * * @param message the message being routed */ // @Override protected void initialise(MuleMessage message) { if (logger.isDebugEnabled()) { if (splitExpression.length() == 0) { logger.warn("splitExpression is not specified, no processing will take place"); } else { logger.debug("splitExpression is " + splitExpression); } } Object src = message.getPayload(); try { if (src instanceof byte[]) { src = new String((byte[])src); } Document dom4jDoc; if (src instanceof String) { String xml = (String)src; SAXReader reader = new SAXReader(); setDoSchemaValidation(reader, isValidateSchema()); dom4jDoc = reader.read(new StringReader(xml)); } else if (src instanceof org.dom4j.Document) { dom4jDoc = (org.dom4j.Document)src; } else { logger.error("Non-XML message payload: " + src.getClass().toString()); return; } if (dom4jDoc != null) { if (splitExpression.length() > 0) { XPath xpath = dom4jDoc.createXPath(splitExpression); if (namespaces != null) { xpath.setNamespaceURIs(namespaces); } List foundNodes = xpath.selectNodes(dom4jDoc); if (enableCorrelation != ENABLE_CORRELATION_NEVER) { message.setCorrelationGroupSize(foundNodes.size()); } if (logger.isDebugEnabled()) { logger.debug("Split into " + foundNodes.size()); } List parts = new LinkedList(); // Rather than reparsing these when individual messages are // created, lets do it now // We can also avoid parsing the Xml again altogether for (Iterator iterator = foundNodes.iterator(); iterator.hasNext();) { Node node = (Node)iterator.next(); if (node instanceof Element) { // Can't do detach here just in case the source object // was a document. node = (Node)node.clone(); parts.add(DocumentHelper.createDocument((Element)node)); } else { logger.warn("Dcoument node: " + node.asXML() + " is not an element and thus is not a valid part"); } } nodesContext.set(parts); } } else { logger.warn("Unsupported message type, ignoring"); } } catch (Exception ex) { throw new IllegalArgumentException("Failed to initialise the payload: " + ExceptionUtils.getStackTrace(ex)); } Map theProperties = new HashMap(); for (Iterator iterator = message.getPropertyNames().iterator(); iterator.hasNext();) { String propertyKey = (String)iterator.next(); theProperties.put(propertyKey, message.getProperty(propertyKey)); } propertiesContext.set(theProperties); } // @Override protected void cleanup() { nodesContext.set(null); propertiesContext.set(null); } /** * Retrieves a specific message part for the given endpoint. the message will * then be routed via the provider. * * @param message the current message being processed * @param endpoint the endpoint that will be used to route the resulting message * part * @return the message part to dispatch */ protected MuleMessage getMessagePart(MuleMessage message, OutboundEndpoint endpoint) { List nodes = (List)nodesContext.get(); if (nodes == null) { logger.error("Error: nodes are null"); return null; } for (Iterator i = nodes.iterator(); i.hasNext();) { Document doc = (Document)i.next(); try { Map theProperties = (Map)propertiesContext.get(); MuleMessage result = new DefaultMuleMessage(doc, new HashMap(theProperties)); if (endpoint.getFilter() == null || endpoint.getFilter().accept(result)) { if (logger.isDebugEnabled()) { logger.debug("Endpoint filter matched for node " + i + " of " + nodes.size() + ". Routing message over: " + endpoint.getEndpointURI().toString()); } i.remove(); return result; } else { if (logger.isDebugEnabled()) { logger.debug("Endpoint filter did not match, returning null"); } } } catch (Exception e) { logger.error("Unable to create message for node at position " + i, e); return null; } } return null; } protected void setDoSchemaValidation(SAXReader reader, boolean validate) throws Exception { reader.setValidation(validate); reader.setFeature(APACHE_XML_FEATURES_VALIDATION_SCHEMA, validate); reader.setFeature(APACHE_XML_FEATURES_VALIDATION_SCHEMA_FULL_CHECKING, true); /* * By default we're not validating against an XSD. If this is the case, * there's no need to continue here, so we bail. */ if (!validate) { return; } InputStream xsdAsStream = IOUtils.getResourceAsStream(getExternalSchemaLocation(), getClass()); if (xsdAsStream == null) { throw new IllegalArgumentException("Couldn't find schema at " + getExternalSchemaLocation()); } // Set schema language property (must be done before the schemaSource // is set) reader.setProperty(JAXP_PROPERTIES_SCHEMA_LANGUAGE, JAXP_PROPERTIES_SCHEMA_LANGUAGE_VALUE); // Need this one to map schemaLocation to a physical location reader.setProperty(JAXP_PROPERTIES_SCHEMA_SOURCE, xsdAsStream); } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/routing/RoundRobinXmlSplitter.java0000644000175000017500000001625110777661265031673 0ustar charlescharles/* * $Id: RoundRobinXmlSplitter.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.routing; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.CouldNotRouteOutboundMessageException; import org.mule.api.routing.RoutingException; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import org.dom4j.Document; /** * This router will split the Xml message into parts based on the xpath expression * and route each new event to the endpoints on the router, one after the other. */ public class RoundRobinXmlSplitter extends FilteringXmlMessageSplitter { // We have to do some additional checks if we're going to allow filters on the // round robin endpoints // So for performance lets turn it off by default protected volatile boolean enableEndpointFiltering = false; private boolean deterministic = true; private static final AtomicInteger globalCounter = new AtomicInteger(0); public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { try { String correlationId = messageInfoMapping.getCorrelationId(message); initialise(message); OutboundEndpoint endpoint; MuleMessage result = null; Document part; List parts = (List)nodesContext.get(); if (parts == null) { logger.error("There are no parts for current message. No events were routed: " + message); return null; } int correlationSequence = 1; Counter epCounter = new Counter(); Iterator iterator = parts.iterator(); while (iterator.hasNext()) { part = (Document)iterator.next(); // Create the message Map theProperties = (Map)propertiesContext.get(); message = new DefaultMuleMessage(part, new HashMap(theProperties)); if (enableEndpointFiltering) { endpoint = getEndpointForMessage(message); } else { endpoint = (OutboundEndpoint) getEndpoints().get(epCounter.next()); } if (endpoint == null) { logger.error("There was no matching endpoint for message part: " + part.asXML()); } else { try { if (enableCorrelation != ENABLE_CORRELATION_NEVER) { boolean correlationSet = message.getCorrelationId() != null; if (!correlationSet && (enableCorrelation == ENABLE_CORRELATION_IF_NOT_SET)) { message.setCorrelationId(correlationId); } // take correlation group size from the message // properties, set by concrete message splitter // implementations final int groupSize = message.getCorrelationGroupSize(); message.setCorrelationGroupSize(groupSize); message.setCorrelationSequence(correlationSequence++); } if (synchronous) { result = send(session, message, endpoint); } else { dispatch(session, message, endpoint); } } catch (MuleException e) { throw new CouldNotRouteOutboundMessageException(message, endpoint, e); } } } return result; } finally { this.cleanup(); } } /** * Retrieves a specific message part for the given endpoint. the message will * then be routed via the provider. * * @param message the current message being processed * @return the message part to dispatch */ protected OutboundEndpoint getEndpointForMessage(MuleMessage message) { for (int i = 0; i < endpoints.size(); i++) { OutboundEndpoint endpoint = (OutboundEndpoint)endpoints.get(i); try { if (endpoint.getFilter() == null || endpoint.getFilter().accept(message)) { if (logger.isDebugEnabled()) { logger.debug("Endpoint filter matched for node " + i + ". Routing message over: " + endpoint.getEndpointURI().toString()); } return endpoint; } else { if (logger.isDebugEnabled()) { logger.debug("Endpoint filter did not match"); } } } catch (Exception e) { logger.error("Unable to create message for node at position " + i, e); return null; } } return null; } public void addEndpoint(OutboundEndpoint endpoint) { if (endpoint.getFilter() != null && !enableEndpointFiltering) { throw new IllegalStateException( "Endpoints on the RoundRobin splitter router cannot have filters associated with them"); } super.addEndpoint(endpoint); } public boolean isEnableEndpointFiltering() { return enableEndpointFiltering; } public void setEnableEndpointFiltering(boolean enableEndpointFiltering) { this.enableEndpointFiltering = enableEndpointFiltering; } public boolean isDeterministic() { return deterministic; } public void setDeterministic(boolean deterministic) { this.deterministic = deterministic; } private class Counter { private AtomicInteger counter; public Counter() { if (isDeterministic()) { counter = new AtomicInteger(0); } else { counter = globalCounter; } } public int next() { return counter.getAndIncrement() % getEndpoints().size(); } } } mule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/util/0000755000175000017500000000000011351411141023767 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/java/org/mule/module/xml/util/XMLUtils.java0000644000175000017500000000362710764120222026327 0ustar charlescharles/* * $Id: XMLUtils.java 11239 2008-03-07 01:55:30Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.xml.util; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactoryConfigurationError; import org.dom4j.io.DOMReader; import org.w3c.dom.Document; /** * General utility methods for working with XML. */ public class XMLUtils { public static final String TRANSFORMER_FACTORY_JDK5 = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"; /** * Converts a DOM to an XML string. */ public static String toXml(Document dom) { return new DOMReader().read(dom).asXML(); } /** * @return a new XSLT transformer * @throws TransformerConfigurationException if no TransformerFactory can be located in the * runtime environment. */ public static Transformer getTransformer() throws TransformerConfigurationException { TransformerFactory tf; try { tf = TransformerFactory.newInstance(); } catch (TransformerFactoryConfigurationError e) { System.setProperty("javax.xml.transform.TransformerFactory", TRANSFORMER_FACTORY_JDK5); tf = TransformerFactory.newInstance(); } if (tf != null) { return tf.newTransformer(); } else { throw new TransformerConfigurationException("Unable to instantiate a TransformerFactory"); } } } mule-2.0.1/modules/xml/src/main/resources/0000755000175000017500000000000011351411141020265 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/resources/META-INF/0000755000175000017500000000000011351411141021425 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/resources/META-INF/mule-xml.xsd0000644000175000017500000002145010771035437023726 0ustar charlescharles If true then the message part is sent to the first endpoint whose filter accepts the part. The default is false. If endpointFiltering is false and this option is true (the default) then the first message part if routed to the first endpoint, the second part to the second endpoint, etc, with the nth part going to the (n modulo number of endpoints) endpoint. If false then the messages will be distributed equally amongst all endpoints. mule-2.0.1/modules/xml/src/main/resources/META-INF/MANIFEST.MF0000644000175000017500000000000010553776311023065 0ustar charlescharlesmule-2.0.1/modules/xml/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012210663635100024277 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/xml/2.0/mule-xml.xsd=META-INF/mule-xml.xsd mule-2.0.1/modules/xml/src/main/resources/META-INF/spring.handlers0000644000175000017500000000013710763667515024502 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/xml/2.0=org.mule.module.xml.config.XmlNamespaceHandler mule-2.0.1/modules/xml/src/main/resources/META-INF/services/0000755000175000017500000000000011351411141023250 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351411141024037 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351411141025001 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351411141025560 5ustar charlescharlesmule-2.0.1/modules/xml/src/main/resources/META-INF/services/org/mule/i18n/xml-messages.properties0000644000175000017500000000013410710670237032314 0ustar charlescharles1=Failed to evaluate XPath expression: "{0}" 2=XML DOM type "{0}" is currently not supportedmule-2.0.1/modules/xml/src/main/resources/META-INF/services/org/mule/config/0000755000175000017500000000000011351411141026246 5ustar charlescharles././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootmule-2.0.1/modules/xml/src/main/resources/META-INF/services/org/mule/config/registry-bootstrap.propertiesmule-2.0.1/modules/xml/src/main/resources/META-INF/services/org/mule/config/registry-bootstrap.prope0000644000175000017500000000176610764101307033221 0ustar charlescharlesobject.1=org.mule.module.xml.expression.BeanPayloadExpressionEvaluator object.2=org.mule.module.xml.expression.XPathExpressionEvaluator object.3=org.mule.module.xml.expression.JXPathExpressionEvaluator transformer.1=org.mule.module.xml.transformer.DocumentToOutputHandler transformer.2=org.mule.module.xml.transformer.DomDocumentToXml transformer.3=org.mule.module.xml.transformer.XmlToDomDocument,returnClass=org.dom4j.io.DocumentResult transformer.4=org.mule.module.xml.transformer.XmlToDomDocument,returnClass=org.dom4j.Document,name=XmlToDom4jDocument transformer.5=org.mule.module.xml.transformer.XmlToDomDocument,returnClass=org.w3c.dom.Document,name=XmlToW3CDocument #transformer.6=org.mule.module.xml.transformer.XmlToDomDocument,returnClass=byte[] #These shouldn't be loaded by default since they don't really perform a type conversion, it does an Object to Xml string #transformer.2=org.mule.module.xml.transformer.ObjectToXml,name=ObjectToXml #transformer.3=org.mule.module.xml.transformer.XmlToObject mule-2.0.1/modules/xml/src/test/0000755000175000017500000000000011351411137016313 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/0000755000175000017500000000000011351411136017233 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/0000755000175000017500000000000011351411136020022 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/mule/0000755000175000017500000000000011351411137020765 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/mule/transformers/0000755000175000017500000000000011351411136023511 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/0000755000175000017500000000000011351411137024312 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/wire/0000755000175000017500000000000011351411137025260 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/wire/XStreamWireFormatTestCase.java0000644000175000017500000000475210767262171033166 0ustar charlescharles/* * $Id: XStreamWireFormatTestCase.java 11377 2008-03-16 18:18:33Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml.wire; import org.mule.api.MuleMessage; import org.mule.api.transformer.wire.WireFormat; import org.mule.module.xml.transformer.ObjectToXml; import org.mule.module.xml.transformer.XmlToObject; import org.mule.module.xml.transformer.wire.XStreamWireFormat; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transformer.wire.AbstractMuleMessageWireFormatTestCase; import java.util.Properties; public class XStreamWireFormatTestCase extends AbstractMuleMessageWireFormatTestCase { protected WireFormat getWireFormat() throws IllegalAccessException, InstantiationException, ClassNotFoundException { return new XStreamWireFormat(); } public void testGetDefaultInboundTransformer() throws IllegalAccessException, InstantiationException, ClassNotFoundException { assertEquals(XmlToObject.class, ((XStreamWireFormat) getWireFormat()).getInboundTransformer().getClass()); } public void testGetDefaultOutboundTransformer() throws IllegalAccessException, InstantiationException, ClassNotFoundException { assertEquals(ObjectToXml.class, ((XStreamWireFormat) getWireFormat()).getOutboundTransformer().getClass()); } public void testWriteReadPayload() throws Exception { // Create orange to send over the wire Properties messageProerties = new Properties(); messageProerties.put("key1", "val1"); Orange inOrange = new Orange(); inOrange.setBrand("Walmart"); inOrange.setMapProperties(messageProerties); Object outObject = readWrite(inOrange); // Test deserialized Fruit // TODO This wire-format wraps desrialized payloads in a message. See // MULE-3118 // See test implementation in AbstractMuleMessageWireFormatTestCase. assertTrue(outObject instanceof MuleMessage); assertEquals("Walmart", ((Orange) ((MuleMessage) outObject).getPayload()).getBrand()); assertEquals("val1", ((Orange) ((MuleMessage) outObject).getPayload()).getMapProperties().get("key1")); } } mule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XsltTransformerUTF8TestCase.java0000644000175000017500000000326110764101307032441 0ustar charlescharles/* * $Id: XsltTransformerUTF8TestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.api.transformer.Transformer; import org.mule.module.xml.transformer.XsltTransformer; import org.mule.util.IOUtils; public class XsltTransformerUTF8TestCase extends AbstractXmlTransformerTestCase { private String srcData; private String resultData; // @Override protected void doSetUp() throws Exception { srcData = IOUtils.toString(IOUtils.getResourceAsStream("cdcatalog-utf-8.xml", getClass()), "UTF-8"); resultData = IOUtils.toString(IOUtils.getResourceAsStream("cdcatalog-utf-8.html", getClass()), "UTF-8"); } public Transformer getTransformer() throws Exception { XsltTransformer transformer = new XsltTransformer(); transformer.setXslFile("cdcatalog.xsl"); transformer.setReturnClass(String.class); transformer.initialise(); return transformer; } public Transformer getRoundTripTransformer() throws Exception { return null; } // @Override public void testRoundtripTransform() throws Exception { // disable this test } public Object getTestData() { return srcData; } public Object getResultData() { return resultData; } } mule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XsltTransformerTestCase.java0000644000175000017500000001537010764101307031776 0ustar charlescharles/* * $Id:XsltTransformerTestCase.java 5937 2007-04-09 22:35:04Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.module.xml.transformer.XsltTransformer; import org.mule.tck.MuleTestUtils; import org.mule.util.IOUtils; import java.util.HashMap; import java.util.Map; public class XsltTransformerTestCase extends AbstractXmlTransformerTestCase { private String srcData; private String resultData; // @Override protected void doSetUp() throws Exception { srcData = IOUtils.getResourceAsString("cdcatalog.xml", getClass()); resultData = IOUtils.getResourceAsString("cdcatalog.html", getClass()); } public Transformer getTransformer() throws Exception { XsltTransformer transformer = new XsltTransformer(); transformer.setReturnClass(String.class); transformer.setXslFile("cdcatalog.xsl"); transformer.setMaxActiveTransformers(42); transformer.initialise(); return transformer; } public Transformer getRoundTripTransformer() throws Exception { return null; } // @Override public void testRoundtripTransform() throws Exception { // disable this test } public Object getTestData() { return srcData; } public Object getResultData() { return resultData; } public void testCustomTransformerFactoryClass() throws InitialisationException { XsltTransformer t = new XsltTransformer(); t.setXslTransformerFactory("com.nosuchclass.TransformerFactory"); t.setXslFile("cdcatalog.xsl"); try { t.initialise(); fail("should have failed with ClassNotFoundException"); } catch (InitialisationException iex) { assertEquals(ClassNotFoundException.class, iex.getCause().getClass()); } // try again with JDK default t.setXslTransformerFactory(null); t.initialise(); } public void testTransformWithStaticParam() throws TransformerException, InitialisationException { String xml = "" + "sub node 1 original value" + "sub node 2 original value" + ""; String param = "sub node 2 cool new value"; String expectedTransformedxml = "" + "sub node 1 original value" + "" + param + "" + ""; String xsl = "" + "" + "" + "" + "" + "" + "" + "" + ""; XsltTransformer transformer = new XsltTransformer(); transformer.setReturnClass(String.class); // set stylesheet transformer.setXslt(xsl); // set parameter Map params = new HashMap(); params.put("param1", param); transformer.setContextProperties(params); // init transformer transformer.initialise(); // do transformation String transformerResult = (String) transformer.transform(xml); // remove doc type and CRLFs transformerResult = transformerResult.substring(transformerResult.indexOf("?>") + 2); assertTrue(transformerResult.indexOf(expectedTransformedxml) > -1); } public void testTransformWithDynamicParam() throws Exception { String xml = "" + "sub node 1 original value" + "sub node 2 original value" + ""; String param = "sub node 2 cool new value"; String expectedTransformedxml = "" + "sub node 1 original value" + "" + param + "" + ""; String xsl = "" + "" + "" + "" + "" + "" + "" + "" + ""; XsltTransformer transformer = new XsltTransformer(); transformer.setReturnClass(String.class); // set stylesheet transformer.setXslt(xsl); // set parameter Map params = new HashMap(); params.put("param1", "${header:myproperty}"); transformer.setContextProperties(params); // init transformer transformer.initialise(); // set up MuleEventContext MuleEvent event = MuleTestUtils.getTestEvent("test message data", muleContext); event.getMessage().setProperty("myproperty", param); RequestContext.setEvent(event); // do transformation String transformerResult = (String) transformer.transform(xml); // remove doc type and CRLFs transformerResult = transformerResult.substring(transformerResult.indexOf("?>") + 2); assertTrue(transformerResult.indexOf(expectedTransformedxml) > -1); } } mule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/DomXmlTransformersTestCase.java0000644000175000017500000000330610764101307032423 0ustar charlescharles/* * $Id: DomXmlTransformersTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.api.transformer.Transformer; import org.mule.module.xml.transformer.DomDocumentToXml; import org.mule.module.xml.transformer.XmlToDomDocument; import org.mule.util.IOUtils; import org.dom4j.DocumentHelper; import org.dom4j.io.DOMWriter; import org.w3c.dom.Document; public class DomXmlTransformersTestCase extends AbstractXmlTransformerTestCase { private String srcData; private Document resultData; // @Override protected void doSetUp() throws Exception { srcData = IOUtils.getResourceAsString("cdcatalog.xml", getClass()); org.dom4j.Document dom4jDoc = DocumentHelper.parseText(srcData); resultData = new DOMWriter().write(dom4jDoc); } public Transformer getTransformer() throws Exception { XmlToDomDocument trans = new XmlToDomDocument(); trans.setReturnClass(org.w3c.dom.Document.class); return trans; } public Transformer getRoundTripTransformer() throws Exception { DomDocumentToXml trans = new DomDocumentToXml(); trans.setReturnClass(String.class); return trans; } public Object getTestData() { return srcData; } public Object getResultData() { return resultData; } } mule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XmlObjectTransformersTestCase.java0000644000175000017500000000342110766061620033115 0ustar charlescharles/* * $Id: XmlObjectTransformersTestCase.java 11339 2008-03-12 23:13:20Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.module.xml.transformer.ObjectToXml; import org.mule.module.xml.transformer.XmlToObject; import org.mule.tck.testmodels.fruit.Apple; import java.io.ByteArrayInputStream; public class XmlObjectTransformersTestCase extends AbstractXmlTransformerTestCase { private Apple testObject = null; public XmlObjectTransformersTestCase() { testObject = new Apple(); testObject.wash(); } public Transformer getTransformer() throws Exception { return new ObjectToXml(); } public Transformer getRoundTripTransformer() throws Exception { return new XmlToObject(); } public Object getTestData() { return testObject; } public Object getResultData() { return "\n" + " false\n" + " true\n" + ""; } public void testStreaming() throws TransformerException { XmlToObject transformer = new XmlToObject(); String input = (String) this.getResultData(); assertEquals(testObject, transformer.transform(new ByteArrayInputStream(input.getBytes()))); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XmlPrettyPrinterTransformerTestCase.javamule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XmlPrettyPrinterTransformerTestCase.j0000644000175000017500000000360210764101307033663 0ustar charlescharles/* * $Id: XmlPrettyPrinterTransformerTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.api.transformer.Transformer; import org.mule.module.xml.transformer.XmlPrettyPrinter; import org.mule.transformer.AbstractTransformerTestCase; import org.dom4j.io.OutputFormat; public class XmlPrettyPrinterTransformerTestCase extends AbstractTransformerTestCase { // Do not normalize any Strings for this test since we need to test formatting protected String normalizeString(String rawString) { return rawString; } public Object getResultData() { return "\n\n" + "\n" + " \n" + " test\n" + " \n" + "\n"; } public Transformer getRoundTripTransformer() throws Exception { // there is no XmlUnprettyPrinter :) return null; } public Object getTestData() { return "test"; } public Transformer getTransformer() throws Exception { return new XmlPrettyPrinter(); } public void testOutputOptions() { XmlPrettyPrinter t = new XmlPrettyPrinter(); OutputFormat f = t.getOutputFormat(); assertEquals(2, f.getIndent().length()); assertFalse(f.isPadText()); t.setIndentSize(4); t.setPadText(true); assertEquals(4, f.getIndent().length()); assertTrue(f.isPadText()); } } mule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/JXPathExtractorTestCase.java0000644000175000017500000001037710764101307031655 0ustar charlescharles/* * $Id: JXPathExtractorTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.module.xml.transformer.JXPathExtractor; import org.mule.tck.AbstractMuleTestCase; import java.util.List; public class JXPathExtractorTestCase extends AbstractMuleTestCase { protected static final String TEST_XML_MULTI_RESULTS = "" + "" + "value1" + "value2" + "value3" + ""; protected static final String TEST_XML_MULTI_NESTED_RESULTS = "" + "" + "" + "val1" + "val2" + "" + "" + "val3" + "val4" + "" + ""; protected static final String TEST_XML_SINGLE_RESULT = "" + "" + "value1" + ""; public void testSingeResult() throws Exception { final JXPathExtractor extractor = new JXPathExtractor(); final String expression = "/root/node"; extractor.setExpression(expression); // just make code coverage tools happy assertEquals("Wrong expression returned.", expression, extractor.getExpression()); final Object objResult = extractor.transform(TEST_XML_SINGLE_RESULT); assertNotNull(objResult); String result = (String)objResult; assertEquals("Wrong value extracted.", "value1", result); } public void testMultipleResults() throws Exception { JXPathExtractor extractor = new JXPathExtractor(); extractor.setExpression("/root/node"); extractor.setSingleResult(false); final Object objResult = extractor.transform(TEST_XML_MULTI_RESULTS); assertNotNull(objResult); List results = (List)objResult; assertEquals("Wrong number of results returned.", 3, results.size()); assertEquals("Wrong value returned.", "value1", results.get(0)); assertEquals("Wrong value returned.", "value2", results.get(1)); assertEquals("Wrong value returned.", "value3", results.get(2)); } /** * This xpath expression will internally have DefaultText returned, test there * are no ClassCastExceptions. */ public void testMultipleResultsNested() throws Exception { JXPathExtractor extractor = new JXPathExtractor(); extractor.setExpression("/root/node[*]/*/text()"); extractor.setSingleResult(false); final Object objResult = extractor.transform(TEST_XML_MULTI_NESTED_RESULTS); assertNotNull(objResult); List results = (List)objResult; assertEquals("Wrong number of results returned.", 4, results.size()); assertEquals("Wrong value returned.", "val1", results.get(0)); assertEquals("Wrong value returned.", "val2", results.get(1)); assertEquals("Wrong value returned.", "val3", results.get(2)); assertEquals("Wrong value returned.", "val4", results.get(3)); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/DomXmlTransformerEncodingTestCase.javamule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/DomXmlTransformerEncodingTestCase.jav0000644000175000017500000000552510764101307033553 0ustar charlescharles/* * $Id: DomXmlTransformerEncodingTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.transformer.Transformer; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.module.xml.transformer.DomDocumentToXml; import org.mule.module.xml.transformer.XmlToDomDocument; import org.mule.util.IOUtils; import org.dom4j.DocumentHelper; import org.dom4j.io.DOMReader; import org.dom4j.io.DOMWriter; import org.w3c.dom.Document; public class DomXmlTransformerEncodingTestCase extends AbstractXmlTransformerTestCase { private Document srcData; // Parsed XML doc private String resultData; // String as US-ASCII // @Override protected void doSetUp() throws Exception { org.dom4j.Document dom4jDoc = DocumentHelper.parseText(IOUtils.toString(IOUtils.getResourceAsStream( "cdcatalog-utf-8.xml", getClass()), "UTF-8")); srcData = new DOMWriter().write(dom4jDoc); resultData = IOUtils.toString(IOUtils.getResourceAsStream("cdcatalog-us-ascii.xml", getClass()), "US-ASCII"); } public Transformer getTransformer() throws Exception { Transformer trans = new DomDocumentToXml(); trans.setReturnClass(String.class); EndpointBuilder builder = new EndpointURIEndpointBuilder("test://test", muleContext); builder.setEncoding("US-ASCII"); ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint( builder); trans.setEndpoint(endpoint); return trans; } public Transformer getRoundTripTransformer() throws Exception { XmlToDomDocument trans = new XmlToDomDocument(); // encoding is not interesting trans.setReturnClass( org.w3c.dom.Document.class); return trans; } public Object getTestData() { return srcData; } public Object getResultData() { return resultData; } // @Override public boolean compareResults(Object expected, Object result) { // This is only used during roundtrip test, so it will always be Document // instances if (expected instanceof Document) { expected = new DOMReader().read((Document)expected).asXML(); result = new DOMReader().read((Document)result).asXML(); } return super.compareResults(expected, result); } } mule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/AbstractXmlTransformerTestCase.java0000644000175000017500000000410010763667515033276 0ustar charlescharles/* * $Id: AbstractXmlTransformerTestCase.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.module.xml.util.XMLUtils; import org.mule.transformer.AbstractTransformerTestCase; import javax.xml.transform.TransformerFactoryConfigurationError; import org.custommonkey.xmlunit.XMLUnit; import org.w3c.dom.Document; /** * Use this superclass if you intend to compare Xml contents. */ public abstract class AbstractXmlTransformerTestCase extends AbstractTransformerTestCase { protected AbstractXmlTransformerTestCase() { super(); XMLUnit.setIgnoreWhitespace(true); XMLUnit.setXSLTVersion("2.0"); try { XMLUnit.getTransformerFactory(); } catch (TransformerFactoryConfigurationError e) { XMLUnit.setTransformerFactory(XMLUtils.TRANSFORMER_FACTORY_JDK5); } } // @Override public boolean compareResults(Object expected, Object result) { if (expected instanceof Document && result instanceof Document) { return XMLUnit.compareXML((Document)expected, (Document)result).similar(); } else if (expected instanceof String && result instanceof String) { try { String expectedString = this.normalizeString((String)expected); String resultString = this.normalizeString((String)result); return XMLUnit.compareXML(expectedString, resultString).similar(); } catch (Exception ex) { return false; } } // all other comparisons are passed up return super.compareResults(expected, result); } } mule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/InlineXsltTransformerTestCase.java0000644000175000017500000000370510764101307033134 0ustar charlescharles/* * $Id: InlineXsltTransformerTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.api.transformer.Transformer; import org.mule.module.xml.transformer.XsltTransformer; import org.mule.util.IOUtils; public class InlineXsltTransformerTestCase extends AbstractXmlTransformerTestCase { private String srcData; private String resultData; protected void doSetUp() throws Exception { srcData = IOUtils.getResourceAsString("simple.xml", getClass()); resultData = IOUtils.getResourceAsString("simple-out.xml", getClass()); } public Transformer getTransformer() throws Exception { XsltTransformer transformer = new XsltTransformer(); transformer.setXslt("\n" + "\n" + "\n" + "\n" + " \n" + " \n" + " \n" + "\n" + ""); transformer.setReturnClass(String.class); transformer.initialise(); return transformer; } public Transformer getRoundTripTransformer() throws Exception { return null; } public void testRoundtripTransform() throws Exception { // disable this test } public Object getTestData() { return srcData; } public Object getResultData() { return resultData; } } mule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XStreamFactoryTestCase.java0000644000175000017500000000270410764101307031531 0ustar charlescharles/* * $Id: XStreamFactoryTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.module.xml.transformer.XStreamFactory; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.StringUtils; import com.thoughtworks.xstream.XStream; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; public class XStreamFactoryTestCase extends AbstractMuleTestCase { public void testConcurrentHashMapConverter() throws ClassNotFoundException, IllegalAccessException, InstantiationException { ConcurrentHashMap map = new ConcurrentHashMap(); map.put("foo", "bar"); XStream xstream = new XStreamFactory().getInstance(); String mapXML = xstream.toXML(map); assertNotNull(mapXML); assertTrue(StringUtils.isNotEmpty(mapXML)); Object newMap = xstream.fromXML(mapXML); assertNotNull(newMap); assertTrue(newMap instanceof ConcurrentHashMap); assertEquals(1, ((Map)newMap).size()); assertEquals("bar", ((Map)newMap).get("foo")); } } mule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/ParallelXsltTransformerTestCase.java0000644000175000017500000000757410764101307033462 0ustar charlescharles/* * $Id: ParallelXsltTransformerTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.module.xml.transformer.XsltTransformer; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.IOUtils; import java.util.Collection; import java.util.Iterator; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentLinkedQueue; import org.custommonkey.xmlunit.XMLAssert; public class ParallelXsltTransformerTestCase extends AbstractMuleTestCase { private String srcData; private String resultData; private Collection actualResults = new ConcurrentLinkedQueue(); // @Override protected void doSetUp() throws Exception { srcData = IOUtils.toString(IOUtils.getResourceAsStream("cdcatalog-utf-8.xml", getClass()), "UTF-8"); resultData = IOUtils.toString(IOUtils.getResourceAsStream("cdcatalog-utf-8.html", getClass()), "UTF-8"); } public Transformer getTransformer() throws Exception { XsltTransformer transformer = new XsltTransformer(); transformer.setReturnClass(String.class); transformer.setXslFile("cdcatalog.xsl"); transformer.initialise(); return transformer; } int running = 0; public synchronized void signalStarted() { ++running; } public synchronized void signalDone() { if (--running == 0) this.notify(); } public void testParallelTransformation() throws Exception { final Transformer transformer = getTransformer(); long startTime = System.currentTimeMillis(); for (int i = 0; i < getParallelThreadCount(); ++i) { new Thread(new Runnable() { public void run() { signalStarted(); for (int j = 0; j < getCallsPerThread(); ++j) { try { actualResults.add(transformer.transform(srcData)); } catch (TransformerException e) { actualResults.add(e); } } signalDone(); } }).start(); } synchronized (this) { this.wait(); } long endTime = System.currentTimeMillis(); checkResult(); if (logger.isDebugEnabled()) { logger.debug("Parallel transformations in " + getParallelThreadCount() + " threads with " + getCallsPerThread() + " calls/thread took " + (endTime - startTime) + " ms."); } } protected void checkResult() throws Exception { Object expectedResult = resultData; for (Iterator it = actualResults.iterator(); it.hasNext();) { Object result = it.next(); if (result instanceof Exception) throw (Exception) result; if (expectedResult instanceof String && result instanceof String) { XMLAssert.assertXMLEqual((String) expectedResult, (String) result); } else { XMLAssert.assertEquals(expectedResult, result); } } } private int getParallelThreadCount() { return 20; } private int getCallsPerThread() { return 100; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XmlObjectTransformersUTF8TestCase.javamule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XmlObjectTransformersUTF8TestCase.jav0000644000175000017500000000324010764101307033415 0ustar charlescharles/* * $Id: XmlObjectTransformersUTF8TestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.api.transformer.Transformer; import org.mule.module.xml.transformer.XmlToObject; import org.mule.transformer.AbstractTransformerTestCase; import org.mule.util.ArrayUtils; import java.io.UnsupportedEncodingException; public class XmlObjectTransformersUTF8TestCase extends AbstractTransformerTestCase { // this is "�b�d�f" in a Java source file encoding independent form. private static final String TEST_STRING = "\u00E1b\u00E7d\u00E8f"; private final byte[] testXml; public XmlObjectTransformersUTF8TestCase() throws UnsupportedEncodingException { super(); testXml = ArrayUtils.addAll("".getBytes("ASCII"), ArrayUtils.addAll( TEST_STRING.getBytes("UTF-8"), "".getBytes("ASCII"))); } public Transformer getTransformer() throws Exception { return new XmlToObject(); } public Transformer getRoundTripTransformer() throws Exception { // no round tripping because ObjectToXml transforms to String, and not byte[] return null; } public Object getTestData() { return testXml; } public Object getResultData() { return TEST_STRING; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XStreamTransformerConfigurationTestCase.javamule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XStreamTransformerConfigurationTestCa0000644000175000017500000000507210764101307033705 0ustar charlescharles/* * $Id: XStreamTransformerConfigurationTestCase.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.api.transformer.TransformerException; import org.mule.module.xml.transformer.XStreamFactory; import org.mule.module.xml.transformer.XmlToObject; import org.mule.tck.AbstractMuleTestCase; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.DomDriver; /** * Tests configuration and creation of XStream-based transformers */ public class XStreamTransformerConfigurationTestCase extends AbstractMuleTestCase { public static volatile boolean MyDriverDidInitialize; protected static class MyDOMDriver extends DomDriver { public MyDOMDriver() { super(); XStreamTransformerConfigurationTestCase.MyDriverDidInitialize = true; } } // @Override protected void doSetUp() throws Exception { super.doSetUp(); MyDriverDidInitialize = true; } // @Override protected void doTearDown() throws Exception { MyDriverDidInitialize = false; super.doTearDown(); } public void testDefaultDriver() throws Exception { XmlToObject transformer = new XmlToObject(); // check for XStream's default assertEquals(XStreamFactory.XSTREAM_XPP_DRIVER, transformer.getDriverClassName()); } public void testCustomDriver() throws Exception { XmlToObject transformer = new XmlToObject(); // set custom driver transformer.setDriverClassName(MyDOMDriver.class.getName()); XStream xs = transformer.getXStream(); assertNotNull(xs); assertSame(xs, transformer.getXStream()); assertTrue(MyDriverDidInitialize); } public void testBadDriver() throws Exception { XmlToObject transformer = new XmlToObject(); // set nonexisting driver class transformer.setDriverClassName("DudeWhereIsMyDriver"); try { assertNotNull(transformer.getXStream()); fail(); } catch (TransformerException tex) { // OK assertTrue(tex.getCause() instanceof ClassNotFoundException); } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XmlUMOMessageTransformersTestCase.javamule-2.0.1/modules/xml/src/test/java/org/mule/transformers/xml/XmlUMOMessageTransformersTestCase.jav0000644000175000017500000001673310766204322033523 0ustar charlescharles/* * $Id:XmlUMOMessageTransformersTestCase.java 5937 2007-04-09 22:35:04Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformers.xml; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.MuleMessage; import org.mule.api.transformer.Transformer; import org.mule.module.xml.transformer.ObjectToXml; import org.mule.module.xml.transformer.XmlToObject; import org.mule.tck.MuleTestUtils; import org.mule.tck.testmodels.fruit.Apple; import java.util.HashMap; import java.util.Map; import org.custommonkey.xmlunit.XMLAssert; public class XmlUMOMessageTransformersTestCase extends AbstractXmlTransformerTestCase { private MuleMessage testObject = null; // @Override protected void doSetUp() throws Exception { Map props = new HashMap(); props.put("object", new Apple()); props.put("number", new Integer(1)); props.put("string", "hello"); testObject = new DefaultMuleMessage("test", props); RequestContext.setEvent(new DefaultMuleEvent(testObject, getTestOutboundEndpoint("test"), MuleTestUtils .getTestSession(muleContext), true)); } // @Override protected void doTearDown() throws Exception { RequestContext.clear(); } public Transformer getTransformer() throws Exception { ObjectToXml t = new ObjectToXml(); t.setAcceptUMOMessage(true); return t; } public Transformer getRoundTripTransformer() throws Exception { return new XmlToObject(); } public Object getTestData() { return testObject; } public Object getResultData() { return "\n" + " \n" + " test\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " invocation\n" + " 0\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " inbound\n" + " 1\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " outbound\n" + " 2\n" + " \n" + " \n" + " \n" + " object\n" + " \n" + " false\n" + " false\n" + " \n" + " \n" + " \n" + " string\n" + " hello\n" + " \n" + " \n" + " number\n" + " 1\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " session\n" + " 3\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " number\n" + " object\n" + " string\n" + " \n" + " \n" + " \n" + " false\n" + " \n" + " \n" + " UTF-8\n" + " 3be5fe5a-87f8-11dc-a153-0b6db396665f\n" + " \n" + " \n"; } /** * Different JVMs serialize fields to XML in a different order, in which case we * need to check for the actual contents. We reconstruct the UMOMessages from the * generated XML and compare them as objects. */ // @Override public boolean compareResults(Object expected, Object result) { if (!super.compareResults(expected, result)) { // apparently the generic XML comparison did not work, so check again with XPath try { XMLAssert.assertXpathEvaluatesTo("3", "count(//adapter/properties/scopedMap/entry/map/entry)", (String)result); XMLAssert.assertXpathEvaluatesTo("false", "//adapter/properties/scopedMap/entry/map/entry/org.mule.tck.testmodels.fruit.Apple/bitten", (String)result); } catch (Exception ex) { fail(ex.getMessage()); } } return true; } // @Override public boolean compareRoundtripResults(Object expected, Object result) { if (expected == null && result == null) { return true; } if (expected == null || result == null) { return false; } if (expected instanceof MuleMessage && result instanceof MuleMessage) { return ((MuleMessage)expected).getPayload().equals(((MuleMessage)result).getPayload()) && ((MuleMessage)expected).getProperty("object").equals( ((MuleMessage)result).getProperty("object")) && ((MuleMessage)expected).getProperty("string").equals( ((MuleMessage)result).getProperty("string")) && ((MuleMessage)expected).getIntProperty("number", -1) == ((MuleMessage)result) .getIntProperty("number", -2); } else { return false; } } } mule-2.0.1/modules/xml/src/test/java/org/mule/routing/0000755000175000017500000000000011351411137022454 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/mule/routing/filters/0000755000175000017500000000000011351411137024124 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/mule/routing/filters/xml/0000755000175000017500000000000011351411137024724 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/mule/routing/filters/xml/IsXmlFilterTestCase.java0000644000175000017500000000454710763667515031462 0ustar charlescharles/* * $Id: IsXmlFilterTestCase.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters.xml; import org.mule.DefaultMuleMessage; import org.mule.module.xml.filters.IsXmlFilter; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; public class IsXmlFilterTestCase extends AbstractMuleTestCase { private IsXmlFilter filter; protected void doSetUp() throws Exception { filter = new IsXmlFilter(); } public void testFilterFalse() throws Exception { assertFalse(filter.accept(new DefaultMuleMessage("This is definitely not XML."))); } public void testFilterFalse2() throws Exception { assertFalse(filter.accept(new DefaultMuleMessage( "This is almost XMLThis is almost XML"))); } public void testFilterTrue() throws Exception { assertTrue(filter.accept(new DefaultMuleMessage("This is some nice XML!"))); } public void testFilterBytes() throws Exception { byte[] bytes = "This is some nice XML!".getBytes(); assertTrue(filter.accept(new DefaultMuleMessage(bytes))); } public void testFilterNull() throws Exception { assertFalse(filter.accept(new DefaultMuleMessage(null))); } public void testFilterLargeXml() throws Exception { final String xml = loadFromClasspath("cdcatalog.xml"); assertTrue(filter.accept(new DefaultMuleMessage(xml))); } public void testFilterLargeXmlFalse() throws Exception { final String html = loadFromClasspath("cdcatalog.html"); assertTrue(filter.accept(new DefaultMuleMessage(html))); } private String loadFromClasspath(final String name) throws IOException { InputStream is = IOUtils.getResourceAsStream(name, getClass()); assertNotNull("Test resource not found.", is); return IOUtils.toString(is); } } mule-2.0.1/modules/xml/src/test/java/org/mule/routing/filters/xml/Dummy.java0000644000175000017500000000204110664630335026670 0ustar charlescharles/* * $Id: Dummy.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters.xml; public class Dummy { private int id; private String content; public Dummy() { super(); } /** * @return Returns the content. */ public String getContent() { return content; } /** * @param content The content to set. */ public void setContent(String content) { this.content = content; } /** * @return Returns the id. */ public int getId() { return id; } /** * @param id The id to set. */ public void setId(int id) { this.id = id; } } mule-2.0.1/modules/xml/src/test/java/org/mule/routing/filters/xml/JXPathFilterTestCase.java0000644000175000017500000001674510763667515031567 0ustar charlescharles/* * $Id: JXPathFilterTestCase.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters.xml; import org.mule.DefaultMuleMessage; import org.mule.module.xml.filters.JXPathFilter; import org.mule.tck.AbstractMuleTestCase; import java.io.InputStream; import java.io.StringReader; import java.util.HashMap; import java.util.Map; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.commons.io.IOUtils; import org.dom4j.DocumentHelper; import org.xml.sax.InputSource; public class JXPathFilterTestCase extends AbstractMuleTestCase { private String xmlStringInput = null; private String xmlStringInputNS = null; private org.dom4j.Document dom4jDocumentInput = null; private org.dom4j.Document dom4jDocumentInputNS = null; private org.w3c.dom.Document w3cDocumentInput = null; private org.w3c.dom.Document w3cDocumentInputNS = null; private JXPathFilter simpleFilter = null; private JXPathFilter nsAwareFilter = null; // @SuppressWarnings("unchecked") protected void doSetUp() throws Exception { final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); // Read No-Namespace Xml file InputStream is = currentClassLoader.getResourceAsStream("cdcatalog.xml"); assertNotNull("Test resource 'cdcatalog.xml' not found.", is); xmlStringInput = IOUtils.toString(is); dom4jDocumentInput = DocumentHelper.parseText(xmlStringInput); w3cDocumentInput = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( new InputSource(new StringReader(xmlStringInput))); simpleFilter = new JXPathFilter(); // Read Namespace Xml file is = currentClassLoader.getResourceAsStream("cdcatalogNS.xml"); assertNotNull("Test resource 'cdcatalogNS.xml' not found.", is); xmlStringInputNS = IOUtils.toString(is); dom4jDocumentInputNS = DocumentHelper.parseText(xmlStringInputNS); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); w3cDocumentInputNS = dbf.newDocumentBuilder().parse( new InputSource(new StringReader(xmlStringInputNS))); nsAwareFilter = new JXPathFilter(); Map namespaces = new HashMap(); namespaces.put("nsone", "http://one.org"); namespaces.put("nstwo", "http://two.org"); nsAwareFilter.setNamespaces(namespaces); } public void testBogusExpression() throws Exception { try { JXPathFilter myFilter = new JXPathFilter(); myFilter.setPattern("foo/bar/"); myFilter.accept(new DefaultMuleMessage(xmlStringInput)); fail("Invalid XPath should have thrown an exception"); } //Now we have Jaxen on the class path we get a Jaxen exception, but this is an unchecked exception catch (Exception e) { // expected } } private void doTestExpectedValueFilter(Object xmlData) throws Exception { simpleFilter.setPattern("catalog/cd[3]/title"); simpleFilter.setExpectedValue("Greatest Hits"); assertTrue(simpleFilter.accept(new DefaultMuleMessage(xmlData))); } private void doTestBooleanFilter1(Object xmlData) throws Exception { simpleFilter.setPattern("(catalog/cd[3]/title) ='Greatest Hits'"); assertTrue(simpleFilter.accept(new DefaultMuleMessage(xmlData))); } private void doTestBooleanFilter2(Object xmlData) throws Exception { simpleFilter.setPattern("count(catalog/cd) = 26"); assertTrue(simpleFilter.accept(new DefaultMuleMessage(xmlData))); } private void doTestExpectedValueFilterNS(Object xmlData) throws Exception { nsAwareFilter.setPattern("nsone:catalog/nstwo:cd[3]/title"); nsAwareFilter.setExpectedValue("Greatest Hits"); assertTrue(nsAwareFilter.accept(new DefaultMuleMessage(xmlData))); } private void doTestBooleanFilter1NS(Object xmlData) throws Exception { nsAwareFilter.setPattern("(nsone:catalog/nstwo:cd[3]/title) ='Greatest Hits'"); assertTrue(nsAwareFilter.accept(new DefaultMuleMessage(xmlData))); } private void doTestBooleanFilter2NS(Object xmlData) throws Exception { nsAwareFilter.setPattern("count(nsone:catalog/nstwo:cd) = 26"); assertTrue(nsAwareFilter.accept(new DefaultMuleMessage(xmlData))); } public void testFilterOnObject() throws Exception { Dummy d = new Dummy(); d.setId(10); d.setContent("hello"); simpleFilter.setPattern("id=10 and content='hello'"); assertTrue(simpleFilter.accept(new DefaultMuleMessage(d))); } public void testExpectedValueFilterXmlString() throws Exception { doTestExpectedValueFilter(xmlStringInput); } public void testExpectedValueFilterXmlByteArray() throws Exception { doTestExpectedValueFilter(xmlStringInput.getBytes()); } public void testBooleanFilter1XmlString() throws Exception { doTestBooleanFilter1(xmlStringInput); } public void testBooleanFilter2XmlString() throws Exception { doTestBooleanFilter2(xmlStringInput); } public void testExpectedValueFilterDom4JDocument() throws Exception { doTestExpectedValueFilter(dom4jDocumentInput); } public void testBooleanFilter1Dom4JDocument() throws Exception { doTestBooleanFilter1(dom4jDocumentInput); } public void testBooleanFilter2Dom4JDocument() throws Exception { doTestBooleanFilter2(dom4jDocumentInput); } public void testExpectedValueFilterW3cDocument() throws Exception { doTestExpectedValueFilter(w3cDocumentInput); } public void testBooleanFilter1W3cDocument() throws Exception { doTestBooleanFilter1(w3cDocumentInput); } public void testBooleanFilter2W3cDocument() throws Exception { doTestBooleanFilter2(w3cDocumentInput); } public void testExpectedValueFilterXmlStringNS() throws Exception { doTestExpectedValueFilterNS(xmlStringInputNS); } public void testBooleanFilter1XmlStringNS() throws Exception { doTestBooleanFilter1NS(xmlStringInputNS); } public void testBooleanFilter2XmlStringNS() throws Exception { doTestBooleanFilter2NS(xmlStringInputNS); } public void testExpectedValueFilterDom4JDocumentNS() throws Exception { doTestExpectedValueFilterNS(dom4jDocumentInputNS); } public void testBooleanFilter1Dom4JDocumentNS() throws Exception { doTestBooleanFilter1NS(dom4jDocumentInputNS); } public void testBooleanFilter2Dom4JDocumentNS() throws Exception { doTestBooleanFilter2NS(dom4jDocumentInputNS); } public void testExpectedValueFilterW3cDocumentNS() throws Exception { doTestExpectedValueFilterNS(w3cDocumentInputNS); } public void testBooleanFilter1W3cDocumentNS() throws Exception { doTestBooleanFilter1NS(w3cDocumentInputNS); } public void testBooleanFilter2W3cDocumentNS() throws Exception { doTestBooleanFilter2NS(w3cDocumentInputNS); } } mule-2.0.1/modules/xml/src/test/java/org/mule/routing/outbound/0000755000175000017500000000000011351411137024313 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/mule/routing/outbound/RoundRobinXmlSplitterTestCase.java0000644000175000017500000001647210763667515033140 0ustar charlescharles/* * $Id: RoundRobinXmlSplitterTestCase.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.module.xml.routing.RoundRobinXmlSplitter; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import org.mule.util.IOUtils; import com.mockobjects.constraint.Constraint; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.HashMap; import java.util.Map; import org.dom4j.Document; import org.dom4j.DocumentHelper; public class RoundRobinXmlSplitterTestCase extends AbstractMuleTestCase { private OutboundEndpoint endpoint1; private OutboundEndpoint endpoint2; private OutboundEndpoint endpoint3; private RoundRobinXmlSplitter xmlSplitter; // @Override protected void doSetUp() throws Exception { // setup endpoints endpoint1 = getTestOutboundEndpoint("Test1Endpoint", "test://endpointUri.1"); endpoint2 = getTestOutboundEndpoint("Test2Endpoint", "test://endpointUri.2"); endpoint3 = getTestOutboundEndpoint("Test3Endpoint", "test://endpointUri.3"); // setup splitter xmlSplitter = new RoundRobinXmlSplitter(); xmlSplitter.setValidateSchema(true); xmlSplitter.setExternalSchemaLocation("purchase-order.xsd"); // The xml document declares a default namespace, thus // we need to workaround it by specifying it both in // the namespaces and in the splitExpression Map namespaces = new HashMap(); namespaces.put("e", "http://www.example.com"); xmlSplitter.setSplitExpression("/e:purchaseOrder/e:items/e:item"); xmlSplitter.setNamespaces(namespaces); xmlSplitter.addEndpoint(endpoint1); xmlSplitter.addEndpoint(endpoint2); xmlSplitter.addEndpoint(endpoint3); } public void testStringPayloadXmlMessageSplitter() throws Exception { String payload = IOUtils.getResourceAsString("purchase-order2.xml", getClass()); internalTestSuccessfulXmlSplitter(payload); } public void testDom4JDocumentPayloadXmlMessageSplitter() throws Exception { String payload = IOUtils.getResourceAsString("purchase-order2.xml", getClass()); Document doc = DocumentHelper.parseText(payload); internalTestSuccessfulXmlSplitter(doc); } public void testByteArrayPayloadXmlMessageSplitter() throws Exception { String payload = IOUtils.getResourceAsString("purchase-order2.xml", getClass()); internalTestSuccessfulXmlSplitter(payload.getBytes()); } private void internalTestSuccessfulXmlSplitter(Object payload) throws Exception { Mock session = MuleTestUtils.getMockSession(); MuleMessage message = new DefaultMuleMessage(payload); assertTrue(xmlSplitter.isMatch(message)); final RoundRobinXmlSplitterTestCase.ItemNodeConstraint itemNodeConstraint = new RoundRobinXmlSplitterTestCase.ItemNodeConstraint(); session.expect("dispatchEvent", C.args(itemNodeConstraint, C.eq(endpoint1))); session.expect("dispatchEvent", C.args(itemNodeConstraint, C.eq(endpoint2))); session.expect("dispatchEvent", C.args(itemNodeConstraint, C.eq(endpoint3))); session.expect("dispatchEvent", C.args(itemNodeConstraint, C.eq(endpoint1))); xmlSplitter.route(message, (MuleSession)session.proxy(), false); session.verify(); message = new DefaultMuleMessage(payload); session.expectAndReturn("sendEvent", C.args(itemNodeConstraint, C.eq(endpoint1)), message); session.expectAndReturn("sendEvent", C.args(itemNodeConstraint, C.eq(endpoint2)), message); session.expectAndReturn("sendEvent", C.args(itemNodeConstraint, C.eq(endpoint3)), message); session.expectAndReturn("sendEvent", C.args(itemNodeConstraint, C.eq(endpoint1)), message); MuleMessage result = xmlSplitter.route(message, (MuleSession)session.proxy(), true); assertNotNull(result); assertEquals(message, result); session.verify(); } public void testXsdNotFoundThrowsException() throws Exception { final String invalidSchemaLocation = "non-existent.xsd"; Mock session = MuleTestUtils.getMockSession(); RoundRobinXmlSplitter splitter = new RoundRobinXmlSplitter(); splitter.setValidateSchema(true); splitter.setExternalSchemaLocation(invalidSchemaLocation); String payload = IOUtils.getResourceAsString("purchase-order.xml", getClass()); MuleMessage message = new DefaultMuleMessage(payload); assertTrue(splitter.isMatch(message)); try { splitter.route(message, (MuleSession)session.proxy(), false); fail("Should have thrown an exception, because XSD is not found."); } catch (IllegalArgumentException iaex) { assertTrue("Wrong exception?", iaex.getMessage().indexOf( "Couldn't find schema at " + invalidSchemaLocation) != -1); } session.verify(); } public void testUnsupportedTypePayloadIsIgnored() throws Exception { Exception unsupportedPayload = new Exception(); Mock session = MuleTestUtils.getMockSession(); MuleMessage message = new DefaultMuleMessage(unsupportedPayload); assertTrue(xmlSplitter.isMatch(message)); xmlSplitter.route(message, (MuleSession)session.proxy(), false); session.verify(); message = new DefaultMuleMessage(unsupportedPayload); MuleMessage result = xmlSplitter.route(message, (MuleSession)session.proxy(), true); assertNull(result); session.verify(); } public void testInvalidXmlPayloadThrowsException() throws Exception { Mock session = MuleTestUtils.getMockSession(); RoundRobinXmlSplitter splitter = new RoundRobinXmlSplitter(); MuleMessage message = new DefaultMuleMessage("This is not XML."); try { splitter.route(message, (MuleSession)session.proxy(), false); fail("No exception thrown."); } catch (IllegalArgumentException iaex) { assertTrue("Wrong exception message.", iaex.getMessage().startsWith( "Failed to initialise the payload: ")); } } private class ItemNodeConstraint implements Constraint { public boolean eval(Object o) { final MuleMessage message = (MuleMessage)o; final Object payload = message.getPayload(); assertTrue("Wrong class type for node.", payload instanceof Document); Document node = (Document)payload; final String partNumber = node.getRootElement().attributeValue("partNum"); return "872-AA".equals(partNumber) || "926-AA".equals(partNumber) || "126-AA".equals(partNumber) || "226-AA".equals(partNumber); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/modules/xml/src/test/java/org/mule/routing/outbound/FilteringXmlMessageSplitterTestCase.javamule-2.0.1/modules/xml/src/test/java/org/mule/routing/outbound/FilteringXmlMessageSplitterTestCase.j0000644000175000017500000001764510763667515033622 0ustar charlescharles/* * $Id: FilteringXmlMessageSplitterTestCase.java 11195 2008-03-06 04:13:01Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.module.xml.routing.FilteringXmlMessageSplitter; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import org.mule.util.IOUtils; import com.mockobjects.constraint.Constraint; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.HashMap; import java.util.Map; import org.dom4j.Document; import org.dom4j.DocumentHelper; public class FilteringXmlMessageSplitterTestCase extends AbstractMuleTestCase { private OutboundEndpoint endpoint1; private OutboundEndpoint endpoint2; private OutboundEndpoint endpoint3; private FilteringXmlMessageSplitter xmlSplitter; // @Override protected void doSetUp() throws Exception { // setup endpoints endpoint1 = getTestOutboundEndpoint("Test1Endpoint", "test://endpointUri.1"); endpoint2 = getTestOutboundEndpoint("Test2Endpoint", "test://endpointUri.2"); endpoint3 = getTestOutboundEndpoint("Test3Endpoint", "test://endpointUri.3"); // setup splitter xmlSplitter = new FilteringXmlMessageSplitter(); xmlSplitter.setValidateSchema(true); xmlSplitter.setExternalSchemaLocation("purchase-order.xsd"); // The xml document declares a default namespace, thus // we need to workaround it by specifying it both in // the namespaces and in the splitExpression Map namespaces = new HashMap(); namespaces.put("e", "http://www.example.com"); xmlSplitter.setSplitExpression("/e:purchaseOrder/e:items/e:item"); xmlSplitter.setNamespaces(namespaces); xmlSplitter.addEndpoint(endpoint1); xmlSplitter.addEndpoint(endpoint2); xmlSplitter.addEndpoint(endpoint3); } public void testStringPayloadXmlMessageSplitter() throws Exception { String payload = IOUtils.getResourceAsString("purchase-order.xml", getClass()); internalTestSuccessfulXmlSplitter(payload); } public void testStringPayloadXmlMessageSplitterWithoutXsd() throws Exception { xmlSplitter.setExternalSchemaLocation(null); xmlSplitter.setValidateSchema(false); String payload = IOUtils.getResourceAsString("purchase-order.xml", getClass()); internalTestSuccessfulXmlSplitter(payload); } public void testDom4JDocumentPayloadXmlMessageSplitter() throws Exception { String payload = IOUtils.getResourceAsString("purchase-order.xml", getClass()); Document doc = DocumentHelper.parseText(payload); internalTestSuccessfulXmlSplitter(doc); } public void testByteArrayPayloadXmlMessageSplitter() throws Exception { String payload = IOUtils.getResourceAsString("purchase-order.xml", getClass()); internalTestSuccessfulXmlSplitter(payload.getBytes()); } public void testByteArrayPayloadCorrelateNever() throws Exception { String payload = IOUtils.getResourceAsString("purchase-order.xml", getClass()); xmlSplitter.setEnableCorrelation(AbstractOutboundRouter.ENABLE_CORRELATION_NEVER); internalTestSuccessfulXmlSplitter(payload.getBytes()); } private void internalTestSuccessfulXmlSplitter(Object payload) throws Exception { Mock session = MuleTestUtils.getMockSession(); MuleMessage message = new DefaultMuleMessage(payload); assertTrue(xmlSplitter.isMatch(message)); final ItemNodeConstraint itemNodeConstraint = new ItemNodeConstraint(); session.expect("dispatchEvent", C.args(itemNodeConstraint, C.eq(endpoint1))); session.expect("dispatchEvent", C.args(itemNodeConstraint, C.eq(endpoint1))); xmlSplitter.route(message, (MuleSession)session.proxy(), false); session.verify(); message = new DefaultMuleMessage(payload); session.expectAndReturn("sendEvent", C.args(itemNodeConstraint, C.eq(endpoint1)), message); session.expectAndReturn("sendEvent", C.args(itemNodeConstraint, C.eq(endpoint1)), message); MuleMessage result = xmlSplitter.route(message, (MuleSession)session.proxy(), true); assertNotNull(result); assertEquals(message, result); session.verify(); } public void testXsdNotFoundThrowsException() throws Exception { final String invalidSchemaLocation = "non-existent.xsd"; Mock session = MuleTestUtils.getMockSession(); FilteringXmlMessageSplitter splitter = new FilteringXmlMessageSplitter(); splitter.setValidateSchema(true); splitter.setExternalSchemaLocation(invalidSchemaLocation); String payload = IOUtils.getResourceAsString("purchase-order.xml", getClass()); MuleMessage message = new DefaultMuleMessage(payload); assertTrue(splitter.isMatch(message)); try { splitter.route(message, (MuleSession)session.proxy(), false); fail("Should have thrown an exception, because XSD is not found."); } catch (IllegalArgumentException iaex) { assertTrue("Wrong exception?", iaex.getMessage().indexOf( "Couldn't find schema at " + invalidSchemaLocation) != -1); } session.verify(); } public void testUnsupportedTypePayloadIsIgnored() throws Exception { Exception unsupportedPayload = new Exception(); Mock session = MuleTestUtils.getMockSession(); MuleMessage message = new DefaultMuleMessage(unsupportedPayload); assertTrue(xmlSplitter.isMatch(message)); xmlSplitter.route(message, (MuleSession)session.proxy(), false); session.verify(); message = new DefaultMuleMessage(unsupportedPayload); MuleMessage result = xmlSplitter.route(message, (MuleSession)session.proxy(), true); assertNull(result); session.verify(); } public void testInvalidXmlPayloadThrowsException() throws Exception { Mock session = MuleTestUtils.getMockSession(); FilteringXmlMessageSplitter splitter = new FilteringXmlMessageSplitter(); MuleMessage message = new DefaultMuleMessage("This is not XML."); try { splitter.route(message, (MuleSession)session.proxy(), false); fail("No exception thrown."); } catch (IllegalArgumentException iaex) { assertTrue("Wrong exception message.", iaex.getMessage().startsWith( "Failed to initialise the payload: ")); } } private class ItemNodeConstraint implements Constraint { public boolean eval(Object o) { final MuleMessage message = (MuleMessage)o; final Object payload = message.getPayload(); assertTrue("Wrong class type for node.", payload instanceof Document); // MULE-2963 if (xmlSplitter.enableCorrelation == AbstractOutboundRouter.ENABLE_CORRELATION_NEVER) { assertEquals(-1, message.getCorrelationGroupSize()); } else { // the purchase order document contains two parts assertEquals(2, message.getCorrelationGroupSize()); } Document node = (Document) payload; final String partNumber = node.getRootElement().attributeValue("partNum"); return "872-AA".equals(partNumber) || "926-AA".equals(partNumber); } } } mule-2.0.1/modules/xml/src/test/java/org/mule/xml/0000755000175000017500000000000011351411136021564 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/mule/xml/util/0000755000175000017500000000000011351411136022541 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/java/org/mule/xml/util/properties/0000755000175000017500000000000011351411136024735 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/modules/xml/src/test/java/org/mule/xml/util/properties/JXPathExpressionEvaluatorTestCase.javamule-2.0.1/modules/xml/src/test/java/org/mule/xml/util/properties/JXPathExpressionEvaluatorTestCase.0000644000175000017500000000306710771035437033514 0ustar charlescharles/* * $Id: JXPathExpressionEvaluatorTestCase.java 11476 2008-03-21 22:47:59Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.xml.util.properties; import org.mule.DefaultMuleMessage; import org.mule.module.xml.expression.JXPathExpressionEvaluator; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Banana; import org.mule.tck.testmodels.fruit.FruitBowl; public class JXPathExpressionEvaluatorTestCase extends AbstractMuleTestCase { public void testWithExpressions() { Apple apple = new Apple(); apple.wash(); FruitBowl payload = new FruitBowl(apple, new Banana()); DefaultMuleMessage msg = new DefaultMuleMessage(payload); JXPathExpressionEvaluator e = new JXPathExpressionEvaluator(); Object value = e.evaluate("apple/washed", msg); assertNotNull(value); assertTrue(value instanceof Boolean); assertTrue(((Boolean)value).booleanValue()); value = e.evaluate("apple/washed", payload); assertNotNull(value); assertTrue(value instanceof Boolean); assertTrue(((Boolean)value).booleanValue()); value = e.evaluate("bar", msg); assertNull(value); } } mule-2.0.1/modules/xml/src/test/resources/0000755000175000017500000000000011351411140020317 5ustar charlescharlesmule-2.0.1/modules/xml/src/test/resources/purchase-order2.xml0000644000175000017500000000347110672263414024071 0ustar charlescharles Alice Smith 123 Maple Street Mill Valley CA 90952 Robert Smith 8 Oak Avenue Old Town PA 95819 Hurry, my lawn is going wild! Lawnmower 1 148.95 Confirm this is electric Baby Monitor 1 39.98 1999-05-21 Light Bulbs 6 5.99 1999-05-21 Chainsaw 1 239.98 1999-05-21 mule-2.0.1/modules/xml/src/test/resources/log4j.properties0000644000175000017500000000050210547540350023465 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages log4j.logger.org.mule=WARN mule-2.0.1/modules/xml/src/test/resources/cdcatalog-us-ascii.xml0000644000175000017500000000107410672263414024515 0ustar charlescharles De første kærester på månen TV-2 Danmark Columbia 149 2005 春のかたみ 元ちとせ Japan Sony Records 42 2006 mule-2.0.1/modules/xml/src/test/resources/cdcatalog.xml0000644000175000017500000001272610503622471023003 0ustar charlescharles Empire Burlesque Bob Dylan USA Columbia 10.90 1985 Hide your heart Bonnie Tyler UK CBS Records 9.90 1988 Greatest Hits Dolly Parton USA RCA 9.90 1982 Still got the blues Gary Moore UK Virgin records 10.20 1990 Eros Eros Ramazzotti EU BMG 9.90 1997 One night only Bee Gees UK Polydor 10.90 1998 Sylvias Mother Dr.Hook UK CBS 8.10 1973 Maggie May Rod Stewart UK Pickwick 8.50 1990 Romanza Andrea Bocelli EU Polydor 10.80 1996 When a man loves a woman Percy Sledge USA Atlantic 8.70 1987 Black angel Savage Rose EU Mega 10.90 1995 1999 Grammy Nominees Many USA Grammy 10.20 1999 For the good times Kenny Rogers UK Mucik Master 8.70 1995 Big Willie style Will Smith USA Columbia 9.90 1997 Tupelo Honey Van Morrison UK Polydor 8.20 1971 Soulsville Jorn Hoel Norway WEA 7.90 1996 The very best of Cat Stevens UK Island 8.90 1990 Stop Sam Brown UK A and M 8.90 1988 Bridge of Spies T`Pau UK Siren 7.90 1987 Private Dancer Tina Turner UK Capitol 8.90 1983 Midt om natten Kim Larsen EU Medley 7.80 1983 Pavarotti Gala Concert Luciano Pavarotti UK DECCA 9.90 1991 The dock of the bay Otis Redding USA Atlantic 7.90 1987 Picture book Simply Red EU Elektra 7.20 1985 Red The Communards UK London 7.80 1987 Unchain my heart Joe Cocker USA EMI 8.20 1987 mule-2.0.1/modules/xml/src/test/resources/purchase-order.xml0000644000175000017500000000261610503622471024002 0ustar charlescharles Alice Smith 123 Maple Street Mill Valley CA 90952 Robert Smith 8 Oak Avenue Old Town PA 95819 Hurry, my lawn is going wild! Lawnmower 1 148.95 Confirm this is electric Baby Monitor 1 39.98 1999-05-21 mule-2.0.1/modules/xml/src/test/resources/cdcatalogNS.xml0000644000175000017500000001334410505202223023230 0ustar charlescharles Empire Burlesque Bob Dylan USA Columbia 10.90 1985 Hide your heart Bonnie Tyler UK CBS Records 9.90 1988 Greatest Hits Dolly Parton USA RCA 9.90 1982 Still got the blues Gary Moore UK Virgin records 10.20 1990 Eros Eros Ramazzotti EU BMG 9.90 1997 One night only Bee Gees UK Polydor 10.90 1998 Sylvias Mother Dr.Hook UK CBS 8.10 1973 Maggie May Rod Stewart UK Pickwick 8.50 1990 Romanza Andrea Bocelli EU Polydor 10.80 1996 When a man loves a woman Percy Sledge USA Atlantic 8.70 1987 Black angel Savage Rose EU Mega 10.90 1995 1999 Grammy Nominees Many USA Grammy 10.20 1999 For the good times Kenny Rogers UK Mucik Master 8.70 1995 Big Willie style Will Smith USA Columbia 9.90 1997 Tupelo Honey Van Morrison UK Polydor 8.20 1971 Soulsville Jorn Hoel Norway WEA 7.90 1996 The very best of Cat Stevens UK Island 8.90 1990 Stop Sam Brown UK A and M 8.90 1988 Bridge of Spies T`Pau UK Siren 7.90 1987 Private Dancer Tina Turner UK Capitol 8.90 1983 Midt om natten Kim Larsen EU Medley 7.80 1983 Pavarotti Gala Concert Luciano Pavarotti UK DECCA 9.90 1991 The dock of the bay Otis Redding USA Atlantic 7.90 1987 Picture book Simply Red EU Elektra 7.20 1985 Red The Communards UK London 7.80 1987 Unchain my heart Joe Cocker USA EMI 8.20 1987 mule-2.0.1/modules/xml/src/test/resources/cdcatalog.xsl0000644000175000017500000000125610744144266023015 0ustar charlescharles

    My CD Collection

    Title Artist
    mule-2.0.1/modules/xml/src/test/resources/cdcatalog-echo.xsl0000644000175000017500000000040610744144266023725 0ustar charlescharles mule-2.0.1/modules/xml/src/test/resources/simple.xml0000644000175000017500000000007410672263414022351 0ustar charlescharles testing mule-2.0.1/modules/xml/src/test/resources/parameter-echo.xsl0000644000175000017500000000043610757302635023767 0ustar charlescharles mule-2.0.1/modules/xml/src/test/resources/purchase-order.xsd0000644000175000017500000000553610503622471024004 0ustar charlescharles Purchase order schema for Example.com. Copyright 2000 Example.com. All rights reserved. mule-2.0.1/modules/xml/src/test/resources/cdcatalog.html0000644000175000017500000000277710503622471023154 0ustar charlescharles

    My CD Collection

    TitleArtist
    Empire BurlesqueBob Dylan
    Hide your heartBonnie Tyler
    Greatest HitsDolly Parton
    Still got the bluesGary Moore
    ErosEros Ramazzotti
    One night onlyBee Gees
    Sylvias MotherDr.Hook
    Maggie MayRod Stewart
    RomanzaAndrea Bocelli
    When a man loves a womanPercy Sledge
    Black angelSavage Rose
    1999 Grammy NomineesMany
    For the good timesKenny Rogers
    Big Willie styleWill Smith
    Tupelo HoneyVan Morrison
    SoulsvilleJorn Hoel
    The very best ofCat Stevens
    StopSam Brown
    Bridge of SpiesT`Pau
    Private DancerTina Turner
    Midt om nattenKim Larsen
    Pavarotti Gala ConcertLuciano Pavarotti
    The dock of the bayOtis Redding
    Picture bookSimply Red
    RedThe Communards
    Unchain my heartJoe Cocker
    mule-2.0.1/modules/xml/src/test/resources/cdcatalog-utf-8.xml0000644000175000017500000000077510672263414023752 0ustar charlescharles De første kærester på månen TV-2 Danmark Columbia 149 2005 春のかたみ 元ちとせ Japan Sony Records 42 2006 mule-2.0.1/modules/xml/src/test/resources/cdcatalog-esoteric.xml0000644000175000017500000000150510672263414024614 0ustar charlescharles De første kærester på månen TV-2 Danmark Columbia 149 2005 春のかたみ 元ちとせ Japan Sony Records 42 2006 𠁞𠁟 𠚃 China CJK Unified Ideographs Extension B Records 100042 2007 mule-2.0.1/modules/xml/src/test/resources/cdcatalog-esoteric-us-ascii.xml0000644000175000017500000000162210672263414026327 0ustar charlescharles De første kærester på månen TV-2 Danmark Columbia 149 2005 春のかたみ 元ちとせ Japan Sony Records 42 2006 𠁞𠁟 𠚃 China CJK Unified Ideographs Extension B Records 100042 2007 mule-2.0.1/modules/xml/src/test/resources/cdcatalog-utf-8.html0000644000175000017500000000047210503622471024103 0ustar charlescharles

    My CD Collection

    TitleArtist
    De første kærester på månenTV-2
    春のかたみ元ちとせ
    mule-2.0.1/modules/xml/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000006210767262171025211 0ustar charlescharles# # Test cases listed in this file are not run. # mule-2.0.1/modules/xml/src/test/resources/simple-out.xml0000644000175000017500000000012110672263414023147 0ustar charlescharles testing mule-2.0.1/modules/xml/pom.xml0000644000175000017500000001350311006063605016064 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-xml XML Extensions Functionality for working with XML osgi org.apache.felix maven-bundle-plugin org.mule.transformer.xml, org.mule.routing.filters.xml org.mule mule-core ${version} org.mule mule-core ${version} test test-jar org.mule.modules mule-module-spring-config ${version} provided dom4j dom4j commons-jxpath commons-jxpath 1.2 commons-collections commons-collections commons-beanutils commons-beanutils commons-logging commons-logging xml-apis xml-apis xerces xerces ant ant-optional jdom jdom javax.servlet servlet-api junit junit com.thoughtworks.xstream xstream 1.2.1 xpp3 xpp3_min 1.1.3.4.O stax stax-api 1.0.1 org.codehaus.woodstox wstx-asl 3.2.2 jaxen jaxen xmlunit xmlunit 1.1 test javax.activation activation provided mule-2.0.1/modules/jaas/0000755000175000017500000000000011351411163014662 5ustar charlescharlesmule-2.0.1/modules/jaas/src/0000755000175000017500000000000011351411163015451 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/0000755000175000017500000000000011351411163016375 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/java/0000755000175000017500000000000011351411163017316 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/java/org/0000755000175000017500000000000011351411163020105 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/java/org/mule/0000755000175000017500000000000011351411163021047 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/java/org/mule/module/0000755000175000017500000000000011351411163022334 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/0000755000175000017500000000000011351411163023252 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/JaasSecurityContext.java0000644000175000017500000000241510754375733030114 0ustar charlescharles/* * $Id: JaasSecurityContext.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; public class JaasSecurityContext implements SecurityContext { private JaasAuthentication authentication; /** * Constructor for the class * * @param authentication */ public JaasSecurityContext(JaasAuthentication authentication) { this.authentication = authentication; } /** * Returns the authentication * * @return authentication */ public final Authentication getAuthentication() { return authentication; } /** * Sets the Authentication * * @param authentication */ public final void setAuthentication(Authentication authentication) { this.authentication = (JaasAuthentication) authentication; } } mule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/JaasAuthentication.java0000644000175000017500000000335510754375733027723 0ustar charlescharles/* * $Id: JaasAuthentication.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas; import org.mule.api.security.Authentication; import org.mule.api.security.Credentials; import java.util.Map; import javax.security.auth.Subject; public class JaasAuthentication implements Authentication { private boolean authenticated; private char[] credentials; private String user; private Map properties; private Subject subject; public JaasAuthentication(Credentials credentials) { this.user = credentials.getUsername(); this.credentials = credentials.getPassword(); } public JaasAuthentication(Object user, Object credentials, Subject subject) { this.user = (String) user; this.credentials = ((String) credentials).toCharArray(); this.subject = subject; } public void setAuthenticated(boolean b) { authenticated = b; } public boolean isAuthenticated() { return authenticated; } public Object getCredentials() { return new String(credentials); } public Object getPrincipal() { return user; } public Map getProperties() { return properties; } public void setProperties(Map properties) { this.properties = properties; } public Subject getSubject() { return subject; } } mule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/config/0000755000175000017500000000000011351411163024517 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/config/JaasNamespaceHandler.java0000644000175000017500000000302610754375733031376 0ustar charlescharles/* * $Id: JaasNamespaceHandler.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas.config; import org.mule.api.config.MuleProperties; import org.mule.config.spring.parsers.generic.ChildDefinitionParser; import org.mule.config.spring.parsers.generic.NamedDefinitionParser; import org.mule.module.jaas.JaasSimpleAuthenticationProvider; import org.mule.module.jaas.filters.JaasSecurityFilter; import org.mule.security.PasswordBasedEncryptionStrategy; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; public class JaasNamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("security-manager", new NamedDefinitionParser(MuleProperties.OBJECT_SECURITY_MANAGER)); registerBeanDefinitionParser("security-provider", new ChildDefinitionParser("provider", JaasSimpleAuthenticationProvider.class)); registerBeanDefinitionParser("password-encryption-strategy", new ChildDefinitionParser("encryptionStrategy", PasswordBasedEncryptionStrategy.class)); registerBeanDefinitionParser("jaas-security-filter", new ChildDefinitionParser("securityFilter", JaasSecurityFilter.class)); } } mule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/MuleCallbackHandler.java0000644000175000017500000000442510754375733027761 0ustar charlescharles/* * $Id: MuleCallbackHandler.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas; import org.mule.api.security.Authentication; import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; public class MuleCallbackHandler implements CallbackHandler { private Authentication authentication; private String username; private String password; /** * @param authentication */ public MuleCallbackHandler(Authentication authentication) { this.authentication = authentication; this.username = (String) this.authentication.getPrincipal(); this.password = (String) this.authentication.getCredentials(); } /** * The handle() method handles the callbacks to be passed to the Jaas security. * It makes use of two types of callbacks: the NameCallback and the * PasswordCallback. * * @param callbacks * @throws IOException * @throws UnsupportedCallbackException */ public final void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof NameCallback) { NameCallback nameCb = (NameCallback) callbacks[i]; nameCb.setName(username); } else if (callbacks[i] instanceof PasswordCallback) { PasswordCallback passCb = (PasswordCallback) callbacks[i]; passCb.setPassword(password.toCharArray()); } else { throw (new UnsupportedCallbackException(callbacks[i], "Callback class not supported")); } } } } mule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/filters/0000755000175000017500000000000011351411163024722 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/filters/JaasSecurityFilter.java0000644000175000017500000001075310754375733031371 0ustar charlescharles/* * $Id: JaasSecurityFilter.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas.filters; import org.mule.api.MuleEvent; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.CredentialsNotSetException; import org.mule.api.security.CryptoFailureException; import org.mule.api.security.EncryptionStrategyNotFoundException; import org.mule.api.security.SecurityException; import org.mule.api.security.SecurityProviderNotFoundException; import org.mule.api.security.Authentication; import org.mule.api.security.Credentials; import org.mule.api.security.SecurityContext; import org.mule.api.security.UnauthorisedException; import org.mule.api.security.UnknownAuthenticationTypeException; import org.mule.config.i18n.CoreMessages; import org.mule.module.jaas.JaasAuthentication; import org.mule.security.AbstractEndpointSecurityFilter; import org.mule.security.MuleCredentials; import org.mule.security.MuleHeaderCredentialsAccessor; public class JaasSecurityFilter extends AbstractEndpointSecurityFilter { public JaasSecurityFilter() { setCredentialsAccessor(new MuleHeaderCredentialsAccessor()); } protected final void authenticateInbound(MuleEvent event) throws SecurityException, CryptoFailureException, EncryptionStrategyNotFoundException, UnknownAuthenticationTypeException { String userHeader = (String) getCredentialsAccessor().getCredentials(event); if (userHeader == null) { throw new CredentialsNotSetException(event.getMessage(), event.getSession().getSecurityContext(), event.getEndpoint(), this); } Credentials user = new MuleCredentials(userHeader, getSecurityManager()); Authentication authResult; Authentication umoAuthentication = new JaasAuthentication(user); try { authResult = getSecurityManager().authenticate(umoAuthentication); } catch (SecurityException se) { // Security Exception occurred if (logger.isDebugEnabled()) { logger.debug("Security Exception raised. Authentication request for user: " + user.getUsername() + " failed: " + se.toString()); } throw se; } catch (Exception e) { // Authentication failed if (logger.isDebugEnabled()) { logger.debug("Authentication request for user: " + user.getUsername() + " failed: " + e.toString()); } throw new UnauthorisedException(CoreMessages.authFailedForUser(user.getUsername()), event.getMessage(), e); } // Authentication success if (logger.isDebugEnabled()) { logger.debug("Authentication success: " + authResult.toString()); } SecurityContext context = getSecurityManager().createSecurityContext(authResult); context.setAuthentication(authResult); event.getSession().setSecurityContext(context); } protected void authenticateOutbound(MuleEvent event) throws SecurityException, SecurityProviderNotFoundException, CryptoFailureException { if (event.getSession().getSecurityContext() == null) { if (isAuthenticate()) { throw new UnauthorisedException(event.getMessage(), event.getSession().getSecurityContext(), event.getEndpoint(), this); } else { return; } } Authentication auth = event.getSession().getSecurityContext().getAuthentication(); if (isAuthenticate()) { auth = getSecurityManager().authenticate(auth); if (logger.isDebugEnabled()) { logger.debug("Authentication success: " + auth.toString()); } } String token = auth.getCredentials().toString(); getCredentialsAccessor().setCredentials(event, token); } protected void doInitialise() throws InitialisationException { // empty constructor } } mule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/JaasSecurityContextFactory.java0000644000175000017500000000176410754375733031452 0ustar charlescharles/* * $Id: JaasSecurityContextFactory.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; import org.mule.api.security.SecurityContextFactory; public class JaasSecurityContextFactory implements SecurityContextFactory { /** * Creates the Jaas Security Context * * @param authentication * @return JaasSecurityContext((Authentication) authentication) */ public final SecurityContext create(Authentication authentication) { return new JaasSecurityContext((JaasAuthentication) authentication); } } mule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/loginmodule/0000755000175000017500000000000011351411163025570 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/loginmodule/DefaultLoginModule.java0000644000175000017500000002110410754375733032176 0ustar charlescharles/* * $Id: DefaultLoginModule.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas.loginmodule; import org.mule.module.jaas.MuleJaasPrincipal; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Vector; import javax.security.auth.Subject; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.NameCallback; import javax.security.auth.callback.PasswordCallback; import javax.security.auth.callback.UnsupportedCallbackException; import javax.security.auth.login.FailedLoginException; import javax.security.auth.login.LoginException; import javax.security.auth.spi.LoginModule; /** * This is the Default Login Module for the Mule Jaas Authentication. * It extends Jaas' own LoginModule interface. */ public class DefaultLoginModule implements LoginModule { // Callback Handlers private CallbackHandler callbackHandler; // the authentication status private boolean succeeded = false; private boolean commitSucceeded = false; // username and password private String username; private String password; private String credentials; private List credentialList; private Subject subject; /** * Abort if authentication fails * * @return boolean * @throws LoginException */ public final boolean abort() throws LoginException { if (!succeeded) { return false; } else if (succeeded && !commitSucceeded) { // login succeeded but overall authentication failed succeeded = false; username = null; if (password != null) { password = null; } } else { // overall authentication succeeded and commit succeeded, // but someone else's commit failed logout(); } return true; } /** * Commit if authentication succeeds, otherwise return false * * @return boolean * @throws LoginException */ public final boolean commit() throws LoginException { if (!succeeded) { return false; } else { // set the principal just authenticated in the subject if (subject == null) { return false; } MuleJaasPrincipal principal = new MuleJaasPrincipal(username); Set entities = subject.getPrincipals(); if (!entities.contains(principal)) { entities.add(principal); } // in any case, clean out state username = null; password = null; commitSucceeded = true; return true; } } /** * Initialises the callbackHandler, the credentials and the credentials list * * @param subject * @param callbackHandler * @param sharedState * @param options */ public final void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { this.subject = subject; this.callbackHandler = callbackHandler; this.credentials = (String) options.get("credentials"); this.credentialList = getCredentialList(this.credentials); } /** * This method attempts to login the user by checking his credentials against * those of the authorised users. * * @throws LoginException This is thrown either when there is no callback Handler * or else when the user fails to be authenticated */ public final boolean login() throws LoginException { if (callbackHandler == null) { throw new LoginException("Error: no CallbackHandler available " + "to garner authentication information from the user"); } if (callbackHandler == null) { throw new LoginException("no handler"); } NameCallback nameCb = new NameCallback("user: "); PasswordCallback passCb = new PasswordCallback("password: ", true); // Create the callbacks to send to the Callback Handler Callback[] callbacks = new Callback[]{nameCb, passCb}; // Call the handler to get the username and password of the user. try { callbackHandler.handle(callbacks); } catch (IOException e) { throw new LoginException(e.toString()); } catch (UnsupportedCallbackException e) { throw new LoginException("Error: " + e.getCallback().toString() + " not available to garner authentication information " + "from the user"); } username = nameCb.getName(); password = new String(passCb.getPassword()); boolean usernameCorrect = false; boolean passwordCorrect = false; succeeded = false; // check the username and password against the list of authorised users for (int i = 0; i < credentialList.size(); i = i + 2) { if (username.equals(credentialList.get(i).toString())) { usernameCorrect = true; } else { usernameCorrect = false; } if (password.equals(credentialList.get(i + 1).toString())) { passwordCorrect = true; } else { passwordCorrect = false; } // only if both the username and password are correct will the user be // authenticated if ((usernameCorrect) & (passwordCorrect)) { succeeded = true; } } if (succeeded) { return true; } else { succeeded = false; username = null; password = null; if (!usernameCorrect) { throw new FailedLoginException("User Name Incorrect"); } else { throw new FailedLoginException("Password Incorrect"); } } } /** * Returns true when authentication succeeds or false when it fails * * @return succeeded */ public final boolean logout() { return succeeded; } /** * This method parses the credentials string and populates the credentials list * against which the username and password submitted with the request will be * checked * * @param credentials * @return outputList */ public final List getCredentialList(String credentials) { boolean semicolonIsFound = false; boolean dividerIsFound = false; char[] credentialArray = credentials.toCharArray(); String username = ""; String password = ""; List outputList = new Vector(); for (int i = 0; i < credentials.length(); i++) { if ((credentialArray[i] != ':') && (!dividerIsFound)) { username = username + credentialArray[i]; } else if ((credentialArray[i] == ':') && (!dividerIsFound)) { dividerIsFound = true; } else if ((credentialArray[i] != ';') && (!semicolonIsFound) && (dividerIsFound)) { password = password + credentialArray[i]; } else if ((credentialArray[i] != ';') && (!semicolonIsFound) && (dividerIsFound)) { password = password + credentialArray[i]; } else if ((credentialArray[i] == ';') && (!semicolonIsFound) && (dividerIsFound)) { outputList.add(username); outputList.add(password); semicolonIsFound = false; dividerIsFound = false; username = ""; password = ""; } } return outputList; } } mule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/MuleJaasPrincipal.java0000644000175000017500000000170010754375733027500 0ustar charlescharles/* * $Id: MuleJaasPrincipal.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas; import java.security.Principal; public class MuleJaasPrincipal implements Principal { private final String name; public MuleJaasPrincipal(String name) { if (name == null) { throw new IllegalArgumentException("Null name"); } this.name = name; } public String getName() { return name; } public String toString() { return name; } public int hasCode() { return name.hashCode(); } } mule-2.0.1/modules/jaas/src/main/java/org/mule/module/jaas/JaasSimpleAuthenticationProvider.java0000644000175000017500000002561410774254333032604 0ustar charlescharles/* * $Id: JaasSimpleAuthenticationProvider.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; import org.mule.api.security.SecurityContextFactory; import org.mule.api.security.SecurityProvider; import org.mule.api.security.UnauthorisedException; import org.mule.api.security.UnknownAuthenticationTypeException; import org.mule.config.i18n.CoreMessages; import java.io.IOException; import java.security.Security; import java.util.HashMap; import java.util.Map; import javax.security.auth.Subject; import javax.security.auth.login.AppConfigurationEntry; import javax.security.auth.login.Configuration; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; /** * This is the Provider for Mule's Jaas Security. */ public class JaasSimpleAuthenticationProvider implements SecurityProvider { private String loginConfig; private String loginContextName; private String credentials; private String loginModule; private String defaultModule = "org.mule.module.jaas.loginmodule.DefaultLoginModule"; private String name; private SecurityContextFactory factory; // ~ Getters and Setters // ================================================================ /** * Sets the login Configuration * * @param loginConfig */ public final void setLoginConfig(String loginConfig) { this.loginConfig = loginConfig; } /** * Gets the Login Configuration * * @return loginConfig */ public final String getLoginConfig() { return loginConfig; } /** * Sets the Login Context name * * @param loginContextName */ public final void setLoginContextName(String loginContextName) { this.loginContextName = loginContextName; } /** * Gets the Login Context Name * * @return loginContextName */ public final String getLoginContextName() { return loginContextName; } /** * Gets the user's credentials, i.e. the username and password * * @return credentials */ public final String getCredentials() { return credentials; } /** * Sets the user's credentials. * * @param credentials */ public final void setCredentials(String credentials) { this.credentials = credentials; } /** * Gets the login module name * * @return loginModule */ public final String getLoginModule() { return loginModule; } /** * sets the login module name * * @param loginModule */ public final void setLoginModule(String loginModule) { this.loginModule = loginModule; } /** @return name */ public final String getName() { return name; } /** @param name */ public final void setName(String name) { this.name = name; } // ~ Methods ================================================================ /** * @throws IOException The configureJaas method gets the resource path of the * jaas configuration file and constructs the URL for the login * configuration. */ private void configureJaas() throws IOException { String loginConfigUrl = "file://" + org.mule.util.FileUtils.getResourcePath(loginConfig, JaasSimpleAuthenticationProvider.class); boolean alreadySet = false; int n = 1; String prefix = "login.config.url."; String existing = null; while ((existing = Security.getProperty(prefix + n)) != null) { alreadySet = existing.equals(loginConfigUrl); if (alreadySet) { break; } n++; } if (!alreadySet) { String key = prefix + n; Security.setProperty(key, loginConfigUrl); } } /** * The authenticate method first creates the jaas Login Context using the * callback handler and the name of the class or directory to prtect. If the * Login Context is successfully created, it will then attempt to login. * * @return Authentication * @throws org.mule.api.security.SecurityException * */ public final Authentication authenticate(Authentication authentication) throws org.mule.api.security.SecurityException { LoginContext loginContext; JaasAuthentication auth = (JaasAuthentication)authentication; // Create the Mule Callback Handler MuleCallbackHandler cbh = new MuleCallbackHandler(auth); // Create the LoginContext object, and pass it to the CallbackHandler try { if (auth.getSubject() != null) { loginContext = new LoginContext(loginContextName,auth.getSubject(), cbh); } else { loginContext = new LoginContext(loginContextName, cbh); } } catch (LoginException e) { throw new org.mule.api.security.UnauthorisedException( CoreMessages.cannotLoadFromClasspath(loginContextName)); } // Attempt to login the user try { loginContext.login(); } catch (LoginException le) { le.fillInStackTrace(); throw new UnauthorisedException(CoreMessages.authFailedForUser(auth.getPrincipal())); } Subject subject = loginContext.getSubject(); JaasAuthentication finalAuth = new JaasAuthentication(auth.getPrincipal(), auth.getCredentials(),subject); finalAuth.setAuthenticated(true); return finalAuth; } /** * checks whether the class is supported. * * @param aClass * @return */ public final boolean supports(Class aClass) { return Authentication.class.isAssignableFrom(aClass); } /** * @return * @throws UnknownAuthenticationTypeException * This occurs when the Security * Factory cannot be created */ public final SecurityContext createSecurityContext(Authentication auth) throws UnknownAuthenticationTypeException { return factory.create(auth); } /** * The initialise method checks whether a jaas configuration file exists. If it * exists, it will call the configureJaas() method to create the context URL of * that file. If such a configuration file is not present, it will then try to * configure jaas programmatically. It also attempts to create the * JaasSecurityContextFactory. * * @throws InitialisationException */ public final void initialise() throws InitialisationException { // configure jaas from properties passed to the provider from the Mule XML // configuration file if (loginConfig == null) { try { AppConfigurationEntry entry = null; JaasConfig.init(); HashMap options = new HashMap(); options.put("credentials", credentials); // if a custom login module is not found, it will use the Default // Login Module if (loginModule != null) { entry = new AppConfigurationEntry(loginModule, AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options); } else { entry = new AppConfigurationEntry(defaultModule, AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options); } JaasConfig.addApplicationConfigEntry(loginContextName, entry); } catch (Exception e) { throw new InitialisationException(e, this); } } else { // configure jaas from a jaas configuration file try { configureJaas(); } catch (IOException e) { throw new InitialisationException(e, this); } } // create the Jaas SecurityContext Factory try { factory = new JaasSecurityContextFactory(); } catch (Exception e) { throw new InitialisationException(CoreMessages.failedToCreate("JaasProvider"), e, this); } } /** * The JaasConfig class extends the Jaas Configuration in order to be able to * configure the jaas security programmatically. */ public static class JaasConfig extends Configuration { private static Map appConfigEntries = new HashMap(); private static JaasConfig jaasConfig; /** Initializes and sets the Jaas Configuration */ public static void init() { jaasConfig = new JaasConfig(); Configuration.setConfiguration(jaasConfig); } /** * Returns the Jas Configuration * * @return jaasConfig */ public static JaasConfig getJaasConfig() { return jaasConfig; } /** * Adds the Configuration Entries * * @param name * @param entry */ public static void addApplicationConfigEntry(String name, AppConfigurationEntry entry) { appConfigEntries.put(name, entry); } /** * Gets the configuration entries using the application Name * * @param applicationName * @return */ public final AppConfigurationEntry[] getAppConfigurationEntry(String applicationName) { if (applicationName == null) { throw new IllegalArgumentException("applicationName passed in was null."); } AppConfigurationEntry entry = (AppConfigurationEntry) appConfigEntries.get(applicationName); if (entry == null) { return new AppConfigurationEntry[]{}; } else { AppConfigurationEntry e[] = new AppConfigurationEntry[1]; e[0] = entry; return e; } } public void refresh() { // Nothing to do here } } } mule-2.0.1/modules/jaas/src/main/resources/0000755000175000017500000000000011351411163020407 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/resources/META-INF/0000755000175000017500000000000011351411163021547 5ustar charlescharlesmule-2.0.1/modules/jaas/src/main/resources/META-INF/MANIFEST.MF0000644000175000017500000000000010553776311023203 0ustar charlescharlesmule-2.0.1/modules/jaas/src/main/resources/META-INF/spring.schemas0000644000175000017500000000012510644431014024415 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/jaas/2.0/mule-jaas.xsd=META-INF/mule-jaas.xsd mule-2.0.1/modules/jaas/src/main/resources/META-INF/mule-jaas.xsd0000644000175000017500000000532410716342245024161 0ustar charlescharles This is the security provider type that is used to configure JAAS related functionality. This appears to authenticate users via information in standard HTTP headers. mule-2.0.1/modules/jaas/src/main/resources/META-INF/spring.handlers0000644000175000017500000000014110754375733024611 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/jaas/2.0=org.mule.module.jaas.config.JaasNamespaceHandler mule-2.0.1/modules/jaas/src/test/0000755000175000017500000000000011351411162016427 5ustar charlescharlesmule-2.0.1/modules/jaas/src/test/java/0000755000175000017500000000000011351411162017350 5ustar charlescharlesmule-2.0.1/modules/jaas/src/test/java/org/0000755000175000017500000000000011351411162020137 5ustar charlescharlesmule-2.0.1/modules/jaas/src/test/java/org/mule/0000755000175000017500000000000011351411162021101 5ustar charlescharlesmule-2.0.1/modules/jaas/src/test/java/org/mule/module/0000755000175000017500000000000011351411162022366 5ustar charlescharlesmule-2.0.1/modules/jaas/src/test/java/org/mule/module/jaas/0000755000175000017500000000000011351411162023304 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/modules/jaas/src/test/java/org/mule/module/jaas/JaasAutenticationWithJaasConfigFileTestCase.javamule-2.0.1/modules/jaas/src/test/java/org/mule/module/jaas/JaasAutenticationWithJaasConfigFileTestCa0000644000175000017500000001204710763522057033342 0ustar charlescharles/* * $Id: JaasAutenticationWithJaasConfigFileTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas; import org.mule.api.EncryptionStrategy; import org.mule.api.ExceptionPayload; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.security.MuleCredentials; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class JaasAutenticationWithJaasConfigFileTestCase extends FunctionalTestCase { public void testCaseGoodAuthentication() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("Marie.Rizzo", "dragon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Test", props); assertNotNull(m); assertTrue(m.getPayload() instanceof String); assertTrue(m.getPayloadAsString().equals("Test Received")); } public void testCaseDifferentGoodAuthentication() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("anon", "anon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Test", props); assertNotNull(m); assertTrue(m.getPayload() instanceof String); assertTrue(m.getPayloadAsString().equals("Test Received")); } public void testCaseWrongCombinationOfCorrectUsernameAndPassword() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("Marie.Rizzo", "anon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Test", props); assertNotNull(m); assertTrue(m.getPayload() instanceof String); assertFalse(m.getPayloadAsString().equals("Test Received")); //assert exception ExceptionPayload exceptionPayload = m.getExceptionPayload(); assertNotNull(exceptionPayload); assertEquals("Authentication failed for principal Marie.Rizzo. Message payload is of type: String", exceptionPayload.getMessage()); } public void testCaseBadUserName() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("Evil", "dragon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Test", props); assertNotNull(m); assertTrue(m.getPayload() instanceof String); assertFalse(m.getPayloadAsString().equals("Test Received")); //assert exception ExceptionPayload exceptionPayload = m.getExceptionPayload(); assertNotNull(exceptionPayload); assertEquals("Authentication failed for principal Evil. Message payload is of type: String", exceptionPayload.getMessage()); } public void testCaseBadPassword() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("Marie.Rizzo", "evil", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Test", props); assertNotNull(m); assertTrue(m.getPayload() instanceof String); assertFalse(m.getPayloadAsString().equals("Test Received")); //assert exception ExceptionPayload exceptionPayload = m.getExceptionPayload(); assertNotNull(exceptionPayload); assertEquals("Authentication failed for principal Marie.Rizzo. Message payload is of type: String", exceptionPayload.getMessage()); } protected String getConfigResources() { return "mule-conf-for-jaas-conf-file.xml"; } } mule-2.0.1/modules/jaas/src/test/java/org/mule/module/jaas/JaasNamespaceHandlerTestCase.java0000644000175000017500000000463610754375733031630 0ustar charlescharles/* * $Id: JaasNamespaceHandlerTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas; import org.mule.api.EncryptionStrategy; import org.mule.api.security.SecurityManager; import org.mule.api.security.SecurityProvider; import org.mule.security.PasswordBasedEncryptionStrategy; import org.mule.tck.FunctionalTestCase; public class JaasNamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { return "jaas-namespace-config.xml"; } public void testJaasProvider() { knownProperties(getProvider("jaasSecurityProvider")); } public void testPasswordBasedEncryption() { knownProperties(getEncryptionStrategy("PBE")); } protected SecurityProvider getProvider(String name) { SecurityManager securityManager = muleContext.getSecurityManager(); return securityManager.getProvider(name); } protected void knownProperties(SecurityProvider provider) { assertNotNull(provider); assertTrue(provider instanceof JaasSimpleAuthenticationProvider); JaasSimpleAuthenticationProvider jaasProvider = (JaasSimpleAuthenticationProvider) provider; assertNotNull(jaasProvider.getLoginContextName()); assertEquals("jaasTest", jaasProvider.getLoginContextName()); assertNotNull(jaasProvider.getLoginConfig()); assertEquals("jaas.conf", jaasProvider.getLoginConfig()); } protected EncryptionStrategy getEncryptionStrategy(String name) { SecurityManager securityManager = muleContext.getSecurityManager(); return securityManager.getEncryptionStrategy(name); } protected void knownProperties(EncryptionStrategy encryptionStrategy) { assertNotNull(encryptionStrategy); assertTrue(encryptionStrategy instanceof PasswordBasedEncryptionStrategy); PasswordBasedEncryptionStrategy pbe = (PasswordBasedEncryptionStrategy) encryptionStrategy; assertNotNull(pbe.getName()); assertEquals("PBE", pbe.getName()); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmule-2.0.1/modules/jaas/src/test/java/org/mule/module/jaas/JaasAuthenticationNoJaasConfigFileTestCase.javamule-2.0.1/modules/jaas/src/test/java/org/mule/module/jaas/JaasAuthenticationNoJaasConfigFileTestCas0000644000175000017500000001165610763522057033343 0ustar charlescharles/* * $Id: JaasAuthenticationNoJaasConfigFileTestCase.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas; import org.mule.api.EncryptionStrategy; import org.mule.api.ExceptionPayload; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.security.MuleCredentials; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class JaasAuthenticationNoJaasConfigFileTestCase extends FunctionalTestCase { public void assertExceptionPayload(MuleMessage umoMessage, String exceptionMessage) { assertNotNull(umoMessage.getExceptionPayload()); ExceptionPayload exceptionPayload = umoMessage.getExceptionPayload(); assertNotNull(exceptionPayload); assertEquals(exceptionMessage, exceptionPayload.getMessage()); } public void testCaseGoodAuthentication() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("Marie.Rizzo", "dragon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Test", props); assertNotNull(m); assertTrue(m.getPayload() instanceof String); assertTrue(m.getPayloadAsString().equals("Test Received")); } public void testCaseDifferentGoodAuthentication() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("anon", "anon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Test", props); assertNotNull(m); assertTrue(m.getPayload() instanceof String); assertTrue(m.getPayloadAsString().equals("Test Received")); } public void testCaseWrongCombinationOfCorrectUsernameAndPassword() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("Marie.Rizzo", "anon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Test", props); assertNotNull(m); assertTrue(m.getPayload() instanceof String); assertFalse(m.getPayloadAsString().equals("Test Received")); assertExceptionPayload(m, "Authentication failed for principal Marie.Rizzo. Message payload is of type: String"); } public void testCaseBadUserName() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("Evil", "dragon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Test", props); assertNotNull(m); assertTrue(m.getPayload() instanceof String); assertFalse(m.getPayloadAsString().equals("Test Received")); assertExceptionPayload(m, "Authentication failed for principal Evil. Message payload is of type: String"); } public void testCaseBadPassword() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("Marie.Rizzo", "evil", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Test", props); assertNotNull(m); assertTrue(m.getPayload() instanceof String); assertFalse(m.getPayloadAsString().equals("Test Received")); assertExceptionPayload(m, "Authentication failed for principal Marie.Rizzo. Message payload is of type: String"); } protected String getConfigResources() { return "mule-conf-with-no-jaas-config-file.xml"; } } mule-2.0.1/modules/jaas/src/test/java/org/mule/module/jaas/JaasAuthenticationWithNtLoginModule.java0000644000175000017500000000310310763522057033233 0ustar charlescharles/* * $Id: JaasAuthenticationWithNtLoginModule.java 11179 2008-03-05 13:46:23Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jaas; import org.mule.api.EncryptionStrategy; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.module.client.MuleClient; import org.mule.security.MuleCredentials; import org.mule.tck.FunctionalTestCase; import java.util.HashMap; import java.util.Map; public class JaasAuthenticationWithNtLoginModule extends FunctionalTestCase { public void testCaseAuthentication() throws Exception { MuleClient client = new MuleClient(); Map props = new HashMap(); EncryptionStrategy strategy = muleContext .getSecurityManager() .getEncryptionStrategy("PBE"); String header = MuleCredentials.createHeader("Marie.Rizzo", "dragon", "PBE", strategy); props.put(MuleProperties.MULE_USER_PROPERTY, header); MuleMessage m = client.send("vm://test", "Test", props); assertNotNull(m); assertTrue(m.getPayload() instanceof String); assertTrue(m.getPayloadAsString().equals("Test Received")); } protected String getConfigResources() { return "mule-conf-with-NTLoginModule.xml"; } } mule-2.0.1/modules/jaas/src/test/resources/0000755000175000017500000000000011351411163020442 5ustar charlescharlesmule-2.0.1/modules/jaas/src/test/resources/mule-conf-with-no-jaas-config-file.xml0000644000175000017500000000310310745174725027545 0ustar charlescharles mule-2.0.1/modules/jaas/src/test/resources/log4j.properties0000644000175000017500000000050410702420744023602 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages #log4j.logger.org.mule=DEBUG mule-2.0.1/modules/jaas/src/test/resources/jaas.conf0000644000175000017500000000021410754375733022246 0ustar charlescharlesjaasTest{ org.mule.module.jaas.loginmodule.DefaultLoginModule required credentials="anon:anon;Marie.Rizzo:dragon;" debug=true; }; mule-2.0.1/modules/jaas/src/test/resources/mule-conf-with-NTLoginModule.xml0000644000175000017500000000305210745174725026520 0ustar charlescharles mule-2.0.1/modules/jaas/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000007010754375733025333 0ustar charlescharlesorg.mule.module.jaas.JaasAuthenticationWithNtLoginModulemule-2.0.1/modules/jaas/src/test/resources/jaas-namespace-config.xml0000644000175000017500000000163010665301621025303 0ustar charlescharles mule-2.0.1/modules/jaas/src/test/resources/mule-conf-for-jaas-conf-file.xml0000644000175000017500000000274610745174725026442 0ustar charlescharles mule-2.0.1/modules/jaas/pom.xml0000644000175000017500000000474211006063605016207 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-jaas Jaas Security Mule Jaas Support exposes Jaas Authentication providers and Method interceptors to authentication event traffic via endpoints. org.mule mule-core ${version} org.mule.modules mule-module-spring-config ${version} provided org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test org.mule.transports mule-transport-vm ${version} test osgi org.apache.felix maven-bundle-plugin org.mule.module.jaas.* mule-2.0.1/modules/jboss-transactions/0000755000175000017500000000000011351411134017570 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/0000755000175000017500000000000011351411134020357 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/main/0000755000175000017500000000000011351411134021303 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/main/java/0000755000175000017500000000000011351411134022224 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/main/java/org/0000755000175000017500000000000011351411134023013 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/main/java/org/mule/0000755000175000017500000000000011351411134023755 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/main/java/org/mule/module/0000755000175000017500000000000011351411134025242 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/main/java/org/mule/module/jboss/0000755000175000017500000000000011351411134026362 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/main/java/org/mule/module/jboss/transaction/0000755000175000017500000000000011351411134030707 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/main/java/org/mule/module/jboss/transaction/package.html0000644000175000017500000000016710764101307033201 0ustar charlescharles Mule Provides integration with JBoss TS (Arjuna). ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/modules/jboss-transactions/src/main/java/org/mule/module/jboss/transaction/JBossArjunaTransactionManagerFactory.javamule-2.0.1/modules/jboss-transactions/src/main/java/org/mule/module/jboss/transaction/JBossArjunaTra0000644000175000017500000000553010764101307033472 0ustar charlescharles/* * $Id:JBossArjunaTransactionManagerFactory.java 8215 2007-09-05 16:56:51Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jboss.transaction; import org.mule.RegistryContext; import org.mule.api.transaction.TransactionManagerFactory; import com.arjuna.ats.arjuna.common.Environment; import com.arjuna.ats.arjuna.common.arjPropertyManager; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.transaction.TransactionManager; public class JBossArjunaTransactionManagerFactory implements TransactionManagerFactory { private Map properties = new HashMap(); //static //{ //arjPropertyManager.propertyManager.setProperty(LogFactory.LOGGER_PROPERTY, "log4j_releveler"); //arjPropertyManager.propertyManager.setProperty(LogFactory.LOGGER_PROPERTY, "jakarta"); //arjPropertyManager.propertyManager.setProperty(LogFactory.DEBUG_LEVEL, String.valueOf(DebugLevel.FULL_DEBUGGING)); //commonPropertyManager.propertyManager.setProperty(LogFactory.LOGGER_PROPERTY, "jakarta"); //commonPropertyManager.propertyManager.setProperty(LogFactory.DEBUG_LEVEL, String.valueOf(DebugLevel.FULL_DEBUGGING)); //} private TransactionManager tm; public JBossArjunaTransactionManagerFactory() { //arjPropertyManager.propertyManager.setProperty("com.arjuna.ats.arjuna.objectstore.objectStoreType", "ShadowNoFileLockStore"); //arjPropertyManager.propertyManager.setProperty(Environment.OBJECTSTORE_TYPE, ArjunaNames.Implementation_ObjectStore_JDBCStore().stringForm()); } public synchronized TransactionManager create() throws Exception { if (tm == null) { if (!properties.containsKey(Environment.OBJECTSTORE_DIR)) { final String muleInternalDir = RegistryContext.getConfiguration().getWorkingDirectory(); arjPropertyManager.propertyManager.setProperty(Environment.OBJECTSTORE_DIR, muleInternalDir + "/transaction-log"); } for (Iterator i = properties.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); arjPropertyManager.propertyManager.setProperty((String) entry.getKey(), (String) entry.getValue()); } tm = com.arjuna.ats.jta.TransactionManager.transactionManager(); } return tm; } public Map getProperties() { return properties; } public void setProperties(Map properties) { this.properties = properties; } } mule-2.0.1/modules/jboss-transactions/src/main/java/org/mule/module/jboss/config/0000755000175000017500000000000011351411134027627 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/modules/jboss-transactions/src/main/java/org/mule/module/jboss/config/JbossTSNamespaceHandler.javamule-2.0.1/modules/jboss-transactions/src/main/java/org/mule/module/jboss/config/JbossTSNamespaceHan0000644000175000017500000000230210764101307033347 0ustar charlescharles/* * $Id: JbossTSNamespaceHandler.java 11236 2008-03-06 23:48:23Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jboss.config; import org.mule.config.spring.parsers.collection.ChildMapEntryDefinitionParser; import org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser; import org.mule.module.jboss.transaction.JBossArjunaTransactionManagerFactory; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; /** * Registers Bean Definition Parsers for the "jbossts" namespace. */ public class JbossTSNamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("transaction-manager", new MuleOrphanDefinitionParser(JBossArjunaTransactionManagerFactory.class, true)); registerBeanDefinitionParser("properties", new ChildMapEntryDefinitionParser("properties","key","value")); } } mule-2.0.1/modules/jboss-transactions/src/main/resources/0000755000175000017500000000000011351411134023315 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/main/resources/META-INF/0000755000175000017500000000000011351411134024455 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/main/resources/META-INF/spring.schemas0000644000175000017500000000013510703727351027336 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/jbossts/2.0/mule-jbossts.xsd=META-INF/mule-jbossts.xsdmule-2.0.1/modules/jboss-transactions/src/main/resources/META-INF/spring.handlers0000644000175000017500000000015010754375733027521 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/jbossts/2.0=org.mule.module.jboss.config.JbossTSNamespaceHandler mule-2.0.1/modules/jboss-transactions/src/main/resources/META-INF/mule-jbossts.xsd0000644000175000017500000000262010743401715027634 0ustar charlescharles mule-2.0.1/modules/jboss-transactions/src/test/0000755000175000017500000000000011351411134021336 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/test/java/0000755000175000017500000000000011351411134022257 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/test/java/org/0000755000175000017500000000000011351411134023046 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/test/java/org/mule/0000755000175000017500000000000011351411134024010 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/test/java/org/mule/module/0000755000175000017500000000000011351411134025275 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/test/java/org/mule/module/jboss/0000755000175000017500000000000011351411134026415 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/test/java/org/mule/module/jboss/transactions/0000755000175000017500000000000011351411134031125 5ustar charlescharles././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootmule-2.0.1/modules/jboss-transactions/src/test/java/org/mule/module/jboss/transactions/JBossArjunaTxThreadAssociationTestCase.javamule-2.0.1/modules/jboss-transactions/src/test/java/org/mule/module/jboss/transactions/JBossArjunaTx0000644000175000017500000000164310764101307033556 0ustar charlescharles/* * $Id:JBossArjunaTxThreadAssociationTestCase.java 8215 2007-09-05 16:56:51Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jboss.transactions; import org.mule.api.transaction.TransactionManagerFactory; import org.mule.module.jboss.transaction.JBossArjunaTransactionManagerFactory; import org.mule.tck.AbstractTxThreadAssociationTestCase; public class JBossArjunaTxThreadAssociationTestCase extends AbstractTxThreadAssociationTestCase { protected TransactionManagerFactory getTransactionManagerFactory() { return new JBossArjunaTransactionManagerFactory(); } } mule-2.0.1/modules/jboss-transactions/src/test/java/org/mule/module/jboss/config/0000755000175000017500000000000011351411134027662 5ustar charlescharles././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/modules/jboss-transactions/src/test/java/org/mule/module/jboss/config/JbossTSNamespaceHandlerTestCase.javamule-2.0.1/modules/jboss-transactions/src/test/java/org/mule/module/jboss/config/JbossTSNamespaceHan0000644000175000017500000000203510754375733033424 0ustar charlescharles/* * $Id: JbossTSNamespaceHandlerTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.module.jboss.config; import org.mule.tck.FunctionalTestCase; import com.arjuna.ats.arjuna.common.arjPropertyManager; public class JbossTSNamespaceHandlerTestCase extends FunctionalTestCase { public void testNamespaceHandler() { assertNotNull(muleContext.getTransactionManager()); assertTrue(muleContext.getTransactionManager().getClass().getName().compareTo("arjuna") > 0); assertEquals(arjPropertyManager.propertyManager.getProperty("test"),"TEST"); } protected String getConfigResources() { return "jbossts-namespacehandler.xml"; } } mule-2.0.1/modules/jboss-transactions/src/test/resources/0000755000175000017500000000000011351411134023350 5ustar charlescharlesmule-2.0.1/modules/jboss-transactions/src/test/resources/log4j.properties0000644000175000017500000000061310702420744026513 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages #log4j.logger.org.mule=DEBUG #log4j.logger.com.arjuna=DEBUG #log4j.logger.org.apache.activemq=DEBUG mule-2.0.1/modules/jboss-transactions/src/test/resources/jbossts-namespacehandler.xml0000644000175000017500000000154010743401715031061 0ustar charlescharles mule-2.0.1/modules/jboss-transactions/pom.xml0000644000175000017500000000403511006063605021112 0ustar charlescharles 4.0.0 org.mule.modules mule-modules 2.0.1 mule-module-jbossts jar JBoss Transactions Integration Provides access to the JBoss Transaction Service for User and Xa transactions. org.mule mule-core ${version} org.mule.modules mule-module-spring-config ${version} provided org.mule.tests mule-tests-functional ${version} test org.mule.modules mule-module-client ${version} test org.jboss jbossts-common 4.2.3-SP5 org.jboss jbossts-jta 4.2.3-SP5-patched org.jboss jbossts-jta-integration 4.2.3-SP5 mule-2.0.1/src/0000755000175000017500000000000011351411057013065 5ustar charlescharlesmule-2.0.1/src/site/0000755000175000017500000000000011351411057014031 5ustar charlescharlesmule-2.0.1/src/site/resources/0000755000175000017500000000000011351411057016043 5ustar charlescharlesmule-2.0.1/src/site/resources/images/0000755000175000017500000000000011351411057017310 5ustar charlescharlesmule-2.0.1/src/site/resources/images/mulesource_logo.gif0000644000175000017500000000303410621717250023205 0ustar charlescharlesGIF89a8ubfgiNOQN 3H.ay~.v#iI%'7z@dq} WH|%<CW}E!(~wlDWAe&Bd ]}~&1O,dG-XIP@dM`Xb/䓼Aǚ7mx% dI;aY 4[1 {XmZ#}hUdd-lŒɔ!T8_X1ry 7V+q!7]џsrŘc  BvX!|s7^ԑzvP*Kw~'l^l@pr+祈a8aw v|{e Bd 㧑eŽ9,=?E`1l:6;^:1pܯ펬G/C6 2kIV &Cgʻ06. ܁6 r Mule images/mulesource_logo.gif http://mule.mulesource.org/ ${parentProject} mule-2.0.1/local_settings.xml0000644000175000017500000001212510712572216016040 0ustar charlescharles tests mule-2.0.1/buildtools/0000755000175000017500000000000011351410664014461 5ustar charlescharlesmule-2.0.1/buildtools/etc/0000755000175000017500000000000011351410664015234 5ustar charlescharlesmule-2.0.1/buildtools/etc/libraries_disclaimer.txt0000644000175000017500000000077010700153016022141 0ustar charlescharlesThe libraries in this directory are for one reason or another not available for download from one of the major Maven repositories (ibiblio, java.net, codehaus, apache.org, etc.) They are made available here for the sole purpose of conveniently compiling and testing the Mule source code. They should in no way be used in a non-development environment without having the appropriate licenses / permissions from the library's owner and should be obtained through their official distribution channels. mule-2.0.1/buildtools/scripts/0000755000175000017500000000000011351410664016150 5ustar charlescharlesmule-2.0.1/buildtools/scripts/compare_exclusions.sh0000755000175000017500000000201010714422127022401 0ustar charlescharles#!/bin/bash if [ $# -ne 2 ] then echo "Usage: $0 directory1 directory2" exit 1 fi dir1="$1" dir2="$2" function name() { dir="$1" full=`readlink -f "$dir"` name=`basename "$full"` } function process() { dir="$1" name="$2" echo "reading $name" tmp=`mktemp "${name}.XXX"` find "$dir" \( -name ".svn" -prune \) -o \( -name "target" -prune \) -o \( -name mule-test-exclusions.txt -exec egrep "^[a-z]" \{} \; \) | sort > "$tmp" } function display() { file1="$1" file2="$2" name="$3" echo echo echo -n "tests excluded only in $name: " comm -2 -3 "$file1" "$file2" | wc -l echo comm -2 -3 "$file1" "$file2" } name "$dir1" namedir1="$name" name "$dir2" namedir2="$name" process "$dir1" "$namedir1" tmpdir1="$tmp" process "$dir2" "$namedir2" tmpdir2="$tmp" display "$tmpdir1" "$tmpdir2" "$namedir1" display "$tmpdir2" "$tmpdir1" "$namedir2" echo echo echo -n "tests excluded in both: " comm -1 -2 "$file1" "$file2" | wc -l echo comm -1 -2 "$tmpdir1" "$tmpdir2" #rm "$tmpdir1" "$tmpdir2" mule-2.0.1/buildtools/scripts/SwitchVersion.groovy0000644000175000017500000001046110713650726022236 0ustar charlescharles/** * SwitchVersion * * Usage: SwitchVersion * * Finds recursively all pom.xml files and switches * to . */ import java.util.regex.Pattern def root = new File(args[0]) oldVersion = args[1] newVersion = args[2] versionPattern = Pattern.compile("\\s*.*.*") root.eachFileRecurse() { file -> if (file.directory == false) { if (file.name == 'pom.xml') { process(file) } else if (file.name == 'install.xml') { // MULE-2659: take care of the installer configuration file as well switchAppVersion(file) } } } //----------------------------------------------------------------------------- def process(input) //----------------------------------------------------------------------------- { println("processing " + input) def outputFile = new File(input.getParent(), "pom.xml.new") def output = new BufferedWriter(new FileWriter(outputFile)) def processingParentElement = false def versionProcessed = false input.eachLine { line -> if (line.indexOf("") > -1) { processingParentElement = true } else if (line.indexOf("") > -1) { processingParentElement = false } def versionMatch = versionPattern.matcher(line).matches(); if (processingParentElement && versionMatch) { outputLine(output, switchVersion(line, "version", oldVersion, newVersion)) } else { if ((versionProcessed == false) && versionMatch) { versionProcessed = true outputLine(output, switchVersion(line, "version", oldVersion, newVersion)) } else { if (line.indexOf("") > -1) { outputLine(output, switchVersion(line, "muleVersion", oldVersion, newVersion)) } else { outputLine(output, line) } } } } output.close() // rename the new pom back to 'pom.xml' def backupFile = new File(input.getParent(), "pom.xml.orig") input.renameTo(backupFile) outputFile.renameTo(input) // remove the backup file backupFile.delete() } //----------------------------------------------------------------------------- def switchAppVersion(installerConfigFile) //----------------------------------------------------------------------------- { println("processing " + installerConfigFile) def outputFile = new File(installerConfigFile.getParent(), "install.xml.new") def output = new BufferedWriter(new FileWriter(outputFile)) installerConfigFile.eachLine { line -> if (line.indexOf("") > -1) { outputLine(output, switchVersion(line, "appversion", oldVersion, newVersion)) } else { outputLine(output, line) } } output.close() def backupFile = new File(installerConfigFile.getParent(), "install.xml.orig") installerConfigFile.renameTo(backupFile) outputFile.renameTo(installerConfigFile) backupFile.delete() } //----------------------------------------------------------------------------- def switchVersion(line, versionTag, oldVersion, newVersion) //----------------------------------------------------------------------------- { startVersionTag = "<" + versionTag + ">" endVersionTag = "" // include the tag length int start = line.indexOf(startVersionTag) + startVersionTag.length(); int end = line.indexOf(endVersionTag); def version = line.substring(start, end); if ((version == oldVersion) == false) { return line; } StringBuffer processedLine = new StringBuffer(128); processedLine.append(line.substring(0, start)); processedLine.append(newVersion); processedLine.append(line.substring(end)); return processedLine.toString(); } //----------------------------------------------------------------------------- def outputLine(output, line) //----------------------------------------------------------------------------- { output.write(line) output.newLine() } mule-2.0.1/buildtools/scripts/mule_undo.sh0000755000175000017500000000105710665301621020500 0ustar charlescharles#!/bin/bash # used in the same way as mule_root.sh, but reverts to backup file # (apply to the .xml file, not the backup) if [ -z "$1" ] then echo "supply file name as first parameter" exit 1 fi file="$1" if [ ! -e "$file" ] then echo "no file $file" exit 1 fi line=`egrep ' ${file}" mv "${file}~" "${file}" fi mule-2.0.1/buildtools/scripts/ListExcludedTests.groovy0000644000175000017500000000177310631620702023037 0ustar charlescharles/** Recursively scan for pom.xml files and report excluded tests for each project. Runs from the currend directory, work dir is Mule project root. $Id: ListExcludedTests.groovy 6956 2007-06-06 21:06:10Z aperepel $ */ def muleRoot = '../..' def parser = new XmlSlurper() def ant = new AntBuilder() def scanner = ant.fileScanner { fileset (dir: muleRoot) { include(name: "**/pom.xml") } } scanner.each { file -> def project = parser.parse(file) printExcludes(project) } /** Analyze Surefire configuration if available and print excluded tests. */ def printExcludes(project) { def plugins = project?.build?.plugins?.plugin.findAll { it.artifactId == 'maven-surefire-plugin' } plugins.each { plugin -> splash "$project.name" plugin?.configuration?.excludes.exclude.each { println it } } } /** A helper splash message method. */ def splash(text) { println() println '=' * 50 println " $text" println '=' * 50 }mule-2.0.1/buildtools/scripts/ListTestExclusions.groovy0000644000175000017500000000126110700235613023243 0ustar charlescharles/** Recursively scan for mule-test-exclusions.txt files and report excluded tests for each project. Runs from the currend directory, work dir is Mule project root. $Id: ListTestExclusions.groovy 8752 2007-10-01 18:25:15Z aperepel $ */ def muleRoot = '../..' def ant = new AntBuilder() def scanner = ant.fileScanner { fileset (dir: muleRoot) { include(name: "**/src/test/resources/mule-test-exclusions.txt") } } def lines = [] scanner.each { file -> file.eachLine() { line -> if (!line.startsWith('#') && line.length() != 0) { lines << line } } } lines.sort() lines.each { line -> println(line) } mule-2.0.1/buildtools/scripts/build.sh0000755000175000017500000000226110626134307017610 0ustar charlescharles#!/bin/sh ############################################## # Full nightly build for Mule ############################################## # Purge old Mule artifacts from repository rm -rf $M2_REPO/org/mule/ # Check-out project if necessary, otherwise update. if [ ! -d "mule" ] then svn co http://svn.codehaus.org/mule/trunk/mule mule cd mule else cd mule svn update fi # Clean everything mvn -Ptests,distributions clean # Build all modules mvn -Dmaven.test.skip.exec=true -Ptests install # Run unit tests only mvn -Dmaven.test.failure.ignore=true test # Run unit and integration tests # mvn -Dmaven.test.failure.ignore=true -Ptests test # Generate HTML reports # mvn -Dmaven.test.skip.exec=true -Ptests site:site # Generate javadocs mvn -Dmaven.test.skip.exec=true -Ptests -Daggregate=true javadoc:javadoc # Generate all distributions (-DperformRelease=true to generate source bundles, # will be repackaged by the full distro script into a single source zip) mvn -Dmaven.test.skip.exec=true -Pdistributions -DperformRelease=true install # Upload all modules, javadocs, and sources to the public repository # mvn -Dmaven.test.skip.exec=true -Ptests -DperformRelease=true deploy mule-2.0.1/buildtools/scripts/SwitchLicenseHeader.sh0000644000175000017500000000022110673775521022370 0ustar charlescharles#!/bin/bash for file in `find . -name \*.java -print` do sed 's/MuleSource MPL/CPAL v1.0/g' < $file > $file.new mv $file.new $file done mule-2.0.1/buildtools/scripts/mkpom.sh0000755000175000017500000000451110545332216017633 0ustar charlescharles#!/bin/sh # # Script to create an m2 POM from a library and its related artifacts # # USAGE # mkpom.sh file.jar [file-sources.jar] [file-javadoc.jar] # # The target repository path DEPENDENCIES="." # Maven expects hexadecimal letters as lowercase so you might have to add -l here MD5="md5sum" if [ $# = 1 ] then echo "Enter groupId (can be multi-part, such as javax.mail):" read groupId echo "Enter artifactId:" read artifactId echo "Enter version:" read version echo "Enter classifier:" read classifier # Convert the group's package to a path (e.g. javax.mail --> javax/mail) groupPath=`echo $groupId | sed s*[.]*/*g` # Create file name path=$DEPENDENCIES/$groupPath/$artifactId/$version if [[ "$classifier" > "" ]]; then file=$artifactId-$version-$classifier else file=$artifactId-$version fi echo "Creating directory $path" mkdir -p $path echo "Setting directory privileges" chmod -fR 775 $DEPENDENCIES echo "Installing library as $file.jar" cp $1 $path/$file.jar echo "Generating basic POM" echo "" > $path/$file.pom echo " 4.0.0" >> $path/$file.pom echo " $groupId" >> $path/$file.pom echo " $artifactId" >> $path/$file.pom echo " $version" >> $path/$file.pom if [[ "$classifier" > "" ]] ; then echo " $classifier" >> $path/$file.pom fi echo "" >> $path/$file.pom echo "Generating checksums" $MD5 $path/$file.jar > $path/$file.jar.md5 $MD5 $path/$file.pom > $path/$file.pom.md5 # optional sources sources=`basename $1 .jar`-sources.jar if [ -f $sources ]; then echo "Copying sources to $file-sources.jar" cp $sources $path/$file-sources.jar $MD5 $path/$file-sources.jar > $path/$file-sources.jar.md5 fi # optional javadoc javadoc=`basename $1 .jar`-javadoc.jar if [ -f $javadoc ]; then echo "Copying javadoc to $file-javadoc.jar" cp $javadoc $path/$file-javadoc.jar $MD5 $path/$file-javadoc.jar > $path/$file-javadoc.jar.md5 fi echo "Setting file privileges" chmod 664 $path/* else echo "Usage: `basename $0` .jar [-sources.jar] [-javadoc.jar]" fi mule-2.0.1/buildtools/scripts/mule_root.sh0000755000175000017500000000352710665301621020522 0ustar charlescharles#!/bin/bash # this was used to convert spring-based configs to use the new mule root element # typical use was # find some/directory -name "*.xml" -exec path/mule_root.sh \{} \; # see mule_undo.sh for automated reverting to backup if [ -z "$1" ] then echo "supply file name as first parameter" exit 1 fi file="$1" if [ ! -e "$file" ] then echo "no file $file" exit 1 fi line=`egrep '/<\/mule>/' "$file" # change mule ns for spring sed -i -e 's/xmlns:mule="http:\/\/www.mulesource.org\/schema\/mule\/core\/2.0"/xmlns:spring="http:\/\/www.springframework.org\/schema\/beans"/' "$file" # remove mule: prefixes sed -i -e 's//<\/spring:bean>/' "$file" sed -i -e 's//<\/spring:entry>/' "$file" sed -i -e 's//<\/spring:property>/' "$file" sed -i -e 's///' "$file" sed -i -e 's/<\/list>/<\/spring:list>/' "$file" sed -i -e 's///' "$file" sed -i -e 's/<\/map>/<\/spring:map>/' "$file" sed -i -e 's///' "$file" sed -i -e 's/<\/value>/<\/spring:value>/' "$file" sed -i -e 's///' "$file" sed -i -e 's/<\/constructor-arg>/<\/spring:constructor-arg>/' "$file" mule-2.0.1/buildtools/scripts/ScanLicenseHeaders.groovy0000644000175000017500000000332110777130726023112 0ustar charlescharles/** * Recursively scan through all java files checking the file header */ public class ScanLicenseHeaders { /** * These files are known to have invalid license headers and are the usual exception to the rule */ static List exceptions = [ "BobberArchetype.java", "BobberArchetypeMojo.java", "ProjectArchetypeMojo.java", "TransportArchetypeMojo.java" ]; static void main(args) { if (args.length != 1) { println("usage: ScanLicenseHeaders ") System.exit(1) } if (scan(new File(args[0])) == false) { System.exit(1) } } static boolean scan(File scanRoot) { def retValue = true; def ant = new AntBuilder() def scanner = ant.fileScanner { fileset (dir: scanRoot) { include(name: "**/*.java") exclude(name: "**/target/**") } } def licenseLine = "The software in this package is published under the terms of the CPAL v1.0"; scanner.each { file -> file.withReader { reader -> // using the standard file header, the license is in line 6 def line = null 6.times { line = reader.readLine() } if (line.indexOf(licenseLine) == -1) { if (exceptions.contains(file.name) == false) { println("License suspect: $file") retValue = false } } } } return retValue } } mule-2.0.1/buildtools/scripts/update_poms.sh0000755000175000017500000000076510647303074021042 0ustar charlescharles#!/bin/sh # This script is useful for making a release with m2. It simply replaces # the release version in all POMs in the project. # # Usage: update_poms.sh directory old_version new_version" if [ $# -lt 3 ] then echo "Usage: $0 directory old_version new_version" exit 1 fi echo "Replacing $2 with $3 for all pom.xml files in directory $1..." for pom in `find $1 -name pom.xml` do echo "Editing file $pom" sed -e 's/'"$2"'/'"$3"'/g' $pom > $pom.tmp mv -f $pom.tmp $pom done mule-2.0.1/buildtools/scripts/ListSchema.groovy0000644000175000017500000001455410754403514021466 0ustar charlescharles/** This should do the following: - scan the directory tree for all schema - infer the deploy location of the schema - scan the directory tree for all configurations - check that the configurations are consistent - generate a list of the schema and their deploy location (disabled) - generate a set of commands that can be used to deploy the schema The last part is going to depend on the deploy method, so the final user will need to edit the code (see generateDeployCommand below). It expects to be run in the buildtools/scripts directory (see "root" variable below). Example schema and their locations: transports/file/src/main/resources/META-INF/mule-file.xsd -> http://www.mulesource.org/schema/mule/file/2.0/mule-file.xsd modules/acegi/src/main/resources/META-INF/mule-acegi.xsd -> http://www.mulesource.org/schema/mule/acegi/2.0/mule-acegi.xsd core/src/main/resources/META-INF/mule.xsd -> http://www.mulesource.org/schema/mule/core/2.0/mule.xsd $Id$ */ // Schema version def version = 2.0 // Provide the location where https://dav.codehaus.org/dist/mule is mounted on your file system // as a parameter to the script. def davfs = "DAVMountPoint" if (args.size() > 0) { davfs = args[0] } // schema are indexed by the xsd file names (eg mule-foo.xsd is "foo") def schemaNames = [] def schemaSources = [:] def schemaDestinations = [:] def schemaDestinationPaths = [:] // assume we are running in the buildtools/scripts directory def root = "../.." // destination base def base = "http://www.mulesource.org/schema/mule/" // the structure of xsd locations def corexsd = /.*(\/|\\)spring-config(\/|\\).*(\/|\\)mule\.xsd/ def servicexsd = /.*(\/|\\)spring-config(\/|\\).*(\/|\\)mule-(.*)\.xsd/ def testxsd = /.*(\/|\\)tests(\/|\\)([^\/]+)(\/|\\).*(\/|\\)mule-test\.xsd/ def otherxsd = /.*(\/|\\)(transports|modules)(\/|\\)([^\/]+)(\/|\\).*(\/|\\)mule-(.*)\.xsd/ def checkCurrentDirectory = { if (! (new File("").getCanonicalFile().getName() == "scripts")) { println "" println "WARNING: run from in the scripts directory" println "" System.exit(1) } } def scanForSchemaAndInferDestinations = { println "" println "scanning for schema" println "" for (f in new AntBuilder().fileScanner { fileset(dir:root) { include(name:"**/*.xsd") exclude(name:"**/src/test/**/*.xsd") exclude(name:"**/target/**/*.xsd") } }) { if (f.absolutePath ==~ corexsd) { schemaNames << "core" schemaSources.put("core", f) schemaDestinations.put("core", "${base}core/${version}/mule.xsd") schemaDestinationPaths.put("core", "${base}core/${version}") } else if (f.absolutePath ==~ testxsd) { schemaNames << "test" schemaSources.put("test", f) schemaDestinations.put("test", "${base}test/${version}/mule-test.xsd") schemaDestinationPaths.put("test", "${base}test/${version}") } else if (f.absolutePath ==~ otherxsd) { match = (f.absolutePath =~ otherxsd) name = match[0][7] schemaNames << name schemaSources.put(name, f) schemaDestinations.put(name, "${base}${name}/${version}/mule-${name}.xsd") schemaDestinationPaths.put(name, "${base}${name}/${version}") } else if (f.absolutePath ==~ servicexsd) { match = (f.absolutePath =~ servicexsd) name = match[0][4] schemaNames << name schemaSources.put(name, f) schemaDestinations.put(name, "${base}${name}/${version}/mule-${name}.xsd") schemaDestinationPaths.put(name, "${base}${name}/${version}") } else { println "WARNING: ignoring $f" } } } def checkSchema = { println "" println "checking schema" println "" for (name in schemaNames) { file = schemaSources[name] parser = new XmlParser().parse(file) for (element in parser.value) { if (element.name.localPart == "import") { namespace = element.attributes["namespace"] if (namespace.contains("mulesource") && ! namespace.contains("core") && ! element.attributes.keySet().contains("schemaLocation")) { println "WARNING: missing schema location" println "in " + file println "for " + namespace } } } } } def scanAndCheckConfigs = { println "" println "checking configurations" println "" for (f in new AntBuilder().fileScanner { fileset(dir:root) { include(name:"**/*.xml") exclude(name:"**/target/**/*.xml") } }) { try { def parser = new XmlParser().parse(f) for (key in parser?.attributes.keySet()) { if (key instanceof groovy.xml.QName && key.localPart == "schemaLocation") { tokens = new StringTokenizer(parser.attributes[key]) while (tokens.hasMoreTokens()) { id = tokens.nextToken() uri = tokens.nextToken() match = (id =~ /.*mulesource\.org.*mule\/([^\/]+)\/.*/) if (match.matches()) { name = match[0][1] // we should really scan for test schema too, // but there's only one^H^H^H a few if (name != "parsers-test" && ! name.startsWith("nest-example")) { if (! schemaNames.contains(name)) { println "WARNING: missing schema for $name - see file $f" } else if (uri != schemaDestinations[name]) { println "WARNING: URI for $name is ${schemaDestinations[name]} (not ${uri}) - see file $f" } } } } } } } catch (e) { println "WARNING: error parsing $f: $e" } } } def listSchema = { for (name in schemaNames) { println "" println "${name}:" println " ${schemaSources[name]}" println " ${schemaDestinations[name]}" } } // this is just a suggestion def generateDeployCommand = { println "" println "generating deploy command" println "" for (name in schemaNames) { source = schemaSources[name] pathUri = new URI(schemaDestinationPaths[name]) schemaUri = new URI(schemaDestinations[name]) println "mkdir -p ${davfs}${pathUri.path}" println "cp $source ${davfs}${schemaUri.path}" } } checkCurrentDirectory() scanForSchemaAndInferDestinations() checkSchema() scanAndCheckConfigs() //listSchema() generateDeployCommand() mule-2.0.1/buildtools/scripts/tabstospaces.sh0000755000175000017500000000077210636077031021212 0ustar charlescharles#!/bin/sh # Usage: tabstospaces.sh directory" if [ $# -lt 1 ] then echo "Usage: $0 directory" exit 1 fi ignore_dirs="\.svn\|CVS" source_files="\.java$\|\.xml$\|\.xsd$\|\.xsl$\|\.dtd$\|\.txt$\|\.groovy$\|\.vm$\|\.properties$\|\.jsp$\|\.html$\|\.htm$\|\.sh$\|*README*" for file in `find $1 | grep -v -e $ignore_dirs | grep -e $source_files` do if [ -f $file ] then echo "Editing file $file" sed -e 's/\t/ /g' $file > $file.tmp mv -f $file.tmp $file fi done mule-2.0.1/buildtools/scripts/ListIncludedTests.groovy0000644000175000017500000000515510631620702023027 0ustar charlescharles/** The report scans all modules for testcases which are actually executed by the build. Information from module poms is incorporated to reflect excluded tests. Runs from the currend directory, work dir is Mule project root. $Id: ListExcludedTests.groovy 5406 2007-03-04 17:58:50Z aperepel $ */ def muleRoot = '../..' def parser = new XmlSlurper() def testCount = 0 def ant = new AntBuilder() new File(muleRoot).eachFileRecurse { file -> if (!file.directory && file.name == 'pom.xml') { def project = parser.parse(file) def testNames = [] splash project.name // custom tests directory locations not supported at the moment def testsDir = new File(file.parent, 'src/test/java/') // ugly way to break out of closure, continue not supported here if (testsDir.exists()) { // TODO fetch these from a top level pom def topLevelExcludes = [ '**/Abstract*TestCase.java', '**/target/**' ] def moduleExcludes = [] // scan module pom to extract local excludes def plugins = project?.build?.plugins?.plugin.findAll { it.artifactId == 'maven-surefire-plugin' } plugins.each { plugin -> plugin?.configuration?.excludes.exclude.each { moduleExcludes << it } } def scanner = ant.fileScanner { fileset(dir: testsDir) { include(name: '**/*TestCase.java') // from the root pom topLevelExcludes.each { e -> exclude(name: e) } // from each individual pom moduleExcludes.each { e -> exclude(name: e) } } } scanner.each { test -> testNames << test.name } // print all with index and sorted testNames.sort().eachWithIndex { name, i -> println "${(i + 1).toString().padLeft(3)}. ${name}" } testCount += testNames.size() } } } splash "Total included test count: $testCount" /** A helper splash message method. */ def splash(text) { println() println '=' * 50 println " $text" println '=' * 50 }mule-2.0.1/buildtools/scripts/SchemaStatistics.groovy0000644000175000017500000001457210677267717022726 0ustar charlescharles/** This should do the following: - scan the directory tree for all configuration files (*.xml) - produce statistics by package that include -- basic type (old , spring, new , other) -- for "new " type, additional statistics: --- whether inbound/outbound endpoints are used --- whether namespaces other than mule: and spring: are used --- whether other namespaces are used for anything other than endpoints - in addition, track the total number of namespaces present The output is not that beautiful, but filtering lines not beginning with "#" should give a CSV file (except for errors) $Id$ */ import org.codehaus.groovy.ant.FileScanner // assume we are running in the buildtools/scripts directory def root = "../.." class Package { String base // core, transports, etc String dir // full path List configs // all configuration files found int xmlTypeCountError int xmlTypeCountOther int xmlTypeCountOldMule int xmlTypeCountNewMule int xmlTypeCountSpring int endpointContextSpecific int endpointTransportSpecific void scan() { AntBuilder ant = new AntBuilder() FileScanner scanner = ant.fileScanner { fileset (dir: dir) { include(name: "**/*.xml") exclude(name: "**/pom.xml") exclude(name: "**/target/**") exclude(name: "**/test-data/out/**") } } scanner.each {file -> parse(file)} } void parse(File file) { // println "# " + file.name try { Node doc = new XmlParser().parse(file) String name = doc.name if (name.equals("{http://www.springframework.org/schema/beans}beans")) { addSpringConfig(file, doc) } else if (name.equals("beans")) { addSpringConfig(file, doc) } else if (name.equals("{http://www.mulesource.org/schema/mule/core/2.0}mule")) { addNewMuleConfig(file, doc) } else if (name.equals("{http://www.mulesource.org/schema/mule/core/2.0}mule-unsafe")) { addNewMuleConfig(file, doc) } else if (name.equals("mule-configuration")) { addOldMuleConfig(file, doc) } else if (name.equals("project")) { addOtherConfig(file, doc, true) // ant build file } else if (name.equals("{http://schemas.xmlsoap.org/soap/envelope/}Envelope")) { addOtherConfig(file, doc, true) // soap envelope } else if (name.equals("process-definition")) { addOtherConfig(file, doc, true) // loan broker process defn } else if (name.equals("ehcache")) { addOtherConfig(file, doc, true) // eh cache } else if (name.equals("ejb-jar")) { addOtherConfig(file, doc, true) // ejb jar } else if (name.equals("{http://www.openejb.org/openejb-jar/1.1}openejb-jar")) { addOtherConfig(file, doc, true) // ejb jar } else if (name.equals("jbpm-configuration")) { addOtherConfig(file, doc, true) // jbpm } else if (name.equals("web-app")) { addOtherConfig(file, doc, true) // web.xml } else if (name.equals("SiebelMessage")) { addOtherConfig(file, doc, true) // 3rd party } else if (name.equals("plexus")) { addOtherConfig(file, doc, true) // 3rd party } else { addOtherConfig(file, doc, false) } } catch (Exception e) { addErrorConfig(file, e) } } void addErrorConfig(File file, Exception e) { xmlTypeCountError++ println "# *** failed to parse " + file.name println "# " + e.message } void addOtherConfig(File file, Node doc, boolean quiet) { xmlTypeCountOther++ if (! quiet) { println "# failed to identify " + file.name + " starting with " + doc.name } } void addSpringConfig(File file, Node doc) { xmlTypeCountSpring++ } void addNewMuleConfig(File file, Node doc) { xmlTypeCountNewMule++ def elements = doc.depthFirst() def endpoints = elements.findAll{e -> e.name.localPart == "inbound-endpoint" || e.name.localPart == "outbound-endpoint"}; if (endpoints.size() > 0) { endpointContextSpecific++ } if (endpoints.findAll{e -> e.name.namespaceURI != "http://www.mulesource.org/schema/mule/core/2.0"}) { endpointTransportSpecific++ } } void addOldMuleConfig(File file, Node doc) { if (! file.name.contains("legacy")) { println "# *** old config: " + file.name } xmlTypeCountOldMule++ } String toString() { return "# " + base + " " + dir } String types() { return "# error: " + xmlTypeCountError + "; other: " + xmlTypeCountOther + "; spring: " + xmlTypeCountSpring + "; old mule: " + xmlTypeCountOldMule + "; new mule: " + xmlTypeCountNewMule } String dropRoot(File dir) { if (dir.name == base) { return "" } else { File parent = new File(dir.parent) return dropRoot(parent) + "/" + dir.name } } String csv() { return "\"" + base + "\",\"" + dropRoot(new File(dir)) + "\"," + xmlTypeCountError + "," + xmlTypeCountOther + "," + xmlTypeCountSpring + "," + xmlTypeCountOldMule + "," + xmlTypeCountNewMule + "," + endpointContextSpecific + "," + endpointTransportSpecific } } def checkCurrentDirectory = { if (! (new File("").getCanonicalFile().getName() == "scripts")) { println "" println "WARNING: run from in the scripts directory" println "" System.exit(1) } } // root directories to search def baseDirectories = ["core", "examples", "tests", "modules", "transports"] //def baseDirectories = ["transports"] // find directories with maven structure (pom.xml and (src or conf)) def findPackages = { packages = [] for (base in baseDirectories) { extendPackagesFrom(root, base, packages) } return packages } def extendPackagesFrom(root, base, packages) { ant = new AntBuilder() scanner = ant.fileScanner { fileset (dir: root + "/" + base) { include(name: "**/pom.xml") } } scanner.each { file -> dir = file.parent if (checkForDirectory(dir, "src") || checkForDirectory(dir, "conf")) { packages.add(new Package(dir: dir, base: base)) } } return packages } def checkForDirectory(parent, child) { file = new File(parent, child) return file.exists() && file.isDirectory() } // driver checkCurrentDirectory() def packages = findPackages() println "group,package,error-type,other-type,spring-type,old-mule-type,new-mule-type,context-endpoint,transport-endpoint" for (pkg in packages) { println "# ------------------" pkg.scan() println pkg println pkg.types() println pkg.csv() } mule-2.0.1/buildtools/scripts/EclipseXmlCatalog.groovy0000644000175000017500000000441210645152531022761 0ustar charlescharles/* * Genrerates a file that can be imported as eclipse XML catalog */ //assume we are running in the buildtools/scripts directory root = "../.." // the structure of xsd locations corexsd = /.*(\/|\\)core(\/|\\).*(\/|\\)mule.xsd/ otherxsd = /.*(\/|\\)(transports|modules)(\/|\\)([^\/]+)(\/|\\).*(\/|\\)mule-(.*)\.xsd/ //destination base base = "http://www.mulesource.org/schema/mule/" def checkCurrentDirectory() { if (! (new File("").getCanonicalFile().getName() == "scripts")) { println "" println "WARNING: run from in the scripts directory" println "" System.exit(1) } } def searchEclipseProjects() { nameRegEx = /.*(.*)<\/name>.*/ println("\n") for (projectFile in new AntBuilder().fileScanner { fileset(dir:root) { include(name:"**/.project") }}) { // extract the project's name from the .project file match = (projectFile.getText() =~ nameRegEx) projectName = match[0][1] processProject(projectFile, projectName) } println("") } def processProject(projectFile, projectName) { projectDir = projectFile.getParentFile() for (xsdFile in new AntBuilder().fileScanner { fileset(dir:projectDir) { include(name:"**/*.xsd") exclude(name:"**/src/test/**/*.xsd") exclude(name:"**/target/**/*.xsd") }}) { printSchemaEntry(projectName, projectFile, xsdFile) } } def printSchemaEntry(projectName, projectFile, xsdFile) { schemaSource = "" if (xsdFile.absolutePath ==~ corexsd) { schemaSource = "${base}core/2.0/mule.xsd" } else if (xsdFile.absolutePath ==~ otherxsd) { match = (xsdFile.absolutePath =~ otherxsd) name = match[0][7] schemaSource = "${base}${name}/2.0/mule-${name}.xsd" } else { println "WARNING: ignoring $xsdFile" return } projectDir = projectFile.parentFile dirLength = projectDir.absolutePath.length() schemaRelativePath = xsdFile.absolutePath.substring(dirLength + 1) print(" ") } checkCurrentDirectory() searchEclipseProjects() mule-2.0.1/buildtools/src/0000755000175000017500000000000011351410664015250 5ustar charlescharlesmule-2.0.1/buildtools/src/main/0000755000175000017500000000000011351410664016174 5ustar charlescharlesmule-2.0.1/buildtools/src/main/resources/0000755000175000017500000000000011351410664020206 5ustar charlescharlesmule-2.0.1/buildtools/src/main/resources/codecheck/0000755000175000017500000000000011351410664022116 5ustar charlescharlesmule-2.0.1/buildtools/src/main/resources/codecheck/checkstyle.xml0000644000175000017500000000733210672263414025007 0ustar charlescharles mule-2.0.1/buildtools/src/main/resources/codecheck/LICENSE.txt0000644000175000017500000006623410672263414023760 0ustar charlescharlesCommon Public Attribution License Version 1.0 (CPAL) 1. "Definitions" 1.0.1 "Commercial Use" means distribution or otherwise making the Covered Code available to a third party. 1.1 "Contributor" means each entity that creates or contributes to the creation of Modifications. 1.2 "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. 1.3 "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. 1.4 "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data. 1.5 "Executable" means Covered Code in any form other than Source Code. 1.6 "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. 1.7 "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. 1.8 "License" means this document. 1.8.1 "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 1.9 "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is: A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. B. Any new file that contains any part of the Original Code or previous Modifications. 1.10 "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. 1.10.1 "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. 1.11 "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. 1.12 "You" (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. Source Code License. 2.1 The Initial Developer Grant. The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and (b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof). (c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License. (d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices. 2.2 Contributor Grant. Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). (c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code. (d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor. 3. Distribution Obligations. 3.1 Application of License. The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. 3.2 Availability of Source Code. Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. 3.3 Description of Modifications. You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. 3.4 Intellectual Property Matters (a) Third Party Claims. If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. (b) Contributor APIs. If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file. (c) Representations. Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License. 3.5 Required Notices. You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 3.6 Distribution of Executable Versions. You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer, Original Developer or any Contributor. You hereby agree to indemnify the Initial Developer, Original Developer and every Contributor for any liability incurred by the Initial Developer, Original Developer or such Contributor as a result of any such terms You offer. 3.7 Larger Works. You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. 4. Inability to Comply Due to Statute or Regulation. If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Application of this License. This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code. 6. Versions of the License. 6.1 New Versions. MuleSource, Inc. ("MuleSource") may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. 6.2 Effect of New Versions. Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Socialtext. No one other than MuleSource has the right to modify the terms applicable to Covered Code created under this License. 6.3 Derivative Works. If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases "MuleSource", "CPAL" or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the CPAL. (Filling in the name of the Initial Developer, Original Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.) 7. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER, ORIGINAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 8. TERMINATION. 8.1 This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 8.2 If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer, Original Developer or a Contributor (the Initial Developer, Original Developer or Contributor against whom You file such action is referred to as "Participant") alleging that: (a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above. (b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant. 8.3 If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license. 8.4 In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination. 9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ORIGINAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 10. U.S. GOVERNMENT END USERS. The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. 11. MISCELLANEOUS. This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. 12. RESPONSIBILITY FOR CLAIMS. As between Initial Developer, Original Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer, Original Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. 13. MULTIPLE-LICENSED CODE. Initial Developer may designate portions of the Covered Code as Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the CPAL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A. 14. ADDITIONAL TERM: ATTRIBUTION (a) As a modest attribution to the organizer of the development of the Original Code ("Original Developer"), in the hope that its promotional value may help justify the time, money and effort invested in writing the Original Code, the Original Developer may include in Exhibit B ("Attribution Information") a requirement that each time an Executable and Source Code or a Larger Work is launched or initially run (which includes initiating a session), a prominent display of the Original Developer's Attribution Information (as defined below) must occur on the graphic user interface employed by the end user to access such Covered Code (which may include display on a splash screen), if any. The size of the graphic image should be consistent with the size of the other elements of the Attribution Information. If the access by the end user to the Executable and Source Code does not create a graphic user interface for access to the Covered Code, this obligation shall not apply. If the Original Code displays such Attribution Information in a particular form (such as in the form of a splash screen, notice at login, an "about" display, or dedicated attribution area on user interface screens), continued use of such form for that Attribution Information is one way of meeting this requirement for notice. (b) Attribution information may only include a copyright notice, a brief phrase, graphic image and a URL ("Attribution Information") and is subject to the Attribution Limits as defined below. For these purposes, prominent shall mean display for sufficient duration to give reasonable notice to the user of the identity of the Original Developer and that if You include Attribution Information or similar information for other parties, You must ensure that the Attribution Information for the Original Developer shall be no less prominent than such Attribution Information or similar information for the other party. For greater certainty, the Original Developer may choose to specify in Exhibit B below that the above attribution requirement only applies to an Executable and Source Code resulting from the Original Code or any Modification, but not a Larger Work. The intent is to provide for reasonably modest attribution, therefore the Original Developer cannot require that You display, at any time, more than the following information as Attribution Information: (a) a copyright notice including the name of the Original Developer; (b) a word or one phrase (not exceeding 10 words); (c) one graphic image provided by the Original Developer; and (d) a URL (collectively, the "Attribution Limits"). (c) If Exhibit B does not include any Attribution Information, then there are no requirements for You to display any Attribution Information of the Original Developer. (d) You acknowledge that all trademarks, service marks and/or trade names contained within the Attribution Information distributed with the Covered Code are the exclusive property of their owners and may only be used with the permission of their owners, or under circumstances otherwise permitted by law or as expressly set out in this License. 15. ADDITIONAL TERM: NETWORK USE. The term "External Deployment" means the use, distribution, or communication of the Original Code or Modifications in any way such that the Original Code or Modifications may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Code or Modifications as a distribution under section 3.1 and make Source Code available under Section 3.2. EXHIBIT A. Common Public Attribution License Version 1.0. "The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mulesource.com/CPAL/. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is MuleSource Mule The Initial Developer of the Original Code is MuleSource Inc. All portions of the code are Copyright (c) 2003-2007 MuleSource Inc. All Rights Reserved. EXHIBIT B. Attribution Information Subject to the limitations and other requirements in Section 14 of the License, the Original Developer requires You to display the following Attribution Information: Attribution Copyright Notice: Copyright (c) 2003-2007 MuleSource Inc. Attribution Phrase (not exceeding 10 words): Powered by Mule. MuleSource is Open for Integration. Attribution URL: http://www.mulesource.com Graphic Image provided in the Covered Code as file: http://www.mulesource.com/images/mulesource_license_logo.gif Redistributions of the Covered Code in binary form or source code form, must ensure that the first time the resulting executable program is launched, a user interface, if any, shall include the attribution information set forth below prominently. If the executable program does not launch a user interface, the Company name and URL shall be included in the notice section of each file of the Covered Code. : Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL. mule-2.0.1/buildtools/src/main/resources/codecheck/LicenseHeader.txt0000644000175000017500000000064710672263414025365 0ustar charlescharles/* * $Id: LicenseHeader.txt 8388 2007-09-13 16:36:28Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ mule-2.0.1/buildtools/pom.xml0000644000175000017500000000251111006063605015771 0ustar charlescharles 4.0.0 org.mule mule 2.0.1 mule-buildtools jar Mule Build Tools These are the tools used by the Mule's build procedure org.apache.maven.plugins maven-jar-plugin false org.apache.maven.plugins maven-source-plugin false mule-2.0.1/core/0000755000175000017500000000000011351411132013220 5ustar charlescharlesmule-2.0.1/core/xdocs/0000755000175000017500000000000011351411067014347 5ustar charlescharlesmule-2.0.1/core/xdocs/stylesheets/0000755000175000017500000000000011351411067016723 5ustar charlescharlesmule-2.0.1/core/xdocs/stylesheets/maven.css0000644000175000017500000000311310204257011020532 0ustar charlescharlesbody { background: #fff; color: #000; } .app h4 { color: #ff3300; border-right: 1px solid #ff3300; border-left: 1px solid #ff3300; border-top: 1px solid #ff3300; border-bottom: 1px solid #ff3300; background-color: #fff; } .app h3 { color: #fff; background-color: #ff3300; } .a td { background: #ddd; color: #000; } .b td { background: #efefef; color: #000; } .app th { background-color: #bbb; color: #fff; } div#banner { border-top: 1px solid #fff; border-bottom: 1px solid #003; } #banner, #banner td { background: #fff; color: #000; } #leftcol { background: #eee; color: #000; border-right: 1px solid #aaa; border-bottom: 1px solid #aaa; border-top: 1px solid #fff; } #navcolumn { background: #eee; color: #000; border-right: none; border-bottom: none; border-top: none; } #breadcrumbs { background-color: #ddd; color: #000; border-top: 1px solid #fff; border-bottom: 1px solid #aaa; } #source { background-color: #fff; color: #000; border-right: 1px solid #66cccc; border-left: 1px solid #66cccc; border-top: 1px solid #66cccc; border-bottom: 1px solid #66cccc; margin-right: 7px; margin-left: 7px; margin-top: 1em; } #source pre { margin-right: 7px; margin-left: 7px; } a:link, #breadcrumbs a:visited, #navcolumn a:visited, .app a:visited, .tasknav a:visited { color: blue; } a:active, a:hover, #leftcol a:active, #leftcol a:hover { color: #f30 !important; } a:link.selfref, a:visited.selfref { color: #555 !important; } h3, h4 { margin-top: 1em; margin-bottom: 0; } .none td { background: #fff; color: #000; } mule-2.0.1/core/xdocs/images/0000755000175000017500000000000011351411067015614 5ustar charlescharlesmule-2.0.1/core/xdocs/images/umoComponent.gif0000644000175000017500000003121710204257011020763 0ustar charlescharlesGIF89a9B $  0u y8@ $iLq 0Uy] ( 4 L4 @ @,$$  8@( 0 (( (($$(($$$$@ 00 q (0(H 44(((((, (D00 ,044<<$,8 0088 <<<<$44000@@(4@00@$4P,4@(88 <@(4Y44@ HH44HPP8880<<0<@88D0@@8<@ PP<<<(DH4@@0@P<xp(R7T ҦJ 6xziif9=vږfaڦTW>y~ jeZTHGx¹*^IETjj6Ȟk-PJ r۔`IE7L]I𒔣$q!Hoq1N ơC&  'qhU\& ƠWy!0ɇi:',sv, ;W]ڠ c<:({,[ȟP?P: H3{sءEE$ HB&"ca L!-fH3IO:2VpC `_Q 6$ &UȤ (`/TsX y)G֗~"ȏ~nqB}" oaAa]E0ڿ #0눂j +d:<1D">qc%`,3ÕCH )̭DZ5@d=L:שN^atAͷٔZ5pJI֔S- B eD'zx66 iQW "<,)p+"SF;GSЕ~MRTp6R@)eOU\Q B3Lʦ*u/(@A>U cW5 5il{NQGd&ɖL55=T +((CD&ڔ@BAhI,`S]傒UP$,:ʃ< #uhg+V#vug gn$qKI׸-K GT­ xp ӱ4p%թָZTt O*TSnG<ePm-Tu:Qa2˜j!Q9Β.jD]QeT埾]RnP-~;'o*Snny]ӚQIbXR,ve.[l6\'RƩݰі9i|A!p>G/ nī'\[L-j F7Ż ;i,Mem/IBf>0ईvYNt `ܢYEmmH ؠrZ=f,0iqHLdᜁyL*? J.T$A3brCJכ1qq8f/Q. *a8tmئ&)]3!/N`@`.@6_MGAeKxd.z.N8AR$`2Տ=S5fxaGOz#^?c` ƖU$ HP;a~ 2`9 1c=AtE*{ 'Be/aI#2CF\{0@Ԣ'08GP/P'WGPQ@49S T 9(Ph0}1pwwCaSW6 /"9(5` A !1؄'!@ q I"S'4?@* ei$wp6h}8U`b_dQu>MuL#"A i1)x-* m!0F_ E5ts?U6@(0n8/@HX P!0'0 7@ 3ASYH5_6YτRp_Ro"sW4pAp 갎؎x Ap4JLd%p'5{ sSy% t Xj~b PP P`X& 0p8P/F JC.`2p83@%(12iF83#n}WJ '\َ 0p4G0Y@H$c e=3 9pf P7h A0 Е 2}8ߐp4 Et\q x;` 0C 9ϐCBP bk yV#Ppg y)  A as  xZK'qРZ ЛLcJUW0ȩڕiGch:Z`ydZisDq47J30y |-@:[iUYz<`%![B9~ D#?IT9 4Cp 0 |&@Zʕ&*0>m`#CaLl3[p? ?jfPJ [%i~}4 v  H?qj:R:BnU*hq xLApgPz ]k] PZKFD30;#@ziۀLp'c? R` R [:|/[ XAsPVȤtp=) @R 0;Qp09jxJݰ3 ߳BЛ3-:z600j @+ 0Iz< U k@F4E)0 jID*ାꨜpR[zߛǰjx) JDC J70GD0K>; A |J U נ @>04ע^G:` B<,@gC P@!`WP0^Lʹg0+ŜKz6z˕6j Av<kxL hj|]] wȃ Ke< hZz- K0\Sb:,v6`h )pq:KT[̕Kx$IE1 PzÐib@{ܕ̤?@|આ \ ql܀`i,%aۣ2Е(Q,Y^30p])Us@nj Mx)͕U@ u-.@ѭ2=zLM#ѣ@^ t]qcT C\Y @z8@d.*Kx̕@^ , NړN;! B bLz d>=z=pڣPnܘ0^pD]ѯc zw_~Wrz-@ @ \ d.[0/׀@p0gM&0,/'Mz87\ FH_QG[iWU&:?`ROzB_g~ܰ:oq/b?zk0[Y7ž؁lox"n/Y/=_xユ%|=wonx;?BmʪN곏Nz0'^vt o 29Lz%i֐E _@7OLzC: "OB f:E)RbA 3Z"MgAdS?ę&=}TPEETRM0S̵,xMJ%Rn5a@#U>84WԙMS… F8|gJvrszb̜3'/#;-;ķ]at)mƝ[Pz^DŽRr%SFp-t^ڸer${ f缷[xΤǼ<#knzF#ia;'{C0A"תZ.9->."AN}|IþHFs  )_1FZ`; 쒬^*DN>-Yz``dJqa;X|ezd9r1~e`61yFԑx֐3N\-&? 3F~Σ !@nA ([9 **xPOq I4н+"'/y4b ە9 qQC84(#_G1z8k&@uc X~e K?l` fH")_AGb<v|^Ph: ! T+P56=(vt(؃"p_e=klR (` bC[&2L#4:Hvo0v K.vs`3 0FEǃ(!qF%j@ܓ J@0_bCNn=%d'(kcLl%%MJp@A9Vp79'E t'dx}@AK RF0*ЌhN&SуeiEF{H1Ԧrc Ty}e4$#(+Wf aebk6 eJ?w0B7a*T”lb% ; 4v_O=x4)ذ,-,b -j!}p-t 6׹υnsq WlhFQ.#0a -K t@0&f[Dx Τ,B&nqjD~ƀ :pWνE²9GxdkMoK h N.j aۄQxA"U 7pƺWpƇq GL  LqȂ/[ n# fAiNs"lJ)<" `V U1=K|l4:|khƁPn8'̀e1 :Є~xar\Ƶ71rC&qd TD3J` wJ @  T1%PXjDlDq}FPSp 1D"(ʣ*3 @H@x!*Q#AP UI栈C,-W1GAr\U*Pq- p 5 6@C5faDYCEl_ 1xAۘ@H>wŒrqC`@0Wk~63@u"FxKv;A n؃?|Ab^VxK%XDٜ'ww'4%>gc ykn [ɁPuy1 |yQxIP=;0[&0gk@'BpxȿЇhO xDÈ!&HwxX gwAy~H*0  Q@HF \AwP>H uBwо>M$; xBи&̉uP?İO CP; }H ;dpB3EdDOPDF\D=|ED CnC,| b X6@XZW2d8D*CBHD撄EILPL|X &kd`pgghFo颂Y0,HLMȆVh" h 0T9\E`=jdl*Fj̃hEd[JUp,8.@Fe HFHbFTnFp(\H(t~E"hQ;Ǒ Iox0\F&d[l[pt@DHȢ\Jl.2oJ|}8[I\=`KCIID 2ʇlFTJ3JML 0_4ȎIDǼ0JThRۆ8V ʏE*hF8[`˪JS3 ¬0ŤMF<[$ZH?I Ѽ0HD0̓tƦoXALM|3ʴJL R!(Ni,J<0edNNd.<(CJ NTL4P ϒP+чm'|\O: M4K1LĂJ̬,Яu2JM,* ֚Л8}+438I|L*F|L"CO#MHQ2G=0IORR.&Q{px9s R%†%)0甄;Q * zȁ=0!Bu }hr sX8S >pTw@ArY űs1DXTHU ]7^u.Uw8NxHry:ĵdtd'@'~8ĝFyxe]dEZ%Z|[tA5R]L_.{Hfb}`~fwAч;Nj dҭq&g6ЂrFDY8`kT{SM~( N.aG ~WfZ|zcx|]A#@j2v6~hy~{yp闆阖y懋w0 <`=g|X6j^i}eBi=Ccjta5~gbꮶj)Bmi겦TzjfkY1 T(궶ܸ\AWk=qM¶ܦZ+0΍W.iƖlpYmH`lXe lXA&lXoZåfm<ǔ. \ L62#]RDDĵ nS SnuRBYpe̦DR̳6Il.L|[ddeE5h(y`{W/ҫǿ{@|wx}֏wyy?Xg9⭁ F^fftyÿVX|[\C V`y~GwwğƟ7,h „ 2l萠>UD2)f"ƌ7fƈuF,i$<̘2[xyh&N.xYϠBMHS !V[BBaSZSr9 -ƒ-{fѴ=/S-ܸrޣJ+^-ZV}^ [1^zͭl̚qC3hllOWw/4؈/nm.ۺ+Óh_wϙ8~3ɧ3KG?^s]}` F![>A!x z Mzvsi8~AЀ:8ux邟:z^;3Okc7+O %ӯmP~AG |Nkk-l?U?\w1߃篿|uOwx绂heoHX1ItF#P:..Q ,=I |?Ac`4*%):DzSZk7@Ѐ+0/$ kpQ'yK/<ҹt!.|bHePЕ/I?aT{#ٖ)}8?AEM)XܗYQ!2zG0T6Ƌ]㳊.\@bX@nu(N2u\tLΣUiCO.sK[2qeζ:ƬK`Fhq\&3UB3"3i,b& @q<':өNu=`yҳ'>}>;mule-2.0.1/core/xdocs/images/lifecycle.gif0000644000175000017500000005326010204257011020241 0ustar charlescharlesGIF89a$<Pa $u} 0 <m U@( <$  (  8$$ P(( @$$(($$$ $8 00$$4 (,00((((a(L(,4(,8(,<,u88(00$0<,i0000u00400<@@,4<044,4@4444y4488DD888 8}0<<88LL8<@4i,~`J ̎]mYac RpY<Twm%ںc)83݅? ]so! 2? K )8-' s(8g-?ڰ,˛A>"IuFIT9kD;85A:.g~p!^\--nӥ9M1b b?qwɜ殗'@B,=ex%hG:" /mhC': >ba`])8/0:( >RFP«*E03Tӳ%3fgu6‚1ff:n^jM&QsB4]DŒv$<):.eᑓϞ%3e!|]Ãm灛9F4I|TR;13X̦՝WAؼC5ȋ2 P R3,2&Ԓ$`e}#+82OL/҅ WScz"9ZChw#g~3Xu(ϚؤM.VRIy:?WeLAԡ 6͗]B+&7]qЉfW5M,A@61(T7 O6'J 7HOsեhPCfK*JSӊNl@5Wյ_i\VsuMDQY6|ylT+8 JHv5gUکת&drv!zUlX tznw `r3N*Q;T1/IݖЮ*_mWB8ubP;X-\A* tx'Su;4D)_3 APUza K˂Tf+*hS>Kk_K_vs튯ƫ!j6.d?[ 3LuOoֵid\~uG5xЭfdZⱂژ*;57˃\=@NX~- 6I|-QIYDEN%*)OII8FT7jX!*Ďe_p*:ڐAx(5^X>;+Ey 7FтָaŪn4f::̆l%Ep]ӢH':GrKq^$ 3zl\V,H3_,h*-܋Ҡ Ymi , 81+󙵗}&/Wљl,xINYeF5qQ6v[낛 % Pl c0) sh#x?ϔ u:9]xA4u&|rġ]93A\ xCXAx{`iBFխ~u_`Nxϻ}3Ou/,ȱv>=h'Ok79鏿GOcO+lWcO7^Em{Ͼ> %1aB(QGI+KMO(QHEȄ  e XxZPc(THghV_Ȇaei(kmhoqsȇuy{(}Hx8*t<p:1X(xЉ87 x(Hx(H芻ȋØxƸ،֘?x=؍88Q ☎4ю4t6X HQ Pd+ȎYGx '@yP yu )ǎ)&YqŰ'Av.a 4YAq,y14Z@B9DYFyHJyONPRKA9YP`b9dYfyhjlٖnp piqAp qٗ~9Yd xCZ٘Y !Z`ٙip𙨙m 9t!@dI Ifi(p¹1 d 1𕅰I9˹_I p| 99ﰛybYIiv Y1P1pй110թ @91 p% ɟSZ@9Й p 1  %p=1:Iι 000S YE*`*u1BX5jq9µRDu]Gj&K6:Rz 9s N "t8ױN0ZZYI.ZP0 < ٨Es4k/[W-C!2&= r#=8(!b3aR"2f= r!'(S lêeTpU=8rj 00~ZSPJSIylE!&*25:#)%R015> '/-+{OZi5YPS6B"RE15q1dC1d~e7L;;֩TqA6$&i~) &j *b$J-0q"#҂$m1#-lZ!h#2cDX$'c!ڴ;n;VTq4rIR3D+;R3++Mg[6+-\,Zo0%q-F21{0f%[k~ajT"5V&Wf=#!5q¹˂2*9;(uR(.h4h^,^ĘQݼ=~RH%MDRJ-]LiƍJ˶ęSN=}ThlCETiNl"Q*F0^ŚUV]EXe͞EVZmݮ]\u-;TvX`…=Xbƍ5dʕ-_fΝ=oZ苑IF:qϭ]jڵ1[7~}nqG"͝?ϊXtǩ_}vK^u/3^=Ów1N>uK>#? @,wSpڡB 7܊,BcCO{⁧E_1FgFoq;pG2HE#D0fII'l3f;bn;9n;o[Jk&;p'LT%x>WP'⟇>z駧zb՗g,>|'|]9bK  ߇?~72?q , `Cj+`Vw Zq&@u'pBx$PÅ K.HE stA= H(DCF*oF4 m *CT+xvAfa ;$%D9QGs-BCҏqH<'H[C lGN`c(IIR)ހvl$,᷆HB !tq 8R#}rLjVx<)iZӛ6MiDĩ3=LgFeTI—anSZ=2xZV[80_4QXK  /Q%1Hî!a|j1 ]E*؅TCxL&OX!P{=P %D2AG1B(*⭧%抑vڵ9x _[_xf#{Jbd2i'YI'|iݭr7Z֨To4(_l4a9<+Drk/9o|Sj^D3/Iɏ &0Lo&ĝNA ֗@-ldZ^t>bJkKmas,DeL:%,uH_".]`oQ! 嫰_d! 38\GXM$m6 [ m6긃JB8y3@AкT[ѻX8;$y8<OOB3UH&UT~@P+#Cľs<[EXD9:t ^024E? 84<#@>8b3;[>&Եsd3&a@tA>.Q6Ծ`D\Sc[Fd!F?mDZV+HSTG @Ÿ@d;>;:ebp>h?c 3H^s|Bc?;SǏ8@І˹E:$lG<ǀuIr4GACI}ɡt K@wlxDP>pʯ˰˱$˲4˳DK܅d˶t˷˯T.xp =x#˿$4D4̸PtDŽL 搎L LѴM M:TՔMh̬MҠLM$ݸD dN0yNpL N0윌 !OL 0\a!OёP!'1UUuП2~a| P~q|Pt PEQMQ5]UeuQ=%PO1!-Qi M ;AHQR(e)]*R+*-R,-(R.R- 2>~<78Si׼>ťaC?ӔAESDuwJ@}I}BӭBW}, MAՓ(U^:ZF+#|3QU,p'q8Iu|eAp[ ]U;tzp6f3g AfjlBnq7tŽq(CW( A?9AP?>zuVNCTŞY?<І3&q VÏ9CB39>mG^CAD6>6Z?:Y:>#9K?d|>KV9k]]U i`sH^_EU_em_ u}__iP+APݓl:]3?[.Zv9"݉^fmX`{Ly\Xf֏\ u`k@0Qx`b""F#Vb#f$n%v()~*b++,b,-.vbL8V:ȇ+9GjMl6#Dķ][ۗDaC)]7c9e>`0OrDDfա9>d[>[k9m|ChTVUfVvWXYZ[\]N`HȗDqh k uІb`}+ 1x(15f.`Uv:1j揃}Vukfk6gfhfLg.i,1(uvD~eLHjT&v臆`x5Jh'(菖h_Hh VfYӒ }Hi]$+W&j(8n펅mvՐY)/ ꬞HH _hUU U]QWC |eHBHeQUT$He_LhƃHh>kn8(9{ܹQɜ;dٟ۳b mgG]C6TV9MH6CvӦvSPZ~|컃m8BPIEv Kl nmC; [\>,v͵m4ֈpl_Bn6LȀ.ɞqފGoE_ HGdV#¦յEp]=r}ٕ o3CᯛX'SaoT3NrF"TqOUN_.rF@Cp=t7t£3:g3lB 6Y/),դk+ 6k\$]g;uB`k9?xtI"ol/f@ @kB` h7rnodWkX=ڐDs^[Cut3~GVwW7u޾Lɖ['mZG3^G9[vN>vgonG?mxv(cST=.xC:3{FY.3YYY@*T7?;^NSE曛m@c/NecVU xVHChHp{u֪cW>y{` o 7aƗkψo08{goe@|׷}Hؼ瑈pk{&U@vf]FhxW~<rVT}Hyݐ8smcw MjwK\],h Bj0!ă5B̀i !$'0CG$y荺*W%3Ŭr͘tv'',d|)(Rx<5'Ө@ԝRr4bKADT3Bj`ZeVʦq[Cͬz(lK׮f&EB i6ljF*HH/fEsə {,nn&<0ՅZ_E ߝ;Y U {SOLx;-vٷC_Egix{7Cv3{ \7vq3KU%΅Keʓw*?̀KN4*8A5bM5Jjl ^ݾV.5P )^dddBdQF6좵P2mIcGJ{o"JY͖"JP$ ̕@vᶈ J4M֭4QEZu|WBTb\{zU.R0 )r }5 :BG`.ԆP U3?EQW 1UyK%2nXq3]Ƣ[ۏ͋wwBa#(q_|rZGI@V֛qHps=,RQ1TjJ=6~(˩:<0ŧ|1M5/iC_J}Q;]1gӾr۶6)#ci,H^9|Dj\_aGtNs{Ѩ+2)&#f @d1 "K|7X!XDץDPJfDVVj2G9gGՄC):1E &6˞VprVimAZ)aE(yqCZs\vȸ3/~( KrIyd2H "'26R$KHi%4D 0 E2Иh{A`HFe4@,XB"@ :PAN~x`=KUMʘF9NxPp'ٹsTEXAVΙp'/u~|bsNKyF([1᧨s,x t~V5D1梛6*. H!b 0vC/*әҴ65dܔb&)P '(?vY7}*T*Ջ.è%UJrE'R9ձfi;NӮn}+B:dv+^Q$~+` CKeJ1T~dm+ԫԸ4ȒfF`3͎ua4\An!|k'RҶ `X&0S?ܚ"zb|}p3Nן0Q3\]ULƧP.UD>1 p}Y}!r춆Q9myQʱg!Ve:Yٮ9m.:Cc} ~,B-9C iv|, xCX Xc+ Azw"a ;k!P.ڀe-gy^2,/9d>\5͠Bf9yv3|dA(\}{T*]?]A[SI^A=2 t>BWF(w@.Orj8YZQFb? rHc׽浯 a66d3^OhS~m_{ـfIok6͠ܞrQMhډV,BÃSDi8`w'yN"]-%lzwԬBZM=ЄTomosxo`1&?9Kq=o8ccmb%:Aw`6Izr^o[Z׬km]dH\J2^:EaJCDQZPyf(NXR,Ekc&pO~bN;˩x=WT`u Ry̢<!Z(;.Գʙ/g La0*SԌE ݬ>Eq3pG/0U{m:5I,rU$*/:%~ġXL=<{dI?yK?V% ]U=̎v?4 e U ` Wb ; `]` " < KS1` aƃEEÅ`<! ! !\˭VH0JGLU=;LI!6?ăh]!(L,6i۽3XD}=J j "! &!*"".#6"$"3#2%V"&Fb&^&v"'2b"bSl^4(bM0C,X-NN5i!zb(¢/0TN휢b+3F4LYAQǒqLB#8#9St]=i?XW98#=֣H=<#?J#(#@$Ad A&$=փ4Ӑ>8dCBD>$LDdERdF^dEGndtFJH:dINGdJ6d(JdH?`JdMΤHEڤIG$LLdON MeP*Q2O"eQBRQ>SdSRTfLz|%X' GXX~HY~Y"QZ%YZC[\eY%\eX]Y%@[e^f_"^&_.bc%cNfd&[e&ff:fBfgJfe6g%ff&ghehRBd,l&mX5&oop'o'r&d1pFAr>'tc=0'bt^'vcpqfw~,.p:'xytu'{ngq|g'y'~g^zMgwhTSLk5EJ&M\ YQ(b}^(SK!,hNh>hS|.<`G(ƨ(:5LB樎(B>ެ̇>U#L0DZHH@W@8"P@`0#B WoBY]EQGr\ X(WP<V-"tp@SBw<gҔ.3 q:Bqw0cAJC^Ԑ"(G\j.4wpHiǭ`G%EGrX++\'P!JJ @i/?1[0#^lN/T r7s03Np (nD;D2 Ѣ ڛ>CG:SC˪+HѨ#vO>ֹAmwS9S\ҞGP$Y24t9U2s3:oq"FW7M%ېѴ4רo [,+BPfH1>WMxMmpq$U[EWw7 H=,wxMG[J]xJhShP"/F.C RNPܵpD DUWdJJYsL'مQggSw) uLɩxSG`JcY>7Ȗʓ`~]E6sd;7^T20׮q8%Ёlsҁ[k8Ap#8r"8KOKVrsmH8~hspqɬ`#!w:8CkAOV#XxS"`f9%8@7yy[99qWT?+W9%99S S.FᒋG;_zFFt?+x; 4zStc@wz:pk1_8X79g;"x?3#:[ tպw cڻQUl$r y[8/@;ú+;s1;yWf0g{1"|# ;績7!xȏ{mJq3^WT}NԪ@pT=pYǺ {G+7zyGSy;_=xI?T\;A C/=A"S0{:C VJvYP퉊7Q* W|(viu9Ap͊q]{e }qUy^ʂ_)"\9sD(8gns=x[zX`?=T qbj%$O]J4T?IbvR"q ^c'6Ѽ2>%xBF_9ddF'}? ?h\>T- t`Z쇊πB\r %4 3Hp)aC  އBiAD(E4"qC(^E)NUE-jQ[F1Bq EPA !!1mt#i1f`xG=}HADA HE.c&52W?t'AJQ~s)QJUNt / ŲYB=/QYJ`\x !2M2ː)J&!?M`lY WƳB=RT#%DfEDSmQJ9Jl M')N]@&qxSOA=^iS.}U?fUp>UZUVͣjYomV?s(;V,G=X5aX.vc!YN Yюi2}emjZ-mYk-o[ \*d ;[ַ]mvGq{]&.t]R7u*nuu_Uٯ~˞70; np`Cx0a0 F' pI-^ x(o i d ޱI[U&Mve- -ee1e0mvsfLue0}󟽂/Ѕ6te:эvhIOẑ&41$'zњe>ԥ6i1.mjU?YvakYϚ֧'jk]ױ,C0le/vmhC@նc *,h#Hѝnuvoyϛo L@ 7p'|·]M\ 1qo|>O YnE<O;ɱE ϸqs)4KE8$JUՕ+{/*FMrRh =Xv0=wO`Gl.s2ӣg=uŢ uNnPw-/9cQ2vӓKZ o> A 8y[Q!K ),b)!,NL7yPN“8drxtd(ſJVr?MK*~~e+Wa7n>@@ş~K@ F$< xV9 27ajd_2"V2Ba28 =dzT߉=C 0%BDCd& /F `p!t%XOWڣ^DP~eBo6@dWe!F!}ocuYOUPdjlE ψ P08 o 9`  `B0" *  0 w %c{)'T'% B bbdPba4XX `P$c0QeF`Hsn`8>@h1ʐn1 leԡ!#f.q "qzOd"^\ʖpfg5b$,C Urq eWpd$`ш.719 P0    !3Bkgyu`+'`D`%%fhփ{%dBaAUvjwT#&b<fH4$3n /l /2’"9@> 9.?+/:"ɸ// +p1# i0Q. *2P0N//R3>`>   `ڐ,MsnS]32Is!L*E`bp*VG,%<U5Wyl :5 UZTύF\A\Iyq3 H\ѭ[-IU\܈\/SAH/rRS`u^t_T1 V4;X$UJb6FS!e$qZ6A#zt}oe8Rb" NoWd14)u#Cwfi-7Vqkr^6Zl-`.ύoG"{W~us߶5I"q" H}QTmT=wm{"pD]}/[I7TtZ!ڔ`!Ù @cb:Szo谉)&no)&x]8%~*-%b覯%P o(vp΁B2S! +6]Ͷ#0}{zV)"VՒ7oPԀ.אZpz 7LysX-K҃c\0$X$n7dIC6+XetCL#Lse+/Lse\9kh( vn7]Ѹ6$4W}usw5y?oF  VTv?|[YM0@&Hl^$ Й"V Ru0wmH?O'wy.+VGYR`GУGR]+"Cr6R=n "YS-@E"O5#ɤ2Zkn* $HS u4u2$FFH|ڂ-GZZGsyHuq43b:HCr1y`$ܔq9}?@# GIw1!sxazN ?ϳY+CZCA5*@nT:6j3.gEuf3T@zɪ @@!<1"%`;G.`HqNB#!=a(h`/ g^Vj"C%.芨-'=3%@)& ltY]a^l%l# +^AC>G~=Q+;mule-2.0.1/core/xdocs/images/logo-with-title-small.gif0000644000175000017500000000426210204257011022436 0ustar charlescharlesGIF89a&!!!r]]???ce<<^**666upAAA=CCw]];;;o!!e33a--wwy绻DD33ff""ۙUU`..̭᪪ww|qn##ɫl$$FFFrBBB<<<P((GGGs DDDl66񓛛$&&l]\QЙC-^vlonC.f!&\rB<2Ŵ EC 4҄(|‰+4 4I.PB(W.#2hBP!X 0/U#NAנ<4D$ʒ !2D$FNZLŒ0`'a7]d6l (0e12„6DHHQ(Upa@E꓇<}i DCG+gVP b! [!ٲ'2ì%#BUҗk!AG%hcѦըG%MaÈVy#"K(&B1`b R0 )؂6`,PDmAhB"3'-iMKaH `Li|^!NZ(JKfL8Z6rQ,Mk9N d?wε]Z`J=in'C&UW+RՄ"N)# HrJug WUiKG 'F;^ ö+Z]p`LԲP'L3Sԭ3u]ٛN@OZ0Yd^+;.Y-l[ɪC 3IXӯg(0dE(*Z*Űgim:U07ekQ6$(3n& u^b$64`,88 plG>9628>{bX}-B% J,j ņ纖_ll[](2J}1Mbx-+TB@~klhd}x=)i- aH,`VcZc}Fpىt/\nQPFqn4/ }"F sv/`WNo 5=a8C G5flv:3D |O2u7 X"`$3]C`"3ǀI/:#$(kK/IX.ۍs0VO0_50Y 5`5!e{ʫ022w^"NᏒ 0ކϖFkCq7hwv|Ѓ]GhQi#'8.0'NQ{@'.̰>ء_~CqY4=?YBuLa!z#A͎цwВ7{o]OD [P+jCDѹޙ#Žp9B20p?y8݇G9 6Db>ƿ/L 81 #tė )_ˇzT/#P?Oz\ЯR|ذGNi.& "nth'}rhʧdnn5ȠFv/ccd}pe6kL}uRjVؠpT~wk`]gǁ!fG$C%bDƤa*vLTx\:h.jf% i[$ TdK FPO`P@fޅ ]xHŵ 8b)gWDYA 0@#p^bdTexKHK8GPeHRa)atL|kaP mHb1^煈FAB$41fa) PnWb[ N$\GŖb5uW0x$,SX۸,"QVhE8PNtS9aŐ4 PsG0WT%ƄӍ^"J808 A >YaZ-)S 6T7UGV#6KRHVE$V>q">0nDgI?{XSUYa"aE W4L4ЕTN0S`$8I={C8'?? x?5t1@uCvP5 g1j #բS-:!!vCfGivK#SЊS *A T!A0W ?0]j!x-fшdH,Nk-{QqJ! Pj/w(`z{Чi J!M-U-ݲ1zi"1=f9.z iq "{"P,Ja˲G-tAb!Ί?6s-xíݱ̂.Z;8xjXp- /{@Z ,;U` 4 j\ f Iҩ&,( u{ 7 _{!,f-j!40 : y-يI@ tp- p-;@j hѯ^@,j~aAдrFK, @qu;VP ' ᷶Qs{'A ,j^WqNh R),;}IpAz[a! p jʻoѦp*CBIJE?{E;[{蛾껾,EM` P{ۿ;=-  10"H,5 "<$\&|(Ȳi0D4\6|8:<>Lk{SPF@JLNPR>>tt}iiPPPm99~yyKMMoVV`ns^LLî)((ݥ𸸸qTT꯯^>>a@@u[[Ҝgo66S--g|TT!""uMM[//|&**EGG!## ;<<ou;DD999⳶><>xw``m""w__$++&&{-''ڐd..xya++Z00`_zYY{__m//~\\r|{{r kwk##s<<>AA===444v]]%&&&&&:<bOҀ )@&? q#?7Cfu_їfV Z#R^NM0QUaX}zM[WC +]}P7U "#5H1)b o3teX."K/@:jæ%djm"at<,|Bi,sIJKR4xU+p E  8ݗ_HDPA  #P ~!2t'+P !yQP*347 8>Tz yQG41wX5 4N 1 D0$ _,Ԉ6!90C> 34h5>uH A?dmPkv v(i ȓR%EeIY Ր$2PHX۝ʘ3, E|$=h2 }ATfvq7w$\K` MDžƑFeTQAaH +%Ze)abqudZ(Gd',օ\rx||)vd+BAt`Ax2 TYp1{R"z | % gg~QQcfT )!`v!8Q&'^lRuYozq&&H=[g Idf`ǘܗ>$*$_&A$ez!jf؏ P1H#%ԗG~ &V{vx/r} τ6(A]A'e^2)u׍;x1b(0Z|`2؍|,ҘDf%Vn]kudW:GG!ٖUQ[¤kcaQc,"CX`-4= vYXGaC ܀'q(p<'t_Gޕv>|x[n%FUN%6ٖwzvko^=EI\4Q2 rUX>zSW}uZ,}I/|J世d\^-I\b*}'3̡;FϳE3MX~I_Ňz^+"8+LlB=b ><^zL3f&9$g2@w5AT@h w\A{ E[$/&j1p3IK3Q'W F["PaKԂ3+A'%xYҒ2e1™Y~sUvL*'YrAR=R,X謕DhBMȧ>!HD$2pȈbdB(w=5AG, 8ycg<=#:멥̓2d qA:h據Ƨ dvڙXjy\ f`[Rc5D*nz<$LIVֶ̊&Za[*^EtkNJTk\9„Sa1H?d'KJVf7z he%`a#$ ֺ A2HHv%\ @- :@J$J\>yIHmT[y൚K(`6Y20&ws] X[u:c^?Ƨ=i@XJ\j Φ|qMX_Ӛϐ'$b;zKP؊Gu[X%Z7hhvЋ8@Șʸ،hN`+pؘڸ؍ٸ8Xx蘎@8XX%XwvVsӏDӱp.@! SX _0$9a@ W0;@$Y6yCs.ɏ &@695),ٓtWz@PI~jcvp+)RbOrq!V@EB N(B&cna2llK /-ݦ|x}T/1*F̹pBRITqAqArizb~kA. W`IFkqAosja$ Q";PU |J \ ufPnp]S)f!|I5+I!E0VP/;eCE qO +iY[!I1dzfhiu}Ւn6WJr:uxkzmڧtQzjT:P:Zz*rک+Pzڪ;mule-2.0.1/core/xdocs/images/providers.gif0000644000175000017500000003237310204257011020321 0ustar charlescharlesGIF89a       $   ( $$ (($$$, $$,,$$$((,, 00 (( (, (0$((,,00(((00$,,004444,,,$0088(00$0<,00(0<88000(44004@@,44(4@,4@444@@,88@@088(<<DD8880<<LLHH8<<0@@LL8<@<<<4@@LL,DD0@PLL<@@@@@8DDR- xN9iS3Z6zY^ͺk68o/۽L{q:^ N8Rmzs.7Kx4|)lسKerUñ=_> Q8eQ7C־W~IJAbT0F6I,Ƞ'c0f vW'j50hY5ݱ/rdt6zF,2)$^<#[WIpWtϐTV U? $4(pt:!yga!lĔcZ gZ+o@tH?6Qm@(&%ϰ@!Ů)x3H'BdjbX  H3$p0 o EtDa 0X 0&AC%hG5 JP*+BB`36_6 &5k:s!6xR┈6Mr!8V"yj<:Εş@Qm0%f4P<#8J(̅6P)V $$ E  EY [4H@.xџHx)ޱzT_=zꔟSz-M0~C?͗X XkZu5MWֻy +j^ZX !ɫ`RBI`{*Ve;{XGP%cMۚѪek_{-gqWV6.3~ Vp <4{ DčE5ȱ=J 9Vŷ.GQ#[$"=+.EHZi VdF`@r%.){XJ;&"ч@Xt_m<~  8m Lpq,_n"0+ 2\]Qj 0d GBψ] * ʵ1A! !pDH~L{ h+|B (0+Q]ᰂC0\2Ű@ \f@L{VC6Hp!gO"`s{>s\@r4&d#wT[0W hB,~Ģ %3b# .(@ 2T-!<8b׀v]FB fܬ{tb>!iTϤr3P+pF "7J,r"7ğPrp2TЄgPumǟ r `F.~ .f0I\!Cy&tiq? rNwܬR9IBAaGM?.ގ*8eGNvQ-\8O/=H1Gt=!fLev_"_=0mWԘ@n zS vS U Gt{Wzr}'w7ye7%`srr ǀaw'82Yv1~ 2HVR&@t>y Xz':'|ryO3w'qW]67ytׄ'{qKFHwga ?(Gzzv|'P[ǂC'~Cstgc}yȁ|xz}!`6&&^|rwqgsWf(q\|WzjvWewo x  Ewq Upfrnpu8Wzz{|(`|,Vz‡ у`i.U7sъH x|9hqxqܘ&(U`sGhbr/r({%782 쇍gר}'|4K-h/8Uvfhq?Ȁȁ{ x*x&$'q 'XWV@ 't`)t(tp{MAf d1 1 Y&g~wݧz@x{8Wzx.1Y@ k1rUYC&_(M(}9لɀ'؄AG uׄgXHz*g- _"0l79ɎX=@rM0s$>A1`'&I>@ ?r A^Ij;Qٗi+@&*@MiOS R(院 ="~Af@tq՚@ ! aM:j? /; pP0{ 1/K`+Q:bD R{h.7 !PQ*-v{4c<>1x[3KfX0.-|eklzGQQ;~@3Kk ꠸@0z[?[26 벤˻@+ۺK0 {ಋK*˼<{仳[0{KΠ ;w? l; K<Pg;4{  L ,xf A,|LHe5$L+ĘEN3Ć{̛% J VLR0.̻c.|@ImVm tv/lf딃@ a\0 ޷*MLδ-P{Ȓuڎğԡ'1ay<ŭ[+nũl `f)(m\à$4Vk3Ȓ\n,c<`Z.˞߰b tmMP/NaX.VꥻO{5k9{>h@X dnLo;n-K5}9.k{?9;f/ 0fF q0<*_ޥ?P]ЁqtQ7L 7= g0 ܲ?8ͩM.N  D*t vfDQOF=~RdH D)_B 9jSfL#męs eH'kR}7"c:5UjGTD8 ) *5p(Љ*Z8UZ%\ !<\rVZC3 Xɤ3zӽAV V}+_;MҤwM>7}}mP <0Y;2ǭ/lli?wK+U=נ~=wmԶ8 <9[ 6Cѣ _`G+m:nDeqFI鬡-6"@|PpoϡCt$Xgrǩ|i"'XGO4T@e@k!}dÉ2K6 'v1*5Z!kQog!6qTQ+щ0?ه 3)@F%2 L E3Hyf i`K6 \]uvn8o21FqFü3.NܧwEDϮ)PtB9 v#_C`lj?)'q\SH HIZ1ta'PLvE^ب˜mؘͮMYS7brЌ==r#k6&m=x6ErUxر8_v"r3U4 :tb.n5^ /Q1л3{}~aVUӢa&0b}  'F`Ȝ^(f }6枤noEGk.ҡ-H_ν|z$~`H\4}k*o΁1JGx\ʕ&ad3Loz x,ԈWµ qR2 H!aXXT8L#CQ̴G|_ ~r-R;N֙`jdPC@20{Å< u$=PH!a U NApKpd]ဨ-N}~bD-)ej3Ie80I D*UJJ`j+C)Җ@-u) cQۄ4b`niAEv9@8Mn \g9NB (I)NJ'LAv``;df4g8+vVԕD 4zhhD,UZ15'@# tQ #hJ!g4t`FLe:Sfc9GlFD?:S'TI{$ifX;IDTF8#aȆ}x4xFQW(W=qulIHNn#,;STIWjIGɨ)B@Sd탤8)cd JzƎM$&*6-X{wFubkׁ$}8Y!e{Y,֤lAj; %5""(HIW:SϼT%bHSf2M6(-%$CvcT(8p[-[Qļz Lb!x+uВwA$=KYCT3W-!qd(Ցy#0}[f_F1:d΍+^0Q1ߡJa޼졯IKN;BT:א,6yuGcX>jY!]Osؤ8HRcVedC :7>ltܝFm$HCBӜVf&cIQiY3׭V6 _]觽!_P<x#-GF@#4~H]}#@6,ʿЏ-n@%jy#\> 20Qm"~Z !lWm@^z<ؙ{Q߃0ؿog&aeGqN„1(+OB $χo͘O_5 V(Set6MnZ]#9䵊u$1]ӜV^Yx9G޾i Z∤#0 ~{awm <5A(ƍ6gI^'/oO\lC|G(uyOs2iVOԣFuAQ,7w54=P[{/>j~,*/ɨ̃|z&_Q), Ùf?=`8p8Ȅi?Zi> Ї)  `?ѼP 0  *8@Ahd(?Ğ S ܇[@6S6A :+B0jh ph%CtBhB\AB,p0!Խ3DX۠?8j؁?:BC>?\0D3?K \X7مI(eM,k/'Q(S#>rL*4`xsXʯ˰˱$˱Ă;*Hy<ʑXJ4ypuCE,C˪DTO|Ԉ3tV< @TN㌀O!`9̅d@N\˕̣ΙҜKΘG4N!dNYLtM*چhDWLSYXOUOE9QDЍ^NxPPI(mI??PqTQ.5MLQI-%)!PM!)) ;%\S2 NS9\ȅ R::ilД8Ҙx cPʪ Λ0sPɨ=-=NASh?);MTh;hOTUU@. RI, U)AMSU%hSZ}hR=$"Hm r H |/,,%NfhHYP!X)o/EXhiX5XhS-ӑ<{O&i%IhBVTVfuVYR doEYuS\ԴW[4RxҜ{Չl{54r%,R5NXReՅUEїX1-N2}m86-UUYؕYIVٗYqUTrY:|T@ז(̉0P҇z ?Pח[ Ի}\9Z.ϋ=NeQ3g5VeۨEYaXe[SC%8mUqMF TԩMTƾ I\S5ίmmؗ]խYϽ\YVuu LpexW ``*%b-9buۙ~@Hf9[@_!cc x@AS@ z(qpMKZ@UA&;v V0URaOFehb]`[@<P\.Gk^ Me;Fa҈,5ghijfj^uCnD2І0 qщJ(7RO,M&kh6|>XqT2߬RFhofh_fon }0KlvΨHK`L|E6i_ nh5Mj$S~S8\*ds} fD8(hW|hvVi0 LIgJmޤbaff;ueD+`j; 4`(^ۜlj֐"s80҇W\ q8M -`r wXX |p J>vg0" Nf1@pg S8֬Gi(N lHܮC:?02Mv˖f뗫h\Vn+n+!8"&> Vfo&&t(ox#[ȶn"@Wp hv. [PbP xq2)VX$V@w dxqזH?q3pwqV0 N&0鎉"EZF@Św@tprvfHޤ=t{Qu& ?1^ 9R!bJ^h:R1BD)FԏDU1P 8b "n`GLea0@Ul!*20@m,pxϩ.?0(E0~.)merJT 1V \Ĉɪҋ=żh rBn;Ϝ (P¸tg51J1P\XK5ǂ|G^j@{<R}K; >Q,[}5!5 :5ؖ!sY;4i8jMΪeˍjoCIjGt)=7m`XWQ1`[w8 aG5O x9衋.zP6yyMOm>\깇; oI? +d쾉;7Yzd;R;4O==e=p|3?0s@w4oZ?#LF@y "4ARAa0 l G<##Jv{\;1ah2NtH>!skG^@%qC$T6`Z,B/*0CʘoQL"SgElPG7rp< ȑ@ r{t!q3R!>N5۪aKQoj3.}+IYJҐd'hb)˰'%2{DP8LKp+p"%@ܦI0|ۻ287V|7ݰFq,,hL diմ5"e!=J W*H_D:5b*nۖ'<ѿ^t[5ګg@&m)nSajz Ժg&R_:5\Nu*TT jy;M$NuD0O8XS< 7=kkTA& Ke=+hZ`6j7  `QDBAGܓŁH"<7Cp1t4—Ic2:mjZ53k5tSnrWu 5nDBS ŃNg'eS3ѶE .A ^-!ޅU]Kn3?FQ {kztp\(f0 M/.,b"i ;;. b")^݊w]k8"1Lz8(d,+97/+J|brPy _O7.[pA- d+$ ?۸9^Ȁdi8x]g=$7GQI2:ўYhuތm4jiE l yq1քulNK ]$5J;mule-2.0.1/core/xdocs/images/receiveMessageFlow.gif0000644000175000017500000002110410204257011022051 0ustar charlescharlesGIF89a{          $  $ (  $ ( $$$0 $( $,$$$$$( (0$(($(,$(0((( ,8$,4$,8(,0,,,,,0(00$0<$0@(08(0<,04,08000004(4@,48(4D044,4@048444448(8H088,8D08@48<48@8880<<88<0L)pIlĩ#O3 JѣH*]ʴӧP FիX:+W[ v5ld%6յۺu.غv(p} Lvp^R+^̸ǐ#/G˘3k̹ϠC{,Ө^װ?Mmʬͻ {ȓ+_μ`УKZAH]pިK}. )ih$HrPh3%¡aM%hTN}XGJUNh N%0 ⍁,0}T 0X^hx.C5XY%@ɷ<8a8Y|(s`8nZv嗏ј)Ѵ`4ۑ$~>)P`i*zb|`*EI 0Y6G MW.uN􈧏Me~~ (_j2߈ 5jdx MG#gXˏ'FlV{٩f#vކGq+AE@@ NdˊC J)*$J,403 TwT,I0l23Ah* $ɤœJD Y'cBA"DrTW}.+@''GMmdM rpɺSb-2rD%k1Y;wQ%IQs_g'2㎷\#nyce9P`z 2c` } `n{B'Gu ). '; Ƌ7Wo}5և Ƴ`@[6.Y#)' H^)S-|P |Ȧ6nz+pd@izW#BAN(E WD]).o) wa_C4 d>/xqG_.}]x*{$pr4fAbB1z W}3`AmjzcByٷ}W}yݗ~7dp{|G|U|etzgr xqP q@_Q R Gx 2 ǂsuGB~7x@'Qp 0x2 p{GyCrWgAj@V/nW0ly "Ga$XAhPWy ^ `XGw"ă=` Hj$ru|a T thQ0HQJys+~un*1*({} {Q0yC6HrdVV h }G aFp~$ dn XֈB2 hXAM(xi\Ӏ \3FK K Ơ7@÷xb ʠpw䋢},@}  BHw.h d,߸t+ْHAVA+O&{Dv @PGA8c5&mvpqH($P iم@ICBxoKxJ Z ݠ ĠEՠ Z 0 U=8 ;N4I ;c:Ѓk *yQ,t u{ .g i9n(~Xa}pQIYH~ ™sw}wp gY| rc n99/L0jv )p'@{y.7){ʹ}[=V / @owcˠE IZI a '|ii; nnH N \ I EKwÇ՛ } LH}RTu |hyQ`*YAЈ}DPYr0fk ڦHJqz0%āb,JP Pa 8E3ZT:5` ̐E @RJR3 ʚp ՛N vEV \QI9 oZfpz*Ed6q# ট2r `X (pQ:TʭȀ%9Nک 0 ʙZ 0 N'/ ꫴ  >ʲ@z 3@8@@*PV6 F/P@@dpQ HpUWnƏU{Ur+ \@XAuYb[۵A ya +4P[tC7 y% 2nn0/ګ0 n0D;Cb8| ե=ՊAWBfHhJw` h( 2PAG nE;n5@ J6Jʕ2WsKnEqR܁ QË&JP0 u@u` P i2#0`9@2 ̫ L #:%EɴfdžP $ hg$ BKwyQ[yA Ïp{8dWKw!a*+kZJ qek ct9܍RäruvU|k웩U ZDݠ 9 4(~(Z.A2y/d:~SR2 C\qāiʪL3,ʑgϨ{{᭝d[ ,U-E}%n`-"-θSIHk& GA> H p:݈0~( 0~].H?<{qaͮXn@@:3V@&~ !owj Z iǓ7I}ǹN)_$CNpr9wvv;6LΊ4nJ3`sԈJfn9 gf6 1)tI鉞Iv/xo{ydG DzM,d_F9$(oRԘ*:(p>'[o,`pQ#kKڍ8q6s(v1ktw(54r*"vwhe(o=ՋN&u+^|CذF`7f6I`jF* a[ڰqܺėv pFf{b;R?o db3vOrEmGW)UIn[-qU{f6Ymf{{ f%+Wps) s_fAhǥFxvͅt%.Mђ4i+w‹ftj9=jRWȹƝrRyӭIiPAa6cP Zռ6󫑍1_41_Pwז7'ƥvll[YFA+fmmwsȝo79F[{o*Fxjj.v8qWq+O1rMo@Ur3ee>s5Lqs|7yMt)u~t71uWwյ^uo]v$dzL~vO}m;N_zyN +,7|x/~w^򇟉/sO< d=_Uz<}e=k{?|?|G~O/χ~a}Wӷ~{o߇}?~?]GQ|E??ǟ@H4<Dd@'SL 9 $A8eHd@LSJl$ĬĹj !:gk:Q҆$̈%:AAB,B+@ʚ#0 CC0<) (i7l(,6T8C C:=C>D@d;mule-2.0.1/core/xdocs/images/mule-logo.gif0000644000175000017500000000003210204257011020167 0ustar charlescharlesGIF89a&!!!r]]???cmule-2.0.1/core/xdocs/images/providerUML.gif0000644000175000017500000000563010204257011020510 0ustar charlescharlesGIF89a)[[[mmm3Mf::WWuu3J` w(/7>FMUl"Dfƪ3"J1`@wO^n}Ҍ"Df׈33GG\\pp)Rz"31J@`Ow^n}"Df3M"f+3<DMUh|:Wu3Pm33MMff3Mf"+3<DMUh:|Wu3"J1`@wO^n}Ҍ"Df̈ת33MMff:Wu3(P7mETbq3Mf3Uw--DD[[qq3&M3f@MYfs:WuȒׯ33MMff:Wu3M&f3@MYfs:Wu!:,)H*\ȰÇ#JHŋ3jȱǏ C1ɓ(S\ɲ˗0c|I͛R'ϟ@)DF*͹BNJ}uӪVj`NDOD)Sb֮cV`]k׫ۿSlݯvN51H˒+y`Ƞ=xp\хO6ʚ۹ϖCļ.jِ}ȁl9Oܺf[rG#\M={o' [}[O|rwL>rEYw1V x} ^uTj`~IrȔ 6ta%hv'Zء&#38Ӎ84>f$@9HƤO6V3R)eVVRm\6cT6 ?y ssWsry'{_yn=h衈&JhV٢>YIQV*h%q)*ujmfꕲUH6NZc7+2d_&{n.KNImBVq-EX*}[=FnJNj}lڋA^++H* 3 B̢RbrDŽjl#ml)8`A&  aC!F81fԸcG=9r"H'QT J/%9f͇2mtSgϕ :hQG&=SiSOٓͪ5bd֩4~Uvؑd͎MZhݒc[0+߂W +Ӿpļz7W;Fa _ܘ%䔒-F=媁N=ukʪkْ֘qAWnZjϗ۶k{#:򙼫C6tyϗO̼E+-|po=ϫ.bm5 ɹξB ׋Ϣ -Lp/~>Q DrDYPUqC.},AL6$Ԏ:ʊ HM.H`ѡ,Ҫ..1)G22M s6S39N&L3OS52T̨MTQ [G&I|NC4AM+4-OE2Q҆H+I/=OWCPX+u:U/]!_5NWTa=a\SdPd%\Vhl6n)O2ŝ\;sMNvc{}M}߁ ^~.%XՅ%9<?}XaQJY~xaiq>ky.s瞁砉Ns 7Q 魚vꨛzf'z,e;e6eVdv{d{dycs֛cq{ckbi ,h „ 2l0@'RhĈ7rcE G,yQɔ*W%L(cҬYӥ͜: 'F@I(҂B2)ҥPN4J*LXkK`"ڴjײm-ܸrH.޼zjfYK8`\c!;=:]1#:3bOh01j8ڵҬiOLh] z↚yr7Eow\wi㺥NwⷱƝn%?.t׭};cmׇ~ {8HXx`faؠ~Ρ7XWrma!lֵy#Fۍ( h 8^v,"w1GԎ'dGh"+e@Z9Rhaac}}445444///...hSNb~VEFFDXi, (` ;!!BU!%%"6@#%%!GP%%"7{@#%%!Gg+ '^ z9!!"AeM<_Q>8:=V }ytvy}urmlpqwnR3001Cqo]2?c I#"#0pZ&!!*fO %%$5rs.#%%!YO %%$5r|4"%%$\H /r a)!-k[JOOLTx dKWj mule-2.0.1/core/xdocs/images/Interceptors.gif0000644000175000017500000002714510204257011020766 0ustar charlescharlesGIF89a    $     $ $( , <( $$$,(48$ (( 0 < (  8 P 0 < @,,$$$, $$$0$@$8$$$ $0$H$L$$0((((a(P(](U$,,(Y<< 88(,4,Y,e,u,a,e$0<,i(08,080000u0m0q0} 0i0u@@,4@44404@404D4} 4y0888PP8880<<8 84<<80@@<<<8)/-h ΠN<"X H3xaV dav=q脈;0h9XHX(@DO<@ |hlj Vh9he3'~ BĢ֕(:@*y(z +*ʕzh.kUvډUmd#6.!+: su,Zu!옯)yioVnAnk1s5o⨧"s _)zXpPo )3F̘{ϲefvLm>\ P.`eP{'%ѪviBߥHF]r5wDph'Jfi%^mawogUU)m'W=A"mmx?QW~=qmem ģSĮ{`;YĻ 'XմGiWW8'uY/>Xݧ~WfxrRz(dD ?aC_8w t#~`ҏ\8xV/&F.$=4o4 d+P&p@D1 -BHL&:P\!H*Z1zB.`(A 9x*0hL6i H:t`6(01 91DL"F )JZ2Ps&/QD$l4v<*R2Td*cI@#l:jIYi˥&KA0I Id&:pF2&6+vU6q*Rf~d1JЂuɀ ZSAA)"z48%|J y: uH->Jӷt$o`2t JOˆu-71TeX):|0K%P ⃁toE> >QתDohāҪd @|Ζة4j!@GWQUò,q+HTx⮌*^_:ҝ D>G;4C J ֞DQi< q`֮Ղ5Lպ&mCzұBuOl0j7USwJ!]D EŜ*ZVbUo>nD}g[XڶW ʨXYKBz,̓#LL̅3al ˇCLb(fʉS▬0FɋcLc8p\(GdBd HF ,^$$0J([!B.e`NR"Wyh=l4y _@ߜ2Sn^fL̙ςGGMBЈNtEx! E;Zaq0XJ[Ҙδ7N{ӠGM8ԨNuigMZָεw^8,ů&f;Ўv=dKζ-mj#Mm{;.vܮMzk%N~$ַN</>8 C|`ok o`\;Wkc#u(&8Q L@'sC8=Q!@Û:靆O]_(< $IhH2RzNeiG=Qux;w xB\ AJ*SL S$5LY'$j_7e b8zb`@14hHC=n |qU/%y&ʷ||}y v}Vwy wpWPgW]UU@RC qSXg\.uRE5]`_%XeXWMUTJ]SGZ]X&e\HxXP WIXZje]烌Y1$nU | ۧ P pzwy'zqwW';{g7[[{5XqWR]E|]c nXTXՄ>ZҠVIX^Չ'E|aX\Vńgxu`c~ym7zix0z{nww yWpz ~%~g]'EWQ|UňuWUՎc|O(\K[ whsXpހpipwq7x`!X5vY uX?(ՅW ZXh5^fxW=RlU 3UU0IYeePX]UT=S')"9pnvWIs)A/pULepUg8V'Ƈ_ z)_XW VjVuIVvX/il)e_uUEWҰW%`e[Fa;ЅjXoA%YF X1`e|pn!$AyAP^Ɖ9lʉ0љ6QiTةkiމ\9IkYCpfש9 q{I)l90)Y|y`Ǖ&:Zzڡ H` 1uŠ .02:4Z6z8:<ڣ>0#! `^*kݰLڤNPR:TZVzXZ\$z0(lIʥhjlڦn:^Jielgxz|Zq ulwڧzV vV:Zyʨ 0&:~کlJ  `Zk *FU Ėzʦ*eu@x vfZz l `4:lzZMf_mjjdE*t*l:ʫjSV֙`:k qJV0e2v {d;  Jz #0JPp0p 0;^g2ᱵFf$ {@&{ p p |⠳HX>i"[k-Y{ 1UDE<[>WP # p{p g{ 0p̠P J@z˫-pbȗ_k\ #!|8EK/mp[A; P{ 0gJ gP&; {0+ @ڀ h ˹P OxU0Zi^0yX {v)ZW5SUV]xXҫV;yRmxU*)Vɔ [VjQU_V%Ef()A{# & ){ 0PȊP [WO%""(@Y>@xRHV(ǓUTIx=)YE|XzUTIY_ kSІb5[T9^SY,,ulR*M̻{2[  ?G+RX8_WxXG9Y[SIJeѮċeڵ8@WŗpW4S |# 4ݧtt-q9[XeEUf~ެUbeX7A^{xZ+N+zStiX%^?'5SHҧ)5{z pUs-s k~nP"mɷ׾L Q xpחؽ؎ؐRٝן)Fڥ֧05֭]ۥjVQm۾ =k۝P}- }؝ڽ=7Q=3 =]}}W7jZ RP >^~^NM &~(* gt:ݖZ,^6~8^.NhPd*J9>D^&"A;ټi*FR> 3T^~V.mNPj d^v\l~xn.gF~fLktv{ Mjk~n 2`@N~na2?>:>8nNd'6Y* %PR P>s` n ^̞H~D  0` p' n > > N^~l^d.nN s N R` R`p n> `Rp/  N _ps@ _P.E,. 0P0 . ?DsP@RUY_*o0N>@% ɞʞ ^n 6:VP ޮ_>%nG_&/S_s o ^_^\^. % 4_~T  aZ䥟@ /._kп OR Po?_0rONC//?lr<")ے `9R%], g*D% khD$QL5yW TTPE@ :MkiT%Ɉ)՟S(ʍ|EeZmݾ֖nuśW^*)32U"X\\1c 1sQ.sΜrԤTYd mQ_|\Ɍƈg-K/iO(wdo?AtQ|e@ {!8 F7)q촇Gt7~ w@ ݴ4ħ\nQtdjCb`i:''%TPsTR2WW2Xa%6̡!3: IYZ:n*tܤ𬅩xj`jQVG:M Ƈo:t e)F@[Gw 7t+\uW_' Xb/8%*TnٯBޅ*lMޮJVeD`@H[W#^sUukasbLc̱3E7dWޖhq>\ TfݪVMn {i6)79jUe}#y˿yO(zb&. /|vtjSN\Uj@R gCGYg' rkZÃJ|r4w14U*;|JBzt߇=ԍZ Xgej9;YЗ}Wr_@(/7A Vp (Pt]c`BDa UGl=І#a OBЇTy! "7DrFhO(D"/ Lb.CuQc)8EVъz%6Ec2nЌgK׸)Vp9ȡԑw#vF6ґd$%9IJVҒd&!.I d(EY5Q}R%Vҕe,e9KZҖe.u K8qY:e0i!)Lf6әτf49MjVӚĦ3mI|c9c&Dg:չNvS4^NzJ,`Qٗsӟh@ eBYD yrⱟhD%Nv1KhF-Јs{yDE:RQF*4 rTW =cHK:SqRͥXG+̚ըfpQ@ԩ`jEժWmM>իg*ԻTg=V @~խP'>9H+wMkR zF:X U1+]bW6vjuplaKլ-D I5 fֵ4f1"~aX#9b )(3 .B̓5L4GXCanMd~5q mXckN#Ѕ.#܁]V,YVE">"wy@LUi5L"Vh/h OP\2sa; 7ްvO<ر#F0"|U2_cS1~́8<چ𒸼Pqpdm`r<:Ԣ3a)SV'{cJHrqLxT11Zkg♳z.-M[~@1>):d:@c~h'MaѸ4+kӺ֚u諰1KlƶbHf xl+[C+{*˽sldS=[xTfrBF@#f;|/ ( ~p{k× `Oόk r؋5QNqԁ!Oa/>dǜJ~sB=y`=Fuɓ֙NzsI}X:Q:꘮DLvo{>ww;=g1*1xG|x7|~%_yӺ {o1yG}35zOc?<=r '1}W'Sq?EQ~/~ ŋd?ӿ~o~T~8_o yҿa2>CܿL+9c d  \t@كC PY8%%nl?^,4x tAtn@AL?Y&P! #Axp3P3BBN8.cpA%8.. sBwRN ԅcB`Ѕ0<plE܃n؃?@D=Rm:C;AF4ºúR\D%5Dn@hDNBO4*DDS TCUD LCXlNBZ/YEC~CE=Y`AbEbd?9+Arjċ3E؃ytD8|GGlDf8%8fr28ZG0?xtȉYi(c3^0䡆|ȍ8g\uHlGzGdɺA4`;IKɎjɝ[\L|N\I|AW#JF^D@wx4xJ{ʣj@dʌɗʮBAT!D˖TKtK˸ȹ z\˖*K´ 4LxD̠Al{̽jB+ ΌTdtׄؔ٤ڴTx,Mͺt4DTdtN[ C N8h?pN$tO]1e\ϫ3!}5PO;O%uݎPO F E P O  Pe&J]Qu  tN % {MQ%eR)!Ҩ0$&*'5 c0)-/O,% ^R.UR0%](4TL3S/eS(ā4S RcFX48(9=<;u v؅](]]z]XbXzhE]E-P3Q%BS8SXzHq8CTg^`qfh-胎Vh_heV(:49CߔMv+iQrK(-&6i8X;еL0 x5P DVNxF;8k{nN'5kir뿞Ol;@n R0l2 pfjHО ifc՞{`lP-hOh00kz\(Q85ez>nvp5QmuJ:@@(QS"4xls'NdtN3S3zK/N'V&6JPkB6I F'Ex3{%{13-/R[ pSBN.oB.];.x _.G'p^@l*30x - DKC{"X!1)O/gr߲V27/G/o^1G2 #6mu~Ǧ/r!'r*o.PS<'1O&>R[se2E#QC3nvҖBkR66r='*^1?ot1B'Rwdz5 sF50@3f7Oout tkZ07+>o.=uQP44WvS`Ith?tR?pIO&I"`p^_'_OvknB-Z8V6/BK2wU/qV/;vߊ0VoBv5wwJtRwzw'0/cgGHwpQl7Os0|f:a0G88ʟ)9z}1̗|8՗P?x}7j 0L}z.W ݠ6PO~_Xq R0GWgwgOzt,h „ !Ĉ'Rh"ƌ7r#Ȑ"Gz$ʔ*WlRɘ2gҬi&N\'Ѓr-j(Ҥ4m)TRj*VruẬbǒ-4״j3-ܸۭk;zu. J-lQ ΋1#dl9:z7sl߻ʗGU.ԪS߳7/زgӮm6ܺwM;mule-2.0.1/core/xdocs/images/Helloworldsample.gif0000644000175000017500000006713110204257011021621 0ustar charlescharlesGIF89aa       $$   $$ $$ (0 00((04(($$$$$( 00,0 (( 08$((,0 44<<8<$,844$0088 <<(00$440008<@@DH@@,4@444088PPDD0<< LL$@P,@@UULL8<@<<<4@@LL0@P8@@4@L<@@PP@@@YY8DDUUaa@HHae]]4L]DHH]]DHPii]]@PPaaLLL@PYeePPPiiuuLUUPUY@YquummUUU}}UYYUY] qqYYYuuLaa]]]yyUaaYaaPeeHe}$yyUeiaaaaee Pieee Pmiiiemmimm mmmmmq$]uuUuiqqmquqqqiyyuuue}}$qyyyyy(ai}}}(P}}(m(,amƅu,Α0}0u0ƙyΕޙ}Ν0桡֥ު沲򺺺™ƶʮֺ,a H*\ȰÇ#JHŋ3jȱǏ CIɓ(S\ɲ˗0cʜI͛8sɳϟ@rDkՍ$K?2}i *OAlKdiٳhӚG;uSZ_wCW\9 \W/_q \M^nv+T}S&Z o˕K7|[zX'ɿ$wȓ+_q_UqJ2}FMݻe{G_u\+żnM;8HqO+2]5p%Z[HMZs@5XO :̥,%ePmG5,2F9&O+9 c|]# 2,Y9&XSpiRG5./ls*UE*LT`S?`UU[`ӄn8EF`%ZKNfxSc7EשQF:,=hl9xAH6f5 x(gmZ;Nk3G"z7˾;XH:B} ݵo]t'_V0Xl!(A8t!4>j 5LTck1 |?/ YtWQ9c=Z fy\U.ic]&E.0"ݗqhu><Ńv h"T>9k:|-/*Rio$Ʒg _]y2\W½ [i7B7E .|y4OHU^tⷀ4g ^żrVh>`u#[X+2E_y7μJ*,&8brҬb6S?TZ3-'/r)01k{SQ"l4$q2EDTl2TnGU'"'2mx,-,X<;G:05N…fTPrn!&nʰ!`\V7f6ɨ?($eF'ԄB`!Z\Ӂx4seqPHOIHtX/%|sM$I'R4 \$##U,yOVNw'6@%~4XxA,B>Q##,P%!8 pjвE>]jAMքMMzބ&$\&`\Ng+l!kt+CAsfA'T D5/5*y]2w107=҂SS,h9>3S#Pii3mEbĆ&n]#D@A~Nu+N!RS"؛,Z65Ys6Dm>F-:HO f^Da?M[v%\.&a\ X\OTA⛒6r-t!H!3--V,sa,-c!-,q-ҁ"b{b.dqDD F}bddEdawBT!ɞ  144@#gIpSAw\pQEBDx*10e~H@wb`3w|N6mӇ! P!Qqv]"e7T7{7cBjh}s}c+o g4:Z32'sFs4,iŔDGVTC=nIe "+5u"Z{X-9w8Q)NR$> ŧBF|w0d%B%;:%!H@΁Rb/p2hgD W46x7{ӑ{ubc_NeG;6O6KafUMD"O22BL$CC zs)qWSQau%D ѱC*7d!!. a *?q a ;)=S[H H-!BET&..IhE=ZPCjP)2MYm t  i'Y1e贊N2rd@iz;Ҁ*`Մ I& ʆ9 (CHB AHyYAp IL[Fxy[HV|(MuQsbbkkh*4K߀"K'Br(&!3|a.,YM/!BIM$C14CmbC ][C,T%0M { ,9nJ҂b/ؠ W!k}!(21ňh g=OT`+pf!M{;C kf^J3>##j>>So,P؅6HE;} 6I!DeϥBaW9*Mê]ʤ%;F; {s(c<G_0wPd?S4oig_2DdTrȌL:%s"^!Ngu7<1#$A5'˼Ιi>GxCFN~/ÜC !&7)I<TIIy/D/ ,z0-"09(v#H(fu&,w#dVmxg'~5eՄIwW.#d'W/b8}ԢM S~%qXO=Fg5Ӡ7vZfmgmհnP o0Q ` QQ~ i]z אA@=ט}| pٞ=qئMج!ڞٲ}Aۛ]ں۲­-ܼٶ]ھ=]qܿܓ=νMM]ސ}ݺݐ=m ^~ ^~ "#$np&.ym8Q$޷ތ "aK)!3N&z@.M8:2.48O^3I~<>^EB>䁝 qM3&3#%Qe~$\r`4lr]fj2{>nywޛt^sJS"AڃNVډהNen71\уőB1 馮-^j:}aIwEnڧn׸.tXQƂf}ܓ*2~ߎ^1 7c>Ʈ~Bi܃K%?_8^p,.0y4_6O_X$ JD_FHJLNOW CZ\FX}W^h`En 5 Y>` ;>7Qd2@G:Ҙi@3rX EXRmK1|_Gowm=ۋpW "'2rG=zoImtӵEnBL'ǞM ]C]h\3x}w8PƜ`?C^ 8P@#$=8H@ ߫RQ1fh3*"6W0P0dȄI` :Z |^BA {9J`j@"On j(z`OˆI<fMa&J(hO%E(z$}G(َhcE(z1#f-{(G:e4xCL$~Q:BW ;F) 'R;@"Ӻ95a52 B>dE QG"EshG;@HX3BHomoC"CAcS\%1ٟ'U ڕ *@H?ǥOj 6ݒ.-/5FAhF/i2/h %_8 =BG1PBK#'T"%P. C0CA |ާVPb@@ִU@ @hAm,v=h;Xְ8P jKji̊#S,o(&= JDjCE(Ú  lr8G,QTAD|"jvm]7XE- Rc&A*] i!>p?2U!`t.%@af(R1Oj>@%h1"-yoJ'Ku͆*T n2e(CwxFQ p$m;\r@/jI sjn:CD)wXM Y~7moo߇aӣ^^b-JF3v: dȀvSJLif1WS _x!O$sEkF+ V<3FEbg n:Ž M|L su[\˄v2 c_͂C,Ft`>>ON_)&X> Ё!'&22u 3D>~Ah ƿ-h|3Sԭ.ʮ5ۏ}&0;3>PÂEPY,([#>=Ӂ@鉓K>?4@ {>zAS.뻉}?#;B|h/;_ؤ*/C*|{d?#+<d?s.<{3@31$23#5 Q8d؎Y8QXD 9@ C9P1HdD lHD`0BjbCK@胶CA:CxCxBP?겴2?3?j?|rFR"+iԪ6<aȂ8 .aRj01ӛLP{=@Dd8,Y@{3X콄G{$>q@(2(!z 0 4 puGɠU ?˥KQi&ߊ9h^xv@**!*ij40k4P ecX^`r"TE8BX8;||֋U9г]@leD]VnEYO-t$뒮O?Y@,DNZhjy{}|ACWx^dMD:;xԏ/;+ǰOP5P2GYܔȢ-Qs9x^-0J4­E&߽ٖj4Es=bE)U[7Я3dX3,X58V=zDtۗ]]+ʫRs-1*0mLl.30Ci .z eō `e;>x܅܏xOJ%I0JƋ._v*R63 1X}$$m49{8;_ՠ 8HPmQMCULoQ-ԯQ8+bt=>7M ވo``a~mO~Ibí ҪsMH751*]AȨiV(o/U?[zFFS9Z$mаu-iw֢ъ `gmbGww=dIZJ?CO+ 滬vl0raaSwfPІ>Z7oL|ڒH-մzYzPzM[^`x y.CldLN7 /j FwCqsT(cfBPlwyN>z9.L{{Cio .p}!\IH#Ǩ o+Qj)0!|vU}{g$PHP$P]U] a9დ1EpI}*ؗh|t@uv~Ѕ l K we&a_>SuRCtqR'q Ð"G,Il*Wl%̘2g¤`ܸ`:qEBgo,B)ԨRN4B 6Z ETIbǒ-k,ڴj׆y^IncAeռzZ oйhi0,KN0 /I}dی-*e!Tt=2%wzyl;źwN'p5j P:mNXڷs>-`k1r9zХSk},5ӟKn3Pb:%B%IYD~@K}j1'Pg\ É JzzeS`\w9#xw\<|M2s!qL~%VHP1Ad 62 6&㙃xfPY9,E9aDp͇1Ɉo26tvb&k _AݎZ]ph?AU3la葙hBʕsMQ DK =q2h;L7T,C&6 +2+%sjRyb{$Z9Ppc ;`*\HF [>VHPTnkG[x_B zҔV;2%#E |+4t-O0]0 26΃B%m*+mi\m;[g Cmmȹrޭ&}v < Z[ W45Ӓu7Z ='c䐍6Wh<+ 88Ȓv[OKqI:kzꉻq҂"[>V>Hn? ?Yo]Q!LLfKbHzr>!(0H@ ` o`t~› -V"#oQtء"f<#wxh H<}[s"aGVšlQ?zPx6/mg ;(㑖Gd a7ȸl$7G^r+$,MVҒ(4>$EwhU eFBV"/+G>ıBc,'9=t#~%0'LtDХMnPz)yzhp:qp*m?qL3&ƚkҳ~R=H'u1|rd% :~tUIchF(NŌ1܇l1`5NK~@PRp'<ӭJ?.RM ! )h}I:AIeYvVO4b% P–y^k9j ԪdŪP2$^T9",[dB9v5ihEkV+GZS;H-rvi]nE! R֕c ^W.x+o@ =/z} }/|+җ*`wK귿oR!x803~0r03_qհd. >\bx.~1aO⢩$isx 뱏!N~ِd-YM2L)X(^0(QW/2dvB  [8hhAr3 8Őư#h>)&F^4)mLaT`ё 0P@4 Pk1 jd"7F }>6e36qdbG Qas>36@k[{%ŷӭuA *7!!F|/Ƈ ow78#`!(| %weF 98eG<=T@sx(d -̑>Q<S]TF8 l GdAxمG=:X*AU;+ 8Bw LA 0 ##:@*ud)tة d# X(C;2_:۝2 h9*lX?>)wqgc7"^>Eh0}8G铯  1 Џb,bQY4Q%FfVil;@D= gg7A.2@gt&,P ;=hd1CTăTj@j&_'(hdR݅=QQ̓l yVzen(v~(r]Yhv Ι艾XՃtB$Ac،بV \PA`y2iȓ6%n&&fwl)%IBDg)wEM鎭dfʩviu}鎁]eZ*ɩiirQ[&i}JC\bj_ *29h'^v`Tn|Bjrj5 +&.,|ĭ*Y*`jAPj*mër?x+4+֫֫ت3A,:mBٴkX+\`k& ƞd lc*Nqk &@B* D2P@ -,:,W@xU @!$|H3\A).lKB*B($,Z췒mBk 8-MLZΞ+*8A3N$T@a-MBl_a-hdp-,axB(+âEC tC| ҄Lƒnd1HnaBx-F-X=܂@"&L\~.:"F*x},H%HW.$P~C5䨚M?X~Hh΄X[oɞlυ/b,; PAKĨAPA (B1hXbPh`60B¼L(|璌,B0D3@LpZn-a$C deMG'd 0g@pJpPP0RT #ŝ# ,X + 8LB\mfmpZ ,P-)PLA+*D<P$݂(L.ptNDp4<@ 82CDX3A $.Z"=i>9X#3P!.@p|0A 0O ]tKB swW$$N|KIԃ;FFC8C>XXC8xVXӃYu>XZwGIۆ-4#+3 :4ND0̄/D`gK66Ka0PHmUD DQ ;TQuGSd r6|9B[C/C,B8Y`u8AXov>B,|["P'{6<-|CG30A_ Bv6P%A}o,6)O뽾PSLve[v\lC PgC*@=19AX6# w>ol#vn##h5k"F?LA>7TDt `5r_LA`7-TdC*tJ%D*L/TA/9A`AAa3y6@3kLPhvlXn,V}J\h/;JSB UYXBkq۶q5?B;v;|[sx>i#xCmJ@KtHwpD5d88dL$CdyBAAb4LCx6 $4A*9z2㺮:MPPSNy6B>wS 0Qm8\xXhWvkǂWkӃr?Ck=iovX,x(=ݣxVEE @5 YA&Tl~ F8o=e Y4FdI% *[TJ&SəVf{I$OPu@L+͜'fF]SMU:jUBҺ[T:+\VѦ$Z|@ PfIJ35$-3% |E2g $] +a=_U~f-T8 ]eh#U(BdXT{j>D[>ϡG>zuױ;zVeyYŮQeV9![~]b V 7ՂpF9.HA@H P )Фk9v@I,E:)3^80ʒq: ,Z(,Ȓl^q&*#ɗ $-æ*<:/222D5d[E 3!Yq"S=n-R[#n|TЩ B51_, Gd 6 DKͷM 85]DH|֝yvU >vj裑NZ饙>:Y(Q-J蒬F)H&:R.P( pvKi NJć>Bg 8VWe3AE<& q!;z~СψG:"|8Y&w2ugM[9j7-Ι,Yg_`*'^B*{bh`DъI 4Q(Ff$sIګG.*1/%'իI2e;ޜN*ΰt 8%@p" FZ4ekNt@:|A;ꚢAq*HBF8b%T!BHU&L5PS6!iyYpEơeH1ƐJ7;hj(!#AZԣXGP>D췾gd&D"@JmNy:s"!|sxs!b E>B>–p3mcsxD>r^ 3f1DL Dy6`bH1JA'2uL^~*hF1\ώLRx Ec+ "" DIB".RB@U&B-ms Lk0!=x!3 /v|!e>у&QXsMTAG (J)GAUSpUS`" ʈ]q y nZ׸Vdm>ˍ'Q4MhZ@#P!Q!!b_@{QahL[9o4q4LeoCLC8aL2xD/*ܢ qʨn3mm|َL 0n4\: V\p`5sZ i_ا8VWKFD+3:{"JZ LR6*Zqr"X84!/2Ll98]G:kvAB5Kme/>UN22{Lz9KDb-~P"!pUƘY_nQn Pfg-R=fʁ9 K ,0dY>"0T5 I1j2@=HJ{aI@+MC :ɩ tV)E M4 UtiIs:t@nϑl5-m;gv>;.*\{* ((%< qq8Wс -q >ьnt#a$@, sj3 Vрj+}Jkp `i0E< S(>%[9Foe^PdkB*:0UvJo@}t 27 M& Pk,X(w wʇ!@'"2qSke6: C%l)pfF\`DB{!8.Rxn9ZDo(tr q&?W2q΂RloatM2_rmʠ1őLT(T7+$`| = K.Xn>O$nek.b&#&I &FJ JFQ̄evBi PٸdpOO4<"8!T^L0ND @DጂfB**48 0Bf/@!^&0nZe\fl(CFR/.|ֆoƨ"w#8(_LpeBF=<~* /svȦÕI-Aھ .::j;B@P̊xqԌp ^* nA' -$ ]%"D " yq ] + #DȂք/oP"΀^,!cMDsQ:BڱMgJ[ItBa!ꙴ!z:N)q"!q#-ՙ韞Ja,>gݡؼV6uޯ죾9$>k~ͱ*L^_mr!A矂!!Q[=">gi^[a|^T^v%~?^IjY5\R>q%JX͜c?7m_?"A sw=Ѭ !m)?w_Ӿ <0… 6|-ĉ+Z1ƍ%b.ȑ9<2ʕ+KG2̙$3LwX 4Е=$I:} ɡT 1֭\+~9ժرVE= 'lْ} 7\*ͽ-֮|gؼ -V̰wŇ9͜;{Ѡ ܤ9jv:x!~";wjz-Ѡċ?< q;ΈX .>;u68]>".Ǒۧ:^Rk`uu[ _`-H@]8w~xPވM"_."ً.hb6 H:ơ\ !7H$xaxR*h!%Wb^-~adej䙲񘗏nE%\C9_JrLmIٓJVoYIhxzg$ba5fiv:iI ^r~ dInj k֣9ފkZjmw! ,!Z앓UialӢdX^\Q~PbKnަs5bKosU{ר dU/oU| \Z\g1oq t r$r&. 32}N柿>}a͟]Bs;[ B>}DȅEB zB7-k Ka H AܑBI .K0E.Vzj</"nDQ[a!;} #3K80@ 2A% HBL(Ud £ l=hG{ẓ@QGc$AH> { T}0!1 x|е+$;& UPi^ bw=#=L%F7tnwb6Ng [w,UoqH|꓅@ ~m U7-6n+z1X/؞oT"˱'/C=?ZʋLN/8Wr,"n IA֙h)H nТ@etbHv|ʨGD& Q*)JZH 堤@I pՄv/ԛ:N{Tp(*n1[/ϔ) ۶g}+)zB>{d$82T}L()%JqLxӚp)B9E2M48ܘ'i+Hd׎_{C2۶Y5X_9;oDD]KC;0G;/#@t}rp):JwVQˑ|nnr`)p2]Qb ETb;%&Xj7oCeL+z(vD 5l`҇CPP9v[}e`JI[AA V^DTbYJ4C`;HߠClWqTXGYyYb]bfv]NN-FZAhsF'߰+d(ذoV+`!M\"{kY"Tv<+s~W7X+#zDYXSq5e%n SFBztXIjvTBDY؈n7eu(M}@bDC0J+@BWIX] bio(M w!BjFBZ_4Ei94ed@jQB۸FAJ@(&Er2)aRER_W?GXsi'i$5WrZD*DX'ܗt@4AUMZE@AVELt`i ŒS7A +>Ai,e0O#S$%te؈iA`}P` %J?TʀCg` & 7K?A>-A( Kz:U{* *'|LbuyDL|pkx)g[ Ig] }g[wUJZ_v%}V[>dh4-S,wDeRSZvkJQ ~9_ [[yUĒ@Cd*7|H*6|Wf&^o6bPRzfD͙DSIggeK V%w c@)_U h҂LdURud ɜ5U6vug$7`VYc4@60ny@ 1@ t @:? xџ@x5LXjdoXuTBt?[ C $[[WlJ#y-Ce]Y%Q9bWE<cC oP`RE0nDJDz~@tc*E&+"JKـjMnM8O3DeF`qEgq9K@$K0iq0FT@*-%SS?ݥUv$asˆBUx t@MG@h`:'dOL봉(RT\TNtOd dCEq!JAd_ŕ@_hTCSWWDF6JdORO 1ca5JQ_dy-9GXH!Րeeyah[diFCZAZam VdV7=T@zfpUF!AL [ƒIĩI+b%\dzDbD\*[`ieP,`_IJ7?wCm htd ]yuAhKQ}|LOD0s·Xוb{bqU&*EC9LZEq{UdжAk[FQ ;@zlodv6D~sa(1HBJ)QJ#z 1xy*{*–)K?TOKc@ď?rwGGZfw{wKLǒyxxdKGV,J׼VxDy1xبY`qX8)PX%h pIf`-XCŊؽaHGHs7Bz0GۈqUJbDc+UKtCKQB 6#5K D@G%$XeG\SvD@SLTRҸ gATCQaPg@g'Q)J5j0PuW{Ad)J5`l){B~ 6C\DLϦEZɷ!S(8Tj4ERpSZ(T@@U@@)8w6Q߰UdUVStQtm VUKT~+K!vXꄈf|DG$,͒uR%dMKYpB?l@"W@CZ[AJ59C&WJwkb& f` 'n7K*-/cGQv؊ A.#/?ubwvyIQIHI/IZ}k[վW5BN1kR|U,\O9ŀGS/Np F Bl˗VeM]\u_4U`J= B֐Lꅀ_Y_scV\VffZ^Wh[FBذV֯Knot*noeMYܝحPdfqdD.Nn.gϛZȋ_jyJ8y B> <>'Aq+͆"m"4O=TN3ŭ8NBR@ MMinf&KZZ8DTyBeQfDZYYJpc @[qYo ttˣoͼ{xUwm%Ah%K,~JͦߐB>Z+t JGڥlq=2kLVRW^KE]&B XVӘ ?mxCΒƆ+X@6TKlplT=[V @j7PEE`aȣ/V4lzg2{ \ذ!zȨB :eI\꙰ϿKyTه̾?N̵Lɓ)/Vcś/a_\VQT9-ԟ;UQTFU(T]%[Yiծe[qΥ[]y}ׯܿ~qoܸ9Xpber*e7v-\yFzhweVUǮDkNZFضW(mۮ51>鶯ckj_u'_yկgޭ^RTG?w@TP;mule-2.0.1/core/xdocs/images/splash.gif0000644000175000017500000002201210204257011017563 0ustar charlescharlesGIF89a/))|N!!bdeeT!! abbRUU%((GJJrrrPQQ***nnn:))*11)..6((EEE...Ђu699=AA###zzz166,,,BFF&&&~!&&0++^E&&$$$i#++YZZ2,,.11BCC湹%,,;''[)229::J$$A&&&&(((.,,WWW>**ttt ((n#((HHHA((.**:==TTTK""7&&444N$$$$4..r(22fgg,11 <==jjj,((MNN%%|||,22.44WYYKKK!!$'' Xegg$$ LLL@BB.22''JLL2((((-**!**0338,,.''##,//X V000ɠiii鿿??AAA䭭NNN\\\֫IKKݟoo__؏//㯯wwwOOOOOY)00hhh@@@vvv]]]^^^111]^^'**#,,Ӻx200NPPH##ˑ[\\}~~fee%%% 1((211)))UWW_``333!, H*\ȰÇ#JHŋ3jȱǏ CIɓ(S\ɲ˗0cʜI͛8sɳϟ@ JѣH*]ʴӧPJJիX6D ‚`ÊK,N`-_v$ݻ+1&߿ ,2͕o -s!FY03k[r,BMiV$15z":",-\ \Uȓ+_μER W1D1壊#ϛK _s,Y؋$BU_~QJ xS(P3O"4QD eȒ{䒟g_$y Bd"O1$ 9 /( "( I(|gJg-csf)J2 1 .O*$ H6 $chEZZbj^dM-XE#fJj橨 Q&/ P! ,%rR(%ڥJj'.7eEާJ`O؊IÆ+#[=pE|_1.?q[,%a[.R*`1/PPz=}Zb.%"-j1D*E\\Q@_-Ӯ%;R&%77;W 0eD3dtˑԌdMnre@`OHًG=ݩ D$ˑ !N 9~Ó2zHy+$:GT$UOu 7<xļoO] >U!@h0Rǵbdu jv<AK}!CĵQ@4@N(#XxdTHd.[a29$Lꋡg(' 0/Q((fD\`H3 !d@rE iN&H%#nHVHF? "Ѐ7 L(^.b|f2)9CKR @#=- OT-*Tbdix&"IލЃv_jir X@W" 1u2!v#GĖv8K"4S|IacEpeDzp1E|(nh^PRɨcZDJ8&UTQN  QVTQ8ͩNw ;b< jN} nd,vAԡpTFD QMl" 5&' pONNU1#ƑH1jG>A "hO,NJU: @DP H;UMXm5\ юb,jb-~0&!U0@NʟTt/OxɪJii˒hq+[)"W^uBE8ͮv3"*Z;PA" &Q,(PH BiU6Lf3K%:r 8ơ'L [pC;ת?B +h 85pd $*X+( >S$rAK6"폁)c!WA*[QȲ|.WY`D |"l m:Cܐ TaG&&LS(nD\N$D#w" A5N{ӠueP H0yOSw  }#f/+8fFZIǑ;j[Ƃd`v2q|@f^Vt=ЌV;~'Eb#{#ޏdbt[Jo`=X; eEo,#"z WR! on@yZ 8nU(7]K")#L=!_c$C6G"p yX8:Cs5( pD+kxsHN [+X )y7 _7wQ'T" pO$E<'d-Fn@og*qa\(2zd{|?hHR- P^N s6)Rpо7ɣ%3Z|F#aDOȢ,7o^(}UX߷ ~E~hj~~1 0Pw YR~BwF v V%J V1 G\|Ȃy a@X8LJ$uhƒWs a[ 3k\cJ qV }wE|&'LЁoAaPH)G 0(jEg{vcz{{PG!{'&DƆ?%'^txSH^ZA7 !g7m(G.8|마Qkh&U(#^hp,xs>'Da:X`7ft AC\ŗ$\gB8q! )Q (8gc%d*Joш.g/HR9 }1B4W"1AhQVȊ61~&H%`% IH"#sq葏ȑLw&gD  j ):NMCwow$rѓ; ВC3@t@[cA<h dDhIp Yh"@l焩W 1X;zV%w;aHJh؈`!AI} xZP-q3i&Tvn0ԓ$9Yj)'p@vH^59Xɚ@q)Y]Bh%Թ(䕜m}͉ \}ieٝ zcIzra Pzz ;Tǀj3AGVArڙpڤluA 2 ZCb@ RЫJ: ګjp   !!zqzQ?aH4ːP}!P .% ^ fyP ;;:p۰P2A{JsHnJ0ZiWk@0 App!  fL۴NP ] 2QA>?HLcN*';\;a@@#^@ u= Mpp7zJpL۸븪`U+4AJ"B[**XۭgKi*bH> e `[4 Y=PaZ8 %c= {u& e띡ڊr**l  rXG @ZZpav3`)@B%ڦ# +Rj+a |pO #'@ ,t0XѾ%0k0ѱ 9+!JrY`e)% {,/1=ha< T/eZSHD *싸CCr`Q%S+Z `z|~ǀp(M@7, MAgǛ ARa&i)tK$ŋ<@PnL. H|<J%t9b; z%lŘ1P"004!# L.%$ҿ$rŸrLv 1e 6cK\A.aQKwMTwΛlǽ-L׬*( Po@LB-d\"KInL",-ugv c$3YpcclM,QL  Ҥ,q zd7^P ,L CՈ&"J@S*>Pfl+-'ܵ^HfMGm[0QV-v#]&Y]dx]q rM"pU{@L-#lqqG%2\"\m M<(3= S)q՛mM6ѓ}/''m(7c:}Æ;u})Aa]%\$ !z)\%='8~ϓrqL%-;ԖRgBں}o@ W<69m=Aއmrl'0 1 6 !C-#-PA<^پ"@q v-nN%}5@lp\eE) wᵝ-q䐞=wD*MGn`W3SK3 a#]n)}df!I*  έL-0%(@Q;)}`l}?D_?JuM= 1փ1a_ W˲Խ(aqgnhҋ$~w dKB f\^7/Q [| o]C @y&T5^nn Qp8GA'1 @  ~`j?o%q> G.Z;O s.ab=n)u Au_% q~%w(>YϹwik&gB oP_oO qթzu$"Ȉ0n`((sttv?}GLݖIq!yß& W>#5Á#XA @~%NX"QRǃ.^V#: RŖ[zYe/lJ\;+SPIUYS)@_T@G XڑCJfXDDZ܂4*zZ)t]K``1\X9D10JկQR MlQ* "]!T]mܷhdᝇֺ81Ƌ y"-m wr?~@e,8pp{Lq<3 / `p1cgBlabr $25߳=ʃo"[I /%EQssfgfЩMs~ BӼ!*ě5GΗOpLI2Ԝ92Rwt zTA EvXVX ,փx6"9ѱ k!)RL8V瓁ڮ ?U,BJW{JaŁtsma5QD(<ֲBX.Үq[V緙 G]je]W2ﯼ(eA68Qb;Ċ״ޓ^f5{Q .Z~WM%S ddtG .xmE7p-ק_$sc aAPeo|eaMs`#FBӿ$ܨ^Q2M݄:Zx3\\w@ks䓔h0-VѮJfoas}Ɯx[>IJ㖬LLD>./jΐyU۴V\q;Z;RTuڡIW "y`NuH~amբVt{lfzlt+ [ V4AF B!ےSkZcRnDRpg3Elm4躭M:Nv4 k'[mp~`=t:.4ųgoulbIa~qQFaiaK`qӡC% [p).t><&Mb.k-?Xr.` Yu#6>*[<ı}m~4_~imxv)A^CC$@34;K.?" :hkZɼ0 3;h*5BX3;kn2:1$k; >r*Xì)?$ ;,2:ㄪ :Y˩A'&CjAӁȪN`@#^@;pY) 4=A2S@q $O@;4(Cr?{0(>Ľ#ɛQA&-<ԛBFBXL@e_7Nt3N"z PCp:fCk(D<5>z2-L/e8^ZbaKJ2DH#c"k4A< [Gr:`r\s -y|}dtCpi"ᤨ{F؛Fb̢R2AKS8 C<'rkQ3&Ӹ&DT-HRSZ(F4$ I~z ܃)t)>rrH`I2uJ,YO"Jqa㆐ i1) '#PL*,{"@C|t5xBL1H-!<#+>`f3@Ev#!6ت ', :r-CPwL@ ѣ:kl\[ !jCl7*_i(P,2kRuк1*b,DpąY 'A0Za`RL3Y4 ;5Ca5C) R֏†dO)dAY`ZAv(!@,F"A CvNQ0AIGK* >t),m0`J /LNnNI R;B@i$?!"*x@H. :~'#5 4@Ah+l ;mule-2.0.1/core/xdocs/images/mule.ico0000644000175000017500000000706610204257011017254 0ustar charlescharlesh& ( @??=jjgkkijjhiigccb } !!z$$ y%%##{''&&u0044++q<<88??LL^^aaeeooll||YY_zz\\_<<>aac}}445444///...hSNb~VEFFDXi, (` ;!!BU!%%"6@#%%!GP%%"7{@#%%!Gg+ '^ z9!!"AeM<_Q>8:=V }ytvy}urmlpqwnR3001Cqo]2?c I#"#0pZ&!!*fO %%$5rs.#%%!YO %%$5r|4"%%$\H /r a)!-k[JOOLTx dKWj ( @//x&&pt&* hh ?D777;"?D???pt```7;7`d`pph/3/ppphhh PT&&?D &*`dhl&*xPPP1>N&?PPPPPPPPPNNNNNNNNNNN)P/ N0PPPPPPPP P&  NPPPPPPP  N0=  'PPPPPPP  N/  EPPPPPP  N !PPPPPP  N 6PPPPPP  N'  PPPPPP  N1  BPPPPPP  N7'  =,PPPPPPP  NP' .)0PPPPPP PP2'1"..0PPPPPPPPP".,PPE".)PPPP72.)0PPPPP".1PPP"."PPPPPPPP0.)PPPPPPPPP7".1PPPP8'.)0PPPPPPP!.)7PPPPPPPP7".1PPPPPE".)PPPPPP!."7PPPPPPPP7".1PPPPPP".)PPPPP1."7PPPPPPPP7".1PPPPPPP"."EPPPP1."7PPPPPPPPP".!PPPPPPPP"."PPP1."PPPPP01111).:11118PPPP?".)P+."?PPPPN==1PPPPP)."+==&PPN 1PPPPPP". B8PN 1PPPPPPP+  >7N 1PPPPPPN  1N 1PPPPPP!=  /N 1PPPPPP, >N 1PPPPPP  'N 1PPPPPP  +N 1PPPPPPP'  EN  1PPPPPPP?N  =,PN 1PPPPPPPP ,PP"NNNNNNNNNNN0PPPPPPPPP2"N&PPPmule-2.0.1/core/xdocs/images/Errorhandlersample.gif0000644000175000017500000005613110204257011022133 0ustar charlescharlesGIF89a\       ((  $( $$ $ 0400((,$4400$((48,04408<<(,0 08@@<@88(048, ,04000@@DD,4@@@444088DD @@PP0<<88<0ËO><7ӫj( *O׆h'c!߁& bRG a&<͇ ( h('" 8`I@ k: ] DiHrLL6 ك3J+C  5KX]c|1ьepfKBix*hqWp6hIM+^ .6,( K@L&(`.2(5*Z#:0vǩw`XLr'yjihn h6˗ ΀I Ŷ x *h. j?*pҊƫY0Mׯ^i(.K5^0,6ȕ[Z-_)Z/ 4%ڭH昳=:4d6 ,$*"A0SDVk&ab&\rيl^ Ȱ t£A̘Q@gZ C@`-dh|1,.RCwK+g7_$71|vwaRs. kk; qCwy褻,7x1gm9+.g{.`JqϞqݮԣU<>p}ЗϮէ~~ ߋ59XQG-QtkYAgNtKӾ.Q !K 2,) ע &ڠ%.U_CLkӚ<9M[wB%_Htմ TGĴ\䌠Fs ߧ:]G09A1WC3k$F PP50D0KY32Zť>FA$'g4B =YNІ9bc:|0yJKGtIe7p$RtYf/gRt^0H.vSo Izڳ'Ƽ GNc-ӹ΂A⋧@.{Pu RkSiLh;U-~Lǖ}yz?2sh]N(11u7pv"ITS43 @Ӟε-@/4VDey!j-c. @ڶn{$PGzdk%2Xnj1[FH8V~%^"^O;PlqčZm̂0M9¿(`P8Ǡ;=xc {4xE聀u=s ;EXoXO1bYxbd YOzP`/_O]4 hVaq10_B gG$JD!OƸ@8w{O}=Bɫ;ԓh$^{ T2=uZK|y(_yV5OAF]i,@CBx_{A < H OO q .@- }[ 7 P8Xxl؁ȁ wS|xڰ 0#`P~G$؃>>(8 Zp ðL؄M J kXZ5D^(@k Nxh }0ﰅr8GF_xnQi@~@hx؈C8Ұqs|@B4H("&ONْ\ ͘`9=[ .Y rYv;@e0 \Y \`py-9 ]x6PS9 [9-9 "YGi+@ؚNfg+~+ Әv %Z`h(ȸ   *8; %0 Ш+9<;Ѳ!@k:KLaQR+N{0z;KMxBQ/K&h e욵!Zv˯pX8x{p؛ڻ۽  %ap ې q `$2X⻿ۿ˽pgP} f{@{&sX "<$\&|%p#$<.[ *` S*[BȀ>@,*! V LNPR2.`&d! oh ?D1ڤ1BWi!p抆T 0|`p'VgaHRH>s%ImQYߍqޏAeLNPR>N> ;Aaߤ1ҍ*qApx pA ݀ ː pjp p7PWjp^pl5]a8zjȆf僡`(rMr_0)ur˲lbG  D.o@# d^@ 0>^~0p1m4`NNpxp^Pj֠ 7Pzppz—.F"~Hap |蚁8n$),ە%n/Go24ablG7r,D<. P zӐL.Ȱ~J6mg` j NW { 0\1y ӭj7GS40%G]r%!D 5g 11KNN U }ȟȯ)ۄ ).f TeK`!pݛ ۪ } j`  .= DX0s >4'D̅1c!i1H@4J5LL5m޴[K=YrAMСmiM+j6-Ѫ Cqf 5/eԩTLK0 兘 b].%Z/ rIpL:=|' gÍ?Y8e9@Q|=ZhҡY %).\DI85bLѮ̙ojbfr[˥ήK>4^^x'ZsG_]Bu_޳OJ>lB "~!$vg!2p;f-BNBiA`NDq<A=fVZbDo$jơ|pą8x H.]& B'*i8D2/ |,6+-M5+[ZmɡHqBJ(* "*% %B(/ lR0c:CI+ ?/{' D5ՃPUL!+A0 he _9Kx%K*0V{K$OA&X,bR[zQNm[9 ++|,d72,d^{DZԖ*Gl5B*,\:5 ^H3Ȅ;4`h?ɓїS]E9e_e(ֆfVMBc'cMH6V~S@9(yljjXIF]ȶ]$S2y齷m6݌_9_`{-זX*lŋيDf;m'vrNYA^䆨+:ye?GVaH[c¨0 X]s rs{fV.g:M6/='~(t񐨌sW1v˼\3O^n ]b9© ῩY"}l8ۗx*l.RtA61'| ?:+X P4hŊt0FrWD! #+z00Cw8PrC@1Ԃ&@CXqnojCģ \o[$\FMFbH%HSdF0]^G=}xo\C(O#Kz$3 ArуDĐTMFPMs7`=n tAq@e4}0| ` @Cr+GLPąHc n ZS# p ~\F9aoMx!Z3 Hm&H1J`dGFX]hTc>=k1'(I`> h` F@ءh"(jэ@7 * ^U(D&ܡe\ȄL¦Wi&vc+o'5[RR]s !ŕxS\Dh.t x`LPZPB<*iY'Dx(d)_Ն"@S2()BJeR\^bE՞K[aFSg P/$ɃAQrV7@W8 b elpYKXjBX~l {8ԅ2rJUUҲ-ه.w ւ"4bT\3"ܐ 7c)3p78)g)UFPNqDz-D PlCd'-m0dgu-W@2 @V n(Q" 8|bf ƒ+[ݘnN< Wxx;gBzwbp? >oX)?D86w`$a4:L`b­xMqCD*hpQe|x2<6q^UЄYc8SKr5 Iyenj6<,nbROxo{rGHQ<& 9L`r`X PC!7G[+bl^e `d*_4!:tCImTĕ n|8_[RKPm%VOGab ,K iO*Ipu MxzI&fmzgĵոwyE .+6rl|n5 NgxP ?ӂĄ*hIA /pd\Z=TaHxfBh{!㯭dT}ę%v{isgVT3Pye-XJužկՐ%Ǡ1l=S5ۻh %`N @h%5 Ve6 k%E!ޡdp7T}=U =̻W]8]h8*:{7>xB?>k&j&q"1PPZ2s cЃ̂3ɵk2# B4# .Ж=A:P %a =P LDy0*hXYl8BB E\TDADFXLa5<= > Ɉ;1WfC<Z‰QhA_*ǛHAIaLhlU$!JUҠLXI~TĊDmF1l `+KI1x(LXȉ@wGmA᚟ &IQJGvaS{鿉?  乭/؍ ܨ : )k+ A!A2Z  #4ЀІ9ԣ++[JkyO OW/L];8#ɕ(.MP9."PZ OyH8!L%yӟ^p6%8L=>Ș2Ѭ}H9i(']aEJ :@BR(QXRN]+$RNҲe2+{ CҲrX<ӜϜӀK+( ӄSDd8=꽨tCA'P aj &#]pkR $$1-+QL/*MI쓧0H9ިPM?(.02`V/ͪ *읉_77#IIiQ=,jGL[iPyc۳_0CC}'&?~x $5uȼ;B^' ?0Q!a .v-WVV啳-X *74D7Ȥ0=$5MOU(b4 NR;ۤ5] fgN'O%tp╰!ꡮE ZeZ24a&}jQ [OP !N_ deǠ2HdvfyCG&   ?OLiI:LhNii@%@`枰 X]lRQY+]w8-0ԕi%^Uh  (ljfR6]F\y͕|־)䊰, ivA_6 H-IP{ްPC@j8ɺ <=9MP) ^ X8EaJ!dTn`ޓ'鸘i#^ -`\lCvkY*Ї B Oe@~B.Zl0Lnn oCo(_ *E: ĄN\ PϦcău҈: KݶqȅZe]aPl3pmYԙby;Fu81X7n)X (4w[ V"o5C$7eŌm}7Y"?0'mhܠdюHltq(жK? p0Owȏ{x Q"OyXِ cvv=3lym jp h_ehh_?W7V? H'7'y+V_L`4K}eNpB@vs^v-+P:[.ҩϱnwAgs9qXq񦡂6C6rmR oZj5Ev9r{Є7GWg|;g(w8j xPr-z_sQm''g~snVneRەnfw0BUV8#0Sӓѣp#KΠ3]K a) Kh=>Y\`L}mz?J @Uns S:Z"-Sqع.hB l9,0ttWZR*恦/ |GHbʧr|>L3>@ A~rUO*Tը`*UTv> ~+`+(0!},d!|`scjh񎱞f7*ZM :DlXƚ= 9as6mld`Q+^\u8ht+Rֽ.v+-(.%lPT\cDѲX] h um=WzV` +.&B}0a 3&Q[}/ffiPqxlVGz x~10slָ0?!B.`:᪂6ڸ3 CwW²,ff SiZE甼66XE)Ux#S|DžIG:Ag>,IKі&rzpZߜy߬ь**Pr f?5%>l^ѹ4qbwɆ iS־6msu4틸 ] qigrY-fNsJd{K/(J'Mc1J)osO$]boHK8?[|q &ϢGutW9o5㞌a s|byz_>틹·1d|aHt蹯{ q@  &.  >l=] fnh 7Օ 4 ֠ =l*  Da "X6>aC V^! v~X aխ 5 ֡ޡrC p! !"B&h(A#j""%V< 7|",8K´'C=B Z"+"Jau> @ ~0,+0^ `g$}."@0F4>l& F?x(2G.4#9&l:xC7.c.7C9#=.P.d;hDvGJjuF0,GJ&Sl&B~I""NC (Rl p%\%PDRl<L &""p]B-"f-,&R/\N&eDpA-, `&77Tle8f>LV^&fY %RU>+e qAoͦs$2oorch~fIւ Ew^'Vrrx++FJkm.$,]YkNGhU@4b T)(kH"Pk~A _a+?իZ\.,xHq(l*bTZÖ>lR( ff,8ml2lAu@լڬԀ,е/lRx\gC0h t[>-V[l4CNaʪ#(@\Q1|A(ZF+p()Þ/Wq V=$L(I`\ 2i$#Cj5  P P |"   '(NKH&ǴtH\G-B7{D&ACA9PE6E5vl{G\6jv9මl5hp@ ɝH50?M_|5[{5 "D65b7,AZ/.yW &,ָ7[E75\ pdq_J܄E68180@X{YdwPLV3{.7v7zwZ[8iTvKHfq6H@!XGv,=KBxD!BBC܂=\m{ Cwd<̃4yo Iwgpno 07**ADxiX[xAZLH Vt7 3@TS&7wGv1{I T8fUpM*_MY#1X@ZV3,[S vY&֜Ʀexms2x-vv8A*8v8E6GxsvuL8=(i>Bh]7Pz`L2!1g.x6FG7 XDEcpZc̠к58F67yx'!BW @j5@mQk SL8q"<0cGA9dI˸eK,go&Mgla@]E F "5bmN|WAԜ1 ,bSV "x5Q w-`hj#sջWo05C n2glwTQk7ȄF9%x9,-pƽ4mR(qAɅ\$w,2_0 Br *vrY, $q\ iM].LdO 0lfMmL  9iWaeNsFLW˯jv[ Y8F(i97D\-G 'ck)LjƱiC 1O# g JR];A]jSbn4lP%Bz[_F["4ҁ|L7y4lA ;qHk Jz.cݎ\-nq]AscaL;ݙX`TQsk+"$emZeja8$@p"$a L.$Ei p 9S%zRZi[hwRB  eيAk3#ن 5mgyHoU;. ͏d{ȕ~[[s-l/qwAklousD|"q)6A.a(XV B- Ž6 <&$[B Kp ;c S'ՍL(ON`A8 M%5i₽/˷|jH{PswǶڱb<Ɵol. C2JJB E34o *e6!z ,R.e,c.3@CBɖ EIԩ ʊt "T~Si Jvfzp Jďۂb bf0BP![ BOkA ܍khN[П!$%3`2RDj(` 4npVoGp6##F#L"bnH  v%z KvbAuΨzǮh{NhPEo7$.! cnl k-/Fek/ /ՠFl^- qFAQ.JPjG E4C ƀB>#hSBs JzpBW,QfYQ„Wgx nZ2ƨ&_1f/$1%ӃT-W""c2,(XBR$΋',RiЍC$W%rpq'nfScò/(ߒ7&#N**=j%F(&0+/#@k3aƢ v LuO\Hd5'e6r.4.a:7 CĦR={82S@ #P"WSAa!fT-34F J;C 6b kSo-sA< #k0ÀD#O>ӄj#j$&T`?d-k.D:=tVRG_.CH%G (sObC;Há&ZPꏨΔkȱ.[2>D/\0/F7cB@j#D,3""vl@IFatʊ|J#KѣA3;ykA(R}(zuQm(zv~hAq2-STE#n e孑nY  m փ*31^TO/,OS3Ls@n({n2J'uZzHz||'14qJTf^2Td&MU4I^BTV/V-V.Va_PWK iԀPPF6dO0u15B:>sa @99f ! AtI!ʜ6i*zZiIH-E:u'!TNVl`)2aaZ\m[jj?cYTA&nFaOkwpW\JZ[I`+w3M N$ h)vZ'UiC _d:A_B2@@RĈ0h5/U\!6Vc/kʤWD!w=E%\[\ȥ|GT in|,q{#( !+ `(:MB@t#tbcJ4c$Xj\w6yh4kieU`'AVv\l Ohl`lOxaEJ"g١1 +V]h@3}84ވ#R!xn/XU cN=9reJ.yҎRNe DJ%e^jDGIfffjfn)SYZ\iN3cg~ h(_hGph> iNJi^i4QU&GgMT'`jj*^*~\,((lH[ hOE( F2K.0(.bhJ-.xV.|- p9cv䊙1{0[b/3 q;7"vx-R swlu[9l s2C֌eU-21yuxR-iJ/XfꋰXtZoM>5XMd\vmadvv5!vUk(17xNI7R)OO5=*DL \Lyo@9{D F͊$f|6b d10,|ϪO3o` O"b0?柯%$09x}#K<8Q$j|y#sA|ԃ;AHzL ;mule-2.0.1/core/xdocs/images/multiTransform.gif0000644000175000017500000002435510204257011021333 0ustar charlescharlesGIF89a      $  $ (  (0(4(4 $, (0$$ $$0< $($$$$$( (0 0<$(( (4 ,0$,,4@(,0 8D$04(00$0<(08@P,00 cqkeY b[ͷnqKewJ[X21Z)Gj~WlRw|,CL(,*,,L8is<>-Ym LStPG-RWm5NT_You]-6amve6im-7qmwu߭7y$K#Rn@,O.xT} Tngw'2RH騧ꬷz!6,Վh/1T94G/Wo@YR6H/oOh&(/oоR6ڀ5FmXA}'x>]tD7OiҢҏ#(L 8(7(Hڐ|/Rf @ tFXx]b) HE KF.rPJw ЃhL# 10Cߨ8>rFz>~ư2ƝbjL#Qtt$?щ 选,1*(>IJ%ƣP=@@Irߐ@*C/ 0"v*F)D*)(+Y<4R)C.C/J9@nXXJ9rJEX:N@vrB/R3z8㒲[@ ͨ("P{XE!*?= HCz<$JAc |i; kl@ 1S>(J:?Pࠨ8K ~8`5)>(X@+TJ~ԶEMO`ʓ9P#5=C1ӟAd jWBme[Ծ^i 8@.} T]`_62XJ  duLVPe1},%ZT  eijVjuo6Mpe"cP+T3 4Hb'vR5*E cA4y)>ф@΋}K@ace1STBHp` :}a%1ۡB EQa*2]{{}x#h ozw ŧ~D9V7l2 C<Ҏx)D0bNJ_6ƀ7Z|_%#m  H#c9/eÂl9W(ʐ^,ӳoȍy@^0J~W Ubm^b!f7ޕ ƣ `G фTx8N_U}BsC(v:tp@(Qg;U@􏏡p`~Emh(kt;jLey(4SoZ'UNA3LyV! t/uPbs:@?N19 e}C% #.nj嗍M0w  @ă8x=7vnPm#P4 qaY} #q#\?[*0 LEw4PP)%C}ޯ~/XZ[>Lą؝Dph9(P>~,ӏ`Cϭ-8dlSUQ:~B@GBEHĄ'W>P; ]iV=>]G06sxdXJյԆr8^Tz5=o#kGL_)}(A4:`6fa`(G=e?\o? h?@ P+Na>'=x poKtu'U?u !gm3rVHA`h?+pp<+`?+ˠHM؎XxPC_&jҷeb^j^_e6}ɇčuA0{hV}V}@ h(GⓎV`j'G;! hp?P\ oP?M<|$??I _9L@cAh`+    }pذ&Fye 7tm0ey&Y rf0AU0h=?fmplϐ`mrFh+cyFyYhJ?8 <?zp< `bz O +?͉ιAqyYOS8"1ViEjmfQcp_|^8tp eXըtYd xIl+{3{r>wCwg?LPș`<@ i? T˘ fIX|D fA硎P ASyp氘6ei)^ ß I}tv@y0ț APvr*rl,'{*GkX!J?ͩ\i+o 8o@AC E2FqK b ťb)o6㘦JpCoX6zl#mu hrzvc =&r4aG=qa ^ ?J?o:?o ::aکFXZ$5kLbM@f}|i}$Ix^I}{} pO4A0rr~3gwSTG9ћCY Tx9p8?xA[+Eɸ;gT(Q`M(< Ϡr-;91sE7wtyv;1}8L* ,P hN(? D {cD怍ejXEЊჽ{x'0 D۲߻2+D}а_Zf?kTwq ٧\8>| D4 pů@ J* 'Dz9m}ij4 x= q G3:@zDžl*'n$d-8Qd\AHaHC0 vE >ʰlqJ;]AKD-vBwɳ:oI@äpE=4EG?AI0nfhfP6NEِY;1c 0=xy+JΦO^Eae`X?ryDQB--C}4DJF{0b\6DzB0S.GAY.@ln'v>/~$A54S.oG:Ԭ@P=t^U-5 =]>p H@]MpS4pNC>L m?.ƿ8p?-^ĘQ`D v%MZ'c-8*]F$ycFd)SNx/!.aEhR!KI>Ӥ֧]U=˘]M~KPlڐ̞D˖*[nf5ۢQ鮥*_~ q0aM,,^{M8rB+=qw-K ytғkZt{mƝ[Qv\8rybx_?ܵذ/x]ŗG>#M)m_||?}{珰$< DШ˿dP&# +pA r *Ƅ,F$DOD1EWdmC5/rvG2H!$ǚ`<iTr*k2Jr,J)cJnJ-r$/K-pL2פ(d:3DM5NӽF=pз %? D tHUp8R'-SMeSJL?eSL%I@/<3UW- 5QgRVq%&o-J%XcE6YeeYc3Mx-W%I,[ouv}VjﲔMlO57UN\q] %]|Ŕwt״~w7 $ze xׄ,ɇ̆X3cb=7U7Ė8wji䉙A}%&1ք:Vcr~)*BI zhhY\ciyN)im!{\lxlTnIMe3:CV1`h(f~ZP&pe;)R[irxs)y)g#n.g+Fzr WڍYmv'\PBQQ9nj[>~`S</a[2y#[bR=aO{ӝ@wv|u_漶cs# /DpSԪjd;aWAhkWm\.f?Qoسd3,fр[Ƞ@aY#R)ج+P)L|kI ґ{#X6>2qwjKԶek)# F\at"H -Rg'ɑMhD.(Kz%,w@xG;~^d/k>E)_$#+IarygzMфfdשG^UKu `g˫bIu XAy `4X6bHv_O,5.Sّp_O##D*` #m{_WmtMAy& h  ><ෞ8pmG85mnV&=ܧ6pPi qxxXyqS3 ;8L}vm{\OJvj<*(=aOWlvjVbH>:\]{;'Sm@#hC+|^j, 7ֽtm\MMd\jDS+j?MOoSgmX0ym rwфKU󥽁&G0ad ;KʐR:o;ն0i@\NVpeL9[_ .vgXp!Ƴv+&j f$v/insmy{WlzbQjURzESS+ɑcIw~)3B;~MUCvz3- e/%sy Ow*n̏ձɻ;_^פ\\}u{0ҿ6ir<6oNH@χ~eW~}wחPѫ,V[~x?o"@;Ǒÿ$4ӿSo @K⓻L A 3> &d{ tA ?cmCbR`*lAӁgp*tgA`B )t?kkH2ptx0C)BBr/,j7d?Q0'4CGW(6LB=|*9?m.!),KB&B^ D74DQ:F<4Dcg(4M{PS[EIQCvzD D,>86<*xWxXtXi38jkk6^) FD2hC3df,gLDt L^ħ_lo AnC$|(L>xB%BHD/Avwn|z|Ɔ+7lIICɞŸl4JDJeRʥIp$Ȅʭʮʯ˰˱$KL#T Nh˸˻˼˽˾˿?TbKIAePdtDŽȔɤ\L4(L Ĵ̛xNdtM,M tA9CGOs+ج!,|I8kl_@4DJ,l Ѡ*e|q8HH ET8(`"B`A`iM0[!KǸ|NianVXp\ KXDNNRmKcEXcJn#;mule-2.0.1/core/xdocs/images/inTransformExample.gif0000644000175000017500000001214510204257011022115 0ustar charlescharlesGIF89aOV       $    $ $ (  $, $  ( (0$($$0< $( ,4 $, (( (0 0<$(( ,0$,,$,44@(,0 8D$04(00$0<@P,00(0<004(48,44 @L @P044,4@048,8D488La8880<<0<@L]0=rװ R6!s#2##ϴ#q/HbKN=%PջO`-RI]XF%(hN߿`@Oz׏Bss.edh@ambV"Lvpr}ņ4nx%C>$x^<$#h$|H }<0LP K6 0>fy"d(G9]'hQ8WZI7UdWb3E:,)nr&*>ȠJq@ˠf0jb骂ű"ydjkeR =Ju4_c챜t 6W1>{, p*= \OY,`2 n;/OO0 -m?U͠* x=QϫFQp"E#J݆R*Jh)(V c)Zwhra^'OYH48[IrΞEٙQ?y7txrĂNY˾#F>û:Tힵ0S;9O u>;i{ WL3|1EŠ7at07=:pW{|#ș5WfE"gtt/E #0EIcb"Ko11Ч6\jT V VVSY>☂]0= ^J؄FHC"8zXĒT=}|b%Mqc~cD QFSPp/C,ӄw'ˆi He1r3f7z~0aÆ.=0Va&Xݹod:`gpR(T}g, ~%@?yS.&C9NzņmiH'T=4nS=A{+|[ǎi=U-͑ZMU} Z)! /U5 C4ve+PYT*eb-^dl#a;dS1dž,l$|ٻë)W-w&?J!!-Tn LzPn쿃)U חv /pj(0pR>5veMʬ1cBYhVLg/{ &Vw`ez*pĹ>b;\7H nm6LA/v[ّGTtdw=<#z8K&ԧWOf_R]ur/+Y2 071!F`2i^Fc2@³o `H³ gփ?kos[iBiHASv@SJd?DyC8aR $@Im ʠq őJ`Ho^;(%@Iq rxVE:pDD^tw3Va2<}ɓ ` 怚vS7{9%`Ohp  rxMQ߄G,Q nМ} qPkQTy=ڙp|YpQ~1?IIU ^!16gSMU(Gh>z! a,ed;ZIM@ J,єPI1$P !t`+oKP3=`@E0SR)%(c?Mf$߀^zp 0g>B V\3 - >)ւ-j UoIu /X:۵?r E:€r`j>B0^jp0eieđZH#!.J"dD"0lZ ipJ"ڐ^MPG^PZ)j Hhi" Z^ [A2OXuK:U^9V'a鱓/[lCB8'K8, !!祛p2+c'+籑ZA !pWK.&pPT ِ'.!1A +tdGin׶h+2b!xp1۷ x0%y1e)ВK)Qq+ʐ+<)s)iFkHK-H';!"@X~pAq 6(K 2Q;HH AK1Wq[ x{տ;j u p&1  "<$\&Хq[02<4\6|84 0hp D\F|HJLNĔ`>>PxUpXZ\I0^`bPv|xz|~|ǰ@ KPȆ|Ȉ8ȌȎȐɒ<ɔ ȵɜɛ,eɞ<ʤ\ʠPʪ\ʰBʲ|˰˪Rq<̞ F}HJLNP-EV}XO=x`b;mule-2.0.1/core/xdocs/images/mule-logo-.gif0000644000175000017500000000005410204257011020250 0ustar charlescharlesGIF89aXHQ%~]]5Y0U*dzK mule-2.0.1/core/xdocs/images/muleUMO.gif0000644000175000017500000001733410204257011017627 0ustar charlescharlesGIF89aHS33z"31J@`Ow^n}"Df3M"f+3<DMUh|:Wu3Pm33MMff3Mf"+3<DMUh:|Wu3"J1`@wO^n}Ҍ"Df̈ת33MMff:Wu3(P7mETbq3Mf3Uw--DD[[qq3&M3f@MYfs:WuȒׯ33MMff:Wu3M&f3@MYfs:Wu!4,HSH*\ȰÇ#JHŋ3jȱǏ C1ɓ(S\ɲ˗0cʜI͛8sɓ' JѣH*]ʴӧPJJիUʵׯ`ÊKց@˪]˶۷p6ݻx;Aݽ L8i߿+^xƐ#K1ѓB1#5t@( 1p_onl"3Kr-űr'72.}7q=;70̬ =4= tJ/p>|sRs?kY5{+a]W;.BC 莭qԒLwt."=~+P/@/5@ ݴtlo&΋{7W>5# sn:,NyS_1>Î.ϹelΜ.| "1sコc^W_ <1/]N9fM4l$xgO?V8hQG.h &POJ̩qgTW MkҥL_b;TUɦU+k[ n݃fջַƕoxV|pcX<'bʗurd̟eZ=ڦn;{&zh֯>5jد]֝Plm[x޾GV^4q溏#g|:3.x쓝gyw1G\Q׃6җOUCk?2 P@*|KA 6P = % .M<1Yla0BF#QoTq!)K.9L2-$L ,1#r2:-łL\<,4 {3[ 9l01ٌᜑ=\: As.9K.v\rus[EmA5=]Ppި5NU~&xQ_y`dgbn_78_X3a#6ECJ޵e_d+I_xIg(NJfcmfTyE*zIiv].ZCZؤM*%UZiM٫[Hj.m[%. [kkcVj4{hRRIp+El37M< $I|ϛ(=| G~ykKQ{%1~(;Wهkɴ&+)LHT.UDpVJl@4*L`Ç#JH1b3jܘqDž IɓR$’ʔ'c,I͛_lXω9 Ոck]zϧ?/*)șXGlɵ+W!bUju)XNв9k5ڻ t;nS1_zLK(z<)^mU (R?[ak P0Ek̐1P#KHrR7q~CNyԪ1>Pn9.wQ9W8`GzʍAb({6ns]~gt%-xWNGC7ew t]YeşVLSJ69\|Y_ 8[`Garf(`YZs8%G]>_S b~8㒆mXw=#UdMlX(1)E`f]t..xەeURn卩'a`Ҕ۝@)[)'Hj&נMU)aX5mߡ7q**F=\L* ޒ}jeisf:*2*NXZ9a"UjidWZykF!s9:HlZX_Ymk6lK%:nVquT/{zt>,ƦNܩFܯȯ b|~n *&+rL)ƛȷ|s9/d4g?Wi5z+OMw5[8!>94? b_"M7>;}7 ݀mks_||܄'}v&5p/n?yy.-WM:O9D\L9k{]y:_>;o4^L yƧ8n|ʭ'yb4/f ){Yj/a>:Mځ[Q$|GoҖ(c }-Г.#ى~ Lxf>OwMSnC0#"8' cca]V(DPC=SΑRCMpJZe 1GD؆$DBC(LTgس,Nl݀HHPb{C5X ..94A64$>o4'I1+'g)( ØUQ\_&tDYyI(B2{%Y6go 0/{IɂO|$DcarWLc6lT!7nBϛ$:EeF/q:Iy <_iEcrGL -GKӞe-ǿ(''j%(8PeAin>j-Sp|ie8z$~bfQ(RuiT"$h2i>:/M↢`S~3#"PkzR(qVWJ’a-b,Ju*^= i\8WֵK^hRKXfЩc4kVB֡(eY8֦u ԶRn}tXGMb%ܾ5d}8jДRnum4dԍZ%-gzP"ֱ_J#hC{PָW{n]{Q42ux3㝮?{ԩhb/H$A <0… :|a+Zƍ2dȌKN2,[ 3̘ 83Ν OHF<* *ϔ.4 5DZsEIbUO*:vgM^Ӻ9lҡogwiY.4V0C c{VdNձb.Ycޟ{!?LgԒGdL5Ekl쿪wv hֵmk.۷/.|5oJo#7-쭭SsOsGKO[_Mo=m1Om7@~Xg T-Hy^T &hʴ`f ߈!fRi"L2#Bx͗bFH/&tE袐Y7#UD2ЏG (>Vҋ %\NIQRiP0:ԡUؒG&c%grӚSI!`x锗`rg~v[,@i^iXIlRYx*ꡈ&$"MiVijFgOQuqvꪶ d ִZ+*m 간Dn{tfVUh}ʯ ;ӿ;.lMmزL2R^frt jE )2-ؒ7s 9N 2|jT4lS[<;Y=.Y~n`=[ڭljis^@9ʵaW)r-䑿Do>tvC2ږ?׸s8zJ8C/^\_tl;k"jJ|񵟍S;CS_հ,~䫟@OU7^^ZOv_ҋM7 }R)@~R!| | }sGlr-HA.!.BҎ48P$LW(5En0܊9ʆ!{AF[i)06уkd"X0zWbF:ЋywFm,h?Ƒ/rh;Qz)IF"ʈl G:L̍*H.I#OJgvCD\zkT*`3IpRdDP2!0#Kr)t-8Fd&t˔'NC>3gؤ׬yM8ڒRqF{>(򦹳@ RLAיH^d܁2en&e/ÄTL΅h? 勤>:čE)dCC)L Z ӥٍ)NwJ_*iklj̀ʃgvP%kbFtQ-<ʪQxfEAg鯧Q^]kC羭P%pX'0o9 X+\WK9_o^dꥇ?f򗯯߼f뗟>7`C8ڇ߁ؠv *XVWN`ކAyxሪ-")d"2:hB1H@ڏh0F~%y"EzvIYaH~>P&ViexM0 `֛mP(0 @CBKwbA} 2Rf9&Qi R(f}'~6dYjVc1:(jꗑN8頕Fv)i \(**(4*yYzk,v:괡 J,2껱*EV~㚉i.+r( #Cکlny' ZV͹s- 2,0 mhq ;'2%Gy2_Ws@+$ \&s @zsƥ\5_ M3Ⱦ4K/_OM)ֱUvWZ4LsH5ڟ=j7=oh2݄7vϜ7A3?xIK1PKRAQt5 @]ؘwnD:,츿]v:yf~;pNR긯N|Ț.;Y>N7n#_Co(*p2zR"+5 *f=zgZwlUj Ze+p ~`yKS-5ཊ%-Xyjc|`w' v\@,.+Th.z!p,Ք==S\R(W>Ip4D"FHMC;uޓ8;3~/ 1-tc͢ & Cw4$,cIyDd% L4"'IM=,$7ϔp(Wع#+iHԒl4LB^2T vxgef)Ĥ,OZR^ϺHfM`'q pIOsR_Nl*eN+çך@fD,tZYaUdoR)<.ыb)ϳtVAM+xmXNleh叐-YN&PԙÆԇ6hMyQ. Lc1uTN O$JEUmUbw:*RQrNZR(KҴ.XXS  (h*l!Ĉ'Rhb7rG"G,ird %L'gҬi3#Ȝ:9'J-jtΤ92mZ3JNRƪZB+ذbǒeuhٴjײm{6&ܸrҭk.޼z/j0Ċ3n1Ȓ'Sl2̚7s3ТG;mule-2.0.1/core/xdocs/images/fix.gif0000644000175000017500000000026510204257011017065 0ustar charlescharlesGIF89a-H/Ʊ8)&#騦rT:$TRTxwv!,b9 ^+_'nYE1REAeWܮQ!{pKe0`!5 VJ`Q7  );mule-2.0.1/core/xdocs/images/sendMessageFlow.gif0000644000175000017500000002122610204257011021365 0ustar charlescharlesGIF89a        $  $ (  $ ( $$$0 $( $,$$$$$((0 (0$(,$(0((( ,8$,4$,8(,0,,,,,0$08(00$0<$0@(08(0<,04,08000004(4@,4<044,4@048444(8H,8D48848<48@8880<<,@tm 3KIL8 H@A,HF eL'H RAoHGHNHGa<p-fH8̡ ]1<!A(B(T! R\8M6& ~`ܗhLHSc ]с%&(8Bdp dT7|dD|A zD$G@.73&HE.!L|R*џW(B%8gpaLF 9\db 0Ibs*J1Dd.PL!]̤@&"mтF& &+e)#T+rMs\#QM& PIЂ3(^<`ټA-6a+ HGJҒE.Сl(ზ"sPNp2󧭜'Q|"(`QqbHpDDJA 8ZTʱ7BԮFLöխ He>W ?_i)}hPѽ1Y@$"e<u;e+041\`&R)QjNKa S,6D Q-Q>C/J"H*QaJSH_ ޥ`04#SMoAb`~-1(@ ( V_Š?D 40APE@p M)V! `1@p`/ 0 ^Bag~u:KX L\P5&2`%P!,"^I2e8!NsgbOȰ<+ @)OقuG:q;1(aDCn3 1ق7.b Lռ3P΍` n/zflrYu< AiS= 6"(Bu XXtk\FUEJ1bOp 8AGAPA "職%\G 2 :"~#<  @b$D"lH{@)(q! >b3 ( JB#c vakp 8'C0**։Tz , CY2!g\AN2p(OZ[;CB~pwb8?>(WH\) ;eXF ,'|y E<zC?8:) ;Z ;<5.% A`4 <<<s<Ez#hn;a4 i4{o-#` d $ yhGIGI AmggDdx`{WrxHӀ`}}~gDq7 y |DflǗ|J||www| O` Ё'xOgDq=74g 3Aˠf@37B҇w O `@3x p` gB'w"Hg^  gg `}W' yӀ7 WXB1qH p8H?q@F>jB~aw&8 2N8)HxR> @p@@+ %ihAx ܘwww7#rRHxTs@ e*a 1WBg XwGkOpyywh&T2hf1 sZp5s9 p (4x6)HH@? P @ ِq (w>} Ͱ} rwrH}rm 5A`}6Wnq$#` ׉y=yv؆(hH3Iq8֓RٌӠ@GcQ 8$x XI ~w|̀( C _|._ 2.9`vS8rY#9@?`iF P dD_"7Y9IBw{7ӉPyL)wHiz4Öj ܁ ^ @GB7߇x` 9 }ۗ( -r){^y ALp99B YrXr(x#zD q- z) [B1r sSL L _sLPS's C1Tp0 |@?EXz .6TIK`!/ .cggS`l 8mJc~: m 2WJ92L p3. =E ̰ S0* 8J1|אnJ\ꥤ|@ e?Ѡ Z  qI)GK0p z_à ˨Jl 8 @Ć͇czy vi` S +Q7Ep 0SQ0䢯J1ɣК 8s B/LΊ2|d]: ߪ 0  SM80d[8P`AV`#`f`Aj PT `0j|; 0Ŧu vu p0F `#!1 P ʧa#10s 0󁴉 :1Ҋ|ժF0 FP T;|l8P %gzIA%r|uٙ*+RsPfKj ˜2MySq/6; wu$TG+ꊜYkE>1f313/fҐ4û$)=/5<1PBXqR@ P @Ŷ wzǙþ#46g[Wr \#' h JAvq:yIVrgx8Цq#kZyʯ3|/.$K`H y4%WuL|"-23/g fIJ(@\ !T {` $2` OKħ+5f6Tp_>]YGh 7'GŐ .ly{L„Z%x׌ Hӌ ɟyms IR sP Ȋ'B @l $HI'7WOx7xplYʙْ6cym .Hm P礲|d'*n\)yǘo.rH^ټH$N襞BqmAS-ShS4LP U >ӷNt|:mXlݞsH=Uv8nް#Q G {ni ynYmyHg&Q|>9 @ U _ ?P+1{޾%uay\ [grjM^̐;X){+l8r{Gnwni_~fѸL.@JN2Q-Wx1cfaoTG> ]Z?AuϜ}8vx ~܂?{7¯ri@2#U~ p|[Uug 1 s,v\m1M@ DPaA'=њrycQFܒRH%MD9-!b,L5męSΚvNPKl-DTiAFGTjcQٚ1R]ᵩV@[9>ZnNsDZ^%KԚ>#@-Esr"dʕC:-Dm1y~ZϷqokXg4zZAػZwbKM[wq,w~{Q̸q甲^|D6CYz;I5ݽ"):[>( <hV(!Knkn t@P-dBxM,P>o<`f<S2γڣOmPXCrEȏPp%@/ ˷%z&]ܮӌL%T Ö4hC\ ӈ;aE9Ib&c`|kSzDS`ZqH"g@&) ]* {.(]L`PFKNS"29*#SGtSZ3W&S=ֽ[ԢchULi!^-%&HbE-LS% B}C U>plTlJ5U7'=&}(dM-Kd\W#<*`Oܸ\jB+ "um;$uEV.wriajSY^ϣu_Q_.ai`k)xe:jjaqV#\.0Gl!lF;m$ ZRimA06m`` a W,oA\Ys;d ⁃*"19PrJvoBvw>x{5Iȡy矇>z>Pݚb "/LaNB }g}w<ɞ 0JQЀC"nx`3Zwf{F@2~]FEq"wd.FX?BGAD@?'-3[)Hnu`(B SbDaŠ9\շb#Y%x) jaF)21B+40 Ns@WB(QU! .Zm'NS#Q 1pAXd L1>J&( 9# XRrɊAø&ٵmX2eg, sQf<&m #1VdKP3h*햋b9v qjrX÷|9X%yN b2EESex)aA)1* B.OcЃghGяB'1 F%YKF.(P\ѬB "} 6کP^"0/+P`kQ0jW2^c 9w[1P{Qi3-%ƨ(o,)-20p;+82j|9.NDLl-v= j\M,rf_-s@ֶ6-^j|3U!4pJ0E$.Iʑ )r\tJW]nt !KFvCoz lt-q;noL >}b}qߧ$4u0 ovvIwuvh`Bx.Ez mpPI%Sgq5 ȁ^# nS.9|ohGFrd&7J nty@symuJPбuwzKugѾ咝owu{މ>w.n{h=|/w|%O|5?}E?bc}Qzկw};b˞#=a{n#~q G~όBO>9|C_~|?~}_䯈q@C~:pK=@t4DKdt  \ A4DdASB $",:#D$A%d& !t(B )+Ԥ*-B".0/6B`_p:1TC{D;BP3L5#bsC9C?{{==+C =C=D#JD+0>+?DN,FtH4HE!Ek8VCQ\EWE=tX[;E;mule-2.0.1/core/xdocs/images/mule-logo-icon-32.gif0000644000175000017500000000260510204257011021347 0ustar charlescharlesGIF89a vc..m&&o%%|EEE###ͮ@@@ϰ xBBBDDDp$$$$$n##;;;KKK>>>tt}iiPPPm99~yyKMMoVV`ns^LLî)((ݥ𸸸qTT꯯^>>a@@u[[Ҝgo66S--g|TT!""uMM[//|&**EGG!## ;<<ou;DD999⳶><>xw``m""w__$++&&{-''ڐd..xya++Z00`_zYY{__m//~\\r|{{r kwk##s<<>AA===444v]]%&&&&&:<bOҀ )@&? q#?7Cfu_їfV Z#R^NM0QUaX}zM[WC +]}P7U "#5H1)b o3teX."K/@:jæ%djm"at<,|Bi,sIJKR4xU+p E  8ݗ_HDPA  #P ~!2t'+P !yQP*347 8>Tz yQG41wX5 4N 1 D0$ _,Ԉ6!90C> 34h5>uH A?d The Mule implementation of the Universal Message Objects(tm) API specification. mule-2.0.1/core/src/main/java/org/mule/work/0000755000175000017500000000000011351411106020370 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/work/package.html0000644000175000017500000000016110745677442022676 0ustar charlescharles Mule A javax.resource.spi.WorkManager implementation. mule-2.0.1/core/src/main/java/org/mule/work/DefaultWorkListener.java0000644000175000017500000000355210766460477025225 0ustar charlescharles/* * $Id: DefaultWorkListener.java 11362 2008-03-14 11:27:59Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.work; import javax.resource.spi.work.WorkEvent; import javax.resource.spi.work.WorkListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Default exception Handler used when executing work in the work manager */ public class DefaultWorkListener implements WorkListener { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); public void workAccepted(WorkEvent event) { handleWorkException(event, "workAccepted"); } public void workRejected(WorkEvent event) { handleWorkException(event, "workRejected"); } public void workStarted(WorkEvent event) { handleWorkException(event, "workStarted"); } public void workCompleted(WorkEvent event) { handleWorkException(event, "workCompleted"); } protected void handleWorkException(WorkEvent event, String type) { Throwable e; if (event != null && event.getException() != null) { e = event.getException(); } else { return; } if (event.getException().getCause() != null) { e = event.getException().getCause(); } logger.error("Work caused exception on '" + type + "'. Work being executed was: " + event.getWork().toString()); logger.error(e); } } mule-2.0.1/core/src/main/java/org/mule/work/SyncWorkExecutor.java0000644000175000017500000000262410745677442024564 0ustar charlescharles/* * $Id: SyncWorkExecutor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ /** * * Copyright 2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mule.work; import org.mule.api.work.WorkExecutor; import javax.resource.spi.work.WorkException; import edu.emory.mathcs.backport.java.util.concurrent.Executor; public class SyncWorkExecutor implements WorkExecutor { public void doExecute(WorkerContext work, Executor executor) throws WorkException, InterruptedException { work.run(); } } mule-2.0.1/core/src/main/java/org/mule/work/StartWorkExecutor.java0000644000175000017500000000302010745677442024734 0ustar charlescharles/* * $Id: StartWorkExecutor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ /** * * Copyright 2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mule.work; import org.mule.api.work.WorkExecutor; import org.mule.util.concurrent.Latch; import javax.resource.spi.work.WorkException; import edu.emory.mathcs.backport.java.util.concurrent.Executor; public class StartWorkExecutor implements WorkExecutor { public void doExecute(WorkerContext work, Executor executor) throws WorkException, InterruptedException { Latch latch = work.provideStartLatch(); executor.execute(work); latch.await(); } } mule-2.0.1/core/src/main/java/org/mule/work/MuleWorkManager.java0000644000175000017500000002270110774254333024314 0ustar charlescharles/* * $Id: MuleWorkManager.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ /** * * Copyright 2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mule.work; import org.mule.api.MuleException; import org.mule.api.config.ThreadingProfile; import org.mule.api.context.WorkManager; import org.mule.api.work.WorkExecutor; import java.text.MessageFormat; import java.util.List; import javax.resource.spi.XATerminator; import javax.resource.spi.work.ExecutionContext; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkCompletedException; import javax.resource.spi.work.WorkException; import javax.resource.spi.work.WorkListener; import edu.emory.mathcs.backport.java.util.concurrent.Executor; import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleWorkManager is a JCA Work manager implementation used to manage * thread allocation for Mule components and connectors. This code has been adapted * from the Geronimo implementation. */ public class MuleWorkManager implements WorkManager { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(MuleWorkManager.class); /** * Graceful shutdown delay */ private static final long SHUTDOWN_TIMEOUT = 5000L; /** * The ThreadingProfile used for creation of the underlying ExecutorService */ private final ThreadingProfile threadingProfile; /** * The actual pool of threads used by this MuleWorkManager to process the Work * instances submitted via the (do,start,schedule)Work methods. */ private volatile ExecutorService workExecutorService; private final String name; /** * Various policies used for work execution */ private final WorkExecutor scheduleWorkExecutor = new ScheduleWorkExecutor(); private final WorkExecutor startWorkExecutor = new StartWorkExecutor(); private final WorkExecutor syncWorkExecutor = new SyncWorkExecutor(); public MuleWorkManager(ThreadingProfile profile, String name) { super(); if (name == null) { name = "WorkManager#" + hashCode(); } this.threadingProfile = profile; this.name = name; } public synchronized void start() throws MuleException { if (workExecutorService == null) { workExecutorService = threadingProfile.createPool(name); } } public synchronized void dispose() { if (workExecutorService != null) { try { // Cancel currently executing tasks List outstanding = workExecutorService.shutdownNow(); // Wait a while for existing tasks to terminate if (!workExecutorService.awaitTermination(SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS)) { if (logger.isWarnEnabled()) { logger.warn(MessageFormat.format( "Pool {0} did not terminate in time; {1} work items were cancelled.", new Object[] {name, outstanding.isEmpty() ? "No" : Integer.toString(outstanding.size())})); } } } catch (InterruptedException ie) { // (Re-)Cancel if current thread also interrupted workExecutorService.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } finally { workExecutorService = null; } } } // TODO public XATerminator getXATerminator() { return null; } /* * (non-Javadoc) * * @see javax.resource.spi.work.MuleWorkManager#doWork(javax.resource.spi.work.Work) */ public void doWork(Work work) throws WorkException { executeWork(new WorkerContext(work), syncWorkExecutor); } /* * (non-Javadoc) * * @see javax.resource.spi.work.MuleWorkManager#doWork(javax.resource.spi.work.Work, * long, javax.resource.spi.work.ExecutionContext, * javax.resource.spi.work.WorkListener) */ public void doWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener) throws WorkException { WorkerContext workWrapper = new WorkerContext(work, startTimeout, execContext, workListener); workWrapper.setThreadPriority(Thread.currentThread().getPriority()); executeWork(workWrapper, syncWorkExecutor); } /* * (non-Javadoc) * * @see javax.resource.spi.work.MuleWorkManager#startWork(javax.resource.spi.work.Work) */ public long startWork(Work work) throws WorkException { WorkerContext workWrapper = new WorkerContext(work); workWrapper.setThreadPriority(Thread.currentThread().getPriority()); executeWork(workWrapper, startWorkExecutor); return System.currentTimeMillis() - workWrapper.getAcceptedTime(); } /* * (non-Javadoc) * * @see javax.resource.spi.work.MuleWorkManager#startWork(javax.resource.spi.work.Work, * long, javax.resource.spi.work.ExecutionContext, * javax.resource.spi.work.WorkListener) */ public long startWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener) throws WorkException { WorkerContext workWrapper = new WorkerContext(work, startTimeout, execContext, workListener); workWrapper.setThreadPriority(Thread.currentThread().getPriority()); executeWork(workWrapper, startWorkExecutor); return System.currentTimeMillis() - workWrapper.getAcceptedTime(); } /* * (non-Javadoc) * * @see javax.resource.spi.work.MuleWorkManager#scheduleWork(javax.resource.spi.work.Work) */ public void scheduleWork(Work work) throws WorkException { WorkerContext workWrapper = new WorkerContext(work); workWrapper.setThreadPriority(Thread.currentThread().getPriority()); executeWork(workWrapper, scheduleWorkExecutor); } /* * (non-Javadoc) * * @see javax.resource.spi.work.MuleWorkManager#scheduleWork(javax.resource.spi.work.Work, * long, javax.resource.spi.work.ExecutionContext, * javax.resource.spi.work.WorkListener) */ public void scheduleWork(Work work, long startTimeout, ExecutionContext execContext, WorkListener workListener) throws WorkException { WorkerContext workWrapper = new WorkerContext(work, startTimeout, execContext, workListener); workWrapper.setThreadPriority(Thread.currentThread().getPriority()); executeWork(workWrapper, scheduleWorkExecutor); } /** * @see Executor#execute(Runnable) */ public void execute(Runnable work) { if (workExecutorService == null) { throw new IllegalStateException("This MuleWorkManager '" + name + "' was never started"); } else if (workExecutorService.isShutdown()) { throw new IllegalStateException("This MuleWorkManager '" + name + "' is stopped"); } workExecutorService.execute(work); } /** * Execute the specified Work. * * @param work Work to be executed. * @exception WorkException Indicates that the Work execution has been * unsuccessful. */ private void executeWork(WorkerContext work, WorkExecutor workExecutor) throws WorkException { if (workExecutorService == null || workExecutorService.isShutdown()) { throw new IllegalStateException("This MuleWorkManager '" + name + "' is stopped"); } try { work.workAccepted(this); workExecutor.doExecute(work, workExecutorService); WorkException exception = work.getWorkException(); if (null != exception) { throw exception; } } catch (InterruptedException e) { WorkCompletedException wcj = new WorkCompletedException("The execution has been interrupted for WorkManager: " + name, e); wcj.setErrorCode(WorkException.INTERNAL); throw wcj; } } } mule-2.0.1/core/src/main/java/org/mule/work/WorkerContext.java0000644000175000017500000003155210745677442024106 0ustar charlescharles/* * $Id: WorkerContext.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ /** * * Copyright 2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mule.work; import org.mule.util.concurrent.Latch; import javax.resource.spi.work.ExecutionContext; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkAdapter; import javax.resource.spi.work.WorkCompletedException; import javax.resource.spi.work.WorkEvent; import javax.resource.spi.work.WorkException; import javax.resource.spi.work.WorkListener; import javax.resource.spi.work.WorkRejectedException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * WorkerContext TODO */ public class WorkerContext implements Work { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(WorkerContext.class); /** * Null WorkListener used as the default WorkListener. */ private static final WorkListener NULL_WORK_LISTENER = new WorkAdapter() { public void workRejected(WorkEvent event) { if (event.getException() != null) { if (event.getException() instanceof WorkCompletedException && event.getException().getCause() != null) { logger.error(event.getWork().toString(), event.getException().getCause()); } else { logger.error(event.getWork().toString(), event.getException()); } } } }; /** * Priority of the thread, which will execute this work. */ private int threadPriority; /** * Actual work to be executed. */ private Work worker; /** * System.currentTimeMillis() when the wrapped Work has been accepted. */ private long acceptedTime; /** * Number of times that the execution of this work has been tried. */ private int retryCount; /** * Time duration (in milliseconds) within which the execution of the Work * instance must start. */ private long startTimeOut; /** * Execution context of the actual work to be executed. */ private final ExecutionContext executionContext; /** * Listener to be notified during the life-cycle of the work treatment. */ private WorkListener workListener = NULL_WORK_LISTENER; /** * Work exception, if any. */ private WorkException workException; /** * A latch, which is released when the work is started. */ private final Latch startLatch = new Latch(); /** * A latch, which is released when the work is completed. */ private final Latch endLatch = new Latch(); /** * Create a WorkWrapper. * * @param work Work to be wrapped. */ public WorkerContext(Work work) { worker = work; executionContext = null; } /** * Create a WorkWrapper with the specified execution context. * * @param aWork Work to be wrapped. * @param aStartTimeout a time duration (in milliseconds) within which the * execution of the Work instance must start. * @param execContext an object containing the execution context with which the * submitted Work instance must be executed. * @param workListener an object which would be notified when the various Work * processing events (work accepted, work rejected, work started, */ public WorkerContext(Work aWork, long aStartTimeout, ExecutionContext execContext, WorkListener workListener) { worker = aWork; startTimeOut = aStartTimeout; executionContext = execContext; if (null != workListener) { this.workListener = workListener; } } /* * (non-Javadoc) * * @see javax.resource.spi.work.Work#release() */ public void release() { worker.release(); } /** * Defines the thread priority level of the thread, which will be dispatched to * process this work. This priority level must be the same one for a given * resource adapter. * * @param aPriority Priority of the thread to be used to process the wrapped Work * instance. */ public void setThreadPriority(int aPriority) { threadPriority = aPriority; } /** * Gets the priority level of the thread, which will be dispatched to process * this work. This priority level must be the same one for a given resource * adapter. * * @return The priority level of the thread to be dispatched to process the * wrapped Work instance. */ public int getThreadPriority() { return threadPriority; } /** * Call-back method used by a Work executor in order to notify this instance that * the wrapped Work instance has been accepted. * * @param anObject Object on which the event initially occurred. It should be the * work executor. */ public synchronized void workAccepted(Object anObject) { acceptedTime = System.currentTimeMillis(); workListener.workAccepted(new WorkEvent(anObject, WorkEvent.WORK_ACCEPTED, worker, null)); } /** * System.currentTimeMillis() when the Work has been accepted. This method can be * used to compute the duration of a work. * * @return When the work has been accepted. */ public synchronized long getAcceptedTime() { return acceptedTime; } /** * Gets the time duration (in milliseconds) within which the execution of the * Work instance must start. * * @return Time out duration. */ public long getStartTimeout() { return startTimeOut; } /** * Used by a Work executor in order to know if this work, which should be * accepted but not started has timed out. This method MUST be called prior to * retry the execution of a Work. * * @return true if the Work has timed out and false otherwise. */ public synchronized boolean isTimedOut() { // A value of 0 means that the work never times out. // ??? really? if (0 == startTimeOut || startTimeOut == MuleWorkManager.INDEFINITE) { return false; } boolean isTimeout = acceptedTime + startTimeOut > 0 && System.currentTimeMillis() > acceptedTime + startTimeOut; if (logger.isDebugEnabled()) { logger.debug(this + " accepted at " + acceptedTime + (isTimeout ? " has timed out." : " has not timed out. ") + retryCount + " retries have been performed."); } if (isTimeout) { workException = new WorkRejectedException(this + " has timed out.", WorkException.START_TIMED_OUT); workListener.workRejected(new WorkEvent(this, WorkEvent.WORK_REJECTED, worker, workException)); return true; } retryCount++; return isTimeout; } /** * Gets the WorkException, if any, thrown during the execution. * * @return WorkException, if any. */ public synchronized WorkException getWorkException() { return workException; } /* * (non-Javadoc) * * @see java.lang.Runnable#run() */ public void run() { if (isTimedOut()) { // In case of a time out, one releases the start and end latches // to prevent a dead-lock. startLatch.countDown(); endLatch.countDown(); return; } // Implementation note: the work listener is notified prior to release // the start lock. This behavior is intentional and seems to be the // more conservative. workListener.workStarted(new WorkEvent(this, WorkEvent.WORK_STARTED, worker, null)); startLatch.countDown(); // Implementation note: we assume this is being called without an // interesting TransactionContext, // and ignore/replace whatever is associated with the current thread. try { if (executionContext == null || executionContext.getXid() == null) { // TODO currently unused, see below // ExecutionContext context = new ExecutionContext(); try { worker.run(); } finally { // ExecutionContext returningContext = new // ExecutionContext(); // if (context != returningContext) { // throw new WorkCompletedException("Wrong // TransactionContext on return from work done"); // } } // TODO should we commit the txContext to flush any leftover // state??? } else { // try { // long transactionTimeout = // executionContext.getDefaultTransactionTimeout(); // //translate -1 value to 0 to indicate default transaction // timeout. // transactionContextManager.begin(executionContext.getXid(), // transactionTimeout == -1 ? 0 : transactionTimeout); // } catch (XAException e) { // throw new WorkCompletedException("Transaction import failed // for xid " + executionContext.getXid(), // WorkCompletedException.TX_RECREATE_FAILED).initCause(e); // } catch (InvalidTransactionException e) { // throw new WorkCompletedException("Transaction import failed // for xid " + executionContext.getXid(), // WorkCompletedException.TX_RECREATE_FAILED).initCause(e); // } catch (SystemException e) { // throw new WorkCompletedException("Transaction import failed // for xid " + executionContext.getXid(), // WorkCompletedException.TX_RECREATE_FAILED).initCause(e); // } catch (ImportedTransactionActiveException e) { // throw new WorkCompletedException("Transaction already active // for xid " + executionContext.getXid(), // WorkCompletedException.TX_CONCURRENT_WORK_DISALLOWED); // } try { worker.run(); } finally { // transactionContextManager.end(executionContext.getXid()); } } workListener.workCompleted(new WorkEvent(this, WorkEvent.WORK_COMPLETED, worker, null)); } catch (Throwable e) { workException = (WorkException)(e instanceof WorkCompletedException ? e : new WorkCompletedException("Unknown error", WorkCompletedException.UNDEFINED).initCause(e)); workListener.workCompleted(new WorkEvent(this, WorkEvent.WORK_REJECTED, worker, workException)); } finally { endLatch.countDown(); } } /** * Provides a latch, which can be used to wait the start of a work execution. * * @return Latch that a caller can acquire to wait for the start of a work * execution. */ public Latch provideStartLatch() { return startLatch; } /** * Provides a latch, which can be used to wait the end of a work execution. * * @return Latch that a caller can acquire to wait for the end of a work * execution. */ public Latch provideEndLatch() { return endLatch; } public String toString() { return "Work: " + worker; } } mule-2.0.1/core/src/main/java/org/mule/work/ScheduleWorkExecutor.java0000644000175000017500000000265010745677442025403 0ustar charlescharles/* * $Id: ScheduleWorkExecutor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ /** * * Copyright 2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mule.work; import org.mule.api.work.WorkExecutor; import javax.resource.spi.work.WorkException; import edu.emory.mathcs.backport.java.util.concurrent.Executor; public class ScheduleWorkExecutor implements WorkExecutor { public void doExecute(WorkerContext work, Executor executor) throws WorkException, InterruptedException { executor.execute(work); } } mule-2.0.1/core/src/main/java/org/mule/object/0000755000175000017500000000000011351411114020653 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/object/JndiObjectFactory.java0000644000175000017500000001225610774254333025107 0ustar charlescharles/* * $Id: JndiObjectFactory.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.object; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationCallback; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.object.ObjectFactory; import org.mule.config.i18n.CoreMessages; import java.util.Hashtable; import java.util.Map; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class JndiObjectFactory implements ObjectFactory, Initialisable, Disposable { /** * If true, the object is looked up from JNDI each time create() is called, otherwise it * is looked up once and stored locally. Default value is false. */ private boolean lookupOnEachCall = false; private String objectName; private String initialFactory; private String url; private Map properties; private Context _context; private Object _object; protected final Log logger = LogFactory.getLog(getClass()); public JndiObjectFactory() { // for IoC only } public JndiObjectFactory(String objectName, String initialFactory, String url) { this(objectName, initialFactory, url, null); } public JndiObjectFactory(String objectName, String initialFactory, String url, Map properties) { this.objectName = objectName; this.initialFactory = initialFactory; this.url = url; this.properties = properties; } public void initialise() throws InitialisationException { if (_context == null) { Hashtable props = new Hashtable(); if (initialFactory != null) { props.put(Context.INITIAL_CONTEXT_FACTORY, initialFactory); } else if (properties == null || !properties.containsKey(Context.INITIAL_CONTEXT_FACTORY)) { throw new InitialisationException(CoreMessages.objectIsNull("jndiInitialFactory"), this); } if (url != null) { props.put(Context.PROVIDER_URL, url); } if (properties != null) { props.putAll(properties); } try { _context = new InitialContext(props); } catch (NamingException e) { throw new InitialisationException(e, this); } } } public void dispose() { if (_context != null) { try { _context.close(); } catch (NamingException e) { logger.error("JNDI Context failed to dispose properly: ", e); } finally { _context = null; } } } public Object getInstance() throws Exception { if (_object == null || lookupOnEachCall == true) { _object = _context.lookup(objectName); } return _object; } /** {@inheritDoc} */ public Class getObjectClass() { throw new UnsupportedOperationException(); } /////////////////////////////////////////////////////////////////////////////////////////// // Getters and Setters /////////////////////////////////////////////////////////////////////////////////////////// public String getInitialFactory() { return initialFactory; } public void setInitialFactory(String initialFactory) { this.initialFactory = initialFactory; } public boolean isLookupOnEachCall() { return lookupOnEachCall; } public void setLookupOnEachCall(boolean lookupOnEachCall) { this.lookupOnEachCall = lookupOnEachCall; } public String getObjectName() { return objectName; } public void setObjectName(String objectName) { this.objectName = objectName; } public Map getProperties() { return properties; } public void setProperties(Map properties) { this.properties = properties; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public Context getContext() { return _context; } protected void setContext(Context context) { this._context = context; } public void addObjectInitialisationCallback(InitialisationCallback callback) { throw new UnsupportedOperationException(); } public boolean isSingleton() { return false; } } mule-2.0.1/core/src/main/java/org/mule/object/AbstractObjectFactory.java0000644000175000017500000001100310774254333025753 0ustar charlescharles/* * $Id: AbstractObjectFactory.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.object; import org.mule.api.lifecycle.InitialisationCallback; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.object.ObjectFactory; import org.mule.config.i18n.MessageFactory; import org.mule.util.BeanUtils; import org.mule.util.ClassUtils; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Creates object instances based on the class and sets any properties. */ public abstract class AbstractObjectFactory implements ObjectFactory { public static final String ATTRIBUTE_OBJECT_CLASS_NAME = "objectClassName"; public static final String ATTRIBUTE_OBJECT_CLASS = "objectClass"; protected String objectClassName; protected Class objectClass = null; protected Map properties = null; protected List initialisationCallbacks = new ArrayList(); protected transient Log logger = LogFactory.getLog(getClass()); /** For Spring only */ public AbstractObjectFactory() { // nop } public AbstractObjectFactory(String objectClassName) { this(objectClassName, null); } public AbstractObjectFactory(String objectClassName, Map properties) { this.objectClassName = objectClassName; this.properties = properties; } public AbstractObjectFactory(Class objectClass) { this(objectClass, null); } public AbstractObjectFactory(Class objectClass, Map properties) { this.objectClass = objectClass; this.properties = properties; } public void initialise() throws InitialisationException { if (objectClass == null && objectClassName == null) { throw new InitialisationException( MessageFactory.createStaticMessage("Object factory has not been initialized."), this); } if (objectClass == null && objectClassName != null) { try { objectClass = ClassUtils.getClass(objectClassName); } catch (ClassNotFoundException e) { throw new InitialisationException(e, this); } } } public void dispose() { this.objectClass = null; this.objectClassName = null; } /** * Creates an initialized object instance based on the class and sets any properties. */ public Object getInstance() throws Exception { if (objectClass == null) { throw new InitialisationException( MessageFactory.createStaticMessage("Object factory has not been initialized."), this); } Object object = ClassUtils.instanciateClass(objectClass, ClassUtils.NO_ARGS); if (properties != null) { BeanUtils.populate(object, properties); } fireInitialisationCallbacks(object); return object; } protected void fireInitialisationCallbacks(Object component) throws InitialisationException { InitialisationCallback callback; for (Iterator iterator = initialisationCallbacks.iterator(); iterator.hasNext();) { callback = (InitialisationCallback) iterator.next(); callback.initialise(component); } } public Class getObjectClass() { return objectClass; } public void setObjectClass(Class objectClass) { this.objectClass = objectClass; } protected String getObjectClassName() { return objectClassName; } public void setObjectClassName(String objectClassName) { this.objectClassName = objectClassName; } protected Map getProperties() { return properties; } public void setProperties(Map properties) { this.properties = properties; } public void addObjectInitialisationCallback(InitialisationCallback callback) { initialisationCallbacks.add(callback); } public boolean isSingleton() { return false; } } mule-2.0.1/core/src/main/java/org/mule/object/SingletonObjectFactory.java0000644000175000017500000000526210774254333026164 0ustar charlescharles/* * $Id: SingletonObjectFactory.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.object; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.MessageFactory; import java.util.Map; /** * Creates an instance of the object once and then always returns the same instance. */ public class SingletonObjectFactory extends AbstractObjectFactory { private Object instance = null; /** For Spring only */ public SingletonObjectFactory() { super(); } public SingletonObjectFactory(String objectClassName) { super(objectClassName); } public SingletonObjectFactory(String objectClassName, Map properties) { super(objectClassName, properties); } public SingletonObjectFactory(Class objectClass) { super(objectClass); } public SingletonObjectFactory(Class objectClass, Map properties) { super(objectClass, properties); } /** * Create the singleton based on a previously created object. */ public SingletonObjectFactory(Object instance) { super(instance.getClass()); this.instance = instance; } // @Override public void initialise() throws InitialisationException { super.initialise(); if (instance == null) { try { instance = super.getInstance(); } catch (Exception e) { throw new InitialisationException(e, this); } } } // @Override public void dispose() { instance = null; super.dispose(); } /** * Always returns the same instance of the object. */ // @Override public Object getInstance() throws Exception { if (instance != null) { return instance; } else { throw new InitialisationException( MessageFactory.createStaticMessage("Object factory has not been initialized."), this); } } // @Override public Class getObjectClass() { if (instance != null) { return instance.getClass(); } else { return super.getObjectClass(); } } public boolean isSingleton() { return true; } } mule-2.0.1/core/src/main/java/org/mule/object/PrototypeObjectFactory.java0000644000175000017500000000220410767256152026223 0ustar charlescharles/* * $Id: PrototypeObjectFactory.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.object; import java.util.Map; /** * Creates a new instance of the object on each call. */ public class PrototypeObjectFactory extends AbstractObjectFactory { /** For Spring only */ public PrototypeObjectFactory() { super(); } public PrototypeObjectFactory(String objectClassName) { super(objectClassName); } public PrototypeObjectFactory(String objectClassName, Map properties) { super(objectClassName, properties); } public PrototypeObjectFactory(Class objectClass) { super(objectClass); } public PrototypeObjectFactory(Class objectClass, Map properties) { super(objectClass, properties); } } mule-2.0.1/core/src/main/java/org/mule/RequestContext.java0000644000175000017500000001066310745677442023303 0ustar charlescharles/* * $Id: RequestContext.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.ExceptionPayload; import org.mule.api.MuleEvent; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.ThreadSafeAccess; /** * RequestContext is a thread context where components can get the * current event or set response properties that will be sent on the outgoing * message. * *

    RequestContext seems to be used to allow thread local mutation of events that * are not otherwise available in the scope. so this is a good place to create a new * thread local copy - it will be read because supporting code is expecting mutation.

    * */ public final class RequestContext { // to clarify "safe" in constructors public static boolean SAFE = true; public static boolean UNSAFE = true; // setting this to false gives old (mutable) semantics in non-critical cases private static boolean DEFAULT_ACTION = SAFE; private static final ThreadLocal currentEvent = new ThreadLocal(); /** Do not instanciate. */ protected RequestContext() { // no-op } public static MuleEventContext getEventContext() { MuleEvent event = getEvent(); if (event != null) { return new DefaultMuleEventContext(event); } else { return null; } } public static MuleEvent getEvent() { return (MuleEvent) currentEvent.get(); } /** * Set an event for out-of-scope thread access. Safe: use by default * * @param event - the event to set * @return A new mutable copy of the event set */ public static MuleEvent setEvent(MuleEvent event) { return internalSetEvent(newEvent(event, DEFAULT_ACTION)); } protected static MuleEvent internalSetEvent(MuleEvent event) { currentEvent.set(event); return event; } protected static MuleMessage internalRewriteEvent(MuleMessage message, boolean safe) { if (message != null) { MuleEvent event = getEvent(); if (event != null) { MuleMessage copy = newMessage(message, safe); MuleEvent newEvent = new DefaultMuleEvent(copy, event); if (safe) { resetAccessControl(copy); } internalSetEvent(newEvent); return copy; } } return message; } /** * Resets the current request context (clears all information). */ public static void clear() { setEvent(null); } /** * There is no unsafe version of this because it shouldn't be performance critical * * @param exceptionPayload */ public static void setExceptionPayload(ExceptionPayload exceptionPayload) { MuleEvent newEvent = newEvent(getEvent(), SAFE); newEvent.getMessage().setExceptionPayload(exceptionPayload); internalSetEvent(newEvent); } public static ExceptionPayload getExceptionPayload() { return getEvent().getMessage().getExceptionPayload(); } public static MuleMessage safeMessageCopy(MuleMessage message) { return newMessage(message, SAFE); } protected static MuleEvent newEvent(MuleEvent event, boolean safe) { if (safe && event instanceof ThreadSafeAccess) { return (MuleEvent) ((ThreadSafeAccess)event).newThreadCopy(); } else { return event; } } protected static MuleMessage newMessage(MuleMessage message, boolean safe) { if (safe && message instanceof ThreadSafeAccess) { return (MuleMessage) ((ThreadSafeAccess)message).newThreadCopy(); } else { return message; } } protected static void resetAccessControl(Object object) { if (object instanceof ThreadSafeAccess) { ((ThreadSafeAccess) object).resetAccessControl(); } } } mule-2.0.1/core/src/main/java/org/mule/jndi/0000755000175000017500000000000011351411106020332 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/jndi/MuleInitialContextFactory.java0000644000175000017500000000144610745677442026342 0ustar charlescharles/* * $Id: MuleInitialContextFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.jndi; import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingException; import javax.naming.spi.InitialContextFactory; public class MuleInitialContextFactory implements InitialContextFactory { public Context getInitialContext(Hashtable hashtable) throws NamingException { return new SimpleContext(); } } mule-2.0.1/core/src/main/java/org/mule/jndi/SimpleContext.java0000644000175000017500000001713410745677442024030 0ustar charlescharles/* * $Id: SimpleContext.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.jndi; import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import java.util.jar.Attributes; import javax.naming.Binding; import javax.naming.CompositeName; import javax.naming.Context; import javax.naming.Name; import javax.naming.NameAlreadyBoundException; import javax.naming.NameClassPair; import javax.naming.NameNotFoundException; import javax.naming.NameParser; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.OperationNotSupportedException; public class SimpleContext implements Context { /** What holds the bindings. */ protected Map bindings = new HashMap(); /** Context's environment. */ private Hashtable environment; public SimpleContext() { super(); } public Object lookupLink(Name name) throws NamingException { // unsupported return null; } public void rename(Name oldName, Name newName) throws NamingException { // unsupported } public NameParser getNameParser(Name name) throws NamingException { // unsupported return null; } public NamingEnumeration list(Name name) throws NamingException { // unsupported return null; } public Object lookup(Name name) throws NamingException { return lookup(name.toString()); } public Object lookup(String name) throws NamingException { Object rc = bindings.get(name); if (rc == null) { throw new NameNotFoundException(name); } return rc; } public void bind(Name name, Object obj) throws NamingException { bind(name.toString(), obj); } public void bind(String name, Object obj) throws NamingException { if (bindings.containsKey(name)) { throw new NameAlreadyBoundException(name); } bindings.put(name, obj); } public void rebind(Name name, Object obj) throws NamingException { rebind(name.toString(), obj); } public void rebind(String name, Object obj) throws NamingException { bindings.put(name, obj); } public void unbind(Name name) throws NamingException { unbind(name.toString()); } public void unbind(String name) throws NamingException { if (bindings.remove(name) == null) { throw new NameNotFoundException(name); } } public void rename(Attributes.Name oldName, Attributes.Name newName) throws NamingException { rename(oldName.toString(), newName.toString()); } public void rename(String oldName, String newName) throws NamingException { if (!bindings.containsKey(oldName)) { throw new NameNotFoundException(oldName); } if (bindings.containsKey(newName)) { throw new NameAlreadyBoundException(newName); } bindings.put(newName, bindings.remove(oldName)); } public NamingEnumeration list(Attributes.Name name) throws NamingException { return list(name.toString()); } public NamingEnumeration list(String name) throws NamingException { if (name.length() > 0) { throw new OperationNotSupportedException("subcontexts not supported"); } final Iterator i = bindings.entrySet().iterator(); return new NamingEnumeration() { public Object next() { Map.Entry e = (Map.Entry) i.next(); return new NameClassPair((String) e.getKey(), e.getValue().getClass().getName()); } public boolean hasMore() { return i.hasNext(); } public void close() { // noop } public boolean hasMoreElements() { return hasMore(); } public Object nextElement() { return next(); } }; } public NamingEnumeration listBindings(Name name) throws NamingException { return listBindings(name.toString()); } public NamingEnumeration listBindings(String name) throws NamingException { if (name.length() > 0) { throw new OperationNotSupportedException("subcontexts not supported"); } final Iterator i = bindings.entrySet().iterator(); return new NamingEnumeration() { public Object next() { Map.Entry e = (Map.Entry) i.next(); return new Binding((String) e.getKey(), e.getValue()); } public boolean hasMore() { return i.hasNext(); } public void close() { // noop } public boolean hasMoreElements() { return hasMore(); } public Object nextElement() { return next(); } }; } public void destroySubcontext(Name name) throws NamingException { destroySubcontext(name.toString()); } public void destroySubcontext(String name) throws NamingException { throw new OperationNotSupportedException("subcontexts not supported"); } public Context createSubcontext(Name name) throws NamingException { return createSubcontext(name.toString()); } public Context createSubcontext(String name) throws NamingException { throw new OperationNotSupportedException("subcontexts not supported"); } public Object lookupLink(Attributes.Name name) throws NamingException { return lookupLink(name.toString()); } public Object lookupLink(String name) throws NamingException { return lookup(name); } public NameParser getNameParser(Attributes.Name name) { return getNameParser(name.toString()); } public NameParser getNameParser(String name) { throw new UnsupportedOperationException("getNameParser"); } public String composeName(String name, String prefix) throws NamingException { return composeName(new CompositeName(name), new CompositeName(prefix)).toString(); } public Name composeName(Name name, Name prefix) throws NamingException { Name result = (Name) prefix.clone(); result.addAll(name); return result; } public Object addToEnvironment(String key, Object val) { if (environment == null) { environment = new Hashtable(); } return environment.put(key, val); } public Object removeFromEnvironment(String key) { if (environment == null) { environment = new Hashtable(); } return environment.remove(key); } public Hashtable getEnvironment() { if (environment == null) { environment = new Hashtable(); } return environment; } public void close() { // noop } public String getNameInNamespace() { return ""; } } mule-2.0.1/core/src/main/java/org/mule/endpoint/0000755000175000017500000000000011351411105021225 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/endpoint/AbstractEndpoint.java0000644000175000017500000003421710765624675025375 0ustar charlescharles/* * $Id: AbstractEndpoint.java 11319 2008-03-12 00:54:21Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.MuleContext; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.filter.Filter; import org.mule.api.security.EndpointSecurityFilter; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transformer.Transformer; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import org.mule.util.ClassUtils; import java.net.URI; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import edu.emory.mathcs.backport.java.util.Collections; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * ImmutableMuleEndpoint describes a Provider in the Mule Server. A * endpoint is a grouping of an endpoint, an endpointUri and a transformer. */ public abstract class AbstractEndpoint implements ImmutableEndpoint { private static final long serialVersionUID = -1650380871293160973L; /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(AbstractEndpoint.class); /** * The endpoint used to communicate with the external system */ private final Connector connector; /** * The endpointUri on which to send or receive information */ private final EndpointURI endpointUri; /** * The transformers used to transform the incoming or outgoing data */ private final List transformers; /** * The transformers used to transform the incoming or outgoing data */ private final List responseTransformers; /** * The name for the endpoint */ private final String name; /** * Any additional properties for the endpoint * // TODO This should be final. See MULE-3105 * // TODO Shouldn't this be guarded from concurrent writes? */ private Map properties = new HashMap(); /** * The transaction configuration for this endpoint */ private final TransactionConfig transactionConfig; /** * event filter for this endpoint */ private final Filter filter; /** * determines whether unaccepted filtered events should be removed from the * source. If they are not removed its up to the Message receiver to handle * recieving the same message again */ private final boolean deleteUnacceptedMessages; /** * The security filter to apply to this endpoint */ private final EndpointSecurityFilter securityFilter; /** * whether events received by this endpoint should execute in a single thread */ private final boolean synchronous; /** * Determines whether a synchronous call should block to obtain a response from a * remote server (if the transport supports it). For example for Jms endpoints, * setting remote sync will cause a temporary destination to be set up as a * replyTo destination and will send the message a wait for a response on the * replyTo destination. If the JMSReplyTo is already set on the message that * destination will be used instead. */ private final boolean remoteSync; /** * How long to block when performing a remote synchronisation to a remote host. * This property is optional and will be set to the default Synchonous MuleEvent * time out value if not set */ private final int remoteSyncTimeout; /** * The state that the endpoint is initialised in such as started or stopped */ private final String initialState; private final String endpointEncoding; private final MuleContext muleContext; private final ConnectionStrategy connectionStrategy; public AbstractEndpoint(Connector connector, EndpointURI endpointUri, List transformers, List responseTransformers, String name, Map properties, TransactionConfig transactionConfig, Filter filter, boolean deleteUnacceptedMessages, EndpointSecurityFilter securityFilter, boolean synchronous, boolean remoteSync, int remoteSyncTimeout, String initialState, String endpointEncoding, MuleContext muleContext, ConnectionStrategy connectionStrategy) { this.connector = connector; this.endpointUri = endpointUri; if (transformers == null) { this.transformers = Collections.unmodifiableList(java.util.Collections.EMPTY_LIST); } else { updateTransformerEndpoints(transformers); this.transformers = Collections.unmodifiableList(transformers); } if (responseTransformers == null) { this.responseTransformers = Collections.unmodifiableList(java.util.Collections.EMPTY_LIST); } else { updateTransformerEndpoints(responseTransformers); this.responseTransformers = Collections.unmodifiableList(responseTransformers); } this.name = name; // TODO Properties should be immutable. See MULE-3105 // this.properties = Collections.unmodifiableMap(properties); this.properties.putAll(properties); this.transactionConfig = transactionConfig; this.filter = filter; this.deleteUnacceptedMessages = deleteUnacceptedMessages; this.securityFilter = securityFilter; if (this.securityFilter != null) { this.securityFilter.setEndpoint(this); } this.synchronous = synchronous; this.remoteSync = remoteSync; this.remoteSyncTimeout = remoteSyncTimeout; this.initialState = initialState; this.endpointEncoding = endpointEncoding; this.muleContext = muleContext; this.connectionStrategy = connectionStrategy; } public EndpointURI getEndpointURI() { return endpointUri; } public String getEncoding() { return endpointEncoding; } public Connector getConnector() { return connector; } public String getName() { return name; } public List getTransformers() { return transformers; } public Map getProperties() { return properties; } public boolean isReadOnly() { return true; } public String toString() { // Use the interface to retrieve the string and set // the endpoint uri to a default value String sanitizedEndPointUri = null; URI uri = null; if (endpointUri != null) { sanitizedEndPointUri = endpointUri.toString(); uri = endpointUri.getUri(); } // The following will further sanitize the endpointuri by removing // the embedded password. This will only remove the password if the // uri contains all the necessary information to successfully rebuild the url if (uri != null && (uri.getRawUserInfo() != null) && (uri.getScheme() != null) && (uri.getHost() != null) && (uri.getRawPath() != null)) { // build a pattern up that matches what we need tp strip out the password Pattern sanitizerPattern = Pattern.compile("(.*):.*"); Matcher sanitizerMatcher = sanitizerPattern.matcher(uri.getRawUserInfo()); if (sanitizerMatcher.matches()) { sanitizedEndPointUri = new StringBuffer(uri.getScheme()).append("://") .append(sanitizerMatcher.group(1)) .append(":") .append("@") .append(uri.getHost()) .append(uri.getRawPath()) .toString(); } if (uri.getRawQuery() != null) { sanitizedEndPointUri = sanitizedEndPointUri + "?" + uri.getRawQuery(); } } return ClassUtils.getClassName(getClass()) + "{endpointUri=" + sanitizedEndPointUri + ", connector=" + connector + ", transformer=" + transformers + ", name='" + name + "'" + ", properties=" + properties + ", transactionConfig=" + transactionConfig + ", filter=" + filter + ", deleteUnacceptedMessages=" + deleteUnacceptedMessages + ", securityFilter=" + securityFilter + ", synchronous=" + synchronous + ", initialState=" + initialState + ", remoteSync=" + remoteSync + ", remoteSyncTimeout=" + remoteSyncTimeout + ", endpointEncoding=" + endpointEncoding + "}"; } public String getProtocol() { return connector.getProtocol(); } public TransactionConfig getTransactionConfig() { return transactionConfig; } protected static boolean equal(Object a, Object b) { return ClassUtils.equal(a, b); } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; final AbstractEndpoint other = (AbstractEndpoint) obj; return equal(connectionStrategy, other.connectionStrategy) && equal(connector, other.connector) && deleteUnacceptedMessages == other.deleteUnacceptedMessages && equal(endpointEncoding, other.endpointEncoding) && equal(endpointUri, other.endpointUri) && equal(filter, other.filter) && equal(initialState, other.initialState) // don't include lifecycle state as lifecycle code includes hashing // && equal(initialised, other.initialised) && equal(name, other.name) && equal(properties, other.properties) && remoteSync == other.remoteSync && remoteSyncTimeout == other.remoteSyncTimeout && equal(responseTransformers, other.responseTransformers) && equal(securityFilter, other.securityFilter) && synchronous == other.synchronous && equal(transactionConfig, other.transactionConfig) && equal(transformers, other.transformers); } public int hashCode() { return ClassUtils.hash(new Object[]{this.getClass(), connectionStrategy, connector, deleteUnacceptedMessages ? Boolean.TRUE : Boolean.FALSE, endpointEncoding, endpointUri, filter, initialState, // don't include lifecycle state as lifecycle code includes hashing // initialised, name, properties, remoteSync ? Boolean.TRUE : Boolean.FALSE, new Integer(remoteSyncTimeout), responseTransformers, securityFilter, synchronous ? Boolean.TRUE : Boolean.FALSE, transactionConfig, transformers}); } public Filter getFilter() { return filter; } public boolean isDeleteUnacceptedMessages() { return deleteUnacceptedMessages; } // TODO - remove (or fix) protected void updateTransformerEndpoints(List transformers) { Iterator transformer = transformers.iterator(); while (transformer.hasNext()) { ((Transformer) transformer.next()).setEndpoint(this); } } /** * Returns an EndpointSecurityFilter for this endpoint. If one is not set, there * will be no authentication on events sent via this endpoint * * @return EndpointSecurityFilter responsible for authenticating message flow via * this endpoint. * @see org.mule.api.security.EndpointSecurityFilter */ public EndpointSecurityFilter getSecurityFilter() { return securityFilter; } /** * Determines if requests originating from this endpoint should be synchronous * i.e. execute in a single thread and possibly return an result. This property * is only used when the endpoint is of type 'receiver' * * @return whether requests on this endpoint should execute in a single thread. * This property is only used when the endpoint is of type 'receiver' */ public boolean isSynchronous() { return synchronous; } /** * For certain providers that support the notion of a backchannel such as sockets * (outputStream) or Jms (ReplyTo) Mule can automatically wait for a response * from a backchannel when dispatching over these protocols. This is different * for synchronous as synchronous behavior only applies to in * * @return */ public boolean isRemoteSync() { return remoteSync; } /** * The timeout value for remoteSync invocations * * @return the timeout in milliseconds */ public int getRemoteSyncTimeout() { return remoteSyncTimeout; } /** * Sets the state the endpoint will be loaded in. The States are 'stopped' and * 'started' (default) * * @return the endpoint starting state */ public String getInitialState() { return initialState; } public List getResponseTransformers() { return responseTransformers; } public Object getProperty(Object key) { return properties.get(key); } public MuleContext getMuleContext() { return muleContext; } /** * Getter for property 'connectionStrategy'. * * @return Value for property 'connectionStrategy'. */ public ConnectionStrategy getConnectionStrategy() { return connectionStrategy; } } mule-2.0.1/core/src/main/java/org/mule/endpoint/MuleEndpointURI.java0000644000175000017500000003022110774254333025071 0ustar charlescharles/* * $Id: MuleEndpointURI.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.RegistryContext; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.EndpointURIBuilder; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.registry.ServiceDescriptorFactory; import org.mule.api.registry.ServiceException; import org.mule.config.i18n.CoreMessages; import org.mule.transport.service.TransportServiceDescriptor; import org.mule.util.ClassUtils; import org.mule.util.PropertiesUtils; import org.mule.util.StringUtils; import java.net.URI; import java.net.URISyntaxException; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleEndpointURI is used to determine how a message is sent of * received. The url defines the protocol, the endpointUri destination of the message * and optionally the endpoint to use when dispatching the event. Mule urls take the * form of - protocol://[host]:[port]/[provider]/endpointUri or * protocol://[host]:[port]/endpointUri i.e. vm:///my.object or The protocol can be * any of any connector registered with Mule. The endpoint name if specified must be * the name of a register global endpoint The endpointUri can be any endpointUri * recognised by the endpoint type. */ public class MuleEndpointURI implements EndpointURI { /** * Serial version */ private static final long serialVersionUID = 3906735768171252877L; /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(MuleEndpointURI.class); public static boolean isMuleUri(String url) { return url.indexOf(":/") != -1; } private String address; private String filterAddress; private String endpointName; private String connectorName; private String transformers; private String responseTransformers; private Properties params = new Properties(); private URI uri; private String userInfo; private String schemeMetaInfo; private String resourceInfo; MuleEndpointURI(String address, String endpointName, String connectorName, String transformers, String responseTransformers, Properties properties, URI uri, String userInfo) { this(address, endpointName, connectorName, transformers, responseTransformers, properties, uri); if (userInfo != null) { this.userInfo = userInfo; } } public MuleEndpointURI(String address, String endpointName, String connectorName, String transformers, String responseTransformers, Properties properties, URI uri) { this.address = address; this.endpointName = endpointName; this.connectorName = connectorName; this.transformers = transformers; this.responseTransformers = responseTransformers; this.params = properties; this.uri = uri; this.userInfo = uri.getUserInfo(); if (properties != null) { resourceInfo = (String) properties.remove("resourceInfo"); } } public MuleEndpointURI(EndpointURI endpointUri) { initialise(endpointUri); } public MuleEndpointURI(EndpointURI endpointUri, String filterAddress) { initialise(endpointUri); this.filterAddress = filterAddress; } /** * Creates but does not initialize the endpoint URI. It is up to the caller * to call initialise() at some point. */ public MuleEndpointURI(String uri) throws EndpointException { uri = uri.trim().replaceAll(" ", "%20"); if (!validateUrl(uri)) { throw new MalformedEndpointException(uri); } try { schemeMetaInfo = retrieveSchemeMetaInfo(uri); if (schemeMetaInfo != null) { uri = uri.replaceFirst(schemeMetaInfo + ":", ""); } this.uri = new URI(uri); this.userInfo = this.uri.getRawUserInfo(); } catch (URISyntaxException e) { throw new MalformedEndpointException(uri, e); } } public void initialise() throws InitialisationException { try { String scheme = (schemeMetaInfo == null ? this.uri.getScheme() : schemeMetaInfo); TransportServiceDescriptor sd; sd = (TransportServiceDescriptor)RegistryContext.getRegistry().lookupServiceDescriptor(ServiceDescriptorFactory.PROVIDER_SERVICE_TYPE, scheme, null); if (sd == null) { throw new ServiceException(CoreMessages.noServiceTransportDescriptor(scheme)); } EndpointURIBuilder builder = sd.createEndpointBuilder(); EndpointURI built = builder.build(this.uri); initialise(built); } catch (Exception e) { throw new InitialisationException(e, this); } } private String retrieveSchemeMetaInfo(String url) { int i = url.indexOf(':'); if (i == -1) { return null; } if (url.charAt(i + 1) == '/') { return null; } else { return url.substring(0, i); } } protected boolean validateUrl(String url) { return (url.indexOf(":/") > 0); } private void initialise(EndpointURI endpointUri) { this.address = endpointUri.getAddress(); if (this.endpointName == null) { this.endpointName = endpointUri.getEndpointName(); } this.connectorName = endpointUri.getConnectorName(); this.transformers = endpointUri.getTransformers(); this.responseTransformers = endpointUri.getResponseTransformers(); this.params = endpointUri.getParams(); this.uri = endpointUri.getUri(); this.resourceInfo = endpointUri.getResourceInfo(); this.userInfo = endpointUri.getUserInfo(); } public String getAddress() { return address; } public String getEndpointName() { return (StringUtils.isEmpty(endpointName) ? null : endpointName); } public Properties getParams() { // TODO fix this so that the query string properties are not lost. // not sure whats causing this at the moment if (params.size() == 0 && getQuery() != null) { params = PropertiesUtils.getPropertiesFromQueryString(getQuery()); } return params; } public Properties getUserParams() { Properties p = new Properties(); p.putAll(getParams()); p.remove(PROPERTY_ENDPOINT_NAME); p.remove(PROPERTY_ENDPOINT_URI); p.remove(PROPERTY_TRANSFORMERS); return p; } public URI parseServerAuthority() throws URISyntaxException { return uri.parseServerAuthority(); } public URI normalize() { return uri.normalize(); } public URI resolve(URI uri) { return uri.resolve(uri); } public URI resolve(String str) { return uri.resolve(str); } public URI relativize(URI uri) { return uri.relativize(uri); } public String getScheme() { return uri.getScheme(); } public String getFullScheme() { return (schemeMetaInfo == null ? uri.getScheme() : schemeMetaInfo + ':' + uri.getScheme()); } public boolean isAbsolute() { return uri.isAbsolute(); } public boolean isOpaque() { return uri.isOpaque(); } public String getRawSchemeSpecificPart() { return uri.getRawSchemeSpecificPart(); } public String getSchemeSpecificPart() { return uri.getSchemeSpecificPart(); } public String getRawAuthority() { return uri.getRawAuthority(); } public String getAuthority() { return uri.getAuthority(); } public String getRawUserInfo() { return uri.getRawUserInfo(); } public String getUserInfo() { return userInfo; } public String getHost() { return uri.getHost(); } public int getPort() { return uri.getPort(); } public String getRawPath() { return uri.getRawPath(); } public String getPath() { return uri.getPath(); } public String getRawQuery() { return uri.getRawQuery(); } public String getQuery() { return uri.getQuery(); } public String getRawFragment() { return uri.getRawFragment(); } public String getFragment() { return uri.getFragment(); } public String toString() { return uri.toASCIIString(); } public String getTransformers() { return transformers; } public URI getUri() { return uri; } public String getConnectorName() { return connectorName; } public String getSchemeMetaInfo() { return (schemeMetaInfo == null ? uri.getScheme() : schemeMetaInfo); } public String getResourceInfo() { return resourceInfo; } public String getFilterAddress() { return filterAddress; } public void setEndpointName(String name) { endpointName = name; } public String getUser() { if (StringUtils.isNotBlank(userInfo)) { int i = userInfo.indexOf(':'); if (i == -1) { return userInfo; } else { return userInfo.substring(0, i); } } return null; } public String getResponseTransformers() { return responseTransformers; } public String getPassword() { if (StringUtils.isNotBlank(userInfo)) { int i = userInfo.indexOf(':'); if (i > -1) { return userInfo.substring(i + 1); } } return null; } public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof MuleEndpointURI)) { return false; } MuleEndpointURI muleEndpointURI = (MuleEndpointURI) o; return ClassUtils.equal(address, muleEndpointURI.address) && ClassUtils.equal(connectorName, muleEndpointURI.connectorName) && ClassUtils.equal(endpointName, muleEndpointURI.endpointName) && ClassUtils.equal(filterAddress, muleEndpointURI.filterAddress) && ClassUtils.equal(params, muleEndpointURI.params) && ClassUtils.equal(resourceInfo, muleEndpointURI.resourceInfo) && ClassUtils.equal(schemeMetaInfo, muleEndpointURI.schemeMetaInfo) && ClassUtils.equal(transformers, muleEndpointURI.transformers) && ClassUtils.equal(responseTransformers, muleEndpointURI.responseTransformers) && ClassUtils.equal(uri, muleEndpointURI.uri); } public int hashCode() { return ClassUtils.hash(new Object[]{ address, filterAddress, endpointName, connectorName, transformers, responseTransformers, params, uri, schemeMetaInfo, resourceInfo }); } } mule-2.0.1/core/src/main/java/org/mule/endpoint/package.html0000644000175000017500000000023410745677442023535 0ustar charlescharles Implemtation of Mule endpoint uris. These are constructed using builders that are pluggable for each provider. mule-2.0.1/core/src/main/java/org/mule/endpoint/DynamicURIInboundEndpoint.java0000644000175000017500000001124610766463006027100 0ustar charlescharles/* * $Id: DynamicURIInboundEndpoint.java 11366 2008-03-14 11:48:22Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.MuleContext; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.routing.filter.Filter; import org.mule.api.security.EndpointSecurityFilter; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import java.util.List; import java.util.Map; /** * Allow's EndpointURI to be set and changed dynamically by wrapping up an immutable endpoint instance. */ public class DynamicURIInboundEndpoint implements InboundEndpoint { private static final long serialVersionUID = -2814979100270307813L; private InboundEndpoint endpoint; private EndpointURI dynamicEndpointURI; public DynamicURIInboundEndpoint(InboundEndpoint endpoint) { this.endpoint = endpoint; } public DynamicURIInboundEndpoint(InboundEndpoint endpoint, EndpointURI dynamicEndpointURI) { this.endpoint = endpoint; setEndpointURI(dynamicEndpointURI); } public EndpointURI getEndpointURI() { if (dynamicEndpointURI != null) { return dynamicEndpointURI; } else { return endpoint.getEndpointURI(); } } public void setEndpointURI(EndpointURI dynamicEndpointURI) { this.dynamicEndpointURI = dynamicEndpointURI; } public ConnectionStrategy getConnectionStrategy() { return endpoint.getConnectionStrategy(); } public Connector getConnector() { return endpoint.getConnector(); } public String getEncoding() { return endpoint.getEncoding(); } public Filter getFilter() { return endpoint.getFilter(); } public String getInitialState() { return endpoint.getInitialState(); } public MuleContext getMuleContext() { return endpoint.getMuleContext(); } public String getName() { return endpoint.getName(); } public Map getProperties() { return endpoint.getProperties(); } public Object getProperty(Object key) { return endpoint.getProperty(key); } public String getProtocol() { return endpoint.getProtocol(); } public int getRemoteSyncTimeout() { return endpoint.getRemoteSyncTimeout(); } public List getResponseTransformers() { return endpoint.getResponseTransformers(); } public EndpointSecurityFilter getSecurityFilter() { return endpoint.getSecurityFilter(); } public TransactionConfig getTransactionConfig() { return endpoint.getTransactionConfig(); } public List getTransformers() { return endpoint.getTransformers(); } public boolean isDeleteUnacceptedMessages() { return endpoint.isDeleteUnacceptedMessages(); } public boolean isReadOnly() { return endpoint.isReadOnly(); } public boolean isRemoteSync() { return endpoint.isRemoteSync(); } public boolean isSynchronous() { return endpoint.isSynchronous(); } public MuleMessage request(long timeout) throws Exception { return endpoint.request(timeout); } public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dynamicEndpointURI == null) ? 0 : dynamicEndpointURI.hashCode()); result = prime * result + ((endpoint == null) ? 0 : endpoint.hashCode()); return result; } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final DynamicURIInboundEndpoint other = (DynamicURIInboundEndpoint) obj; if (dynamicEndpointURI == null) { if (other.dynamicEndpointURI != null) return false; } else if (!dynamicEndpointURI.equals(other.dynamicEndpointURI)) return false; if (endpoint == null) { if (other.endpoint != null) return false; } else if (!endpoint.equals(other.endpoint)) return false; return true; } } mule-2.0.1/core/src/main/java/org/mule/endpoint/AbstractEndpointURIBuilder.java0000644000175000017500000001016210745677442027253 0ustar charlescharles/* * $Id: AbstractEndpointURIBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.EndpointURIBuilder; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.util.PropertiesUtils; import java.io.UnsupportedEncodingException; import java.net.URI; import java.net.URLDecoder; import java.util.Properties; /** * {@link UrlEndpointURIBuilder} is the default endpointUri strategy suitable for * most connectors */ public abstract class AbstractEndpointURIBuilder implements EndpointURIBuilder { protected String address; protected String endpointName; protected String connectorName; protected String transformers; protected String responseTransformers; protected String userInfo; public EndpointURI build(URI uri) throws MalformedEndpointException { Properties props = getPropertiesForURI(uri); String replaceAddress = null; //If the address has been set as a parameter on the URI, then we must ensure that that value is used //for the address. We still call the setEndpoint() method so that other information on the URI //is still processed if (address != null) { replaceAddress = address; setEndpoint(uri, props); address = replaceAddress; } else { setEndpoint(uri, props); } EndpointURI ep = new MuleEndpointURI(address, endpointName, connectorName, transformers, responseTransformers, props, uri, userInfo); address = null; endpointName = null; connectorName = null; transformers = null; responseTransformers = null; return ep; } protected abstract void setEndpoint(URI uri, Properties props) throws MalformedEndpointException; protected Properties getPropertiesForURI(URI uri) throws MalformedEndpointException { Properties properties = PropertiesUtils.getPropertiesFromQueryString(uri.getQuery()); String tempEndpointName = (String) properties.get(EndpointURI.PROPERTY_ENDPOINT_NAME); if (tempEndpointName != null) { this.endpointName = tempEndpointName; } // override the endpointUri if set String endpoint = (String) properties.get(EndpointURI.PROPERTY_ENDPOINT_URI); if (endpoint != null) { this.address = endpoint; address = decode(address, uri); } String cnnName = (String) properties.get(EndpointURI.PROPERTY_CONNECTOR_NAME); if (cnnName != null) { this.connectorName = cnnName; } transformers = (String) properties.get(EndpointURI.PROPERTY_TRANSFORMERS); if (transformers != null) { transformers = transformers.replaceAll(" ", ","); } responseTransformers = (String) properties.get(EndpointURI.PROPERTY_RESPONSE_TRANSFORMERS); if (responseTransformers != null) { responseTransformers = responseTransformers.replaceAll(" ", ","); } // If we have user info, decode it as it might contain '@' or other encodable // characters userInfo = uri.getUserInfo(); if (userInfo != null) { userInfo = decode(userInfo, uri); } return properties; } private String decode(String string, URI uri) throws MalformedEndpointException { try { //TODO RM* URGENT: return URLDecoder.decode(string, "UTF-8" /*RegistryContext.getConfiguration().getDefaultEncoding()*/); } catch (UnsupportedEncodingException e) { throw new MalformedEndpointException(uri.toString(), e); } } } mule-2.0.1/core/src/main/java/org/mule/endpoint/URIBuilder.java0000644000175000017500000003103311003247564024050 0ustar charlescharles/* * $Id: URIBuilder.java 11620 2008-04-22 02:37:40Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointURI; import org.mule.util.ClassUtils; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java.util.TreeMap; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference; /** * This has the following logic: * - if an address is specified, it is used verbatim (except for parameters); this is consistent with the generic case * - otherwise, we construct from components, omitting things that aren't specified as much as possible * (use required attributes to guarantee entries) * * In addition, parameters are handled as follows: * - parameters can be given in the uri, the queryMap, or both * - queryMap values override uri values * - the order of parameters in the uri remains the same (even if values change) * - queryMap parameters are appended after uri parameters * (I don't think ordering should matter, but XFire seems to require it) * * TODO - check that we have sufficient control via XML (what about empty strings?) * * Not called EndpointURIBuilder because of {@link org.mule.api.endpoint.EndpointURIBuilder} */ public class URIBuilder { private static final String DOTS = ":"; private static final String DOTS_SLASHES = DOTS + "//"; private static final String QUERY = "?"; private static final String AND = "&"; private static final String EQUALS = "="; public static final String META = "meta"; public static final String PROTOCOL = "protocol"; public static final String USER = "user"; public static final String PASSWORD = "password"; public static final String HOST = "host"; public static final String ADDRESS = "address"; public static final String PORT = "port"; public static final String PATH = "path"; public static final String[] ALL_ATTRIBUTES = new String[]{META, PROTOCOL, USER, PASSWORD, HOST, ADDRESS, PORT, PATH}; // combinations used in various endpoint parsers to validate required attributes public static final String[] PATH_ATTRIBUTES = new String[]{PATH}; public static final String[] HOST_ATTRIBUTES = new String[]{HOST}; public static final String[] SOCKET_ATTRIBUTES = new String[]{HOST, PORT}; public static final String[] USERHOST_ATTRIBUTES = new String[]{USER, HOST}; // this doesn't include address, since that is handled separately (and is exclusive with these) public static final String[] ALL_TRANSPORT_ATTRIBUTES = new String[]{USER, PASSWORD, HOST, PORT, PATH}; private String address; private String meta; private String protocol; private String user; private String password; private String host; private Integer port; private String path; private Map queryMap; private AtomicReference cache = new AtomicReference(); public URIBuilder() { // default } public URIBuilder(EndpointURI endpointURI) { cache.set(endpointURI); } public URIBuilder(String address) { // separate meta from address, if necessary int dots = address.indexOf(DOTS); int dotsSlashes = address.indexOf(DOTS_SLASHES); if (dots > -1 && dots < dotsSlashes) { this.meta = address.substring(0, dots); address = address.substring(dots+1); } this.address = address; } public void setUser(String user) { assertNotUsed(); this.user = user; } public void setPassword(String password) { assertNotUsed(); this.password = password; } public void setHost(String host) { assertNotUsed(); this.host = host; } public void setAddress(String address) { assertNotUsed(); this.address = address; assertAddressConsistent(); } public void setPort(int port) { assertNotUsed(); this.port = new Integer(port); } public void setProtocol(String protocol) { assertNotUsed(); this.protocol = protocol; assertAddressConsistent(); } public void setMeta(String meta) { assertNotUsed(); this.meta = meta; } public void setPath(String path) { assertNotUsed(); if (null != path && path.indexOf(DOTS_SLASHES) > -1) { throw new IllegalArgumentException("Unusual syntax in path: '" + path + "' contains " + DOTS_SLASHES); } this.path = path; } public void setQueryMap(Map queryMap) { assertNotUsed(); this.queryMap = queryMap; } public EndpointURI getEndpoint() { if (null == cache.get()) { try { EndpointURI endpointUri = new MuleEndpointURI(getConstructor()); cache.compareAndSet(null, endpointUri); } catch (EndpointException e) { throw (IllegalStateException)new IllegalStateException("Bad endpoint configuration").initCause(e); } } return (EndpointURI)cache.get(); } /** * @return The String supplied to the delegate constructor */ protected String getConstructor() { StringBuffer buffer = new StringBuffer(); appendMeta(buffer); OrderedQueryParameters uriQueries = appendAddress(buffer); uriQueries.override(queryMap); buffer.append(uriQueries.toString()); return buffer.toString(); } private void appendMeta(StringBuffer buffer) { if (null != meta) { buffer.append(meta); buffer.append(DOTS); } } private OrderedQueryParameters appendAddress(StringBuffer buffer) { if (null != address) { int index = address.indexOf(QUERY); if (index > -1) { buffer.append(address.substring(0, index)); return parseQueries(address.substring(index + 1)); } else { buffer.append(address); return new OrderedQueryParameters(); } } else { constructAddress(buffer); return new OrderedQueryParameters(); } } private OrderedQueryParameters parseQueries(String queries) { OrderedQueryParameters map = new OrderedQueryParameters(); StringTokenizer query = new StringTokenizer(queries, AND); while (query.hasMoreTokens()) { StringTokenizer nameValue = new StringTokenizer(query.nextToken(), EQUALS); String name = nameValue.nextToken(); String value = null; if (nameValue.hasMoreTokens()) { value = nameValue.nextToken(); } map.put(name, value); } return map; } private void constructAddress(StringBuffer buffer) { buffer.append(protocol); buffer.append(DOTS_SLASHES); boolean atStart = true; if (null != user) { buffer.append(user); if (null != password) { buffer.append(":"); buffer.append(password); } buffer.append("@"); atStart = false; } if (null != host) { buffer.append(host); if (null != port) { buffer.append(":"); buffer.append(port); } atStart = false; } if (null != path) { if (! atStart) { buffer.append("/"); } buffer.append(path); } } protected void assertNotUsed() { if (null != cache.get()) { throw new IllegalStateException("Too late to set values - builder already used"); } } protected void assertAddressConsistent() { if (null != meta) { if (null != address) { if (address.startsWith(meta + DOTS)) { throw new IllegalArgumentException("Meta-protocol '" + meta + "' should not be specified in the address '" + address + "' - it is implicit in the element namespace."); } if (null != protocol) { assertProtocolConsistent(); } else { if (address.indexOf(DOTS_SLASHES) == -1) { throw new IllegalArgumentException("Address '" + address + "' does not have a transport protocol prefix " + "(omit the meta protocol prefix, '" + meta + DOTS + "' - it is implicit in the element namespace)."); } } } } else { assertProtocolConsistent(); } } protected void assertProtocolConsistent() { if (null != protocol && null != address && !address.startsWith(protocol + DOTS_SLASHES)) { throw new IllegalArgumentException("Address '" + address + "' for protocol '" + protocol + "' should start with " + protocol + DOTS_SLASHES); } } public String toString() { return getConstructor(); } public boolean equals(Object other) { if (null == other || !getClass().equals(other.getClass())) return false; if (this == other) return true; URIBuilder builder = (URIBuilder) other; return equal(address, builder.address) && equal(meta, builder.meta) && equal(protocol, builder.protocol) && equal(user, builder.user) && equal(password, builder.password) && equal(host, builder.host) && equal(port, builder.port) && equal(path, builder.path) && equal(queryMap, builder.queryMap); } protected static boolean equal(Object a, Object b) { return ClassUtils.equal(a, b); } public int hashCode() { return ClassUtils.hash(new Object[]{address, meta, protocol, user, password, host, port, path, queryMap}); } private static class OrderedQueryParameters { private Map values = new HashMap(); private List orderedKeys = new LinkedList(); public void put(String name, String value) { values.put(name, value); orderedKeys.add(name); } public void override(Map map) { if (null != map) { // order additional parameters Iterator names = new TreeMap(map).keySet().iterator(); while (names.hasNext()) { String name = (String) names.next(); String value =(String) map.get(name); if (! values.keySet().contains(name)) { orderedKeys.add(name); } values.put(name, value); } } } public String toString() { StringBuffer buffer = new StringBuffer(); Iterator keys = orderedKeys.iterator(); boolean first = true; while (keys.hasNext()) { if (first) { buffer.append(QUERY); first = false; } else { buffer.append(AND); } String key = (String)keys.next(); buffer.append(key); String value = (String)values.get(key); if (null != value) { buffer.append(EQUALS); buffer.append(value); } } return buffer.toString(); } } }mule-2.0.1/core/src/main/java/org/mule/endpoint/DefaultOutboundEndpoint.java0000644000175000017500000000674010765313375026726 0ustar charlescharles/* * $Id: DefaultOutboundEndpoint.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.filter.Filter; import org.mule.api.security.EndpointSecurityFilter; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import org.mule.api.transport.DispatchException; import org.mule.config.MuleManifest; import java.util.List; import java.util.Map; public class DefaultOutboundEndpoint extends AbstractEndpoint implements OutboundEndpoint { private static final long serialVersionUID = 8860985949279708638L; public DefaultOutboundEndpoint(Connector connector, EndpointURI endpointUri, List transformers, List responseTransformers, String name, Map properties, TransactionConfig transactionConfig, Filter filter, boolean deleteUnacceptedMessage, EndpointSecurityFilter securityFilter, boolean synchronous, boolean remoteSync, int remoteSyncTimeout, String initialState, String endpointEncoding, MuleContext muleContext, ConnectionStrategy connectionStrategy) { super(connector, endpointUri, transformers, responseTransformers, name, properties, transactionConfig, filter, deleteUnacceptedMessage, securityFilter, synchronous, remoteSync, remoteSyncTimeout, initialState, endpointEncoding, muleContext, connectionStrategy); } public void dispatch(MuleEvent event) throws DispatchException { if (getConnector() != null) { getConnector().dispatch(this, event); } else { // TODO Either remove because this should never happen or i18n the // message throw new IllegalStateException("The connector on the endpoint: " + toString() + " is null. Please contact " + MuleManifest.getDevListEmail()); } } public MuleMessage send(MuleEvent event) throws DispatchException { if (getConnector() != null) { return getConnector().send(this, event); } else { // TODO Either remove because this should never happen or i18n the // message throw new IllegalStateException("The connector on the endpoint: " + toString() + " is null. Please contact " + MuleManifest.getDevListEmail()); } } } mule-2.0.1/core/src/main/java/org/mule/endpoint/UserInfoEndpointURIBuilder.java0000644000175000017500000000516010745677442027244 0ustar charlescharles/* * $Id: UserInfoEndpointURIBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.endpoint.MalformedEndpointException; import java.net.URI; import java.util.Properties; /** * UserInfoEndpointBuilder builds an endpoint with the userinfo and * host details. This endpoint builder is used where endpoints as of the form : * xxx://ross:secret@host:1000 */ public class UserInfoEndpointURIBuilder extends AbstractEndpointURIBuilder { //TODO THis endpoint builder is redundant I think. We should be able to use the URL endpoint builder. //It depends on where deriving classes can work with the URL endpoint builder, but there are a lot of similarities protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException { // Added by Lajos 2006-12-14 per Ross if (uri.getHost() == null) { if (props.getProperty("address") == null) { throw new MalformedEndpointException(uri.toString()); } else { return; } } // Check and handle '@' symbols in the user info address = uri.getHost(); int a = address.indexOf("."); int b = (a == -1 ? -1 : address.indexOf(".", a + 1)); if (b > -1) { address = address.substring(a + 1); } if (uri.getPort() != -1) { // set the endpointUri to be a proper url if host and port are set this.address += ":" + uri.getPort(); } if (userInfo != null) { int x = userInfo.indexOf(":"); if (x > -1) { String user = userInfo.substring(0, x); if (user.indexOf("@") > -1) { address = user; } else { address = user + "@" + address; } } else { if (userInfo.indexOf("@") > -1) { address = userInfo; } else { address = userInfo + "@" + address; } } } } } mule-2.0.1/core/src/main/java/org/mule/endpoint/UrlEndpointURIBuilder.java0000644000175000017500000000266010745677442026256 0ustar charlescharles/* * $Id: UrlEndpointURIBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.util.StringUtils; import java.net.URI; import java.util.Properties; /** * UrlEndpointBuilder is the default endpointUri strategy suitable for * most connectors */ public class UrlEndpointURIBuilder extends AbstractEndpointURIBuilder { protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException { address = ""; if (uri.getHost() != null) { // set the endpointUri to be a proper url if host and port are set this.address = uri.getScheme() + "://" + uri.getHost(); if (uri.getPort() != -1) { address += ":" + uri.getPort(); } } if (StringUtils.isNotBlank(uri.getPath())) { address += uri.getPath(); } if (StringUtils.isNotBlank(uri.getQuery())) { address += "?" + uri.getQuery(); } } } mule-2.0.1/core/src/main/java/org/mule/endpoint/AbstractEndpointBuilder.java0000644000175000017500000006206710766460477026707 0ustar charlescharles/* * $Id: AbstractEndpointBuilder.java 11362 2008-03-14 11:27:59Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.RegistryContext; import org.mule.api.DefaultMuleException; import org.mule.api.MuleContext; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.registry.ServiceDescriptorFactory; import org.mule.api.registry.ServiceException; import org.mule.api.routing.filter.Filter; import org.mule.api.security.EndpointSecurityFilter; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transformer.Transformer; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; import org.mule.transaction.MuleTransactionConfig; import org.mule.transformer.TransformerUtils; import org.mule.transport.AbstractConnector; import org.mule.transport.service.TransportFactory; import org.mule.transport.service.TransportFactoryException; import org.mule.transport.service.TransportServiceDescriptor; import org.mule.util.CharSetUtils; import org.mule.util.ClassUtils; import org.mule.util.MapCombiner; import org.mule.util.ObjectNameHelper; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Properties; /** * Abstract endpoint builder used for externalizing the complex creation logic of * endpoints out of the endpoint instance itself.
    The use of a builder allows * i) Endpoints to be configured once and created in a repeatable fashion (global * endpoints), ii) Allow for much more extensibility in endpoint creation for * transport specific endpoints, streaming endpoints etc.
    */ public abstract class AbstractEndpointBuilder implements EndpointBuilder { public static final String PROPERTY_REMOTE_SYNC = "remoteSync"; public static final String PROPERTY_REMOTE_SYNC_TIMEOUT = "remoteSyncTimeout"; protected URIBuilder uriBuilder; protected Connector connector; protected List transformers; protected List responseTransformers; protected String name; protected Map properties = new HashMap(); protected TransactionConfig transactionConfig; protected Filter filter; protected Boolean deleteUnacceptedMessages; protected EndpointSecurityFilter securityFilter; protected Boolean synchronous; protected Boolean remoteSync; protected Integer remoteSyncTimeout; protected String initialState = ImmutableEndpoint.INITIAL_STATE_STARTED; protected String encoding; protected Integer createConnector; protected ConnectionStrategy connectionStrategy; // not included in equality/hash protected String registryId = null; protected MuleContext muleContext; public InboundEndpoint buildInboundEndpoint() throws EndpointException, InitialisationException { return doBuildInboundEndpoint(); } public OutboundEndpoint buildOutboundEndpoint() throws EndpointException, InitialisationException { return doBuildOutboundEndpoint(); } protected void setPropertiesFromProperties(Map properties) { synchronous = getBooleanProperty(properties, MuleProperties.SYNCHRONOUS_PROPERTY, synchronous); remoteSync = getBooleanProperty(properties, PROPERTY_REMOTE_SYNC, remoteSync); remoteSyncTimeout = getIntegerProperty(properties, PROPERTY_REMOTE_SYNC_TIMEOUT, remoteSyncTimeout); } public static Boolean getBooleanProperty(Map properties, String name, Boolean dflt) { if (properties.containsKey(name)) { return Boolean.valueOf((String) properties.get(name)); } else { return dflt; } } public static Integer getIntegerProperty(Map properties, String name, Integer dflt) { if (properties.containsKey(name)) { return Integer.decode((String) properties.get(name)); } else { return dflt; } } protected InboundEndpoint doBuildInboundEndpoint() throws InitialisationException, EndpointException { // use an explicit value here to avoid caching Map properties = getProperties(); // this sets values used below, if they appear as properties setPropertiesFromProperties(properties); if (uriBuilder == null) { throw new NullPointerException(CoreMessages.objectIsNull("uriBuilder").getMessage()); } EndpointURI endpointURI = uriBuilder.getEndpoint(); endpointURI.initialise(); Connector connector = getConnector(); if (connector != null && endpointURI != null && !connector.supportsProtocol(endpointURI.getFullScheme())) { throw new IllegalArgumentException(CoreMessages.connectorSchemeIncompatibleWithEndpointScheme( connector.getProtocol(), endpointURI).getMessage()); } List transformers = getInboundTransformers(connector, endpointURI); List responseTransformers = getInboundEndpointResponseTransformers(connector, endpointURI); boolean remoteSync = getRemoteSync(connector); boolean synchronous; if (remoteSync) { synchronous = true; } else { synchronous = getSynchronous(connector, endpointURI); } return new DefaultInboundEndpoint(connector, endpointURI, transformers, responseTransformers, getName(endpointURI), getProperties(), getTransactionConfig(), getFilter(connector), getDefaultDeleteUnacceptedMessages(connector), getSecurityFilter(), synchronous, remoteSync, getRemoteSyncTimeout(connector), getInitialState(connector), getEndpointEncoding(connector), muleContext, getConnectionStrategy(connector)); } protected OutboundEndpoint doBuildOutboundEndpoint() throws InitialisationException, EndpointException { // use an explicit value here to avoid caching Map properties = getProperties(); // this sets values used below, if they appear as properties setPropertiesFromProperties(properties); if (uriBuilder == null) { throw new NullPointerException(CoreMessages.objectIsNull("uriBuilder").getMessage()); } EndpointURI endpointURI = uriBuilder.getEndpoint(); endpointURI.initialise(); Connector connector = getConnector(); if (connector != null && endpointURI != null && !connector.supportsProtocol(endpointURI.getFullScheme())) { throw new IllegalArgumentException(CoreMessages.connectorSchemeIncompatibleWithEndpointScheme( connector.getProtocol(), endpointURI).getMessage()); } List transformers = getOutboundTransformers(connector, endpointURI); List responseTransformers = getOutboundEndpointResponseTransformers(connector, endpointURI); boolean remoteSync = getRemoteSync(connector); boolean synchronous; if (remoteSync) { synchronous = true; } else { synchronous = getSynchronous(connector, endpointURI); } return new DefaultOutboundEndpoint(connector, endpointURI, transformers, responseTransformers, getName(endpointURI), getProperties(), getTransactionConfig(), getFilter(connector), getDefaultDeleteUnacceptedMessages(connector), getSecurityFilter(), synchronous, remoteSync, getRemoteSyncTimeout(connector), getInitialState(connector), getEndpointEncoding(connector), muleContext, getConnectionStrategy(connector)); } protected boolean getSynchronous(Connector connector, EndpointURI endpointURI) { return synchronous != null ? synchronous.booleanValue() : getDefaultSynchronous(connector, endpointURI.getScheme()); } protected boolean getDefaultSynchronous(Connector connector, String protocol) { if (connector != null && connector.isSyncEnabled(protocol)) { return true; } else { return muleContext.getConfiguration().isDefaultSynchronousEndpoints(); } } protected ConnectionStrategy getConnectionStrategy(Connector connector) { return connectionStrategy != null ? connectionStrategy : getDefaultConnectionStrategy(connector); } protected ConnectionStrategy getDefaultConnectionStrategy(Connector connector) { return muleContext.getDefaultConnectionStrategy(); } protected TransactionConfig getTransactionConfig() { return transactionConfig != null ? transactionConfig : getDefaultTransactionConfig(); } protected TransactionConfig getDefaultTransactionConfig() { // TODO Do we need a new instance per endpoint, or can a single instance be // shared? return new MuleTransactionConfig(); } protected EndpointSecurityFilter getSecurityFilter() { return securityFilter != null ? securityFilter : getDefaultSecurityFilter(); } protected EndpointSecurityFilter getDefaultSecurityFilter() { return null; } protected Connector getConnector() throws EndpointException { return connector != null ? connector : getDefaultConnector(); } protected Connector getDefaultConnector() throws EndpointException { return getConnector(uriBuilder.getEndpoint(), muleContext); } protected String getName(EndpointURI endpointURI) { return name != null ? name : ObjectNameHelper.getEndpointName(endpointURI); } protected Map getProperties() { // Add properties from builder, endpointURI and then seal (make unmodifiable) LinkedList maps = new LinkedList(); // properties from url come first if (null != uriBuilder) { // properties from the URI itself maps.addLast(uriBuilder.getEndpoint().getParams()); } // properties on builder may override url if (properties != null) { maps.addLast(properties); } MapCombiner combiner = new MapCombiner(); combiner.setList(maps); return Collections.unmodifiableMap(combiner); } protected boolean getRemoteSync(Connector connector) { return remoteSync != null ? remoteSync.booleanValue() : getDefaultRemoteSync(connector); } protected boolean getDefaultRemoteSync(Connector connector) { return muleContext.getConfiguration().isDefaultRemoteSync(); } protected boolean getDeleteUnacceptedMessages(Connector connector) { return deleteUnacceptedMessages != null ? deleteUnacceptedMessages.booleanValue() : getDefaultDeleteUnacceptedMessages(connector); } protected boolean getDefaultDeleteUnacceptedMessages(Connector connector) { return false; } protected String getEndpointEncoding(Connector connector) { return encoding != null ? encoding : getDefaultEndpointEncoding(connector); } protected String getDefaultEndpointEncoding(Connector connector) { if (muleContext != null) { return muleContext.getConfiguration().getDefaultEncoding(); } else { return CharSetUtils.defaultCharsetName(); } } protected Filter getFilter(Connector connector) { return filter != null ? filter : getDefaultFilter(connector); } protected Filter getDefaultFilter(Connector connector) { return null; } protected String getInitialState(Connector connector) { return initialState != null ? initialState : getDefaultInitialState(connector); } protected String getDefaultInitialState(Connector connector) { return ImmutableEndpoint.INITIAL_STATE_STARTED; } protected int getRemoteSyncTimeout(Connector connector) { return remoteSyncTimeout != null ? remoteSyncTimeout.intValue() : getDefaultRemoteSyncTimeout(connector); } protected int getDefaultRemoteSyncTimeout(Connector connector) { return muleContext.getConfiguration().getDefaultSynchronousEventTimeout(); } protected List getInboundTransformers(Connector connector, EndpointURI endpointURI) throws TransportFactoryException { // #1 Transformers set on builder if (transformers != null) { return transformers; } // #2 Transformer specified on uri List transformers = getTransformersFromString(endpointURI.getTransformers()); if (transformers != null) { return transformers; } // #3 Default Transformer return getDefaultInboundTransformers(connector); } protected List getDefaultInboundTransformers(Connector connector) throws TransportFactoryException { try { return TransformerUtils.getDefaultInboundTransformers(getNonNullServiceDescriptor(uriBuilder.getEndpoint() .getSchemeMetaInfo(), getOverrides(connector))); } catch (Exception e) { throw new TransportFactoryException(e); } } protected List getOutboundTransformers(Connector connector, EndpointURI endpointURI) throws TransportFactoryException { // #1 Transformers set on builder if (transformers != null) { return transformers; } // #2 Transformer specified on uri List transformers = getTransformersFromString(endpointURI.getTransformers()); if (transformers != null) { return transformers; } // #3 Default Transformer return getDefaultOutboundTransformers(connector); } protected List getDefaultOutboundTransformers(Connector connector) throws TransportFactoryException { try { return TransformerUtils.getDefaultOutboundTransformers(getNonNullServiceDescriptor(uriBuilder.getEndpoint() .getSchemeMetaInfo(), getOverrides(connector))); } catch (Exception e) { throw new TransportFactoryException(e); } } protected List getInboundEndpointResponseTransformers(Connector connector, EndpointURI endpointURI) throws TransportFactoryException { // #1 Transformers set on builder if (responseTransformers != null) { return responseTransformers; } // #2 Transformer specified on uri List transformers = getTransformersFromString(endpointURI.getResponseTransformers()); if (transformers != null) { return transformers; } // #3 Default Connector Response Transformer return getDefaultResponseTransformers(connector); } protected List getOutboundEndpointResponseTransformers(Connector connector, EndpointURI endpointURI) throws TransportFactoryException { // #1 Transformers set on builder if (responseTransformers != null) { return responseTransformers; } // #2 Transformer specified on uri List transformers = getTransformersFromString(endpointURI.getResponseTransformers()); if (transformers != null) { return transformers; } return Collections.EMPTY_LIST; } protected List getDefaultResponseTransformers(Connector connector) throws TransportFactoryException { try { return TransformerUtils.getDefaultResponseTransformers(getNonNullServiceDescriptor(uriBuilder.getEndpoint() .getSchemeMetaInfo(), getOverrides(connector))); } catch (Exception e) { throw new TransportFactoryException(e); } } private List getTransformersFromString(String transformers) throws TransportFactoryException { try { return TransformerUtils.getTransformers(transformers); } catch (DefaultMuleException e) { throw new TransportFactoryException(e); } } private Properties getOverrides(Connector connector) { // Get connector specific overrides to set on the descriptor Properties overrides = new Properties(); if (connector instanceof AbstractConnector) { Map so = ((AbstractConnector) connector).getServiceOverrides(); if (so != null) { overrides.putAll(so); } } return overrides; } private TransportServiceDescriptor getNonNullServiceDescriptor(String scheme, Properties overrides) throws ServiceException { TransportServiceDescriptor sd = (TransportServiceDescriptor) RegistryContext.getRegistry() .lookupServiceDescriptor(ServiceDescriptorFactory.PROVIDER_SERVICE_TYPE, scheme, overrides); if (null != sd) { return sd; } else { throw new ServiceException(CoreMessages.noServiceTransportDescriptor(scheme)); } } private Connector getConnector(EndpointURI endpointURI, MuleContext muleContext) throws EndpointException { String scheme = uriBuilder.getEndpoint().getFullScheme(); Connector connector; try { if (uriBuilder.getEndpoint().getConnectorName() != null) { connector = muleContext.getRegistry().lookupConnector(uriBuilder.getEndpoint().getConnectorName()); if (connector == null) { throw new TransportFactoryException(CoreMessages.objectNotRegistered("Connector", uriBuilder.getEndpoint().getConnectorName())); } } else { connector = TransportFactory.getConnectorByProtocol(scheme); if (connector == null) { connector = TransportFactory.createConnector(endpointURI, muleContext); muleContext.getRegistry().registerConnector(connector); } } } catch (Exception e) { throw new TransportFactoryException(e); } if (connector == null) { Message m = CoreMessages.failedToCreateObjectWith("Endpoint", "endpointURI: " + endpointURI); m.setNextMessage(CoreMessages.objectIsNull("connector")); throw new TransportFactoryException(m); } return connector; } // Builder setters public void setConnector(Connector connector) { this.connector = connector; } public void addTransformer(Transformer transformer) { if (transformers == null) { transformers = new LinkedList(); } transformers.add(transformer); } public void setTransformers(List transformers) { this.transformers = transformers; } public void setResponseTransformers(List responseTransformers) { this.responseTransformers = responseTransformers; } public void setName(String name) { this.name = name; } /** * NOTE - this appends properties. */ public void setProperties(Map properties) { if (null == this.properties) { this.properties = new HashMap(); } this.properties.putAll(properties); } /** * Sets a property on the endpoint * * @param key the property key * @param value the value of the property */ public void setProperty(Object key, Object value) { properties.put(key, value); } public void setTransactionConfig(TransactionConfig transactionConfig) { this.transactionConfig = transactionConfig; } public void setFilter(Filter filter) { this.filter = filter; } public void setDeleteUnacceptedMessages(boolean deleteUnacceptedMessages) { this.deleteUnacceptedMessages = new Boolean(deleteUnacceptedMessages); } public void setSecurityFilter(EndpointSecurityFilter securityFilter) { this.securityFilter = securityFilter; } public void setSynchronous(boolean synchronous) { this.synchronous = new Boolean(synchronous); } public void setRemoteSync(boolean remoteSync) { this.remoteSync = new Boolean(remoteSync); } public void setRemoteSyncTimeout(int remoteSyncTimeout) { this.remoteSyncTimeout = new Integer(remoteSyncTimeout); } public void setInitialState(String initialState) { this.initialState = initialState; } public void setEncoding(String encoding) { this.encoding = encoding; } public void setCreateConnector(int createConnector) { this.createConnector = new Integer(createConnector); } public void setRegistryId(String registryId) { this.registryId = registryId; } public void setMuleContext(MuleContext muleContext) { this.muleContext = muleContext; } public void setConnectionStrategy(ConnectionStrategy connectionStrategy) { this.connectionStrategy = connectionStrategy; } public URIBuilder getEndpointBuilder() { return uriBuilder; } public void setURIBuilder(URIBuilder URIBuilder) { this.uriBuilder = URIBuilder; } // TODO Equals() and hashCode() only needed for tests, move to tests public int hashCode() { return ClassUtils.hash(new Object[]{connectionStrategy, connector, createConnector, deleteUnacceptedMessages, encoding, uriBuilder, filter, initialState, name, properties, remoteSync, remoteSyncTimeout, responseTransformers, securityFilter, synchronous, transactionConfig, transformers}); } // TODO Equals() and hashCode() only needed for tests, move to tests public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; final AbstractEndpointBuilder other = (AbstractEndpointBuilder) obj; return equal(connectionStrategy, other.connectionStrategy) && equal(connector, other.connector) && equal(createConnector, other.createConnector) && equal(deleteUnacceptedMessages, other.deleteUnacceptedMessages) && equal(encoding, other.encoding) && equal(uriBuilder, other.uriBuilder) && equal(filter, other.filter) && equal(initialState, other.initialState) && equal(name, other.name) && equal(properties, other.properties) && equal(remoteSync, other.remoteSync) && equal(remoteSyncTimeout, other.remoteSyncTimeout) && equal(responseTransformers, other.responseTransformers) && equal(securityFilter, other.securityFilter) && equal(synchronous, other.synchronous) && equal(transactionConfig, other.transactionConfig) && equal(transformers, other.transformers); } protected static boolean equal(Object a, Object b) { return ClassUtils.equal(a, b); } public Object clone() throws CloneNotSupportedException { EndpointBuilder builder = (EndpointBuilder) super.clone(); builder.setConnector(connector); builder.setURIBuilder(uriBuilder); builder.setTransformers(transformers); builder.setResponseTransformers(responseTransformers); builder.setName(name); builder.setProperties(properties); builder.setTransactionConfig(transactionConfig); builder.setFilter(filter); builder.setSecurityFilter(securityFilter); builder.setInitialState(initialState); builder.setEncoding(encoding); builder.setRegistryId(registryId); builder.setMuleContext(muleContext); builder.setConnectionStrategy(connectionStrategy); if (deleteUnacceptedMessages != null) { builder.setDeleteUnacceptedMessages(deleteUnacceptedMessages.booleanValue()); } if (synchronous != null) { builder.setSynchronous(synchronous.booleanValue()); } if (remoteSync != null) { builder.setRemoteSync(remoteSync.booleanValue()); } if (remoteSyncTimeout != null) { builder.setRemoteSyncTimeout(remoteSyncTimeout.intValue()); } return builder; } } mule-2.0.1/core/src/main/java/org/mule/endpoint/EndpointURIEndpointBuilder.java0000644000175000017500000000715710765313375027274 0ustar charlescharles/* * $Id: EndpointURIEndpointBuilder.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextAware; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; public class EndpointURIEndpointBuilder extends AbstractEndpointBuilder implements MuleContextAware { public EndpointURIEndpointBuilder() { // blank } /** * Called from Spring * * @param global The global endpoint "template" * @throws EndpointException */ public EndpointURIEndpointBuilder(EndpointURIEndpointBuilder global) throws EndpointException { // can't (concisely) use setters where null is a possibility // for consistency, set directly on all fields (this also avoids logic in // getters) uriBuilder = global.uriBuilder; connector = global.connector; transformers = global.transformers; responseTransformers = global.responseTransformers; name = global.name; // this seems a bit odd, but is tested for in the big // spring config test case properties = global.properties; transactionConfig = global.transactionConfig; filter = global.filter; deleteUnacceptedMessages = global.deleteUnacceptedMessages; securityFilter = global.securityFilter; synchronous = global.synchronous; remoteSync = global.remoteSync; remoteSyncTimeout = global.remoteSyncTimeout; encoding = global.encoding; connectionStrategy = global.connectionStrategy; } public EndpointURIEndpointBuilder(URIBuilder URIBuilder, MuleContext muleContext) { this.muleContext = muleContext; this.uriBuilder = URIBuilder; } /** * @deprecated */ public EndpointURIEndpointBuilder(String address, MuleContext muleContext) { this(new URIBuilder(address), muleContext); } /** * @deprecated */ public EndpointURIEndpointBuilder(EndpointURI endpointURI, MuleContext muleContext) { this(new URIBuilder(endpointURI), muleContext); } public EndpointURIEndpointBuilder(ImmutableEndpoint source, MuleContext muleContext) { this(source.getEndpointURI(), muleContext); setName(source.getName()); setEncoding(source.getEncoding()); setConnector(source.getConnector()); setTransformers(source.getTransformers().isEmpty() ? null : source.getTransformers()); setResponseTransformers(source.getResponseTransformers().isEmpty() ? null : source.getResponseTransformers()); setProperties(source.getProperties()); setTransactionConfig(source.getTransactionConfig()); setDeleteUnacceptedMessages(source.isDeleteUnacceptedMessages()); setInitialState(source.getInitialState()); setRemoteSyncTimeout(source.getRemoteSyncTimeout()); setRemoteSync(source.isRemoteSync()); setFilter(source.getFilter()); setSecurityFilter(source.getSecurityFilter()); setConnectionStrategy(source.getConnectionStrategy()); setSynchronous(source.isSynchronous()); setMuleContext(source.getMuleContext()); } } mule-2.0.1/core/src/main/java/org/mule/endpoint/ResourceNameEndpointURIBuilder.java0000644000175000017500000000372510745677442030107 0ustar charlescharles/* * $Id: ResourceNameEndpointURIBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.util.StringUtils; import java.net.URI; import java.util.Properties; /** * ResourceNameEndpointBuilder extracts a resource name from a uri * endpointUri * */ public class ResourceNameEndpointURIBuilder extends AbstractEndpointURIBuilder { public static final String RESOURCE_INFO_PROPERTY = "resourceInfo"; protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException { address = StringUtils.EMPTY; if (uri.getHost() != null && !"localhost".equals(uri.getHost())) { address = uri.getHost(); } if (uri.getPath() != null && uri.getPath().length() != 0) { if (address.length() > 0) { address += "/"; } address += uri.getPath().substring(1); } else if (uri.getAuthority() != null && !uri.getAuthority().equals(address)) { address += uri.getAuthority(); } // is user info specified? int y = address.indexOf("@"); if (y > -1) { this.userInfo = address.substring(0, y); } // increment to 0 or one char past the @ y++; int x = address.indexOf(":", y); if (x > -1) { String resourceInfo = address.substring(y, x); props.setProperty("resourceInfo", resourceInfo); address = address.substring(x + 1); } } } mule-2.0.1/core/src/main/java/org/mule/endpoint/SocketEndpointURIBuilder.java0000644000175000017500000000277010745677442026746 0ustar charlescharles/* * $Id: SocketEndpointURIBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.endpoint.MalformedEndpointException; import java.net.URI; import java.util.Properties; /** * SocketEndpointBuilder builds an endpointUri based on host and port * only */ public class SocketEndpointURIBuilder extends AbstractEndpointURIBuilder { protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException { // set the endpointUri to be a proper url if host and port are set if (uri.getPort() == -1) { // try the form tcp://6666 try { int port = Integer.parseInt(uri.getHost()); this.address = uri.getScheme() + "://localhost:" + port; } catch (NumberFormatException e) { // ignore } } if (address == null) { this.address = uri.getScheme() + "://" + uri.getHost(); if (uri.getPort() != -1) { this.address += ":" + uri.getPort(); } } } } mule-2.0.1/core/src/main/java/org/mule/endpoint/DefaultInboundEndpoint.java0000644000175000017500000000556110765313375026525 0ustar charlescharles/* * $Id: DefaultInboundEndpoint.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.MuleContext; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.routing.filter.Filter; import org.mule.api.security.EndpointSecurityFilter; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import org.mule.config.MuleManifest; import java.util.List; import java.util.Map; public class DefaultInboundEndpoint extends AbstractEndpoint implements InboundEndpoint { private static final long serialVersionUID = -4752772777414636142L; public DefaultInboundEndpoint(Connector connector, EndpointURI endpointUri, List transformers, List responseTransformers, String name, Map properties, TransactionConfig transactionConfig, Filter filter, boolean deleteUnacceptedMessage, EndpointSecurityFilter securityFilter, boolean synchronous, boolean remoteSync, int remoteSyncTimeout, String initialState, String endpointEncoding, MuleContext muleContext, ConnectionStrategy connectionStrategy) { super(connector, endpointUri, transformers, responseTransformers, name, properties, transactionConfig, filter, deleteUnacceptedMessage, securityFilter, synchronous, remoteSync, remoteSyncTimeout, initialState, endpointEncoding, muleContext, connectionStrategy); } public MuleMessage request(long timeout) throws Exception { if (getConnector() != null) { return getConnector().request(this, timeout); } else { // TODO Either remove because this should never happen or i18n the // message throw new IllegalStateException("The connector on the endpoint: " + toString() + " is null. Please contact " + MuleManifest.getDevListEmail()); } } } mule-2.0.1/core/src/main/java/org/mule/endpoint/DefaultEndpointFactory.java0000644000175000017500000001542710764322372026534 0ustar charlescharles/* * $Id: DefaultEndpointFactory.java 11278 2008-03-07 20:26:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointFactory; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.registry.RegistrationException; import org.mule.config.i18n.CoreMessages; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class DefaultEndpointFactory implements EndpointFactory { /** logger used by this class */ protected static final Log logger = LogFactory.getLog(DefaultEndpointFactory.class); public static final String ENDPOINT_REGISTRY_PREFIX = "endpoint:"; protected MuleContext muleContext; public InboundEndpoint getInboundEndpoint(String uri) throws MuleException { logger.debug("DefaultEndpointFactory request for inbound endpoint for uri: " + uri); EndpointBuilder endpointBuilder = lookupEndpointBuilder(uri); if (endpointBuilder == null) { logger.debug("Named EndpointBuilder not found, creating endpoint from uri"); endpointBuilder = new EndpointURIEndpointBuilder(uri, muleContext); } return getInboundEndpoint(endpointBuilder); } public OutboundEndpoint getOutboundEndpoint(String uri) throws MuleException { logger.debug("DefaultEndpointFactory request for outbound endpoint for uri: " + uri); EndpointBuilder endpointBuilder = lookupEndpointBuilder(uri); if (endpointBuilder == null) { logger.debug("Named EndpointBuilder not found, creating endpoint from uri"); endpointBuilder = new EndpointURIEndpointBuilder(uri, muleContext); } return getOutboundEndpoint(endpointBuilder); } protected EndpointBuilder lookupEndpointBuilder(String endpointName) { logger.debug("Looking up EndpointBuilder with name:" + endpointName + " in registry"); // TODO DF: Do some simple parsing of endpointName to not lookup endpoint builder if endpointName is // obviously a uri and not a substituted name ?? EndpointBuilder endpointBuilder = RegistryContext.getRegistry().lookupEndpointBuilder(endpointName); if (endpointBuilder != null) { logger.debug("EndpointBuilder with name:" + endpointName + " FOUND"); } return endpointBuilder; } public InboundEndpoint getInboundEndpoint(EndpointBuilder builder) throws MuleException { InboundEndpoint endpoint = builder.buildInboundEndpoint(); return (InboundEndpoint) registerEndpoint(endpoint); } public OutboundEndpoint getOutboundEndpoint(EndpointBuilder builder) throws MuleException { OutboundEndpoint endpoint = builder.buildOutboundEndpoint(); return (OutboundEndpoint) registerEndpoint(endpoint); } /** * * @param endpoint * @return * @throws RegistrationException */ protected ImmutableEndpoint registerEndpoint(ImmutableEndpoint endpoint) throws RegistrationException { ImmutableEndpoint registryEndpoint = (ImmutableEndpoint) muleContext.getRegistry().lookupObject( ENDPOINT_REGISTRY_PREFIX + endpoint.hashCode()); if (registryEndpoint == null) { muleContext.getRegistry().registerObject(ENDPOINT_REGISTRY_PREFIX + endpoint.hashCode(), endpoint); registryEndpoint = endpoint; } return registryEndpoint; } public EndpointBuilder getEndpointBuilder(String uri) throws MuleException { logger.debug("DefaultEndpointFactory request for endpoint builder for uri: " + uri); EndpointBuilder endpointBuilder = lookupEndpointBuilder(uri); if (endpointBuilder != null) { try { endpointBuilder = (EndpointBuilder) endpointBuilder.clone(); } catch (Exception e) { throw new EndpointException(CoreMessages.failedToClone("global endpoint EndpointBuilder"), e); } } else { logger.debug("Named EndpointBuilder not found, creating endpoint builder for uri"); endpointBuilder = new EndpointURIEndpointBuilder(uri, muleContext); } return endpointBuilder; } public void setMuleContext(MuleContext context) { this.muleContext = context; } public org.mule.api.endpoint.InboundEndpoint getInboundEndpoint(EndpointURI uri) throws MuleException { return (InboundEndpoint) getEndpoint(uri, new EndpointSource() { public ImmutableEndpoint getEndpoint(EndpointBuilder builder) throws MuleException { return getInboundEndpoint(builder); } }); } public OutboundEndpoint getOutboundEndpoint(EndpointURI uri) throws MuleException { return (OutboundEndpoint) getEndpoint(uri, new EndpointSource() { public ImmutableEndpoint getEndpoint(EndpointBuilder builder) throws MuleException { return getOutboundEndpoint(builder); } }); } protected ImmutableEndpoint getEndpoint(EndpointURI uri, EndpointSource source) throws MuleException { logger.debug("DefaultEndpointFactory request for endpoint for: " + uri); EndpointBuilder endpointBuilder = null; if (uri.getEndpointName() != null) { endpointBuilder = lookupEndpointBuilder(uri.getEndpointName()); if (endpointBuilder == null) { throw new IllegalArgumentException("The endpoint with name: " + uri.getEndpointName() + "was not found."); } } else { logger.debug("Named EndpointBuilder not found, creating endpoint from uri"); endpointBuilder = new EndpointURIEndpointBuilder(uri, muleContext); } return source.getEndpoint(endpointBuilder); } private interface EndpointSource { ImmutableEndpoint getEndpoint(EndpointBuilder endpointBuilder) throws MuleException; } } mule-2.0.1/core/src/main/java/org/mule/endpoint/DynamicURIOutboundEndpoint.java0000644000175000017500000001156510765313375027307 0ustar charlescharles/* * $Id: DynamicURIOutboundEndpoint.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.filter.Filter; import org.mule.api.security.EndpointSecurityFilter; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import org.mule.api.transport.DispatchException; import java.util.List; import java.util.Map; /** * Allow's EndpointURI to be set and changed dynamically by wrapping up an immutable * endpoint instance. */ public class DynamicURIOutboundEndpoint implements OutboundEndpoint { private static final long serialVersionUID = -2814979100270307813L; private OutboundEndpoint endpoint; private EndpointURI dynamicEndpointURI; public DynamicURIOutboundEndpoint(OutboundEndpoint endpoint) { this.endpoint = endpoint; } public DynamicURIOutboundEndpoint(OutboundEndpoint endpoint, EndpointURI dynamicEndpointURI) { this.endpoint = endpoint; setEndpointURI(dynamicEndpointURI); } public EndpointURI getEndpointURI() { if (dynamicEndpointURI != null) { return dynamicEndpointURI; } else { return endpoint.getEndpointURI(); } } public void setEndpointURI(EndpointURI dynamicEndpointURI) { this.dynamicEndpointURI = dynamicEndpointURI; } public void dispatch(MuleEvent event) throws DispatchException { endpoint.dispatch(event); } public ConnectionStrategy getConnectionStrategy() { return endpoint.getConnectionStrategy(); } public Connector getConnector() { return endpoint.getConnector(); } public String getEncoding() { return endpoint.getEncoding(); } public Filter getFilter() { return endpoint.getFilter(); } public String getInitialState() { return endpoint.getInitialState(); } public MuleContext getMuleContext() { return endpoint.getMuleContext(); } public String getName() { return endpoint.getName(); } public Map getProperties() { return endpoint.getProperties(); } public Object getProperty(Object key) { return endpoint.getProperty(key); } public String getProtocol() { return endpoint.getProtocol(); } public int getRemoteSyncTimeout() { return endpoint.getRemoteSyncTimeout(); } public List getResponseTransformers() { return endpoint.getResponseTransformers(); } public EndpointSecurityFilter getSecurityFilter() { return endpoint.getSecurityFilter(); } public TransactionConfig getTransactionConfig() { return endpoint.getTransactionConfig(); } public List getTransformers() { return endpoint.getTransformers(); } public boolean isDeleteUnacceptedMessages() { return endpoint.isDeleteUnacceptedMessages(); } public boolean isReadOnly() { return endpoint.isReadOnly(); } public boolean isRemoteSync() { return endpoint.isRemoteSync(); } public boolean isSynchronous() { return endpoint.isSynchronous(); } public MuleMessage send(MuleEvent event) throws DispatchException { return endpoint.send(event); } public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dynamicEndpointURI == null) ? 0 : dynamicEndpointURI.hashCode()); result = prime * result + ((endpoint == null) ? 0 : endpoint.hashCode()); return result; } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final DynamicURIOutboundEndpoint other = (DynamicURIOutboundEndpoint) obj; if (dynamicEndpointURI == null) { if (other.dynamicEndpointURI != null) return false; } else if (!dynamicEndpointURI.equals(other.dynamicEndpointURI)) return false; if (endpoint == null) { if (other.endpoint != null) return false; } else if (!endpoint.equals(other.endpoint)) return false; return true; } } mule-2.0.1/core/src/main/java/org/mule/DefaultMuleEvent.java0000644000175000017500000004731510761043432023503 0ustar charlescharles/* * $Id: DefaultMuleEvent.java 11035 2008-02-26 17:06:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.DefaultMuleException; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.ThreadSafeAccess; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.security.Credentials; import org.mule.api.service.Service; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.PropertyScope; import org.mule.config.i18n.CoreMessages; import org.mule.endpoint.DefaultEndpointFactory; import org.mule.security.MuleCredentials; import org.mule.util.MapUtils; import org.mule.util.UUID; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.EventObject; import java.util.Iterator; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * DefaultMuleEvent represents any data event occuring in the Mule * environment. All data sent or received within the Mule environment will be passed * between components as an MuleEvent.

    The MuleEvent holds some data and provides * helper methods for obtaining the data in a format that the receiving Mule UMO * understands. The event can also maintain any number of properties that can be set * and retrieved by Mule UMO components. */ public class DefaultMuleEvent extends EventObject implements MuleEvent, ThreadSafeAccess { /** * Serial version */ private static final long serialVersionUID = 1L; /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); /** * The endpoint associated with the event */ private transient ImmutableEndpoint endpoint = null; /** * the Universally Unique ID for the event */ private String id = null; /** * The payload message used to read the payload of the event */ private MuleMessage message = null; private transient MuleSession session; private boolean stopFurtherProcessing = false; private boolean synchronous = false; private int timeout = TIMEOUT_NOT_SET_VALUE; private transient ResponseOutputStream outputStream = null; private transient Object transformedMessage = null; private Credentials credentials = null; protected String[] ignoredPropertyOverrides = new String[]{MuleProperties.MULE_METHOD_PROPERTY}; /** * Properties cache that only reads properties once from the inbound message and * merges them with any properties on the endpoint. The message properties take * precedence over the endpoint properties */ public DefaultMuleEvent(MuleMessage message, ImmutableEndpoint endpoint, Service service, MuleEvent previousEvent) { super(message.getPayload()); this.message = message; this.id = generateEventId(); this.session = previousEvent.getSession(); ((DefaultMuleSession) session).setService(service); this.endpoint = endpoint; this.synchronous = previousEvent.isSynchronous(); this.timeout = previousEvent.getTimeout(); this.outputStream = (ResponseOutputStream) previousEvent.getOutputStream(); fillProperties(previousEvent); } public DefaultMuleEvent(MuleMessage message, ImmutableEndpoint endpoint, MuleSession session, boolean synchronous) { this(message, endpoint, session, synchronous, null); } /** * Contructor. * * @param message the event payload * @param endpoint the endpoint to associate with the event * @param session the previous event if any * @see org.mule.api.transport.MessageAdapter */ public DefaultMuleEvent(MuleMessage message, ImmutableEndpoint endpoint, MuleSession session, boolean synchronous, ResponseOutputStream outputStream) { super(message.getPayload()); this.message = message; this.endpoint = endpoint; this.session = session; this.id = generateEventId(); this.synchronous = synchronous; this.outputStream = outputStream; fillProperties(null); } /** * Contructor. * * @param message the event payload * @param endpoint the endpoint to associate with the event * @param session the previous event if any * @see org.mule.api.transport.MessageAdapter */ public DefaultMuleEvent(MuleMessage message, ImmutableEndpoint endpoint, MuleSession session, String eventId, boolean synchronous) { super(message.getPayload()); this.message = message; this.endpoint = endpoint; this.session = session; this.id = eventId; this.synchronous = synchronous; fillProperties(null); } /** * A helper constructor used to rewrite an event payload * * @param message * @param rewriteEvent */ public DefaultMuleEvent(MuleMessage message, MuleEvent rewriteEvent) { super(message.getPayload()); this.message = message; this.id = rewriteEvent.getId(); this.session = rewriteEvent.getSession(); ((DefaultMuleSession) session).setService(rewriteEvent.getService()); this.endpoint = rewriteEvent.getEndpoint(); this.synchronous = rewriteEvent.isSynchronous(); this.timeout = rewriteEvent.getTimeout(); this.outputStream = (ResponseOutputStream) rewriteEvent.getOutputStream(); if (rewriteEvent instanceof DefaultMuleEvent) { this.transformedMessage = ((DefaultMuleEvent) rewriteEvent).getCachedMessage(); } fillProperties(rewriteEvent); } protected void fillProperties(MuleEvent previousEvent) { if (previousEvent != null) { MuleMessage msg = previousEvent.getMessage(); synchronized (msg) { for (Iterator iterator = msg.getPropertyNames().iterator(); iterator.hasNext();) { String prop = (String) iterator.next(); Object value = msg.getProperty(prop); // don't overwrite property on the message if (!ignoreProperty(prop)) { message.setProperty(prop, value); } } } } if (endpoint != null && endpoint.getProperties() != null) { for (Iterator iterator = endpoint.getProperties().keySet().iterator(); iterator.hasNext();) { String prop = (String) iterator.next(); Object value = endpoint.getProperties().get(prop); // don't overwrite property on the message if (!ignoreProperty(prop)) { message.setProperty(prop, value, PropertyScope.INVOCATION); } } } setCredentials(); } /** * This method is used to determine if a property on the previous event should be * ignorred for the next event. This method is here because we don't have proper * scoped handlng of meta data yet The rules are *

      *
    1. If a property is already set on the currect event don't overwrite with the previous event value *
    2. If the propery name appears in the ignorredPropertyOverrides list, then we always set it on the new event *
    * * @param key * @return */ protected boolean ignoreProperty(String key) { if (key == null) { return true; } for (int i = 0; i < ignoredPropertyOverrides.length; i++) { if (key.equals(ignoredPropertyOverrides[i])) { return false; } } return null != message.getProperty(key); } protected void setCredentials() { if (null != endpoint && null != endpoint.getEndpointURI() && null != endpoint.getEndpointURI().getUserInfo()) { final String userName = endpoint.getEndpointURI().getUser(); final String password = endpoint.getEndpointURI().getPassword(); if (password != null && userName != null) { credentials = new MuleCredentials(userName, password.toCharArray()); } } } public Credentials getCredentials() { return credentials; } Object getCachedMessage() { return transformedMessage; } public MuleMessage getMessage() { return message; } public byte[] getMessageAsBytes() throws DefaultMuleException { try { return message.getPayloadAsBytes(); } catch (Exception e) { throw new DefaultMuleException( CoreMessages.cannotReadPayloadAsBytes(message.getPayload().getClass().getName()), e); } } public Object transformMessage() throws TransformerException { return transformMessage(null); } public Object transformMessage(Class outputType) throws TransformerException { message.applyTransformers(endpoint.getTransformers()); if(outputType==null) { return message.getPayload(); } else { return message.getPayload(outputType); } } /** * This method will attempt to convert the transformed message into an array of * bytes It will first check if the result of the transformation is a byte array * and return that. Otherwise if the the result is a string it will serialized * the CONTENTS of the string not the String object. finally it will check if the * result is a Serializable object and convert that to an array of bytes. * * @return a byte[] representation of the message * @throws TransformerException if an unsupported encoding is being used or if * the result message is not a String byte[] or Seializable object */ public byte[] transformMessageToBytes() throws TransformerException { Object obj = transformMessage(byte[].class); return (byte[])obj; } /** * Returns the message transformed into it's recognised or expected format and * then into a String. The transformer used is the one configured on the endpoint * through which this event was received. * * @return the message transformed into it's recognised or expected format as a * Strings. * @throws org.mule.api.transformer.TransformerException if a failure occurs in * the transformer * @see org.mule.api.transformer.Transformer */ public String transformMessageToString() throws TransformerException { try { return new String(transformMessageToBytes(), getEncoding()); } catch (UnsupportedEncodingException e) { throw new TransformerException(endpoint.getTransformers(), e); } /* TODO MULE-2691 Note that the above code actually transforms the message * to byte[] instead of String. The following code would transform the * message to a String but breaks some tests in transports/http: * transformMessageToBytes(); ByteArrayToObject t = new ByteArrayToObject(); t.setEncoding(getEncoding()); List list = new ArrayList(); list.add(t); message.applyTransformers(list); return (String) message.getPayload(); */ } public String getMessageAsString() throws MuleException { return getMessageAsString(getEncoding()); } /** * Returns the message contents as a string * * @param encoding the encoding to use when converting the message to string * @return the message contents as a string * @throws org.mule.api.MuleException if the message cannot be converted into a * string */ public String getMessageAsString(String encoding) throws MuleException { try { return message.getPayloadAsString(encoding); } catch (Exception e) { throw new DefaultMuleException( CoreMessages.cannotReadPayloadAsString(message.getClass().getName()), e); } } /* * (non-Javadoc) * * @see org.mule.api.MuleEvent#getId() */ public String getId() { return id; } /** * @see org.mule.api.MuleEvent#getProperty(java.lang.String, boolean) */ public Object getProperty(String name, boolean exhaustiveSearch) { return getProperty(name, /* defaultValue */null, exhaustiveSearch); } /* * (non-Javadoc) * * @see org.mule.api.MuleEvent#getProperty(java.lang.String, java.lang.Object, * boolean) */ public Object getProperty(String name, Object defaultValue, boolean exhaustiveSearch) { Object property = message.getProperty(name); if (exhaustiveSearch) { // Search the endpoint if (property == null) { property = MapUtils.getObject(getEndpoint().getEndpointURI().getParams(), name, null); } // Search the connector if (property == null) { try { property = PropertyUtils.getProperty(getEndpoint().getConnector(), name); } catch (Exception e) { // Ignore this exception, it just means that the connector has no // such property. } } } return (property == null ? defaultValue : property); } /* * (non-Javadoc) * * @see org.mule.api.MuleEvent#getEndpoint() */ public ImmutableEndpoint getEndpoint() { return endpoint; } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ public String toString() { StringBuffer buf = new StringBuffer(64); buf.append("MuleEvent: ").append(getId()); buf.append(", sync=").append(isSynchronous()); buf.append(", stop processing=").append(isStopFurtherProcessing()); buf.append(", ").append(endpoint); return buf.toString(); } protected String generateEventId() { return UUID.getUUID(); } public MuleSession getSession() { return session; } void setSession(MuleSession session) { this.session = session; } /** * Gets the recipient service of this event */ public Service getService() { return session.getService(); } /** * Determines whether the default processing for this event will be executed * * @return Returns the stopFurtherProcessing. */ public boolean isStopFurtherProcessing() { return stopFurtherProcessing; } /** * Setting this parameter will stop the Mule framework from processing this event * in the standard way. This allow for client code to override default behaviour. * The common reasons for doing this are - 1. The UMO has more than one send * endpoint configured; the service must dispatch to other prviders * programatically by using the service on the current event 2. The UMO doesn't * send the current event out through a endpoint. i.e. the processing of the * event stops in the uMO. * * @param stopFurtherProcessing The stopFurtherProcessing to set. */ public void setStopFurtherProcessing(boolean stopFurtherProcessing) { this.stopFurtherProcessing = stopFurtherProcessing; } public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof DefaultMuleEvent)) { return false; } final DefaultMuleEvent event = (DefaultMuleEvent)o; if (message != null ? !message.equals(event.message) : event.message != null) { return false; } return id.equals(event.id); } public int hashCode() { return 29 * id.hashCode() + (message != null ? message.hashCode() : 0); } public boolean isSynchronous() { return synchronous; } public void setSynchronous(boolean value) { synchronous = value; } public int getTimeout() { if (timeout == TIMEOUT_NOT_SET_VALUE) { // If this is not set it will use the default timeout value timeout = endpoint.getRemoteSyncTimeout(); } return timeout; } public void setTimeout(int timeout) { this.timeout = timeout; } /** * An outputstream can optionally be used to write response data to an incoming * message. * * @return an output strem if one has been made available by the message receiver * that received the message */ public OutputStream getOutputStream() { return outputStream; } private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(endpoint.hashCode()); } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { logger = LogFactory.getLog(getClass()); in.defaultReadObject(); int hashCode = in.readInt(); endpoint = (ImmutableEndpoint) RegistryContext.getRegistry().lookupObject( DefaultEndpointFactory.ENDPOINT_REGISTRY_PREFIX + hashCode); } /** * Gets the encoding for this message. First it looks to see if encoding has been * set on the endpoint, if not it will check the message itself and finally it * will fall back to the Mule global configuration for encoding which cannot be * null. * * @return the encoding for the event */ public String getEncoding() { String encoding = message.getEncoding(); if (encoding == null) { encoding = endpoint.getEncoding(); } return encoding; } public MuleContext getMuleContext() { return endpoint.getMuleContext(); } public ThreadSafeAccess newThreadCopy() { if (message instanceof ThreadSafeAccess) { DefaultMuleEvent copy = new DefaultMuleEvent((MuleMessage) ((ThreadSafeAccess) message).newThreadCopy(), this); copy.resetAccessControl(); return copy; } else { return this; } } public void resetAccessControl() { if (message instanceof ThreadSafeAccess) { ((ThreadSafeAccess) message).resetAccessControl(); } } public void assertAccess(boolean write) { if (message instanceof ThreadSafeAccess) { ((ThreadSafeAccess) message).assertAccess(write); } } } mule-2.0.1/core/src/main/java/org/mule/FailedToQueueEventException.java0000644000175000017500000000275510746275214025656 0ustar charlescharles/* * $Id: FailedToQueueEventException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleMessage; import org.mule.api.service.Service; import org.mule.api.service.ServiceException; import org.mule.config.i18n.Message; /** * FailedToQueueEventException is thrown when an event cannot be put * on an internal service queue. */ public class FailedToQueueEventException extends ServiceException { /** * Serial version */ private static final long serialVersionUID = -8368283988424746098L; public FailedToQueueEventException(Message message, MuleMessage umoMessage, Service service) { super(message, umoMessage, service); } public FailedToQueueEventException(Message message, MuleMessage umoMessage, Service service, Throwable cause) { super(message, umoMessage, service, cause); } public FailedToQueueEventException(MuleMessage umoMessage, Service service, Throwable cause) { super(umoMessage, service, cause); } } mule-2.0.1/core/src/main/java/org/mule/model/0000755000175000017500000000000011351411104020504 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/model/AbstractModel.java0000644000175000017500000001602010774254333024113 0ustar charlescharles/* * $Id: AbstractModel.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.component.LifecycleAdapterFactory; import org.mule.api.context.MuleContextAware; import org.mule.api.context.notification.ServerNotification; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.model.EntryPointResolver; import org.mule.api.model.EntryPointResolverSet; import org.mule.api.model.Model; import org.mule.component.DefaultLifecycleAdapterFactory; import org.mule.context.notification.ModelNotification; import org.mule.model.resolvers.DefaultEntryPointResolverSet; import org.mule.model.resolvers.LegacyEntryPointResolverSet; import org.mule.service.DefaultServiceExceptionStrategy; import java.beans.ExceptionListener; import java.util.Collection; import java.util.Iterator; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleModel is the default implementation of the Model. The model * encapsulates and manages the runtime behaviour of a Mule Server instance. It is * responsible for maintaining the UMOs instances and their configuration. */ public abstract class AbstractModel implements Model { public static final String DEFAULT_MODEL_NAME = "main"; private String name = DEFAULT_MODEL_NAME; private EntryPointResolverSet entryPointResolverSet = null; // values are supplied below as required private LifecycleAdapterFactory lifecycleAdapterFactory = new DefaultLifecycleAdapterFactory(); private AtomicBoolean initialised = new AtomicBoolean(false); private AtomicBoolean started = new AtomicBoolean(false); private ExceptionListener exceptionListener = new DefaultServiceExceptionStrategy(); protected transient Log logger = LogFactory.getLog(getClass()); protected MuleContext muleContext; /* * (non-Javadoc) * * @see org.mule.api.UMOModel#getName() */ public String getName() { return name; } /* * (non-Javadoc) * * @see org.mule.api.UMOModel#setName(java.lang.String) */ public void setName(String name) { this.name = name; } /* * (non-Javadoc) * * @see org.mule.api.model.Model#getEntryPointResolver() */ public EntryPointResolverSet getEntryPointResolverSet() { if (null == entryPointResolverSet) { entryPointResolverSet = new LegacyEntryPointResolverSet(); } return entryPointResolverSet; } /* * (non-Javadoc) * * @see org.mule.api.model.Model#setEntryPointResolver(org.mule.api.model.EntryPointResolver) */ public void setEntryPointResolverSet(EntryPointResolverSet entryPointResolverSet) { this.entryPointResolverSet = entryPointResolverSet; } /** * This allows us to configure entry point resolvers incrementally * * @param entryPointResolvers Resolvers to add */ public void setEntryPointResolvers(Collection entryPointResolvers) { if (null == entryPointResolverSet) { entryPointResolverSet = new DefaultEntryPointResolverSet(); } for (Iterator resolvers = entryPointResolvers.iterator(); resolvers.hasNext();) { entryPointResolverSet.addEntryPointResolver((EntryPointResolver) resolvers.next()); } } /* * (non-Javadoc) * * @see org.mule.api.model.Model#getLifecycleAdapterFactory() */ public LifecycleAdapterFactory getLifecycleAdapterFactory() { return lifecycleAdapterFactory; } /* * (non-Javadoc) * * @see org.mule.api.model.Model#setLifecycleAdapterFactory(org.mule.api.lifecycle.LifecycleAdapterFactory) */ public void setLifecycleAdapterFactory(LifecycleAdapterFactory lifecycleAdapterFactory) { this.lifecycleAdapterFactory = lifecycleAdapterFactory; } /** Destroys any current components */ public void dispose() { fireNotification(new ModelNotification(this, ModelNotification.MODEL_DISPOSING)); fireNotification(new ModelNotification(this, ModelNotification.MODEL_DISPOSED)); } /** * Stops any registered components * * @throws MuleException if a Service fails tcomponent */ public void stop() throws MuleException { fireNotification(new ModelNotification(this, ModelNotification.MODEL_STOPPING)); started.set(false); fireNotification(new ModelNotification(this, ModelNotification.MODEL_STOPPED)); } /** * Starts all registered components * * @throws MuleException if any of the components fail to start */ public void start() throws MuleException { if (!initialised.get()) { throw new IllegalStateException("Not Initialised"); } if (!started.get()) { fireNotification(new ModelNotification(this, ModelNotification.MODEL_STARTING)); started.set(true); fireNotification(new ModelNotification(this, ModelNotification.MODEL_STARTED)); } else { logger.debug("Model already started"); } } public void initialise() throws InitialisationException { if (!initialised.get()) { fireNotification(new ModelNotification(this, ModelNotification.MODEL_INITIALISING)); initialised.set(true); fireNotification(new ModelNotification(this, ModelNotification.MODEL_INITIALISED)); } else { logger.debug("Model already initialised"); } } public ExceptionListener getExceptionListener() { return exceptionListener; } public void setExceptionListener(ExceptionListener exceptionListener) { this.exceptionListener = exceptionListener; } void fireNotification(ServerNotification notification) { if (muleContext != null) { muleContext.fireNotification(notification); } else if (logger.isWarnEnabled()) { logger.debug("MuleContext is not yet available for firing notifications, ignoring event: " + notification); } } public void setMuleContext(MuleContext context) { this.muleContext = context; //Because we allow a default Exception strategy for the model we need to inject the //muleContext when we get it if(exceptionListener instanceof MuleContextAware) { ((MuleContextAware)exceptionListener).setMuleContext(muleContext); } } } mule-2.0.1/core/src/main/java/org/mule/model/streaming/0000755000175000017500000000000011351411103022474 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/model/streaming/CallbackOutputStream.java0000644000175000017500000000354010745677442027464 0ustar charlescharles/* * $Id: CallbackOutputStream.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.streaming; import java.io.IOException; import java.io.OutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class CallbackOutputStream extends OutputStream { protected final Log logger = LogFactory.getLog(CallbackOutputStream.class); public static interface Callback { public void onClose() throws Exception; } private OutputStream delegate; private Callback callback; public CallbackOutputStream(OutputStream delegate, Callback callback) { this.delegate = delegate; this.callback = callback; } public void write(int b) throws IOException { delegate.write(b); } public void write(byte b[]) throws IOException { delegate.write(b); } public void write(byte b[], int off, int len) throws IOException { delegate.write(b, off, len); } public void close() throws IOException { try { delegate.close(); } finally { closeCallback(); } } private void closeCallback() { if (null != callback) { try { callback.onClose(); } catch(Exception e) { logger.debug("Suppressing exception while releasing resources: " + e.getMessage()); } } } } mule-2.0.1/core/src/main/java/org/mule/model/streaming/DelegatingInputStream.java0000755000175000017500000000305310754365306027625 0ustar charlescharles/* * $Id: DelegatingInputStream.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.streaming; import java.io.IOException; import java.io.InputStream; public class DelegatingInputStream extends InputStream { private InputStream delegate; public DelegatingInputStream(InputStream delegate) { this.delegate = delegate; } public int available() throws IOException { return delegate.available(); } public synchronized void mark(int readlimit) { delegate.mark(readlimit); } public boolean markSupported() { return delegate.markSupported(); } public synchronized void reset() throws IOException { delegate.reset(); } public long skip(long n) throws IOException { return delegate.skip(n); } public int read() throws IOException { return delegate.read(); } public int read(byte b[]) throws IOException { return delegate.read(b); } public int read(byte b[], int off, int len) throws IOException { return delegate.read(b, off, len); } public void close() throws IOException { delegate.close(); } } mule-2.0.1/core/src/main/java/org/mule/model/seda/0000755000175000017500000000000011351411104021420 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/model/seda/SedaService.java0000644000175000017500000004213110771736371024506 0ustar charlescharles/* * $Id: SedaService.java 11488 2008-03-24 14:38:49Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.seda; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.FailedToQueueEventException; import org.mule.OptimizedRequestContext; import org.mule.RequestContext; import org.mule.api.ExceptionPayload; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleRuntimeException; import org.mule.api.config.ThreadingProfile; import org.mule.api.context.WorkManager; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.LifecycleException; import org.mule.api.service.ServiceException; import org.mule.api.transport.ReplyToHandler; import org.mule.config.QueueProfile; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; import org.mule.management.stats.ServiceStatistics; import org.mule.message.DefaultExceptionPayload; import org.mule.service.AbstractService; import org.mule.transport.NullPayload; import org.mule.util.queue.Queue; import org.mule.util.queue.QueueSession; import java.util.NoSuchElementException; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkEvent; import javax.resource.spi.work.WorkException; import javax.resource.spi.work.WorkListener; /** * A Seda service runs inside a Seda Model and is responsible for managing a Seda * Queue and thread pool for a Mule sevice service. In Seda terms this is * equivilent to a stage. */ public class SedaService extends AbstractService implements Work, WorkListener { /** * Serial version/ */ private static final long serialVersionUID = 7711976708670893015L; protected WorkManager workManager; /** * The time out used for taking from the Seda Queue. */ protected Integer queueTimeout; /** * The threading profile to use for this service. If this is not set a default * will be provided by the server */ protected ThreadingProfile threadingProfile; /** * The queue profile to use for this service. If this is not set a default * will be provided by the server */ protected QueueProfile queueProfile; protected Queue queue; /** For Spring only */ public SedaService() { super(); } /** * Initialise the service. The service will first create a Mule UMO from the * UMODescriptor and then initialise a pool based on the attributes in the * UMODescriptor. * * @throws org.mule.api.lifecycle.InitialisationException if the service fails * to initialise * @see org.mule.api.UMODescriptor */ protected synchronized void doInitialise() throws InitialisationException { if (threadingProfile == null) { // TODO MULE-2102 This should be configured in the default template. threadingProfile = muleContext.getDefaultComponentThreadingProfile(); } // Create thread pool workManager = threadingProfile.createWorkManager(getName()); if (queueProfile == null) { // TODO MULE-2102 This should be configured in the default template. queueProfile = ((SedaModel) model).getQueueProfile(); } if (queueTimeout == null) { // TODO MULE-2102 This should be configured in the default template. setQueueTimeout(new Integer(((SedaModel) model).getQueueTimeout())); } try { if (name == null) { throw new InitialisationException(MessageFactory.createStaticMessage("Service has no name to identify it"), this); } // Setup event Queue (used for VM execution). The queue has the same name as the service. queueProfile.configureQueue(name, muleContext.getQueueManager()); queue = muleContext.getQueueManager().getQueueSession().getQueue(name); if (queue == null) { throw new InitialisationException(MessageFactory.createStaticMessage("Queue " + name + " not created for service " + name), this); } } catch (InitialisationException e) { throw e; } catch (Throwable e) { throw new InitialisationException( CoreMessages.objectFailedToInitialise("Service Queue"), e, this); } } protected void doForceStop() throws MuleException { doStop(); } protected void doStop() throws MuleException { if (muleContext.getQueueManager().getQueueSession().getQueue(name).size() > 0) { try { stopping.whenFalse(null); } catch (InterruptedException e) { // we can ignore this // TODO MULE-863: Why? } } workManager.dispose(); } protected void doStart() throws MuleException { try { workManager.start(); workManager.scheduleWork(this, WorkManager.INDEFINITE, null, this); } catch (Exception e) { throw new LifecycleException( CoreMessages.failedToStart("Service: " + name), e, this); } } protected void doDispose() { // threadPool.awaitTerminationAfterShutdown(); if (workManager != null) { workManager.dispose(); } } protected void doDispatch(MuleEvent event) throws MuleException { // Dispatching event to the service if (stats.isEnabled()) { stats.incReceivedEventASync(); } if (logger.isDebugEnabled()) { logger.debug("Service: " + name + " has received asynchronous event on: " + event.getEndpoint().getEndpointURI()); } // Block until we can queue the next event try { enqueue(event); if (stats.isEnabled()) { stats.incQueuedEvent(); } } catch (Exception e) { FailedToQueueEventException e1 = new FailedToQueueEventException( CoreMessages.interruptedQueuingEventFor(this.getName()), event.getMessage(), this, e); handleException(e1); } if (logger.isTraceEnabled()) { logger.trace("MuleEvent added to queue for: " + name); } } protected MuleMessage doSend(MuleEvent event) throws MuleException { MuleMessage result = null; try { if (logger.isDebugEnabled()) { logger.debug(this + " : got proxy for " + event.getId() + " = " + component); } Object replyTo = event.getMessage().getReplyTo(); ReplyToHandler replyToHandler = getReplyToHandler(event.getMessage(), (InboundEndpoint) event.getEndpoint()); result = component.onCall(event); result = sendToOutboundRouter(event, result); result = processAsyncReplyRouter(result); processReplyTo(event, result, replyToHandler, replyTo); // stats if (stats.isEnabled()) { stats.incSentEventSync(); } } catch (Exception e) { event.getSession().setValid(false); if (e instanceof MessagingException) { handleException(e); } else { handleException(new MessagingException(CoreMessages.eventProcessingFailedFor(getName()), event.getMessage(), e)); } if (result == null) { // important that we pull event from request context here as it may // have been modified // (necessary to avoid scribbling between threads) result = new DefaultMuleMessage(NullPayload.getInstance(), RequestContext.getEvent().getMessage()); } ExceptionPayload exceptionPayload = result.getExceptionPayload(); if (exceptionPayload == null) { exceptionPayload = new DefaultExceptionPayload(e); } result.setExceptionPayload(exceptionPayload); } return result; } public int getQueueSize() { QueueSession session = muleContext.getQueueManager().getQueueSession(); Queue queue = session.getQueue(name); if (queue == null) { logger.warn(new InitialisationException(MessageFactory.createStaticMessage("Queue " + name + " not created for service " + name), this)); return -1; } return queue.size(); } /** * While the service isn't stopped this runs a continuous loop checking for new * events in the queue. */ public void run() { DefaultMuleEvent event = null; QueueSession queueSession = muleContext.getQueueManager().getQueueSession(); while (!stopped.get()) { try { // Wait if the service is paused paused.whenFalse(null); // If we're doing a draining stop, read all events from the queue // before stopping if (stopping.get()) { if (queueSession == null || getQueueSize() <= 0) { stopping.set(false); break; } } event = (DefaultMuleEvent) dequeue(); if (event != null) { if (stats.isEnabled()) { stats.decQueuedEvent(); } if (logger.isDebugEnabled()) { logger.debug("Service: " + name + " dequeued event on: " + event.getEndpoint().getEndpointURI()); } workManager.scheduleWork(new ComponentStageWorker(event), WorkManager.INDEFINITE, null, this); } } catch (Exception e) { if (isStopped() || isStopping()) { break; } if (e instanceof InterruptedException) { stopping.set(false); break; } else if (e instanceof NoSuchElementException) { handleException(new ServiceException(CoreMessages.proxyPoolTimedOut(), (event == null ? null : event.getMessage()), this, e)); } else if (e instanceof MuleException) { handleException(e); } else if (e instanceof WorkException) { handleException( new ServiceException( CoreMessages.eventProcessingFailedFor(name), (event == null ? null : event.getMessage()), this, e)); } else { handleException( new ServiceException( CoreMessages.failedToGetPooledObject(), (event == null ? null : event.getMessage()), this, e)); } } finally { stopping.set(false); } } } public void release() { stopping.set(false); } protected void enqueue(MuleEvent event) throws Exception { QueueSession session = muleContext.getQueueManager().getQueueSession(); Queue queue = session.getQueue(name); if (queue == null) { throw new InitialisationException(MessageFactory.createStaticMessage("Queue " + name + " not created for service " + name), this); } if (logger.isDebugEnabled()) { logger.debug("Service " + name + " putting event on queue " + name + ": " + event); } queue.put(event); } protected MuleEvent dequeue() throws Exception { if (logger.isDebugEnabled()) { //logger.debug("Service " + name + " polling queue " + name + ", timeout = " + queueTimeout); } if (getQueueTimeout() == null) { throw new InitialisationException(CoreMessages.noServiceQueueTimeoutSet(this), this); } else { return (MuleEvent) queue.poll(getQueueTimeout().intValue()); } } public void workAccepted(WorkEvent event) { handleWorkException(event, "workAccepted"); } public void workRejected(WorkEvent event) { handleWorkException(event, "workRejected"); } public void workStarted(WorkEvent event) { handleWorkException(event, "workStarted"); } public void workCompleted(WorkEvent event) { handleWorkException(event, "workCompleted"); } protected void handleWorkException(WorkEvent event, String type) { Throwable e; if (event != null && event.getException() != null) { e = event.getException(); } else { return; } if (event.getException().getCause() != null) { e = event.getException().getCause(); } logger.error("Work caused exception on '" + type + "'. Work being executed was: " + event.getWork().toString()); if (e instanceof Exception) { handleException((Exception) e); } else { throw new MuleRuntimeException( CoreMessages.componentCausedErrorIs(this.getName()), e); } } protected ServiceStatistics createStatistics() { return new ServiceStatistics(getName(), threadingProfile.getMaxThreadsActive()); } public Object getInstance() throws MuleException { throw new UnsupportedOperationException("Direct access to underlying service object is not allowed in the SedaModel. If this is for a unit test, make sure you are using the TestSedaModel ('seda-test')"); } public QueueProfile getQueueProfile() { return queueProfile; } public void setQueueProfile(QueueProfile queueProfile) { this.queueProfile = queueProfile; } public Integer getQueueTimeout() { return queueTimeout; } public void setQueueTimeout(Integer queueTimeout) { this.queueTimeout = queueTimeout; } public ThreadingProfile getThreadingProfile() { return threadingProfile; } public void setThreadingProfile(ThreadingProfile threadingProfile) { this.threadingProfile = threadingProfile; } public WorkManager getWorkManager() { return workManager; } public void setWorkManager(WorkManager workManager) { this.workManager = workManager; } protected void dispatchToOutboundRouter(MuleEvent event, MuleMessage result) throws MessagingException { super.dispatchToOutboundRouter(event, result); // TODO MULE-3077 SedaService should use a SEDA queue to dispatch to outbound // routers } private class ComponentStageWorker implements Work { private MuleEvent event; public ComponentStageWorker(MuleEvent event) { this.event = event; } public void run() { try { event = OptimizedRequestContext.criticalSetEvent(event); Object replyTo = event.getMessage().getReplyTo(); ReplyToHandler replyToHandler = getReplyToHandler(event.getMessage(), (InboundEndpoint) event.getEndpoint()); MuleMessage result = component.onCall(event); dispatchToOutboundRouter(event, result); processReplyTo(event, result, replyToHandler, replyTo); } catch (Exception e) { event.getSession().setValid(false); if (e instanceof MessagingException) { handleException(e); } else { handleException(new MessagingException(CoreMessages.eventProcessingFailedFor(getName()), event.getMessage(), e)); } } } public void release() { // no-op } } } mule-2.0.1/core/src/main/java/org/mule/model/seda/SedaModel.java0000644000175000017500000000463311002101611024116 0ustar charlescharles/* * $Id: SedaModel.java 11593 2008-04-18 11:18:33Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.seda; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.PoolingProfile; import org.mule.config.QueueProfile; import org.mule.model.AbstractModel; /** * A mule service service model that uses Seda principals to achieve high * throughput by Quing events for compoonents and processing them concurrently. */ public class SedaModel extends AbstractModel { /** * The time out used for taking from the Seda Queue. */ private int queueTimeout; /** * the pooling configuration used when initialising the service described by * this descriptor. */ protected PoolingProfile poolingProfile; /** * The queuing profile for events received for this service */ protected QueueProfile queueProfile; /** * Returns the model type name. This is a friendly identifier that is used to * look up the SPI class for the model * * @return the model type */ public String getType() { return "seda"; } public void initialise() throws InitialisationException { queueTimeout = muleContext.getConfiguration().getDefaultSynchronousEventTimeout(); if (queueProfile == null) { queueProfile = new QueueProfile(); } if (poolingProfile == null) { poolingProfile = new PoolingProfile(); } super.initialise(); } public int getQueueTimeout() { return queueTimeout; } public void setQueueTimeout(int queueTimeout) { this.queueTimeout = queueTimeout; } public PoolingProfile getPoolingProfile() { return poolingProfile; } public void setPoolingProfile(PoolingProfile poolingProfile) { this.poolingProfile = poolingProfile; } public QueueProfile getQueueProfile() { return queueProfile; } public void setQueueProfile(QueueProfile queueProfile) { this.queueProfile = queueProfile; } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/0000755000175000017500000000000011351411103022527 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/model/resolvers/AbstractArgumentEntryPointResolver.java0000644000175000017500000001406110745677442032452 0ustar charlescharles/* * $Id: AbstractArgumentEntryPointResolver.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.api.MuleEventContext; import org.mule.api.model.InvocationResult; import org.mule.util.ClassUtils; import org.mule.util.StringMessageUtils; import java.lang.reflect.Method; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; /** * A base class that allows implementing resolvers to define what parameters it is expecting. Currently * there are two implementations of this {@link org.mule.model.resolvers.NoArgumentsEntryPointResolver}, that * allows meothds with no arguments to be invoked and {@link org.mule.model.resolvers.ArrayEntryPointResolver} that * allows for methods that accept an array type to be invoked. *

    * Users can set explicit method names on this resolver to control which methods are allowed to be called. Also a set of * 'ingorred' methods are available (and the use can add others) to tell the resolver to not resolve to these methods. * The default ones are: *

      *
    • {@link #toString()} *
    • {@link #getClass()} *
    • {@link #notify} *
    • {@link #notifyAll} *
    • {@link #hashCode} *
    • {@link #wait} *
    • {@link Cloneable#clone()} *
    • 'is*' *
    • 'get*'. *
    *

    Note that wildcard expressions can be used. */ public abstract class AbstractArgumentEntryPointResolver extends ReflectionEntryPointResolver { private Set methods = new HashSet(2); private boolean enableDiscovery = true; public AbstractArgumentEntryPointResolver() { //By default No arg methods without a return type should be supported setAcceptVoidMethods(true); // we don't want to match these methods when looking for a service method //If you add to this list please change the javaDoc above too. setIgnoredMethods(new HashSet(Arrays.asList(new String[]{"toString", "getClass", "notify", "notifyAll", "wait", "hashCode", "clone", "is*", "get*"}))); } public Set getMethods() { return methods; } public void setMethods(Set methods) { this.methods = methods; } public void addMethod(String name) { this.methods.add(name); } public boolean removeMethod(String name) { return this.methods.remove(name); } public boolean isEnableDiscovery() { return enableDiscovery; } public void setEnableDiscovery(boolean enableDiscovery) { this.enableDiscovery = enableDiscovery; } public InvocationResult invoke(Object component, MuleEventContext context) throws Exception { Method method = null; Object[] payload = getPayloadFromMessage(context); if (payload == null) { return new InvocationResult(InvocationResult.STATE_INVOKE_NOT_SUPPORTED); } for (Iterator iterator = methods.iterator(); iterator.hasNext();) { String methodName = (String) iterator.next(); method = getMethodByName(methodName, context); if (method == null) { method = ClassUtils.getMethod(component.getClass(), methodName, getMethodArgumentTypes(payload)); } if (method != null) { addMethodByName(method, context); break; } } //If the method wasn't explicitly set, lets try and discover it if (method == null) { if (isEnableDiscovery()) { Class[] argTypes = getMethodArgumentTypes(payload); List methods = ClassUtils.getSatisfiableMethods(component.getClass(), argTypes, isAcceptVoidMethods(), false, getIgnoredMethods(), filter); if (methods.size() > 1) { InvocationResult result = new InvocationResult(InvocationResult.STATE_INVOKED_FAILED); // too many methods match the payload argument result.setErrorTooManyMatchingMethods(component, argTypes, this); return result; } else if (methods.size() == 1) { // found exact match for payload argument method = this.addMethodByArguments(component, (Method) methods.get(0), getPayloadFromMessage(context)); } else { InvocationResult result = new InvocationResult(InvocationResult.STATE_INVOKED_FAILED); // no method for payload argument either - bail out result.setErrorNoMatchingMethods(component, ClassUtils.NO_ARGS_TYPE, this); return result; } } else { InvocationResult result = new InvocationResult(InvocationResult.STATE_INVOKED_FAILED); // no method for the explicit methods either result.setErrorNoMatchingMethodsCalled(component, StringMessageUtils.toString(methods), this); return result; } } return invokeMethod(component, method, getPayloadFromMessage(context)); } protected abstract Class[] getMethodArgumentTypes(Object[] payload); public String toString() { final StringBuffer sb = new StringBuffer(); sb.append(ClassUtils.getClassName(getClass())); sb.append("{methods=").append(StringMessageUtils.toString(methods)); sb.append("{transformFirst=").append(isTransformFirst()); sb.append(", acceptVoidMethods=").append(isAcceptVoidMethods()); sb.append('}'); return sb.toString(); } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/AbstractEntryPointResolver.java0000644000175000017500000001273010746275214030740 0ustar charlescharles/* * $Id: AbstractEntryPointResolver.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.VoidResult; import org.mule.api.MuleEventContext; import org.mule.api.model.EntryPointResolver; import org.mule.api.model.InvocationResult; import org.mule.api.transformer.TransformerException; import org.mule.transport.NullPayload; import org.mule.util.ClassUtils; import org.mule.util.StringMessageUtils; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A Base class for {@link org.mule.api.model.EntryPointResolver}. It provides parameters for * detemining if the payload of the message should be transformed first and whether void methods are * acceptible. It also provides a method cashe for those resolvers that use reflection to discover methods * on the service. */ public abstract class AbstractEntryPointResolver implements EntryPointResolver { /** logger used by this class */ protected transient final Log logger = LogFactory.getLog(getClass()); private boolean transformFirst = true; private boolean acceptVoidMethods = false; // @GuardedBy(itself) protected final ConcurrentHashMap methodCache = new ConcurrentHashMap(4); public boolean isTransformFirst() { return transformFirst; } public void setTransformFirst(boolean transformFirst) { this.transformFirst = transformFirst; } public boolean isAcceptVoidMethods() { return acceptVoidMethods; } public void setAcceptVoidMethods(boolean acceptVoidMethods) { this.acceptVoidMethods = acceptVoidMethods; } protected Method getMethodByName(String methodName, MuleEventContext context) { StringBuffer key = new StringBuffer(24).append(context.getService().getName()) .append(".").append(methodName); Method method = (Method) methodCache.get(key); return method; } protected Method addMethodByName(Method method, MuleEventContext context) { StringBuffer key = new StringBuffer(24).append(context.getService().getName()) .append(".").append(method.getName()); Method previousMethod = (Method) methodCache.putIfAbsent(key, method); return (previousMethod != null ? previousMethod : method); } protected Method addMethodByArguments(Object component, Method method, Object[] payload) { Method previousMethod = (Method) methodCache.putIfAbsent(getCacheKeyForPayload(component, payload), method); return (previousMethod != null ? previousMethod : method); } protected Method getMethodByArguments(Object component, Object[] payload) { Method method = (Method) methodCache.get(getCacheKeyForPayload(component, payload)); return method; } protected String getCacheKeyForPayload(Object component, Object[] payload) { StringBuffer key = new StringBuffer(48); for (int i = 0; i < payload.length; i++) { Object o = payload[i]; key.append(o.getClass().getName()); } key.append(".").append(ClassUtils.getClassName(component.getClass())); return key.toString(); } protected Object[] getPayloadFromMessage(MuleEventContext context) throws TransformerException { Object temp; if (isTransformFirst()) { temp = context.transformMessage(); } else { temp = context.getMessage().getPayload(); } if (temp instanceof Object[]) { return (Object[]) temp; } else if (temp instanceof NullPayload) { return ClassUtils.NO_ARGS; } else { return new Object[]{temp}; } } protected InvocationResult invokeMethod(Object component, Method method, Object[] arguments) throws InvocationTargetException, IllegalAccessException { String methodCall = null; if (logger.isDebugEnabled()) { methodCall = component.getClass().getName() + "." + method.getName() + "(" + StringMessageUtils.toString(ClassUtils.getClassTypes(arguments)) + ")"; logger.debug("Invoking " + methodCall); } Object result = method.invoke(component, arguments); if (method.getReturnType().equals(Void.TYPE)) { result = VoidResult.getInstance(); } if (logger.isDebugEnabled()) { logger.debug("Result of call " + methodCall + " is " + (result == null ? "null" : "not null")); } return new InvocationResult(result, method); } public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("AbstractEntryPointResolver"); sb.append("{transformFirst=").append(transformFirst); sb.append(", acceptVoidMethods=").append(acceptVoidMethods); sb.append('}'); return sb.toString(); } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/ReflectionEntryPointResolver.java0000644000175000017500000001545310746275214031274 0ustar charlescharles/* * $Id: ReflectionEntryPointResolver.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.api.MuleEventContext; import org.mule.api.model.InvocationResult; import org.mule.routing.filters.WildcardFilter; import org.mule.util.ClassUtils; import org.mule.util.StringMessageUtils; import org.mule.util.StringUtils; import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; /** * ReflectEntryPointResolver is used to determine the entry point on a service * after an event has been received for it. The entrypoint is discovered using * the event payload type(s) as the argument using reflection. An entry point will try and match for * different argument types, so it's possible to have multiple entry points on a * single service. *

    * For multiple parameters the payload of context.getMessage().getPayload() should be an Array of objects. * If the message payload is of type {@link org.mule.transport.NullPayload} the resolver will look for a no-argument * method to call that doesn't match the set of ignoredMethods on the resolver. *

    * Also a set of 'ignored' methods are available (and the use can add others) to tell the resolver to not * resolve to these methods. The default ones are: *

      *
    • {@link #toString()} *
    • {@link #getClass()} *
    • {@link #notify} *
    • {@link #notifyAll} *
    • {@link #hashCode} *
    • {@link #wait} *
    • {@link java.lang.reflect.Proxy#getInvocationHandler} *
    • {@link Cloneable#clone()} *
    • 'is*' *
    • 'get*'. *
    • 'set*'. *
    *

    Note that wildcard expressions can be used. */ public class ReflectionEntryPointResolver extends AbstractEntryPointResolver { // we don't want to match these methods when looking for a service method private Set ignoredMethods = new HashSet(Arrays.asList(new String[]{"equals", "getInvocationHandler", "set*", "toString", "getClass", "notify", "notifyAll", "wait", "hashCode", "clone", "is*", "get*"})); protected WildcardFilter filter; public ReflectionEntryPointResolver() { updateFilter(); } private void updateFilter() { filter = new WildcardFilter(StringUtils.join(ignoredMethods, ',')); } /** * Returns an unmodifable Set of ignoredMethods on this resolver * To add method to the resolver use {@link #addIgnoredMethod(String)} * * @return unmodifiable set of method names set on this resolver */ public Collection getIgnoredMethods() { return Collections.unmodifiableSet(ignoredMethods); } public void setIgnoredMethods(Collection methods) { this.ignoredMethods = new HashSet(methods); updateFilter(); } public void addIgnoredMethod(String name) { this.ignoredMethods.add(name); updateFilter(); } public boolean removeIgnoredMethod(String name) { boolean result = this.ignoredMethods.remove(name); updateFilter(); return result; } /** * Will discover the entrypoint on the service using the payload type to figure out the method to call. * For multiple parameters the payload of context.getMessage().geTPayload() should be an Array of objects. * If the message payload is of type {@link org.mule.transport.NullPayload} the resolver will look for a no-argument * method to call that doesn't match the set of ignoredMethods on the resover. * * @param service * @param context * @return * @throws Exception */ public InvocationResult invoke(Object component, MuleEventContext context) throws Exception { Object[] payload = getPayloadFromMessage(context); Method method; InvocationResult result; method = this.getMethodByArguments(component, payload); if (method != null) { return invokeMethod(component, method, payload); } Class[] types = ClassUtils.getClassTypes(payload); // do any methods on the service accept a context? List methods = ClassUtils.getSatisfiableMethods(component.getClass(), types, isAcceptVoidMethods(), false, ignoredMethods, filter); int numMethods = methods.size(); if (numMethods > 1) { result = new InvocationResult(InvocationResult.STATE_INVOKED_FAILED); // too many methods match the context argument result.setErrorTooManyMatchingMethods(component, types, StringMessageUtils.toString(methods), this); return result; } else if (numMethods == 1) { // found exact match for method with context argument method = this.addMethodByArguments(component, (Method) methods.get(0), payload); } else { methods = ClassUtils.getSatisfiableMethods(component.getClass(), ClassUtils .getClassTypes(payload), true, true, ignoredMethods); numMethods = methods.size(); if (numMethods > 1) { result = new InvocationResult(InvocationResult.STATE_INVOKED_FAILED); // too many methods match the context argument result.setErrorTooManyMatchingMethods(component, types, StringMessageUtils.toString(methods), this); return result; } else if (numMethods == 1) { // found exact match for payload argument method = this.addMethodByArguments(component, (Method) methods.get(0), payload); } else { result = new InvocationResult(InvocationResult.STATE_INVOKED_FAILED); // no method for payload argument either - bail out result.setErrorNoMatchingMethods(component, ClassUtils.getClassTypes(payload), this); return result; } } return invokeMethod(component, method, payload); } public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("ReflectionEntryPointResolver"); sb.append("{ignoredMethods=").append(StringMessageUtils.toString(ignoredMethods)); sb.append("{transformFirst=").append(isTransformFirst()); sb.append(", acceptVoidMethods=").append(isAcceptVoidMethods()); sb.append('}'); return sb.toString(); } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/MethodHeaderPropertyEntryPointResolver.java0000644000175000017500000001237710745677442033312 0ustar charlescharles/* * $Id: MethodHeaderPropertyEntryPointResolver.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.api.MuleEventContext; import org.mule.api.config.MuleProperties; import org.mule.api.lifecycle.Callable; import org.mule.api.model.InvocationResult; import org.mule.config.i18n.CoreMessages; import org.mule.util.ClassUtils; import java.lang.reflect.Method; import org.apache.commons.lang.BooleanUtils; /** * This resolver will look for a 'method' property on the incoming event to determine which method to invoke * Users can customise the name of the property used to look up the method name on the event */ public class MethodHeaderPropertyEntryPointResolver extends AbstractEntryPointResolver { private String methodProperty = MuleProperties.MULE_METHOD_PROPERTY; public String getMethodProperty() { return methodProperty; } public void setMethodProperty(String methodProperty) { this.methodProperty = methodProperty; } public InvocationResult invoke(Object component, MuleEventContext context) throws Exception { //TODO: RM* This is a hack that can be fixed by introducing property scoping on the message // Transports such as SOAP need to ignore the method property boolean ignoreMethod = BooleanUtils.toBoolean((Boolean) context.getMessage().removeProperty( MuleProperties.MULE_IGNORE_METHOD_PROPERTY)); if (ignoreMethod) { //TODO: Removed once we have property scoping InvocationResult result = new InvocationResult(InvocationResult.STATE_INVOKE_NOT_SUPPORTED); result.setErrorMessage("Property: " + MuleProperties.MULE_IGNORE_METHOD_PROPERTY + " was set so skipping this resolver: " + this); return result; } //TODO: with scoped properties we wouldn't need to remove the property here Object methodProp = context.getMessage().removeProperty(getMethodProperty()); if (methodProp == null) { InvocationResult result = new InvocationResult(InvocationResult.STATE_INVOKED_FAILED); // no method for the explicit method header result.setErrorMessage(CoreMessages.propertyIsNotSetOnEvent(getMethodProperty()).toString()); return result; } Method method; String methodName; if (methodProp instanceof Method) { method = (Method) methodProp; methodName = method.getName(); } else { methodName = methodProp.toString(); method = getMethodByName(methodName, context); } if (method != null && method.getParameterTypes().length == 0) { return invokeMethod(component, method, ClassUtils.NO_ARGS_TYPE); } Object[] payload = getPayloadFromMessage(context); if (method == null) { Class[] classTypes = ClassUtils.getClassTypes(payload); try { method = component.getClass().getMethod(methodName, classTypes); } catch (NoSuchMethodException e) { InvocationResult result = new InvocationResult(InvocationResult.STATE_INVOKED_FAILED); result.setErrorNoMatchingMethods(component, classTypes, this); return result; } } validateMethod(component, method); addMethodByName(method, context); return invokeMethod(component, method, payload); } /** * This method can be used to validate that the method exists and is allowed to * be executed. */ protected void validateMethod(Object component, Method method) throws NoSuchMethodException { boolean fallback = component instanceof Callable; if (method != null) { // This will throw NoSuchMethodException if it doesn't exist try { component.getClass().getMethod(method.getName(), method.getParameterTypes()); } catch (NoSuchMethodException e) { if (!fallback) { throw e; } } } else { if (!fallback) { throw new NoSuchMethodException( CoreMessages.methodWithParamsNotFoundOnObject("null", "unknown", component.getClass()).toString()); } } } public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("MethodHeaderPropertyEntryPointResolver"); sb.append("{methodHeader=").append(methodProperty); sb.append("transformFirst=").append(isTransformFirst()); sb.append(", acceptVoidMethods=").append(isAcceptVoidMethods()); sb.append('}'); return sb.toString(); } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/LegacyEntryPointResolverSet.java0000644000175000017500000000275710745677442031075 0ustar charlescharles/* * $Id: LegacyEntryPointResolverSet.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; /** * An {@link org.mule.api.model.EntryPointResolverSet} that mimics the behaviour of the Mule 1.x * DynamicEntryPointResolver. */ public class LegacyEntryPointResolverSet extends DefaultEntryPointResolverSet { public LegacyEntryPointResolverSet() { addEntryPointResolver(new MethodHeaderPropertyEntryPointResolver()); addEntryPointResolver(new CallableEntryPointResolver()); ReflectionEntryPointResolver preTransformResolver = new ReflectionEntryPointResolver(); //In Mule 1.x you could call setXX methods as service methods by default preTransformResolver.removeIgnoredMethod("set*"); addEntryPointResolver(preTransformResolver); ReflectionEntryPointResolver postTransformResolver = new ReflectionEntryPointResolver(); postTransformResolver.setTransformFirst(false); //In Mule 1.x you could call setXX methods as service methods by default postTransformResolver.removeIgnoredMethod("set*"); addEntryPointResolver(postTransformResolver); } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/ExplicitMethodEntryPointResolver.java0000644000175000017500000000622510745677442032131 0ustar charlescharles/* * $Id: ExplicitMethodEntryPointResolver.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.api.MuleEventContext; import org.mule.api.model.InvocationResult; import org.mule.config.i18n.CoreMessages; import org.mule.util.ClassUtils; import org.mule.util.StringMessageUtils; import java.lang.reflect.Method; import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Set; /** * An Entrypoint resolver that allows the user to set one or more acceptiple methd names to look for. * For each method reflection will be used to see if the method accepts the current payload types ( * the results are cached to improve performance). * There has to be at least one method name set on this resolver */ public class ExplicitMethodEntryPointResolver extends AbstractEntryPointResolver { private Set methods = new LinkedHashSet(2); public void setMethods(Collection methods) { this.methods = new LinkedHashSet(methods); } public void addMethod(String name) { this.methods.add(name); } public boolean removeMethod(String name) { return this.methods.remove(name); } public InvocationResult invoke(Object component, MuleEventContext context) throws Exception { if (methods == null || methods.size() == 0) { throw new IllegalStateException(CoreMessages.objectIsNull("methods").toString()); } Object[] payload = getPayloadFromMessage(context); Class[] classTypes = ClassUtils.getClassTypes(payload); Method method = null; for (Iterator iterator = methods.iterator(); iterator.hasNext();) { String methodName = (String) iterator.next(); method = getMethodByName(methodName, context); if (method == null) { method = ClassUtils.getMethod(component.getClass(), methodName, classTypes); } if (method != null) { addMethodByName(method, context); break; } } if (method == null) { InvocationResult result = new InvocationResult(InvocationResult.STATE_INVOKED_FAILED); result.setErrorNoMatchingMethods(component, classTypes, this); return result; } return invokeMethod(component, method, payload); } public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("ExplicitEntryPointResolver"); sb.append("{methods=").append(StringMessageUtils.toString(methods)); sb.append("{transformFirst=").append(isTransformFirst()); sb.append(", acceptVoidMethods=").append(isAcceptVoidMethods()); sb.append('}'); return sb.toString(); } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/DefaultEntryPointResolverSet.java0000644000175000017500000000610310746275214031232 0ustar charlescharles/* * $Id: DefaultEntryPointResolverSet.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.api.MuleEventContext; import org.mule.api.model.EntryPointResolver; import org.mule.api.model.EntryPointResolverSet; import org.mule.api.model.InvocationResult; import org.mule.util.CollectionUtils; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Provides the default implementation of an {@link org.mule.api.model.EntryPointResolverSet} * It resolves a method to call on the given service when an event is received. * This object maintains a set of Resolvers that will be used in order to resolve * an entrypoint on a service object until one is found or until the set is * exhausted. */ public class DefaultEntryPointResolverSet implements EntryPointResolverSet { protected final Log logger = LogFactory.getLog(getClass()); private final Set entryPointResolvers = new LinkedHashSet(4); private List exceptions = new CopyOnWriteArrayList(); public Object invoke(Object component, MuleEventContext context) throws Exception { try { for (Iterator iterator = entryPointResolvers.iterator(); iterator.hasNext();) { EntryPointResolver resolver = (EntryPointResolver) iterator.next(); InvocationResult result = resolver.invoke(component, context); if (result.getState() == InvocationResult.STATE_INVOKED_SUCESSFUL) { return result.getResult(); } else { if (result.hasError()) { exceptions.add(result.getErrorMessage()); } } } throw new EntryPointNotFoundException(CollectionUtils.toString(exceptions, true)); } finally { exceptions.clear(); } } public Set getEntryPointResolvers() { return entryPointResolvers; } public void setEntryPointResolvers(Set entryPointResolvers) { this.entryPointResolvers.clear(); this.entryPointResolvers.addAll(entryPointResolvers); } public void addEntryPointResolver(EntryPointResolver resolver) { synchronized (entryPointResolvers) { this.entryPointResolvers.add(resolver); } } public boolean removeEntryPointResolver(EntryPointResolver resolver) { return this.entryPointResolvers.remove(resolver); } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/EntryPointNotFoundException.java0000644000175000017500000000174110746275214031066 0ustar charlescharles/* * $Id: EntryPointNotFoundException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.api.MuleException; import org.mule.config.i18n.MessageFactory; /** * Tis exception gets thrown by the {@link org.mule.model.resolvers.DefaultEntryPointResolverSet} if after trying * all entrypointResolvers it cannot fin the entrypoint on the service service */ public class EntryPointNotFoundException extends MuleException { /** @param message the exception message */ public EntryPointNotFoundException(String message) { super(MessageFactory.createStaticMessage(message)); } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/NoArgumentsEntryPointResolver.java0000644000175000017500000000274210745677442031451 0ustar charlescharles/* * $Id: NoArgumentsEntryPointResolver.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.api.MuleEventContext; import org.mule.api.transformer.TransformerException; import org.mule.util.ClassUtils; /** * Allows for arguments with no parameters to be called. Regardless of the payload of the current * event, this resolver will always only look for No-Arg servic methods. *

    * Note that the {@link org.mule.model.resolvers.ReflectionEntryPointResolver} supports the resolution * of no-arg service methods if the event payload received is of type {@link org.mule.transport.NullPayload}. * * @see org.mule.model.resolvers.ReflectionEntryPointResolver * @see org.mule.transport.NullPayload */ public class NoArgumentsEntryPointResolver extends AbstractArgumentEntryPointResolver { //@java.lang.Override protected Class[] getMethodArgumentTypes(Object[] payload) { return ClassUtils.NO_ARGS_TYPE; } //@java.lang.Override protected Object[] getPayloadFromMessage(MuleEventContext context) throws TransformerException { return ClassUtils.NO_ARGS; } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/TooManySatisfiableMethodsException.java0000644000175000017500000000251310746275214032355 0ustar charlescharles/* * $Id: TooManySatisfiableMethodsException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.api.MuleException; import org.mule.config.i18n.CoreMessages; /** * TooManySatisfiableMethodsException is thrown by EntryPointResolvers * when the service passed has more than one method that meets the criteria of the * configured EntryPointResolver. * * @see org.mule.api.model.EntryPointResolver */ public class TooManySatisfiableMethodsException extends MuleException { /** Serial version */ private static final long serialVersionUID = 7856775581858822364L; public TooManySatisfiableMethodsException(Object component, Object[] types) { super(CoreMessages.tooManyAcceptableMethodsOnObjectForTypes(component, types)); } public TooManySatisfiableMethodsException(Object component, Class returnType) { super(CoreMessages.tooManyMatchingMethodsOnObjectWhichReturn(component, returnType)); } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/ArrayEntryPointResolver.java0000644000175000017500000000360610746275214030255 0ustar charlescharles/* * $Id: ArrayEntryPointResolver.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.api.MuleEventContext; import org.mule.api.transformer.TransformerException; import org.mule.util.ClassUtils; /** * Will resolver entry point methods on a service service that accept a single array. * i.e. * public Object eat(Fruit[] fruit) *

    * This resolver will NOT resolver method endtry points such as - * public Object eat(Fruit[] fruit, Banana banana) *

    * If you require to mix an array type with complex types you need to specify an inbound transformer that return a * multi-dimensional array of arguments i.e. * new Object[]{new Fruit[]{new Apple(), new Orange()}, new Banana()}; */ public class ArrayEntryPointResolver extends AbstractArgumentEntryPointResolver { //@java.lang.Override protected Class[] getMethodArgumentTypes(Object[] payload) { return ClassUtils.getClassTypes(payload); } //@java.lang.Override protected Object[] getPayloadFromMessage(MuleEventContext context) throws TransformerException { Object temp; if (isTransformFirst()) { temp = context.transformMessage(); } else { temp = context.getMessage().getPayload(); } if (temp instanceof Object[]) { return new Object[]{temp}; } else { //Payload type not supported by this resolver return null; } } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/CallableEntryPointResolver.java0000644000175000017500000000447210745677442030710 0ustar charlescharles/* * $Id: CallableEntryPointResolver.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.api.MuleEventContext; import org.mule.api.MuleRuntimeException; import org.mule.api.lifecycle.Callable; import org.mule.api.model.EntryPointResolver; import org.mule.api.model.InvocationResult; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; import org.mule.util.ClassUtils; import java.lang.reflect.Method; /** * An entrypoint resolver that only allows Service objects that implmement the * Callable interface * * @see org.mule.api.lifecycle.Callable */ public class CallableEntryPointResolver implements EntryPointResolver { protected static final Method callableMethod; static { try { callableMethod = Callable.class.getMethod("onCall", new Class[] {MuleEventContext.class}); } catch (NoSuchMethodException e) { throw new MuleRuntimeException( MessageFactory.createStaticMessage("Panic! No onCall(MuleEventContext) method found in the Callable interface.")); } } public InvocationResult invoke(Object component, MuleEventContext context) throws Exception { if (component instanceof Callable) { Object result = ((Callable) component).onCall(context); return new InvocationResult(result, callableMethod); } else { InvocationResult result = new InvocationResult(InvocationResult.STATE_INVOKE_NOT_SUPPORTED); result.setErrorMessage(ClassUtils.getClassName(getClass()) + ":" + CoreMessages.objectDoesNotImplementInterface(component, Callable.class).toString()); return result; } } public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("CallableEntryPointResolver"); sb.append("{}"); return sb.toString(); } } mule-2.0.1/core/src/main/java/org/mule/model/resolvers/NoSatisfiableMethodsException.java0000644000175000017500000000270010746275214031341 0ustar charlescharles/* * $Id: NoSatisfiableMethodsException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.resolvers; import org.mule.api.MuleException; import org.mule.config.i18n.CoreMessages; /** * NoSatisfiableMethodsException is thrown by EntryPointResolvers when * the service passed has no methods that meet the criteria of the configured * EntryPointResolver. * * @see org.mule.api.model.EntryPointResolver */ public class NoSatisfiableMethodsException extends MuleException { /** Serial version */ private static final long serialVersionUID = -4703387041767867189L; public NoSatisfiableMethodsException(Object component, String methodName) { super(CoreMessages.noEntryPointFoundForNoArgsMethod(component, methodName)); } public NoSatisfiableMethodsException(Object component, Class[] args) { super(CoreMessages.noEntryPointFoundWithArgs(component, args)); } public NoSatisfiableMethodsException(Object component, Class returnType) { super(CoreMessages.noMatchingMethodsOnObjectReturning(component, returnType)); } } mule-2.0.1/core/src/main/java/org/mule/model/direct/0000755000175000017500000000000011351411103021755 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/model/direct/DirectModel.java0000644000175000017500000000142110745677442025043 0ustar charlescharles/* * $Id: DirectModel.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.direct; import org.mule.model.AbstractModel; public class DirectModel extends AbstractModel { /** * Returns the model type name. This is a friendly identifier that is used to * look up the SPI class for the model * * @return the model type */ public String getType() { return "direct"; } } mule-2.0.1/core/src/main/java/org/mule/model/direct/DirectService.java0000644000175000017500000000273210767632003025375 0ustar charlescharles/* * $Id: DirectService.java 11414 2008-03-18 03:16:19Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.direct; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.service.AbstractService; import java.util.List; /** * A direct service invokes the service service directly without any threading, even * when the invocation is asynchronous */ public class DirectService extends AbstractService { /** * Serial version */ private static final long serialVersionUID = -8590955440156945732L; protected List interceptorList = null; public DirectService() { super(); } protected MuleMessage doSend(MuleEvent event) throws MuleException { Object obj = component.onCall(event); if (obj instanceof MuleMessage) { return (MuleMessage) obj; } else { return new DefaultMuleMessage(obj, event.getMessage()); } } protected void doDispatch(MuleEvent event) throws MuleException { component.onCall(event); } } mule-2.0.1/core/src/main/java/org/mule/model/DefaultModelServiceDescriptor.java0000644000175000017500000000411210754365306027314 0ustar charlescharles/* * $Id: DefaultModelServiceDescriptor.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model; import org.mule.api.config.MuleProperties; import org.mule.api.model.Model; import org.mule.api.model.ModelServiceDescriptor; import org.mule.api.registry.AbstractServiceDescriptor; import org.mule.api.registry.ServiceException; import org.mule.config.i18n.CoreMessages; import org.mule.util.BeanUtils; import org.mule.util.ClassUtils; import java.util.Properties; /** * @inheritDocs */ public class DefaultModelServiceDescriptor extends AbstractServiceDescriptor implements ModelServiceDescriptor { private String modelClass; private Properties properties; public DefaultModelServiceDescriptor(String service, Properties properties) { super(service); this.properties = properties; modelClass = removeProperty(MuleProperties.MODEL_CLASS, properties); } public Model createModel() throws ServiceException { if (modelClass != null) { try { Model model = (Model)ClassUtils.instanciateClass(modelClass, ClassUtils.NO_ARGS, getClass()); BeanUtils.populateWithoutFail(model, properties, false); return model; } catch (Exception e) { throw new ServiceException(CoreMessages.failedToCreate(modelClass), e); } } else return null; } public Class getModelClass() throws ServiceException { try { return ClassUtils.getClass(modelClass); } catch (ClassNotFoundException e) { throw new ServiceException(CoreMessages.cannotLoadFromClasspath(modelClass), e); } } } mule-2.0.1/core/src/main/java/org/mule/model/pipeline/0000755000175000017500000000000011351411103022310 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/model/pipeline/PipelineModel.java0000644000175000017500000000143110745677442025732 0ustar charlescharles/* * $Id: PipelineModel.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.pipeline; import org.mule.model.AbstractModel; public class PipelineModel extends AbstractModel { /** * Returns the model type name. This is a friendly identifier that is used to * look up the SPI class for the model * * @return the model type */ public String getType() { return "pipeline"; } } mule-2.0.1/core/src/main/java/org/mule/model/pipeline/PipelineService.java0000644000175000017500000000603010766654216026267 0ustar charlescharles/* * $Id: PipelineService.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.pipeline; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleRuntimeException; import org.mule.api.component.Component; import org.mule.api.transport.DispatchException; import org.mule.component.SimpleCallableJavaComponent; import org.mule.config.i18n.CoreMessages; import org.mule.model.direct.DirectService; public class PipelineService extends DirectService { /** * Serial version */ private static final long serialVersionUID = -2788210157354765190L; public PipelineService() { super(); } protected MuleMessage doSend(MuleEvent event) throws MuleException { try { Object result = component.onCall(event); MuleMessage returnMessage = null; if (result instanceof MuleMessage) { returnMessage = (MuleMessage) result; } else { returnMessage = new DefaultMuleMessage(result, event.getMessage()); } if (!event.isStopFurtherProcessing()) { // // TODO what about this code? // Map context = RequestContext.clearProperties(); // if (context != null) { // returnMessage.addProperties(context); // } if (outboundRouter.hasEndpoints()) { MuleMessage outboundReturnMessage = outboundRouter.route(returnMessage, event.getSession(), event.isSynchronous()); if (outboundReturnMessage != null) { returnMessage = outboundReturnMessage; } } else { logger.debug("Outbound router on service '" + name + "' doesn't have any endpoints configured."); } } return returnMessage; } catch (Exception e) { throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } } protected void doDispatch(MuleEvent event) throws MuleException { sendEvent(event); } // @Override public void setComponent(Component component) { if (!(component instanceof SimpleCallableJavaComponent)) { throw new MuleRuntimeException(CoreMessages.objectNotOfCorrectType(component.getClass(), SimpleCallableJavaComponent.class)); } super.setComponent(component); } } mule-2.0.1/core/src/main/java/org/mule/model/ModelServiceNotFoundException.java0000644000175000017500000000243310745677442027317 0ustar charlescharles/* * $Id: ModelServiceNotFoundException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model; import org.mule.api.model.ModelException; import org.mule.config.i18n.MessageFactory; /** * Is thrown when a model service name is specified and cannot be found or loaded */ public class ModelServiceNotFoundException extends ModelException { /** * Serial version */ private static final long serialVersionUID = -5306713972201495210L; /** * @param location the path of the service */ public ModelServiceNotFoundException(String location) { super(MessageFactory.createStaticMessage(location)); } /** * @param location the path of the service * @param cause the exception that cause this exception to be thrown */ public ModelServiceNotFoundException(String location, Throwable cause) { super(MessageFactory.createStaticMessage(location), cause); } } mule-2.0.1/core/src/main/java/org/mule/transformer/0000755000175000017500000000000011351411105021747 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/transformer/wire/0000755000175000017500000000000011351411104022714 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/transformer/wire/SerializedMuleMessageWireFormat.java0000644000175000017500000000167710754110316032024 0ustar charlescharles/* * $Id: SerializedMuleMessageWireFormat.java 10776 2008-02-11 18:15:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.wire; import org.mule.transformer.simple.ByteArrayToMuleMessage; import org.mule.transformer.simple.MuleMessageToByteArray; /** * Wire format using Java serialization to serialize MuleMessage objects accross the wire */ public class SerializedMuleMessageWireFormat extends TransformerPairWireFormat { public SerializedMuleMessageWireFormat() { setInboundTransformer(new ByteArrayToMuleMessage()); setOutboundTransformer(new MuleMessageToByteArray()); } }mule-2.0.1/core/src/main/java/org/mule/transformer/wire/SerializationWireFormat.java0000644000175000017500000000156710767262171030427 0ustar charlescharles/* * $Id: SerializationWireFormat.java 11377 2008-03-16 18:18:33Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.wire; import org.mule.transformer.simple.ByteArrayToSerializable; import org.mule.transformer.simple.SerializableToByteArray; /** * Wire format using Java serialization */ public class SerializationWireFormat extends TransformerPairWireFormat { public SerializationWireFormat() { setInboundTransformer(new ByteArrayToSerializable()); setOutboundTransformer(new SerializableToByteArray()); } } mule-2.0.1/core/src/main/java/org/mule/transformer/wire/TransformerPairWireFormat.java0000644000175000017500000001046010754110316030705 0ustar charlescharles/* * $Id: TransformerPairWireFormat.java 10776 2008-02-11 18:15:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.wire; import org.mule.api.MuleException; import org.mule.api.DefaultMuleException; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.api.transformer.wire.WireFormat; import org.mule.config.i18n.CoreMessages; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * TODO */ public class TransformerPairWireFormat implements WireFormat { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); protected Transformer inboundTransformer; protected Transformer outboundTransformer; protected Class transferObjectClass; public Object read(InputStream in) throws MuleException { if (inboundTransformer == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("inboundTransformer").getMessage()); } if (inboundTransformer.isSourceTypeSupported(InputStream.class)) { return inboundTransformer.transform(in); } else { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); IOUtils.copy(in, baos); return inboundTransformer.transform(baos.toByteArray()); } catch (IOException e) { throw new DefaultMuleException(CoreMessages.failedToReadPayload(), e); } } } public void write(OutputStream out, Object o, String encoding) throws MuleException { if (outboundTransformer == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("outboundTransformer").getMessage()); } try { Class returnClass = outboundTransformer.getReturnClass(); if (returnClass == null) { logger.warn("No return class was set on transformer: " + outboundTransformer + ". Attempting to work out how to treat the result transformation"); Object result = outboundTransformer.transform(o); byte[] bytes; if (result instanceof byte[]) { bytes = (byte[]) result; } else { bytes = result.toString().getBytes(encoding); } out.write(bytes); } else if (returnClass.equals(byte[].class)) { byte[] b = (byte[]) outboundTransformer.transform(o); out.write(b); } else if (returnClass.equals(String.class)) { String s = (String) outboundTransformer.transform(o); out.write(s.getBytes(encoding)); } else { throw new TransformerException(CoreMessages.transformFailedFrom(o.getClass())); } } catch (IOException e) { throw new TransformerException(CoreMessages.transformFailedFrom(o.getClass()), e); } } public Transformer getInboundTransformer() { return inboundTransformer; } public void setInboundTransformer(Transformer inboundTransformer) { this.inboundTransformer = inboundTransformer; } public Transformer getOutboundTransformer() { return outboundTransformer; } public void setOutboundTransformer(Transformer outboundTransformer) { this.outboundTransformer = outboundTransformer; } public void setTransferObjectClass(Class clazz) { transferObjectClass = clazz; } } mule-2.0.1/core/src/main/java/org/mule/transformer/package.html0000644000175000017500000000024010745677442024254 0ustar charlescharles Provides the default transformer base implementations for Mule including compression and encryption support. mule-2.0.1/core/src/main/java/org/mule/transformer/encryption/0000755000175000017500000000000011351411105024141 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/transformer/encryption/package.html0000644000175000017500000000015110745677442026447 0ustar charlescharles Transformers for encrypting and decrypting message payloads. mule-2.0.1/core/src/main/java/org/mule/transformer/encryption/AbstractEncryptionTransformer.java0000644000175000017500000001120410774254333033063 0ustar charlescharles/* * $Id: AbstractEncryptionTransformer.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.encryption; import org.mule.api.EncryptionStrategy; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.CryptoFailureException; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.AbstractTransformer; import org.mule.util.IOUtils; import java.io.InputStream; import java.io.UnsupportedEncodingException; /** * EncryptionTransformer will transform an array of bytes or string * into an encrypted array of bytes * */ public abstract class AbstractEncryptionTransformer extends AbstractTransformer { private EncryptionStrategy strategy = null; private String strategyName = null; public AbstractEncryptionTransformer() { registerSourceType(byte[].class); registerSourceType(String.class); registerSourceType(InputStream.class); setReturnClass(byte[].class); } // @Override public Object clone() throws CloneNotSupportedException { AbstractEncryptionTransformer clone = (AbstractEncryptionTransformer) super.clone(); /* * The actual strategy is *shared* - not sure if this is right? both shallow * and deep copy make sense - think about security, passwords, required * external authentication dependencies etc. :( */ clone.setStrategy(strategy); clone.setStrategyName(strategyName); return clone; } public Object doTransform(Object src, String encoding) throws TransformerException { byte[] buf; if (src instanceof String) { buf = src.toString().getBytes(); } else if (src instanceof InputStream) { InputStream input = (InputStream) src; try { buf = IOUtils.toByteArray(input); } finally { IOUtils.closeQuietly(input); } } else { buf = (byte[]) src; } try { byte[] result = getTransformedBytes(buf); if (getReturnClass().equals(String.class)) { if (encoding != null) { try { return new String(result, encoding); } catch (UnsupportedEncodingException ex) { return new String(result); } } else { return new String(result); } } else { return result; } } catch (CryptoFailureException e) { throw new TransformerException(this, e); } } protected abstract byte[] getTransformedBytes(byte[] buffer) throws CryptoFailureException; /** * Template method were deriving classes can do any initialisation after the * properties have been set on this transformer * * @throws org.mule.api.lifecycle.InitialisationException */ public void initialise() throws InitialisationException { if (strategyName != null) { if (endpoint.getMuleContext().getSecurityManager() == null) { if (strategy == null) { throw new InitialisationException(CoreMessages.authSecurityManagerNotSet(), this); } } else { strategy = endpoint.getMuleContext().getSecurityManager().getEncryptionStrategy(strategyName); } } if (strategy == null) { throw new InitialisationException(CoreMessages.encryptionStrategyNotSet(), this); } } public EncryptionStrategy getStrategy() { return strategy; } public void setStrategy(EncryptionStrategy strategy) { this.strategy = strategy; } public String getStrategyName() { return strategyName; } public void setStrategyName(String strategyName) { this.strategyName = strategyName; } } mule-2.0.1/core/src/main/java/org/mule/transformer/encryption/DecryptionTransformer.java0000644000175000017500000000157210745677442031404 0ustar charlescharles/* * $Id: DecryptionTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.encryption; import org.mule.api.security.CryptoFailureException; /** * EncryptionTransformer will transform an encrypted array of bytes or * string into an decrypted array of bytes */ public class DecryptionTransformer extends AbstractEncryptionTransformer { protected byte[] getTransformedBytes(byte[] buffer) throws CryptoFailureException { return getStrategy().decrypt(buffer, null); } } mule-2.0.1/core/src/main/java/org/mule/transformer/encryption/EncryptionTransformer.java0000644000175000017500000000156010745677442031413 0ustar charlescharles/* * $Id: EncryptionTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.encryption; import org.mule.api.security.CryptoFailureException; /** * EncryptionTransformer will transform an array of bytes or string * into an encrypted array of bytes */ public class EncryptionTransformer extends AbstractEncryptionTransformer { protected byte[] getTransformedBytes(byte[] buffer) throws CryptoFailureException { return getStrategy().encrypt(buffer, null); } } mule-2.0.1/core/src/main/java/org/mule/transformer/AbstractDiscoverableTransformer.java0000644000175000017500000000162110745677442031153 0ustar charlescharles/* * $Id: AbstractDiscoverableTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.api.transformer.DiscoverableTransformer; public abstract class AbstractDiscoverableTransformer extends AbstractTransformer implements DiscoverableTransformer { private int priorityWeighting = DEFAULT_PRIORITY_WEIGHTING; public int getPriorityWeighting() { return priorityWeighting; } public void setPriorityWeighting(int weighting) { priorityWeighting = weighting; } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/0000755000175000017500000000000011351411105023240 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/transformer/simple/SerializableToByteArray.java0000644000175000017500000000520210745677442030666 0ustar charlescharles/* * $Id: SerializableToByteArray.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.MuleMessage; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import java.io.Serializable; import org.apache.commons.lang.SerializationUtils; /** * SerializableToByteArray converts a serializable object or a String * to a byte array. If MuleMessage is configured as a source type on this * transformer by calling setAcceptUMOMessage(true) then the MuleMessage * will be serialised. This is useful for transports such as TCP where the message * headers would normally be lost. */ public class SerializableToByteArray extends AbstractTransformer implements DiscoverableTransformer { private int priorityWeighting = DiscoverableTransformer.DEFAULT_PRIORITY_WEIGHTING; public SerializableToByteArray() { this.registerSourceType(Serializable.class); this.setReturnClass(byte[].class); } public boolean isAcceptUMOMessage() { return this.isSourceTypeSupported(MuleMessage.class, true); } public void setAcceptUMOMessage(boolean value) { if (value) { this.registerSourceType(MuleMessage.class); } else { this.unregisterSourceType(MuleMessage.class); } } public Object doTransform(Object src, String encoding) throws TransformerException { /* * If the MuleMessage source type has been registered then we can assume that * the whole message is to be serialised, not just the payload. This can be * useful for protocols such as tcp where the protocol does not support * headers and the whole message needs to be serialized. */ try { return SerializationUtils.serialize((Serializable) src); } catch (Exception e) { throw new TransformerException(this, e); } } public int getPriorityWeighting() { return priorityWeighting; } public void setPriorityWeighting(int priorityWeighting) { this.priorityWeighting = priorityWeighting; } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/ByteArrayToHexString.java0000644000175000017500000000375610766014216030172 0ustar charlescharles/* * $Id: ByteArrayToHexString.java 11336 2008-03-12 17:53:18Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import org.mule.util.IOUtils; import org.mule.util.StringUtils; import java.io.InputStream; /** * Converts a Byte array to a Hex String. */ public class ByteArrayToHexString extends AbstractTransformer { private volatile boolean upperCase = false; public ByteArrayToHexString() { registerSourceType(byte[].class); registerSourceType(InputStream.class); setReturnClass(String.class); } public boolean getUpperCase() { return upperCase; } public void setUpperCase(boolean value) { upperCase = value; } protected Object doTransform(Object src, String encoding) throws TransformerException { if (src == null) { return StringUtils.EMPTY; } try { byte[] bytes = null; if (src instanceof InputStream) { InputStream input = (InputStream) src; try { bytes = IOUtils.toByteArray(input); } finally { IOUtils.closeQuietly(input); } } else { bytes = (byte[]) src; } return StringUtils.toHexString(bytes, upperCase); } catch (Exception ex) { throw new TransformerException(this, ex); } } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/package.html0000644000175000017500000000011710745677442025550 0ustar charlescharles Basic transformer implementations. mule-2.0.1/core/src/main/java/org/mule/transformer/simple/GetBeanProperty.java0000644000175000017500000000332410745677442027207 0ustar charlescharles/* * $Id: GetBeanProperty.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import org.apache.commons.beanutils.PropertyUtils; /** * Looks up a property from a JavaBean using PropertyUtils.getProperty(). * Nested properties are valid, assuming they follow JavaBean conventions. * * * * * * */ public class GetBeanProperty extends AbstractTransformer { private String propertyName; public GetBeanProperty() { super(); registerSourceType(Object.class); setReturnClass(Object.class); } public Object doTransform(Object src, String encoding) throws TransformerException { try { return PropertyUtils.getProperty(src, this.propertyName); } catch (Exception e) { throw new TransformerException(this, e); } } public String getPropertyName() { return propertyName; } public void setPropertyName(String propertyName) { this.propertyName = propertyName; } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/MessagePropertiesTransformer.java0000644000175000017500000001610610776731310032010 0ustar charlescharles/* * $Id: MessagePropertiesTransformer.java 11536 2008-04-08 18:00:40Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractMessageAwareTransformer; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; /** * A configurable message transformer that allows users to add, overwrite and delete * properties on the current message. Users can set a {@link List} of * 'deleteProperties' names to remove from the message and can also set a {@link Map} * of 'addProperties' that will be added to the message and possibly overwrite * existing properties with the same name.

    If {@link #overwrite} is set to * false, and a property exists on the message (even if the value is * null, it will be left intact. The transformer then acts as a more * gentle 'enricher'. The default setting is true. */ public class MessagePropertiesTransformer extends AbstractMessageAwareTransformer { private List deleteProperties = null; private Map addProperties = null; /** the properties map containing rename mappings for message properties */ private Map renameProperties; private boolean overwrite = true; public MessagePropertiesTransformer() { registerSourceType(Object.class); setReturnClass(Object.class); } // @Override public Object clone() throws CloneNotSupportedException { MessagePropertiesTransformer clone = (MessagePropertiesTransformer)super.clone(); if (deleteProperties != null) { clone.setDeleteProperties(new ArrayList(deleteProperties)); } if (addProperties != null) { clone.setAddProperties(new HashMap(addProperties)); } if (renameProperties != null) { clone.setRenameProperties(new HashMap(renameProperties)); } return clone; } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { if (deleteProperties != null && deleteProperties.size() > 0) { for (Iterator iterator = deleteProperties.iterator(); iterator.hasNext();) { message.removeProperty(iterator.next().toString()); } } if (addProperties != null && addProperties.size() > 0) { final Set propertyNames = message.getPropertyNames(); for (Iterator iterator = addProperties.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry)iterator.next(); if (entry.getKey() == null) { logger.error("Setting Null property keys is not supported, this entry is being ignored"); } else { final String key = entry.getKey().toString(); final Object value = entry.getValue(); if (overwrite) { if (logger.isDebugEnabled()) { if (!propertyNames.contains(key)) { logger.debug("Overwriting message property " + key); } } message.setProperty(key, value); } else { if (propertyNames.contains(key)) { if (logger.isDebugEnabled()) { logger.debug(MessageFormat.format( "Message already contains the property and overwrite is false, skipping: key={0}, value={1}", new Object[]{key, value})); } } } } } } /* perform renaming transformation */ if (this.renameProperties != null && this.renameProperties.size() > 0) { final Set propertyNames = message.getPropertyNames(); for (Iterator iterator = this.renameProperties.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry)iterator.next(); if (entry.getKey() == null) { logger.error("Setting Null property keys is not supported, this entry is being ignored"); } else { final String key = entry.getKey().toString(); final String value = (String)entry.getValue(); if (value == null) { logger.error("Setting Null property values for renameProperties is not supported, this entry is being ignored"); } else { /* log transformation */ if (logger.isDebugEnabled() && !propertyNames.contains(key)) { logger.debug("renaming message property " + key + " to " + value); } /* * store current value of the property. then remove key and * store value under new key */ Object propValue = message.getProperty(key); message.removeProperty(key); message.setProperty(value, propValue); } } } } return message; } public List getDeleteProperties() { return deleteProperties; } public void setDeleteProperties(List deleteProperties) { this.deleteProperties = deleteProperties; } public Map getAddProperties() { return addProperties; } public void setAddProperties(Map addProperties) { this.addProperties = addProperties; } /** * @return the renameProperties */ public Map getRenameProperties() { return this.renameProperties; } /** * @param renameProperties the renameProperties to set */ public void setRenameProperties(Map renameProperties) { this.renameProperties = renameProperties; } public boolean isOverwrite() { return overwrite; } public void setOverwrite(final boolean overwrite) { this.overwrite = overwrite; } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/ExpressionTransformer.java0000644000175000017500000001510310774254333030505 0ustar charlescharles/* * $Id: ExpressionTransformer.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.util.expression.ExpressionEvaluatorManager; import org.mule.util.expression.ExpressionRuntimeException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * This transformer will evaluate one or more expressions on the current message and return the * results as an Array. If only one expression is defined it will return the object returned from * the expression. *

    * You can use expressions to extract *

      *
    • headers (single, map or list)
    • *
    • attachments (single, map or list)
    • *
    • payload
    • *
    • xpath
    • *
    • groovy
    • *
    • bean
    • *
    * and more. *

    * This transformer provides a very powerful way to pull different bits of information from the * message and pass them to the service. */ public class ExpressionTransformer extends AbstractMessageAwareTransformer { private List arguments; public ExpressionTransformer() { //No type checking by default registerSourceType(Object.class); setReturnClass(Object.class); arguments = new ArrayList(4); } public void addArgument(Argument argument) { arguments.add(argument); } public boolean removeArgument(Argument argument) { return arguments.remove(argument); } /** * Template method were deriving classes can do any initialisation after the * properties have been set on this transformer * * @throws org.mule.api.lifecycle.InitialisationException * */ //@Override public void initialise() throws InitialisationException { if(arguments==null || arguments.size()==0) { throw new InitialisationException(CoreMessages.objectIsNull("arguments[]"), this); } for (Iterator iterator = arguments.iterator(); iterator.hasNext();) { Argument argument = (Argument) iterator.next(); try { argument.validate(); } catch (Exception e) { throw new InitialisationException(e, this); } } } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { Object results[] = new Object[arguments.size()]; int i =0; for (Iterator iterator = arguments.iterator(); iterator.hasNext();i++) { Argument argument = (Argument) iterator.next(); try { results[i] = ExpressionEvaluatorManager.evaluate(argument.getFullExpression(), message); } catch (ExpressionRuntimeException e) { throw new TransformerException(this, e); } if(!argument.isOptional() && results[i]==null) { throw new TransformerException(CoreMessages.expressionEvaluatorReturnedNull( argument.getEvaluator(), argument.getExpression()), this); } } if(results.length==1) { return results[0]; } else { return results; } } public List getArguments() { return arguments; } public void setArguments(List arguments) { this.arguments = arguments; } public static class Argument { public static final String EVAL_TOKEN = ":"; private String expression; private String evaluator; private String customEvaluator; private boolean optional; public Argument() { } public String getCustomEvaluator() { return customEvaluator; } public void setCustomEvaluator(String customEvaluator) { this.customEvaluator = customEvaluator; } public String getEvaluator() { return evaluator; } public void setEvaluator(String evaluator) { this.evaluator = evaluator; } public String getExpression() { return expression; } public void setExpression(String expression) { this.expression = expression; } public boolean isOptional() { return optional; } public void setOptional(boolean optional) { this.optional = optional; } protected String getFullExpression() { //Sprecial handling of these evaluators since they don't retuen nul if some headers or attachments were found if(!optional && ( evaluator.equals("headers") || evaluator.equals("headers-list") || (evaluator.equals("attachments") || evaluator.equals("attachments-list")))) { return evaluator + EVAL_TOKEN + expression + "required"; } return evaluator + EVAL_TOKEN + expression; } protected void validate() { if(expression==null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("expression").getMessage()); } if(evaluator ==null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("evaluator").getMessage()); } if(evaluator.equals("custom")) { if(customEvaluator==null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("customEvaluator").getMessage()); } else { evaluator = customEvaluator; } } if(!ExpressionEvaluatorManager.isEvaluatorRegistered(evaluator)) { throw new IllegalArgumentException(CoreMessages.expressionEvaluatorNotRegistered(evaluator).getMessage()); } } } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/StringToObjectArray.java0000644000175000017500000000461110765525116030024 0ustar charlescharles/* * $Id: StringToObjectArray.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import org.mule.util.IOUtils; import org.mule.util.StringUtils; import java.io.InputStream; /** * StringToObjectArray converts a String into an object array. This * is useful in certain situations, as when a string needs to be converted into * an Object[] in order to be passed to a SOAP service. The input String is parsed * into the array based on a configurable delimiter - default is a space. */ public class StringToObjectArray extends AbstractTransformer { private String delimiter = null; private static final String DEFAULT_DELIMITER = " "; public StringToObjectArray() { registerSourceType(String.class); registerSourceType(byte[].class); registerSourceType(InputStream.class); setReturnClass(Object[].class); } public Object doTransform(Object src, String encoding) throws TransformerException { String in; if (src instanceof byte[]) { in = new String((byte[])src); } else if (src instanceof InputStream) { InputStream input = (InputStream) src; try { in = IOUtils.toString(input); } finally { IOUtils.closeQuietly(input); } } else { in = (String)src; } String[] out = StringUtils.splitAndTrim(in, getDelimiter()); return out; } /** * @return the delimiter */ public String getDelimiter() { if (delimiter == null) { return DEFAULT_DELIMITER; } else { return delimiter; } } /** * @param delimiter the delimiter */ public void setDelimiter(String delimiter) { this.delimiter = delimiter; } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/MapLookup.java0000644000175000017500000000326510745677442026050 0ustar charlescharles/* * $Id: MapLookup.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.MessageFactory; import org.mule.transformer.AbstractTransformer; import java.util.Map; /** * MapLookup looks up and returns an object from a Map based on a key. */ public class MapLookup extends AbstractTransformer { protected volatile Object key; public MapLookup() { registerSourceType(Map.class); setReturnClass(Object.class); } public Object doTransform(Object src, String encoding) throws TransformerException { if (src instanceof Map) { if (key != null) { return ((Map) src).get(key); } else { throw new TransformerException(MessageFactory .createStaticMessage("Property 'key' must be set in order to use this transformer.")); } } else { throw new TransformerException(MessageFactory .createStaticMessage("Message to transform must be of type java.util.Map")); } } public Object getKey() { return key; } public void setKey(Object key) { this.key = key; } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/ByteArrayToMuleMessage.java0000644000175000017500000000126610755024144030457 0ustar charlescharles/* * $Id: ByteArrayToMuleMessage.java 10802 2008-02-14 11:39:16Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.MuleMessage; /** TODO */ public class ByteArrayToMuleMessage extends ByteArrayToSerializable { public ByteArrayToMuleMessage() { super(); setReturnClass(MuleMessage.class); } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/AutoTransformer.java0000644000175000017500000000340011002221467027236 0ustar charlescharles/* * $Id: AutoTransformer.java 11604 2008-04-18 22:39:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; /** * A transformer that uses the transform discovery mechanism to convert the message payload. This transformer * works much better when transforming custom object types rather that java types since there is less chance for * ambiguity. * If an exact match cannot be made an execption will be thrown. */ public class AutoTransformer extends AbstractMessageAwareTransformer { /** * Template method where deriving classes can do any initialisation after the * properties have been set on this transformer * * @throws org.mule.api.lifecycle.InitialisationException * */ //@Override public void initialise() throws InitialisationException { super.initialise(); if(getReturnClass().equals(Object.class)) { throw new InitialisationException(CoreMessages.transformerInvalidReturnType(Object.class, getName()), this); } } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { return message.getPayload(getReturnClass()); } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/StringAppendTransformer.java0000644000175000017500000000376210765525116030754 0ustar charlescharles/* * $Id: StringAppendTransformer.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import org.mule.util.IOUtils; import org.mule.util.StringUtils; import java.io.InputStream; public class StringAppendTransformer extends AbstractTransformer { private String message = StringUtils.EMPTY; public StringAppendTransformer() { this(StringUtils.EMPTY); } public StringAppendTransformer(String message) { this.message = message; setReturnClass(String.class); registerSourceType(String.class); registerSourceType(byte[].class); registerSourceType(InputStream.class); } protected Object doTransform(Object src, String encoding) throws TransformerException { String string; if (src instanceof byte[]) { string = new String((byte[]) src); } else if (src instanceof InputStream) { InputStream input = (InputStream) src; try { string = IOUtils.toString(input); } finally { IOUtils.closeQuietly(input); } } else { string = (String) src; } return append(message, string); } public static String append(String append, String msg) { return msg + append; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } }mule-2.0.1/core/src/main/java/org/mule/transformer/simple/ByteArrayToObject.java0000644000175000017500000000607610766014216027463 0ustar charlescharles/* * $Id: ByteArrayToObject.java 11336 2008-03-12 17:53:18Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; import java.io.ObjectStreamConstants; import java.io.PushbackInputStream; import java.io.UnsupportedEncodingException; /** * ByteArrayToObject works in the same way as * ByteArrayToSerializable but checks if the byte array is a * serialised object and if not will return a String created from the bytes as the * returnType on the transformer. */ public class ByteArrayToObject extends ByteArrayToSerializable { // @Override public Object doTransform(Object src, String encoding) throws TransformerException { if (src instanceof byte[]) { byte[] bytes = (byte[])src; if (this.checkStreamHeader(bytes[0])) { return super.doTransform(src, encoding); } else { try { return new String(bytes, encoding); } catch (UnsupportedEncodingException e) { throw new TransformerException(this, e); } } } else if (src instanceof InputStream) { try { PushbackInputStream pushbackStream = new PushbackInputStream((InputStream)src); int firstByte = pushbackStream.read(); pushbackStream.unread((byte)firstByte); if (this.checkStreamHeader((byte)firstByte)) { return super.doTransform(pushbackStream, encoding); } else { try { return IOUtils.toString(pushbackStream, encoding); } finally { // this also closes the underlying stream that's stored in src pushbackStream.close(); } } } catch (IOException iox) { throw new TransformerException(this, iox); } } else { throw new TransformerException(CoreMessages.transformOnObjectUnsupportedTypeOfEndpoint( this.getName(), src.getClass(), endpoint)); } } private boolean checkStreamHeader(byte firstByte) { return (firstByte == (byte)((ObjectStreamConstants.STREAM_MAGIC >>> 8) & 0xFF)); } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/ByteArrayToSerializable.java0000644000175000017500000000376010766014216030660 0ustar charlescharles/* * $Id: ByteArrayToSerializable.java 11336 2008-03-12 17:53:18Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.AbstractTransformer; import java.io.InputStream; import org.apache.commons.lang.SerializationUtils; /** * ByteArrayToSerializable converts a serialized object to its object * representation */ public class ByteArrayToSerializable extends AbstractTransformer implements DiscoverableTransformer { /** Give core transformers a slighty higher priority */ private int priorityWeighting = DiscoverableTransformer.DEFAULT_PRIORITY_WEIGHTING + 1; public ByteArrayToSerializable() { registerSourceType(byte[].class); registerSourceType(InputStream.class); } public Object doTransform(Object src, String encoding) throws TransformerException { try { if (src instanceof byte[]) { return SerializationUtils.deserialize((byte[]) src); } else { return SerializationUtils.deserialize((InputStream) src); } } catch (Exception e) { throw new TransformerException( CoreMessages.transformFailed("byte[]", "Object"), this, e); } } public int getPriorityWeighting() { return priorityWeighting; } public void setPriorityWeighting(int priorityWeighting) { this.priorityWeighting = priorityWeighting; } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/ObjectToString.java0000644000175000017500000000610510745677442027035 0ustar charlescharles/* * $Id: ObjectToString.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.AbstractTransformer; import org.mule.util.IOUtils; import org.mule.util.StringMessageUtils; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; /** * ObjectToString transformer is useful for debugging. It will return * human-readable output for various kinds of objects. Right now, it is just coded to * handle Map and Collection objects. Others will be added. */ public class ObjectToString extends AbstractTransformer implements DiscoverableTransformer { protected static final int DEFAULT_BUFFER_SIZE = 80; /** Give core transformers a slighty higher priority */ private int priorityWeighting = DiscoverableTransformer.DEFAULT_PRIORITY_WEIGHTING + 1; public ObjectToString() { registerSourceType(Object.class); registerSourceType(byte[].class); registerSourceType(InputStream.class); setReturnClass(String.class); } public Object doTransform(Object src, String encoding) throws TransformerException { String output = ""; if (src instanceof InputStream) { InputStream is = (InputStream) src; try { ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); IOUtils.copy(is, byteOut); output = new String(byteOut.toByteArray(), encoding); } catch (IOException e) { throw new TransformerException(CoreMessages.errorReadingStream(), e); } finally { try { is.close(); } catch (IOException e) { logger.warn("Could not close stream", e); } } } else if (src instanceof byte[]) { try { output = new String((byte[]) src, encoding); } catch (UnsupportedEncodingException e) { throw new TransformerException(this, e); } } else { output = StringMessageUtils.toString(src); } return output; } public int getPriorityWeighting() { return priorityWeighting; } public void setPriorityWeighting(int priorityWeighting) { this.priorityWeighting = priorityWeighting; } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/HexStringToByteArray.java0000644000175000017500000000240010745677442030170 0ustar charlescharles/* * $Id: HexStringToByteArray.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import org.mule.util.ArrayUtils; import org.mule.util.StringUtils; /** * Converts a Hex String to a Byte array */ public class HexStringToByteArray extends AbstractTransformer { public HexStringToByteArray() { registerSourceType(String.class); setReturnClass(byte[].class); } protected Object doTransform(Object src, String encoding) throws TransformerException { if (src == null) { return ArrayUtils.EMPTY_BYTE_ARRAY; } try { return StringUtils.hexStringToByteArray((String) src); } catch (Exception ex) { throw new TransformerException(this, ex); } } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/ObjectToInputStream.java0000644000175000017500000000376510754365306030044 0ustar charlescharles/* * $Id: ObjectToInputStream.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.RequestContext; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.OutputHandler; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; /** * ObjectToInputStream converts serilaizable object to a input stream but * treats java.lang.String differently by converting to bytes using * the String.getBytrs() method. */ public class ObjectToInputStream extends SerializableToByteArray { public ObjectToInputStream() { this.registerSourceType(String.class); this.registerSourceType(OutputHandler.class); setReturnClass(InputStream.class); } // @Override public Object doTransform(Object src, String encoding) throws TransformerException { try { if (src instanceof String) { return new ByteArrayInputStream(((String) src).getBytes(encoding)); } else if (src instanceof OutputHandler) { OutputHandler oh = (OutputHandler) src; ByteArrayOutputStream out = new ByteArrayOutputStream(); oh.write(RequestContext.getEvent(), out); return new ByteArrayInputStream(out.toByteArray()); } } catch (Exception e) { throw new TransformerException(this, e); } byte[] bytes = (byte[]) super.doTransform(src, encoding); return new ByteArrayInputStream(bytes); } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/ObjectArrayToString.java0000644000175000017500000000464110745677442030037 0ustar charlescharles/* * $Id: ObjectArrayToString.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; import org.mule.util.StringUtils; /** * ObjectArrayToString transformer is the opposite of * StringToObjectArray - it simply converts Object[] to a String in which each * element is separated by a configurable delimiter (default is a space). */ public class ObjectArrayToString extends AbstractTransformer implements DiscoverableTransformer { /** Give core transformers a slighty higher priority */ private int priorityWeighting = DiscoverableTransformer.DEFAULT_PRIORITY_WEIGHTING + 1; private static final String DEFAULT_DELIMITER = " "; private String delimiter = null; public ObjectArrayToString() { registerSourceType(Object[].class); setReturnClass(String.class); } public Object doTransform(Object src, String encoding) throws TransformerException { if (src == null) { return src; } Object[] in = (Object[]) src; String out = StringUtils.join(in, getDelimiter()); /* for (int i = 0; i < in.length; i++) { if (in[i] != null) { if (i > 0) out += getDelimiter(); out += in[i].toString(); } } */ return out; } /** @return the delimiter */ public String getDelimiter() { if (delimiter == null) { return DEFAULT_DELIMITER; } else { return delimiter; } } /** @param sets the delimiter */ public void setDelimiter(String delimiter) { this.delimiter = delimiter; } public int getPriorityWeighting() { return priorityWeighting; } public void setPriorityWeighting(int priorityWeighting) { this.priorityWeighting = priorityWeighting; } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/ObjectToByteArray.java0000644000175000017500000000365410766014216027462 0ustar charlescharles/* * $Id: ObjectToByteArray.java 11336 2008-03-12 17:53:18Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.TransformerException; import org.mule.util.IOUtils; import java.io.ByteArrayOutputStream; import java.io.InputStream; /** * ObjectToByteArray converts serilaizable object to a byte array but * treats java.lang.String differently by converting to bytes using * the String.getBytrs() method. */ public class ObjectToByteArray extends SerializableToByteArray { public ObjectToByteArray() { this.registerSourceType(InputStream.class); this.registerSourceType(String.class); setReturnClass(byte[].class); } // @Override public Object doTransform(Object src, String encoding) throws TransformerException { try { if (src instanceof String) { return src.toString().getBytes(encoding); } else if (src instanceof InputStream) { InputStream is = (InputStream) src; ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); try { IOUtils.copyLarge(is, byteOut); } finally { is.close(); } return byteOut.toByteArray(); } } catch (Exception e) { throw new TransformerException(this, e); } return super.doTransform(src, encoding); } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/ObjectToOutputHandler.java0000755000175000017500000000674410763632552030372 0ustar charlescharles/* * $Id: ObjectToOutputHandler.java 11189 2008-03-06 00:06:02Z dandiep $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.MuleEvent; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.OutputHandler; import org.mule.config.i18n.MessageFactory; import org.mule.transformer.AbstractTransformer; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Serializable; import org.apache.commons.lang.SerializationUtils; /** ObjectToOutputHandler converts a byte array into a String. */ public class ObjectToOutputHandler extends AbstractTransformer implements DiscoverableTransformer { /** Give core transformers a slighty higher priority */ private int priorityWeighting = DiscoverableTransformer.DEFAULT_PRIORITY_WEIGHTING + 1; public ObjectToOutputHandler() { registerSourceType(byte[].class); registerSourceType(String.class); registerSourceType(InputStream.class); registerSourceType(Serializable.class); setReturnClass(OutputHandler.class); } public Object doTransform(final Object src, final String encoding) throws TransformerException { if (src instanceof String) { return new OutputHandler() { public void write(MuleEvent event, OutputStream out) throws IOException { out.write(((String) src).getBytes(encoding)); } }; } else if (src instanceof byte[]) { return new OutputHandler() { public void write(MuleEvent event, OutputStream out) throws IOException { out.write((byte[]) src); } }; } else if (src instanceof InputStream) { return new OutputHandler() { public void write(MuleEvent event, OutputStream out) throws IOException { InputStream is = (InputStream) src; try { IOUtils.copyLarge(is, out); } finally { is.close(); } } }; } else if (src instanceof Serializable) { return new OutputHandler() { public void write(MuleEvent event, OutputStream out) throws IOException { SerializationUtils.serialize((Serializable) src, out); } }; } else { throw new TransformerException(MessageFactory .createStaticMessage("Unable to convert " + src.getClass() + " to OutputHandler.")); } } public int getPriorityWeighting() { return priorityWeighting; } public void setPriorityWeighting(int priorityWeighting) { this.priorityWeighting = priorityWeighting; } } mule-2.0.1/core/src/main/java/org/mule/transformer/simple/MuleMessageToByteArray.java0000644000175000017500000000205010754110316030443 0ustar charlescharles/* * $Id: MuleMessageToByteArray.java 10776 2008-02-11 18:15:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractMessageAwareTransformer; import org.apache.commons.lang.SerializationUtils; /** TODO */ public class MuleMessageToByteArray extends AbstractMessageAwareTransformer { public MuleMessageToByteArray() { registerSourceType(MuleMessage.class); setReturnClass(byte[].class); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { return SerializationUtils.serialize(message); } } mule-2.0.1/core/src/main/java/org/mule/transformer/TransformerWeighting.java0000644000175000017500000001610010776735352027007 0ustar charlescharles/* * $Id: TransformerWeighting.java 11542 2008-04-08 18:35:22Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.Transformer; import java.util.Iterator; import java.util.List; /** * Given a {@link org.mule.api.transformer.Transformer} instance, an input class and output class * this object will create a weighting for a transformer. This weighthing can be used compare one transformer with * another, which can be useful for choosing a transformer to use given the input class and required output class. */ public class TransformerWeighting implements Comparable { private Transformer transformer; private int inputWeighting; private int outputWeighting; private Class inputClass; private Class outputClass; public TransformerWeighting(Class inputClass, Class outputClass, Transformer transformer) { this.inputClass = inputClass; this.outputClass = outputClass; this.transformer = transformer; init(); } private void init() { inputWeighting = Integer.MAX_VALUE; List sourceTypes = transformer.getSourceTypes(); for (Iterator iterator = sourceTypes.iterator(); iterator.hasNext();) { Class aClass = (Class) iterator.next(); int weighting = getWeighting(-1, inputClass, aClass); if (weighting < inputWeighting && weighting != -1) { inputWeighting = weighting; } } outputWeighting = getWeighting(-1, outputClass, transformer.getReturnClass()); inputWeighting = (inputWeighting == Integer.MAX_VALUE ? -1 : inputWeighting); outputWeighting = (outputWeighting == Integer.MAX_VALUE ? -1 : outputWeighting); } protected int getWeighting(int weighting, Class src, Class dest) { int x = weighting + 1; if (dest.equals(src)) { return x; } else if (!dest.isAssignableFrom(src)) { return -1; } else if (src.getInterfaces().length > 0) { for (int i = 0; i < src.getInterfaces().length; i++) { Class aClass = src.getInterfaces()[i]; if (dest.equals(aClass)) { return x; } } return x + 1; } else if (src.getSuperclass() != null) { return getWeighting(x, src.getSuperclass(), dest); } return x; } public Class getInputClass() { return inputClass; } public int getInputWeighting() { return inputWeighting; } public Class getOutputClass() { return outputClass; } public int getOutputWeighting() { return outputWeighting; } public Transformer getTransformer() { return transformer; } public boolean isExactMatch() { return inputWeighting == 0 && outputWeighting == 0; } public boolean isNotMatch() { return inputWeighting == -1 || outputWeighting == -1; } public int compareTo(Object o) { TransformerWeighting weighting = (TransformerWeighting) o; if (weighting.getInputWeighting() == getInputWeighting() && weighting.getOutputWeighting() == getOutputWeighting()) { //We only check the weighting if we have an exact match //These transformers should always implement DiscoverableTransformer, but jic we check here if (weighting.getTransformer() instanceof DiscoverableTransformer && this.getTransformer() instanceof DiscoverableTransformer) { int x = ((DiscoverableTransformer) weighting.getTransformer()).getPriorityWeighting(); int y = ((DiscoverableTransformer) this.getTransformer()).getPriorityWeighting(); if (x > y) { return -1; } if (x < y) { return 1; } return 0; } else { return 0; } } else { if (isNotMatch()) { return -1; } else if (weighting.isNotMatch() && !isNotMatch()) { return 1; } else if (weighting.isExactMatch() && !isExactMatch()) { return -1; } else if (weighting.getInputWeighting() < getInputWeighting() && weighting.getOutputWeighting() < getOutputWeighting()) { return -1; } //If the outputWeighting is closer to 0 its a better match else if (weighting.getInputWeighting() == getInputWeighting() && weighting.getOutputWeighting() < getOutputWeighting()) { return -1; } else if (weighting.getInputWeighting() < getInputWeighting() && weighting.getOutputWeighting() == getOutputWeighting()) { return -1; } return 1; } } public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TransformerWeighting that = (TransformerWeighting) o; if (inputClass != null ? !inputClass.equals(that.inputClass) : that.inputClass != null) { return false; } if (outputClass != null ? !outputClass.equals(that.outputClass) : that.outputClass != null) { return false; } return true; } public int hashCode() { int result; result = (transformer != null ? transformer.hashCode() : 0); result = 31 * result + inputWeighting; result = 31 * result + outputWeighting; result = 31 * result + (inputClass != null ? inputClass.hashCode() : 0); result = 31 * result + (outputClass != null ? outputClass.hashCode() : 0); return result; } public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("TransformerWeighting"); sb.append("{inputClass=").append(inputClass); sb.append(", inputWeighting=").append(inputWeighting); sb.append(", outputClass=").append(outputClass); sb.append(", outputWeighting=").append(outputWeighting); sb.append(", transformer=").append(transformer.getName()); sb.append('}'); return sb.toString(); } } mule-2.0.1/core/src/main/java/org/mule/transformer/codec/0000755000175000017500000000000011351411105023024 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/transformer/codec/package.html0000644000175000017500000000014210745677442025332 0ustar charlescharles Transformers for Base64, UC and UU encoding/decoding. mule-2.0.1/core/src/main/java/org/mule/transformer/codec/Base64Decoder.java0000644000175000017500000000426010766014216026216 0ustar charlescharles/* * $Id: Base64Decoder.java 11336 2008-03-12 17:53:18Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.codec; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.AbstractTransformer; import org.mule.util.Base64; import org.mule.util.IOUtils; import java.io.InputStream; /** * Base64Encoder transforms Base64 encoded data into strings or byte * arrays. */ public class Base64Decoder extends AbstractTransformer { public Base64Decoder() { registerSourceType(String.class); registerSourceType(byte[].class); registerSourceType(InputStream.class); setReturnClass(byte[].class); } public Object doTransform(Object src, String encoding) throws TransformerException { try { String data; if (src instanceof byte[]) { data = new String((byte[]) src, encoding); } else if (src instanceof InputStream) { InputStream input = (InputStream) src; try { data = IOUtils.toString(input); } finally { input.close(); } } else { data = (String) src; } byte[] result = Base64.decode(data); if (getReturnClass().equals(String.class)) { return new String(result, encoding); } else { return result; } } catch (Exception ex) { throw new TransformerException( CoreMessages.transformFailed("base64", this.getReturnClass().getName()), this, ex); } } } mule-2.0.1/core/src/main/java/org/mule/transformer/codec/XmlEntityEncoder.java0000644000175000017500000000340410765525116027145 0ustar charlescharles/* * $Id: XmlEntityEncoder.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.codec; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.AbstractTransformer; import org.mule.util.XMLEntityCodec; import java.io.InputStream; import org.apache.commons.io.IOUtils; /** * Encodes a string with XML entities */ public class XmlEntityEncoder extends AbstractTransformer { public XmlEntityEncoder() { registerSourceType(String.class); registerSourceType(byte[].class); registerSourceType(InputStream.class); setReturnClass(String.class); } public Object doTransform(Object src, String encoding) throws TransformerException { try { String data; if (src instanceof byte[]) { data = new String((byte[]) src, encoding); } else if (src instanceof InputStream) { data = IOUtils.toString((InputStream)src); } else { data = (String) src; } return XMLEntityCodec.encodeString(data); } catch (Exception ex) { throw new TransformerException( CoreMessages.transformFailed(src.getClass().getName(), "XML"), this, ex); } } } mule-2.0.1/core/src/main/java/org/mule/transformer/codec/XmlEntityDecoder.java0000644000175000017500000000341210765525116027132 0ustar charlescharles/* * $Id: XmlEntityDecoder.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.codec; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.AbstractTransformer; import org.mule.util.IOUtils; import org.mule.util.XMLEntityCodec; import java.io.InputStream; /** * Decodes a String or byte[] containing XML entities */ public class XmlEntityDecoder extends AbstractTransformer { public XmlEntityDecoder() { registerSourceType(String.class); registerSourceType(byte[].class); registerSourceType(InputStream.class); setReturnClass(String.class); } public Object doTransform(Object src, String encoding) throws TransformerException { try { String data; if (src instanceof byte[]) { data = new String((byte[]) src, encoding); } else if (src instanceof InputStream) { data = IOUtils.toString((InputStream)src); } else { data = (String) src; } return XMLEntityCodec.decodeString(data); } catch (Exception ex) { throw new TransformerException( CoreMessages.transformFailed(src.getClass().getName(), "XML"), this, ex); } } } mule-2.0.1/core/src/main/java/org/mule/transformer/codec/Base64Encoder.java0000644000175000017500000000430310766014216026226 0ustar charlescharles/* * $Id: Base64Encoder.java 11336 2008-03-12 17:53:18Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.codec; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.AbstractTransformer; import org.mule.util.Base64; import org.mule.util.IOUtils; import java.io.InputStream; /** * Base64Encoder transforms strings or byte arrays into Base64 encoded * string. */ public class Base64Encoder extends AbstractTransformer { public Base64Encoder() { registerSourceType(String.class); registerSourceType(byte[].class); registerSourceType(InputStream.class); setReturnClass(String.class); } public Object doTransform(Object src, String encoding) throws TransformerException { try { byte[] buf; if (src instanceof String) { buf = ((String) src).getBytes(encoding); } else if (src instanceof InputStream) { InputStream input = (InputStream) src; try { buf = IOUtils.toByteArray(input); } finally { input.close(); } } else { buf = (byte[]) src; } String result = Base64.encodeBytes(buf, Base64.DONT_BREAK_LINES); if (getReturnClass().equals(byte[].class)) { return result.getBytes(encoding); } else { return result; } } catch (Exception ex) { throw new TransformerException( CoreMessages.transformFailed(src.getClass().getName(), "base64"), this, ex); } } } mule-2.0.1/core/src/main/java/org/mule/transformer/compression/0000755000175000017500000000000011351411104024307 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/transformer/compression/package.html0000644000175000017500000000015510745677442026622 0ustar charlescharles Transformers for compressing and uncompressing message payloads. mule-2.0.1/core/src/main/java/org/mule/transformer/compression/GZipUncompressTransformer.java0000644000175000017500000000366410765525116032357 0ustar charlescharles/* * $Id: GZipUncompressTransformer.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.compression; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.MessageFactory; import org.mule.util.IOUtils; import java.io.IOException; import java.io.InputStream; import org.apache.commons.lang.SerializationUtils; /** * GZipCompressTransformer TODO */ public class GZipUncompressTransformer extends GZipCompressTransformer { public GZipUncompressTransformer() { super(); } // @Override public Object doTransform(Object src, String encoding) throws TransformerException { byte[] buffer = null; try { byte[] input = null; if (src instanceof InputStream) { InputStream inputStream = (InputStream)src; try { input = IOUtils.toByteArray(inputStream); } finally { inputStream.close(); } } else { input = (byte[])src; } buffer = getStrategy().uncompressByteArray(input); } catch (IOException e) { throw new TransformerException( MessageFactory.createStaticMessage("Failed to uncompress message."), this, e); } if (!getReturnClass().equals(byte[].class)) { return SerializationUtils.deserialize(buffer); } return buffer; } } mule-2.0.1/core/src/main/java/org/mule/transformer/compression/GZipCompressTransformer.java0000644000175000017500000000414110765525116032003 0ustar charlescharles/* * $Id: GZipCompressTransformer.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.compression; import org.mule.api.transformer.TransformerException; import org.mule.util.IOUtils; import org.mule.util.compression.GZipCompression; import java.io.IOException; import java.io.InputStream; import java.io.Serializable; import org.apache.commons.lang.SerializationUtils; /** * GZipCompressTransformer is a transformer compressing objects into * byte arrays. */ public class GZipCompressTransformer extends AbstractCompressionTransformer { public GZipCompressTransformer() { super(); this.setStrategy(new GZipCompression()); this.registerSourceType(Serializable.class); this.registerSourceType(byte[].class); this.registerSourceType(InputStream.class); this.setReturnClass(byte[].class); } public Object doTransform(Object src, String encoding) throws TransformerException { try { byte[] data = null; if (src instanceof byte[]) { data = (byte[]) src; } else if (src instanceof InputStream) { InputStream input = (InputStream)src; try { data = IOUtils.toByteArray(input); } finally { input.close(); } } else { data = SerializationUtils.serialize((Serializable) src); } return this.getStrategy().compressByteArray(data); } catch (IOException ioex) { throw new TransformerException(this, ioex); } } } mule-2.0.1/core/src/main/java/org/mule/transformer/compression/AbstractCompressionTransformer.java0000644000175000017500000000236310745677442033417 0ustar charlescharles/* * $Id: AbstractCompressionTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.compression; import org.mule.transformer.AbstractTransformer; import org.mule.util.compression.CompressionStrategy; /** * AbstractCompressionTransformer is a base class for all transformers * that can compress or uncompress data when they performa message transformation. * Compression is done via a pluggable strategy. */ public abstract class AbstractCompressionTransformer extends AbstractTransformer { private CompressionStrategy strategy; /** * default constructor required for discovery */ public AbstractCompressionTransformer() { super(); } public CompressionStrategy getStrategy() { return strategy; } public void setStrategy(CompressionStrategy strategy) { this.strategy = strategy; } } mule-2.0.1/core/src/main/java/org/mule/transformer/NoActionTransformer.java0000644000175000017500000000233510745677442026602 0ustar charlescharles/* * $Id: NoActionTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.api.transformer.TransformerException; /** * NoActionTransformer doesn't do any transformation on the source * object and returns the source as the result. This can be used to overload the * default transform for an endpoint. */ public final class NoActionTransformer extends AbstractTransformer { public NoActionTransformer() { registerSourceType(Object.class); setReturnClass(Object.class); } /* * (non-Javadoc) * * @see org.mule.api.transformer.Transformer#transform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { return src; } // @Override public boolean isAcceptNull() { return true; } } mule-2.0.1/core/src/main/java/org/mule/transformer/TransformerCollection.java0000644000175000017500000000420610745677442027162 0ustar charlescharles/* * $Id: TransformerCollection.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.api.MuleMessage; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import java.util.Arrays; import java.util.Iterator; import java.util.List; /** TODO */ public class TransformerCollection extends AbstractMessageAwareTransformer { private List transformers; public TransformerCollection(List transformers) { if (transformers.size() < 1) { throw new IllegalArgumentException("You must set at least one transformer"); } this.transformers = transformers; } public TransformerCollection(Transformer[] transformers) { if (transformers.length < 1) { throw new IllegalArgumentException("You must set at least one transformer"); } this.transformers = Arrays.asList(transformers); } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { MuleMessage result = message; Object temp = message; Transformer lastTransformer = null; for (Iterator iterator = transformers.iterator(); iterator.hasNext();) { lastTransformer = (Transformer) iterator.next(); temp = lastTransformer.transform(temp); if (temp instanceof MuleMessage) { result = (MuleMessage) temp; } else { result.setPayload(temp); } } if (lastTransformer != null && lastTransformer.getReturnClass().equals(MuleMessage.class)) { return result; } else { return result.getPayload(); } } } mule-2.0.1/core/src/main/java/org/mule/transformer/TransformerTemplate.java0000644000175000017500000000315510745677442026644 0ustar charlescharles/* * $Id: TransformerTemplate.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; /** TODO */ public class TransformerTemplate extends AbstractMessageAwareTransformer { private TransformerCallback callback; public TransformerTemplate(TransformerCallback callback) { this.callback = callback; } public Object transform(MuleMessage message, String outputEncoding) throws TransformerException { try { return callback.doTransform(message); } catch (TransformerException e) { throw e; } catch (Exception e) { throw new TransformerException(this, e); } } public interface TransformerCallback { public Object doTransform(MuleMessage message) throws Exception; } public static class OverwitePayloadCallback implements TransformerCallback { private Object payload; public OverwitePayloadCallback(Object payload) { this.payload = payload; } public Object doTransform(MuleMessage message) throws Exception { return payload; } } } mule-2.0.1/core/src/main/java/org/mule/transformer/AbstractMessageAwareTransformer.java0000644000175000017500000000552010766204322031101 0ustar charlescharles/* * $Id: AbstractMessageAwareTransformer.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.DefaultMuleMessage; import org.mule.MuleServer; import org.mule.RequestContext; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; /** * AbstractMessageAwareTransformer is a transformer that has a reference * to the current message. This message can be used obtains properties associated * with the current message useful to the transform. Note that when part of a * transform chain, the Message payload reflects the pre-transform message state, * unless there is no current event for this thread, then the message will be a new * DefaultMuleMessage with the src as its payload. Transformers should always work on the * src object not the message payload. * * @see org.mule.api.MuleMessage * @see org.mule.DefaultMuleMessage */ public abstract class AbstractMessageAwareTransformer extends AbstractTransformer { public boolean isSourceTypeSupported(Class aClass, boolean exactMatch) { //TODO RM* This is a bit of hack since we could just register MuleMessage as a supportedType, but this has some //funny behaviour in certain ObjectToXml transformers return (super.isSourceTypeSupported(aClass, exactMatch) || MuleMessage.class.isAssignableFrom(aClass)); } public final Object doTransform(Object src, String encoding) throws TransformerException { MuleMessage message; if(src instanceof MuleMessage) { message = (MuleMessage)src; } else if (MuleServer.getMuleContext().getConfiguration().isAutoWrapMessageAwareTransform()) { message = new DefaultMuleMessage(src); } else { MuleEventContext event = RequestContext.getEventContext(); if (event == null) { throw new TransformerException(CoreMessages.noCurrentEventForTransformer(), this); } message = event.getMessage(); if(!message.getPayload().equals(src)) { throw new IllegalStateException("Transform payload does not match current MuleEventContext payload"); } } return transform(message, encoding); } public abstract Object transform(MuleMessage message, String outputEncoding) throws TransformerException; }mule-2.0.1/core/src/main/java/org/mule/transformer/AbstractTransformer.java0000644000175000017500000002364210774254333026627 0ustar charlescharles/* * $Id: AbstractTransformer.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.MessageAdapter; import org.mule.config.i18n.CoreMessages; import org.mule.transport.NullPayload; import org.mule.util.ClassUtils; import org.mule.util.FileUtils; import org.mule.util.StringMessageUtils; import org.mule.util.StringUtils; import java.io.InputStream; import java.util.Collections; import java.util.List; import javax.xml.transform.stream.StreamSource; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractTransformer is a base class for all transformers. * Transformations transform one object into another. */ public abstract class AbstractTransformer implements Transformer { protected static final int DEFAULT_TRUNCATE_LENGTH = 200; protected final Log logger = LogFactory.getLog(getClass()); /** * The return type that will be returned by the {@link #transform} method is * called */ protected Class returnClass = Object.class; /** * The name that identifies this transformer. If none is set the class name of * the transformer is used */ protected String name = null; /** The endpoint that this transformer instance is configured on */ protected ImmutableEndpoint endpoint = null; /** * A list of supported Class types that the source payload passed into this * transformer */ protected final List sourceTypes = new CopyOnWriteArrayList(); /** * Determines whether the transformer will throw an exception if the message * passed is is not supported or the return tye is incorrect */ private boolean ignoreBadInput = false; /** default constructor required for discovery */ public AbstractTransformer() { super(); } protected Object checkReturnClass(Object object) throws TransformerException { if (returnClass != null) { if (!returnClass.isInstance(object)) { throw new TransformerException( CoreMessages.transformUnexpectedType(object.getClass(), returnClass), this); } } if (logger.isDebugEnabled()) { logger.debug("The transformed object is of expected type. Type is: " + ClassUtils.getSimpleName(object.getClass())); } return object; } protected void registerSourceType(Class aClass) { if (!sourceTypes.contains(aClass)) { sourceTypes.add(aClass); if (aClass.equals(Object.class)) { logger.debug("java.lang.Object has been added as source type for this transformer, there will be no source type checking performed"); } } } protected void unregisterSourceType(Class aClass) { sourceTypes.remove(aClass); } /** @return transformer name */ public String getName() { if (name == null) { name = this.generateTransformerName(); } return name; } /** @param string */ public void setName(String string) { if (string == null) { string = ClassUtils.getSimpleName(this.getClass()); } logger.debug("Setting transformer name to: " + string); name = string; } /* * (non-Javadoc) * * @see org.mule.transformer.Transformer#getReturnClass() */ public Class getReturnClass() { return returnClass; } /* * (non-Javadoc) * * @see org.mule.transformer.Transformer#setReturnClass(java.lang.String) */ public void setReturnClass(Class newClass) { returnClass = newClass; } public boolean isSourceTypeSupported(Class aClass) { return isSourceTypeSupported(aClass, false); } public boolean isSourceTypeSupported(Class aClass, boolean exactMatch) { int numTypes = sourceTypes.size(); if (numTypes == 0) { return !exactMatch; } for (int i = 0; i < numTypes; i++) { Class anotherClass = (Class) sourceTypes.get(i); if (exactMatch) { if (anotherClass.equals(aClass)) { return true; } } else if (anotherClass.isAssignableFrom(aClass)) { return true; } } return false; } /** * Transforms the object. * * @param src The source object to transform. * @return The transformed object */ public final Object transform(Object src) throws TransformerException { String encoding = null; Object payload = src; MessageAdapter adapter; if (src instanceof MessageAdapter) { encoding = ((MessageAdapter) src).getEncoding(); adapter = (MessageAdapter) src; if ((!isSourceTypeSupported(MessageAdapter.class, true) && !isSourceTypeSupported(MuleMessage.class, true) && !(this instanceof AbstractMessageAwareTransformer)) ) { src = ((MessageAdapter) src).getPayload(); payload = adapter.getPayload(); } } if (encoding == null && endpoint != null) { encoding = endpoint.getEncoding(); } else if (encoding == null) { encoding = FileUtils.DEFAULT_ENCODING; } Class srcCls = src.getClass(); if (!isSourceTypeSupported(srcCls)) { if (ignoreBadInput) { logger.debug("Source type is incompatible with this transformer and property 'ignoreBadInput' is set to true, so the transformer chain will continue."); return payload; } else { throw new TransformerException( CoreMessages.transformOnObjectUnsupportedTypeOfEndpoint(this.getName(), payload.getClass(), endpoint), this); } } if (logger.isDebugEnabled()) { logger.debug("Applying transformer " + getName() + " (" + getClass().getName() + ")"); logger.debug("Object before transform: " + StringMessageUtils.truncate(StringMessageUtils.toString(payload), DEFAULT_TRUNCATE_LENGTH, false)); } Object result; result = doTransform(payload, encoding); // } if (result == null) { result = NullPayload.getInstance(); } if (logger.isDebugEnabled()) { logger.debug("Object after transform: " + StringMessageUtils.truncate(StringMessageUtils.toString(result), DEFAULT_TRUNCATE_LENGTH, false)); } result = checkReturnClass(result); return result; } protected boolean isConsumed(Class srcCls) { return InputStream.class.isAssignableFrom(srcCls) || StreamSource.class.isAssignableFrom(srcCls); } public ImmutableEndpoint getEndpoint() { return endpoint; } /* * (non-Javadoc) * * @see org.mule.api.transformer.Transformer#setConnector(org.mule.api.transport.Connector) */ public void setEndpoint(ImmutableEndpoint endpoint) { this.endpoint = endpoint; } protected abstract Object doTransform(Object src, String encoding) throws TransformerException; /** * Template method where deriving classes can do any initialisation after the * properties have been set on this transformer * * @throws InitialisationException */ public void initialise() throws InitialisationException { // do nothing, subclasses may override } protected String generateTransformerName() { String name = ClassUtils.getSimpleName(this.getClass()); int i = name.indexOf("To"); if (i > 0 && returnClass != null) { String target = ClassUtils.getSimpleName(returnClass); if (target.equals("byte[]")) { target = "byteArray"; } name = name.substring(0, i + 2) + StringUtils.capitalize(target); } return name; } public List getSourceTypes() { return Collections.unmodifiableList(sourceTypes); } public boolean isIgnoreBadInput() { return ignoreBadInput; } public void setIgnoreBadInput(boolean ignoreBadInput) { this.ignoreBadInput = ignoreBadInput; } // @Override public String toString() { StringBuffer sb = new StringBuffer(80); sb.append(ClassUtils.getSimpleName(this.getClass())); sb.append("{this=").append(Integer.toHexString(System.identityHashCode(this))); sb.append(", name='").append(name).append('\''); sb.append(", ignoreBadInput=").append(ignoreBadInput); sb.append(", returnClass=").append(returnClass); sb.append(", sourceTypes=").append(sourceTypes); sb.append('}'); return sb.toString(); } public boolean isAcceptNull() { return false; } } mule-2.0.1/core/src/main/java/org/mule/transformer/TransformerUtils.java0000644000175000017500000001227010765313375026161 0ustar charlescharles/* * $Id: TransformerUtils.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.RegistryContext; import org.mule.api.DefaultMuleException; import org.mule.api.MuleException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transformer.Transformer; import org.mule.config.i18n.CoreMessages; import org.mule.transport.service.TransportFactoryException; import org.mule.transport.service.TransportServiceDescriptor; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.StringTokenizer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class TransformerUtils { public static final String COMMA = ","; private static Log logger = LogFactory.getLog(AbstractTransformer.class); public static void initialiseAllTransformers(List transformers) throws InitialisationException { if (transformers != null) { Iterator transformer = transformers.iterator(); while (transformer.hasNext()) { ((Transformer) transformer.next()).initialise(); } } } public static String toString(List transformers) { StringBuffer buffer = new StringBuffer(); Iterator transformer = transformers.iterator(); while (transformer.hasNext()) { buffer.append(transformer.next().toString()); if (transformer.hasNext()) { buffer.append(" -> "); } } return buffer.toString(); } public static Transformer firstOrNull(List transformers) { if (transformers != null && 0 != transformers.size()) { return (Transformer) transformers.get(0); } else { return null; } } public static boolean isSourceTypeSupportedByFirst(List transformers, Class clazz) { Transformer transformer = firstOrNull(transformers); return null != transformer && transformer.isSourceTypeSupported(clazz); } protected static interface TransformerSource { public List getTransformers() throws TransportFactoryException; } protected static List getTransformersFromSource(TransformerSource source) { try { List transformers = source.getTransformers(); TransformerUtils.initialiseAllTransformers(transformers); return transformers; } catch (MuleException e) { logger.debug(e.getMessage(), e); return null; } } public static List getDefaultInboundTransformers(final TransportServiceDescriptor serviceDescriptor) { return getTransformersFromSource(new TransformerSource() { public List getTransformers() throws TransportFactoryException { return serviceDescriptor.createInboundTransformers(); } }); } public static List getDefaultResponseTransformers(final TransportServiceDescriptor serviceDescriptor) { return getTransformersFromSource(new TransformerSource() { public List getTransformers() throws TransportFactoryException { return serviceDescriptor.createResponseTransformers(); } }); } public static List getDefaultOutboundTransformers(final TransportServiceDescriptor serviceDescriptor) { return getTransformersFromSource(new TransformerSource() { public List getTransformers() throws TransportFactoryException { return serviceDescriptor.createOutboundTransformers(); } }); } /** * Builds a list of UMOTransformers. * * @param names - a list of transformers separated by commans * @return a list (possibly empty) of transformers or * {@link TransformerUtils#UNDEFINED} if the names list is null * @throws org.mule.api.DefaultMuleException */ public static List getTransformers(String names) throws DefaultMuleException { if (null != names) { List transformers = new LinkedList(); StringTokenizer st = new StringTokenizer(names, COMMA); while (st.hasMoreTokens()) { String key = st.nextToken().trim(); Transformer transformer = RegistryContext.getRegistry().lookupTransformer(key); if (transformer == null) { throw new DefaultMuleException(CoreMessages.objectNotRegistered("Transformer", key)); } transformers.add(transformer); } return transformers; } else { return null; } } } mule-2.0.1/core/src/main/java/org/mule/MuleSessionHandler.java0000644000175000017500000001131110763266624024035 0ustar charlescharles/* * $Id: MuleSessionHandler.java 11158 2008-03-04 15:41:08Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.config.MuleProperties; import org.mule.api.transformer.Transformer; import org.mule.api.transport.SessionHandler; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.codec.Base64Decoder; import org.mule.transformer.codec.Base64Encoder; import java.io.UnsupportedEncodingException; import java.util.Iterator; import java.util.StringTokenizer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A default session handler used to store and retrieve session information on an * event. The DefaultMuleSession information is stored as a header on the message (does not * support Tcp, Udp, etc. unless the MuleMessage object is serialised across the * wire). The session is stored in the "MULE_SESSION" property as String key/value * pairs that are Base64 encoded, for example: * ID=dfokokdf-3ek3oke-dkfokd;MySessionProp1=Value1;MySessionProp2=Value2 */ public class MuleSessionHandler implements SessionHandler { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); private static Transformer encoder = new Base64Encoder(); private static Transformer decoder = new Base64Decoder(); public void retrieveSessionInfoFromMessage(MuleMessage message, MuleSession session) throws MuleException { String sessionId = (String) message.removeProperty(MuleProperties.MULE_SESSION_ID_PROPERTY); Object sessionHeader = message.removeProperty(MuleProperties.MULE_SESSION_PROPERTY); if (sessionId != null) { throw new IllegalStateException( "This session handler does not know how to look up session information for session id: " + sessionId); } if (sessionHeader != null) { String sessionString = null; try { sessionString = new String((byte[]) decoder.transform(sessionHeader), message.getEncoding()); } catch (UnsupportedEncodingException e) { sessionString = new String((byte[]) decoder.transform(sessionHeader)); } if (logger.isDebugEnabled()) { logger.debug("Parsing session header: " + sessionString); } String pair; String name; String value; for (StringTokenizer stringTokenizer = new StringTokenizer(sessionString, ";"); stringTokenizer.hasMoreTokens();) { pair = stringTokenizer.nextToken(); int i = pair.indexOf("="); if (i == -1) { throw new IllegalArgumentException( CoreMessages.sessionValueIsMalformed(pair).toString()); } name = pair.substring(0, i).trim(); value = pair.substring(i + 1).trim(); session.setProperty(name, value); if (logger.isDebugEnabled()) { logger.debug("Added MuleSession variable: " + pair); } } } } public void storeSessionInfoToMessage(MuleSession session, MuleMessage message) throws MuleException { StringBuffer buf = new StringBuffer(); buf.append(getSessionIDKey()).append("=").append(session.getId()); for (Iterator iterator = session.getPropertyNames(); iterator.hasNext();) { Object o = iterator.next(); buf.append(";"); buf.append(o).append("=").append(session.getProperty(o)); if (logger.isDebugEnabled()) { logger.debug("Adding property to session header: " + o + "=" + session.getProperty(o)); } } String sessionString = buf.toString(); if (logger.isDebugEnabled()) { logger.debug("Adding session header to message: " + sessionString); } sessionString = (String) encoder.transform(sessionString); message.setProperty(MuleProperties.MULE_SESSION_PROPERTY, sessionString); } public String getSessionIDKey() { return "ID"; } } mule-2.0.1/core/src/main/java/org/mule/management/0000755000175000017500000000000011351411123021521 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/management/stats/0000755000175000017500000000000011351411123022657 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/management/stats/ServiceStatistics.java0000644000175000017500000001675510771736371027237 0ustar charlescharles/* * $Id: ServiceStatistics.java 11488 2008-03-24 14:38:49Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.stats; import org.mule.api.management.stats.Statistics; import org.mule.management.stats.printers.SimplePrinter; import java.io.PrintWriter; public class ServiceStatistics implements Statistics { /** * Serial version */ private static final long serialVersionUID = -2086999226732861674L; private String name; private long receivedEventSync = 0; private long receivedEventASync = 0; private long queuedEvent = 0; private long maxQueuedEvent = 0; private long averageQueueSize = 0; private long totalQueuedEvent = 0; private long sentEventSync = 0; private long sentReplyToEvent = 0; private long sentEventASync = 0; private long executionError = 0; private long fatalError = 0; private int threadPoolSize = 0; private long samplePeriod = 0; private boolean enabled = false; private RouterStatistics inboundRouterStat = null; private ComponentStatistics componentStat = null; private RouterStatistics outboundRouterStat = null; public ServiceStatistics(String name) { this(name, 0); } /** * The constructor * * @param name */ public ServiceStatistics(String name, int threadPoolSize) { super(); this.name = name; this.threadPoolSize = threadPoolSize; clear(); } /** * Are statistics logged */ public boolean isEnabled() { return enabled; } /** * Enable statistics logs (this is a dynamic parameter) */ public synchronized void setEnabled(boolean b) { enabled = b; if (inboundRouterStat != null) { inboundRouterStat.setEnabled(b); } if (componentStat != null) { componentStat.setEnabled(b); } if (outboundRouterStat != null) { outboundRouterStat.setEnabled(b); } } public synchronized void incReceivedEventSync() { receivedEventSync++; } public synchronized void incReceivedEventASync() { receivedEventASync++; } public synchronized void incExecutionError() { executionError++; } public synchronized void incFatalError() { fatalError++; } public synchronized void incSentEventSync() { sentEventSync++; } public synchronized void incSentEventASync() { sentEventASync++; } public synchronized void incSentReplyToEvent() { sentReplyToEvent++; } public synchronized void incQueuedEvent() { queuedEvent++; totalQueuedEvent++; if (queuedEvent > maxQueuedEvent) { maxQueuedEvent = queuedEvent; } // if(queuedEvent > 1) { averageQueueSize = Math.round(getAsyncEventsReceived() / totalQueuedEvent); // } } public synchronized void decQueuedEvent() { queuedEvent--; } public long getAverageExecutionTime() { return componentStat.getAverageExecutionTime(); } public long getAverageQueueSize() { return averageQueueSize; } public long getMaxQueueSize() { return maxQueuedEvent; } /** * @deprecated * @return */ public long getMaxExecutionTime() { return componentStat.getMaxExecutionTime(); } public long getFatalErrors() { return fatalError; } /** * @deprecated * @return */ public long getMinExecutionTime() { return componentStat.getMinExecutionTime(); } /** * @deprecated * @return */ public long getTotalExecutionTime() { return componentStat.getTotalExecutionTime(); } public long getQueuedEvents() { return queuedEvent; } public long getAsyncEventsReceived() { return receivedEventASync; } public long getSyncEventsReceived() { return receivedEventSync; } public long getReplyToEventsSent() { return sentReplyToEvent; } public long getSyncEventsSent() { return sentEventSync; } public long getAsyncEventsSent() { return sentEventASync; } public long getTotalEventsSent() { return getSyncEventsSent() + getAsyncEventsSent(); } public long getTotalEventsReceived() { return getSyncEventsReceived() + getAsyncEventsReceived(); } public long getExecutedEvents() { return componentStat.getExecutedEvents(); } public long getExecutionErrors() { return executionError; } public synchronized String getName() { return name; } public synchronized void setName(String name) { this.name = name; } /** * log in info level the main statistics */ public void logSummary() { logSummary(new SimplePrinter(System.out)); } public void logSummary(PrintWriter printer) { printer.print(this); } public synchronized void clear() { receivedEventSync = 0; receivedEventASync = 0; queuedEvent = 0; maxQueuedEvent = 0; totalQueuedEvent = 0; averageQueueSize = 0; sentEventSync = 0; sentEventASync = 0; sentReplyToEvent = 0; executionError = 0; fatalError = 0; if (getInboundRouterStat() != null) { getInboundRouterStat().clear(); } if (getOutboundRouterStat() != null) { getOutboundRouterStat().clear(); } samplePeriod = System.currentTimeMillis(); } /** * @return Returns the inboundRouterStat. */ public RouterStatistics getInboundRouterStat() { return inboundRouterStat; } /** * @param inboundRouterStat The inboundRouterStat to set. */ public void setInboundRouterStat(RouterStatistics inboundRouterStat) { this.inboundRouterStat = inboundRouterStat; this.inboundRouterStat.setEnabled(enabled); } /** * @return Returns the outboundRouterStat. */ public RouterStatistics getOutboundRouterStat() { return outboundRouterStat; } /** * @param outboundRouterStat The outboundRouterStat to set. */ public void setOutboundRouterStat(RouterStatistics outboundRouterStat) { this.outboundRouterStat = outboundRouterStat; this.outboundRouterStat.setEnabled(enabled); } /** * @return Returns the outboundRouterStat. */ public ComponentStatistics getComponentStat() { return componentStat; } /** * @param outboundRouterStat The outboundRouterStat to set. */ public void setComponentStat(ComponentStatistics componentStat) { this.componentStat = componentStat; this.componentStat.setEnabled(enabled); } public int getThreadPoolSize() { return threadPoolSize; } public long getSamplePeriod() { return System.currentTimeMillis() - samplePeriod; } } mule-2.0.1/core/src/main/java/org/mule/management/stats/SedaServiceStatistics.java0000644000175000017500000000335210746275214030015 0ustar charlescharles/* * $Id: SedaServiceStatistics.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.stats; /** * TODO MULE-2233 Pooling functionality has been abstracted out of the SedaService. * This class should be updated accordingly. */ public class SedaServiceStatistics extends ServiceStatistics { private int componentPoolMaxSize = 0; private int componentPoolAbsoluteMaxSize = 0; private int componentPoolSize = 0; public SedaServiceStatistics(String name, int threadPoolSize, int componentPoolsize) { super(name, threadPoolSize); this.componentPoolMaxSize = componentPoolsize; this.componentPoolAbsoluteMaxSize = componentPoolMaxSize; } public synchronized void clear() { componentPoolSize = 0; componentPoolAbsoluteMaxSize = 0; super.clear(); } public int getComponentPoolMaxSize() { return componentPoolMaxSize; } public int getComponentPoolAbsoluteMaxSize() { return componentPoolAbsoluteMaxSize; } public int getComponentPoolSize() { return componentPoolSize; } public synchronized void setComponentPoolSize(int componentPoolSize) { this.componentPoolSize = componentPoolSize; if (componentPoolSize > componentPoolAbsoluteMaxSize) { componentPoolAbsoluteMaxSize = componentPoolSize; } } } mule-2.0.1/core/src/main/java/org/mule/management/stats/package.html0000644000175000017500000000020110204257011025131 0ustar charlescharles Jmx statistics support used to monitor messaging status for various Mule components. mule-2.0.1/core/src/main/java/org/mule/management/stats/ComponentStatistics.java0000644000175000017500000000450410771736371027566 0ustar charlescharles/* * $Id: ComponentStatistics.java 11488 2008-03-24 14:38:49Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.stats; import org.mule.api.management.stats.Statistics; import org.mule.management.stats.printers.SimplePrinter; import java.io.PrintWriter; /** * */ public class ComponentStatistics implements Statistics { /** * Serial version */ private static final long serialVersionUID = -2086999226732861674L; private long minExecutionTime = 0; private long maxExecutionTime = 0; private long averageExecutionTime = 0; private long executedEvent = 0; private long totalExecTime = 0; private boolean enabled = false; public void clear() { minExecutionTime = 0; maxExecutionTime = 0; executedEvent = 0; totalExecTime = 0; } public boolean isEnabled() { return enabled; } public void logSummary() { logSummary(new SimplePrinter(System.out)); } public void logSummary(PrintWriter printer) { printer.print(this); } public void setEnabled(boolean b) { this.enabled = b; } public long getMaxExecutionTime() { return maxExecutionTime; } public long getMinExecutionTime() { return minExecutionTime; } public long getTotalExecutionTime() { return totalExecTime; } public long getExecutedEvents() { return executedEvent; } public synchronized void addExecutionTime(long time) { executedEvent++; totalExecTime += (time == 0 ? 1 : time); if (minExecutionTime == 0 || time < minExecutionTime) { minExecutionTime = time; } if (maxExecutionTime == 0 || time > maxExecutionTime) { maxExecutionTime = time; } averageExecutionTime = Math.round(totalExecTime / executedEvent); } public long getAverageExecutionTime() { return averageExecutionTime; } } mule-2.0.1/core/src/main/java/org/mule/management/stats/AllStatistics.java0000644000175000017500000000567210746275214026337 0ustar charlescharles/* * $Id: AllStatistics.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.stats; import org.mule.api.management.stats.Statistics; import org.mule.management.stats.printers.AbstractTablePrinter; import org.mule.management.stats.printers.SimplePrinter; import java.io.PrintWriter; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; /** * AllStatistics TODO */ public class AllStatistics { private boolean isStatisticsEnabled; private long startTime; private HashMap componentStat = new HashMap(); /** * */ public AllStatistics() { clear(); } public void logSummary() { logSummary(new SimplePrinter(System.out)); } public void logSummary(PrintWriter printer) { if (printer instanceof AbstractTablePrinter) { printer.print(componentStat.values()); } else { Iterator it = componentStat.values().iterator(); while (it.hasNext()) { printer.print(it.next()); } } // printer.println("-----------------------------"); // printer.println("duration (ms): " + (System.currentTimeMillis() - // startTime)); } public synchronized void clear() { Iterator it = getComponentStatistics().iterator(); while (it.hasNext()) { ((Statistics) it.next()).clear(); } startTime = System.currentTimeMillis(); } /** * Are statistics logged */ public boolean isEnabled() { return isStatisticsEnabled; } /** * Enable statistics logs (this is a dynamic parameter) */ public void setEnabled(boolean b) { isStatisticsEnabled = b; Iterator it = componentStat.values().iterator(); while (it.hasNext()) { ((ServiceStatistics) it.next()).setEnabled(b); } } public synchronized long getStartTime() { return startTime; } public synchronized void setStartTime(long startTime) { this.startTime = startTime; } public synchronized void add(ServiceStatistics stat) { if (stat != null) { componentStat.put(stat.getName(), stat); } } public synchronized void remove(ServiceStatistics stat) { if (stat != null) { componentStat.remove(stat.getName()); } } public synchronized Collection getComponentStatistics() { return componentStat.values(); } } mule-2.0.1/core/src/main/java/org/mule/management/stats/RouterStatistics.java0000644000175000017500000001136410745677442027112 0ustar charlescharles/* * $Id: RouterStatistics.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.stats; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.management.stats.Statistics; import org.mule.management.stats.printers.SimplePrinter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; /** * RouterStatistics TODO * */ public class RouterStatistics implements Statistics { /** * Serial version */ private static final long serialVersionUID = 4540482357430845065L; public static final int TYPE_INBOUND = 1; public static final int TYPE_OUTBOUND = 2; public static final int TYPE_RESPONSE = 3; public static final int TYPE_NESTED = 4; private boolean enabled; private long notRouted; private long caughtInCatchAll; private long totalRouted; private long totalReceived; private Map routed; private int type; /** * @see org.mule.api.management.stats.Statistics#clear() */ public synchronized void clear() { notRouted = 0; totalRouted = 0; totalReceived = 0; caughtInCatchAll = 0; routed.clear(); } /** * @see org.mule.api.management.stats.Statistics#isEnabled() */ public boolean isEnabled() { return enabled; } public void logSummary() { logSummary(new SimplePrinter(System.out)); } public void logSummary(PrintWriter printer) { printer.print(this); } /** * @see org.mule.api.management.stats.Statistics#setEnabled(boolean) */ public synchronized void setEnabled(boolean b) { enabled = b; } /** * The constructor */ public RouterStatistics(int type) { super(); this.type = type; routed = new HashMap(); } /** * Increment routed message for multiple endpoints * * @param endpoints The endpoint collection */ public void incrementRoutedMessage(Collection endpoints) { if (endpoints == null || endpoints.isEmpty()) { return; } List list = new ArrayList(endpoints); synchronized (list) { for (int i = 0; i < list.size(); i++) { incrementRoutedMessage((ImmutableEndpoint) list.get(i)); } } } /** * Increment routed message for an endpoint * * @param endpoint The endpoint */ public synchronized void incrementRoutedMessage(ImmutableEndpoint endpoint) { if (endpoint == null) { return; } String name = endpoint.getName(); Long cpt = (Long) routed.get(name); long count = 0; if (cpt != null) { count = cpt.longValue(); } // TODO we should probably use a MutableLong here, // but that might be problematic for remote MBean access (serialization) routed.put(name, new Long(++count)); totalRouted++; totalReceived++; } /** * Increment no routed message */ public synchronized void incrementNoRoutedMessage() { notRouted++; totalReceived++; } /** * Increment no routed message */ public synchronized void incrementCaughtMessage() { caughtInCatchAll++; } /** * @return Returns the notRouted. */ public final long getCaughtMessages() { return caughtInCatchAll; } /** * @return Returns the notRouted. */ public final long getNotRouted() { return notRouted; } /** * @return Returns the totalReceived. */ public final long getTotalReceived() { return totalReceived; } /** * @return Returns the totalRouted. */ public final long getTotalRouted() { return totalRouted; } /** * @return Returns the totalRouted. */ public final long getRouted(String endpointName) { Long l = (Long) routed.get(endpointName); if (l == null) { return 0; } else { return l.longValue(); } } public boolean isInbound() { return type == TYPE_INBOUND; } public Map getRouted() { return routed; } } mule-2.0.1/core/src/main/java/org/mule/management/stats/printers/0000755000175000017500000000000011351411123024525 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/management/stats/printers/package.html0000644000175000017500000000017710462161420027017 0ustar charlescharles Mule Various statistics printers, for table, plain and CVS formats. mule-2.0.1/core/src/main/java/org/mule/management/stats/printers/HtmlTablePrinter.java0000644000175000017500000001067110664630335030633 0ustar charlescharles/* * $Id: HtmlTablePrinter.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.stats.printers; import org.mule.util.StringUtils; import java.io.OutputStream; import java.io.Writer; import java.util.Collection; import java.util.StringTokenizer; /** * HtmlTablePrinter prints event processing stats as a HTML table */ public class HtmlTablePrinter extends AbstractTablePrinter { public HtmlTablePrinter(Writer out) { super(out); } public HtmlTablePrinter(OutputStream out) { super(out); } // @Override public void print(Collection stats) { println(""); String[][] table = getTable(stats); boolean providerStats = false; println(""); for (int i = 0; i < table.length; i++) { println(""); } println(""); for (int i = 1; i < table[0].length; i++) { println(""); for (int j = 0; j < table.length; j++) { if (j == 0) { if (StringUtils.equals(table[1][i], "-")) { if (StringUtils.equals(table[j][i], "By Provider")) { println(""); } else { println(""); } } else if (StringUtils.isNotEmpty(table[j][i])) { println(""); } else { println(""); } } else { if (providerStats) { println(""); } else { println(""); } } } println(""); if (StringUtils.equals(table[0][i], "By Provider")) { providerStats = true; } else { providerStats = false; } } println("
    " + table[i][0] + "
    " + table[j][i] + "
    " + table[j][i] + "
    " + table[j][i] + " " + getProviderStatsHtml(table[j][i]) + "" + ((StringUtils.equals(table[j][i], "-")) ? "" : table[j][i]) + "
    "); } protected String getProviderStatsHtml(String stats) { if (StringUtils.isBlank(stats)) { return ""; } StringBuffer buf = new StringBuffer(); buf.append(""); StringTokenizer st = new StringTokenizer(stats, ";"); if (st.countTokens() == 0) { buf.append(""); } else { String token; while (st.hasMoreTokens()) { token = st.nextToken(); buf.append(""); } } buf.append("
    "); int i = stats.indexOf("="); buf.append(stats.substring(0, i)).append(": "); buf.append(""); buf.append(stats.substring(i + 1)); buf.append("
    "); int i = token.indexOf("="); buf.append(token.substring(0, i)).append(": "); buf.append(""); buf.append(token.substring(i + 1)); buf.append("
    "); return buf.toString(); } } mule-2.0.1/core/src/main/java/org/mule/management/stats/printers/AbstractTablePrinter.java0000644000175000017500000001621010746275214031467 0ustar charlescharles/* * $Id: AbstractTablePrinter.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.stats.printers; import org.mule.management.stats.ServiceStatistics; import org.mule.management.stats.RouterStatistics; import org.mule.management.stats.SedaServiceStatistics; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; /** * HtmlTablePrinter prints event processing stats as a HTML table */ public class AbstractTablePrinter extends PrintWriter { public AbstractTablePrinter(Writer out) { super(out, true); } public AbstractTablePrinter(OutputStream out) { super(out, true); } public String[] getHeaders() { String[] column = new String[36]; column[0] = "Service Name"; column[1] = "Service Pool Max Size"; column[2] = "Service Pool Size"; column[3] = "Thread Pool Size"; column[4] = "Current Queue Size"; column[5] = "Max Queue Size"; column[6] = "Avg Queue Size"; column[7] = "Sync Events Received"; column[8] = "Async Events Received"; column[9] = "Total Events Received"; column[10] = "Sync Events Sent"; column[11] = "Async Events Sent"; column[12] = "ReplyTo Events Sent"; column[13] = "Total Events Sent"; column[14] = "Executed Events"; column[15] = "Execution Messages"; column[16] = "Fatal Messages"; column[17] = "Min Execution Time"; column[18] = "Max Execution Time"; column[19] = "Avg Execution Time"; column[20] = "Total Execution Time"; column[21] = "In Router Statistics"; column[22] = "Total Received"; column[23] = "Total Routed"; column[24] = "Not Routed"; column[25] = "Caught Events"; column[26] = "By Provider"; column[27] = ""; column[28] = "Out Router Statistics"; column[29] = "Total Received"; column[30] = "Total Routed"; column[31] = "Not Routed"; column[32] = "Caught Events"; column[33] = "By Provider"; column[34] = ""; column[35] = "Sample Period"; return column; } protected void getColumn(ServiceStatistics stats, String[] col) { if (stats == null) { return; } col[0] = stats.getName(); //TODO RM* Handling custom stats objects if (stats instanceof SedaServiceStatistics) { col[1] = ((SedaServiceStatistics) stats).getComponentPoolMaxSize() + "/" + ((SedaServiceStatistics) stats).getComponentPoolAbsoluteMaxSize(); col[2] = String.valueOf(((SedaServiceStatistics) stats).getComponentPoolSize()); } else { col[1] = "-"; col[2] = "-"; } col[3] = String.valueOf(stats.getThreadPoolSize()); col[4] = String.valueOf(stats.getQueuedEvents()); col[5] = String.valueOf(stats.getMaxQueueSize()); col[6] = String.valueOf(stats.getAverageQueueSize()); col[7] = String.valueOf(stats.getSyncEventsReceived()); col[8] = String.valueOf(stats.getAsyncEventsReceived()); col[9] = String.valueOf(stats.getTotalEventsReceived()); col[10] = String.valueOf(stats.getSyncEventsSent()); col[11] = String.valueOf(stats.getAsyncEventsSent()); col[12] = String.valueOf(stats.getReplyToEventsSent()); col[13] = String.valueOf(stats.getTotalEventsSent()); col[14] = String.valueOf(stats.getExecutedEvents()); col[15] = String.valueOf(stats.getExecutionErrors()); col[16] = String.valueOf(stats.getFatalErrors()); col[17] = String.valueOf(stats.getMinExecutionTime()); col[18] = String.valueOf(stats.getMaxExecutionTime()); col[19] = String.valueOf(stats.getAverageExecutionTime()); col[20] = String.valueOf(stats.getTotalExecutionTime()); int i = getRouterInfo(stats.getInboundRouterStat(), col, 21); i = getRouterInfo(stats.getOutboundRouterStat(), col, i); col[i] = String.valueOf(stats.getSamplePeriod()); } protected int getRouterInfo(RouterStatistics stats, String[] col, int index) { // TODO what's the deal with the +/- signs? if (stats.isInbound()) { col[index++] = "-"; } else { col[index++] = "-"; } col[index++] = String.valueOf(stats.getTotalReceived()); col[index++] = String.valueOf(stats.getTotalRouted()); col[index++] = String.valueOf(stats.getNotRouted()); col[index++] = String.valueOf(stats.getCaughtMessages()); Map routed = stats.getRouted(); col[index++] = "-"; if (!routed.isEmpty()) { Iterator it = routed.entrySet().iterator(); StringBuffer buf = new StringBuffer(40); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); buf.append(e.getKey()).append('=').append(e.getValue()); if (it.hasNext()) { buf.append(';'); } } col[index++] = buf.toString(); } else { col[index++] = ""; } return index; } protected String[][] getTable(Collection stats) { String[] cols = getHeaders(); String[][] table = new String[stats.size() + 1][cols.length]; for (int i = 0; i < cols.length; i++) { table[0][i] = cols[i]; } int i = 1; for (Iterator iterator = stats.iterator(); iterator.hasNext(); i++) { getColumn((ServiceStatistics) iterator.next(), table[i]); } return table; } public void print(Object obj) { if (obj instanceof Collection) { print((Collection) obj); } else if (obj instanceof ServiceStatistics) { List l = new ArrayList(); l.add(obj); print(l); } else { super.print(obj); } } public void println(Object obj) { print(obj); println(); } public void print(Collection c) { throw new UnsupportedOperationException(); } // help IBM compiler, it complains helplessly about // an abmiguously overloaded/overridden method. public void println(String string) { this.println((Object) string); } // help IBM compiler, it complains helplessly about // an abmiguously overloaded/overridden method. public void print(String string) { this.print((Object) string); } } mule-2.0.1/core/src/main/java/org/mule/management/stats/printers/CSVPrinter.java0000644000175000017500000000341310746275214027410 0ustar charlescharles/* * $Id: CSVPrinter.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.stats.printers; import java.io.OutputStream; import java.io.Writer; import java.util.Collection; /** * CSVPrinter prints service stats in CSV format */ public class CSVPrinter extends AbstractTablePrinter { private String delim = ","; private boolean printHeaders = true; public CSVPrinter(Writer out) { super(out); } public CSVPrinter(OutputStream out) { super(out); } public void print(Collection stats) { try { String[][] table = getTable(stats); int i = (printHeaders ? 0 : 1); for (; i < table.length; i++) { for (int j = 0; j < table[0].length; j++) { print(table[i][j]); if (j + 1 != table[i].length) { print(delim); } } println(); } } catch (Throwable e) { // TODO MULE-863: Unlikely to be sufficient // (and nothing explicitly thrown above) e.printStackTrace(); } } public boolean isPrintHeaders() { return printHeaders; } public void setPrintHeaders(boolean printHeaders) { this.printHeaders = printHeaders; } } mule-2.0.1/core/src/main/java/org/mule/management/stats/printers/SimplePrinter.java0000644000175000017500000000234410746275214030210 0ustar charlescharles/* * $Id: SimplePrinter.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.stats.printers; import java.io.OutputStream; import java.io.Writer; import java.util.Collection; /** * SimplePrinter Default stats printer */ public class SimplePrinter extends AbstractTablePrinter { public SimplePrinter(Writer out) { super(out); } public SimplePrinter(OutputStream out) { super(out); } public void print(Collection stats) { String[][] table = getTable(stats); for (int i = 1; i < table.length; i++) { println(); println("---- Service Statistics ----"); for (int j = 0; j < table[0].length; j++) { println(table[0][j] + ": " + table[i][j]); } println("---- End Service Statistics ----"); } } } mule-2.0.1/core/src/main/java/org/mule/management/stats/printers/XMLPrinter.java0000644000175000017500000001742210746275214027422 0ustar charlescharles/* * $Id: XMLPrinter.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management.stats.printers; import org.mule.management.stats.RouterStatistics; import org.mule.util.StringUtils; import java.io.OutputStream; import java.io.Writer; import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.StringTokenizer; /** * XMLPrinter prints event processing stats as a XML document * */ public class XMLPrinter extends AbstractTablePrinter { /** * Indentation step for XML pretty-printing. */ protected static final int XML_INDENT_SIZE = 2; public XMLPrinter(Writer out) { super(out); } public XMLPrinter(OutputStream out) { super(out); } public String[] getHeaders() { String[] column = new String[42]; column[0] = "Service Name"; column[1] = "Service Pool Max Size"; column[2] = "Service Pool Size"; column[3] = "Thread Pool Size"; column[4] = "Current Queue Size"; column[5] = "Max Queue Size"; column[6] = "Avg Queue Size"; column[7] = "Sync Events Received"; column[8] = "Async Events Received"; column[9] = "Total Events Received"; column[10] = "Sync Events Sent"; column[11] = "Async Events Sent"; column[12] = "ReplyTo Events Sent"; column[13] = "Total Events Sent"; column[14] = "Executed Events"; column[15] = "Execution Messages"; column[16] = "Fatal Messages"; column[17] = "Min Execution Time"; column[18] = "Max Execution Time"; column[19] = "Avg Execution Time"; column[20] = "Total Execution Time"; column[21] = "Router"; column[22] = "Type"; column[23] = "Total Received"; column[24] = "Total Routed"; column[25] = "Not Routed"; column[26] = "Caught Events"; column[27] = "Providers"; column[28] = ""; column[29] = "Providers"; column[30] = "Router"; column[31] = "Router"; column[32] = "Type"; column[33] = "Total Received"; column[34] = "Total Routed"; column[35] = "Not Routed"; column[36] = "Caught Events"; column[37] = "Providers"; column[38] = ""; column[39] = "Providers"; column[40] = "Router"; column[41] = "Sample Period"; return column; } protected int getRouterInfo(RouterStatistics stats, String[] col, int index) { index++; if (stats.isInbound()) { col[index++] = "Inbound"; } else { col[index++] = "Outbound"; } col[index++] = String.valueOf(stats.getTotalReceived()); col[index++] = String.valueOf(stats.getTotalRouted()); col[index++] = String.valueOf(stats.getNotRouted()); col[index++] = String.valueOf(stats.getCaughtMessages()); index++; Map routed = stats.getRouted(); if (!routed.isEmpty()) { Iterator it = routed.entrySet().iterator(); StringBuffer buf = new StringBuffer(40); while (it.hasNext()) { Map.Entry e = (Map.Entry) it.next(); buf.append(e.getKey()).append('=').append(e.getValue()); if (it.hasNext()) { buf.append(';'); } } col[index++] = buf.toString(); } else { col[index++] = ""; } index += 2; return index; } public void print(Collection stats) { println(""); println(""); String[][] table = getTable(stats); boolean router = false; boolean providers = false; int indentLevel = 1; for (int i = 1; i < table.length; i++) { println("", indentLevel); indentLevel++; for (int j = 1; j < table[i].length; j++) { if (StringUtils.equals(table[0][j], "Router")) { if (!router) { println("", indentLevel); indentLevel++; router = true; } else { indentLevel--; println("", indentLevel); router = false; } } else if (StringUtils.equals(table[0][j], "Providers")) { if (StringUtils.isEmpty(table[i][j + 1]) && StringUtils.equals(table[0][j + 2], "Providers")) { println("", indentLevel); j += 2; } else { if (!providers) { println("", indentLevel); indentLevel++; providers = true; } else { indentLevel--; println("", indentLevel); providers = false; } } } else { if (providers) { printProviderStatsXml(table[i][j], indentLevel); } else { println("", indentLevel); } } } indentLevel--; println("", indentLevel); } indentLevel--; println("", indentLevel); } public void println(String s, int indentLevel) { final String indent = StringUtils.repeat(' ', indentLevel * XML_INDENT_SIZE); println(indent + s); } protected void printProviderStatsXml(String stats, int indentLevel) { if (StringUtils.isBlank(stats)) { return; } StringTokenizer st = new StringTokenizer(stats, ";"); if (st.countTokens() == 0) { StringBuffer buf = new StringBuffer(); buf.append(""); println(buf.toString(), indentLevel); } else { String token; while (st.hasMoreTokens()) { StringBuffer buf = new StringBuffer(); token = st.nextToken(); buf.append(""); println(buf.toString(), indentLevel); } } } } mule-2.0.1/core/src/main/java/org/mule/DefaultMuleEventContext.java0000644000175000017500000006534310770356575025070 0ustar charlescharles/* * $Id: DefaultMuleEventContext.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.FutureMessageResult; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleEventContext; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.transaction.TransactionCoordination; import java.io.OutputStream; import edu.emory.mathcs.backport.java.util.concurrent.Callable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * DefaultMuleEventContext is the context object for the current request. * Using the context, developers can send/dispatch/receive events programmatically as * well as manage transactions. */ public class DefaultMuleEventContext implements MuleEventContext { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(DefaultMuleEventContext.class); private final MuleEvent event; private final MuleSession session; public DefaultMuleEventContext(MuleEvent event) { this.event = event; this.session = event.getSession(); } /** * Returns the message payload for this event * * @return the message payload for this event */ public MuleMessage getMessage() { return event.getMessage(); } /** * Reterns the conents of the message as a byte array. * * @return the conents of the message as a byte array * @throws org.mule.api.MuleException if the message cannot be converted into an * array of bytes */ public byte[] getMessageAsBytes() throws MuleException { return event.getMessageAsBytes(); } /** * Returns the message transformed into it's recognised or expected format. The * transformer used is the one configured on the endpoint through which this * event was received. * * @return the message transformed into it's recognised or expected format. * @throws org.mule.api.transformer.TransformerException if a failure occurs in * the transformer * @see org.mule.api.transformer.Transformer */ public Object transformMessage() throws TransformerException { return event.transformMessage(); } /** * Returns the message transformed into its recognised or expected format. The * transformer used is the one configured on the endpoint through which this * event was received. * * @param expectedType The class type required for the return object. This param * just provides a convienient way to manage type casting of * transformed objects * @return the message transformed into it's recognised or expected format. * @throws org.mule.api.transformer.TransformerException if a failure occurs or * if the return type is not the same as the expected type in the * transformer * @see org.mule.api.transformer.Transformer */ public Object transformMessage(Class expectedType) throws TransformerException { return event.transformMessage(expectedType); } /** * Returns the message transformed into it's recognised or expected format and * then into an array of bytes. The transformer used is the one configured on the * endpoint through which this event was received. * * @return the message transformed into it's recognised or expected format as an * array of bytes. * @throws org.mule.api.transformer.TransformerException if a failure occurs in * the transformer * @see org.mule.api.transformer.Transformer */ public byte[] transformMessageToBytes() throws TransformerException { return event.transformMessageToBytes(); } /** * Returns the message contents as a string * * @return the message contents as a string * @throws org.mule.api.MuleException if the message cannot be converted into a * string */ public String getMessageAsString(String encoding) throws MuleException { return event.getMessageAsString(encoding); } /** * Returns the message transformed into it's recognised or expected format and * then into a String. The transformer used is the one configured on the endpoint * through which this event was received. This method will use the default * encoding on the event * * @return the message transformed into it's recognised or expected format as a * Strings. * @throws org.mule.api.transformer.TransformerException if a failure occurs in * the transformer * @see org.mule.api.transformer.Transformer */ public String transformMessageToString() throws TransformerException { return event.transformMessageToString(); } /** * Returns the message contents as a string This method will use the default * encoding on the event * * @return the message contents as a string * @throws org.mule.api.MuleException if the message cannot be converted into a * string */ public String getMessageAsString() throws MuleException { return event.getMessageAsString(); } /** * Returns the current transaction (if any) for the session * * @return the current transaction for the session or null if there is no * transaction in progress */ public Transaction getCurrentTransaction() { return TransactionCoordination.getInstance().getTransaction(); } public void markTransactionForRollback() throws TransactionException { if (getCurrentTransaction() != null) { getCurrentTransaction().setRollbackOnly(); } } /** * This will send an event via the configured outbound router on the service * * @param message the message to send * @return the result of the send if any * @throws org.mule.api.MuleException if there is no outbound endpoint configured * on the service or the events fails during dispatch */ public MuleMessage sendEvent(Object message) throws MuleException { return sendEvent(new DefaultMuleMessage(message, event.getMessage())); } /** * Depending on the session state this methods either Passes an event * synchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpoint The endpoint to disptch the event through. * @return the return Message from the call or null if there was no result * @throws org.mule.api.MuleException if the event fails to be processed by the * service or the transport for the endpoint */ public MuleMessage sendEvent(MuleMessage message, OutboundEndpoint endpoint) throws MuleException { // If synchronous receive has not been explicitly set, default it to true setRemoteSync(message, endpoint); return session.sendEvent(message, endpoint); } /** * Depending on the session state this methods either Passes an event * synchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the message payload to send * @return the return Message from the call or null if there was no result * @throws org.mule.api.MuleException if the event fails to be processed by the * service or the transport for the endpoint */ public MuleMessage sendEvent(MuleMessage message) throws MuleException { // If synchronous receive has not been explicitly set, default it to // true setRemoteSync(message, (OutboundEndpoint) event.getEndpoint()); return session.sendEvent(message); } /** * Depending on the session state this methods either Passes an event * synchronously to the next available Mule UMO in the pool or via the * endpointUri configured for the event * * @param message the event message payload to send * @param endpointUri The endpointUri to disptch the event through * @return the return Message from the call or null if there was no result * @throws org.mule.api.MuleException if the event fails to be processed by the * service or the transport for the endpointUri */ public MuleMessage sendEvent(MuleMessage message, EndpointURI endpointUri) throws MuleException { OutboundEndpoint endpoint = getMuleContext().getRegistry().lookupEndpointFactory().getOutboundEndpoint(endpointUri); // If synchronous receive has not been explicitly set, default it to // true setRemoteSync(message, endpoint); return session.sendEvent(message, endpoint); } /** * sends an event request via the configured outbound router for this service. * This method return immediately, but the result of the event invocation * available from the returned a Future result that can be accessed later by the * the returned FutureMessageResult. the Future messageResult can be queried at * any time to check that the invocation has completed. A timeout is associated * with the invocation, which is the maximum time in milli-seconds that the * invocation should take to complete * * @param message the object that is the payload of the event * @param timeout how long to block in milliseconds waiting for a result * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found * @see org.mule.api.FutureMessageResult */ public FutureMessageResult sendEventAsync(final Object message, final int timeout) throws MuleException { Callable callable = new Callable() { public Object call() throws Exception { MuleMessage umoMessage = new DefaultMuleMessage(message, event.getMessage()); umoMessage.setBooleanProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, true); umoMessage.setIntProperty(MuleProperties.MULE_EVENT_TIMEOUT_PROPERTY, timeout); return sendEvent(umoMessage); } }; FutureMessageResult result = new FutureMessageResult(callable); // TODO MULE-732: use injected ExecutorService result.execute(); return result; } /** * sends an event request via the configured outbound router for this service. * This method return immediately, but the result of the event invocation * available from the returned a Future result that can be accessed later by the * the returned FutureMessageResult. the Future messageResult can be queried at * any time to check that the invocation has completed. A timeout is associated * with the invocation, which is the maximum time in milli-seconds that the * invocation should take to complete * * @param message the MuleMessage of the event * @param timeout how long to block in milliseconds waiting for a result * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found * @see org.mule.api.FutureMessageResult */ public FutureMessageResult sendEventAsync(final MuleMessage message, final int timeout) throws MuleException { Callable callable = new Callable() { public Object call() throws Exception { message.setBooleanProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, true); message.setIntProperty(MuleProperties.MULE_EVENT_TIMEOUT_PROPERTY, timeout); return sendEvent(message); } }; FutureMessageResult result = new FutureMessageResult(callable); // TODO MULE-732: use injected ExecutorService result.execute(); return result; } /** * sends an event request via the configured outbound router for this service. * This method return immediately, but the result of the event invocation * available from the returned a Future result that can be accessed later by the * the returned FutureMessageResult. the Future messageResult can be queried at * any time to check that the invocation has completed. A timeout is associated * with the invocation, which is the maximum time in milli-seconds that the * invocation should take to complete * * @param message the MuleMessage of the event * @param endpointUri the endpointUri to dispatch to * @param timeout how long to block in milliseconds waiting for a result * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found * @see org.mule.api.FutureMessageResult */ public FutureMessageResult sendEventAsync(final MuleMessage message, final EndpointURI endpointUri, final int timeout) throws MuleException { Callable callable = new Callable() { public Object call() throws Exception { message.setBooleanProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, true); message.setIntProperty(MuleProperties.MULE_EVENT_TIMEOUT_PROPERTY, timeout); return sendEvent(message, endpointUri); } }; FutureMessageResult result = new FutureMessageResult(callable); // TODO MULE-732: use injected ExecutorService result.execute(); return result; } /** * sends an event request via the configured outbound router for this service. * This method return immediately, but the result of the event invocation * available from the returned a Future result that can be accessed later by the * the returned FutureMessageResult. the Future messageResult can be queried at * any time to check that the invocation has completed. A timeout is associated * with the invocation, which is the maximum time in milli-seconds that the * invocation should take to complete * * @param message the MuleMessage of the event * @param endpointName The endpoint name to disptch the event through. This will * be looked up first on the service configuration and then on the * mule manager configuration * @param timeout how long to block in milliseconds waiting for a result * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found * @see org.mule.api.FutureMessageResult */ public FutureMessageResult sendEventAsync(final MuleMessage message, final String endpointName, final int timeout) throws MuleException { Callable callable = new Callable() { public Object call() throws Exception { message.setBooleanProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, true); message.setIntProperty(MuleProperties.MULE_EVENT_TIMEOUT_PROPERTY, timeout); return sendEvent(message, endpointName); } }; FutureMessageResult result = new FutureMessageResult(callable); // TODO MULE-732: use injected ExecutorService result.execute(); return result; } /** * Depending on the session state this methods either Passes an event * synchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpointName The endpoint name to disptch the event through. This will * be looked up first on the service configuration and then on the * mule manager configuration * @return the return Message from the call or null if there was no result * @throws org.mule.api.MuleException if the event fails to be processed by the * service or the transport for the endpoint */ public MuleMessage sendEvent(MuleMessage message, String endpointName) throws MuleException { OutboundEndpoint endpoint = RegistryContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(endpointName); setRemoteSync(message, endpoint); return session.sendEvent(message, endpoint); } /** * This will dispatch an event asynchronously via the configured outbound * endpoint on the service for this session * * @param message payload to dispatch * @throws org.mule.api.MuleException if there is no outbound endpoint configured * on the service or the events fails during dispatch */ public void dispatchEvent(Object message) throws MuleException { session.dispatchEvent(new DefaultMuleMessage(message, event.getMessage())); } /** * This will dispatch an event asynchronously via the configured outbound * endpoint on the service for this session * * @param message the message to send * @throws org.mule.api.MuleException if there is no outbound endpoint configured * on the service or the events fails during dispatch */ public void dispatchEvent(MuleMessage message) throws MuleException { session.dispatchEvent(message); } /** * Depending on the session state this methods either Passes an event * asynchronously to the next available Mule UMO in the pool or via the * endpointUri configured for the event * * @param message the event message payload to send * @param endpointUri the endpointUri to dispatc the event to first on the * service configuration and then on the mule manager configuration * @throws org.mule.api.MuleException if the event fails to be processed by the * service or the transport for the endpointUri */ public void dispatchEvent(MuleMessage message, EndpointURI endpointUri) throws MuleException { OutboundEndpoint endpoint = getMuleContext().getRegistry().lookupEndpointFactory().getOutboundEndpoint(endpointUri); session.dispatchEvent(message, endpoint); } /** * Depending on the session state this methods either Passes an event * asynchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpointName The endpoint name to disptch the event through. This will * be looked up first on the service configuration and then on the * mule manager configuration * @throws org.mule.api.MuleException if the event fails to be processed by the * service or the transport for the endpoint */ public void dispatchEvent(MuleMessage message, String endpointName) throws MuleException { session.dispatchEvent(message, endpointName); } /** * Depending on the session state this methods either Passes an event * asynchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpoint The endpoint name to disptch the event through. * @throws org.mule.api.MuleException if the event fails to be processed by the * service or the transport for the endpoint */ public void dispatchEvent(MuleMessage message, OutboundEndpoint endpoint) throws MuleException { session.dispatchEvent(message, endpoint); } /** * Requests a synchronous receive of an event on the service * * @param endpoint the endpoint identifing the endpointUri on ewhich the event * will be received * @param timeout time in milliseconds before the request timesout * @return The requested event or null if the request times out * @throws org.mule.api.MuleException if the request operation fails */ public MuleMessage requestEvent(InboundEndpoint endpoint, long timeout) throws MuleException { return session.requestEvent(endpoint, timeout); } /** * Requests a synchronous receive of an event on the service * * @param endpointName the endpoint identifing the endpointUri on ewhich the * event will be received * @param timeout time in milliseconds before the request timesout * @return The requested event or null if the request times out * @throws org.mule.api.MuleException if the request operation fails */ public MuleMessage requestEvent(String endpointName, long timeout) throws MuleException { return session.requestEvent(endpointName, timeout); } /** * Requests a synchronous receive of an event on the service * * @param endpointUri the endpointUri on which the event will be received * @param timeout time in milliseconds before the request timesout * @return The requested event or null if the request times out * @throws org.mule.api.MuleException if the request operation fails */ public MuleMessage requestEvent(EndpointURI endpointUri, long timeout) throws MuleException { InboundEndpoint endpoint = getMuleContext().getRegistry().lookupEndpointFactory().getInboundEndpoint(endpointUri); return session.requestEvent(endpoint, timeout); } /** * @return the service descriptor of the service that received this event */ public Service getService() { return event.getService(); } /** * Determines whether the default processing for this event will be executed. By * default, the Mule server will route events according to a components * configuration. The user can override this behaviour by obtaining a reference * to the MuleEvent context, either by implementing * org.mule.api.lifecycle.Callable or calling * RequestContext.getEventContext to obtain the MuleEventContext for * the current thread. The user can programmatically control how events are * dispatched. * * @return Returns true is the user has set stopFurtherProcessing. * @see org.mule.api.MuleEventContext * @see org.mule.api.lifecycle.Callable */ public boolean isStopFurtherProcessing() { return RequestContext.getEvent().isStopFurtherProcessing(); } /** * Determines whether the default processing for this event will be executed. By * default, the Mule server will route events according to a components * configuration. The user can override this behaviour by obtaining a reference * to the MuleEvent context, either by implementing * org.mule.api.lifecycle.Callable or calling * UMOManager.getEventContext to obtain the MuleEventContext for * the current thread. The user can programmatically control how events are * dispached. * * @param stopFurtherProcessing the value to set. */ public void setStopFurtherProcessing(boolean stopFurtherProcessing) { event.setStopFurtherProcessing(stopFurtherProcessing); } /** * An outputstream the can optionally be used write response data to an incoming * message. * * @return an output stream if one has been made available by the message receiver * that received the message */ public OutputStream getOutputStream() { return event.getOutputStream(); } /** * Determines whether the was sent synchrounously or not * * @return true if the event is synchronous */ public boolean isSynchronous() { return event.isSynchronous(); } public EndpointURI getEndpointURI() { return event.getEndpoint().getEndpointURI(); } /** * Returns the transaction for the current event or null if there is no * transaction in progresss * * @return the transaction for the current event or null if there is no * transaction in progresss */ public Transaction getTransaction() { return TransactionCoordination.getInstance().getTransaction(); } /** * Get the timeout value associated with the event * * @return the timeout for the event */ public int getTimeout() { return event.getTimeout(); } private void setRemoteSync(MuleMessage message, OutboundEndpoint endpoint) { if (endpoint.isRemoteSync()) { if (getTransaction() == null) { message.setBooleanProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, true); } else { throw new IllegalStateException( CoreMessages.cannotUseTxAndRemoteSync().getMessage()); } } } /** * Gets the encoding for the current message. For potocols that send encoding * Information with the message, this method should be overriden to expose the * transport encoding, otherwise the default encoding in the Mule configuration * will be used * * @return the encoding for this message. This method must never return null */ public String getEncoding() { return event.getEncoding(); } public MuleSession getSession() { return event.getSession(); } public String toString() { return event.toString(); } public MuleContext getMuleContext() { return event.getMuleContext(); } } mule-2.0.1/core/src/main/java/org/mule/MuleServer.java0000644000175000017500000003607410766637211022374 0ustar charlescharles/* * $Id: MuleServer.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.DefaultMuleException; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.config.ConfigurationException; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; import org.mule.context.DefaultMuleContextFactory; import org.mule.util.ClassUtils; import org.mule.util.IOUtils; import org.mule.util.MuleUrlStreamHandlerFactory; import org.mule.util.PropertiesUtils; import org.mule.util.StringMessageUtils; import org.mule.util.SystemUtils; import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleServer is a simple application that represents a local Mule * Server daemon. It is initialised with a mule-config.xml file. */ public class MuleServer implements Runnable { public static final String CLI_OPTIONS[][] = {{"builder", "true", "Configuration Builder Type"}, {"config", "true", "Configuration File"}, {"idle", "false", "Whether to run in idle (unconfigured) mode"}, {"main", "true", "Main Class"}, {"mode", "true", "Run Mode"}, {"props", "true", "Startup Properties"}}; /** * Don't use a class object so the core doesn't depend on mule-module-spring-config. */ protected static final String CLASSNAME_DEFAULT_CONFIG_BUILDER = "org.mule.config.builders.AutoConfigurationBuilder"; /** * This builder sets up the configuration for an idle Mule node - a node that * doesn't do anything initially but is fed configuration during runtime */ protected static final String CLASSNAME_DEFAULT_IDLE_CONFIG_BUILDER = "org.mule.config.builders.MuleIdleConfigurationBuilder"; /** * Required to support the '-config spring' shortcut. Don't use a class object so * the core doesn't depend on mule-module-spring. TODO this may not be a problem * for Mule 2.x */ protected static final String CLASSNAME_SPRING_CONFIG_BUILDER = "org.mule.config.spring.SpringXmlConfigurationBuilder"; /** * logger used by this class */ private static Log logger = LogFactory.getLog(MuleServer.class); public static final String DEFAULT_CONFIGURATION = "mule-config.xml"; /** * one or more configuration urls or filenames separated by commas */ private String configurationResources = null; /** * A FQN of the #configBuilder class, required in case MuleServer is * reinitialised. */ private static String configBuilderClassName = null; /** * A properties file to be read at startup. This can be useful for setting * properties which depend on the run-time environment (dev, test, production). */ private static String startupPropertiesFile = null; /** * The Runtime shutdown thread used to dispose this server */ private static MuleShutdownHook muleShutdownHook; protected Map options = Collections.EMPTY_MAP; /** * The MuleContext should contain anything which does not belong in the Registry. * There is one MuleContext per Mule instance. Assuming it has been created, a * handle to the local MuleContext can be obtained from anywhere by calling * MuleServer.getMuleContext() */ protected static MuleContext muleContext = null; /** * Application entry point. * * @param args command-line args */ public static void main(String[] args) throws Exception { MuleServer server = new MuleServer(args); server.start(false, true); } public MuleServer() { init(new String[]{}); } public MuleServer(String configResources) { // setConfigurationResources(configResources); init(new String[]{"-config", configResources}); } /** * Configure the server with command-line arguments. */ public MuleServer(String[] args) throws IllegalArgumentException { init(args); } protected void init(String[] args) throws IllegalArgumentException { Map options; try { muleShutdownHook = new MuleShutdownHook(logger); registerShutdownHook(muleShutdownHook); options = SystemUtils.getCommandLineOptions(args, CLI_OPTIONS); } catch (DefaultMuleException me) { throw new IllegalArgumentException(me.toString()); } // set our own UrlStreamHandlerFactory to become more independent of system // properties MuleUrlStreamHandlerFactory.installUrlStreamHandlerFactory(); String config = (String) options.get("config"); // Try default if no config file was given. if (config == null && !options.containsKey("idle")) { logger.warn("A configuration file was not set, using default: " + DEFAULT_CONFIGURATION); // try to load the config as a file as well URL configUrl = IOUtils.getResourceAsUrl(DEFAULT_CONFIGURATION, MuleServer.class, true, false); if (configUrl != null) { config = configUrl.toExternalForm(); } else { System.out.println(CoreMessages.configNotFoundUsage()); System.exit(-1); } } if (config != null) { setConfigurationResources(config); } // Configuration builder String cfgBuilderClassName = (String) options.get("builder"); if (options.containsKey("idle")) { setConfigurationResources("IDLE"); cfgBuilderClassName = CLASSNAME_DEFAULT_IDLE_CONFIG_BUILDER; } // Configuration builder if (cfgBuilderClassName != null) { try { // Provide a shortcut for Spring: "-builder spring" if (cfgBuilderClassName.equalsIgnoreCase("spring")) { cfgBuilderClassName = CLASSNAME_SPRING_CONFIG_BUILDER; } setConfigBuilderClassName(cfgBuilderClassName); } catch (Exception e) { logger.fatal(e); final Message message = CoreMessages.failedToLoad("Builder: " + cfgBuilderClassName); System.err.println(StringMessageUtils.getBoilerPlate("FATAL: " + message.toString())); System.exit(1); } } // Startup properties String propertiesFile = (String) options.get("props"); if (propertiesFile != null) { setStartupPropertiesFile(propertiesFile); } } /** * Start the mule server * * @param ownThread determines if the server will run in its own daemon thread or * the current calling thread */ public void start(boolean ownThread, boolean registerShutdownHook) { if (registerShutdownHook) { registerShutdownHook(muleShutdownHook); } if (ownThread) { Thread serverThread = new Thread(this, "MuleServer"); serverThread.setDaemon(true); serverThread.start(); } else { run(); } } /** * Overloaded the [main] thread run method. This calls initialise and shuts down * if an exception occurs */ public void run() { try { logger.info("Mule Server initializing..."); initialize(); logger.info("Mule Server starting..."); muleContext.start(); } catch (Throwable e) { shutdown(e); } } /** * Sets the configuration builder to use for this server. Note that if a builder * is not set and the server's start method is called the default is an instance * of SpringXmlConfigurationBuilder. * * @param builderClassName the configuration builder FQN to use * @throws ClassNotFoundException if the class with the given name can not be * loaded */ public static void setConfigBuilderClassName(String builderClassName) throws ClassNotFoundException { if (builderClassName != null) { Class cls = ClassUtils.loadClass(builderClassName, MuleServer.class); if (ConfigurationBuilder.class.isAssignableFrom(cls)) { MuleServer.configBuilderClassName = builderClassName; } else { throw new IllegalArgumentException("Not a usable ConfigurationBuilder class: " + builderClassName); } } else { MuleServer.configBuilderClassName = null; } } /** * Returns the class name of the configuration builder used to create this * MuleServer. * * @return FQN of the current config builder */ public static String getConfigBuilderClassName() { if (configBuilderClassName != null) { return configBuilderClassName; } else { return CLASSNAME_DEFAULT_CONFIG_BUILDER; } } /** * Initializes this daemon. Derived classes could add some extra behaviour if they wish. * * @throws Exception if failed to initialize */ public void initialize() throws Exception { Runtime.getRuntime().addShutdownHook(new ShutdownThread()); if (configurationResources == null) { logger.warn("A configuration file was not set, using default: " + DEFAULT_CONFIGURATION); configurationResources = DEFAULT_CONFIGURATION; } ConfigurationBuilder cfgBuilder; try { // create a new ConfigurationBuilder that is disposed afterwards cfgBuilder = (ConfigurationBuilder) ClassUtils.instanciateClass(getConfigBuilderClassName(), new Object[]{configurationResources}, MuleServer.class); } catch (Exception e) { throw new ConfigurationException(CoreMessages.failedToLoad(getConfigBuilderClassName()), e); } if (!cfgBuilder.isConfigured()) { Properties startupProperties= null; if (getStartupPropertiesFile() != null) { startupProperties = PropertiesUtils.loadProperties(getStartupPropertiesFile(), getClass()); } DefaultMuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); muleContext = muleContextFactory.createMuleContext(cfgBuilder, startupProperties); } } /** * Will shut down the server displaying the cause and time of the shutdown * * @param e the exception that caused the shutdown */ public void shutdown(Throwable e) { Message msg = CoreMessages.fatalErrorWhileRunning(); MuleException muleException = ExceptionHelper.getRootMuleException(e); if (muleException != null) { logger.fatal(muleException.getDetailedMessage()); } else { logger.fatal(msg.toString() + " " + e.getMessage(), e); } List msgs = new ArrayList(); msgs.add(msg.getMessage()); Throwable root = ExceptionHelper.getRootException(e); msgs.add(root.getMessage() + " (" + root.getClass().getName() + ")"); msgs.add(" "); msgs.add(CoreMessages.fatalErrorInShutdown()); if (muleContext != null) { msgs.add(CoreMessages.serverStartedAt(muleContext.getStartDate())); } msgs.add(CoreMessages.serverShutdownAt(new Date())); String shutdownMessage = StringMessageUtils.getBoilerPlate(msgs, '*', 80); logger.fatal(shutdownMessage); // make sure that Mule is shutdown correctly. if (muleContext != null) { muleContext.dispose(); } System.exit(0); } /** * shutdown the server. This just displays the time the server shut down */ public void shutdown() { logger.info("Mule server shutting dow due to normal shutdown request"); List msgs = new ArrayList(); msgs.add(CoreMessages.normalShutdown()); msgs.add(CoreMessages.serverStartedAt(muleContext.getStartDate()).getMessage()); msgs.add(CoreMessages.serverShutdownAt(new Date()).getMessage()); String shutdownMessage = StringMessageUtils.getBoilerPlate(msgs, '*', 80); logger.info(shutdownMessage); // make sure that Mule is shutdown correctly. muleContext.dispose(); System.exit(0); } public Log getLogger() { return logger; } public void registerShutdownHook(MuleShutdownHook muleShutdownHook) { Runtime.getRuntime().removeShutdownHook(muleShutdownHook); Runtime.getRuntime().addShutdownHook(muleShutdownHook); } // ///////////////////////////////////////////////////////////////// // Getters and setters // ///////////////////////////////////////////////////////////////// /** * Getter for property messengerURL. * * @return Value of property messengerURL. */ public String getConfigurationResources() { return configurationResources; } /** * Setter for property configurationResources. * * @param configurationResources New value of property configurationResources. */ public void setConfigurationResources(String configurationResources) { this.configurationResources = configurationResources; } public static String getStartupPropertiesFile() { return startupPropertiesFile; } public static void setStartupPropertiesFile(String startupPropertiesFile) { MuleServer.startupPropertiesFile = startupPropertiesFile; } public static MuleContext getMuleContext() { return muleContext; } public static void setMuleContext(MuleContext muleContext) { MuleServer.muleContext = muleContext; } /** * This class is installed only for MuleServer running as commandline app. A * clean Mule shutdown can be achieved by disposing the * {@link org.mule.DefaultMuleContext}. */ private class ShutdownThread extends Thread { public void run() { if (muleContext !=null && !muleContext.isDisposed() && !muleContext.isDisposing()) { muleContext.dispose(); } } } } mule-2.0.1/core/src/main/java/org/mule/AbstractExceptionListener.java0000644000175000017500000004134310774254333025425 0ustar charlescharles/* * $Id: AbstractExceptionListener.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MessagingException; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleEventContext; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.context.MuleContextAware; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.InvalidEndpointTypeException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.LifecycleException; import org.mule.api.routing.RoutingException; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.ExceptionNotification; import org.mule.message.ExceptionMessage; import org.mule.routing.filters.WildcardFilter; import org.mule.transaction.TransactionCoordination; import org.mule.transport.NullPayload; import java.beans.ExceptionListener; import java.util.Iterator; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractExceptionListener is a base implementation that custom * Exception Listeners can override. It provides template methods for handling the * for base types of exceptions plus allows multimple endpoints to be associated with * this exception listener and provides an implementation for dispatching exception * events from this Listener. */ public abstract class AbstractExceptionListener implements ExceptionListener, Initialisable, Disposable, MuleContextAware { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); protected List endpoints = new CopyOnWriteArrayList(); protected AtomicBoolean initialised = new AtomicBoolean(false); protected MuleContext muleContext; protected WildcardFilter rollbackTxFilter; protected WildcardFilter commitTxFilter; protected boolean enableNotifications = true; public void setMuleContext(MuleContext context) { this.muleContext = context; } public List getEndpoints() { return endpoints; } public void setEndpoints(List endpoints) { if (endpoints != null) { this.endpoints.clear(); // Ensure all endpoints are response endpoints // This will go when we start dropping suport for 1.4 and start using 1.5 for (Iterator it = this.endpoints.iterator(); it.hasNext();) { ImmutableEndpoint endpoint = (ImmutableEndpoint) it.next(); if (!(endpoint instanceof InboundEndpoint)) { throw new InvalidEndpointTypeException(CoreMessages.exceptionListenerMustUseOutboundEndpoint(this, endpoint)); } } this.endpoints.addAll(endpoints); } else { throw new IllegalArgumentException("List of endpoints = null"); } } public void addEndpoint(OutboundEndpoint endpoint) { if (endpoint != null) { endpoints.add(endpoint); } } public boolean removeEndpoint(OutboundEndpoint endpoint) { return endpoints.remove(endpoint); } public void exceptionThrown(Exception e) { if (enableNotifications) { fireNotification(new ExceptionNotification(e)); } logException(e); handleTransaction(e); Throwable t = getExceptionType(e, RoutingException.class); if (t != null) { RoutingException re = (RoutingException) t; handleRoutingException(re.getUmoMessage(), re.getEndpoint(), e); return; } t = getExceptionType(e, MessagingException.class); if (t != null) { MessagingException me = (MessagingException) t; handleMessagingException(me.getUmoMessage(), e); return; } t = getExceptionType(e, LifecycleException.class); if (t != null) { LifecycleException le = (LifecycleException) t; handleLifecycleException(le.getComponent(), e); if (RequestContext.getEventContext() != null) { handleMessagingException(RequestContext.getEventContext().getMessage(), e); } else { logger.info("There is no current event available, routing Null message with the exception"); handleMessagingException(new DefaultMuleMessage(NullPayload.getInstance()), e); } return; } handleStandardException(e); } protected Throwable getExceptionType(Throwable t, Class exceptionType) { while (t != null) { if (exceptionType.isAssignableFrom(t.getClass())) { return t; } t = t.getCause(); } return null; } /** * The initialise method is call every time the Exception stategy is assigned to * a service or connector. This implementation ensures that initialise is * called only once. The actual initialisation code is contained in the * doInitialise() method. * * @throws InitialisationException */ public final synchronized void initialise() throws InitialisationException { if (!initialised.get()) { doInitialise(muleContext); initialised.set(true); } } protected void doInitialise(MuleContext muleContext) throws InitialisationException { logger.info("Initialising exception listener: " + toString()); } /** * If there is a current transaction this method will mark it for rollback This * method should not be called if an event is routed from this exception handler * to an endpoint that should take part in the current transaction */ protected void handleTransaction(Throwable t) { Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (tx == null) { return; } //Work with the root exception, not anything thaat wraps it t = ExceptionHelper.getRootException(t); if (rollbackTxFilter == null && commitTxFilter == null) { //By default, rollback the transaction rollbackTransaction(); } else if (rollbackTxFilter != null && rollbackTxFilter.accept(t.getClass().getName())) { //the rollback filter take preceedence over th ecommit filter rollbackTransaction(); } else if (commitTxFilter != null && !commitTxFilter.accept(t.getClass().getName())) { //we only have to rollback if the commitTxFilter does NOT match rollbackTransaction(); } } protected void rollbackTransaction() { Transaction tx = TransactionCoordination.getInstance().getTransaction(); try { if (tx != null) { tx.setRollbackOnly(); } } catch (TransactionException e) { logException(e); } } /** * Routes the current exception to an error endpoint such as a Dead Letter Queue * (jms) This method is only invoked if there is a MuleMessage available to * dispatch. The message dispatched from this method will be an * ExceptionMessage which contains the exception thrown the * MuleMessage and any context information. * * @param message the MuleMessage being processed when the exception occurred * @param failedEndpoint optional; the endpoint being dispatched or received on * when the error occurred. This is NOT the endpoint that the message * will be disptched on and is only supplied to this method for * logging purposes * @param t the exception thrown. This will be sent with the ExceptionMessage * @see ExceptionMessage */ protected void routeException(MuleMessage message, ImmutableEndpoint failedEndpoint, Throwable t) { OutboundEndpoint endpoint = getEndpoint(t); if (endpoint != null) { try { logger.error("Message being processed is: " + (message == null ? "null" : message.toString())); MuleEventContext ctx = RequestContext.getEventContext(); String component = "Unknown"; EndpointURI endpointUri = null; if (ctx != null) { if (ctx.getService() != null) { component = ctx.getService().getName(); } endpointUri = ctx.getEndpointURI(); } else if (failedEndpoint != null) { endpointUri = failedEndpoint.getEndpointURI(); } ExceptionMessage msg; msg = new ExceptionMessage(getErrorMessagePayload(message), t, component, endpointUri); MuleMessage exceptionMessage; if (ctx == null) { exceptionMessage = new DefaultMuleMessage(msg); } else { exceptionMessage = new DefaultMuleMessage(msg, ctx.getMessage()); } MuleEvent exceptionEvent = new DefaultMuleEvent(exceptionMessage, endpoint, new DefaultMuleSession( exceptionMessage, new MuleSessionHandler(), muleContext), true); exceptionEvent = RequestContext.setEvent(exceptionEvent); endpoint.send(exceptionEvent); if (logger.isDebugEnabled()) { logger.debug("routed Exception message via " + endpoint); } } catch (MuleException e) { logFatal(message, e); } } else { handleTransaction(t); } } protected Object getErrorMessagePayload(MuleMessage message) { try { return message.getPayloadAsString(); } catch (Exception e) { logException(e); logger.info("Failed to read message payload as string, using raw payload"); return message.getPayload(); } } /** * Returns an endpoint for the given exception. ExceptionListeners can have * multiple endpoints registered on them. This methods allows custom * implementations to control which endpoint is used based on the exception * thrown. This implementation simply returns the first endpoint in the list. * * @param t the exception thrown * @return The endpoint used to dispatch an exception message on or null if there * are no endpoints registered */ protected OutboundEndpoint getEndpoint(Throwable t) { if (endpoints.size() > 0) { return (OutboundEndpoint) endpoints.get(0); } else { return null; } } /** * Used to log the error passed into this Exception Listener * * @param t the exception thrown */ protected void logException(Throwable t) { MuleException umoe = ExceptionHelper.getRootMuleException(t); if (umoe != null) { logger.error(umoe.getDetailedMessage()); } else { logger.error("Caught exception in Exception Strategy: " + t.getMessage(), t); } } /** * Logs a fatal error message to the logging system. This should be used mostly * if an error occurs in the exception listener itself. This implementation logs * the the message itself to the logs if it is not null * * @param message The MuleMessage currently being processed * @param t the fatal exception to log */ protected void logFatal(MuleMessage message, Throwable t) { logger.fatal( "Failed to dispatch message to error queue after it failed to process. This may cause message loss." + (message == null ? "" : "Logging Message here: \n" + message.toString()), t); } public boolean isInitialised() { return initialised.get(); } public void dispose() { // Template method } /** * Fires a server notification to all registered * {@link org.mule.api.context.notification.listener.ExceptionNotificationListener} * eventManager. * * @param notification the notification to fire. */ protected void fireNotification(ExceptionNotification notification) { if (muleContext != null) { muleContext.fireNotification(notification); } else if (logger.isWarnEnabled()) { logger.debug("MuleContext is not yet available for firing notifications, ignoring event: " + notification); } } public WildcardFilter getCommitTxFilter() { return commitTxFilter; } public void setCommitTxFilter(WildcardFilter commitTxFilter) { this.commitTxFilter = commitTxFilter; } public boolean isEnableNotifications() { return enableNotifications; } public void setEnableNotifications(boolean enableNotifications) { this.enableNotifications = enableNotifications; } public WildcardFilter getRollbackTxFilter() { return rollbackTxFilter; } public void setRollbackTxFilter(WildcardFilter rollbackTxFilter) { this.rollbackTxFilter = rollbackTxFilter; } /** * A messaging exception is thrown when an excpetion occurs during normal message * processing. A MessagingException holds a reference to the * current message that is passed into this method * * @param message the current message being processed * @param e the top level exception thrown. This may be a Messaging exception or * some wrapper exception * @see MessagingException */ public abstract void handleMessagingException(MuleMessage message, Throwable e); /** * A routing exception is thrown when an excpetion occurs during normal message * processing A RoutingException holds a reference to the current * message and te endpoint being routing to or from when the error occurred. Both * are passed into this method * * @param message the current message being processed * @param endpoint the endpoint being dispatched to or received from when the * error occurred * @param e the top level exception thrown. This may be a Messaging exception or * some wrapper exception * @see RoutingException */ public abstract void handleRoutingException(MuleMessage message, ImmutableEndpoint endpoint, Throwable e); /** * DefaultLifecyclePhase exceptions are thrown when an error occurs during an object's * lifecycle call such as start, stop or initialise. The exception contains a * reference to the object that failed which can be used for more informative * logging. * * @param service the object that failed during a lifecycle call * @param e the top level exception thrown. This may or may not be the * LifecycleException but a lifecycle exception will be * present in the exception stack. * @see LifecycleException */ public abstract void handleLifecycleException(Object component, Throwable e); /** * A handler for all other exceptions * * @param e the top level exception thrown */ public abstract void handleStandardException(Throwable e); } mule-2.0.1/core/src/main/java/org/mule/component/0000755000175000017500000000000011351411113021406 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/component/AbstractJavaComponent.java0000644000175000017500000001622110771736371026530 0ustar charlescharles/* * $Id: AbstractJavaComponent.java 11488 2008-03-24 14:38:49Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.component.JavaComponent; import org.mule.api.component.LifecycleAdapter; import org.mule.api.component.LifecycleAdapterFactory; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.model.EntryPointResolver; import org.mule.api.model.EntryPointResolverSet; import org.mule.api.object.ObjectFactory; import org.mule.api.routing.NestedRouterCollection; import org.mule.config.i18n.CoreMessages; import org.mule.model.resolvers.DefaultEntryPointResolverSet; import org.mule.routing.nested.DefaultNestedRouterCollection; import java.util.Collection; import java.util.Iterator; /** * Abstract implementation of JavaComponent adds JavaComponent specific's: * {@link EntryPointResolverSet}, {@link NestedRouterCollection} and * {@link ObjectFactory}. Provides default implementations of doOnCall and doOnEvent * and defines abstract template methods provided for obtaining and returning the * component object instance. */ public abstract class AbstractJavaComponent extends AbstractComponent implements JavaComponent { protected EntryPointResolverSet entryPointResolverSet; protected NestedRouterCollection nestedRouter = new DefaultNestedRouterCollection(); protected ObjectFactory objectFactory; protected LifecycleAdapterFactory lifecycleAdapterFactory; public AbstractJavaComponent() { // For Spring only } public AbstractJavaComponent(ObjectFactory objectFactory) { this(objectFactory, null, null); } public AbstractJavaComponent(ObjectFactory objectFactory, EntryPointResolverSet entryPointResolverSet, NestedRouterCollection nestedRouterCollection) { this.objectFactory = objectFactory; this.entryPointResolverSet = entryPointResolverSet; if (nestedRouterCollection != null) { this.nestedRouter = nestedRouterCollection; } } protected MuleMessage doOnCall(MuleEvent event) throws Exception { return invokeComponentInstance(event); } protected MuleMessage invokeComponentInstance(MuleEvent event) throws Exception { LifecycleAdapter componentLifecycleAdapter = null; try { componentLifecycleAdapter = borrowComponentLifecycleAdaptor(); return componentLifecycleAdapter.intercept(null); } finally { returnComponentLifecycleAdaptor(componentLifecycleAdapter); } } public Class getObjectType() { return objectFactory.getObjectClass(); } /** * Creates and initialises a new LifecycleAdaptor instance wrapped the component * object instance obtained from the configured object factory. * * @return * @throws MuleException * @throws Exception */ protected LifecycleAdapter createLifeCycleAdaptor() throws MuleException, Exception { LifecycleAdapter lifecycleAdapter; if (lifecycleAdapterFactory != null) { // Custom lifecycleAdapterFactory set on component lifecycleAdapter = lifecycleAdapterFactory.create(objectFactory.getInstance(), this, entryPointResolverSet); } else { // Inherit lifecycleAdapterFactory from model lifecycleAdapter = service.getModel().getLifecycleAdapterFactory().create(objectFactory.getInstance(), this, entryPointResolverSet); } lifecycleAdapter.initialise(); return lifecycleAdapter; } protected abstract LifecycleAdapter borrowComponentLifecycleAdaptor() throws Exception; protected abstract void returnComponentLifecycleAdaptor(LifecycleAdapter lifecycleAdapter) throws Exception; // @Override protected void doInitialise() throws InitialisationException { if (objectFactory == null) { throw new InitialisationException(CoreMessages.objectIsNull("object factory"), this); } // If this component was configured with spring the objectFactory instance // has already been initialised, yet if this component was no configured with // spring then the objectFactory is still uninitialised so we need to // initialise it here. objectFactory.initialise(); } // @Override protected void doStart() throws MuleException { // We need to resolve entry point resolvers here rather than in initialise() // because when configuring with spring, although the service has been // injected and is available the injected service construction has not been // completed and model is still in null. if (entryPointResolverSet == null) { entryPointResolverSet = service.getModel().getEntryPointResolverSet(); } } // @Override protected void doDispose() { // TODO This can't be implemented currently because AbstractService allows // disposed services to be re-initialised, and re-use of a disposed object // factory is not possible // objectFactory.dispose(); } public EntryPointResolverSet getEntryPointResolverSet() { return entryPointResolverSet; } public NestedRouterCollection getNestedRouter() { return nestedRouter; } public void setEntryPointResolverSet(EntryPointResolverSet entryPointResolverSet) { this.entryPointResolverSet = entryPointResolverSet; } public void setNestedRouter(NestedRouterCollection nestedRouter) { this.nestedRouter = nestedRouter; } /** * Allow for incremental addition of resolvers by for example the spring-config * module * * @param entryPointResolvers Resolvers to add */ public void setEntryPointResolvers(Collection entryPointResolvers) { if (null == entryPointResolverSet) { entryPointResolverSet = new DefaultEntryPointResolverSet(); } for (Iterator resolvers = entryPointResolvers.iterator(); resolvers.hasNext();) { entryPointResolverSet.addEntryPointResolver((EntryPointResolver) resolvers.next()); } } public ObjectFactory getObjectFactory() { return objectFactory; } public void setObjectFactory(ObjectFactory objectFactory) { this.objectFactory = objectFactory; } public LifecycleAdapterFactory getLifecycleAdapterFactory() { return lifecycleAdapterFactory; } public void setLifecycleAdapterFactory(LifecycleAdapterFactory lifecycleAdapterFactory) { this.lifecycleAdapterFactory = lifecycleAdapterFactory; } } mule-2.0.1/core/src/main/java/org/mule/component/DefaultLifecycleAdapterFactory.java0000644000175000017500000000333310767355640030336 0ustar charlescharles/* * $Id: DefaultLifecycleAdapterFactory.java 11379 2008-03-17 02:46:56Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component; import org.mule.api.MuleException; import org.mule.api.component.JavaComponent; import org.mule.api.component.LifecycleAdapter; import org.mule.api.component.LifecycleAdapterFactory; import org.mule.api.model.EntryPointResolverSet; /** * DefaultLifecycleAdapterFactory creates a DefaultLifeCycleAdapter. Users can * implement their own LifeCycleAdapter factories to control lifecycle events on their services such * as introduce other lifecycle events that are controlled by external changes. * * @see org.mule.api.component.LifecycleAdapter * @see org.mule.api.component.LifecycleAdapterFactory * @see org.mule.component.DefaultLifecycleAdapter * @see org.mule.component.DefaultLifecycleAdapterFactory */ public class DefaultLifecycleAdapterFactory implements LifecycleAdapterFactory { public DefaultLifecycleAdapterFactory() { super(); } /* * (non-Javadoc) * * @see org.mule.api.lifecycle.LifecycleAdapterFactory#create(java.lang.Object, * org.mule.api.UMODescriptor) */ public LifecycleAdapter create(Object pojoService, JavaComponent component, EntryPointResolverSet resolver) throws MuleException { return new DefaultLifecycleAdapter(pojoService, component, resolver); } } mule-2.0.1/core/src/main/java/org/mule/component/simple/0000755000175000017500000000000011351411113022677 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/component/simple/package.html0000644000175000017500000000024210745677442025207 0ustar charlescharles Mule A collection of simple mule components that can be useful to simplify configuration while testing. mule-2.0.1/core/src/main/java/org/mule/component/simple/NullComponent.java0000644000175000017500000000177010746275214026365 0ustar charlescharles/* * $Id: NullComponent.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component.simple; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; /** * NullComponent is a service that is used as a placeholder. This * implementation will throw an exception if a message is received for it. */ public class NullComponent implements Callable { public Object onCall(MuleEventContext context) throws Exception { throw new UnsupportedOperationException("This service cannot receive messages. Service is: " + context.getService().getName()); } } mule-2.0.1/core/src/main/java/org/mule/component/simple/BridgeComponent.java0000644000175000017500000000613610746275214026650 0ustar charlescharles/* * $Id: BridgeComponent.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component.simple; import org.mule.api.MuleEventContext; import org.mule.api.config.ConfigurationException; import org.mule.api.lifecycle.Callable; import org.mule.api.routing.InboundRouter; import org.mule.api.service.Service; import org.mule.api.service.ServiceAware; import org.mule.routing.inbound.DefaultInboundRouterCollection; import org.mule.routing.inbound.ForwardingConsumer; import org.mule.routing.inbound.InboundPassThroughRouter; import java.util.Iterator; /** * The BridgeComponent is a standard Mule service that enables a bridge between an inbound and outbound endpoints. * Transformers can be used on the endpoints to convert the data being received in order to 'bridge' from one * endpoint transport to another. When the BridgeComponent is used, it configures itself so that it will * not actually be invoked, instead it tells Mule to bypass invocation of the service, which has a slight performance * improvement. Note that because the service is never actually invoked any interceptors configured on the service * will not be invoked either. * * @deprecated along with bridge-service - use an empty service and, if you want an efficient transfer of messages, * add a forwarding-consumer. */ public class BridgeComponent implements ServiceAware, Callable { public Object onCall(MuleEventContext context) throws Exception { throw new UnsupportedOperationException( "A bridge should not ever receive an event, instead the event should be directly dispatched from the inbound endpoint to the outbound router. Service is: " + context.getService().getName()); } public void setService(Service service) throws ConfigurationException { // Add a ForwardingConsumer, which punts message to oubound router, unless already present boolean registered = false; if(service.getInboundRouter()==null) { service.setInboundRouter(new DefaultInboundRouterCollection()); } for (Iterator routers = service.getInboundRouter().getRouters().iterator(); routers.hasNext();) { InboundRouter router = (InboundRouter) routers.next(); //Remove if present if(router instanceof InboundPassThroughRouter) { service.getInboundRouter().removeRouter(router); } registered = registered || router instanceof ForwardingConsumer; } if (! registered) { service.getInboundRouter().addRouter(new ForwardingConsumer()); } // Make sure if other routers on the inbound router, they are honoured service.getInboundRouter().setMatchAll(true); } } mule-2.0.1/core/src/main/java/org/mule/component/simple/StaticComponent.java0000644000175000017500000000466710774254333026712 0ustar charlescharles/* * $Id: StaticComponent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component.simple; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.util.IOUtils; import java.io.IOException; /** * A service that will return a static data object as a result. This is useful for * testing with expected results. The data returned can be read from a file or set as * a property on this service. */ public class StaticComponent implements Callable, Initialisable { private Object data; private String dataFile; private String prefix; private String postfix; public void initialise() throws InitialisationException { if (dataFile != null) { try { data = IOUtils.getResourceAsString(dataFile, getClass()); } catch (IOException e) { throw new InitialisationException(e, this); } } } public Object getData() { return data; } public void setData(Object data) { this.data = data; } public String getDataFile() { return dataFile; } public void setDataFile(String dataFile) { this.dataFile = dataFile; } public String getPrefix() { return prefix; } public void setPrefix(String prefix) { this.prefix = prefix; } public String getPostfix() { return postfix; } public void setPostfix(String postfix) { this.postfix = postfix; } public Object onCall(MuleEventContext eventContext) throws Exception { if (data != null) { return data; } String eventData = eventContext.transformMessageToString(); if (prefix != null) { eventData = prefix + eventData; } if (postfix != null) { eventData += postfix; } return eventData; } } mule-2.0.1/core/src/main/java/org/mule/component/simple/LogComponent.java0000644000175000017500000000265310746275214026175 0ustar charlescharles/* * $Id: LogComponent.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component.simple; import org.mule.api.MuleEventContext; import org.mule.api.component.simple.LogService; import org.mule.api.lifecycle.Callable; import org.mule.util.StringMessageUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * LogComponent simply logs the content (or content length if it is a * large message) */ public class LogComponent implements Callable, LogService { private static Log logger = LogFactory.getLog(LogComponent.class); public Object onCall(MuleEventContext context) throws Exception { String contents = context.getMessageAsString(); String msg = "Message received in service: " + context.getService().getName(); msg = StringMessageUtils.getBoilerPlate(msg + ". Content is: '" + StringMessageUtils.truncate(contents, 100, true) + "'"); log(msg); return null; } public void log(String message) { logger.info(message); } } mule-2.0.1/core/src/main/java/org/mule/component/simple/EchoComponent.java0000644000175000017500000000167110745677442026341 0ustar charlescharles/* * $Id: EchoComponent.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component.simple; import org.mule.api.MuleEventContext; import org.mule.api.component.simple.EchoService; /** * EchoComponent will log the message and return the payload back as * the result. */ public class EchoComponent extends LogComponent implements EchoService { public Object onCall(MuleEventContext context) throws Exception { super.onCall(context); return context.transformMessage(); } public String echo(String echo) { return echo; } } mule-2.0.1/core/src/main/java/org/mule/component/simple/PassThroughComponent.java0000644000175000017500000000173211003252442027701 0ustar charlescharles/* * $Id: PassThroughComponent.java 11621 2008-04-22 03:01:54Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component.simple; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.component.AbstractComponent; /** * PassThroughComponent will simply return the payload back as the * result. This typically you don't need to specify this, since it is used by * default. */ public class PassThroughComponent extends AbstractComponent { // @Override protected MuleMessage doOnCall(MuleEvent event) throws Exception { event.transformMessage(); return event.getMessage(); } } mule-2.0.1/core/src/main/java/org/mule/component/builder/0000755000175000017500000000000011351411113023034 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/component/builder/MessageBuilderException.java0000644000175000017500000000251410745677442030504 0ustar charlescharles/* * $Id: MessageBuilderException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component.builder; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; /** * Thrown by a MessageBuilder implementation if it cannot build the current * message or some other error occurs. */ public class MessageBuilderException extends MessagingException { /** * Serial version */ private static final long serialVersionUID = 1144140732378649625L; public MessageBuilderException(Message message, MuleMessage umoMessage) { super(message, umoMessage); } public MessageBuilderException(Message message, MuleMessage umoMessage, Throwable cause) { super(message, umoMessage, cause); } public MessageBuilderException(MuleMessage umoMessage, Throwable cause) { super(CoreMessages.failedToBuildMessage(), umoMessage, cause); } } mule-2.0.1/core/src/main/java/org/mule/component/builder/ReflectionMessageBuilder.java0000644000175000017500000000526510745677442030646 0ustar charlescharles/* * $Id: ReflectionMessageBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component.builder; import org.mule.api.MuleMessage; import org.mule.config.i18n.CoreMessages; import org.mule.model.resolvers.NoSatisfiableMethodsException; import org.mule.model.resolvers.TooManySatisfiableMethodsException; import org.mule.util.ClassUtils; import java.lang.reflect.Method; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; /** * Will try and set the result of an invocation as a bean property on the request * message using reflection. */ public class ReflectionMessageBuilder extends AbstractMessageBuilder { // we don't want to match these methods when looking for a method protected final Set ignoreMethods = new HashSet(Arrays.asList(new String[]{"equals", "getInvocationHandler"})); public Object buildMessage(MuleMessage request, MuleMessage response) throws MessageBuilderException { Object master = request.getPayload(); Object property = response.getPayload(); List methods = null; try { methods = ClassUtils.getSatisfiableMethods(master.getClass(), new Class[]{property.getClass()}, true, false, ignoreMethods); } catch (Exception e) { throw new MessageBuilderException(request, e); } if (methods.size() == 0) { throw new MessageBuilderException(request, new NoSatisfiableMethodsException(master, new Class[]{property.getClass()})); } else if (methods.size() > 1) { throw new MessageBuilderException(request, new TooManySatisfiableMethodsException(master, new String[]{property.getClass().getName()})); } else { Method m = (Method) methods.get(0); try { m.invoke(master, (property.getClass().isArray() ? (Object[]) property : new Object[]{property})); } catch (Exception e) { throw new MessageBuilderException( CoreMessages.failedToInvoke(m.getName() + " on " + master.getClass().getName()), request, e); } } return master; } } mule-2.0.1/core/src/main/java/org/mule/component/builder/AbstractMessageBuilder.java0000644000175000017500000001143610757615756030317 0ustar charlescharles/* * $Id: AbstractMessageBuilder.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component.builder; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.component.builder.MessageBuilder; import org.mule.api.config.ConfigurationException; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.Callable; import org.mule.api.routing.OutboundRouter; import org.mule.api.service.Service; import org.mule.api.service.ServiceAware; import org.mule.util.StringMessageUtils; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A service that will invoke all outbound endpoints configured on the service * allow the result of each endpoint invocation to be aggregated to a single message. */ public abstract class AbstractMessageBuilder implements ServiceAware, Callable, MessageBuilder { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); protected Service service; public void setService(Service service) throws ConfigurationException { this.service = service; } public Object onCall(MuleEventContext eventContext) throws Exception { MuleMessage requestMessage = new DefaultMuleMessage(eventContext.transformMessage(), eventContext.getMessage()); MuleMessage responseMessage = null; Object builtMessage; if (service.getOutboundRouter().hasEndpoints()) { List endpoints = new ArrayList(); for (Iterator iterator = service.getOutboundRouter().getRouters().iterator(); iterator.hasNext();) { OutboundRouter router = (OutboundRouter) iterator.next(); endpoints.addAll(router.getEndpoints()); } for (Iterator iterator = endpoints.iterator(); iterator.hasNext();) { OutboundEndpoint endpoint = (OutboundEndpoint) iterator.next(); Object request = requestMessage.getPayload(); boolean rsync = eventContext.getMessage().getBooleanProperty( MuleProperties.MULE_REMOTE_SYNC_PROPERTY, endpoint.isRemoteSync()); if (!rsync) { logger.info("Endpoint: " + endpoint + " is not remoteSync enabled. Message builder finishing"); if (eventContext.isSynchronous()) { responseMessage = eventContext.sendEvent(requestMessage, endpoint); } else { eventContext.dispatchEvent(requestMessage, endpoint); responseMessage = null; } break; } else { responseMessage = eventContext.sendEvent(requestMessage, endpoint); if (logger.isDebugEnabled()) { logger.debug("Response Message Received from: " + endpoint.getEndpointURI()); } if (logger.isTraceEnabled()) { try { logger.trace("Message Payload: \n" + StringMessageUtils.truncate( StringMessageUtils.toString(responseMessage.getPayload()), 200, false)); } catch (Exception e) { // ignore } } builtMessage = buildMessage(new DefaultMuleMessage(request, requestMessage), responseMessage); responseMessage = new DefaultMuleMessage(builtMessage, responseMessage); requestMessage = new DefaultMuleMessage(responseMessage.getPayload(), responseMessage); } } } else { logger.info("There are currently no endpoints configured on service: " + service.getName()); } eventContext.setStopFurtherProcessing(true); return responseMessage; } } mule-2.0.1/core/src/main/java/org/mule/component/DefaultLifecycleAdapter.java0000644000175000017500000002615010774254333027003 0ustar charlescharles/* * $Id: DefaultLifecycleAdapter.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component; import org.mule.RequestContext; import org.mule.VoidResult; import org.mule.api.DefaultMuleException; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.component.JavaComponent; import org.mule.api.component.LifecycleAdapter; import org.mule.api.interceptor.Invocation; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.Startable; import org.mule.api.lifecycle.Stoppable; import org.mule.api.model.EntryPointResolverSet; import org.mule.api.routing.NestedRouter; import org.mule.api.service.ServiceAware; import org.mule.api.service.ServiceException; import org.mule.config.i18n.CoreMessages; import org.mule.model.resolvers.LegacyEntryPointResolverSet; import org.mule.model.resolvers.NoSatisfiableMethodsException; import org.mule.model.resolvers.TooManySatisfiableMethodsException; import org.mule.routing.nested.NestedInvocationHandler; import org.mule.transformer.TransformerTemplate; import org.mule.util.ClassUtils; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * DefaultLifecycleAdapter provides lifecycle methods for all Mule * managed components. It's possible to plugin custom lifecycle adapters, this can * provide additional lifecycle methods triggered by an external source. */ public class DefaultLifecycleAdapter implements LifecycleAdapter { /** logger used by this class */ protected static final Log logger = LogFactory.getLog(DefaultLifecycleAdapter.class); protected Object componentObject; protected JavaComponent component; private boolean isStoppable = false; private boolean isStartable = false; private boolean isDisposable = false; private boolean started = false; private boolean disposed = false; private EntryPointResolverSet entryPointResolver; public DefaultLifecycleAdapter(Object componentObject, JavaComponent component) throws MuleException { this(componentObject, component, new LegacyEntryPointResolverSet()); } public DefaultLifecycleAdapter(Object componentObject, JavaComponent component, EntryPointResolverSet entryPointResolver) throws MuleException { if (componentObject == null) { throw new IllegalArgumentException("POJO Service cannot be null"); } if (entryPointResolver == null) { entryPointResolver = new LegacyEntryPointResolverSet(); } this.componentObject = componentObject; this.component = component; this.entryPointResolver = entryPointResolver; isStartable = Startable.class.isInstance(componentObject); isStoppable = Stoppable.class.isInstance(componentObject); isDisposable = Disposable.class.isInstance(componentObject); if (componentObject instanceof ServiceAware) { ((ServiceAware) componentObject).setService(component.getService()); } configureNestedRouter(); } /** * Propagates start() life-cycle to component object implementations if they * implement the mule {@link Startable} interface. NOT: It is up to component * implementations to ensure their implementation of start() is thread-safe. */ public void start() throws MuleException { if (isStartable) { try { ((Startable) componentObject).start(); started = true; } catch (Exception e) { throw new DefaultMuleException(CoreMessages.failedToStart("UMO Service: " + component.getService().getName()), e); } } else { started = true; } } /** * Propagates stop() life-cycle to component object implementations if they * implement the mule {@link Stoppable} interface. NOT: It is up to component * implementations to ensure their implementation of stop() is thread-safe. */ public void stop() throws MuleException { if (isStoppable) { try { ((Stoppable) componentObject).stop(); started = false; } catch (Exception e) { throw new DefaultMuleException(CoreMessages.failedToStop("UMO Service: " + component.getService().getName()), e); } } else { started = false; } } /** * Propagates dispose() life-cycle to component object implementations if they * implement the mule {@link Disposable} interface. NOT: It is up to component * implementations to ensure their implementation of dispose() is thread-safe. */ public void dispose() { if (isDisposable) { try { ((Disposable) componentObject).dispose(); } catch (Exception e) { // TODO MULE-863: Handle or fail logger.error("failed to dispose: " + component.getService().getName(), e); } } disposed = true; } /** @return true if the service has been started */ public boolean isStarted() { return started; } /** @return whether the service managed by this lifecycle has been disposed */ public boolean isDisposed() { return disposed; } // Note: Invocation argument is not even used! public MuleMessage intercept(Invocation invocation) throws MuleException { // Invoke method Object result; MuleEvent event = RequestContext.getEvent(); try { // Use the overriding entrypoint resolver if one is set if (component.getEntryPointResolverSet() != null) { result = component.getEntryPointResolverSet().invoke(componentObject, RequestContext.getEventContext()); } else { result = entryPointResolver.invoke(componentObject, RequestContext.getEventContext()); } } catch (Exception e) { // should all Exceptions caught here be a ServiceException?!? // TODO MULE-863: See above throw new ServiceException(RequestContext.getEventContext().getMessage(), component.getService(), e); } MuleMessage resultMessage = null; if (result instanceof VoidResult) { // This will rewire the current message event.transformMessage(); resultMessage = event.getMessage(); } else if (result != null) { if (result instanceof MuleMessage) { resultMessage = (MuleMessage) result; } else { event.getMessage().applyTransformers( Collections.singletonList(new TransformerTemplate(new TransformerTemplate.OverwitePayloadCallback( result)))); resultMessage = event.getMessage(); } } return resultMessage; } /** * Propagates initialise() life-cycle to component object implementations if they * implement the mule {@link Initialisable} interface. *

    * NOTE: It is up to component implementations to ensure their implementation of * initialise() is thread-safe. */ public void initialise() throws InitialisationException { if (Initialisable.class.isInstance(componentObject)) { ((Initialisable) componentObject).initialise(); } } protected void configureNestedRouter() throws MuleException { // Initialise the nested router and bind the endpoints to the methods using a // Proxy if (component.getNestedRouter() != null) { Map bindings = new HashMap(); for (Iterator it = component.getNestedRouter().getRouters().iterator(); it.hasNext();) { NestedRouter nestedRouter = (NestedRouter) it.next(); Object proxy = bindings.get(nestedRouter.getInterface()); if (proxy == null) { // Create a proxy that implements this interface // and just routes away using a mule client // ( using the high level Mule client is probably // a bit agricultural but this is just POC stuff ) proxy = nestedRouter.createProxy(componentObject); bindings.put(nestedRouter.getInterface(), proxy); // Now lets set the proxy on the Service object Method setterMethod; List methods = ClassUtils.getSatisfiableMethods(componentObject.getClass(), new Class[]{nestedRouter.getInterface()}, true, false, null); if (methods.size() == 1) { setterMethod = (Method) methods.get(0); } else if (methods.size() > 1) { throw new TooManySatisfiableMethodsException(componentObject.getClass(), new Class[]{nestedRouter.getInterface()}); } else { throw new NoSatisfiableMethodsException(componentObject.getClass(), new Class[]{nestedRouter.getInterface()}); } try { setterMethod.invoke(componentObject, new Object[]{proxy}); } catch (Exception e) { throw new InitialisationException(CoreMessages.failedToSetProxyOnService(nestedRouter, componentObject.getClass()), e, this); } } else { NestedInvocationHandler handler = (NestedInvocationHandler) Proxy.getInvocationHandler(proxy); handler.addRouterForInterface(nestedRouter); } } } } } mule-2.0.1/core/src/main/java/org/mule/component/DefaultJavaComponent.java0000644000175000017500000001152110767456112026344 0ustar charlescharles/* * $Id: DefaultJavaComponent.java 11382 2008-03-17 11:55:54Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component; import org.mule.api.MuleException; import org.mule.api.component.JavaComponent; import org.mule.api.component.LifecycleAdapter; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.model.EntryPointResolverSet; import org.mule.api.model.ModelException; import org.mule.api.object.ObjectFactory; import org.mule.api.routing.NestedRouterCollection; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; /** * Default implementation of {@link JavaComponent}. Component lifecycle is * propagated to the component object instance via the {@link LifecycleAdapter}. */ public class DefaultJavaComponent extends AbstractJavaComponent { protected LifecycleAdapter singletonComponentLifecycleAdapter; public DefaultJavaComponent() { // For spring only super(); } public DefaultJavaComponent(ObjectFactory objectFactory) { super(objectFactory); } public DefaultJavaComponent(ObjectFactory objectFactory, EntryPointResolverSet entryPointResolverSet, NestedRouterCollection nestedRouterCollection) { super(objectFactory, entryPointResolverSet, nestedRouterCollection); } protected void doStart() throws MuleException { super.doStart(); // If this component is using a SingletonObjectFactory we should create // LifecycleAdaptor wrapper just once now and not on each event. This also // allows start/stop life-cycle methods to be propagated to singleton // component instances. if (objectFactory != null && objectFactory.isSingleton()) { // On first call, create and initialise singleton instance try { if (singletonComponentLifecycleAdapter == null) { singletonComponentLifecycleAdapter = createLifeCycleAdaptor(); } } catch (Exception e) { throw new InitialisationException( MessageFactory.createStaticMessage("Unable to create instance of POJO service"), e, this); } // On all calls, start if not started. if (!singletonComponentLifecycleAdapter.isStarted()) { try { singletonComponentLifecycleAdapter.start(); } catch (Exception e) { throw new ModelException(CoreMessages.failedToStart("Service '" + service.getName() + "'"), e); } } } } protected void doStop() throws MuleException { super.doStop(); // It only makes sense to propagate this life-cycle to singleton component // implementations if (singletonComponentLifecycleAdapter != null) { if (singletonComponentLifecycleAdapter.isStarted()) { try { singletonComponentLifecycleAdapter.stop(); } catch (Exception e) { throw new ModelException(CoreMessages.failedToStop("Service '" + service.getName() + "'"), e); } } } } protected void doDispose() { super.doDispose(); // It only makes sense to propagating this life-cycle to singleton component // implementations if (singletonComponentLifecycleAdapter != null) { singletonComponentLifecycleAdapter.dispose(); } } protected LifecycleAdapter borrowComponentLifecycleAdaptor() throws Exception { LifecycleAdapter componentLifecycleAdapter; if (singletonComponentLifecycleAdapter != null) { componentLifecycleAdapter = singletonComponentLifecycleAdapter; } else { componentLifecycleAdapter = createLifeCycleAdaptor(); componentLifecycleAdapter.start(); } return componentLifecycleAdapter; } protected void returnComponentLifecycleAdaptor(LifecycleAdapter lifecycleAdapter) throws Exception { if (singletonComponentLifecycleAdapter == null && lifecycleAdapter != null) { lifecycleAdapter.stop(); lifecycleAdapter.dispose(); lifecycleAdapter = null; } } } mule-2.0.1/core/src/main/java/org/mule/component/SimpleCallableJavaComponent.java0000644000175000017500000001463110770356575027644 0ustar charlescharles/* * $Id: SimpleCallableJavaComponent.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component; import org.mule.DefaultMuleEventContext; import org.mule.VoidResult; import org.mule.api.DefaultMuleException; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleRuntimeException; import org.mule.api.component.JavaComponent; import org.mule.api.component.LifecycleAdapter; import org.mule.api.lifecycle.Callable; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Startable; import org.mule.api.lifecycle.Stoppable; import org.mule.api.model.ModelException; import org.mule.api.object.ObjectFactory; import org.mule.config.i18n.CoreMessages; import org.mule.object.SingletonObjectFactory; import org.mule.transformer.TransformerTemplate; import edu.emory.mathcs.backport.java.util.Collections; /** * Simple {@link JavaComponent} implementation to be used when * {@link LifecycleAdapter} is not required because i) the object instance implements * {@link Callable} and so entry-point resolution is required and ii) nested-routers * are not used.
    An {@link ObjectFactory} can be set but must return object * instances that implement {@link Callable}. If one of the constructors that takes * just a Class or the instance itself is used then the * {@link SingletonObjectFactory} is used by default.
    This implementation * replaces and improves on OptimizedComponent/OptimizedMuleProxy */ public class SimpleCallableJavaComponent extends AbstractJavaComponent { private boolean started = false; public SimpleCallableJavaComponent() { // for spring } /** * Create an SimpleCallableJavaComponent instance using an object instance that * implements {@link Callable} * * @param callable */ public SimpleCallableJavaComponent(Callable callable) { objectFactory = new SingletonObjectFactory(callable); } /** * Create an SimpleCallableJavaComponent instance using an object class. This * class should implement {@link Callable}. * * @param callable * @throws DefaultMuleException if the Class specified does not implement * {@link Callable} */ public SimpleCallableJavaComponent(Class callable) throws DefaultMuleException { if (!(Callable.class.isAssignableFrom(callable))) { throw new DefaultMuleException(CoreMessages.objectNotOfCorrectType(callable, Callable.class)); } objectFactory = new SingletonObjectFactory(callable); } public SimpleCallableJavaComponent(ObjectFactory objectFactory) throws DefaultMuleException { if (!(Callable.class.isAssignableFrom(objectFactory.getObjectClass()))) { throw new DefaultMuleException(CoreMessages.objectNotOfCorrectType(objectFactory.getObjectClass(), Callable.class)); } this.objectFactory = objectFactory; } protected void doStart() throws MuleException { super.doStart(); if (Startable.class.isAssignableFrom(objectFactory.getObjectClass())) { try { ((Startable) objectFactory.getInstance()).start(); } catch (Exception e) { throw new ModelException(CoreMessages.failedToStart("Service '" + service.getName() + "'"), e); } } } protected void doStop() throws MuleException { super.doStop(); if (started && Stoppable.class.isAssignableFrom(objectFactory.getObjectClass())) { try { ((Stoppable) objectFactory.getInstance()).stop(); } catch (Exception e) { throw new ModelException(CoreMessages.failedToStop("Service '" + service.getName() + "'"), e); } } } protected void doDispose() { super.doDispose(); if (Disposable.class.isAssignableFrom(objectFactory.getObjectClass())) { try { ((Disposable) objectFactory.getInstance()).dispose(); } catch (Exception e) { logger.error("Unable to dispose component instance", e); } } } public Class getObjectType() { if (objectFactory != null) { return objectFactory.getObjectClass(); } else { return Callable.class; } } protected LifecycleAdapter borrowComponentLifecycleAdaptor() throws Exception { // no-op return null; } protected void returnComponentLifecycleAdaptor(LifecycleAdapter lifecycleAdapter) { // no-op } protected MuleMessage invokeComponentInstance(MuleEvent event) throws Exception { Object result = ((Callable) objectFactory.getInstance()).onCall(new DefaultMuleEventContext(event)); if (result instanceof VoidResult) { // This will rewire the current message event.transformMessage(); return event.getMessage(); } else if (result != null) { if (result instanceof MuleMessage) { return (MuleMessage) result; } else { event.getMessage().applyTransformers( Collections.singletonList(new TransformerTemplate(new TransformerTemplate.OverwitePayloadCallback( result)))); return event.getMessage(); } } else { return null; } } // @Override public void setObjectFactory(ObjectFactory objectFactory) { if (!(Callable.class.isAssignableFrom(objectFactory.getObjectClass()))) { throw new MuleRuntimeException(CoreMessages.objectNotOfCorrectType(objectFactory.getObjectClass(), Callable.class)); } super.setObjectFactory(objectFactory); } } mule-2.0.1/core/src/main/java/org/mule/component/PooledJavaComponent.java0000644000175000017500000001124610774254333026205 0ustar charlescharles/* * $Id: PooledJavaComponent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component; import org.mule.api.MuleException; import org.mule.api.component.Component; import org.mule.api.component.LifecycleAdapter; import org.mule.api.lifecycle.InitialisationCallback; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.model.EntryPointResolverSet; import org.mule.api.object.ObjectFactory; import org.mule.api.routing.NestedRouterCollection; import org.mule.config.PoolingProfile; import org.mule.util.pool.DefaultLifecycleEnabledObjectPool; import org.mule.util.pool.LifecyleEnabledObjectPool; import org.mule.util.pool.ObjectPool; /** * PooledJavaComponent implements pooling. */ public class PooledJavaComponent extends AbstractJavaComponent { protected PoolingProfile poolingProfile; protected LifecyleEnabledObjectPool lifecycleAdapterPool; public PooledJavaComponent() { super(); } public PooledJavaComponent(ObjectFactory objectFactory) { this(objectFactory, null); } public PooledJavaComponent(ObjectFactory objectFactory, PoolingProfile poolingProfile) { super(objectFactory); this.poolingProfile = poolingProfile; } public PooledJavaComponent(ObjectFactory objectFactory, PoolingProfile poolingProfile, EntryPointResolverSet entryPointResolverSet, NestedRouterCollection nestedRouterCollection) { super(objectFactory, entryPointResolverSet, nestedRouterCollection); this.poolingProfile = poolingProfile; } protected LifecycleAdapter borrowComponentLifecycleAdaptor() throws Exception { return (LifecycleAdapter) lifecycleAdapterPool.borrowObject(); } protected void returnComponentLifecycleAdaptor(LifecycleAdapter lifecycleAdapter) { lifecycleAdapterPool.returnObject(lifecycleAdapter); } protected void doStart() throws MuleException { super.doStart(); // Wrap pool's objectFactory with a LifeCycleAdaptor factory so we pool // LifeCycleAdaptor's and not just pojo instances. lifecycleAdapterPool = new DefaultLifecycleEnabledObjectPool(new LifeCycleAdaptorFactory(), poolingProfile); lifecycleAdapterPool.initialise(); lifecycleAdapterPool.start(); } protected void doStop() throws MuleException { super.doStop(); if (lifecycleAdapterPool != null) { lifecycleAdapterPool.stop(); lifecycleAdapterPool.close(); lifecycleAdapterPool = null; } } public void setPoolingProfile(PoolingProfile poolingProfile) { // TODO What happens if this is set while component is started? Should we i) // do nothing ii) issue warning iii) stop/start the pool // (!!) iv) throw exception? this.poolingProfile = poolingProfile; } public PoolingProfile getPoolingProfile() { return poolingProfile; } /** * LifeCycleAdaptorFactory wraps the Component' s * {@link ObjectFactory}. The LifeCycleAdaptorFactory "getInstance()" method * creates a new {@link LifecycleAdapter} wrapping the object instance obtained * for the component instance {@link ObjectFactory} set on the {@link Component}.
    * This allows us to keep {@link LifecycleAdapter} creation in the Component and * out of the {@link DefaultLifecyleEnabledObjectPool} and to use the generic * {@link ObjectPool} interface. */ protected class LifeCycleAdaptorFactory implements ObjectFactory { public Object getInstance() throws Exception { return createLifeCycleAdaptor(); } public Class getObjectClass() { return LifecycleAdapter.class; } public void initialise() throws InitialisationException { objectFactory.initialise(); } public void dispose() { objectFactory.dispose(); } public void addObjectInitialisationCallback(InitialisationCallback callback) { objectFactory.addObjectInitialisationCallback(callback); } public boolean isSingleton() { return false; } } } mule-2.0.1/core/src/main/java/org/mule/component/AbstractComponent.java0000644000175000017500000001530410774254333025723 0ustar charlescharles/* * $Id: AbstractComponent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component; import org.mule.OptimizedRequestContext; import org.mule.api.DefaultMuleException; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.component.Component; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.DisposeException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.service.ServiceException; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; import org.mule.management.stats.ComponentStatistics; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Abstract {@link Component} to be used by all {@link Component} implementations. */ public abstract class AbstractComponent implements Component { /** logger used by this class */ protected final Log logger = LogFactory.getLog(this.getClass()); protected Service service; protected ComponentStatistics statistics = null; protected final AtomicBoolean started = new AtomicBoolean(false); protected final AtomicBoolean stopping = new AtomicBoolean(false); protected final AtomicBoolean initialised = new AtomicBoolean(false); protected final AtomicBoolean disposing = new AtomicBoolean(false); protected final AtomicBoolean disposed = new AtomicBoolean(false); public AbstractComponent() { statistics = new ComponentStatistics(); } public MuleMessage onCall(MuleEvent event) throws MuleException { // Ensure we have event in ThreadLocal OptimizedRequestContext.unsafeSetEvent(event); if (logger.isTraceEnabled()) { logger.trace("Invoking " + this.getClass().getName() + "component for service " + service.getName()); } // Do some checks: i) check component is not disposed, ii) that it is started // and iii) that the event's endpoint is an inbound endpoint. checkDisposed(); if (!(event.getEndpoint() instanceof InboundEndpoint)) { throw new IllegalStateException( "Unable to process outbound event, components only process incoming events."); } if (stopping.get() || !started.get()) { throw new DefaultMuleException(CoreMessages.componentIsStopped(service.getName())); } // Invoke component implementation and gather statistics try { long startTime = 0; if (statistics.isEnabled()) { startTime = System.currentTimeMillis(); } MuleMessage result = doOnCall(event); if (statistics.isEnabled()) { statistics.addExecutionTime(System.currentTimeMillis() - startTime); } return result; } catch (MuleException me) { throw me; } catch (Exception e) { throw new ServiceException(CoreMessages.failedToInvoke(this.toString()), event.getMessage(), service, e); } } protected abstract MuleMessage doOnCall(MuleEvent event) throws Exception; public String toString() { return this.getClass().getName() + " component for: " + service.toString(); } public void release() { // nothing to do } public ComponentStatistics getStatistics() { return statistics; } public void setService(Service service) { this.service = service; } public Service getService() { return service; } public void initialise() throws InitialisationException { if (!initialised.get()) { if (logger.isInfoEnabled()) { logger.info("Initialising: " + this); } if (service == null) { throw new InitialisationException( MessageFactory.createStaticMessage("Component has not been initialized properly, no service."), this); } doInitialise(); initialised.set(true); } } protected void doInitialise() throws InitialisationException { // Default implementation is no-op } public void dispose() { disposing.set(true); try { if (started.get()) { stop(); } } catch (MuleException e) { logger.error(CoreMessages.failedToStop(toString())); } try { doDispose(); } catch (Exception e) { logger.warn(CoreMessages.failedToDispose(toString()), e); } finally { disposed.set(true); disposing.set(false); initialised.set(false); } } protected void doDispose() { // Default implementation is no-op } public void stop() throws MuleException { // If component is already disposed then ignore, don't fails, as stop() might // get called by service after spring has called disposed etc. if (!disposed.get() && started.get() && !stopping.get()) { stopping.set(true); if (logger.isInfoEnabled()) { logger.info("Stopping: " + this); } doStop(); started.set(false); stopping.set(false); } } protected void doStart() throws MuleException { // Default implementation is no-op } public void start() throws MuleException { checkDisposed(); if (!started.get()) { if (logger.isInfoEnabled()) { logger.info("Starting: " + this); } doStart(); started.set(true); } } protected void doStop() throws MuleException { // Default implementation is no-op } protected void checkDisposed() throws DisposeException { if (disposed.get()) { throw new DisposeException(CoreMessages.createStaticMessage("Cannot use a disposed component"), this); } } } mule-2.0.1/core/src/main/java/org/mule/api/0000755000175000017500000000000011351411122020155 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/MessagingException.java0000644000175000017500000000621710745677442024653 0ustar charlescharles/* * $Id: MessagingException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.config.MuleManifest; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; import org.mule.transport.NullPayload; import java.util.Map; /** * MessagingException is a general message exception thrown when * errors specific to Message processing occur.. */ public class MessagingException extends MuleException { /** * Serial version */ private static final long serialVersionUID = 6941498759267936649L; /** * The MuleMessage being processed when the error occurred */ protected final transient MuleMessage umoMessage; public MessagingException(Message message, MuleMessage umoMessage) { super(); this.umoMessage = umoMessage; setMessage(generateMessage(message)); } public MessagingException(Message message, MuleMessage umoMessage, Throwable cause) { super(cause); this.umoMessage = umoMessage; setMessage(generateMessage(message)); } public MessagingException(Message message, Object payload) { super(); if (payload == null) { this.umoMessage = RequestContext.getEventContext().getMessage(); } else { this.umoMessage = new DefaultMuleMessage(payload, (Map) null); } setMessage(generateMessage(message)); } public MessagingException(Message message, Object payload, Throwable cause) { super(cause); if (payload == null) { this.umoMessage = RequestContext.getEventContext().getMessage(); } else { this.umoMessage = new DefaultMuleMessage(payload, (Map) null); } setMessage(generateMessage(message)); } private String generateMessage(Message message) { StringBuffer buf = new StringBuffer(80); if (message != null) { buf.append(message.getMessage()).append(". "); } if (umoMessage != null) { Object payload = umoMessage.getPayload(); if (payload == null) { payload = NullPayload.getInstance(); } buf.append(CoreMessages.messageIsOfType(payload.getClass()).getMessage()); addInfo("Payload", payload.toString()); } else { buf.append("The current MuleMessage is null! Please report this to ").append(MuleManifest.getDevListEmail()); addInfo("Payload", NullPayload.getInstance().toString()); } return buf.toString(); } public MuleMessage getUmoMessage() { return umoMessage; } } mule-2.0.1/core/src/main/java/org/mule/api/MuleContext.java0000755000175000017500000001606510766637211023324 0ustar charlescharles/* * $Id: MuleContext.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.api.config.MuleConfiguration; import org.mule.api.config.ThreadingProfile; import org.mule.api.context.WorkManager; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.ServerNotificationListener; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.Lifecycle; import org.mule.api.lifecycle.LifecycleManager; import org.mule.api.registry.RegistrationException; import org.mule.api.registry.Registry; import org.mule.api.security.SecurityManager; import org.mule.api.transport.ConnectionStrategy; import org.mule.context.notification.NotificationException; import org.mule.context.notification.ServerNotificationManager; import org.mule.management.stats.AllStatistics; import org.mule.util.queue.QueueManager; import javax.resource.spi.work.WorkListener; import javax.transaction.TransactionManager; public interface MuleContext extends Lifecycle { /** * Sets the Jta Transaction Manager to use with this Mule server instance * * @param manager the manager to use * @throws Exception */ void setTransactionManager(TransactionManager manager) throws Exception; /** * Returns the Jta transaction manager used by this Mule server instance. or * null if a transaction manager has not been set * * @return the Jta transaction manager used by this Mule server instance. or * null if a transaction manager has not been set */ TransactionManager getTransactionManager(); ServerNotificationManager getNotificationManager(); /** * Determines if the server has been started * * @return true if the server has been started */ boolean isStarted(); /** * Determines if the server has been initialised * * @return true if the server has been initialised */ boolean isInitialised(); /** * Determines if the server is being initialised * * @return true if the server is beening initialised */ boolean isInitialising(); boolean isDisposed(); boolean isDisposing(); /** * Registers an intenal server event listener. The listener will be notified * when a particular event happens within the server. Typically this is not * an event in the same sense as an MuleEvent (although there is nothing * stopping the implementation of this class triggering listeners when a * MuleEvent is received). *

    * The types of notifications fired is entirely defined by the implementation of * this class * * @param l the listener to register */ void registerListener(ServerNotificationListener l) throws NotificationException; /** * Registers an intenal server event listener. The listener will be notified * when a particular event happens within the server. Typically this is not * an event in the same sense as an MuleEvent (although there is nothing * stopping the implementation of this class triggering listeners when a * MuleEvent is received). *

    * The types of notifications fired is entirely defined by the implementation of * this class * * @param l the listener to register * @param resourceIdentifier a particular resource name for the given type * of listener For example, the resourceName could be the name of * a service if the listener was a ServiceNotificationListener */ void registerListener(ServerNotificationListener l, String resourceIdentifier) throws NotificationException; /** * Unregisters a previously registered listener. If the listener has not * already been registered, this method should return without exception * * @param l the listener to unregister */ void unregisterListener(ServerNotificationListener l); /** * Fires a server notification to all regiistered listeners * * @param notification the notification to fire */ void fireNotification(ServerNotification notification); /** * Sets the security manager used by this Mule instance to authenticate and * authorise incoming and outgoing event traffic and service invocations * * @param securityManager the security manager used by this Mule instance to * authenticate and authorise incoming and outgoing event traffic * and service invocations * @throws RegistrationException */ void setSecurityManager(SecurityManager securityManager) throws InitialisationException, RegistrationException; /** * Gets the security manager used by this Mule instance to authenticate and * authorise incoming and outgoing event traffic and service invocations * * @return he security manager used by this Mule instance to authenticate * and authorise incoming and outgoing event traffic and service * invocations */ SecurityManager getSecurityManager(); /** * Obtains a workManager instance that can be used to schedule work in a * thread pool. This will be used primarially by UMOAgents wanting to * schedule work. This work Manager must never be used by provider * implementations as they have their own workManager accible on the * connector. * * @return a workManager instance used by the current MuleManager */ WorkManager getWorkManager(); WorkListener getWorkListener(); /** * Sets the queue manager used by mule for queuing events. This is used for * service queues * * @param queueManager * @throws RegistrationException * */ void setQueueManager(QueueManager queueManager) throws RegistrationException; /** * Gets the queue manager used by mule for queuing events. This is used for * service queues. * * @return * */ QueueManager getQueueManager(); public AllStatistics getStatistics(); LifecycleManager getLifecycleManager(); Registry getRegistry(); void applyLifecycle(Object object) throws MuleException; MuleConfiguration getConfiguration(); ThreadingProfile getDefaultMessageDispatcherThreadingProfile(); ThreadingProfile getDefaultMessageRequesterThreadingProfile(); ThreadingProfile getDefaultMessageReceiverThreadingProfile(); ThreadingProfile getDefaultComponentThreadingProfile(); ThreadingProfile getDefaultThreadingProfile(); ConnectionStrategy getDefaultConnectionStrategy(); /** * Returns the date when the server was started. */ long getStartDate(); } mule-2.0.1/core/src/main/java/org/mule/api/package.html0000644000175000017500000000034010745677442022464 0ustar charlescharles The Universal Message Object(tm) API provides a way for components to interact without needing to know about the protocol or delivery mechanisms of information passed between them mule-2.0.1/core/src/main/java/org/mule/api/work/0000755000175000017500000000000011351411116021142 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/work/WorkExecutor.java0000644000175000017500000000355710745677442024506 0ustar charlescharles/* * $Id: WorkExecutor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ /** * * Copyright 2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mule.api.work; import org.mule.work.WorkerContext; import javax.resource.spi.work.WorkException; import edu.emory.mathcs.backport.java.util.concurrent.Executor; /** * WorkExecutor TODO */ public interface WorkExecutor { /** * This method must be implemented by sub-classes in order to provide the * relevant synchronization policy. It is called by the executeWork template * method. * * @param work Work to be executed. * @throws javax.resource.spi.work.WorkException Indicates that the work has * failed. * @throws InterruptedException Indicates that the thread in charge of the * execution of the specified work has been interrupted. */ void doExecute(WorkerContext work, Executor executor) throws WorkException, InterruptedException; } mule-2.0.1/core/src/main/java/org/mule/api/object/0000755000175000017500000000000011351411121021422 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/object/ObjectFactory.java0000644000175000017500000000306410767256152025053 0ustar charlescharles/* * $Id: ObjectFactory.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.object; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationCallback; /** * ObjectFactory is a generic Factory interface. */ public interface ObjectFactory extends Initialisable, Disposable { /** * Retrieve an instance of the object. This may create a new instance or look up * an existing instance depending on the implementation. If a new instance is * created it will also be initialized by this method * (Initilisable.initialise()). */ Object getInstance() throws Exception; /** * Returns the class of the object to be instantiated without actually creating * an instance. This may not be logical or even possible depending on the * implementation. */ Class getObjectClass(); /** * Returns true if the ObjectFactory implementation always returns the same object * instance. * * @return */ boolean isSingleton(); /** * Register a custom initialiser */ void addObjectInitialisationCallback(InitialisationCallback callback); } mule-2.0.1/core/src/main/java/org/mule/api/MuleEventContext.java0000644000175000017500000004641510757615756024337 0ustar charlescharles/* * $Id: MuleEventContext.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transformer.TransformerException; import java.io.OutputStream; /** * MuleEventContext is the context object for the current request. * Using the context, developers can send/dispatch/receive events programmatically as * well as manage transactions. */ public interface MuleEventContext { /** * Returns the message payload for this event * * @return the message payload for this event */ MuleMessage getMessage(); /** * Returns the contents of the message as a byte array. * * @return the contents of the message as a byte array * @throws MuleException if the message cannot be converted into an array of bytes */ byte[] getMessageAsBytes() throws MuleException; /** * Returns the message transformed into it's recognised or expected format. The * transformer used is the one configured on the endpoint through which this * event was received. * * @return the message transformed into it's recognised or expected format. * @throws org.mule.api.transformer.TransformerException if a failure occurs in * the transformer * @see org.mule.api.transformer.Transformer */ Object transformMessage() throws TransformerException; /** * Returns the message transformed into it's recognised or expected format. The * transformer used is the one configured on the endpoint through which this * event was received. * * @param expectedType The class type required for the return object. This param * just provides a convienient way to manage type casting of * transformed objects * @return the message transformed into it's recognised or expected format. * @throws org.mule.api.transformer.TransformerException if a failure occurs or * if the return type is not the same as the expected type in the * transformer * @see org.mule.api.transformer.Transformer */ Object transformMessage(Class expectedType) throws TransformerException; /** * Returns the message transformed into it's recognised or expected format and * then into an array of bytes. The transformer used is the one configured on the * endpoint through which this event was received. * * @return the message transformed into it's recognised or expected format as an * array of bytes. * @throws TransformerException if a failure occurs in the transformer * @see org.mule.api.transformer.Transformer */ byte[] transformMessageToBytes() throws TransformerException; /** * Returns the message transformed into it's recognised or expected format and * then into a String. The transformer used is the one configured on the endpoint * through which this event was received. This method will use the encoding set * on the event * * @return the message transformed into it's recognised or expected format as a * Strings. * @throws TransformerException if a failure occurs in the transformer * @see org.mule.api.transformer.Transformer */ String transformMessageToString() throws TransformerException; /** * Returns the message contents as a string This method will use the encoding set * on the event * * @return the message contents as a string * @throws MuleException if the message cannot be converted into a string */ String getMessageAsString() throws MuleException; /** * Returns the message contents as a string * * @param encoding The encoding to use when transforming the message * @return the message contents as a string * @throws MuleException if the message cannot be converted into a string */ String getMessageAsString(String encoding) throws MuleException; /** * Returns the current transaction (if any) for the session * * @return the current transaction for the session or null if there is no * transaction in progress */ Transaction getCurrentTransaction(); /** * Mark the current transaction (if any) for rollback * * @throws TransactionException */ void markTransactionForRollback() throws TransactionException; /** * This will send an event via the configured outbound router on the service * * @param message the message to send * @return the result of the send if any * @throws MuleException if there is no outbound endpoint configured on the * service or the events fails during dispatch */ MuleMessage sendEvent(Object message) throws MuleException; /** * Depending on the session state this methods either Passes an event * synchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the message payload to send * @return the return Message from the call or null if there was no result * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ MuleMessage sendEvent(MuleMessage message) throws MuleException; /** * Depending on the session state this methods either Passes an event * synchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpoint The endpointUri to disptch the event through * @return the return Message from the call or null if there was no result * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ MuleMessage sendEvent(MuleMessage message, EndpointURI endpoint) throws MuleException; /** * Depending on the session state this methods either Passes an event * synchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpointName The endpoint name to disptch the event through. This will * be looked up first on the service configuration and then on the * mule manager configuration * @return the return Message from the call or null if there was no result * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ MuleMessage sendEvent(MuleMessage message, String endpointName) throws MuleException; /** * Depending on the session state this methods either Passes an event * synchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpoint The endpoint to disptch the event through. * @return the return Message from the call or null if there was no result * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ MuleMessage sendEvent(MuleMessage message, OutboundEndpoint endpoint) throws MuleException; /** * sends an event request via the configured outbound router for this service. * This method return immediately, but the result of the event invocation * available from the returned a Future result that can be accessed later by the * the returned FutureMessageResult. the Future messageResult can be queried at * any time to check that the invocation has completed. A timeout is associated * with the invocation, which is the maximum time in milli-seconds that the * invocation should take to complete * * @param message the object that is the payload of the event * @param timeout how long to block in milliseconds waiting for a result * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found * @see FutureMessageResult */ FutureMessageResult sendEventAsync(Object message, int timeout) throws MuleException; /** * sends an event request via the configured outbound router for this service. * This method return immediately, but the result of the event invocation * available from the returned a Future result that can be accessed later by the * the returned FutureMessageResult. the Future messageResult can be queried at * any time to check that the invocation has completed. A timeout is associated * with the invocation, which is the maximum time in milli-seconds that the * invocation should take to complete * * @param message the MuleMessage of the event * @param timeout how long to block in milliseconds waiting for a result * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found * @see FutureMessageResult */ FutureMessageResult sendEventAsync(MuleMessage message, int timeout) throws MuleException; /** * sends an event request via the configured outbound router for this service. * This method return immediately, but the result of the event invocation * available from the returned a Future result that can be accessed later by the * the returned FutureMessageResult. the Future messageResult can be queried at * any time to check that the invocation has completed. A timeout is associated * with the invocation, which is the maximum time in milli-seconds that the * invocation should take to complete * * @param message the MuleMessage of the event * @param endpoint the endpointUri to dispatch to * @param timeout how long to block in milliseconds waiting for a result * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found * @see FutureMessageResult */ FutureMessageResult sendEventAsync(MuleMessage message, EndpointURI endpoint, int timeout) throws MuleException; /** * sends an event request via the configured outbound router for this service. * This method return immediately, but the result of the event invocation * available from the returned a Future result that can be accessed later by the * the returned FutureMessageResult. the Future messageResult can be queried at * any time to check that the invocation has completed. A timeout is associated * with the invocation, which is the maximum time in milli-seconds that the * invocation should take to complete * * @param message the MuleMessage of the event * @param endpointName The endpoint name to disptch the event through. This will * be looked up first on the service configuration and then on the * mule manager configuration * @param timeout how long to block in milliseconds waiting for a result * @return the result message if any of the invocation * @throws org.mule.api.MuleException if the dispatch fails or the components or * transfromers cannot be found * @see FutureMessageResult */ FutureMessageResult sendEventAsync(MuleMessage message, String endpointName, int timeout) throws MuleException; /** * This will dispatch an event asynchronously via the configured outbound * endpoint on the service for this session * * @param message the message to send * @throws MuleException if there is no outbound endpoint configured on the * service or the events fails during dispatch */ void dispatchEvent(MuleMessage message) throws MuleException; /** * This will dispatch an event asynchronously via the configured outbound * endpoint on the service for this session * * @param payload the message payloadto send * @throws MuleException if there is no outbound endpoint configured on the * service or the events fails during dispatch */ void dispatchEvent(Object payload) throws MuleException; /** * Depending on the session state this methods either Passes an event * asynchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpoint the endpointUri to dispatc the event to first on the service * configuration and then on the mule manager configuration * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ void dispatchEvent(MuleMessage message, EndpointURI endpoint) throws MuleException; /** * Depending on the session state this methods either Passes an event * asynchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event. * * @param message the event message payload to send * @param endpointName The endpoint name to disptch the event through. This will * be looked up first on the service configuration and then on the * mule manager configuration * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ void dispatchEvent(MuleMessage message, String endpointName) throws MuleException; /** * Depending on the session state this methods either Passes an event * asynchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpoint The endpoint name to disptch the event through. * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ void dispatchEvent(MuleMessage message, OutboundEndpoint endpoint) throws MuleException; /** * Requests a synchronous receive of an event on the service. * * @param endpoint the endpoint identifying the endpointUri on which the event * will be received * @param timeout time in milliseconds before the request times out * @return The requested event or null if the request times out * @throws MuleException if the request operation fails */ MuleMessage requestEvent(InboundEndpoint endpoint, long timeout) throws MuleException; /** * Requests a synchronous receive of an event on the service. * * @param endpointName the endpoint identifying the endpointUri on which the * event will be received * @param timeout time in milliseconds before the request timesout * @return The requested event or null if the request times out * @throws MuleException if the request operation fails */ MuleMessage requestEvent(String endpointName, long timeout) throws MuleException; /** * Requests a synchronous receive of an event on the service. * * @param endpoint the endpointUri on which the event will be received * @param timeout time in milliseconds before the request timesout * @return The requested event or null if the request times out * @throws MuleException if the request operation fails */ MuleMessage requestEvent(EndpointURI endpoint, long timeout) throws MuleException; Service getService(); /** * Determines whether the default processing for this event will be executed. By * default, the Mule server will route events according to a components * configuration. The user can override this behaviour by obtaining a reference * to the MuleEvent context, either by implementing * org.mule.api.lifecycle.Callable or calling * UMOManager.getEventContext to obtain the MuleEventContext for * the current thread. The user can programmatically control how events are * dispached. * * @return Returns true is the user has set stopFurtherProcessing. * @see org.mule.api.context.UMOManager * @see MuleEventContext * @see org.mule.api.lifecycle.Callable */ boolean isStopFurtherProcessing(); /** * Determines whether the default processing for this event will be executed. By * default, the Mule server will route events according to a components * configuration. The user can override this behaviour by obtaining a reference * to the MuleEvent context, either by implementing * org.mule.api.lifecycle.Callable or calling * UMOManager.getEventContext to obtain the MuleEventContext for * the current thread. The user can programmatically control how events are * dispached. * * @param stopFurtherProcessing the value to set. */ void setStopFurtherProcessing(boolean stopFurtherProcessing); /** * An outputstream the can optionally be used write response data to an incoming * message. * * @return an output strem if one has been made available by the message receiver * that received the message */ OutputStream getOutputStream(); /** * Determines whether the was sent synchrounously or not * * @return true if the event is synchronous */ boolean isSynchronous(); /** * Returns a reference to the Endpoint Uri for this context This is the endpoint * on which the event was received * * @return the receive endpoint for this event context */ EndpointURI getEndpointURI(); /** * Returns the transaction for the current event or null if there is no * transaction in progresss * * @return the transaction for the current event or null if there is no * transaction in progresss */ Transaction getTransaction(); /** * Get the timeout value associated with the event * * @return the timeout for the event */ int getTimeout(); /** * Gets the encoding for the current message. For potocols that send encoding * Information with the message, this method should be overriden to expose the * transport encoding, otherwise the default encoding in the Mule configuration * will be used * * @return the encoding for this message. This method must never return null */ String getEncoding(); MuleSession getSession(); MuleContext getMuleContext(); } mule-2.0.1/core/src/main/java/org/mule/api/ExceptionPayload.java0000644000175000017500000000150210745677442024317 0ustar charlescharles/* * $Id: ExceptionPayload.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import java.io.Serializable; import java.util.Map; /** * ExceptionPayload is a message payload that contains exception * information that occurred during message processing. */ public interface ExceptionPayload extends Serializable { int getCode(); String getMessage(); Map getInfo(); Throwable getException(); Throwable getRootException(); } mule-2.0.1/core/src/main/java/org/mule/api/MuleEvent.java0000644000175000017500000002234610746275214022754 0ustar charlescharles/* * $Id: MuleEvent.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.security.Credentials; import org.mule.api.service.Service; import org.mule.api.transformer.TransformerException; import java.io.OutputStream; /** * MuleEvent represents any data event occuring in the Mule * environment. All data sent or received within the mule environment will be passed * between components as an MuleEvent.

    The MuleEvent holds a MuleMessage * payload and provides helper methods for obtaining the data in a format that the * receiving Mule UMO understands. The event can also maintain any number of * properties that can be set and retrieved by Mule UMO components. * * @see MuleMessage */ public interface MuleEvent { int TIMEOUT_WAIT_FOREVER = 0; int TIMEOUT_DO_NOT_WAIT = -1; int TIMEOUT_NOT_SET_VALUE = Integer.MIN_VALUE; /** * Returns the message payload for this event * * @return the message payload for this event */ MuleMessage getMessage(); Credentials getCredentials(); /** * Reterns the conents of the message as a byte array. * * @return the conents of the message as a byte array * @throws MuleException if the message cannot be converted into an array of bytes */ byte[] getMessageAsBytes() throws MuleException; /** * Transforms the message into it's recognised or expected format. The * transformer used is the one configured on the endpoint through which this * event was received. * * @return the message transformed into it's recognised or expected format. * @throws TransformerException if a failure occurs in the transformer * @see org.mule.api.transformer.Transformer */ Object transformMessage() throws TransformerException; /** * Transforms the message into the requested format. The transformer used is * the one configured on the endpoint through which this event was received. * * @param outputType The requested output type. * @return the message transformed into it's recognised or expected format. * @throws TransformerException if a failure occurs in the transformer * @see org.mule.api.transformer.Transformer */ Object transformMessage(Class outputType) throws TransformerException; /** * Transforms the message into it's recognised or expected format and then * into an array of bytes. The transformer used is the one configured on the * endpoint through which this event was received. * * @return the message transformed into it's recognised or expected format as an * array of bytes. * @throws TransformerException if a failure occurs in the transformer * @see org.mule.api.transformer.Transformer */ byte[] transformMessageToBytes() throws TransformerException; /** * Returns the message transformed into it's recognised or expected format and * then into a String. The transformer used is the one configured on the endpoint * through which this event was received. If necessary this will use the encoding * set on the event * * @return the message transformed into it's recognised or expected format as a * Strings. * @throws TransformerException if a failure occurs in the transformer * @see org.mule.api.transformer.Transformer */ String transformMessageToString() throws TransformerException; /** * Returns the message contents as a string If necessary this will use the * encoding set on the event * * @return the message contents as a string * @throws MuleException if the message cannot be converted into a string */ String getMessageAsString() throws MuleException; /** * Returns the message contents as a string * * @param encoding the encoding to use when converting the message to string * @return the message contents as a string * @throws MuleException if the message cannot be converted into a string */ String getMessageAsString(String encoding) throws MuleException; /** * Every event in the system is assigned a universally unique id (UUID). * * @return the unique identifier for the event */ String getId(); /** * Gets a property associated with the current event. If * exhaustiveSearch is true, the endpoint and connector associated * with the event will also be searched for the property. * * @param name the property name * @param exhaustiveSearch also search the endpoint and connector for the * property * @return the property value or null if the property does not exist */ Object getProperty(String name, boolean exhaustiveSearch); /** * Gets a property associated with the current event. If * exhaustiveSearch is true, the endpoint and connector associated * with the event will also be searched for the property. * * @param name the property name * @param defaultValue a default value if the property doesn't exist in the event * @param exhaustiveSearch also search the endpoint and connector for the * property * @return the property value or the defaultValue if the property does not exist */ Object getProperty(String name, Object defaultValue, boolean exhaustiveSearch); /** * Gets the endpoint associated with this event * * @return the endpoint associated with this event */ ImmutableEndpoint getEndpoint(); /** * Retrieves the service session for the current event * * @return the service session for the event */ MuleSession getSession(); /** * Retrieves the service for the current event * * @return the service for the event */ Service getService(); /** * Determines whether the default processing for this event will be executed. By * default, the Mule server will route events according to a components * configuration. The user can override this behaviour by obtaining a reference * to the MuleEvent context, either by implementing * org.mule.api.lifecycle.Callable or calling * UMOManager.getEventContext to obtain the MuleEventContext for * the current thread. The user can programmatically control how events are * dispached. * * @return Returns true is the user has set stopFurtherProcessing. * @see org.mule.api.context.UMOManager * @see MuleEventContext * @see org.mule.api.lifecycle.Callable */ boolean isStopFurtherProcessing(); /** * Determines whether the default processing for this event will be executed. By * default, the Mule server will route events according to a components * configuration. The user can override this behaviour by obtaining a reference * to the MuleEvent context, either by implementing * org.mule.api.lifecycle.Callable or calling * UMOManager.getEventContext to obtain the MuleEventContext for * the current thread. The user can programmatically control how events are * dispached. * * @param stopFurtherProcessing the value to set. */ void setStopFurtherProcessing(boolean stopFurtherProcessing); /** * Determines whether the was sent synchrounously or not * * @return true if the event is synchronous */ boolean isSynchronous(); /** * Determines whether the was sent synchrounously or not * * @param value true if the event is synchronous */ void setSynchronous(boolean value); /** * The number of milliseconds to wait for a return event when running * synchronously. 0 wait forever -1 try and receive, but do not wait or a * positive millisecond value * * @return the event timeout in milliseconds */ int getTimeout(); /** * The number of milliseconds to wait for a return event when running * synchronously. 0 wait forever -1 try and receive, but do not wait or a * positive millisecod value * * @param timeout the event timeout in milliseconds */ void setTimeout(int timeout); /** * An outputstream the can optionally be used write response data to an incoming * message. * * @return an output strem if one has been made available by the message receiver * that received the message */ OutputStream getOutputStream(); /** * Gets the encoding for this message. * * @return the encoding for the event. This must never return null. */ String getEncoding(); /** * Returns the muleContext for the Mule node that this event was received in * @return the muleContext for the Mule node that this event was received in */ MuleContext getMuleContext(); } mule-2.0.1/core/src/main/java/org/mule/api/endpoint/0000755000175000017500000000000011351411116022000 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/endpoint/InboundEndpoint.java0000644000175000017500000000111710757625263025765 0ustar charlescharles/* * $Id: InboundEndpoint.java 10964 2008-02-22 20:04:03Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.endpoint; import org.mule.api.transport.MessageRequesting; public interface InboundEndpoint extends ImmutableEndpoint, MessageRequesting { } mule-2.0.1/core/src/main/java/org/mule/api/endpoint/package.html0000644000175000017500000000010110745677442024277 0ustar charlescharles Endpoint interfaces. mule-2.0.1/core/src/main/java/org/mule/api/endpoint/EndpointNotFoundException.java0000644000175000017500000000274710745677442030017 0ustar charlescharles/* * $Id: EndpointNotFoundException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.endpoint; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; /** * EndpointNotFoundException is thrown when an endpoint name or * protocol is specified but a matching endpoint is not registered with the Mule * server */ public class EndpointNotFoundException extends EndpointException { /** * Serial version */ private static final long serialVersionUID = 790450139906970837L; public EndpointNotFoundException(String endpoint) { super(CoreMessages.endpointNotFound(endpoint)); } /** * @param message the exception message */ public EndpointNotFoundException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public EndpointNotFoundException(Message message, Throwable cause) { super(message, cause); } public EndpointNotFoundException(Throwable cause) { super(cause); } } mule-2.0.1/core/src/main/java/org/mule/api/endpoint/MalformedEndpointException.java0000644000175000017500000000330610745677442030161 0ustar charlescharles/* * $Id: MalformedEndpointException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.endpoint; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; /** * MalformedEndpointException is thrown by the MuleEndpointURI class * if it fails to parse a Url * * @see org.mule.endpoint.MuleEndpointURI */ public class MalformedEndpointException extends EndpointException { /** * Serial version */ private static final long serialVersionUID = -3179045414716505094L; /** * @param endpoint the endpoint that could not be parsed */ public MalformedEndpointException(String endpoint) { super(CoreMessages.endpointIsMalformed(endpoint)); } /** * @param endpoint the endpoint that could not be parsed */ public MalformedEndpointException(Message message, String endpoint) { super(CoreMessages.endpointIsMalformed(endpoint).setNextMessage(message)); } /** * @param endpoint the endpoint that could not be parsed * @param cause the exception that cause this exception to be thrown */ public MalformedEndpointException(String endpoint, Throwable cause) { super(CoreMessages.endpointIsMalformed(endpoint), cause); } public MalformedEndpointException(Throwable cause) { super(cause); } } mule-2.0.1/core/src/main/java/org/mule/api/endpoint/EndpointURIBuilder.java0000644000175000017500000000136210745677442026342 0ustar charlescharles/* * $Id: EndpointURIBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.endpoint; import java.net.URI; /** * EndpointBuilder determines how a uri is translated to a * MuleEndpointURI Connectors can override the default behaviour to suit their needs */ public interface EndpointURIBuilder { EndpointURI build(URI uri) throws MalformedEndpointException; } mule-2.0.1/core/src/main/java/org/mule/api/endpoint/EndpointBuilder.java0000644000175000017500000000542010757615756025764 0ustar charlescharles/* * $Id: EndpointBuilder.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.endpoint; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextAware; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.routing.filter.Filter; import org.mule.api.security.EndpointSecurityFilter; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transformer.Transformer; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import org.mule.endpoint.URIBuilder; import java.util.List; import java.util.Map; /** * Constructs endpoints. Transport specific endpoints can easily resolve the Endpoint implementation to be * uses, for generic endpoints we can either resolve the transport from uri string or use a default * implementation. */ public interface EndpointBuilder extends MuleContextAware, Cloneable { /** * Constructs inbound endpoints * * @return * @throws EndpointException * @throws InitialisationException */ InboundEndpoint buildInboundEndpoint() throws EndpointException, InitialisationException; /** * Constructs outbound endpoints * * @return * @throws EndpointException * @throws InitialisationException */ OutboundEndpoint buildOutboundEndpoint() throws EndpointException, InitialisationException; void setConnector(Connector connector); void addTransformer(Transformer transformer); void setTransformers(List transformers); void setResponseTransformers(List responseTransformer); void setName(String name); void setProperty(Object key, Object value); void setProperties(Map properties); void setTransactionConfig(TransactionConfig transactionConfig); void setFilter(Filter filter); void setDeleteUnacceptedMessages(boolean deleteUnacceptedMessages); void setSecurityFilter(EndpointSecurityFilter securityFilter); void setSynchronous(boolean synchronous); void setRemoteSync(boolean remoteSync); void setRemoteSyncTimeout(int remoteSyncTimeout); void setInitialState(String initialState); void setEncoding(String encoding); void setRegistryId(String registryId); void setMuleContext(MuleContext muleContext); void setConnectionStrategy(ConnectionStrategy connectionStrategy); void setURIBuilder(URIBuilder URIBuilder); Object clone() throws CloneNotSupportedException; } mule-2.0.1/core/src/main/java/org/mule/api/endpoint/ImmutableEndpoint.java0000644000175000017500000001611210765313375026304 0ustar charlescharles/* * $Id: ImmutableEndpoint.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.endpoint; import org.mule.api.MuleContext; import org.mule.api.routing.filter.Filter; import org.mule.api.security.EndpointSecurityFilter; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import java.io.Serializable; import java.util.List; import java.util.Map; /** * ImmutableEndpoint describes a Message endpoint where data is * sent or received. An Enpoint is an Resource address (EndpointUri), with associated * transformation, transaction and filtering rules. */ public interface ImmutableEndpoint extends Serializable { public static final String INITIAL_STATE_STARTED = "started"; public static final String INITIAL_STATE_STOPPED = "stopped"; /** * This specifess the communication endpointUri. This will have a different format * depending on the transport protocol being used i.e. *

      *
    • smtp -> admin@mycompany.com
    • *
    • jms -> shipping.orders.topic
    • *
    • sms -> +447910010010
    • *
    *

    if an endpointUri is not specifed it will be assumed that it will be * determined at run-time by the calling application. The endpointUri can be * aliteral endpointUri such as an email address or it can be a logical name for * an endpointUri as long as it is declared in a message-endpointUri * block. When the message-provider is created the endpointUri is first lookup in * the endpointUri registry and if nothing is returned the endpointUri value * itself is used. * * @return the endpointUri on which the endpoint sends or receives data */ EndpointURI getEndpointURI(); /** * Decides the encoding to be used for events received by this endpoint * * @return the encoding set on the endpoint or null if no codin has been * specified */ String getEncoding(); /** * The endpoint that will be used to send the message on. It is important that * the endpointUri and the connection correlate i.e. if your endpointUri is a jms * queue your connection must be a JMS endpoint. * * @return the endpoint associated with the endpoint */ Connector getConnector(); /** * The name is the identifier for the endpoint * * @return the endpoint name */ String getName(); /** * Transformers are responsible for transforming data when it is received or * sent by the UMO (depending on whether this endpoint is a receiver or not). A * tranformation for an inbound event can be forced by the user by calling the * inbound event.getTransformedMessage(). A tranformation for an outbound event * is called or when the UMO dispatchEvent() or sendEvent() methods are called. * If an endpoint has no transformers an empty list is returned. * * @return the transformers to use when receiving or sending data */ List getTransformers(); /** * The transformers used when a response is returned from invoking this endpoint. * If an endpoint has no response transformers an empty list is returned. * @return the transformer to use when receiving the response data */ List getResponseTransformers(); /** * Returns any properties set on this endpoint * * @return a map of properties for this endpoint */ Map getProperties(); /** * Retrieves a property set on the endpoint * * @param key the name of the property * @return the property value or null if it does not exist */ Object getProperty(Object key); /** * The transport protocol name that the message endpoint communicates over. i.e. * jms, sms, smtp etc. The protocol must match that of the associated endpoint * * @return the protocol name */ String getProtocol(); /** * @return true if this endpoint is read-only and none of it's properties can * change. Global endpoints should be read-only so that unexpected * behaviour is avoided. */ boolean isReadOnly(); /** * Returns the transaction configuration for this endpoint * * @return the transaction configuration for this endpoint or null if the * endpoint is not transactional */ TransactionConfig getTransactionConfig(); /** * The filter to apply to incoming messages. Only applies when the endpoint * endpointUri is a receiver * * @return the Filter to use or null if one is not set */ Filter getFilter(); /** * If a filter is configured on this endpoint, this property will determine if * message that are not excepted by the filter are deleted * * @return true if message should be deleted, false otherwise */ boolean isDeleteUnacceptedMessages(); /** * Returns an EndpointSecurityFilter for this endpoint. If one is not set, * there will be no authentication on events sent via this endpoint * * @return EndpointSecurityFilter responsible for authenticating message flow * via this endpoint. * @see EndpointSecurityFilter */ EndpointSecurityFilter getSecurityFilter(); /** * Determines if requests originating from this endpoint should be synchronous * i.e. execute in a single thread and possibly return an result. This property * is only used when the endpoint is of type 'receiver' * * @return whether requests on this endpoint should execute in a single thread. * This property is only used when the endpoint is of type 'receiver' */ boolean isSynchronous(); /** * For certain providers that support the notion of a backchannel such as sockets * (outputStream) or Jms (ReplyTo) Mule can automatically wait for a response * from a backchannel when dispatching over these protocols. This is different * for synchronous as synchronous behavior only applies to in * */ boolean isRemoteSync(); /** * The timeout value for remoteSync invocations * * @return the timeout in milliseconds */ int getRemoteSyncTimeout(); /** * Sets the state the endpoint will be loaded in. The States are 'stopped' and * 'started' (default) * * @return the endpoint starting state */ String getInitialState(); MuleContext getMuleContext(); /** * Returns the connection strategy this endpoint should use when connecting to the underlying resource * @return the connection strategy this endpoint should use when connecting to the underlying resource */ ConnectionStrategy getConnectionStrategy(); } mule-2.0.1/core/src/main/java/org/mule/api/endpoint/EndpointFactory.java0000644000175000017500000001065010757615756026006 0ustar charlescharles/* * $Id: EndpointFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.endpoint; import org.mule.api.MuleException; import org.mule.api.context.MuleContextAware; import org.mule.api.registry.Registry; import org.mule.endpoint.EndpointURIEndpointBuilder; /** * Endpoint factory creates immutable instances of {@link ImmutableEndpoint}. These endpoints may be
    *

  • Endpoints created by uri string of the type requested. *
  • Endpoints of the type requested created based on a given global endpoint identified by global endpoint * name. *
  • Endpoints of the type requested based on an existing configured endpoint instance that has been given * a name in configuration.

    This factory always returns new unique endpoint instances. The * {@link Registry} should be used to lookup/create endpoints. */ public interface EndpointFactory extends MuleContextAware { /** * Creates an endpoint with the "INBOUND" role.

    The uri parameter can either be a uri, or a * (global) endpoint identifier or name.

    The {@link InboundEndpoint} interface is * currently used as the return type but this will be replaces by and more specific interface. SEE * MULE-2292 * * @param uri endpoint identifier or uri * @param muleContext * @return * @throws MuleException */ InboundEndpoint getInboundEndpoint(String uri) throws MuleException; /** * Creates an endpoint with the "OUTBOUND" role.

    The uri parameter can either be a uri, or a * (global) endpoint identifier or name.

    The {@link OutboundEndpoint} interface is * currently used as the return type but this will be replaces by and more specific interface. SEE * MULE-2292 * * @param uri endpoint identifier or uri * @param muleContext * @return * @throws MuleException */ OutboundEndpoint getOutboundEndpoint(String uri) throws MuleException; /** * Creates an endpoint with the "INBOUND" role using the builder provided. * * @param builder * @param muleContext * @return * @throws MuleException */ InboundEndpoint getInboundEndpoint(EndpointBuilder builder) throws MuleException; /** * Creates an endpoint with the "OUTBOUND" role using the builder provided. * * @param builder * @param muleContext * @return * @throws MuleException */ OutboundEndpoint getOutboundEndpoint(EndpointBuilder builder) throws MuleException; /** * @param endpointUri * @return * @throws MuleException * @deprecated */ InboundEndpoint getInboundEndpoint(EndpointURI endpointUri) throws MuleException; /** * @param endpointUri * @return * @throws MuleException * @deprecated */ OutboundEndpoint getOutboundEndpoint(EndpointURI endpointUri) throws MuleException; /** * Used to retrieve the an EndpointBuilder equal to the one would be used to create an endpoint.

    * This is * useful if you need to customize a builder before creation of an endpoint as you can use this method to * obtain the endpoint builder, custommize it and then call the factory methods that take a * EndpointBuilder rather than a String.

    (Of course if you know the uri is a uri rather than a global * endpoint identifier you could create your own EndpointURIEndpointBuilder locally, this method allows * the uri to be substituted with a global endpoint name and returns it's builder if this is the case. * allow the uri parameter to be either a uri or a global endpoint identifier you need this method.

    * Each and every call to this method, even if it is for the same uri/global endpoint name will return a new EndpoointBuilder instance. * * * * @param uri endpoint identifier or uri * @param muleContext * @return * @throws MuleException * @see EndpointBuilder * @see EndpointURIEndpointBuilder */ EndpointBuilder getEndpointBuilder(String uri) throws MuleException; } mule-2.0.1/core/src/main/java/org/mule/api/endpoint/OutboundEndpoint.java0000644000175000017500000000112410757625263026164 0ustar charlescharles/* * $Id: OutboundEndpoint.java 10964 2008-02-22 20:04:03Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.endpoint; import org.mule.api.transport.MessageDispatching; public interface OutboundEndpoint extends ImmutableEndpoint, MessageDispatching { } mule-2.0.1/core/src/main/java/org/mule/api/endpoint/InvalidEndpointTypeException.java0000644000175000017500000000161710745677442030506 0ustar charlescharles/* * $Id: InvalidEndpointTypeException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.endpoint; import org.mule.api.MuleRuntimeException; import org.mule.config.i18n.Message; public class InvalidEndpointTypeException extends MuleRuntimeException { private static final long serialVersionUID = 8597088580804178563L; public InvalidEndpointTypeException(Message message) { super(message); } public InvalidEndpointTypeException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/endpoint/EndpointURI.java0000644000175000017500000000470010754403514025015 0ustar charlescharles/* * $Id: EndpointURI.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.endpoint; import org.mule.api.lifecycle.Initialisable; import java.io.Serializable; import java.net.URI; import java.util.Properties; /** * EndpointURI is used to determine how a message is sent or * received. The url defines the protocol, the endpointUri destination of the message * and optionally the endpoint to use when dispatching the event. Mule urls take the * form of - protocol://[host]:[port]/[provider]/endpointUri or * protocol://[host]:[port]/endpointUri i.e. vm://my.object or * The protocol can be any of any conector registered with Mule. The * endpoint name if specified must be the name of a register global endpoint The * endpointUri can be any endpointUri recognised by the endpoint type. * */ public interface EndpointURI extends Serializable, Initialisable { String PROPERTY_ENDPOINT_NAME = "endpointName"; String PROPERTY_ENDPOINT_URI = "address"; String PROPERTY_CONNECTOR_NAME = "connector"; String PROPERTY_TRANSFORMERS = "transformers"; String PROPERTY_RESPONSE_TRANSFORMERS = "responseTransformers"; String getAddress(); String getFilterAddress(); /** * @deprecated This property is used by endpoint-identifiers, global-endpoints use ImmutableEndpoint.getName() */ String getEndpointName(); /** * @deprecated This property is used by endpoint-identifiers, global-endpoints use ImmutableEndpoint.getName() */ void setEndpointName(String name); Properties getParams(); /** * A reduced version of getParams() - drops some system parameters */ Properties getUserParams(); String getScheme(); String getSchemeMetaInfo(); String getFullScheme(); String getAuthority(); String getHost(); int getPort(); String getPath(); String getQuery(); String getUserInfo(); String getTransformers(); String getResponseTransformers(); URI getUri(); String getConnectorName(); String getResourceInfo(); String getUser(); String getPassword(); } mule-2.0.1/core/src/main/java/org/mule/api/endpoint/EndpointException.java0000644000175000017500000000237210745677442026334 0ustar charlescharles/* * $Id: EndpointException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.endpoint; import org.mule.api.MuleException; import org.mule.config.i18n.Message; /** * EndpointException is an abstract exception extended by endpoint * specific exceptions. */ public class EndpointException extends MuleException { /** * Serial version */ private static final long serialVersionUID = 3219403251233216800L; /** * @param message the exception message */ public EndpointException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public EndpointException(Message message, Throwable cause) { super(message, cause); } public EndpointException(Throwable cause) { super(cause); } } mule-2.0.1/core/src/main/java/org/mule/api/model/0000755000175000017500000000000011351411116021260 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/model/package.html0000644000175000017500000000024710745677442023572 0ustar charlescharles Contains the interfaces for the Model and supporting objects such as the CompoenntResolver, EntryPointResolver, etc. APIs. mule-2.0.1/core/src/main/java/org/mule/api/model/EntryPoint.java0000644000175000017500000000141610746275214024256 0ustar charlescharles/* * $Id: EntryPoint.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.model; import org.mule.api.MuleEventContext; /** * EntryPoint defines the current entry method on a service. If * the invoked method does not have a return value, a {@link org.mule.VoidResult} * is returned. */ public interface EntryPoint { Object invoke(Object component, MuleEventContext context) throws Exception; } mule-2.0.1/core/src/main/java/org/mule/api/model/ModelServiceDescriptor.java0000644000175000017500000000230110745677442026565 0ustar charlescharles/* * $Id: ModelServiceDescriptor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.model; import org.mule.api.registry.ServiceDescriptor; import org.mule.api.registry.ServiceException; /** * ModelServiceDescriptor describes the necessery information for * creating a model from a service descriptor. A service descriptor should be * located at META-INF/services/org/mule/models/ where type is the * type of the model to be created. The service descriptor is in the form of * string key value pairs and supports a number of properties, descriptions of which * can be found here: http://www.muledocs.org/Model+Service+Descriptors. */ public interface ModelServiceDescriptor extends ServiceDescriptor { public Model createModel() throws ServiceException; public Class getModelClass() throws ServiceException; } mule-2.0.1/core/src/main/java/org/mule/api/model/Model.java0000644000175000017500000000701710767355640023213 0ustar charlescharles/* * $Id: Model.java 11379 2008-03-17 02:46:56Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.model; import org.mule.api.NamedObject; import org.mule.api.component.LifecycleAdapterFactory; import org.mule.api.context.MuleContextAware; import org.mule.api.lifecycle.Lifecycle; import java.beans.ExceptionListener; /** * The Model encapsulates and manages the runtime behaviour of a * Mule Server instance. It is responsible for maintaining the UMOs instances and * their configuration. */ public interface Model extends Lifecycle, MuleContextAware, NamedObject { /** * Returns the model type name. This is a friendly identifier that is used to * look up the SPI class for the model * * @return the model type */ String getType(); /** * The entry point resolver is used to determine the method to be called on a * service when an event is received for it. * * @return Returns the entryPointResolver. */ EntryPointResolverSet getEntryPointResolverSet(); /** * This will be used to build entry points on the components registered with the * model. * * @param entryPointResolver The entryPointResolver to set. This will be used to * build entry points on the components registered with the model. */ void setEntryPointResolverSet(EntryPointResolverSet entryPointResolver); /** * The lifecycle adapter is used by the model to translate Mule lifecycle event * to events that UMO components registered with the model understand. The * LifecycleAdapterFactory is used by the model to instanciate * LifecycleAdapters. * * @return Returns the lifecycleAdapterFactory used by this Model. * @see LifecycleAdapterFactory * @see org.mule.api.component.LifecycleAdapter */ LifecycleAdapterFactory getLifecycleAdapterFactory(); /** * Sets the lifecycleAdapterFactory on the model. * * @param lifecycleAdapterFactory The lifecycleAdapterFactory to set on this * model. * @see LifecycleAdapterFactory * @see org.mule.api.component.LifecycleAdapter */ void setLifecycleAdapterFactory(LifecycleAdapterFactory lifecycleAdapterFactory); /** * The exception strategy to use by components managed by the model. The * exception strategy is used when an exception occurs while processing the * current event for a service. A service can define it's own exception * strategy, but if it doesn't this implmentation will be used. * * @return the default exception strategy for this model. * @see ExceptionListener */ ExceptionListener getExceptionListener(); /** * The exception strategy to use by components managed by the model. The * exception strategy is used when an exception occurs while processing the * current event for a service. A service can define it's own exception * strategy, but if it doesn't this implmentation will be used. * * @param listener the default exception strategy for this model. * @see ExceptionListener */ void setExceptionListener(ExceptionListener listener); } mule-2.0.1/core/src/main/java/org/mule/api/model/SessionException.java0000644000175000017500000000220610745677442025453 0ustar charlescharles/* * $Id: SessionException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.model; import org.mule.config.i18n.Message; /** * SessionException is thrown when errors occur in the DefaultMuleSession or * Seession Manager */ public class SessionException extends ModelException { /** * Serial version */ private static final long serialVersionUID = -6751481096543965553L; /** * @param message the exception message */ public SessionException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public SessionException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/model/InvocationResult.java0000644000175000017500000001246710745677442025473 0ustar charlescharles/* * $Id: InvocationResult.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.model; import org.mule.config.i18n.CoreMessages; import java.lang.reflect.Method; /** TODO */ public class InvocationResult { /** the resover performing the invocation knows that it cannot attempt to make the invocation */ public static final int STATE_INVOKE_NOT_SUPPORTED = 0; /** the invocation was successful */ public static final int STATE_INVOKED_SUCESSFUL = 1; /** The invocation was attempted but failed */ public static final int STATE_INVOKED_FAILED = 2; private String errorMessage; /** the name of the method called for this invocation */ private String methodCalled; private Object result; private int state; /** * Will construct an InvocationResult with a given state. The state must be either * {@link #STATE_INVOKE_NOT_SUPPORTED} if the resover performing the invocation knows that it cannot * attempt to make the invocation * {@link #STATE_INVOKED_FAILED} If an invocation attempt is made but fails * {@link #STATE_INVOKED_SUCESSFUL} If the invocation was successful * * @param state the state of the result */ public InvocationResult(int state) { if (state < 0 || state > 2) { throw new IllegalArgumentException("state"); } this.state = state; } /** * Creates a result with the result payload set. The state of this result will be {@link #STATE_INVOKED_SUCESSFUL} * since only in this state will a result be set. * * @param result the result of a successful invocation */ public InvocationResult(Object result, Method method) { this.result = result; this.state = STATE_INVOKED_SUCESSFUL; this.methodCalled = method.getName(); } /** * Returns the name of the method invoked, this property is only set if the state of the invocation is * {@link #STATE_INVOKED_SUCESSFUL} * * @return the name of the method invoked */ public String getMethodCalled() { return methodCalled; } /** * The result of this invocation * * @return an object or null if the result did not yeild a result or because the state of this invocation result * is either {@link #STATE_INVOKE_NOT_SUPPORTED} or {@link #STATE_INVOKED_FAILED}. */ public Object getResult() { return result; } /** * Returns the state of this invocation. Possible values are: * {@link #STATE_INVOKE_NOT_SUPPORTED} if the resover performing the invocation knows that it cannot * attempt to make the invocation * {@link #STATE_INVOKED_FAILED} If an invocation attempt is made but fails * {@link #STATE_INVOKED_SUCESSFUL} If the invocation was successful * * @return */ public int getState() { return state; } /** * An optional error message can be set if the invocation state is not {@link #STATE_INVOKED_SUCESSFUL} * * @param message */ public void setErrorMessage(String message) { if (state == STATE_INVOKED_SUCESSFUL) { throw new IllegalStateException(CoreMessages.invocationSuccessfulCantSetError().toString()); } errorMessage = message; } /** * Returns true if an error message has been set on this result, false otherwise * * @return true if an error message has been set on this result, false otherwise */ public boolean hasError() { return errorMessage != null; } /** * Returns the error message set on this result or null if none has been set * * @return the error message set on this result or null if none has been set */ public String getErrorMessage() { return errorMessage; } public void setErrorTooManyMatchingMethods(Object component, Class[] argTypes, String methods, EntryPointResolver resolver) { setErrorMessage(CoreMessages.tooManyAcceptableMethodsOnObjectUsingResolverForTypes( component.getClass().getName(), argTypes, resolver).toString()); } public void setErrorTooManyMatchingMethods(Object component, Class[] argTypes, EntryPointResolver resolver) { setErrorMessage(CoreMessages.tooManyAcceptableMethodsOnObjectUsingResolverForTypes( component.getClass().getName(), argTypes, resolver).toString()); } public void setErrorNoMatchingMethods(Object component, Class[] args, EntryPointResolver resolver) { setErrorMessage(CoreMessages.noEntryPointFoundWithArgsUsingResolver( component.getClass().getName(), args, resolver).toString()); } public void setErrorNoMatchingMethodsCalled(Object component, String methods, EntryPointResolver resolver) { setErrorMessage(CoreMessages.noMatchingMethodsOnObjectCalledUsingResolver( component.getClass().getName(), methods, resolver).toString()); } } mule-2.0.1/core/src/main/java/org/mule/api/model/EntryPointResolverSet.java0000644000175000017500000000264210746275214026456 0ustar charlescharles/* * $Id: EntryPointResolverSet.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.model; import org.mule.api.MuleEventContext; /** * EntryPointResolver resolves a method to call on the given * service object when an event is received. * This object maintains a set of Resolvers that will be used in order to resolve * an entrypoint on a service object until one is found or until the set is * exhausted. */ public interface EntryPointResolverSet { Object invoke(Object component, MuleEventContext context) throws Exception; /** * Will add a resolver to the list of resolvers to invoke on a compoent. * Implementations must maintain an ordered list of resolvers * * @param resolver the resolver to add */ void addEntryPointResolver(EntryPointResolver resolver); /** * Removes a resolver from the list * * @param resolver the resolver to remove * @return true if the resolver was found and removed from the list */ boolean removeEntryPointResolver(EntryPointResolver resolver); } mule-2.0.1/core/src/main/java/org/mule/api/model/EntryPointResolver.java0000644000175000017500000000137610746275214026005 0ustar charlescharles/* * $Id: EntryPointResolver.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.model; import org.mule.api.MuleEventContext; /** * EntryPointResolver resolves a method to call on the given * UMODescriptor when an event is received for the service */ public interface EntryPointResolver { InvocationResult invoke(Object component, MuleEventContext context) throws Exception; } mule-2.0.1/core/src/main/java/org/mule/api/model/ModelException.java0000644000175000017500000000205310745677442025070 0ustar charlescharles/* * $Id: ModelException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.model; import org.mule.api.MuleException; import org.mule.config.i18n.Message; public class ModelException extends MuleException { /** * Serial version */ private static final long serialVersionUID = -4593985962209518596L; /** * @param message the exception message */ public ModelException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public ModelException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/transformer/0000755000175000017500000000000011351411116022522 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/transformer/wire/0000755000175000017500000000000011351411116023470 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/transformer/wire/WireFormat.java0000644000175000017500000000140210757365472026435 0ustar charlescharles/* * $Id: WireFormat.java 10933 2008-02-21 21:20:58Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transformer.wire; import org.mule.api.MuleException; import java.io.InputStream; import java.io.OutputStream; public interface WireFormat { Object read(InputStream is) throws MuleException; void write(OutputStream out, Object o, String encoding) throws MuleException; void setTransferObjectClass(Class clazz); } mule-2.0.1/core/src/main/java/org/mule/api/transformer/package.html0000644000175000017500000000020110745677442025022 0ustar charlescharles Contains the interfaces for transformers and exceptions for the UMO Transformer API. mule-2.0.1/core/src/main/java/org/mule/api/transformer/StreamingTransformer.java0000644000175000017500000000312010745677442027563 0ustar charlescharles/* * $Id: StreamingTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transformer; import java.io.InputStream; import java.io.OutputStream; /** * TODO */ public interface StreamingTransformer extends BaseTransformer { /** * Transformers can be chained together and invoked in a series * * @return the next transformer to invoke after this one */ StreamingTransformer getNextTransformer(); /** * Transformers can be chained together and invoked in a series * * @param nextTransformer the next transforer to invoke */ void setNextTransformer(StreamingTransformer nextTransformer); /** * Thransforms the supllied data and returns the result * * @param src the inputStream * @param encoding the encoding to use in this transformation (if necessary) * @return the transformed data * @throws TransformerException if a error occurs transforming the data or if the * expected returnClass isn't the same as the transformed data */ // TODO RM: shouldn't this method be void since the "result" is in OutputStream? Object transform(InputStream src, OutputStream dest, String encoding) throws TransformerException; } mule-2.0.1/core/src/main/java/org/mule/api/transformer/BaseTransformer.java0000644000175000017500000000235110745677442026511 0ustar charlescharles/* * $Id: BaseTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transformer; import org.mule.api.NamedObject; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.Initialisable; /** * Transformer can be chained together to covert message payloads from one * object type to another. */ public interface BaseTransformer extends Initialisable, NamedObject { /** * The endpoint that this transformer is attached to * @return the endpoint associated with the transformer */ ImmutableEndpoint getEndpoint(); /** * Sets the endpoint associated with with this connector. * This should be idempotent, since endpoints do not guarantee it will only * be called once. * @param endpoint sets the endpoint associated with the transfromer */ void setEndpoint(ImmutableEndpoint endpoint); } mule-2.0.1/core/src/main/java/org/mule/api/transformer/Transformer.java0000644000175000017500000000416710745677442025725 0ustar charlescharles/* * $Id: Transformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transformer; import java.util.List; /** * Transformer can be chained together to covert message payloads * from one object type to another. */ public interface Transformer extends BaseTransformer { /** * Determines if a particular source class can be handled by this transformer * * @param aClass The class to check for compatability * @return true if the transformer supports this type of class or false * otherwise */ boolean isSourceTypeSupported(Class aClass); /** * Returns an unmodifiable list of Source types registered on this transformer * * @return an unmodifiable list of Source types registered on this transformer */ List getSourceTypes(); /** * Does this transformer allow null input? * * @return true if this transformer can accept null input */ boolean isAcceptNull(); public boolean isIgnoreBadInput(); /** * Thransforms the supplied data and returns the result * * @param src the data to transform * @return the transformed data * @throws TransformerException if a error occurs transforming the data or if the * expected returnClass isn't the same as the transformed data */ Object transform(Object src) throws TransformerException; /** * Sets the expected return type for the transformed data. If the transformed * data is not of this class type a TransformerException will be * thrown. * * @param theClass the expected return type class */ void setReturnClass(Class theClass); /** @return the exceptedreturn type */ Class getReturnClass(); } mule-2.0.1/core/src/main/java/org/mule/api/transformer/DiscoverableTransformer.java0000644000175000017500000000355210745677442030245 0ustar charlescharles/* * $Id: DiscoverableTransformer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transformer; /** * A interface to denote that a transformer is discoverable. A Transformer can implement this interface so that * when a transformation is being 'discovered' for a payload type the transformers implementing this interface * will be included in the search. A 'priorityWeighting property is introduced with this interface that can be used * to help select a transformer when there are two or more matches. The transformer with the highest priorityWeighting * will be selected. */ public interface DiscoverableTransformer { public static final int MAX_PRIORITY_WEIGHTING = 10; public static final int MIN_PRIORITY_WEIGHTING = 1; public static final int DEFAULT_PRIORITY_WEIGHTING = MIN_PRIORITY_WEIGHTING; /** * If 2 or more discoverable transformers are equal, this value can be used to select the correct one * * @return the priority weighting for this transformer. This is a value between * {@link #MIN_PRIORITY_WEIGHTING} and {@link #MAX_PRIORITY_WEIGHTING}. */ public int getPriorityWeighting(); /** * If 2 or more discoverable transformers are equal, this value can be used to select the correct one * * @param weighting the priority weighting for this transformer. This is a value between * {@link #MIN_PRIORITY_WEIGHTING} and {@link #MAX_PRIORITY_WEIGHTING}. */ public void setPriorityWeighting(int weighting); } mule-2.0.1/core/src/main/java/org/mule/api/transformer/TransformerException.java0000644000175000017500000000575410745677442027607 0ustar charlescharles/* * $Id: TransformerException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transformer; import org.mule.api.endpoint.EndpointException; import org.mule.config.i18n.Message; import org.mule.transformer.TransformerUtils; import java.util.List; /** * TransformerException is a simple exception that is thrown by * transformers. */ public class TransformerException extends EndpointException { /** * Serial version */ private static final long serialVersionUID = 2943589828020763649L; private transient Transformer transformer; /** * @param message the exception message */ public TransformerException(Message message, Transformer transformer) { super(message); this.transformer = transformer; addInfo("Transformer", transformer.toString()); } public TransformerException(Message message, List transformers) { super(message); this.transformer = TransformerUtils.firstOrNull(transformers); addInfo("Transformer", TransformerUtils.toString(transformers)); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public TransformerException(Message message, Transformer transformer, Throwable cause) { super(message, cause); this.transformer = transformer; addInfo("Transformer", transformer.toString()); } public TransformerException(Message message, List transformers, Throwable cause) { super(message, cause); this.transformer = TransformerUtils.firstOrNull(transformers); addInfo("Transformer", TransformerUtils.toString(transformers)); } public TransformerException(Transformer transformer, Throwable cause) { super(cause); this.transformer = transformer; addInfo("Transformer", (transformer == null ? "null" : transformer.toString())); } public TransformerException(List transformers, Throwable cause) { super(cause); this.transformer = TransformerUtils.firstOrNull(transformers); addInfo("Transformer", TransformerUtils.toString(transformers)); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public TransformerException(Message message, Throwable cause) { super(message, cause); } /** * @param message the exception message */ public TransformerException(Message message) { super(message); } public Transformer getTransformer() { return transformer; } } mule-2.0.1/core/src/main/java/org/mule/api/management/0000755000175000017500000000000011351411122022271 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/management/stats/0000755000175000017500000000000011351411122023427 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/management/stats/Statistics.java0000644000175000017500000000145010745677442026455 0ustar charlescharles/* * $Id: Statistics.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.management.stats; import java.io.Serializable; /** * Statistics TODO * */ public interface Statistics extends Serializable { /** * Are statistics logged */ boolean isEnabled(); /** * Enable statistics logs (this is a dynamic parameter) */ void setEnabled(boolean b); void clear(); void logSummary(); } mule-2.0.1/core/src/main/java/org/mule/api/component/0000755000175000017500000000000011351411120022155 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/component/LifecycleAdapter.java0000644000175000017500000000162010767355640026247 0ustar charlescharles/* * $Id: LifecycleAdapter.java 11379 2008-03-17 02:46:56Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.component; import org.mule.api.interceptor.Interceptor; import org.mule.api.lifecycle.Lifecycle; import org.mule.api.service.Service; /** * LifecycleAdapter is a wrapper around a pojo service that adds Lifecycle methods to the pojo. It also * associates the pojo service with its {@link Service} object. * * @see Service */ public interface LifecycleAdapter extends Lifecycle, Interceptor { boolean isStarted(); boolean isDisposed(); } mule-2.0.1/core/src/main/java/org/mule/api/component/LifecycleAdapterFactory.java0000644000175000017500000000143410767355640027602 0ustar charlescharles/* * $Id: LifecycleAdapterFactory.java 11379 2008-03-17 02:46:56Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.component; import org.mule.api.MuleException; import org.mule.api.model.EntryPointResolverSet; /** LifecycleAdapterFactory TODO (document class) */ public interface LifecycleAdapterFactory { LifecycleAdapter create(Object pojoService, JavaComponent component, EntryPointResolverSet resolver) throws MuleException; } mule-2.0.1/core/src/main/java/org/mule/api/component/simple/0000755000175000017500000000000011351411120023446 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/component/simple/LogService.java0000644000175000017500000000101110745677442026377 0ustar charlescharles/* * $Id: LogService.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.component.simple; public interface LogService { void log(String message); } mule-2.0.1/core/src/main/java/org/mule/api/component/simple/EchoService.java0000644000175000017500000000101310745677442026536 0ustar charlescharles/* * $Id: EchoService.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.component.simple; public interface EchoService { String echo(String echo); } mule-2.0.1/core/src/main/java/org/mule/api/component/builder/0000755000175000017500000000000011351411120023603 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/component/builder/MessageBuilder.java0000644000175000017500000000156610745677442027404 0ustar charlescharles/* * $Id: MessageBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.component.builder; import org.mule.api.MuleMessage; import org.mule.component.builder.MessageBuilderException; /** * A Strategy Class for Building one message from the invocation results of a chain * if endpoints. This is used for invoking different endpoints to obain parts of a * larger message. */ public interface MessageBuilder { Object buildMessage(MuleMessage request, MuleMessage response) throws MessageBuilderException; } mule-2.0.1/core/src/main/java/org/mule/api/component/JavaComponent.java0000644000175000017500000000753710767355640025630 0ustar charlescharles/* * $Id: JavaComponent.java 11379 2008-03-17 02:46:56Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.component; import org.mule.api.model.EntryPointResolverSet; import org.mule.api.object.ObjectFactory; import org.mule.api.routing.NestedRouterCollection; import org.mule.component.PooledJavaComponent; import org.mule.object.PrototypeObjectFactory; import org.mule.object.SingletonObjectFactory; /** * JavaComponent is a Java {@link Component} implementation used to * invoke Java component implementations. A JavaComponent uses an * {@link ObjectFactory} to specify the object instance's source and allows for * singleton and prototype implementations to be used along with other custom * {@link ObjectFactory} that allow component instances to be obtained from * containers such as Spring. A JavaComponent uses a customizable * {@link EntryPointResolverSet} in order to resolve which method should be used for * invocation and allows java bindings to be configure. Java Component bindings, if * implemented by the JavaComponent implementation, uses a component instance proxy * to implement interface methods using calls to outbound endpoints. */ public interface JavaComponent extends Component { /** * A {@link JavaComponent} can have a custom entry-point resolver for its own * object. By default this is null. When set this resolver will override the * resolver on the model * * @return Null is a resolver set has not been set otherwise the resolver to use * on this service */ EntryPointResolverSet getEntryPointResolverSet(); /** * A {@link JavaComponent} can have a custom entry-point resolver for its own * object. By default this is null. When set this resolver will override the * resolver on the model * * @return Null is a resolver set has not been set otherwise the resolver to use * on this service */ void setEntryPointResolverSet(EntryPointResolverSet entryPointResolverSet); // TODO This should be renamed to something like "Bindings", moved up to // Component. NestedRouter should also be renamed to "Binding" and made more // generic so as to support other types of bindings e.g. wsdl port -> ws-endpont, // or script context variable -> outbound endpoint etc. See MULE-3114 NestedRouterCollection getNestedRouter(); void setNestedRouter(NestedRouterCollection nestedRouter); /** * The object factory used to obtain the component object instance. Mule core * provides two implementations: {@link SingletonObjectFactory} and * {@link PrototypeObjectFactory}.
    The spring-config module provides an * {@link ObjectFactory} implementation that delegates to spring. There is no * PooledObjectFactory, the {@link PooledJavaComponent} should be used for * pooling. * * @param objectFactory */ void setObjectFactory(ObjectFactory objectFactory); /** * @return */ ObjectFactory getObjectFactory(); /** * @return */ Class getObjectType(); /** * Returns the factory used create life-cycle adaptors that are used to wrap * component instance. * * @return */ public LifecycleAdapterFactory getLifecycleAdapterFactory(); /** * Sets the factory used create life-cycle adaptors that are used to wrap * component instance. * * @param lifecycleAdaptor */ public void setLifecycleAdapterFactory(LifecycleAdapterFactory lifecycleAdaptor); } mule-2.0.1/core/src/main/java/org/mule/api/component/Component.java0000644000175000017500000000362210767632003025004 0ustar charlescharles/* * $Id: Component.java 11414 2008-03-18 03:16:19Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.component; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.Lifecycle; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.service.Service; import org.mule.management.stats.ComponentStatistics; /** * A Component is a invoked by a {@link Service} for each incoming * {@link MuleEvent} routed on by the {@link InboundRouterCollection}. A component * processes a {@link MuleEvent} by invoking the component instance that has been * configured, optionally returning a result.

    Implementations of * Component can use different types of component implementation, * implement component instance pooling or implement bindings which allow * for service composition. */ public interface Component extends Lifecycle { /** * Invokes the component * * @param event the event used to invoke the component * @return the return event from the component * @throws MuleException if the call fails */ MuleMessage onCall(MuleEvent event) throws MuleException; /** * Component statistics are used to gather component statistics such as * sync/async invocation counts and total and average execution time. * * @return */ ComponentStatistics getStatistics(); /** * @param service */ void setService(Service service); /** * @return */ Service getService(); } mule-2.0.1/core/src/main/java/org/mule/api/context/0000755000175000017500000000000011351411116021644 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/context/package.html0000644000175000017500000000016610745677442024156 0ustar charlescharles Manager APIs, including the UMOManager, agent and server event interfaces mule-2.0.1/core/src/main/java/org/mule/api/context/notification/0000755000175000017500000000000011351411116024332 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/context/notification/CustomNotificationListener.java0000644000175000017500000000164010745677442032553 0ustar charlescharles/* * $Id: CustomNotificationListener.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * CustomNotificationListener is an observer interface that can be * used to listen for Custom notifications using * UMOManager.fireCustomEvent(..). Custom notifications can be used * by components and other objects such as routers, transformers, agents, etc to * communicate a change of state to each other. */ public interface CustomNotificationListener extends ServerNotificationListener { // no methods } mule-2.0.1/core/src/main/java/org/mule/api/context/notification/MessageNotificationListener.java0000644000175000017500000000140210745677442032661 0ustar charlescharles/* * $Id: MessageNotificationListener.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * MessageNotificationListener is an observer interface that objects * can use to receive notifications about messages being sent and received from a * Mule Server */ public interface MessageNotificationListener extends ServerNotificationListener { // no methods } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/core/src/main/java/org/mule/api/context/notification/MuleContextNotificationListener.javamule-2.0.1/core/src/main/java/org/mule/api/context/notification/MuleContextNotificationListener.java0000644000175000017500000000144010763554366033545 0ustar charlescharles/* * $Id: MuleContextNotificationListener.java 11181 2008-03-05 17:31:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * MuleContextNotificationListener is an observer interface that objects * can implement and then register themselves with the Mule manager to be notified * when a Manager event occurs. */ public interface MuleContextNotificationListener extends ServerNotificationListener { // no methods } mule-2.0.1/core/src/main/java/org/mule/api/context/notification/ExceptionNotificationListener.java0000644000175000017500000000142410745677442033237 0ustar charlescharles/* * $Id:ExceptionNotificationListener.java 7275 2007-06-28 02:51:31Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * ExceptionNotificationListener is an observer interface that * objects can implement and then register themselves with the Mule manager to be * notified when a Exception event occurs. */ public interface ExceptionNotificationListener extends ServerNotificationListener { // no methods } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/core/src/main/java/org/mule/api/context/notification/TransactionNotificationListener.javamule-2.0.1/core/src/main/java/org/mule/api/context/notification/TransactionNotificationListener.java0000644000175000017500000000143410745677442033567 0ustar charlescharles/* * $Id:TransactionNotificationListener.java 7275 2007-06-28 02:51:31Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * TransactionNotificationListener is an observer interface that objects * can implement and then register themselves with the Mule manager to be notified * when a Transaction event occurs. */ public interface TransactionNotificationListener extends ServerNotificationListener { // no methods } mule-2.0.1/core/src/main/java/org/mule/api/context/notification/ConnectionNotificationListener.java0000644000175000017500000000144010745677442033376 0ustar charlescharles/* * $Id: ConnectionNotificationListener.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * ConnectionNotificationListener is an observer interface that * objects can implement and then register themselves with the Mule manager to be * notified when a Connection event occurs. */ public interface ConnectionNotificationListener extends ServerNotificationListener { // no methods } mule-2.0.1/core/src/main/java/org/mule/api/context/notification/RegistryNotificationListener.java0000644000175000017500000000142610745677442033113 0ustar charlescharles/* * $Id: RegistryNotificationListener.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * RegistryNotificationListener is an observer interface that objects * can implement and then register themselves with the MuleContext to be notified * when a Registry event occurs. */ public interface RegistryNotificationListener extends ServerNotificationListener { // no methods }mule-2.0.1/core/src/main/java/org/mule/api/context/notification/BlockingServerEvent.java0000644000175000017500000000140310745677442031142 0ustar charlescharles/* * $Id: BlockingServerEvent.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * BlockingServerEvent is a marker interface that tells the server * event manager to publish this event in the current thread, thus blocking the * current thread of execution until all listeners have been processed */ public interface BlockingServerEvent { // no methods } mule-2.0.1/core/src/main/java/org/mule/api/context/notification/RoutingNotificationListener.java0000644000175000017500000000137010771256706032723 0ustar charlescharles/* * $Id: RoutingNotificationListener.java 11483 2008-03-22 19:28:06Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * RoutingNotificationListener is an observer interface that objects * can use to receive notifications about routing events such as async-reply misses. */ public interface RoutingNotificationListener extends ServerNotificationListener { // no methods }mule-2.0.1/core/src/main/java/org/mule/api/context/notification/ServerNotificationListener.java0000644000175000017500000000147710745677442032557 0ustar charlescharles/* * $Id: ServerNotificationListener.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * ServerNotificationListener is an observer interface that ojects * can implement and register themselves with the Mule Server to receive * notifications when the server, model and components stop, start, initialise, etc. */ public interface ServerNotificationListener { void onNotification(ServerNotification notification); } mule-2.0.1/core/src/main/java/org/mule/api/context/notification/ServerNotification.java0000644000175000017500000001341110771256706031033 0ustar charlescharles/* * $Id: ServerNotification.java 11483 2008-03-22 19:28:06Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; import org.mule.MuleServer; import org.mule.endpoint.MuleEndpointURI; import org.mule.util.ClassUtils; import java.util.EventObject; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; /** * ServerNotification is an event triggered by something happening * in the Server itself such as the server starting or a service being registered. */ public abstract class ServerNotification extends EventObject { public static final int NO_ACTION_ID = Integer.MIN_VALUE; public static final String NO_ACTION_NAME = "none"; public static final String TYPE_INFO = "info"; public static final String TYPE_WARNING = "warn"; public static final String TYPE_ERROR = "error"; public static final String TYPE_FATAL = "fatal"; public static final int CONTEXT_EVENT_ACTION_START_RANGE = 100; public static final int MODEL_EVENT_ACTION_START_RANGE = 200; public static final int SERVICE_EVENT_ACTION_START_RANGE = 300; public static final int SECURITY_EVENT_ACTION_START_RANGE = 400; public static final int MANAGEMENT_EVENT_ACTION_START_RANGE = 500; public static final int ADMIN_EVENT_ACTION_START_RANGE = 600; public static final int CONNECTION_EVENT_ACTION_START_RANGE = 700; public static final int MESSAGE_EVENT_ACTION_START_RANGE = 800; public static final int SPACE_EVENT_ACTION_START_RANGE = 900; public static final int REGISTRY_EVENT_ACTION_START_RANGE = 1000; public static final int EXCEPTION_EVENT_ACTION_START_RANGE = 1100; public static final int TRANSACTION_EVENT_ACTION_START_RANGE = 1200; public static final int ROUTING_EVENT_ACTION_START_RANGE = 1300; public static final int CUSTOM_EVENT_ACTION_START_RANGE = 100000; public static final int NULL_ACTION = 0; public static final Object NULL_MESSAGE = ""; public final String EVENT_NAME = ClassUtils.getClassName(getClass()); protected String serverId; protected long timestamp; protected int action = NULL_ACTION; private static Map actionIdToName = new ConcurrentHashMap(); private static Map actionNameToId = new ConcurrentHashMap(); /** * The resourceIdentifier is used when firing inbound server notifications such * as Admin notifications or other action notifications triggered by an external * source Used to associate the event with a particular resource. For example, if * the event was a ServiceNotification the resourceIdentifier could be the name * of a particular service */ protected String resourceIdentifier = null; public ServerNotification(Object message, int action) { this(message, action, null); } public ServerNotification(Object message, int action, String resourceIdentifier) { super((message == null ? NULL_MESSAGE : message)); this.action = action; this.resourceIdentifier = resourceIdentifier; if (MuleServer.getMuleContext().getRegistry() != null && null != message) { serverId = message.toString(); } timestamp = System.currentTimeMillis(); } public int getAction() { return action; } public String getServerId() { return serverId; } public String getResourceIdentifier() { return resourceIdentifier; } public long getTimestamp() { return timestamp; } public boolean isResourceIdentifierAnUri() { return MuleEndpointURI.isMuleUri(resourceIdentifier); } public String toString() { return EVENT_NAME + "{" + "action=" + getActionName(action) + ", resourceId=" + resourceIdentifier + ", serverId=" + serverId + ", timestamp=" + timestamp + "}"; } protected String getPayloadToString() { return source.toString(); } public String getType() { return TYPE_INFO; } public String getActionName() { return getActionName(action); } protected static synchronized void registerAction(String name, int i) { String lowerCaseName = name.toLowerCase(); Integer id = new Integer(i); if (actionNameToId.containsKey(lowerCaseName)) { throw new IllegalStateException("Action " + name + " already registered"); } if (actionIdToName.containsKey(id)) { throw new IllegalStateException("Action id " + i + " already registered"); } actionIdToName.put(id, lowerCaseName); actionNameToId.put(lowerCaseName, id); } public static String getActionName(int action) { if (action == NO_ACTION_ID) { return NO_ACTION_NAME; } Integer key = new Integer(action); if (actionIdToName.containsKey(key)) { return (String) actionIdToName.get(key); } else { throw new IllegalArgumentException("No action with id: " + action); } } public static int getActionId(String action) { String lowerCaseName = action.toLowerCase(); if (actionNameToId.containsKey(lowerCaseName)) { return ((Integer) actionNameToId.get(lowerCaseName)).intValue(); } else { throw new IllegalArgumentException("No action called: " + action); } } } mule-2.0.1/core/src/main/java/org/mule/api/context/notification/ModelNotificationListener.java0000644000175000017500000000141410745677442032340 0ustar charlescharles/* * $Id: ModelNotificationListener.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * ModelNotificationListener is an observer interface that objects can * implement and then register themselves with the Mule manager to be notified when a * Model event occurs. */ public interface ModelNotificationListener extends ServerNotificationListener { // no methods } mule-2.0.1/core/src/main/java/org/mule/api/context/notification/SecurityNotificationListener.java0000644000175000017500000000135710763554366033114 0ustar charlescharles/* * $Id: SecurityNotificationListener.java 11181 2008-03-05 17:31:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * MuleContextNotificationListener is an observer interface that objects * can implement to receive notifications about secure access requests. */ public interface SecurityNotificationListener extends ServerNotificationListener { // no methods } mule-2.0.1/core/src/main/java/org/mule/api/context/notification/ServerNotificationHandler.java0000644000175000017500000000233210745677442032336 0ustar charlescharles/* * $Id: ServerNotificationHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; public interface ServerNotificationHandler { public void fireNotification(ServerNotification notification); public boolean isNotificationDynamic(); /** * This returns a very "conservative" value - it is true if the notification or any subclass would be * accepted. So if it returns false then you can be sure that there is no need to send the * notification. On the other hand, if it returns true there is no guarantee that the notification * "really" will be dispatched to any listener. * * @param notfnClass Either the notification class being generated or some superclass * @return false if there is no need to dispatch the notification */ public boolean isNotificationEnabled(Class notfnClass); } mule-2.0.1/core/src/main/java/org/mule/api/context/notification/ManagementNotificationListener.java0000644000175000017500000000141010745677442033350 0ustar charlescharles/* * $Id: ManagementNotificationListener.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * ManagementNotificationListener is an observer interface that * objects can use to receive notifications about the state of the Mule instance and * its resources */ public interface ManagementNotificationListener extends ServerNotificationListener { // no methods } mule-2.0.1/core/src/main/java/org/mule/api/context/notification/ServiceNotificationListener.java0000644000175000017500000000142410746275214032671 0ustar charlescharles/* * $Id: ServiceNotificationListener.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context.notification; /** * ServiceNotificationListener is an observer interface that objects * can implement and then register themselves with the Mule manager to be notified * when a Service event occurs. */ public interface ServiceNotificationListener extends ServerNotificationListener { // no methods } mule-2.0.1/core/src/main/java/org/mule/api/context/WorkManager.java0000644000175000017500000000154410745677442024756 0ustar charlescharles/* * $Id: WorkManager.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Startable; import edu.emory.mathcs.backport.java.util.concurrent.Executor; /** * WorkManager extends the standard JCA WorkManager with lifecycle * methods and util.concurrent bridging. */ public interface WorkManager extends javax.resource.spi.work.WorkManager, Startable, Disposable, Executor { // no additional methods } mule-2.0.1/core/src/main/java/org/mule/api/context/MuleContextException.java0000644000175000017500000000225410745677442026666 0ustar charlescharles/* * $Id: MuleContextException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context; import org.mule.api.MuleException; import org.mule.config.i18n.Message; /** * MuleContextException is thrown when an exception occurs with Manager * objects */ public class MuleContextException extends MuleException { /** * Serial version */ private static final long serialVersionUID = -1526680893293714180L; /** * @param message the exception message */ public MuleContextException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public MuleContextException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/context/MuleContextFactory.java0000644000175000017500000000627310745677442026344 0ustar charlescharles/* * $Id: MuleContextFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.config.ConfigurationException; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.builders.DefaultsConfigurationBuilder; import java.util.List; /** * A {@link CopyOfMuleContextFactory} is used to create instances of * {@link MuleContext}. The instances of {@link MuleContext} returned by this * factory are initialised but not started. */ public interface MuleContextFactory { /** * Returns an existing instance of {@link MuleContext} is one exists, otherwise a * new {@link MuleContext} instance is created with defaults. * * @return * @throws InitialisationException * @throws ConfigurationException * @see {@link DefaultsConfigurationBuilder} */ MuleContext createMuleContext() throws InitialisationException, ConfigurationException; /** * Creates a new MuleContext using the {@link MuleContextBuilder} provided. * * @param configurationBuilder * @return * @throws InitialisationException * @throws ConfigurationException */ public MuleContext createMuleContext(MuleContextBuilder muleContextBuilder) throws InitialisationException, ConfigurationException; /** * Creates a new MuleContext using the given configurationBuilder * * @param configurationBuilder * @return * @throws InitialisationException * @throws ConfigurationException */ public MuleContext createMuleContext(ConfigurationBuilder configurationBuilder) throws InitialisationException, ConfigurationException; /** * Creates a new MuleContext using the {@link MuleContextBuilder} provided and * configures it with the list of configuration builder and c onfigures it with * configurationBuilder * * @param configurationBuilder * @return * @throws InitialisationException * @throws ConfigurationException */ public MuleContext createMuleContext(ConfigurationBuilder configurationBuilder, MuleContextBuilder muleContextBuilder) throws InitialisationException, ConfigurationException; /** * Creates a new MuleContext using the {@link MuleContextBuilder} provided and * configures it with the list of configuration builders. Configuration builders * will be invoked in the same or as provided in the List. * * @param configurationBuilder * @return * @throws InitialisationException * @throws ConfigurationException */ public MuleContext createMuleContext(List configurationBuilders, MuleContextBuilder muleContextBuilder) throws InitialisationException, ConfigurationException; } mule-2.0.1/core/src/main/java/org/mule/api/context/MuleContextBuilder.java0000644000175000017500000000276410766637211026315 0ustar charlescharles/* * $Id: MuleContextBuilder.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context; import org.mule.api.MuleContext; import org.mule.api.config.MuleConfiguration; import org.mule.api.lifecycle.LifecycleManager; import org.mule.context.notification.ServerNotificationManager; import javax.resource.spi.work.WorkListener; /** * Builder that is used to build instances of {@link MuleContext}. Implementing * classes are stateful and should provide public chainable setters for configuring * the builder instance and no public getters. */ public interface MuleContextBuilder { /** * Builds a new {@link MuleContext} instance using configured builder instance. * Does not initialise or start MuleContext, only constructs the instance. * * @return */ MuleContext buildMuleContext(); void setWorkManager(WorkManager workManager); void setWorkListener(WorkListener workListener); void setNotificationManager(ServerNotificationManager notificationManager); void setLifecycleManager(LifecycleManager lifecycleManager); void setMuleConfiguration(MuleConfiguration muleConfiguration); } mule-2.0.1/core/src/main/java/org/mule/api/context/MuleContextAware.java0000644000175000017500000000140010745677442025757 0ustar charlescharles/* * $Id: MuleContextAware.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.context; import org.mule.api.MuleContext; /** * Objects who want to be aware of the MuleContext should implement this interface. Once the context has * been initialised it will be passed to all objects implementing this interface. */ public interface MuleContextAware { void setMuleContext(MuleContext context); } mule-2.0.1/core/src/main/java/org/mule/api/transaction/0000755000175000017500000000000011351411117022506 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/transaction/Transaction.java0000644000175000017500000000403210747501743025652 0ustar charlescharles/* * $Id: Transaction.java 10590 2008-01-29 01:39:47Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transaction; public interface Transaction { int STATUS_ACTIVE = 0; int STATUS_MARKED_ROLLBACK = 1; int STATUS_PREPARED = 2; int STATUS_COMMITTED = 3; int STATUS_ROLLEDBACK = 4; int STATUS_UNKNOWN = 5; int STATUS_NO_TRANSACTION = 6; int STATUS_PREPARING = 7; int STATUS_COMMITTING = 8; int STATUS_ROLLING_BACK = 9; /** * Begin the transaction. * * @throws TransactionException */ void begin() throws TransactionException; /** * Commit the transaction * * @throws TransactionException */ void commit() throws TransactionException; /** * Rollback the transaction * * @throws TransactionException */ void rollback() throws TransactionException; int getStatus() throws TransactionException; boolean isBegun() throws TransactionException; boolean isRolledBack() throws TransactionException; boolean isCommitted() throws TransactionException; Object getResource(Object key); boolean hasResource(Object key); void bindResource(Object key, Object resource) throws TransactionException; void setRollbackOnly() throws TransactionException; boolean isRollbackOnly() throws TransactionException; boolean isXA(); /** * Resume the XA transaction * * @throws TransactionException if any error */ void resume() throws TransactionException; /** * Suspend the XA transaction * * @return * @throws TransactionException if any error */ javax.transaction.Transaction suspend() throws TransactionException; } mule-2.0.1/core/src/main/java/org/mule/api/transaction/TransactionException.java0000644000175000017500000000246410745677442027550 0ustar charlescharles/* * $Id: TransactionException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transaction; import org.mule.api.MuleException; import org.mule.config.i18n.Message; /** *

    * TransactionException is thrown when an exception occurs while * trying to create, start commit or rollback an exception */ public class TransactionException extends MuleException { /** * Serial version */ private static final long serialVersionUID = -3470229644235978820L; /** * @param message the exception message */ public TransactionException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public TransactionException(Message message, Throwable cause) { super(message, cause); } public TransactionException(Throwable cause) { super(cause); } } mule-2.0.1/core/src/main/java/org/mule/api/transaction/TransactionManagerFactory.java0000644000175000017500000000172010745677442030506 0ustar charlescharles/* * $Id: TransactionManagerFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transaction; import javax.transaction.TransactionManager; /** * TranactionManagerFactory is a factory class for creating a * transaction manager for the MuleServer. * */ public interface TransactionManagerFactory { /** * Creates of obtains the jta transaction manager to use for mule transactions * * @return the transaction manager to use * @throws Exception if the transaction manager cannot be located or created */ TransactionManager create() throws Exception; } mule-2.0.1/core/src/main/java/org/mule/api/transaction/TransactionFactory.java0000644000175000017500000000222510745677442027214 0ustar charlescharles/* * $Id: TransactionFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transaction; import org.mule.api.MuleContext; /** * TransactionFactory creates a transaction. * */ public interface TransactionFactory { /** * Create and begins a new transaction * * @return a new Transaction * @throws TransactionException if the transaction cannot be created or begun * @param muleContext */ Transaction beginTransaction(MuleContext muleContext) throws TransactionException; /** * Determines whether this transaction factory creates transactions that are * really transacted or if they are being used to simulate batch actions, such as * using Jms Client Acknowledge. * * @return */ boolean isTransacted(); } mule-2.0.1/core/src/main/java/org/mule/api/transaction/TransactionConfig.java0000644000175000017500000000301710745677442027012 0ustar charlescharles/* * $Id: TransactionConfig.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transaction; import org.mule.transaction.constraints.ConstraintFilter; /** * TransactionConfig defines transaction configuration for a * transactional endpoint. */ public interface TransactionConfig { /** Whether there is a transaction available or not, ignore it */ byte ACTION_NONE = 0; /** Will ensure that a new transaction is created for each invocation */ byte ACTION_ALWAYS_BEGIN = 1; /** Will begin a new transaction if no transaction is already present */ byte ACTION_BEGIN_OR_JOIN = 2; /** There must always be a transaction present for the invocation */ byte ACTION_ALWAYS_JOIN = 3; /** If there is a transaction available, then use it, otherwise continue processing */ byte ACTION_JOIN_IF_POSSIBLE = 4; TransactionFactory getFactory(); void setFactory(TransactionFactory factory); byte getAction(); void setAction(byte action); boolean isTransacted(); ConstraintFilter getConstraint(); void setConstraint(ConstraintFilter constraint); void setTimeout(int timeout); int getTimeout(); } mule-2.0.1/core/src/main/java/org/mule/api/transaction/TransactionCallback.java0000644000175000017500000000104710745677442027302 0ustar charlescharles/* * $Id: TransactionCallback.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transaction; public interface TransactionCallback { Object doInTransaction() throws Exception; } mule-2.0.1/core/src/main/java/org/mule/api/config/0000755000175000017500000000000011351411121021421 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/config/MuleProperties.java0000644000175000017500000001452310766460477025303 0ustar charlescharles/* * $Id: MuleProperties.java 11362 2008-03-14 11:27:59Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.config; /** * MuleProperties is a set of constants pertaining to Mule properties. */ public interface MuleProperties { /** * The prefix for any Mule-specific properties set on an event */ String PROPERTY_PREFIX = "MULE_"; // End System properties /******************************************************************************** * MuleEvent Level properties *******************************************************************************/ String MULE_EVENT_PROPERTY = PROPERTY_PREFIX + "EVENT"; String MULE_EVENT_TIMEOUT_PROPERTY = PROPERTY_PREFIX + "EVENT_TIMEOUT"; String MULE_METHOD_PROPERTY = "method"; // Deprecated. 'method' is now used consistently for all transports // String MULE_METHOD_PROPERTY = PROPERTY_PREFIX + "SERVICE_METHOD"; String MULE_IGNORE_METHOD_PROPERTY = PROPERTY_PREFIX + "IGNORE_METHOD"; String MULE_ENDPOINT_PROPERTY = PROPERTY_PREFIX + "ENDPOINT"; String MULE_ORIGINATING_ENDPOINT_PROPERTY = PROPERTY_PREFIX + "ORIGINATING_ENDPOINT"; String MULE_ERROR_CODE_PROPERTY = PROPERTY_PREFIX + "ERROR_CODE"; String MULE_REPLY_TO_PROPERTY = PROPERTY_PREFIX + "REPLYTO"; String MULE_USER_PROPERTY = PROPERTY_PREFIX + "USER"; String MULE_ENCODING_PROPERTY = PROPERTY_PREFIX + "ENCODING"; String MULE_REPLY_TO_REQUESTOR_PROPERTY = PROPERTY_PREFIX + "REPLYTO_REQUESTOR"; String MULE_SESSION_ID_PROPERTY = PROPERTY_PREFIX + "SESSION_ID"; String MULE_SESSION_PROPERTY = PROPERTY_PREFIX + "SESSION"; String MULE_MESSAGE_ID_PROPERTY = PROPERTY_PREFIX + "MESSAGE_ID"; String MULE_CORRELATION_ID_PROPERTY = PROPERTY_PREFIX + "CORRELATION_ID"; String MULE_CORRELATION_GROUP_SIZE_PROPERTY = PROPERTY_PREFIX + "CORRELATION_GROUP_SIZE"; String MULE_CORRELATION_SEQUENCE_PROPERTY = PROPERTY_PREFIX + "CORRELATION_SEQUENCE"; String MULE_REMOTE_SYNC_PROPERTY = PROPERTY_PREFIX + "REMOTE_SYNC"; String MULE_REMOTE_CLIENT_ADDRESS = PROPERTY_PREFIX + "REMOTE_CLIENT_ADDRESS"; String MULE_SOAP_METHOD = PROPERTY_PREFIX + "SOAP_METHOD"; String MULE_JMS_SESSION = PROPERTY_PREFIX + "JMS_SESSION"; String MULE_MANAGEMENT_CONTEXT_PROPERTY = PROPERTY_PREFIX + "MANAGEMENT_CONTEXT"; // End MuleEvent Level properties /******************************************************************************** * Generic Service descriptor properties *******************************************************************************/ public final String SERVICE_FINDER = "service.finder"; /******************************************************************************** * Model Service descriptor properties *******************************************************************************/ public final String MODEL_CLASS = "model"; /******************************************************************************** * Transport Service descriptor properties *******************************************************************************/ String CONNECTOR_CLASS = "connector"; String CONNECTOR_MESSAGE_RECEIVER_CLASS = "message.receiver"; String CONNECTOR_TRANSACTED_MESSAGE_RECEIVER_CLASS = "transacted.message.receiver"; String CONNECTOR_XA_TRANSACTED_MESSAGE_RECEIVER_CLASS = "xa.transacted.message.receiver"; String CONNECTOR_DISPATCHER_FACTORY = "dispatcher.factory"; String CONNECTOR_REQUESTER_FACTORY = "requester.factory"; String CONNECTOR_TRANSACTION_FACTORY = "transaction.factory"; String CONNECTOR_MESSAGE_ADAPTER = "message.adapter"; String CONNECTOR_INBOUND_TRANSFORMER = "inbound.transformer"; String CONNECTOR_OUTBOUND_TRANSFORMER = "outbound.transformer"; String CONNECTOR_RESPONSE_TRANSFORMER = "response.transformer"; String CONNECTOR_ENDPOINT_BUILDER = "endpoint.builder"; String CONNECTOR_SERVICE_FINDER = "service.finder"; String CONNECTOR_SERVICE_ERROR = "service.error"; String CONNECTOR_SESSION_HANDLER = "session.handler"; // End Connector Service descriptor properties String MULE_WORKING_DIRECTORY_PROPERTY = "mule.working.dir"; String MULE_HOME_DIRECTORY_PROPERTY = "mule.home"; // Object Name Keys String OBJECT_SYSTEM_MODEL = "_muleSystemModel"; String OBJECT_MULE_CONTEXT_PROCESSOR = "_muleContextProcessor"; String OBJECT_PROPERTY_PLACEHOLDER_PROCESSOR = "_mulePropertyPlaceholderProcessor"; String OBJECT_OBJECT_NAME_PROCESSOR = "_muleObjectNameProcessor"; String OBJECT_LIFECYCLE_MANAGER = "_muleLifecycleManager"; String OBJECT_SECURITY_MANAGER = "_muleSecurityManager"; String OBJECT_TRANSACTION_MANAGER = "_muleTransactionManager"; String OBJECT_QUEUE_MANAGER = "_muleQueueManager"; String OBJECT_MULE_APPLICATION_PROPERTIES = "_muleProperties"; String OBJECT_MULE_ENDPOINT_FACTORY = "_muleEndpointFactory"; String OBJECT_MULE_SIMPLE_REGISTRY_BOOTSTRAP = "_muleSimpleRegistryBootstrap"; String OBJECT_DEFAULT_THREADING_PROFILE = "_defaultThreadingProfile"; String OBJECT_DEFAULT_MESSAGE_DISPATCHER_THREADING_PROFILE = "_defaultMessageDispatcherThreadingProfile"; String OBJECT_DEFAULT_MESSAGE_REQUESTER_THREADING_PROFILE = "_defaultMessageRequesterThreadingProfile"; String OBJECT_DEFAULT_MESSAGE_RECEIVER_THREADING_PROFILE = "_defaultMessageReceiverThreadingProfile"; String OBJECT_DEFAULT_COMPONENT_THREADING_PROFILE = "_defaultComponentThreadingProfile"; String OBJECT_DEFAULT_CONNECTION_STRATEGY = "_defaultConnectionStrategy"; String OBJECT_MULE_CONFIGURATION = "_muleConfiguration"; // Not currently used as these need to be instance variables of the MuleContext. String OBJECT_WORK_MANAGER = "_muleWorkManager"; String OBJECT_NOTIFICATION_MANAGER = "_muleNotificationManager"; /** * Specifies whether mule should process messages sysnchonously, i.e. that a * mule-model can only process one message at a time, or asynchronously. The * default value is 'false'. */ String SYNCHRONOUS_PROPERTY = "synchronous"; } mule-2.0.1/core/src/main/java/org/mule/api/config/ConfigurationException.java0000644000175000017500000000175510745677442027014 0ustar charlescharles/* * $Id: ConfigurationException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.config; import org.mule.api.DefaultMuleException; import org.mule.config.i18n.Message; public class ConfigurationException extends DefaultMuleException { /** * Serial version */ private static final long serialVersionUID = 3658822340943734960L; public ConfigurationException(Message message) { super(message); } public ConfigurationException(Message message, Throwable cause) { super(message, cause); } public ConfigurationException(Throwable cause) { super(cause); } } mule-2.0.1/core/src/main/java/org/mule/api/config/ThreadingProfile.java0000644000175000017500000001303010746275214025531 0ustar charlescharles/* * $Id: ThreadingProfile.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.config; import org.mule.api.context.WorkManager; import org.mule.config.ImmutableThreadingProfile; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionHandler; import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory; import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; import org.apache.commons.collections.map.CaseInsensitiveMap; /** * Mule uses a few different pools i.e. for service threads and message dispatchers. This interface * makes it easier to configure the pool. Pools are created via * {@link ImmutableThreadingProfile#createPool(String, ThreadingProfile)} (which * should really be a separate factory). * *

    {@link ImmutableThreadingProfile} is a simple read-only implementation that * makes a local copy of any {@link org.mule.api.config.ThreadingProfile} passed to a consructor.

    * *

    {@link org.mule.config.ChainedThreadingProfile} is a mutable implementation that can take * default values from an existing {@link org.mule.api.config.ThreadingProfile}. The default values * can be either dynamic (read whenever the value is queried) or static (a local copy of the * default is made when the profile is first constructed).

    */ public interface ThreadingProfile { /** * Default value for MAX_THREADS_ACTIVE */ public static final int DEFAULT_MAX_THREADS_ACTIVE = 16; /** * Default value for MAX_THREADS_IDLE */ public static final int DEFAULT_MAX_THREADS_IDLE = 1; /** * Default value for MAX_BUFFER_SIZE */ public static final int DEFAULT_MAX_BUFFER_SIZE = 0; /** * Default value for MAX_THREAD_TTL */ public static final long DEFAULT_MAX_THREAD_TTL = 60000; /** * Default value for DEFAULT_THREAD_WAIT_TIMEOUT */ public static final long DEFAULT_THREAD_WAIT_TIMEOUT = 30000L; /** * Default value for do threading */ public static final boolean DEFAULT_DO_THREADING = true; /** * Actions to perform on pool exhaustion */ public static final int WHEN_EXHAUSTED_WAIT = 0; public static final int WHEN_EXHAUSTED_DISCARD = 1; public static final int WHEN_EXHAUSTED_DISCARD_OLDEST = 2; public static final int WHEN_EXHAUSTED_ABORT = 3; public static final int WHEN_EXHAUSTED_RUN = 4; /** * Default action to perform on pool exhaustion */ static final int DEFAULT_POOL_EXHAUST_ACTION = WHEN_EXHAUSTED_RUN; // map pool exhaustion strings to their respective values static final Map POOL_EXHAUSTED_ACTIONS = new CaseInsensitiveMap() { private static final long serialVersionUID = 1L; // initializer { Integer value = new Integer(WHEN_EXHAUSTED_WAIT); this.put("WHEN_EXHAUSTED_WAIT", value); this.put("WAIT", value); value = new Integer(WHEN_EXHAUSTED_DISCARD); this.put("WHEN_EXHAUSTED_DISCARD", value); this.put("DISCARD", value); value = new Integer(WHEN_EXHAUSTED_DISCARD_OLDEST); this.put("WHEN_EXHAUSTED_DISCARD_OLDEST", value); this.put("DISCARD_OLDEST", value); value = new Integer(WHEN_EXHAUSTED_ABORT); this.put("WHEN_EXHAUSTED_ABORT", value); this.put("ABORT", value); value = new Integer(WHEN_EXHAUSTED_RUN); this.put("WHEN_EXHAUSTED_RUN", value); this.put("RUN", value); } }; static final ThreadingProfile DEFAULT_THREADING_PROFILE = new ImmutableThreadingProfile( DEFAULT_MAX_THREADS_ACTIVE, DEFAULT_MAX_THREADS_IDLE, DEFAULT_MAX_BUFFER_SIZE, DEFAULT_MAX_THREAD_TTL, DEFAULT_THREAD_WAIT_TIMEOUT, DEFAULT_POOL_EXHAUST_ACTION, DEFAULT_DO_THREADING, null, null ); int getMaxThreadsActive(); int getMaxThreadsIdle(); long getThreadTTL(); long getThreadWaitTimeout(); int getPoolExhaustedAction(); RejectedExecutionHandler getRejectedExecutionHandler(); ThreadFactory getThreadFactory(); void setMaxThreadsActive(int maxThreadsActive); void setMaxThreadsIdle(int maxThreadsIdle); void setThreadTTL(long threadTTL); void setThreadWaitTimeout(long threadWaitTimeout); void setPoolExhaustedAction(int poolExhaustPolicy); void setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler); void setThreadFactory(ThreadFactory threadFactory); int getMaxBufferSize(); void setMaxBufferSize(int maxBufferSize); WorkManagerFactory getWorkManagerFactory(); void setWorkManagerFactory(WorkManagerFactory workManagerFactory); WorkManager createWorkManager(String name); ThreadPoolExecutor createPool(); ThreadPoolExecutor createPool(String name); boolean isDoThreading(); void setDoThreading(boolean doThreading); static interface WorkManagerFactory { WorkManager createWorkManager(ThreadingProfile profile, String name); } } mule-2.0.1/core/src/main/java/org/mule/api/config/ExceptionReader.java0000644000175000017500000000220610745677442025377 0ustar charlescharles/* * $Id: ExceptionReader.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.config; import java.util.Map; /** * Provides a strategy interface for reading information from an exception in a * consistent way. For example JMS 1.0.2b uses linkedExceptions rather that 'cause' * and SQLExceptions hold additional information that can be extracted using this * interface. */ public interface ExceptionReader { String getMessage(Throwable t); Throwable getCause(Throwable t); Class getExceptionType(); /** * Returns a map of the non-stanard information stored on the exception * * @param t the exception to extract the information from * @return a map of the non-stanard information stored on the exception */ Map getInfo(Throwable t); } mule-2.0.1/core/src/main/java/org/mule/api/config/ConfigurationBuilder.java0000644000175000017500000000400110745677442026427 0ustar charlescharles/* * $Id: ConfigurationBuilder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.config; import org.mule.api.MuleContext; /** * A ConfigurationBuilder is used to configure a Mule instance, * represented by a MuleContext instance. Multiple ConfigurationBuilder's can be used * to configure a single mule instance with each ConfigurationBuilder doing one of * more of the following: *
  • Creation of mule runtime artifacts (endpoint's, connector's, service's, * transformer's) which are then registered with the Registy Creation and registration of SecurityManager / TransactionManager / TransactionManagerFactory / QueueManager * and ThreadingProfile's. Unlike the runtime artifacts mule only uses a single instance of each of these and so if * multiple configuration builder create and register these artifacts only one will be used. *
  • Configuration of existing Mule configuration related artifacts such as MuleConfiguration and * ServerNotificationManager *

    * Which of the above takes place, depends on what the configuration source contains and the ConfgurationBuilder implementation is used. */ public interface ConfigurationBuilder { /** * Will configure a MuleContext based on the configuration provided * * @param muleContext * @throws ConfigurationException */ void configure(MuleContext muleContext) throws ConfigurationException; /** * Indicate whether this ConfigurationBulder has been configured yet * * @return true if this ConfigurationBulder has been configured. */ boolean isConfigured(); } mule-2.0.1/core/src/main/java/org/mule/api/config/PropertyFactory.java0000644000175000017500000000206410745677442025474 0ustar charlescharles/* * $Id: PropertyFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.config; import java.util.Map; /** * PropertyFactory is used to create objects from the property file. * PropertyFactories map to elements in the MuleXml config. */ public interface PropertyFactory { /** * Creates a property using code execution. * * @param properties The map of properties preceeding this * @return an object that will become the value of a property with a name that * matches the 'name' attribute on the element. * @throws Exception */ Object create(Map properties) throws Exception; } mule-2.0.1/core/src/main/java/org/mule/api/config/MuleConfiguration.java0000644000175000017500000000267010766637211025746 0ustar charlescharles/* * $Id: MuleConfiguration.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.config; /** * Configuration info. which can be set when creating the MuleContext but becomes * immutable after startup. */ public interface MuleConfiguration { /** * The prefix for any Mule-specific properties set in the system properties */ public static final String SYSTEM_PROPERTY_PREFIX = "mule."; boolean isDefaultSynchronousEndpoints(); int getDefaultSynchronousEventTimeout(); boolean isDefaultRemoteSync(); String getWorkingDirectory(); String getMuleHomeDirectory(); int getDefaultTransactionTimeout(); boolean isClientMode(); String getDefaultEncoding(); String getId(); String getClusterId(); String getDomainId(); String getSystemModelType(); String getSystemName(); boolean isFailOnMessageScribbling(); boolean isAssertMessageAccess(); boolean isAutoWrapMessageAwareTransform(); boolean isCacheMessageAsBytes(); boolean isCacheMessageOriginalPayload(); boolean isEnableStreaming(); } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/0000755000175000017500000000000011351411116022117 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/lifecycle/StartException.java0000644000175000017500000000306510746275214025760 0ustar charlescharles/* * $Id: StartException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.config.i18n.Message; /** DisposeException TODO (document class) */ public class StartException extends LifecycleException { /** Serial version */ private static final long serialVersionUID = 1714192220605243678L; /** * @param message the exception message * @param service the object that failed during a lifecycle method call */ public StartException(Message message, Startable component) { super(message, component); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public StartException(Message message, Throwable cause, Startable component) { super(message, cause, component); } /** * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public StartException(Throwable cause, Startable component) { super(cause, component); } }mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/package.html0000644000175000017500000000013010745677442024420 0ustar charlescharles Lifecycle interfaces for all UMOcomponents. mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/Lifecycle.java0000644000175000017500000000135010745677442024706 0ustar charlescharles/* * $Id: Lifecycle.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; /** * DefaultLifecyclePhase adds lifecycle methods start, * stop and dispose. * TODO MULE-2113 */ public interface Lifecycle extends Initialisable, Startable, Stoppable, Disposable { // no additional methods - see super interfaces } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/CreateException.java0000644000175000017500000000337010746275214026065 0ustar charlescharles/* * $Id: CreateException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.config.i18n.Message; /** * InitialisationException is thrown by the initialise method defined * in the org.mule.api.lifecycle.Initialisable interface. * IinitialisationExceptions are fatal and will cause the current Mule instance to * shutdown. */ public class CreateException extends LifecycleException { /** Serial version */ private static final long serialVersionUID = -8402348927606781921L; /** * @param message the exception message * @param service the object that failed during a lifecycle method call */ public CreateException(Message message, Object component) { super(message, component); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public CreateException(Message message, Throwable cause, Object component) { super(message, cause, component); } /** * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public CreateException(Throwable cause, Object component) { super(cause, component); } }mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/Stoppable.java0000644000175000017500000000124110774254333024727 0ustar charlescharles/* * $Id: Stoppable.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.api.MuleException; /** * Stoppable TODO (document class) */ public interface Stoppable { public static final String PHASE_NAME = "stop"; void stop() throws MuleException; } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/FatalException.java0000644000175000017500000000324710746275214025714 0ustar charlescharles/* * $Id: FatalException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.config.i18n.Message; /** * FatalException can be thrown during initialisation or during * execution to indicate that something fatal has occurred and the MuleManager must * shutdown. */ public class FatalException extends LifecycleException { /** * Serial version */ private static final long serialVersionUID = -330442983239074937L; /** * @param message the exception message * @param service the object that failed during a lifecycle method call */ public FatalException(Message message, Object component) { super(message, component); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public FatalException(Message message, Throwable cause, Object component) { super(message, cause, component); } /** * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public FatalException(Throwable cause, Object component) { super(cause, component); } } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/LifecycleTransitionResult.java0000644000175000017500000000611310774254333030152 0ustar charlescharles/* * $Id: LifecycleTransitionResult.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.util.ClassUtils; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Iterator; /** * Restrict possible results - only OK or a retry based on some throwable are currently allowed. */ public final class LifecycleTransitionResult { /** * The logic for processing a collection of children * * @param iface The lifecycle interface to be called * @param objects An iterator over all children that must also be called * @throws org.mule.api.lifecycle.LifecycleException if any fail */ private static void processAllNoRetry(Class iface, Iterator objects) throws LifecycleException { if (!iface.isAssignableFrom(Lifecycle.class)) { throw new IllegalArgumentException("Not a Lifecycle interface: " + iface); } // all interfaces have a single method Method method = iface.getMethods()[0]; // some interfaces have a single exception, others none boolean hasException = method.getExceptionTypes().length > 0; Class exception = hasException ? method.getExceptionTypes()[0] : null; while (objects.hasNext()) { Object target = objects.next(); processSingleNoRetry(target, method, exception, iface); } } private static void processSingleNoRetry(Object target, Method method, Class exception, Class iface) throws LifecycleException { if (! iface.isAssignableFrom(target.getClass())) { throw new IllegalArgumentException(ClassUtils.getSimpleName(target.getClass()) + " is not an " + ClassUtils.getSimpleName(iface)); } try { method.invoke(target, ClassUtils.NO_ARGS); } catch (IllegalAccessException e) { throw (IllegalArgumentException) new IllegalArgumentException("Unsupported interface: " + iface).initCause(e); } catch (InvocationTargetException e) { throw (IllegalArgumentException) new IllegalArgumentException("Unsupported interface: " + iface).initCause(e); } } /** * Initialise children */ public static void initialiseAll(Iterator children) throws InitialisationException { try { processAllNoRetry(Initialisable.class, children); } catch (InitialisationException e) { throw e; } catch (LifecycleException e) { throw (IllegalStateException) new IllegalStateException("Unexpected exception: " + e).initCause(e); } } } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/DisposeException.java0000644000175000017500000000310310746275214026262 0ustar charlescharles/* * $Id: DisposeException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.config.i18n.Message; /** DisposeException TODO (document class) */ public class DisposeException extends LifecycleException { /** Serial version */ private static final long serialVersionUID = 1714192290605243678L; /** * @param message the exception message * @param service the object that failed during a lifecycle method call */ public DisposeException(Message message, Disposable component) { super(message, component); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public DisposeException(Message message, Throwable cause, Disposable component) { super(message, cause, component); } /** * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public DisposeException(Throwable cause, Disposable component) { super(cause, component); } } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/LifecycleException.java0000644000175000017500000000372510755123151026555 0ustar charlescharles/* * $Id: LifecycleException.java 10808 2008-02-14 20:36:57Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.api.MuleException; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; import org.mule.util.ObjectUtils; /** LifecycleException TODO */ public class LifecycleException extends MuleException { /** Serial version */ private static final long serialVersionUID = 2909614055858287394L; private transient Object component; /** * @param message the exception message * @param service the object that failed during a lifecycle method call */ public LifecycleException(Message message, Object component) { super(message); this.component = component; } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public LifecycleException(Message message, Throwable cause, Object component) { super(message, cause); this.component = component; } /** * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public LifecycleException(Throwable cause, Object component) { super(CoreMessages.initialisationFailure(cause.getMessage()), cause); this.component = component; addInfo("Object", ObjectUtils.toString(component, "null")); } public Object getComponent() { return component; } } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/RecoverableException.java0000644000175000017500000000260110755123151027077 0ustar charlescharles/* * $Id: RecoverableException.java 10808 2008-02-14 20:36:57Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.config.i18n.Message; /** * RecoverableException can be thrown during initialisation to * indicate that the error occurred is not fatal and a reactive action can be * performed to try and remedy the error. The most common example would be a * Connector failing to connect due to a JVM_BIND exception. */ public class RecoverableException extends InitialisationException { /** Serial version */ private static final long serialVersionUID = -5799024626172482665L; /** @param message the exception message */ public RecoverableException(Message message, Initialisable object) { super(message, object); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public RecoverableException(Message message, Initialisable object, Throwable cause) { super(message, cause, object); } } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/LifecyclePhase.java0000644000175000017500000000364010774254333025663 0ustar charlescharles/* * $Id: LifecyclePhase.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.lifecycle.LifecycleObject; import java.util.Set; /** * Encapsulates the notion of a lifecycle phase i.e. 'stop'. Implementations of this class are responsible * for invoking the lifecycle phase on a set of objects and also for knowing which phases can preceed and go * after it. This objects are configurable so that lifecycles can be customised. * * Note that users wouldn't normally customise the lifecycle of the server. */ public interface LifecyclePhase { String ALL_PHASES = "all"; void fireLifecycle(MuleContext muleContext, String currentPhase) throws MuleException; void addOrderedLifecycleObject(LifecycleObject lco); void removeOrderedLifecycleObject(LifecycleObject lco); Set getOrderedLifecycleObjects(); void setOrderedLifecycleObjects(Set orderedLifecycleObjects); Class[] getIgnoredObjectTypes(); void setIgnoredObjectTypes(Class[] ignorredObjectTypes); Class getLifecycleClass(); void setLifecycleClass(Class lifecycleClass); String getName(); Set getSupportedPhases(); void setSupportedPhases(Set supportedPhases); void registerSupportedPhase(String phase); boolean isPhaseSupported(String phase); void applyLifecycle(Object o) throws LifecycleException; public int getRegistryScope(); public void setRegistryScope(int registryScope); public String getOppositeLifecyclePhase(); } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/Initialisable.java0000644000175000017500000000263710774254333025561 0ustar charlescharles/* * $Id: Initialisable.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; /** * Initialisable is a lifecycle interface that gets called at the * initialise lifecycle stage of the implementing service. */ public interface Initialisable { static final String PHASE_NAME = "initialise"; /** * Method used to perform any initialisation work. If a fatal error occurs during * initialisation an InitialisationException should be thrown, * causing the Mule instance to shutdown. If the error is recoverable, say by * retrying to connect, a RecoverableException should be thrown. * There is no guarantee that by throwing a Recoverable exception that the Mule * instance will not shut down. * * @throws InitialisationException if a fatal error occurs causing the Mule instance to shutdown * @throws RecoverableException if an error occurs that can be recovered from * @return Status of transition */ void initialise() throws InitialisationException; } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/LifecycleManager.java0000644000175000017500000000231510745677442026203 0ustar charlescharles/* * $Id: LifecycleManager.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.api.MuleException; import org.mule.api.MuleContext; import java.util.Set; /** * The LifecycleManager is responsible for managing the different lifecycle phases of the server and managing the * transitions between lifecycle phases. */ public interface LifecycleManager { Set getLifecycles(); void setLifecycles(Set lifecycles); void registerLifecycle(LifecyclePhase lci); void firePhase(MuleContext muleContext, String phase) throws MuleException; String getCurrentPhase(); String getExecutingPhase(); void reset(); boolean isPhaseComplete(String phaseName); void applyLifecycle(MuleContext muleContext, Object object) throws MuleException; void checkPhase(String name) throws IllegalStateException; } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/Callable.java0000644000175000017500000000366310762020431024472 0ustar charlescharles/* * $Id: Callable.java 11129 2008-02-29 15:13:29Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.api.MuleEventContext; /** * Callable is used to provide UMOs with an interface that supports * event calls. UMO components do not have to implement this interface, though the * onCall method provides an example lifecycle method that is executed * when an event is received for the implementing service. */ public interface Callable extends EventListener { /** * Passes the event to the listener * * @param eventContext the context of the current event being process * @return Object this object can be anything. When the * LifecycleAdapter for the service receives this * object it will first see if the Object is an MuleMessage * if not and the Object is not null a new message will be created using * the returned object as the payload. This new event will then get * published via the configured outbound router if- *
      *
    1. One has been configured for the UMO.
    2. *
    3. the setStopFurtherProcessing(true) wasn't called * on the event context event.
    4. *
    * @throws Exception if the event fails to process properly. If exceptions aren't * handled by the implementation they will be handled by the * exceptionListener associated with the service */ Object onCall(MuleEventContext eventContext) throws Exception; } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/InitialisationCallback.java0000644000175000017500000000145510746275214027402 0ustar charlescharles/* * $Id: InitialisationCallback.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; /** * InitialisationCallback is used to provide customised initialiation * for more complex components. For example, soap services have a custom * initialisation that passes the service object to the mule service. */ public interface InitialisationCallback { void initialise(Object component) throws InitialisationException; } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/EventListener.java0000644000175000017500000000166210745677442025604 0ustar charlescharles/* * $Id: EventListener.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; /** * EventListener is a marker interface that is implemented by * objects wishing to receive UMO events in managed environments, succh as an EJB * container. There are not methods on this interface as typically Mule will work out * the method to invoke on the listener. Developers can implement * org.mule.api.lifecycle.Callable to implement a specific Mule * listener interface. * * @see Callable */ public interface EventListener { // no methods } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/StopException.java0000644000175000017500000000306010746275214025603 0ustar charlescharles/* * $Id: StopException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.config.i18n.Message; /** DisposeException TODO (document class) */ public class StopException extends LifecycleException { /** Serial version */ private static final long serialVersionUID = 1714192220605243678L; /** * @param message the exception message * @param service the object that failed during a lifecycle method call */ public StopException(Message message, Stoppable component) { super(message, component); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public StopException(Message message, Throwable cause, Stoppable component) { super(message, cause, component); } /** * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public StopException(Throwable cause, Stoppable component) { super(cause, component); } }mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/InitialisationException.java0000644000175000017500000000346610746275214027650 0ustar charlescharles/* * $Id: InitialisationException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.config.i18n.Message; /** * InitialisationException is thrown by the initialise method defined * in the org.mule.api.lifecycle.Initialisable interface. * IinitialisationExceptions are fatal and will cause the current Mule instance to * shutdown. */ public class InitialisationException extends LifecycleException { /** Serial version */ private static final long serialVersionUID = -8402348927606781931L; /** * @param message the exception message * @param service the object that failed during a lifecycle method call */ public InitialisationException(Message message, Initialisable component) { super(message, component); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public InitialisationException(Message message, Throwable cause, Initialisable component) { super(message, cause, component); } /** * @param cause the exception that cause this exception to be thrown * @param service the object that failed during a lifecycle method call */ public InitialisationException(Throwable cause, Initialisable component) { super(cause, component); } } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/Disposable.java0000644000175000017500000000170210746275214025065 0ustar charlescharles/* * $Id: Disposable.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; /** * Disposable is a lifecycle interface that gets called at the dispose * lifecycle stage of the implementing service as the service is being destroyed. */ public interface Disposable { static final String PHASE_NAME = "dispose"; /** * A lifecycle method where implementor should free up any resources. If an * exception is thrown it should just be logged and processing should continue. * This method should not throw Runtime exceptions. */ void dispose(); } mule-2.0.1/core/src/main/java/org/mule/api/lifecycle/Startable.java0000644000175000017500000000163710774254333024730 0ustar charlescharles/* * $Id: Startable.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.lifecycle; import org.mule.api.MuleException; import org.mule.api.component.LifecycleAdapter; /** * Startable provides an object with a {@link #start()} method * which gets called when the Mule instance gets started. This is mostly used by * infrastructure components, but can also be implemented by service objects * * @see LifecycleAdapter */ public interface Startable { static final String PHASE_NAME = "start"; void start() throws MuleException; } mule-2.0.1/core/src/main/java/org/mule/api/service/0000755000175000017500000000000011351411120021613 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/service/Service.java0000644000175000017500000001640110776731576024116 0ustar charlescharles/* * $Id: Service.java 11537 2008-04-08 18:03:42Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.service; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.NamedObject; import org.mule.api.component.Component; import org.mule.api.context.MuleContextAware; import org.mule.api.lifecycle.Lifecycle; import org.mule.api.model.Model; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.routing.OutboundRouterCollection; import org.mule.api.routing.ResponseRouterCollection; import java.beans.ExceptionListener; import java.io.Serializable; /** * Service is the internal representation of a Mule Managed service. It * is responsible for managing the interaction of events to and from the service as * well as managing pooled resources. */ public interface Service extends Serializable, Lifecycle, MuleContextAware, NamedObject { /** * Makes an asynchronous event call to the service. * * @param event the event to consume * @throws MuleException if the event fails to be processed */ void dispatchEvent(MuleEvent event) throws MuleException; /** * Makes a synchronous event call to the service. This event will be consumed by * the service and a result returned. * * @param event the event to consume * @return a MuleMessage containing the resulting message and properties * @throws MuleException if the event fails to be processed */ MuleMessage sendEvent(MuleEvent event) throws MuleException; /** * Determines whether this service has been started * * @return true is the service is started and ready to receive events */ boolean isStarted(); /** * Pauses event processing for a single Mule Service. Unlike stop(), a paused * service will still consume messages from the underlying transport, but those * messages will be queued until the service is resumed. */ void pause() throws MuleException; /** * Resumes a single Mule Service that has been paused. If the service is not * paused nothing is executed. */ void resume() throws MuleException; /** * True if the service is in a paused state, false otherwise * * @return True if the service is in a paused state, false otherwise */ boolean isPaused(); /** * The exception strategy to use to handle exceptions in the Mule UMO. * * @return the exception strategy to use. If none has been set a default will be * used. */ ExceptionListener getExceptionListener(); /** * Inbound Routers control how events are received by a service. If no router is * set. A default will be used that uses the inboundProvider set on his * descriptor. * * @return the inbound router for this service. This will always return a valid * router. * @see InboundRouterCollection */ InboundRouterCollection getInboundRouter(); /** * Outbound Routers control how events are published by a service once. the * event has been processed. If no router is set. A default will be used that * uses the outboundProvider set on his descriptor to route the event. * * @return the outbound router for this service * @see OutboundRouterCollection */ OutboundRouterCollection getOutboundRouter(); /** * Response Routers control how events are returned in a request/response call. * It can be use to aggregate response events before returning, thus acting as a * Join in a forked process. This can be used to make request/response calls a * lot more efficient as independent tasks can be forked, execute concurrently * and then join before the request completes * * @return the response router for this service * @see ResponseRouterCollection */ ResponseRouterCollection getResponseRouter(); /** * Returns the initial state of this service * * @return the initial state of this service */ String getInitialState(); /** * Returns the name of the model that this descriptor is registered with. * @return the name of the model that this descriptor is registered with or null * if this descriptor has not been registered with a model yet */ Model getModel(); /** * The exception strategy to use to handle exceptions in the Mule UMO. * * @param listener the exception strategy to use. If none has been set or * argument is null a default */ void setExceptionListener(ExceptionListener listener); /** * Inbound Routers control how events are received by a service. If no router is * set. A default will be used that uses the inboundProvider set on his * descriptor. * * @param router the inbound router for this service * @see InboundRouterCollection */ void setInboundRouter(InboundRouterCollection router); /** * Outbound Routers control how events are published by a service once. the * event has been processed. If no router is set. A default will be used that * uses the outboundProvider set on his descriptor to route the event. * * @param router the outbound router for this service * @see OutboundRouterCollection */ void setOutboundRouter(OutboundRouterCollection router); /** * Response Routers control how events are returned in a request/response call. * It can be use to aggregate response events before returning, thus acting as a * Join in a forked process. This can be used to make request/response calls a * lot more efficient as independent tasks can be forked, execute concurrently * and then join before the request completes * * @param router the response router for this service * @see org.mule.api.routing.ResponseRouterCollection */ void setResponseRouter(ResponseRouterCollection router); /** * Sets the initial state of this service * * @param state the initial state of this service * @see org.mule.ImmutableMuleDescriptor#INITIAL_STATE_STARTED * @see org.mule.ImmutableMuleDescriptor#INITIAL_STATE_STOPPED * @see org.mule.ImmutableMuleDescriptor#INITIAL_STATE_PAUSED */ void setInitialState(String state); /** * Sets the Model name that this descriptor is registered within. * @param modelName name of the model */ void setModel(Model model); /** * Returns the Component that is a invoked by a {@link Service} for each incoming * {@link MuleEvent} routed on by the {@link InboundRouterCollection}. * * @return */ Component getComponent(); /** * Sets the Component that is a invoked by a {@link Service} for each incoming * {@link MuleEvent} routed on by the {@link InboundRouterCollection}. * * @param component */ void setComponent(Component component); } mule-2.0.1/core/src/main/java/org/mule/api/service/ServiceAware.java0000644000175000017500000000212010746275214025054 0ustar charlescharles/* * $Id: ServiceAware.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.service; import org.mule.api.config.ConfigurationException; /** * ServiceAware is an injector interface that will supply a * Service to the object. This interface should be implemented by services * managed by Mule that want to receive their Service instance. The * Service will be set before any initialisation method is called. i.e. if the * service implements org.mule.api.lifecycle.Initialisable, the descriptor will be * set before initialise() method is called. * * @see org.mule.api.lifecycle.Initialisable * @see Service */ public interface ServiceAware { void setService(Service service) throws ConfigurationException; } mule-2.0.1/core/src/main/java/org/mule/api/service/ServiceException.java0000644000175000017500000000426510746275214025767 0ustar charlescharles/* * $Id: ServiceException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.service; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; /** * ServiceException should be thrown when some action on a service * fails, such as starting or stopping */ // @ThreadSafe public class ServiceException extends MessagingException { /** * Serial version */ private static final long serialVersionUID = 56178344205041599L; private final transient Service service; /** * @param message the exception message */ public ServiceException(Message message, MuleMessage umoMessage, Service service) { super(generateMessage(message, service), umoMessage); this.service = service; } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public ServiceException(Message message, MuleMessage umoMessage, Service service, Throwable cause) { super(generateMessage(message, service), umoMessage, cause); this.service = service; } public ServiceException(MuleMessage umoMessage, Service service, Throwable cause) { super(generateMessage(null, service), umoMessage, cause); this.service = service; } public Service getService() { return service; } private static Message generateMessage(Message previousMessage, Service service) { Message returnMessage = CoreMessages.componentCausedErrorIs(service); if (previousMessage != null) { previousMessage.setNextMessage(returnMessage); return previousMessage; } else { return returnMessage; } } } mule-2.0.1/core/src/main/java/org/mule/api/MuleMessage.java0000644000175000017500000001267610745677442023274 0ustar charlescharles/* * $Id: MuleMessage.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.MessageAdapter; import java.util.List; /** * MuleMessage represents a message payload. The Message comprises of * the payload itself and properties associated with the payload. */ public interface MuleMessage extends MessageAdapter { /** * Returns the currently edited Message adapter for this message. If no edits have been made * this methd will return the same as {@link #getOriginalAdapter()} * @return */ MessageAdapter getAdapter(); /** * Returns the original payload used to create this message. The payload of the message can change if {@link #applyTransformers(java.util.List)} or * {@link #applyTransformers(java.util.List, Class)} is called. * @return the original payload used to create this message */ MessageAdapter getOriginalAdapter(); /** * Will apply a list of transformers to the payload of the message. This *Will* change the payload of the * message. This method provides the only way to alter the paylaod of this message without recreating a * copy of the message * @param transformers the transformers to apply to the message payload * @throws TransformerException if a transformation error occurs or one or more of the transformers passed in a * are incompatible with the message payload */ public void applyTransformers(List transformers) throws TransformerException; /** * Will apply a list of transformers to the payload of the message. This *Will* change the payload of the * message. This method provides the only way to alter the paylaod of this message without recreating a * copy of the message * @param transformers the transformers to apply to the message payload * @param outputType the required output type for this transformation. by adding this parameter some additional * transformations will occur on the message payload to ensure that the final payload is of the specified type. * If no transformers can be found in the registry that can transform from the return type of the transformation * list to the outputType and exception will be thrown * @throws TransformerException if a transformation error occurs or one or more of the transformers passed in a * are incompatible with the message payload */ public void applyTransformers(List transformers, Class outputType) throws TransformerException; /** * Update the message payload. This is typically only called if the * payload was originally an InputStream. In which case, if the InputStream * is consumed, it needs to be replaced for future access. * * @param payload the object to assign as the message payload */ void setPayload(Object payload); /** * Will attempt to obtain the payload of this message with the desired Class type. This will * try and resolve a trnsformr that can do this transformation. If a transformer cannot be found * an exception is thrown. Any transfromers added to the reqgistry will be checked for compatability * @param outputType the desired return type * @return The converted payload of this message. Note that this method will not alter the payload of this * message *unless* the payload is an inputstream in which case the stream will be read and the payload will become * the fully read stream. * @throws TransformerException if a transformer cannot be found or there is an error during transformation of the * payload */ Object getPayload(Class outputType) throws TransformerException; /** * Converts the message implementation into a String representation * * @param encoding The encoding to use when transforming the message (if * necessary). The parameter is used when converting from a byte array * @return String representation of the message payload * @throws Exception Implementation may throw an endpoint specific exception */ String getPayloadAsString(String encoding) throws Exception; /** * Converts the message implementation into a String representation. If encoding * is required it will use the encoding set on the message * * @return String representation of the message payload * @throws Exception Implementation may throw an endpoint specific exception */ String getPayloadAsString() throws Exception; /** * Converts the message implementation into a byte array representation * * @return byte array of the message * @throws Exception Implemetation may throw an endpoint specific exception */ byte[] getPayloadAsBytes() throws Exception; /** * Returns the original payload used to create this message. The payload of the message can change if {@link #applyTransformers(java.util.List)} or * {@link #applyTransformers(java.util.List, Class)} is called. * @return the original payload used to create this message */ Object getOrginalPayload(); } mule-2.0.1/core/src/main/java/org/mule/api/MuleRuntimeException.java0000644000175000017500000000257010764120222025156 0ustar charlescharles/* * $Id: MuleRuntimeException.java 11239 2008-03-07 01:55:30Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.config.i18n.Message; /** * MuleRuntimeException Is the base runtime exception type for the * Mule Server any other runtimes exceptions thrown by Mule code will use or be based * on this exception. Runtime exceptions in mule are only ever thrown where the * method is not declared to throw an exception and the exception is serious. */ public class MuleRuntimeException extends RuntimeException { /** * Serial version */ private static final long serialVersionUID = 6728041560892553159L; /** * @param message the exception message */ public MuleRuntimeException(Message message) { super(message.getMessage()); } /** * @param message the exception message * @param cause the exception that triggered this exception */ public MuleRuntimeException(Message message, Throwable cause) { super(message.getMessage(), cause); } } mule-2.0.1/core/src/main/java/org/mule/api/MuleException.java0000644000175000017500000001605510745677442023641 0ustar charlescharles/* * $Id: MuleException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; import org.mule.util.StringUtils; import org.mule.util.SystemUtils; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * MuleException is the base exception type for the Mule server any * other exceptions thrown by Mule code will be based on this exception, */ public abstract class MuleException extends Exception { private Map info = new HashMap(); private int errorCode = -1; private String message = null; private Message i18nMessage; /** * @param message the exception message */ public MuleException(Message message) { super(); setMessage(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public MuleException(Message message, Throwable cause) { super((cause instanceof InvocationTargetException ? ((InvocationTargetException) cause).getTargetException() : cause)); setMessage(message); } public MuleException(Throwable cause) { super((cause instanceof InvocationTargetException ? ((InvocationTargetException) cause).getTargetException() : cause)); if (cause != null) { setMessage(MessageFactory.createStaticMessage(cause.getMessage() + " (" + cause.getClass().getName() + ")")); } else { initialise(); } } protected MuleException() { super(); initialise(); } protected void setMessage(Message message) { initialise(); this.message = message.getMessage(); i18nMessage = message; } protected void setMessage(String message) { initialise(); this.message = message; if (i18nMessage == null) { i18nMessage = MessageFactory.createStaticMessage(message); } } public int getExceptionCode() { return errorCode; } public Message getI18nMessage() { return i18nMessage; } public int getMessageCode() { return (i18nMessage == null ? 0 : i18nMessage.getCode()); } public void addInfo(String name, Object info) { this.info.put(name, info); } protected void appendMessage(String s) { message += s; } protected void prependMessage(String s) { message = message + ". " + s; } protected void setExceptionCode(int code) { errorCode = code; } public final String getMessage() { return message; } protected void initialise() { setExceptionCode(ExceptionHelper.getErrorCode(getClass())); String javadoc = ExceptionHelper.getJavaDocUrl(getClass()); String doc = ExceptionHelper.getDocUrl(getClass()); if (javadoc != null) { // info.put(ClassHelper.getClassName(getClass()) + " JavaDoc", javadoc); info.put("JavaDoc", javadoc); } if (doc != null) { // info.put(ClassHelper.getClassName(getClass()) + " Other Doc", doc); info.put("Other Doc", doc); } } public String getDetailedMessage() { MuleException e = ExceptionHelper.getRootMuleException(this); if (!e.equals(this)) { return getMessage(); } StringBuffer buf = new StringBuffer(1024); buf.append(SystemUtils.LINE_SEPARATOR).append(StringUtils.repeat('*', 80)).append( SystemUtils.LINE_SEPARATOR); buf.append("Message : ").append(message).append(SystemUtils.LINE_SEPARATOR); buf.append("Type : ") .append(getClass().getName()) .append(SystemUtils.LINE_SEPARATOR); buf.append("Code : ").append("MULE_ERROR-").append( getExceptionCode() + getMessageCode()).append(SystemUtils.LINE_SEPARATOR); // buf.append("Msg Code : // ").append(getMessageCode()).append(SystemUtils.LINE_SEPARATOR); Map info = ExceptionHelper.getExceptionInfo(this); for (Iterator iterator = info.keySet().iterator(); iterator.hasNext();) { String s = (String) iterator.next(); int pad = 22 - s.length(); buf.append(s); if (pad > 0) { buf.append(StringUtils.repeat(' ', pad)); } buf.append(": "); buf.append(info.get(s)).append(SystemUtils.LINE_SEPARATOR); } // print exception stack buf.append(StringUtils.repeat('*', 80)).append(SystemUtils.LINE_SEPARATOR); buf.append(CoreMessages.exceptionStackIs()).append(SystemUtils.LINE_SEPARATOR); buf.append(ExceptionHelper.getExceptionStack(this)); buf.append(StringUtils.repeat('*', 80)).append(SystemUtils.LINE_SEPARATOR); buf.append(CoreMessages.rootStackTrace()).append(SystemUtils.LINE_SEPARATOR); Throwable root = ExceptionHelper.getRootException(this); StringWriter w = new StringWriter(); PrintWriter p = new PrintWriter(w); root.printStackTrace(p); buf.append(w.toString()).append(SystemUtils.LINE_SEPARATOR); buf.append(StringUtils.repeat('*', 80)).append(SystemUtils.LINE_SEPARATOR); return buf.toString(); } public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof MuleException)) { return false; } final MuleException umoException = (MuleException) o; if (errorCode != umoException.errorCode) { return false; } if (i18nMessage != null ? !i18nMessage.equals(umoException.i18nMessage) : umoException.i18nMessage != null) { return false; } if (message != null ? !message.equals(umoException.message) : umoException.message != null) { return false; } return true; } public int hashCode() { int result; result = errorCode; result = 29 * result + (message != null ? message.hashCode() : 0); result = 29 * result + (i18nMessage != null ? i18nMessage.hashCode() : 0); return result; } public Map getInfo() { return info; } } mule-2.0.1/core/src/main/java/org/mule/api/registry/0000755000175000017500000000000011351411122022025 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/registry/ServiceDescriptor.java0000644000175000017500000000115410745677442026361 0ustar charlescharles/* * $Id: ServiceDescriptor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.registry; /** * Parent interface for any pluggable service in Mule (transport, model, etc.) */ public interface ServiceDescriptor { public String getService(); } mule-2.0.1/core/src/main/java/org/mule/api/registry/ServiceException.java0000644000175000017500000000153510745677442026204 0ustar charlescharles/* * $Id: ServiceException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.registry; import org.mule.api.MuleException; import org.mule.config.i18n.Message; /** * Any service-related exception: service not found, service lookup error, etc. */ public class ServiceException extends MuleException { public ServiceException(Message message) { super(message); } public ServiceException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/registry/AbstractServiceDescriptor.java0000644000175000017500000000601110745677442030042 0ustar charlescharles/* * $Id: AbstractServiceDescriptor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.registry; import org.mule.util.ClassUtils; import org.mule.util.StringUtils; import java.util.Map; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public abstract class AbstractServiceDescriptor implements ServiceDescriptor { /** * logger used by this class */ protected final Log logger = LogFactory.getLog(getClass()); protected String service; public AbstractServiceDescriptor(String service) { this.service = service; } public String getService() { return service; } protected String removeProperty(String name, Properties properties) { String temp = (String)properties.remove(name); if (StringUtils.isEmpty(StringUtils.trim(temp))) { return null; } else { return temp; } } protected Class removeClassProperty(String name, Properties properties) throws ClassNotFoundException { String clazz = removeProperty(name, properties); if(clazz==null) return null; return ClassUtils.loadClass(clazz, getClass()); } /** * Unique key used to cache the service descriptors. This uses the service and the * overrides, but since it is generated externally by the factory that instantiates * the service descriptor we do not need to keep overrides or properties anywhere else. */ public static class Key { private final Map overrides; private final String service; public Key(String service, Map overrides) { this.overrides = overrides; this.service = service; } //@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Key)) { return false; } final Key key = (Key)o; if (overrides != null ? !overrides.equals(key.overrides) : key.overrides != null) { return false; } if (!service.equals(key.service)) { return false; } return true; } //@Override public int hashCode() { return 29 * (overrides != null ? overrides.hashCode() : 0) + (service != null ? service.hashCode(): 0); } public String getKey() { return service + ":" + Integer.toString(hashCode()); } } } mule-2.0.1/core/src/main/java/org/mule/api/registry/ServiceFinder.java0000644000175000017500000000215310745677442025452 0ustar charlescharles/* * $Id: ServiceFinder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.registry; import java.util.Properties; /** * ServiceFinder can be used as a hook into the service lookup process to * return the correct Service Descriptor for a given service name. By default a service * is looked up directly, however a generic service name might be used where the real * service implementation will depend on other modules/resources being available. * For example, in the case of a SOAP connector the finder could check the classpath for * Axis or XFire and return the correct descriptor. */ public interface ServiceFinder { String findService(String service, ServiceDescriptor descriptor, Properties props) throws ServiceException; } mule-2.0.1/core/src/main/java/org/mule/api/registry/ServiceDescriptorFactory.java0000644000175000017500000000714610774260226027706 0ustar charlescharles/* * $Id: ServiceDescriptorFactory.java 11518 2008-03-31 22:07:18Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.registry; import org.mule.MuleServer; import org.mule.api.config.MuleProperties; import org.mule.config.i18n.CoreMessages; import org.mule.model.DefaultModelServiceDescriptor; import org.mule.transport.service.DefaultTransportServiceDescriptor; import org.mule.transport.service.TransportServiceDescriptor; import org.mule.util.ClassUtils; import org.mule.util.SpiUtils; import java.util.Properties; import org.apache.commons.lang.StringUtils; /** * Factory used to create a new service descriptor. */ // TODO MULE-2102 public class ServiceDescriptorFactory { // Service types (used for looking up the service descriptors) public static final String PROVIDER_SERVICE_TYPE = "transport"; public static final String MODEL_SERVICE_TYPE = "model"; public static final String EXCEPTION_SERVICE_TYPE = "exception"; /** * Factory method to create a new service descriptor. */ public static ServiceDescriptor create(String type, String name, Properties props, Properties overrides, Registry registry) throws ServiceException { if (overrides != null) { props.putAll(overrides); } String serviceFinderClass = (String) props.remove(MuleProperties.SERVICE_FINDER); ServiceDescriptor sd = null; if (type.equals(PROVIDER_SERVICE_TYPE)) { try { sd = new DefaultTransportServiceDescriptor(name, props, registry); } catch (Exception e) { throw (IllegalStateException) new IllegalStateException("Cannot create transport " + name).initCause(e); } Properties exceptionMappingProps = SpiUtils.findServiceDescriptor(EXCEPTION_SERVICE_TYPE, name + "-exception-mappings"); ((TransportServiceDescriptor) sd).setExceptionMappings(exceptionMappingProps); } else if (type.equals(MODEL_SERVICE_TYPE)) { sd = new DefaultModelServiceDescriptor(name, props); } else { throw new ServiceException(CoreMessages.unrecognisedServiceType(type)); } // If there is a finder service, use it to find the "real" service. if (StringUtils.isNotBlank(serviceFinderClass)) { ServiceFinder finder; try { finder = (ServiceFinder) ClassUtils.instanciateClass(serviceFinderClass, ClassUtils.NO_ARGS); } catch (Exception e) { throw new ServiceException(CoreMessages.cannotInstanciateFinder(serviceFinderClass), e); } String realService = finder.findService(name, sd, props); if (realService != null) { // Recursively look up the service descriptor for the real service. return MuleServer.getMuleContext().getRegistry().lookupServiceDescriptor( ServiceDescriptorFactory.PROVIDER_SERVICE_TYPE, realService, overrides); } else { throw new ServiceException(CoreMessages.serviceFinderCantFindService(name)); } } return sd; } } mule-2.0.1/core/src/main/java/org/mule/api/registry/ObjectProcessor.java0000644000175000017500000000104710745677442026031 0ustar charlescharles/* * $Id: ObjectProcessor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.registry; /** * TODO */ public interface ObjectProcessor { public Object process(Object object); } mule-2.0.1/core/src/main/java/org/mule/api/registry/RegistrationException.java0000644000175000017500000000135410745677442027255 0ustar charlescharles/* * $Id: RegistrationException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.registry; import org.mule.api.DefaultMuleException; public class RegistrationException extends DefaultMuleException { public RegistrationException(String message) { super(message); } public RegistrationException(Throwable cause) { super(cause); } } mule-2.0.1/core/src/main/java/org/mule/api/registry/Registry.java0000644000175000017500000001557110761151311024516 0ustar charlescharles/* * $Id: Registry.java 11058 2008-02-27 03:02:33Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.registry; import org.mule.api.MuleException; import org.mule.api.agent.Agent; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointFactory; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.model.Model; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.Connector; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Properties; public interface Registry extends Initialisable, Disposable { public static final int SCOPE_IMMEDIATE = 0; public static final int SCOPE_LOCAL = 1; public static final int SCOPE_REMOTE = 2; public static final int DEFAULT_SCOPE = SCOPE_REMOTE; // ///////////////////////////////////////////////////////////////////////// // Lookup methods - these should NOT create a new object, only return existing ones // ///////////////////////////////////////////////////////////////////////// /** Look up a single object by name. */ Object lookupObject(String key); /** Look up a single object by name. */ Object lookupObject(String key, int scope); /** Look up all objects of a given type. */ Collection lookupObjects(Class type); /** Look up all objects of a given type. */ Collection lookupObjects(Class type, int scope); /** Look up a single object by type. */ Object lookupObject(Class type) throws RegistrationException; /** Look up a single object by type. */ Object lookupObject(Class type, int scope) throws RegistrationException; // TODO Not sure these methods are needed since the generic ones above can be used. Connector lookupConnector(String name); /** * Looks-up endpoint builders which can be used to repeatably create endpoints with the same configuration. * These endpoint builder are either global endpoints or they are builders used to create named * endpoints configured on routers and exception strategies. */ EndpointBuilder lookupEndpointBuilder(String name); EndpointFactory lookupEndpointFactory(); Transformer lookupTransformer(String name); Service lookupService(String component); /** * This method will return a list of {@link org.mule.api.transformer.Transformer} objects that accept the given * input and return the given output type of object * * @param input The desiered input type for the transformer * @param output the desired output type for the transformer * @return a list of matching transformers. If there were no matchers an empty list is returned. */ List lookupTransformers(Class input, Class output); /** * Will find a transformer that is the closest match to the desired input and output. * * @param input The desiered input type for the transformer * @param output the desired output type for the transformer * @return A transformer that exactly matches or the will accept the input and output parameters * @throws TransformerException will be thrown if there is more than one match */ Transformer lookupTransformer(Class input, Class output) throws TransformerException; Collection/**/ lookupServices(String model); Collection/**/ lookupServices(); Model lookupModel(String name); Model lookupSystemModel(); Agent lookupAgent(String agentName); /** @deprecated Use lookupModel() instead */ Collection getModels(); /** @deprecated Use lookupConnector() instead */ Collection getConnectors(); /** @deprecated Use lookupEndpoint() instead */ Collection getEndpoints(); /** @deprecated Use lookupAgent() instead */ Collection getAgents(); /** @deprecated Use lookupTransformer() instead */ Collection getTransformers(); // ///////////////////////////////////////////////////////////////////////// // Registration methods // ///////////////////////////////////////////////////////////////////////// void registerObject(String key, Object value) throws RegistrationException; void registerObject(String key, Object value, Object metadata) throws RegistrationException; void registerObjects(Map objects) throws RegistrationException; void unregisterObject(String key) throws MuleException; // TODO MULE-2139 The following methods are Mule-specific and should be split out into a separate class; // leave this one as a "pure" registry interface. void registerConnector(Connector connector) throws MuleException; void unregisterConnector(String connectorName) throws MuleException; //TODO MULE-2494 void registerEndpoint(ImmutableEndpoint endpoint) throws MuleException; //TODO MULE-2494 void unregisterEndpoint(String endpointName) throws MuleException; public void registerEndpointBuilder(String name, EndpointBuilder builder) throws MuleException; void registerTransformer(Transformer transformer) throws MuleException; void unregisterTransformer(String transformerName) throws MuleException; void registerService(Service service) throws MuleException; void unregisterService(String serviceName) throws MuleException; void registerModel(Model model) throws MuleException; void unregisterModel(String modelName) throws MuleException; void registerAgent(Agent agent) throws MuleException; void unregisterAgent(String agentName) throws MuleException; // ///////////////////////////////////////////////////////////////////////// // Creation methods // ///////////////////////////////////////////////////////////////////////// // TODO These methods are a mess (they blur lookup with creation, uris with names). Need to clean this up. ServiceDescriptor lookupServiceDescriptor(String type, String name, Properties overrides) throws ServiceException; // ///////////////////////////////////////////////////////////////////////// // Registry Metadata // ///////////////////////////////////////////////////////////////////////// Registry getParent(); void setParent(Registry registry); String getRegistryId(); boolean isReadOnly(); boolean isRemote(); void setDefaultScope(int scope); int getDefaultScope(); boolean isInitialised(); boolean isInitialising(); boolean isDisposed(); boolean isDisposing(); } mule-2.0.1/core/src/main/java/org/mule/api/MuleMessageCollection.java0000644000175000017500000000236710771256630025273 0ustar charlescharles/* * $Id: MuleMessageCollection.java 11481 2008-03-22 19:27:20Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import java.util.List; /** * An interface that defines a collection of Mule Messages and methods for working with the collection. * Typically this type of message is only used when users explicitly want to work with aggregated or re-sequenced * collections of messages. */ public interface MuleMessageCollection extends MuleMessage { public void addMessage(MuleMessage message); public void addMessage(MuleMessage message, int index); public void addMessages(MuleMessage[] messages); public void addMessages(MuleEvent[] events); public void addMessages(List messages); public void removedMessage(MuleMessage message); public MuleMessage[] getMessagesAsArray(); public MuleMessage getMessage(int index); public Object[] getPayloadsAsArray(); public int size(); } mule-2.0.1/core/src/main/java/org/mule/api/security/0000755000175000017500000000000011351411122022024 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/security/UnknownAuthenticationTypeException.java0000644000175000017500000000214710745677442032004 0ustar charlescharles/* * $Id: UnknownAuthenticationTypeException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.MuleException; import org.mule.config.i18n.CoreMessages; /** * UnknownAuthenticationTypeException is thrown if a security context * request is make with an unrecognised Authentication type. */ public class UnknownAuthenticationTypeException extends MuleException { /** * Serial version */ private static final long serialVersionUID = 6275865761357999175L; public UnknownAuthenticationTypeException(Authentication authentication) { super(CoreMessages.authTypeNotRecognised((authentication == null ? "null" : authentication.getClass().getName()))); } } mule-2.0.1/core/src/main/java/org/mule/api/security/SecurityProvider.java0000644000175000017500000000201610745677442026241 0ustar charlescharles/* * $Id: SecurityProvider.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.lifecycle.Initialisable; /** * SecurityProvider is a target security provider thsat actually * does the work of authenticating credentials and populating the Authentication * object. */ public interface SecurityProvider extends Initialisable { void setName(String name); String getName(); Authentication authenticate(Authentication authentication) throws SecurityException; boolean supports(Class aClass); SecurityContext createSecurityContext(Authentication auth) throws UnknownAuthenticationTypeException; } mule-2.0.1/core/src/main/java/org/mule/api/security/CryptoFailureException.java0000644000175000017500000000427610745677442027400 0ustar charlescharles/* * $Id: CryptoFailureException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.EncryptionStrategy; import org.mule.api.DefaultMuleException; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; /** * CryptoFailureException is a generic exception thrown by an * CryptoStrategy if encryption or decryption fails. The constuctors of this * exception accept a EncryptionStrategy that will be included in the exception * message. Implementors of EncryptionStrategy should provide a toString method * that exposes *only* information that maybe useful for debugging not passwords, * secret keys, etc. */ public class CryptoFailureException extends DefaultMuleException { /** * Serial version */ private static final long serialVersionUID = 1336343718508294379L; private transient EncryptionStrategy encryptionStrategy; public CryptoFailureException(Message message, EncryptionStrategy strategy) { super(message); String s = (strategy == null ? "null" : strategy.toString()); addInfo("Encryption", s); this.encryptionStrategy = strategy; } public CryptoFailureException(Message message, EncryptionStrategy strategy, Throwable cause) { super(message, cause); String s = (strategy == null ? "null" : strategy.toString()); addInfo("Encryption", s); this.encryptionStrategy = strategy; } public CryptoFailureException(EncryptionStrategy strategy, Throwable cause) { super(CoreMessages.cryptoFailure(), cause); String s = (strategy == null ? "null" : strategy.toString()); addInfo("Encryption", s); this.encryptionStrategy = strategy; } public EncryptionStrategy getEncryptionStrategy() { return encryptionStrategy; } } mule-2.0.1/core/src/main/java/org/mule/api/security/package.html0000644000175000017500000000013710745677442024337 0ustar charlescharles Security API for authentication and authorisation. mule-2.0.1/core/src/main/java/org/mule/api/security/EndpointSecurityFilter.java0000644000175000017500000000273710745677442027407 0ustar charlescharles/* * $Id: EndpointSecurityFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.MuleEvent; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; /** * EndpointSecurityFilter is a base filter for secure filtering of * inbound and outbout event flow */ public interface EndpointSecurityFilter extends Initialisable { /** * @param manager */ void setSecurityManager(SecurityManager manager); SecurityManager getSecurityManager(); String getSecurityProviders(); void setSecurityProviders(String providers); void setEndpoint(ImmutableEndpoint endpoint); ImmutableEndpoint getEndpoint(); void setCredentialsAccessor(CredentialsAccessor accessor); CredentialsAccessor getCredentialsAccessor(); void authenticate(MuleEvent event) throws SecurityException, UnknownAuthenticationTypeException, CryptoFailureException, SecurityProviderNotFoundException, EncryptionStrategyNotFoundException, InitialisationException; } mule-2.0.1/core/src/main/java/org/mule/api/security/TlsDirectTrustStore.java0000644000175000017500000001063210745677442026676 0ustar charlescharles/* * $Id: TlsDirectTrustStore.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.security.tls.TlsConfiguration; import javax.net.ssl.TrustManagerFactory; /** * Configure direct trust stores. * TLS/SSL connections are made to trusted systems - the public certificates of trusted systems are stored in * a keystore (called a trust store) and used to verify that the connection made to a remote system "really * is" the expected identity. * *

    The information specified in this interface may be used to configure a trust store directly, or the * values in the {@link TlsIndirectTrustStore} may be stored as property values and used later, or both. * It may therefore be specific to a single * connector, or global to all connectors made by that protocol, or even (in the case of the SSL transport) * become a global default value. For more information see the documentation for the connector or protocol in * question. The comments in {@link org.mule.api.security.tls.TlsConfiguration} may also be useful.

    */ public interface TlsDirectTrustStore extends TlsIndirectTrustStore { /** * @return The type of keystore used to implement the trust store defined in {@link #getTrustStore()} */ String getTrustStoreType(); /** * @param trustStoreType The type of keystore used to implement the trust store defined in * {@link #setTrustStore(String)} */ void setTrustStoreType(String trustStoreType); /** * @return The algorithm used by the trust store. The default comes from { * @link org.mule.api.security.provider.AutoDiscoverySecurityProviderFactory} */ String getTrustManagerAlgorithm(); /** * @param trustManagerAlgorithm The algorithm used by the trust store. The default comes from { * @link org.mule.api.security.provider.AutoDiscoverySecurityProviderFactory} */ void setTrustManagerAlgorithm(String trustManagerAlgorithm); /** * @return Either the factory defined by {@link #setTrustManagerFactory(TrustManagerFactory)} or one * constructed from the parameters in this interface ({@link #setTrustStore(String)} etc). */ TrustManagerFactory getTrustManagerFactory(); /** * @param trustManagerFactory The source of trust information if the store is accessed directly * (some connectors generate trust stores indirectly through System properties in which case this * value will be ignored - see {@link TlsConfiguration}). */ void setTrustManagerFactory(TrustManagerFactory trustManagerFactory); /** * If the trust store is undefined and the trust store generated via System properties then the * key store certificates defined via {@link TODO} can be used as a source of trust information. * * @return true if the key store data should not be used when a trust store is otherwise * undefined */ boolean isExplicitTrustStoreOnly(); /** * If the trust store is undefined and the trust store generated via System properties then the * key store certificates defined via {@link TODO} can be used as a source of trust information. * * @param explicitTrustStoreOnly true if the key store data should not be used when a trust * store is otherwise undefined */ void setExplicitTrustStoreOnly(boolean explicitTrustStoreOnly); /** * If a server socket is constructed directly (see {@link TlsConfiguration}) then this flag will * control whether client authenticatin is required. This does not apply to client connections. * * @return true if clients must be authenticated */ boolean isRequireClientAuthentication(); /** * If a server socket is constructed directly (see {@link TlsConfiguration}) then this flag will * control whether client authenticatin is required. This does not apply to client connections. * * @param requireClientAuthentication true if clients must be authenticated */ void setRequireClientAuthentication(boolean requireClientAuthentication); } mule-2.0.1/core/src/main/java/org/mule/api/security/SecurityManager.java0000644000175000017500000000274710745677442026034 0ustar charlescharles/* * $Id: SecurityManager.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.EncryptionStrategy; import org.mule.api.lifecycle.Initialisable; import java.util.Collection; /** * SecurityManager is responsible for managing one or more * security providers. */ public interface SecurityManager extends Initialisable { Authentication authenticate(Authentication authentication) throws SecurityException, SecurityProviderNotFoundException; void addProvider(SecurityProvider provider); SecurityProvider getProvider(String name); SecurityProvider removeProvider(String name); Collection getProviders(); void setProviders(Collection providers); SecurityContext createSecurityContext(Authentication authentication) throws UnknownAuthenticationTypeException; EncryptionStrategy getEncryptionStrategy(String name); void addEncryptionStrategy(EncryptionStrategy strategy); EncryptionStrategy removeEncryptionStrategy(String name); Collection getEncryptionStrategies(); void setEncryptionStrategies(Collection strategies); } mule-2.0.1/core/src/main/java/org/mule/api/security/UnauthorisedException.java0000644000175000017500000000455510745677442027262 0ustar charlescharles/* * $Id: UnauthorisedException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.RequestContext; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; /** * UnauthorisedException is thrown if authentication fails */ public class UnauthorisedException extends SecurityException { /** * Serial version */ private static final long serialVersionUID = -6664384216189042672L; public UnauthorisedException(Message message) { super(message, RequestContext.getEventContext().getMessage()); } public UnauthorisedException(Message message, Throwable cause) { super(message, RequestContext.getEventContext().getMessage(), cause); } public UnauthorisedException(Message message, MuleMessage umoMessage) { super(message, umoMessage); } public UnauthorisedException(Message message, MuleMessage umoMessage, Throwable cause) { super(message, umoMessage, cause); } public UnauthorisedException(MuleMessage umoMessage, SecurityContext context, ImmutableEndpoint endpoint, EndpointSecurityFilter filter) { super(constructMessage(context, endpoint, filter), umoMessage); } private static Message constructMessage(SecurityContext context, ImmutableEndpoint endpoint, EndpointSecurityFilter filter) { Message m = null; if (context == null) { m = CoreMessages.authSetButNoContext(filter.getClass().getName()); } else { m = CoreMessages.authFailedForUser(context.getAuthentication().getPrincipal()); } m.setNextMessage(CoreMessages.authDeniedOnEndpoint(endpoint.getEndpointURI())); return m; } } mule-2.0.1/core/src/main/java/org/mule/api/security/TlsIndirectTrustStore.java0000644000175000017500000000432210745677442027224 0ustar charlescharles/* * $Id: TlsIndirectTrustStore.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import java.io.IOException; /** * Configure indirect trust stores. * TLS/SSL connections are made to trusted systems - the public certificates of trusted systems are store in * a keystore (called a trust store) and used to verify that the connection made to a remote system "really * is" the expected identity. * *

    The information specified in this interface may be used to configure a trust store directly, as * part of {@link TlsDirectKeyStore}, or it may be stored as property values and used later, or both. * It may therefore be specific to a single * connector, or global to all connectors made by that protocol, or even (in the case of the SSL transport) * become a global default value. For more information see the documentation for the connector or protocol in * question. The comments in {@link org.mule.api.security.tls.TlsConfiguration} may also be useful.

    */ public interface TlsIndirectTrustStore { /** * @return The location (resolved relative to the current classpath and file system, if possible) * of the keystore that contains public certificates of trusted servers. */ String getTrustStore(); /** * @param name The location of the keystore that contains public certificates of trusted servers. * @throws IOException If the location cannot be resolved via the file system or classpath */ void setTrustStore(String name) throws IOException; /** * @return The password used to protected the trust store defined in {@link #getTrustStore()} */ String getTrustStorePassword(); /** * @param trustStorePassword The password used to protected the trust store defined in * {@link #setTrustStore(String)} */ void setTrustStorePassword(String trustStorePassword); } mule-2.0.1/core/src/main/java/org/mule/api/security/CredentialsAccessor.java0000644000175000017500000000145510745677442026645 0ustar charlescharles/* * $Id: CredentialsAccessor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.MuleEvent; /** * CredentialsAccessor is a template for obtaining user credentials * from the current message and writing the user credentials to an outbound message */ public interface CredentialsAccessor { Object getCredentials(MuleEvent event); void setCredentials(MuleEvent event, Object credentials); } mule-2.0.1/core/src/main/java/org/mule/api/security/TlsIndirectKeyStore.java0000644000175000017500000000514610745677442026640 0ustar charlescharles/* * $Id: TlsIndirectKeyStore.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import java.io.IOException; /** * Configure indirect key stores. * TLS/SSL connections are made on behalf of an entity, which can be anonymous or identified by a * certificate - this interface specifies how a keystore can be used to provide the certificates * (and associated private keys) necessary for identification. * *

    The information specified in this interface is used to configure a key store indirectly. * For more information see the documentation for the connector or protocol in question. * The comments in {@link org.mule.api.security.tls.TlsConfiguration} may also be useful.

    * *

    Programmers: this information, once stored in and retrieved from properties via * {@link org.mule.api.security.tls.TlsPropertiesMapper}, will provide a key manager factory via the {@link TlsDirectKeyStore} * interface implemented by {@link org.mule.api.security.tls.TlsConfiguration}. This can be associated with a socket * factory via {@link org.mule.api.security.tls.TlsPropertiesSocketFactory}.

    */ public interface TlsIndirectKeyStore { /** * @return The location (resolved relative to the current classpath and file system, if possible) * of the keystore that contains public certificates and private keys for identification. */ String getClientKeyStore(); /** * @param name The location of the keystore that contains public certificates and private keys * for identification. * @throws IOException If the location cannot be resolved via the file system or classpath */ void setClientKeyStore(String name) throws IOException; /** * @return The password used to protect the keystore itself */ String getClientKeyStorePassword(); /** * @param clientKeyStorePassword The password used to protect the keystore itself */ void setClientKeyStorePassword(String clientKeyStorePassword); /** * @return The type of keystore used in {@link #getClientKeyStore()} */ void setClientKeyStoreType(String clientKeyStoreType); /** * @return The type of keystore used in {@link #setClientKeyStore(String)} */ String getClientKeyStoreType(); } mule-2.0.1/core/src/main/java/org/mule/api/security/SecurityContextFactory.java0000644000175000017500000000137610745677442027433 0ustar charlescharles/* * $Id: SecurityContextFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; /** * SecurityContextFactory is responsible for creating a * SecurityContext instance. The factory itself is associated with an * Authentication class type on the SecurityManager */ public interface SecurityContextFactory { SecurityContext create(Authentication authentication); } mule-2.0.1/core/src/main/java/org/mule/api/security/SecurityException.java0000644000175000017500000000172510745677442026413 0ustar charlescharles/* * $Id: SecurityException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.config.i18n.Message; /** * SecurityException is a generic security exception */ public abstract class SecurityException extends MessagingException { protected SecurityException(Message message, MuleMessage umoMessage) { super(message, umoMessage); } protected SecurityException(Message message, MuleMessage umoMessage, Throwable cause) { super(message, umoMessage, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/security/tls/0000755000175000017500000000000011351411122022626 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/security/tls/package.html0000644000175000017500000000023310745677442025136 0ustar charlescharles Mule This package contains classes to support TLS/SSL configuration and socket creation. mule-2.0.1/core/src/main/java/org/mule/api/security/tls/TlsPropertiesSocketFactory.java0000644000175000017500000000672110745677442031050 0ustar charlescharles/* * $Id: TlsPropertiesSocketFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security.tls; import java.io.IOException; import java.net.InetAddress; import java.net.Socket; import javax.net.ssl.SSLSocketFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A socket factory that is configured via Properties, using a {@link TlsConfiguration} * that has been stored via {@link TlsPropertiesMapper}. */ public class TlsPropertiesSocketFactory extends SSLSocketFactory { private Log logger = LogFactory.getLog(getClass()); private boolean anon; private String namespace; private SSLSocketFactory factory; public TlsPropertiesSocketFactory(boolean anon, String namespace) { logger.debug("creating: " + anon + "; " + namespace); this.anon = anon; this.namespace = namespace; } private synchronized SSLSocketFactory getFactory() throws IOException { if (null == factory) { logger.debug("creating factory"); TlsPropertiesMapper propertiesMapper = new TlsPropertiesMapper(namespace); TlsConfiguration configuration = new TlsConfiguration(TlsConfiguration.DEFAULT_KEYSTORE); propertiesMapper.readFromProperties(configuration, System.getProperties()); try { configuration.initialise(anon, namespace); factory = configuration.getSocketFactory(); } catch (Exception e) { throw (IOException) new IOException(e.getMessage()).initCause(e); } } return factory; } public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException { return getFactory().createSocket(s, host, port, autoClose); } public String[] getDefaultCipherSuites() { try { return getFactory().getDefaultCipherSuites(); } catch (Exception e) { return new String[0]; } } public String[] getSupportedCipherSuites() { try { return getFactory().getSupportedCipherSuites(); } catch (Exception e) { return new String[0]; } } public Socket createSocket(String arg0, int arg1) throws IOException { return getFactory().createSocket(arg0, arg1); } public Socket createSocket(InetAddress arg0, int arg1) throws IOException { return getFactory().createSocket(arg0, arg1); } public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) throws IOException { return getFactory().createSocket(arg0, arg1); } public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, int arg3) throws IOException { return getFactory().createSocket(arg0, arg1, arg2, arg3); } // see http://forum.java.sun.com/thread.jspa?threadID=701799&messageID=4280973 public Socket createSocket() throws IOException { return getFactory().createSocket(); } } mule-2.0.1/core/src/main/java/org/mule/api/security/tls/TlsConfiguration.java0000644000175000017500000004547410745677442027032 0ustar charlescharles/* * $Id: TlsConfiguration.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security.tls; import org.mule.api.lifecycle.CreateException; import org.mule.api.security.TlsDirectKeyStore; import org.mule.api.security.TlsDirectTrustStore; import org.mule.api.security.TlsIndirectKeyStore; import org.mule.api.security.TlsProtocolHandler; import org.mule.api.security.provider.AutoDiscoverySecurityProviderFactory; import org.mule.api.security.provider.SecurityProviderFactory; import org.mule.api.security.provider.SecurityProviderInfo; import org.mule.config.i18n.CoreMessages; import org.mule.util.FileUtils; import org.mule.util.IOUtils; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.security.KeyManagementException; import java.security.KeyStore; import java.security.NoSuchAlgorithmException; import java.security.Provider; import java.security.Security; import javax.net.ssl.KeyManager; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLServerSocketFactory; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Support for configuring TLS/SSL connections. *

    *

    Introduction

    *

    * This class was introduced to centralise the work of TLS/SSL configuration. It is intended * to be backwards compatible with earlier code (as much as possible) and so is perhaps more * complex than would be necessary if starting from zero - the main source of confusion is the * distinction between direct and indirect creation of sockets and stores. *

    *

    Configuration

    *

    * The documentation in this class is intended more for programmers than end uses. If you are * configuring a connector the interfaces {@link org.mule.api.security.TlsIndirectTrustStore}, * {@link TlsDirectTrustStore}, * {@link TlsDirectKeyStore} and {@link TlsIndirectKeyStore} should provide guidance to individual * properties. In addition you should check the documentation for the specific protocol / connector * used and may also need to read the discussion on direct and indirect socket and store creation * below (or, more simply, just use whichever key store interface your connector implements!). *

    *

    Programming

    *

    * This class is intended to be used as a delegate as we typically want to add security to an * already existing connector (so we inherit from that connector, implement the appropriate * interfaces from {@link org.mule.api.security.TlsIndirectTrustStore}, {@link TlsDirectTrustStore}, * {@link TlsDirectKeyStore} and {@link TlsIndirectKeyStore}, and then forward calls to the * interfaces to an instance of this class). *

    *

    For setting System properties (and reading them) use {@link TlsPropertiesMapper}. This * can take a "namespace" which can then be used by {@link TlsPropertiesSocketFactory} to * construct an appropriate socket factory. This approach (storing to proeprties and then * retrieving that information later in a socket factory) lets us pass TLS/SSL configuration * into libraries that are configured by specifying on the socket factory class.

    *

    *

    Direct and Indirect Socket and Store Creation

    *

    * For the SSL transport, which historically defined parameters for many different secure * transports, the configuration interfaces worked as follows: *

    *

    *
    {@link TlsDirectTrustStore}
    Used to generate trust store directly and indirectly * for all TLS/SSL conections via System properties
    *
    {@link TlsDirectKeyStore}
    Used to generate key store directly
    *
    {@link TlsIndirectKeyStore}
    Used to generate key store indirectly for all * TLS/SSL conections via System properties
    *
    *

    * Historically, many other transports relied on the indirect configurations defined above. * So they implemented {@link org.mule.api.security.TlsIndirectTrustStore} * (a superclass of {@link TlsDirectTrustStore}) * and relied on {@link TlsIndirectKeyStore} from the SSL configuration. For continuity these * interfaces continue to be used, even though * the configurations are now typically (see individual connector/protocol documentation) specific * to a protocol or connector. Note - these interfaces are new, but the original code had * those methods, used as described. The new interfaces only make things explicit. *

    *

    Note for programmers One way to understand the above is to see that many * protocols are handled by libraries that are configured by providing either properties or * a socket factory. In both cases (the latter via {@link TlsPropertiesSocketFactory}) we * continue to use properties and the "indirect" interface. Note also that the mapping * in {@link TlsPropertiesMapper} correctly handles the asymmetry, so an initial call to * {@link TlsConfiguration} uses the keystore defined via {@link TlsDirectKeyStore}, but * when a {@link TlsConfiguration} is retrieved from System proerties using * {@link TlsPropertiesMapper#readFromProperties(TlsConfiguration,java.util.Properties)} * the "indirect" properties are supplied as "direct" values, meaning that the "indirect" * socket factory can be retrieved from {@link #getKeyManagerFactory()}. It just works.

    */ public final class TlsConfiguration implements TlsDirectTrustStore, TlsDirectKeyStore, TlsIndirectKeyStore, TlsProtocolHandler { public static final String DEFAULT_KEYSTORE = ".keystore"; public static final String DEFAULT_KEYSTORE_TYPE = KeyStore.getDefaultType(); public static final String DEFAULT_SSL_TYPE = "SSLv3"; public static final String JSSE_NAMESPACE = "javax.net"; private Log logger = LogFactory.getLog(getClass()); private SecurityProviderFactory spFactory = new AutoDiscoverySecurityProviderFactory(); private SecurityProviderInfo spInfo = spFactory.getSecurityProviderInfo(); private Provider provider = spFactory.getProvider(); private String sslType = DEFAULT_SSL_TYPE; // global private String protocolHandler = spInfo.getProtocolHandler(); // this is the key store that is generated in-memory and available to connectors explicitly. // it is local to the socket. private String keyStoreName = DEFAULT_KEYSTORE; // was default in https but not ssl private String keyPassword = null; private String keyStorePassword = null; private String keystoreType = DEFAULT_KEYSTORE_TYPE; private String keyManagerAlgorithm = spInfo.getKeyManagerAlgorithm(); private KeyManagerFactory keyManagerFactory = null; // this is the key store defined in system properties that is used implicitly. // note that some transports use different namespaces within system properties, // so this is typically global across a particular transport. // it is also used as the trust store defined in system properties if no other trust // store is given and explicitTrustStoreOnly is false private String clientKeyStoreName = null; private String clientKeyStorePassword = null; private String clientKeyStoreType = DEFAULT_KEYSTORE_TYPE; // this is the trust store used to construct sockets both explicitly // and globally (if not set, see client key above) via the jvm defaults. private String trustStoreName = null; private String trustStorePassword = null; private String trustStoreType = DEFAULT_KEYSTORE_TYPE; private String trustManagerAlgorithm = spInfo.getKeyManagerAlgorithm(); private TrustManagerFactory trustManagerFactory = null; private boolean explicitTrustStoreOnly = false; private boolean requireClientAuthentication = false; /** * Support for TLS connections with a given initial value for the key store * * @param keyStore initial value for the key store */ public TlsConfiguration(String keyStore) { this.keyStoreName = keyStore; } // note - in what follows i'm using "raw" variables rather than accessors because // i think the names are clearer. the API names for the accessors are historical // and not a close fit to actual use (imho). /** * @param anon If the connection is anonymous then we don't care about client keys * @param namespace Namespace to use for global properties (for JSSE use JSSE_NAMESPACE) * @throws CreateException ON initialisation problems */ public void initialise(boolean anon, String namespace) throws CreateException { if (logger.isDebugEnabled()) { logger.debug("initialising: anon " + anon); } validate(anon); Security.addProvider(provider); System.setProperty("java.protocol.handler.pkgs", protocolHandler); if (!anon) { initKeyManagerFactory(); } initTrustManagerFactory(); if (null != namespace) { new TlsPropertiesMapper(namespace).writeToProperties(System.getProperties(), this); } } private void validate(boolean anon) throws CreateException { assertNotNull(getProvider(), "The security provider cannot be null"); if (!anon) { assertNotNull(getKeyStore(), "The KeyStore location cannot be null"); assertNotNull(getKeyPassword(), "The Key password cannot be null"); assertNotNull(getKeyStorePassword(), "The KeyStore password cannot be null"); assertNotNull(getKeyManagerAlgorithm(), "The Key Manager Algorithm cannot be null"); } } private void initKeyManagerFactory() throws CreateException { if (logger.isDebugEnabled()) { logger.debug("initialising key manager factory from keystore data"); } KeyStore tempKeyStore; try { tempKeyStore = KeyStore.getInstance(keystoreType); InputStream is = IOUtils.getResourceAsStream(keyStoreName, getClass()); if (null == is) { throw new FileNotFoundException( CoreMessages.cannotLoadFromClasspath("Keystore: " + keyStoreName).getMessage()); } tempKeyStore.load(is, keyStorePassword.toCharArray()); } catch (Exception e) { throw new CreateException( CoreMessages.failedToLoad("KeyStore: " + keyStoreName), e, this); } try { keyManagerFactory = KeyManagerFactory.getInstance(getKeyManagerAlgorithm()); keyManagerFactory.init(tempKeyStore, keyPassword.toCharArray()); } catch (Exception e) { throw new CreateException(CoreMessages.failedToLoad("Key Manager"), e, this); } } private void initTrustManagerFactory() throws CreateException { if (null != trustStoreName) { trustStorePassword = null == trustStorePassword ? "" : trustStorePassword; KeyStore trustStore; try { trustStore = KeyStore.getInstance(trustStoreType); InputStream is = IOUtils.getResourceAsStream(trustStoreName, getClass()); if (null == is) { throw new FileNotFoundException( "Failed to load truststore from classpath or local file: " + trustStoreName); } trustStore.load(is, trustStorePassword.toCharArray()); } catch (Exception e) { throw new CreateException( CoreMessages.failedToLoad("TrustStore: " + trustStoreName), e, this); } try { trustManagerFactory = TrustManagerFactory.getInstance(trustManagerAlgorithm); trustManagerFactory.init(trustStore); } catch (Exception e) { throw new CreateException( CoreMessages.failedToLoad("Trust Manager (" + trustManagerAlgorithm + ")"), e, this); } } } private static void assertNotNull(Object value, String message) { if (null == value) { throw new IllegalArgumentException(message); } } private static String defaultForNull(String value, String deflt) { if (null == value) { return deflt; } else { return value; } } public SSLSocketFactory getSocketFactory() throws NoSuchAlgorithmException, KeyManagementException { return getSslContext().getSocketFactory(); } public SSLServerSocketFactory getServerSocketFactory() throws NoSuchAlgorithmException, KeyManagementException { return getSslContext().getServerSocketFactory(); } public SSLContext getSslContext() throws NoSuchAlgorithmException, KeyManagementException { KeyManager[] keyManagers = null == getKeyManagerFactory() ? null : getKeyManagerFactory().getKeyManagers(); TrustManager[] trustManagers = null == getTrustManagerFactory() ? null : getTrustManagerFactory().getTrustManagers(); SSLContext context = SSLContext.getInstance(getSslType()); // TODO - nice to have a configurable random number source set here context.init(keyManagers, trustManagers, null); return context; } public String getSslType() { return sslType; } public void setSslType(String sslType) { this.sslType = sslType; } public Provider getProvider() { return provider; } public void setProvider(Provider provider) { this.provider = provider; } public String getProtocolHandler() { return protocolHandler; } public void setProtocolHandler(String protocolHandler) { this.protocolHandler = protocolHandler; } public SecurityProviderFactory getSecurityProviderFactory() { return spFactory; } public void setSecurityProviderFactory(SecurityProviderFactory spFactory) { this.spFactory = spFactory; } // access to the explicit key store variables public String getKeyStore() { return keyStoreName; } public void setKeyStore(String name) throws IOException { keyStoreName = name; if (null != keyStoreName) { keyStoreName = FileUtils.getResourcePath(keyStoreName, getClass()); if (logger.isDebugEnabled()) { logger.debug("Normalised keyStore path to: " + keyStoreName); } } } public String getKeyPassword() { return keyPassword; } public void setKeyPassword(String keyPassword) { this.keyPassword = keyPassword; } public String getKeyStorePassword() { return keyStorePassword; } public void setKeyStorePassword(String storePassword) { this.keyStorePassword = storePassword; } public String getKeyStoreType() { return keystoreType; } public void setKeyStoreType(String keystoreType) { this.keystoreType = keystoreType; } public String getKeyManagerAlgorithm() { return keyManagerAlgorithm; } public void setKeyManagerAlgorithm(String keyManagerAlgorithm) { this.keyManagerAlgorithm = keyManagerAlgorithm; } public KeyManagerFactory getKeyManagerFactory() { return keyManagerFactory; } // access to the implicit key store variables public String getClientKeyStore() { return clientKeyStoreName; } public void setClientKeyStore(String name) throws IOException { clientKeyStoreName = name; if (null != clientKeyStoreName) { clientKeyStoreName = FileUtils.getResourcePath(clientKeyStoreName, getClass()); if (logger.isDebugEnabled()) { logger.debug("Normalised clientKeyStore path to: " + clientKeyStoreName); } } } public String getClientKeyStorePassword() { return clientKeyStorePassword; } public void setClientKeyStorePassword(String clientKeyStorePassword) { this.clientKeyStorePassword = clientKeyStorePassword; } public void setClientKeyStoreType(String clientKeyStoreType) { this.clientKeyStoreType = clientKeyStoreType; } public String getClientKeyStoreType() { return clientKeyStoreType; } // access to trust store variables public String getTrustStore() { return trustStoreName; } public void setTrustStore(String name) throws IOException { trustStoreName = name; if (null != trustStoreName) { trustStoreName = FileUtils.getResourcePath(trustStoreName, getClass()); if (logger.isDebugEnabled()) { logger.debug("Normalised trustStore path to: " + trustStoreName); } } } public String getTrustStorePassword() { return trustStorePassword; } public void setTrustStorePassword(String trustStorePassword) { this.trustStorePassword = trustStorePassword; } public String getTrustStoreType() { return trustStoreType; } public void setTrustStoreType(String trustStoreType) { this.trustStoreType = trustStoreType; } public String getTrustManagerAlgorithm() { return trustManagerAlgorithm; } public void setTrustManagerAlgorithm(String trustManagerAlgorithm) { this.trustManagerAlgorithm = defaultForNull(trustManagerAlgorithm, spInfo.getKeyManagerAlgorithm()); } public TrustManagerFactory getTrustManagerFactory() { return trustManagerFactory; } public void setTrustManagerFactory(TrustManagerFactory trustManagerFactory) { this.trustManagerFactory = trustManagerFactory; } public boolean isExplicitTrustStoreOnly() { return explicitTrustStoreOnly; } public void setExplicitTrustStoreOnly(boolean explicitTrustStoreOnly) { this.explicitTrustStoreOnly = explicitTrustStoreOnly; } public boolean isRequireClientAuthentication() { return requireClientAuthentication; } public void setRequireClientAuthentication(boolean requireClientAuthentication) { this.requireClientAuthentication = requireClientAuthentication; } } mule-2.0.1/core/src/main/java/org/mule/api/security/tls/TlsPropertiesMapper.java0000644000175000017500000001475310745677442027520 0ustar charlescharles/* * $Id: TlsPropertiesMapper.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security.tls; import java.io.IOException; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Move a {@link TlsConfiguration} to and from Properties (typically System Properties). * This can be used to store TLS/SSL configuration for a library (eg. Javamail, which * reads java.mail properties) or for later retrieval by {@link TlsPropertiesSocketFactory}. */ public class TlsPropertiesMapper { private static final String TRUST_NAME_SUFFIX = ".ssl.trustStore"; private static final String TRUST_TYPE_SUFFIX = ".ssl.trustStoreType"; private static final String TRUST_PASSWORD_SUFFIX = ".ssl.trustStorePassword"; private static final String TRUST_ALGORITHM_SUFFIX = ".ssl.trustManagerAlgorithm"; private static final String KEY_NAME_SUFFIX = ".ssl.keyStore"; private static final String KEY_TYPE_SUFFIX = ".ssl.keyStoreType"; private static final String KEY_PASSWORD_SUFFIX = ".ssl.keyStorePassword"; private Log logger = LogFactory.getLog(getClass()); private String namespace; public TlsPropertiesMapper(String namespace) { this.namespace = namespace; } public void writeToProperties(Properties properties, TlsConfiguration configuration) { writeTrustStoreToProperties(properties, configuration); writeKeyStoreToProperties(properties, configuration); } public void readFromProperties(TlsConfiguration configuration, Properties properties) throws IOException { readTrustStoreFromProperties(configuration, properties); readKeyStoreFromProperties(configuration, properties); } private void writeTrustStoreToProperties(Properties properties, TlsConfiguration configuration) { String trustStoreName = configuration.getTrustStore(); String trustStorePassword = configuration.getTrustStorePassword(); if (null == trustStoreName && !configuration.isExplicitTrustStoreOnly()) { logger.info("Defaulting " + namespace + " trust store to client Key Store"); trustStoreName = configuration.getClientKeyStore(); trustStorePassword = configuration.getClientKeyStorePassword(); } if (null != trustStoreName) { synchronized (properties) { setProperty(properties, TRUST_NAME_SUFFIX, trustStoreName); setProperty(properties, TRUST_TYPE_SUFFIX, configuration.getTrustStoreType()); setProperty(properties, TRUST_PASSWORD_SUFFIX, trustStorePassword); setProperty(properties, TRUST_ALGORITHM_SUFFIX, configuration.getTrustManagerAlgorithm()); } logger.debug("Set Trust Store: " + namespace + TRUST_NAME_SUFFIX + " = " + trustStoreName); } } private void readTrustStoreFromProperties(TlsConfiguration configuration, Properties properties) throws IOException { configuration.setTrustStore( getProperty(properties, TRUST_NAME_SUFFIX, configuration.getTrustStore())); configuration.setTrustStoreType( getProperty(properties, TRUST_TYPE_SUFFIX, configuration.getTrustStoreType())); configuration.setTrustStorePassword( getProperty(properties, TRUST_PASSWORD_SUFFIX, configuration.getTrustStorePassword())); configuration.setTrustManagerAlgorithm( getProperty(properties, TRUST_ALGORITHM_SUFFIX, configuration.getTrustManagerAlgorithm())); } private void writeKeyStoreToProperties(Properties properties, TlsConfiguration configuration) { if (null != configuration.getClientKeyStore()) { synchronized (properties) { setProperty(properties, KEY_NAME_SUFFIX, configuration.getClientKeyStore()); setProperty(properties, KEY_TYPE_SUFFIX, configuration.getClientKeyStoreType()); setProperty(properties, KEY_PASSWORD_SUFFIX, configuration.getClientKeyStorePassword()); } logger.info("Set Key Store: " + namespace + KEY_NAME_SUFFIX + " = " + configuration.getClientKeyStore()); } } // note the asymmetry here. this preserves the semantics of the original implementation. // originally, the "client" keystore data were written to system properties (only) and // used implicitly to construct sockets, while "non-client" keystore information was // used explicitly. // now we construct some of those implicit sockets explicitly (as part of avoiding global // configuration for tls across all transports). in these cases we read the data needed // from (namespaced) proeprties. if we read that information back into "non-client" keystore // data, even though it was written from "client" data, then we can use the same code in // TlsConfiguration to generate the sockets in both cases. private void readKeyStoreFromProperties(TlsConfiguration configuration, Properties properties) throws IOException { configuration.setKeyStore( getProperty(properties, KEY_NAME_SUFFIX, configuration.getKeyStore())); configuration.setKeyStoreType( getProperty(properties, KEY_TYPE_SUFFIX, configuration.getKeyStoreType())); configuration.setKeyStorePassword( getProperty(properties, KEY_PASSWORD_SUFFIX, configuration.getKeyStorePassword())); } private void setProperty(Properties properties, String suffix, String value) { if (null != value) { properties.setProperty(namespace + suffix, value); if (logger.isDebugEnabled()) { logger.debug(namespace + suffix + " <- " + value); } } } private String getProperty(Properties properties, String suffix, String deflt) { String value = properties.getProperty(namespace + suffix); if (null == value) { value = deflt; } if (logger.isDebugEnabled()) { logger.debug(namespace + suffix + " -> " + value); } return value; } } mule-2.0.1/core/src/main/java/org/mule/api/security/SecurityContext.java0000644000175000017500000000134510745677442026077 0ustar charlescharles/* * $Id: SecurityContext.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; /** * SecurityContext holds security information and is associated * with the MuleSession. * * @see org.mule.api.MuleSession */ public interface SecurityContext { void setAuthentication(Authentication authentication); Authentication getAuthentication(); } mule-2.0.1/core/src/main/java/org/mule/api/security/EncryptionNotSupportedException.java0000644000175000017500000000225510745677442031324 0ustar charlescharles/* * $Id: EncryptionNotSupportedException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.MuleMessage; import org.mule.config.i18n.Message; /** * EncryptionNotSupportedException is thrown if an algorithm is set in * the MULE_USER header but it doesn't match the algorithm set on the security filter */ public class EncryptionNotSupportedException extends SecurityException { /** * Serial version */ private static final long serialVersionUID = -1661059380853528623L; public EncryptionNotSupportedException(Message message, MuleMessage umoMessage) { super(message, umoMessage); } public EncryptionNotSupportedException(Message message, MuleMessage umoMessage, Throwable cause) { super(message, umoMessage, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/security/EncryptionStrategyNotFoundException.java0000644000175000017500000000235710745677442032140 0ustar charlescharles/* * $Id: EncryptionStrategyNotFoundException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.MuleException; import org.mule.config.i18n.CoreMessages; /** * EncryptionStrategyNotFoundException is thrown by the * SecurityManager when an encryption scheme is set in a property or header that * has not been registered witrh the manager */ public class EncryptionStrategyNotFoundException extends MuleException { /** * Serial version */ private static final long serialVersionUID = 3916371211189075139L; public EncryptionStrategyNotFoundException(String strategyName) { super(CoreMessages.authNoEncryptionStrategy(strategyName)); } public EncryptionStrategyNotFoundException(String strategyName, Throwable cause) { super(CoreMessages.authNoEncryptionStrategy(strategyName), cause); } } mule-2.0.1/core/src/main/java/org/mule/api/security/UnsupportedAuthenticationSchemeException.java0000644000175000017500000000232510745677442033156 0ustar charlescharles/* * $Id: UnsupportedAuthenticationSchemeException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.MuleMessage; import org.mule.config.i18n.Message; /** * UnsupportedAuthenticationSchemeException is thrown when a * authentication scheme is being used on the message that the Security filter does * not understand */ public class UnsupportedAuthenticationSchemeException extends SecurityException { /** * Serial version */ private static final long serialVersionUID = 3281021140543598680L; public UnsupportedAuthenticationSchemeException(Message message, MuleMessage umoMessage) { super(message, umoMessage); } public UnsupportedAuthenticationSchemeException(Message message, MuleMessage umoMessage, Throwable cause) { super(message, umoMessage, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/security/provider/0000755000175000017500000000000011351411121023655 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/security/provider/package.html0000644000175000017500000000041210745677442026165 0ustar charlescharles Mule This package contains classes related to JDK-specific security provider lookup and configuration. Note that there is no specific provider configuration for BEA's JRockit, as it uses Sun's JSSE. mule-2.0.1/core/src/main/java/org/mule/api/security/provider/SecurityProviderFactory.java0000644000175000017500000000163510745677442031431 0ustar charlescharles/* * $Id: SecurityProviderFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security.provider; import java.security.Provider; /** * Determines and initializes JDK-specific security provider. */ public interface SecurityProviderFactory { SecurityProviderInfo getSecurityProviderInfo(); /** * @return an instance of a security provider * @throws org.mule.api.MuleRuntimeException if there was a problem with the security * provider * @see #getSecurityProviderInfo() */ Provider getProvider(); } mule-2.0.1/core/src/main/java/org/mule/api/security/provider/IBMSecurityProvider2Info.java0000644000175000017500000000245310745677442031326 0ustar charlescharles/* * $Id: IBMSecurityProvider2Info.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security.provider; /** * IBM JDK 1.4.2-specific security provider information. Contains config details for * IBM JSSE2. Note, versions lower than 1.4.1 do not have this * provider bundled. */ public class IBMSecurityProvider2Info implements SecurityProviderInfo { private static final String KEY_MANAGER_ALGORITHM = "IbmX509"; private static final String PROTOCOL_HANDLER = "com.ibm.net.ssl.www2.protocol.Handler"; private static final String PROVIDER_CLASS = "com.ibm.jsse2.IBMJSSEProvider2"; public String getKeyManagerAlgorithm() { return IBMSecurityProvider2Info.KEY_MANAGER_ALGORITHM; } public String getProtocolHandler() { return IBMSecurityProvider2Info.PROTOCOL_HANDLER; } public String getProviderClass() { return IBMSecurityProvider2Info.PROVIDER_CLASS; } } mule-2.0.1/core/src/main/java/org/mule/api/security/provider/IBMSecurityProviderInfo.java0000644000175000017500000000212510745677442031240 0ustar charlescharles/* * $Id: IBMSecurityProviderInfo.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security.provider; /** * IBM JDK-specific security provider information. */ public class IBMSecurityProviderInfo implements SecurityProviderInfo { private static final String KEY_MANAGER_ALGORITHM = "IbmX509"; private static final String PROTOCOL_HANDLER = "com.ibm.net.ssl.internal.www.protocol"; private static final String PROVIDER_CLASS = "com.ibm.jsse.IBMJSSEProvider"; public String getKeyManagerAlgorithm() { return KEY_MANAGER_ALGORITHM; } public String getProtocolHandler() { return PROTOCOL_HANDLER; } public String getProviderClass() { return PROVIDER_CLASS; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/core/src/main/java/org/mule/api/security/provider/AutoDiscoverySecurityProviderFactory.javamule-2.0.1/core/src/main/java/org/mule/api/security/provider/AutoDiscoverySecurityProviderFactory.ja0000644000175000017500000000560110745677442033620 0ustar charlescharles/* * $Id: AutoDiscoverySecurityProviderFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security.provider; import org.mule.api.MuleRuntimeException; import org.mule.config.i18n.CoreMessages; import org.mule.util.ClassUtils; import org.mule.util.SystemUtils; import java.security.Provider; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Automatically discovers the JDK we are running on and returns a corresponding * {@link SecurityProviderInfo}.

    Implementations of this class are thread-safe. */ public class AutoDiscoverySecurityProviderFactory implements SecurityProviderFactory { /** * Default is Sun's JSSE. */ public static final SecurityProviderInfo DEFAULT_SECURITY_PROVIDER = new SunSecurityProviderInfo(); /** * Logger used by this class. */ protected transient Log logger = LogFactory.getLog(getClass()); /** * Security provider properties for IBM JDK. */ private static final SecurityProviderInfo IBM_SECURITY_PROVIDER = new IBMSecurityProviderInfo(); /** * Security provider properties for IBM JDK 1.4.2 and higher. */ // private static final SecurityProviderInfo IBM_SECURITY_PROVIDER_2 = new // IBMSecurityProvider2Info(); public SecurityProviderInfo getSecurityProviderInfo() { SecurityProviderInfo info; if (SystemUtils.isIbmJDK()) { // TODO test IBM JDK 1.4.2 more thoroughly and decide if // it's worth including this newer provider support. // switch to IBM's security provider // if (SystemUtils.isJavaVersionAtLeast(142)) { // IBM JSSE2 // info = IBM_SECURITY_PROVIDER_2; // } else { // older IBM JSSE info = IBM_SECURITY_PROVIDER; // } } else { info = DEFAULT_SECURITY_PROVIDER; } // BEA's JRockit uses Sun's JSSE, so defaults are fine return info; } public Provider getProvider() { SecurityProviderInfo info = getSecurityProviderInfo(); if (logger.isInfoEnabled()) { logger.info("Using " + info.getClass().getName()); } try { return (Provider) ClassUtils.instanciateClass(info.getProviderClass(), null); } catch (Exception ex) { throw new MuleRuntimeException( CoreMessages.failedToInitSecurityProvider(info.getProviderClass()), ex); } } } mule-2.0.1/core/src/main/java/org/mule/api/security/provider/SecurityProviderInfo.java0000644000175000017500000000124410745677442030711 0ustar charlescharles/* * $Id: SecurityProviderInfo.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security.provider; /** * A holder for some JDK-level SSL/TLS properties. */ public interface SecurityProviderInfo { String getKeyManagerAlgorithm(); String getProtocolHandler(); String getProviderClass(); } mule-2.0.1/core/src/main/java/org/mule/api/security/provider/SunSecurityProviderInfo.java0000644000175000017500000000213610745677442031400 0ustar charlescharles/* * $Id: SunSecurityProviderInfo.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security.provider; /** * Sun JDK-specific security provider information. */ public class SunSecurityProviderInfo implements SecurityProviderInfo { private static final String KEY_MANAGER_ALGORITHM = "SunX509"; private static final String PROTOCOL_HANDLER = "com.sun.net.ssl.internal.www.protocol"; private static final String PROVIDER_CLASS = "com.sun.net.ssl.internal.ssl.Provider"; public String getKeyManagerAlgorithm() { return KEY_MANAGER_ALGORITHM; } public String getProtocolHandler() { return PROTOCOL_HANDLER; } public String getProviderClass() { return PROVIDER_CLASS; } } mule-2.0.1/core/src/main/java/org/mule/api/security/Credentials.java0000644000175000017500000000120010745677442025146 0ustar charlescharles/* * $Id: Credentials.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; /** * Credentials holds credentials information for a user. */ public interface Credentials { String getUsername(); char[] getPassword(); Object getRoles(); } mule-2.0.1/core/src/main/java/org/mule/api/security/TlsProtocolHandler.java0000644000175000017500000000124110745677442026500 0ustar charlescharles/* * $Id: TlsProtocolHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; /** * Set the underlying protocol handler. As far as I know, this is untested. */ public interface TlsProtocolHandler { String getProtocolHandler(); void setProtocolHandler(String protocolHandler); } mule-2.0.1/core/src/main/java/org/mule/api/security/Authentication.java0000644000175000017500000000153510745677442025703 0ustar charlescharles/* * $Id: Authentication.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import java.util.Map; /** * UMOAuthentication represents an authentication request and contains * authentication information if the request was successful */ public interface Authentication { void setAuthenticated(boolean b); boolean isAuthenticated(); Object getCredentials(); Object getPrincipal(); Map getProperties(); void setProperties(Map properties); } mule-2.0.1/core/src/main/java/org/mule/api/security/TlsDirectKeyStore.java0000644000175000017500000000577410745677442026320 0ustar charlescharles/* * $Id: TlsDirectKeyStore.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import java.io.IOException; import javax.net.ssl.KeyManagerFactory; /** * Configure direct key stores. * TLS/SSL connections are made on behalf of an entity, which can be anonymous or identified by a * certificate - this interface specifies how a keystore can be used to provide the certificates * (and associated private keys) necessary for identification. * *

    The information specified in this interface is used to configure a key store directly. * For more information see the documentation for the connector or protocol in question. * The comments in {@link org.mule.api.security.tls.TlsConfiguration} may also be useful.

    */ public interface TlsDirectKeyStore { /** * @return The location (resolved relative to the current classpath and file system, if possible) * of the keystore that contains public certificates and private keys for identification. */ String getKeyStore(); /** * @param name The location of the keystore that contains public certificates and private keys * for identification. * @throws IOException If the location cannot be resolved via the file system or classpath */ void setKeyStore(String name) throws IOException; /** * @return The password used to protect the private key(s) */ String getKeyPassword(); /** * @param keyPassword The password used to protect the private key(s) */ void setKeyPassword(String keyPassword); /** * @return The password used to protect the keystore itself */ String getKeyStorePassword(); /** * @param storePassword The password used to protect the keystore itself */ void setKeyStorePassword(String storePassword); /** * @return The type of keystore used in {@link #getKeyStore()} */ String getKeyStoreType(); /** * @param keystoreType The type of keystore used in {@link #setKeyStore(String)} */ void setKeyStoreType(String keystoreType); /** * @return The algorithm used by the key store. The default comes from { * @link org.mule.api.security.provider.AutoDiscoverySecurityProviderFactory} */ String getKeyManagerAlgorithm(); /** * @param keyManagerAlgorithm The algorithm used by the key store. The default comes from { * @link org.mule.api.security.provider.AutoDiscoverySecurityProviderFactory} */ void setKeyManagerAlgorithm(String keyManagerAlgorithm); /** * @return A source of key stores generated from the parameters supplied here. */ KeyManagerFactory getKeyManagerFactory(); } mule-2.0.1/core/src/main/java/org/mule/api/security/CredentialsNotSetException.java0000644000175000017500000000274310745677442030177 0ustar charlescharles/* * $Id: CredentialsNotSetException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.config.i18n.Message; /** * CredentialsNotSetException is thrown when user credentials cannot * be obtained from the current message */ public class CredentialsNotSetException extends UnauthorisedException { /** * Serial version */ private static final long serialVersionUID = -6271648179641734579L; public CredentialsNotSetException(Message message, MuleMessage umoMessage) { super(message, umoMessage); } public CredentialsNotSetException(Message message, MuleMessage umoMessage, Throwable cause) { super(message, umoMessage, cause); } public CredentialsNotSetException(MuleMessage umoMessage, SecurityContext context, ImmutableEndpoint endpoint, EndpointSecurityFilter filter) { super(umoMessage, context, endpoint, filter); } } mule-2.0.1/core/src/main/java/org/mule/api/security/SecurityProviderNotFoundException.java0000644000175000017500000000235410745677442031602 0ustar charlescharles/* * $Id: SecurityProviderNotFoundException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.security; import org.mule.api.MuleException; import org.mule.config.i18n.CoreMessages; /** * SecurityProviderNotFoundException is thrown by the * SecurityManager when an authentication request is made but no suitable security * provider can be found to process the authentication */ public class SecurityProviderNotFoundException extends MuleException { /** * Serial version */ private static final long serialVersionUID = 124630897095610595L; public SecurityProviderNotFoundException(String providerName) { super(CoreMessages.authNoSecurityProvider(providerName)); } public SecurityProviderNotFoundException(String providerName, Throwable cause) { super(CoreMessages.authNoSecurityProvider(providerName), cause); } } mule-2.0.1/core/src/main/java/org/mule/api/ThreadSafeAccess.java0000644000175000017500000000501310745677442024200 0ustar charlescharles/* * $Id: ThreadSafeAccess.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; /** * Interface implemented by message-related objects that avoid exposing mutable data to multiple threads * by providing immutable copies. This interface is optional - it is an implementation detail that is * tested for dynamically and used only if available. * *

    To avoid "scribbling" where several threads change state within in a single method (typically * in inconsistent ways, causing subtle and intermittent errors) we use the following access policy for * message related objects:

    * *
      * *
    • A new object is "unbound" and "mutable".
    • * *
    • An object is "bound" to the first thread that calls the object after it is created.
    • * *
    • A "mutable" object can be modified only by the thread to which it is bound.
    • * *
    • An object is "sealed" (no longer "mutable") when it is accessed by a thread other than the * thread to which it is "bound". It is an error to attempt to change a "sealed" object.
    • * *
    * *

    In practice this means that objects are initially mutable, but become immutable once they are * shared.

    */ public interface ThreadSafeAccess { final boolean WRITE = true; final boolean READ = false; /** * This method may be called before data in the object are accessed. It should verify that the * access policy is followed correctly (if not, a runtime exception may be thrown). * * @param write True if the access will mutate values. */ void assertAccess(boolean write); /** * This method should ONLY be used in the construction of composite ThreadSafeAccess instances. * For example, a ThreadSafeAccess MuleEvent contains a ThreadSafeAccess MessageAdapter. During * the construction of the event, the message adapter may be bound to the contructing thread. * Calling this method releases that binding so that the event as a whole can be passed to a new * thread unbound. */ void resetAccessControl(); /** * @return A new instance of the implementing class, unbound to any thread and mutable. */ ThreadSafeAccess newThreadCopy(); } mule-2.0.1/core/src/main/java/org/mule/api/FutureMessageResult.java0000644000175000017500000001155510745677442025036 0ustar charlescharles/* * $Id: FutureMessageResult.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.DefaultMuleMessage; import org.mule.api.transformer.TransformerException; import org.mule.util.concurrent.DaemonThreadFactory; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.Callable; import edu.emory.mathcs.backport.java.util.concurrent.ExecutionException; import edu.emory.mathcs.backport.java.util.concurrent.Executor; import edu.emory.mathcs.backport.java.util.concurrent.Executors; import edu.emory.mathcs.backport.java.util.concurrent.FutureTask; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.TimeoutException; /** * FutureMessageResult is an MuleMessage result of a remote invocation * on a Mule Server. This object makes the result available to the client code once * the request has been processed. This execution happens asynchronously. */ // @ThreadSafe public class FutureMessageResult extends FutureTask { /** * This is a simple default Executor for FutureMessageResults. Instead of * spawning a Thread for each invocation it uses a single daemon Thread with an * unbounded queue, so "truly" concurrent operation of multiple Futures or * otherwise customized execution behaviour requires calling the * {@link #setExecutor(Executor)} method and passing in a custom {@link Executor}. * This is strongly recommended in order to provide better control over * concurrency, resource consumption and possible overruns. *

    * Reasons for these defaults: *

      *
    • a daemon thread does not block the VM on shutdown; lifecycle control * should be done elsewhere (e.g. the provider of the custom ExecutorService), * otherwise this class would become too overloaded *
    • a single thread provides for conservative & predictable yet async * behaviour from a client's point of view *
    • the unbounded queue is not optimal but probably harmless since e.g. a * MuleClient would have to create a LOT of Futures for an OOM. Cancelled/timed * out invocations are GC'ed so the problem is rather unlikely to occur. *
    */ private static final Executor DefaultExecutor = Executors.newSingleThreadExecutor( new DaemonThreadFactory("MuleDefaultFutureMessageExecutor")); // @GuardedBy(this) private Executor executor; // @GuardedBy(this) private List transformers; public FutureMessageResult(Callable callable) { super(callable); this.executor = DefaultExecutor; } /** * Set an ExecutorService to run this invocation. * * @param e the executor to be used. * @throws IllegalArgumentException when the executor is null or shutdown. */ public void setExecutor(Executor e) { if (e == null) { throw new IllegalArgumentException("Executor must not be null."); } synchronized (this) { this.executor = e; } } /** * Set a post-invocation transformer. * * @param t UMOTransformers to be applied to the result of this invocation. May be * null. */ public void setTransformers(List t) { synchronized (this) { this.transformers = t; } } public MuleMessage getMessage() throws InterruptedException, ExecutionException, TransformerException { return this.getMessage(this.get()); } public MuleMessage getMessage(long timeout) throws InterruptedException, ExecutionException, TimeoutException, TransformerException { return this.getMessage(this.get(timeout, TimeUnit.MILLISECONDS)); } private MuleMessage getMessage(Object obj) throws TransformerException { MuleMessage result = null; if (obj != null) { if (obj instanceof MuleMessage) { result = (MuleMessage)obj; } else { result = new DefaultMuleMessage(obj); } synchronized (this) { if (transformers != null) { result.applyTransformers(transformers); } } } return result; } /** * Start asynchronous execution of this task */ public void execute() { synchronized (this) { executor.execute(this); } } } mule-2.0.1/core/src/main/java/org/mule/api/MuleSession.java0000644000175000017500000002341310757615756023325 0ustar charlescharles/* * $Id: MuleSession.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.security.SecurityContext; import org.mule.api.service.Service; import java.io.Serializable; import java.util.Iterator; /** * MuleSession is the context in which a request is executed. The * session manages the marshalling of events to and from components This object is * not usually referenced by client code directly. If needed Components should manage * events via the MuleEventContext which is obtainable via the * UMOManager or by implementing * org.mule.api.lifecycle.Callable. */ public interface MuleSession extends Serializable { /** * Returns the Service associated with the session in its current execution * * @return the Service associated with the session in its current execution * @see org.mule.api.service.Service */ Service getService(); /** * This will send an event via the configured outbound endpoint on the service * for this session * * @param message the message to send * @return the result of the send if any * @throws org.mule.api.MuleException if there is no outbound endpoint configured * on the service or the events fails during dispatch */ MuleMessage sendEvent(MuleMessage message) throws MuleException; /** * Depending on the session state this methods either Passes an event * synchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param event the event to process * @return the return Message from the call or null if there was no result * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ MuleMessage sendEvent(MuleEvent event) throws MuleException; /** * Depending on the session state this methods either Passes an event * synchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpoint The endpoint to disptch the event through * @return the return Message from the call or null if there was no result * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ MuleMessage sendEvent(MuleMessage message, OutboundEndpoint endpoint) throws MuleException; /** * Depending on the session state this methods either Passes an event * synchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpointName The endpoint name to disptch the event through. This will * be looked up first on the service configuration and then on the * mule manager configuration * @return the return Message from the call or null if there was no result * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ MuleMessage sendEvent(MuleMessage message, String endpointName) throws MuleException; /** * This will dispatch an event asynchronously via the configured outbound * endpoint on the service for this session * * @param message the message to send * @throws MuleException if there is no outbound endpoint configured on the * service or the events fails during dispatch */ void dispatchEvent(MuleMessage message) throws MuleException; /** * Depending on the session state this methods either Passes an event * asynchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param event the event message payload to send first on the service * configuration and then on the mule manager configuration * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ void dispatchEvent(MuleEvent event) throws MuleException; /** * Depending on the session state this methods either Passes an event * asynchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpoint The endpoint name to disptch the event through * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ void dispatchEvent(MuleMessage message, OutboundEndpoint endpoint) throws MuleException; /** * Depending on the session state this methods either Passes an event * asynchronously to the next available Mule UMO in the pool or via the endpoint * configured for the event * * @param message the event message payload to send * @param endpointName The endpoint name to disptch the event through. This will * be looked up first on the service configuration and then on the * mule manager configuration * @throws MuleException if the event fails to be processed by the service or * the transport for the endpoint */ void dispatchEvent(MuleMessage message, String endpointName) throws MuleException; /** * Requests a synchronous receive of an event on the service * * @param endpoint the endpoint identifing the endpointUri on ewhich the event * will be received * @param timeout time in milliseconds before the request timesout * @return The requested event or null if the request times out * @throws MuleException if the request operation fails */ MuleMessage requestEvent(InboundEndpoint endpoint, long timeout) throws MuleException; /** * Requests a synchronous receive of an event on the service * * @param endpointName the endpoint name identifing the endpointUri on ewhich the * event will be received * @param timeout time in milliseconds before the request timesout * @return The requested event or null if the request times out * @throws MuleException if the request operation fails */ MuleMessage requestEvent(String endpointName, long timeout) throws MuleException; /** * Determines if this session is valid. A session becomes invalid if an exception * occurs while processing * * @return true if the service is functioning properly, false otherwise */ boolean isValid(); /** * Determines if this session is valid. A session becomes invalid if an exception * occurs while processing * * @param value true if the service is functioning properly, false otherwise */ void setValid(boolean value); /** * Creates an outbound event for this session * * @param message the event messgae payload * @param endpoint the endpoint to send/dispatch through * @param previousEvent the previous event (if any) on this session * @return the event to send/dispatch * @throws MuleException if the evnet cannot be created */ MuleEvent createOutboundEvent(MuleMessage message, OutboundEndpoint endpoint, MuleEvent previousEvent) throws MuleException; /** * Returns the unique id for this session * * @return the unique id for this session */ String getId(); /** * The security context for this session. If not null outbound, inbound and/or * method invocations will be authenticated using this context * * @param context the context for this session or null if the request is not * secure. */ void setSecurityContext(SecurityContext context); /** * The security context for this session. If not null outbound, inbound and/or * method invocations will be authenticated using this context * * @return the context for this session or null if the request is not secure. */ SecurityContext getSecurityContext(); /** * Will set a session level property. These will either be stored and retrieved * using the underlying transport mechanism of stored using a default mechanism * * @param key the key for the object data being stored on the session * @param value the value of the session data */ void setProperty(Object key, Object value); /** * Will retrieve a session level property. * * @param key the key for the object data being stored on the session * @return the value of the session data or null if the property does not exist */ Object getProperty(Object key); /** * Will retrieve a session level property and remove it from the session * * @param key the key for the object data being stored on the session * @return the value of the session data or null if the property does not exist */ Object removeProperty(Object key); /** * Returns an iterater of property keys for the session properties on this * session * * @return an iterater of property keys for the session properties on this * session */ Iterator getPropertyNames(); } mule-2.0.1/core/src/main/java/org/mule/api/routing/0000755000175000017500000000000011351411117021650 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/routing/OutboundRouterCollection.java0000644000175000017500000000246110770356575027556 0ustar charlescharles/* * $Id: OutboundRouterCollection.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; /** * OutboundRouterCollection is responsible for holding all outbound routers for a service service. */ public interface OutboundRouterCollection extends RouterCollection { /** * Prepares one or more events to be dispached by a Message Dispatcher. * * @param message The source Message * @param session The current session * @return a list containing 0 or events to be dispatched * @throws RoutingException If any of the events cannot be created. */ MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws MessagingException; /** * Determines if any endpoints have been set on this router. * * @return */ boolean hasEndpoints(); } mule-2.0.1/core/src/main/java/org/mule/api/routing/package.html0000644000175000017500000000014510745677442024156 0ustar charlescharles Interfaces that define inbound and outbound routing API. mule-2.0.1/core/src/main/java/org/mule/api/routing/CouldNotRouteOutboundMessageException.java0000644000175000017500000000333210745677442032213 0ustar charlescharles/* * $Id: CouldNotRouteOutboundMessageException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.config.i18n.Message; /** * CouldNotRouteOutboundMessageException thrown if Mule fails to route * the current outbound event. */ public class CouldNotRouteOutboundMessageException extends RoutingException { /** * Serial version */ private static final long serialVersionUID = 4609966704030524482L; public CouldNotRouteOutboundMessageException(MuleMessage message, ImmutableEndpoint endpoint) { super(message, endpoint); } public CouldNotRouteOutboundMessageException(MuleMessage umoMessage, ImmutableEndpoint endpoint, Throwable cause) { super(umoMessage, endpoint, cause); } public CouldNotRouteOutboundMessageException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint) { super(message, umoMessage, endpoint); } public CouldNotRouteOutboundMessageException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint, Throwable cause) { super(message, umoMessage, endpoint, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/routing/OutboundRouter.java0000644000175000017500000001215310757615756025545 0ustar charlescharles/* * $Id: OutboundRouter.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transaction.TransactionConfig; import java.util.List; /** * OutboundRouter is used to control outbound routing behaviour for * an event. One or more Outbound routers can be associated with an * OutboundRouterCollection and will be selected based on the filters * set on the individual Outbound Router. * * @see OutboundRouterCollection */ public interface OutboundRouter extends Router { /** * Sets a list of Endpoint instances associated with this router * * @param endpoints a list of Endpoint instances */ void setEndpoints(List endpoints); /** * Gets a list of Endpoint instances associated with this router * * @return a list of Endpoint instances */ List getEndpoints(); /** * Adds an endpoint to this router * * @param endpoint the endpoint to add to the router */ void addEndpoint(OutboundEndpoint endpoint); /** * Removes a specific endpoint from the router * * @param endpoint the endpoint to remove * @return true if the endpoint was removed */ boolean removeEndpoint(OutboundEndpoint endpoint); /** * This method is responsible for routing the Message via the MuleSession. The logic * for this method will change for each type of router depending on expected * behaviour. For example, a MulticastingRouter might just iterate through the * list of assoaciated endpoints sending the message. Another type of router such * as the ExceptionBasedRouter will hit the first endpoint, if it fails try the * second, and so on. Most router implementations will extends the * FilteringOutboundRouter which implements all the common logic need for a * router. * * @param message the message to send via one or more endpoints on this router * @param session the session used to actually send the event * @param synchronous whether the invocation process should be synchronous or not * @return a result message if any from the invocation. If the synchronous flag * is false a null result will always be returned. * @throws MessagingException if any errors occur during the sending of messages * @see org.mule.routing.outbound.FilteringOutboundRouter * @see org.mule.routing.outbound.ExceptionBasedRouter * @see org.mule.routing.outbound.MulticastingRouter */ MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws MessagingException; /** * Determines if the event should be processed by this router. Routers can be * selectively invoked by configuring a filter on them. Usually the filter is * applied to the message when calling this method. All core Mule outbound * routers extend the FilteringOutboundRouter router that handles this method * automatically. * * @param message the current message to evaluate * @return true if the event should be processed by this router * @throws MessagingException if the event cannot be evaluated * @see org.mule.routing.inbound.SelectiveConsumer */ boolean isMatch(MuleMessage message) throws MessagingException; TransactionConfig getTransactionConfig(); void setTransactionConfig(TransactionConfig transactionConfig); /** * Gets the replyTo endpoint for any outgoing messages. This will then be used by * other Mule routers to send replies back for this message. If the underlying * protocol supports replyTo messages, such as Jms, a Jms Destination will be * attached to the outbound message * * @return the replyTo endpoint or null if one has not been set. */ String getReplyTo(); /** * Sets the replyTo endpoint for any outgoing messages. This will then be used by * other Mule routers to send replies back for this message. If the underlying * protocol supports replyTo messages, such as Jms, a Jms Destination will be * attached to the outbound message * * @param replyTo endpoint string to use */ void setReplyTo(String replyTo); /** * Determines whether this router supports dynamic endpoint. i.e. endpoints that * are not configured at design time. Endpoints might be pulled from the message * or payload. * * @return */ boolean isDynamicEndpoints(); /** * @param name the Endpoint identifier * @return the Endpoint or null if the endpointUri is not registered */ public OutboundEndpoint getEndpoint(String name); } mule-2.0.1/core/src/main/java/org/mule/api/routing/RoutePathNotFoundException.java0000644000175000017500000000331310745677442030007 0ustar charlescharles/* * $Id: RoutePathNotFoundException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.config.i18n.Message; /** * RoutePathNotFoundException is thrown if a routing path for an event * cannot be found. This can be caused if there is no (or no matching) endpoint for * the event to route through. */ public class RoutePathNotFoundException extends RoutingException { /** * Serial version */ private static final long serialVersionUID = -8481434966594513065L; public RoutePathNotFoundException(MuleMessage message, ImmutableEndpoint endpoint) { super(message, endpoint); } public RoutePathNotFoundException(MuleMessage umoMessage, ImmutableEndpoint endpoint, Throwable cause) { super(umoMessage, endpoint, cause); } public RoutePathNotFoundException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint) { super(message, umoMessage, endpoint); } public RoutePathNotFoundException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint, Throwable cause) { super(message, umoMessage, endpoint, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/routing/CouldNotRouteInboundEventException.java0000644000175000017500000000330110746275214031473 0ustar charlescharles/* * $Id: CouldNotRouteInboundEventException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.config.i18n.Message; /** * CouldNotRouteInboundEventException thrown if the current service * cannot accept the inbound event. */ public class CouldNotRouteInboundEventException extends RoutingException { /** * Serial version */ private static final long serialVersionUID = 2736231899561051615L; public CouldNotRouteInboundEventException(MuleMessage message, ImmutableEndpoint endpoint) { super(message, endpoint); } public CouldNotRouteInboundEventException(MuleMessage umoMessage, ImmutableEndpoint endpoint, Throwable cause) { super(umoMessage, endpoint, cause); } public CouldNotRouteInboundEventException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint) { super(message, umoMessage, endpoint); } public CouldNotRouteInboundEventException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint, Throwable cause) { super(message, umoMessage, endpoint, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/routing/ResponseRouterCollection.java0000644000175000017500000000311610757615756027557 0ustar charlescharles/* * $Id: ResponseRouterCollection.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import java.util.List; /** * ResponseRouterCollection is a router that can be used to control * how the response in a request/response message flow is created. Its main use case * is to aggregate a set of asynchonous events into a single response. */ public interface ResponseRouterCollection extends RouterCollection { void route(MuleEvent event) throws RoutingException; MuleMessage getResponse(MuleMessage message) throws MuleException; ResponseRouter removeRouter(ResponseRouter router); void addEndpoint(InboundEndpoint endpoint); boolean removeEndpoint(InboundEndpoint endpoint); List getEndpoints(); /** * @param name the Endpoint identifier * @return the Endpoint or null if the endpointUri is not registered * @see ResponseRouterCollection */ InboundEndpoint getEndpoint(String name); void setEndpoints(List endpoints); int getTimeout(); void setTimeout(int timeout); boolean hasEndpoints(); } mule-2.0.1/core/src/main/java/org/mule/api/routing/filter/0000755000175000017500000000000011351411117023135 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/routing/filter/ObjectFilter.java0000644000175000017500000000110710745677442026400 0ustar charlescharles/* * $Id: ObjectFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing.filter; /** * Interface for filtering any kind of object. */ public interface ObjectFilter { boolean accept(Object object); } mule-2.0.1/core/src/main/java/org/mule/api/routing/filter/Filter.java0000644000175000017500000000147110745677442025255 0ustar charlescharles/* * $Id: Filter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing.filter; import org.mule.api.MuleMessage; /** * The Filter interface allows MuleMessage filtering. */ public interface Filter { /** * Check a given message against this filter. * * @param message a non null message to filter. * @return true if the message matches the filter */ boolean accept(MuleMessage message); } mule-2.0.1/core/src/main/java/org/mule/api/routing/RouterCatchAllStrategy.java0000644000175000017500000000156510757615756027151 0ustar charlescharles/* * $Id: RouterCatchAllStrategy.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; /** * RouterCatchAllStrategy TODO */ public interface RouterCatchAllStrategy { void setEndpoint(OutboundEndpoint endpoint); OutboundEndpoint getEndpoint(); MuleMessage catchMessage(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException; } mule-2.0.1/core/src/main/java/org/mule/api/routing/NestedRouterCollection.java0000644000175000017500000000121010745677442027171 0ustar charlescharles/* * $Id: NestedRouterCollection.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; /** * NestedRouterCollection manages a collection of nested routers. */ public interface NestedRouterCollection extends RouterCollection { // no additional methods } mule-2.0.1/core/src/main/java/org/mule/api/routing/NestedRouter.java0000644000175000017500000000453110757615756025171 0ustar charlescharles/* * $Id: NestedRouter.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; public interface NestedRouter extends Router { /** * This method is responsible for routing the Message via the MuleSession. The logic * for this method will change for each type of router depending on expected * behaviour. For example, a MulticastingRouter might just iterate through the * list of assoaciated endpoints sending the message. Another type of router such * as the ExceptionBasedRouter will hit the first endpoint, if it fails try the * second, and so on. Most router implementations will extends the * FilteringOutboundRouter which implements all the common logic need for a * router. * * @param message the message to send via one or more endpoints on this router * @param session the session used to actually send the event * @param synchronous whether the invocation process should be synchronous or not * @return a result message if any from the invocation. If the synchronous flag * is false a null result will always be returned. * @throws MessagingException if any errors occur during the sending of messages * @see org.mule.routing.outbound.FilteringOutboundRouter * @see org.mule.routing.outbound.ExceptionBasedRouter * @see org.mule.routing.outbound.MulticastingRouter */ MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws MessagingException; void setEndpoint(OutboundEndpoint endpoint); OutboundEndpoint getEndpoint(); Class getInterface(); void setInterface(Class interfaceClass); String getMethod(); void setMethod(String method); /** * This wires the dynamic proxy to the service object. * * @param target */ Object createProxy(Object target); } mule-2.0.1/core/src/main/java/org/mule/api/routing/Router.java0000644000175000017500000000153510745677442024024 0ustar charlescharles/* * $Id: Router.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.management.stats.RouterStatistics; /** * Router is a base interface for all routers. */ //public interface Router extends Registerable public interface Router extends Initialisable, Disposable { void setRouterStatistics(RouterStatistics stats); RouterStatistics getRouterStatistics(); } mule-2.0.1/core/src/main/java/org/mule/api/routing/MessageInfoMapping.java0000644000175000017500000000171710771035311026240 0ustar charlescharles/* * $Id: MessageInfoMapping.java 11475 2008-03-21 22:46:33Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MuleMessage; /** * This mapping us used by routers to control how Important message information is pulled from the current * message. It is unlikely that many users will need to configure a custom mapping except where this information * is already set within their message type and Mule should use that rather than generate it itself. */ public interface MessageInfoMapping { public String getMessageId(MuleMessage message); public String getCorrelationId(MuleMessage message); } mule-2.0.1/core/src/main/java/org/mule/api/routing/ResponseRouter.java0000644000175000017500000000651110746275214025532 0ustar charlescharles/* * $Id: ResponseRouter.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; /** * ResponseRouter is a router that handles response flow. Response * Aggregators are used to collect responses that are usually sent to replyTo * endpoints set on outbound routers. When an event is sent out via an outbound * router, the response router will block the response flow on an Service until * the Response Router resolves a reply or times out. */ public interface ResponseRouter extends Router { /** * This method is invoked when an event is received via an endpoint on this * Response Router. It is responsible for tieing up the event it receives with * responses waiting to return back to the callee. This method will be called by * a different thread to the getResponse method. The getResponse() method block * the response execution until the process method signals that a match is found. * * @param event * @throws RoutingException */ void process(MuleEvent event) throws RoutingException; /** * Called by the Mule framework once the outbound router has been processed on a * service the Message passed in is the response message from the service (or * outbount router if a response was returned). This method is invoked to signal * that the event flow for the service has completed and what ever message is * returned from this method with be sent back as the response. This method will * block until the correct response for the given Message has been received. * * @param message The processed message from the Service * @return the response message sent back to the callee * @throws RoutingException * @see MuleMessage * @see org.mule.api.service.Service */ MuleMessage getResponse(MuleMessage message) throws RoutingException; /** * Sets the timeout delay that the response router should wait for a response for * a given event. If the time expires and exception will be thrown by Mule. * * @param timeout the time in milliseconds to wait for a response event */ void setTimeout(int timeout); /** * Returns the timeout delay that the response router should wait for a response * for a given event. If the time expires and exception will be thrown by Mule. * * @return the time in milliseconds to wait for a response event */ int getTimeout(); /** * Should the router fail and throw an exception if a timeout occurs or should it return * the events received so far. * //TODO This method is not implemented yet * @param fail */ void setFailOnTimeout(boolean fail); /** * Should the router fail and throw an exception if a timeout occurs or should it return * the events received so far. * //TODO This method is not implemented yet * @return */ boolean isFailOnTimeout(); } mule-2.0.1/core/src/main/java/org/mule/api/routing/InboundRouter.java0000644000175000017500000000510510746275214025330 0ustar charlescharles/* * $Id: InboundRouter.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; /** * InboundRouter defines an interface for an inbound Message * router. An inbound router is used to control how events are received by a * service. One or more of these routers can be associated with a * InboundRouterCollection implementation. * * @see InboundRouterCollection */ public interface InboundRouter extends Router { /** * A received MuleEvent is passed to this method for processing. The router can * control processing by either 1. passing back a null to indicate that the * router has either discarded the event of the event has been stored for further * processing. A reaosn for storing the event might be that other events in it's * correlation group are expected to be received. 2. Pass back an array of one or * more events to be processed by the service. Often 1 event is returned, i.e. * in the case of event aggregation. The router may return an array of events if * a set of events have been resequenced or multiple events have been generated * from a single event. * * @param event the event received by the inbound endpoint before it is passed to * the service * @return null to indicate the event has been stored/destroyed or an array of * events to be processed by the service * @throws MessagingException if an error occurs during processing of the event */ MuleEvent[] process(MuleEvent event) throws MessagingException; /** * Determines if the event should be processed by this router. Routers can be * selectively invoked by configuing a filter on them. Usually the filter is * applied to the event when calling this method. All core Mule inbound routers * extend the SelectiveConsumer router. * * @param event the current event to evaluate * @return true if the event should be processed by this router * @throws MessagingException if the event cannot be evaluated * @see org.mule.routing.inbound.SelectiveConsumer */ boolean isMatch(MuleEvent event) throws MessagingException; } mule-2.0.1/core/src/main/java/org/mule/api/routing/RoutingException.java0000644000175000017500000000472710745677442026060 0ustar charlescharles/* * $Id: RoutingException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; /** * RoutingException is a base class for all routing exceptions. * Routing exceptions are only thrown for DefaultInboundRouterCollection and * DefaultOutboundRouterCollection and deriving types. Mule itself does not throw routing * exceptions when routing internal events. */ public class RoutingException extends MessagingException { /** * Serial version */ private static final long serialVersionUID = 2478458847072048645L; protected final transient ImmutableEndpoint endpoint; public RoutingException(MuleMessage message, ImmutableEndpoint endpoint) { super(generateMessage(null, endpoint), message); this.endpoint = endpoint; } public RoutingException(MuleMessage umoMessage, ImmutableEndpoint endpoint, Throwable cause) { super(generateMessage(null, endpoint), umoMessage, cause); this.endpoint = endpoint; } public RoutingException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint) { super(generateMessage(message, endpoint), umoMessage); this.endpoint = endpoint; } public RoutingException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint, Throwable cause) { super(generateMessage(message, endpoint), umoMessage, cause); this.endpoint = endpoint; } public ImmutableEndpoint getEndpoint() { return endpoint; } private static Message generateMessage(Message message, ImmutableEndpoint endpoint) { Message m = CoreMessages.failedToRouterViaEndpoint(endpoint); if (message != null) { message.setNextMessage(m); return message; } else { return m; } } } mule-2.0.1/core/src/main/java/org/mule/api/routing/ServiceRoutingException.java0000644000175000017500000000576210746275214027371 0ustar charlescharles/* * $Id: ServiceRoutingException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.service.Service; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; /** * ServiceRoutingException is thrown due to a routing exception * between the endpoint the event was received on and the service receiving the * event. */ public class ServiceRoutingException extends RoutingException { /** * Serial version */ private static final long serialVersionUID = -113944443831267318L; private transient Service service; public ServiceRoutingException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint, Service service) { super(generateMessage(message, endpoint, service), umoMessage, endpoint); this.service = service; } public ServiceRoutingException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint, Service service, Throwable cause) { super(generateMessage(message, endpoint, service), umoMessage, endpoint, cause); this.service = service; } public ServiceRoutingException(MuleMessage umoMessage, ImmutableEndpoint endpoint, Service service) { super(generateMessage(null, endpoint, service), umoMessage, endpoint); this.service = service; } public ServiceRoutingException(MuleMessage umoMessage, ImmutableEndpoint endpoint, Service service, Throwable cause) { super(generateMessage(null, endpoint, service), umoMessage, endpoint, cause); this.service = service; } private static Message generateMessage(Message message, ImmutableEndpoint endpoint, Service service) { Message m = CoreMessages.routingFailedOnEndpoint(service.getName(), endpoint.getEndpointURI()); if (message != null) { message.setNextMessage(m); return message; } else { return m; } } public Service getService() { return service; } } mule-2.0.1/core/src/main/java/org/mule/api/routing/InboundRouterCollection.java0000644000175000017500000000251210757615756027356 0ustar charlescharles/* * $Id: InboundRouterCollection.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import java.util.List; /** * DefaultInboundRouterCollection manages a collection of inbound routers. */ public interface InboundRouterCollection extends RouterCollection { MuleMessage route(MuleEvent event) throws MessagingException; void addRouter(InboundRouter router); InboundRouter removeRouter(InboundRouter router); void addEndpoint(InboundEndpoint endpoint); boolean removeEndpoint(InboundEndpoint endpoint); List getEndpoints(); /** * @param name the Endpoint identifier * @return the Endpoint or null if the endpointUri is not registered * @see InboundRouterCollection */ InboundEndpoint getEndpoint(String name); void setEndpoints(List endpoints); } mule-2.0.1/core/src/main/java/org/mule/api/routing/ResponseTimeoutException.java0000644000175000017500000000257410745677442027574 0ustar charlescharles/* * $Id: ResponseTimeoutException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.config.i18n.Message; /** * ResponseTimeoutException is thrown when a response is not received * in a given timeout in the Response Router. * * @see org.mule.api.routing.ResponseRouter */ public class ResponseTimeoutException extends RoutingException { /** * Serial version */ private static final long serialVersionUID = 6882278747922113239L; public ResponseTimeoutException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint) { super(message, umoMessage, endpoint); } public ResponseTimeoutException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint, Throwable cause) { super(message, umoMessage, endpoint, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/routing/IdempotentMessageIdStore.java0000644000175000017500000000352410745677442027453 0ustar charlescharles/* * $Id: IdempotentMessageIdStore.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.routing.inbound.IdempotentInMemoryMessageIdStore; import org.mule.routing.inbound.IdempotentReceiver; /** * IdempotentMessageIdStore is the main interface used by * {@link IdempotentReceiver} for storing received message IDs. * * @see {@link IdempotentInMemoryMessageIdStore} */ public interface IdempotentMessageIdStore { /** * Check whether the given ID is already registered with this store. * * @param id the ID to check * @return true if the ID is stored or false if it could * not be found * @throws IllegalArgumentException if the given ID is null * @throws Exception if any implementation-specific error occured, e.g. when the store * is not available */ boolean containsId(Object id) throws IllegalArgumentException, Exception; /** * Store the given ID. * * @param id the ID to store * @return true if the ID was stored properly, or false * if it already existed * @throws IllegalArgumentException if the given ID cannot be stored or is * null * @throws Exception if the store is not available or any other * implementation-specific error occured */ boolean storeId(Object id) throws IllegalArgumentException, Exception; } mule-2.0.1/core/src/main/java/org/mule/api/routing/RouterCollection.java0000644000175000017500000000256210745677442026041 0ustar charlescharles/* * $Id: RouterCollection.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.routing; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.management.stats.RouterStatistics; import java.util.List; /** * RouterCollection defines the interface for a MessageRouter that * manages more than one router. A {@link RouterCatchAllStrategy} can be set on * this router to route unwanted or unfiltered events. If a catch strategy is not * set, the router just returns null. */ public interface RouterCollection extends Initialisable, Disposable { void setRouters(List routers); List getRouters(); void addRouter(Router router); Router removeRouter(Router router); RouterCatchAllStrategy getCatchAllStrategy(); void setCatchAllStrategy(RouterCatchAllStrategy catchAllStrategy); boolean isMatchAll(); RouterStatistics getStatistics(); void setStatistics(RouterStatistics stat); void setMatchAll(boolean matchAll); } mule-2.0.1/core/src/main/java/org/mule/api/DefaultMuleException.java0000644000175000017500000000310710745677442025140 0ustar charlescharles/* * $Id: DefaultMuleException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; /** * MuleException Is the base exception type for the Mule application * any other exceptions thrown by Mule code will be based on this exception. */ public class DefaultMuleException extends MuleException { /** * Serial version */ private static final long serialVersionUID = 2554735072826262515L; public DefaultMuleException(String message) { this(MessageFactory.createStaticMessage(message)); } /** * @param message the exception message */ public DefaultMuleException(Message message) { super(message); } public DefaultMuleException(String message, Throwable cause) { this(MessageFactory.createStaticMessage(message), cause); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public DefaultMuleException(Message message, Throwable cause) { super(message, cause); } public DefaultMuleException(Throwable cause) { super(cause); } } mule-2.0.1/core/src/main/java/org/mule/api/agent/0000755000175000017500000000000011351411120021251 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/agent/Agent.java0000644000175000017500000000240310776664712023204 0ustar charlescharles/* * $Id: Agent.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.agent; import org.mule.api.NamedObject; import org.mule.api.lifecycle.Lifecycle; import java.util.List; /** * Agent is a server plugin that can be initialised, started and * destroyed along with the UMOManager itself. Agents can initialise or bind to * external services such as a Jmx server. */ public interface Agent extends Lifecycle, NamedObject { /** * Should be a 1 line description of the agent * * @return */ String getDescription(); void registered(); void unregistered(); /** * @return List of Class objects (agent classes) that this Agent requires to be * started before it can start itself. The implementation of this class may never * return null. */ List/*>*/ getDependentAgents(); } mule-2.0.1/core/src/main/java/org/mule/api/transport/0000755000175000017500000000000011351411120022207 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/transport/package.html0000644000175000017500000000015510745677442024524 0ustar charlescharles Contains the interfaces that comprise a provider implementation. mule-2.0.1/core/src/main/java/org/mule/api/transport/MessageDispatcherFactory.java0000644000175000017500000000723310757615756030040 0ustar charlescharles/* * $Id: MessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; /** * MessageDispatcherFactory is a factory interface for managing the * lifecycles of a transport's message dispatchers. The methods basically implement * the {@link org.apache.commons.pool.KeyedPoolableObjectFactory} lifecycle, with a * {@link ImmutableEndpoint} as the key and the dispatcher as pooled object. */ public interface MessageDispatcherFactory { /** * Controls whether dispatchers are cached or created per request. Note that if * an exception occurs in the dispatcher, it is automatically disposed of and a * new one is created for the next request. This allows dispatchers to recover * from loss of connection and other faults. When invoked by * {@link #validate(OutboundEndpoint, MessageDispatcher)} it takes * precedence over the dispatcher's own return value of * {@link MessageDispatcher#validate()}. * * @return true if created per request */ boolean isCreateDispatcherPerRequest(); /** * Creates a new message dispatcher instance, initialised with the passed * endpoint. The returned instance should be immediately useable. * * @param endpoint the endoint for which this dispatcher should be created * @return a properly created MessageDispatcher for this * transport * @throws MuleException if the dispatcher cannot be created */ MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException; /** * Invoked before the given dispatcher is handed out to a * client, but not after {@link #create(OutboundEndpoint)}. * * @param endpoint the endpoint of the dispatcher * @param dispatcher the dispatcher to be activated * @throws MuleException if the dispatcher cannot be activated */ void activate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) throws MuleException; /** * Invoked after the dispatcher is returned from a client but * before it is prepared for return to its pool via * {@link #passivate(OutboundEndpoint, MessageDispatcher)}. * * @param endpoint the endpoint of the dispatcher * @param dispatcher the dispatcher to be validated * @return true if the dispatcher is valid for reuse, * false otherwise. */ boolean validate(OutboundEndpoint endpoint, MessageDispatcher dispatcher); /** * Invoked immediately before the given dispatcher is returned * to its pool. * * @param endpoint the endpoint of the dispatcher * @param dispatcher the dispatcher to be passivated */ void passivate(OutboundEndpoint endpoint, MessageDispatcher dispatcher); /** * Invoked when a dispatcher returned false for * {@link #validate(OutboundEndpoint, MessageDispatcher)}. * * @param endpoint the endpoint of the dispatcher * @param dispatcher the dispatcher to be validated */ void destroy(OutboundEndpoint endpoint, MessageDispatcher dispatcher); } mule-2.0.1/core/src/main/java/org/mule/api/transport/SessionHandler.java0000644000175000017500000000240010745677442026022 0ustar charlescharles/* * $Id: SessionHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; /** * An interface used for reading and writing session information to and from the * current message. */ public interface SessionHandler { void storeSessionInfoToMessage(MuleSession session, MuleMessage message) throws MuleException; void retrieveSessionInfoFromMessage(MuleMessage message, MuleSession session) throws MuleException; /** * The property name of the session id to use when creating the Mule session. by * default the property name "ID" will be used. If no property was set on the * session called "ID" a session id will be automatically generated * * @return the property name of the session id that is set on the session */ String getSessionIDKey(); } mule-2.0.1/core/src/main/java/org/mule/api/transport/ReceiveException.java0000644000175000017500000000372510745677442026355 0ustar charlescharles/* * $Id: ReceiveException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; import org.mule.util.ObjectUtils; /** * ReceiveException is specifically thrown by the Provider receive * method if something fails in the underlying transport */ public class ReceiveException extends MuleException { /** * Serial version */ private static final long serialVersionUID = 1960304517882133951L; private ImmutableEndpoint endpoint; /** * @param message the exception message */ public ReceiveException(Message message, ImmutableEndpoint endpoint, long timeout) { super(message); this.endpoint = endpoint; addInfo("Endpoint", ObjectUtils.toString(this.endpoint, "null")); addInfo("Timeout", String.valueOf(timeout)); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public ReceiveException(Message message, ImmutableEndpoint endpoint, long timeout, Throwable cause) { super(message, cause); this.endpoint = endpoint; addInfo("Endpoint", ObjectUtils.toString(this.endpoint, "null")); addInfo("Timeout", String.valueOf(timeout)); } public ReceiveException(ImmutableEndpoint endpoint, long timeout, Throwable cause) { this(CoreMessages.failedToRecevieWithTimeout(endpoint, timeout), endpoint, timeout, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/transport/PropertyScope.java0000644000175000017500000001047310745677442025730 0ustar charlescharles/* * $Id: PropertyScope.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import java.io.Serializable; import java.util.Comparator; /** * A PropertyScope is used to assoaciate a message property with a lifetime. Some scopes may be very brief such as * {@link #INVOCATION} scope which only lasts until a service has been invoke or a longer running scope such as {@link #SESSION} * */ public final class PropertyScope implements Serializable { public static final String INVOCATION_NAME = "invocation"; public static final String INBOUND_NAME = "inbound"; public static final String OUTBOUND_NAME = "outbound"; public static final String SESSION_NAME = "session"; public static final String APPLICATION_NAME = "application"; /** * This scope is defined from the point that a Message is created until a service has processed the * message. Properties set on endpoints will be found in this scope */ public static final PropertyScope INVOCATION = new PropertyScope(INVOCATION_NAME, 0); /** * This scope holds all inbound headers when a message is received. This scope is read only */ public static final PropertyScope INBOUND = new PropertyScope(INBOUND_NAME, 1); /** * This is the default scope when writing properties to a message. All properties written in this scope * will be attached to the outbound message (or response message) */ public static final PropertyScope OUTBOUND = new PropertyScope(OUTBOUND_NAME, 2); /** * Defines the scope for any properties set on the session. Mule utilises the underlying transport for controlling the * session where possible i.e. HttpSession. But Mule will fallback to an internal session mechanisim where a session is * encoded on the message with an expiry time associated with it. */ public static final PropertyScope SESSION = new PropertyScope(SESSION_NAME, 3); /** * This provides access to properties in the registry. By default this scope is not enabled since * it will most likely have a performance impact. This is a read-only scope */ public static final PropertyScope APPLICATION = new PropertyScope(APPLICATION_NAME, 4); /** * An array of all scopes defined here */ public static final PropertyScope[] ALL_SCOPES = new PropertyScope[]{INVOCATION, INBOUND, OUTBOUND, SESSION, APPLICATION}; private String scope; private int order; public PropertyScope(String scope, int order) { this.scope = scope; this.order = order; } public String getScope() { return scope; } public int getOrder() { return order; } public String toString() { return getScope(); } public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyScope that = (PropertyScope) o; if (order != that.order) { return false; } if (scope != null ? !scope.equals(that.scope) : that.scope != null) { return false; } return true; } public int hashCode() { int result; result = (scope != null ? scope.hashCode() : 0); result = 31 * result + order; return result; } /** * Used for comparing {@link PropertyScope} instances in a map. The {@link PropertyScope#getOrder()} * property is used to determine the order in the map */ public static class ScopeComarator implements Comparator, Serializable { public int compare(Object o, Object o1) { if (o == o1) { return 0; } if (o.equals(o1)) { return 0; } return (((PropertyScope) o).getOrder() < ((PropertyScope) o1).getOrder() ? -1 : 1); } } } mule-2.0.1/core/src/main/java/org/mule/api/transport/DispatchException.java0000644000175000017500000000313510745677442026525 0ustar charlescharles/* * $Id: DispatchException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.Message; /** * DispatchException is thrown when an endpoint dispatcher fails to * send, dispatch or receive a message. */ public class DispatchException extends RoutingException { /** * Serial version */ private static final long serialVersionUID = -8204621943732496605L; public DispatchException(MuleMessage message, ImmutableEndpoint endpoint) { super(message, endpoint); } public DispatchException(MuleMessage umoMessage, ImmutableEndpoint endpoint, Throwable cause) { super(umoMessage, endpoint, cause); } public DispatchException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint) { super(message, umoMessage, endpoint); } public DispatchException(Message message, MuleMessage umoMessage, ImmutableEndpoint endpoint, Throwable cause) { super(message, umoMessage, endpoint, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/transport/ConnectorException.java0000644000175000017500000000413310745677442026717 0ustar charlescharles/* * $Id: ConnectorException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleException; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; /** * ConnectorException Is thrown in the context of a Connector, * usually some sort of transport level error where the connection has failed. This * exception maintains a reference to the connector. * * @see Connector */ public class ConnectorException extends MuleException { /** * Serial version */ private static final long serialVersionUID = 4729481487016346035L; /** * The connector relevant to this exception */ private transient Connector connector; /** * @param message the exception message * @param connector where the exception occurred or is being thrown */ public ConnectorException(Message message, Connector connector) { super(generateMessage(message, connector)); this.connector = connector; } /** * @param message the exception message * @param connector where the exception occurred or is being thrown * @param cause the exception that cause this exception to be thrown */ public ConnectorException(Message message, Connector connector, Throwable cause) { super(generateMessage(message, connector), cause); this.connector = connector; } private static Message generateMessage(Message message, Connector connector) { Message m = CoreMessages.connectorCausedError(connector); if (message != null) { message.setNextMessage(m); } return message; } public Connector getConnector() { return connector; } } mule-2.0.1/core/src/main/java/org/mule/api/transport/MessageDispatching.java0000644000175000017500000000270410757615756026655 0ustar charlescharles/* * $Id: MessageDispatching.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; /** * Define generic methods for dispatching events. * The exact behaviour of the action is defined by the implementing class. * * @see org.mule.api.endpoint.OutboundEndpoint * @see org.mule.api.transport.MessageDispatcher */ public interface MessageDispatching { long RECEIVE_WAIT_INDEFINITELY = 0; long RECEIVE_NO_WAIT = -1; /** * Dispatches an event from the endpoint to the external system * * @param event The event to dispatch * @throws DispatchException if the event fails to be dispatched */ void dispatch(MuleEvent event) throws DispatchException; /** * Sends an event from the endpoint to the external system * * @param event The event to send * @return event the response form the external system wrapped in a MuleEvent * @throws DispatchException if the event fails to be dispatched */ MuleMessage send(MuleEvent event) throws DispatchException; } mule-2.0.1/core/src/main/java/org/mule/api/transport/NoReceiverForEndpointException.java0000644000175000017500000000314410745677442031177 0ustar charlescharles/* * $Id: NoReceiverForEndpointException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.endpoint.EndpointException; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; /** * NoReceiverForEndpointException is thrown when an enpoint is * specified for a receiver but no such receiver exists. */ public class NoReceiverForEndpointException extends EndpointException { /** * Serial version */ private static final long serialVersionUID = -3954838511333933643L; /** * @param endpoint the endpoint that could not be located */ public NoReceiverForEndpointException(String endpoint) { super(CoreMessages.endpointNotFound(endpoint)); } /** * @param message the exception message */ public NoReceiverForEndpointException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public NoReceiverForEndpointException(Message message, Throwable cause) { super(message, cause); } public NoReceiverForEndpointException(Throwable cause) { super(cause); } } mule-2.0.1/core/src/main/java/org/mule/api/transport/MessageTypeNotSupportedException.java0000644000175000017500000000312510745677442031602 0ustar charlescharles/* * $Id: MessageTypeNotSupportedException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MessagingException; import org.mule.config.i18n.CoreMessages; /** * MessageTypeNotSupportedException is thrown when a message payload * is set on a Message implementation of MessageAdapter which is not of supported * type for that message or adapter. */ public class MessageTypeNotSupportedException extends MessagingException { /** * Serial version */ private static final long serialVersionUID = -3954838511333933643L; public MessageTypeNotSupportedException(Object message, Class adapterClass) { super(CoreMessages.messageNotSupportedByAdapter( (message != null ? message.getClass().getName() : "null"), (adapterClass != null ? adapterClass.getName() : "null class")), message); } public MessageTypeNotSupportedException(Object message, Class adapterClass, Throwable cause) { super(CoreMessages.messageNotSupportedByAdapter( (message != null ? message.getClass().getName() : "null"), (adapterClass != null ? adapterClass.getName() : "null class")), message, cause); } } mule-2.0.1/core/src/main/java/org/mule/api/transport/MessageRequesterFactory.java0000644000175000017500000000735610757615756027737 0ustar charlescharles/* * $Id: MessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; /** * A factory interface for managing the lifecycles of a transport's message requesters. * The methods basically implement * the {@link org.apache.commons.pool.KeyedPoolableObjectFactory} lifecycle, with a * {@link org.mule.api.endpoint.InboundEndpoint} as the key and the requester as pooled object. */ public interface MessageRequesterFactory { /** * Controls whether dispatchers are cached or created per request. Note that if * an exception occurs in the requester, it is automatically disposed of and a * new one is created for the next request. This allows requesters to recover * from loss of connection and other faults. When invoked by * {@link #validate(org.mule.api.endpoint.InboundEndpoint, org.mule.api.transport.MessageRequester)} it takes * precedence over the dispatcher's own return value of * {@link org.mule.api.transport.MessageDispatcher#validate()}. * * @return true if created per request */ boolean isCreateRequesterPerRequest(); /** * Creates a new message requester instance, initialised with the passed * endpoint. The returned instance should be immediately useable. * * @param endpoint the endoint for which this requester should be created * @return a properly created UMOMessagerequester for this * transport * @throws org.mule.api.MuleException if the requester cannot be created */ MessageRequester create(InboundEndpoint endpoint) throws MuleException; /** * Invoked before the given requester is handed out to a * client, but not after {@link #create(org.mule.api.endpoint.InboundEndpoint)}. * * @param endpoint the endpoint of the requester * @param requester the requester to be activated * @throws org.mule.api.MuleException if the requester cannot be activated */ void activate(InboundEndpoint endpoint, MessageRequester requester) throws MuleException; /** * Invoked after the requester is returned from a client but * before it is prepared for return to its pool via * {@link #passivate(org.mule.api.endpoint.InboundEndpoint, org.mule.api.transport.MessageRequester)}. * * @param endpoint the endpoint of the requester * @param requester the requester to be validated * @return true if the requester is valid for reuse, * false otherwise. */ boolean validate(InboundEndpoint endpoint, MessageRequester requester); /** * Invoked immediately before the given requester is returned * to its pool. * * @param endpoint the endpoint of the requester * @param requester the requester to be passivated */ void passivate(InboundEndpoint endpoint, MessageRequester requester); /** * Invoked when a requester returned false for * {@link #validate(org.mule.api.endpoint.InboundEndpoint, org.mule.api.transport.MessageRequester)}. * * @param endpoint the endpoint of the requester * @param requester the requester to be validated */ void destroy(InboundEndpoint endpoint, MessageRequester requester); }mule-2.0.1/core/src/main/java/org/mule/api/transport/MessageRequester.java0000644000175000017500000000401010745677442026364 0ustar charlescharles/* * $Id: MessageRequester.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.lifecycle.Disposable; /** * Combine {@link org.mule.api.transport.MessageRequesting} with * various lifecycle methods for the actual instances doing message sending. */ public interface MessageRequester extends Disposable, Connectable, MessageRequesting { /** * This method can perform necessary state updates before any of the * {@link org.mule.api.transport.MessageDispatching} methods are invoked. * * @see {@link org.mule.api.transport.MessageDispatcherFactory#activate(org.mule.api.endpoint.ImmutableEndpoint, org.mule.api.transport.MessageDispatcher)} */ void activate(); /** * After receiving a message, the dispatcher can use this method e.g. to * clean up its internal state (if it has any) or return pooled resources to * whereever it got them during {@link #activate()}. * * @see {@link org.mule.api.transport.MessageDispatcherFactory#passivate(org.mule.api.endpoint.ImmutableEndpoint, org.mule.api.transport.MessageDispatcher)} */ void passivate(); /** * Determines whether this dispatcher can be reused after message receiving. * * @return true if this dispatcher can be reused, * false otherwise (for example when * {@link org.mule.api.lifecycle.Disposable#dispose()} has been called because an Exception was * raised) */ boolean validate(); /** * Gets the connector for this dispatcher * * @return the connector for this dispatcher */ Connector getConnector(); }mule-2.0.1/core/src/main/java/org/mule/api/transport/Connector.java0000644000175000017500000002005710765313375025035 0ustar charlescharles/* * $Id: Connector.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MessagingException; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.NamedObject; import org.mule.api.context.MuleContextAware; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.Lifecycle; import org.mule.api.service.Service; import java.beans.ExceptionListener; import java.io.OutputStream; /** * Connector is the mechanism used to connect to external systems * and protocols in order to send and receive data. */ public interface Connector extends Lifecycle, MuleContextAware, NamedObject { int INT_VALUE_NOT_SET = -1; /** * This creates a MessageReceiver associated with this endpoint * and registers it with the connector * * @param service the listening service * @param endpoint the endpoint contains the listener endpointUri on which to * listen on. * @throws Exception if the MessageReceiver cannot be created or the Receiver * cannot be registered */ MessageReceiver registerListener(Service service, InboundEndpoint endpoint) throws Exception; /** * @param service the listening service * @param endpoint the associated endpointDescriptor with the listener * @throws Exception if the listener cannot be unregistered. If a listener is not * associated with the given endpoint this will not throw an * exception */ void unregisterListener(Service service, InboundEndpoint endpoint) throws Exception; /** * @return true if the endpoint is started */ boolean isStarted(); /** * @return false if the connector is alive and well or true if the connector is * being destroyed */ boolean isDisposed(); /** * @return false if the connector is alive and well or true if the connector has * been told to dispose */ boolean isDisposing(); /** * Gets a {@link MessageAdapter} from the connector for the given message * (data) * * @param message the data with which to initialise the {@link MessageAdapter} * @return the {@link MessageAdapter} for the endpoint * @throws MessagingException if the message parameter is not supported * @see MessageAdapter */ MessageAdapter getMessageAdapter(Object message) throws MessagingException; /** * @return the primary protocol name for endpoints of this connector */ String getProtocol(); /** * @return true if the protocol is supported by this connector. */ boolean supportsProtocol(String protocol); /** * @param listener the exception strategy to use with this endpoint * @see ExceptionListener */ void setExceptionListener(ExceptionListener listener); /** * @return the Exception stategy used by the endpoint * @see ExceptionListener */ ExceptionListener getExceptionListener(); /** * @param exception the exception that was caught */ void handleException(Exception exception); /** * The dispatcher factory is used to create a message dispatcher of the current * request * * @param factory the factory to use when a dispatcher request is madr */ void setDispatcherFactory(MessageDispatcherFactory factory); /** * The dispatcher factory is used to create a message dispatcher of the current * request * * @return the factory to use when a dispatcher request is madr */ MessageDispatcherFactory getDispatcherFactory(); /** * The requester factory is used to create a message requester of the current * request * * @param factory the factory to use when a request is made */ void setRequesterFactory(MessageRequesterFactory factory); /** * The requester factory is used to create a message requester of the current * request * * @return the factory to use when a request is made */ MessageRequesterFactory getRequesterFactory(); boolean isRemoteSyncEnabled(); /** * Used to define is this connectors endpoints' should be synchronous by default rather than using mule's * instance wide default. The endpoint is passed through to this method so that transports like axis/xfire * can determine if synchronous should be default depending on the endpoint transport e.g. http/vm/jms * etc. * * @param endpoint * @return * @see ImmutableEndpoint#isSynchronous() */ boolean isSyncEnabled(String protocol); /** * Dispatches an event from the endpoint to the external system * * @param event The event to dispatch * @throws DispatchException if the event fails to be dispatched */ void dispatch(OutboundEndpoint endpoint, MuleEvent event) throws DispatchException; /** * Make a specific request to the underlying transport * * @param uri the endpoint uri to use when connecting to the resource * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal cuases an exception * @deprecated Use request(ImmutableEndpoint endpoint, long timeout) */ MuleMessage request(String uri, long timeout) throws Exception; /** * Make a specific request to the underlying transport * * @param endpoint the endpoint to use when connecting to the resource * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal cuases an exception */ MuleMessage request(InboundEndpoint endpoint, long timeout) throws Exception; /** * Sends an event from the endpoint to the external system * * @param event The event to send * @return event the response form the external system wrapped in a MuleEvent * @throws DispatchException if the event fails to be dispatched */ MuleMessage send(OutboundEndpoint endpoint, MuleEvent event) throws DispatchException; /** * Will get the output stream for this type of transport. Typically this * will be called only when Streaming is being used on an outbound endpoint. * If Streaming is not supported by this transport an {@link UnsupportedOperationException} * is thrown. Note that the stream MUST release resources on close. For help doing so, see * {@link org.mule.model.streaming.CallbackOutputStream}. * * @param endpoint the endpoint that releates to this Dispatcher * @param message the current message being processed * @return the output stream to use for this request * @throws MuleException */ OutputStream getOutputStream(OutboundEndpoint endpoint, MuleMessage message) throws MuleException; MuleContext getMuleContext(); } mule-2.0.1/core/src/main/java/org/mule/api/transport/MessageReceiver.java0000644000175000017500000000642110757615756026164 0ustar charlescharles/* * $Id: MessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.Lifecycle; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import java.io.OutputStream; /** * MessageReceiver is used to receive data from an external system. * Typically an implementation of this interface will also implement the listener * interface for the external system. For example to listen to a JMS destination the * developer would also implement javax.jms.MessageListener. The endpoint (which * creates the MessageReceiver) will then register the receiver with the JMS * server. Where a listener interface is not availiable the derived * MessageReceiver will implement the code necessary to receive * data from the external system. For example, the file endpoint will poll a * specified directory for its data. */ public interface MessageReceiver extends Lifecycle, Connectable { /** * @return the receivers endpoint */ InboundEndpoint getEndpoint(); /** * @param message * @param exception */ // void handleException(Object message, Throwable exception); /** * @return the service associated with the receiver */ Service getService(); /** * @param endpoint the endpoint to listen on * @see ImmutableEndpoint */ void setEndpoint(InboundEndpoint endpoint); /** * @param service the service to associate with the receiver. When data is * received the service dispatchEvent or * sendEvent is used to dispatch the data to the * relivant UMO. */ void setService(Service service); void setConnector(Connector connector); Connector getConnector(); /** * The endpointUri that this receiver listens on * * @return */ EndpointURI getEndpointURI(); String getReceiverKey(); void setReceiverKey(String key); MuleMessage routeMessage(MuleMessage message) throws MuleException; MuleMessage routeMessage(MuleMessage message, boolean synchronous) throws MuleException; MuleMessage routeMessage(MuleMessage message, Transaction trans, boolean synchronous) throws MuleException; MuleMessage routeMessage(MuleMessage message, OutputStream outputStream) throws MuleException; MuleMessage routeMessage(MuleMessage message, boolean synchronous, OutputStream outputStream) throws MuleException; MuleMessage routeMessage(MuleMessage message, Transaction trans, boolean synchronous, OutputStream outputStream) throws MuleException; } mule-2.0.1/core/src/main/java/org/mule/api/transport/UniqueIdNotSupportedException.java0000644000175000017500000000317510745677442031104 0ustar charlescharles/* * $Id: UniqueIdNotSupportedException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleRuntimeException; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; /** * UniqueIdNotSupportedException is thrown by * MessageAdapter.getUniqueId() if the underlying message does not support or have * a unique identifier. */ public class UniqueIdNotSupportedException extends MuleRuntimeException { /** * Serial version */ private static final long serialVersionUID = -6719055482076081111L; public UniqueIdNotSupportedException(MessageAdapter adapter) { super(CoreMessages.uniqueIdNotSupportedByAdapter(adapter.getClass().getName())); } public UniqueIdNotSupportedException(MessageAdapter adapter, Message message) { super(chainMessage( CoreMessages.uniqueIdNotSupportedByAdapter(adapter.getClass().getName()), message)); } public UniqueIdNotSupportedException(MessageAdapter adapter, Throwable cause) { super(CoreMessages.uniqueIdNotSupportedByAdapter(adapter.getClass().getName()), cause); } protected static Message chainMessage(Message m1, Message m2) { m1.setNextMessage(m2); return m1; } } mule-2.0.1/core/src/main/java/org/mule/api/transport/MessageAdapter.java0000644000175000017500000003001711002521634025745 0ustar charlescharles/* * $Id: MessageAdapter.java 11609 2008-04-20 01:59:56Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.ExceptionPayload; import java.io.Serializable; import java.util.Map; import java.util.Set; import javax.activation.DataHandler; /** * MessageAdapter provides a common abstraction of different * message implementations provided by different underlying technologies. */ public interface MessageAdapter extends Serializable { /** * Adds a map of properties to be associated with this message * * @param properties the properties add to this message */ void addProperties(Map properties); /** * Adds a map of properties to be associated with this message * * @param properties the properties add to this message * @param scope the scope in which the proeprties should be added */ void addProperties(Map properties, PropertyScope scope); /** * Removes all properties on this message */ void clearProperties(); /** * Gets a property of the message implementation * * @param key the key on which to lookup the property value * @return the property value or null if the property does not exist */ Object getProperty(String key); /** * Set a property on the message * * @param key the key on which to associate the value * @param value the property value */ void setProperty(String key, Object value); /** * Set a property on the message * * @param key the key on which to associate the value * @param value the property value * @param scope The scope at which to set the property at * @see PropertyScope */ void setProperty(String key, Object value, PropertyScope scope); /** * Removes a property on this message * * @param key the property key to remove * @return the removed property value or null if the property did not exist */ Object removeProperty(String key); /** * @return all property keys on this message */ Set getPropertyNames(); /** * @return the current message */ Object getPayload(); /** * gets the unique identifier for the message. It's up to the implementation to * ensure a unique id * * @return a unique message id. The Id should never be null. If the underlying * transport does not have the notion of a message Id, one shuold be * generated. The generated Id should be a UUID. */ String getUniqueId(); /** * Gets a property from the message * * @param name the name or key of the property * @param defaultValue a default value if the property doesn't exist in the event * @return the property value or the defaultValue if the property does not exist */ Object getProperty(String name, Object defaultValue); /** * Gets an integer property from the message * * @param name the name or key of the property * @param defaultValue a default value if the property doesn't exist in the event * @return the property value or the defaultValue if the property does not exist */ int getIntProperty(String name, int defaultValue); /** * Gets a long property from the message * * @param name the name or key of the property * @param defaultValue a default value if the property doesn't exist in the event * @return the property value or the defaultValue if the property does not exist */ long getLongProperty(String name, long defaultValue); /** * Gets a double property from the message * * @param name the name or key of the property * @param defaultValue a default value if the property doesn't exist in the event * @return the property value or the defaultValue if the property does not exist */ double getDoubleProperty(String name, double defaultValue); /** * Gets a boolean property from the message * * @param name the name or key of the property * @param defaultValue a default value if the property doesn't exist in the event * @return the property value or the defaultValue if the property does not exist */ boolean getBooleanProperty(String name, boolean defaultValue); /** * Sets a boolean property on the message * * @param name the property name or key * @param value the property value */ void setBooleanProperty(String name, boolean value); /** * Sets a integerproperty on the message * * @param name the property name or key * @param value the property value */ void setIntProperty(String name, int value); /** * Sets a long property on the message * * @param name the property name or key * @param value the property value */ void setLongProperty(String name, long value); /** * Sets a double property on the message * * @param name the property name or key * @param value the property value */ void setDoubleProperty(String name, double value); /** * Gets a String property from the message * * @param name the name or key of the property * @param defaultValue a default value if the property doesn't exist in the event * @return the property value or the defaultValue if the property does not exist */ String getStringProperty(String name, String defaultValue); /** * Sets a String property on the message * * @param name the property name or key * @param value the property value */ void setStringProperty(String name, String value); /** * Sets a correlationId for this message. The correlation Id can be used by * components in the system to manage message relations

    transport protocol. * As such not all messages will support the notion of a correlationId i.e. tcp * or file. In this situation the correlation Id is set as a property of the * message where it's up to developer to keep the association with the message. * For example if the message is serialised to xml the correlationId will be * available in the message. * * @param id the Id reference for this relationship */ void setCorrelationId(String id); /** * Sets a correlationId for this message. The correlation Id can be used by * components in the system to manage message relations.

    The correlationId * is associated with the message using the underlying transport protocol. As * such not all messages will support the notion of a correlationId i.e. tcp or * file. In this situation the correlation Id is set as a property of the message * where it's up to developer to keep the association with the message. For * example if the message is serialised to xml the correlationId will be * available in the message. * * @return the correlationId for this message or null if one hasn't been set */ String getCorrelationId(); /** * Gets the sequence or ordering number for this message in the the correlation * group (as defined by the correlationId) * * @return the sequence number or -1 if the sequence is not important */ int getCorrelationSequence(); /** * Gets the sequence or ordering number for this message in the the correlation * group (as defined by the correlationId) * * @param sequence the sequence number or -1 if the sequence is not important */ void setCorrelationSequence(int sequence); /** * Determines how many messages are in the correlation group * * @return total messages in this group or -1 if the size is not known */ int getCorrelationGroupSize(); /** * Determines how many messages are in the correlation group * * @param size the total messages in this group or -1 if the size is not known */ void setCorrelationGroupSize(int size); /** * Sets a replyTo address for this message. This is useful in an asynchronous * environment where the caller doesn't wait for a response and the response * needs to be routed somewhere for further processing. The value of this field * can be any valid endpointUri url. * * @param replyTo the endpointUri url to reply to */ void setReplyTo(Object replyTo); /** * Returns a replyTo address for this message. This is useful in an asynchronous * environment where the caller doesn't wait for a response and the response * needs to be routed somewhere for further processing. The value of this field * can be any valid endpointUri url. * * @return the endpointUri url to reply to or null if one has not been set */ Object getReplyTo(); /** * If an error occurred during the processing of this message this will return a * ErrorPayload that contains the root exception and Mule error code, plus any * other releated info * * @return The exception payload (if any) attached to this message */ ExceptionPayload getExceptionPayload(); /** * If an error occurs while processing this message, a ErrorPayload is attached * which contains the root exception and Mule error code, plus any other releated * info. * * @param payload The exception payload to attach to this message */ void setExceptionPayload(ExceptionPayload payload); /** * Allows for arbitary data attachments to be associated with the Message. These attachements work in the * same way that email attachments work. Attachments can be binary or text * @param name the name to associate with the attachment * @param dataHandler The attachment datahandler to use. This will be used to interract with the attachment data * @throws Exception * @see javax.activation.DataHandler */ void addAttachment(String name, DataHandler dataHandler) throws Exception; /** * Remove an attahcment form this message with the specifed name * @param name the name of the attachment to remove. If the attachment does not exist, the request may be ignorred * @throws Exception different messaging systems handle attachments differnetly, as such some will throw an exception * if an attahcment does dot exist. */ void removeAttachment(String name) throws Exception; /** * Retrieve an attachment with the given name. If the attachment does not exist, null will be returned * @param name the name of the attachment to retrieve * @return the attachment with the given name or null if the attachment does not exist * @see javax.activation.DataHandler */ DataHandler getAttachment(String name); /** * Returns a set of the names of the attachments on this message. If there are no attachments an empty set will be * returned. * @return a set of the names of the attachments on this message. If there are no attachments an empty set will be * returned. */ Set getAttachmentNames(); /** * Gets the encoding for the current message. For potocols that send encoding * information with the message, this method should be overriden to expose the * transport encoding, otherwise the default encoding in the Mule configuration * will be used. * * @return the encoding for this message. This method must never return null */ String getEncoding(); /** * Sets the encoding for this message * * @param encoding the encoding to use */ void setEncoding(String encoding); /** * Perform any clean up operations on the message resource. * Typically this is used to esure that a message stream is closed */ void release(); } mule-2.0.1/core/src/main/java/org/mule/api/transport/OutputHandler.java0000644000175000017500000000226710745677442025712 0ustar charlescharles/* * $Id: OutputHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleEvent; import java.io.IOException; import java.io.OutputStream; /** * The OutputHandler is a strategy class that is set on the StreamMessageAdapter to * defer the writing of the message payload until there is a stream available to * write it to. * * @see org.mule.transport.streaming.StreamMessageAdapter */ public interface OutputHandler { /** * Write the event payload to the stream. Depending on the underlying transport, * attachements and message properties may be written to the stream here too. * * @param event the current event * @param out the output stream to write to * @throws IOException */ void write(MuleEvent event, OutputStream out) throws IOException; } mule-2.0.1/core/src/main/java/org/mule/api/transport/ConnectionStrategy.java0000644000175000017500000000172110745677442026730 0ustar charlescharles/* * $Id: ConnectionStrategy.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.transport.FatalConnectException; /** * Allows developers to plug in customised reconnection behaviour */ public interface ConnectionStrategy { /** * Attempts to connect to a resource according the strategy implemented * * @param connectable the object to connect to a resource * @throws FatalConnectException is thrown if the strategy finally fails to make * a connection. */ void connect(Connectable connectable) throws FatalConnectException; } mule-2.0.1/core/src/main/java/org/mule/api/transport/MessageRequesting.java0000644000175000017500000000266010745677442026544 0ustar charlescharles/* * $Id: MessageRequesting.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleMessage; /** * Defines generic methods for receiving events. * The exact behaviour of the action is defined by the implementing class. * * @see org.mule.api.endpoint.ImmutableEndpoint * @see MessageRequester */ public interface MessageRequesting { long REQUEST_WAIT_INDEFINITELY = 0; long REQUEST_NO_WAIT = -1; /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal causes an exception */ MuleMessage request(long timeout) throws Exception; }mule-2.0.1/core/src/main/java/org/mule/api/transport/ReplyToHandler.java0000644000175000017500000000163210745677442026003 0ustar charlescharles/* * $Id: ReplyToHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleException; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import java.util.List; /** * ReplyToHandler is used to handle routing where a replyTo endpointUri is * set on the message */ public interface ReplyToHandler { void processReplyTo(MuleEvent event, MuleMessage returnMessage, Object replyTo) throws MuleException; void setTransformers(List transformers); List getTransformers(); } mule-2.0.1/core/src/main/java/org/mule/api/transport/MutableMessageAdapter.java0000644000175000017500000000217310745677442027307 0ustar charlescharles/* * $Id: MutableMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; /** * Defines a {@link org.mule.api.transport.MessageAdapter} that can have its payload re-assigned after it * has been created. Transport message adapters must never use this interface since a message payload received * from a transport is always consdered read-only. */ public interface MutableMessageAdapter extends MessageAdapter { /** * Update the message payload. This is typically only called if the * payload was originally an InputStream. In which case, if the InputStream * is consumed, it needs to be replaced for future access. * * @param payload the object to assign as the message payload */ void setPayload(Object payload); } mule-2.0.1/core/src/main/java/org/mule/api/transport/InternalMessageListener.java0000644000175000017500000000202710745677442027675 0ustar charlescharles/* * $Id: InternalMessageListener.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.transaction.Transaction; import java.io.OutputStream; /** * A listener used to receive Muleevents from a transport receiver. The listener can be * swapped out to deliver message to other frameworks, bypassing the Mule container. */ public interface InternalMessageListener { MuleMessage onMessage(MuleMessage message, Transaction trans, boolean synchronous, OutputStream outputStream) throws MuleException; } mule-2.0.1/core/src/main/java/org/mule/api/transport/MessageDispatcher.java0000644000175000017500000000355410745677442026507 0ustar charlescharles/* * $Id: MessageDispatcher.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; import org.mule.api.lifecycle.Disposable; /** * Combine {@link MessageDispatching} with * various lifecycle methods for the actual instances doing message sending. */ public interface MessageDispatcher extends Disposable, Connectable, MessageDispatching { /** * This method can perform necessary state updates before any of the * {@link MessageDispatching} methods are invoked. * * @see {@link MessageDispatcherFactory#activate(org.mule.api.endpoint.ImmutableEndpoint, MessageDispatcher)} */ void activate(); /** * After sending a message, the dispatcher can use this method e.g. to * clean up its internal state (if it has any) or return pooled resources to * whereever it got them during {@link #activate()}. * * @see {@link MessageDispatcherFactory#passivate(org.mule.api.endpoint.ImmutableEndpoint, MessageDispatcher)} */ void passivate(); /** * Determines whether this dispatcher can be reused after message sending. * * @return true if this dispatcher can be reused, * false otherwise (for example when * {@link Disposable#dispose()} has been called because an Exception was * raised) */ boolean validate(); /** * Gets the connector for this dispatcher * * @return the connector for this dispatcher */ Connector getConnector(); } mule-2.0.1/core/src/main/java/org/mule/api/transport/Connectable.java0000644000175000017500000000234210745677442025323 0ustar charlescharles/* * $Id: Connectable.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.transport; /** * Interface for objects that should connect to a resource. */ public interface Connectable { /** * Make the connection to the underlying transport. The fact that this object is * connected or not should have no influence on the lifecycle, especially the * start / stop state if applicable. * * @throws Exception */ void connect() throws Exception; /** * Disconnect the from the underlying transport * * @throws Exception */ void disconnect() throws Exception; /** * Determines if this object is connected or not * * @return */ boolean isConnected(); /** * Returns a string identifying the underlying resource * * @return */ String getConnectionDescription(); } mule-2.0.1/core/src/main/java/org/mule/api/EncryptionStrategy.java0000644000175000017500000000216710745677442024734 0ustar charlescharles/* * $Id: EncryptionStrategy.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.api.lifecycle.Initialisable; import org.mule.api.security.CryptoFailureException; /** * EncryptionStrategy can be used to provide different types of * Encryption strategy objects. These can be configured with different information * relivant with the encryption method being used. for example for Password Based * Encryption (PBE) a password, salt, iteration count and algorithm may be set on the * strategy. */ public interface EncryptionStrategy extends Initialisable { public String getName(); byte[] encrypt(byte[] data, Object info) throws CryptoFailureException; byte[] decrypt(byte[] data, Object info) throws CryptoFailureException; } mule-2.0.1/core/src/main/java/org/mule/api/NamedObject.java0000644000175000017500000000142110745677442023222 0ustar charlescharles/* * $Id: NamedObject.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; /** * Adds {@link #getName} and {@link #setName} methods to an object */ public interface NamedObject { /** * Sets the name of the object * @param name the name of the object */ void setName(String name); /** * Gts the name of the object * @return the name of the object */ String getName(); } mule-2.0.1/core/src/main/java/org/mule/api/interceptor/0000755000175000017500000000000011351411115022515 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/api/interceptor/Interceptor.java0000644000175000017500000000363710763565563025716 0ustar charlescharles/* * $Id: Interceptor.java 11182 2008-03-05 18:50:27Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.interceptor; import org.mule.api.MuleMessage; import org.mule.api.interceptor.Invocation; import org.mule.api.MuleException; /** * Interceptor is based on a similar concept of servlet filters and * works much the same way. This method is more commonally known as the interceptor * pattern and it allows for pre and processing of invocations on the object being * intercepted. * *

    In 2.x this is deprecated, but we provide an adapter, in the Spring Extras package, to * help use old implementations. There is one significant change, however - because the * interception is now "lower" in the call chain, {@link org.mule.api.interceptor.Invocation#execute()} * returns an Object rather than a {@link org.mule.api.MuleMessage}. To simplify handling this, * the adapter we provide will construct a suitable MuleMessage for you if you return null. * * @deprecated - This is only used for backwards compatability with old style (Mule 1.x) interceptors */ public interface Interceptor { /** * Invoked when the component should be called. The implementation can call * {@link Invocation#execute()} to call the component. * * @param invocation the invocation containing info about the current message and * service * @return A result message that may have been altered by this invocation * @throws org.mule.api.MuleException if the invocation fails */ MuleMessage intercept(Invocation invocation) throws MuleException; } mule-2.0.1/core/src/main/java/org/mule/api/interceptor/Invocation.java0000644000175000017500000000266210762020431025501 0ustar charlescharles/* * $Id: Invocation.java 11129 2008-02-29 15:13:29Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api.interceptor; import org.mule.api.service.Service; import org.mule.api.MuleMessage; import org.mule.api.MuleException; import org.mule.api.MuleEvent; /** * Call the embedded component. Because interception is "lower level" in 2.x, it cannot * return a MuleMessage - instead an Object is returned. * *

    If you are using the adapter in the Spring Extras package then, if you want that same object to be * returned as the result, you do not need to construct a new message, just return null and the * adapter will manage the result correctly. * * @deprecated - This is only used for backwards compatability with old style (Mule 1.x) interceptors */ public interface Invocation { /** * Calls the component * * @return the result of invoking the component * @throws org.mule.api.MuleException if something goes wrong */ public Object execute() throws MuleException; public Service getService(); public MuleEvent getEvent(); public MuleMessage getMessage(); } mule-2.0.1/core/src/main/java/org/mule/AbstractAgent.java0000644000175000017500000000274410774254333023021 0ustar charlescharles/* * $Id: AbstractAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleContext; import org.mule.api.agent.Agent; import org.mule.api.context.MuleContextAware; import org.mule.api.lifecycle.InitialisationException; import java.util.Collections; import java.util.List; /** * Implements common methods for all Agents. Importantly, the Management context is made available to Agents that * extend this. */ public abstract class AbstractAgent implements Agent, MuleContextAware { protected MuleContext muleContext; protected String name; protected AbstractAgent(String name) { this.name = name; } public final String getName() { return name; } public final void setName(String name) { this.name = name; } public String getDescription() { return name; } public List getDependentAgents() { return Collections.EMPTY_LIST; } public void setMuleContext(MuleContext context) { this.muleContext = context; } public abstract void initialise() throws InitialisationException; } mule-2.0.1/core/src/main/java/org/mule/context/0000755000175000017500000000000011351411106021072 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/context/notification/0000755000175000017500000000000011351411106023560 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/context/notification/Policy.java0000644000175000017500000001550310745677442025715 0ustar charlescharles/* * $Id: Policy.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.ServerNotificationListener; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentMap; /** * For a particular configuration, this describes what events should be delivered where. * It is read-only and a lazy instance is cached by the * {@link Configuration} */ class Policy { // map from event to set of senders private Map eventToSenders = new HashMap(); // these are cumulative - set values should never change, they are just a cache of known info // they are co and contra-variant wrt to exact event type (see code below). private ConcurrentMap knownEventsExact = new ConcurrentHashMap(); private ConcurrentMap knownEventsSuper = new ConcurrentHashMap(); /** * For each listener, we check each interface and see what events can be delivered. * * @param interfaceToEvents * @param listenerSubscriptionPairs * @param disabledInterfaces * @param disabledEvents */ Policy(Map interfaceToEvents, Set listenerSubscriptionPairs, Set disabledInterfaces, Set disabledEvents) { for (Iterator pairs = listenerSubscriptionPairs.iterator(); pairs.hasNext();) { ListenerSubscriptionPair pair = (ListenerSubscriptionPair) pairs.next(); ServerNotificationListener listener = pair.getListener(); for (Iterator interfaces = interfaceToEvents.keySet().iterator(); interfaces.hasNext();) { Class iface = (Class) interfaces.next(); if (notASubclassOfAnyClassInSet(disabledInterfaces, iface)) { if (iface.isAssignableFrom(listener.getClass())) { for (Iterator events = ((Collection) interfaceToEvents.get(iface)).iterator(); events.hasNext();) { Class event = (Class) events.next(); if (notASubclassOfAnyClassInSet(disabledEvents, event)) { knownEventsExact.put(event, Boolean.TRUE); knownEventsSuper.put(event, Boolean.TRUE); if (!eventToSenders.containsKey(event)) { eventToSenders.put(event, new HashSet()); } ((Collection) eventToSenders.get(event)).add(new Sender(pair)); } } } } } } } protected static boolean notASubclassOfAnyClassInSet(Set set, Class clazz) { for (Iterator iterator = set.iterator(); iterator.hasNext();) { Class disabled = (Class) iterator.next(); if (disabled.isAssignableFrom(clazz)) { return false; } } return true; } protected static boolean notASuperclassOfAnyClassInSet(Set set, Class clazz) { for (Iterator iterator = set.iterator(); iterator.hasNext();) { Class disabled = (Class) iterator.next(); if (clazz.isAssignableFrom(disabled)) { return false; } } return true; } void dispatch(ServerNotification notification) { if (null != notification) { Class notfnClass = notification.getClass(); // search if we don't know about this event, or if we do know it is used if ((!knownEventsExact.containsKey(notfnClass)) || ((Boolean) knownEventsExact.get(notfnClass)).booleanValue()) { boolean found = false; for (Iterator events = eventToSenders.keySet().iterator(); events.hasNext();) { Class event = (Class) events.next(); if (event.isAssignableFrom(notfnClass)) { found = true; for (Iterator senders = ((Collection) eventToSenders.get(event)).iterator(); senders.hasNext();) { ((Sender) senders.next()).dispatch(notification); } } } knownEventsExact.put(notfnClass, Boolean.valueOf(found)); } } } /** * This returns a very "conservative" value - it is true if the notification or any subclass would be * accepted. So if it returns false then you can be sure that there is no need to send the * notification. On the other hand, if it returns true there is no guarantee that the notification * "really" will be dispatched to any listener. * * @param notfnClass Either the notification class being generated or some superclass * @return false if there is no need to dispatch the notification */ boolean isNotificationEnabled(Class notfnClass) { if (!knownEventsSuper.containsKey(notfnClass)) { boolean found = false; // this is exhaustive because we initialise to include all events handled. for (Iterator events = knownEventsSuper.keySet().iterator(); events.hasNext() && !found;) { Class event = (Class) events.next(); found = ((Boolean) knownEventsSuper.get(event)).booleanValue() && notfnClass.isAssignableFrom(event); } knownEventsSuper.put(notfnClass, Boolean.valueOf(found)); } if (!knownEventsExact.containsKey(notfnClass)) { boolean found = false; for (Iterator events = eventToSenders.keySet().iterator(); events.hasNext() && !found;) { Class event = (Class) events.next(); found = event.isAssignableFrom(notfnClass); } knownEventsExact.put(notfnClass, Boolean.valueOf(found)); } return ((Boolean) knownEventsSuper.get(notfnClass)).booleanValue() || ((Boolean) knownEventsExact.get(notfnClass)).booleanValue(); } } mule-2.0.1/core/src/main/java/org/mule/context/notification/RoutingNotification.java0000644000175000017500000000405310777661265030453 0ustar charlescharles/* * $Id: RoutingNotification.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.MuleMessage; import org.mule.api.context.notification.ServerNotification; /** * Is fired by routers. Currently only Async-Reply routers use this when an event is received for an * event group that has already been processed. */ public class RoutingNotification extends ServerNotification { /** * Serial version */ private static final long serialVersionUID = -6455441938378523145L; public static final int MISSED_ASYNC_REPLY = ROUTING_EVENT_ACTION_START_RANGE + 1; public static final int ASYNC_REPLY_TIMEOUT = ROUTING_EVENT_ACTION_START_RANGE + 2; public static final int CORRELATION_TIMEOUT = ROUTING_EVENT_ACTION_START_RANGE + 3; static { registerAction("missed async reply", MISSED_ASYNC_REPLY); registerAction("async reply timeout", ASYNC_REPLY_TIMEOUT); registerAction("correlation timeout", CORRELATION_TIMEOUT); } public RoutingNotification(MuleMessage resource, String identifier, int action) { super(resource, action); resourceIdentifier = identifier; } protected String getPayloadToString() { try { return ((MuleMessage)source).getPayloadAsString(); } catch (Exception e) { return source.toString(); } } public String getType() { if (action == MISSED_ASYNC_REPLY) { return TYPE_WARNING; } else if (action == ASYNC_REPLY_TIMEOUT) { return TYPE_WARNING; } else { return TYPE_INFO; } } }mule-2.0.1/core/src/main/java/org/mule/context/notification/package.html0000644000175000017500000000022310745677442026065 0ustar charlescharles Mule Internal server notification types fired via the MuleManager. mule-2.0.1/core/src/main/java/org/mule/context/notification/Sender.java0000644000175000017500000000263510754365306025671 0ustar charlescharles/* * $Id: Sender.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; import org.mule.routing.filters.WildcardFilter; /** * This does the work necessary to deliver events to a particular listener. It is generated for a * particular {@link Configuration} and stored in a * {@link org.mule.context.notification.Policy}. */ class Sender { private ListenerSubscriptionPair pair; private WildcardFilter subscriptionFilter; Sender(ListenerSubscriptionPair pair) { this.pair = pair; subscriptionFilter = new WildcardFilter(pair.getSubscription()); subscriptionFilter.setCaseSensitive(false); } public void dispatch(ServerNotification notification) { if (pair.isNullSubscription() || (null != notification.getResourceIdentifier() && subscriptionFilter.accept(notification.getResourceIdentifier()))) { pair.getListener().onNotification(notification); } } } mule-2.0.1/core/src/main/java/org/mule/context/notification/CustomNotification.java0000644000175000017500000000461310745677442030277 0ustar charlescharles/* * $Id: CustomNotification.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.CustomNotificationListener; import org.mule.api.context.notification.ServerNotification; /** * CustomNotification Custom notifications can be used by components * and other objects such as routers, transformers, agents, etc to communicate a * change of state to each other. The Action value for the event is abitary. However * care should be taken not to set the action code to an existing action code. To * ensure this doesn't happen always set the action code greater than the * CUSTOM_ACTION_START_RANGE. * * @see CustomNotificationListener */ public class CustomNotification extends ServerNotification { /** * Serial version */ private static final long serialVersionUID = 762448139858484536L; /** * Creates a custom action event * * @param message the message to associate with the event * @param action the action code for the event * @throws IllegalArgumentException if the action value is less than * CUSTOM_ACTION_START_RANGE */ public CustomNotification(Object message, int action) { super(message, action); if (action < CUSTOM_EVENT_ACTION_START_RANGE && action > 0) { throw new IllegalArgumentException( "Action range must be greater than CUSTOM_ACTION_START_RANGE (" + CUSTOM_EVENT_ACTION_START_RANGE + ")"); } } public CustomNotification(Object message, int action, String resourceId) { super(message, action, resourceId); if (action < CUSTOM_EVENT_ACTION_START_RANGE && action > 0) { throw new IllegalArgumentException( "Action range must be greater than CUSTOM_ACTION_START_RANGE (" + CUSTOM_EVENT_ACTION_START_RANGE + ")"); } } protected String[] getActionNames() { return new String[]{}; } } mule-2.0.1/core/src/main/java/org/mule/context/notification/ServiceNotification.java0000644000175000017500000000425010754365306030413 0ustar charlescharles/* * $Id: ServiceNotification.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; import org.mule.api.service.Service; /** * ServiceNotification is fired when an event such as the service * starting occurs. The payload of this event will always be a reference to the * service. */ public class ServiceNotification extends ServerNotification { /** * Serial version */ private static final long serialVersionUID = -8575741816897936674L; public static final int SERVICE_INITIALISED = SERVICE_EVENT_ACTION_START_RANGE + 1; public static final int SERVICE_STARTED = SERVICE_EVENT_ACTION_START_RANGE + 2; public static final int SERVICE_STOPPED = SERVICE_EVENT_ACTION_START_RANGE + 3; public static final int SERVICE_PAUSED = SERVICE_EVENT_ACTION_START_RANGE + 4; public static final int SERVICE_RESUMED = SERVICE_EVENT_ACTION_START_RANGE + 5; public static final int SERVICE_DISPOSED = SERVICE_EVENT_ACTION_START_RANGE + 6; public static final int SERVICE_STOPPING = SERVICE_EVENT_ACTION_START_RANGE + 7; static { registerAction("service initialised", SERVICE_INITIALISED); registerAction("service started", SERVICE_STARTED); registerAction("service stopping", SERVICE_STOPPING); registerAction("service stopped", SERVICE_STOPPED); registerAction("service paused", SERVICE_PAUSED); registerAction("service resumed", SERVICE_RESUMED); registerAction("service disposed", SERVICE_DISPOSED); } public ServiceNotification(Service message, int action) { super(message, action); resourceIdentifier = message.getName(); } protected String getPayloadToString() { return ((Service) source).getName(); } } mule-2.0.1/core/src/main/java/org/mule/context/notification/RegistryNotification.java0000644000175000017500000000421410745677442030632 0ustar charlescharles/* * $Id: RegistryNotification.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; import org.mule.api.registry.Registry; /** * RegistyNotification is fired when an event such as an object being * registered in the Registry starting occurs. The payload of this event will always * be a reference to the Registry ID. * * @see org.mule.api.registry.Registry * @see org.mule.api.MuleContext */ public class RegistryNotification extends ServerNotification { /** * Serial version */ private static final long serialVersionUID = -3246036188021581121L; public static final int REGISTRY_INITIALISING = REGISTRY_EVENT_ACTION_START_RANGE + 1; public static final int REGISTRY_INITIALISED = REGISTRY_EVENT_ACTION_START_RANGE + 2; public static final int REGISTRY_DISPOSING = REGISTRY_EVENT_ACTION_START_RANGE + 3; public static final int REGISTRY_DISPOSED = REGISTRY_EVENT_ACTION_START_RANGE + 4; static { registerAction("registry initialising", REGISTRY_INITIALISING); registerAction("registry initialised", REGISTRY_INITIALISED); registerAction("registry disposing", REGISTRY_DISPOSING); registerAction("registry disposed", REGISTRY_DISPOSED); } public RegistryNotification(Registry registry, String action) { this(registry, getActionId(action)); } public RegistryNotification(Registry registry, int action) { super(registry.getRegistryId(), action); resourceIdentifier = registry.getRegistryId(); } public String toString() { return EVENT_NAME + "{" + "action=" + getActionName(action) + ", resourceId=" + resourceIdentifier + ", timestamp=" + timestamp + "}"; } }mule-2.0.1/core/src/main/java/org/mule/context/notification/TransactionNotification.java0000644000175000017500000000405510745677442031312 0ustar charlescharles/* * $Id: TransactionNotification.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.BlockingServerEvent; import org.mule.api.context.notification.ServerNotification; import org.mule.api.transaction.Transaction; public class TransactionNotification extends ServerNotification implements BlockingServerEvent { /** * Serial version */ private static final long serialVersionUID = -3245036187011582121L; public static final int TRANSACTION_BEGAN = TRANSACTION_EVENT_ACTION_START_RANGE + 1; public static final int TRANSACTION_COMMITTED = TRANSACTION_EVENT_ACTION_START_RANGE + 2; public static final int TRANSACTION_ROLLEDBACK = TRANSACTION_EVENT_ACTION_START_RANGE + 3; static { registerAction("begin", TRANSACTION_BEGAN); registerAction("commit", TRANSACTION_COMMITTED); registerAction("rollback", TRANSACTION_ROLLEDBACK); } /** * Ideally, that should've been a transaction's XID, but we'd need to resort to all kinds of reflection tricks to * get it. Still, toString() typically outputs a class name followed by the XID, so that's good enough. */ private String transactionStringId; public TransactionNotification(Transaction transaction, int action) { super(transaction, action); this.transactionStringId = transaction.toString(); } public String getTransactionStringId() { return this.transactionStringId; } public String toString() { return EVENT_NAME + "{" + "action=" + getActionName(action) + ", transactionStringId=" + transactionStringId + ", timestamp=" + timestamp + "}"; } } mule-2.0.1/core/src/main/java/org/mule/context/notification/ExceptionNotification.java0000644000175000017500000000226210745677442030761 0ustar charlescharles/* * $Id: ExceptionNotification.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; public class ExceptionNotification extends ServerNotification { /** * Serial version. */ private static final long serialVersionUID = -43091546451476239L; public static final int EXCEPTION_ACTION = EXCEPTION_EVENT_ACTION_START_RANGE + 1; static { registerAction("exception", EXCEPTION_ACTION); } private Throwable exception; public ExceptionNotification(Throwable exception) { super(exception, EXCEPTION_ACTION); this.exception = exception; } public Throwable getException() { return this.exception; } public String getType() { return TYPE_ERROR; } } mule-2.0.1/core/src/main/java/org/mule/context/notification/ServerNotificationManager.java0000644000175000017500000001775210766460477031577 0ustar charlescharles/* * $Id: ServerNotificationManager.java 11362 2008-03-14 11:27:59Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.WorkManager; import org.mule.api.context.notification.BlockingServerEvent; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.ServerNotificationHandler; import org.mule.api.context.notification.ServerNotificationListener; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.LifecycleException; import org.mule.util.ClassUtils; import java.util.Collection; import java.util.Collections; import java.util.Map; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkException; import javax.resource.spi.work.WorkListener; import edu.emory.mathcs.backport.java.util.concurrent.BlockingDeque; import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingDeque; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A reworking of the event manager that allows efficient behaviour without global on/off * switches in the config. * *

    The configuration and resulting policy are separate; the policy * is a summary of the configuration that contains information to decide whether a particular * message can be handled, and which updates that with experience gained handling messages. * When the configuration is changed the policy is rebuilt. In this way we get a fairly * efficient system without needing controls elsewhere. * *

    However, measurements showed that there was still a small impact on speed in some * cases. To improve behaviour further the * {@link org.mule.context.notification.OptimisedNotificationHandler} was * added. This allows a service that generates notifications to cache locally a handler * optimised for a particular class. * *

    The dynamic flag stops this caching from occurring. This reduces efficiency slightly * (about 15% cost on simple VM messages, less on other transports)

    * *

    Note that, because of subclass relationships, we need to be very careful about exactly * what is enabled and disabled: *

      *
    • Disabling an event or interface disables all uses of that class or any subclass.
    • *
    • Enquiring whether an event is enabled returns true if any subclass is enabled.
    • *
    */ public class ServerNotificationManager implements Work, Disposable, ServerNotificationHandler { public static final String NULL_SUBSCRIPTION = "NULL"; protected Log logger = LogFactory.getLog(getClass()); private boolean dynamic = false; private Configuration configuration = new Configuration(); private AtomicBoolean disposed = new AtomicBoolean(false); private BlockingDeque eventQueue = new LinkedBlockingDeque(); public boolean isNotificationDynamic() { return dynamic; } public void setNotificationDynamic(boolean dynamic) { this.dynamic = dynamic; } public void start(WorkManager workManager, WorkListener workListener) throws LifecycleException { try { workManager.scheduleWork(this, WorkManager.INDEFINITE, null, workListener); } catch (WorkException e) { throw new LifecycleException(e, this); } } public void addInterfaceToType(Class iface, Class event) { configuration.addInterfaceToType(iface, event); } public void setInterfaceToTypes(Map interfaceToEvents) throws ClassNotFoundException { configuration.addAllInterfaceToTypes(interfaceToEvents); } public void addListenerSubscriptionPair(ListenerSubscriptionPair pair) { configuration.addListenerSubscriptionPair(pair); } public void addListener(ServerNotificationListener listener) { configuration.addListenerSubscriptionPair(new ListenerSubscriptionPair(listener)); } public void addListenerSubscription(ServerNotificationListener listener, String subscription) { configuration.addListenerSubscriptionPair(new ListenerSubscriptionPair(listener, subscription)); } public void setAllListenerSubscriptionPairs(Collection pairs) { configuration.addAllListenerSubscriptionPairs(pairs); } /** * This removes *all* registrations that reference this listener */ public void removeListener(ServerNotificationListener listener) { configuration.removeListener(listener); } public void removeAllListeners(Collection listeners) { configuration.removeAllListeners(listeners); } public void disableInterface(Class iface) throws ClassNotFoundException { configuration.disableInterface(iface); } public void setDisabledInterfaces(Collection interfaces) throws ClassNotFoundException { configuration.disabledAllInterfaces(interfaces); } public void disableType(Class type) throws ClassNotFoundException { configuration.disableType(type); } public void setDisabledTypes(Collection types) throws ClassNotFoundException { configuration.disableAllTypes(types); } public void fireNotification(ServerNotification notification) { if (!disposed.get()) { if (notification instanceof BlockingServerEvent) { notifyListeners(notification); } else { try { eventQueue.put(notification); } catch (InterruptedException e) { if (!disposed.get()) { logger.error("Failed to queue notification: " + notification, e); } } } } } public boolean isNotificationEnabled(Class type) { return configuration.getPolicy().isNotificationEnabled(type); } public void dispose() { disposed.set(true); configuration = null; } protected void notifyListeners(ServerNotification notification) { if (!disposed.get()) { configuration.getPolicy().dispatch(notification); } } public void release() { dispose(); } public void run() { while (!disposed.get()) { try { ServerNotification notification = (ServerNotification) eventQueue.take(); notifyListeners(notification); } catch (InterruptedException e) { // ignore - we just loop round } } } /** * Support string or class parameters */ public static Class toClass(Object value) throws ClassNotFoundException { Class clazz; if (value instanceof String) { clazz = ClassUtils.loadClass(value.toString(), value.getClass()); } else if(value instanceof Class) { clazz = (Class)value; } else { throw new IllegalArgumentException("Notification types and listeners must be a Class with fully qualified class name. Value is: " + value); } return clazz; } // for tests ------------------------------------------------------- Policy getPolicy() { return configuration.getPolicy(); } public Map getInterfaceToTypes() { return Collections.unmodifiableMap(configuration.getInterfaceToTypes()); } public Collection getListeners() { return Collections.unmodifiableCollection(configuration.getListeners()); } } mule-2.0.1/core/src/main/java/org/mule/context/notification/MessageNotification.java0000644000175000017500000000577210777661265030421 0ustar charlescharles/* * $Id: MessageNotification.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.context.notification.ServerNotification; import org.mule.api.endpoint.ImmutableEndpoint; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * These notifications are fire when either a message is received via an endpoint, or * dispatcher of if a receive call is made on a dispatcher. */ public class MessageNotification extends ServerNotification { /** * Serial version */ private static final long serialVersionUID = -5118299601117624094L; /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(MessageNotification.class); public static final int MESSAGE_RECEIVED = MESSAGE_EVENT_ACTION_START_RANGE + 1; public static final int MESSAGE_DISPATCHED = MESSAGE_EVENT_ACTION_START_RANGE + 2; public static final int MESSAGE_SENT = MESSAGE_EVENT_ACTION_START_RANGE + 3; public static final int MESSAGE_REQUESTED = MESSAGE_EVENT_ACTION_START_RANGE + 4; static { registerAction("received", MESSAGE_RECEIVED); registerAction("dispatched", MESSAGE_DISPATCHED); registerAction("sent", MESSAGE_SENT); registerAction("requested", MESSAGE_REQUESTED); } private ImmutableEndpoint endpoint; public MessageNotification(MuleMessage resource, ImmutableEndpoint endpoint, String identifier, int action) { super(cloneMessage(resource), action); resourceIdentifier = identifier; this.endpoint = endpoint; } protected static MuleMessage cloneMessage(MuleMessage message) { // TODO we probably need to support deep cloning here synchronized (message) { return new DefaultMuleMessage(message.getPayload(), message); } } protected String getPayloadToString() { try { return ((MuleMessage)source).getPayloadAsString(); } catch (Exception e) { return source.toString(); } } public String toString() { return EVENT_NAME + "{action=" + getActionName(action) + ", endpoint: " + endpoint.getEndpointURI() + ", resourceId=" + resourceIdentifier + ", timestamp=" + timestamp + ", serverId=" + serverId + ", message: " + source + "}"; } public ImmutableEndpoint getEndpoint() { return endpoint; } } mule-2.0.1/core/src/main/java/org/mule/context/notification/MuleContextNotification.java0000644000175000017500000001070610766204322031256 0ustar charlescharles/* * $Id: MuleContextNotification.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.MuleContext; import org.mule.api.context.notification.BlockingServerEvent; import org.mule.api.context.notification.ServerNotification; /** * MuleContextNotification is fired when an event such as the mule * context starting occurs. The payload of this event will always be a reference to * the muleContext. */ public class MuleContextNotification extends ServerNotification implements BlockingServerEvent { /** * Serial version */ private static final long serialVersionUID = -3246036188011581121L; public static final int CONTEXT_INITIALISING = CONTEXT_EVENT_ACTION_START_RANGE + 1; public static final int CONTEXT_INITIALISED = CONTEXT_EVENT_ACTION_START_RANGE + 2; public static final int CONTEXT_STARTING = CONTEXT_EVENT_ACTION_START_RANGE + 3; public static final int CONTEXT_STARTED = CONTEXT_EVENT_ACTION_START_RANGE + 4; public static final int CONTEXT_STOPPING = CONTEXT_EVENT_ACTION_START_RANGE + 5; public static final int CONTEXT_STOPPED = CONTEXT_EVENT_ACTION_START_RANGE + 6; public static final int CONTEXT_DISPOSING = CONTEXT_EVENT_ACTION_START_RANGE + 7; public static final int CONTEXT_DISPOSED = CONTEXT_EVENT_ACTION_START_RANGE + 8; // The following events are not context events, but rather more general global // mule events. public static final int CONTEXT_DISPOSING_CONNECTORS = CONTEXT_EVENT_ACTION_START_RANGE + 9; public static final int CONTEXT_DISPOSED_CONNECTORS = CONTEXT_EVENT_ACTION_START_RANGE + 10; public static final int CONTEXT_STARTING_MODELS = CONTEXT_EVENT_ACTION_START_RANGE + 11; public static final int CONTEXT_STARTED_MODELS = CONTEXT_EVENT_ACTION_START_RANGE + 12; public static final int CONTEXT_STOPPING_MODELS = CONTEXT_EVENT_ACTION_START_RANGE + 13; public static final int CONTEXT_STOPPED_MODELS = CONTEXT_EVENT_ACTION_START_RANGE + 14; static { registerAction("mule context initialising", CONTEXT_INITIALISING); registerAction("mule context initialised", CONTEXT_INITIALISED); registerAction("mule context starting", CONTEXT_STARTING); registerAction("mule context started", CONTEXT_STARTED); registerAction("mule context stopping", CONTEXT_STOPPING); registerAction("mule context stopped", CONTEXT_STOPPED); registerAction("mule context disposing", CONTEXT_DISPOSING); registerAction("mule context disposed", CONTEXT_DISPOSED); registerAction("disposing connectors", CONTEXT_DISPOSING_CONNECTORS); registerAction("disposed connectors", CONTEXT_DISPOSED_CONNECTORS); registerAction("starting models", CONTEXT_STARTING_MODELS); registerAction("started models", CONTEXT_STARTED_MODELS); registerAction("stopping models", CONTEXT_STOPPING_MODELS); registerAction("stopped models", CONTEXT_STOPPED_MODELS); } private String clusterId; private String domain; public MuleContextNotification(MuleContext context, String action) { this(context, getActionId(action)); } public MuleContextNotification(MuleContext context, int action) { super(getId(context), action); resourceIdentifier = getId(context); this.clusterId = context.getConfiguration().getClusterId(); this.domain = context.getConfiguration().getDomainId(); } private static String getId(MuleContext context) { return context.getConfiguration().getDomainId() + "." + context.getConfiguration().getClusterId() + "." + context.getConfiguration().getId(); } public String getClusterId() { return clusterId; } public String getDomain() { return domain; } protected String getPayloadToString() { return ((MuleContext) source).getConfiguration().getId(); } public String toString() { return EVENT_NAME + "{" + "action=" + getActionName(action) + ", resourceId=" + resourceIdentifier + ", timestamp=" + timestamp + "}"; } } mule-2.0.1/core/src/main/java/org/mule/context/notification/Configuration.java0000644000175000017500000001235510745677442027267 0ustar charlescharles/* * $Id: Configuration.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.ServerNotificationListener; import org.mule.config.i18n.CoreMessages; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This acts as a synchronized collection. No call blocks and all are synchronized. */ class Configuration { protected Log logger = LogFactory.getLog(getClass()); private Map interfaceToTypes = new HashMap(); // map from interface to collection of events private Set listenerSubscriptionPairs = new HashSet(); private Set disabledInterfaces = new HashSet(); private Set disabledNotificationTypes = new HashSet(); private boolean dirty = true; private Policy policy; synchronized void addInterfaceToType(Class iface, Class type) { dirty = true; if (!ServerNotification.class.isAssignableFrom(type)) { throw new IllegalArgumentException( CoreMessages.propertyIsNotSupportedType("type", ServerNotification.class, type).getMessage()); } if (!interfaceToTypes.containsKey(iface)) { interfaceToTypes.put(iface, new HashSet()); } Set events = (Set) interfaceToTypes.get(iface); events.add(type); if (logger.isDebugEnabled()) { logger.debug("Registered event type: " + type); logger.debug("Binding listener type '" + iface + "' to event type '" + type + "'"); } } /** * @param interfaceToTypes map from interace to a particular event * @throws ClassNotFoundException */ synchronized void addAllInterfaceToTypes(Map interfaceToTypes) throws ClassNotFoundException { dirty = true; for (Iterator ifaces = interfaceToTypes.keySet().iterator(); ifaces.hasNext();) { Object iface = ifaces.next(); addInterfaceToType(ServerNotificationManager.toClass(iface), ServerNotificationManager.toClass(interfaceToTypes.get(iface))); } } synchronized void addListenerSubscriptionPair(ListenerSubscriptionPair pair) { dirty = true; listenerSubscriptionPairs.add(pair); } synchronized void addAllListenerSubscriptionPairs(Collection pairs) { dirty = true; for (Iterator listener = pairs.iterator(); listener.hasNext();) { addListenerSubscriptionPair((ListenerSubscriptionPair) listener.next()); } } synchronized void removeListener(ServerNotificationListener listener) { dirty = true; Set toRemove = new HashSet(); for (Iterator listeners = listenerSubscriptionPairs.iterator(); listeners.hasNext();) { ListenerSubscriptionPair pair = (ListenerSubscriptionPair) listeners.next(); if (pair.getListener().equals(listener)) { toRemove.add(pair); } } listenerSubscriptionPairs.removeAll(toRemove); } synchronized void removeAllListeners(Collection listeners) { dirty = true; for (Iterator listener = listeners.iterator(); listener.hasNext();) { removeListener((ServerNotificationListener) listener.next()); } } synchronized void disableInterface(Class iface) { dirty = true; disabledInterfaces.add(iface); } synchronized void disabledAllInterfaces(Collection interfaces) throws ClassNotFoundException { dirty = true; for (Iterator iface = interfaces.iterator(); iface.hasNext();) { disableInterface(ServerNotificationManager.toClass(iface.next())); } } synchronized void disableType(Class type) { dirty = true; disabledNotificationTypes.add(type); } synchronized void disableAllTypes(Collection types) throws ClassNotFoundException { dirty = true; for (Iterator event = types.iterator(); event.hasNext();) { disableType(ServerNotificationManager.toClass(event.next())); } } synchronized Policy getPolicy() { if (dirty) { policy = new Policy(interfaceToTypes, listenerSubscriptionPairs, disabledInterfaces, disabledNotificationTypes); dirty = false; } return policy; } // for tests ------------------------------- Map getInterfaceToTypes() { return Collections.unmodifiableMap(interfaceToTypes); } Collection getListeners() { return Collections.unmodifiableCollection(listenerSubscriptionPairs); } } mule-2.0.1/core/src/main/java/org/mule/context/notification/ModelNotification.java0000644000175000017500000000533710745677442030071 0ustar charlescharles/* * $Id: ModelNotification.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.BlockingServerEvent; import org.mule.api.context.notification.ServerNotification; import org.mule.api.model.Model; /** * ModelNotification is fired when an event such as the model starting * occurs. The payload of this event will always be a reference to the model. * * @see org.mule.api.model.Model */ public class ModelNotification extends ServerNotification implements BlockingServerEvent { /** * Serial version */ private static final long serialVersionUID = -1954880336427554435L; public static final int MODEL_INITIALISING = MODEL_EVENT_ACTION_START_RANGE + 1; public static final int MODEL_INITIALISED = MODEL_EVENT_ACTION_START_RANGE + 2; public static final int MODEL_INITIALISING_LISTENERS = MODEL_EVENT_ACTION_START_RANGE + 3; public static final int MODEL_INITIALISED_LISTENERS = MODEL_EVENT_ACTION_START_RANGE + 4; public static final int MODEL_STARTING = MODEL_EVENT_ACTION_START_RANGE + 5; public static final int MODEL_STARTED = MODEL_EVENT_ACTION_START_RANGE + 6; public static final int MODEL_STOPPING = MODEL_EVENT_ACTION_START_RANGE + 7; public static final int MODEL_STOPPED = MODEL_EVENT_ACTION_START_RANGE + 8; public static final int MODEL_DISPOSING = MODEL_EVENT_ACTION_START_RANGE + 9; public static final int MODEL_DISPOSED = MODEL_EVENT_ACTION_START_RANGE + 10; static { registerAction("model initialising", MODEL_INITIALISING); registerAction("model initialised", MODEL_INITIALISED); registerAction("model initialising listener", MODEL_INITIALISING_LISTENERS); registerAction("model initialised listener", MODEL_INITIALISED_LISTENERS); registerAction("model starting", MODEL_STARTING); registerAction("model started", MODEL_STARTED); registerAction("model stopping", MODEL_STOPPING); registerAction("model stopped", MODEL_STOPPED); registerAction("model disposing", MODEL_DISPOSING); registerAction("model disposed", MODEL_DISPOSED); } public ModelNotification(Model model, int action) { super(model, action); resourceIdentifier = model.getName(); } protected String getPayloadToString() { return ((Model) source).getName(); } } mule-2.0.1/core/src/main/java/org/mule/context/notification/ListenerSubscriptionPair.java0000644000175000017500000000352410756576625031467 0ustar charlescharles/* * $Id: ListenerSubscriptionPair.java 10884 2008-02-19 16:02:29Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotificationListener; /** * A simple tuple that stores a listener with an optional subscription (used to match a resource ID). */ public class ListenerSubscriptionPair { private ServerNotificationListener listener; private String subscription = ServerNotificationManager.NULL_SUBSCRIPTION; private boolean nullSubscription = true; /** * For config - must be constructed using the setters */ public ListenerSubscriptionPair() { // empty } public ListenerSubscriptionPair(ServerNotificationListener listener) { setListener(listener); } public ListenerSubscriptionPair(ServerNotificationListener listener, String subscription) { setListener(listener); setSubscription(subscription); } public void setListener(ServerNotificationListener listener) { this.listener = listener; } public void setSubscription(String subscription) { if (null != subscription) { this.subscription = subscription; nullSubscription = false; } } public ServerNotificationListener getListener() { return listener; } public String getSubscription() { return subscription; } public boolean isNullSubscription() { return nullSubscription; } } mule-2.0.1/core/src/main/java/org/mule/context/notification/NotificationException.java0000644000175000017500000000230610745677442030760 0ustar charlescharles/* * $Id: NotificationException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.MuleException; import org.mule.config.i18n.Message; /** * Thrown by the ServerNotification Manager if unrecognised listeners or events are * passed to the manager */ public class NotificationException extends MuleException { /** * Serial version */ private static final long serialVersionUID = -5998352122311445746L; /** * @param message the exception message */ public NotificationException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public NotificationException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/context/notification/SecurityNotification.java0000644000175000017500000000311510745677442030630 0ustar charlescharles/* * $Id: SecurityNotification.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; /** * SecurityNotification is fired when a request for authorisation * occurs. The event may denote successful access or denied access depending on the * type of event. Subscribing to these notifications developers can maintain an * access log, block clients, etc. * * @see org.mule.MuleManager * @see org.mule.api.context.UMOManager */ public class SecurityNotification extends ServerNotification { /** * Serial version */ private static final long serialVersionUID = 5951835321289699941L; public static final int SECURITY_AUTHENTICATION_FAILED = SECURITY_EVENT_ACTION_START_RANGE + 1; static { registerAction("authenitication failed", SECURITY_AUTHENTICATION_FAILED); } public SecurityNotification(org.mule.api.security.SecurityException message, int action) { super(message, action); resourceIdentifier = message.toString(); } protected String getPayloadToString() { return source.toString(); } public String getType() { return TYPE_WARNING; } } mule-2.0.1/core/src/main/java/org/mule/context/notification/ManagementNotification.java0000644000175000017500000000263110746275214031067 0ustar charlescharles/* * $Id: ManagementNotification.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; /** * ManagementNotification is fired when monitored resources such as * internal queues reach capacity * * @see org.mule.MuleManager * @see org.mule.api.context.UMOManager */ public class ManagementNotification extends ServerNotification { /** * Serial version */ private static final long serialVersionUID = -259130553709035786L; // TODO resource status notifications here i.e. public static final int MANAGEMENT_COMPONENT_QUEUE_EXHAUSTED = MANAGEMENT_EVENT_ACTION_START_RANGE + 1; public static final int MANAGEMENT_NODE_PING = MANAGEMENT_EVENT_ACTION_START_RANGE + 2; static { registerAction("service queue exhausted", MANAGEMENT_COMPONENT_QUEUE_EXHAUSTED); registerAction("node ping", MANAGEMENT_NODE_PING); } public ManagementNotification(Object message, int action) { super(message, action); } } mule-2.0.1/core/src/main/java/org/mule/context/notification/ConnectionNotification.java0000644000175000017500000000371410745677442031125 0ustar charlescharles/* * $Id: ConnectionNotification.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; import org.mule.api.transport.Connectable; /** * Is fired by a connector when a connection is made, or disconnected of the * connection fails. */ public class ConnectionNotification extends ServerNotification { /** * Serial version */ private static final long serialVersionUID = -6455441938378523145L; public static final int CONNECTION_CONNECTED = CONNECTION_EVENT_ACTION_START_RANGE + 1; public static final int CONNECTION_FAILED = CONNECTION_EVENT_ACTION_START_RANGE + 2; public static final int CONNECTION_DISCONNECTED = CONNECTION_EVENT_ACTION_START_RANGE + 3; static { registerAction("connected", CONNECTION_CONNECTED); registerAction("connect failed", CONNECTION_FAILED); registerAction("disconnected", CONNECTION_DISCONNECTED); } public ConnectionNotification(Connectable resource, String identifier, int action) { super(resource, action); resourceIdentifier = identifier; } protected String getPayloadToString() { if (source instanceof Connectable) { return ((Connectable) source).getConnectionDescription(); } return source.toString(); } public String getType() { if (action == CONNECTION_DISCONNECTED) { return TYPE_WARNING; } if (action == CONNECTION_FAILED) { return TYPE_ERROR; } return TYPE_INFO; } } mule-2.0.1/core/src/main/java/org/mule/context/notification/OptimisedNotificationHandler.java0000644000175000017500000000437210745677442032262 0ustar charlescharles/* * $Id: OptimisedNotificationHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.ServerNotificationHandler; /** * Optimized to make a quick decision on a particular class of messages. */ public class OptimisedNotificationHandler implements ServerNotificationHandler { private ServerNotificationHandler delegate; private Class type; private boolean dynamic = false; private boolean enabled = false; public OptimisedNotificationHandler(ServerNotificationHandler delegate, Class type) { this.delegate = delegate; this.type = type; dynamic = delegate.isNotificationDynamic(); enabled = delegate.isNotificationEnabled(type); } public boolean isNotificationDynamic() { return dynamic; } /** * This returns a very "conservative" value - it is true if the notification or any subclass would be * accepted. So if it returns false then you can be sure that there is no need to send the * notification. On the other hand, if it returns true there is no guarantee that the notification * "really" will be dispatched to any listener. * * @param notfnClass Either the notification class being generated or some superclass * @return false if there is no need to dispatch the notification */ public boolean isNotificationEnabled(Class notfnClass) { if ((!dynamic) && type.isAssignableFrom(notfnClass)) { return enabled; } else { return delegate.isNotificationEnabled(notfnClass); } } public void fireNotification(ServerNotification notification) { if (isNotificationEnabled(notification.getClass())) { delegate.fireNotification(notification); } } } mule-2.0.1/core/src/main/java/org/mule/context/DefaultMuleContextBuilder.java0000644000175000017500000002012310771256706027040 0ustar charlescharles/* * $Id: DefaultMuleContextBuilder.java 11483 2008-03-22 19:28:06Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context; import org.mule.DefaultMuleContext; import org.mule.api.MuleContext; import org.mule.api.config.MuleConfiguration; import org.mule.api.config.ThreadingProfile; import org.mule.api.context.MuleContextBuilder; import org.mule.api.context.WorkManager; import org.mule.api.context.notification.ConnectionNotificationListener; import org.mule.api.context.notification.CustomNotificationListener; import org.mule.api.context.notification.ExceptionNotificationListener; import org.mule.api.context.notification.ManagementNotificationListener; import org.mule.api.context.notification.ModelNotificationListener; import org.mule.api.context.notification.MuleContextNotificationListener; import org.mule.api.context.notification.RegistryNotificationListener; import org.mule.api.context.notification.RoutingNotificationListener; import org.mule.api.context.notification.SecurityNotificationListener; import org.mule.api.context.notification.ServiceNotificationListener; import org.mule.api.context.notification.TransactionNotificationListener; import org.mule.api.lifecycle.LifecycleManager; import org.mule.config.DefaultMuleConfiguration; import org.mule.context.notification.ConnectionNotification; import org.mule.context.notification.CustomNotification; import org.mule.context.notification.ExceptionNotification; import org.mule.context.notification.ManagementNotification; import org.mule.context.notification.ModelNotification; import org.mule.context.notification.MuleContextNotification; import org.mule.context.notification.RegistryNotification; import org.mule.context.notification.RoutingNotification; import org.mule.context.notification.SecurityNotification; import org.mule.context.notification.ServerNotificationManager; import org.mule.context.notification.ServiceNotification; import org.mule.context.notification.TransactionNotification; import org.mule.lifecycle.GenericLifecycleManager; import org.mule.lifecycle.phases.MuleContextDisposePhase; import org.mule.lifecycle.phases.MuleContextInitialisePhase; import org.mule.lifecycle.phases.MuleContextStartPhase; import org.mule.lifecycle.phases.MuleContextStopPhase; import org.mule.util.ClassUtils; import org.mule.work.DefaultWorkListener; import org.mule.work.MuleWorkManager; import javax.resource.spi.work.WorkListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Implementation of {@link MuleContextBuilder} that uses {@link DefaultMuleContext} * as the default {@link MuleContext} implementation and builds it with defaults * values for {@link MuleConfiguration}, {@link LifecycleManager}, {@link WorkManager}, * {@link WorkListener} and {@link ServerNotificationManager}. */ public class DefaultMuleContextBuilder implements MuleContextBuilder { protected static final Log logger = LogFactory.getLog(DefaultMuleContextBuilder.class); protected MuleConfiguration config; protected LifecycleManager lifecycleManager; protected WorkManager workManager; protected WorkListener workListener; protected ServerNotificationManager notificationManager; /** * {@inheritDoc} */ public MuleContext buildMuleContext() { logger.debug("Building new DefaultMuleContext instance with MuleContextBuilder: " + this); MuleContext muleContext = new DefaultMuleContext(getMuleConfiguration(), getWorkManager(), getWorkListener(), getLifecycleManager(), getNotificationManager()); return muleContext; } public void setMuleConfiguration(MuleConfiguration config) { this.config = config; } public void setWorkManager(WorkManager workManager) { this.workManager = workManager; } public void setWorkListener(WorkListener workListener) { this.workListener = workListener; } public void setNotificationManager(ServerNotificationManager notificationManager) { this.notificationManager = notificationManager; } public void setLifecycleManager(LifecycleManager lifecycleManager) { this.lifecycleManager = lifecycleManager; } protected MuleConfiguration getMuleConfiguration() { if (config != null) { return config; } else { return new DefaultMuleConfiguration(); } } protected LifecycleManager getLifecycleManager() { if (lifecycleManager != null) { return lifecycleManager; } else { LifecycleManager lifecycleManager = new GenericLifecycleManager(); lifecycleManager.registerLifecycle(new MuleContextInitialisePhase()); lifecycleManager.registerLifecycle(new MuleContextStartPhase()); lifecycleManager.registerLifecycle(new MuleContextStopPhase()); lifecycleManager.registerLifecycle(new MuleContextDisposePhase()); return lifecycleManager; } } protected WorkManager getWorkManager() { if (workManager != null) { return workManager; } else { return new MuleWorkManager(ThreadingProfile.DEFAULT_THREADING_PROFILE, "MuleServer"); } } protected WorkListener getWorkListener() { if (workListener != null) { return workListener; } else { return new DefaultWorkListener(); } } protected ServerNotificationManager getNotificationManager() { if (notificationManager != null) { return notificationManager; } else { ServerNotificationManager notificationManager = new ServerNotificationManager(); notificationManager.addInterfaceToType(MuleContextNotificationListener.class, MuleContextNotification.class); notificationManager.addInterfaceToType(ModelNotificationListener.class, ModelNotification.class); notificationManager.addInterfaceToType(RoutingNotificationListener.class, RoutingNotification.class); notificationManager.addInterfaceToType(ServiceNotificationListener.class, ServiceNotification.class); notificationManager.addInterfaceToType(SecurityNotificationListener.class, SecurityNotification.class); notificationManager.addInterfaceToType(ManagementNotificationListener.class, ManagementNotification.class); notificationManager.addInterfaceToType(CustomNotificationListener.class, CustomNotification.class); notificationManager.addInterfaceToType(ConnectionNotificationListener.class, ConnectionNotification.class); notificationManager.addInterfaceToType(RegistryNotificationListener.class, RegistryNotification.class); notificationManager.addInterfaceToType(ExceptionNotificationListener.class, ExceptionNotification.class); notificationManager.addInterfaceToType(TransactionNotificationListener.class, TransactionNotification.class); return notificationManager; } } public String toString() { return ClassUtils.getClassName(getClass()) + "{muleConfiguration=" + config + ", lifecycleManager=" + lifecycleManager + ", workManager=" + workManager + ", workListener=" + workListener + ", notificationManager=" + notificationManager + "}"; } } mule-2.0.1/core/src/main/java/org/mule/context/DefaultMuleContextFactory.java0000644000175000017500000001621710766636440027073 0ustar charlescharles/* * $Id: DefaultMuleContextFactory.java 11370 2008-03-15 03:06:08Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context; import org.mule.MuleServer; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.config.ConfigurationException; import org.mule.api.context.MuleContextBuilder; import org.mule.api.context.MuleContextFactory; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.builders.AutoConfigurationBuilder; import org.mule.config.builders.DefaultsConfigurationBuilder; import org.mule.config.builders.SimpleConfigurationBuilder; import java.util.List; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Default implementation that stores MuleContext in {@link MuleServer} static and * uses {@link DefaultMuleContextBuilder} to build new {@link MuleContext} instances. */ public class DefaultMuleContextFactory implements MuleContextFactory { protected static final Log logger = LogFactory.getLog(DefaultMuleContextBuilder.class); /** * Use default ConfigurationBuilder, default MuleContextBuilder */ public MuleContext createMuleContext() throws InitialisationException, ConfigurationException { // Configure with defaults needed for a feasible/startable MuleContext return createMuleContext(new DefaultsConfigurationBuilder(), new DefaultMuleContextBuilder()); } /** * Use default MuleContextBuilder */ public MuleContext createMuleContext(ConfigurationBuilder configurationBuilder) throws InitialisationException, ConfigurationException { // Create MuleContext using default MuleContextBuilder return createMuleContext(configurationBuilder, new DefaultMuleContextBuilder()); } /** * Use default ConfigurationBuilder */ public MuleContext createMuleContext(MuleContextBuilder muleContextBuilder) throws InitialisationException, ConfigurationException { // Configure with defaults needed for a feasible/startable MuleContext return createMuleContext(new DefaultsConfigurationBuilder(), muleContextBuilder); } /** * {@inheritDoc */ public MuleContext createMuleContext(List configurationBuilders, MuleContextBuilder muleContextBuilder) throws InitialisationException, ConfigurationException { // Create MuleContext MuleContext muleContext = doCreateMuleContext(muleContextBuilder); // Configure for (int i = 0; i < configurationBuilders.size(); i++) { ((ConfigurationBuilder) configurationBuilders.get(i)).configure(muleContext); } return muleContext; } /** * {@inheritDoc */ public MuleContext createMuleContext(ConfigurationBuilder configurationBuilder, MuleContextBuilder muleContextBuilder) throws InitialisationException, ConfigurationException { // Create MuleContext MuleContext muleContext = doCreateMuleContext(muleContextBuilder); // Configure configurationBuilder.configure(muleContext); return muleContext; } // Additional Factory methods provided by this implementation. /** * Creates a new {@link MuleContext} instance from the resource provided. * Implementations of {@link MuleContextFactory} can either use a default * {@link ConfigurationBuilder} to implement this, or do some auto-detection to * determine the {@link ConfigurationBuilder} that should be used. * * @param configResources comma seperated list of configuration resources. * @return * @throws InitialisationException * @throws ConfigurationException */ public MuleContext createMuleContext(String resource) throws InitialisationException, ConfigurationException { return createMuleContext(resource, null); } /** * Creates a new {@link MuleContext} instance from the resource provided. * Implementations of {@link MuleContextFactory} can either use a default * {@link ConfigurationBuilder} to implement this, or do some auto-detection to * determine the {@link ConfigurationBuilder} that should be used. Properties if * provided are used to replace "property placeholder" value in configuration * files. * * @param resource * @param properties * @return * @throws InitialisationException * @throws ConfigurationException */ public MuleContext createMuleContext(String configResources, Properties properties) throws InitialisationException, ConfigurationException { // Create MuleContext MuleContext muleContext = doCreateMuleContext(new DefaultMuleContextBuilder()); // Configure with startup properties if (properties != null && !properties.isEmpty()) { new SimpleConfigurationBuilder(properties).configure(muleContext); } // Automatically resolve Configuration to be used and delegate configuration // to it. new AutoConfigurationBuilder(configResources).configure(muleContext); return muleContext; } /** * Creates a new MuleContext using the given configurationBuilder. Properties if * provided are used to replace "property placeholder" value in configuration * files. * * @param configurationBuilder * @param properties * @return * @throws InitialisationException * @throws ConfigurationException */ public MuleContext createMuleContext(ConfigurationBuilder configurationBuilder, Properties properties) throws InitialisationException, ConfigurationException { // Create MuleContext MuleContext muleContext = doCreateMuleContext(new DefaultMuleContextBuilder()); // Configure with startup properties if (properties != null && !properties.isEmpty()) { new SimpleConfigurationBuilder(properties).configure(muleContext); } // Configure with cconfigurationBuilder configurationBuilder.configure(muleContext); return muleContext; } protected MuleContext doCreateMuleContext(MuleContextBuilder muleContextBuilder) throws InitialisationException { // Create transent registry RegistryContext.getOrCreateRegistry(); // Create muleContext instance and set it in MuleServer MuleContext muleContext = buildMuleContext(muleContextBuilder); MuleServer.setMuleContext(muleContext); // Initialiase MuleContext muleContext.initialise(); return muleContext; } protected MuleContext buildMuleContext(MuleContextBuilder muleContextBuilder) { return muleContextBuilder.buildMuleContext(); } } mule-2.0.1/core/src/main/java/org/mule/DefaultMessageCollection.java0000644000175000017500000001250710771256630025201 0ustar charlescharles/* * $Id: DefaultMessageCollection.java 11481 2008-03-22 19:27:20Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleMessageCollection; import org.mule.api.ThreadSafeAccess; import org.mule.api.transformer.TransformerException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; /** * A {@link org.mule.api.MuleMessage} type that manages a collection of MuleMessage Objects. * Typically this type of message is only used when users explicitly want to work with aggregated or re-sequenced * collections of messages. * * Note that the {@link #getPayload()} for this message will return a {@link java.util.List} of payload objects for * each of the Mule messages stored in this collection. * * Calling {@link #getPayload(Class)} will attempt to transform all payloads and return a {@link java.util.List}. * * The methods {@link #getPayloadAsString()} and {@link #getPayloadAsBytes()} are unsupported, instead users should * call {@link #getPayload(Class)} and pass in the return type byte[].class or String.class. */ public class DefaultMessageCollection extends DefaultMuleMessage implements MuleMessageCollection { private List messageList = new CopyOnWriteArrayList(); public DefaultMessageCollection() { //This will be a collection of payloads super(new CopyOnWriteArrayList()); } /** * Performs a shallow copy * @param msg */ public DefaultMessageCollection(DefaultMessageCollection msg) { this(); for (int i = 0; i < msg.getMessagesAsArray().length; i++) { addMessage(msg.getMessagesAsArray()[i]); } } public void addMessage(MuleMessage message) { getMessageList().add(message); getPayloadList().add(message.getPayload()); } public MuleMessage[] getMessagesAsArray() { List list = getMessageList(); MuleMessage[] messages = new MuleMessage[list.size()]; messages = (MuleMessage[])list.toArray(messages); return messages; } public Object[] getPayloadsAsArray() { List list = getPayloadList(); Object[] payloads = new Object[list.size()]; payloads = list.toArray(payloads); return payloads; } public void removedMessage(MuleMessage message) { getMessageList().remove(message); getPayloadList().remove(message.getPayload()); } public void addMessage(MuleMessage message, int index) { getMessageList().add(index, message); getPayloadList().add(index, message.getPayload()); } public void addMessages(MuleEvent[] events) { for (int i = 0; i < events.length; i++) { MuleEvent event = events[i]; addMessage(event.getMessage()); } } public void addMessages(List messages) { for (Iterator iterator = messages.iterator(); iterator.hasNext();) { MuleMessage message = (MuleMessage) iterator.next(); addMessage(message); } } public void addMessages(MuleMessage[] messages) { for (int i = 0; i < messages.length; i++) { addMessage(messages[i]); } } public MuleMessage getMessage(int index) { return (MuleMessage)getMessageList().get(index); } protected List getMessageList() { return messageList; } protected List getPayloadList() { return (List)getPayload(); } /** * Applies the {@link #getPayload(Class)} call to every message in the collection and returns a * {@link java.util.List} of results. * * {@inheritDoc} */ //@Override public Object getPayload(Class outputType) throws TransformerException { List results = new ArrayList(getMessageList().size()); for (Iterator iterator = getMessageList().iterator(); iterator.hasNext();) { MuleMessage message = (MuleMessage) iterator.next(); results.add(message.getPayload(outputType)); } return results; } public int size() { return getMessageList().size(); } /** * {@inheritDoc} */ //@Override public byte[] getPayloadAsBytes() throws Exception { throw new UnsupportedOperationException("getPayloadAsBytes(), use getPayload(byte[].class)"); } /** * {@inheritDoc} */ //@Override public String getPayloadAsString(String encoding) throws Exception { throw new UnsupportedOperationException("getPayloadAsString(), use getPayload(String[].class)"); } /** * We need to overload this if we find we want to make this class available to users, but the copy will be expensive; * @return */ public ThreadSafeAccess newThreadCopy() { return new DefaultMessageCollection(this); } } mule-2.0.1/core/src/main/java/org/mule/NullSessionHandler.java0000644000175000017500000000257510745677442024065 0ustar charlescharles/* * $Id: NullSessionHandler.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.transport.SessionHandler; /** * A session handler that ignores any session information */ public class NullSessionHandler implements SessionHandler { public void retrieveSessionInfoFromMessage(MuleMessage message, MuleSession session) throws MuleException { // noop } public void storeSessionInfoToMessage(MuleSession session, MuleMessage message) throws MuleException { // noop } /** * The property name of the session id to use when creating the Mule session. by * default the property name "ID" will be used. If no property was set on the * session called "ID" a session id will be automatically generated * * @return the property name of the session id that is set on the session */ public String getSessionIDKey() { return "ID"; } } mule-2.0.1/core/src/main/java/org/mule/ResponseOutputStream.java0000644000175000017500000000233410747501743024465 0ustar charlescharles/* * $Id: ResponseOutputStream.java 10590 2008-01-29 01:39:47Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.Socket; /** * ResponseOutputStream is an output stream associated with the * currently received event. Note that if the stream is from a socket the socket is * also available on this stream so that the socket state can be validated before * writing. */ public class ResponseOutputStream extends BufferedOutputStream { private Socket socket = null; public ResponseOutputStream(OutputStream stream) { super(stream); } public ResponseOutputStream(Socket socket, OutputStream stream) throws IOException { super(stream); this.socket = socket; } public Socket getSocket() { return socket; } } mule-2.0.1/core/src/main/java/org/mule/transaction/0000755000175000017500000000000011351411107021734 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/transaction/package.html0000644000175000017500000000015710204257011024216 0ustar charlescharles Contains the core transaction support classes and exception types. mule-2.0.1/core/src/main/java/org/mule/transaction/XaTransactionFactory.java0000644000175000017500000000313110745677442026731 0ustar charlescharles/* * $Id: XaTransactionFactory.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.api.MuleContext; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transaction.TransactionFactory; import org.mule.config.i18n.CoreMessages; /** * XaTransactionFactory Is used to create/retrieve a Transaction from * a transaction manager configured on the MuleManager. */ public class XaTransactionFactory implements TransactionFactory { public Transaction beginTransaction(MuleContext muleContext) throws TransactionException { try { XaTransaction xat = new XaTransaction(muleContext.getTransactionManager()); xat.begin(); return xat; } catch (Exception e) { throw new TransactionException(CoreMessages.cannotStartTransaction("XA"), e); } } /** * Determines whether this transaction factory creates transactions that are * really transacted or if they are being used to simulate batch actions, such as * using Jms Client Acknowledge. * * @return */ public boolean isTransacted() { return true; } } mule-2.0.1/core/src/main/java/org/mule/transaction/AbstractTransaction.java0000644000175000017500000001140310747501743026565 0ustar charlescharles/* * $Id: AbstractTransaction.java 10590 2008-01-29 01:39:47Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.MuleServer; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.TransactionNotification; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This base class provides low level features for transactions. */ public abstract class AbstractTransaction implements Transaction { protected final transient Log logger = LogFactory.getLog(getClass()); /* * (non-Javadoc) * * @see org.mule.api.Transaction#isRollbackOnly() */ public boolean isRollbackOnly() throws TransactionException { return getStatus() == STATUS_MARKED_ROLLBACK; } /* * (non-Javadoc) * * @see org.mule.api.Transaction#isBegun() */ public boolean isBegun() throws TransactionException { int status = getStatus(); return status != STATUS_NO_TRANSACTION && status != STATUS_UNKNOWN; } /* * (non-Javadoc) * * @see org.mule.api.Transaction#isRolledBack() */ public boolean isRolledBack() throws TransactionException { return getStatus() == STATUS_ROLLEDBACK; } /* * (non-Javadoc) * * @see org.mule.api.Transaction#isCommitted() */ public boolean isCommitted() throws TransactionException { return getStatus() == STATUS_COMMITTED; } /* * (non-Javadoc) * * @see org.mule.api.Transaction#begin() */ public void begin() throws TransactionException { logger.debug("Beginning transaction"); doBegin(); TransactionCoordination.getInstance().bindTransaction(this); fireNotification(new TransactionNotification(this, TransactionNotification.TRANSACTION_BEGAN)); } /* * (non-Javadoc) * * @see org.mule.api.Transaction#commit() */ public void commit() throws TransactionException { try { logger.debug("Committing transaction " + this); if (isRollbackOnly()) { throw new IllegalTransactionStateException(CoreMessages.transactionMarkedForRollback()); } doCommit(); fireNotification(new TransactionNotification(this, TransactionNotification.TRANSACTION_COMMITTED)); } finally { TransactionCoordination.getInstance().unbindTransaction(this); } } /* * (non-Javadoc) * * @see org.mule.api.Transaction#rollback() */ public void rollback() throws TransactionException { try { logger.debug("Rolling back transaction"); setRollbackOnly(); doRollback(); fireNotification(new TransactionNotification(this, TransactionNotification.TRANSACTION_ROLLEDBACK)); } finally { TransactionCoordination.getInstance().unbindTransaction(this); } } /** * Really begin the transaction. Note that resources are enlisted yet. * * @throws TransactionException */ protected abstract void doBegin() throws TransactionException; /** * Commit the transaction on the underlying resource * * @throws TransactionException */ protected abstract void doCommit() throws TransactionException; /** * Rollback the transaction on the underlying resource * * @throws TransactionException */ protected abstract void doRollback() throws TransactionException; /** * Fires a server notification to all registered * {@link org.mule.api.context.notification.listener.TransactionNotificationListener}s. * */ protected void fireNotification(TransactionNotification notification) { // TODO profile this piece of code MuleServer.getMuleContext().fireNotification(notification); } public boolean isXA() { return false; } public void resume() throws TransactionException { throw new IllegalTransactionStateException(CoreMessages.notMuleXaTransaction(this)); } public javax.transaction.Transaction suspend() throws TransactionException { throw new IllegalTransactionStateException(CoreMessages.notMuleXaTransaction(this)); } } mule-2.0.1/core/src/main/java/org/mule/transaction/TransactionRollbackException.java0000644000175000017500000000245710745677442030453 0ustar charlescharles/* * $Id: TransactionRollbackException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; public class TransactionRollbackException extends TransactionException { /** * Serial version */ private static final long serialVersionUID = -3247455113055556221L; /** * @param message the exception message */ public TransactionRollbackException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public TransactionRollbackException(Message message, Throwable cause) { super(message, cause); } public TransactionRollbackException(Throwable cause) { super(CoreMessages.transactionRollbackFailed(), cause); } } mule-2.0.1/core/src/main/java/org/mule/transaction/TransactionTemplate.java0000644000175000017500000001736010747501743026605 0ustar charlescharles/* * $Id: TransactionTemplate.java 10590 2008-01-29 01:39:47Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.api.MuleContext; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionCallback; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.CoreMessages; import java.beans.ExceptionListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class TransactionTemplate { private static final Log logger = LogFactory.getLog(TransactionTemplate.class); private final TransactionConfig config; private final ExceptionListener exceptionListener; private final MuleContext context; public TransactionTemplate(TransactionConfig config, ExceptionListener listener, MuleContext context) { this.config = config; exceptionListener = listener; this.context = context; } public Object execute(TransactionCallback callback) throws Exception { if (config == null) { return callback.doInTransaction(); } else { byte action = config.getAction(); Transaction tx = TransactionCoordination.getInstance().getTransaction(); Transaction suspendedXATx = null; if (action == TransactionConfig.ACTION_NONE && tx != null) { //TODO RM*: I'm not sure there is any value in throwing an exection here, since //there may be a transaction in progress but has nothing to to with this invocation //so maybe we just process outside the tx. Not sure yet //return callback.doInTransaction(); /* Reply from AP: There is value at the moment, at least in having fewer surprises with a more explicit config. Current behavior is that of 'Never' TX attribute in Java EE parlance. What you refer to, however, is the 'Not Supported' TX behavior. A SUSPEND is performed in this case with (optional) RESUME later. */ throw new IllegalTransactionStateException( CoreMessages.transactionAvailableButActionIs("None")); } else if (action == TransactionConfig.ACTION_ALWAYS_BEGIN && tx != null) { if (logger.isDebugEnabled()) { logger.debug("Transaction action is ACTION_ALWAYS_BEGIN, " + "current TX: " + tx); } if (tx.isXA()) { // suspend current transaction suspendedXATx = tx; suspendXATransaction(suspendedXATx); } else { // commit/rollback resolveTransaction(tx); } //transaction will be started below tx = null; } else if (action == TransactionConfig.ACTION_ALWAYS_JOIN && tx == null) { throw new IllegalTransactionStateException( CoreMessages.transactionNotAvailableButActionIs("Always Join")); } if (action == TransactionConfig.ACTION_ALWAYS_BEGIN || (action == TransactionConfig.ACTION_BEGIN_OR_JOIN && tx == null)) { logger.debug("Beginning transaction"); tx = config.getFactory().beginTransaction(context); logger.debug("Transaction successfully started: " + tx); } else { tx = null; } try { Object result = callback.doInTransaction(); if (tx != null) { resolveTransaction(tx); if (suspendedXATx != null) { resumeXATransaction(suspendedXATx); tx = suspendedXATx; } } return result; } catch (Exception e) { if (exceptionListener != null) { logger.info("Exception Caught in Transaction template. Handing off to exception handler: " + exceptionListener); exceptionListener.exceptionThrown(e); } else { logger .info("Exception Caught in Transaction template without any exception listeners defined, exception is rethrown."); if (tx != null) { tx.setRollbackOnly(); } } if (tx != null) { // The exception strategy can choose to route exception // messages // as part of the current transaction. So only rollback the // tx // if it has been marked for rollback (which is the default // case in the // AbstractExceptionListener) if (tx.isRollbackOnly()) { logger.debug("Exception caught: rollback transaction", e); } resolveTransaction(tx); if (suspendedXATx != null) { resumeXATransaction(suspendedXATx); } } // we've handled this exception above. just return null now if (exceptionListener != null) { return null; } else { throw e; } } catch (Error e) { if (tx != null) { logger.info("Error caught, rolling back TX " + tx, e); tx.rollback(); } throw e; } } } protected void resolveTransaction(Transaction tx) throws TransactionException { if (tx.isRollbackOnly()) { logger.debug("Transaction has been marked rollbackOnly, rolling it back: " + tx); tx.rollback(); } else { logger.debug("Committing transaction " + tx); tx.commit(); } } protected void suspendXATransaction(Transaction tx) throws TransactionException { if (logger.isDebugEnabled()) { logger.debug("Suspending " + tx); } tx.suspend(); if (logger.isDebugEnabled()) { logger.debug("Successfully suspended " + tx); logger.debug("Unbinding the following TX from the current context: " + tx); } TransactionCoordination.getInstance().unbindTransaction(tx); } protected void resumeXATransaction(Transaction tx) throws TransactionException { if (logger.isDebugEnabled()) { logger.debug("Re-binding and Resuming " + tx); } TransactionCoordination.getInstance().bindTransaction(tx); tx.resume(); } } mule-2.0.1/core/src/main/java/org/mule/transaction/AbstractSingleResourceTransaction.java0000644000175000017500000000754010745677442031456 0ustar charlescharles/* * $Id: AbstractSingleResourceTransaction.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.CoreMessages; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; /** * This abstract class can be used as a base class for transactions that can enlist * only one resource (such as a JMS session or JDBC connection). */ public abstract class AbstractSingleResourceTransaction extends AbstractTransaction { protected volatile Object key; protected volatile Object resource; protected final AtomicBoolean started = new AtomicBoolean(false); protected final AtomicBoolean committed = new AtomicBoolean(false); protected final AtomicBoolean rolledBack = new AtomicBoolean(false); protected final AtomicBoolean rollbackOnly = new AtomicBoolean(false); /* * (non-Javadoc) * * @see org.mule.api.Transaction#begin() */ public void begin() throws TransactionException { super.begin(); started.compareAndSet(false, true); } /* * (non-Javadoc) * * @see org.mule.api.Transaction#commit() */ public void commit() throws TransactionException { super.commit(); committed.compareAndSet(false, true); } /* * (non-Javadoc) * * @see org.mule.api.Transaction#rollback() */ public void rollback() throws TransactionException { super.rollback(); rolledBack.compareAndSet(false, true); } /* * (non-Javadoc) * * @see org.mule.api.Transaction#getStatus() */ public int getStatus() throws TransactionStatusException { if (rolledBack.get()) { return STATUS_ROLLEDBACK; } if (committed.get()) { return STATUS_COMMITTED; } if (rollbackOnly.get()) { return STATUS_MARKED_ROLLBACK; } if (started.get()) { return STATUS_ACTIVE; } return STATUS_NO_TRANSACTION; } /* * (non-Javadoc) * * @see org.mule.api.Transaction#getResource(java.lang.Object) */ public Object getResource(Object key) { return key != null && this.key == key ? this.resource : null; } /* * (non-Javadoc) * * @see org.mule.api.Transaction#hasResource(java.lang.Object) */ public boolean hasResource(Object key) { return key != null && this.key == key; } /* * (non-Javadoc) * * @see org.mule.api.Transaction#bindResource(java.lang.Object, * java.lang.Object) */ public void bindResource(Object key, Object resource) throws TransactionException { if (key == null) { throw new IllegalTransactionStateException(CoreMessages.transactionCannotBindToNullKey()); } if (resource == null) { throw new IllegalTransactionStateException(CoreMessages.transactionCannotBindNullResource()); } if (this.key != null) { throw new IllegalTransactionStateException(CoreMessages.transactionSingleResourceOnly()); } this.key = key; this.resource = resource; } /* * (non-Javadoc) * * @see org.mule.api.Transaction#setRollbackOnly() */ public void setRollbackOnly() { rollbackOnly.set(true); } public Object getId() { return key; } } mule-2.0.1/core/src/main/java/org/mule/transaction/MuleTransactionConfig.java0000644000175000017500000001327210764322372027056 0ustar charlescharles/* * $Id: MuleTransactionConfig.java 11278 2008-03-07 20:26:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transaction.TransactionFactory; import org.mule.transaction.constraints.ConstraintFilter; import org.mule.util.ClassUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** *

    MuleTransactionConfig defines transaction configuration for a * transactional endpoint. */ public class MuleTransactionConfig implements TransactionConfig { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(MuleTransactionConfig.class); public static final String ACTION_NONE_STRING = "NONE"; public static final String ACTION_ALWAYS_BEGIN_STRING = "ALWAYS_BEGIN"; public static final String ACTION_BEGIN_OR_JOIN_STRING = "BEGIN_OR_JOIN"; public static final String ACTION_ALWAYS_JOIN_STRING = "ALWAYS_JOIN"; public static final String ACTION_JOIN_IF_POSSIBLE_STRING = "JOIN_IF_POSSIBLE"; private TransactionFactory factory; private byte action = ACTION_NONE; private ConstraintFilter constraint = null; private int timeout; public MuleTransactionConfig() { // todo timeout = RegistryContext.getConfiguration().getDefaultTransactionTimeout(); } /* * (non-Javadoc) * * @see org.mule.umo.UMOTransactionConfig#getFactory() */ public TransactionFactory getFactory() { return factory; } /* * (non-Javadoc) * * @see org.mule.umo.UMOTransactionConfig#setFactory(org.mule.umo.UMOTransactionFactory) */ public void setFactory(TransactionFactory factory) { if (factory == null) { throw new IllegalArgumentException("Transaction Factory cannot be null"); } this.factory = factory; } /* * (non-Javadoc) * * @see org.mule.umo.UMOTransactionConfig#getAction() */ public byte getAction() { return action; } /* * (non-Javadoc) * * @see org.mule.umo.UMOTransactionConfig#setAction(byte) */ public void setAction(byte action) { this.action = action; } public void setActionAsString(String action) { if (ACTION_ALWAYS_BEGIN_STRING.equals(action)) { this.action = ACTION_ALWAYS_BEGIN; } else if (ACTION_BEGIN_OR_JOIN_STRING.equals(action)) { this.action = ACTION_BEGIN_OR_JOIN; } else if (ACTION_ALWAYS_JOIN_STRING.equals(action)) { this.action = ACTION_ALWAYS_JOIN; } else if (ACTION_JOIN_IF_POSSIBLE_STRING.equals(action)) { this.action = ACTION_JOIN_IF_POSSIBLE; } else if (ACTION_NONE_STRING.equals(action)) { this.action = ACTION_NONE; } else { throw new IllegalArgumentException("Action " + action + " is not recognised as a begin action."); } } public String getActionAsString() { switch (action) { case ACTION_ALWAYS_BEGIN : return ACTION_ALWAYS_BEGIN_STRING; case ACTION_BEGIN_OR_JOIN : return ACTION_BEGIN_OR_JOIN_STRING; case ACTION_ALWAYS_JOIN : return ACTION_ALWAYS_JOIN_STRING; case ACTION_JOIN_IF_POSSIBLE : return ACTION_JOIN_IF_POSSIBLE_STRING; default : return ACTION_NONE_STRING; } } public boolean isTransacted() { return factory != null && factory.isTransacted() && action != ACTION_NONE; } public ConstraintFilter getConstraint() { if (constraint == null) { return null; } try { return (ConstraintFilter) constraint.clone(); } catch (CloneNotSupportedException e) { logger.fatal("Failed to clone ContraintFilter: " + e.getMessage(), e); return constraint; } } public void setConstraint(ConstraintFilter constraint) { this.constraint = constraint; } public int getTimeout() { return timeout; } public void setTimeout(int timeout) { this.timeout = timeout; } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("Transaction{factory=") .append(factory) .append(", action=") .append(getActionAsString()) .append(", timeout=") .append(timeout) .append("}"); return buf.toString(); } public int hashCode() { return ClassUtils.hash(new Object[]{factory, new Byte(action), constraint, new Integer(timeout)}); } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; final MuleTransactionConfig other = (MuleTransactionConfig) obj; return ClassUtils.equal(factory, other.factory) && ClassUtils.equal(new Byte(action), new Byte(other.action)) && ClassUtils.equal(constraint, other.constraint) && ClassUtils.equal(new Integer(timeout), new Integer(other.timeout)); } } mule-2.0.1/core/src/main/java/org/mule/transaction/TransactionInProgressException.java0000644000175000017500000000235210664630335030775 0ustar charlescharles/* * $Id: TransactionInProgressException.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.config.i18n.Message; /** *

    * TransactionInProgressException is thrown if a new transaction is * started when there is one already in progress. */ public class TransactionInProgressException extends TransactionStatusException { /** * Serial version */ private static final long serialVersionUID = -6041127507191183323L; /** * @param message the exception message */ public TransactionInProgressException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public TransactionInProgressException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/transaction/TransactionStatusException.java0000644000175000017500000000244510745677442030202 0ustar charlescharles/* * $Id: TransactionStatusException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; public class TransactionStatusException extends TransactionException { /** * Serial version */ private static final long serialVersionUID = -2408368544426562868L; /** * @param message the exception message */ public TransactionStatusException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public TransactionStatusException(Message message, Throwable cause) { super(message, cause); } public TransactionStatusException(Throwable cause) { super(CoreMessages.transactionCannotReadState(), cause); } } mule-2.0.1/core/src/main/java/org/mule/transaction/TransactionCoordination.java0000644000175000017500000000476510745677442027477 0ustar charlescharles/* * $Id: TransactionCoordination.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.CoreMessages; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public final class TransactionCoordination { protected static final Log logger = LogFactory.getLog(TransactionCoordination.class); private static final TransactionCoordination instance = new TransactionCoordination(); private static final ThreadLocal transactions = new ThreadLocal(); // @GuardedBy("this") private int txCounter = 0; /** Do not instanciate. */ private TransactionCoordination() { super(); } public static TransactionCoordination getInstance() { return instance; } public Transaction getTransaction() { return (Transaction) transactions.get(); } public void unbindTransaction(Transaction transaction) throws TransactionException { try { Transaction oldTx = (Transaction) transactions.get(); if (oldTx != null && !oldTx.equals(transaction)) { throw new IllegalTransactionStateException(CoreMessages.transactionCannotUnbind()); } } finally { transactions.set(null); synchronized (this) { if (txCounter > 0) { txCounter--; } } } } public void bindTransaction(Transaction transaction) throws TransactionException { Transaction oldTx = (Transaction) transactions.get(); if (oldTx != null) { throw new IllegalTransactionStateException(CoreMessages.transactionAlreadyBound()); } transactions.set(transaction); synchronized (this) { txCounter++; if (logger.isDebugEnabled()) { logger.debug("Binding new transaction (" + txCounter + ") " + transaction); } } } } mule-2.0.1/core/src/main/java/org/mule/transaction/XaTransaction.java0000644000175000017500000003466710747501743025413 0ustar charlescharles/* * $Id: XaTransaction.java 10590 2008-01-29 01:39:47Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.MuleServer; import org.mule.api.transaction.TransactionException; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.transaction.HeuristicRollbackException; import javax.transaction.InvalidTransactionException; import javax.transaction.RollbackException; import javax.transaction.SystemException; import javax.transaction.Transaction; import javax.transaction.TransactionManager; import javax.transaction.xa.XAResource; /** * XaTransaction represents an XA transaction in Mule. */ public class XaTransaction extends AbstractTransaction { /** * The inner JTA transaction */ private Transaction transaction = null; /** * Map of enlisted resources */ private Map resources = new HashMap(); private TransactionManager txManager; public XaTransaction(TransactionManager txManager) { this.txManager = txManager; } protected void doBegin() throws TransactionException { if (txManager == null) { throw new IllegalStateException( CoreMessages.objectNotRegistered("Transaction Manager", "Transaction Manager").getMessage()); } try { txManager.begin(); synchronized (this) { transaction = txManager.getTransaction(); } } catch (Exception e) { throw new TransactionException(CoreMessages.cannotStartTransaction("XA"), e); } } protected synchronized void doCommit() throws TransactionException { try { /* JTA spec quotes (parts highlighted by AP), the same applies to both TransactionManager and UserTransaction: 3.2.2 Completing a Transaction The TransactionManager.commit method completes the transaction currently associated with the calling thread. **** After the commit method returns, the calling thread is not associated with a transaction. **** If the commit method is called when the thread is not associated with any transaction context, the TM throws an exception. In some implementations, the commit operation is restricted to the transaction originator only. If the calling thread is not allowed to commit the transaction, the TM throws an exception. The TransactionManager.rollback method rolls back the transaction associated with the current thread. **** After the rollback method completes, the thread is associated with no transaction. **** And the following block about Transaction (note there's no thread-tx disassociation clause) 3.3.3 Transaction Completion The Transaction.commit and Transaction.rollback methods allow the target object to be comitted or rolled back. The calling thread is not required to have the same transaction associated with the thread. If the calling thread is not allowed to commit the transaction, the transaction manager throws an exception. So what it meant was that one can't use Transaction.commit()/rollback(), as it doesn't properly disassociate the thread of execution from the current transaction. There's no JTA API-way to do that after the call, so the thread's transaction is subject to manual recovery process. Instead TransactionManager or UserTransaction must be used. */ // TODO AP check this way to get to TM really works in Mule 2 TransactionManager txManager = MuleServer.getMuleContext().getTransactionManager(); delistResources(); txManager.commit(); } catch (RollbackException e) { throw new TransactionRollbackException(CoreMessages.transactionMarkedForRollback(), e); } catch (HeuristicRollbackException e) { throw new TransactionRollbackException(CoreMessages.transactionMarkedForRollback(), e); } catch (Exception e) { throw new IllegalTransactionStateException(CoreMessages.transactionCommitFailed(), e); } finally { /* MUST nullify XA ref here, otherwise Transaction.getStatus() doesn't match javax.transaction.Transaction.getStatus(). Must return STATUS_NO_TRANSACTION and not STATUS_COMMITTED. TransactionCoordination unbinds the association immediately on this method's exit. */ this.transaction = null; closeResources(); } } protected void doRollback() throws TransactionRollbackException { try { /* JTA spec quotes (parts highlighted by AP), the same applies to both TransactionManager and UserTransaction: 3.2.2 Completing a Transaction The TransactionManager.commit method completes the transaction currently associated with the calling thread. **** After the commit method returns, the calling thread is not associated with a transaction. **** If the commit method is called when the thread is not associated with any transaction context, the TM throws an exception. In some implementations, the commit operation is restricted to the transaction originator only. If the calling thread is not allowed to commit the transaction, the TM throws an exception. The TransactionManager.rollback method rolls back the transaction associated with the current thread. **** After the rollback method completes, the thread is associated with no transaction. **** And the following block about Transaction (note there's no thread-tx disassociation clause) 3.3.3 Transaction Completion The Transaction.commit and Transaction.rollback methods allow the target object to be comitted or rolled back. The calling thread is not required to have the same transaction associated with the thread. If the calling thread is not allowed to commit the transaction, the transaction manager throws an exception. So what it meant was that one can't use Transaction.commit()/rollback(), as it doesn't properly disassociate the thread of execution from the current transaction. There's no JTA API-way to do that after the call, so the thread's transaction is subject to manual recovery process. Instead TransactionManager or UserTransaction must be used. */ TransactionManager txManager = MuleServer.getMuleContext().getTransactionManager(); delistResources(); txManager.rollback(); } catch (SystemException e) { throw new TransactionRollbackException(e); } catch (Exception e) { throw new TransactionRollbackException(e); } finally { /* MUST nullify XA ref here, otherwise Transaction.getStatus() doesn't match javax.transaction.Transaction.getStatus(). Must return STATUS_NO_TRANSACTION and not STATUS_COMMITTED. TransactionCoordination unbinds the association immediately on this method's exit. */ this.transaction = null; closeResources(); } } public synchronized int getStatus() throws TransactionStatusException { if (transaction == null) { return STATUS_NO_TRANSACTION; } try { return transaction.getStatus(); } catch (SystemException e) { throw new TransactionStatusException(e); } } public void setRollbackOnly() { if (transaction == null) { throw new IllegalStateException("Current thread is not associated with a transaction."); } try { synchronized (this) { transaction.setRollbackOnly(); } } catch (SystemException e) { throw (IllegalStateException) new IllegalStateException( "Failed to set transaction to rollback only: " + e.getMessage() ).initCause(e); } } public synchronized Object getResource(Object key) { return resources.get(key); } public synchronized boolean hasResource(Object key) { return resources.containsKey(key); } public synchronized void bindResource(Object key, Object resource) throws TransactionException { if (resources.containsKey(key)) { throw new IllegalTransactionStateException( CoreMessages.transactionResourceAlreadyListedForKey(key)); } resources.put(key, resource); } // moved here from connection wrapper public boolean enlistResource(XAResource resource) throws TransactionException { TransactionManager txManager = MuleServer.getMuleContext().getTransactionManager(); try { Transaction jtaTransaction = txManager.getTransaction(); if (jtaTransaction == null) { throw new TransactionException(MessageFactory.createStaticMessage("XATransaction is null")); } return jtaTransaction.enlistResource(resource); } catch (RollbackException e) { throw new TransactionException(e); } catch (SystemException e) { throw new TransactionException(e); } } public boolean delistResource(XAResource resource, int tmflag) throws TransactionException { TransactionManager txManager = MuleServer.getMuleContext().getTransactionManager(); try { Transaction jtaTransaction = txManager.getTransaction(); if (jtaTransaction == null) { throw new TransactionException(CoreMessages.noJtaTransactionAvailable(Thread.currentThread())); } return jtaTransaction.delistResource(resource, tmflag); } catch (SystemException e) { throw new TransactionException(e); } } public String toString() { return transaction == null ? " " : transaction.toString(); } public Transaction getTransaction() { return transaction; } public boolean isXA() { return true; } public void resume() throws TransactionException { TransactionManager txManager = MuleServer.getMuleContext().getTransactionManager(); if (txManager == null) { throw new IllegalStateException( CoreMessages.objectNotRegistered("TransactionManager", "Transaction Manager").getMessage()); } try { txManager.resume(transaction); } catch (InvalidTransactionException e) { throw new TransactionException(e); } catch (SystemException e) { throw new TransactionException(e); } } public Transaction suspend() throws TransactionException { TransactionManager txManager = MuleServer.getMuleContext().getTransactionManager(); if (txManager == null) { throw new IllegalStateException( CoreMessages.objectNotRegistered("TransactionManager", "Transaction Manager").getMessage()); } try { transaction = txManager.suspend(); } catch (SystemException e) { throw new TransactionException(e); } return transaction; } protected void delistResources() { Iterator i = resources.entrySet().iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry) i.next(); if (entry.getValue() instanceof MuleXaObject) { //there is need for reuse object try { ((MuleXaObject) entry.getValue()).delist(); } catch (Exception e) { logger.error("Cann't delist resource " + entry.getValue() + " " + e); } } } } protected void closeResources() { Iterator i = resources.entrySet().iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry) i.next(); if (entry.getValue() instanceof MuleXaObject) { MuleXaObject xaObject = (MuleXaObject) entry.getValue(); if (!xaObject.isReuseObject()) { try { xaObject.close(); } catch (Exception e) { logger.error("Cann't close resource " + xaObject); } } } } } public static interface MuleXaObject { void close() throws Exception; void setReuseObject(boolean reuseObject); boolean isReuseObject(); //enlist is called indirectly boolean delist() throws Exception; /** * Get XAConnection or XASession from wrapper / proxy * * @return return javax.sql.XAConnection for jdbc or javax.jms.XASession for jms */ Object getTargetObject(); String SET_REUSE_OBJECT_METHOD_NAME = "setReuseObject"; String IS_REUSE_OBJECT_METHOD_NAME = "isReuseObject"; String DELIST_METHOD_NAME = "delist"; String GET_TARGET_OBJECT_METHOD_NAME = "getTargetObject"; String CLOSE_METHOD_NAME = "close"; } } mule-2.0.1/core/src/main/java/org/mule/transaction/TransactionNotInProgressException.java0000644000175000017500000000227310664630335031460 0ustar charlescharles/* * $Id: TransactionNotInProgressException.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.config.i18n.Message; /** *

    * TransactionNotInProgressException TODO (document class) */ public class TransactionNotInProgressException extends TransactionStatusException { /** * Serial version */ private static final long serialVersionUID = -4825546092229025015L; /** * @param message the exception message */ public TransactionNotInProgressException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public TransactionNotInProgressException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/transaction/constraints/0000755000175000017500000000000011351411106024302 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/transaction/constraints/package.html0000644000175000017500000000021710204257011026562 0ustar charlescharles Contains the transaction contraint filter used to control how and when transactions are committed. mule-2.0.1/core/src/main/java/org/mule/transaction/constraints/BatchConstraint.java0000644000175000017500000000320210745677442030257 0ustar charlescharles/* * $Id: BatchConstraint.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction.constraints; import org.mule.api.MuleEvent; /** * BatchConstraint is a filter that counts on every execution and * returns true when the batch size value equals the execution count. */ // @ThreadSafe public class BatchConstraint extends ConstraintFilter { // @GuardedBy(this) private int batchSize = 1; // @GuardedBy(this) private int batchCount = 0; public boolean accept(MuleEvent event) { synchronized (this) { batchCount++; return batchCount == batchSize; } } public int getBatchSize() { synchronized (this) { return batchSize; } } public synchronized void setBatchSize(int batchSize) { synchronized (this) { this.batchSize = batchSize; } } public Object clone() throws CloneNotSupportedException { synchronized (this) { BatchConstraint clone = (BatchConstraint) super.clone(); clone.setBatchSize(batchSize); for (int i = 0; i < batchCount; i++) { clone.accept(null); } return clone; } } } mule-2.0.1/core/src/main/java/org/mule/transaction/constraints/ManualConstraint.java0000644000175000017500000000141210745677442030454 0ustar charlescharles/* * $Id: ManualConstraint.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction.constraints; import org.mule.api.MuleEvent; /** * ManualConstraint always returns false, meaning that the transaction * should be committed manually. */ // @ThreadSafe public class ManualConstraint extends ConstraintFilter { public boolean accept(MuleEvent event) { return false; } } mule-2.0.1/core/src/main/java/org/mule/transaction/constraints/ConstraintFilter.java0000644000175000017500000000145210745677442030470 0ustar charlescharles/* * $Id: ConstraintFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction.constraints; import org.mule.api.MuleEvent; // @ThreadSafe public class ConstraintFilter implements Cloneable { public ConstraintFilter() { super(); } public boolean accept(MuleEvent event) { return true; } public Object clone() throws CloneNotSupportedException { return super.clone(); } } mule-2.0.1/core/src/main/java/org/mule/transaction/lookup/0000755000175000017500000000000011351411107023245 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/core/src/main/java/org/mule/transaction/lookup/WeblogicTransactionManagerLookupFactory.javamule-2.0.1/core/src/main/java/org/mule/transaction/lookup/WeblogicTransactionManagerLookupFactory.ja0000644000175000017500000000131510664630335033553 0ustar charlescharles/* * $Id: WeblogicTransactionManagerLookupFactory.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction.lookup; public class WeblogicTransactionManagerLookupFactory extends GenericTransactionManagerLookupFactory { public WeblogicTransactionManagerLookupFactory() { setJndiName("javax.transaction.TransactionManager"); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/core/src/main/java/org/mule/transaction/lookup/GenericTransactionManagerLookupFactory.javamule-2.0.1/core/src/main/java/org/mule/transaction/lookup/GenericTransactionManagerLookupFactory.jav0000644000175000017500000000773410774254333033577 0ustar charlescharles/* * $Id: GenericTransactionManagerLookupFactory.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction.lookup; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transaction.TransactionManagerFactory; import org.mule.config.i18n.CoreMessages; import org.mule.util.JndiContextHelper; import org.mule.util.StringUtils; import java.util.Map; import javax.naming.Context; import javax.naming.NamingException; import javax.transaction.TransactionManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A factory performing a JNDI lookup for TransactionManager.

    NOTE: Java EE 1.4 * specification does not mandate application server vendors to expose a * TransactionManager for direct use, nor does it name the standard way to locate it. * For some servers the TransactionManager is not even available in the global JNDI * namespace, so your only bet is to run Mule in the same JVM as the application * server. */ public class GenericTransactionManagerLookupFactory implements TransactionManagerFactory, Initialisable { protected final Log logger = LogFactory.getLog(getClass()); protected Context context; private Map environment; private TransactionManager txManager; private String jndiName; public String getJndiName() { return jndiName; } public void setJndiName(final String jndiName) { this.jndiName = jndiName; } public TransactionManager getTxManager() { return txManager; } public void setTxManager(final TransactionManager txManager) { this.txManager = txManager; } public Map getEnvironment() { return environment; } public void setEnvironment(final Map environment) { this.environment = environment; } public Context getContext() { return context; } public void setContext(final Context context) { this.context = context; } /** @see org.mule.api.transaction.TransactionManagerFactory#create() */ public TransactionManager create() throws Exception { // implementing the Initilisable interface does not call it?? initialise(); if (txManager == null) { txManager = (TransactionManager) context.lookup(jndiName); } return txManager; } /** * Method used to perform any initialisation work. If a fatal error occurs during * initialisation an InitialisationException should be thrown, * causing the Mule instance to shutdown. If the error is recoverable, say by * retrying to connect, a RecoverableException should be thrown. * There is no guarantee that by throwing a Recoverable exception that the Mule * instance will not shut down. * * @throws org.mule.api.lifecycle.InitialisationException * if a fatal error occurs * causing the Mule instance to shutdown */ public void initialise() throws InitialisationException { if (txManager == null && StringUtils.isEmpty(StringUtils.trim(jndiName))) { throw new InitialisationException(CoreMessages.propertiesNotSet("jndiName"), this); } try { if (context == null) { context = JndiContextHelper.initialise(getEnvironment()); } } catch (NamingException e) { throw new InitialisationException(CoreMessages.failedToCreate("Jndi context"), e, this); } } } mule-2.0.1/core/src/main/java/org/mule/transaction/lookup/JBossTransactionManagerLookupFactory.java0000644000175000017500000000127010664630335033367 0ustar charlescharles/* * $Id: JBossTransactionManagerLookupFactory.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction.lookup; public class JBossTransactionManagerLookupFactory extends GenericTransactionManagerLookupFactory { public JBossTransactionManagerLookupFactory() { setJndiName("java:/TransactionManager"); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/core/src/main/java/org/mule/transaction/lookup/WebsphereTransactionManagerLookupFactory.javamule-2.0.1/core/src/main/java/org/mule/transaction/lookup/WebsphereTransactionManagerLookupFactory.j0000644000175000017500000000770510755024144033610 0ustar charlescharles/* * $Id: WebsphereTransactionManagerLookupFactory.java 10802 2008-02-14 11:39:16Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction.lookup; import org.mule.api.transaction.TransactionManagerFactory; import org.mule.util.ClassUtils; import java.lang.reflect.Method; import javax.transaction.TransactionManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * The code borrowed from Spring's * org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean. See * the apache-2.0.license file in Mule's licenses folder for details. * * @see com.ibm.ws.Transaction.TransactionManagerFactory#getTransactionManager * @see com.ibm.ejs.jts.jta.JTSXA#getTransactionManager * @see com.ibm.ejs.jts.jta.TransactionManagerFactory#getTransactionManager */ public class WebsphereTransactionManagerLookupFactory implements TransactionManagerFactory { private static final String FACTORY_CLASS_5_1_AND_ABOVE = "com.ibm.ws.Transaction.TransactionManagerFactory"; private static final String FACTORY_CLASS_5_0 = "com.ibm.ejs.jts.jta.TransactionManagerFactory"; private static final String FACTORY_CLASS_4 = "com.ibm.ejs.jts.jta.JTSXA"; private final Log logger = LogFactory.getLog(getClass()); /** * This constructor retrieves the WebSphere TransactionManager factory class, so * we can get access to the JTA TransactionManager. */ public TransactionManager create() { Class clazz; TransactionManager transactionManager; try { logger.debug("Trying WebSphere 5.1+: " + FACTORY_CLASS_5_1_AND_ABOVE); clazz = ClassUtils.loadClass(FACTORY_CLASS_5_1_AND_ABOVE, this.getClass()); logger.info("Found WebSphere 5.1+: " + FACTORY_CLASS_5_1_AND_ABOVE); } catch (ClassNotFoundException ex) { logger.debug("Could not find WebSphere 5.1+ TransactionManager factory class", ex); try { logger.debug("Trying WebSphere 5.0: " + FACTORY_CLASS_5_0); clazz = ClassUtils.loadClass(FACTORY_CLASS_5_0, this.getClass()); logger.info("Found WebSphere 5.0: " + FACTORY_CLASS_5_0); } catch (ClassNotFoundException ex2) { logger.debug("Could not find WebSphere 5.0 TransactionManager factory class", ex2); try { logger.debug("Trying WebSphere 4: " + FACTORY_CLASS_4); clazz = ClassUtils.loadClass(FACTORY_CLASS_4, this.getClass()); logger.info("Found WebSphere 4: " + FACTORY_CLASS_4); } catch (ClassNotFoundException ex3) { logger.debug("Could not find WebSphere 4 TransactionManager factory class", ex3); throw new RuntimeException( "Couldn't find any WebSphere TransactionManager factory class, " + "neither for WebSphere version 5.1 nor 5.0 nor 4", ex); } } } try { Method method = clazz.getMethod("getTransactionManager", (Class[])null); transactionManager = (TransactionManager) method.invoke(null, (Object[])null); } catch (Exception ex) { throw new RuntimeException("Found WebSphere TransactionManager factory class [" + clazz.getName() + "], but couldn't invoke its static 'getTransactionManager' method", ex); } return transactionManager; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/core/src/main/java/org/mule/transaction/lookup/Resin3TransactionManagerLookupFactory.javamule-2.0.1/core/src/main/java/org/mule/transaction/lookup/Resin3TransactionManagerLookupFactory.java0000644000175000017500000000127710664630335033521 0ustar charlescharles/* * $Id: Resin3TransactionManagerLookupFactory.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction.lookup; public class Resin3TransactionManagerLookupFactory extends GenericTransactionManagerLookupFactory { public Resin3TransactionManagerLookupFactory() { setJndiName("java:comp/TransactionManager"); } } mule-2.0.1/core/src/main/java/org/mule/transaction/lookup/JRunTransactionManagerLookupFactory.java0000644000175000017500000000126510664630335033231 0ustar charlescharles/* * $Id: JRunTransactionManagerLookupFactory.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction.lookup; public class JRunTransactionManagerLookupFactory extends GenericTransactionManagerLookupFactory { public JRunTransactionManagerLookupFactory() { setJndiName("java:/TransactionManager"); } } mule-2.0.1/core/src/main/java/org/mule/transaction/IllegalTransactionStateException.java0000644000175000017500000000225710664630335031260 0ustar charlescharles/* * $Id: IllegalTransactionStateException.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.config.i18n.Message; /** * IllegalTransactionStateException TODO (document class) */ public class IllegalTransactionStateException extends TransactionStatusException { /** * Serial version */ private static final long serialVersionUID = -1062247038945694389L; /** * @param message the exception message */ public IllegalTransactionStateException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public IllegalTransactionStateException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/config/0000755000175000017500000000000011351411114020652 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/config/package.html0000644000175000017500000000021310204257011023127 0ustar charlescharles Mule Providers Mule Xml configuration support and general configuration classes. mule-2.0.1/core/src/main/java/org/mule/config/bootstrap/0000755000175000017500000000000011351411114022667 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/config/bootstrap/SimpleRegistryBootstrap.java0000644000175000017500000002131210774254333030431 0ustar charlescharles/* * $Id: SimpleRegistryBootstrap.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.bootstrap; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.context.MuleContextAware; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.registry.ObjectProcessor; import org.mule.api.registry.Registry; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.util.ClassUtils; import org.mule.util.PropertiesUtils; import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.util.Enumeration; import java.util.Iterator; import java.util.Map; import java.util.Properties; /** * This object will load objects defined in a file called registry-bootstrap.properties into the local registry. * This allows modules and transports to make certain objects available by default. The most common use case is for a * module or transport to load stateless transformers into the registry. * For this file to be located it must be present in the modules META-INF directory under * META-INF/services/org/mule/config/ *

    * The format of this file is a simple key / value pair. i.e. * * myobject=org.foo.MyObject * *

    * Will register an instance of MyObject with a key of 'myobject'. If you don't care about the object name and want to * ensure that the ojbect gets a unique name you can use - * * object.1=org.foo.MyObject * object.2=org.bar.MyObject * *

    * or * * myFoo=org.foo.MyObject * myBar=org.bar.MyObject * *

    *

    * Loading transformers has a slightly different notation since you can define the 'returnClass' and 'name'of * the transformer as parameters i.e. *

    * * transformer.1=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=byte[] * transformer.2=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=java.lang.String, name=JMSMessageToString * transformer.3=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=java.util.Hashtable) * *

    * Note that the key used for transformers must be 'transformer.x' where 'x' is a sequential number. The transformer name will be * automatically generated as JMSMessageToXXX where XXX is the return class name i.e. JMSMessageToString unless a 'name' * parameter is specified. If no 'returnClass' is specified the defualt in the transformer will be used. *

    * Note that all objects defined have to have a default constructor. They can implement injection interfaces such as * {@link org.mule.api.context.MuleContextAware} and lifecylce interfaces such as {@link org.mule.api.lifecycle.Initialisable}. */ public class SimpleRegistryBootstrap implements Initialisable, MuleContextAware { public static final String SERVICE_PATH = "META-INF/services/org/mule/config/"; public static final String REGISTRY_PROPERTIES = "registry-bootstrap.properties"; public String TRANSFORMER_PREFIX = "transformer."; public String OBJECT_PREFIX = "object."; protected MuleContext context; /** {@inheritDoc} */ public void setMuleContext(MuleContext context) { this.context = context; } /** {@inheritDoc} */ public void initialise() throws InitialisationException { Enumeration e = ClassUtils.getResources(SERVICE_PATH + REGISTRY_PROPERTIES, getClass()); while (e.hasMoreElements()) { try { URL url = (URL) e.nextElement(); Properties p = new Properties(); p.load(url.openStream()); process(p); } catch (Exception e1) { throw new InitialisationException(e1, this); } } } protected void process(Properties props) throws NoSuchMethodException, IllegalAccessException, MuleException, InvocationTargetException, ClassNotFoundException, InstantiationException { registerTransformers(props, context.getRegistry()); registerUnnamedObjects(props, context.getRegistry()); //this must be called last as it clears the properties map registerObjects(props, context.getRegistry()); } private void registerTransformers(Properties props, Registry registry) throws MuleException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException, ClassNotFoundException { int i = 1; String transString = props.getProperty(TRANSFORMER_PREFIX + i); String name = null; String returnClassString = null; while (transString != null) { Class returnClass = null; int x = transString.indexOf(","); if (x > -1) { Properties p = PropertiesUtils.getPropertiesFromString(transString.substring(i + 1), ','); name = p.getProperty("name", null); returnClassString = p.getProperty("returnClass", null); } if (returnClassString != null) { if (returnClassString.equals("byte[]")) { returnClass = byte[].class; } else { returnClass = ClassUtils.loadClass(returnClassString, getClass()); } } String transClass = (x == -1 ? transString : transString.substring(0, x)); Transformer trans = (Transformer) ClassUtils.instanciateClass(transClass, ClassUtils.NO_ARGS); if (!(trans instanceof DiscoverableTransformer)) { throw new TransformerException(CoreMessages.transformerNotImplementDiscoverable(trans)); } if (returnClass != null) { trans.setReturnClass(returnClass); } if (name != null) { trans.setName(name); } else { //This will generate a default name for the transformer name = trans.getName(); //We then prefix the name to ensure there is less chance of conflict if the user registers // the transformer with the same name trans.setName("_" + name); } registry.registerTransformer(trans); props.remove(TRANSFORMER_PREFIX + i++); name = null; returnClass = null; transString = props.getProperty(TRANSFORMER_PREFIX + i); } } private void registerObjects(Properties props, Registry registry) throws MuleException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException, ClassNotFoundException { //Note that caling the other register methods first will have removed any processed entries for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); Object object = ClassUtils.instanciateClass(entry.getValue().toString(), ClassUtils.NO_ARGS); String key = entry.getKey().toString(); Class meta = Object.class; if(object instanceof ObjectProcessor) { meta = ObjectProcessor.class; } registry.registerObject(key, object, meta); } props.clear(); } private void registerUnnamedObjects(Properties props, Registry registry) throws MuleException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, InstantiationException, ClassNotFoundException { int i = 1; String objectString = props.getProperty(OBJECT_PREFIX + i); while (objectString != null) { Object o = ClassUtils.instanciateClass(objectString, ClassUtils.NO_ARGS); Class meta = Object.class; if(o instanceof ObjectProcessor) { meta = ObjectProcessor.class; } registry.registerObject(OBJECT_PREFIX + i + "#" + o.hashCode(), o, meta); props.remove(OBJECT_PREFIX + i++); objectString = props.getProperty(OBJECT_PREFIX + i); } } } mule-2.0.1/core/src/main/java/org/mule/config/builders/0000755000175000017500000000000011351411114022463 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/config/builders/AutoConfigurationBuilder.java0000644000175000017500000001011210760620270030300 0ustar charlescharles/* * $Id: AutoConfigurationBuilder.java 11007 2008-02-25 20:10:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.builders; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.config.ConfigurationException; import org.mule.config.ConfigResource; import org.mule.config.i18n.CoreMessages; import org.mule.util.ClassUtils; import org.mule.util.StringUtils; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Configures Mule from a configuration resource or comma seperated list of configuration resources by * auto-detecting the ConfigurationBuilder to use for each resource. This is resolved by either checking the * classpath for config modules e.g. spring-config or by using the file extention or a combination. */ public class AutoConfigurationBuilder extends AbstractResourceConfigurationBuilder { protected static final Log logger = LogFactory.getLog(AutoConfigurationBuilder.class); public AutoConfigurationBuilder(String resource) throws ConfigurationException { super(resource); } public AutoConfigurationBuilder(String[] resources) throws ConfigurationException { super(resources); } public AutoConfigurationBuilder(ConfigResource[] resources) { super(resources); } protected void doConfigure(MuleContext muleContext) throws ConfigurationException { autoConfigure(muleContext, configResources); } /** * @param muleContext * @param resource * @return * @throws ConfigurationException */ protected void autoConfigure(MuleContext muleContext, ConfigResource[] configResources) throws ConfigurationException { Map configsMap = new LinkedHashMap(); for (int i = 0; i < configResources.length; i++) { String configExtension = StringUtils.substringAfterLast( (configResources[i]).getUrl().getFile(), "."); List configs = (List) configsMap.get(configExtension); if (configs == null) { configs = new ArrayList(); configsMap.put(configExtension, configs); } configs.add(configResources[i]); } try { Properties props = new Properties(); props.load(ClassUtils.getResource("configuration-builders.properties", this.getClass()).openStream()); Iterator iterator = configsMap.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry e = (Map.Entry) iterator.next(); String extension = (String) e.getKey(); List configs = (List) e.getValue(); String className = (String) props.get(extension); if (className == null || !ClassUtils.isClassOnPath(className, this.getClass())) { throw new ConfigurationException( CoreMessages.configurationBuilderNoMatching(createConfigResourcesString())); } ConfigResource[] constructorArg = new ConfigResource[configs.size()]; System.arraycopy(configs.toArray(), 0, constructorArg, 0, configs.size()); ConfigurationBuilder cb = (ConfigurationBuilder) ClassUtils.instanciateClass(className, new Object[]{constructorArg}); cb.configure(muleContext); } } catch (ConfigurationException e) { throw e; } catch (Exception e) { throw new ConfigurationException(e); } } } mule-2.0.1/core/src/main/java/org/mule/config/builders/AbstractResourceConfigurationBuilder.java0000644000175000017500000001030710766204322032653 0ustar charlescharles/* * $Id: AbstractResourceConfigurationBuilder.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.builders; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.config.ConfigurationException; import org.mule.config.ConfigResource; import org.mule.config.i18n.CoreMessages; import org.mule.util.StringUtils; import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Abstract {@link ConfigurationBuilder} implementation used for * ConfigurationBuider's that use one of more configuration resources of the same * type that are defined using strings or {@link ConfigResource} objects. It is recommended that * {@link org.mule.config.ConfigResource} objects are used over strings since they can be more descriptive, but * Strings will be supported for quite some time. */ public abstract class AbstractResourceConfigurationBuilder extends AbstractConfigurationBuilder { protected static final Log logger = LogFactory.getLog(AutoConfigurationBuilder.class); protected ConfigResource[] configResources; /** * @param configResources a comma separated list of configuration files to load, * this should be accessible on the classpath or filesystem * @throws org.mule.api.config.ConfigurationException usually if the config resources cannot be loaded */ public AbstractResourceConfigurationBuilder(String configResources) throws ConfigurationException { this.configResources = loadConfigResources(StringUtils.splitAndTrim(configResources, ",; ")); } /** * @param configResources an array of configuration files to load, this should be * accessible on the classpath or filesystem * @throws org.mule.api.config.ConfigurationException usually if the config resources cannot be loaded */ public AbstractResourceConfigurationBuilder(String[] configResources) throws ConfigurationException { this.configResources = loadConfigResources(configResources); } /** * @param configResources an array Reader oject that provides acces to a configuration either locally or remotely */ public AbstractResourceConfigurationBuilder(ConfigResource[] configResources) { this.configResources = configResources; } /** * Override to check for existence of configResouce before invocation, and set * resources n configuration afterwards. */ public void configure(MuleContext muleContext) throws ConfigurationException { if (configResources == null) { throw new ConfigurationException(CoreMessages.objectIsNull("Configuration Resources")); } super.configure(muleContext); logger.info(CoreMessages.configurationBuilderSuccess(this, createConfigResourcesString())); } protected ConfigResource[] loadConfigResources(String[] configs) throws ConfigurationException { try { configResources = new ConfigResource[configs.length]; for (int i = 0; i < configs.length; i++) { configResources[i] = new ConfigResource(configs[i]); } return configResources; } catch (IOException e) { throw new ConfigurationException(e); } } protected String createConfigResourcesString() { StringBuffer configResourcesString = new StringBuffer(); configResourcesString.append("["); for (int i = 0; i < configResources.length; i++) { configResourcesString.append(configResources[i]); if (i < configResources.length - 1) { configResourcesString.append(", "); } } configResourcesString.append("]"); return configResourcesString.toString(); } } mule-2.0.1/core/src/main/java/org/mule/config/builders/DefaultsConfigurationBuilder.java0000644000175000017500000001050210777050076031153 0ustar charlescharles/* * $Id: DefaultsConfigurationBuilder.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.builders; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.config.MuleProperties; import org.mule.api.config.ThreadingProfile; import org.mule.api.model.Model; import org.mule.api.registry.Registry; import org.mule.config.ChainedThreadingProfile; import org.mule.config.bootstrap.SimpleRegistryBootstrap; import org.mule.endpoint.DefaultEndpointFactory; import org.mule.model.seda.SedaModel; import org.mule.security.MuleSecurityManager; import org.mule.transport.SingleAttemptConnectionStrategy; import org.mule.util.queue.MemoryPersistenceStrategy; import org.mule.util.queue.QueueManager; import org.mule.util.queue.TransactionalQueueManager; /** * Configures defaults required by Mule. This configuration builder is used to * configure mule with these defaults when no other ConfigurationBuilder that sets * these is being used. This is used by both AbstractMuleTestCase and MuleClient. *
    *
    * Default instances of the following are configured: *

  • {@link SimpleRegistryBootstrap} *
  • {@link QueueManager} *
  • {@link SecurityManager} *
  • {@link DefaultEndpointFactory} *
  • {@link Model} systemModel *
  • {@link ThreadingProfile} defaultThreadingProfile *
  • {@link ThreadingProfile} defaultMessageDispatcherThreadingProfile *
  • {@link ThreadingProfile} defaultMessageRequesterThreadingProfile *
  • {@link ThreadingProfile} defaultMessageReceiverThreadingProfile *
  • {@link ThreadingProfile} defaultComponentThreadingProfile */ public class DefaultsConfigurationBuilder extends AbstractConfigurationBuilder { protected void doConfigure(MuleContext muleContext) throws Exception { configureDefaults(muleContext.getRegistry()); } protected void configureDefaults(Registry registry) throws MuleException { registry.registerObject(MuleProperties.OBJECT_MULE_SIMPLE_REGISTRY_BOOTSTRAP, new SimpleRegistryBootstrap()); QueueManager queueManager = new TransactionalQueueManager(); queueManager.setPersistenceStrategy(new MemoryPersistenceStrategy()); registry.registerObject(MuleProperties.OBJECT_QUEUE_MANAGER, queueManager); registry.registerObject(MuleProperties.OBJECT_SECURITY_MANAGER, new MuleSecurityManager()); registry.registerObject(MuleProperties.OBJECT_MULE_ENDPOINT_FACTORY, new DefaultEndpointFactory()); ThreadingProfile defaultThreadingProfile = new ChainedThreadingProfile(); defaultThreadingProfile.setThreadWaitTimeout(30); defaultThreadingProfile.setMaxThreadsActive(10); defaultThreadingProfile.setMaxThreadsIdle(10); defaultThreadingProfile.setMaxBufferSize(0); defaultThreadingProfile.setThreadTTL(60000); defaultThreadingProfile.setPoolExhaustedAction(ThreadingProfile.WHEN_EXHAUSTED_RUN); registry.registerObject(MuleProperties.OBJECT_DEFAULT_THREADING_PROFILE, defaultThreadingProfile); registry.registerObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_RECEIVER_THREADING_PROFILE, new ChainedThreadingProfile(defaultThreadingProfile)); registry.registerObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_REQUESTER_THREADING_PROFILE, new ChainedThreadingProfile(defaultThreadingProfile)); registry.registerObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_DISPATCHER_THREADING_PROFILE, new ChainedThreadingProfile(defaultThreadingProfile)); registry.registerObject(MuleProperties.OBJECT_DEFAULT_COMPONENT_THREADING_PROFILE, new ChainedThreadingProfile(defaultThreadingProfile)); registry.registerObject(MuleProperties.OBJECT_DEFAULT_CONNECTION_STRATEGY, new SingleAttemptConnectionStrategy()); Model systemModel = new SedaModel(); systemModel.setName(MuleProperties.OBJECT_SYSTEM_MODEL); registry.registerModel(systemModel); } } mule-2.0.1/core/src/main/java/org/mule/config/builders/SimpleConfigurationBuilder.java0000644000175000017500000000263410777050076030644 0ustar charlescharles/* * $Id: SimpleConfigurationBuilder.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.builders; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.registry.Registry; import java.util.Map; /** * This simple ConfgurationBuilder implementation. This is useful for registering any * Map of objects with the {@link Registry} via the {@link ConfigurationBuilder} * interface. This is useful for example for the registration of "startup properties" * which are provided at startup and then used to fill "property placeholders" in * other configuration mechanisms such as XML. */ public class SimpleConfigurationBuilder extends AbstractConfigurationBuilder { protected Map objects; public SimpleConfigurationBuilder(Map objects) { this.objects = objects; } protected void doConfigure(MuleContext muleContext) throws Exception { if (objects != null && objects.size() > 0) { muleContext.getRegistry().registerObjects(objects); } } } mule-2.0.1/core/src/main/java/org/mule/config/builders/AbstractConfigurationBuilder.java0000644000175000017500000000330110746140215031135 0ustar charlescharles/* * $Id: AbstractConfigurationBuilder.java 10521 2008-01-24 16:45:01Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.builders; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.config.ConfigurationException; import org.mule.config.i18n.CoreMessages; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A support class for {@link org.mule.api.config.ConfigurationBuilder} implementations * that handles the logic of creating config arrays and {@link java.util.Properties} * arguments * * @see org.mule.api.config.ConfigurationBuilder */ public abstract class AbstractConfigurationBuilder implements ConfigurationBuilder { protected static final Log logger = LogFactory.getLog(AbstractConfigurationBuilder.class); private boolean configured = false; public void configure(MuleContext muleContext) throws ConfigurationException { try { doConfigure(muleContext); configured = true; } catch (Exception e) { logger.error(CoreMessages.configurationBuilderError(this), e); throw new ConfigurationException(e); } } protected abstract void doConfigure(MuleContext muleContext) throws Exception; public boolean isConfigured() { return configured; } } mule-2.0.1/core/src/main/java/org/mule/config/NamingExceptionReader.java0000644000175000017500000000417010745677442025762 0ustar charlescharles/* * $Id: NamingExceptionReader.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import org.mule.api.config.ExceptionReader; import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.naming.Name; import javax.naming.NamingException; public class NamingExceptionReader implements ExceptionReader { /** * Displayed when no remaining or resolved name found. */ protected static final String MISSING_NAME_DISPLAY_VALUE = ""; public String getMessage(Throwable t) { return (t instanceof NamingException ? ((NamingException) t).toString(true) : ""); } public Throwable getCause(Throwable t) { return (t instanceof NamingException ? ((NamingException) t).getCause() : null); } public Class getExceptionType() { return NamingException.class; } /** * Returns a map of the non-stanard information stored on the exception * * @param t the exception to extract the information from * @return a map of the non-stanard information stored on the exception */ public Map getInfo(Throwable t) { if (t instanceof NamingException) { NamingException e = (NamingException) t; Map info = new HashMap(); final Name remainingName = e.getRemainingName(); final Name resolvedName = e.getResolvedName(); info.put("Remaining Name", remainingName == null ? MISSING_NAME_DISPLAY_VALUE : remainingName.toString()); info.put("Resolved Name", resolvedName == null ? MISSING_NAME_DISPLAY_VALUE : resolvedName.toString()); return info; } else { return Collections.EMPTY_MAP; } } } mule-2.0.1/core/src/main/java/org/mule/config/support/0000755000175000017500000000000011351411114022366 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/config/support/InheritedModel.java0000644000175000017500000000147110745677442026160 0ustar charlescharles/* * $Id: InheritedModel.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.support; import org.mule.model.AbstractModel; /** * TODO */ public class InheritedModel extends AbstractModel { public String getType() { return "inherited"; } //@Override public String getName() { return super.getName() + "#" + hashCode(); } public String getParentName() { return super.getName(); } } mule-2.0.1/core/src/main/java/org/mule/config/factories/0000755000175000017500000000000011351411114022631 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/config/factories/HostNameFactory.java0000644000175000017500000000262110761272625026563 0ustar charlescharles/* * $Id: HostNameFactory.java 11070 2008-02-27 14:37:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.factories; import org.mule.api.config.PropertyFactory; import java.net.InetAddress; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Extracts the local hostname from the local system */ public class HostNameFactory implements PropertyFactory { protected static final Log logger = LogFactory.getLog(HostNameFactory.class); public Object create(Map props) throws Exception { // we could use getCanonicalHostName here. however, on machines behind // NAT firewalls it seems that is often the NAT address, which corresponds // to an interface on the firewall, not on the local machine. try { return InetAddress.getLocalHost().getHostName(); } catch (Exception e) { logger.warn("Unable to resolve hostname, defaulting to 'localhost': " + e.getMessage(), e); return "localhost"; } } } mule-2.0.1/core/src/main/java/org/mule/config/ReaderInputStream.java0000644000175000017500000000152010664703640025127 0ustar charlescharles/* * $Id: ReaderInputStream.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import java.io.IOException; import java.io.InputStream; import java.io.Reader; public class ReaderInputStream extends InputStream { private Reader reader = null; public ReaderInputStream(Reader reader) { this.reader = reader; } /** * @see java.io.InputStream#read() */ public int read() throws IOException { return reader.read(); } } mule-2.0.1/core/src/main/java/org/mule/config/QueueProfile.java0000644000175000017500000000467610746275214024157 0ustar charlescharles/* * $Id: QueueProfile.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import org.mule.api.lifecycle.InitialisationException; import org.mule.util.queue.QueueConfiguration; import org.mule.util.queue.QueueManager; /** * QueueProfile determines how an internal queue for a service will * behave */ public class QueueProfile { private int maxOutstandingMessages = 0; private boolean persistent = false; public QueueProfile() { super(); } public QueueProfile(int maxOutstandingMessages, boolean persistent) { this.maxOutstandingMessages = maxOutstandingMessages; this.persistent = persistent; } public QueueProfile(QueueProfile queueProfile) { this.maxOutstandingMessages = queueProfile.getMaxOutstandingMessages(); this.persistent = queueProfile.isPersistent(); } /** * This specifies the number of messages that can be queued before it starts * blocking. * * @return the max number of messages that will be queued */ public int getMaxOutstandingMessages() { return maxOutstandingMessages; } /** * This specifies the number of messages that can be queued before it starts * blocking. * * @param maxOutstandingMessages the max number of messages that will be queued */ public void setMaxOutstandingMessages(int maxOutstandingMessages) { this.maxOutstandingMessages = maxOutstandingMessages; } public boolean isPersistent() { return persistent; } public void setPersistent(boolean persistent) { this.persistent = persistent; } public void configureQueue(String component, QueueManager queueManager) throws InitialisationException { QueueConfiguration qc = new QueueConfiguration(maxOutstandingMessages, persistent); queueManager.setQueueConfiguration(component, qc); } public String toString() { return "QueueProfile{maxOutstandingMessage=" + maxOutstandingMessages + ", persistent=" + persistent + "}"; } } mule-2.0.1/core/src/main/java/org/mule/config/i18n/0000755000175000017500000000000011351411114021431 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/config/i18n/CoreMessages.java0000644000175000017500000010204611002221467024662 0ustar charlescharles/* * $Id: CoreMessages.java 11604 2008-04-18 22:39:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.i18n; import org.mule.AbstractExceptionListener; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.model.EntryPointResolver; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.routing.OutboundRouter; import org.mule.api.routing.ResponseRouterCollection; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.config.MuleManifest; import org.mule.util.ClassUtils; import org.mule.util.DateUtils; import org.mule.util.StringMessageUtils; import org.mule.util.StringUtils; import java.util.Date; public class CoreMessages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("core"); public static Message versionNotSet() { return createMessage(BUNDLE_PATH, 1); } public static Message serverStartedAt(long startDate) { return createMessage(BUNDLE_PATH, 2, new Date(startDate)); } public static Message serverShutdownAt(Date date) { return createMessage(BUNDLE_PATH, 3, date); } public static Message agentsRunning() { return createMessage(BUNDLE_PATH, 4); } public static Message notSet() { return createMessage(BUNDLE_PATH, 5); } public static Message version() { String version = StringUtils.defaultString(MuleManifest.getProductVersion(), notSet().getMessage()); return createMessage(BUNDLE_PATH, 6, version); } public static Message shutdownNormally(Date date) { return createMessage(BUNDLE_PATH, 7, date); } public static Message serverWasUpForDuration(long duration) { String formattedDuration = DateUtils.getFormattedDuration(duration); return createMessage(BUNDLE_PATH, 8, formattedDuration); } public static Message configNotFoundUsage() { return createMessage(BUNDLE_PATH, 9); } public static Message fatalErrorWhileRunning() { return createMessage(BUNDLE_PATH, 10); } public static Message rootStackTrace() { return createMessage(BUNDLE_PATH, 11); } public static Message exceptionStackIs() { return createMessage(BUNDLE_PATH, 12); } public static Message messageIsOfType(Class type) { return createMessage(BUNDLE_PATH, 18, ClassUtils.getSimpleName(type)); } public static Message fatalErrorInShutdown() { return createMessage(BUNDLE_PATH, 20); } public static Message normalShutdown() { return createMessage(BUNDLE_PATH, 21); } public static Message none() { return createMessage(BUNDLE_PATH, 22); } public static Message notClustered() { return createMessage(BUNDLE_PATH, 23); } public static Message failedToRouterViaEndpoint(ImmutableEndpoint endpoint) { return createMessage(BUNDLE_PATH, 30, endpoint); } public static Message cannotUseDisposedConnector() { return createMessage(BUNDLE_PATH, 32); } public static Message connectorCausedError() { return connectorCausedError(null); } public static Message connectorCausedError(Object connector) { return createMessage(BUNDLE_PATH, 33, connector); } public static Message endpointIsNullForListener() { return createMessage(BUNDLE_PATH, 34); } public static Message listenerAlreadyRegistered(EndpointURI endpointUri) { return createMessage(BUNDLE_PATH, 35, endpointUri); } public static Message objectAlreadyInitialised(String name) { return createMessage(BUNDLE_PATH, 37, name); } public static Message componentCausedErrorIs(Object component) { return createMessage(BUNDLE_PATH, 38, component); } public static Message objectFailedToInitialise(String string) { return createMessage(BUNDLE_PATH, 40, string); } public static Message failedToStop(String string) { return createMessage(BUNDLE_PATH, 41, string); } public static Message failedToStart(String string) { return createMessage(BUNDLE_PATH, 42, string); } public static Message proxyPoolTimedOut() { return createMessage(BUNDLE_PATH, 43); } public static Message failedToGetPooledObject() { return createMessage(BUNDLE_PATH, 44); } public static Message objectIsNull(String string) { return createMessage(BUNDLE_PATH, 45, string); } public static Message componentNotRegistered(String name) { return createMessage(BUNDLE_PATH, 46, name); } public static Message failedtoRegisterOnEndpoint(String name, Object endpointURI) { return createMessage(BUNDLE_PATH, 47, name, endpointURI); } public static Message failedToUnregister(String name, Object endpointURI) { return createMessage(BUNDLE_PATH, 48, name, endpointURI); } public static Message endpointIsMalformed(String endpoint) { return createMessage(BUNDLE_PATH, 51, endpoint); } public static Message transformFailedBeforeFilter() { return createMessage(BUNDLE_PATH, 52); } public static Message transformUnexpectedType(Class class1, Class returnClass) { return createMessage(BUNDLE_PATH, 53, ClassUtils.getSimpleName(class1), ClassUtils.getSimpleName(returnClass)); } public static Message transformOnObjectUnsupportedTypeOfEndpoint(String name, Class class1, ImmutableEndpoint endpoint) { return createMessage(BUNDLE_PATH, 54, name, StringMessageUtils.toString(class1), (endpoint != null ? endpoint.getEndpointURI() : null)); } public static Message transformFailedFrom(Class clazz) { return createMessage(BUNDLE_PATH, 55, clazz); } public static Message encryptionStrategyNotSet() { return createMessage(BUNDLE_PATH, 56); } public static Message failedToLoadTransformer(String direction, String transformer) { return createMessage(BUNDLE_PATH, 57, direction, transformer); } public static Message failedToLoad(String string) { return createMessage(BUNDLE_PATH, 58, string); } public static Message messageNotSupportedByAdapter(String string, String string2) { return createMessage(BUNDLE_PATH, 59, string, string2); } public static Message tooManyAcceptableMethodsOnObjectForTypes(Object object, Object types) { return createMessage(BUNDLE_PATH, 60, StringMessageUtils.toString(object), StringMessageUtils.toString(types)); } public static Message cannotSetPropertyOnObjectWithParamType(String property, Class class1, Class class2) { return createMessage(BUNDLE_PATH, 61, property, StringMessageUtils.toString(class1), StringMessageUtils.toString(class2)); } public static Message noComponentForEndpoint() { return createMessage(BUNDLE_PATH, 64); } public static Message failedToCreate(String string) { return createMessage(BUNDLE_PATH, 65, string); } public static Message noCorrelationId() { return createMessage(BUNDLE_PATH, 66); } public static Object failedToDispose(String string) { return createMessage(BUNDLE_PATH, 67, string); } public static Message failedToInvoke(String string) { return createMessage(BUNDLE_PATH, 68, string); } public static Message cannotReadPayloadAsBytes(String type) { return createMessage(BUNDLE_PATH, 69, type); } public static Message cannotReadPayloadAsString(String type) { return createMessage(BUNDLE_PATH, 70, type); } public static Message routingFailedOnEndpoint(String name, Object endpointURI) { return createMessage(BUNDLE_PATH, 72, name, endpointURI); } public static Message cannotInstanciateFinder(String serviceFinder) { return createMessage(BUNDLE_PATH, 73, serviceFinder); } public static Message failedToCreateObjectWith(String string, Object arg) { return createMessage(BUNDLE_PATH, 74, string, arg); } public static Message objectNotSetInService(Object object, Object service) { return createMessage(BUNDLE_PATH, 75, object, service); } public static Message objectNotFound(String object) { return createMessage(BUNDLE_PATH, 76, object); } public static Message objectNotFound(String type, String object) { return createMessage(BUNDLE_PATH, 76, type + ": " + object); } public static Message transactionMarkedForRollback() { return createMessage(BUNDLE_PATH, 77); } public static Message transactionCannotBindToNullKey() { return createMessage(BUNDLE_PATH, 78); } public static Message transactionCannotBindNullResource() { return createMessage(BUNDLE_PATH, 79); } public static Message transactionSingleResourceOnly() { return createMessage(BUNDLE_PATH, 80); } public static Message noCurrentEventForTransformer() { return createMessage(BUNDLE_PATH, 81); } public static Message objectNotRegistered(String type, String name) { return createMessage(BUNDLE_PATH, 82, type, name); } public static Message failedToSetPropertiesOn(String string) { return createMessage(BUNDLE_PATH, 83, string); } public static Message failedToCreateConnectorFromUri(EndpointURI uri) { return createMessage(BUNDLE_PATH, 84, uri); } public static Message initialisationFailure(String string) { return createMessage(BUNDLE_PATH, 85, string); } public static Message failedToCreateEndpointFromLocation(String string) { return createMessage(BUNDLE_PATH, 87, string); } public static Message managerAlreadyStarted() { return createMessage(BUNDLE_PATH, 88); } public static Message noEndpointsForRouter() { return createMessage(BUNDLE_PATH, 89); } public static Message responseTimedOutWaitingForId(int timeout, Object id) { return createMessage(BUNDLE_PATH, 90, String.valueOf(timeout), id); } public static Message failedToRecevieWithTimeout(Object endpoint, long timeout) { return createMessage(BUNDLE_PATH, 93, endpoint, String.valueOf(timeout)); } public static Message failedToWriteMessageToStore(Object id, String storeName) { return createMessage(BUNDLE_PATH, 94, id, storeName); } public static Message failedToReadFromStore(String absolutePath) { return createMessage(BUNDLE_PATH, 95, absolutePath); } public static Message cannotStartTransaction(String string) { return createMessage(BUNDLE_PATH, 96, string); } public static Message transactionCommitFailed() { return createMessage(BUNDLE_PATH, 97); } public static Message transactionRollbackFailed() { return createMessage(BUNDLE_PATH, 98); } public static Message transactionCannotReadState() { return createMessage(BUNDLE_PATH, 99); } public static Message transactionResourceAlreadyListedForKey(Object key) { return createMessage(BUNDLE_PATH, 100, key); } public static Message noOutboundRouterSetOn(String string) { return createMessage(BUNDLE_PATH, 101, string); } public static Message transactionAvailableButActionIs(String string) { return createMessage(BUNDLE_PATH, 103, string); } public static Message transactionNotAvailableButActionIs(String string) { return createMessage(BUNDLE_PATH, 104, string); } public static Message noCatchAllEndpointSet() { return createMessage(BUNDLE_PATH, 105); } public static Message interruptedQueuingEventFor(Object object) { return createMessage(BUNDLE_PATH, 106, object); } public static Message transactionCannotUnbind() { return createMessage(BUNDLE_PATH, 107); } public static Message transactionAlreadyBound() { return createMessage(BUNDLE_PATH, 108); } public static Message methodWithParamsNotFoundOnObject(String method, Object class1, Class class2) { return createMessage(BUNDLE_PATH, 109, method, StringMessageUtils.toString(class1), StringMessageUtils.toString(class2)); } public static Message transformFailed(String from, String to) { return createMessage(BUNDLE_PATH, 110, from, to); } public static Message cryptoFailure() { return createMessage(BUNDLE_PATH, 112); } public static Message schemeNotCompatibleWithConnector(String scheme, Class expectedClass) { return createMessage(BUNDLE_PATH, 115, scheme, expectedClass); } public static Message noEntryPointFoundWithArgs(Object object, Object args) { return createMessage(BUNDLE_PATH, 116, StringMessageUtils.toString(object), StringMessageUtils.toString(args)); } public static Message authNoSecurityProvider(String providerName) { return createMessage(BUNDLE_PATH, 117, providerName); } public static Message transactionCanOnlyBindToResources(String string) { return createMessage(BUNDLE_PATH, 120, string); } public static Message cannotLoadFromClasspath(String string) { return createMessage(BUNDLE_PATH, 122, string); } public static Message failedToReadPayload() { return createMessage(BUNDLE_PATH, 124); } public static Message endpointNotFound(String endpoint) { return createMessage(BUNDLE_PATH, 126, endpoint); } public static Message eventProcessingFailedFor(String name) { return createMessage(BUNDLE_PATH, 127, name); } public static Message failedToDispatchToReplyto(ImmutableEndpoint endpoint) { return createMessage(BUNDLE_PATH, 128, endpoint); } public static Message authTypeNotRecognised(String string) { return createMessage(BUNDLE_PATH, 131, string); } public static Message authSecurityManagerNotSet() { return createMessage(BUNDLE_PATH, 132); } public static Message authSetButNoContext(String name) { return createMessage(BUNDLE_PATH, 133, name); } public static Message authDeniedOnEndpoint(EndpointURI endpointURI) { return createMessage(BUNDLE_PATH, 134, endpointURI); } public static Message authFailedForUser(Object user) { return createMessage(BUNDLE_PATH, 135, user); } public static Message authEndpointMustSendOrReceive() { return createMessage(BUNDLE_PATH, 136); } public static Message transactionManagerAlreadySet() { return createMessage(BUNDLE_PATH, 140); } public static Message failedToCreateManagerInstance(String className) { return createMessage(BUNDLE_PATH, 144, className); } public static Message failedToClone(String string) { return createMessage(BUNDLE_PATH, 145, string); } public static Message exceptionOnConnectorNotExceptionListener(String name) { return createMessage(BUNDLE_PATH, 146, name); } public static Message uniqueIdNotSupportedByAdapter(String name) { return createMessage(BUNDLE_PATH, 147, name); } public static Message serverNotificationManagerNotEnabled() { return createMessage(BUNDLE_PATH, 150); } public static Message failedToScheduleWork() { return createMessage(BUNDLE_PATH, 151); } public static Message authNoCredentials() { return createMessage(BUNDLE_PATH, 152); } public static Message valueIsInvalidFor(String value, String parameter) { return createMessage(BUNDLE_PATH, 154, value, parameter); } public static Message connectorWithProtocolNotRegistered(String scheme) { return createMessage(BUNDLE_PATH, 156, scheme); } public static Message propertyIsNotSupportedType(String property, Class expected, Class actual) { return createMessage(BUNDLE_PATH, 157, property, StringMessageUtils.toString(expected), StringMessageUtils.toString(actual)); } public static Message propertyIsNotSupportedType(String property, Class[] expected, Class actual) { return createMessage(BUNDLE_PATH, 157, property, StringMessageUtils.toString(expected), StringMessageUtils.toString(actual)); } public static Message containerAlreadyRegistered(String name) { return createMessage(BUNDLE_PATH, 155, name); } public static Message resourceManagerNotStarted() { return createMessage(BUNDLE_PATH, 161); } public static Message resourceManagerDirty() { return createMessage(BUNDLE_PATH, 162); } public static Message resourceManagerNotReady() { return createMessage(BUNDLE_PATH, 163); } public static Message reconnectStrategyFailed(Class strategy, String description) { return createMessage(BUNDLE_PATH, 164, StringMessageUtils.toString(strategy), description); } public static Message cannotSetObjectOnceItHasBeenSet(String string) { return createMessage(BUNDLE_PATH, 165, string); } public static Message eventTypeNotRecognised(String string) { return createMessage(BUNDLE_PATH, 166, string); } public static Message componentIsStopped(String name) { return createMessage(BUNDLE_PATH, 167, name); } public static Message propertyIsNotSetOnEvent(String property) { return createMessage(BUNDLE_PATH, 168, property); } public static Message descriptorAlreadyExists(String name) { return createMessage(BUNDLE_PATH, 171, name); } public static Message failedToInvokeRestService(String service) { return createMessage(BUNDLE_PATH, 172, service); } public static Message authNoEncryptionStrategy(String strategyName) { return createMessage(BUNDLE_PATH, 174, strategyName); } public static Message headerMalformedValueIs(String header, String value) { return createMessage(BUNDLE_PATH, 175, header, value); } public static Message transformOnObjectNotOfSpecifiedType(String name, Object expectedType) { return createMessage(BUNDLE_PATH, 177, name, expectedType); } public static Message cannotUseTxAndRemoteSync() { return createMessage(BUNDLE_PATH, 178); } public static Message failedToBuildMessage() { return createMessage(BUNDLE_PATH, 180); } public static Message propertiesNotSet(String string) { return createMessage(BUNDLE_PATH, 183, string); } public static Message objectNotOfCorrectType(Class actualClass, Class expectedClass) { return createMessage(BUNDLE_PATH, 185, StringMessageUtils.toString(actualClass), StringMessageUtils.toString(expectedClass)); } public static Message failedToConvertStringUsingEncoding(String encoding) { return createMessage(BUNDLE_PATH, 188, encoding); } public static Message propertyHasInvalidValue(String property, Object value) { return createMessage(BUNDLE_PATH, 189, property, value); } public static Message schemeCannotChangeForRouter(String scheme, String scheme2) { return createMessage(BUNDLE_PATH, 192, scheme, scheme2); } public static Message days() { return createMessage(BUNDLE_PATH, 193); } public static Message hours() { return createMessage(BUNDLE_PATH, 194); } public static Message minutes() { return createMessage(BUNDLE_PATH, 195); } public static Message seconds() { return createMessage(BUNDLE_PATH, 196); } public static Message templateCausedMalformedEndpoint(String uri, String newUri) { return createMessage(BUNDLE_PATH, 197, uri, newUri); } public static Message couldNotDetermineDestinationComponentFromEndpoint(String endpoint) { return createMessage(BUNDLE_PATH, 198, endpoint); } public static Message sessionValueIsMalformed(String string) { return createMessage(BUNDLE_PATH, 201, string); } public static Message streamingFailedNoStream() { return createMessage(BUNDLE_PATH, 205); } public static Message connectorSchemeIncompatibleWithEndpointScheme(Object expected, Object actual) { return createMessage(BUNDLE_PATH, 206, expected, actual); } public static Message failedToReadAttachment(String string) { return createMessage(BUNDLE_PATH, 207, string); } public static Message failedToInitSecurityProvider(String providerClass) { return createMessage(BUNDLE_PATH, 208, providerClass); } public static Message streamingNotSupported(String protocol) { return createMessage(BUNDLE_PATH, 209, protocol); } public static Message streamingComponentMustHaveOneEndpoint(String name) { return createMessage(BUNDLE_PATH, 210, name); } public static Message streamingFailedForEndpoint(String string) { return createMessage(BUNDLE_PATH, 212, string); } public static Message streamingEndpointsDoNotSupportTransformers() { return createMessage(BUNDLE_PATH, 213); } public static Message streamingEndpointsMustBeUsedWithStreamingModel() { return createMessage(BUNDLE_PATH, 214); } public static Message tooManyMatchingMethodsOnObjectWhichReturn(Object object, Object returnType) { return createMessage(BUNDLE_PATH, 216, StringMessageUtils.toString(object), StringMessageUtils.toString(returnType)); } public static Message failedToSetProxyOnService(Object proxy, Class routerClass) { return createMessage(BUNDLE_PATH, 217, proxy, routerClass); } public static Message mustSetMethodNamesOnBinding() { return createMessage(BUNDLE_PATH, 218); } public static Message cannotFindBindingForMethod(String name) { return createMessage(BUNDLE_PATH, 219, name); } public static Message noMatchingMethodsOnObjectReturning(Object object, Class returnType) { return createMessage(BUNDLE_PATH, 220, StringMessageUtils.toString(object), StringMessageUtils.toString(returnType)); } public static Message moreThanOneConnectorWithProtocol(String protocol) { return createMessage(BUNDLE_PATH, 221, protocol); } public static Message failedToGetOutputStream() { return createMessage(BUNDLE_PATH, 223); } public static Message noEntryPointFoundForNoArgsMethod(final Object component, final String methodName) { return createMessage(BUNDLE_PATH, 224, component, methodName); } public static Message noDelegateClassAndMethodProvidedForNoArgsWrapper() { return createMessage(BUNDLE_PATH, 225); } public static Message noDelegateClassIfDelegateInstanceSpecified() { return createMessage(BUNDLE_PATH, 226); } public static Message noServiceTransportDescriptor(String protocol) { return createMessage(BUNDLE_PATH, 227, protocol); } public static Message failedToInvokeLifecycle(String phaseName, Object object) { return createMessage(BUNDLE_PATH, 228, phaseName, object); } public static Message unrecognisedServiceType(String type) { return createMessage(BUNDLE_PATH, 229, type); } public static Message serviceFinderCantFindService(String name) { return createMessage(BUNDLE_PATH, 230, name); } // public static Message modelNameDoesNotMatchModel(UMOImmutableDescriptor descriptor, String modelName) // { // return createMessage(BUNDLE_PATH, 231, descriptor.getName(), descriptor.getModelName(), modelName); // } // These endpoint errors should go away once we make setting endpoints on routers typesafe public static Message inboundRouterMustUseInboundEndpoints(InboundRouterCollection router, ImmutableEndpoint endpoint) { return createMessage(BUNDLE_PATH, 232, endpoint, router); } public static Message outboundRouterMustUseOutboudEndpoints(OutboundRouter router, ImmutableEndpoint endpoint) { return createMessage(BUNDLE_PATH, 233, endpoint, router); } public static Message responseRouterMustUseInboundEndpoints(ResponseRouterCollection router, ImmutableEndpoint endpoint) { return createMessage(BUNDLE_PATH, 234, endpoint, router); } public static Message exceptionListenerMustUseOutboundEndpoint(AbstractExceptionListener exceptionListener, ImmutableEndpoint endpoint) { return createMessage(BUNDLE_PATH, 235, endpoint, exceptionListener); } /** * Returns a message that is a product informatin. * * @return message */ public static Message productInformation() { String notset = CoreMessages.notSet().getMessage(); return createMessage(BUNDLE_PATH, 236, StringUtils.defaultString(MuleManifest.getProductDescription(), notset), StringUtils.defaultString(MuleManifest.getProductVersion(), notset), StringUtils.defaultString( MuleManifest.getVendorName(), notset) + " " + StringUtils.defaultString( MuleManifest.getVendorUrl(), notset)); } public static Message noTransformerFoundForMessage(Class input, Class output) { return createMessage(BUNDLE_PATH, 237, input.getName(), output.getName()); } public static Message errorReadingStream() { return createMessage(BUNDLE_PATH, 238); } public static Message noEntryPointFoundForNoArgsMethodUsingResolver(final Object component, final String methodName, EntryPointResolver resolver) { return createMessage(BUNDLE_PATH, 239, methodName, component, resolver); } public static Message noEntryPointFoundWithArgsUsingResolver(Object object, Object args, EntryPointResolver resolver) { return createMessage(BUNDLE_PATH, 240, StringMessageUtils.toString(object), StringMessageUtils.toString(args), resolver); } public static Message noMatchingMethodsOnObjectReturningUsingResolver(Object object, Class returnType, EntryPointResolver resolver) { return createMessage(BUNDLE_PATH, 241, StringMessageUtils.toString(object), returnType.getClass().getName(), resolver); } public static Message tooManyAcceptableMethodsOnObjectUsingResolverForTypes(Object object, Object types, EntryPointResolver resolver) { return createMessage(BUNDLE_PATH, 242, StringMessageUtils.toString(object), StringMessageUtils.toString(types), resolver); } public static Message tooManyMatchingMethodsOnObjectUsingResolverWhichReturn(Object object, Object returnType, EntryPointResolver resolver) { return createMessage(BUNDLE_PATH, 243, StringMessageUtils.toString(returnType), StringMessageUtils.toString(object), resolver); } public static Message objectDoesNotImplementInterface(Object object, Class interfaceClass) { return createMessage(BUNDLE_PATH, 244, StringMessageUtils.toString(object), interfaceClass); } public static Message invocationSuccessfulCantSetError() { return createMessage(BUNDLE_PATH, 245); } public static Message noMatchingMethodsOnObjectCalledUsingResolver(Object object, String methodName, EntryPointResolver resolver) { return createMessage(BUNDLE_PATH, 246, StringMessageUtils.toString(object), methodName, resolver); } public static Message noJtaTransactionAvailable(final Thread callingThread) { return createMessage(BUNDLE_PATH, 247, StringUtils.defaultString(callingThread.toString())); } public static Message notMuleXaTransaction(Object tx) { return createMessage(BUNDLE_PATH, 248, tx.getClass()); } public static Message noServiceQueueTimeoutSet(Service service) { return createMessage(BUNDLE_PATH, 249, service); } public static Message failedToProcessExtractorFunction(String name) { return createMessage(BUNDLE_PATH, 250, name); } public static Message expressionEvaluatorNotRegistered(String key) { return createMessage(BUNDLE_PATH, 251, key); } public static Message objectAlreadyExists(String key) { return createMessage(BUNDLE_PATH, 252, key); } public static Message noMuleTransactionAvailable() { return createMessage(BUNDLE_PATH, 253); } public static Message objectAlreadyRegistered(String name, Object origObject, Object newObject) { return createMessage(BUNDLE_PATH, 254, name, origObject + "." + origObject.getClass(), newObject + "." + newObject.getClass()); } public static Message transformerNotImplementDiscoverable(Transformer transformer) { return createMessage(BUNDLE_PATH, 255, transformer); } public static Message transformHasMultipleMatches(Class input, Class output, Transformer transformer1, Transformer transformer2) { return createMessage(BUNDLE_PATH, 256, new Object[]{input, output, transformer1.getName() + "(" + transformer1.getClass() + ")", transformer2.getName() + "(" + transformer2.getClass() + ")"}); } public static Message configurationBuilderSuccess(ConfigurationBuilder configurationBuilder, int numResources) { return createMessage(BUNDLE_PATH, 257, configurationBuilder.getClass().getName(), new Integer(numResources)); } public static Message configurationBuilderSuccess(ConfigurationBuilder configurationBuilder, String resources) { return createMessage(BUNDLE_PATH, 258, configurationBuilder.getClass().getName(), resources); } public static Message configurationBuilderNoMatching(String resource) { return createMessage(BUNDLE_PATH, 259, resource); } public static Message configurationBuilderError(ConfigurationBuilder configurationBuilder) { return createMessage(BUNDLE_PATH, 260, StringMessageUtils.toString(configurationBuilder.getClass())); } public static Message nestedRetry() { return createMessage(BUNDLE_PATH, 261); } public static Message expressionEvaluatorReturnedNull(String name, String expr) { return createMessage(BUNDLE_PATH, 263, name, expr); } public static Message expressionInvalidForProperty(String property, String expr) { return createMessage(BUNDLE_PATH, 264, property, expr); } public static Message expressionMalformed(String expr, String eval) { return createMessage(BUNDLE_PATH, 265, expr, eval); } public static Message correlationTimedOut(Object groupId) { return createMessage(BUNDLE_PATH, 266, groupId); } public static Message transformerInvalidReturnType(Class clazz, String transformerName) { return createMessage(BUNDLE_PATH, 267, clazz, transformerName); } } mule-2.0.1/core/src/main/java/org/mule/config/i18n/package.html0000644000175000017500000000403310754375733023740 0ustar charlescharles Mule Internationalisation support for Mule messages and exception messages.

    The Message class is a wrapper for an error message, its error code and other information. The messages are read from ResourceBundles usually from classpath.

    The class MessageFactory encapsulates the lookup of ResourceBundles and creation of messages. Since each mule module should provide its own messages, subclasses of MessageFactory should be created. It is convention to put the module specific class in a subpackage called i18n.

    Subclassing MessageFactory

    For a mule module foo with base package org.mule.module.foo a MessageFactory subclass would typcially look like this:
    package org.mule.module.foo.i18n;
    
    public class FooMessages extends MessageFactory
    {
        private static final String BUNDLE_PATH = getBundlePath("foo");
        
        public static final Message foo()
        {
            return createMessage(BUNDLE_PATH, 1);
        }
        
        public static final Message bar(String arg)
        {
            return createMessage(BUNDLE_PATH, 2, arg);
        }
        
        .
        .
        .
    }
    
    Note that the only publicly available methods are those from FooMessages. This approach has various advantages:
    • Message instances are created using meaningful java methods, i.e. client code is less cluttered with message cration details.
    • The method signature ensures that the right number of arguments is passed in to format the message.
    • No more constants for message codes needed as there is exactly one occurrence of the constant in the code.
    • By using the right MessageFactory subclass it is ensured that the correct ResourceBundle will be chosen for lookup.
    • Formatting the input to messages can be taken out of the client code by putting it in this class
    mule-2.0.1/core/src/main/java/org/mule/config/i18n/LocaleMessageHandler.java0000644000175000017500000000634510664703640026324 0ustar charlescharles/* * $Id: LocaleMessageHandler.java 8083 2007-08-28 02:25:36Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.i18n; import java.text.MessageFormat; import java.util.Locale; import java.util.ResourceBundle; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * The LocaleMessageHandler is essentially a merging of the Message * and Messages classes, since there is no good reason to have them separate. A * key point is that this Handler is meant to be used for application-specific * messages, rather than core system messages. (That's not to say it couldn't * eventually replace the latter, however). Note that message codes are Strings * here, instead of the ints in Message. * * The LocaleMessageHandler can be called directly, but is really meant to be * called by LocaleMessage classes as done in the examples. * * Note that this class assumes the resource bundle is in the format * -messages and is located at the top of the jar or classes * directory. We can later add the ability to specify a path prefix. */ public class LocaleMessageHandler { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(LocaleMessageHandler.class); /** * Get the resource string for the given bundle name and resource code */ public static String getString(String bundleName, String code) { return getString(bundleName, code, new Object[] {}); } /** * Get the resource string for the given bundle name, resource code and * one argument */ public static String getString(String bundleName, String code, Object arg1) { if (arg1 == null) { arg1 = "null"; } return getString(bundleName, code, new Object[]{arg1}); } /** * Get the resource string for the given bundle name, resource code and * two arguments */ public static String getString(String bundleName, String code, Object arg1, Object arg2) { if (arg1 == null) { arg1 = "null"; } if (arg2 == null) { arg2 = "null"; } return getString(bundleName, code, new Object[]{arg1, arg2}); } /** * Get the resource string for the given bundle name, resource code and array * of arguments. All above methods invoke this one. */ public static String getString(String bundleName, String code, Object[] args) { String path = bundleName + "-messages"; Locale locale = Locale.getDefault(); ResourceBundle bundle = ResourceBundle.getBundle(path, locale); String m = bundle.getString(code); if (m == null) { logger.error("Failed to find message for id " + code + " in resource bundle " + path); return ""; } return MessageFormat.format(m, args); } } mule-2.0.1/core/src/main/java/org/mule/config/i18n/Message.java0000644000175000017500000000267110664630335023704 0ustar charlescharles/* * $Id: Message.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.i18n; import java.io.Serializable; public class Message implements Serializable { /** * Serial version */ private static final long serialVersionUID = -6109760447384477924L; private String message; private int code = 0; private Object[] args; private Message nextMessage; protected Message(String message, int code, Object[] args) { super(); this.message = message; this.code = code; this.args = args; } public int getCode() { return code; } public Object[] getArgs() { return args; } public String getMessage() { return message + (nextMessage != null ? ". " + nextMessage.getMessage() : ""); } public Message setNextMessage(Message nextMessage) { this.nextMessage = nextMessage; return this; } public Message getNextMessage() { return nextMessage; } public String toString() { return this.getMessage(); } } mule-2.0.1/core/src/main/java/org/mule/config/i18n/MessageFactory.java0000644000175000017500000001731310754403514025230 0ustar charlescharles/* * $Id: MessageFactory.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config.i18n; import java.text.MessageFormat; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public abstract class MessageFactory extends Object { /** * logger used by this class */ private static final Log logger = LogFactory.getLog(MessageFactory.class); /** * This error code is used for {@link Message} instances that are not read from a * resource bundles but are created only with a string. */ private static final int STATIC_ERROR_CODE = -1; private static final transient Object[] EMPTY_ARGS = new Object[]{}; /** * Computes the bundle's full path * (META-INF/services/org/mule/i18n/<bundleName>-messages.properties) from * bundleName. * * @param bundleName Name of the bundle without the "messages" suffix and without * file extension. */ protected static String getBundlePath(String bundleName) { return "META-INF.services.org.mule.i18n." + bundleName + "-messages"; } /** * Factory method to create a new {@link Message} instance that is filled with the formatted * message with id code from the resource bundle bundlePath. * * @param bundlePath complete path to the resource bundle for lookup * @param code numeric code of the message * @param arg * @see getBundlePath() */ protected static Message createMessage(String bundlePath, int code, Object arg) { return createMessage(bundlePath, code, new Object[] {arg}); } /** * Factory method to create a new {@link Message} instance that is filled with the formatted * message with id code from the resource bundle bundlePath. * * @param bundlePath complete path to the resource bundle for lookup * @param code numeric code of the message * @param arg1 * @param arg2 * @see getBundlePath() */ protected static Message createMessage(String bundlePath, int code, Object arg1, Object arg2) { return createMessage(bundlePath, code, new Object[] {arg1, arg2}); } /** * Factory method to create a new {@link Message} instance that is filled with the formatted * message with id code from the resource bundle bundlePath. * * @param bundlePath complete path to the resource bundle for lookup * @param code numeric code of the message * @param arg1 * @param arg2 * @param arg3 * @see getBundlePath() */ protected static Message createMessage(String bundlePath, int code, Object arg1, Object arg2, Object arg3) { return createMessage(bundlePath, code, new Object[] {arg1, arg2, arg3}); } /** * Factory method to create a new {@link Message} instance that is filled with the formatted * message with id code from the resource bundle bundlePath. * * Attention: do not confuse this method with * createMessage(String, int, Object). * * @param bundlePath complete path to the resource bundle for lookup * @param code numeric code of the message * @param arguments * @see getBundlePath() */ protected static Message createMessage(String bundlePath, int code, Object[] arguments) { String messageString = getString(bundlePath, code, arguments); return new Message(messageString, code, arguments); } /** * Factory method to create a new {@link Message} instance that is filled with the formatted * message with id code from the resource bundle bundlePath. * * @param bundlePath complete path to the resource bundle for lookup * @param code numeric code of the message */ protected static Message createMessage(String bundlePath, int code) { String messageString = getString(bundlePath, code, null); return new Message(messageString, code, EMPTY_ARGS); } /** * Factory method to create a {@link Message} instance that is not read from a resource bundle. * * @param message Message's message text * @return a Messsage instance that has an error code of -1 and no arguments. */ public static Message createStaticMessage(String message) { return new Message(message, STATIC_ERROR_CODE, EMPTY_ARGS); } /** * Factory method to read the message with code code from the resource bundle. * * @param bundlePath complete path to the resource bundle for lookup * @param code numeric code of the message * @return formatted error message as {@link String} */ protected static String getString(String bundlePath, int code) { return getString(bundlePath, code, null); } /** * Factory method to read the message with code code from the resource bundle. * * @param bundlePath complete path to the resource bundle for lookup * @param code numeric code of the message * @param arg * @return formatted error message as {@link String} */ protected static String getString(String bundlePath, int code, Object arg) { Object[] arguments = new Object[] {arg}; return getString(bundlePath, code, arguments); } /** * Factory method to read the message with code code from the resource bundle. * * @param bundlePath complete path to the resource bundle for lookup * @param code numeric code of the message * @param arg1 * @param arg2 * @return formatted error message as {@link String} */ protected static String getString(String bundlePath, int code, Object arg1, Object arg2) { Object[] arguments = new Object[] {arg1, arg2}; return getString(bundlePath, code, arguments); } protected static String getString(String bundlePath, int code, Object[] args) { // We will throw a MissingResourceException if the bundle name is invalid // This happens if the code references a bundle name that just doesn't exist ResourceBundle bundle = getBundle(bundlePath); try { String m = bundle.getString(String.valueOf(code)); if (m == null) { logger.error("Failed to find message for id " + code + " in resource bundle " + bundlePath); return ""; } return MessageFormat.format(m, args); } catch (MissingResourceException e) { logger.error("Failed to find message for id " + code + " in resource bundle " + bundlePath); return ""; } } /** * @throws MissingResourceException if resource is missing */ private static ResourceBundle getBundle(String bundlePath) { Locale locale = Locale.getDefault(); if (logger.isTraceEnabled()) { logger.trace("Loading resource bundle: " + bundlePath + " for locale " + locale); } ResourceBundle bundle = ResourceBundle.getBundle(bundlePath, locale); return bundle; } } mule-2.0.1/core/src/main/java/org/mule/config/MuleExceptionReader.java0000644000175000017500000000243110756313276025443 0ustar charlescharles/* * $Id: MuleExceptionReader.java 10852 2008-02-18 14:31:26Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import org.mule.api.MuleException; import org.mule.api.config.ExceptionReader; import java.util.Collections; import java.util.Map; /** * Grabs all information from the MuleException type */ public final class MuleExceptionReader implements ExceptionReader { public String getMessage(Throwable t) { return t.getMessage(); } public Throwable getCause(Throwable t) { return t.getCause(); } public Class getExceptionType() { return MuleException.class; } /** * Returns a map of the non-stanard information stored on the exception * * @return a map of the non-stanard information stored on the exception */ public Map getInfo(Throwable t) { return (t instanceof MuleException ? ((MuleException) t).getInfo() : Collections.EMPTY_MAP); } } mule-2.0.1/core/src/main/java/org/mule/config/ImmutableThreadingProfile.java0000644000175000017500000002160010745677442026632 0ustar charlescharles/* * $Id: ImmutableThreadingProfile.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import org.mule.api.config.ThreadingProfile; import org.mule.api.context.WorkManager; import org.mule.util.StringUtils; import org.mule.util.concurrent.NamedThreadFactory; import org.mule.util.concurrent.WaitPolicy; import org.mule.work.MuleWorkManager; import edu.emory.mathcs.backport.java.util.concurrent.BlockingQueue; import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingDeque; import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionHandler; import edu.emory.mathcs.backport.java.util.concurrent.SynchronousQueue; import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory; import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class ImmutableThreadingProfile implements ThreadingProfile { private int maxThreadsActive; private int maxThreadsIdle; private int maxBufferSize; private long threadTTL; private long threadWaitTimeout; private int poolExhaustedAction; private boolean doThreading; private WorkManagerFactory workManagerFactory = new DefaultWorkManagerFactory(); private RejectedExecutionHandler rejectedExecutionHandler; private ThreadFactory threadFactory; public ImmutableThreadingProfile(int maxThreadsActive, int maxThreadsIdle, int maxBufferSize, long threadTTL, long threadWaitTimeout, int poolExhaustedAction, boolean doThreading, RejectedExecutionHandler rejectedExecutionHandler, ThreadFactory threadFactory) { this.maxThreadsActive = maxThreadsActive; this.maxThreadsIdle = maxThreadsIdle; this.maxBufferSize = maxBufferSize; this.threadTTL = threadTTL; this.threadWaitTimeout = threadWaitTimeout; this.poolExhaustedAction = poolExhaustedAction; this.doThreading = doThreading; this.rejectedExecutionHandler = rejectedExecutionHandler; this.threadFactory = threadFactory; } public ImmutableThreadingProfile(ThreadingProfile tp) { this(tp.getMaxThreadsActive(), tp.getMaxThreadsIdle(), tp.getMaxBufferSize(), tp.getThreadTTL(), tp.getThreadWaitTimeout(), tp.getPoolExhaustedAction(), tp.isDoThreading(), tp.getRejectedExecutionHandler(), tp.getThreadFactory()); } public int getMaxThreadsActive() { return maxThreadsActive; } public int getMaxThreadsIdle() { return maxThreadsIdle; } public long getThreadTTL() { return threadTTL; } public long getThreadWaitTimeout() { return threadWaitTimeout; } public int getPoolExhaustedAction() { return poolExhaustedAction; } public RejectedExecutionHandler getRejectedExecutionHandler() { return rejectedExecutionHandler; } public ThreadFactory getThreadFactory() { return threadFactory; } public void setMaxThreadsActive(int maxThreadsActive) { throw new UnsupportedOperationException(getClass().getName()); } public void setMaxThreadsIdle(int maxThreadsIdle) { throw new UnsupportedOperationException(getClass().getName()); } public void setThreadTTL(long threadTTL) { throw new UnsupportedOperationException(getClass().getName()); } public void setThreadWaitTimeout(long threadWaitTimeout) { throw new UnsupportedOperationException(getClass().getName()); } public void setPoolExhaustedAction(int poolExhaustPolicy) { throw new UnsupportedOperationException(getClass().getName()); } public void setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler) { throw new UnsupportedOperationException(getClass().getName()); } public void setThreadFactory(ThreadFactory threadFactory) { throw new UnsupportedOperationException(getClass().getName()); } public int getMaxBufferSize() { return maxBufferSize; } public void setMaxBufferSize(int maxBufferSize) { throw new UnsupportedOperationException(getClass().getName()); } public WorkManagerFactory getWorkManagerFactory() { return workManagerFactory; } public void setWorkManagerFactory(WorkManagerFactory workManagerFactory) { throw new UnsupportedOperationException(getClass().getName()); } public WorkManager createWorkManager(String name) { return workManagerFactory.createWorkManager(this, name); } public ThreadPoolExecutor createPool() { return createPool(null); } public ThreadPoolExecutor createPool(String name) { return createPool(name, this); } public boolean isDoThreading() { return doThreading; } public void setDoThreading(boolean doThreading) { throw new UnsupportedOperationException(getClass().getName()); } public String toString() { return "ThreadingProfile{" + "maxThreadsActive=" + maxThreadsActive + ", maxThreadsIdle=" + maxThreadsIdle + ", maxBufferSize=" + maxBufferSize + ", threadTTL=" + threadTTL + ", poolExhaustedAction=" + poolExhaustedAction + ", threadWaitTimeout=" + threadWaitTimeout + ", doThreading=" + doThreading + ", workManagerFactory=" + workManagerFactory + ", rejectedExecutionHandler=" + rejectedExecutionHandler + ", threadFactory=" + threadFactory + "}"; } public static class DefaultWorkManagerFactory implements WorkManagerFactory { public WorkManager createWorkManager(ThreadingProfile profile, String name) { return new MuleWorkManager(profile, name); } } // this should be a separate factory, really public static ThreadPoolExecutor createPool(String name, ThreadingProfile tp) { BlockingQueue buffer; if (tp.getMaxBufferSize() > 0 && tp.getMaxThreadsActive() > 1) { buffer = new LinkedBlockingDeque(tp.getMaxBufferSize()); } else { buffer = new SynchronousQueue(); } ThreadPoolExecutor pool = new ThreadPoolExecutor(Math.max(tp.getMaxThreadsIdle(), tp.getMaxThreadsActive()), tp.getMaxThreadsActive(), tp.getThreadTTL(), TimeUnit.MILLISECONDS, buffer); // use a custom ThreadFactory if one has been configured if (tp.getThreadFactory() != null) { pool.setThreadFactory(tp.getThreadFactory()); } else { // ..else create a "NamedThreadFactory" if a proper name was passed in if (StringUtils.isNotBlank(name)) { pool.setThreadFactory(new NamedThreadFactory(name)); } else { // let ThreadPoolExecutor create a default ThreadFactory; // see Executors.defaultThreadFactory() } } if (tp.getRejectedExecutionHandler() != null) { pool.setRejectedExecutionHandler(tp.getRejectedExecutionHandler()); } else { switch (tp.getPoolExhaustedAction()) { case WHEN_EXHAUSTED_DISCARD_OLDEST : pool.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardOldestPolicy()); break; case WHEN_EXHAUSTED_RUN : pool.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); break; case WHEN_EXHAUSTED_ABORT : pool.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); break; case WHEN_EXHAUSTED_DISCARD : pool.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy()); break; default : // WHEN_EXHAUSTED_WAIT pool.setRejectedExecutionHandler(new WaitPolicy(tp.getThreadWaitTimeout(), TimeUnit.MILLISECONDS)); break; } } return pool; } }mule-2.0.1/core/src/main/java/org/mule/config/DefaultMuleConfiguration.java0000644000175000017500000004034111001634510026455 0ustar charlescharles/* * $Id: DefaultMuleConfiguration.java 11585 2008-04-17 11:49:28Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import org.mule.MuleServer; import org.mule.api.MuleContext; import org.mule.api.config.MuleConfiguration; import org.mule.api.config.MuleProperties; import org.mule.api.lifecycle.FatalException; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.Startable; import org.mule.config.i18n.CoreMessages; import org.mule.util.FileUtils; import org.mule.util.NumberUtils; import org.mule.util.StringUtils; import org.mule.util.UUID; import java.net.InetAddress; import java.net.UnknownHostException; import java.nio.charset.Charset; import javax.xml.parsers.SAXParserFactory; import org.apache.commons.lang.BooleanUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Configuration info. which can be set when creating the MuleContext but becomes * immutable after starting the MuleContext. */ public class DefaultMuleConfiguration implements MuleConfiguration { private boolean synchronous = false; /** * The type of model used for the internal system model where system created * services are registered */ private String systemModelType = "seda"; private String encoding = "UTF-8"; /** * When running sychonously, return events can be received over transports that * support ack or replyTo This property determines how long to wait for a receive */ private int synchronousEventTimeout = 10000; /** * The default transaction timeout value used if no specific transaction time out * has been set on the transaction config */ private int defaultTransactionTimeout = 30000; /** * Determines whether when running synchronously, return events are received * before returning the call. i.e. in jms wait for a replyTo. Vm queues do this * automatically */ private boolean remoteSync = false; /** Where Mule stores any runtime files to disk */ private String workingDirectory = "./.mule"; /** * Whether the server instance is running in client mode, which means that some * services will not be started */ private boolean clientMode = false; /** * Should we fail when we detect "message scribbling"? * @see AbstractMessageAdapter.checkMutable() */ private boolean failOnMessageScribbling = true; /** the unique id for this Mule instance */ private String id; /** If this node is part of a cluster then this is the shared cluster Id */ private String clusterId; /** The domain name that this instance belongs to. */ private String domainId; // Debug options private boolean cacheMessageAsBytes = true; private boolean cacheMessageOriginalPayload = true; private boolean enableStreaming = true; private boolean assertMessageAccess = true; private boolean autoWrapMessageAwareTransform = true; protected transient Log logger = LogFactory.getLog(DefaultMuleConfiguration.class); public DefaultMuleConfiguration() { super(); // Apply any settings which come from the JVM system properties. applySystemProperties(); if (id == null) { id = UUID.getUUID(); } if (clusterId == null) { clusterId = CoreMessages.notClustered().getMessage(); } if (domainId == null) { try { domainId = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { logger.warn(e); domainId = "org.mule"; } } try { validateEncoding(); validateXML(); } catch (FatalException e) { throw new RuntimeException(e); } } /** * Apply any settings which come from the JVM system properties. */ protected void applySystemProperties() { String p; p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "encoding"); if (p != null) { encoding = p; } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "endpoints.synchronous"); if (p != null) { synchronous = BooleanUtils.toBoolean(p); } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "systemModelType"); if (p != null) { systemModelType = p; } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "timeout.synchronous"); if (p != null) { synchronousEventTimeout = NumberUtils.toInt(p); } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "timeout.transaction"); if (p != null) { defaultTransactionTimeout = NumberUtils.toInt(p); } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "remoteSync"); if (p != null) { remoteSync = BooleanUtils.toBoolean(p); } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "workingDirectory"); if (p != null) { workingDirectory = p; } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "clientMode"); if (p != null) { clientMode = BooleanUtils.toBoolean(p); } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "disable.threadsafemessages"); if (p != null) { failOnMessageScribbling = !BooleanUtils.toBoolean(p); } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "serverId"); if (p != null) { id = p; } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "clusterId"); if (p != null) { clusterId = p; } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "domainId"); if (p != null) { domainId = p; } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "message.cacheBytes"); if (p != null) { cacheMessageAsBytes = BooleanUtils.toBoolean(p); } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "message.cacheOriginal"); if (p != null) { cacheMessageOriginalPayload = BooleanUtils.toBoolean(p); } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "streaming.enable"); if (p != null) { enableStreaming = BooleanUtils.toBoolean(p); } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "message.assertAccess"); if (p != null) { assertMessageAccess = BooleanUtils.toBoolean(p); } p = System.getProperty(SYSTEM_PROPERTY_PREFIX + "transform.autoWrap"); if (p != null) { autoWrapMessageAwareTransform = BooleanUtils.toBoolean(p); } } protected void validateEncoding() throws FatalException { //Check we have a valid and supported encoding if (!Charset.isSupported(encoding)) { throw new FatalException(CoreMessages.propertyHasInvalidValue("encoding", encoding), this); } } /** * Mule needs a proper JAXP implementation and will complain when run with a plain JDK * 1.4. Use the supplied launcher or specify a proper JAXP implementation via * -Djava.endorsed.dirs. See the following URLs for more information: *
      *
    • {@link http://xerces.apache.org/xerces2-j/faq-general.html#faq-4} *
    • {@link http://xml.apache.org/xalan-j/faq.html#faq-N100D6} *
    • {@link http://java.sun.com/j2se/1.4.2/docs/guide/standards/} *
    */ protected void validateXML() throws FatalException { SAXParserFactory f = SAXParserFactory.newInstance(); if (f == null || f.getClass().getName().indexOf("crimson") != -1) { throw new FatalException(CoreMessages.valueIsInvalidFor(f.getClass().getName(), "javax.xml.parsers.SAXParserFactory"), this); } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#isDefaultSynchronousEndpoints() */ public boolean isDefaultSynchronousEndpoints() { return synchronous; } public void setDefaultSynchronousEndpoints(boolean synchronous) { if (verifyContextNotStarted()) { this.synchronous = synchronous; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#getDefaultSynchronousEventTimeout() */ public int getDefaultSynchronousEventTimeout() { return synchronousEventTimeout; } public void setDefaultSynchronousEventTimeout(int synchronousEventTimeout) { if (verifyContextNotStarted()) { this.synchronousEventTimeout = synchronousEventTimeout; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#isDefaultRemoteSync() */ public boolean isDefaultRemoteSync() { return remoteSync; } public void setDefaultRemoteSync(boolean remoteSync) { if (verifyContextNotStarted()) { this.remoteSync = remoteSync; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#getWorkingDirectory() */ public String getWorkingDirectory() { return workingDirectory; } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#getMuleHomeDirectory() */ public String getMuleHomeDirectory() { return System.getProperty(MuleProperties.MULE_HOME_DIRECTORY_PROPERTY); } public void setWorkingDirectory(String workingDirectory) { if (verifyContextNotInitialized()) { // fix windows backslashes in absolute paths, convert them to forward ones this.workingDirectory = FileUtils.newFile(workingDirectory).getAbsolutePath().replaceAll("\\\\", "/"); } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#getDefaultTransactionTimeout() */ public int getDefaultTransactionTimeout() { return defaultTransactionTimeout; } public void setDefaultTransactionTimeout(int defaultTransactionTimeout) { if (verifyContextNotStarted()) { this.defaultTransactionTimeout = defaultTransactionTimeout; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#isClientMode() */ public boolean isClientMode() { return clientMode; } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#getDefaultEncoding() */ public String getDefaultEncoding() { return encoding; } public void setDefaultEncoding(String encoding) { if (verifyContextNotInitialized()) { this.encoding = encoding; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#getId() */ public String getId() { return id; } public void setId(String id) { if (verifyContextNotInitialized()) { if (StringUtils.isBlank(id)) { throw new RuntimeException("Cannot set server id to null/blank"); } this.id = id; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#getClusterId() */ public String getClusterId() { return clusterId; } public void setClusterId(String clusterId) { if (verifyContextNotInitialized()) { this.clusterId = clusterId; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#getDomainId() */ public String getDomainId() { return domainId; } public void setDomainId(String domainId) { if (verifyContextNotInitialized()) { this.domainId = domainId; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#getSystemModelType() */ public String getSystemModelType() { return systemModelType; } public void setSystemModelType(String systemModelType) { if (verifyContextNotStarted()) { this.systemModelType = systemModelType; } } public void setClientMode(boolean clientMode) { if (verifyContextNotStarted()) { this.clientMode = clientMode; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#getSystemName() */ public String getSystemName() { return domainId + "." + clusterId + "." + id; } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#isFailOnMessageScribbling() */ public boolean isFailOnMessageScribbling() { return failOnMessageScribbling; } public void setFailOnMessageScribbling(boolean failOnMessageScribbling) { if (verifyContextNotStarted()) { this.failOnMessageScribbling = failOnMessageScribbling; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#isAssertMessageAccess() */ public boolean isAssertMessageAccess() { return assertMessageAccess; } public void setAssertMessageAccess(boolean assertMessageAccess) { if (verifyContextNotStarted()) { this.assertMessageAccess = assertMessageAccess; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#isAutoWrapMessageAwareTransform() */ public boolean isAutoWrapMessageAwareTransform() { return autoWrapMessageAwareTransform; } public void setAutoWrapMessageAwareTransform(boolean autoWrapMessageAwareTransform) { if (verifyContextNotStarted()) { this.autoWrapMessageAwareTransform = autoWrapMessageAwareTransform; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#isCacheMessageAsBytes() */ public boolean isCacheMessageAsBytes() { return cacheMessageAsBytes; } public void setCacheMessageAsBytes(boolean cacheMessageAsBytes) { if (verifyContextNotStarted()) { this.cacheMessageAsBytes = cacheMessageAsBytes; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#isCacheMessageOriginalPayload() */ public boolean isCacheMessageOriginalPayload() { return cacheMessageOriginalPayload; } public void setCacheMessageOriginalPayload(boolean cacheMessageOriginalPayload) { if (verifyContextNotStarted()) { this.cacheMessageOriginalPayload = cacheMessageOriginalPayload; } } /* (non-Javadoc) * @see org.mule.config.MuleConfiguration#isEnableStreaming() */ public boolean isEnableStreaming() { return enableStreaming; } public void setEnableStreaming(boolean enableStreaming) { if (verifyContextNotStarted()) { this.enableStreaming = enableStreaming; } } protected boolean verifyContextNotInitialized() { MuleContext context = MuleServer.getMuleContext(); if (context != null && context.getLifecycleManager().isPhaseComplete(Initialisable.PHASE_NAME)) { logger.warn("Cannot modify MuleConfiguration once the MuleContext has been initialized. Modification will be ignored."); return false; } else { return true; } } protected boolean verifyContextNotStarted() { MuleContext context = MuleServer.getMuleContext(); if (context != null && context.getLifecycleManager().isPhaseComplete(Startable.PHASE_NAME)) { logger.warn("Cannot modify MuleConfiguration once the MuleContext has been started. Modification will be ignored."); return false; } else { return true; } } } mule-2.0.1/core/src/main/java/org/mule/config/ChainedThreadingProfile.java0000644000175000017500000001607110745677442026254 0ustar charlescharles/* * $Id: ChainedThreadingProfile.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import org.mule.api.config.ThreadingProfile; import org.mule.api.context.WorkManager; import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionHandler; import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory; import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; /** * This was written (perhaps too far in advance) with an eye to how we will manage default values * in a dynamic environment. Since very little has been decided in that direction the correct * behaviour is unclear - changing the default value of "dyanamic" * {@link org.mule.config.ChainedThreadingProfile#ChainedThreadingProfile(ThreadingProfile)} * will switch behaviour between dynamic and static chaining. * *

    Note that within Spring, as far as I understand things, object creation is always ordered * so that dependencies are correctly resolved. In that case, in a static scenario (or in a * dynamic one that rebuilds the instances) dyanmic and static behaviour should be identical.

    * *

    Also, the "lazy" chaining is an optimisation - all hierarchies should be grounded in a final * default which is {@link ImmutableThreadingProfile} and, as such, return reliable * values (lazy would be necessary if this is not the case, since we must avoid evaluating * incomplete delegates).

    */ public class ChainedThreadingProfile implements ThreadingProfile { private Integer maxThreadsActive; private Integer maxThreadsIdle; private Integer maxBufferSize; private Long threadTTL; private Long threadWaitTimeout; private Integer poolExhaustedAction; private Boolean doThreading; private WorkManagerFactory workManagerFactory = new ImmutableThreadingProfile.DefaultWorkManagerFactory(); private RejectedExecutionHandler rejectedExecutionHandler; private ThreadFactory threadFactory; private ThreadingProfile delegate; /** * Generate a mutable threading profile with fixed default values taken from * {@link #DEFAULT_THREADING_PROFILE} */ public ChainedThreadingProfile() { // the default is itself constant, so dynanmic=true irrelevant this(DEFAULT_THREADING_PROFILE); } /** * Generate a mutable threading profile with dynamic default values taken from the * given delegate. * * @param delegate */ public ChainedThreadingProfile(ThreadingProfile delegate) { this(delegate, true); } /** * Generate a mutable threading profile. Default values are taken from the "delegate" * argument. If dynamic is true then changes in the delegate instance are reflected in * this instance. * * @param delegate Source of default values. * @param dynamic If true, changes in delegate are reflected in this instance */ public ChainedThreadingProfile(ThreadingProfile delegate, boolean dynamic) { if (!dynamic) { // for static dependencies, we delegate to a fixed copy delegate = new ImmutableThreadingProfile(delegate); } this.delegate = delegate; } public int getMaxThreadsActive() { return null != maxThreadsActive ? maxThreadsActive.intValue() : delegate.getMaxThreadsActive(); } public int getMaxThreadsIdle() { return null != maxThreadsIdle ? maxThreadsIdle.intValue() : delegate.getMaxThreadsIdle(); } public long getThreadTTL() { return null != threadTTL ? threadTTL.longValue() : delegate.getThreadTTL(); } public long getThreadWaitTimeout() { return null != threadWaitTimeout ? threadWaitTimeout.longValue() : delegate.getThreadWaitTimeout(); } public int getPoolExhaustedAction() { return null != poolExhaustedAction ? poolExhaustedAction.intValue() : delegate.getPoolExhaustedAction(); } public RejectedExecutionHandler getRejectedExecutionHandler() { return rejectedExecutionHandler; } public ThreadFactory getThreadFactory() { return threadFactory; } public void setMaxThreadsActive(int maxThreadsActive) { this.maxThreadsActive = new Integer(maxThreadsActive); } public void setMaxThreadsIdle(int maxThreadsIdle) { this.maxThreadsIdle = new Integer(maxThreadsIdle); } public void setThreadTTL(long threadTTL) { this.threadTTL = new Long(threadTTL); } public void setThreadWaitTimeout(long threadWaitTimeout) { this.threadWaitTimeout = new Long(threadWaitTimeout); } public void setPoolExhaustedAction(int poolExhaustPolicy) { this.poolExhaustedAction = new Integer(poolExhaustPolicy); } public void setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler) { this.rejectedExecutionHandler = rejectedExecutionHandler; } public void setThreadFactory(ThreadFactory threadFactory) { this.threadFactory = threadFactory; } public int getMaxBufferSize() { return null != maxBufferSize ? maxBufferSize.intValue() : delegate.getMaxBufferSize(); } public void setMaxBufferSize(int maxBufferSize) { this.maxBufferSize = new Integer(maxBufferSize); } public WorkManagerFactory getWorkManagerFactory() { return workManagerFactory; } public void setWorkManagerFactory(WorkManagerFactory workManagerFactory) { this.workManagerFactory = workManagerFactory; } public WorkManager createWorkManager(String name) { return workManagerFactory.createWorkManager(this, name); } public ThreadPoolExecutor createPool() { return createPool(null); } public ThreadPoolExecutor createPool(String name) { return ImmutableThreadingProfile.createPool(name, this); } public boolean isDoThreading() { return null != doThreading ? doThreading.booleanValue() : delegate.isDoThreading(); } public void setDoThreading(boolean doThreading) { this.doThreading = Boolean.valueOf(doThreading); } public String toString() { return "ThreadingProfile{" + "maxThreadsActive=" + maxThreadsActive + ", maxThreadsIdle=" + maxThreadsIdle + ", maxBufferSize=" + maxBufferSize + ", threadTTL=" + threadTTL + ", poolExhaustedAction=" + poolExhaustedAction + ", threadWaitTimeout=" + threadWaitTimeout + ", doThreading=" + doThreading + ", workManagerFactory=" + workManagerFactory + ", rejectedExecutionHandler=" + rejectedExecutionHandler + ", threadFactory=" + threadFactory + "}"; } }mule-2.0.1/core/src/main/java/org/mule/config/ExceptionHelper.java0000644000175000017500000003561410756313276024646 0ustar charlescharles/* * $Id: ExceptionHelper.java 10852 2008-02-18 14:31:26Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import org.mule.api.MuleException; import org.mule.api.MuleRuntimeException; import org.mule.api.config.ExceptionReader; import org.mule.config.i18n.CoreMessages; import org.mule.util.ClassUtils; import org.mule.util.MapUtils; import org.mule.util.SpiUtils; import org.mule.util.StringUtils; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * ExceptionHelper provides a number of helper functions that can be * useful for dealing with Mule exceptions. This class has 3 core functions -

    1. * ErrorCode lookup. A corresponding Mule error code can be found using for a given * Mule exception 2. Addtional Error information such as Java doc url for a given * exception can be resolved using this class 3. Error code mappings can be looked up * by providing the the protocol to map to and the Mule exception. */ public final class ExceptionHelper { /** * This is the property to set the error code to no the message it is the * property name the Transport provider uses set the set the error code on the * underlying message */ public static final String ERROR_CODE_PROPERTY = "error.code.property"; /** * a comma-separated list of other protocols the mappings in a file can be * applied to */ public static final String APPLY_TO_PROPERTY = "apply.to"; /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(ExceptionHelper.class); private static String J2SE_VERSION = ""; /** todo How do you get the j2ee version?? */ private static final String J2EE_VERSION = "1.3ee"; private static Properties errorDocs = new Properties(); private static Properties errorCodes = new Properties(); private static Map reverseErrorCodes = null; private static Map errorMappings = new HashMap(); private static int exceptionThreshold = 0; private static boolean verbose = true; private static boolean initialised = false; /** * A list of the exception readers to use for different types of exceptions */ private static List exceptionReaders = new ArrayList(); /** * The default ExceptionReader which will be used for most types of exceptions */ private static ExceptionReader defaultExceptionReader = new DefaultExceptionReader(); static { initialise(); } /** Do not instanciate. */ private ExceptionHelper() { // no-op } private static void initialise() { try { if (initialised) { return; } registerExceptionReader(new MuleExceptionReader()); registerExceptionReader(new NamingExceptionReader()); J2SE_VERSION = System.getProperty("java.specification.version"); String name = SpiUtils.SERVICE_ROOT + SpiUtils.EXCEPTION_SERVICE_PATH + "mule-exception-codes.properties"; InputStream in = ExceptionHelper.class.getClassLoader().getResourceAsStream(name); if (in == null) { throw new IllegalArgumentException("Failed to load resource: " + name); } errorCodes.load(in); in.close(); reverseErrorCodes = MapUtils.invertMap(errorCodes); name = SpiUtils.SERVICE_ROOT + SpiUtils.EXCEPTION_SERVICE_PATH + "mule-exception-config.properties"; in = ExceptionHelper.class.getClassLoader().getResourceAsStream(name); if (in == null) { throw new IllegalArgumentException("Failed to load resource: " + name); } errorDocs.load(in); in.close(); initialised = true; } catch (Exception e) { throw new MuleRuntimeException(CoreMessages.failedToLoad("Exception resources"), e); } } public static int getErrorCode(Class exception) { String code = errorCodes.getProperty(exception.getName(), "-1"); return Integer.parseInt(code); } public static Class getErrorClass(int code) { String key = String.valueOf(code); Object clazz = reverseErrorCodes.get(key); if (clazz == null) { return null; } else if (clazz instanceof Class) { return (Class)clazz; } else { try { clazz = ClassUtils.loadClass(clazz.toString(), ExceptionHelper.class); } catch (ClassNotFoundException e) { logger.error(e.getMessage(), e); return null; } reverseErrorCodes.put(key, clazz); return (Class)clazz; } } private static Properties getErrorMappings(String protocol) { Object m = errorMappings.get(protocol); if (m != null) { if (m instanceof Properties) { return (Properties)m; } else { return null; } } else { String name = SpiUtils.SERVICE_ROOT + SpiUtils.EXCEPTION_SERVICE_PATH + protocol + "-exception-mappings.properties"; InputStream in = ExceptionHelper.class.getClassLoader().getResourceAsStream(name); if (in == null) { errorMappings.put(protocol, "not found"); logger.warn("Failed to load error mappings from: " + name + " This may be because there are no error code mappings for protocol: " + protocol); return null; } Properties p = new Properties(); try { p.load(in); in.close(); } catch (IOException iox) { throw new IllegalArgumentException("Failed to load resource: " + name); } errorMappings.put(protocol, p); String applyTo = p.getProperty(APPLY_TO_PROPERTY, null); if (applyTo != null) { String[] protocols = StringUtils.splitAndTrim(applyTo, ","); for (int i = 0; i < protocols.length; i++) { errorMappings.put(protocols[i], p); } } return p; } } public static String getErrorCodePropertyName(String protocol) { protocol = protocol.toLowerCase(); Properties mappings = getErrorMappings(protocol); if (mappings == null) { return null; } return mappings.getProperty(ERROR_CODE_PROPERTY); } public static String getErrorMapping(String protocol, Class exception) { protocol = protocol.toLowerCase(); Properties mappings = getErrorMappings(protocol); if (mappings == null) { logger.info("No mappings found for protocol: " + protocol); return String.valueOf(getErrorCode(exception)); } Class clazz = exception; String code = null; while (!clazz.equals(Object.class)) { code = mappings.getProperty(clazz.getName()); if (code == null) { clazz = clazz.getSuperclass(); } else { return code; } } code = String.valueOf(getErrorCode(exception)); // Finally lookup mapping based on error code and return the Mule error // code if a match is not found return mappings.getProperty(code, code); } public static String getJavaDocUrl(Class exception) { return getDocUrl("javadoc.", exception.getName()); } public static String getDocUrl(Class exception) { return getDocUrl("doc.", exception.getName()); } private static String getDocUrl(String prefix, String packageName) { String key = prefix; if (packageName.startsWith("java.") || packageName.startsWith("javax.")) { key += J2SE_VERSION; } String url = getUrl(key, packageName); if (url == null && (packageName.startsWith("java.") || packageName.startsWith("javax."))) { key = prefix + J2EE_VERSION; url = getUrl(key, packageName); } if (url != null) { if (!url.endsWith("/")) { url += "/"; } String s = packageName.replaceAll("[.]", "/"); s += ".html"; url += s; } return url; } private static String getUrl(String key, String packageName) { String url = null; if (!key.endsWith(".")) { key += "."; } while (packageName.length() > 0) { url = errorDocs.getProperty(key + packageName, null); if (url == null) { int i = packageName.lastIndexOf("."); if (i == -1) { packageName = ""; } else { packageName = packageName.substring(0, i); } } else { break; } } return url; } public static Throwable getRootException(Throwable t) { Throwable cause = t; Throwable root = null; while (cause != null) { root = cause; cause = getExceptionReader(cause).getCause(cause); // address some misbehaving exceptions, avoid endless loop if (t == cause) { break; } } return root; } public static Throwable getRootParentException(Throwable t) { Throwable cause = t; Throwable parent = t; while (cause != null) { if (cause.getCause() == null) { return parent; } parent = cause; cause = getExceptionReader(cause).getCause(cause); // address some misbehaving exceptions, avoid endless loop if (t == cause) { break; } } return t; } public static MuleException getRootMuleException(Throwable t) { Throwable cause = t; MuleException umoException = null; while (cause != null) { if (cause instanceof MuleException) { umoException = (MuleException)cause; } cause = getExceptionReader(cause).getCause(cause); // address some misbehaving exceptions, avoid endless loop if (t == cause) { break; } } return umoException; } public static List getExceptionsAsList(Throwable t) { List exceptions = new ArrayList(); Throwable cause = t; while (cause != null) { exceptions.add(0, cause); cause = getExceptionReader(cause).getCause(cause); // address some misbehaving exceptions, avoid endless loop if (t == cause) { break; } } return exceptions; } public static Map getExceptionInfo(Throwable t) { Map info = new HashMap(); Throwable cause = t; while (cause != null) { info.putAll(getExceptionReader(cause).getInfo(cause)); cause = getExceptionReader(cause).getCause(cause); // address some misbehaving exceptions, avoid endless loop if (t == cause) { break; } } return info; } public static String getExceptionStack(Throwable t) { StringBuffer buf = new StringBuffer(); // get exception stack List exceptions = getExceptionsAsList(t); int i = 1; for (Iterator iterator = exceptions.iterator(); iterator.hasNext(); i++) { if (i > exceptionThreshold && exceptionThreshold > 0) { buf.append("(").append(exceptions.size() - i + 1).append(" more...)"); break; } Throwable throwable = (Throwable)iterator.next(); ExceptionReader er = getExceptionReader(throwable); buf.append(i).append(". ").append(er.getMessage(throwable)).append(" ("); buf.append(throwable.getClass().getName()).append(")\n"); if (verbose && throwable.getStackTrace().length > 0) { StackTraceElement e = throwable.getStackTrace()[0]; buf.append(" ") .append(e.getClassName()) .append(":") .append(e.getLineNumber()) .append(" (") .append(getJavaDocUrl(throwable.getClass())) .append(")\n"); } } return buf.toString(); } /** * Registers an exception reader with Mule * * @param reader the reader to register. */ public static void registerExceptionReader(ExceptionReader reader) { exceptionReaders.add(reader); } /** * Gets an exception reader for the exception * * @param t the exception to get a reader for * @return either a specific reader or an instance of DefaultExceptionReader. * This method never returns null; */ public static ExceptionReader getExceptionReader(Throwable t) { for (Iterator iterator = exceptionReaders.iterator(); iterator.hasNext();) { ExceptionReader exceptionReader = (ExceptionReader)iterator.next(); if (exceptionReader.getExceptionType().isInstance(t)) { return exceptionReader; } } return defaultExceptionReader; } public static String writeException(Throwable t) { ExceptionReader er = getExceptionReader(t); StringBuffer msg = new StringBuffer(); msg.append(er.getMessage(t)).append(". Type: ").append(t.getClass()); return msg.toString(); } } mule-2.0.1/core/src/main/java/org/mule/config/ConfigResource.java0000644000175000017500000000541611002162333024437 0ustar charlescharles/* * $Id: ConfigResource.java 11600 2008-04-18 18:13:47Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import org.mule.util.IOUtils; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.IOException; import java.net.URL; /** * A ConfigResource holds the url description (or location) and the url stream. It is useful to associate the two * for error reporting when the stream cannot be read. */ public class ConfigResource { protected String resourceName; private URL url; private InputStream inputStream; public ConfigResource(String resourceName) throws IOException { this.resourceName = resourceName; url = IOUtils.getResourceAsUrl(resourceName, getClass(), true, true); if(url == null) { throw new FileNotFoundException(resourceName); } } public ConfigResource(URL url) { this.url = url; this.resourceName = url.toExternalForm(); } public ConfigResource(String resourceName, InputStream inputStream) { this.inputStream = inputStream; this.resourceName = resourceName; } public InputStream getInputStream() throws IOException { if(inputStream==null && url !=null) { inputStream = url.openStream(); } return inputStream; } public URL getUrl() { return url; } public String getResourceName() { return resourceName; } public boolean isStreamOpen() { return inputStream!=null; } public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ConfigResource that = (ConfigResource) o; if (resourceName != null ? !resourceName.equals(that.resourceName) : that.resourceName != null) { return false; } return true; } public int hashCode() { int result; result = (resourceName != null ? resourceName.hashCode() : 0); result = 31 * result + (url != null ? url.hashCode() : 0); return result; } public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("ConfigResource"); sb.append("{resourceName='").append(resourceName).append('\''); sb.append('}'); return sb.toString(); } } mule-2.0.1/core/src/main/java/org/mule/config/DefaultExceptionReader.java0000644000175000017500000000240310745677442026132 0ustar charlescharles/* * $Id: DefaultExceptionReader.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import org.mule.api.config.ExceptionReader; import java.util.HashMap; import java.util.Map; /** * This is the default exception reader used if there is no specific one registered * for the current exception. */ public final class DefaultExceptionReader implements ExceptionReader { private Map info = new HashMap(); public String getMessage(Throwable t) { return t.getMessage(); } public Throwable getCause(Throwable t) { return t.getCause(); } public Class getExceptionType() { return Throwable.class; } /** * Returns a map of the non-stanard information stored on the exception * * @return a map of the non-stanard information stored on the exception */ public Map getInfo(Throwable t) { return info; } } mule-2.0.1/core/src/main/java/org/mule/config/MuleManifest.java0000644000175000017500000001120110766637211024122 0ustar charlescharles/* * $Id: MuleManifest.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import org.mule.api.config.MuleConfiguration; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Enumeration; import java.util.jar.Attributes; import java.util.jar.Manifest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This is a static class that provides access to the Mule core manifest file. */ public class MuleManifest { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(MuleManifest.class); private static Manifest manifest; public static String getProductVersion() { return getManifestProperty("Implementation-Version"); } public static String getVendorName() { return getManifestProperty("Specification-Vendor"); } public static String getVendorUrl() { return getManifestProperty("Vendor-Url"); } public static String getProductUrl() { return getManifestProperty("Product-Url"); } public static String getProductName() { return getManifestProperty("Implementation-Title"); } public static String getProductMoreInfo() { return getManifestProperty("More-Info"); } public static String getProductSupport() { return getManifestProperty("Support"); } public static String getProductLicenseInfo() { return getManifestProperty("License"); } public static String getProductDescription() { return getManifestProperty("Description"); } public static String getBuildNumber() { return getManifestProperty("Build-Revision"); } public static String getBuildDate() { return getManifestProperty("Build-Date"); } public static String getDevListEmail() { return getManifestProperty("Dev-List-Email"); } public static String getDTDSystemId() { return getManifestProperty("Dtd-System-Id"); } public static String getDTDPublicId() { return getManifestProperty("Dtd-Public-Id"); } public static Manifest getManifest() { if (manifest == null) { manifest = new Manifest(); InputStream is = null; try { // We want to load the MANIFEST.MF from the mule-core jar. Sine we // don't know the version we're using we have to search for the jar on the classpath URL url = (URL) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { Enumeration e = MuleConfiguration.class.getClassLoader().getResources( ("META-INF/MANIFEST.MF")); while (e.hasMoreElements()) { URL url = (URL) e.nextElement(); if (url.toExternalForm().indexOf("mule-core") > -1) { return url; } } } catch (IOException e1) { logger.warn("Failure reading manifest: " + e1.getMessage(), e1); } return null; } }); if (url != null) { is = url.openStream(); } if (is != null) { manifest.read(is); } } catch (IOException e) { logger.warn("Failed to read manifest Info, Manifest information will not display correctly: " + e.getMessage()); } } return manifest; } protected static String getManifestProperty(String name) { return getManifest().getMainAttributes().getValue(new Attributes.Name(name)); } } mule-2.0.1/core/src/main/java/org/mule/config/PoolingProfile.java0000644000175000017500000001751110746275214024472 0ustar charlescharles/* * $Id: PoolingProfile.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.config; import java.util.Map; import org.apache.commons.collections.map.CaseInsensitiveMap; /** * PoolingProfile is a configuration object used to define the object * pooling parameters for the service it is associated with. */ public class PoolingProfile { /** * Tells the object pool not to initialise any components on startup. */ public static final int INITIALISE_NONE = 0; /** * Tells the object pool only to initialise one service on startup. */ public static final int INITIALISE_ONE = 1; /** * Tells the object pool to initialise all components on startup. */ public static final int INITIALISE_ALL = 2; // Constants used to determine the exhausted action of the pool public static final int WHEN_EXHAUSTED_FAIL = 0; /** @deprecated use WHEN_EXHAUSTED_WAIT instead */ public static final int WHEN_EXHAUSTED_BLOCK = 1; public static final int WHEN_EXHAUSTED_WAIT = 1; public static final int WHEN_EXHAUSTED_GROW = 2; /** * Controls the maximum number of Mule UMOs that can be borrowed from a service * pool at one time. When non-positive, there is no limit to the number of * components that may be active at one time. When maxActive is exceeded, the * pool is said to be exhausted. You can specify this value on the descriptor * declaration. If none is set this value will be used. */ public static final int DEFAULT_MAX_POOL_ACTIVE = 5; /** * Controls the maximum number of Mule UMOs that can sit idle in the pool at any * time. When non-positive, there is no limit to the number of Mule UMOs that may * be idle at one time. You can specify this value on the descriptor declaration. * If none is set this value will be used. If this value is not set then a system * default of '5' will be used. */ public static final int DEFAULT_MAX_POOL_IDLE = 5; /** * When the threadPoolExhaustedAction is set to WHEN_EXHAUSTED_WAIT this can * specify the maximum milliseconds the pool should block before throwing a * NoSuchElementException */ public static final long DEFAULT_MAX_POOL_WAIT = 4000; /** * Specifies the behaviour of the Mule UMO pool when the pool is exhausted: *

      *
    • WHEN_EXHAUSTED_FAIL : will throw a NoSuchElementException
    • *
    • WHEN_EXHAUSTED_WAIT : will block (invoke Object.wait(long) until a new or * idle object is available.
    • *
    • WHEN_EXHAUSTED_GROW : will create a new Mule and return it (essentially * making maxActive meaningless).
    • *
    * If a positive maxWait value is supplied, it will block for at most that many * milliseconds, after which a NoSuchElementException will be thrown. If maxWait * is non-positive, it will block indefinitely. */ public static final int DEFAULT_POOL_EXHAUSTED_ACTION = WHEN_EXHAUSTED_GROW; /** * Determines how components in a pool should be initialised. The possible values * are: *
      *
    • INITIALISE_NONE : Will not load any components in the pool on startup
    • *
    • INITIALISE_ONE : Will load only the first service in the pool on * startup
    • *
    • INITIALISE_ALL : Will load all components in the pool on startup
    • *
    */ public static final int DEFAULT_POOL_INITIALISATION_POLICY = INITIALISE_ONE; // map pool exhaustion strings to their respective values public static final Map POOL_EXHAUSTED_ACTIONS = new CaseInsensitiveMap() { private static final long serialVersionUID = 1L; // static initializer { // if the values were an actual enum in ObjectPool we could iterate // properly.. :/ Integer value = new Integer(WHEN_EXHAUSTED_WAIT); this.put("WHEN_EXHAUSTED_WAIT", value); value = new Integer(WHEN_EXHAUSTED_FAIL); this.put("WHEN_EXHAUSTED_FAIL", value); value = new Integer(WHEN_EXHAUSTED_GROW); this.put("WHEN_EXHAUSTED_GROW", value); } }; // map pool initialisation policy strings to their respective values public static final Map POOL_INITIALISATION_POLICIES = new CaseInsensitiveMap() { private static final long serialVersionUID = 1L; // static initializer { Integer value = new Integer(INITIALISE_NONE); this.put("INITIALISE_NONE", value); value = new Integer(INITIALISE_ONE); this.put("INITIALISE_ONE", value); value = new Integer(INITIALISE_ALL); this.put("INITIALISE_ALL", value); } }; private int maxActive = DEFAULT_MAX_POOL_ACTIVE; private int maxIdle = DEFAULT_MAX_POOL_IDLE; private long maxWait = DEFAULT_MAX_POOL_WAIT; private int exhaustedAction = DEFAULT_POOL_EXHAUSTED_ACTION; private int initialisationPolicy = DEFAULT_POOL_INITIALISATION_POLICY; // private UMOPoolFactory poolFactory = new CommonsPoolFactory(); public PoolingProfile() { super(); } public PoolingProfile(PoolingProfile pp) { this.maxActive = pp.getMaxActive(); this.maxIdle = pp.getMaxIdle(); this.maxWait = pp.getMaxWait(); this.exhaustedAction = pp.getExhaustedAction(); this.initialisationPolicy = pp.getInitialisationPolicy(); // if (pp.getPoolFactory() != null) // { // poolFactory = pp.getPoolFactory(); // } } public PoolingProfile(int maxActive, int maxIdle, long maxWait, int exhaustedAction, int initialisationPolicy) { this.maxActive = maxActive; this.maxIdle = maxIdle; this.maxWait = maxWait; this.exhaustedAction = exhaustedAction; this.initialisationPolicy = initialisationPolicy; } /** * @return max number of Mule UMOs that can be idle in a service */ public int getMaxIdle() { return maxIdle; } /** * @return max number of Mule UMOs that can be active in a service */ public int getMaxActive() { return maxActive; } /** * @return time in miilisconds to wait for a Mule UMO to be available in a * service when the pool of Mule UMOs is exhausted and the * PoolExhaustedAction is set to WHEN_EXHAUSTED_BLOCK */ public long getMaxWait() { return maxWait; } /** * @return the action when the Mule UMO pool is exhaused for a service */ public int getExhaustedAction() { return exhaustedAction; } public int getInitialisationPolicy() { return initialisationPolicy; } public void setInitialisationPolicy(int policy) { initialisationPolicy = policy; } public void setMaxIdle(int maxIdle) { this.maxIdle = maxIdle; } public void setMaxActive(int maxActive) { this.maxActive = maxActive; } public void setMaxWait(long maxWait) { this.maxWait = maxWait; } public void setExhaustedAction(int exhaustedAction) { this.exhaustedAction = exhaustedAction; } // public UMOPoolFactory getPoolFactory() // { // return poolFactory; // } // // public void setPoolFactory(UMOPoolFactory poolFactory) // { // this.poolFactory = poolFactory; // } } mule-2.0.1/core/src/main/java/org/mule/lifecycle/0000755000175000017500000000000011351411103021342 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/lifecycle/DefaultLifecycleManager.java0000644000175000017500000000343510745677442026743 0ustar charlescharles/* * $Id: DefaultLifecycleManager.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle; import org.mule.api.MuleContext; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.Startable; import org.mule.api.lifecycle.Stoppable; import org.mule.api.registry.Registry; import org.mule.lifecycle.phases.MuleContextStartPhase; import org.mule.lifecycle.phases.MuleContextStopPhase; import org.mule.lifecycle.phases.TransientRegistryDisposePhase; import org.mule.lifecycle.phases.TransientRegistryInitialisePhase; /** * Creates the default Mule lifecycleManager with {@link Initialisable#initialise()}, {@link Startable#start()}, * {@link Stoppable#stop()} and {@link org.mule.api.lifecycle.Disposable#dispose()}. * * @see org.mule.api.lifecycle.Initialisable * @see org.mule.api.lifecycle.Startable * @see org.mule.api.lifecycle.Stoppable * @see org.mule.api.lifecycle.Disposable */ public class DefaultLifecycleManager extends GenericLifecycleManager { public DefaultLifecycleManager() { //Create Lifecycle phases Class[] ignorredObjects = new Class[]{Registry.class, MuleContext.class}; registerLifecycle(new TransientRegistryInitialisePhase(ignorredObjects)); registerLifecycle(new MuleContextStartPhase(ignorredObjects)); registerLifecycle(new MuleContextStopPhase(ignorredObjects)); registerLifecycle(new TransientRegistryDisposePhase(ignorredObjects)); } } mule-2.0.1/core/src/main/java/org/mule/lifecycle/ContainerManagedLifecyclePhase.java0000644000175000017500000000221710745677442030241 0ustar charlescharles/* * $Id: ContainerManagedLifecyclePhase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle; import org.mule.api.MuleException; import org.mule.api.MuleContext; /** * A container-managed lifecycle phase is called by the container itself. This class acts as a marker to enable * tracking of phases even if Mule does not initiate the phase */ public class ContainerManagedLifecyclePhase extends DefaultLifecyclePhase { public ContainerManagedLifecyclePhase(String name, Class lifecycleClass, String oppositePhaseName) { super(name, lifecycleClass, oppositePhaseName); } //@java.lang.Override public void fireLifecycle(MuleContext muleContext, String currentPhase) throws MuleException { //The container manages this lifecycle return; } } mule-2.0.1/core/src/main/java/org/mule/lifecycle/AlreadyInitialisedException.java0000644000175000017500000000224410746275214027650 0ustar charlescharles/* * $Id: AlreadyInitialisedException.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; /** * AlreadyInitialisedException is thrown when a service or connector * has already been initialised. */ public class AlreadyInitialisedException extends InitialisationException { /** Serial version */ private static final long serialVersionUID = 3121894155097428317L; /** * @param object the object that has been initialised and cannot be initialised * again */ public AlreadyInitialisedException(String name, Initialisable object) { super(CoreMessages.objectAlreadyInitialised(name), object); } } mule-2.0.1/core/src/main/java/org/mule/lifecycle/DefaultLifecyclePhase.java0000644000175000017500000002077610776664712026440 0ustar charlescharles/* * $Id: DefaultLifecyclePhase.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.lifecycle.LifecycleException; import org.mule.api.lifecycle.LifecyclePhase; import org.mule.api.registry.Registry; import org.mule.config.i18n.CoreMessages; import org.mule.util.ClassUtils; import org.mule.util.StringMessageUtils; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Represents a configurable lifecycle phase. This is a default implementation of a 'generic phase' in that is * can be configured to represnt any phase. Instances of this phase can then be registered with a * {@link org.mule.api.lifecycle.LifecycleManager} and by used to enforce a lifecycle phase on an object. * Usually, Lifecycle phases have a fixed configuration in which case a specialisation of this class should be * created that initialises its configuration internally. * *

    Note that this class and {@link org.mule.api.lifecycle.LifecycleTransitionResult} both make assumptions about * the interfaces used - the return values and exceptions. These are, currently, that the return value is either * void or {@link org.mule.api.lifecycle.LifecycleTransitionResult} and either 0 or 1 exceptions can be * thrown which are either {@link InstantiationException} or {@link org.mule.api.lifecycle.LifecycleException}. * * @see org.mule.api.lifecycle.LifecyclePhase */ public class DefaultLifecyclePhase implements LifecyclePhase { protected transient final Log logger = LogFactory.getLog(DefaultLifecyclePhase.class); private Class lifecycleClass; private Method lifecycleMethod; private Set orderedLifecycleObjects = new LinkedHashSet(6); private Class[] ignorredObjectTypes; private String name; private String oppositeLifecyclePhase; private Set supportedPhases; private int registryScope = Registry.SCOPE_REMOTE; public DefaultLifecyclePhase(String name, Class lifecycleClass, String oppositeLifecyclePhase) { this.name = name; this.lifecycleClass = lifecycleClass; //DefaultLifecyclePhase interface only has one method lifecycleMethod = lifecycleClass.getMethods()[0]; this.oppositeLifecyclePhase = oppositeLifecyclePhase; } public void fireLifecycle(MuleContext muleContext, String currentPhase) throws MuleException { if (logger.isDebugEnabled()) { logger.debug("Attempting to fire lifecycle phase: " + getName()); } if (currentPhase.equals(name)) { if (logger.isDebugEnabled()) { logger.debug("Not firing, already in lifecycle phase: " + getName()); } return; } if (!isPhaseSupported(currentPhase)) { throw new IllegalStateException("Lifecycle phase: " + name + " does not support current phase: " + currentPhase + ". Phases supported are: " + StringMessageUtils.toString(supportedPhases)); } // overlapping interfaces can cause duplicates Set duplicates = new HashSet(); for (Iterator iterator = orderedLifecycleObjects.iterator(); iterator.hasNext();) { LifecycleObject lo = (LifecycleObject) iterator.next(); Collection lifecycleInstances = RegistryContext.getRegistry().lookupObjects(lo.getType(), getRegistryScope()); if (lifecycleInstances.size() == 0) { continue; } List targets = this.sortLifecycleInstances(lifecycleInstances, lo); lo.firePreNotification(muleContext); for (Iterator target = targets.iterator(); target.hasNext();) { Object o = target.next(); if (duplicates.contains(o)) { target.remove(); } else { if (logger.isDebugEnabled()) { logger.debug("lifecycle phase: " + getName() + " for object: " + o); } this.applyLifecycle(o); target.remove(); duplicates.add(o); } } lo.firePostNotification(muleContext); } } /** * Subclasses can override this method to order objects before * the lifecycle method is applied to them. * * This method does not apply any special ordering to objects. * * @param objects * @param lo * @return List with ordered objects */ protected List sortLifecycleInstances(Collection objects, LifecycleObject lo) { return new ArrayList(objects); } public void addOrderedLifecycleObject(LifecycleObject lco) { orderedLifecycleObjects.add(lco); } public void removeOrderedLifecycleObject(LifecycleObject lco) { orderedLifecycleObjects.remove(lco); } protected boolean ignoreType(Class type) { if (ignorredObjectTypes == null) { return false; } else { for (int i = 0; i < ignorredObjectTypes.length; i++) { Class ignorredObjectType = ignorredObjectTypes[i]; if (ignorredObjectType.isAssignableFrom(type)) { return true; } } } return false; } public Set getOrderedLifecycleObjects() { return orderedLifecycleObjects; } public void setOrderedLifecycleObjects(Set orderedLifecycleObjects) { this.orderedLifecycleObjects = orderedLifecycleObjects; } public Class[] getIgnoredObjectTypes() { return ignorredObjectTypes; } public void setIgnoredObjectTypes(Class[] ignorredObjectTypes) { this.ignorredObjectTypes = ignorredObjectTypes; } public Class getLifecycleClass() { return lifecycleClass; } public void setLifecycleClass(Class lifecycleClass) { this.lifecycleClass = lifecycleClass; } public String getName() { return name; } public Set getSupportedPhases() { return supportedPhases; } public void setSupportedPhases(Set supportedPhases) { this.supportedPhases = supportedPhases; } public void registerSupportedPhase(String phase) { if (supportedPhases == null) { supportedPhases = new HashSet(); } supportedPhases.add(phase); } public boolean isPhaseSupported(String phase) { if (getSupportedPhases() == null) { return true; } else { if (getSupportedPhases().contains(ALL_PHASES)) { return true; } else { return getSupportedPhases().contains(phase); } } } public void applyLifecycle(Object o) throws LifecycleException { if (o == null) { return; } if (ignoreType(o.getClass())) { return; } if (!getLifecycleClass().isAssignableFrom(o.getClass())) { return; } try { lifecycleMethod.invoke(o, ClassUtils.NO_ARGS); } catch (Exception e) { throw new LifecycleException(CoreMessages.failedToInvokeLifecycle(lifecycleMethod.getName(), o), e, this); } } public int getRegistryScope() { return registryScope; } public void setRegistryScope(int registryScope) { this.registryScope = registryScope; } public String getOppositeLifecyclePhase() { return oppositeLifecyclePhase; } } mule-2.0.1/core/src/main/java/org/mule/lifecycle/GenericLifecycleManager.java0000644000175000017500000001435610774254333026727 0ustar charlescharles/* * $Id: GenericLifecycleManager.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.lifecycle.LifecycleManager; import org.mule.api.lifecycle.LifecyclePhase; import org.mule.lifecycle.phases.NotInLifecyclePhase; import org.mule.util.StringMessageUtils; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.apache.commons.collections.set.ListOrderedSet; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class GenericLifecycleManager implements LifecycleManager { /** * logger used by this class */ protected transient final Log logger = LogFactory.getLog(GenericLifecycleManager.class); protected static NotInLifecyclePhase notInLifecyclePhase = new NotInLifecyclePhase(); protected String currentPhase = notInLifecyclePhase.getName(); protected String executingPhase = null; protected ListOrderedSet lifecycles = new ListOrderedSet(); protected Map index = new HashMap(6); protected Set completedPhases = new HashSet(6); public Set getLifecycles() { return lifecycles; } public void setLifecycles(Set lifecycles) { for (Iterator iterator = lifecycles.iterator(); iterator.hasNext();) { LifecyclePhase phase = (LifecyclePhase) iterator.next(); registerLifecycle(phase); } } public void registerLifecycle(LifecyclePhase lci) { index.put(lci.getName(), new Integer(lifecycles.size())); lifecycles.add(lci); } public void firePhase(MuleContext muleContext, String phase) throws MuleException { if (currentPhase.equalsIgnoreCase(phase)) { logger.debug("Already in lifecycle phase: " + phase); return; } Integer phaseIndex = (Integer) index.get(phase); if (phaseIndex == null) { throw new IllegalArgumentException("No lifeccycle phase registered with name: " + phase); } try { setExecutingPhase(phase); LifecyclePhase li = (LifecyclePhase) lifecycles.get(phaseIndex.intValue()); li.fireLifecycle(muleContext, currentPhase); setCurrentPhase(li); } finally { setExecutingPhase(null); } } public String getCurrentPhase() { return currentPhase; } /** * Returns the name of the currently executing phase or null if there is not current phase * * @return */ public String getExecutingPhase() { return executingPhase; } protected synchronized void setCurrentPhase(LifecyclePhase phase) { completedPhases.add(phase.getName()); completedPhases.remove(phase.getOppositeLifecyclePhase()); this.currentPhase = phase.getName(); } protected synchronized void setExecutingPhase(String phase) { this.executingPhase = phase; } public void reset() { setExecutingPhase(null); completedPhases.clear(); setCurrentPhase(notInLifecyclePhase); } public boolean isPhaseComplete(String phaseName) { return completedPhases.contains(phaseName); } public void applyLifecycle(MuleContext muleContext, Object object) throws MuleException { logger.debug("applying lifecycle to " + object); LifecyclePhase lcp; String phase; Integer phaseIndex; for (Iterator iterator = completedPhases.iterator(); iterator.hasNext();) { phase = (String) iterator.next(); phaseIndex = (Integer) index.get(phase); lcp = (LifecyclePhase) lifecycles.get(phaseIndex.intValue()); if (logger.isDebugEnabled()) { logger.debug("phase: " + lcp); } lcp.applyLifecycle(object); } //If we're currently in a phase, fire that too if (getExecutingPhase() != null) { phaseIndex = (Integer) index.get(getExecutingPhase()); lcp = (LifecyclePhase) lifecycles.get(phaseIndex.intValue()); if (logger.isDebugEnabled()) { logger.debug("and executing: " + lcp); } lcp.applyLifecycle(object); } } public void checkPhase(String name) throws IllegalStateException { if (completedPhases.contains(name)) { throw new IllegalStateException("Phase '" + name + "' has already been executed"); } if (name.equalsIgnoreCase(executingPhase)) { throw new IllegalStateException("Phase '" + name + "' is already currently being executed"); } if (executingPhase != null) { throw new IllegalStateException("Currently executing lifecycle phase: " + executingPhase); } Integer phaseIndex = (Integer) index.get(name); if (phaseIndex == null) { throw new IllegalStateException("Phase does not exist: " + name); } if (NotInLifecyclePhase.PHASE_NAME.equals(currentPhase)) { if (phaseIndex.intValue() > 0) { throw new IllegalStateException("The first lifecycle phase has to be called before the '" + name + "' phase"); } } else { LifecyclePhase phase = (LifecyclePhase) lifecycles.get(phaseIndex.intValue()); if (!phase.isPhaseSupported(currentPhase)) { throw new IllegalStateException("Lifecycle phase: " + currentPhase + " does not support current phase: " + name + ". Phases supported are: " + StringMessageUtils.toString(phase.getSupportedPhases())); } } } } mule-2.0.1/core/src/main/java/org/mule/lifecycle/phases/0000755000175000017500000000000011351411102022624 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/lifecycle/phases/TransientRegistryDisposePhase.java0000644000175000017500000000555010763554366031536 0ustar charlescharles/* * $Id: TransientRegistryDisposePhase.java 11181 2008-03-05 17:31:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle.phases; import org.mule.api.MuleContext; import org.mule.api.agent.Agent; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.LifecyclePhase; import org.mule.api.model.Model; import org.mule.api.registry.Registry; import org.mule.api.transport.Connector; import org.mule.context.notification.MuleContextNotification; import org.mule.lifecycle.DefaultLifecyclePhase; import org.mule.lifecycle.NotificationLifecycleObject; import java.util.LinkedHashSet; import java.util.Set; /** * The Dispose phase for the TransientRegistry LifecycleManager. Calling {@link org.mule.registry.TransientRegistry#dispose()} * with initiate this phase via the {@link org.mule.api.lifecycle.LifecycleManager}. * This phase controls the order in which objects should be disposed. * * @see org.mule.api.MuleContext * @see org.mule.api.lifecycle.LifecycleManager * @see org.mule.registry.TransientRegistry * @see org.mule.api.lifecycle.Disposable */ public class TransientRegistryDisposePhase extends DefaultLifecyclePhase { public TransientRegistryDisposePhase() { this(new Class[]{Registry.class}); } public TransientRegistryDisposePhase(Class[] ignorredObjects) { super(Disposable.PHASE_NAME, Disposable.class, Initialisable.PHASE_NAME); Set disposeOrderedObjects = new LinkedHashSet(); // disposeOrderedObjects.add(new NotificationLifecycleObject(MuleContext.class, MuleContextNotification.class, // MuleContextNotification.getActionName(MuleContextNotification.CONTEXT_DISPOSING), // MuleContextNotification.getActionName(MuleContextNotification.CONTEXT_DISPOSED))); disposeOrderedObjects.add(new NotificationLifecycleObject(MuleContext.class)); disposeOrderedObjects.add(new NotificationLifecycleObject(Connector.class, MuleContextNotification.class, MuleContextNotification.CONTEXT_DISPOSING_CONNECTORS,MuleContextNotification.CONTEXT_DISPOSED_CONNECTORS)); disposeOrderedObjects.add(new NotificationLifecycleObject(Agent.class)); disposeOrderedObjects.add(new NotificationLifecycleObject(Model.class)); disposeOrderedObjects.add(new NotificationLifecycleObject(Disposable.class)); setIgnoredObjectTypes(ignorredObjects); setOrderedLifecycleObjects(disposeOrderedObjects); registerSupportedPhase(LifecyclePhase.ALL_PHASES); } } mule-2.0.1/core/src/main/java/org/mule/lifecycle/phases/NotInLifecyclePhase.java0000644000175000017500000000173410745677442027357 0ustar charlescharles/* * $Id: NotInLifecyclePhase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle.phases; import org.mule.api.lifecycle.LifecyclePhase; import org.mule.lifecycle.DefaultLifecyclePhase; /** * This lifecycle phase marks the 'pre-lifecycle' phase of an object. The default phase before * any other phase has been executed */ public class NotInLifecyclePhase extends DefaultLifecyclePhase { public static String PHASE_NAME = "not in lifecycle"; public NotInLifecyclePhase() { super(PHASE_NAME, NotInLifecyclePhase.class, null); registerSupportedPhase(LifecyclePhase.ALL_PHASES); } }mule-2.0.1/core/src/main/java/org/mule/lifecycle/phases/MuleContextInitialisePhase.java0000644000175000017500000000205210745677442030764 0ustar charlescharles/* * $Id: MuleContextInitialisePhase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle.phases; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.lifecycle.ContainerManagedLifecyclePhase; /** * Since all objects are created and initialised in the registry, the Initialise lifecyclePhase is always * taken care of by the Registry, hence this class extends {@link org.mule.lifecycle.ContainerManagedLifecyclePhase} */ public class MuleContextInitialisePhase extends ContainerManagedLifecyclePhase { public MuleContextInitialisePhase() { super(Initialisable.PHASE_NAME, Initialisable.class, Disposable.PHASE_NAME); } }mule-2.0.1/core/src/main/java/org/mule/lifecycle/phases/MuleContextStopPhase.java0000644000175000017500000000502510763554366027621 0ustar charlescharles/* * $Id: MuleContextStopPhase.java 11181 2008-03-05 17:31:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle.phases; import org.mule.api.MuleContext; import org.mule.api.agent.Agent; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.Startable; import org.mule.api.lifecycle.Stoppable; import org.mule.api.model.Model; import org.mule.api.registry.Registry; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.context.notification.MuleContextNotification; import org.mule.lifecycle.DefaultLifecyclePhase; import org.mule.lifecycle.NotificationLifecycleObject; import java.util.LinkedHashSet; import java.util.Set; /** * The Stop phase for the Management context LifecycleManager. Calling {@link org.mule.api.UMOManagementContext#stop()} * with initiate this phase via the {@link org.mule.api.lifecycle.LifecycleManager}. * This phase controls the order in which objects should be stopped. * * @see org.mule.api.UMOManagementContext * @see org.mule.api.lifecycle.LifecycleManager * @see org.mule.api.lifecycle.Stoppable */ public class MuleContextStopPhase extends DefaultLifecyclePhase { public MuleContextStopPhase() { this(new Class[]{Registry.class, MuleContext.class}); } public MuleContextStopPhase(Class[] ignorredObjects) { super(Stoppable.PHASE_NAME, Stoppable.class, Startable.PHASE_NAME); Set stopOrderedObjects = new LinkedHashSet(); stopOrderedObjects.add(new NotificationLifecycleObject(Connector.class)); stopOrderedObjects.add(new NotificationLifecycleObject(Agent.class)); stopOrderedObjects.add(new NotificationLifecycleObject(Model.class, MuleContextNotification.class, MuleContextNotification.CONTEXT_STOPPING_MODELS,MuleContextNotification.CONTEXT_STOPPED_MODELS)); stopOrderedObjects.add(new NotificationLifecycleObject(Service.class)); stopOrderedObjects.add(new NotificationLifecycleObject(Stoppable.class)); setIgnoredObjectTypes(ignorredObjects); setOrderedLifecycleObjects(stopOrderedObjects); registerSupportedPhase(Startable.PHASE_NAME); registerSupportedPhase(Initialisable.PHASE_NAME); } }mule-2.0.1/core/src/main/java/org/mule/lifecycle/phases/MuleContextDisposePhase.java0000644000175000017500000000275610745677442030313 0ustar charlescharles/* * $Id: MuleContextDisposePhase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle.phases; import org.mule.api.MuleException; import org.mule.api.MuleContext; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.lifecycle.DefaultLifecyclePhase; /** * Objects are disposed of via the Registry since the Registry manages the creation/initialisation of the objects * it must also take care of disposing them. However, a user may want to initiate a dispose via the * {@link org.mule.DefaultMuleContext} so the dispose Lifecycle phase for the {@link org.mule.DefaultMuleContext} * needs to call dispose on the Registry. */ public class MuleContextDisposePhase extends DefaultLifecyclePhase { public MuleContextDisposePhase() { super(Disposable.PHASE_NAME, Disposable.class, Initialisable.PHASE_NAME); } public void fireLifecycle(MuleContext muleContext, String currentPhase) throws MuleException { //Delegate this to the Registry if (muleContext.getRegistry() != null) { muleContext.getRegistry().dispose(); } } } mule-2.0.1/core/src/main/java/org/mule/lifecycle/phases/MuleContextStartPhase.java0000644000175000017500000000601610776664712027773 0ustar charlescharles/* * $Id: MuleContextStartPhase.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle.phases; import org.mule.agent.AgentSorter; import org.mule.api.MuleContext; import org.mule.api.agent.Agent; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.Startable; import org.mule.api.lifecycle.Stoppable; import org.mule.api.model.Model; import org.mule.api.registry.Registry; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.context.notification.MuleContextNotification; import org.mule.lifecycle.DefaultLifecyclePhase; import org.mule.lifecycle.LifecycleObject; import org.mule.lifecycle.NotificationLifecycleObject; import java.util.Collection; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; /** * The Start phase for the Management context LifecycleManager. Calling * {@link org.mule.api.UMOManagementContext#start()} with initiate this phase via the * {@link org.mule.api.lifecycle.LifecycleManager}. This phase controls the order in * which objects should be started. * * @see org.mule.api.UMOManagementContext * @see org.mule.api.lifecycle.LifecycleManager * @see org.mule.api.lifecycle.Startable */ public class MuleContextStartPhase extends DefaultLifecyclePhase { public MuleContextStartPhase() { this(new Class[]{Registry.class, MuleContext.class}); } public MuleContextStartPhase(Class[] ignorredObjects) { super(Startable.PHASE_NAME, Startable.class, Stoppable.PHASE_NAME); Set startOrderedObjects = new LinkedHashSet(); startOrderedObjects.add(new NotificationLifecycleObject(Connector.class)); startOrderedObjects.add(new NotificationLifecycleObject(Agent.class)); startOrderedObjects.add(new NotificationLifecycleObject(Model.class, MuleContextNotification.class, MuleContextNotification.CONTEXT_STARTING_MODELS, MuleContextNotification.CONTEXT_STARTED_MODELS)); startOrderedObjects.add(new NotificationLifecycleObject(Service.class)); startOrderedObjects.add(new NotificationLifecycleObject(Startable.class)); setIgnoredObjectTypes(ignorredObjects); setOrderedLifecycleObjects(startOrderedObjects); registerSupportedPhase(Stoppable.PHASE_NAME); registerSupportedPhase(Initialisable.PHASE_NAME); } /** * Make sure that the agents are started up in proper order. */ protected List sortLifecycleInstances(Collection objects, LifecycleObject lo) { if (!lo.getType().equals(Agent.class)) { return super.sortLifecycleInstances(objects, lo); } return AgentSorter.sortAgents(objects); } } mule-2.0.1/core/src/main/java/org/mule/lifecycle/phases/TransientRegistryInitialisePhase.java0000644000175000017500000000526310755123151032204 0ustar charlescharles/* * $Id: TransientRegistryInitialisePhase.java 10808 2008-02-14 20:36:57Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle.phases; import org.mule.api.MuleContext; import org.mule.api.agent.Agent; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.model.Model; import org.mule.api.registry.Registry; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.api.transport.Connector; import org.mule.lifecycle.DefaultLifecyclePhase; import org.mule.lifecycle.NotificationLifecycleObject; import java.util.LinkedHashSet; import java.util.Set; /** * The Initialise phase for the TransientRegistry LifecycleManager. Calling {@link org.mule.registry.TransientRegistry#initialise()} * with initiate this phase via the {@link org.mule.api.lifecycle.LifecycleManager}. * This phase controls the order in which objects should be initialised. * * @see org.mule.api.MuleContext * @see org.mule.api.lifecycle.LifecycleManager * @see org.mule.registry.TransientRegistry * @see org.mule.api.lifecycle.Initialisable */ public class TransientRegistryInitialisePhase extends DefaultLifecyclePhase { public TransientRegistryInitialisePhase() { this(new Class[]{Registry.class}); } public TransientRegistryInitialisePhase(Class[] ignorredObjects) { super(Initialisable.PHASE_NAME, Initialisable.class, Disposable.PHASE_NAME); setIgnoredObjectTypes(ignorredObjects); Set initOrderedObjects = new LinkedHashSet(); initOrderedObjects.add(new NotificationLifecycleObject(MuleContext.class)); initOrderedObjects.add(new NotificationLifecycleObject(Connector.class)); initOrderedObjects.add(new NotificationLifecycleObject(Transformer.class)); initOrderedObjects.add(new NotificationLifecycleObject(ImmutableEndpoint.class)); initOrderedObjects.add(new NotificationLifecycleObject(Agent.class)); initOrderedObjects.add(new NotificationLifecycleObject(Service.class)); initOrderedObjects.add(new NotificationLifecycleObject(Model.class)); initOrderedObjects.add(new NotificationLifecycleObject(Initialisable.class)); setOrderedLifecycleObjects(initOrderedObjects); registerSupportedPhase(NotInLifecyclePhase.PHASE_NAME); } } mule-2.0.1/core/src/main/java/org/mule/lifecycle/LifecycleObject.java0000644000175000017500000000360610776664712025272 0ustar charlescharles/* * $Id: LifecycleObject.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle; import org.mule.api.MuleContext; import org.mule.api.context.notification.ServerNotification; import org.mule.util.ClassUtils; public class LifecycleObject { private Class type; private ServerNotification preNotification; private ServerNotification postNotification; public LifecycleObject(Class type) { this.type = type; } public ServerNotification getPostNotification() { return postNotification; } public void setPostNotification(ServerNotification postNotification) { this.postNotification = postNotification; } public ServerNotification getPreNotification() { return preNotification; } public void setPreNotification(ServerNotification preNotification) { this.preNotification = preNotification; } public Class getType() { return type; } public void setType(Class type) { this.type = type; } public void firePreNotification(MuleContext context) { if(preNotification!=null) { context.fireNotification(preNotification); } } public void firePostNotification(MuleContext context) { if(postNotification!=null) { context.fireNotification(postNotification); } } // @Override public String toString() { return super.toString() + " (" + ClassUtils.getSimpleName(type) + ")"; } }mule-2.0.1/core/src/main/java/org/mule/lifecycle/NotificationLifecycleObject.java0000644000175000017500000000730710776664712027643 0ustar charlescharles/* * $Id: NotificationLifecycleObject.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.lifecycle; import org.mule.api.MuleContext; import org.mule.api.MuleRuntimeException; import org.mule.api.context.notification.ServerNotification; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.MuleContextNotification; import org.mule.util.ClassUtils; import java.lang.reflect.Constructor; /** * TODO */ public class NotificationLifecycleObject extends LifecycleObject { private String preNotificationName; private String postNotificationName; private Constructor ctor; public NotificationLifecycleObject(Class type) { super(type); } public NotificationLifecycleObject(Class type, Class notificationClass) { super(type); if (notificationClass==null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("notificationClass").toString()); } // MULE-2903: make sure the notifiactionClass is properly loaded and initialized notificationClass = ClassUtils.initializeClass(notificationClass); if (!ServerNotification.class.isAssignableFrom(notificationClass)) { throw new IllegalArgumentException("Notification class must be of type: " + ServerNotification.class.getName()); } ctor = ClassUtils.getConstructor(notificationClass, new Class[]{Object.class, String.class}); if(ctor==null) { throw new IllegalArgumentException("No constructor defined in Notification class: " + notificationClass + " with arguments (Object.class, String.class)"); } } public NotificationLifecycleObject(Class type, Class notificationClass, int preNotification, int postNotification) { this(type, notificationClass); setPreNotificationName(MuleContextNotification.getActionName(preNotification)); setPostNotificationName(MuleContextNotification.getActionName(postNotification)); } public String getPostNotificationName() { return postNotificationName; } public void setPostNotificationName(String postNotificationName) { this.postNotificationName = postNotificationName; } public String getPreNotificationName() { return preNotificationName; } public void setPreNotificationName(String preNotificationName) { this.preNotificationName = preNotificationName; } //@Override public void firePreNotification(MuleContext context) { if(getPreNotificationName()!=null) { setPreNotification(createNotification(context, getPreNotificationName())); } super.firePreNotification(context); } //@Override public void firePostNotification(MuleContext context) { if(getPostNotificationName()!=null) { setPostNotification(createNotification(context, getPostNotificationName())); } super.firePostNotification(context); } protected ServerNotification createNotification(MuleContext context, String action) { try { return (ServerNotification)ctor.newInstance(new Object[]{context, action}); } catch (Exception e) { throw new MuleRuntimeException(CoreMessages.failedToCreate("Notification:" + action) ,e); } } }mule-2.0.1/core/src/main/java/org/mule/DefaultMuleSession.java0000644000175000017500000004116311005754603024041 0ustar charlescharles/* * $Id: DefaultMuleSession.java 11661 2008-04-30 02:29:23Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointNotFoundException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.OutboundRouterCollection; import org.mule.api.security.SecurityContext; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.api.transport.DispatchException; import org.mule.api.transport.ReceiveException; import org.mule.api.transport.SessionHandler; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractConnector; import org.mule.util.UUID; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * DefaultMuleSession manages the interaction and distribution of events for * Mule UMOs. */ public final class DefaultMuleSession implements MuleSession { /** * Serial version */ private static final long serialVersionUID = 3380926585676521866L; /** * logger used by this class */ private static Log logger = LogFactory.getLog(DefaultMuleSession.class); /** * The Mule service associated with the session */ private Service service = null; /** * Determines if the service is valid */ private boolean valid = true; private String id; private SecurityContext securityContext; private Map properties = null; private MuleContext muleContext; public DefaultMuleSession(Service service, MuleContext muleContext) { this.muleContext = muleContext; properties = new HashMap(); id = UUID.getUUID(); this.service = service; } public DefaultMuleSession(MuleMessage message, SessionHandler requestSessionHandler, Service service, MuleContext muleContext) throws MuleException { this(message, requestSessionHandler, muleContext); if (service == null) { throw new IllegalArgumentException( CoreMessages.propertiesNotSet("service").toString()); } this.service = service; } public DefaultMuleSession(MuleMessage message, SessionHandler requestSessionHandler, MuleContext muleContext) throws MuleException { this.muleContext = muleContext; if (requestSessionHandler == null) { throw new IllegalArgumentException( CoreMessages.propertiesNotSet("requestSessionHandler").toString()); } if (message == null) { throw new IllegalArgumentException( CoreMessages.propertiesNotSet("message").toString()); } properties = new HashMap(); requestSessionHandler.retrieveSessionInfoFromMessage(message, this); id = (String) getProperty(requestSessionHandler.getSessionIDKey()); if (id == null) { id = UUID.getUUID(); if (logger.isDebugEnabled()) { logger.debug("There is no session id on the request using key: " + requestSessionHandler.getSessionIDKey() + ". Generating new session id: " + id); } } else if (logger.isDebugEnabled()) { logger.debug("Got session with id: " + id); } } public void dispatchEvent(MuleMessage message) throws MuleException { if (service == null) { throw new IllegalStateException(CoreMessages.objectIsNull("Service").getMessage()); } OutboundRouterCollection router = service.getOutboundRouter(); if (router == null) { throw new EndpointNotFoundException( CoreMessages.noOutboundRouterSetOn(service.getName())); } router.route(message, this, false); } public void dispatchEvent(MuleMessage message, String endpointName) throws MuleException { dispatchEvent(message, muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(endpointName)); } public void dispatchEvent(MuleMessage message, OutboundEndpoint endpoint) throws MuleException { if (endpoint == null) { logger.warn("Endpoint argument is null, using outbound router to determine endpoint."); dispatchEvent(message); } if (logger.isDebugEnabled()) { logger.debug("MuleSession has received asynchronous event on: " + endpoint); } MuleEvent event = createOutboundEvent(message, endpoint, null); dispatchEvent(event); processResponse(event.getMessage()); } public MuleMessage sendEvent(MuleMessage message, String endpointName) throws MuleException { return sendEvent(message, muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(endpointName)); } public MuleMessage sendEvent(MuleMessage message) throws MuleException { if (service == null) { throw new IllegalStateException(CoreMessages.objectIsNull("Service").getMessage()); } OutboundRouterCollection router = service.getOutboundRouter(); if (router == null) { throw new EndpointNotFoundException( CoreMessages.noOutboundRouterSetOn(service.getName())); } MuleMessage result = router.route(message, this, true); if (result != null) { processResponse(result); } return result; } public MuleMessage sendEvent(MuleMessage message, OutboundEndpoint endpoint) throws MuleException { if (endpoint == null) { logger.warn("Endpoint argument is null, using outbound router to determine endpoint."); return sendEvent(message); } if (logger.isDebugEnabled()) { logger.debug("MuleSession has received synchronous event on endpoint: " + endpoint); } MuleEvent event = createOutboundEvent(message, endpoint, null); MuleMessage result = sendEvent(event); // Handles the situation where a response has been received via a remote // ReplyTo channel. if (endpoint.isRemoteSync() && result != null) { result.applyTransformers(endpoint.getResponseTransformers()); } if (result != null) { processResponse(result); } return result; } /* * (non-Javadoc) * * @see org.mule.api.MuleSession#dispatchEvent(org.mule.api.MuleEvent) */ public void dispatchEvent(MuleEvent event) throws MuleException { if (event.getEndpoint() instanceof OutboundEndpoint) { try { if (logger.isDebugEnabled()) { logger.debug("dispatching event: " + event); } Connector connector = event.getEndpoint().getConnector(); if (connector instanceof AbstractConnector) { ((AbstractConnector) connector).getSessionHandler().storeSessionInfoToMessage(this, event.getMessage()); } else { // TODO in Mule 2.0 we'll flatten the Connector hierachy logger.warn("A session handler could not be obtained, using default"); new MuleSessionHandler().storeSessionInfoToMessage(this, event.getMessage()); } ((OutboundEndpoint) event.getEndpoint()).dispatch(event); } catch (Exception e) { throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } } else if (service != null) { if (logger.isDebugEnabled()) { logger.debug("dispatching event to service: " + service.getName() + ", event is: " + event); } service.dispatchEvent(event); processResponse(event.getMessage()); } else { throw new DispatchException(CoreMessages.noComponentForEndpoint(), event.getMessage(), event.getEndpoint()); } } public String getId() { return id; } /* * (non-Javadoc) * * @see org.mule.api.MuleSession#sendEvent(org.mule.api.MuleEvent) */ // TODO This method is practically the same as dispatchEvent(MuleEvent event), // so we could use some refactoring here. public MuleMessage sendEvent(MuleEvent event) throws MuleException { int timeout = event.getMessage().getIntProperty(MuleProperties.MULE_EVENT_TIMEOUT_PROPERTY, -1); if (timeout >= 0) { event.setTimeout(timeout); } if (event.getEndpoint() instanceof OutboundEndpoint) { try { if (logger.isDebugEnabled()) { logger.debug("sending event: " + event); } Connector connector = event.getEndpoint().getConnector(); if (connector instanceof AbstractConnector) { ((AbstractConnector) connector).getSessionHandler().storeSessionInfoToMessage(this, event.getMessage()); } else { // TODO in Mule 2.0 we'll flatten the Connector hierachy logger.warn("A session handler could not be obtained, using default."); new MuleSessionHandler().storeSessionInfoToMessage(this, event.getMessage()); } MuleMessage response = ((OutboundEndpoint) event.getEndpoint()).send(event); // See MULE-2692 //RM* This actually performs the function of adding properties from the request to the response // message I think this could be done without the performance hit. //Or we could provide a way to set the request message as the OriginalAdapter on the message //And provide access to the request properties that way response = OptimizedRequestContext.unsafeRewriteEvent(response); processResponse(response); return response; } catch (MuleException e) { throw e; } catch (Exception e) { throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } } else if (service != null) { if (logger.isDebugEnabled()) { logger.debug("sending event to service: " + service.getName() + " event is: " + event); } return service.sendEvent(event); } else { throw new DispatchException(CoreMessages.noComponentForEndpoint(), event.getMessage(), event.getEndpoint()); } } /** * Once an event has been processed we need to romove certain properties so that * they not propagated to the next request * * @param response The response from the previous request */ protected void processResponse(MuleMessage response) { if (response == null) { return; } } /* * (non-Javadoc) * * @see org.mule.api.MuleSession#isValid() */ public boolean isValid() { return valid; } /* * (non-Javadoc) * * @see org.mule.api.MuleSession#setValid(boolean) */ public void setValid(boolean value) { valid = value; } /* * (non-Javadoc) * * @see org.mule.api.MuleSession#receiveEvent(org.mule.api.endpoint.Endpoint, * long, org.mule.api.MuleEvent) */ public MuleMessage requestEvent(String endpointName, long timeout) throws MuleException { InboundEndpoint endpoint = RegistryContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(endpointName); return requestEvent(endpoint, timeout); } /* * (non-Javadoc) * * @see org.mule.api.MuleSession#receiveEvent(org.mule.api.endpoint.Endpoint, * long, org.mule.api.MuleEvent) */ public MuleMessage requestEvent(InboundEndpoint endpoint, long timeout) throws MuleException { try { return endpoint.request(timeout); } catch (Exception e) { throw new ReceiveException(endpoint, timeout, e); } } public MuleEvent createOutboundEvent(MuleMessage message, OutboundEndpoint endpoint, MuleEvent previousEvent) throws MuleException { if (endpoint == null) { throw new DispatchException(CoreMessages.objectIsNull("Outbound Endpoint"), message, endpoint); } if (logger.isDebugEnabled()) { logger.debug("Creating event with data: " + message.getPayload().getClass().getName() + ", for endpoint: " + endpoint); } try { MuleEvent event; if (previousEvent != null) { event = new DefaultMuleEvent(message, endpoint, service, previousEvent); } else { event = new DefaultMuleEvent(message, endpoint, this, false, null); } return event; } catch (Exception e) { throw new DispatchException( CoreMessages.failedToCreate("MuleEvent"), message, endpoint, e); } } /** * @return Returns the service. */ public Service getService() { return service; } void setService(Service service) { this.service = service; } /** * The security context for this session. If not null outbound, inbound and/or * method invocations will be authenticated using this context * * @param context the context for this session or null if the request is not * secure. */ public void setSecurityContext(SecurityContext context) { securityContext = context; } /** * The security context for this session. If not null outbound, inbound and/or * method invocations will be authenticated using this context * * @return the context for this session or null if the request is not secure. */ public SecurityContext getSecurityContext() { return securityContext; } /** * Will set a session level property. These will either be stored and retrieved * using the underlying transport mechanism of stored using a default mechanism * * @param key the key for the object data being stored on the session * @param value the value of the session data */ public void setProperty(Object key, Object value) { properties.put(key, value); } /** * Will retrieve a session level property. * * @param key the key for the object data being stored on the session * @return the value of the session data or null if the property does not exist */ public Object getProperty(Object key) { return properties.get(key); } /** * Will retrieve a session level property and remove it from the session * * @param key the key for the object data being stored on the session * @return the value of the session data or null if the property does not exist */ public Object removeProperty(Object key) { return properties.remove(key); } /** * Returns an iterater of property keys for the session properties on this * session * * @return an iterater of property keys for the session properties on this * session */ public Iterator getPropertyNames() { return properties.keySet().iterator(); } } mule-2.0.1/core/src/main/java/org/mule/service/0000755000175000017500000000000011351411113021044 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/service/AbstractService.java0000644000175000017500000007060611003252442025006 0ustar charlescharles/* * $Id: AbstractService.java 11621 2008-04-22 03:01:54Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.service; import org.mule.OptimizedRequestContext; import org.mule.api.MessagingException; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.component.Component; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.model.Model; import org.mule.api.model.ModelException; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.routing.NestedRouterCollection; import org.mule.api.routing.OutboundRouterCollection; import org.mule.api.routing.ResponseRouterCollection; import org.mule.api.service.Service; import org.mule.api.service.ServiceException; import org.mule.api.transport.DispatchException; import org.mule.api.transport.MessageReceiver; import org.mule.api.transport.ReplyToHandler; import org.mule.component.SimpleCallableJavaComponent; import org.mule.component.simple.PassThroughComponent; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.MessageFactory; import org.mule.context.notification.ServiceNotification; import org.mule.management.stats.ServiceStatistics; import org.mule.routing.inbound.DefaultInboundRouterCollection; import org.mule.routing.inbound.InboundPassThroughRouter; import org.mule.routing.nested.DefaultNestedRouterCollection; import org.mule.routing.outbound.DefaultOutboundRouterCollection; import org.mule.routing.outbound.OutboundPassThroughRouter; import org.mule.routing.response.DefaultResponseRouterCollection; import org.mule.transport.AbstractConnector; import org.mule.util.concurrent.WaitableBoolean; import java.beans.ExceptionListener; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A base implementation for all UMOComponents in Mule */ public abstract class AbstractService implements Service { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); protected ServiceStatistics stats = null; /** * Determines if the service has been stopped */ protected AtomicBoolean stopped = new AtomicBoolean(true); /** * Determines whether stop has been called and is still in progress */ protected WaitableBoolean stopping = new WaitableBoolean(false); /** * Determines if the service has been initilised */ protected AtomicBoolean initialised = new AtomicBoolean(false); /** * The model in which this service is registered */ protected Model model; /** * Determines if the service has been paused */ protected WaitableBoolean paused = new WaitableBoolean(false); protected MuleContext muleContext; /** * The initial states that the service can be started in */ public static final String INITIAL_STATE_STOPPED = "stopped"; public static final String INITIAL_STATE_STARTED = "started"; public static final String INITIAL_STATE_PAUSED = "paused"; /** * The exception strategy used by the service. */ protected ExceptionListener exceptionListener; /** * The service's name */ protected String name; protected InboundRouterCollection inboundRouter = new DefaultInboundRouterCollection(); protected OutboundRouterCollection outboundRouter = new DefaultOutboundRouterCollection(); protected NestedRouterCollection nestedRouter = new DefaultNestedRouterCollection(); protected ResponseRouterCollection responseRouter = new DefaultResponseRouterCollection(); /** * Determines the initial state of this service when the model starts. Can be * 'stopped' or 'started' (default) */ protected String initialState = INITIAL_STATE_STARTED; /** * Indicates whether a service has passed its initial startup state. */ private AtomicBoolean beyondInitialState = new AtomicBoolean(false); // Default component to use if one is not configured. // TODO MULE-3113 This should not really be needed as to implement bridging we should // should just increment a 'bridged' counter and sent the event straight to // outbound router collection. Currently it's the Component that routes events // onto the outbound router collection so this default implementation is needed. // It would be beneficial to differenciate between component invocations and // events that are bridged but currently everything is an invocation. protected Component component = new PassThroughComponent(); /** * For Spring only */ public AbstractService() { // nop } /** * Initialise the service. The service will first create a Mule UMO from the * UMODescriptor and then initialise a pool based on the attributes in the * UMODescriptor. * * @throws org.mule.api.lifecycle.InitialisationException * if the service fails * to initialise */ public final synchronized void initialise() throws InitialisationException { if (initialised.get()) { throw new InitialisationException(CoreMessages.objectAlreadyInitialised("Service '" + name + "'"), this); } // Ensure Component has service instance and is initialised. If the component // was configured with spring and is therefore in the registry it will get // started automatically, if it was set on the service directly then it won't // be started automatically. So to be sure we start it here. component.setService(this); component.initialise(); if (inboundRouter == null) { // Create Default routes that route to the default inbound and // outbound endpoints inboundRouter = new DefaultInboundRouterCollection(); // TODO MULE-2102 This should be configured in the default template. inboundRouter.addRouter(new InboundPassThroughRouter()); } if (outboundRouter == null) { outboundRouter = new DefaultOutboundRouterCollection(); // TODO MULE-2102 This should be configured in the default template. outboundRouter.addRouter(new OutboundPassThroughRouter()); } if (responseRouter == null) { responseRouter = new DefaultResponseRouterCollection(); } if (exceptionListener == null) { //By default us the model Exception Listener exceptionListener = getModel().getExceptionListener(); // // TODO MULE-2102 This should be configured in the default template. // exceptionListener = new DefaultServiceExceptionStrategy(this); // ((MuleContextAware) exceptionListener).setMuleContext(muleContext); // ((Initialisable) exceptionListener).initialise(); } doInitialise(); // initialise statistics stats = createStatistics(); stats.setEnabled(muleContext.getStatistics().isEnabled()); muleContext.getStatistics().add(stats); stats.setOutboundRouterStat(outboundRouter.getStatistics()); stats.setInboundRouterStat(inboundRouter.getStatistics()); stats.setComponentStat(component.getStatistics()); initialised.set(true); fireComponentNotification(ServiceNotification.SERVICE_INITIALISED); } protected ServiceStatistics createStatistics() { return new ServiceStatistics(name); } protected void fireComponentNotification(int action) { muleContext.fireNotification(new ServiceNotification(this, action)); } public void forceStop() throws MuleException { if (!stopped.get()) { logger.debug("Stopping Service"); stopping.set(true); fireComponentNotification(ServiceNotification.SERVICE_STOPPING); doForceStop(); stopped.set(true); stopping.set(false); fireComponentNotification(ServiceNotification.SERVICE_STOPPED); } } public void stop() throws MuleException { if (!stopped.get()) { logger.debug("Stopping Service"); stopping.set(true); fireComponentNotification(ServiceNotification.SERVICE_STOPPING); // Unregister Listeners for the service unregisterListeners(); component.stop(); doStop(); stopped.set(true); fireComponentNotification(ServiceNotification.SERVICE_STOPPED); logger.info("Mule Service " + name + " has been stopped successfully"); } } public void start() throws MuleException { // TODO If Service is uninitialised when start is called should we initialise // or throw an exception? if (!initialised.get()) { throw new IllegalStateException("Cannot start an unitialised service."); } if (isStarted()) { logger.info("Service is already started: " + name); } else { if (initialState.equals(AbstractService.INITIAL_STATE_STOPPED)) { logger.info("stopped"); } if (!beyondInitialState.get() && initialState.equals(AbstractService.INITIAL_STATE_STOPPED)) { logger.info("Service " + name + " has not been started (initial state = 'stopped')"); } else if (!beyondInitialState.get() && initialState.equals(AbstractService.INITIAL_STATE_PAUSED)) { start(/*startPaused*/true); logger.info("Service " + name + " has been started and paused (initial state = 'paused')"); } else { start(/*startPaused*/false); logger.info("Service " + name + " has been started successfully"); } beyondInitialState.set(true); } } /** * Starts a Mule Service. * * @param startPaused - Start service in a "paused" state (messages are * received but not processed). */ protected void start(boolean startPaused) throws MuleException { // Ensure Component is started. If component was configured with spring and // is therefore in the registry it will get started automatically, if it was // set on the service directly then it won't be started automatically. So to // be sure we start it here. component.start(); // Create the receivers for the service but do not start them yet. registerListeners(); // We connect the receivers _before_ starting the service because there may // be // some initialization required for the service which needs to have them // connected. // For example, the org.mule.transport.soap.glue.GlueMessageReceiver adds // InitialisationCallbacks within its doConnect() method (see MULE-804). connectListeners(); // Start (and pause) the service. if (stopped.get()) { stopped.set(false); paused.set(false); doStart(); } fireComponentNotification(ServiceNotification.SERVICE_STARTED); if (startPaused) { pause(); } // We start the receivers _after_ starting the service because if a message // gets routed to the service before it is started, // org.mule.model.AbstractComponent.dispatchEvent() will throw a // ServiceException with message COMPONENT_X_IS_STOPPED (see MULE-526). startListeners(); } /** * Pauses event processing for a single Mule Service. Unlike stop(), a paused * service will still consume messages from the underlying transport, but those * messages will be queued until the service is resumed. */ public final void pause() throws MuleException { doPause(); paused.set(true); fireComponentNotification(ServiceNotification.SERVICE_PAUSED); logger.info("Mule Service " + name + " has been paused successfully"); } /** * Resumes a single Mule Service that has been paused. If the service is not * paused nothing is executed. */ public final void resume() throws MuleException { doResume(); paused.set(false); fireComponentNotification(ServiceNotification.SERVICE_RESUMED); logger.info("Mule Service " + name + " has been resumed successfully"); } /** * Determines if the service is in a paused state * * @return True if the service is in a paused state, false otherwise */ public boolean isPaused() { return paused.get(); } /** * Custom components can execute code necessary to put the service in a paused * state here. If a developer overloads this method the doResume() method MUST * also be overloaded to avoid inconsistent state in the service * * @throws MuleException */ protected void doPause() throws MuleException { // template method } /** * Custom components can execute code necessary to resume a service once it has * been paused If a developer overloads this method the doPause() method MUST * also be overloaded to avoid inconsistent state in the service * * @throws MuleException */ protected void doResume() throws MuleException { // template method } public final void dispose() { try { if (!stopped.get()) { stop(); } } catch (MuleException e) { // TODO MULE-863: If this is an error, do something! logger.error("Failed to stop service: " + name, e); } doDispose(); component.dispose(); initialised.set(false); fireComponentNotification(ServiceNotification.SERVICE_DISPOSED); muleContext.getStatistics().remove(stats); } public ServiceStatistics getStatistics() { return stats; } public void dispatchEvent(MuleEvent event) throws MuleException { if (stopping.get() || stopped.get()) { throw new ServiceException( CoreMessages.componentIsStopped(name), event.getMessage(), this); } try { waitIfPaused(event); } catch (InterruptedException e) { throw new ServiceException(event.getMessage(), this, e); } // Dispatching event to an inbound endpoint // in the DefaultMuleSession#dispatchEvent ImmutableEndpoint endpoint = event.getEndpoint(); if (endpoint instanceof OutboundEndpoint) { try { ((OutboundEndpoint) endpoint).dispatch(event); } catch (Exception e) { throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } return; } // Dispatching event to the service if (stats.isEnabled()) { stats.incReceivedEventASync(); } if (logger.isDebugEnabled()) { logger.debug("Service: " + name + " has received asynchronous event on: " + event.getEndpoint().getEndpointURI()); } doDispatch(event); } public MuleMessage sendEvent(MuleEvent event) throws MuleException { if (stopping.get() || stopped.get()) { throw new ServiceException( CoreMessages.componentIsStopped(name), event.getMessage(), this); } try { waitIfPaused(event); } catch (InterruptedException e) { throw new ServiceException(event.getMessage(), this, e); } if (stats.isEnabled()) { stats.incReceivedEventSync(); } if (logger.isDebugEnabled()) { logger.debug("Service: " + name + " has received synchronous event on: " + event.getEndpoint().getEndpointURI()); } event = OptimizedRequestContext.unsafeSetEvent(event); return doSend(event); } /** * Called before an event is sent or dispatched to a service, it will block * until resume() is called. Users can override this method if they want to * handle pausing differently e.g. implement a store and forward policy * * @param event the current event being passed to the service * @throws InterruptedException if the thread is interrupted */ protected void waitIfPaused(MuleEvent event) throws InterruptedException { if (logger.isDebugEnabled() && paused.get()) { logger.debug("Service: " + name + " is paused. Blocking call until resume is called"); } paused.whenFalse(null); } /** * @return the Mule descriptor name which is associated with the service */ public String getName() { return name; } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ public String toString() { return getName(); } public boolean isStopped() { return stopped.get(); } public boolean isStopping() { return stopping.get(); } protected void handleException(Exception e) { exceptionListener.exceptionThrown(e); } protected void doForceStop() throws MuleException { // template method } protected void doStop() throws MuleException { // template method } protected void doStart() throws MuleException { // template method } protected void doDispose() { // template method } protected void doInitialise() throws InitialisationException { // template method } public boolean isStarted() { return !stopped.get(); } protected abstract MuleMessage doSend(MuleEvent event) throws MuleException; protected abstract void doDispatch(MuleEvent event) throws MuleException; protected void registerListeners() throws MuleException { InboundEndpoint endpoint; List endpoints = getIncomingEndpoints(); for (Iterator it = endpoints.iterator(); it.hasNext();) { endpoint = (InboundEndpoint) it.next(); try { endpoint.getConnector().registerListener(this, endpoint); } catch (MuleException e) { throw e; } catch (Exception e) { throw new ModelException( CoreMessages.failedtoRegisterOnEndpoint(name, endpoint.getEndpointURI()), e); } } } protected void unregisterListeners() throws MuleException { InboundEndpoint endpoint; List endpoints = getIncomingEndpoints(); for (Iterator it = endpoints.iterator(); it.hasNext();) { endpoint = (InboundEndpoint) it.next(); try { endpoint.getConnector().unregisterListener(this, endpoint); } catch (MuleException e) { throw e; } catch (Exception e) { throw new ModelException( CoreMessages.failedToUnregister(name, endpoint.getEndpointURI()), e); } } } protected void startListeners() throws MuleException { InboundEndpoint endpoint; List endpoints = getIncomingEndpoints(); for (Iterator it = endpoints.iterator(); it.hasNext();) { endpoint = (InboundEndpoint) it.next(); MessageReceiver receiver = ((AbstractConnector) endpoint.getConnector()).getReceiver(this, endpoint); if (receiver != null && endpoint.getConnector().isStarted() && endpoint.getInitialState().equals(ImmutableEndpoint.INITIAL_STATE_STARTED)) { receiver.start(); } } } // This is not called by anything?! protected void stopListeners() throws MuleException { InboundEndpoint endpoint; List endpoints = getIncomingEndpoints(); for (Iterator it = endpoints.iterator(); it.hasNext();) { endpoint = (InboundEndpoint) it.next(); MessageReceiver receiver = ((AbstractConnector) endpoint.getConnector()).getReceiver(this, endpoint); if (receiver != null) { receiver.stop(); } } } protected void connectListeners() throws MuleException { InboundEndpoint endpoint; List endpoints = getIncomingEndpoints(); for (Iterator it = endpoints.iterator(); it.hasNext();) { endpoint = (InboundEndpoint) it.next(); MessageReceiver receiver = ((AbstractConnector) endpoint.getConnector()).getReceiver(this, endpoint); if (receiver != null) { try { receiver.connect(); } catch (Exception e) { throw new ModelException( MessageFactory.createStaticMessage("Failed to connect listener " + receiver + " for endpoint " + endpoint.getName()), e); } } } } protected void disconnectListeners() throws MuleException { InboundEndpoint endpoint; List endpoints = getIncomingEndpoints(); for (Iterator it = endpoints.iterator(); it.hasNext();) { endpoint = (InboundEndpoint) it.next(); MessageReceiver receiver = ((AbstractConnector) endpoint.getConnector()).getReceiver(this, endpoint); if (receiver != null) { try { receiver.disconnect(); } catch (Exception e) { throw new ModelException( MessageFactory.createStaticMessage("Failed to disconnect listener " + receiver + " for endpoint " + endpoint.getName()), e); } } } } /** * Returns a list of all incoming endpoints on a service. */ protected List getIncomingEndpoints() { List endpoints = new ArrayList(); // Add inbound endpoints endpoints.addAll(inboundRouter.getEndpoints()); // Add response endpoints if (responseRouter != null && responseRouter.getEndpoints() != null) { endpoints.addAll(responseRouter.getEndpoints()); } return endpoints; } public void setMuleContext(MuleContext context) { this.muleContext = context; } // ///////////////////////////////////////////////////////////////////////////////////////// // Getters and Setters // ///////////////////////////////////////////////////////////////////////////////////////// public Model getModel() { return model; } public void setModel(Model model) { this.model = model; } public ExceptionListener getExceptionListener() { return exceptionListener; } public void setExceptionListener(ExceptionListener exceptionListener) { this.exceptionListener = exceptionListener; } public InboundRouterCollection getInboundRouter() { return inboundRouter; } public void setInboundRouter(InboundRouterCollection inboundRouter) { this.inboundRouter = inboundRouter; } public OutboundRouterCollection getOutboundRouter() { return outboundRouter; } public void setOutboundRouter(OutboundRouterCollection outboundRouter) { this.outboundRouter = outboundRouter; } public ResponseRouterCollection getResponseRouter() { return responseRouter; } public void setResponseRouter(ResponseRouterCollection responseRouter) { this.responseRouter = responseRouter; } public String getInitialState() { return initialState; } public void setInitialState(String initialState) { this.initialState = initialState; } public void setName(String name) { this.name = name; } public Component getComponent() { return component; } public void setComponent(Component component) { this.component = component; this.component.setService(this); } protected void processReplyTo(MuleEvent event, MuleMessage result, ReplyToHandler replyToHandler, Object replyTo) throws MuleException { if (result != null && replyToHandler != null) { String requestor = (String) result.getProperty(MuleProperties.MULE_REPLY_TO_REQUESTOR_PROPERTY); if ((requestor != null && !requestor.equals(getName())) || requestor == null) { replyToHandler.processReplyTo(event, result, replyTo); } } } protected ReplyToHandler getReplyToHandler(MuleMessage message, InboundEndpoint endpoint) { Object replyTo = message.getReplyTo(); ReplyToHandler replyToHandler = null; if (replyTo != null) { replyToHandler = ((AbstractConnector) endpoint.getConnector()).getReplyToHandler(); // Use the response transformer for the event if one is set if (endpoint.getResponseTransformers() != null) { replyToHandler.setTransformers(endpoint.getResponseTransformers()); } } return replyToHandler; } protected void dispatchToOutboundRouter(MuleEvent event, MuleMessage result) throws MessagingException { if (event.isStopFurtherProcessing()) { logger.debug("MuleEvent stop further processing has been set, no outbound routing will be performed."); } if (result != null && !event.isStopFurtherProcessing()) { if (getOutboundRouter().hasEndpoints()) { getOutboundRouter().route(result, event.getSession(), event.isSynchronous()); } } } protected MuleMessage sendToOutboundRouter(MuleEvent event, MuleMessage result) throws MessagingException { if (event.isStopFurtherProcessing()) { logger.debug("MuleEvent stop further processing has been set, no outbound routing will be performed."); } if (result != null && !event.isStopFurtherProcessing()) { if (getOutboundRouter().hasEndpoints()) { MuleMessage outboundReturnMessage = getOutboundRouter().route(result, event.getSession(), event.isSynchronous()); if (outboundReturnMessage != null) { result = outboundReturnMessage; } } else { logger.debug("Outbound router on service '" + getName() + "' doesn't have any endpoints configured."); } } return result; } protected MuleMessage processAsyncReplyRouter(MuleMessage result) throws MuleException { if (result != null && getResponseRouter() != null) { logger.debug("Waiting for response router message"); result = getResponseRouter().getResponse(result); } return result; } } mule-2.0.1/core/src/main/java/org/mule/service/DefaultServiceExceptionStrategy.java0000644000175000017500000000564510777661265030262 0ustar charlescharles/* * $Id: DefaultServiceExceptionStrategy.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.service; import org.mule.DefaultExceptionStrategy; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.management.stats.ServiceStatistics; /** * DefaultServiceExceptionStrategy is the default exception handler * for components. The handler logs errors and will forward the message and exception * to an exception endpointUri if one is set on this Exception strategy */ public class DefaultServiceExceptionStrategy extends DefaultExceptionStrategy { public DefaultServiceExceptionStrategy() { super(); } protected void defaultHandler(Throwable t) { ServiceStatistics statistics = getServiceStatistics(); if (statistics != null) { statistics.incExecutionError(); } super.defaultHandler(t); } protected void logFatal(MuleMessage message, Throwable t) { super.logFatal(message, t); ServiceStatistics statistics = getServiceStatistics(); if (statistics != null) { statistics.incFatalError(); } } protected void routeException(MuleMessage message, ImmutableEndpoint failedEndpoint, Throwable t) { ImmutableEndpoint ep = getEndpoint(t); if (ep != null) { super.routeException(message, failedEndpoint, t); // ServiceStatistics statistics = getServiceStatistics(); // if (statistics != null) // { // statistics.getOutboundRouterStat().incrementRoutedMessage(ep); // } } } protected ServiceStatistics getServiceStatistics() { MuleEvent event = RequestContext.getEvent(); if (event == null) { // very bad should not happen logger.fatal("The Default Service Exception Strategy has been invoked but there is no current event on the context"); //logger.fatal("The error is: " + t.getMessage(), t); return null; } else if(event.getService()==null) { //this will ever happen, but JIC logger.fatal("The Default Service Exception Strategy has been invoked but there is no current service on the context. Please report this to dev@mule.codehaus.org"); return null; } else { return ((AbstractService)event.getService()).getStatistics(); } } } mule-2.0.1/core/src/main/java/org/mule/MuleShutdownHook.java0000644000175000017500000000752610766637211023562 0ustar charlescharles/* * $Id: MuleShutdownHook.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; import org.mule.util.StringMessageUtils; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.apache.commons.logging.Log; /** * The shutdown thread used by the server when its main thread is terminated */ public class MuleShutdownHook extends Thread { private Log logger; private Throwable exception = null; public MuleShutdownHook(Log logger) { super(); this.logger = logger; } public MuleShutdownHook(Log logger, Throwable exception) { this(logger); this.exception = exception; } /* * (non-Javadoc) * * @see java.lang.Runnable#run() */ public void run() { if (exception != null) { shutdown(exception); } else { shutdown(); } } protected void shutdown(Throwable t) { Message msg = CoreMessages.fatalErrorWhileRunning(); MuleException muleException = ExceptionHelper.getRootMuleException(t); if (muleException != null) { logger.fatal(muleException.getDetailedMessage()); } else { logger.fatal(msg.toString() + " " + t.getMessage(), t); } List msgs = new ArrayList(); msgs.add(msg.getMessage()); Throwable root = ExceptionHelper.getRootException(t); msgs.add(root.getMessage() + " (" + root.getClass().getName() + ")"); msgs.add(" "); msgs.add(CoreMessages.fatalErrorInShutdown()); MuleContext context = MuleServer.getMuleContext(); if(context!=null) { msgs.add(CoreMessages.serverStartedAt(context.getStartDate())); } msgs.add(CoreMessages.serverShutdownAt(new Date())); String shutdownMessage = StringMessageUtils.getBoilerPlate(msgs, '*', 86); if (logger.isFatalEnabled()) { logger.fatal(shutdownMessage); } else { System.err.println(shutdownMessage); } } protected void shutdown() { logger.info("Mule server shutting down due to normal shutdown request"); List msgs = new ArrayList(); msgs.add(CoreMessages.normalShutdown()); MuleContext context = MuleServer.getMuleContext(); if(context!=null) { msgs.add(CoreMessages.serverStartedAt(context.getStartDate())); } msgs.add(CoreMessages.serverShutdownAt(new Date())); String shutdownMessage = StringMessageUtils.getBoilerPlate(msgs, '*', 86); if (logger.isInfoEnabled()) { logger.info(shutdownMessage); } else { System.out.println(shutdownMessage); } } public Throwable getException() { return exception; } public void setException(Throwable exception) { this.exception = exception; } public boolean equals(Object o) { if (this == o) { return true; } if (o != null && getClass().getName().equals(o.getClass().getName())) { return true; } return false; } public int hashCode() { return getClass().getName().hashCode(); } } mule-2.0.1/core/src/main/java/org/mule/DefaultExceptionStrategy.java0000644000175000017500000000506610770773146025271 0ustar charlescharles/* * $Id: DefaultExceptionStrategy.java 11468 2008-03-21 17:54:46Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.message.DefaultExceptionPayload; import org.mule.transport.NullPayload; import org.mule.util.ObjectUtils; /** * DefaultExceptionStrategy provides a default exception handling * strategy. */ public class DefaultExceptionStrategy extends AbstractExceptionListener { public void handleMessagingException(MuleMessage message, Throwable t) { defaultHandler(t); routeException(messageFromContextIfAvailable(message), null, t); } public void handleRoutingException(MuleMessage message, ImmutableEndpoint endpoint, Throwable t) { defaultHandler(t); routeException(messageFromContextIfAvailable(message), endpoint, t); } public void handleLifecycleException(Object component, Throwable t) { // Do nothing special here. Overriding implmentations may want alter the // behaviour handleStandardException(t); logger.error("The object that failed was: \n" + ObjectUtils.toString(component, "null")); } public void handleStandardException(Throwable t) { handleTransaction(t); // Attempt to send the exception details to an endpoint if one is set if (RequestContext.getEventContext() != null) { handleMessagingException(RequestContext.getEventContext().getMessage(), t); } else { logger.info("There is no current event available, routing Null message with the exception"); handleMessagingException(new DefaultMuleMessage(NullPayload.getInstance()), t); } } protected void defaultHandler(Throwable t) { if (RequestContext.getEvent() != null) { RequestContext.setExceptionPayload(new DefaultExceptionPayload(t)); } } protected MuleMessage messageFromContextIfAvailable(MuleMessage message) { if (null != RequestContext.getEvent()) { return RequestContext.getEvent().getMessage(); } else { return message; } } } mule-2.0.1/core/src/main/java/org/mule/DefaultMuleContext.java0000644000175000017500000005500610774254333024052 0ustar charlescharles/* * $Id: DefaultMuleContext.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.MuleRuntimeException; import org.mule.api.agent.Agent; import org.mule.api.config.MuleConfiguration; import org.mule.api.config.MuleProperties; import org.mule.api.config.ThreadingProfile; import org.mule.api.context.WorkManager; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.ServerNotificationListener; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.LifecycleManager; import org.mule.api.lifecycle.Startable; import org.mule.api.lifecycle.Stoppable; import org.mule.api.registry.RegistrationException; import org.mule.api.registry.Registry; import org.mule.api.security.SecurityManager; import org.mule.api.transaction.TransactionManagerFactory; import org.mule.api.transport.ConnectionStrategy; import org.mule.config.DefaultMuleConfiguration; import org.mule.config.MuleManifest; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.MuleContextNotification; import org.mule.context.notification.NotificationException; import org.mule.context.notification.ServerNotificationManager; import org.mule.management.stats.AllStatistics; import org.mule.util.StringMessageUtils; import org.mule.util.StringUtils; import org.mule.util.queue.QueueManager; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.jar.Manifest; import javax.resource.spi.work.WorkListener; import javax.transaction.TransactionManager; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class DefaultMuleContext implements MuleContext { /** logger used by this class */ private static transient Log logger = LogFactory.getLog(DefaultMuleContext.class); /** stats used for management */ private AllStatistics stats = new AllStatistics(); private WorkManager workManager; private WorkListener workListener; /** * LifecycleManager for the MuleContext. Note: this is NOT the same lifecycle manager * as the one in the Registry. */ protected LifecycleManager lifecycleManager; protected ServerNotificationManager notificationManager; private MuleConfiguration config; /** the date in milliseconds from when the server was started */ private long startDate; public DefaultMuleContext(MuleConfiguration config, WorkManager workManager, WorkListener workListener, LifecycleManager lifecycleManager, ServerNotificationManager notificationManager) { this.config = config; this.workManager = workManager; this.workListener = workListener; this.lifecycleManager = lifecycleManager; this.notificationManager = notificationManager; } public void initialise() throws InitialisationException { lifecycleManager.checkPhase(Initialisable.PHASE_NAME); if (getNotificationManager() == null) { throw new NullPointerException(CoreMessages.objectIsNull( MuleProperties.OBJECT_NOTIFICATION_MANAGER).getMessage()); } if (workManager == null) { throw new NullPointerException(CoreMessages.objectIsNull("workManager").getMessage()); } try { //We need to start the work manager straight away since we need it to fire notifications workManager.start(); getNotificationManager().start(workManager, workListener); fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_INITIALISING)); lifecycleManager.firePhase(this, Initialisable.PHASE_NAME); fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_INITIALISED)); } catch (Exception e) { throw new InitialisationException(e, this); } } public synchronized void start() throws MuleException { lifecycleManager.checkPhase(Startable.PHASE_NAME); if (!isStarted()) { if (getSecurityManager() == null) { throw new NullPointerException(CoreMessages.objectIsNull("securityManager").getMessage()); } if (getQueueManager() == null) { throw new NullPointerException(CoreMessages.objectIsNull("queueManager").getMessage()); } fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STARTING)); lifecycleManager.firePhase(this, Startable.PHASE_NAME); if (logger.isInfoEnabled()) { logger.info(getStartSplash()); } fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STARTED)); } startDate = System.currentTimeMillis(); } /** * Stops the MuleManager which stops all sessions and * connectors * * @throws MuleException if either any of the sessions or connectors fail to * stop */ public synchronized void stop() throws MuleException { lifecycleManager.checkPhase(Stoppable.PHASE_NAME); fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STOPPING)); lifecycleManager.firePhase(this, Stoppable.PHASE_NAME); fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_STOPPED)); } public void dispose() { if (isDisposing()) { return; } ServerNotificationManager notificationManager = getNotificationManager(); lifecycleManager.checkPhase(Disposable.PHASE_NAME); fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_DISPOSING)); try { if (isStarted()) { stop(); } } catch (MuleException e) { logger.error("Failed to stop manager: " + e.getMessage(), e); } try { lifecycleManager.firePhase(this, Disposable.PHASE_NAME); } catch (MuleException e) { logger.debug("Failed to cleanly dispose Mule: " + e.getMessage(), e); } notificationManager.fireNotification(new MuleContextNotification(this, MuleContextNotification.CONTEXT_DISPOSED)); if ((getStartDate() > 0) && logger.isInfoEnabled()) { logger.info(getEndSplash()); } //lifecycleManager.reset(); } /** * Determines if the server has been initialised * * @return true if the server has been initialised */ public boolean isInitialised() { return lifecycleManager.isPhaseComplete(Initialisable.PHASE_NAME); } /** * Determines if the server is being initialised * * @return true if the server is beening initialised */ public boolean isInitialising() { return Disposable.PHASE_NAME.equals(lifecycleManager.getExecutingPhase()); } protected boolean isStopped() { return lifecycleManager.isPhaseComplete(Stoppable.PHASE_NAME); } protected boolean isStopping() { return Stoppable.PHASE_NAME.equals(lifecycleManager.getExecutingPhase()); } /** * Determines if the server has been started * * @return true if the server has been started */ public boolean isStarted() { return lifecycleManager.isPhaseComplete(Startable.PHASE_NAME); } protected boolean isStarting() { return Startable.PHASE_NAME.equals(lifecycleManager.getExecutingPhase()); } public boolean isDisposed() { return lifecycleManager.isPhaseComplete(Disposable.PHASE_NAME); } public boolean isDisposing() { return Disposable.PHASE_NAME.equals(lifecycleManager.getExecutingPhase()); } public LifecycleManager getLifecycleManager() { return lifecycleManager; } /** * Gets all statisitcs for this instance * * @return all statisitcs for this instance */ public AllStatistics getStatistics() { return stats; } public void registerListener(ServerNotificationListener l) throws NotificationException { registerListener(l, null); } public void registerListener(ServerNotificationListener l, String resourceIdentifier) throws NotificationException { ServerNotificationManager notificationManager = getNotificationManager(); if (notificationManager == null) { throw new MuleRuntimeException(CoreMessages.serverNotificationManagerNotEnabled()); } notificationManager.addListenerSubscription(l, resourceIdentifier); } public void unregisterListener(ServerNotificationListener l) { ServerNotificationManager notificationManager = getNotificationManager(); if (notificationManager != null) { notificationManager.removeListener(l); } } /** * Fires a server notification to all registered * {@link org.mule.api.context.notification.listener.CustomNotificationListener} notificationManager. * * @param notification the notification to fire. This must be of type * {@link org.mule.context.notification.CustomNotification} otherwise an * exception will be thrown. * @throws UnsupportedOperationException if the notification fired is not a * {@link org.mule.context.notification.CustomNotification} */ public void fireNotification(ServerNotification notification) { ServerNotificationManager notificationManager = getNotificationManager(); if (notificationManager != null) { notificationManager.fireNotification(notification); } else if (logger.isDebugEnabled()) { logger.debug("MuleEvent Manager is not enabled, ignoring notification: " + notification); } } /** * Sets the security manager used by this Mule instance to authenticate and * authorise incoming and outgoing event traffic and service invocations * * @param securityManager the security manager used by this Mule instance to * authenticate and authorise incoming and outgoing event traffic * and service invocations */ public void setSecurityManager(SecurityManager securityManager) throws RegistrationException { checkLifecycleForPropertySet(MuleProperties.OBJECT_SECURITY_MANAGER, Initialisable.PHASE_NAME); getRegistry().registerObject(MuleProperties.OBJECT_SECURITY_MANAGER, securityManager); } /** * Gets the security manager used by this Mule instance to authenticate and * authorise incoming and outgoing event traffic and service invocations * * @return he security manager used by this Mule instance to authenticate * and authorise incoming and outgoing event traffic and service * invocations */ public SecurityManager getSecurityManager() { SecurityManager securityManager = (SecurityManager) getRegistry().lookupObject( MuleProperties.OBJECT_SECURITY_MANAGER); if (securityManager == null) { Collection temp = getRegistry().lookupObjects(SecurityManager.class); if (temp.size() > 0) { securityManager = ((SecurityManager) temp.iterator().next()); } } return securityManager; } /** * Obtains a workManager instance that can be used to schedule work in a * thread pool. This will be used primarially by UMOAgents wanting to * schedule work. This work Manager must never be used by provider * implementations as they have their own workManager accible on the * connector. *

    * If a workManager has not been set by the time the * initialise() method has been called a default * MuleWorkManager will be created using the * DefaultThreadingProfile on the MuleConfiguration * object. * * @return a workManager instance used by the current MuleManager * @see org.mule.api.config.ThreadingProfile * @see DefaultMuleConfiguration */ public WorkManager getWorkManager() { return workManager; } public WorkListener getWorkListener() { return workListener; } public QueueManager getQueueManager() { QueueManager queueManager = (QueueManager) getRegistry().lookupObject(MuleProperties.OBJECT_QUEUE_MANAGER); if (queueManager == null) { Collection temp = getRegistry().lookupObjects(QueueManager.class); if (temp.size() > 0) { queueManager = ((QueueManager) temp.iterator().next()); } } return queueManager; } public void setQueueManager(QueueManager queueManager) throws RegistrationException { checkLifecycleForPropertySet(MuleProperties.OBJECT_QUEUE_MANAGER, Initialisable.PHASE_NAME); getRegistry().registerObject(MuleProperties.OBJECT_QUEUE_MANAGER, queueManager); } /** * @return the MuleConfiguration for this MuleContext. This object is immutable * once the context has initialised. */ public MuleConfiguration getConfiguration() { return config; } public ServerNotificationManager getNotificationManager() { return notificationManager; } /** * Sets the Jta Transaction Manager to use with this Mule server instance * * @param manager the manager to use * @throws Exception */ public void setTransactionManager(TransactionManager manager) throws RegistrationException { //checkLifecycleForPropertySet(MuleProperties.OBJECT_TRANSACTION_MANAGER, Initialisable.PHASE_NAME); getRegistry().registerObject(MuleProperties.OBJECT_TRANSACTION_MANAGER, manager); } /** * Returns the Jta transaction manager used by this Mule server instance. or * null if a transaction manager has not been set * * @return the Jta transaction manager used by this Mule server instance. or * null if a transaction manager has not been set */ public TransactionManager getTransactionManager() { TransactionManager transactionManager = (TransactionManager) getRegistry().lookupObject( MuleProperties.OBJECT_TRANSACTION_MANAGER); if (transactionManager == null) { Collection temp = getRegistry().lookupObjects(TransactionManagerFactory.class); if (temp.size() > 0) { try { transactionManager = (((TransactionManagerFactory) temp.iterator().next()).create()); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); throw new MuleRuntimeException(CoreMessages.createStaticMessage("Unable to create transaction manager")); } } else { temp = getRegistry().lookupObjects(TransactionManager.class); if (temp.size() > 0) { transactionManager = (((TransactionManager) temp.iterator().next())); } } } return transactionManager; } protected void checkLifecycleForPropertySet(String propertyName, String phase) throws IllegalStateException { if (lifecycleManager.isPhaseComplete(phase)) { throw new IllegalStateException("Cannot set property: '" + propertyName + "' once the server has been gone through the " + phase + " phase."); } } /** * Resolve and return a handle to the registry. * This should eventually be more intelligent (handle remote registries, clusters of Mule instances, etc.) * For now the registry is just a local singleton. */ public Registry getRegistry() { return RegistryContext.getRegistry(); } /** * Apply current phase of the LifecycleManager. Note: this is NOT the same lifecycle manager * as the one in the Registry. */ public void applyLifecycle(Object object) throws MuleException { lifecycleManager.applyLifecycle(this, object); } public ThreadingProfile getDefaultMessageDispatcherThreadingProfile() { return (ThreadingProfile) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_DISPATCHER_THREADING_PROFILE); } public ThreadingProfile getDefaultMessageRequesterThreadingProfile() { return (ThreadingProfile) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_REQUESTER_THREADING_PROFILE); } public ThreadingProfile getDefaultMessageReceiverThreadingProfile() { return (ThreadingProfile) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_MESSAGE_RECEIVER_THREADING_PROFILE); } public ThreadingProfile getDefaultComponentThreadingProfile() { return (ThreadingProfile) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_COMPONENT_THREADING_PROFILE); } public ThreadingProfile getDefaultThreadingProfile() { return (ThreadingProfile) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_THREADING_PROFILE); } /** * Returns a clone of the default Connection strategy. The clone ensures that the * connection strategy can be manipulated without affecting other connectors * using the same strategy * * @return a clone of the default Connection strategy */ public ConnectionStrategy getDefaultConnectionStrategy() { ConnectionStrategy defaultConnectionStrategy = (ConnectionStrategy) getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_CONNECTION_STRATEGY); try { return (ConnectionStrategy) BeanUtils.cloneBean(defaultConnectionStrategy); } catch (Exception e) { throw new MuleRuntimeException(CoreMessages.failedToClone("Connection Strategy"), e); } } /** * Returns the long date when the server was started * * @return the long date when the server was started */ public long getStartDate() { return startDate; } /** * Returns a formatted string that is a summary of the configuration of the * server. This is the brock of information that gets displayed when the server * starts * * @return a string summary of the server information */ public String getStartSplash() { String notset = CoreMessages.notSet().getMessage(); // Mule Version, Timestamp, and Server ID List message = new ArrayList(); Manifest mf = MuleManifest.getManifest(); Map att = mf.getMainAttributes(); if (att.values().size() > 0) { message.add(StringUtils.defaultString(MuleManifest.getProductDescription(), notset)); message.add(CoreMessages.version().getMessage() + " Build: " + StringUtils.defaultString(MuleManifest.getBuildNumber(), notset)); message.add(StringUtils.defaultString(MuleManifest.getVendorName(), notset)); message.add(StringUtils.defaultString(MuleManifest.getProductMoreInfo(), notset)); } else { message.add(CoreMessages.versionNotSet().getMessage()); } message.add(" "); message.add(CoreMessages.serverStartedAt(startDate).getMessage()); message.add("Server ID: " + getConfiguration().getId()); // JDK, OS, and Host message.add("JDK: " + System.getProperty("java.version") + " (" + System.getProperty("java.vm.info") + ")"); String patch = System.getProperty("sun.os.patch.level", null); message.add("OS: " + System.getProperty("os.name") + (patch != null && !"unknown".equalsIgnoreCase(patch) ? " - " + patch : "") + " (" + System.getProperty("os.version") + ", " + System.getProperty("os.arch") + ")"); try { InetAddress host = InetAddress.getLocalHost(); message.add("Host: " + host.getHostName() + " (" + host.getHostAddress() + ")"); } catch (UnknownHostException e) { // ignore } // Mule Agents message.add(" "); //List agents Collection agents = RegistryContext.getRegistry().lookupObjects(Agent.class); if (agents.size() == 0) { message.add(CoreMessages.agentsRunning().getMessage() + " " + CoreMessages.none().getMessage()); } else { message.add(CoreMessages.agentsRunning().getMessage()); Agent umoAgent; for (Iterator iterator = agents.iterator(); iterator.hasNext();) { umoAgent = (Agent) iterator.next(); message.add(" " + umoAgent.getDescription()); } } return StringMessageUtils.getBoilerPlate(message, '*', 70); } public String getEndSplash() { List message = new ArrayList(2); long currentTime = System.currentTimeMillis(); message.add(CoreMessages.shutdownNormally(new Date()).getMessage()); long duration = 10; if (startDate > 0) { duration = currentTime - startDate; } message.add(CoreMessages.serverWasUpForDuration(duration).getMessage()); return StringMessageUtils.getBoilerPlate(message, '*', 78); } } mule-2.0.1/core/src/main/java/org/mule/OptimizedRequestContext.java0000644000175000017500000000552510745677442025171 0ustar charlescharles/* * $Id: OptimizedRequestContext.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * NOT FOR PUBLIC USE - please use the interface provided by RequestContext. * This is a temporary interface that helps provide an (optimized) fix for message * scribbling. * *

    Mutating methods have three versions: default (RequestContext; safe, makes and returns a new * copy - although this can be changed via {@link RequestContext#DEFAULT_ACTION}); * unsafe (doesn't make a copy, use only where certain no threading); critical (safe, * documents that threading a known issue).

    */ public final class OptimizedRequestContext { private static final boolean DOCUMENT_UNSAFE_CALLS = false; private static final Log logger = LogFactory.getLog(OptimizedRequestContext.class); /** * Do not instantiate. */ private OptimizedRequestContext() { // unused } /** * Set an event for out-of-scope thread access. Unsafe: use only when known to be single threaded. * * @param event - the event to set * @return The event set */ public static MuleEvent unsafeSetEvent(MuleEvent event) { documentUnsafeCall("unsafeSetEvent"); return RequestContext.internalSetEvent(event); } /** * Set an event for out-of-scope thread access. Critical: thread safety known to be required * * @param event - the event to set * @return A new mutable copy of the event set */ public static MuleEvent criticalSetEvent(MuleEvent event) { return RequestContext.internalSetEvent(RequestContext.newEvent(event, RequestContext.SAFE)); } /** * Sets a new message payload in the RequestContext but maintains all other * properties (session, endpoint, synchronous, etc.) from the previous event. * Unsafe: use only when known to be single threaded * * @param message - the new message payload * @return The message set */ public static MuleMessage unsafeRewriteEvent(MuleMessage message) { documentUnsafeCall("unsafeRewriteEvent"); return RequestContext.internalRewriteEvent(message, RequestContext.UNSAFE); } private static void documentUnsafeCall(String message) { if (DOCUMENT_UNSAFE_CALLS) { logger.debug(message, new Exception(message)); } } } mule-2.0.1/core/src/main/java/org/mule/registry/0000755000175000017500000000000011351411115021256 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/registry/TransientRegistry.java0000644000175000017500000003616410774260226025650 0ustar charlescharles/* * $Id: TransientRegistry.java 11518 2008-03-31 22:07:18Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.registry; import org.mule.MuleServer; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.MuleException; import org.mule.api.agent.Agent; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.LifecycleManager; import org.mule.api.lifecycle.LifecyclePhase; import org.mule.api.lifecycle.Stoppable; import org.mule.api.model.Model; import org.mule.api.registry.AbstractServiceDescriptor; import org.mule.api.registry.ObjectProcessor; import org.mule.api.registry.RegistrationException; import org.mule.api.registry.Registry; import org.mule.api.registry.ServiceDescriptor; import org.mule.api.registry.ServiceDescriptorFactory; import org.mule.api.registry.ServiceException; import org.mule.api.service.Service; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.Transformer; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.lifecycle.GenericLifecycleManager; import org.mule.lifecycle.phases.TransientRegistryDisposePhase; import org.mule.lifecycle.phases.TransientRegistryInitialisePhase; import org.mule.util.BeanUtils; import org.mule.util.ClassUtils; import org.mule.util.SpiUtils; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class TransientRegistry extends AbstractRegistry { /** logger used by this class */ protected transient final Log logger = LogFactory.getLog(TransientRegistry.class); public static final String REGISTRY_ID = "org.mule.Registry.Transient"; /** Map of Maps registry */ private Map registry; public TransientRegistry() { super(REGISTRY_ID); init(); } public TransientRegistry(Registry parent) { super(REGISTRY_ID, parent); init(); } private void init() { registry = new HashMap(8); getObjectTypeMap(ObjectProcessor.class).put("_muleExpressionEvaluatorProcessor", new ExpressionEvaluatorProcessor()); RegistryContext.setRegistry(this); try { initialise(); } catch (InitialisationException e) { logger.error(e); } } protected LifecycleManager createLifecycleManager() { GenericLifecycleManager lcm = new GenericLifecycleManager(); LifecyclePhase initPhase = new TransientRegistryInitialisePhase(); initPhase.setRegistryScope(Registry.SCOPE_IMMEDIATE); lcm.registerLifecycle(initPhase); LifecyclePhase disposePhase = new TransientRegistryDisposePhase(); disposePhase.setRegistryScope(Registry.SCOPE_IMMEDIATE); lcm.registerLifecycle(disposePhase); return lcm; } //@java.lang.Override protected void doInitialise() throws InitialisationException { int oldScope = getDefaultScope(); setDefaultScope(Registry.SCOPE_IMMEDIATE); try { applyProcessors(getConnectors()); applyProcessors(getTransformers()); applyProcessors(getEndpoints()); applyProcessors(getAgents()); applyProcessors(getModels()); applyProcessors(lookupServices()); applyProcessors(lookupObjects(Object.class)); } finally { setDefaultScope(oldScope); } } protected void applyProcessors(Map objects) { if (objects == null) { return; } for (Iterator iterator = objects.values().iterator(); iterator.hasNext();) { Object o = iterator.next(); Collection processors = lookupObjects(ObjectProcessor.class); for (Iterator iterator2 = processors.iterator(); iterator2.hasNext();) { ObjectProcessor op = (ObjectProcessor) iterator2.next(); op.process(o); } } } public void registerObjects(Map objects) throws RegistrationException { if (objects == null) { return; } for (Iterator iterator = objects.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); registerObject(entry.getKey().toString(), entry.getValue()); } } protected Object doLookupObject(String key) { Object o = null; if (key != null) { Map map; for (Iterator it = registry.values().iterator(); it.hasNext();) { map = (Map) it.next(); o = map.get(key); if (o != null) { return o; } } } return o; } public Collection doLookupObjects(Class returntype) { Map map = (Map) registry.get(returntype); if (map != null) { return map.values(); } else { return null; } } /** Looks up the service descriptor from a singleton cache and creates a new one if not found. */ public ServiceDescriptor lookupServiceDescriptor(String type, String name, Properties overrides) throws ServiceException { String key = new AbstractServiceDescriptor.Key(name, overrides).getKey(); //TODO If we want these descriptors loaded form Spring we need to checnge the key mechanism //and the scope, and then deal with circular reference issues. ServiceDescriptor sd = (ServiceDescriptor) lookupObject(key); synchronized (this) { if (sd == null) { sd = createServiceDescriptor(type, name, overrides); try { registerObject(key, sd, ServiceDescriptor.class); } catch (RegistrationException e) { throw new ServiceException(e.getI18nMessage(), e); } } } return sd; } // TODO ServiceDescriptors will be created upon bundle startup for OSGi. protected ServiceDescriptor createServiceDescriptor(String type, String name, Properties overrides) throws ServiceException { Properties props = SpiUtils.findServiceDescriptor(type, name); if (props == null) { throw new ServiceException(CoreMessages.failedToLoad(type + " " + name)); } return ServiceDescriptorFactory.create(type, name, props, overrides, this); } protected Map getObjectTypeMap(Object o) { if (o == null) { o = Object.class; } Object key; if (o instanceof Class) { key = o; } else if (o instanceof String) { key = o; } else { key = o.getClass(); } Map objects = (Map) registry.get(key); if (objects == null) { objects = new HashMap(8); registry.put(key, objects); } return objects; } protected Object applyProcessors(Object object) { Object theObject = object; // this may be an incorrect hack. the problem is that if we try to lookup objects in spring before // it is initialised, we end up triggering object creation. that causes circular dependencies because // this may have originally been called while creating objects in spring... so we prevent that by // only doing the full lookup once everything is stable. ac. Collection processors = lookupObjects(ObjectProcessor.class, (null != getParent() && getParent().isInitialised()) ? getDefaultScope() : SCOPE_IMMEDIATE); for (Iterator iterator = processors.iterator(); iterator.hasNext();) { ObjectProcessor o = (ObjectProcessor) iterator.next(); theObject = o.process(theObject); } return theObject; } /** * Allows for arbitary registration of transient objects * * @param key * @param value */ protected void doRegisterObject(String key, Object value) throws RegistrationException { doRegisterObject(key, value, Object.class); } /** * Allows for arbitary registration of transient objects * * @param key * @param value */ protected void doRegisterObject(String key, Object object, Object metadata) throws RegistrationException { logger.debug("registering object"); if (isInitialised() || isInitialising()) { logger.debug("applying processors"); object = applyProcessors(object); } Map objectMap = getObjectTypeMap(metadata); if (objectMap != null) { if (objectMap.containsKey(key)) { // objectMap.put(key, value) would overwrite a previous entity with the same name. Is this really what we want? // Not sure whether to throw an exception or log a warning here. //throw new RegistrationException("TransientRegistry already contains an object named '" + key + "'. The previous object would be overwritten."); logger.warn("TransientRegistry already contains an object named '" + key + "'. The previous object will be overwritten."); } objectMap.put(key, object); try { MuleContext mc = MuleServer.getMuleContext(); logger.debug("context: " + mc); if (mc != null) { logger.debug("applying lifecycle"); mc.applyLifecycle(object); } else { throw new RegistrationException("Unable to register object (\"" + key + ":" + ClassUtils.getSimpleName(object.getClass()) + "\") because MuleContext has not yet been created."); } } catch (MuleException e) { throw new RegistrationException(e); } } else { throw new RegistrationException("No object map exists for type " + metadata); } } //@java.lang.Override public void registerAgent(Agent agent) throws MuleException { registerObject(agent.getName(), agent, Agent.class); } //@java.lang.Override public void registerConnector(Connector connector) throws MuleException { registerObject(connector.getName(), connector, Connector.class); } //@java.lang.Override public void registerEndpoint(ImmutableEndpoint endpoint) throws MuleException { registerObject(endpoint.getName(), endpoint, ImmutableEndpoint.class); } public void registerEndpointBuilder(String name, EndpointBuilder builder) throws MuleException { registerObject(name, builder, EndpointBuilder.class); } //@java.lang.Override public void registerModel(Model model) throws MuleException { registerObject(model.getName(), model, Model.class); } //@java.lang.Override protected void doRegisterTransformer(Transformer transformer) throws MuleException { //TODO should we always throw an exception if an object already exists if (lookupTransformer(transformer.getName()) != null) { throw new RegistrationException(CoreMessages.objectAlreadyRegistered("transformer: " + transformer.getName(), lookupTransformer(transformer.getName()), transformer).getMessage()); } registerObject(transformer.getName(), transformer, Transformer.class); } //@java.lang.Override public void registerService(Service service) throws MuleException { registerObject(service.getName(), service, Service.class); } protected void unregisterObject(String key, Object metadata) throws MuleException { Object obj = getObjectTypeMap(metadata).remove(key); if (obj instanceof Stoppable) { ((Stoppable) obj).stop(); } } public void unregisterObject(String key) throws MuleException { unregisterObject(key, Object.class); } //@java.lang.Override public void unregisterService(String serviceName) throws MuleException { unregisterObject(serviceName, Service.class); } //@java.lang.Override public void unregisterAgent(String agentName) throws MuleException { unregisterObject(agentName, Agent.class); } //@java.lang.Override public void unregisterConnector(String connectorName) throws MuleException { unregisterObject(connectorName, Connector.class); } //@java.lang.Override public void unregisterEndpoint(String endpointName) throws MuleException { unregisterObject(endpointName, ImmutableEndpoint.class); } //@java.lang.Override public void unregisterModel(String modelName) throws MuleException { unregisterObject(modelName, Model.class); } //@java.lang.Override public void unregisterTransformer(String transformerName) throws MuleException { Transformer transformer = lookupTransformer(transformerName); if (transformer instanceof DiscoverableTransformer) { exactTransformerCache.clear(); transformerListCache.clear(); } unregisterObject(transformerName, Transformer.class); } //@java.lang.Override public Transformer lookupTransformer(String name) { Transformer transformer = super.lookupTransformer(name); if (transformer != null) { try { if (transformer.getEndpoint() != null) { throw new IllegalStateException("Endpoint cannot be set"); } // Map props = BeanUtils.describe(transformer); // props.remove("endpoint"); // props.remove("strategy"); // transformer = (Transformer)ClassUtils.instanciateClass(transformer.getClass(), ClassUtils.NO_ARGS); //TODO: friggin' cloning transformer = (Transformer) BeanUtils.cloneBean(transformer); } catch (Exception e) { e.printStackTrace(); } } return transformer; } public boolean isReadOnly() { return false; } public boolean isRemote() { return false; } } mule-2.0.1/core/src/main/java/org/mule/registry/ExpressionEvaluatorProcessor.java0000644000175000017500000000334410764600070030056 0ustar charlescharles/* * $Id: ExpressionEvaluatorProcessor.java 11282 2008-03-08 21:08:08Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.registry; import org.mule.api.lifecycle.Disposable; import org.mule.api.registry.ObjectProcessor; import org.mule.util.expression.ExpressionEvaluator; import org.mule.util.expression.ExpressionEvaluatorManager; /** * Registers ExpressionEvaluators with the {@link org.mule.util.expression.ExpressionEvaluatorManager} so that they will * be resolved at run-time. * {@link org.mule.util.expression.ExpressionEvaluator} objects are used to execute property expressions (usually on the * current message) at run-time to extract a dynamic value. */ public class ExpressionEvaluatorProcessor implements ObjectProcessor, Disposable { public ExpressionEvaluatorProcessor() { ExpressionEvaluatorManager.clearEvaluators(); } public Object process(Object object) { if(object instanceof ExpressionEvaluator) { ExpressionEvaluatorManager.registerEvaluator((ExpressionEvaluator)object); } return object; } /** * A lifecycle method where implementor should free up any resources. If an * exception is thrown it should just be logged and processing should continue. * This method should not throw Runtime exceptions. */ public void dispose() { ExpressionEvaluatorManager.clearEvaluators(); } } mule-2.0.1/core/src/main/java/org/mule/registry/AbstractRegistry.java0000644000175000017500000005443210774254333025444 0ustar charlescharles/* * $Id: AbstractRegistry.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.registry; import org.mule.MuleServer; import org.mule.RegistryContext; import org.mule.api.MuleException; import org.mule.api.agent.Agent; import org.mule.api.config.MuleProperties; import org.mule.api.context.MuleContextAware; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointFactory; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.LifecycleManager; import org.mule.api.model.Model; import org.mule.api.registry.RegistrationException; import org.mule.api.registry.Registry; import org.mule.api.service.Service; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.TransformerCollection; import org.mule.transformer.TransformerWeighting; import org.mule.transformer.simple.ObjectToByteArray; import org.mule.transformer.simple.ObjectToString; import org.mule.util.CollectionUtils; import org.mule.util.UUID; import org.mule.util.expression.ExpressionEvaluatorManager; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public abstract class AbstractRegistry implements Registry { private static final ObjectToString objectToString = new ObjectToString(); private static final ObjectToByteArray objectToByteArray = new ObjectToByteArray(); private Registry parent; /** the unique id for this Registry */ private String id; private int defaultScope = DEFAULT_SCOPE; protected transient Log logger = LogFactory.getLog(getClass()); protected LifecycleManager lifecycleManager; protected Map transformerListCache = new ConcurrentHashMap(8); protected Map exactTransformerCache = new ConcurrentHashMap(8); /** Default Constructor */ protected AbstractRegistry(String id) { if (id == null) { throw new NullPointerException(CoreMessages.objectIsNull("RegistryID").getMessage()); } this.id = id; lifecycleManager = createLifecycleManager(); } protected AbstractRegistry(String id, Registry parent) { this(id); setParent(parent); } protected abstract LifecycleManager createLifecycleManager(); protected LifecycleManager getLifecycleManager() { return lifecycleManager; } public final synchronized void dispose() { // TODO lifecycleManager.checkPhase(Disposable.PHASE_NAME); if (isDisposed()) { return; } try { exactTransformerCache.clear(); transformerListCache.clear(); doDispose(); lifecycleManager.firePhase(MuleServer.getMuleContext(), Disposable.PHASE_NAME); if (getParent() != null) { parent.dispose(); } else { // remove this reference once there is no one else left to dispose RegistryContext.setRegistry(null); ExpressionEvaluatorManager.clearEvaluators(); } } catch (MuleException e) { // TODO logger.error("Failed to cleanly dispose: " + e.getMessage(), e); } } protected void doDispose() { // hook for subclasses to do their disposal } public boolean isDisposed() { return lifecycleManager.isPhaseComplete(Disposable.PHASE_NAME); } public boolean isDisposing() { return Disposable.PHASE_NAME.equals(lifecycleManager.getExecutingPhase()); } public boolean isInitialised() { return lifecycleManager.isPhaseComplete(Initialisable.PHASE_NAME); } public boolean isInitialising() { return Initialisable.PHASE_NAME.equals(lifecycleManager.getExecutingPhase()); } public final void initialise() throws InitialisationException { lifecycleManager.checkPhase(Initialisable.PHASE_NAME); // if (getParent() != null) // { // parent.initialise(); // } // I don't think it makes sense for the Registry to know about the MuleContext at this point. // MuleContext mc = MuleServer.getMuleContext(); // if (mc != null) // { // mc.fireNotification(new RegistryNotification(this, RegistryNotification.REGISTRY_INITIALISING)); // } if (id == null) { logger.warn("No unique id has been set on this registry"); id = UUID.getUUID(); } try { doInitialise(); lifecycleManager.firePhase(MuleServer.getMuleContext(), Initialisable.PHASE_NAME); } catch (InitialisationException e) { throw e; } catch (Exception e) { throw new InitialisationException(e, this); } } protected void doInitialise() throws InitialisationException { // hook for subclasses do to their initialisation } public Connector lookupConnector(String name) { return (Connector) lookupObject(name); } /** * Removed this method from {@link Registry} API as it should only be used * internally and may confuse users. The {@link EndpointFactory} should be used * for creating endpoints.

    Looks up an returns endpoints registered in the * registry by their idendifier (currently endpoint name)

    NOTE: * This method does not create new endpoint instances, but rather returns * existing endpoint instances that have been registered. This lookup method * should be avoided and the intelligent, role specific endpoint lookup methods * should be used instead.

    * * @param name the idendtifer/name used to register endpoint in registry * @see #lookupInboundEndpoint(String, org.mule.api.MuleContext) * @see #lookupResponseEndpoint(String, org.mule.api.MuleContext) */ public ImmutableEndpoint lookupEndpoint(String name) { Object obj = lookupObject(name); if (obj instanceof ImmutableEndpoint) { return (ImmutableEndpoint) obj; } else { logger.debug("No endpoint with the name: " + name + "found. If " + name + " is a global endpoint you should use the EndpointFactory to create endpoint instances from global endpoints."); return null; } } public EndpointBuilder lookupEndpointBuilder(String name) { Object o = lookupObject(name); if (o instanceof EndpointBuilder) { logger.debug("Global endpoint EndpointBuilder for name: " + name + " found"); return (EndpointBuilder) o; } else { logger.debug("No endpoint builder with the name: " + name + " found."); return null; } } public EndpointFactory lookupEndpointFactory() { return (EndpointFactory) lookupObject(MuleProperties.OBJECT_MULE_ENDPOINT_FACTORY); } public Transformer lookupTransformer(String name) { return (Transformer) lookupObject(name); } /** {@inheritDoc} */ public Transformer lookupTransformer(Class inputType, Class outputType) throws TransformerException { Transformer result = (Transformer) exactTransformerCache.get(inputType.getName() + outputType.getName()); if (result != null) { return result; } List trans = lookupTransformers(inputType, outputType); result = getNearestTransformerMatch(trans, inputType, outputType); //If an exact mach is not found, we have a 'second pass' transformer that can be used to converting to String or //byte[] Transformer secondPass = null; if (result == null) { //If no transformers were found but the outputType type is String or byte[] we can perform a more general search // using Object.class and then convert to String or byte[] using the second pass transformer if (outputType.equals(String.class)) { secondPass = objectToString; } else if (outputType.equals(byte[].class)) { secondPass = objectToByteArray; } else { throw new TransformerException(CoreMessages.noTransformerFoundForMessage(inputType, outputType)); } //Perform a more general search trans = lookupTransformers(inputType, Object.class); result = getNearestTransformerMatch(trans, inputType, outputType); if (result != null) { result = new TransformerCollection(new Transformer[]{result, secondPass}); } } if (result != null) { exactTransformerCache.put(inputType.getName() + outputType.getName(), result); } return result; } protected Transformer getNearestTransformerMatch(List trans, Class input, Class output) throws TransformerException { if (trans.size() > 1) { TransformerWeighting weighting = null; for (Iterator iterator = trans.iterator(); iterator.hasNext();) { Transformer transformer = (Transformer) iterator.next(); TransformerWeighting current = new TransformerWeighting(input, output, transformer); if (weighting == null) { weighting = current; } else { int compare = current.compareTo(weighting); if (compare == 1) { weighting = current; } else if (compare == 0) { //We may have two transformers that are exactly the same, in which case we can use either i.e. use the current if (!weighting.getTransformer().getClass().equals(current.getTransformer().getClass())) { throw new TransformerException(CoreMessages.transformHasMultipleMatches(input, output, current.getTransformer(), weighting.getTransformer())); } } } } return weighting.getTransformer(); } else if (trans.size() == 0) { return null; } else { return (Transformer) trans.get(0); } } /** {@inheritDoc} */ public List lookupTransformers(Class input, Class output) { List results = (List) transformerListCache.get(input.getName() + output.getName()); if (results != null) { return results; } results = new ArrayList(2); Collection transformers = getTransformers(); for (Iterator itr = transformers.iterator(); itr.hasNext();) { Transformer t = (Transformer) itr.next(); //The transformer must have the DiscoveryTransformer interface if we are going to //find it here if (!(t instanceof DiscoverableTransformer)) { continue; } Class c = t.getReturnClass(); //TODO RM* this sohuld be an exception if (c == null) { c = Object.class; } if (output.isAssignableFrom(c) && t.isSourceTypeSupported(input)) { results.add(t); } } transformerListCache.put(input.getName() + output.getName(), results); return results; } public Model lookupModel(String name) { return (Model) lookupObject(name); } public Model lookupSystemModel() { return lookupModel(MuleProperties.OBJECT_SYSTEM_MODEL); } public Collection getModels() { return lookupObjects(Model.class); } public Collection getConnectors() { return lookupObjects(Connector.class); } public Collection getAgents() { return lookupObjects(Agent.class); } public Collection getEndpoints() { return lookupObjects(ImmutableEndpoint.class); } public Collection getTransformers() { return lookupObjects(Transformer.class); } public Agent lookupAgent(String name) { return (Agent) lookupObject(name); } public Service lookupService(String name) { return (Service) lookupObject(name); } public Collection/**/ lookupServices() { return lookupObjects(Service.class); } public Collection/**/ lookupServices(String model) { Collection/**/ components = lookupServices(); List modelComponents = new ArrayList(); Iterator it = components.iterator(); Service service; while (it.hasNext()) { service = (Service) it.next(); // TODO Make this comparison more robust. if (model.equals(service.getModel().getName())) { modelComponents.add(service); } } return modelComponents; } public final Object lookupObject(String key, int scope) { logger.debug("lookupObject: key=" + key + " scope=" + scope); Object o = doLookupObject(key); if (o == null) { if (logger.isDebugEnabled()) { logger.debug("Failed to find object in Registry ID: " + getRegistryId()); } if (getParent() != null && scope > SCOPE_IMMEDIATE) { if (getParent().isRemote() && scope == SCOPE_REMOTE) { o = getParent().lookupObject(key); } else if (!getParent().isRemote() && scope >= SCOPE_LOCAL) { o = getParent().lookupObject(key); } } } return o; } public final Object lookupObject(Class type) throws RegistrationException { return lookupObject(type, getDefaultScope()); } /** * Look up a single object by type. * @return null if no object is found * @throws RegistrationException if more than one object is found */ public final Object lookupObject(Class type, int scope) throws RegistrationException { Collection collection = lookupObjects(type, scope); if (collection == null || collection.size() < 1) { return null; } else if (collection.size() > 1) { throw new RegistrationException("More than one object of type " + type + " was found in registry, but only 1 was expected."); } else { return collection.iterator().next(); } } public final Collection lookupObjects(Class type) { return lookupObjects(type, getDefaultScope()); } public final Collection lookupObjects(Class type, int scope) { logger.debug("lookupObjects: type=" + type + " scope=" + scope); Collection collection = doLookupObjects(type); if (collection == null) { collection = new ArrayList(); } if (getParent() != null && scope > SCOPE_IMMEDIATE) { if (getParent().isRemote() && scope == SCOPE_REMOTE) { Collection collection2 = getParent().lookupObjects(type); if (collection2 != null) { collection.addAll(collection2); } } else if (!getParent().isRemote() && scope >= SCOPE_LOCAL) { Collection collection2 = getParent().lookupObjects(type); if (collection2 != null) { collection = CollectionUtils.union(collection, collection2); } } } return collection; } protected abstract Collection doLookupObjects(Class type); public Object lookupObject(String key) { return lookupObject(key, getDefaultScope()); } /** * Initialises all registered agents * * @throws org.mule.api.lifecycle.InitialisationException */ // TODO: Spring is now taking care of the initialisation lifecycle, need to check that we still get this // problem // protected void initialiseAgents() throws InitialisationException // { // logger.info("Initialising agents..."); // // // Do not iterate over the map directly, as 'complex' agents // // may spawn extra agents during initialisation. This will // // cause a ConcurrentModificationException. // // Use a cursorable iteration, which supports on-the-fly underlying // // data structure changes. // Collection agentsSnapshot = lookupCollection(Agent.class).values(); // CursorableLinkedList agentRegistrationQueue = new CursorableLinkedList(agentsSnapshot); // CursorableLinkedList.Cursor cursor = agentRegistrationQueue.cursor(); // // // the actual agent object refs are the same, so we are just // // providing different views of the same underlying data // // try // { // while (cursor.hasNext()) // { // Agent umoAgent = (Agent) cursor.next(); // // int originalSize = agentsSnapshot.size(); // logger.debug("Initialising agent: " + umoAgent.getName()); // umoAgent.initialise(); // // thank you, we are done with you // cursor.remove(); // // // Direct calls to MuleManager.registerAgent() modify the original // // agents map, re-check if the above agent registered any // // 'child' agents. // int newSize = agentsSnapshot.size(); // int delta = newSize - originalSize; // if (delta > 0) // { // // TODO there's some mess going on in // // http://issues.apache.org/jira/browse/COLLECTIONS-219 // // watch out when upgrading the commons-collections. // Collection tail = CollectionUtils.retainAll(agentsSnapshot, agentRegistrationQueue); // Collection head = CollectionUtils.subtract(agentsSnapshot, tail); // // // again, above are only refs, all going back to the original agents map // // // re-order the queue // agentRegistrationQueue.clear(); // // 'spawned' agents first // agentRegistrationQueue.addAll(head); // // and the rest // agentRegistrationQueue.addAll(tail); // // // update agents map with a new order in case we want to re-initialise // // MuleManager on the fly // for (Iterator it = agentRegistrationQueue.iterator(); it.hasNext();) // { // Agent theAgent = (Agent) it.next(); // theAgent.initialise(); // } // } // } // } // finally // { // // close the cursor as per JavaDoc // cursor.close(); // } // logger.info("Agents Successfully Initialised"); // } /** @return null if object not found */ protected abstract Object doLookupObject(String key); protected void unsupportedOperation(String operation, Object o) throws UnsupportedOperationException { throw new UnsupportedOperationException( "Registry: " + getRegistryId() + " is read-only so objects cannot be registered or unregistered. Failed to execute operation " + operation + " on object: " + o); } public final void registerObject(String key, Object value) throws RegistrationException { registerObject(key, value, null); } public final void registerObject(String key, Object value, Object metadata) throws RegistrationException { logger.debug("registerObject: key=" + key + " value=" + value + " metadata=" + metadata); if (value instanceof MuleContextAware) { ((MuleContextAware) value).setMuleContext(MuleServer.getMuleContext()); } doRegisterObject(key, value, metadata); } protected abstract void doRegisterObject(String key, Object value, Object metadata) throws RegistrationException; public final void registerTransformer(Transformer transformer) throws MuleException { if (transformer instanceof DiscoverableTransformer) { exactTransformerCache.clear(); transformerListCache.clear(); } doRegisterTransformer(transformer); } protected abstract void doRegisterTransformer(Transformer transformer) throws MuleException; // ///////////////////////////////////////////////////////////////////////// // Registry Metadata // ///////////////////////////////////////////////////////////////////////// public final String getRegistryId() { return id; } public Registry getParent() { return parent; } public void setParent(Registry registry) { this.parent = registry; } public int getDefaultScope() { return defaultScope; } public void setDefaultScope(int scope) { if (scope < SCOPE_IMMEDIATE || scope > SCOPE_REMOTE) { throw new IllegalArgumentException("Invalid value for scope: " + scope); } defaultScope = scope; } } mule-2.0.1/core/src/main/java/org/mule/security/0000755000175000017500000000000011351411115021255 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/security/MuleSecurityManager.java0000644000175000017500000001262310774254333026070 0ustar charlescharles/* * $Id: MuleSecurityManager.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.EncryptionStrategy; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.LifecycleTransitionResult; import org.mule.api.security.Authentication; import org.mule.api.security.SecurityContext; import org.mule.api.security.SecurityException; import org.mule.api.security.SecurityManager; import org.mule.api.security.SecurityProvider; import org.mule.api.security.SecurityProviderNotFoundException; import org.mule.api.security.UnknownAuthenticationTypeException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MuleSecurityManager is a default implementation security manager * for a Mule instance. */ public class MuleSecurityManager implements SecurityManager { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(MuleSecurityManager.class); private Map providers = new ConcurrentHashMap(); private Map cryptoStrategies = new ConcurrentHashMap(); public MuleSecurityManager() { super(); } public void initialise() throws InitialisationException { List all = new LinkedList(providers.values()); // ordering: appends all.addAll(cryptoStrategies.values()); LifecycleTransitionResult.initialiseAll(all.iterator()); } public Authentication authenticate(Authentication authentication) throws SecurityException, SecurityProviderNotFoundException { Iterator iter = providers.values().iterator(); Class toTest = authentication.getClass(); while (iter.hasNext()) { SecurityProvider provider = (SecurityProvider) iter.next(); if (provider.supports(toTest)) { if (logger.isDebugEnabled()) { logger.debug("Authentication attempt using " + provider.getClass().getName()); } Authentication result = provider.authenticate(authentication); if (result != null) { return result; } } } throw new SecurityProviderNotFoundException(toTest.getName()); } public void addProvider(SecurityProvider provider) { if (getProvider(provider.getName()) != null) { throw new IllegalArgumentException("Provider already registered: " + provider.getName()); } providers.put(provider.getName(), provider); } public SecurityProvider getProvider(String name) { if (name == null) { throw new IllegalArgumentException("provider Name cannot be null"); } return (SecurityProvider) providers.get(name); } public SecurityProvider removeProvider(String name) { return (SecurityProvider) providers.remove(name); } public Collection getProviders() { return Collections.unmodifiableCollection(new ArrayList(providers.values())); } public void setProviders(Collection providers) { for (Iterator iterator = providers.iterator(); iterator.hasNext();) { SecurityProvider provider = (SecurityProvider) iterator.next(); addProvider(provider); } } public SecurityContext createSecurityContext(Authentication authentication) throws UnknownAuthenticationTypeException { Iterator iter = providers.values().iterator(); Class toTest = authentication.getClass(); while (iter.hasNext()) { SecurityProvider provider = (SecurityProvider) iter.next(); if (provider.supports(toTest)) { return provider.createSecurityContext(authentication); } } throw new UnknownAuthenticationTypeException(authentication); } public EncryptionStrategy getEncryptionStrategy(String name) { return (EncryptionStrategy) cryptoStrategies.get(name); } public void addEncryptionStrategy(EncryptionStrategy strategy) { cryptoStrategies.put(strategy.getName(), strategy); } public EncryptionStrategy removeEncryptionStrategy(String name) { return (EncryptionStrategy) cryptoStrategies.remove(name); } public Collection getEncryptionStrategies() { return Collections.unmodifiableCollection(new ArrayList(cryptoStrategies.values())); } public void setEncryptionStrategies(Collection strategies) { for (Iterator iterator = strategies.iterator(); iterator.hasNext();) { EncryptionStrategy strategy = (EncryptionStrategy) iterator.next(); addEncryptionStrategy(strategy); } } } mule-2.0.1/core/src/main/java/org/mule/security/package.html0000644000175000017500000000022610745677442023565 0ustar charlescharles Mule Core security implementation including the mule security manager and encryption types mule-2.0.1/core/src/main/java/org/mule/security/MuleCredentials.java0000644000175000017500000000770210745677442025235 0ustar charlescharles/* * $Id: MuleCredentials.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.EncryptionStrategy; import org.mule.api.config.MuleProperties; import org.mule.api.security.Credentials; import org.mule.api.security.CryptoFailureException; import org.mule.api.security.EncryptionStrategyNotFoundException; import org.mule.api.security.SecurityManager; import org.mule.config.i18n.CoreMessages; import org.mule.util.ArrayUtils; import java.util.StringTokenizer; /** * MuleCredentials can be used to read and set Mule user information * that can be stored in a message header. */ public class MuleCredentials implements Credentials { public static final String TOKEN_DELIM = "::"; private final String username; private final char[] password; private Object roles; public MuleCredentials(String username, char[] password) { this.username = username; this.password = ArrayUtils.clone(password); } public MuleCredentials(String username, char[] password, Object roles) { this.username = username; this.password = ArrayUtils.clone(password); this.roles = roles; } public MuleCredentials(String header, SecurityManager sm) throws EncryptionStrategyNotFoundException, CryptoFailureException { int i = header.indexOf(' '); if (i == -1) { throw new IllegalArgumentException( CoreMessages.headerMalformedValueIs(MuleProperties.MULE_USER_PROPERTY, header).toString()); } String scheme = header.substring(0, i); String creds = header.substring(i + 1); if (!scheme.equalsIgnoreCase("plain")) { EncryptionStrategy es = sm.getEncryptionStrategy(scheme); if (es == null) { throw new EncryptionStrategyNotFoundException(scheme); } else { creds = new String(es.decrypt(creds.getBytes(), null)); } } StringTokenizer st = new StringTokenizer(creds, TOKEN_DELIM); username = st.nextToken(); password = st.nextToken().toCharArray(); if (st.hasMoreTokens()) { roles = st.nextToken(); } } public String getToken() { StringBuffer buf = new StringBuffer(); buf.append(username).append(TOKEN_DELIM); buf.append(password).append(TOKEN_DELIM); if (roles != null) { buf.append(roles); } return buf.toString(); } public String getUsername() { return username; } public char[] getPassword() { return ArrayUtils.clone(password); } public Object getRoles() { return roles; } public static String createHeader(String username, char[] password) { StringBuffer buf = new StringBuffer(32); buf.append("Plain "); buf.append(username).append(TOKEN_DELIM); buf.append(password).append(TOKEN_DELIM); return buf.toString(); } public static String createHeader(String username, String password, String encryptionName, EncryptionStrategy es) throws CryptoFailureException { StringBuffer buf = new StringBuffer(); buf.append(encryptionName).append(" "); String creds = username + TOKEN_DELIM + password; byte[] encrypted = es.encrypt(creds.getBytes(), null); buf.append(new String(encrypted)); return buf.toString(); } } mule-2.0.1/core/src/main/java/org/mule/security/SecretKeyFactory.java0000644000175000017500000000122710760504151025356 0ustar charlescharles/* * $Id: SecretKeyFactory.java 10976 2008-02-25 09:20:41Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; /** * A factory class for providing secret keys to an instance of * {@link SecretKeyEncryptionStrategy}. * * @see SecretKeyEncryptionStrategy */ public interface SecretKeyFactory { byte[] getKey(); } mule-2.0.1/core/src/main/java/org/mule/security/PasswordBasedEncryptionStrategy.java0000644000175000017500000000556110774254333030505 0ustar charlescharles/* * $Id: PasswordBasedEncryptionStrategy.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import java.security.GeneralSecurityException; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.KeySpec; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.PBEParameterSpec; /** * Provides password-based encryption using JCE. Users must specify a password and * optionally a salt and iteration count as well. The default algorithm is * PBEWithMD5AndDES, but users can specify any valid algorithm supported by JCE. */ public class PasswordBasedEncryptionStrategy extends AbstractJCEEncryptionStrategy { public static final String DEFAULT_ALGORITHM = "PBEWithMD5AndDES"; public static final int DEFAULT_ITERATION_COUNT = 20; private byte[] salt = null; private int iterationCount = DEFAULT_ITERATION_COUNT; private char[] password; public PasswordBasedEncryptionStrategy() { algorithm = DEFAULT_ALGORITHM; } public void initialise() throws InitialisationException { if (salt == null) { salt = new byte[]{(byte) 0xc7, (byte) 0x73, (byte) 0x21, (byte) 0x8c, (byte) 0x7e, (byte) 0xc8, (byte) 0xee, (byte) 0x99}; logger.debug("Salt is not set. Using default salt"); } if (password == null) { throw new InitialisationException(CoreMessages.objectIsNull("Password"), this); } super.initialise(); } protected KeySpec createKeySpec() { return new PBEKeySpec(password); } protected AlgorithmParameterSpec createAlgorithmParameterSpec() { return new PBEParameterSpec(salt, iterationCount); } public byte[] getSalt() { return salt; } public void setSalt(byte[] salt) { this.salt = salt; } public int getIterationCount() { return iterationCount; } public void setIterationCount(int iterationCount) { this.iterationCount = iterationCount; } public void setPassword(String password) { this.password = password.toCharArray(); } protected SecretKey getSecretKey() throws GeneralSecurityException { SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(getAlgorithm()); return keyFactory.generateSecret(keySpec); } } mule-2.0.1/core/src/main/java/org/mule/security/SecretKeyEncryptionStrategy.java0000644000175000017500000000552710774254333027644 0ustar charlescharles/* * $Id: SecretKeyEncryptionStrategy.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import org.mule.util.StringMessageUtils; import java.security.GeneralSecurityException; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.KeySpec; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; /** * SecretKey based encryption using JCE. Users must specify a key as an array of * bytes. This can be set directly on the strategy or a keyFactory can be specified. * A keyFactory is an implementation of {@link SecretKeyFactory} and must return a * byte array. The default algorthm used by this strategy is Blowfish, but users can * specify any valid algorithm supported by JCE. * * @see SecretKeyFactory */ public class SecretKeyEncryptionStrategy extends AbstractJCEEncryptionStrategy { public static final String DEFAULT_ALGORITHM = "Blowfish"; private byte[] key; private SecretKeyFactory keyFactory; public SecretKeyEncryptionStrategy() { algorithm = DEFAULT_ALGORITHM; } public void initialise() throws InitialisationException { if (key == null) { if (keyFactory == null) { throw new InitialisationException(CoreMessages.objectIsNull("Key / KeyFactory"), this); } else { try { key = keyFactory.getKey(); } catch (Exception e) { throw new InitialisationException(e, this); } } } super.initialise(); } protected KeySpec createKeySpec() { return new SecretKeySpec(key, algorithm); } protected AlgorithmParameterSpec createAlgorithmParameterSpec() { return null; } public void setKey(byte[] rawKey) { this.key = rawKey; } public void setKey(String rawKey) { this.key = StringMessageUtils.getBytes(rawKey); } public SecretKeyFactory getKeyFactory() { return keyFactory; } public void setKeyFactory(SecretKeyFactory keyFactory) { this.keyFactory = keyFactory; } protected SecretKey getSecretKey() throws GeneralSecurityException { return KeyGenerator.getInstance(algorithm).generateKey(); } } mule-2.0.1/core/src/main/java/org/mule/security/MuleHeaderCredentialsAccessor.java0000644000175000017500000000211710745677442030024 0ustar charlescharles/* * $Id: MuleHeaderCredentialsAccessor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.MuleEvent; import org.mule.api.config.MuleProperties; import org.mule.api.security.CredentialsAccessor; /** * MuleHeaderCredentialsAccessor obtains and sets the user credentials * as Mule property headers. */ public class MuleHeaderCredentialsAccessor implements CredentialsAccessor { public Object getCredentials(MuleEvent event) { return event.getMessage().getProperty(MuleProperties.MULE_USER_PROPERTY); } public void setCredentials(MuleEvent event, Object credentials) { event.getMessage().setProperty(MuleProperties.MULE_USER_PROPERTY, credentials); } } mule-2.0.1/core/src/main/java/org/mule/security/filters/0000755000175000017500000000000011351411115022725 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/security/filters/package.html0000644000175000017500000000013510745677442025234 0ustar charlescharles Mule Core sercurity filter types. mule-2.0.1/core/src/main/java/org/mule/security/filters/MuleEncryptionEndpointSecurityFilter.java0000644000175000017500000001136510745677442033201 0ustar charlescharles/* * $Id: MuleEncryptionEndpointSecurityFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security.filters; import org.mule.api.EncryptionStrategy; import org.mule.api.MuleEvent; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.Authentication; import org.mule.api.security.Credentials; import org.mule.api.security.CredentialsNotSetException; import org.mule.api.security.CryptoFailureException; import org.mule.api.security.EncryptionStrategyNotFoundException; import org.mule.api.security.SecurityContext; import org.mule.api.security.SecurityException; import org.mule.api.security.SecurityProviderNotFoundException; import org.mule.api.security.UnauthorisedException; import org.mule.api.security.UnknownAuthenticationTypeException; import org.mule.config.i18n.CoreMessages; import org.mule.security.AbstractEndpointSecurityFilter; import org.mule.security.DefaultMuleAuthentication; import org.mule.security.MuleCredentials; import org.mule.security.MuleHeaderCredentialsAccessor; /** * MuleEncryptionEndpointSecurityFilter provides password-based * encryption */ public class MuleEncryptionEndpointSecurityFilter extends AbstractEndpointSecurityFilter { private EncryptionStrategy strategy; public MuleEncryptionEndpointSecurityFilter() { setCredentialsAccessor(new MuleHeaderCredentialsAccessor()); } protected final void authenticateInbound(MuleEvent event) throws SecurityException, CryptoFailureException, EncryptionStrategyNotFoundException, UnknownAuthenticationTypeException { String userHeader = (String) getCredentialsAccessor().getCredentials(event); if (userHeader == null) { throw new CredentialsNotSetException(event.getMessage(), event.getSession().getSecurityContext(), event.getEndpoint(), this); } Credentials user = new MuleCredentials(userHeader, getSecurityManager()); Authentication authResult; Authentication umoAuthentication = new DefaultMuleAuthentication(user); try { authResult = getSecurityManager().authenticate(umoAuthentication); } catch (Exception e) { // Authentication failed if (logger.isDebugEnabled()) { logger.debug("Authentication request for user: " + user.getUsername() + " failed: " + e.toString()); } throw new UnauthorisedException(CoreMessages.authFailedForUser(user.getUsername()), event.getMessage(), e); } // Authentication success if (logger.isDebugEnabled()) { logger.debug("Authentication success: " + authResult.toString()); } SecurityContext context = getSecurityManager().createSecurityContext(authResult); context.setAuthentication(authResult); event.getSession().setSecurityContext(context); } protected void authenticateOutbound(MuleEvent event) throws SecurityException, SecurityProviderNotFoundException, CryptoFailureException { if (event.getSession().getSecurityContext() == null) { if (isAuthenticate()) { throw new UnauthorisedException(event.getMessage(), event.getSession().getSecurityContext(), event.getEndpoint(), this); } else { return; } } Authentication auth = event.getSession().getSecurityContext().getAuthentication(); if (isAuthenticate()) { auth = getSecurityManager().authenticate(auth); if (logger.isDebugEnabled()) { logger.debug("Authentication success: " + auth.toString()); } } String token = auth.getCredentials().toString(); String header = new String(strategy.encrypt(token.getBytes(), null)); getCredentialsAccessor().setCredentials(event, header); } protected void doInitialise() throws InitialisationException { if (strategy == null) { throw new InitialisationException(CoreMessages.encryptionStrategyNotSet(), this); } } public EncryptionStrategy getStrategy() { return strategy; } public void setStrategy(EncryptionStrategy strategy) { this.strategy = strategy; } } mule-2.0.1/core/src/main/java/org/mule/security/DefaultMuleAuthentication.java0000644000175000017500000000262210745677442027260 0ustar charlescharles/* * $Id: DefaultMuleAuthentication.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.security.Authentication; import org.mule.api.security.Credentials; import java.util.Map; public class DefaultMuleAuthentication implements Authentication { private boolean authenticated; private char[] credentials; private String user; private Map properties; public DefaultMuleAuthentication(Credentials credentials) { this.user = credentials.getUsername(); this.credentials = credentials.getPassword(); } public void setAuthenticated(boolean b) { authenticated = b; } public boolean isAuthenticated() { return authenticated; } public Object getCredentials() { return new String(credentials); } public Object getPrincipal() { return user; } public Map getProperties() { return properties; } public void setProperties(Map properties) { this.properties = properties; } } mule-2.0.1/core/src/main/java/org/mule/security/AbstractNamedEncryptionStrategy.java0000644000175000017500000000137610745677442030464 0ustar charlescharles/* * $Id: AbstractNamedEncryptionStrategy.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.EncryptionStrategy; public abstract class AbstractNamedEncryptionStrategy implements EncryptionStrategy { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } mule-2.0.1/core/src/main/java/org/mule/security/AbstractEndpointSecurityFilter.java0000644000175000017500000001537410774254333030313 0ustar charlescharles/* * $Id: AbstractEndpointSecurityFilter.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.context.MuleContextAware; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.CredentialsAccessor; import org.mule.api.security.CryptoFailureException; import org.mule.api.security.EncryptionStrategyNotFoundException; import org.mule.api.security.EndpointSecurityFilter; import org.mule.api.security.SecurityException; import org.mule.api.security.SecurityManager; import org.mule.api.security.SecurityProvider; import org.mule.api.security.SecurityProviderNotFoundException; import org.mule.api.security.UnknownAuthenticationTypeException; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.transformer.TransformerTemplate; import org.mule.util.StringUtils; import java.util.Arrays; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractEndpointSecurityFilter provides basic initialisation for * all security filters, namely configuring the SecurityManager for this instance */ public abstract class AbstractEndpointSecurityFilter implements EndpointSecurityFilter, MuleContextAware { protected transient Log logger = LogFactory.getLog(getClass()); protected SecurityManager securityManager; private String securityProviders; protected ImmutableEndpoint endpoint; private boolean inbound = false; private boolean authenticate; private CredentialsAccessor credentialsAccessor; private boolean isInitialised = false; protected MuleContext muleContext; public void setMuleContext(MuleContext context) { this.muleContext = context; } public final void initialise() throws InitialisationException { if (securityManager == null) { securityManager = muleContext.getSecurityManager(); } if (securityManager == null) { throw new InitialisationException(CoreMessages.authSecurityManagerNotSet(), this); } // This filter may only allow authentication on a subset of registered // security providers if (securityProviders != null) { SecurityManager localManager = new MuleSecurityManager(); String[] sp = StringUtils.splitAndTrim(securityProviders, ","); for (int i = 0; i < sp.length; i++) { SecurityProvider provider = securityManager.getProvider(sp[i]); if (provider != null) { localManager.addProvider(provider); } else { throw new InitialisationException( CoreMessages.objectNotRegistered( "Security Provider", sp[i]), this); } } securityManager = localManager; } } protected final synchronized void lazyInit() throws InitialisationException { if (!isInitialised) { initialiseEndpoint(); isInitialised = true; } } protected final void initialiseEndpoint() throws InitialisationException { if (endpoint == null) { throw new InitialisationException(CoreMessages.objectIsNull("Endpoint"), this); } if (endpoint instanceof InboundEndpoint) { inbound = true; } else if (endpoint instanceof OutboundEndpoint) { inbound = false; } else { throw new InitialisationException(CoreMessages.authEndpointMustSendOrReceive(), this); } doInitialise(); } public boolean isAuthenticate() { return authenticate; } public void setAuthenticate(boolean authenticate) { this.authenticate = authenticate; } /** @param manager */ public void setSecurityManager(SecurityManager manager) { securityManager = manager; } public SecurityManager getSecurityManager() { return securityManager; } public String getSecurityProviders() { return securityProviders; } public void setSecurityProviders(String providers) { securityProviders = providers; } public ImmutableEndpoint getEndpoint() { return endpoint; } public synchronized void setEndpoint(ImmutableEndpoint endpoint) { this.endpoint = endpoint; isInitialised = false; } public void authenticate(MuleEvent event) throws SecurityException, UnknownAuthenticationTypeException, CryptoFailureException, SecurityProviderNotFoundException, EncryptionStrategyNotFoundException, InitialisationException { lazyInit(); if (inbound) { authenticateInbound(event); } else { authenticateOutbound(event); } } public CredentialsAccessor getCredentialsAccessor() { return credentialsAccessor; } public void setCredentialsAccessor(CredentialsAccessor credentialsAccessor) { this.credentialsAccessor = credentialsAccessor; } protected void updatePayload(MuleMessage message, final Object payload) throws TransformerException { TransformerTemplate trans = new TransformerTemplate(new TransformerTemplate.TransformerCallback() { public Object doTransform(MuleMessage message) throws Exception { return payload; } }); message.applyTransformers(Arrays.asList(new Object[]{trans})); } protected abstract void authenticateInbound(MuleEvent event) throws SecurityException, CryptoFailureException, SecurityProviderNotFoundException, EncryptionStrategyNotFoundException, UnknownAuthenticationTypeException; protected abstract void authenticateOutbound(MuleEvent event) throws SecurityException, SecurityProviderNotFoundException, CryptoFailureException; protected abstract void doInitialise() throws InitialisationException; } mule-2.0.1/core/src/main/java/org/mule/security/AbstractJCEEncryptionStrategy.java0000644000175000017500000001046610774254333030031 0ustar charlescharles/* * $Id: AbstractJCEEncryptionStrategy.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.security; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.CryptoFailureException; import org.mule.config.i18n.CoreMessages; import org.mule.util.Base64; import java.security.GeneralSecurityException; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.KeySpec; import javax.crypto.Cipher; import javax.crypto.SecretKey; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A JCE based encryption strategy. It also provides base64 encoding of * encrypted/decrypted data by setting the base64encoding attribute. */ public abstract class AbstractJCEEncryptionStrategy extends AbstractNamedEncryptionStrategy { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); protected KeySpec keySpec; protected SecretKey secretKey; protected Cipher encryptCipher; protected Cipher decryptCipher; protected String algorithm = null; protected boolean base64Encoding = true; public void initialise() throws InitialisationException { if (algorithm == null) { throw new InitialisationException(CoreMessages.objectIsNull("Algorithm"), this); } else { logger.debug("Using encryption algorithm: " + algorithm); } keySpec = createKeySpec(); try { secretKey = getSecretKey(); // Create Ciphers encryptCipher = Cipher.getInstance(getAlgorithm()); decryptCipher = Cipher.getInstance(getAlgorithm()); AlgorithmParameterSpec paramSpec = createAlgorithmParameterSpec(); if (paramSpec != null) { encryptCipher.init(Cipher.ENCRYPT_MODE, secretKey, paramSpec); decryptCipher.init(Cipher.DECRYPT_MODE, secretKey, paramSpec); } else { encryptCipher.init(Cipher.ENCRYPT_MODE, secretKey); decryptCipher.init(Cipher.DECRYPT_MODE, secretKey); } } catch (Exception e) { throw new InitialisationException(CoreMessages.failedToCreate("encryption ciphers"), e, this); } } protected abstract SecretKey getSecretKey() throws GeneralSecurityException; public byte[] encrypt(byte[] data, Object info) throws CryptoFailureException { try { byte[] buf = encryptCipher.doFinal(data); if (base64Encoding) { return Base64.encodeBytes(buf).getBytes(); } else { return buf; } } catch (Exception e) { throw new CryptoFailureException(this, e); } } public byte[] decrypt(byte[] data, Object info) throws CryptoFailureException { try { byte[] dec = data; if (base64Encoding) { dec = Base64.decode(new String(data)); } return decryptCipher.doFinal(dec); } catch (Exception e) { throw new CryptoFailureException(this, e); } } public String getAlgorithm() { return algorithm; } public void setAlgorithm(String algorithm) { this.algorithm = algorithm; } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("Algorithm=").append(algorithm); return buf.toString(); } public boolean isBase64Encoding() { return base64Encoding; } public void setBase64Encoding(boolean base64Encoding) { this.base64Encoding = base64Encoding; } protected abstract KeySpec createKeySpec(); protected abstract AlgorithmParameterSpec createAlgorithmParameterSpec(); } mule-2.0.1/core/src/main/java/org/mule/DefaultMuleMessage.java0000644000175000017500000004500211005754564024004 0ustar charlescharles/* * $Id: DefaultMuleMessage.java 11660 2008-04-30 02:29:08Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.ExceptionPayload; import org.mule.api.MuleMessage; import org.mule.api.MuleRuntimeException; import org.mule.api.ThreadSafeAccess; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.MutableMessageAdapter; import org.mule.api.transport.PropertyScope; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractMessageAdapter; import org.mule.transport.DefaultMessageAdapter; import org.mule.transport.NullPayload; import java.io.InputStream; import java.lang.reflect.Proxy; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import javax.activation.DataHandler; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * DefaultMuleMessage is a wrapper that contains a payload and properties * associated with the payload. */ public class DefaultMuleMessage implements MuleMessage, ThreadSafeAccess { /** Serial version */ private static final long serialVersionUID = 1541720810851984842L; private static Log logger = LogFactory.getLog(DefaultMuleMessage.class); private MessageAdapter adapter; private MessageAdapter originalAdapter = null; private transient List appliedTransformerHashCodes = new CopyOnWriteArrayList(); private byte[] cache; public DefaultMuleMessage(Object message) { this(message, (Map) null); } public DefaultMuleMessage(Object message, Map properties) { if (message instanceof MessageAdapter) { adapter = (MessageAdapter) message; } else { adapter = new DefaultMessageAdapter(message); } addProperties(properties); resetAccessControl(); } public DefaultMuleMessage(Object message, MessageAdapter previous) { if (message instanceof MessageAdapter) { adapter = (MessageAdapter) message; ((ThreadSafeAccess) adapter).resetAccessControl(); } else { adapter = new DefaultMessageAdapter(message, previous); } if (previous.getExceptionPayload() != null) { setExceptionPayload(previous.getExceptionPayload()); } setEncoding(previous.getEncoding()); if (previous.getAttachmentNames().size() > 0) { Set attNames = adapter.getAttachmentNames(); synchronized (attNames) { for (Iterator iterator = attNames.iterator(); iterator.hasNext();) { String s = (String) iterator.next(); try { addAttachment(s, adapter.getAttachment(s)); } catch (Exception e) { throw new MuleRuntimeException(CoreMessages.failedToReadAttachment(s), e); } } } } resetAccessControl(); } /** {@inheritDoc} */ public Object getPayload(Class outputType) throws TransformerException { return getPayload(outputType, getEncoding()); } /** * Will attempt to obtain the payload of this message with the desired Class type. This will * try and resolve a trnsformr that can do this transformation. If a transformer cannot be found * an exception is thrown. Any transfromers added to the reqgistry will be checked for compatability * * @param outputType the desired return type * @param encoding the encoding to use if required * @return The converted payload of this message. Note that this method will not alter the payload of this * message *unless* the payload is an inputstream in which case the stream will be read and the payload will become * the fully read stream. * @throws TransformerException if a transformer cannot be found or there is an error during transformation of the * payload */ protected Object getPayload(Class outputType, String encoding) throws TransformerException { //Handle null by ignoring the request if (outputType == null) { return getPayload(); } Class inputCls = getPayload().getClass(); //Special case where proxies are used for testing if (Proxy.isProxyClass(inputCls)) { inputCls = inputCls.getInterfaces()[0]; } //If no conversion is necessary, just return the payload as-is if (outputType.isAssignableFrom(inputCls)) { return getPayload(); } //Grab a list of transformers that batch out input/output requirements // List transformers = RegistryContext.getRegistry().lookupTransformers(inputCls, outputType); //The transformer to execute on this message Transformer transformer = null; transformer = MuleServer.getMuleContext().getRegistry().lookupTransformer(inputCls, outputType); //no transformers found if (transformer == null) { throw new TransformerException(CoreMessages.noTransformerFoundForMessage(inputCls, outputType)); } // Pass in the adapter itself, so we respect the encoding Object result = transformer.transform(this); //TODO Unless we disallow Object.class as a valid return type we need to do this extra check if (!outputType.isAssignableFrom(result.getClass())) { throw new TransformerException(CoreMessages.transformOnObjectNotOfSpecifiedType(outputType.getName(), result.getClass())); } //If the payload is a stream and we've consumed it, then we should //set the payload on the message //This is the only time this method will alter the payload on the message if (isPayloadConsumed(inputCls)) { setPayload(result); } return result; } /** * Checks if the payload has been consumed for this message. This only applies to Streaming payload types * since once the stream has been read, the payload of the message should be updated to represent the data read * from the stream * * @param inputCls the input type of the message payload * @return true if the payload message type was stream-based, false otherwise */ protected boolean isPayloadConsumed(Class inputCls) { return InputStream.class.isAssignableFrom(inputCls); } /** {@inheritDoc} */ public MessageAdapter getAdapter() { return adapter; } /** {@inheritDoc} */ public Object getOrginalPayload() { return (originalAdapter == null ? adapter.getPayload() : originalAdapter.getPayload()); } /** {@inheritDoc} */ public MessageAdapter getOriginalAdapter() { return (originalAdapter == null ? adapter : originalAdapter); } /** {@inheritDoc} */ public void setProperty(String key, Object value, PropertyScope scope) { adapter.setProperty(key, value, scope); } /** {@inheritDoc} */ public Object getProperty(String key) { return adapter.getProperty(key); } /** {@inheritDoc} */ public Object removeProperty(String key) { return adapter.removeProperty(key); } /** {@inheritDoc} */ public void setProperty(String key, Object value) { adapter.setProperty(key, value); } /** {@inheritDoc} */ public final String getPayloadAsString() throws Exception { assertAccess(READ); return getPayloadAsString(getEncoding()); } /** {@inheritDoc} */ public byte[] getPayloadAsBytes() throws Exception { assertAccess(READ); if (cache != null) { return cache; } byte[] result = (byte[]) getPayload(byte[].class); if (MuleServer.getMuleContext().getConfiguration().isCacheMessageAsBytes()) { cache = result; } return result; } /** {@inheritDoc} */ public String getPayloadAsString(String encoding) throws Exception { assertAccess(READ); if (cache != null) { return new String(cache, encoding); } String result = (String) getPayload(String.class); if (MuleServer.getMuleContext().getConfiguration().isCacheMessageAsBytes()) { cache = result.getBytes(encoding); } return result; } /** {@inheritDoc} */ public Set getPropertyNames() { return adapter.getPropertyNames(); } //** {@inheritDoc} */ public double getDoubleProperty(String name, double defaultValue) { return adapter.getDoubleProperty(name, defaultValue); } /** {@inheritDoc} */ public void setDoubleProperty(String name, double value) { adapter.setDoubleProperty(name, value); } /** {@inheritDoc} */ public String getUniqueId() { return adapter.getUniqueId(); } /** {@inheritDoc} */ public Object getProperty(String name, Object defaultValue) { return adapter.getProperty(name, defaultValue); } /** {@inheritDoc} */ public int getIntProperty(String name, int defaultValue) { return adapter.getIntProperty(name, defaultValue); } /** {@inheritDoc} */ public long getLongProperty(String name, long defaultValue) { return adapter.getLongProperty(name, defaultValue); } /** {@inheritDoc} */ public boolean getBooleanProperty(String name, boolean defaultValue) { return adapter.getBooleanProperty(name, defaultValue); } /** {@inheritDoc} */ public void setBooleanProperty(String name, boolean value) { adapter.setBooleanProperty(name, value); } /** {@inheritDoc} */ public void setIntProperty(String name, int value) { adapter.setIntProperty(name, value); } /** {@inheritDoc} */ public void setLongProperty(String name, long value) { adapter.setLongProperty(name, value); } /** {@inheritDoc} */ public void setCorrelationId(String id) { adapter.setCorrelationId(id); } /** {@inheritDoc} */ public String getCorrelationId() { return adapter.getCorrelationId(); } /** {@inheritDoc} */ public void setReplyTo(Object replyTo) { adapter.setReplyTo(replyTo); } /** {@inheritDoc} */ public Object getReplyTo() { return adapter.getReplyTo(); } /** {@inheritDoc} */ public int getCorrelationSequence() { return adapter.getCorrelationSequence(); } /** {@inheritDoc} */ public void setCorrelationSequence(int sequence) { adapter.setCorrelationSequence(sequence); } /** {@inheritDoc} */ public int getCorrelationGroupSize() { return adapter.getCorrelationGroupSize(); } //** {@inheritDoc} */ public void setCorrelationGroupSize(int size) { adapter.setCorrelationGroupSize(size); } /** {@inheritDoc} */ public ExceptionPayload getExceptionPayload() { return adapter.getExceptionPayload(); } /** {@inheritDoc} */ public void setExceptionPayload(ExceptionPayload exceptionPayload) { adapter.setExceptionPayload(exceptionPayload); } /** {@inheritDoc} */ public String toString() { return adapter.toString(); } /** {@inheritDoc} */ public void addAttachment(String name, DataHandler dataHandler) throws Exception { adapter.addAttachment(name, dataHandler); } /** {@inheritDoc} */ public void removeAttachment(String name) throws Exception { adapter.removeAttachment(name); } /** {@inheritDoc} */ public DataHandler getAttachment(String name) { return adapter.getAttachment(name); } /** {@inheritDoc} */ public Set getAttachmentNames() { return adapter.getAttachmentNames(); } /** {@inheritDoc} */ public String getEncoding() { return adapter.getEncoding(); } /** {@inheritDoc} */ public void setEncoding(String encoding) { adapter.setEncoding(encoding); } /** {@inheritDoc} */ public String getStringProperty(String name, String defaultValue) { return adapter.getStringProperty(name, defaultValue); } /** {@inheritDoc} */ public void setStringProperty(String name, String value) { adapter.setStringProperty(name, value); } /** {@inheritDoc} */ public void addProperties(Map properties) { adapter.addProperties(properties); } /** {@inheritDoc} */ public void addProperties(Map properties, PropertyScope scope) { adapter.addProperties(properties, scope); } /** {@inheritDoc} */ public void clearProperties() { adapter.clearProperties(); } /** {@inheritDoc} */ public Object getPayload() { return adapter.getPayload(); } /** {@inheritDoc} */ public synchronized void setPayload(Object payload) { //TODO we may want to enforce stricter rules here, rather than silently wrapping the existing adapter if (!(adapter instanceof MutableMessageAdapter)) { adapter = new DefaultMessageAdapter(payload, adapter); } else { ((MutableMessageAdapter) adapter).setPayload(payload); } cache = null; } /** {@inheritDoc} */ public void release() { adapter.release(); if (originalAdapter != null) { originalAdapter.release(); } cache = null; appliedTransformerHashCodes.clear(); } /** {@inheritDoc} */ public void applyTransformers(List transformers) throws TransformerException { applyTransformers(transformers, null); } public void applyTransformers(List transformers, Class outputType) throws TransformerException { if (transformers.size() > 0 && !appliedTransformerHashCodes.contains(new Integer(transformers.hashCode()))) { applyAllTransformers(transformers); appliedTransformerHashCodes.add(new Integer(transformers.hashCode())); } if (null != outputType && !getPayload().getClass().isAssignableFrom(outputType)) { setPayload(getPayload(outputType)); } } protected void applyAllTransformers(List transformers) throws TransformerException { if (transformers.size() > 0) { Iterator iterator = transformers.iterator(); while (iterator.hasNext()) { Transformer transformer = (Transformer) iterator.next(); if (getPayload() == null) { if (transformer.isAcceptNull()) { setPayload(NullPayload.getInstance()); } else { if (logger.isDebugEnabled()) { logger.debug("Transformer " + transformer + " doesn't support the null payload, exiting from transformer chain."); } break; } } Class srcCls = getPayload().getClass(); if (transformer.isSourceTypeSupported(srcCls)) { Object result = transformer.transform(this); if (originalAdapter == null && MuleServer.getMuleContext().getConfiguration().isCacheMessageOriginalPayload()) { originalAdapter = adapter; } //TODO RM*: Must make sure this works for all scenarios if (result instanceof MuleMessage) { synchronized (this) { adapter = ((MuleMessage) result).getAdapter(); } } else { setPayload(result); } } else { if (logger.isDebugEnabled()) { logger.debug("Transformer " + transformer + " doesn't support the source payload: " + srcCls); } if (!transformer.isIgnoreBadInput()) { if (logger.isDebugEnabled()) { logger.debug("Exiting from transformer chain (ignoreBadInput = false)"); } break; } } } } } //////////////////////////////// ThreadSafeAccess Impl /////////////////////////////// /** {@inheritDoc} */ public ThreadSafeAccess newThreadCopy() { if (adapter instanceof ThreadSafeAccess) { logger.debug("new copy of message for " + Thread.currentThread()); return new DefaultMuleMessage(((ThreadSafeAccess) adapter).newThreadCopy(), this); } else { // not much we can do here - streaming will have to handle things itself return this; } } /** {@inheritDoc} */ public void resetAccessControl() { if (adapter instanceof AbstractMessageAdapter) { ((AbstractMessageAdapter) adapter).resetAccessControl(); } if (originalAdapter instanceof AbstractMessageAdapter) { ((AbstractMessageAdapter) originalAdapter).resetAccessControl(); } } /** {@inheritDoc} */ public void assertAccess(boolean write) { if (adapter instanceof AbstractMessageAdapter) { ((AbstractMessageAdapter) adapter).assertAccess(write); } } } mule-2.0.1/core/src/main/java/org/mule/VoidResult.java0000644000175000017500000000251610745677442022404 0ustar charlescharles/* * $Id: VoidResult.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import java.io.ObjectStreamException; import java.io.Serializable; // @Immutable public final class VoidResult implements Serializable { /** * Serial version */ private static final long serialVersionUID = -3828573682818093673L; private static class VoidResultHolder { private static final VoidResult instance = new VoidResult(); } public static VoidResult getInstance() { return VoidResultHolder.instance; } private VoidResult() { super(); } private Object readResolve() throws ObjectStreamException { return VoidResultHolder.instance; } // @Override public boolean equals(Object obj) { return obj instanceof VoidResult; } // @Override public int hashCode () { return 0; } // @Override public String toString() { return "{VoidResult}"; } } mule-2.0.1/core/src/main/java/org/mule/routing/0000755000175000017500000000000011351411111021071 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/routing/package.html0000644000175000017500000000037710204257011023364 0ustar charlescharles Defines the core routing patterns supported by mule. This package contains inbound/outbound routers as described in the
    Enterprise Integration Patterns book and filters. mule-2.0.1/core/src/main/java/org/mule/routing/response/0000755000175000017500000000000011351411110022726 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/routing/response/DefaultResponseRouterCollection.java0000644000175000017500000001423310774254333032140 0ustar charlescharles/* * $Id: DefaultResponseRouterCollection.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.response; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.InvalidEndpointTypeException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.routing.ResponseRouter; import org.mule.api.routing.ResponseRouterCollection; import org.mule.api.routing.Router; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.CoreMessages; import org.mule.management.stats.RouterStatistics; import org.mule.routing.AbstractRouterCollection; import java.util.Iterator; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; /** * DefaultResponseRouterCollection is a router that can be used to control how * the response in a request/response message flow is created. Main usecase is to * aggregate a set of asynchonous events into a single response */ public class DefaultResponseRouterCollection extends AbstractRouterCollection implements ResponseRouterCollection { private volatile List endpoints = new CopyOnWriteArrayList(); private volatile int timeout = -1; // undefined private volatile boolean failOnTimeout = true; public DefaultResponseRouterCollection() { super(RouterStatistics.TYPE_RESPONSE); } public void initialise() throws InitialisationException { if (timeout == -1) // undefined { setTimeout(muleContext.getConfiguration().getDefaultSynchronousEventTimeout()); } super.initialise(); } public void route(MuleEvent event) throws RoutingException { ResponseRouter router; for (Iterator iterator = getRouters().iterator(); iterator.hasNext();) { router = (ResponseRouter) iterator.next(); router.process(event); // Update stats if (getStatistics().isEnabled()) { getStatistics().incrementRoutedMessage(event.getEndpoint()); } } } public MuleMessage getResponse(MuleMessage message) throws RoutingException { MuleMessage result = null; if (routers.size() == 0) { if(logger.isDebugEnabled()) { logger.debug("There are no routers configured on the response router. Returning the current message"); } result = message; } else { ResponseRouter router; for (Iterator iterator = getRouters().iterator(); iterator.hasNext();) { router = (ResponseRouter) iterator.next(); result = router.getResponse(message); } if (result == null) { // Update stats if (getStatistics().isEnabled()) { getStatistics().incrementNoRoutedMessage(); } } } return result; } public void addRouter(Router router) { ((ResponseRouter) router).setTimeout(getTimeout()); ((ResponseRouter) router).setFailOnTimeout(isFailOnTimeout()); routers.add(router); } public ResponseRouter removeRouter(ResponseRouter router) { if (routers.remove(router)) { return router; } else { return null; } } public void addEndpoint(InboundEndpoint endpoint) { if (endpoint != null) { endpoints.add(endpoint); } else { throw new IllegalArgumentException("endpoint = null"); } } public boolean removeEndpoint(InboundEndpoint endpoint) { return endpoints.remove(endpoint); } public List getEndpoints() { return endpoints; } public void setEndpoints(List endpoints) { if (endpoints != null) { this.endpoints.clear(); // Ensure all endpoints are response endpoints // This will go when we start dropping suport for 1.4 and start using 1.5 for (Iterator it = endpoints.iterator(); it.hasNext();) { ImmutableEndpoint endpoint=(ImmutableEndpoint) it.next(); if (!(endpoint instanceof InboundEndpoint)) { throw new InvalidEndpointTypeException(CoreMessages.responseRouterMustUseInboundEndpoints( this, endpoint)); } } this.endpoints.addAll(endpoints); } else { throw new IllegalArgumentException("List of endpoints = null"); } } /** * @param name the Endpoint identifier * @return the Endpoint or null if the endpointUri is not registered * @see org.mule.api.routing.InboundRouterCollection */ public InboundEndpoint getEndpoint(String name) { InboundEndpoint endpointDescriptor; for (Iterator iterator = endpoints.iterator(); iterator.hasNext();) { endpointDescriptor = (InboundEndpoint) iterator.next(); if (endpointDescriptor.getName().equals(name)) { return endpointDescriptor; } } return null; } public int getTimeout() { return timeout; } public void setTimeout(int timeout) { this.timeout = timeout; } public boolean isFailOnTimeout() { return failOnTimeout; } public void setFailOnTimeout(boolean failOnTimeout) { this.failOnTimeout = failOnTimeout; } public boolean hasEndpoints() { return !getEndpoints().isEmpty(); } } mule-2.0.1/core/src/main/java/org/mule/routing/response/SingleResponseRouter.java0000644000175000017500000000167610777661265030001 0ustar charlescharles/* * $Id: SingleResponseRouter.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.response; import org.mule.routing.EventCorrelatorCallback; import org.mule.routing.SingleCorrelatorCallback; /** * Handles single event responses from a replyTo address. If multiple responses will * be received for a single invocation, the {@link ResponseCorrelationAggregator} * should be used. */ public class SingleResponseRouter extends AbstractResponseAggregator { protected EventCorrelatorCallback getCorrelatorCallback() { return new SingleCorrelatorCallback(); } } mule-2.0.1/core/src/main/java/org/mule/routing/response/package.html0000644000175000017500000000023710226613030025216 0ustar charlescharles Response router implementations that enable asynchronous event processing in request /response messaging requests. mule-2.0.1/core/src/main/java/org/mule/routing/response/AbstractResponseRouter.java0000644000175000017500000000464610777661265030323 0ustar charlescharles/* * $Id: AbstractResponseRouter.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.response; import org.mule.api.MuleMessage; import org.mule.api.routing.MessageInfoMapping; import org.mule.api.routing.ResponseRouter; import org.mule.routing.AbstractRouter; import org.mule.routing.MuleMessageInfoMapping; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractResponseRouter is a base class for all Response Routers */ public abstract class AbstractResponseRouter extends AbstractRouter implements ResponseRouter { protected final Log logger = LogFactory.getLog(getClass()); protected MessageInfoMapping messageInfoMapping = new MuleMessageInfoMapping(); public MessageInfoMapping getMessageInfoMapping() { return messageInfoMapping; } public void setMessageInfoMapping(MessageInfoMapping messageInfoMapping) { this.messageInfoMapping = messageInfoMapping; } /** * Extracts a 'Correlation Id' from a reply message. The correlation Id does not * have to be the Message Correlation Id. It can be extracted from the message * payload if desired. * * @param message a received reply message * @return the correlation Id for this message */ protected Object getReplyAggregateIdentifier(MuleMessage message) { return messageInfoMapping.getCorrelationId(message); } /** * Extracts a Group identifier from the current event. When an event is received * with a group identifier not registered with this router, a new group is * created. The id returned here can be a correlationId or some custom * aggregation Id. This implementation uses the Unique Message Id of the * MuleMessage being returned a * * @param message A response messages received on the response router endpoint * @return an aggregation Id for this event */ protected Object getCallResponseAggregateIdentifier(MuleMessage message) { return messageInfoMapping.getMessageId(message); } } mule-2.0.1/core/src/main/java/org/mule/routing/response/ResponseCorrelationAggregator.java0000644000175000017500000000620210776710212031613 0ustar charlescharles/* * $Id: ResponseCorrelationAggregator.java 11531 2008-04-08 15:34:34Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.response; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.routing.RoutingException; import org.mule.routing.inbound.EventGroup; import org.mule.routing.EventCorrelatorCallback; /** * ResponseCorrelationAggregator Correlates one or more events on a * response flow using the Correlation Id to group events. */ public abstract class ResponseCorrelationAggregator extends AbstractResponseAggregator { protected EventCorrelatorCallback getCorrelatorCallback() { return new DefaultEventCorrelatorCallback(); } public class DefaultEventCorrelatorCallback implements EventCorrelatorCallback { /** * This method is invoked if the shouldAggregate method is called and returns * true. Once this method returns an aggregated message, the event group is * removed from the router. * * @param events the event group for this request * @return an aggregated message * @throws org.mule.routing.AggregationException * if the aggregation fails. in this scenario the * whole event group is removed and passed to the exception handler * for this component */ public MuleMessage aggregateEvents(EventGroup events) throws RoutingException { return ResponseCorrelationAggregator.this.aggregateEvents(events); } /** * Determines if the event group is ready to be aggregated. if the group is ready * to be aggregated (this is entirely up to the application. it could be * determined by volume, last modified time or some oher criteria based on the * last event received) * * @param events * @return true if the event group is ready of aggregation */ public boolean shouldAggregateEvents(EventGroup events) { int expected = events.expectedSize(); int current = events.size(); if (expected == -1) { logger.warn("Correlation Group Size not set, but CorrelationAggregator is being used. Message is being forwarded"); return true; } if (logger.isDebugEnabled()) { logger.debug("Correlation size is " + expected + ", current event group size is " + current + " for correlation group " + events.getGroupId()); } return expected == current; } public EventGroup createEventGroup(MuleEvent event, Object id) { return new EventGroup(id, event.getMessage().getCorrelationGroupSize()); } } } mule-2.0.1/core/src/main/java/org/mule/routing/response/AbstractResponseAggregator.java0000644000175000017500000000631110777661265031114 0ustar charlescharles/* * $Id: AbstractResponseAggregator.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.response; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.routing.RoutingException; import org.mule.routing.EventCorrelator; import org.mule.routing.EventCorrelatorCallback; import org.mule.routing.inbound.AbstractEventAggregator; import org.mule.routing.inbound.EventGroup; /** * AbstractResponseAggregator provides a base class for implementing * response aggregator routers. This provides a thread-safe implemenetation and * allows developers to customise how and when events are grouped and collated. * Response Agrregators are used to collect responses that are usually sent to * replyTo endpoints set on outbound routers. When an event is sent out via an * outbound router, the response router will block the response flow on an * Service until the Response Router resolves a reply or times out. */ public abstract class AbstractResponseAggregator extends AbstractResponseRouter { private int timeout = -1; // undefined private boolean failOnTimeout = true; private EventCorrelator eventCorrelator; //@Override public void initialise() throws InitialisationException { if (timeout == -1) // undefined { setTimeout(muleContext.getConfiguration().getDefaultSynchronousEventTimeout()); } eventCorrelator = new EventCorrelator(getCorrelatorCallback(), messageInfoMapping, muleContext); eventCorrelator.setTimeout(getTimeout()); eventCorrelator.setFailOnTimeout(isFailOnTimeout()); super.initialise(); } protected EventCorrelator getEventCorrelator() { return eventCorrelator; } public void process(MuleEvent event) throws RoutingException { eventCorrelator.addEvent(event); } /** * This method is called by the responding callee thread and should return the * aggregated response message * * @param message * @return * @throws RoutingException */ public MuleMessage getResponse(MuleMessage message) throws RoutingException { return eventCorrelator.getResponse(message); } public boolean isFailOnTimeout() { return failOnTimeout; } public void setFailOnTimeout(boolean failOnTimeout) { this.failOnTimeout = failOnTimeout; } public int getTimeout() { return timeout; } public void setTimeout(int timeout) { this.timeout = timeout; } protected abstract EventCorrelatorCallback getCorrelatorCallback(); /** * @see AbstractEventAggregator#aggregateEvents(EventGroup) */ protected MuleMessage aggregateEvents(EventGroup events) throws RoutingException { return null; } } mule-2.0.1/core/src/main/java/org/mule/routing/response/SimpleCollectionResponseAggregator.java0000644000175000017500000000177110777661265032623 0ustar charlescharles/* * $Id: SimpleCollectionResponseAggregator.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.response; import org.mule.routing.CollectionCorrelatorCallback; import org.mule.routing.EventCorrelatorCallback; /** * A simple aggregator that will keep collecting events until a timeout is reached. It will then return * a {@link org.mule.api.MuleMessageCollection} message. * * @see org.mule.api.MuleMessageCollection */ public class SimpleCollectionResponseAggregator extends ResponseCorrelationAggregator { protected EventCorrelatorCallback getCorrelatorCallback() { return new CollectionCorrelatorCallback(); } } mule-2.0.1/core/src/main/java/org/mule/routing/CorrelationPropertiesExpressionEvaluator.java0000644000175000017500000000513410764057561032266 0ustar charlescharles/* * $Id: CorrelationPropertiesExpressionEvaluator.java 11231 2008-03-06 21:17:37Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.api.config.MuleProperties; import org.mule.api.transport.MessageAdapter; import org.mule.util.expression.MessageHeaderExpressionEvaluator; /** * CorrelationPropertiesExpressionEvaluator is a default implementation used for * getting the Correlation information from a message. This object is only used when * getting a specific property to be set on the message. When reading the property * the getProperty(...) or the direct property accessor will be used i.e. * message.getCorrelationId() or * message.getProperty(MuleProperties.MULE_CORRELATION_ID_PROPERTY) */ public class CorrelationPropertiesExpressionEvaluator extends MessageHeaderExpressionEvaluator { public final Object evaluate(String name, Object message) { Object result; MessageAdapter msg = null; if (message instanceof MessageAdapter) { msg = (MessageAdapter) message; } if (msg != null) { if (MuleProperties.MULE_CORRELATION_ID_PROPERTY.equals(name)) { result = getCorrelationId(msg); } else if (MuleProperties.MULE_MESSAGE_ID_PROPERTY.equals(name)) { result = getMessageId(msg); } else { throw new IllegalArgumentException("Property name: " + name + " not recognised by the Correlation Property Extractor"); } if (result == null) { throw new IllegalArgumentException( "Property Extractor cannot return a null value. Extractor is: " + getClass().getName()); } } else { return super.evaluate(name, message); } return result; } public String getMessageId(MessageAdapter message) { return message.getUniqueId(); } public String getCorrelationId(MessageAdapter message) { String id = message.getCorrelationId(); if (id == null) { id = message.getUniqueId(); } return id; } } mule-2.0.1/core/src/main/java/org/mule/routing/SingleCorrelatorCallback.java0000644000175000017500000000516310777661265026670 0ustar charlescharles/* * $Id: SingleCorrelatorCallback.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.routing.RoutingException; import org.mule.routing.inbound.EventGroup; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A Correlator that correlates one message at a time */ public class SingleCorrelatorCallback implements EventCorrelatorCallback { /** * logger used by this class */ protected transient final Log logger = LogFactory.getLog(CollectionCorrelatorCallback.class); /** * The SingleResponseRouter will return true if the event group * size is 1. If the group size is greater than 1, a warning will be logged. * * @param events * @return true if the event group size is 1 or greater * @see {@link org.mule.routing.response.AbstractResponseAggregator#shouldAggregateEvents(EventGroup)} */ public boolean shouldAggregateEvents(EventGroup events) { if (events.expectedSize() > 1) { logger.warn("CorrelationGroup's expected size is not 1." + " The SingleResponseAggregator will only handle single replyTo events;" + " if there will be multiple events for a single request, " + " use the 'ResponseCorrelationAggregator'"); } return (events.size() != 0); } /** * The SingleResponseRouter will always return the first event of * an event group. * * @param events the event group for this request * @return an aggregated message * @throws org.mule.api.routing.RoutingException * if the aggregation fails. in * this scenario the whole event group is removed and passed to the * exception handler for this componenet * @see {@link org.mule.routing.response.AbstractResponseAggregator#aggregateEvents(EventGroup)} */ public MuleMessage aggregateEvents(EventGroup events) throws RoutingException { return ((MuleEvent) events.iterator().next()).getMessage(); } public EventGroup createEventGroup(MuleEvent event, Object id) { return new EventGroup(id); } }mule-2.0.1/core/src/main/java/org/mule/routing/LoggingCatchAllStrategy.java0000644000175000017500000000352710757615756026506 0ustar charlescharles/* * $Id: LoggingCatchAllStrategy.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.DefaultMuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.RoutingException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * LoggingCatchAllStrategy is a simple strategy that only logs any * events not caught by the router associated with this strategy. This should not * be used in production unless it is acceptible for events to be disposing. */ public class LoggingCatchAllStrategy extends AbstractCatchAllStrategy { private static final Log logger = LogFactory.getLog(DefaultMuleEvent.class); public void setEndpoint(OutboundEndpoint endpoint) { throw new UnsupportedOperationException("An endpoint cannot be set on this Catch All strategy"); } public void setEndpoint(String endpoint) { throw new UnsupportedOperationException("An endpoint cannot be set on this Catch All strategy"); } public OutboundEndpoint getEndpoint() { return null; } public MuleMessage catchMessage(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { logger.warn("Message: " + message + " was not dispatched on session: " + session + ". No routing path was defined for it."); return null; } } mule-2.0.1/core/src/main/java/org/mule/routing/CollectionCorrelatorCallback.java0000644000175000017500000000577010777661265027546 0ustar charlescharles/* * $Id: CollectionCorrelatorCallback.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.DefaultMessageCollection; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleMessageCollection; import org.mule.routing.inbound.EventGroup; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A Correlator that correlates messages based on Mule correlation settings */ public class CollectionCorrelatorCallback implements EventCorrelatorCallback { /** * logger used by this class */ protected transient final Log logger = LogFactory.getLog(CollectionCorrelatorCallback.class); /** * This method is invoked if the shouldAggregate method is called and returns * true. Once this method returns an aggregated message, the event group is * removed from the router. * * @param events the event group for this request * @return an aggregated message * @throws org.mule.routing.AggregationException * if the aggregation fails. in this scenario the * whole event group is removed and passed to the exception handler * for this componenet */ public MuleMessage aggregateEvents(EventGroup events) throws AggregationException { MuleMessageCollection message = new DefaultMessageCollection(); message.addMessages(events.toArray()); return message; } /** * Creates a new EventGroup that will expect the number of events as returned by * {@link org.mule.api.transport.MessageAdapter#getCorrelationGroupSize()}. */ // //@Override public EventGroup createEventGroup(MuleEvent event, Object groupId) { return new EventGroup(groupId, event.getMessage().getCorrelationGroupSize()); } /** * @return true if the correlation size is not set or exactly the * expected size of the event group. * @see org.mule.routing.inbound.AbstractEventAggregator#shouldAggregateEvents(EventGroup) */ public boolean shouldAggregateEvents(EventGroup events) { int size = events.expectedSize(); if (size == -1) { logger.warn("Correlation Group Size not set, but CorrelationAggregator is being used." + " Message is being forwarded"); return true; } if (logger.isDebugEnabled()) { logger.debug("Correlation size is " + size + ". Current event group size is " + events.size() + " for correlation " + events.getGroupId()); } return size == events.size(); } } mule-2.0.1/core/src/main/java/org/mule/routing/AbstractRouterCollection.java0000644000175000017500000000714010774254333026741 0ustar charlescharles/* * $Id: AbstractRouterCollection.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextAware; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.LifecycleTransitionResult; import org.mule.api.routing.Router; import org.mule.api.routing.RouterCatchAllStrategy; import org.mule.api.routing.RouterCollection; import org.mule.management.stats.RouterStatistics; import java.util.Iterator; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractRouterCollection provides common method implementations of * router collections for in and outbound routers. */ public abstract class AbstractRouterCollection implements RouterCollection, Initialisable, MuleContextAware { /** * logger used by this class */ protected final transient Log logger = LogFactory.getLog(getClass()); protected boolean matchAll = false; protected List routers = new CopyOnWriteArrayList(); private RouterStatistics statistics; private RouterCatchAllStrategy catchAllStrategy; protected MuleContext muleContext; public AbstractRouterCollection(int type) { statistics = new RouterStatistics(type); } public void initialise() throws InitialisationException { LifecycleTransitionResult.initialiseAll(routers.iterator()); } public void dispose() { for (Iterator iterator = routers.iterator(); iterator.hasNext();) { Router router = (Router) iterator.next(); router.dispose(); } } public void setRouters(List routers) { for (Iterator iterator = routers.iterator(); iterator.hasNext();) { addRouter((Router) iterator.next()); } } public void addRouter(Router router) { router.setRouterStatistics(getStatistics()); routers.add(router); } public Router removeRouter(Router router) { if (routers.remove(router)) { return router; } else { return null; } } public List getRouters() { return routers; } public RouterCatchAllStrategy getCatchAllStrategy() { return catchAllStrategy; } public void setCatchAllStrategy(RouterCatchAllStrategy catchAllStrategy) { this.catchAllStrategy = catchAllStrategy; if (this.catchAllStrategy != null && catchAllStrategy instanceof AbstractCatchAllStrategy) { ((AbstractCatchAllStrategy) this.catchAllStrategy).setStatistics(statistics); } } public boolean isMatchAll() { return matchAll; } public void setMatchAll(boolean matchAll) { this.matchAll = matchAll; } public RouterStatistics getStatistics() { return statistics; } public void setStatistics(RouterStatistics stat) { this.statistics = stat; } public void setMuleContext(MuleContext context) { this.muleContext = context; } } mule-2.0.1/core/src/main/java/org/mule/routing/AggregationException.java0000644000175000017500000000402010745677442026071 0ustar charlescharles/* * $Id: AggregationException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.DefaultMuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.Message; import org.mule.routing.inbound.EventGroup; import org.mule.transport.NullPayload; /** * TODO document * */ public class AggregationException extends RoutingException { /** * Serial version */ private static final long serialVersionUID = 1276049971165761454L; private EventGroup eventGroup = null; public AggregationException(EventGroup eventGroup, ImmutableEndpoint endpoint) { super(new DefaultMuleMessage(NullPayload.getInstance()), endpoint); this.eventGroup = eventGroup; } public AggregationException(EventGroup eventGroup, ImmutableEndpoint endpoint, Throwable cause) { super(new DefaultMuleMessage(NullPayload.getInstance()), endpoint, cause); this.eventGroup = eventGroup; } public AggregationException(Message message, EventGroup eventGroup, ImmutableEndpoint endpoint) { super(message, new DefaultMuleMessage(NullPayload.getInstance()), endpoint); this.eventGroup = eventGroup; } public AggregationException(Message message, EventGroup eventGroup, ImmutableEndpoint endpoint, Throwable cause) { super(message, new DefaultMuleMessage(NullPayload.getInstance()), endpoint, cause); this.eventGroup = eventGroup; } public EventGroup getEventGroup() { return eventGroup; } } mule-2.0.1/core/src/main/java/org/mule/routing/AbstractRouter.java0000644000175000017500000000313110774254333024721 0ustar charlescharles/* * $Id: AbstractRouter.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextAware; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.routing.Router; import org.mule.management.stats.RouterStatistics; /** * Implements the shared methods that all routers have. The implementations of the different * router types can vary depending on their usage pattern. The types of router are inbound, outbound * response and nested. */ public abstract class AbstractRouter implements Router, MuleContextAware { private RouterStatistics routerStatistics; protected MuleContext muleContext; public void initialise() throws InitialisationException { // default impl does nothing } public void dispose() { // Template } public void setMuleContext(MuleContext context) { this.muleContext = context; } public MuleContext getMuleContext() { return muleContext; } public void setRouterStatistics(RouterStatistics stats) { this.routerStatistics = stats; } public RouterStatistics getRouterStatistics() { return routerStatistics; } } mule-2.0.1/core/src/main/java/org/mule/routing/EventCorrelatorCallback.java0000644000175000017500000000420710776710212026510 0ustar charlescharles/* * $Id: EventCorrelatorCallback.java 11531 2008-04-08 15:34:34Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.routing.inbound.EventGroup; import org.mule.api.MuleMessage; import org.mule.api.MuleEvent; import org.mule.api.routing.RoutingException; /** * A callback used to allow pluggable behaviour when correlating events */ public interface EventCorrelatorCallback { /** * Determines if the event group is ready to be aggregated. if the group is ready * to be aggregated (this is entirely up to the application. it could be * determined by volume, last modified time or some oher criteria based on the * last event received). * * @param events The current event group received by the correlator * @return true if the group is ready for aggregation */ public boolean shouldAggregateEvents(EventGroup events); /** * This method is invoked if the shouldAggregate method is called and returns * true. Once this method returns an aggregated message, the event group is * removed from the router. * * @param events the event group for this request * @return an aggregated message * @throws AggregationException if the aggregation fails. in this scenario the * whole event group is removed and passed to the exception handler * for this component */ public MuleMessage aggregateEvents(EventGroup events) throws RoutingException; /** * Creates the event group with a specific correlation size based on the Mule * Correlation support * * @param id The group id * @param event the current event * @return a new event group of a fixed size */ public EventGroup createEventGroup(MuleEvent event, Object id); } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/0000755000175000017500000000000011351411107022534 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/routing/inbound/CorrelationAggregator.java0000644000175000017500000000260210777661265027712 0ustar charlescharles/* * $Id: CorrelationAggregator.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.api.MuleMessage; import org.mule.routing.AggregationException; import org.mule.routing.CollectionCorrelatorCallback; import org.mule.routing.EventCorrelatorCallback; /** * CorrelationAggregator uses the CorrelationID and * CorrelationGroupSize properties of the {@link org.mule.api.MuleMessage} to manage * message groups. */ public abstract class CorrelationAggregator extends AbstractEventAggregator { protected EventCorrelatorCallback getCorrelatorCallback() { return new DelegateCorrelatorCallback(); } protected abstract MuleMessage aggregateEvents(EventGroup events) throws AggregationException; private class DelegateCorrelatorCallback extends CollectionCorrelatorCallback { public MuleMessage aggregateEvents(EventGroup events) throws AggregationException { return CorrelationAggregator.this.aggregateEvents(events); } } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/package.html0000644000175000017500000000025410204257011025014 0ustar charlescharles Inbound router implementation as described in the Enterprise Integration Patterns book. mule-2.0.1/core/src/main/java/org/mule/routing/inbound/IdempotentReceiver.java0000644000175000017500000001200010746275214027203 0ustar charlescharles/* * $Id: IdempotentReceiver.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import org.mule.api.routing.IdempotentMessageIdStore; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.CoreMessages; /** * IdempotentReceiver ensures that only unique messages are received by a * service. It does this by checking the unique ID of the incoming message. Note that * the underlying endpoint must support unique message IDs for this to work, otherwise a * UniqueIdNotSupportedException is thrown.
    * By default this implementation uses an instance of * {@link IdempotentInMemoryMessageIdStore}. */ public class IdempotentReceiver extends SelectiveConsumer { protected volatile IdempotentMessageIdStore idStore; protected volatile String assignedComponentName; // The maximum number of messages to keep in the store; exact interpretation of this // limit is up to the store implementation. By default the store is unbounded. protected volatile int maxMessages = -1; // The number of seconds each message ID is kept in the store; // by default each entry is kept for 5 minutes protected volatile int messageTTL = (60 * 5); // The number of seconds between expiration intervals; // by default we expire every minute protected volatile int expirationInterval = 60; public IdempotentReceiver() { super(); } public int getMaxMessages() { return maxMessages; } public void setMaxMessages(int maxMessages) { this.maxMessages = maxMessages; } public int getMessageTTL() { return messageTTL; } public void setMessageTTL(int messageTTL) { this.messageTTL = messageTTL; } public int getExpirationInterval() { return expirationInterval; } public void setExpirationInterval(int expirationInterval) { if (expirationInterval <= 0) { throw new IllegalArgumentException(CoreMessages.propertyHasInvalidValue("expirationInterval", new Integer(expirationInterval)).toString()); } this.expirationInterval = expirationInterval; } protected void initialize(MuleEvent event) throws RoutingException { if (assignedComponentName == null && idStore == null) { this.assignedComponentName = event.getService().getName(); this.idStore = this.createMessageIdStore(); } } protected IdempotentMessageIdStore createMessageIdStore() { return new IdempotentInMemoryMessageIdStore(assignedComponentName, maxMessages, messageTTL, expirationInterval); } // @Override public boolean isMatch(MuleEvent event) throws MessagingException { if (idStore == null) { // we need to load this on the first request as we need the service name synchronized (this) { this.initialize(event); } } try { return !idStore.containsId(this.getIdForEvent(event)); } catch (Exception ex) { throw new RoutingException(event.getMessage(), event.getEndpoint(), ex); } } // @Override public MuleEvent[] process(MuleEvent event) throws MessagingException { String eventComponentName = event.getService().getName(); if (!assignedComponentName.equals(eventComponentName)) { IllegalArgumentException iex = new IllegalArgumentException( "This receiver is assigned to service: " + assignedComponentName + " but has received an event for service: " + eventComponentName + ". Please check your config to make sure each service" + "has its own instance of IdempotentReceiver."); throw new RoutingException(event.getMessage(), event.getEndpoint(), iex); } Object id = this.getIdForEvent(event); try { if (idStore.storeId(id)) { return new MuleEvent[]{event}; } else { return null; } } catch (Exception e) { throw new RoutingException(CoreMessages.failedToWriteMessageToStore(id, assignedComponentName), event.getMessage(), event.getEndpoint(), e); } } protected Object getIdForEvent(MuleEvent event) throws MessagingException { return event.getMessage().getUniqueId(); } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/SimpleCollectionAggregator.java0000644000175000017500000000202610777661265030676 0ustar charlescharles/* * $Id: SimpleCollectionAggregator.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.routing.CollectionCorrelatorCallback; import org.mule.routing.EventCorrelatorCallback; /** * This router will return all aggregated events as a {@link org.mule.api.MuleMessageCollection}. * This allows the service itself to act upon the events rather that the user having to write a cusotm * aggregator. This may feel more natural for some users. */ public class SimpleCollectionAggregator extends AbstractEventAggregator { protected EventCorrelatorCallback getCorrelatorCallback() { return new CollectionCorrelatorCallback(); } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/DefaultInboundRouterCollection.java0000644000175000017500000002263310774254333031543 0ustar charlescharles/* * $Id: DefaultInboundRouterCollection.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.InvalidEndpointTypeException; import org.mule.api.routing.InboundRouter; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.CoreMessages; import org.mule.management.stats.RouterStatistics; import org.mule.routing.AbstractRouterCollection; import org.mule.util.StringMessageUtils; import org.mule.util.StringUtils; import java.util.Iterator; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; /** * DefaultInboundRouterCollection is a collection of routers that will be * invoked when an event is received. It is responsible for managing a collection of * routers and also executing the routing logic. Each router must match against the * current event for the event to be routed. */ public class DefaultInboundRouterCollection extends AbstractRouterCollection implements InboundRouterCollection { private final List endpoints = new CopyOnWriteArrayList(); public DefaultInboundRouterCollection() { super(RouterStatistics.TYPE_INBOUND); } public MuleMessage route(MuleEvent event) throws MessagingException { // If the endpoint has a logical name, use it, otherwise use the URI. String inboundEndpoint = // Endpoint identifier (deprecated) event.getEndpoint().getEndpointURI().getEndpointName(); if (StringUtils.isBlank(inboundEndpoint)) { // Global endpoint inboundEndpoint = event.getEndpoint().getName(); } if (StringUtils.isBlank(inboundEndpoint)) { // URI inboundEndpoint = event.getEndpoint().getEndpointURI().getUri().toString(); } event.getMessage().setProperty(MuleProperties.MULE_ORIGINATING_ENDPOINT_PROPERTY, inboundEndpoint); if (endpoints.size() > 0 && routers.size() == 0) { addRouter(new InboundPassThroughRouter()); } String componentName = event.getSession().getService().getName(); MuleEvent[] eventsToRoute = null; boolean noRoute = true; boolean match = false; InboundRouter umoInboundRouter; for (Iterator iterator = getRouters().iterator(); iterator.hasNext();) { umoInboundRouter = (InboundRouter) iterator.next(); if (umoInboundRouter.isMatch(event)) { match = true; eventsToRoute = umoInboundRouter.process(event); noRoute = (eventsToRoute == null); if (!matchAll) { break; } } } // If the stopFurtherProcessing flag has been set // do not route events to the service. // This is the case when using a ForwardingConsumer // inbound router for example. if (!event.isStopFurtherProcessing()) { if (noRoute) { // Update stats if (getStatistics().isEnabled()) { getStatistics().incrementNoRoutedMessage(); } if (!match) { if (getCatchAllStrategy() != null) { if (logger.isDebugEnabled()) { logger.debug("Message did not match any routers on: " + componentName + " - invoking catch all strategy"); } if (getStatistics().isEnabled()) { getStatistics().incrementCaughtMessage(); } return getCatchAllStrategy().catchMessage(event.getMessage(), event.getSession(), event.isSynchronous()); } else { logger.warn("Message did not match any routers on: " + componentName + " and there is no catch all strategy configured on this router. Disposing message: " + event); if (logger.isDebugEnabled()) { try { logger.warn("Message fragment is: " + StringMessageUtils.truncate(event.getMessageAsString(), 100, true)); } catch (MuleException e) { // ignore } } } } } else { try { MuleMessage messageResult = null; for (int i = 0; i < eventsToRoute.length; i++) { // Set the originating endpoint so we'll know where this event came from further down the pipeline. if (event.getMessage().getProperty(MuleProperties.MULE_ORIGINATING_ENDPOINT_PROPERTY) == null) { event.getMessage().setProperty(MuleProperties.MULE_ORIGINATING_ENDPOINT_PROPERTY, inboundEndpoint); } if (event.isSynchronous()) { messageResult = send(eventsToRoute[i]); } else { dispatch(eventsToRoute[i]); } // Update stats if (getStatistics().isEnabled()) { getStatistics().incrementRoutedMessage(eventsToRoute[i].getEndpoint()); } } return messageResult; } catch (MuleException e) { throw new RoutingException(event.getMessage(), event.getEndpoint(), e); } } } return (eventsToRoute != null && eventsToRoute.length > 0 ? eventsToRoute[eventsToRoute.length - 1].getMessage() : null); } public void dispatch(MuleEvent event) throws MuleException { event.getSession().dispatchEvent(event); } public MuleMessage send(MuleEvent event) throws MuleException { return event.getSession().sendEvent(event); } public void addRouter(InboundRouter router) { routers.add(router); } public InboundRouter removeRouter(InboundRouter router) { if (routers.remove(router)) { return router; } else { return null; } } public void addEndpoint(InboundEndpoint endpoint) { endpoints.add(endpoint); } public boolean removeEndpoint(InboundEndpoint endpoint) { return endpoints.remove(endpoint); } public List getEndpoints() { return endpoints; } public void setEndpoints(List endpoints) { if (endpoints != null) { this.endpoints.clear(); // Ensure all endpoints are response endpoints // This will go when we start dropping suport for 1.4 and start using 1.5 for (Iterator it = endpoints.iterator(); it.hasNext();) { ImmutableEndpoint endpoint = (ImmutableEndpoint) it.next(); if (!(endpoint instanceof InboundEndpoint)) { throw new InvalidEndpointTypeException(CoreMessages.inboundRouterMustUseInboundEndpoints(this, endpoint)); } } this.endpoints.addAll(endpoints); } else { throw new IllegalArgumentException("List of endpoints = null"); } } /** * @param name the Endpoint identifier * @return the Endpoint or null if the endpointUri is not registered * @see org.mule.api.routing.InboundRouterCollection */ public InboundEndpoint getEndpoint(String name) { InboundEndpoint endpointDescriptor; for (Iterator iterator = endpoints.iterator(); iterator.hasNext();) { endpointDescriptor = (InboundEndpoint) iterator.next(); if (endpointDescriptor.getName().equals(name)) { return endpointDescriptor; } } return null; } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/EventGroup.java0000644000175000017500000001727110776710212025516 0ustar charlescharles/* * $Id: EventGroup.java 11531 2008-04-08 15:34:34Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.api.MuleEvent; import org.mule.api.MuleMessageCollection; import org.mule.util.ClassUtils; import org.mule.DefaultMessageCollection; import java.io.Serializable; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.helpers.Utils; import org.apache.commons.collections.IteratorUtils; /** * EventGroup is a holder over events grouped by a common group Id. * This can be used by components such as routers to managed related events. */ // @ThreadSafe public class EventGroup implements Comparable, Serializable { /** * Serial version */ private static final long serialVersionUID = 953739659615692697L; public static final MuleEvent[] EMPTY_EVENTS_ARRAY = new MuleEvent[0]; private final Object groupId; // @GuardedBy("this") private final List events; private final long created; private final int expectedSize; public EventGroup(Object groupId) { this(groupId, -1); } public EventGroup(Object groupId, int expectedSize) { super(); this.created = Utils.nanoTime(); this.events = new ArrayList(expectedSize > 0 ? expectedSize : 10); this.expectedSize = expectedSize; this.groupId = groupId; } /** * Compare this EventGroup to another one. If the receiver and the argument both * have groupIds that are {@link Comparable}, they are used for the comparison; * otherwise - since the id can be any object - the group creation time stamp is * used as fallback. Older groups are considered "smaller". * * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo(Object o) { EventGroup other = (EventGroup) o; Object otherId = other.getGroupId(); if (groupId instanceof Comparable && otherId instanceof Comparable) { return ((Comparable) groupId).compareTo(otherId); } else { long diff = created - other.getCreated(); return (diff > 0 ? 1 : (diff < 0 ? -1 : 0)); } } /** * Compares two EventGroups for equality. EventGroups are considered equal when * their groupIds (as returned by {@link #getGroupId()}) are equal. * * @see java.lang.Object#equals(Object) */ // //@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof EventGroup)) { return false; } final EventGroup other = (EventGroup) obj; if (groupId == null) { return (other.groupId == null); } return groupId.equals(other.groupId); } /** * The hashCode of an EventGroup is derived from the object returned by * {@link #getGroupId()}. * * @see java.lang.Object#hashCode() */ // //@Override public int hashCode() { return groupId.hashCode(); } /** * Returns an identifier for this EventGroup. It is recommended that this id is * unique and {@link Comparable} e.g. a UUID. * * @return the id of this event group */ public Object getGroupId() { return groupId; } /** * Returns an iterator over a snapshot copy of this group's collected events. If * you need to iterate over the group and e.g. remove select events, do so via * {@link #removeEvent(MuleEvent)}. If you need to do so atomically in order to * prevent e.g. concurrent reception/aggregation of the group during iteration, * wrap the iteration in a synchronized block on the group instance. * * @return an iterator over collected {@link MuleEvent}s. */ public Iterator iterator() { synchronized (this) { if (events.isEmpty()) { return IteratorUtils.emptyIterator(); } else { return IteratorUtils.arrayIterator(this.toArray()); } } } /** * Returns a snapshot of collected events in this group. * * @return an array of collected {@link MuleEvent}s. */ public MuleEvent[] toArray() { synchronized (this) { if (events.isEmpty()) { return EMPTY_EVENTS_ARRAY; } return (MuleEvent[]) events.toArray(EMPTY_EVENTS_ARRAY); } } /** * Add the given event to this group. * * @param event the event to add */ public void addEvent(MuleEvent event) { synchronized (this) { events.add(event); } } /** * Remove the given event from the group. * * @param event the evnt to remove */ public void removeEvent(MuleEvent event) { synchronized (this) { events.remove(event); } } /** * Return the creation timestamp of the current group. * * @return the timestamp when this group was instantiated. * @see {@link Utils#nanoTime()} */ public long getCreated() { return created; } /** * Returns the number of events collected so far. * * @return number of events in this group or 0 if the group is empty. */ public int size() { synchronized (this) { return events.size(); } } /** * Returns the number of events that this EventGroup is expecting before * correlation can proceed. * * @return expected number of events or -1 if no expected size was specified. */ public int expectedSize() { return expectedSize; } /** * Removes all events from this group. */ public void clear() { synchronized (this) { events.clear(); } } // //@Override public String toString() { StringBuffer buf = new StringBuffer(80); buf.append(ClassUtils.getSimpleName(this.getClass())); buf.append(" {"); buf.append("id=").append(groupId); buf.append(", expected size=").append(expectedSize); synchronized (this) { int currentSize = events.size(); buf.append(", current events=").append(currentSize); if (currentSize > 0) { buf.append(" ["); Iterator i = events.iterator(); while (i.hasNext()) { MuleEvent event = (MuleEvent) i.next(); buf.append(event.getMessage().getUniqueId()); if (i.hasNext()) { buf.append(", "); } } buf.append(']'); } } buf.append('}'); return buf.toString(); } public MuleMessageCollection toMessageCollection() { MuleMessageCollection col = new DefaultMessageCollection(); for (Iterator iterator = events.iterator(); iterator.hasNext();) { MuleEvent event = (MuleEvent) iterator.next(); col.addMessage(event.getMessage()); } return col; } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/AbstractEventResequencer.java0000644000175000017500000001421310745677442030375 0ustar charlescharles/* * $Id: AbstractEventResequencer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import java.util.Arrays; import java.util.Comparator; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentMap; /** * AbstractEventResequencer is used to receive a set of events, * resequence them and forward them on to their destination */ // TODO MULE-841: much of the code here (like the spinloop) is *exactly* the same as in // AbstractEventAggregator, obviously we should unify this public abstract class AbstractEventResequencer extends SelectiveConsumer { protected static final String NO_CORRELATION_ID = "no-id"; private final ConcurrentMap eventGroups = new ConcurrentHashMap(); private volatile Comparator comparator; public AbstractEventResequencer() { super(); } public Comparator getComparator() { return comparator; } public void setComparator(Comparator eventComparator) { this.comparator = eventComparator; } // //@Override public MuleEvent[] process(MuleEvent event) throws MessagingException { MuleEvent[] result = null; if (this.isMatch(event)) { // indicates interleaved EventGroup removal (very rare) boolean miss = false; // match event to its group final Object groupId = this.getEventGroupIdForEvent(event); // spinloop for the EventGroup lookup while (true) { if (miss) { try { // recommended over Thread.yield() Thread.sleep(1); } catch (InterruptedException interrupted) { Thread.currentThread().interrupt(); } } // check for an existing group first EventGroup group = this.getEventGroup(groupId); // does the group exist? if (group == null) { // ..apparently not, so create a new one & add it group = this.addEventGroup(this.createEventGroup(event, groupId)); } // ensure that only one thread at a time evaluates this EventGroup synchronized (group) { // make sure no other thread removed the group in the meantime if (group != this.getEventGroup(groupId)) { // if that is the (rare) case, spin miss = true; continue; } // add the incoming event to the group group.addEvent(event); if (this.shouldResequenceEvents(group)) { result = this.resequenceEvents(group); this.removeEventGroup(group); } // result or not: exit spinloop break; } } } return result; } /** * @see AbstractEventAggregator#createEventGroup(MuleEvent, Object) */ protected EventGroup createEventGroup(MuleEvent event, Object groupId) { return new EventGroup(groupId); } /** * @see AbstractEventAggregator#getEventGroupIdForEvent(MuleEvent) */ protected Object getEventGroupIdForEvent(MuleEvent event) { String groupId = event.getMessage().getCorrelationId(); if (groupId == null) { groupId = NO_CORRELATION_ID; } return groupId; } /** * @see AbstractEventAggregator#getEventGroup(Object) */ protected EventGroup getEventGroup(Object groupId) { return (EventGroup) eventGroups.get(groupId); } /** * @see AbstractEventAggregator#addEventGroup(EventGroup) */ protected EventGroup addEventGroup(EventGroup group) { EventGroup previous = (EventGroup) eventGroups.putIfAbsent(group.getGroupId(), group); // a parallel thread might have removed the EventGroup already, // therefore we need to validate our current reference return (previous != null ? previous : group); } /** * @see AbstractEventAggregator#removeEventGroup(EventGroup) */ protected void removeEventGroup(EventGroup group) { eventGroups.remove(group.getGroupId()); } /** * Reorder collected events according to the configured Comparator. * * @param events the EventGroup used for collecting the events * @return an array of events reordered according to the Comparator returned by * {@link #getComparator()}. If no comparator is configured, the events * are returned unsorted. */ protected MuleEvent[] resequenceEvents(EventGroup events) { if (events == null || events.size() == 0) { return EventGroup.EMPTY_EVENTS_ARRAY; } MuleEvent[] result = events.toArray(); Comparator cmp = this.getComparator(); if (cmp != null) { Arrays.sort(result, cmp); } else { logger.debug("MuleEvent comparator is null, events were not reordered"); } return result; } /** * Determines whether the events in the passed EventGroup are ready to be * reordered. * * @see AbstractEventAggregator#shouldAggregateEvents(EventGroup) */ protected abstract boolean shouldResequenceEvents(EventGroup events); } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/IdempotentInMemoryMessageIdStore.java0000644000175000017500000001556310745677442032026 0ustar charlescharles/* * $Id: IdempotentInMemoryMessageIdStore.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.api.routing.IdempotentMessageIdStore; import org.mule.config.i18n.CoreMessages; import org.mule.util.concurrent.DaemonThreadFactory; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentSkipListMap; import edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.helpers.Utils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * IdempotentInMemoryMessageIdStore implements an optionally bounded * in-memory store for message IDs with periodic expiry of old entries. The bounded size * is a soft limit and only enforced periodically by the expiry process; this * means that the store may temporarily exceed its maximum size between expiry runs, but * will eventually shrink to its configured size. */ public class IdempotentInMemoryMessageIdStore implements IdempotentMessageIdStore { protected final Log logger = LogFactory.getLog(this.getClass()); protected final ConcurrentSkipListMap store; protected final ScheduledThreadPoolExecutor scheduler; protected final int maxEntries; protected final int entryTTL; protected final int expirationInterval; /** * Default constructor for IdempotentInMemoryMessageIdStore. * * @param name a name for this store, can be used for logging and identification * purposes * @param maxEntries the maximum number of entries that this store keeps around. * Specify -1 if the store is supposed to be "unbounded". * @param entryTTL the time-to-live for each message ID, specified in seconds, or * -1 for entries that should never expire. DO NOT * combine this with an unbounded store! * @param expirationInterval the interval for periodic bounded size enforcement and * entry expiration, specified in seconds. Arbitrary positive values * between 1 second and several hours or days are possible, but should be * chosen carefully according to the expected message rate to prevent * OutOfMemory conditions. * @see IdempotentReceiver#createMessageIdStore() * @throws {@link IllegalArgumentException} if non-positive values are specified for * expirationInterval */ public IdempotentInMemoryMessageIdStore(String name, int maxEntries, int entryTTL, int expirationInterval) { super(); this.store = new ConcurrentSkipListMap(); this.maxEntries = (maxEntries >= 0 ? maxEntries : Integer.MAX_VALUE); this.entryTTL = entryTTL; if (expirationInterval <= 0) { throw new IllegalArgumentException(CoreMessages.propertyHasInvalidValue("expirationInterval", new Integer(expirationInterval)).toString()); } this.expirationInterval = expirationInterval; this.scheduler = new ScheduledThreadPoolExecutor(1); scheduler.setThreadFactory(new DaemonThreadFactory(name + "-IdempotentMessageIdStore")); scheduler.scheduleWithFixedDelay(new Expirer(), this.expirationInterval, this.expirationInterval, TimeUnit.SECONDS); } public boolean containsId(Object id) throws IllegalArgumentException, Exception { if (id == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("id").toString()); } // this is a relaxed check so we don't need to synchronize on the store. return store.values().contains(id); } public boolean storeId(Object id) throws IllegalArgumentException, Exception { if (id == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("id").toString()); } // this block is unfortunately necessary to counter a possible race condition // between multiple nonatomic calls to containsId/storeId, which are // only necessary because of the nonatomic calls to isMatch/process by // DefaultInboundRouterCollection.route(). synchronized (store) { if (store.values().contains(id)) { return false; } boolean written = false; while (!written) { written = (store.putIfAbsent(new Long(Utils.nanoTime()), id) == null); } return true; } } protected void expire() { // this is not guaranteed to be precise, but we don't mind int currentSize = store.size(); // first trim to maxSize if necessary int excess = (currentSize - maxEntries); if (excess > 0) { while (currentSize > maxEntries) { store.pollFirstEntry(); currentSize--; } if (logger.isDebugEnabled()) { logger.debug("Expired " + excess + " excess entries"); } } // expire further if entry TTLs are enabled if (entryTTL > 0 && currentSize != 0) { final long now = Utils.nanoTime(); int expiredEntries = 0; Map.Entry oldestEntry; purge : while ((oldestEntry = store.firstEntry()) != null) { Long oldestKey = (Long) oldestEntry.getKey(); long oldestKeyValue = oldestKey.longValue(); if (TimeUnit.NANOSECONDS.toSeconds(now - oldestKeyValue) >= entryTTL) { store.remove(oldestKey); expiredEntries++; } else { break purge; } } if (logger.isDebugEnabled()) { logger.debug("Expired " + expiredEntries + " old entries"); } } } protected class Expirer implements Runnable { public void run() { try { // timed expiry MUST NOT throw anything.. IdempotentInMemoryMessageIdStore.this.expire(); } catch (Exception ex) { // ..but if it does, at least log the error logger.error(ex.getMessage(), ex); } } } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/MessageChunkingAggregator.java0000644000175000017500000000746210776710212030477 0ustar charlescharles/* * $Id: MessageChunkingAggregator.java 11531 2008-04-08 15:34:34Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.routing.AggregationException; import org.mule.routing.EventCorrelatorCallback; import org.mule.routing.CollectionCorrelatorCallback; import java.util.Arrays; import java.util.Comparator; import java.util.Iterator; import org.apache.commons.collections.IteratorUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.lang.SerializationException; import org.apache.commons.lang.SerializationUtils; public class MessageChunkingAggregator extends AbstractEventAggregator { public static final int DEFAULT_BUFFER_SIZE = 4096; protected final Comparator eventComparator = new CorrelationSequenceComparator(); public MessageChunkingAggregator() { super(); } protected EventCorrelatorCallback getCorrelatorCallback() { return new CollectionCorrelatorCallback() { /** * This method is invoked if the shouldAggregate method is called and returns * true. Once this method returns an aggregated message the event group is * removed from the router * * @param events the event group for this request * @return an aggregated message * @throws org.mule.routing.AggregationException if the aggregation fails. in * this scenario the whole event group is removed and passed to the * exception handler for this componenet */ public MuleMessage aggregateEvents(EventGroup events) throws AggregationException { MuleEvent[] collectedEvents = events.toArray(); MuleEvent firstEvent = collectedEvents[0]; Arrays.sort(collectedEvents, eventComparator); ByteArrayOutputStream baos = new ByteArrayOutputStream(DEFAULT_BUFFER_SIZE); try { for (Iterator iterator = IteratorUtils.arrayIterator(collectedEvents); iterator.hasNext();) { MuleEvent event = (MuleEvent) iterator.next(); baos.write(event.getMessageAsBytes()); } MuleMessage message; // try to deserialize message, since ChunkingRouter might have serialized // the object... try { message = new DefaultMuleMessage(SerializationUtils.deserialize(baos.toByteArray()), firstEvent.getMessage()); } catch (SerializationException e) { message = new DefaultMuleMessage(baos.toByteArray(), firstEvent.getMessage()); } message.setCorrelationGroupSize(-1); message.setCorrelationSequence(-1); return message; } catch (Exception e) { throw new AggregationException(events, firstEvent.getEndpoint(), e); } finally { IOUtils.closeQuietly(baos); } } }; } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/IdempotentSecureHashReceiver.java0000644000175000017500000000500310746275214031163 0ustar charlescharles/* * $Id: IdempotentSecureHashReceiver.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import org.mule.api.routing.RoutingException; import org.mule.api.transformer.TransformerException; import org.mule.transformer.simple.ByteArrayToHexString; import org.mule.transformer.simple.SerializableToByteArray; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * IdempotentSecureHashReceiver ensures that only unique messages are * received by a service. It does this by calculating the SHA-256 hash of the message * itself. This provides a value with an infinitesimally small chance of a collision. This * can be used to filter message duplicates. Please keep in mind that the hash is * calculated over the entire byte array representing the message, so any leading or * trailing spaces or extraneous bytes (like padding) can produce different hash values * for the same semantic message content. Care should be taken to ensure that messages do * not contain extraneous bytes. This class is useful when the message does not support * unique identifiers. */ public class IdempotentSecureHashReceiver extends IdempotentReceiver { private static final String messageDigestAlgorithm = "SHA-256"; private final SerializableToByteArray objectToByteArray = new SerializableToByteArray(); private final ByteArrayToHexString byteArrayToHexString = new ByteArrayToHexString(); // @Override protected Object getIdForEvent(MuleEvent event) throws MessagingException { try { MessageDigest md = MessageDigest.getInstance(messageDigestAlgorithm); return byteArrayToHexString.transform(md.digest((byte[]) objectToByteArray.transform(event.getMessage() .getPayload()))); } catch (NoSuchAlgorithmException nsa) { throw new RoutingException(event.getMessage(), event.getEndpoint(), nsa); } catch (TransformerException te) { throw new RoutingException(event.getMessage(), event.getEndpoint(), te); } } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/CorrelationEventResequencer.java0000644000175000017500000000317410745677442031117 0ustar charlescharles/* * $Id: CorrelationEventResequencer.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.api.MuleEvent; /** * CorrelationEventResequencer is used to resequence events according * to their dispatch sequence in the correlation group. When the MessageSplitter * router splits an event it assigns a correlation sequence to the individual message * parts so that another router such as the CorrelationEventResequencer can * receive the parts and reorder or merge them. */ public class CorrelationEventResequencer extends AbstractEventResequencer { public CorrelationEventResequencer() { super(); this.setComparator(new CorrelationSequenceComparator()); } protected boolean shouldResequenceEvents(EventGroup events) { MuleEvent event = (MuleEvent) events.iterator().next(); if (event == null) { // nothing to resequence return false; } int size = event.getMessage().getCorrelationGroupSize(); if (size == -1) { logger.warn("Correlation Group Size not set, but CorrelationResequencer is being used. This can cause messages to be held indefinitely"); } return size == events.size(); } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/WireTap.java0000644000175000017500000000464110766204322024767 0ustar charlescharles/* * $Id: WireTap.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleSession; import org.mule.NullSessionHandler; import org.mule.RequestContext; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.DispatchException; /** * An inbound router that can forward every message to another destination as defined * in the "endpoint" property. This can be a logical destination of a URI.

    A * filter can be applied to this router so that only events matching a criteria will * be tapped. */ public class WireTap extends SelectiveConsumer { private volatile OutboundEndpoint tap; public boolean isMatch(MuleEvent event) throws MessagingException { if (tap != null) { return super.isMatch(event); } else { logger.warn("No endpoint identifier is set on this wire tap"); return false; } } public MuleEvent[] process(MuleEvent event) throws MessagingException { RequestContext.setEvent(null); try { //We have to create a new session for this dispatch, since the session may get altered //using this call, changing the behaviour of the request MuleSession session = new DefaultMuleSession(event.getMessage(), new NullSessionHandler(), getMuleContext()); tap.dispatch(new DefaultMuleEvent(event.getMessage(), tap, session, false)); } catch (MessagingException e) { throw e; } catch (MuleException e) { throw new DispatchException(event.getMessage(), tap, e); } return super.process(event); } public OutboundEndpoint getEndpoint() { return tap; } public void setEndpoint(OutboundEndpoint endpoint) throws MuleException { this.tap = endpoint; } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/AbstractEventAggregator.java0000644000175000017500000000416510777661265030204 0ustar charlescharles/* * $Id: AbstractEventAggregator.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.DefaultMuleEvent; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.lifecycle.InitialisationException; import org.mule.routing.EventCorrelator; import org.mule.routing.EventCorrelatorCallback; import javax.resource.spi.work.WorkException; /** * AbstractEventAggregator will aggregate a set of messages into a * single message. */ public abstract class AbstractEventAggregator extends SelectiveConsumer { private EventCorrelator eventCorrelator; private int timeout = 0; //@Override public void initialise() throws InitialisationException { eventCorrelator = new EventCorrelator(getCorrelatorCallback(), getMessageInfoMapping(), muleContext); if(timeout != 0) { eventCorrelator.setTimeout(timeout); try { eventCorrelator.enableTimeoutMonitor(); } catch (WorkException e) { throw new InitialisationException(e, this); } } super.initialise(); } protected abstract EventCorrelatorCallback getCorrelatorCallback(); //@Override public MuleEvent[] process(MuleEvent event) throws MessagingException { MuleMessage msg = eventCorrelator.process(event); if(msg==null) { return null; } MuleEvent[] result = new MuleEvent[]{new DefaultMuleEvent(msg, event)}; return result; } public int getTimeout() { return timeout; } public void setTimeout(int timeout) { this.timeout = timeout; } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/SelectiveConsumer.java0000644000175000017500000000705610776710212027057 0ustar charlescharles/* * $Id: SelectiveConsumer.java 11531 2008-04-08 15:34:34Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.DefaultMuleMessage; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.routing.InboundRouter; import org.mule.api.routing.RoutingException; import org.mule.api.routing.MessageInfoMapping; import org.mule.api.routing.filter.Filter; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.routing.AbstractRouter; import org.mule.routing.MuleMessageInfoMapping; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * SelectiveConsumer is an inbound router used to filter out unwanted * events. The filtering is performed by a Filter that can be set * on the router. * * @see InboundRouter * @see org.mule.api.routing.InboundRouterCollection * @see org.mule.api.routing.RouterCollection */ public class SelectiveConsumer extends AbstractRouter implements InboundRouter { protected final Log logger = LogFactory.getLog(getClass()); private volatile Filter filter; private volatile boolean transformFirst = true; private MessageInfoMapping messageInfoMapping = new MuleMessageInfoMapping(); public boolean isMatch(MuleEvent event) throws MessagingException { if (logger.isDebugEnabled()) { logger.debug("Attempting to route event: " + event.getId()); } if (filter == null) { return true; } MuleMessage message = event.getMessage(); if (transformFirst) { try { Object payload = event.transformMessage(); message = new DefaultMuleMessage(payload, message); } catch (TransformerException e) { throw new RoutingException( CoreMessages.transformFailedBeforeFilter(), event.getMessage(), event.getEndpoint(), e); } } boolean result = filter.accept(message); if (logger.isDebugEnabled()) { logger.debug("MuleEvent " + event.getId() + (result ? " passed filter " : " did not pass filter ") + filter.getClass().getName()); } return result; } public MuleEvent[] process(MuleEvent event) throws MessagingException { if (this.isMatch(event)) { return new MuleEvent[]{event}; } else { return null; } } public Filter getFilter() { return filter; } public void setFilter(Filter filter) { this.filter = filter; } public boolean isTransformFirst() { return transformFirst; } public void setTransformFirst(boolean transformFirst) { this.transformFirst = transformFirst; } public MessageInfoMapping getMessageInfoMapping() { return messageInfoMapping; } public void setMessageInfoMapping(MessageInfoMapping messageInfoMapping) { this.messageInfoMapping = messageInfoMapping; } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/CorrelationSequenceComparator.java0000644000175000017500000000232510745677442031431 0ustar charlescharles/* * $Id: CorrelationSequenceComparator.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.api.MuleEvent; import java.util.Comparator; /** * CorrelationSequenceComparator is a {@link Comparator} for * {@link MuleEvent}s using their respective correlation sequences. */ public final class CorrelationSequenceComparator implements Comparator { public CorrelationSequenceComparator() { super(); } public int compare(Object o1, Object o2) { int val1 = ((MuleEvent)o1).getMessage().getCorrelationSequence(); int val2 = ((MuleEvent)o2).getMessage().getCorrelationSequence(); if (val1 == val2) { return 0; } else if (val1 > val2) { return 1; } else { return -1; } } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/ForwardingConsumer.java0000644000175000017500000000516410746275214027241 0ustar charlescharles/* * $Id: ForwardingConsumer.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.MessagingException; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.routing.OutboundRouterCollection; import org.mule.api.routing.RoutingException; /** * ForwardingConsumer is used to forward an incoming event over * another transport without invoking a service. This can be used to implement a * bridge accross different transports. */ public class ForwardingConsumer extends SelectiveConsumer { public MuleEvent[] process(MuleEvent event) throws MessagingException { if (super.process(event) != null) { OutboundRouterCollection router = event.getService().getOutboundRouter(); // Set the stopFurtherProcessing flag to true to inform the // DefaultInboundRouterCollection not to route these events to the service event.setStopFurtherProcessing(true); if (router == null) { logger.debug("Descriptor has no outbound router configured to forward to, continuing with normal processing"); return new MuleEvent[]{event}; } else { try { MuleMessage message = new DefaultMuleMessage(event.transformMessage(), event.getMessage()); MuleMessage response = router.route(message, event.getSession(), event.isSynchronous()); // TODO What's the correct behaviour for async endpoints? // maybe let router.route() return a Future for the returned msg? if (response != null) { return new MuleEvent[]{new DefaultMuleEvent(response, event)}; } else { return null; } } catch (MuleException e) { throw new RoutingException(event.getMessage(), event.getEndpoint(), e); } } } return null; } } mule-2.0.1/core/src/main/java/org/mule/routing/inbound/InboundPassThroughRouter.java0000644000175000017500000000214610745677442030417 0ustar charlescharles/* * $Id: InboundPassThroughRouter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.api.MuleEvent; import org.mule.api.routing.RoutingException; /** * InboundPassThroughRouter allows inbound routing over all * registered endpoints without any filtering. This class is used by Mule when a * specific inbound router has not been configured on a UMODescriptor. */ public class InboundPassThroughRouter extends SelectiveConsumer { public MuleEvent[] process(MuleEvent event) throws RoutingException { synchronized (event) { return new MuleEvent[]{event}; } } public boolean isMatch(MuleEvent event) throws RoutingException { return true; } } mule-2.0.1/core/src/main/java/org/mule/routing/filters/0000755000175000017500000000000011351411110022540 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/routing/filters/package.html0000644000175000017500000000021310204257011025021 0ustar charlescharles Filters are often used by routers to determine if the event should be accepted by the router. mule-2.0.1/core/src/main/java/org/mule/routing/filters/ExpressionFilter.java0000644000175000017500000001337110771060666026742 0ustar charlescharles/* * $Id: ExpressionFilter.java 11478 2008-03-22 01:32:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import org.mule.config.i18n.CoreMessages; import org.mule.util.expression.ExpressionEvaluatorManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Allows boolean expressions to be executed on a message */ public class ExpressionFilter implements Filter { /** * logger used by this class */ protected transient final Log logger = LogFactory.getLog(ExpressionFilter.class); private String evaluator; private String expression; private String customEvaluator; private String fullExpression; private boolean nullReturnsTrue = false; /** For evaluators that are not expression languages we can delegate the execution to another filter */ private Filter delegateFilter; public ExpressionFilter(String evaluator, String customEvaluator, String expression) { this.customEvaluator = customEvaluator; this.evaluator = evaluator; this.expression = expression; } public ExpressionFilter(String evaluator, String expression) { this.evaluator = evaluator; this.expression = expression; } public ExpressionFilter(String expression) { int i = expression.indexOf(":"); if(i < 0) { throw new IllegalArgumentException("Expression is invalid: " + expression); } this.evaluator = expression.substring(0, i); this.expression = expression.substring(i+1); } public ExpressionFilter() { super(); } /** * Check a given message against this filter. * * @param message a non null message to filter. * @return true if the message matches the filter */ public boolean accept(MuleMessage message) { String expr = getFullExpression(); if(delegateFilter!=null) { return delegateFilter.accept(message); } Object result = ExpressionEvaluatorManager.evaluate(expr, message); if(result==null) { return nullReturnsTrue; } else if(result instanceof Boolean) { return ((Boolean)result).booleanValue(); } else { logger.warn("Expression: " + expr + ", returned an non-boolean result. Returning: " + !nullReturnsTrue); return !nullReturnsTrue; } } protected String getFullExpression() { if(fullExpression==null) { if(evaluator==null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("evaluator").getMessage()); } if(evaluator.equals("custom")) { if(customEvaluator==null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("customEvaluator").getMessage()); } else { evaluator = customEvaluator; } } if(evaluator.equals("header")) { delegateFilter = new MessagePropertyFilter(expression); } else if(evaluator.equals("regex")) { delegateFilter = new RegExFilter(expression); } else if(evaluator.equals("wildcard")) { delegateFilter = new WildcardFilter(expression); } else if(evaluator.equals("payload-type")) { try { delegateFilter = new PayloadTypeFilter(expression); } catch (ClassNotFoundException e) { IllegalArgumentException iae = new IllegalArgumentException(); iae.initCause(e); throw iae; } } else if(evaluator.equals("exception-type")) { try { delegateFilter = new ExceptionTypeFilter(expression); } catch (ClassNotFoundException e) { IllegalArgumentException iae = new IllegalArgumentException(); iae.initCause(e); throw iae; } } else { //In the case of 'payload' the expression can be null fullExpression = evaluator + ":" + (expression==null ? "" : expression); } } return fullExpression; } public String getCustomEvaluator() { return customEvaluator; } public void setCustomEvaluator(String customEvaluator) { this.customEvaluator = customEvaluator; } public String getEvaluator() { return evaluator; } public void setEvaluator(String evaluator) { this.evaluator = evaluator; } public String getExpression() { return expression; } public void setExpression(String expression) { this.expression = expression; } public boolean isNullReturnsTrue() { return nullReturnsTrue; } public void setNullReturnsTrue(boolean nullReturnsTrue) { this.nullReturnsTrue = nullReturnsTrue; } } mule-2.0.1/core/src/main/java/org/mule/routing/filters/RegExFilter.java0000644000175000017500000000365410745677442025627 0ustar charlescharles/* * $Id: RegExFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import org.mule.api.routing.filter.ObjectFilter; import java.util.regex.Pattern; /** * RegExFilter is used to match a String argument against a regular * pattern. */ public class RegExFilter implements Filter, ObjectFilter { private Pattern pattern; public RegExFilter() { super(); } public RegExFilter(String pattern) { this.pattern = Pattern.compile(pattern); } public boolean accept(MuleMessage message) { return accept(message.getPayload()); } public boolean accept(Object object) { if (object == null) { return false; } return (pattern != null && pattern.matcher(object.toString()).find()); } public String getPattern() { return (pattern == null ? null : pattern.pattern()); } public void setPattern(String pattern) { this.pattern = (pattern != null ? Pattern.compile(pattern) : null); } /** * @return * @deprecated Use {@link #getPattern()} This method name was changed to be consistent with other filters */ public String getExpression() { return getPattern(); } /** * @param * @deprecated Use {@link #getPattern()} This method name was changed to be consistent with other filters */ public void setExpression(String expression) { setPattern(expression); } } mule-2.0.1/core/src/main/java/org/mule/routing/filters/logic/0000755000175000017500000000000011351411110023635 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/routing/filters/logic/package.html0000644000175000017500000000013610204257011026122 0ustar charlescharles Filters that allow other filters to be combined. mule-2.0.1/core/src/main/java/org/mule/routing/filters/logic/NotFilter.java0000644000175000017500000000210410745677442026437 0ustar charlescharles/* * $Id: NotFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters.logic; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; /** * NotFilter accepts if the filter does not accept. */ public class NotFilter implements Filter { private Filter filter; public NotFilter() { super(); } public NotFilter(Filter filter) { this.filter = filter; } public Filter getFilter() { return filter; } public void setFilter(Filter filter) { this.filter = filter; } public boolean accept(MuleMessage message) { return (filter != null ? !filter.accept(message) : false); } } mule-2.0.1/core/src/main/java/org/mule/routing/filters/logic/AbstractFilterCollection.java0000644000175000017500000000375110745677442031467 0ustar charlescharles/* * $Id: AbstractFilterCollection.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters.logic; import org.mule.api.routing.filter.Filter; import java.util.ArrayList; import java.util.List; /** * Manages a filter collection. Used as the base clas for the Or and AND filters */ public abstract class AbstractFilterCollection implements Filter { private List filters; public AbstractFilterCollection() { filters = new ArrayList(); } /** * @param left * @param right */ public AbstractFilterCollection(Filter left, Filter right) { this(); filters.add(left); filters.add(right); } /** * @deprecated * @param leftFilter */ public void setLeftFilter(Filter leftFilter) { filters.add(0, leftFilter); } /** * @deprecated * @param rightFilter */ public void setRightFilter(Filter rightFilter) { filters.add(rightFilter); } /** * @deprecated * @return */ public Filter getLeftFilter() { if(filters.size()==0) return null; return (Filter)filters.get(0); } /** * @deprecated * @return */ public Filter getRightFilter() { if(filters.size() > 1) { return (Filter)filters.get(1); } else if(filters.size()==0) { return null; } else { return (Filter)filters.get(0); } } public List getFilters() { return filters; } public void setFilters(List filters) { this.filters = filters; } } mule-2.0.1/core/src/main/java/org/mule/routing/filters/logic/OrFilter.java0000644000175000017500000000232410754365306026254 0ustar charlescharles/* * $Id: OrFilter.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters.logic; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import java.util.Iterator; /** * OrFilter accepts if any of the filters accept the message */ public class OrFilter extends AbstractFilterCollection { public OrFilter() { super(); } /** * @param left * @param right */ public OrFilter(Filter left, Filter right) { super(left, right); } public boolean accept(MuleMessage message) { for (Iterator iterator = getFilters().iterator(); iterator.hasNext();) { Filter umoFilter = (Filter) iterator.next(); if(umoFilter.accept(message)) { return true; } } return false; } } mule-2.0.1/core/src/main/java/org/mule/routing/filters/logic/AndFilter.java0000644000175000017500000000256110745677442026410 0ustar charlescharles/* * $Id: AndFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters.logic; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import java.util.Iterator; /** * AndFilter accepts only if the leftFilter and rightFilter filter * accept. */ public class AndFilter extends AbstractFilterCollection { public AndFilter() { super(); } /** * * @param left * @param right */ public AndFilter(Filter left, Filter right) { super(left, right); } public boolean accept(MuleMessage message) { if(getFilters().size()==0) { return false; } int counter=0; for (Iterator iterator = getFilters().iterator(); iterator.hasNext();) { Filter umoFilter = (Filter) iterator.next(); if(umoFilter.accept(message)) { counter++; } } return counter == getFilters().size(); } } mule-2.0.1/core/src/main/java/org/mule/routing/filters/EqualsFilter.java0000644000175000017500000000267010745677442026044 0ustar charlescharles/* * $Id: EqualsFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import org.mule.api.routing.filter.ObjectFilter; /** * EqualsFilter is a filter for comparing two objects using the * equals() method. */ public class EqualsFilter implements Filter, ObjectFilter { private Object pattern; public EqualsFilter() { super(); } public EqualsFilter(Object compareTo) { this.pattern = compareTo; } public boolean accept(MuleMessage message) { return accept(message.getPayload()); } public boolean accept(Object object) { if (object == null && pattern == null) { return true; } if (object == null || pattern == null) { return false; } return pattern.equals(object); } public Object getPattern() { return pattern; } public void setPattern(Object pattern) { this.pattern = pattern; } } mule-2.0.1/core/src/main/java/org/mule/routing/filters/MessagePropertyFilter.java0000644000175000017500000001005510745677442027737 0ustar charlescharles/* * $Id: MessagePropertyFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MessagePropertyFilter can be used to filter against properties on * an event. This can be very useful as the event properties represent all the meta * information about the event from the underlying transport, so for an event * received over HTTP you can check for HTTP headers etc. The pattern should be * expressed as a key/value pair, i.e. "propertyName=value". If you want to compare * more than one property you can use the logic filters for And, Or and Not * expressions. By default the comparison is case sensitive; you can set the * caseSensitive property to override this. */ public class MessagePropertyFilter implements Filter { /** * logger used by this class */ protected transient final Log logger = LogFactory.getLog(MessagePropertyFilter.class); private boolean caseSensitive = true; private boolean not = false; private String propertyName; private String propertyValue; public MessagePropertyFilter() { super(); } public MessagePropertyFilter(String expression) { setExpression(expression); } public boolean accept(MuleMessage message) { if (message == null) { return false; } Object value = message.getProperty(propertyName); boolean match; if (value == null) { match = compare(null, propertyValue); } else { match = compare(value.toString(), propertyValue); } if(!match && logger.isDebugEnabled()) { logger.debug("Property: " + propertyName + " not found on message with Id: " + message.getUniqueId()); } return match; } protected boolean compare(String value1, String value2) { if (value1 == null && value2 != null && !"null".equals(value2) && not) { return true; } if (value1 == null) { value1 = "null"; } if (value2 == null) { value2 = "null"; } boolean result = false; if (caseSensitive) { result = value1.equals(value2); } else { result = value1.equalsIgnoreCase(value2); } return (not ? !result : result); } public String getExpression() { return propertyName + '=' + propertyValue; } public void setExpression(String expression) { int i = expression.indexOf('='); if (i == -1) { throw new IllegalArgumentException( "Pattern is malformed - it should be a key value pair, i.e. property=value: " + expression); } else { if (expression.charAt(i - 1) == '!') { not = true; propertyName = expression.substring(0, i - 1).trim(); } else { propertyName = expression.substring(0, i).trim(); } propertyValue = expression.substring(i + 1).trim(); } } public boolean isCaseSensitive() { return caseSensitive; } public void setCaseSensitive(boolean caseSensitive) { this.caseSensitive = caseSensitive; } /** * All Filters that are configured via spring have to implement this method. */ public void setPattern(String pattern) { this.setExpression(pattern); } } mule-2.0.1/core/src/main/java/org/mule/routing/filters/PayloadTypeFilter.java0000644000175000017500000000264210771050152027022 0ustar charlescharles/* * $Id: PayloadTypeFilter.java 11477 2008-03-22 00:18:50Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import org.mule.util.ClassUtils; /** * PayloadTypeFilter filters based on the type of the object received. */ public class PayloadTypeFilter implements Filter { private Class expectedType; public PayloadTypeFilter() { super(); } public PayloadTypeFilter(String expectedType) throws ClassNotFoundException { this(ClassUtils.loadClass(expectedType, PayloadTypeFilter.class)); } public PayloadTypeFilter(Class expectedType) { this.expectedType = expectedType; } public boolean accept(MuleMessage message) { return (expectedType != null ? expectedType.isAssignableFrom(message.getPayload().getClass()) : false); } public Class getExpectedType() { return expectedType; } public void setExpectedType(Class expectedType) { this.expectedType = expectedType; } } mule-2.0.1/core/src/main/java/org/mule/routing/filters/WildcardFilter.java0000644000175000017500000000754010745677442026344 0ustar charlescharles/* * $Id: WildcardFilter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.api.MuleMessage; import org.mule.api.routing.filter.Filter; import org.mule.api.routing.filter.ObjectFilter; import org.mule.util.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * WildcardFilter is used to match Strings against wildcards. It * performs matches with "*", i.e. "jms.events.*" would catch "jms.events.customer" * and "jms.events.receipts". This filter accepts a comma-separated list of patterns, * so more than one filter pattern can be matched for a given argument: * "jms.events.*, jms.actions.*" will match "jms.events.system" and "jms.actions" but * not "jms.queue". */ public class WildcardFilter implements Filter, ObjectFilter { protected final Log logger = LogFactory.getLog(this.getClass()); protected volatile String pattern; protected volatile String[] patterns; private volatile boolean caseSensitive = true; public WildcardFilter() { super(); } public WildcardFilter(String pattern) { this.setPattern(pattern); } public boolean accept(MuleMessage message) { try { return accept(message.getPayloadAsString()); } catch (Exception e) { logger.warn("An exception occured while filtering", e); return false; } } public boolean accept(Object object) { if (object == null) { return false; } String[] currentPatterns = this.patterns; if (currentPatterns != null) { for (int x = 0; x < currentPatterns.length; x++) { boolean foundMatch; String pattern = currentPatterns[x]; if ("*".equals(pattern) || "**".equals(pattern)) { return true; } String candidate = object.toString(); if (!isCaseSensitive()) { pattern = pattern.toLowerCase(); candidate = candidate.toLowerCase(); } int i = pattern.indexOf('*'); if (i == -1) { foundMatch = pattern.equals(candidate); } else { int i2 = pattern.indexOf('*', i + 1); if (i2 > 1) { foundMatch = candidate.indexOf(pattern.substring(1, i2)) > -1; } else if (i == 0) { foundMatch = candidate.endsWith(pattern.substring(1)); } else { foundMatch = candidate.startsWith(pattern.substring(0, i)); } } if (foundMatch) { return true; } } } return false; } public String getPattern() { return pattern; } public void setPattern(String pattern) { this.pattern = pattern; this.patterns = StringUtils.splitAndTrim(pattern, ","); } public boolean isCaseSensitive() { return caseSensitive; } public void setCaseSensitive(boolean caseSensitive) { this.caseSensitive = caseSensitive; } } mule-2.0.1/core/src/main/java/org/mule/routing/filters/ExceptionTypeFilter.java0000644000175000017500000000335610771050152027372 0ustar charlescharles/* * $Id: ExceptionTypeFilter.java 11477 2008-03-22 00:18:50Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.api.ExceptionPayload; import org.mule.api.MuleMessage; import org.mule.util.ClassUtils; /** * A filter that accepts messages that have an exception payload. An Exception type * can also be set on this filter to allow it to accept Exception messages of a * particular Exception class only. */ public class ExceptionTypeFilter extends PayloadTypeFilter { public ExceptionTypeFilter() { super(); } public ExceptionTypeFilter(String expectedType) throws ClassNotFoundException { this(ClassUtils.loadClass(expectedType, ExceptionTypeFilter.class)); } public ExceptionTypeFilter(Class expectedType) { super(expectedType); } /** * Check a given message against this filter. * * @param message a non null message to filter. * @return true if the message matches the filter */ public boolean accept(MuleMessage message) { ExceptionPayload epl = message.getExceptionPayload(); if (getExpectedType() == null) { return epl != null; } else if (epl != null) { return getExpectedType().isAssignableFrom(epl.getException().getClass()); } else { return false; } } } mule-2.0.1/core/src/main/java/org/mule/routing/ServiceCatchAllStrategy.java0000644000175000017500000000444710757615756026522 0ustar charlescharles/* * $Id: ServiceCatchAllStrategy.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.DefaultMuleEvent; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.RoutingException; import org.mule.api.routing.ServiceRoutingException; /** * ServiceCatchAllStrategy is used to catch any events and forward the * events to the service as is. */ public class ServiceCatchAllStrategy extends AbstractCatchAllStrategy { public void setEndpoint(OutboundEndpoint endpoint) { throw new UnsupportedOperationException("The endpoint cannot be set on this catch all"); } public OutboundEndpoint getEndpoint() { return null; } public synchronized MuleMessage catchMessage(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { MuleEvent event = RequestContext.getEvent(); logger.debug("Catch all strategy handling event: " + event); try { logger.info("MuleEvent being routed from catch all strategy for endpoint: " + event.getEndpoint()); event = new DefaultMuleEvent(message, event.getEndpoint(), session.getService(), event); if (synchronous) { statistics.incrementRoutedMessage(event.getEndpoint()); return session.getService().sendEvent(event); } else { statistics.incrementRoutedMessage(event.getEndpoint()); session.getService().dispatchEvent(event); return null; } } catch (MuleException e) { throw new ServiceRoutingException(event.getMessage(), event.getEndpoint(), session.getService(), e); } } } mule-2.0.1/core/src/main/java/org/mule/routing/ExpressionMessageInfoMapping.java0000644000175000017500000000326010771035311027542 0ustar charlescharles/* * $Id: ExpressionMessageInfoMapping.java 11475 2008-03-21 22:46:33Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.api.MuleMessage; import org.mule.api.routing.MessageInfoMapping; import org.mule.util.expression.ExpressionEvaluatorManager; /** * TODO */ public class ExpressionMessageInfoMapping implements MessageInfoMapping { private String correlationIdExpression; private String messageIdExpression; public String getMessageId(MuleMessage message) { return (String)ExpressionEvaluatorManager.evaluate(getMessageIdExpression(), message, true); } public String getCorrelationId(MuleMessage message) { String id = (String)ExpressionEvaluatorManager.evaluate(getCorrelationIdExpression(), message, true); if (id == null) { id = getMessageId(message); } return id; } public String getCorrelationIdExpression() { return correlationIdExpression; } public void setCorrelationIdExpression(String correlationIdExpression) { this.correlationIdExpression = correlationIdExpression; } public String getMessageIdExpression() { return messageIdExpression; } public void setMessageIdExpression(String messageIdExpression) { this.messageIdExpression = messageIdExpression; } } mule-2.0.1/core/src/main/java/org/mule/routing/nested/0000755000175000017500000000000011351411107022360 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/routing/nested/NestedInvocationHandler.java0000644000175000017500000000663010754403514030013 0ustar charlescharles/* * $Id: NestedInvocationHandler.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.nested; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.routing.NestedRouter; import org.mule.config.i18n.CoreMessages; import org.mule.util.StringMessageUtils; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class NestedInvocationHandler implements InvocationHandler { public static final String DEFAULT_METHOD_NAME_TOKEN = "default"; protected static Log logger = LogFactory.getLog(NestedInvocationHandler.class); protected Map routers = new ConcurrentHashMap(); protected NestedInvocationHandler(NestedRouter router) { addRouterForInterface(router); } public void addRouterForInterface(NestedRouter router) { if (router.getMethod() == null) { if (routers.size() == 0) { routers.put(DEFAULT_METHOD_NAME_TOKEN, router); } else { throw new IllegalArgumentException(CoreMessages.mustSetMethodNamesOnBinding().getMessage()); } } else { routers.put(router.getMethod(), router); } } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.getName().equals("toString")) { return toString(); } MuleMessage message; if (args.length == 1) { message = new DefaultMuleMessage(args[0]); } else { message = new DefaultMuleMessage(args); } NestedRouter router = (NestedRouter) routers.get(method.getName()); if (router == null) { router = (NestedRouter) routers.get(DEFAULT_METHOD_NAME_TOKEN); } if (router == null) { throw new IllegalArgumentException(CoreMessages.cannotFindBindingForMethod(method.getName()).toString()); } MuleMessage reply; MuleEvent currentEvent = RequestContext.getEvent(); reply = router.route(message, currentEvent.getSession(), router.getEndpoint().isSynchronous()); if (reply != null) { if (reply.getExceptionPayload() != null) { throw reply.getExceptionPayload().getException(); } else { return reply.getPayload(); } } else { return null; } } public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("NestedInvocation"); sb.append("{routers='").append(StringMessageUtils.toString(routers)); sb.append('}'); return sb.toString(); } } mule-2.0.1/core/src/main/java/org/mule/routing/nested/DefaultNestedRouterCollection.java0000644000175000017500000000153210745677442031216 0ustar charlescharles/* * $Id: DefaultNestedRouterCollection.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.nested; import org.mule.api.routing.NestedRouterCollection; import org.mule.management.stats.RouterStatistics; import org.mule.routing.AbstractRouterCollection; /** * TODO */ public class DefaultNestedRouterCollection extends AbstractRouterCollection implements NestedRouterCollection { public DefaultNestedRouterCollection() { super(RouterStatistics.TYPE_INBOUND); } } mule-2.0.1/core/src/main/java/org/mule/routing/nested/DefaultNestedRouter.java0000644000175000017500000000663710757615756027220 0ustar charlescharles/* * $Id: DefaultNestedRouter.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.nested; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.NestedRouter; import org.mule.api.routing.OutboundRouter; import org.mule.management.stats.RouterStatistics; import org.mule.routing.AbstractRouter; import org.mule.routing.outbound.OutboundPassThroughRouter; import java.lang.reflect.Proxy; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class DefaultNestedRouter extends AbstractRouter implements NestedRouter { protected static Log logger = LogFactory.getLog(DefaultNestedRouter.class); private Class interfaceClass; private String methodName; // The router used to actually dispatch the message protected OutboundRouter outboundRouter; public DefaultNestedRouter() { setRouterStatistics(new RouterStatistics(RouterStatistics.TYPE_NESTED)); } public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws MessagingException { return outboundRouter.route(message, session, synchronous); } public void setInterface(Class interfaceClass) { this.interfaceClass = interfaceClass; } public Class getInterface() { return interfaceClass; } public String getMethod() { return methodName; } public void setMethod(String methodName) { this.methodName = methodName; } /* * (non-Javadoc) * * @see org.mule.api.routing.NestedRouter#createProxy(java.lang.Object, * UMODescriptor descriptor java.lang.Class) */ public Object createProxy(Object target) { try { Object proxy = Proxy.newProxyInstance(getInterface().getClassLoader(), new Class[]{getInterface()}, new NestedInvocationHandler(this)); logger.debug("Have proxy?: " + (null != proxy)); return proxy; } catch (Exception e) { logger.error(e); throw new RuntimeException(e); } } public void setEndpoint(OutboundEndpoint e) { outboundRouter = new OutboundPassThroughRouter(); outboundRouter.addEndpoint(e); outboundRouter.setTransactionConfig(e.getTransactionConfig()); } public Class getInterfaceClass() { return interfaceClass; } public String toString() { final StringBuffer sb = new StringBuffer(); sb.append("DefaultNestedRouter"); sb.append("{method='").append(methodName).append('\''); sb.append(", interface=").append(interfaceClass); sb.append('}'); return sb.toString(); } public OutboundEndpoint getEndpoint() { if (outboundRouter != null) { return (OutboundEndpoint) outboundRouter.getEndpoints().get(0); } else { return null; } } } mule-2.0.1/core/src/main/java/org/mule/routing/EventCorrelator.java0000644000175000017500000004260710777661265025117 0ustar charlescharles/* * $Id: EventCorrelator.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.routing.MessageInfoMapping; import org.mule.api.routing.ResponseTimeoutException; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.RoutingNotification; import org.mule.routing.inbound.EventGroup; import org.mule.util.MapUtils; import org.mule.util.concurrent.Latch; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkException; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentMap; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.collections.buffer.BoundedFifoBuffer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * TODO */ public class EventCorrelator { /** * logger used by this class */ protected transient final Log logger = LogFactory.getLog(EventCorrelator.class); public static final String NO_CORRELATION_ID = "no-id"; public static final int MAX_PROCESSED_GROUPS = 50000; /** * A map of EventGroup objects. These represent one or more messages to be * agregated, keyed by message id. There will be one response message for every * EventGroup. */ protected final ConcurrentMap eventGroups = new ConcurrentHashMap(); /** * A map of locks used to wait for response messages for a given message id */ protected final ConcurrentMap locks = new ConcurrentHashMap(); /** * The collection of messages that are ready to be returned to the callee. Keyed * by Message ID */ protected final ConcurrentMap responseMessages = new ConcurrentHashMap(); protected final BoundedFifoBuffer processedGroups = new BoundedFifoBuffer(MAX_PROCESSED_GROUPS); private int timeout = -1; // undefined private boolean failOnTimeout = true; private MessageInfoMapping messageInfoMapping; private MuleContext context; private EventCorrelatorCallback callback; private AtomicBoolean timerStarted = new AtomicBoolean(false); public EventCorrelator(EventCorrelatorCallback callback, MessageInfoMapping messageInfoMapping, MuleContext context) { if (callback == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("EventCorrelatorCallback").getMessage()); } if (messageInfoMapping == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("MessageInfoMapping").getMessage()); } if (context == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("MuleContext").getMessage()); } this.callback = callback; this.messageInfoMapping = messageInfoMapping; this.context = context; } public void enableTimeoutMonitor() throws WorkException { if (!timerStarted.get()) { this.context.getWorkManager().scheduleWork(new Work() { public void release() { //no op } public void run() { while (true) { List expired = new ArrayList(1); for (Iterator iterator = eventGroups.values().iterator(); iterator.hasNext();) { EventGroup group = (EventGroup) iterator.next(); if ((group.getCreated() + getTimeout()) < System.currentTimeMillis()) { expired.add(group); } } if (expired.size() > 0) { for (Iterator iterator = expired.iterator(); iterator.hasNext();) { EventGroup group = (EventGroup) iterator.next(); eventGroups.remove(group.getGroupId()); locks.remove(group.getGroupId()); context.fireNotification(new RoutingNotification(group.toMessageCollection(), null, RoutingNotification.CORRELATION_TIMEOUT)); // if(isFailOnTimeout()) // { group.toArray()[0].getService().getExceptionListener().exceptionThrown( new CorrelationTimeoutException(CoreMessages.correlationTimedOut(group.getGroupId()), group.toMessageCollection())); // } // else // { // //We could invoke a callback on the compoennt here or just dispatch the events?? // } } } try { Thread.sleep(100); } catch (InterruptedException e) { break; } } } } ); } } /** * @return * @deprecated this is used by a test, but I would like to remove this method */ public Map getResponseMessages() { return Collections.unmodifiableMap(responseMessages); } public MuleMessage process(MuleEvent event) throws RoutingException { addEvent(event); Object correlationId = messageInfoMapping.getCorrelationId(event.getMessage()); if (locks.get(correlationId) != null) { locks.remove(correlationId); return (MuleMessage) responseMessages.remove(correlationId); } else { return null; } } public void addEvent(MuleEvent event) throws RoutingException { // the correlationId of the event's message final Object groupId = messageInfoMapping.getCorrelationId(event.getMessage()); if (groupId == null || groupId.equals("-1")) { throw new RoutingException(CoreMessages.noCorrelationId(), event.getMessage(), event .getEndpoint()); } // indicates interleaved EventGroup removal (very rare) boolean lookupMiss = false; // spinloop for the EventGroup lookup while (true) { if (lookupMiss) { try { // recommended over Thread.yield() Thread.sleep(1); } catch (InterruptedException interrupted) { Thread.currentThread().interrupt(); } } if (isGroupAlreadyProcessed(groupId)) { if (logger.isDebugEnabled()) { logger.debug("An event was received for an event group that has already been processed, " + "this is probably because the async-reply timed out. Correlation Id is: " + groupId + ". Dropping event"); } //Fire a notification to say we received this message context.fireNotification(new RoutingNotification(event.getMessage(), event.getEndpoint().getEndpointURI().toString(), RoutingNotification.MISSED_ASYNC_REPLY)); return; } // check for an existing group first EventGroup group = this.getEventGroup(groupId); // does the group exist? if (group == null) { // ..apparently not, so create a new one & add it group = this.addEventGroup(callback.createEventGroup(event, groupId)); } // ensure that only one thread at a time evaluates this EventGroup synchronized (group) { // make sure no other thread removed the group in the meantime if (group != this.getEventGroup(groupId)) { // if that is the (rare) case, spin lookupMiss = true; continue; } if (logger.isDebugEnabled()) { logger.debug("Adding event to response aggregator group: " + groupId); } // add the incoming event to the group group.addEvent(event); // check to see if the event group is ready to be aggregated if (callback.shouldAggregateEvents(group)) { // create the response message MuleMessage returnMessage = callback.aggregateEvents(group); // remove the eventGroup as no further message will be received // for this group once we aggregate this.removeEventGroup(group); // add the new response message so that it can be collected by // the response Thread MuleMessage previousResult = (MuleMessage) responseMessages.putIfAbsent(groupId, returnMessage); if (previousResult != null) { // this would indicate that we need a better way to prevent // continued aggregation for a group that is currently being // processed. Can this actually happen? throw new IllegalStateException( "Detected duplicate aggregation result message with id: " + groupId); } // will get/create a latch for the response Message ID and // release it, notifying other threads that the response message // is available Latch l = (Latch) locks.get(groupId); if (l == null) { if (logger.isDebugEnabled()) { logger.debug("Creating latch for " + groupId + " in " + this); } l = new Latch(); Latch previous = (Latch) locks.putIfAbsent(groupId, l); if (previous != null) { l = previous; } } l.countDown(); } // result or not: exit spinloop break; } } } /** * @see org.mule.routing.inbound.AbstractEventAggregator#getEventGroup(Object) */ protected EventGroup getEventGroup(Object groupId) { return (EventGroup) eventGroups.get(groupId); } /** * @see org.mule.routing.inbound.AbstractEventAggregator#addEventGroup(EventGroup) */ protected EventGroup addEventGroup(EventGroup group) { EventGroup previous = (EventGroup) eventGroups.putIfAbsent(group.getGroupId(), group); // a parallel thread might have removed the EventGroup already, // therefore we need to validate our current reference return (previous != null ? previous : group); } /** * @see org.mule.routing.inbound.AbstractEventAggregator#removeEventGroup(EventGroup) */ protected void removeEventGroup(EventGroup group) { eventGroups.remove(group.getGroupId()); addProcessedGroup(group.getGroupId()); } protected void addProcessedGroup(Object id) { if (processedGroups.isFull()) { processedGroups.remove(); } processedGroups.add(id); } protected boolean isGroupAlreadyProcessed(Object id) { return processedGroups.contains(id); } /** * This method is called by the responding callee thread and should return the * aggregated response message * * @param message * @return * @throws RoutingException */ public MuleMessage getResponse(MuleMessage message) throws RoutingException { return getResponse(message, getTimeout()); } /** * This method is called by the responding callee thread and should return the * aggregated response message * * @param message * @return * @throws RoutingException */ public MuleMessage getResponse(MuleMessage message, int timeout) throws RoutingException { Object responseId = messageInfoMapping.getMessageId(message); if (logger.isDebugEnabled()) { logger.debug("Waiting for response for message id: " + responseId + " in " + this); } Latch l = (Latch) locks.get(responseId); if (l == null) { if (logger.isDebugEnabled()) { logger.debug("Got response but no one is waiting for it yet. Creating latch for " + responseId + " in " + this); } l = new Latch(); Latch previous = (Latch) locks.putIfAbsent(responseId, l); if (previous != null) { l = previous; } } if (logger.isDebugEnabled()) { logger.debug("Got latch for message: " + responseId); } // the final result message MuleMessage result; // indicates whether the result message could be obtained in the required // timeout interval boolean resultAvailable = false; // flag for catching the interrupted status of the Thread waiting for a // result boolean interruptedWhileWaiting = false; try { if (logger.isDebugEnabled()) { logger.debug("Waiting for response to message: " + responseId); } // how long should we wait for the lock? if (this.getTimeout() <= 0) { l.await(); resultAvailable = true; } else { resultAvailable = l.await(timeout, TimeUnit.MILLISECONDS); } } catch (InterruptedException e) { interruptedWhileWaiting = true; } finally { locks.remove(responseId); result = (MuleMessage) responseMessages.remove(responseId); if (interruptedWhileWaiting) { Thread.currentThread().interrupt(); } } if (!resultAvailable) { if (isFailOnTimeout()) { if (logger.isTraceEnabled()) { logger.trace("Current responses are: \n" + MapUtils.toString(responseMessages, true)); } context.fireNotification(new RoutingNotification(message, null, RoutingNotification.ASYNC_REPLY_TIMEOUT)); throw new ResponseTimeoutException( CoreMessages.responseTimedOutWaitingForId( this.getTimeout(), responseId), message, null); } else { EventGroup group = this.getEventGroup(responseId); if (group == null) { //Unlikely this will ever happen if (logger.isTraceEnabled()) { logger.trace("There is no current event Group. Current responses are: \n" + MapUtils.toString(responseMessages, true)); } return null; } else { this.removeEventGroup(group); // create the response message MuleMessage msg = callback.aggregateEvents(group); return msg; } } } if (result == null) { // this should never happen, just using it as a safe guard for now throw new IllegalStateException("Response Message is null"); } if (logger.isDebugEnabled()) { logger.debug("remaining locks : " + locks.keySet()); logger.debug("remaining results: " + responseMessages.keySet()); } return result; } public boolean isFailOnTimeout() { return failOnTimeout; } public void setFailOnTimeout(boolean failOnTimeout) { this.failOnTimeout = failOnTimeout; } public int getTimeout() { return timeout; } public void setTimeout(int timeout) { this.timeout = timeout; } } mule-2.0.1/core/src/main/java/org/mule/routing/CorrelationTimeoutException.java0000644000175000017500000000226710777661265027506 0ustar charlescharles/* * $Id: CorrelationTimeoutException.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.config.i18n.Message; /** * TODO */ public class CorrelationTimeoutException extends MessagingException { public CorrelationTimeoutException(Message message, Object payload) { super(message, payload); } public CorrelationTimeoutException(Message message, Object payload, Throwable cause) { super(message, payload, cause); } public CorrelationTimeoutException(Message message, MuleMessage umoMessage) { super(message, umoMessage); } public CorrelationTimeoutException(Message message, MuleMessage umoMessage, Throwable cause) { super(message, umoMessage, cause); } } mule-2.0.1/core/src/main/java/org/mule/routing/AbstractCatchAllStrategy.java0000644000175000017500000000317110757615756026656 0ustar charlescharles/* * $Id: AbstractCatchAllStrategy.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.RouterCatchAllStrategy; import org.mule.management.stats.RouterStatistics; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * ForwardingCatchAllStrategy acts as a catch and forward router for any * events not caught by the router this strategy is associated with. Users can assign an * endpoint to this strategy to forward all events to. This is similar to a dead letter * queue in messaging. */ public abstract class AbstractCatchAllStrategy implements RouterCatchAllStrategy { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); protected OutboundEndpoint endpoint; protected RouterStatistics statistics; public void setEndpoint(OutboundEndpoint endpoint) { this.endpoint = endpoint; } public OutboundEndpoint getEndpoint() { return endpoint; } public RouterStatistics getStatistics() { return statistics; } public void setStatistics(RouterStatistics statistics) { this.statistics = statistics; } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/0000755000175000017500000000000011351411110022727 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/routing/outbound/ChainingRouter.java0000644000175000017500000001534310757615756026560 0ustar charlescharles/* * $Id: ChainingRouter.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.CouldNotRouteOutboundMessageException; import org.mule.api.routing.RoutePathNotFoundException; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.CoreMessages; import org.mule.transport.NullPayload; /** * ChainingRouter is used to pass a Mule event through multiple * endpoints using the result of the first as the input for the second. */ public class ChainingRouter extends FilteringOutboundRouter { public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { MuleMessage resultToReturn = null; if (endpoints == null || endpoints.size() == 0) { throw new RoutePathNotFoundException(CoreMessages.noEndpointsForRouter(), message, null); } final int endpointsCount = endpoints.size(); if (logger.isDebugEnabled()) { logger.debug("About to chain " + endpointsCount + " endpoints."); } // need that ref for an error message OutboundEndpoint endpoint = null; try { MuleMessage intermediaryResult = message; for (int i = 0; i < endpointsCount; i++) { endpoint = getEndpoint(i, intermediaryResult); // if it's not the last endpoint in the chain, // enforce the synchronous call, otherwise we lose response boolean lastEndpointInChain = (i == endpointsCount - 1); if (logger.isDebugEnabled()) { logger.debug("Sending Chained message '" + i + "': " + (intermediaryResult == null ? "null" : intermediaryResult.toString())); } if (!lastEndpointInChain) { MuleMessage localResult = send(session, intermediaryResult, endpoint); // Need to propagate correlation info and replyTo, because there // is no guarantee that an external system will preserve headers // (in fact most will not) if (localResult != null && // null result can be wrapped in a NullPayload localResult.getPayload() != NullPayload.getInstance() && intermediaryResult != null) { processIntermediaryResult(localResult, intermediaryResult); } intermediaryResult = localResult; if (logger.isDebugEnabled()) { logger.debug("Received Chain result '" + i + "': " + (intermediaryResult != null ? intermediaryResult.toString() : "null")); } if (intermediaryResult == null || intermediaryResult.getPayload() == NullPayload.getInstance()) { // if there was an error in the first link of the chain, make sure we propagate back // any exception payloads alongside the NullPayload resultToReturn = intermediaryResult; logger.warn("Chaining router cannot process any further endpoints. " + "There was no result returned from endpoint invocation: " + endpoint); break; } } else { // ok, the last call, // use the 'sync/async' method parameter if (synchronous) { resultToReturn = send(session, intermediaryResult, endpoint); if (logger.isDebugEnabled()) { logger.debug("Received final Chain result '" + i + "': " + (resultToReturn == null ? "null" : resultToReturn.toString())); } } else { // reset the previous call result to avoid confusion resultToReturn = null; dispatch(session, intermediaryResult, endpoint); } } } } catch (MuleException e) { throw new CouldNotRouteOutboundMessageException(message, endpoint, e); } return resultToReturn; } // public void addEndpoint(Endpoint endpoint) // { // if (!endpoint.isRemoteSync()) // { // logger.debug("Endpoint: " // + endpoint.getEndpointURI() // + " registered on chaining router needs to be RemoteSync enabled. Setting this property now"); // endpoint.setRemoteSync(true); // } // super.addEndpoint(endpoint); // } /** * Process intermediary result of invocation. The method will be invoked * only if both local and intermediary results are available * (not null). *

    * Overriding methods must call super(localResult, intermediaryResult), * unless they are modifying the correlation workflow (if you know what that means, * you know what you are doing and when to do it). *

    * Default implementation propagates * the following properties: *

      *
    • correlationId *
    • correlationSequence *
    • correlationGroupSize *
    • replyTo *
    * @param localResult result of the last endpoint invocation * @param intermediaryResult the message travelling across the endpoints */ protected void processIntermediaryResult(MuleMessage localResult, MuleMessage intermediaryResult) { localResult.setCorrelationId(intermediaryResult.getCorrelationId()); localResult.setCorrelationSequence(intermediaryResult.getCorrelationSequence()); localResult.setCorrelationGroupSize(intermediaryResult.getCorrelationGroupSize()); localResult.setReplyTo(intermediaryResult.getReplyTo()); } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/AbstractMessageSplitter.java0000644000175000017500000001413410771035311030406 0ustar charlescharles/* * $Id: AbstractMessageSplitter.java 11475 2008-03-21 22:46:33Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.CouldNotRouteOutboundMessageException; import org.mule.api.routing.RoutingException; import java.util.Iterator; import java.util.List; /** * AbstractMessageSplitter is an outbound Message Splitter used to split * the contents of a received message into sub parts that can be processed by other * components. Each Part is fired as a separate event to each endpoint on the router. The * endpoints can have filters on them to receive only certain message parts. */ public abstract class AbstractMessageSplitter extends FilteringOutboundRouter { // Determines if the same endpoint will be matched multiple times until a // match is not found. This should be set by overriding classes. protected boolean multimatch = true; // flag which, if true, makes the splitter honour settings such as remoteSync and // synchronous on the endpoint protected boolean honorSynchronicity = false; public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { String correlationId = messageInfoMapping.getCorrelationId(message); this.initialise(message); OutboundEndpoint endpoint; MuleMessage result = null; List list = getEndpoints(); int correlationSequence = 1; for (Iterator iterator = list.iterator(); iterator.hasNext();) { endpoint = (OutboundEndpoint) iterator.next(); message = getMessagePart(message, endpoint); // TODO MULE-1378 if (message == null) { // Log a warning if there are no messages for a given endpoint logger.warn("Message part is null for endpoint: " + endpoint.getEndpointURI().toString()); } // We'll keep looping to get all messages for the current endpoint // before moving to the next endpoint // This can be turned off by setting the multimatch flag to false while (message != null) { if (honorSynchronicity) { synchronous = endpoint.isSynchronous(); } try { if (enableCorrelation != ENABLE_CORRELATION_NEVER) { boolean correlationSet = message.getCorrelationId() != null; if (!correlationSet && (enableCorrelation == ENABLE_CORRELATION_IF_NOT_SET)) { message.setCorrelationId(correlationId); } // take correlation group size from the message // properties, set by concrete message splitter // implementations final int groupSize = message.getCorrelationGroupSize(); message.setCorrelationGroupSize(groupSize); message.setCorrelationSequence(correlationSequence++); } if (honorSynchronicity) { message.setBooleanProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, endpoint.isRemoteSync()); } if (synchronous) { result = send(session, message, endpoint); } else { dispatch(session, message, endpoint); } } catch (MuleException e) { throw new CouldNotRouteOutboundMessageException(message, endpoint, e); } if (!multimatch) { break; } message = this.getMessagePart(message, endpoint); } } // we are done with splitting & routing this.cleanup(); return result; } public boolean isHonorSynchronicity() { return honorSynchronicity; } /** * Sets the flag indicating whether the splitter honurs endpoint settings * * @param honorSynchronicity flag setting */ public void setHonorSynchronicity(boolean honorSynchronicity) { this.honorSynchronicity = honorSynchronicity; } /** * This method can be implemented to split the message up before * {@link #getMessagePart(MuleMessage, OutboundEndpoint)} method is called. * * @param message the message being routed */ protected abstract void initialise(MuleMessage message); /** * Retrieves a specific message part for the given endpoint. the message will then be * routed via the provider.

    NOTE:Implementations must provide * proper synchronization for shared state (payload, properties, etc.) * * @param message the current message being processed * @param endpoint the endpoint that will be used to route the resulting message part * @return the message part to dispatch */ protected abstract MuleMessage getMessagePart(MuleMessage message, OutboundEndpoint endpoint); /** * This method is called after all parts of the original message have been processed; * typically this is the case after {@link #getMessagePart(MuleMessage, OutboundEndpoint)} * returned null. */ protected abstract void cleanup(); } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/package.html0000644000175000017500000000025510204257011025216 0ustar charlescharles Outbound router implementation as described in the Enterprise Integration Patterns book. mule-2.0.1/core/src/main/java/org/mule/routing/outbound/StaticRecipientList.java0000644000175000017500000000463210745677442027561 0ustar charlescharles/* * $Id: StaticRecipientList.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.MuleMessage; import org.mule.util.StringUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * StaticRecipientList is used to dispatch a single event to multiple * recipients over the same transport. The recipient endpoints for this router can be * configured statically on the router itself. */ public class StaticRecipientList extends AbstractRecipientList { public static final String RECIPIENTS_PROPERTY = "recipients"; public static final String RECIPIENT_DELIMITER = ","; private volatile List recipients = Collections.EMPTY_LIST; protected List getRecipients(MuleMessage message) { Object msgRecipients = message.removeProperty(RECIPIENTS_PROPERTY); if (msgRecipients == null) { return recipients; } else if (msgRecipients instanceof String) { return Arrays.asList(StringUtils.splitAndTrim(msgRecipients.toString(), this.getListDelimiter())); } else if (msgRecipients instanceof List) { return new ArrayList((List) msgRecipients); } else { logger.warn("Recipients on message are neither String nor List but: " + msgRecipients.getClass()); return Collections.EMPTY_LIST; } } public List getRecipients() { return recipients; } public void setRecipients(List recipients) { if (recipients != null) { this.recipients = new ArrayList(recipients); } else { this.recipients = Collections.EMPTY_LIST; } } /** * Overloading classes can change the delimiter used to separate entries in the * recipient list. By default a ',' is used. * * @return The list delimiter to use */ protected String getListDelimiter() { return RECIPIENT_DELIMITER; } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/AbstractRecipientList.java0000644000175000017500000001526710771256731030074 0ustar charlescharles/* * $Id: AbstractRecipientList.java 11484 2008-03-22 19:28:25Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.MuleServer; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.registry.RegistrationException; import org.mule.api.routing.CouldNotRouteOutboundMessageException; import org.mule.api.routing.RoutingException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractRecipientList is used to dispatch a single event to * multiple recipients over the same transport. The recipient endpoints can be * configured statically or can be obtained from the message payload. */ public abstract class AbstractRecipientList extends FilteringOutboundRouter { /** * logger used by this class */ protected final Log logger = LogFactory.getLog(getClass()); private final ConcurrentMap recipientCache = new ConcurrentHashMap(); private Boolean synchronous; public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { if(this.synchronous!=null) { synchronous = this.synchronous.booleanValue(); } List recipients = this.getRecipients(message); List results = new ArrayList(); if (enableCorrelation != ENABLE_CORRELATION_NEVER) { boolean correlationSet = message.getCorrelationGroupSize() != -1; if (correlationSet && (enableCorrelation == ENABLE_CORRELATION_IF_NOT_SET)) { logger.debug("CorrelationId is already set, not setting Correlation group size"); } else { // the correlationId will be set by the AbstractOutboundRouter message.setCorrelationGroupSize(recipients.size()); } } MuleMessage result = null; OutboundEndpoint endpoint; MuleMessage request; for (Iterator iterator = recipients.iterator(); iterator.hasNext();) { Object recipient = iterator.next(); // Make a copy of the message. Question is do we do a proper clone? in // which case there // would potentially be multiple messages with the same id... request = new DefaultMuleMessage(message.getPayload(), message); endpoint = this.getRecipientEndpoint(request, recipient); try { if (synchronous) { result = this.send(session, request, endpoint); if (result != null) { results.add(result.getPayload()); } else { if (logger.isDebugEnabled()) { logger.debug("No result was returned for sync call to: " + endpoint.getEndpointURI()); } } } else { this.dispatch(session, request, endpoint); } } catch (MuleException e) { throw new CouldNotRouteOutboundMessageException(request, endpoint, e); } } if (results.size() == 0) { return null; } else if (results.size() == 1) { return new DefaultMuleMessage(results.get(0), result); } else { return new DefaultMuleMessage(results, result); } } protected OutboundEndpoint getRecipientEndpoint(MuleMessage message, Object recipient) throws RoutingException { OutboundEndpoint endpoint = null; try { if (recipient instanceof EndpointURI) { endpoint = getRecipientEndpointFromUri((EndpointURI) recipient); } else if (recipient instanceof String) { endpoint = getRecipientEndpointFromString(message, (String) recipient); } if (null == endpoint) { throw new RegistrationException("Failed to create endpoint for: " + recipient); } OutboundEndpoint existingEndpoint = (OutboundEndpoint) recipientCache.putIfAbsent(recipient, endpoint); if (existingEndpoint != null) { endpoint = existingEndpoint; } } catch (MuleException e) { throw new RoutingException(message, endpoint, e); } return endpoint; } protected OutboundEndpoint getRecipientEndpointFromUri(EndpointURI uri) throws MuleException { OutboundEndpoint endpoint = null; if (null != getMuleContext() && null != getMuleContext().getRegistry()) { endpoint = getMuleContext().getRegistry().lookupEndpointFactory().getOutboundEndpoint(uri.getAddress()); } if (null != endpoint) { MuleServer.getMuleContext().applyLifecycle(endpoint); } return endpoint; } protected OutboundEndpoint getRecipientEndpointFromString(MuleMessage message, String recipient) throws MuleException { OutboundEndpoint endpoint = (OutboundEndpoint) recipientCache.get(recipient); if (null == endpoint && null != getMuleContext() && null != getMuleContext().getRegistry()) { endpoint = getMuleContext().getRegistry().lookupEndpointFactory().getOutboundEndpoint(recipient); } return endpoint; } public Boolean getSynchronous() { return synchronous; } public void setSynchronous(Boolean synchronous) { this.synchronous = synchronous; } public boolean isDynamicEndpoints() { return true; } protected abstract List getRecipients(MuleMessage message); } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/FilteringOutboundRouter.java0000644000175000017500000001435710757615756030507 0ustar charlescharles/* * $Id: FilteringOutboundRouter.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.CouldNotRouteOutboundMessageException; import org.mule.api.routing.RoutePathNotFoundException; import org.mule.api.routing.RoutingException; import org.mule.api.routing.filter.Filter; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; import org.mule.endpoint.DynamicURIOutboundEndpoint; import org.mule.endpoint.MuleEndpointURI; import org.mule.util.TemplateParser; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; /** * FilteringRouter is a router that accepts events based on a filter * set. */ public class FilteringOutboundRouter extends AbstractOutboundRouter { private List transformers = new LinkedList(); private Filter filter; private boolean useTemplates = false; // We used Square templates as they can exist as part of an URI. private TemplateParser parser = TemplateParser.createSquareBracesStyleParser(); public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { MuleMessage result = null; if (endpoints == null || endpoints.size() == 0) { throw new RoutePathNotFoundException(CoreMessages.noEndpointsForRouter(), message, null); } OutboundEndpoint ep = getEndpoint(0, message); try { if (synchronous) { result = send(session, message, ep); } else { dispatch(session, message, ep); } } catch (MuleException e) { throw new CouldNotRouteOutboundMessageException(message, ep, e); } return result; } public Filter getFilter() { return filter; } public void setFilter(Filter filter) { this.filter = filter; } public boolean isMatch(MuleMessage message) throws RoutingException { if (getFilter() == null) { return true; } try { message.applyTransformers(transformers); } catch (TransformerException e) { throw new RoutingException( CoreMessages.transformFailedBeforeFilter(), message, (ImmutableEndpoint) endpoints.get(0), e); } return getFilter().accept(message); } public List getTransformers() { return transformers; } public void setTransformers(List transformers) { this.transformers = transformers; } public void addEndpoint(OutboundEndpoint endpoint) { if (!useTemplates && parser.isContainsTemplate(endpoint.getEndpointURI().toString())) { useTemplates = true; } super.addEndpoint(endpoint); } /** * Will Return the endpont at the given index and will resolve any template tags * on the Endpoint URI if necessary * * @param index the index of the endpoint to get * @param message the current message. This is required if template matching is * being used * @return the endpoint at the index, with any template tags resolved * @throws CouldNotRouteOutboundMessageException if the template causs the * endpoint to become illegal or malformed */ public OutboundEndpoint getEndpoint(int index, MuleMessage message) throws CouldNotRouteOutboundMessageException { if (!useTemplates) { return (OutboundEndpoint) endpoints.get(index); } else { OutboundEndpoint ep = (OutboundEndpoint) endpoints.get(index); String uri = ep.getEndpointURI().toString(); if (logger.isDebugEnabled()) { logger.debug("Uri before parsing is: " + uri); } Map props = new HashMap(); // Also add the endpoint propertie so that users can set fallback values // when the property is not set on the event props.putAll(ep.getProperties()); for (Iterator iterator = message.getPropertyNames().iterator(); iterator.hasNext();) { String propertyKey = (String) iterator.next(); props.put(propertyKey, message.getProperty(propertyKey)); } String newUriString = parser.parse(props, uri); if (logger.isDebugEnabled()) { logger.debug("Uri after parsing is: " + uri); } try { EndpointURI newUri = new MuleEndpointURI(newUriString); if (!newUri.getScheme().equalsIgnoreCase(ep.getEndpointURI().getScheme())) { throw new CouldNotRouteOutboundMessageException(CoreMessages.schemeCannotChangeForRouter( ep.getEndpointURI().getScheme(), newUri.getScheme()), message, ep); } return new DynamicURIOutboundEndpoint(ep, newUri); } catch (EndpointException e) { throw new CouldNotRouteOutboundMessageException( CoreMessages.templateCausedMalformedEndpoint(uri, newUriString), message, ep, e); } } } public boolean isUseTemplates() { return useTemplates; } public void setUseTemplates(boolean useTemplates) { this.useTemplates = useTemplates; } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/TransformerRouter.java0000644000175000017500000000375110745677442027337 0ustar charlescharles/* * $Id: TransformerRouter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.RoutingException; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.config.i18n.CoreMessages; /** * Simply applies a transformer before continuing on to the next router. * This can be useful with the {@link ChainingRouter}. */ public class TransformerRouter extends AbstractOutboundRouter { private Transformer transformer; public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws MessagingException { if (transformer != null) { try { Object payload = transformer.transform(message.getPayload()); message = new DefaultMuleMessage(payload, message); } catch (TransformerException e) { throw new RoutingException( CoreMessages.transformFailedBeforeFilter(), message, (ImmutableEndpoint)endpoints.get(0), e); } } return message; } public boolean isMatch(MuleMessage message) throws MessagingException { return true; } public Transformer getTransformer() { return transformer; } public void setTransformer(Transformer transformer) { this.transformer = transformer; } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/AbstractOutboundRouter.java0000644000175000017500000002540110777661265030315 0ustar charlescharles/* * $Id: AbstractOutboundRouter.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InvalidEndpointTypeException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.MessageInfoMapping; import org.mule.api.routing.OutboundRouter; import org.mule.api.transaction.TransactionConfig; import org.mule.config.i18n.CoreMessages; import org.mule.routing.AbstractRouter; import org.mule.routing.MuleMessageInfoMapping; import org.mule.util.StringMessageUtils; import org.mule.util.SystemUtils; import java.util.Iterator; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractOutboundRouter is a base router class that tracks * statistics about message processing through the router. * */ public abstract class AbstractOutboundRouter extends AbstractRouter implements OutboundRouter { public static final int ENABLE_CORRELATION_IF_NOT_SET = 0; public static final int ENABLE_CORRELATION_ALWAYS = 1; public static final int ENABLE_CORRELATION_NEVER = 2; /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); protected List endpoints = new CopyOnWriteArrayList(); protected String replyTo = null; protected int enableCorrelation = ENABLE_CORRELATION_IF_NOT_SET; protected MessageInfoMapping messageInfoMapping = new MuleMessageInfoMapping(); protected TransactionConfig transactionConfig; public void dispatch(MuleSession session, MuleMessage message, OutboundEndpoint endpoint) throws MuleException { setMessageProperties(session, message, endpoint); if (logger.isDebugEnabled()) { try { logger.debug("Message being sent to: " + endpoint.getEndpointURI() + " Message payload: \n" + StringMessageUtils.truncate(message.getPayloadAsString(), 100, false) + "\n outbound transformer is: " + endpoint.getTransformers()); } catch (Exception e) { logger.debug("Message being sent to: " + endpoint.getEndpointURI() + " Message payload: \n(unable to retrieve payload: " + e.getMessage() + "\n outbound transformer is: " + endpoint.getTransformers()); } } session.dispatchEvent(message, endpoint); if (getRouterStatistics() != null) { if (getRouterStatistics().isEnabled()) { getRouterStatistics().incrementRoutedMessage(endpoint); } } } public MuleMessage send(MuleSession session, MuleMessage message, OutboundEndpoint endpoint) throws MuleException { if (replyTo != null) { logger.debug("event was dispatched synchronously, but there is a ReplyTo endpoint set, so using asynchronous dispatch"); dispatch(session, message, endpoint); return null; } this.setMessageProperties(session, message, endpoint); if (logger.isDebugEnabled()) { logger.debug("Message being sent to: " + endpoint.getEndpointURI()); logger.debug(message); } if (logger.isTraceEnabled()) { try { logger.trace("Message payload: \n" + message.getPayloadAsString()); } catch (Exception e) { // ignore } } MuleMessage result = session.sendEvent(message, endpoint); if (getRouterStatistics() != null) { if (getRouterStatistics().isEnabled()) { getRouterStatistics().incrementRoutedMessage(endpoint); } } if (logger.isDebugEnabled()) { logger.debug("Response message from sending to: " + endpoint.getEndpointURI()); logger.debug(result); } if (logger.isTraceEnabled()) { try { logger.trace("Message payload: \n" + result.getPayloadAsString()); } catch (Exception e) { // ignore } } return result; } protected void setMessageProperties(MuleSession session, MuleMessage message, OutboundEndpoint endpoint) { if (replyTo != null) { // if replyTo is set we'll probably want the correlationId set as // well message.setReplyTo(replyTo); message.setProperty(MuleProperties.MULE_REPLY_TO_REQUESTOR_PROPERTY, session.getService().getName()); if (logger.isDebugEnabled()) { logger.debug("Setting replyTo=" + replyTo + " for outbound endpoint: " + endpoint.getEndpointURI()); } } if (enableCorrelation != ENABLE_CORRELATION_NEVER) { boolean correlationSet = message.getCorrelationId() != null; if (correlationSet && (enableCorrelation == ENABLE_CORRELATION_IF_NOT_SET)) { if (logger.isDebugEnabled()) { logger.debug("CorrelationId is already set to '" + message.getCorrelationId() + "' , not setting it again"); } return; } else if (correlationSet) { if (logger.isDebugEnabled()) { logger.debug("CorrelationId is already set to '" + message.getCorrelationId() + "', but router is configured to overwrite it"); } } else { if (logger.isDebugEnabled()) { logger.debug("No CorrelationId is set on the message, will set a new Id"); } } String correlation; correlation = messageInfoMapping.getCorrelationId(message); if (logger.isDebugEnabled()) { logger.debug("Extracted correlation Id as: " + correlation); } if (logger.isDebugEnabled()) { StringBuffer buf = new StringBuffer(); buf.append("Setting Correlation info on Outbound router for endpoint: ").append( endpoint.getEndpointURI()); buf.append(SystemUtils.LINE_SEPARATOR).append("Id=").append(correlation); // buf.append(", ").append("Seq=").append(seq); // buf.append(", ").append("Group Size=").append(group); logger.debug(buf.toString()); } message.setCorrelationId(correlation); // message.setCorrelationGroupSize(group); // message.setCorrelationSequence(seq); } } public List getEndpoints() { return endpoints; } public void setEndpoints(List endpoints) { this.endpoints.clear(); // this.endpoints = new CopyOnWriteArrayList(endpoints); for (Iterator iterator = endpoints.iterator(); iterator.hasNext();) { ImmutableEndpoint umoEndpoint = (ImmutableEndpoint) iterator.next(); if (!(umoEndpoint instanceof OutboundEndpoint)) { throw new InvalidEndpointTypeException(CoreMessages.outboundRouterMustUseOutboudEndpoints( this, umoEndpoint)); } else{ addEndpoint((OutboundEndpoint) umoEndpoint); } } } public void addEndpoint(OutboundEndpoint endpoint) { endpoints.add(endpoint); } public boolean removeEndpoint(OutboundEndpoint endpoint) { return endpoints.remove(endpoint); } public String getReplyTo() { return replyTo; } public void setReplyTo(String replyTo) { this.replyTo = replyTo; } public int getEnableCorrelation() { return enableCorrelation; } public void setEnableCorrelation(int enableCorrelation) { this.enableCorrelation = enableCorrelation; } public void setEnableCorrelationAsString(String enableCorrelation) { if (enableCorrelation != null) { if (enableCorrelation.equals("ALWAYS")) { this.enableCorrelation = ENABLE_CORRELATION_ALWAYS; } else if (enableCorrelation.equals("NEVER")) { this.enableCorrelation = ENABLE_CORRELATION_NEVER; } else if (enableCorrelation.equals("IF_NOT_SET")) { this.enableCorrelation = ENABLE_CORRELATION_IF_NOT_SET; } else { throw new IllegalArgumentException("Value for enableCorrelation not recognised: " + enableCorrelation); } } } public MessageInfoMapping getMessageInfoMapping() { return messageInfoMapping; } public void setMessageInfoMapping(MessageInfoMapping messageInfoMapping) { this.messageInfoMapping = messageInfoMapping; } public TransactionConfig getTransactionConfig() { return transactionConfig; } public void setTransactionConfig(TransactionConfig transactionConfig) { this.transactionConfig = transactionConfig; } public boolean isDynamicEndpoints() { return false; } /** * @param name the Endpoint identifier * @return the Endpoint or null if the endpointUri is not registered * @see org.mule.api.routing.InboundRouterCollection */ public OutboundEndpoint getEndpoint(String name) { OutboundEndpoint endpointDescriptor; for (Iterator iterator = endpoints.iterator(); iterator.hasNext();) { endpointDescriptor = (OutboundEndpoint)iterator.next(); if (endpointDescriptor.getName().equals(name)) { return endpointDescriptor; } } return null; } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/DefaultOutboundRouterCollection.java0000644000175000017500000001063110757615756032153 0ustar charlescharles/* * $Id: DefaultOutboundRouterCollection.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.routing.OutboundRouter; import org.mule.api.routing.OutboundRouterCollection; import org.mule.api.routing.RoutingException; import org.mule.api.service.Service; import org.mule.api.transaction.TransactionCallback; import org.mule.management.stats.RouterStatistics; import org.mule.routing.AbstractRouterCollection; import org.mule.transaction.TransactionTemplate; import java.util.Iterator; /** * DefaultOutboundRouterCollection is a container of routers. An * DefaultOutboundRouterCollection must have atleast one router. By default the first matching * router is used to route an event though it is possible to match on all routers * meaning that the message will get sent over all matching routers. */ public class DefaultOutboundRouterCollection extends AbstractRouterCollection implements OutboundRouterCollection { public DefaultOutboundRouterCollection() { super(RouterStatistics.TYPE_OUTBOUND); } public MuleMessage route(final MuleMessage message, final MuleSession session, final boolean synchronous) throws MessagingException { MuleMessage result; boolean matchfound = false; for (Iterator iterator = getRouters().iterator(); iterator.hasNext();) { OutboundRouter umoOutboundRouter = (OutboundRouter) iterator.next(); if (umoOutboundRouter.isMatch(message)) { matchfound = true; // Manage outbound only transactions here final OutboundRouter router = umoOutboundRouter; Service service = session.getService(); TransactionTemplate tt = new TransactionTemplate(umoOutboundRouter.getTransactionConfig(), service.getExceptionListener(), muleContext); TransactionCallback cb = new TransactionCallback() { public Object doInTransaction() throws Exception { return router.route(message, session, synchronous); } }; try { result = (MuleMessage) tt.execute(cb); } catch (Exception e) { throw new RoutingException(message, null, e); } if (!isMatchAll()) { return result; } } } if (!matchfound && getCatchAllStrategy() != null) { if (logger.isDebugEnabled()) { logger.debug("Message did not match any routers on: " + session.getService().getName() + " invoking catch all strategy"); } return catchAll(message, session, synchronous); } else if (!matchfound) { logger.warn("Message did not match any routers on: " + session.getService().getName() + " and there is no catch all strategy configured on this router. Disposing message " + message); } return message; } protected MuleMessage catchAll(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { if (getStatistics().isEnabled()) { getStatistics().incrementCaughtMessage(); } return getCatchAllStrategy().catchMessage(message, session, synchronous); } public boolean hasEndpoints() { for (Iterator iterator = routers.iterator(); iterator.hasNext();) { OutboundRouter router = (OutboundRouter) iterator.next(); if (router.getEndpoints().size() > 0 || router.isDynamicEndpoints()) { return true; } } return false; } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/ExceptionBasedRouter.java0000644000175000017500000001332111004136303027673 0ustar charlescharles/* * $Id: ExceptionBasedRouter.java 11641 2008-04-24 17:00:51Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.ExceptionPayload; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.CouldNotRouteOutboundMessageException; import org.mule.api.routing.RoutePathNotFoundException; import org.mule.api.routing.RoutingException; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.CoreMessages; /** * ExceptionBasedRouter Will send the current event to the first * endpoint that doesn't throw an exception. If all attempted endpoints fail then an * exception is thrown.

    The router will override the sync/async mode of the * endpoint and force the sync mode for all endpoints except the last one. * remoteSync is also enforced. */ public class ExceptionBasedRouter extends FilteringOutboundRouter { public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { if (endpoints == null || endpoints.size() == 0) { throw new RoutePathNotFoundException(CoreMessages.noEndpointsForRouter(), message, null); } final int endpointsCount = endpoints.size(); if (enableCorrelation != ENABLE_CORRELATION_NEVER) { boolean correlationSet = message.getCorrelationId() != null; if (correlationSet && (enableCorrelation == ENABLE_CORRELATION_IF_NOT_SET)) { logger.debug("CorrelationId is already set, not setting Correlation group size"); } else { // the correlationId will be set by the AbstractOutboundRouter message.setCorrelationGroupSize(endpointsCount); } } MuleMessage result = null; // need that ref for an error message OutboundEndpoint endpoint = null; boolean success = false; synchronized (endpoints) { for (int i = 0; i < endpointsCount; i++) { // apply endpoint URI templates if any endpoint = getEndpoint(i, message); boolean lastEndpoint = (i == endpointsCount - 1); if (!lastEndpoint) { logger.info("Sync mode will be forced for " + endpoint.getEndpointURI() + ", as there are more endpoints available."); } if (!lastEndpoint || synchronous) { try { result = send(session, message, endpoint); if (!exceptionPayloadAvailable(result)) { if (logger.isDebugEnabled()) { logger.debug("Successful invocation detected, stopping further processing."); } success = true; break; } } catch (MuleException e) { if(logger.isWarnEnabled()) { Throwable t = ExceptionHelper.getRootException(e); logger.warn("Failed to send to endpoint: " + endpoint.getEndpointURI().toString() + ". Error was: " + t + ". Trying next endpoint", t); } } } else { try { dispatch(session, message, endpoint); success = true; break; } catch (MuleException e) { logger.info("Failed to dispatch to endpoint: " + endpoint.getEndpointURI().toString() + ". Error was: " + e.getMessage() + ". Trying next endpoint"); } } } } if (!success) { throw new CouldNotRouteOutboundMessageException(message, endpoint); } return result; } // public void addEndpoint(Endpoint endpoint) // { // if (!endpoint.isRemoteSync()) // { // logger.debug("Endpoint: " // + endpoint.getEndpointURI() // + " registered on ExceptionBasedRouter needs to be RemoteSync enabled. Setting this property now."); // endpoint.setRemoteSync(true); // } // super.addEndpoint(endpoint); // } /** * @param message message to check * @return true if there was an exception payload set */ protected boolean exceptionPayloadAvailable(MuleMessage message) { if (message == null) { return false; } final ExceptionPayload exceptionPayload = message.getExceptionPayload(); if (exceptionPayload != null) { logger.info("Failure returned, will try next endpoint. Exception payload is: " + exceptionPayload); return true; } else { return false; } } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/OutboundPassThroughRouter.java0000644000175000017500000000414010757615756031020 0ustar charlescharles/* * $Id: OutboundPassThroughRouter.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.RoutingException; import org.mule.api.routing.filter.Filter; import java.util.List; /** * OutboundPassThroughRouter allows outbound routing over a single * endpoint without any filtering. This class is used by Mule when a single outbound * router is set on a UMODescriptor. * */ public class OutboundPassThroughRouter extends FilteringOutboundRouter { public OutboundPassThroughRouter() { super(); } public void addEndpoint(OutboundEndpoint endpoint) { if (endpoint == null) { return; } if (endpoints.size() == 1) { throw new IllegalArgumentException("Only one endpoint can be set on the PassThrough router"); } super.addEndpoint(endpoint); } public void setEndpoints(List endpoints) { if (endpoints.size() > 1) { throw new IllegalArgumentException("Only one endpoint can be set on the PassThrough router"); } super.setEndpoints(endpoints); } public void setFilter(Filter filter) { throw new UnsupportedOperationException( "The Pass Through cannot use filters, use the FilteringOutboundRouter instead"); } public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { if (endpoints == null || endpoints.size() == 0) { return message; } return super.route(message, session, synchronous); } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/EndpointSelector.java0000644000175000017500000001451611005753365027103 0ustar charlescharles/* * $Id: EndpointSelector.java 11659 2008-04-30 02:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.context.MuleContextAware; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.CouldNotRouteOutboundMessageException; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.CoreMessages; import org.mule.util.StringUtils; import org.mule.util.expression.ExpressionEvaluatorManager; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * EndpointSelector selects the outgoing endpoint based on a * an expression evaluator ("header:endpoint" by default). It will first try to match the * endpoint by name and then by address. * The endpoints to use can be set on the router itself or be global endpoint definitions. *

     *
     * <outbound>
     *      <endpoint-selector-router evaluator="xpath" expression="/MSG/HEADER/NEXT-ADDRESS">
     *          <endpoint name="dest1" address="jms://queue1" />
     *          <endpoint name="dest2" address="jms://queue2" />
     *          <endpoint name="dest3" address="jms://queue3" />
     *      </endpoint-selector-router>
     * </outbound>
     *
     * 
    */ public class EndpointSelector extends FilteringOutboundRouter implements MuleContextAware { public static final String DEFAULT_SELECTOR_EVALUATOR = "header"; public static final String DEFAULT_SELECTOR_EXPRESSION = "endpoint"; private String expression = DEFAULT_SELECTOR_EXPRESSION; private String evaluator = DEFAULT_SELECTOR_EVALUATOR; private String customEvaluator; private String fullExpression; public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { List endpoints; String endpointName; String prop = getFullExpression(); if(!ExpressionEvaluatorManager.isValidExpression(prop)) { throw new CouldNotRouteOutboundMessageException( CoreMessages.expressionInvalidForProperty("expression", prop), message, null); } Object property = ExpressionEvaluatorManager.evaluate(prop, message); if(property ==null) { throw new CouldNotRouteOutboundMessageException( CoreMessages.propertyIsNotSetOnEvent(getFullExpression()), message, null); } if (property instanceof String) { endpoints = new ArrayList(1); endpoints.add(property); } else if(property instanceof List) { endpoints = (List)property; } else { throw new CouldNotRouteOutboundMessageException(CoreMessages.propertyIsNotSupportedType( getFullExpression(), new Class[]{String.class, List.class}, property.getClass()), message, null); } MuleMessage result = null; for (Iterator iterator = endpoints.iterator(); iterator.hasNext();) { endpointName = iterator.next().toString(); if(StringUtils.isEmpty(endpointName)) { throw new CouldNotRouteOutboundMessageException( CoreMessages.objectIsNull("Endpoint Name: " + getFullExpression()), message, null); } OutboundEndpoint ep = null; try { ep = lookupEndpoint(endpointName); if (ep == null) { throw new CouldNotRouteOutboundMessageException(CoreMessages.objectNotFound("Endpoint", endpointName), message, ep); } if (synchronous) { // TODO See MULE-2613, we only return the last message here result = send(session, message, ep); } else { dispatch(session, message, ep); } } catch (MuleException e) { throw new CouldNotRouteOutboundMessageException(message, ep, e); } } return result; } protected OutboundEndpoint lookupEndpoint(String endpointName) throws MuleException { OutboundEndpoint ep; Iterator iterator = endpoints.iterator(); while (iterator.hasNext()) { ep = (OutboundEndpoint) iterator.next(); // Endpoint identifier (deprecated) if (endpointName.equals(ep.getEndpointURI().getEndpointName())) { return ep; } // Global endpoint else if (endpointName.equals(ep.getName())) { return ep; } else if (endpointName.equals(ep.getEndpointURI().getUri().toString())) { return ep; } } return getMuleContext().getRegistry().lookupEndpointFactory().getOutboundEndpoint(endpointName); } public String getFullExpression() { if(fullExpression==null) { if(evaluator.equalsIgnoreCase("custom")) { evaluator = customEvaluator; } fullExpression = evaluator + ":" + expression; logger.debug("Full expression for EndpointSelector is: " + fullExpression); } return fullExpression; } public String getExpression() { return expression; } public void setExpression(String expression) { this.expression = expression; } public String getCustomEvaluator() { return customEvaluator; } public void setCustomEvaluator(String customEvaluator) { this.customEvaluator = customEvaluator; } public String getEvaluator() { return evaluator; } public void setEvaluator(String evaluator) { this.evaluator = evaluator; } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/MulticastingRouter.java0000644000175000017500000000653010757615756027501 0ustar charlescharles/* * $Id: MulticastingRouter.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.CouldNotRouteOutboundMessageException; import org.mule.api.routing.RoutePathNotFoundException; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.CoreMessages; /** * MulticastingRouter will broadcast the current message to every endpoint * registed with the router. */ public class MulticastingRouter extends FilteringOutboundRouter { public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { MuleMessage result = null; if (endpoints == null || endpoints.size() == 0) { throw new RoutePathNotFoundException(CoreMessages.noEndpointsForRouter(), message, null); } if (enableCorrelation != ENABLE_CORRELATION_NEVER) { boolean correlationSet = message.getCorrelationId() != null; if (correlationSet && (enableCorrelation == ENABLE_CORRELATION_IF_NOT_SET)) { logger.debug("CorrelationId is already set, not setting Correlation group size"); } else { // the correlationId will be set by the AbstractOutboundRouter message.setCorrelationGroupSize(endpoints.size()); } } try { OutboundEndpoint endpoint; synchronized (endpoints) { for (int i = 0; i < endpoints.size(); i++) { endpoint = (OutboundEndpoint) endpoints.get(i); if (synchronous) { // Were we have multiple outbound endpoints if (result == null) { result = send(session, message, endpoint); } else { String def = (String) endpoint.getProperties().get("default"); if (def != null) { result = send(session, message, endpoint); } else { send(session, message, endpoint); } } } else { dispatch(session, message, endpoint); } } } } catch (MuleException e) { throw new CouldNotRouteOutboundMessageException(message, (ImmutableEndpoint) endpoints.get(0), e); } return result; } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/FilteringListMessageSplitter.java0000644000175000017500000000766510757615756031462 0ustar charlescharles/* * $Id: FilteringListMessageSplitter.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; /** * FilteringListMessageSplitter accepts a List as a message payload * then routes list elements as messages over an endpoint where the endpoint's filter * accepts the payload. */ public class FilteringListMessageSplitter extends AbstractMessageSplitter { private final ThreadLocal payloadContext = new ThreadLocal(); private final ThreadLocal propertiesContext = new ThreadLocal(); /** * Template method can be used to split the message up before the getMessagePart * method is called . * * @param message the message being routed */ // //@Override protected void initialise(MuleMessage message) { if (message.getPayload() instanceof List) { // get a copy of the list List payload = new LinkedList((List) message.getPayload()); payloadContext.set(payload); if (enableCorrelation != ENABLE_CORRELATION_NEVER) { // always set correlation group size, even if correlation id // has already been set (usually you don't have group size yet // by this point. final int groupSize = payload.size(); message.setCorrelationGroupSize(groupSize); if (logger.isDebugEnabled()) { logger.debug("java.util.List payload detected, setting correlation group size to " + groupSize); } } } else { throw new IllegalArgumentException("The payload for this router must be of type java.util.List"); } // Cache the properties here because for some message types getting the // properties can be expensive Map props = new HashMap(); for (Iterator iterator = message.getPropertyNames().iterator(); iterator.hasNext();) { String propertyKey = (String) iterator.next(); props.put(propertyKey, message.getProperty(propertyKey)); } propertiesContext.set(props); } // @Override protected void cleanup() { payloadContext.set(null); propertiesContext.set(null); } /** * @inheritDocs */ protected MuleMessage getMessagePart(MuleMessage message, OutboundEndpoint endpoint) { List payloads = (List) payloadContext.get(); for (Iterator i = payloads.iterator(); i.hasNext();) { Object payload = i.next(); MuleMessage result = new DefaultMuleMessage(payload, (Map) propertiesContext.get()); // If there is no filter assume that the endpoint can accept the // message. Endpoints will be processed in order to only the last // (if any) of the the endpoints may not have a filter if (endpoint.getFilter() == null || endpoint.getFilter().accept(result)) { if (logger.isDebugEnabled()) { logger.debug("Endpoint filter matched. Routing message over: " + endpoint.getEndpointURI().toString()); } i.remove(); return result; } } return null; } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/TemplateEndpointRouter.java0000644000175000017500000000755410757615756030321 0ustar charlescharles/* * $Id: TemplateEndpointRouter.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.CouldNotRouteOutboundMessageException; import org.mule.api.routing.RoutePathNotFoundException; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.CoreMessages; import org.mule.endpoint.DynamicURIOutboundEndpoint; import org.mule.endpoint.MuleEndpointURI; import org.mule.util.TemplateParser; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * The TemplateEndpointRouter allows endpoints to be altered at runtime based on * properties set on the current event or fallback values set on the endpoint properties. * Templated values are expressed using square braces around a property name, i.e. * axis:http://localhost:8082/MyService?method=[SOAP_METHOD]. Note that Ant style property * templates cannot be used in valid URI strings, so we must use square braces instead. */ public class TemplateEndpointRouter extends FilteringOutboundRouter { // We used square templates as they can exist as part of an URI. private TemplateParser parser = TemplateParser.createSquareBracesStyleParser(); public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { MuleMessage result = null; if (endpoints == null || endpoints.size() == 0) { throw new RoutePathNotFoundException(CoreMessages.noEndpointsForRouter(), message, null); } try { OutboundEndpoint ep = (OutboundEndpoint) endpoints.get(0); String uri = ep.getEndpointURI().toString(); if (logger.isDebugEnabled()) { logger.debug("Uri before parsing is: " + uri); } // Also add the endpoint properties so that users can set fallback values // when the property is not set on the event Map props = new HashMap(); props.putAll(ep.getProperties()); for (Iterator iterator = message.getPropertyNames().iterator(); iterator.hasNext();) { String propertyKey = (String) iterator.next(); props.put(propertyKey, message.getProperty(propertyKey)); } uri = parser.parse(props, uri); if (logger.isDebugEnabled()) { logger.debug("Uri after parsing is: " + uri); } EndpointURI newUri = new MuleEndpointURI(uri); if (!newUri.getScheme().equalsIgnoreCase(ep.getEndpointURI().getScheme())) { throw new CouldNotRouteOutboundMessageException(CoreMessages.schemeCannotChangeForRouter( ep.getEndpointURI().getScheme(), newUri.getScheme()), message, ep); } ep = new DynamicURIOutboundEndpoint(ep, new MuleEndpointURI(uri)); if (synchronous) { result = send(session, message, ep); } else { dispatch(session, message, ep); } } catch (MuleException e) { throw new CouldNotRouteOutboundMessageException(message, (ImmutableEndpoint) endpoints.get(0), e); } return result; } } mule-2.0.1/core/src/main/java/org/mule/routing/outbound/MessageChunkingRouter.java0000644000175000017500000001021410746275214030070 0ustar charlescharles/* * $Id: MessageChunkingRouter.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.CoreMessages; /** * A router that breaks up the current message onto smaller parts and sends them to the * same destination. The Destination service needs to have a MessageChunkingAggregator * inbound router in order to rebuild the message at the other end. * * @see org.mule.routing.inbound.MessageChunkingAggregator */ public class MessageChunkingRouter extends FilteringOutboundRouter { private int messageSize = 0; private int numberOfMessages = 1; public int getMessageSize() { return messageSize; } public void setMessageSize(int messageSize) { this.messageSize = messageSize; } public int getNumberOfMessages() { return numberOfMessages; } public void setNumberOfMessages(int numberOfMessages) { this.numberOfMessages = numberOfMessages; } public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { if (messageSize == 0 && numberOfMessages < 2) { return super.route(message, session, synchronous); } else if (messageSize > 0) { byte[] data = new byte[0]; try { data = message.getPayloadAsBytes(); } catch (Exception e) { throw new RoutingException(CoreMessages.failedToReadPayload(), message, getEndpoint(0, message), e); } int parts = data.length / messageSize; if ((parts * messageSize) < data.length) { parts++; } int len = messageSize; MuleMessage part = null; int count = 0; int pos = 0; byte[] buffer = null; try { for (; count < parts; count++) { if ((pos + len) > data.length) { len = data.length - pos; } buffer = new byte[len]; System.arraycopy(data, pos, buffer, 0, buffer.length); pos += len; part = new DefaultMuleMessage(buffer, message); part.setCorrelationId(message.getUniqueId()); part.setCorrelationGroupSize(parts); part.setCorrelationSequence(count); // TODO - remove or downgrade once MULE-1718 is fixed, // for now these really help see the problem if you set the level for this class to INFO if (logger.isInfoEnabled()) { logger.info("sending part " + count + " of " + parts); } super.route(part, session, synchronous); if (logger.isInfoEnabled()) { logger.info("sent"); } } } catch (RoutingException e) { // we'll want to send the whole message to the Exception handler e = new RoutingException(e.getI18nMessage(), e.getUmoMessage(), e.getEndpoint(), e.getCause()); // e.addInfo("chunking", "true"); // buffer = new byte[data.length - len]; // System.arraycopy(data, len, buffer, 0, buffer.length); // e.addInfo("remaining data", buffer); throw e; } } return message; } } mule-2.0.1/core/src/main/java/org/mule/routing/MuleMessageInfoMapping.java0000644000175000017500000000214410771035311026305 0ustar charlescharles/* * $Id: MuleMessageInfoMapping.java 11475 2008-03-21 22:46:33Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.api.routing.MessageInfoMapping; import org.mule.api.MuleMessage; /** * A simple facade implementation of {@link org.mule.api.routing.MessageInfoMapping} that simply * grabs the message information from the {@link org.mule.api.MuleMessage} untouched. */ public class MuleMessageInfoMapping implements MessageInfoMapping { public String getCorrelationId(MuleMessage message) { String id= message.getCorrelationId(); if (id == null) { id = getMessageId(message); } return id; } public String getMessageId(MuleMessage message) { return message.getUniqueId(); } } mule-2.0.1/core/src/main/java/org/mule/routing/ForwardingCatchAllStrategy.java0000644000175000017500000000533010757615756027214 0ustar charlescharles/* * $Id: ForwardingCatchAllStrategy.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.DefaultMuleEvent; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.RoutingException; import org.mule.api.routing.ServiceRoutingException; import org.mule.config.i18n.CoreMessages; /** * ForwardingCatchAllStrategy acts as a catch and forward router for * any events not caught by the router this strategy is associated with. Users can * assign an endpoint to this strategy to forward all events to. This can be used as * a dead letter/error queue. */ public class ForwardingCatchAllStrategy extends AbstractCatchAllStrategy { private boolean sendTransformed = false; public MuleMessage catchMessage(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { if (getEndpoint() == null) { throw new ServiceRoutingException(CoreMessages.noCatchAllEndpointSet(), message, getEndpoint(), session.getService()); } try { OutboundEndpoint endpoint = getEndpoint(); if (sendTransformed && endpoint.getTransformers() != null) { message.applyTransformers(endpoint.getTransformers()); } MuleEvent newEvent = new DefaultMuleEvent(message, endpoint, session, synchronous); if (synchronous) { MuleMessage result = endpoint.send(newEvent); if (statistics != null) { statistics.incrementRoutedMessage(getEndpoint()); } return result; } else { endpoint.dispatch(newEvent); if (statistics != null) { statistics.incrementRoutedMessage(getEndpoint()); } return null; } } catch (Exception e) { throw new RoutingException(message, getEndpoint(), e); } } public boolean isSendTransformed() { return sendTransformed; } public void setSendTransformed(boolean sendTransformed) { this.sendTransformed = sendTransformed; } } mule-2.0.1/core/src/main/java/org/mule/RegistryContext.java0000644000175000017500000000277510766637211023461 0ustar charlescharles/* * $Id: RegistryContext.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.config.MuleConfiguration; import org.mule.api.registry.Registry; import org.mule.registry.TransientRegistry; /** * A handle to the Mule Registry. We should make no assumptions about the location of the actual Registry * implementation. It might be simply a singleton object in the same JVM, or it might be in another JVM or * even running remotely on another machine. */ public class RegistryContext { protected static Registry registry; public static Registry getRegistry() { return registry; } public static synchronized void setRegistry(Registry registry) { RegistryContext.registry = registry; } public static MuleConfiguration getConfiguration() { // TODO Migrate uses to obtain configuration from MuleContext return MuleServer.getMuleContext().getConfiguration(); } public static Registry getOrCreateRegistry() { if(registry==null || registry.isDisposed()) { registry = new TransientRegistry(); } return registry; } } mule-2.0.1/core/src/main/java/org/mule/agent/0000755000175000017500000000000011351411113020502 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/agent/package.html0000644000175000017500000000017410745677442023016 0ustar charlescharles Mule Admin components and Agents used to control and Monitor Mule mule-2.0.1/core/src/main/java/org/mule/agent/Log4jNotificationLoggerAgent.java0000644000175000017500000001242710762020431027024 0ustar charlescharles/* * $Id: Log4jNotificationLoggerAgent.java 11129 2008-02-29 15:13:29Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.agent; import org.mule.api.context.notification.ServerNotification; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import org.mule.util.FileUtils; import org.mule.util.MapUtils; import org.mule.util.StringUtils; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.apache.log4j.Appender; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; import org.apache.log4j.PropertyConfigurator; import org.apache.log4j.RollingFileAppender; import org.apache.log4j.xml.DOMConfigurator; /** * AbstractNotificationLoggerAgent Receives Mule server notifications * and logs them and can optionally route them to an endpoint * */ public class Log4jNotificationLoggerAgent extends AbstractNotificationLoggerAgent { protected static final int DEFAULT_DESCRIPTION_BUFFER_SIZE = 64; protected Logger eventLogger; private String logName = Log4jNotificationLoggerAgent.class.getName(); private String logFile = null; private String logConfigFile = null; private String chainsawHost = "localhost"; private int chainsawPort = -1; private Map levelMappings = new HashMap(); public Log4jNotificationLoggerAgent() { super("log4j-notifications"); } /** * Should be a 1 line description of the agent * * @return the description of this Agent */ public String getDescription() { StringBuffer buf = new StringBuffer(DEFAULT_DESCRIPTION_BUFFER_SIZE); if (StringUtils.isNotBlank(logFile)) { buf.append("Logging notifications to: ").append(logFile); } if (chainsawPort > -1) { buf.append(" Chainsaw: ").append(chainsawHost).append(":").append(chainsawPort); } if (buf.length() == 0) { buf.append("No logging or event forwarding is configured"); } return getName() + ": " + buf.toString(); } public String getLogName() { return logName; } public void setLogName(String logName) { this.logName = logName; } protected void doInitialise() throws InitialisationException { if (logConfigFile != null) { if (logConfigFile.endsWith(".xml")) { DOMConfigurator.configure(logConfigFile); } else { PropertyConfigurator.configure(logConfigFile); } } else { try { eventLogger = Logger.getLogger(logName); if (logFile != null) { File f = FileUtils.newFile(logFile); if (!f.exists()) { FileUtils.createFile(logFile); } Appender file = new RollingFileAppender(new PatternLayout("%5p %m%n"), logFile, true); eventLogger.addAppender(file); } /* Disable for now since the org.apache.log4j.net package is not exported by the PAX Logging Log4J bundle. if (chainsawPort > -1) { Appender chainsaw = new SocketAppender(chainsawHost, chainsawPort); eventLogger.addAppender(chainsaw); } */ } catch (IOException e) { throw new InitialisationException( CoreMessages.failedToLoad("Log4j configuration"), e, this); } } } protected void logEvent(ServerNotification e) { if (eventLogger != null) { String actionKey = e.EVENT_NAME + "." + e.getActionName(); String level = MapUtils.getString(levelMappings, actionKey, e.getType()); eventLogger.log(Level.toLevel(level, Level.INFO), e); } } public String getLogFile() { return logFile; } public void setLogFile(String logFile) { this.logFile = logFile; } public String getLogConfigFile() { return logConfigFile; } public void setLogConfigFile(String logConfigFile) { this.logConfigFile = logConfigFile; } public String getChainsawHost() { return chainsawHost; } public void setChainsawHost(String chainsawHost) { this.chainsawHost = chainsawHost; } public int getChainsawPort() { return chainsawPort; } public void setChainsawPort(int chainsawPort) { this.chainsawPort = chainsawPort; } public Map getLevelMappings() { return levelMappings; } public void setLevelMappings(Map levelMappings) { this.levelMappings.putAll(levelMappings); } } mule-2.0.1/core/src/main/java/org/mule/agent/EndpointNotificationLoggerAgent.java0000644000175000017500000001224610766204322027633 0ustar charlescharles/* * $Id: EndpointNotificationLoggerAgent.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.agent; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.NullSessionHandler; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.context.notification.ServerNotification; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.ConnectionNotification; import org.mule.context.notification.ModelNotification; import org.mule.context.notification.MuleContextNotification; import org.mule.transport.NullPayload; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * EndpointAbstractEventLoggerAgent will forward server notifications * to a configurered endpoint uri. */ public class EndpointNotificationLoggerAgent extends AbstractNotificationLoggerAgent { private String endpointAddress; private OutboundEndpoint logEndpoint = null; private MuleSession session; private List ignoredNotifications = new ArrayList(); public EndpointNotificationLoggerAgent() { super("Endpoint Logger Agent"); // List of notifications to ignore, because when these notifications are // received the notification endpoint is no longer available ignoredNotifications.add(new Integer(MuleContextNotification.CONTEXT_DISPOSING_CONNECTORS)); ignoredNotifications.add(new Integer(MuleContextNotification.CONTEXT_DISPOSED_CONNECTORS)); ignoredNotifications.add(new Integer(MuleContextNotification.CONTEXT_STOPPED)); ignoredNotifications.add(new Integer(MuleContextNotification.CONTEXT_DISPOSING)); ignoredNotifications.add(new Integer(MuleContextNotification.CONTEXT_DISPOSED)); ignoredNotifications.add(new Integer(ModelNotification.MODEL_STOPPED)); ignoredNotifications.add(new Integer(ModelNotification.MODEL_DISPOSING)); ignoredNotifications.add(new Integer(ModelNotification.MODEL_DISPOSED)); } protected void doInitialise() throws InitialisationException { // first see if we're logging notifications to an endpoint try { if (endpointAddress != null) { logEndpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(endpointAddress); } else { throw new InitialisationException( CoreMessages.propertiesNotSet("endpointAddress"), this); } // Create a session for sending notifications session = new DefaultMuleSession(new DefaultMuleMessage(NullPayload.getInstance(), (Map) null), new NullSessionHandler(), muleContext); } catch (Exception e) { throw new InitialisationException(e, this); } } protected void logEvent(ServerNotification e) { if (logEndpoint != null && !ignoredNotifications.contains(new Integer(e.getAction()))) { if ((e.getAction() == ConnectionNotification.CONNECTION_FAILED || e.getAction() == ConnectionNotification.CONNECTION_DISCONNECTED) && ((Connector) e.getSource()).equals(logEndpoint.getConnector())) { // If this is a CONNECTION_FAILED or // CONNECTION_DISCONNECTED notification for the same connector that // is being used for notifications then ignore. return; } try { MuleMessage msg = new DefaultMuleMessage(e.toString(), (Map) null); MuleEvent event = new DefaultMuleEvent(msg, logEndpoint, session, false); logEndpoint.dispatch(event); } catch (Exception e1) { // TODO MULE-863: If this is an error, do something better than this logger.error("Failed to dispatch event: " + e.toString() + " over endpoint: " + logEndpoint + ". Error is: " + e1.getMessage(), e1); } } } /** * Should be a 1 line description of the agent * * @return */ public String getDescription() { StringBuffer buf = new StringBuffer(); buf.append(getName()).append(": "); if (endpointAddress != null) { buf.append("Forwarding notifications to: " + endpointAddress); } return buf.toString(); } public String getEndpointAddress() { return endpointAddress; } public void setEndpointAddress(String endpointAddress) { this.endpointAddress = endpointAddress; } } mule-2.0.1/core/src/main/java/org/mule/agent/AbstractNotificationLoggerAgent.java0000644000175000017500000002476610774254333027636 0ustar charlescharles/* * $Id: AbstractNotificationLoggerAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.agent; import org.mule.AbstractAgent; import org.mule.api.MuleException; import org.mule.api.context.notification.ConnectionNotificationListener; import org.mule.api.context.notification.CustomNotificationListener; import org.mule.api.context.notification.ManagementNotificationListener; import org.mule.api.context.notification.MessageNotificationListener; import org.mule.api.context.notification.ModelNotificationListener; import org.mule.api.context.notification.MuleContextNotificationListener; import org.mule.api.context.notification.SecurityNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.ServerNotificationListener; import org.mule.api.context.notification.ServiceNotificationListener; import org.mule.api.lifecycle.InitialisationException; import org.mule.context.notification.NotificationException; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractNotificationLoggerAgent Receives Mule server notifications * and logs them and can optionally route them to an endpoint */ public abstract class AbstractNotificationLoggerAgent extends AbstractAgent { /** * The logger used for this class */ protected transient Log logger = LogFactory.getLog(getClass()); private boolean ignoreManagerNotifications = false; private boolean ignoreModelNotifications = false; private boolean ignoreComponentNotifications = false; private boolean ignoreConnectionNotifications = false; private boolean ignoreSecurityNotifications = false; private boolean ignoreManagementNotifications = false; private boolean ignoreCustomNotifications = false; private boolean ignoreAdminNotifications = false; private boolean ignoreMessageNotifications = false; private Set listeners = new HashSet(); protected AbstractNotificationLoggerAgent(String name) { super(name); } public void start() throws MuleException { // nothing to do } public void stop() throws MuleException { // nothing to do } public void dispose() { // nothing to do } public void registered() { // nothing to do } public void unregistered() { for (Iterator iterator = listeners.iterator(); iterator.hasNext();) { ServerNotificationListener listener = (ServerNotificationListener) iterator.next(); muleContext.unregisterListener(listener); } } public boolean isIgnoreManagerNotifications() { return ignoreManagerNotifications; } public void setIgnoreManagerNotifications(boolean ignoreManagerNotifications) { this.ignoreManagerNotifications = ignoreManagerNotifications; } public boolean isIgnoreMessageNotifications() { return ignoreMessageNotifications; } public void setIgnoreMessageNotifications(boolean ignoreMessageNotifications) { this.ignoreMessageNotifications = ignoreMessageNotifications; } public boolean isIgnoreModelNotifications() { return ignoreModelNotifications; } public void setIgnoreModelNotifications(boolean ignoreModelNotifications) { this.ignoreModelNotifications = ignoreModelNotifications; } public boolean isIgnoreComponentNotifications() { return ignoreComponentNotifications; } public void setIgnoreComponentNotifications(boolean ignoreComponentNotifications) { this.ignoreComponentNotifications = ignoreComponentNotifications; } public boolean isIgnoreSecurityNotifications() { return ignoreSecurityNotifications; } public void setIgnoreSecurityNotifications(boolean ignoreSecurityNotifications) { this.ignoreSecurityNotifications = ignoreSecurityNotifications; } public boolean isIgnoreManagementNotifications() { return ignoreManagementNotifications; } public void setIgnoreManagementNotifications(boolean ignoreManagementNotifications) { this.ignoreManagementNotifications = ignoreManagementNotifications; } public boolean isIgnoreCustomNotifications() { return ignoreCustomNotifications; } public void setIgnoreCustomNotifications(boolean ignoreCustomNotifications) { this.ignoreCustomNotifications = ignoreCustomNotifications; } public boolean isIgnoreAdminNotifications() { return ignoreAdminNotifications; } public void setIgnoreAdminNotifications(boolean ignoreAdminNotifications) { this.ignoreAdminNotifications = ignoreAdminNotifications; } public boolean isIgnoreConnectionNotifications() { return ignoreConnectionNotifications; } public void setIgnoreConnectionNotifications(boolean ignoreConnectionNotifications) { this.ignoreConnectionNotifications = ignoreConnectionNotifications; } public final void initialise() throws InitialisationException { doInitialise(); if (!ignoreManagerNotifications) { ServerNotificationListener l = new MuleContextNotificationListener() { public void onNotification(ServerNotification notification) { logEvent(notification); } }; try { muleContext.registerListener(l); } catch (NotificationException e) { throw new InitialisationException(e, this); } listeners.add(l); } if (!ignoreModelNotifications) { ServerNotificationListener l = new ModelNotificationListener() { public void onNotification(ServerNotification notification) { logEvent(notification); } }; try { muleContext.registerListener(l); } catch (NotificationException e) { throw new InitialisationException(e, this); } listeners.add(l); } if (!ignoreComponentNotifications) { ServerNotificationListener l = new ServiceNotificationListener() { public void onNotification(ServerNotification notification) { logEvent(notification); } }; try { muleContext.registerListener(l); } catch (NotificationException e) { throw new InitialisationException(e, this); } listeners.add(l); } if (!ignoreSecurityNotifications) { ServerNotificationListener l = new SecurityNotificationListener() { public void onNotification(ServerNotification notification) { logEvent(notification); } }; try { muleContext.registerListener(l); } catch (NotificationException e) { throw new InitialisationException(e, this); } listeners.add(l); } if (!ignoreManagementNotifications) { ServerNotificationListener l = new ManagementNotificationListener() { public void onNotification(ServerNotification notification) { logEvent(notification); } }; try { muleContext.registerListener(l); } catch (NotificationException e) { throw new InitialisationException(e, this); } listeners.add(l); } if (!ignoreCustomNotifications) { ServerNotificationListener l = new CustomNotificationListener() { public void onNotification(ServerNotification notification) { logEvent(notification); } }; try { muleContext.registerListener(l); } catch (NotificationException e) { throw new InitialisationException(e, this); } listeners.add(l); } if (!ignoreConnectionNotifications) { ServerNotificationListener l = new ConnectionNotificationListener() { public void onNotification(ServerNotification notification) { logEvent(notification); } }; try { muleContext.registerListener(l); } catch (NotificationException e) { throw new InitialisationException(e, this); } listeners.add(l); } if (!ignoreMessageNotifications /** && TODO RM* !RegistryContext.getConfiguration().isEnableMessageEvents() **/) { logger.warn("EventLogger agent has been asked to log message notifications, but the MuleManager is configured not to fire Message notifications"); } else if (!ignoreMessageNotifications) { ServerNotificationListener l = new MessageNotificationListener() { public void onNotification(ServerNotification notification) { logEvent(notification); } }; try { muleContext.registerListener(l); } catch (NotificationException e) { throw new InitialisationException(e, this); } listeners.add(l); } } protected abstract void doInitialise() throws InitialisationException; protected abstract void logEvent(ServerNotification e); } mule-2.0.1/core/src/main/java/org/mule/agent/ConfigScannerAgent.java0000644000175000017500000001315510774254333025071 0ustar charlescharles/* * $Id: ConfigScannerAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.agent; import org.mule.AbstractAgent; import org.mule.MuleServer; import org.mule.api.MuleException; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.lifecycle.InitialisationException; import org.mule.util.ClassUtils; import org.mule.util.FileUtils; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * EXPERIMENTAL!!! * * This agent scans a defined directory for dropped configuration files. It * defaults to .mule/conf. * * Once configuration files are ready, they should be moved instead of deleted. * We need a strategy for this. * * This agent should also respond to wire transfers (tcp, multicast). */ public class ConfigScannerAgent extends AbstractAgent { public static final String AGENT_NAME = "Mule Config Scanner"; /** * logger used by this class */ protected static Log logger = LogFactory.getLog(ConfigScannerAgent.class); private String configDirName = null; private File configDir = null; private int sleepInterval = 5000; private boolean doStop = false; private ScannerThread scannerThread = null; public ConfigScannerAgent() { super(AGENT_NAME); } public String getConfigDirName() { return configDirName; } public void setConfigDirName(String configDirName) { this.configDirName = configDirName; } /** * Should be a 1 line description of the agent * * @return */ public String getDescription() { return getName() + " scanning for files in " + configDirName; } public void start() throws MuleException { scannerThread = new ScannerThread(); scannerThread.start(); } public void stop() throws MuleException { // do nothing } public void dispose() { // do nothing } public void registered() { // do nothing } public void unregistered() { // do nothing } public void initialise() throws InitialisationException { if (configDirName == null) { String workDir = muleContext.getConfiguration().getWorkingDirectory(); configDirName = workDir + "/conf"; } try { configDir = FileUtils.openDirectory(configDirName); } catch (IOException ioe) { throw new InitialisationException(ioe, this); } } public List getDependentAgents() { return Collections.EMPTY_LIST; } public String toString() { return getDescription(); } public void setDoStop(boolean doStop) { this.doStop = doStop; } class ScannerThread extends Thread { int errorCount = 0; int errorThreshold = 3; List processedFiles = new ArrayList(); public void run() { while (true) { if (doStop || errorCount >= errorThreshold) break; try { File[] configFiles = configDir.listFiles(); for (int i = 0; i < configFiles.length; i++) { File configFile = configFiles[i]; String path = configFile.getCanonicalPath(); if (processedFiles.contains(path)) { // TODO: probably shouldn't delete here configFile.delete(); if (configFile.exists()) processedFiles.remove(processedFiles.indexOf(path)); } else { logger.info(path); processConfigFile(path); // TODO: probably shouldn't delete here configFile.delete(); processedFiles.add(path); } } } catch (IOException ioe) { logger.error("Unable to check directory: " + ioe.toString()); errorCount++; } try { sleep(sleepInterval); } catch (InterruptedException e) { } } } } private void processConfigFile(String configFile) { try { Class cfgBuilderClass = ClassUtils.loadClass( "org.mule.config.spring.SpringXmlConfigurationBuilder", MuleServer.class); ConfigurationBuilder cfgBuilder = (ConfigurationBuilder) ClassUtils.instanciateClass( cfgBuilderClass, new Object[]{configFile}); if (!cfgBuilder.isConfigured()) { // TODO Update after MULE-1988 cfgBuilder.configure(muleContext); } } catch (Exception e) { logger.error(e); } } } mule-2.0.1/core/src/main/java/org/mule/agent/AgentSorter.java0000644000175000017500000000737710776664712023651 0ustar charlescharles/* * $Id: AgentSorter.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.agent; import org.mule.api.agent.Agent; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.Predicate; /** * Sort {@link Agent} instances so that dependencies of each agent are started before the * actual {@link Agent} is started itself. */ public class AgentSorter extends Object { public static List sortAgents(Collection/**/ agents) { List sortedAgents = new ArrayList(); // step 1: add all agents with no dependencies Collection agentsWithoutDependencies = CollectionUtils.select(agents, new Predicate() { public boolean evaluate(Object object) { return ((Agent) object).getDependentAgents().size() == 0; } }); sortedAgents.addAll(agentsWithoutDependencies); // step 2: process the remaining agents List remainingAgents = new ArrayList(agents); remainingAgents.removeAll(agentsWithoutDependencies); while (remainingAgents.size() > 0) { int processedAgents = 0; ListIterator iter = remainingAgents.listIterator(); while (iter.hasNext()) { Agent agent = (Agent) iter.next(); if (dependentAgentsPresent(agent.getDependentAgents(), agents, sortedAgents)) { sortedAgents.add(agent); iter.remove(); processedAgents++; } } // if we did not process any agents this iteration, the remaining agents // likely form a dependency cycle if (processedAgents == 0) { throw new IllegalArgumentException("Dependency cycle: " + remainingAgents); } } return sortedAgents; } private static boolean dependentAgentsPresent(List dependentClasses, Collection allRegisteredAgents, List sortedAgents) { Iterator dependencyIterator = dependentClasses.iterator(); while (dependencyIterator.hasNext()) { Class dependentClass = (Class) dependencyIterator.next(); if (classExistsInCollection(dependentClass, allRegisteredAgents) == false) { // this agent is currently not registed, ignore this dependency continue; } if (classExistsInCollection(dependentClass, sortedAgents) == false) { return false; } } return true; } private static boolean classExistsInCollection(Class clazz, Collection collection) { return CollectionUtils.exists(collection, new ClassEqualityPredicate(clazz)); } private static class ClassEqualityPredicate extends Object implements Predicate { private Class requiredClass; public ClassEqualityPredicate(Class requiredClass) { super(); this.requiredClass = requiredClass; } public boolean evaluate(Object object) { return object.getClass().equals(requiredClass); } } } mule-2.0.1/core/src/main/java/org/mule/transport/0000755000175000017500000000000011351411112021437 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/transport/SimpleRetryConnectionStrategy.java0000644000175000017500000001343510745677442030364 0ustar charlescharles/* * $Id: SimpleRetryConnectionStrategy.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.transport.Connectable; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.CoreMessages; import org.mule.util.ObjectUtils; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; /** * A simple connection retry strategy where the a connection will be attempted X * number of retryCount every Y milliseconds. The retryCount and frequency * properties can be set to customise the behaviour. */ public class SimpleRetryConnectionStrategy extends AbstractConnectionStrategy { public static final int DEFAULT_FREQUENCY = 2000; public static final int DEFAULT_RETRY_COUNT = 2; public static final int RETRY_COUNT_FOREVER = -1; protected static class RetryCounter extends ThreadLocal { public int countRetry() { return ((AtomicInteger) get()).incrementAndGet(); } public void reset() { ((AtomicInteger) get()).set(0); } //@Override public AtomicInteger current() { return (AtomicInteger) get(); } // @Override protected Object initialValue() { return new AtomicInteger(0); } } protected static final RetryCounter retryCounter = new RetryCounter(); protected static final ThreadLocal called = new ThreadLocal(); private volatile int retryCount = DEFAULT_RETRY_COUNT; private volatile long retryFrequency = DEFAULT_FREQUENCY; protected void doConnect(Connectable connectable) throws FatalConnectException { while (true) { final Boolean recursiveCallDetected = (Boolean) ObjectUtils.defaultIfNull(called.get(), Boolean.FALSE); if (!recursiveCallDetected.booleanValue()) { retryCounter.countRetry(); } called.set(Boolean.TRUE); try { connectable.connect(); if (logger.isDebugEnabled()) { logger.debug("Successfully connected to " + getDescription(connectable)); } break; } catch (InterruptedException ie) { // If we were interrupted it's probably because the server is // shutting down throw new FatalConnectException( // TODO it's not only endpoint that is reconnected, connectors too CoreMessages.reconnectStrategyFailed(this.getClass(), this.getDescription(connectable)), ie, connectable); } catch (Exception e) { if (e instanceof FatalConnectException) { // rethrow throw (FatalConnectException) e; } if (retryCount != RETRY_COUNT_FOREVER && retryCounter.current().get() >= retryCount) { throw new FatalConnectException( // TODO it's not only endpoint that is reconnected, connectors too CoreMessages.reconnectStrategyFailed(this.getClass(), this.getDescription(connectable)), e, connectable); } if (logger.isErrorEnabled()) { StringBuffer msg = new StringBuffer(512); msg.append("Failed to connect/reconnect: ").append( getDescription(connectable)); Throwable t = ExceptionHelper.getRootException(e); msg.append(". Root Exception was: ").append(ExceptionHelper.writeException(t)); logger.error(msg.toString(), e); } if (logger.isInfoEnabled()) { logger.info("Waiting for " + retryFrequency + "ms before reconnecting. Failed attempt " + retryCounter.current().get() + " of " + (retryCount != RETRY_COUNT_FOREVER ? String.valueOf(retryCount) : "unlimited")); } try { Thread.sleep(retryFrequency); } catch (InterruptedException e1) { throw new FatalConnectException( // TODO it's not only endpoint that is reconnected, connectors too CoreMessages.reconnectStrategyFailed(this.getClass(), this.getDescription(connectable)), e, connectable); } } finally { called.set(Boolean.FALSE); } } } /** * Resets any state stored in the retry strategy */ public synchronized void resetState() { retryCounter.reset(); } public int getRetryCount() { return retryCount; } /** * How many times to retry. Set to -1 to retry forever. * @param retryCount number of retries */ public void setRetryCount(int retryCount) { this.retryCount = retryCount; } public long getRetryFrequency() { return retryFrequency; } public void setRetryFrequency(long retryFrequency) { this.retryFrequency = retryFrequency; } } mule-2.0.1/core/src/main/java/org/mule/transport/DefaultMessageAdapter.java0000644000175000017500000001304510745677442026531 0ustar charlescharles/* * $Id: DefaultMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleRuntimeException; import org.mule.api.ThreadSafeAccess; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.MutableMessageAdapter; import org.mule.config.i18n.CoreMessages; import java.util.Iterator; import java.util.Map; import javax.activation.DataHandler; /** * DefaultMessageAdapter can be used to wrap an arbitary object where * no special 'apapting' is needed. The adapter allows for a set of properties to be * associated with an object. */ public final class DefaultMessageAdapter extends AbstractMessageAdapter implements MutableMessageAdapter { /** * Serial version */ private static final long serialVersionUID = 1908152148142575505L; /** * The message object wrapped by this adapter */ protected Object message; protected DefaultMessageAdapter() { super(); } /** * Creates a default message adapter with properties and attachments * * @param message the message to wrap. If this is null and NullPayload object * will be used * @see NullPayload */ public DefaultMessageAdapter(Object message) { if (message == null) { this.message = NullPayload.getInstance(); } else { this.message = message; } } public DefaultMessageAdapter(Object message, MessageAdapter previous) { super(previous); if (previous != null) { if (message == null) { this.message = NullPayload.getInstance(); } else { this.message = message; } // MULE-1564 // this is an iterator over a concurrent map and so is weakly consistent (not fail-safe) // that means we don't get errors here, but may see changed values. // so we can make this safe to null values (although not predictable) by simply checking values for (Iterator iterator = previous.getAttachmentNames().iterator(); iterator.hasNext();) { String name = (String) iterator.next(); try { DataHandler dh = previous.getAttachment(name); if (null == dh) { logger.warn("Detected concurrent access to attachment " + name + " for " + previous); // new Throwable().printStackTrace(); } else { addAttachment(name, dh); } } catch (Exception e) { throw new MuleRuntimeException(CoreMessages.failedToReadPayload(), e); } } for (Iterator iterator = previous.getPropertyNames().iterator(); iterator.hasNext();) { String name = (String) iterator.next(); try { Object value = previous.getProperty(name); if (null == value) { logger.warn("Detected concurrent access to property " + name + " for " + previous); // new Throwable().printStackTrace(); } else { setProperty(name, value); } } catch (Exception e) { throw new MuleRuntimeException(CoreMessages.failedToReadPayload(), e); } } } else { throw new IllegalArgumentException("previousAdapter may not be null"); } } /** * Creates a default message adapter with properties and attachments * * @param message the message to wrap. If this is null and NullPayload object * will be used * @param properties a map properties to set on the adapter. Can be null. * @param attachments a map attaches (DataHandler objects) to set on the adapter. * Can be null. * @see NullPayload * @see javax.activation.DataHandler */ public DefaultMessageAdapter(Object message, Map properties, Map attachments) { this(message); if (properties != null) { this.properties.addInboundProperties(properties); } if (attachments != null) { this.attachments.putAll(attachments); } } /** {@inheritDoc} */ public Object getPayload() { return message; } /** {@inheritDoc} */ public void setPayload(Object payload) { synchronized(message) { message = payload; } } /** {@inheritDoc} */ public String getUniqueId() { return id; } ////////////////////////// ThreadSafeAccess impl //////////////////// /** {@inheritDoc} */ public ThreadSafeAccess newThreadCopy() { return new DefaultMessageAdapter(getPayload(), this); } } mule-2.0.1/core/src/main/java/org/mule/transport/AbstractConnectionStrategy.java0000644000175000017500000001236310764322372027635 0ustar charlescharles/* * $Id: AbstractConnectionStrategy.java 11278 2008-03-07 20:26:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.context.WorkManager; import org.mule.api.transport.Connectable; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageReceiver; import org.mule.config.i18n.MessageFactory; import org.mule.util.ClassUtils; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * TODO document */ public abstract class AbstractConnectionStrategy implements ConnectionStrategy { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); private volatile boolean doThreading = false; private WorkManager workManager; private final Object reconnectLock = new Object(); public final void connect(final Connectable connectable) throws FatalConnectException { if (doThreading) { try { WorkManager wm = getWorkManager(); if (wm == null) { throw new FatalConnectException(MessageFactory.createStaticMessage("No WorkManager is available"), connectable); } wm.scheduleWork(new Work() { public void release() { // nothing to do } public void run() { try { synchronized (reconnectLock) { doConnect(connectable); } } catch (FatalConnectException e) { synchronized (reconnectLock) { resetState(); } // TODO should really extract an interface for // classes capable of handling an exception if (connectable instanceof Connector) { ((Connector) connectable).handleException(e); } // TODO: this cast is evil else if (connectable instanceof AbstractMessageReceiver) { ((AbstractMessageReceiver) connectable).handleException(e); } // if it's none of the above, it's not handled and Mule just sits doing nothing } } }); } catch (WorkException e) { synchronized (reconnectLock) { resetState(); } throw new FatalConnectException(e, connectable); } } else { try { synchronized (reconnectLock) { doConnect(connectable); } } finally { synchronized (reconnectLock) { resetState(); } } } } public boolean isDoThreading() { return doThreading; } public void setDoThreading(boolean doThreading) { this.doThreading = doThreading; } public WorkManager getWorkManager() { return workManager; } public void setWorkManager(WorkManager workManager) { this.workManager = workManager; } protected abstract void doConnect(Connectable connectable) throws FatalConnectException; /** * Resets any state stored in the retry strategy */ public abstract void resetState(); protected String getDescription(Connectable connectable) { if (connectable instanceof MessageReceiver) { return ((MessageReceiver) connectable).getEndpointURI().toString(); } else { return connectable.toString(); } } public int hashCode() { return ClassUtils.hash(new Object[]{doThreading ? Boolean.TRUE : Boolean.FALSE, workManager}); } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || getClass() != obj.getClass()) return false; final AbstractConnectionStrategy other = (AbstractConnectionStrategy) obj; return ClassUtils.equal(new Boolean(doThreading), new Boolean(other.doThreading)) && ClassUtils.equal(workManager, other.workManager); } } mule-2.0.1/core/src/main/java/org/mule/transport/WriterMessageAdapter.java0000644000175000017500000000604310745677442026421 0ustar charlescharles/* * $Id: WriterMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.ThreadSafeAccess; import org.mule.api.transport.MessageTypeNotSupportedException; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; /** * WriterMessageAdapter wraps a java.io.StringWriter and allows meta * information to be associated with the Writer. */ public class WriterMessageAdapter extends AbstractMessageAdapter { /** * Serial version */ private static final long serialVersionUID = -1065602752454818625L; private final StringWriter writer; public WriterMessageAdapter(Object message) throws MessageTypeNotSupportedException { if (message instanceof String) { writer = new StringWriter(); writer.write((String) message); } else if (message instanceof StringWriter) { this.writer = (StringWriter) message; } else { throw new MessageTypeNotSupportedException(message, getClass()); } } protected WriterMessageAdapter(WriterMessageAdapter template) { super(template); writer = template.writer; } /** * Converts the message implementation into a String representation * * @param encoding The encoding to use when transforming the message (if * necessary). The parameter is used when converting from a byte array * @return String representation of the message payload * @throws Exception Implementation may throw an endpoint specific exception */ public String getPayloadAsString(String encoding) throws Exception { return writer.toString(); } /** * Converts the message implementation into a String representation * * @return String representation of the message * @throws Exception Implemetation may throw an endpoint specific exception */ public byte[] getPayloadAsBytes() throws Exception { return writer.toString().getBytes(); } /** * @return the current message */ public Object getPayload() { return writer.toString(); } public void write(String string) { writer.write(string); } public void write(String string, int offset, int len) { writer.write(string, offset, len); } public Writer getWriter() { return writer; } public void flush() { writer.flush(); } public void close() throws IOException { writer.close(); } public ThreadSafeAccess newThreadCopy() { return new WriterMessageAdapter(this); } } mule-2.0.1/core/src/main/java/org/mule/transport/package.html0000644000175000017500000000044410745677442023754 0ustar charlescharles Contains Abstract classes providing common functionality for all Mule providers. Custom providers should use these base classes as they provider almost all the functionality needed by Mule to interact with the underlying technology. mule-2.0.1/core/src/main/java/org/mule/transport/UnsupportedMessageRequester.java0000644000175000017500000000214610757615756030077 0ustar charlescharles/* * $Id: UnsupportedMessageRequester.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; public final class UnsupportedMessageRequester extends AbstractMessageRequester { public UnsupportedMessageRequester(InboundEndpoint endpoint) { super(endpoint); } protected MuleMessage doRequest(long timeout) throws Exception { throw new UnsupportedOperationException("Request not supported for this transport"); } protected void doDispose() { // empty } protected void doConnect() throws Exception { // empty } protected void doDisconnect() throws Exception { // empty } } mule-2.0.1/core/src/main/java/org/mule/transport/AbstractConnector.java0000644000175000017500000021016010774254333025742 0ustar charlescharles/* * $Id: AbstractConnector.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.DefaultExceptionStrategy; import org.mule.MuleSessionHandler; import org.mule.RegistryContext; import org.mule.api.MessagingException; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleRuntimeException; import org.mule.api.config.ThreadingProfile; import org.mule.api.context.WorkManager; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.ServerNotificationHandler; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.DisposeException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.registry.ServiceDescriptorFactory; import org.mule.api.registry.ServiceException; import org.mule.api.service.Service; import org.mule.api.transport.Connectable; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import org.mule.api.transport.ConnectorException; import org.mule.api.transport.DispatchException; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.MessageDispatcher; import org.mule.api.transport.MessageDispatcherFactory; import org.mule.api.transport.MessageReceiver; import org.mule.api.transport.MessageRequester; import org.mule.api.transport.MessageRequesterFactory; import org.mule.api.transport.ReplyToHandler; import org.mule.api.transport.SessionHandler; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.ConnectionNotification; import org.mule.context.notification.MessageNotification; import org.mule.context.notification.OptimisedNotificationHandler; import org.mule.lifecycle.AlreadyInitialisedException; import org.mule.model.streaming.DelegatingInputStream; import org.mule.routing.filters.WildcardFilter; import org.mule.transformer.TransformerUtils; import org.mule.transport.service.TransportFactory; import org.mule.transport.service.TransportServiceDescriptor; import org.mule.transport.service.TransportServiceException; import org.mule.util.BeanUtils; import org.mule.util.ClassUtils; import org.mule.util.CollectionUtils; import org.mule.util.ObjectNameHelper; import org.mule.util.ObjectUtils; import org.mule.util.StringUtils; import org.mule.util.concurrent.NamedThreadFactory; import org.mule.util.concurrent.WaitableBoolean; import java.beans.ExceptionListener; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import javax.resource.spi.work.WorkEvent; import javax.resource.spi.work.WorkListener; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentMap; import edu.emory.mathcs.backport.java.util.concurrent.ScheduledExecutorService; import edu.emory.mathcs.backport.java.util.concurrent.ScheduledThreadPoolExecutor; import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.pool.KeyedPoolableObjectFactory; import org.apache.commons.pool.impl.GenericKeyedObjectPool; /** * AbstractConnector provides base functionality for all connectors * provided with Mule. Connectors are the mechanism used to connect to external * systems and protocols in order to send and receive data.

    The * AbstractConnector provides getter and setter methods for endpoint * name, transport name and protocol. It also provides methods to stop and start * connecotors and sets up a dispatcher threadpool which allows deriving connectors * the possibility to dispatch work to separate threads. This functionality is * controlled with the doThreading property on the threadingProfiles for * dispachers and receivers. The lifecycle for a connector is - *

      *
    1. Create *
    2. Initialise *
    3. Connect *
    4. Connect receivers *
    5. Start *
    6. Start Receivers *
    7. Stop *
    8. Stop Receivers *
    9. Disconnect *
    10. Disconnect Receivers *
    11. Dispose *
    12. Dispose Receivers *
    */ public abstract class AbstractConnector implements Connector, ExceptionListener, Connectable, WorkListener { /** * Default number of concurrent transactional receivers. */ public static final int DEFAULT_NUM_CONCURRENT_TX_RECEIVERS = 4; /** * logger used by this class */ protected final Log logger = LogFactory.getLog(getClass()); /** * Specifies if the endpoint started */ protected final AtomicBoolean started = new AtomicBoolean(false); /** * True once the endpoint has been initialsed */ protected final AtomicBoolean initialised = new AtomicBoolean(false); /** * The name that identifies the endpoint */ protected volatile String name; /** * The exception strategy used by this connector */ protected volatile ExceptionListener exceptionListener; /** * Determines in the connector is alive and well */ protected final AtomicBoolean disposed = new AtomicBoolean(false); /** * Determines in connector has been told to dispose */ protected final AtomicBoolean disposing = new AtomicBoolean(false); /** * Factory used to create dispatchers for this connector */ protected volatile MessageDispatcherFactory dispatcherFactory; /** * Factory used to create requesters for this connector */ protected volatile MessageRequesterFactory requesterFactory; /** * A pool of dispatchers for this connector, keyed by endpoint */ protected final GenericKeyedObjectPool dispatchers = new GenericKeyedObjectPool(); /** * A pool of requesters for this connector, keyed by endpoint */ protected final GenericKeyedObjectPool requesters = new GenericKeyedObjectPool(); /** * The collection of listeners on this connector. Keyed by entrypoint */ protected final ConcurrentMap receivers = new ConcurrentHashMap(); /** * Defines the dispatcher threading profile */ private volatile ThreadingProfile dispatcherThreadingProfile; /** * Defines the requester threading profile */ private volatile ThreadingProfile requesterThreadingProfile; /** * Defines the receiver threading profile */ private volatile ThreadingProfile receiverThreadingProfile; /** * @see {@link #isCreateMultipleTransactedReceivers()} */ protected volatile boolean createMultipleTransactedReceivers = true; /** * @see {@link #getNumberOfConcurrentTransactedReceivers()} */ protected volatile int numberOfConcurrentTransactedReceivers = DEFAULT_NUM_CONCURRENT_TX_RECEIVERS; protected volatile ConnectionStrategy connectionStrategy; protected final WaitableBoolean connected = new WaitableBoolean(false); protected final WaitableBoolean connecting = new WaitableBoolean(false); /** * If the connect method was called via the start method, this will be set so * that when the connector comes on line it will be started */ protected final WaitableBoolean startOnConnect = new WaitableBoolean(false); /** * Optimise the handling of message notifications. If dynamic is set to false then the * cached notification handler implements a shortcut for message notifications. */ private boolean dynamicNotification = false; private ServerNotificationHandler cachedNotificationHandler; private final List supportedProtocols; /** * A shared work manager for all receivers registered with this connector. */ private final AtomicReference/**/ receiverWorkManager = new AtomicReference(); /** * A shared work manager for all requesters created for this connector. */ private final AtomicReference/**/ dispatcherWorkManager = new AtomicReference(); /** * A shared work manager for all requesters created for this connector. */ private final AtomicReference/**/ requesterWorkManager = new AtomicReference(); /** * A generic scheduling service for tasks that need to be performed periodically. */ private final AtomicReference/**/ scheduler = new AtomicReference(); /** * Holds the service configuration for this connector */ protected volatile TransportServiceDescriptor serviceDescriptor; /** * The map of service overrides that can be used to extend the capabilities of the * connector */ protected volatile Properties serviceOverrides; /** * The strategy used for reading and writing session information to and fromt he * transport */ protected volatile SessionHandler sessionHandler = new MuleSessionHandler(); protected MuleContext muleContext; public AbstractConnector() { setDynamicNotification(false); // always add at least the default protocol supportedProtocols = new ArrayList(); supportedProtocols.add(getProtocol().toLowerCase()); connectionStrategy = new SingleAttemptConnectionStrategy(); // TODO dispatcher pool configuration should be extracted, maybe even // moved into the factory? // NOTE: testOnBorrow MUST be FALSE. this is a bit of a design bug in // commons-pool since validate is used for both activation and passivation, // but has no way of knowing which way it is going. dispatchers.setTestOnBorrow(false); dispatchers.setTestOnReturn(true); requesters.setTestOnBorrow(false); requesters.setTestOnReturn(true); } /* * (non-Javadoc) * * @see org.mule.transport.UMOConnector#getName() */ public String getName() { return name; } /* * (non-Javadoc) * * @see org.mule.transport.UMOConnector#setName(java.lang.String) */ public void setName(String newName) { if (newName == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("Connector name").toString()); } if (logger.isDebugEnabled()) { logger.debug("Set Connector name to: " + newName); } name = newName; } public final synchronized void initialise() throws InitialisationException { if (initialised.get()) { InitialisationException e = new AlreadyInitialisedException("Connector '" + getProtocol() + "." + getName() + "'", this); throw e; // Just log a warning since initializing twice is bad but might not be the end of the world. //logger.warn(e); } if (logger.isInfoEnabled()) { logger.info("Initialising: " + this); } // Use lazy-init (in get() methods) for this instead. //dispatcherThreadingProfile = muleContext.getDefaultMessageDispatcherThreadingProfile(); //requesterThreadingProfile = muleContext.getDefaultMessageRequesterThreadingProfile(); //receiverThreadingProfile = muleContext.getDefaultMessageReceiverThreadingProfile(); // Initialise the structure of this connector this.initFromServiceDescriptor(); this.doInitialise(); // We do the management context injection here just in case we're using a default ExceptionStrategy //We always create a default just in case anything goes wrong before if(exceptionListener==null) { exceptionListener = new DefaultExceptionStrategy(); ((DefaultExceptionStrategy)exceptionListener).setMuleContext(muleContext); ((DefaultExceptionStrategy)exceptionListener).initialise(); } try { initWorkManagers(); } catch (MuleException e) { throw new InitialisationException(e, this); } initialised.set(true); } public final synchronized void start() throws MuleException { this.checkDisposed(); if (!this.isStarted()) { //TODO: Not sure about this. Right now the connector will connect only once // there is an endpoint associated with it and that endpoint is connected. // Do we also need the option of connecting the connector without any endpoints? // if (!this.isConnected()) // { // startOnConnect.set(true); // this.getConnectionStrategy().connect(this); // // Only start once we are connected // return; // } if (!this.isConnected()) { startOnConnect.set(true); // Don't call getConnectionStrategy(), it clones the connection strategy. // Connectors should have a single reconnection thread, unlike per receiver/dispatcher connectionStrategy.connect(this); // Only start once we are connected return; } if (logger.isInfoEnabled()) { logger.info("Starting: " + this); } // the scheduler is recreated after stop() ScheduledExecutorService currentScheduler = (ScheduledExecutorService) scheduler.get(); if (currentScheduler == null || currentScheduler.isShutdown()) { scheduler.set(this.getScheduler()); } this.doStart(); started.set(true); if (receivers != null) { for (Iterator iterator = receivers.values().iterator(); iterator.hasNext();) { MessageReceiver mr = (MessageReceiver) iterator.next(); if (logger.isDebugEnabled()) { logger.debug("Starting receiver on endpoint: " + mr.getEndpoint().getEndpointURI()); } mr.start(); } } if (logger.isInfoEnabled()) { logger.info("Started: " + this); } } } /* * (non-Javadoc) * * @see org.mule.api.transport.Connector#isStarted() */ public boolean isStarted() { return started.get(); } public final synchronized void stop() throws MuleException { if (this.isDisposed()) { return; } if (this.isStarted()) { if (logger.isInfoEnabled()) { logger.info("Stopping: " + this); } // shutdown our scheduler service ((ScheduledExecutorService) scheduler.get()).shutdown(); this.doStop(); started.set(false); // Stop all the receivers on this connector (this will cause them to // disconnect too) if (receivers != null) { for (Iterator iterator = receivers.values().iterator(); iterator.hasNext();) { MessageReceiver mr = (MessageReceiver) iterator.next(); if (logger.isDebugEnabled()) { logger.debug("Stopping receiver on endpoint: " + mr.getEndpoint().getEndpointURI()); } mr.stop(); } } } if (this.isConnected()) { try { this.disconnect(); } catch (Exception e) { // TODO MULE-863: What should we really do? logger.error("Failed to disconnect: " + e.getMessage(), e); } } // make sure the scheduler is gone scheduler.set(null); // we do not need to stop the work managers because they do no harm (will just be idle) // and will be reused on restart without problems. //TODO RM* THis shouldn't be here this.initialised.set(false); // started=false already issued above right after doStop() if (logger.isInfoEnabled()) { logger.info("Stopped: " + this); } } /* * (non-Javadoc) * * @see org.mule.api.transport.Connector#shutdown() */ public final synchronized void dispose() { disposing.set(true); if (logger.isInfoEnabled()) { logger.info("Disposing: " + this); } try { this.stop(); } catch (MuleException e) { // TODO MULE-863: What should we really do? logger.warn("Failed to stop during shutdown: " + e.getMessage(), e); } this.disposeReceivers(); this.disposeDispatchers(); this.disposeRequesters(); this.disposeWorkManagers(); this.doDispose(); disposed.set(true); initialised.set(false); if (logger.isInfoEnabled()) { logger.info("Disposed: " + this); } } protected void initWorkManagers() throws MuleException { if (receiverWorkManager.get() == null) { WorkManager newWorkManager = this.getReceiverThreadingProfile().createWorkManager( getName() + ".receiver"); if (receiverWorkManager.compareAndSet(null, newWorkManager)) { newWorkManager.start(); } } if (dispatcherWorkManager.get() == null) { WorkManager newWorkManager = this.getDispatcherThreadingProfile().createWorkManager( getName() + ".dispatcher"); if (dispatcherWorkManager.compareAndSet(null, newWorkManager)) { newWorkManager.start(); } } } protected void disposeWorkManagers() { logger.debug("Disposing dispatcher work manager"); WorkManager workManager = (WorkManager) dispatcherWorkManager.get(); if (workManager != null) { workManager.dispose(); } dispatcherWorkManager.set(null); logger.debug("Disposing receiver work manager"); workManager = (WorkManager) receiverWorkManager.get(); if (workManager != null) { workManager.dispose(); } receiverWorkManager.set(null); } protected void disposeReceivers() { if (receivers != null) { logger.debug("Disposing Receivers"); for (Iterator iterator = receivers.values().iterator(); iterator.hasNext();) { MessageReceiver receiver = (MessageReceiver) iterator.next(); try { this.destroyReceiver(receiver, receiver.getEndpoint()); } catch (Throwable e) { // TODO MULE-863: What should we really do? logger.error("Failed to destroy receiver: " + receiver, e); } } receivers.clear(); logger.debug("Receivers Disposed"); } } protected void disposeDispatchers() { if (dispatchers != null) { logger.debug("Disposing Dispatchers"); dispatchers.clear(); logger.debug("Dispatchers Disposed"); } } protected void disposeRequesters() { if (requesters != null) { logger.debug("Disposing Requesters"); requesters.clear(); logger.debug("Requesters Disposed"); } } /* * (non-Javadoc) * * @see org.mule.api.transport.Connector#isAlive() */ public boolean isDisposed() { return disposed.get(); } /* * (non-Javadoc) * * @see org.mule.api.transport.Connector#handleException(java.lang.Object, * java.lang.Throwable) */ public void handleException(Exception exception) { if (exceptionListener == null) { throw new MuleRuntimeException( CoreMessages.exceptionOnConnectorNotExceptionListener(this.getName()), exception); } else { exceptionListener.exceptionThrown(exception); } } /* * (non-Javadoc) * * @see org.mule.util.ExceptionListener#onException(java.lang.Throwable) */ public void exceptionThrown(Exception e) { handleException(e); } /** * @return the ExceptionStrategy for this endpoint * @see ExceptionListener */ public ExceptionListener getExceptionListener() { return exceptionListener; } /** * @param listener the ExceptionStrategy to use with this endpoint * @see ExceptionListener */ public void setExceptionListener(ExceptionListener listener) { exceptionListener = listener; } /** * @return Returns the dispatcherFactory. */ public MessageDispatcherFactory getDispatcherFactory() { return dispatcherFactory; } /** * @param dispatcherFactory The dispatcherFactory to set. */ public void setDispatcherFactory(MessageDispatcherFactory dispatcherFactory) { KeyedPoolableObjectFactory poolFactory; if (dispatcherFactory instanceof KeyedPoolableObjectFactory) { poolFactory = (KeyedPoolableObjectFactory) dispatcherFactory; } else { // need to adapt the factory for use by commons-pool poolFactory = new KeyedPoolMessageDispatcherFactoryAdapter(dispatcherFactory); } this.dispatchers.setFactory(poolFactory); // we keep a reference to the unadapted factory, otherwise people might end // up with ClassCastExceptions on downcast to their implementation (sigh) this.dispatcherFactory = dispatcherFactory; } /** * @return Returns the requesterFactory. */ public MessageRequesterFactory getRequesterFactory() { return requesterFactory; } /** * @param requesterFactory The requesterFactory to set. */ public void setRequesterFactory(MessageRequesterFactory requesterFactory) { KeyedPoolableObjectFactory poolFactory; if (requesterFactory instanceof KeyedPoolableObjectFactory) { poolFactory = (KeyedPoolableObjectFactory) requesterFactory; } else { // need to adapt the factory for use by commons-pool poolFactory = new KeyedPoolMessageRequesterFactoryAdapter(requesterFactory); } requesters.setFactory(poolFactory); // we keep a reference to the unadapted factory, otherwise people might end // up with ClassCastExceptions on downcast to their implementation (sigh) this.requesterFactory = requesterFactory; } /** * Returns the maximum number of dispatchers that can be concurrently active per * endpoint. * * @return max. number of active dispatchers */ public int getMaxDispatchersActive() { return this.dispatchers.getMaxActive(); } /** * Configures the maximum number of dispatchers that can be concurrently active * per endpoint * * @param maxActive max. number of active dispatchers */ public void setMaxDispatchersActive(int maxActive) { this.dispatchers.setMaxActive(maxActive); // adjust maxIdle in tandem to avoid thrashing this.dispatchers.setMaxIdle(maxActive); } private MessageDispatcher getDispatcher(OutboundEndpoint endpoint) throws MuleException { this.checkDisposed(); if (endpoint == null) { throw new IllegalArgumentException("Endpoint must not be null"); } if (!supportsProtocol(endpoint.getConnector().getProtocol())) { throw new IllegalArgumentException( CoreMessages.connectorSchemeIncompatibleWithEndpointScheme(this.getProtocol(), endpoint.getEndpointURI().toString()).getMessage()); } MessageDispatcher dispatcher = null; try { if (logger.isDebugEnabled()) { logger.debug("Borrowing a dispatcher for endpoint: " + endpoint.getEndpointURI()); } dispatcher = (MessageDispatcher)dispatchers.borrowObject(endpoint); if (logger.isDebugEnabled()) { logger.debug("Borrowed a dispatcher for endpoint: " + endpoint.getEndpointURI() + " = " + dispatcher.toString()); } return dispatcher; } catch (Exception ex) { throw new ConnectorException(CoreMessages.connectorCausedError(), this, ex); } finally { try { if (logger.isDebugEnabled()) { logger.debug("Borrowed dispatcher: " + ObjectUtils.toString(dispatcher, "null")); } } catch (Exception ex) { throw new ConnectorException(CoreMessages.connectorCausedError(), this, ex); } } } private void returnDispatcher(OutboundEndpoint endpoint, MessageDispatcher dispatcher) { if (endpoint != null && dispatcher != null) { try { if (logger.isDebugEnabled()) { logger.debug("Returning dispatcher for endpoint: " + endpoint.getEndpointURI() + " = " + dispatcher.toString()); } } catch (Exception ex) { //Logging failed } finally { try { dispatchers.returnObject(endpoint, dispatcher); } catch (Exception e) { // TODO MULE-863: What should we really do? // ignore - if the dispatcher is broken, it will likely get cleaned // up by the factory //RM* I think we should at least log this error so give some indication of what is failing logger.error("Failed to dispose dispatcher for endpoint: " + endpoint + ". This will cause a memory leak. Please report to", e); } } } } /** * Returns the maximum number of requesters that can be concurrently active per * endpoint. * * @return max. number of active requesters */ public int getMaxRequestersActive() { return this.requesters.getMaxActive(); } /** * Configures the maximum number of requesters that can be concurrently active * per endpoint * * @param maxActive max. number of active requesters */ public void setMaxRequestersActive(int maxActive) { this.requesters.setMaxActive(maxActive); // adjust maxIdle in tandem to avoid thrashing this.requesters.setMaxIdle(maxActive); } private MessageRequester getRequester(InboundEndpoint endpoint) throws MuleException { this.checkDisposed(); if (endpoint == null) { throw new IllegalArgumentException("Endpoint must not be null"); } if (!supportsProtocol(endpoint.getConnector().getProtocol())) { throw new IllegalArgumentException( CoreMessages.connectorSchemeIncompatibleWithEndpointScheme(this.getProtocol(), endpoint.getEndpointURI().toString()).getMessage()); } MessageRequester requester = null; try { if (logger.isDebugEnabled()) { logger.debug("Borrowing a requester for endpoint: " + endpoint.getEndpointURI()); } requester = (MessageRequester)requesters.borrowObject(endpoint); if (logger.isDebugEnabled()) { logger.debug("Borrowed a requester for endpoint: " + endpoint.getEndpointURI() + " = " + requester.toString()); } return requester; } catch (Exception ex) { throw new ConnectorException(CoreMessages.connectorCausedError(), this, ex); } finally { try { if (logger.isDebugEnabled()) { logger.debug("Borrowed requester: " + ObjectUtils.toString(requester, "null")); } } catch (Exception ex) { throw new ConnectorException(CoreMessages.connectorCausedError(), this, ex); } } } private void returnRequester(InboundEndpoint endpoint, MessageRequester requester) { if (endpoint != null && requester != null) { try { if (logger.isDebugEnabled()) { logger.debug("Returning requester for endpoint: " + endpoint.getEndpointURI() + " = " + requester.toString()); } } catch (Exception ex) { //Logging failed } finally { try { requesters.returnObject(endpoint, requester); } catch (Exception e) { // TODO MULE-863: What should we really do? // ignore - if the requester is broken, it will likely get cleaned // up by the factory //RM* I think we should at least log this error so give some indication of what is failing logger.error("Failed to dispose requester for endpoint: " + endpoint + ". This will cause a memory leak. Please report to", e); } } } } protected void checkDisposed() throws DisposeException { if (this.isDisposed()) { throw new DisposeException(CoreMessages.cannotUseDisposedConnector(), this); } } public MessageReceiver registerListener(Service service, InboundEndpoint endpoint) throws Exception { if (endpoint == null) { throw new IllegalArgumentException("The endpoint cannot be null when registering a listener"); } if (service == null) { throw new IllegalArgumentException("The service cannot be null when registering a listener"); } EndpointURI endpointUri = endpoint.getEndpointURI(); if (endpointUri == null) { throw new ConnectorException(CoreMessages.endpointIsNullForListener(), this); } logger.info("Registering listener: " + service.getName() + " on endpointUri: " + endpointUri.toString()); if (getReceiver(service, endpoint) != null) { throw new ConnectorException(CoreMessages.listenerAlreadyRegistered(endpointUri), this); } MessageReceiver receiver = createReceiver(service, endpoint); Object receiverKey = getReceiverKey(service, endpoint); receiver.setReceiverKey(receiverKey.toString()); // Since we're managing the creation we also need to initialise receiver.initialise(); receivers.put(receiverKey, receiver); // receivers.put(getReceiverKey(service, endpoint), receiver); return receiver; } /** * The method determines the key used to store the receiver against. * * @param service the service for which the endpoint is being registered * @param endpoint the endpoint being registered for the service * @return the key to store the newly created receiver against */ protected Object getReceiverKey(Service service, InboundEndpoint endpoint) { return StringUtils.defaultIfEmpty(endpoint.getEndpointURI().getFilterAddress(), endpoint .getEndpointURI().getAddress()); } public final void unregisterListener(Service service, InboundEndpoint endpoint) throws Exception { if (service == null) { throw new IllegalArgumentException( "The service must not be null when you unregister a listener"); } if (endpoint == null) { throw new IllegalArgumentException("The endpoint must not be null when you unregister a listener"); } EndpointURI endpointUri = endpoint.getEndpointURI(); if (endpointUri == null) { throw new IllegalArgumentException( "The endpointUri must not be null when you unregister a listener"); } if (logger.isInfoEnabled()) { logger.info("Removing listener on endpointUri: " + endpointUri); } if (receivers != null && !receivers.isEmpty()) { MessageReceiver receiver = (MessageReceiver)receivers.remove(getReceiverKey(service, endpoint)); if (receiver != null) { destroyReceiver(receiver, endpoint); receiver.dispose(); } } } /** * Getter for property 'dispatcherThreadingProfile'. * * @return Value for property 'dispatcherThreadingProfile'. */ public ThreadingProfile getDispatcherThreadingProfile() { if (dispatcherThreadingProfile == null && muleContext != null) { dispatcherThreadingProfile = muleContext.getDefaultMessageDispatcherThreadingProfile(); } return dispatcherThreadingProfile; } /** * Setter for property 'dispatcherThreadingProfile'. * * @param dispatcherThreadingProfile Value to set for property * 'dispatcherThreadingProfile'. */ public void setDispatcherThreadingProfile(ThreadingProfile dispatcherThreadingProfile) { this.dispatcherThreadingProfile = dispatcherThreadingProfile; } /** * Getter for property 'requesterThreadingProfile'. * * @return Value for property 'requesterThreadingProfile'. */ public ThreadingProfile getRequesterThreadingProfile() { if (requesterThreadingProfile == null && muleContext != null) { requesterThreadingProfile = muleContext.getDefaultMessageRequesterThreadingProfile(); } return requesterThreadingProfile; } /** * Setter for property 'requesterThreadingProfile'. * * @param requesterThreadingProfile Value to set for property * 'requesterThreadingProfile'. */ public void setRequesterThreadingProfile(ThreadingProfile requesterThreadingProfile) { this.requesterThreadingProfile = requesterThreadingProfile; } /** * Getter for property 'receiverThreadingProfile'. * * @return Value for property 'receiverThreadingProfile'. */ public ThreadingProfile getReceiverThreadingProfile() { if (receiverThreadingProfile == null && muleContext != null) { receiverThreadingProfile = muleContext.getDefaultMessageReceiverThreadingProfile(); } return receiverThreadingProfile; } /** * Setter for property 'receiverThreadingProfile'. * * @param receiverThreadingProfile Value to set for property * 'receiverThreadingProfile'. */ public void setReceiverThreadingProfile(ThreadingProfile receiverThreadingProfile) { this.receiverThreadingProfile = receiverThreadingProfile; } public void destroyReceiver(MessageReceiver receiver, InboundEndpoint endpoint) throws Exception { receiver.dispose(); } protected abstract void doInitialise() throws InitialisationException; /** * Template method to perform any work when destroying the connectoe */ protected abstract void doDispose(); /** * Template method to perform any work when starting the connectoe * * @throws MuleException if the method fails */ protected abstract void doStart() throws MuleException; /** * Template method to perform any work when stopping the connectoe * * @throws MuleException if the method fails */ protected abstract void doStop() throws MuleException; public List getDefaultInboundTransformers() { if (serviceDescriptor == null) { throw new RuntimeException("serviceDescriptor not initialized"); } return TransformerUtils.getDefaultInboundTransformers(serviceDescriptor); } public List getDefaultResponseTransformers() { if (serviceDescriptor == null) { throw new RuntimeException("serviceDescriptor not initialized"); } return TransformerUtils.getDefaultResponseTransformers(serviceDescriptor); } public List getDefaultOutboundTransformers() { if (serviceDescriptor == null) { throw new RuntimeException("serviceDescriptor not initialized"); } return TransformerUtils.getDefaultOutboundTransformers(serviceDescriptor); } /** * Getter for property 'replyToHandler'. * * @return Value for property 'replyToHandler'. */ public ReplyToHandler getReplyToHandler() { return new DefaultReplyToHandler(getDefaultResponseTransformers()); } /** * Fires a server notification to all registered listeners * * @param notification the notification to fire. */ public void fireNotification(ServerNotification notification) { cachedNotificationHandler.fireNotification(notification); } /** * Getter for property 'connectionStrategy'. * * @return Value for property 'connectionStrategy'. */ //TODO RM* REMOVE public ConnectionStrategy getConnectionStrategy() { // not happy with this but each receiver needs its own instance // of the connection strategy and using a factory just introduces extra // implementation try { return (ConnectionStrategy) BeanUtils.cloneBean(connectionStrategy); } catch (Exception e) { throw new MuleRuntimeException(CoreMessages.failedToClone("connectionStrategy"), e); } } /** * Setter for property 'connectionStrategy'. * * @param connectionStrategy Value to set for property 'connectionStrategy'. */ public void setConnectionStrategy(ConnectionStrategy connectionStrategy) { this.connectionStrategy = connectionStrategy; } /** {@inheritDoc} */ public boolean isDisposing() { return disposing.get(); } public boolean isRemoteSyncEnabled() { return false; } public boolean isSyncEnabled(String protocol) { return false; } public MessageReceiver getReceiver(Service service, InboundEndpoint endpoint) { if (receivers != null) { Object key = getReceiverKey(service, endpoint); if (key != null) { return (MessageReceiver) receivers.get(key); } else { throw new RuntimeException("getReceiverKey() returned a null key"); } } else { throw new RuntimeException("Connector has not been initialized."); } } /** * Getter for property 'receivers'. * * @return Value for property 'receivers'. */ public Map getReceivers() { return Collections.unmodifiableMap(receivers); } public MessageReceiver lookupReceiver(String key) { if (key != null) { return (MessageReceiver) receivers.get(key); } else { throw new IllegalArgumentException("Receiver key must not be null"); } } public MessageReceiver[] getReceivers(String wildcardExpression) { WildcardFilter filter = new WildcardFilter(wildcardExpression); filter.setCaseSensitive(false); List found = new ArrayList(); for (Iterator iterator = receivers.entrySet().iterator(); iterator.hasNext();) { Map.Entry e = (Map.Entry) iterator.next(); if (filter.accept(e.getKey())) { found.add(e.getValue()); } } return (MessageReceiver[]) CollectionUtils.toArrayOfComponentType(found, MessageReceiver.class); } public void connect() throws Exception { this.checkDisposed(); if (connected.get()) { return; } /* Until the recursive startConnector() -> connect() -> doConnect() -> connect() calls are unwound between a connector and connection strategy, this call has to be here, and not below (commented out currently). Otherwise, e.g. WebspherMQ goes into an endless reconnect thrashing loop, see MULE-1150 for more details. */ try { if (connecting.get()) { this.doConnect(); } if (connecting.compareAndSet(false, true)) { if (logger.isDebugEnabled()) { logger.debug("Connecting: " + this); } connectionStrategy.connect(this); logger.info("Connected: " + getConnectionDescription()); // This method calls itself so the connecting flag is set first, then // the connection is made on the second call return; } // see the explanation above //this.doConnect(); connected.set(true); connecting.set(false); this.fireNotification(new ConnectionNotification(this, getConnectEventId(), ConnectionNotification.CONNECTION_CONNECTED)); } catch (Exception e) { connected.set(false); connecting.set(false); this.fireNotification(new ConnectionNotification(this, getConnectEventId(), ConnectionNotification.CONNECTION_FAILED)); if (e instanceof ConnectException || e instanceof FatalConnectException) { // rethrow throw e; } else { throw new ConnectException(e, this); } } if (startOnConnect.get()) { this.start(); } //TODO RM*. If the connection strategy is called on the receivers, the connector strategy gets called too, //to ensure its connected. Therefore the connect method on the connector needs to be idempotent and not try //and connect dispatchers or receivers // else // { // for (Iterator iterator = receivers.values().iterator(); iterator.hasNext();) // { // MessageReceiver receiver = (MessageReceiver)iterator.next(); // if (logger.isDebugEnabled()) // { // logger.debug("Connecting receiver on endpoint: " // + receiver.getEndpoint().getEndpointURI()); // } // receiver.connect(); // } // } } public void disconnect() throws Exception { startOnConnect.set(this.isStarted()); this.fireNotification(new ConnectionNotification(this, getConnectEventId(), ConnectionNotification.CONNECTION_DISCONNECTED)); connected.set(false); try { this.doDisconnect(); } finally { this.stop(); } logger.info("Disconnected: " + this.getConnectionDescription()); } public String getConnectionDescription() { return this.toString(); } public final boolean isConnected() { return connected.get(); } /** * Template method where any connections should be made for the connector * * @throws Exception */ protected abstract void doConnect() throws Exception; /** * Template method where any connected resources used by the connector should be * disconnected * * @throws Exception */ protected abstract void doDisconnect() throws Exception; /** * The resource id used when firing ConnectEvents from this connector * * @return the resource id used when firing ConnectEvents from this connector */ protected String getConnectEventId() { return getName(); } /** * For better throughput when using TransactedMessageReceivers this will enable a * number of concurrent receivers, based on the value returned by * {@link #getNumberOfConcurrentTransactedReceivers()}. This property is used by * transports that support transactions, specifically receivers that extend the * TransactedPollingMessageReceiver. * * @return true if multiple receivers will be enabled for this connection */ public boolean isCreateMultipleTransactedReceivers() { return createMultipleTransactedReceivers; } /** * @see {@link #isCreateMultipleTransactedReceivers()} * @param createMultipleTransactedReceivers if true, multiple receivers will be * created for this connection */ public void setCreateMultipleTransactedReceivers(boolean createMultipleTransactedReceivers) { this.createMultipleTransactedReceivers = createMultipleTransactedReceivers; } /** * Returns the number of concurrent receivers that will be launched when * {@link #isCreateMultipleTransactedReceivers()} returns true. * * @see #DEFAULT_NUM_CONCURRENT_TX_RECEIVERS */ public int getNumberOfConcurrentTransactedReceivers() { return numberOfConcurrentTransactedReceivers; } /** * @see {@link #getNumberOfConcurrentTransactedReceivers()} * @param count the number of concurrent transacted receivers to start */ public void setNumberOfConcurrentTransactedReceivers(int count) { numberOfConcurrentTransactedReceivers = count; } public void setDynamicNotification(boolean dynamic) { dynamicNotification = dynamic; } protected void updateCachedNotificationHandler() { if (null != muleContext) { if (dynamicNotification) { cachedNotificationHandler = muleContext.getNotificationManager(); } else { cachedNotificationHandler = new OptimisedNotificationHandler(muleContext.getNotificationManager(), MessageNotification.class); } } } public boolean isEnableMessageEvents() { return cachedNotificationHandler.isNotificationEnabled(MessageNotification.class); } /** * Registers other protocols 'understood' by this connector. These must contain * scheme meta info. Any protocol registered must begin with the protocol of this * connector, i.e. If the connector is axis the protocol for jms over axis will * be axis:jms. Here, 'axis' is the scheme meta info and 'jms' is the protocol. * If the protocol argument does not start with the connector's protocol, it will * be appended. * * @param protocol the supported protocol to register */ public void registerSupportedProtocol(String protocol) { protocol = protocol.toLowerCase(); if (protocol.startsWith(getProtocol().toLowerCase())) { registerSupportedProtocolWithoutPrefix(protocol); } else { supportedProtocols.add(getProtocol().toLowerCase() + ":" + protocol); } } /** * Registers other protocols 'understood' by this connector. These must contain * scheme meta info. Unlike the {@link #registerSupportedProtocol(String)} method, * this allows you to register protocols that are not prefixed with the connector * protocol. This is useful where you use a Service Finder to discover which * Transport implementation to use. For example the 'wsdl' transport is a generic * 'finder' transport that will use Axis, Xfire or Glue to create the WSDL * client. These transport protocols would be wsdl-axis, wsdl-xfire and * wsdl-glue, but they can all support 'wsdl' protocol too. * * @param protocol the supported protocol to register */ protected void registerSupportedProtocolWithoutPrefix(String protocol) { supportedProtocols.add(protocol.toLowerCase()); } public void unregisterSupportedProtocol(String protocol) { protocol = protocol.toLowerCase(); if (protocol.startsWith(getProtocol().toLowerCase())) { supportedProtocols.remove(protocol); } else { supportedProtocols.remove(getProtocol().toLowerCase() + ":" + protocol); } } /** * @return true if the protocol is supported by this connector. */ public boolean supportsProtocol(String protocol) { return supportedProtocols.contains(protocol.toLowerCase()); } /** * Returns an unmodifiable list of the protocols supported by this connector * * @return an unmodifiable list of the protocols supported by this connector */ public List getSupportedProtocols() { return Collections.unmodifiableList(supportedProtocols); } /** * Sets A list of protocols that the connector can accept * * @param supportedProtocols */ public void setSupportedProtocols(List supportedProtocols) { for (Iterator iterator = supportedProtocols.iterator(); iterator.hasNext();) { String s = (String) iterator.next(); registerSupportedProtocol(s); } } /** * Returns a work manager for message receivers. */ protected WorkManager getReceiverWorkManager(String receiverName) throws MuleException { return (WorkManager) receiverWorkManager.get(); } /** * Returns a work manager for message dispatchers. * * @throws MuleException in case of error */ protected WorkManager getDispatcherWorkManager() throws MuleException { return (WorkManager) dispatcherWorkManager.get(); } /** * Returns a work manager for message requesters. * * @throws MuleException in case of error */ protected WorkManager getRequesterWorkManager() throws MuleException { return (WorkManager) requesterWorkManager.get(); } /** * Returns a Scheduler service for periodic tasks, currently limited to internal * use. Note: getScheduler() currently conflicts with the same method in the * Quartz transport */ public ScheduledExecutorService getScheduler() { if (scheduler.get() == null) { ThreadFactory threadFactory = new NamedThreadFactory(this.getName() + ".scheduler"); ScheduledThreadPoolExecutor newExecutor = new ScheduledThreadPoolExecutor(4, threadFactory); newExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); newExecutor.setKeepAliveTime(this.getReceiverThreadingProfile().getThreadTTL(), TimeUnit.MILLISECONDS); newExecutor.allowCoreThreadTimeOut(true); if (!scheduler.compareAndSet(null, newExecutor)) { // someone else was faster, ditch our copy. newExecutor.shutdown(); } } return (ScheduledExecutorService) scheduler.get(); } /** * Getter for property 'sessionHandler'. * * @return Value for property 'sessionHandler'. */ public SessionHandler getSessionHandler() { return sessionHandler; } /** * Setter for property 'sessionHandler'. * * @param sessionHandler Value to set for property 'sessionHandler'. */ public void setSessionHandler(SessionHandler sessionHandler) { this.sessionHandler = sessionHandler; } public void workAccepted(WorkEvent event) { this.handleWorkException(event, "workAccepted"); } public void workRejected(WorkEvent event) { this.handleWorkException(event, "workRejected"); } public void workStarted(WorkEvent event) { this.handleWorkException(event, "workStarted"); } public void workCompleted(WorkEvent event) { this.handleWorkException(event, "workCompleted"); } protected void handleWorkException(WorkEvent event, String type) { if (event == null) { return; } Throwable e = event.getException(); if (e == null) { return; } if (e.getCause() != null) { e = e.getCause(); } logger.error("Work caused exception on '" + type + "'. Work being executed was: " + event.getWork().toString()); if (e instanceof Exception) { this.handleException((Exception) e); } else { throw new MuleRuntimeException(CoreMessages.connectorCausedError(this.getName()), e); } } // TODO the following methods should probably be lifecycle-enabled; // for now they are only stubs to get the refactoring going. public void dispatch(OutboundEndpoint endpoint, MuleEvent event) throws DispatchException { MessageDispatcher dispatcher = null; try { dispatcher = this.getDispatcher(endpoint); dispatcher.dispatch(event); } catch (DispatchException dex) { throw dex; } catch (MuleException ex) { throw new DispatchException(event.getMessage(), endpoint, ex); } finally { this.returnDispatcher(endpoint, dispatcher); } } /** * This method will return the dispatcher to the pool or, if the payload is an inputstream, * replace the payload with a new DelegatingInputStream which returns the dispatcher to * the pool when the stream is closed. * * @param endpoint * @param dispatcher * @param result */ protected void setupDispatchReturn(final OutboundEndpoint endpoint, final MessageDispatcher dispatcher, MuleMessage result) { if (result != null && result.getPayload() instanceof InputStream) { DelegatingInputStream is = new DelegatingInputStream((InputStream)result.getPayload()) { public void close() throws IOException { try { super.close(); } finally { returnDispatcher(endpoint, dispatcher); } } }; result.setPayload(is); } else { this.returnDispatcher(endpoint, dispatcher); } } public MuleMessage request(String uri, long timeout) throws Exception { return request(getMuleContext().getRegistry().lookupEndpointFactory().getInboundEndpoint(uri), timeout); } public MuleMessage request(InboundEndpoint endpoint, long timeout) throws Exception { MessageRequester requester = null; MuleMessage result = null; try { requester = this.getRequester(endpoint); result = requester.request(timeout); return result; } finally { setupRequestReturn(endpoint, requester, result); } } /** * This method will return the requester to the pool or, if the payload is an inputstream, * replace the payload with a new DelegatingInputStream which returns the requester to * the pool when the stream is closed. * * @param endpoint * @param requester * @param result */ protected void setupRequestReturn(final InboundEndpoint endpoint, final MessageRequester requester, MuleMessage result) { if (result != null && result.getPayload() instanceof InputStream) { DelegatingInputStream is = new DelegatingInputStream((InputStream)result.getPayload()) { public void close() throws IOException { try { super.close(); } finally { returnRequester(endpoint, requester); } } }; result.setPayload(is); } else { this.returnRequester(endpoint, requester); } } public MuleMessage send(OutboundEndpoint endpoint, MuleEvent event) throws DispatchException { MessageDispatcher dispatcher = null; try { dispatcher = this.getDispatcher(endpoint); return dispatcher.send(event); } catch (DispatchException dex) { throw dex; } catch (MuleException ex) { throw new DispatchException(event.getMessage(), endpoint, ex); } finally { this.returnDispatcher(endpoint, dispatcher); } } // -------- Methods from the removed AbstractServiceEnabled Connector /** * When this connector is created via the * {@link org.mule.transport.service.TransportFactory} the endpoint used to * determine the connector type is passed to this method so that any properties * set on the endpoint that can be used to initialise the connector are made * available. * * @param endpointUri the {@link EndpointURI} use to create this connector * @throws InitialisationException If there are any problems with the * configuration set on the Endpoint or if another exception is * thrown it is wrapped in an InitialisationException. */ public void initialiseFromUrl(EndpointURI endpointUri) throws InitialisationException { if (!supportsProtocol(endpointUri.getFullScheme())) { throw new InitialisationException( CoreMessages.schemeNotCompatibleWithConnector(endpointUri.getFullScheme(), this.getClass()), this); } Properties props = new Properties(); props.putAll(endpointUri.getParams()); // auto set username and password if (endpointUri.getUserInfo() != null) { props.setProperty("username", endpointUri.getUser()); String passwd = endpointUri.getPassword(); if (passwd != null) { props.setProperty("password", passwd); } } String host = endpointUri.getHost(); if (host != null) { props.setProperty("hostname", host); props.setProperty("host", host); } if (endpointUri.getPort() > -1) { props.setProperty("port", String.valueOf(endpointUri.getPort())); } org.mule.util.BeanUtils.populateWithoutFail(this, props, true); setName(ObjectNameHelper.getConnectorName(this)); //initialise(); } /** * Initialises this connector from its {@link TransportServiceDescriptor} This * will be called before the {@link #doInitialise()} method is called. * * @throws InitialisationException InitialisationException If there are any * problems with the configuration or if another exception is thrown * it is wrapped in an InitialisationException. */ protected synchronized void initFromServiceDescriptor() throws InitialisationException { try { serviceDescriptor = (TransportServiceDescriptor) RegistryContext.getRegistry().lookupServiceDescriptor(ServiceDescriptorFactory.PROVIDER_SERVICE_TYPE, getProtocol().toLowerCase(), serviceOverrides); if (serviceDescriptor == null) { throw new ServiceException(CoreMessages.noServiceTransportDescriptor(getProtocol())); } if (logger.isDebugEnabled()) { logger.debug("Loading DispatcherFactory for connector: " + getName() + " (" + getClass().getName() + ")"); } MessageDispatcherFactory df = serviceDescriptor.createDispatcherFactory(); if (df != null) { this.setDispatcherFactory(df); } else if (logger.isDebugEnabled()) { logger.debug("Transport '" + getProtocol() + "' will not support outbound endpoints: "); } if (logger.isDebugEnabled()) { logger.debug("Loading RequesterFactory for connector: " + getName() + " (" + getClass().getName() + ")"); } MessageRequesterFactory rf = serviceDescriptor.createRequesterFactory(); if (rf != null) { this.setRequesterFactory(rf); } else if (logger.isDebugEnabled()) { logger.debug("Transport '" + getProtocol() + "' will not support requests: "); } sessionHandler = serviceDescriptor.createSessionHandler(); // TODO Do we still need to support this for 2.x? // Set any manager default properties for the connector. These are set on // the Manager with a protocol e.g. jms.specification=1.1 // This provides a really convenient way to set properties on an object // from unit tests // Map props = new HashMap(); // PropertiesUtils.getPropertiesWithPrefix(muleContext.getRegistry().lookupProperties(), getProtocol() // .toLowerCase(), props); // if (props.size() > 0) // { // props = PropertiesUtils.removeNamespaces(props); // org.mule.util.BeanUtils.populateWithoutFail(this, props, true); // } } catch (Exception e) { throw new InitialisationException(e, this); } } /** * Get the {@link TransportServiceDescriptor} for this connector. This will be * null if the connector was created by the developer. To create a connector the * proper way the developer should use the {@link TransportFactory} and pass in * an endpoint. * * @return the {@link TransportServiceDescriptor} for this connector */ protected TransportServiceDescriptor getServiceDescriptor() { if (serviceDescriptor == null) { throw new IllegalStateException("This connector has not yet been initialised: " + name); } return serviceDescriptor; } /** * Create a Message receiver for this connector * * @param service the service that will receive events from this receiver, * the listener * @param endpoint the endpoint that defies this inbound communication * @return an instance of the message receiver defined in this connectors' * {@link org.mule.transport.service.TransportServiceDescriptor} * initialised using the service and endpoint. * @throws Exception if there is a problem creating the receiver. This exception * really depends on the underlying transport, thus any exception * could be thrown */ protected MessageReceiver createReceiver(Service service, InboundEndpoint endpoint) throws Exception { return getServiceDescriptor().createMessageReceiver(this, service, endpoint); } /** * Gets a MessageAdapter for the endpoint for the given message * (data) * * @param message the data with which to initialise the * MessageAdapter * @return the MessageAdapter for the endpoint * @throws org.mule.api.MessagingException if the message parameter is not * supported * @see org.mule.api.transport.MessageAdapter */ public MessageAdapter getMessageAdapter(Object message) throws MessagingException { try { return serviceDescriptor.createMessageAdapter(message); } catch (TransportServiceException e) { throw new MessagingException(CoreMessages.failedToCreate("Message Adapter"), message, e); } } /** * A map of fully qualified class names that should override those in the * connectors' service descriptor This map will be null if there are no overrides * * @return a map of override values or null */ public Map getServiceOverrides() { return serviceOverrides; } /** * Set the Service overrides on this connector. * * @param serviceOverrides the override values to use */ public void setServiceOverrides(Map serviceOverrides) { this.serviceOverrides = new Properties(); this.serviceOverrides.putAll(serviceOverrides); } /** * Will get the output stream for this type of transport. Typically this * will be called only when Streaming is being used on an outbound endpoint. * If Streaming is not supported by this transport an {@link UnsupportedOperationException} * is thrown. Note that the stream MUST release resources on close. For help doing so, see * {@link org.mule.model.streaming.CallbackOutputStream}. * * @param endpoint the endpoint that releates to this Dispatcher * @param message the current message being processed * @return the output stream to use for this request * @throws MuleException in case of any error */ public OutputStream getOutputStream(OutboundEndpoint endpoint, MuleMessage message) throws MuleException { throw new UnsupportedOperationException( CoreMessages.streamingNotSupported(this.getProtocol()).toString()); } public MuleContext getMuleContext() { return muleContext; } public void setMuleContext(MuleContext context) { this.muleContext = context; updateCachedNotificationHandler(); } // @Override public String toString() { final StringBuffer sb = new StringBuffer(120); sb.append(ClassUtils.getSimpleName(this.getClass())); sb.append("{this=").append(Integer.toHexString(System.identityHashCode(this))); sb.append(", started=").append(started); sb.append(", initialised=").append(initialised); sb.append(", name='").append(name).append('\''); sb.append(", disposed=").append(disposed); sb.append(", numberOfConcurrentTransactedReceivers=").append(numberOfConcurrentTransactedReceivers); sb.append(", createMultipleTransactedReceivers=").append(createMultipleTransactedReceivers); sb.append(", connected=").append(connected); sb.append(", supportedProtocols=").append(supportedProtocols); sb.append(", serviceOverrides=").append(serviceOverrides); sb.append('}'); return sb.toString(); } } mule-2.0.1/core/src/main/java/org/mule/transport/KeyedPoolMessageRequesterFactoryAdapter.java0000644000175000017500000000616610757615756032301 0ustar charlescharles/* * $Id: KeyedPoolMessageRequesterFactoryAdapter.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.api.transport.MessageRequesterFactory; import org.mule.config.i18n.CoreMessages; import org.apache.commons.pool.KeyedPoolableObjectFactory; /** * KeyedPoolMessageRequesterFactoryAdapter adapts a * MessageRequesterFactory with methods from commons-pool * KeyedPoolableObjectFactory. It is only required for requester * factories that do not inherit from AbstractMessageRequesterFactory. * * @see org.mule.transport.AbstractMessageRequesterFactory */ public class KeyedPoolMessageRequesterFactoryAdapter implements MessageRequesterFactory, KeyedPoolableObjectFactory { private final MessageRequesterFactory factory; public KeyedPoolMessageRequesterFactoryAdapter(MessageRequesterFactory factory) { super(); if (factory == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("factory").toString()); } this.factory = factory; } public void activateObject(Object key, Object obj) throws Exception { factory.activate((InboundEndpoint) key, (MessageRequester) obj); } public void destroyObject(Object key, Object obj) throws Exception { factory.destroy((InboundEndpoint) key, (MessageRequester) obj); } public Object makeObject(Object key) throws Exception { return factory.create((InboundEndpoint) key); } public void passivateObject(Object key, Object obj) throws Exception { factory.passivate((InboundEndpoint) key, (MessageRequester) obj); } public boolean validateObject(Object key, Object obj) { return factory.validate((InboundEndpoint) key, (MessageRequester) obj); } public boolean isCreateRequesterPerRequest() { return factory.isCreateRequesterPerRequest(); } public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return factory.create(endpoint); } public void activate(InboundEndpoint endpoint, MessageRequester requester) throws MuleException { factory.activate(endpoint, requester); } public void destroy(InboundEndpoint endpoint, MessageRequester requester) { factory.destroy(endpoint, requester); } public void passivate(InboundEndpoint endpoint, MessageRequester requester) { factory.passivate(endpoint, requester); } public boolean validate(InboundEndpoint endpoint, MessageRequester requester) { return factory.validate(endpoint, requester); } }mule-2.0.1/core/src/main/java/org/mule/transport/PollingReceiverWorker.java0000644000175000017500000000337510745677442026627 0ustar charlescharles/* * $Id: PollingReceiverWorker.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import javax.resource.spi.work.Work; public class PollingReceiverWorker implements Work { protected final AbstractPollingMessageReceiver receiver; protected volatile boolean running = false; public PollingReceiverWorker(AbstractPollingMessageReceiver pollingMessageReceiver) { super(); receiver = pollingMessageReceiver; } public AbstractPollingMessageReceiver getReceiver() { return receiver; } public boolean isRunning() { return running; } // the run() method will exit after each poll() since it will be invoked again // by the scheduler public void run() { if (!receiver.stopped.get()) { try { running = true; // make sure we are connected, wait if necessary receiver.connected.whenTrue(null); receiver.poll(); } catch (InterruptedException e) { // stop polling receiver.stop(); } catch (Exception e) { receiver.handleException(e); } finally { running = false; } } } public void release() { // nop } } mule-2.0.1/core/src/main/java/org/mule/transport/AbstractMessageDispatcherFactory.java0000644000175000017500000000540610757615756030753 0ustar charlescharles/* * $Id: AbstractMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.api.transport.MessageDispatcherFactory; import org.mule.util.ClassUtils; /** * AbstractMessageDispatcherFactory is a base implementation of the * MessageDispatcherFactory interface for managing the lifecycle of * message dispatchers. * * @see MessageDispatcherFactory */ public abstract class AbstractMessageDispatcherFactory implements MessageDispatcherFactory { public AbstractMessageDispatcherFactory() { super(); } /** * This default implementation of * {@link MessageDispatcherFactory#isCreateDispatcherPerRequest()} returns * false, which means that dispatchers are pooled according to * their lifecycle as described in {@link MessageDispatcher}. * * @return false by default, unless overwritten by a subclass. */ public boolean isCreateDispatcherPerRequest() { return false; } public abstract MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException; public void activate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) throws MuleException { dispatcher.activate(); } public void destroy(OutboundEndpoint endpoint, MessageDispatcher dispatcher) { dispatcher.dispose(); } public void passivate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) { dispatcher.passivate(); } public boolean validate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) { // Unless dispatchers are to be disposed of after every request, we check if // the dispatcher is still valid or has e.g. disposed itself after an // exception. return (this.isCreateDispatcherPerRequest() ? false : dispatcher.validate()); } // @Override public String toString() { final StringBuffer sb = new StringBuffer(60); sb.append(ClassUtils.getSimpleName(this.getClass())); sb.append("{this=").append(Integer.toHexString(System.identityHashCode(this))); sb.append(", createDispatcherPerRequest=").append(this.isCreateDispatcherPerRequest()); sb.append('}'); return sb.toString(); } } mule-2.0.1/core/src/main/java/org/mule/transport/AbstractConnectable.java0000644000175000017500000001774010745677442026246 0ustar charlescharles/* * $Id: AbstractConnectable.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleException; import org.mule.api.MuleRuntimeException; import org.mule.api.context.WorkManager; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.transport.Connectable; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.ConnectionNotification; import org.mule.util.ClassUtils; import java.beans.ExceptionListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Provide a default dispatch (client) support for handling threads lifecycle and validation. */ public abstract class AbstractConnectable implements Connectable, ExceptionListener { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); /** * Thread pool of Connector sessions */ protected WorkManager workManager = null; protected final ImmutableEndpoint endpoint; protected final AbstractConnector connector; protected boolean disposed = false; protected ConnectionStrategy connectionStrategy; protected volatile boolean connecting = false; protected volatile boolean connected = false; public AbstractConnectable(ImmutableEndpoint endpoint) { this.endpoint = endpoint; this.connector = (AbstractConnector) endpoint.getConnector(); connectionStrategy = endpoint.getConnectionStrategy(); if (connectionStrategy instanceof AbstractConnectionStrategy) { // We don't want to do threading in the dispatcher because we're either // already running in a worker thread (asynchronous) or we need to // complete the operation in a single thread final AbstractConnectionStrategy connStrategy = (AbstractConnectionStrategy) connectionStrategy; if (connStrategy.isDoThreading()) { if (logger.isDebugEnabled()) { logger.debug("Overriding doThreading to false on " + connStrategy); } connStrategy.setDoThreading(false); } } if (isDoThreading()) { try { workManager = connector.getDispatcherWorkManager(); } catch (MuleException e) { disposeAndLogException(); throw new MuleRuntimeException(CoreMessages.failedToStart("WorkManager"), e); } } } protected void disposeAndLogException() { try { dispose(); } catch (Throwable t) { logger.error("Could not dispose of the message dispatcher!", t); } } /* * (non-Javadoc) * * @see org.mule.util.ExceptionListener#onException(java.lang.Throwable) */ public void exceptionThrown(Exception e) { try { getConnector().handleException(e); } finally { dispose(); } } public boolean validate() { // by default a dispatcher/requester can be used unless disposed return !disposed; } public void activate() { // nothing to do by default } public void passivate() { // nothing to do by default } /** * Template method to destroy any resources held by the Message Dispatcher */ public final synchronized void dispose() { if (!disposed) { try { try { this.disconnect(); } catch (Exception e) { // TODO MULE-863: What should we really do? logger.warn(e.getMessage(), e); } this.doDispose(); if (workManager != null) { workManager.dispose(); } } finally { disposed = true; } } } public Connector getConnector() { return connector; } public ImmutableEndpoint getEndpoint() { return endpoint; } public synchronized void connect() throws Exception { if (disposed) { throw new IllegalStateException("Requester/dispatcher has been disposed; cannot connect to resource"); } if (connected) { return; } if (!connecting) { connecting = true; if (logger.isDebugEnabled()) { logger.debug("Connecting: " + this); } connectionStrategy.connect(this); logger.info("Connected: " + this); return; } try { //Make sure the connector has connected. If it is connected, this method does nothing connectionStrategy.connect(connector); this.doConnect(); connected = true; connecting = false; connector.fireNotification(new ConnectionNotification(this, getConnectEventId(endpoint), ConnectionNotification.CONNECTION_CONNECTED)); } catch (Exception e) { connected = false; connecting = false; connector.fireNotification(new ConnectionNotification(this, getConnectEventId(endpoint), ConnectionNotification.CONNECTION_FAILED)); if (e instanceof ConnectException) { throw (ConnectException) e; } else { throw new ConnectException(e, this); } } } public synchronized void disconnect() throws Exception { if (!connected) { return; } if (logger.isDebugEnabled()) { logger.debug("Disconnecting: " + this); } this.doDisconnect(); connected = false; logger.info("Disconnected: " + this); connector.fireNotification(new ConnectionNotification(this, getConnectEventId(endpoint), ConnectionNotification.CONNECTION_DISCONNECTED)); } protected String getConnectEventId(ImmutableEndpoint endpoint) { return connector.getName() + ".dispatcher(" + endpoint.getEndpointURI().getUri() + ")"; } public final boolean isConnected() { return connected; } protected boolean isDoThreading () { return connector.getDispatcherThreadingProfile().isDoThreading(); } /** * Returns a string identifying the underlying resource * * @return */ public String getConnectionDescription() { return endpoint.getEndpointURI().toString(); } public synchronized void reconnect() throws Exception { disconnect(); connect(); } protected abstract void doDispose(); protected abstract void doConnect() throws Exception; protected abstract void doDisconnect() throws Exception; // @Override public String toString() { final StringBuffer sb = new StringBuffer(80); sb.append(ClassUtils.getSimpleName(this.getClass())); sb.append("{this=").append(Integer.toHexString(System.identityHashCode(this))); sb.append(", endpoint=").append(endpoint.getEndpointURI().getUri()); sb.append(", disposed=").append(disposed); sb.append('}'); return sb.toString(); } }mule-2.0.1/core/src/main/java/org/mule/transport/KeyedPoolMessageDispatcherFactoryAdapter.java0000644000175000017500000000622010757615756032377 0ustar charlescharles/* * $Id: KeyedPoolMessageDispatcherFactoryAdapter.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.api.transport.MessageDispatcherFactory; import org.mule.config.i18n.CoreMessages; import org.apache.commons.pool.KeyedPoolableObjectFactory; /** * KeyedPoolMessageDispatcherFactoryAdapter adapts a * MessageDispatcherFactory with methods from commons-pool * KeyedPoolableObjectFactory. It is only required for dispatcher * factories that do not inherit from AbstractMessageDispatcherFactory. * * @see AbstractMessageDispatcherFactory */ public class KeyedPoolMessageDispatcherFactoryAdapter implements MessageDispatcherFactory, KeyedPoolableObjectFactory { private final MessageDispatcherFactory factory; public KeyedPoolMessageDispatcherFactoryAdapter(MessageDispatcherFactory factory) { super(); if (factory == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("factory").toString()); } this.factory = factory; } public void activateObject(Object key, Object obj) throws Exception { factory.activate((OutboundEndpoint) key, (MessageDispatcher) obj); } public void destroyObject(Object key, Object obj) throws Exception { factory.destroy((OutboundEndpoint) key, (MessageDispatcher) obj); } public Object makeObject(Object key) throws Exception { return factory.create((OutboundEndpoint) key); } public void passivateObject(Object key, Object obj) throws Exception { factory.passivate((OutboundEndpoint) key, (MessageDispatcher) obj); } public boolean validateObject(Object key, Object obj) { return factory.validate((OutboundEndpoint) key, (MessageDispatcher) obj); } public boolean isCreateDispatcherPerRequest() { return factory.isCreateDispatcherPerRequest(); } public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return factory.create(endpoint); } public void activate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) throws MuleException { factory.activate(endpoint, dispatcher); } public void destroy(OutboundEndpoint endpoint, MessageDispatcher dispatcher) { factory.destroy(endpoint, dispatcher); } public void passivate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) { factory.passivate(endpoint, dispatcher); } public boolean validate(OutboundEndpoint endpoint, MessageDispatcher dispatcher) { return factory.validate(endpoint, dispatcher); } } mule-2.0.1/core/src/main/java/org/mule/transport/MessagePropertiesContext.java0000644000175000017500000002077611002521634027330 0ustar charlescharles/* * $Id: MessagePropertiesContext.java 11609 2008-04-20 01:59:56Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.transport.PropertyScope; import org.mule.util.MapUtils; import org.mule.util.ObjectUtils; import java.io.Serializable; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; /** TODO */ public class MessagePropertiesContext implements Serializable { protected Map scopedMap; protected Set keySet; //TODO RM*: Map these to a RegistryMapView, currently in another branch :( //Treat Application properites as a special call Map applicationProperties = new ConcurrentHashMap(0); private PropertyScope defaultScope = PropertyScope.OUTBOUND; /** * if a property is not available in any ther scope, should we check the registry. * Note there will be performance implementations is this is enabled */ private boolean fallbackToRegistry = false; public MessagePropertiesContext() { keySet = new TreeSet(); scopedMap = new TreeMap(new PropertyScope.ScopeComarator()); scopedMap.put(PropertyScope.INVOCATION, new HashMap(6)); scopedMap.put(PropertyScope.INBOUND, new HashMap(6)); scopedMap.put(PropertyScope.OUTBOUND, new HashMap(6)); scopedMap.put(PropertyScope.SESSION, new HashMap(6)); } public MessagePropertiesContext(PropertyScope defaultScope) { this(); //We can't set a read only scope as default checkScopeForWriteAccess(defaultScope); this.defaultScope = defaultScope; } protected Map getScopedProperties(PropertyScope scope) { Map map = (Map) scopedMap.get(scope); if (map == null) { throw new IllegalArgumentException("Scope not registered: " + scope); } return map; } void registerInvocationProperties(Map properties) { if (properties != null) { getScopedProperties(PropertyScope.INVOCATION).putAll(properties); keySet.addAll(properties.keySet()); } } public PropertyScope getDefaultScope() { return defaultScope; } void addInboundProperties(Map properties) { if (properties != null) { getScopedProperties(PropertyScope.INBOUND).putAll(properties); keySet.addAll(properties.keySet()); } } void registerSessionProperties(Map properties) { if (properties != null) { getScopedProperties(PropertyScope.SESSION).putAll(properties); keySet.addAll(properties.keySet()); } } public Object getProperty(String key) { Object value = null; for (Iterator iterator = scopedMap.values().iterator(); iterator.hasNext();) { Map props = (Map) iterator.next(); value = props.get(key); if (value != null) { break; } } if (value == null && fallbackToRegistry) { value = applicationProperties.get(key); } return value; } public Object getProperty(String key, PropertyScope scope) { if (PropertyScope.APPLICATION.equals(scope)) { return applicationProperties.get(key); } Map props = getScopedProperties(scope); return props.get(key); } public void clearProperties() { Map props = getScopedProperties(PropertyScope.INVOCATION); keySet.removeAll(props.keySet()); props.clear(); props = getScopedProperties(PropertyScope.OUTBOUND); keySet.removeAll(props.keySet()); props.clear(); props = getScopedProperties(PropertyScope.SESSION); keySet.removeAll(props.keySet()); props.clear(); //inbound are read Only } public void clearProperties(PropertyScope scope) { checkScopeForWriteAccess(scope); Map props = getScopedProperties(scope); keySet.removeAll(props.keySet()); props.clear(); } /** * Removes a property on this message * * @param key the property key to remove * @return the removed property value or null if the property did not exist */ public Object removeProperty(String key) { Object value = getScopedProperties(PropertyScope.INVOCATION).remove(key); if (value == null) { value = getScopedProperties(PropertyScope.OUTBOUND).remove(key); } if (value == null) { value = getScopedProperties(PropertyScope.SESSION).remove(key); } if (value != null) { keySet.remove(key); } return value; } /** * Set a property on the message * * @param key the key on which to associate the value * @param value the property value */ public void setProperty(String key, Object value) { getScopedProperties(defaultScope).put(key, value); keySet.add(key); } /** * Set a property on the message * * @param key the key on which to associate the value * @param value the property value * @param scope the scope to se the property on * @see org.mule.api.transport.PropertyScope */ public void setProperty(String key, Object value, PropertyScope scope) { checkScopeForWriteAccess(scope); getScopedProperties(scope).put(key, value); keySet.add(key); } /** @return all property keys on this message */ public Set getPropertyNames() { return Collections.unmodifiableSet(keySet); } /** @return all property keys on this message for the given scope */ public Set getPropertyNames(PropertyScope scope) { return Collections.unmodifiableSet(getScopedProperties(scope).keySet()); } protected void checkScopeForWriteAccess(PropertyScope scope) { if (scope == null || PropertyScope.INBOUND.equals(scope) || PropertyScope.APPLICATION.equals(scope)) { throw new IllegalArgumentException("Scope is invalid for writing properties: " + scope); } } public Object getProperty(String key, Object defaultValue) { Object value = getProperty(key); if (value == null) { value = defaultValue; } return value; } public byte getByteProperty(String name, byte defaultValue) { return ObjectUtils.getByte(getProperty(name), defaultValue); } public short getShortProperty(String name, short defaultValue) { return ObjectUtils.getShort(getProperty(name), defaultValue); } public int getIntProperty(String name, int defaultValue) { return ObjectUtils.getInt(getProperty(name), defaultValue); } public long getLongProperty(String name, long defaultValue) { return ObjectUtils.getLong(getProperty(name), defaultValue); } public float getFloatProperty(String name, float defaultValue) { return ObjectUtils.getFloat(getProperty(name), defaultValue); } public double getDoubleProperty(String name, double defaultValue) { return ObjectUtils.getDouble(getProperty(name), defaultValue); } public boolean getBooleanProperty(String name, boolean defaultValue) { return ObjectUtils.getBoolean(getProperty(name), defaultValue); } public String getStringProperty(String name, String defaultValue) { return ObjectUtils.getString(getProperty(name), defaultValue); } public String toString() { StringBuffer buf = new StringBuffer(128); buf.append("Properites{"); for (Iterator iterator = scopedMap.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); buf.append(entry.getKey()).append(":"); buf.append(MapUtils.toString((Map) entry.getValue(), false)); buf.append(", "); } buf.append("}"); return buf.toString(); } } mule-2.0.1/core/src/main/java/org/mule/transport/UnsupportedMessageDispatcher.java0000644000175000017500000000246510757615756030212 0ustar charlescharles/* * $Id: UnsupportedMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; public final class UnsupportedMessageDispatcher extends AbstractMessageDispatcher { public UnsupportedMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); } protected void doDispatch(MuleEvent event) throws Exception { throw new UnsupportedOperationException("Dispatch not supported for this transport."); } protected MuleMessage doSend(MuleEvent event) throws Exception { throw new UnsupportedOperationException("Send not supported for this transport."); } protected void doDispose() { // empty } protected void doConnect() throws Exception { // empty } protected void doDisconnect() throws Exception { // empty } } mule-2.0.1/core/src/main/java/org/mule/transport/NullPayload.java0000644000175000017500000000271210745677442024562 0ustar charlescharles/* * $Id: NullPayload.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import java.io.ObjectStreamException; import java.io.Serializable; /** * NullPayload represents a null event payload */ // @Immutable public final class NullPayload implements Serializable { /** * Serial version */ private static final long serialVersionUID = 3530905899811505080L; private static class NullPayloadHolder { private static final NullPayload instance = new NullPayload(); } public static NullPayload getInstance() { return NullPayloadHolder.instance; } private NullPayload() { super(); } private Object readResolve() throws ObjectStreamException { return NullPayloadHolder.instance; } // @Override public boolean equals(Object obj) { return obj instanceof NullPayload; } // @Override public int hashCode () { return 1; // random, 0 is taken by VoidResult } // @Override public String toString() { return "{NullPayload}"; } } mule-2.0.1/core/src/main/java/org/mule/transport/DefaultReplyToHandler.java0000644000175000017500000000753310771736371026541 0ustar charlescharles/* * $Id: DefaultReplyToHandler.java 11488 2008-03-24 14:38:49Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.DefaultMuleEvent; import org.mule.RegistryContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointFactory; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.DispatchException; import org.mule.api.transport.ReplyToHandler; import org.mule.config.i18n.CoreMessages; import org.mule.service.AbstractService; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * DefaultReplyToHandler is responsible for processing a message * replyTo header. */ public class DefaultReplyToHandler implements ReplyToHandler { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(DefaultReplyToHandler.class); private volatile List transformers; private final Map endpointCache = new HashMap(); public DefaultReplyToHandler(List transformers) { this.transformers = transformers; } public void processReplyTo(MuleEvent event, MuleMessage returnMessage, Object replyTo) throws MuleException { if (logger.isDebugEnabled()) { logger.debug("sending reply to: " + returnMessage.getReplyTo()); } String replyToEndpoint = replyTo.toString(); // get the endpoint for this url OutboundEndpoint endpoint = getEndpoint(event, replyToEndpoint); // make sure remove the replyTo property as not cause a a forever // replyto loop returnMessage.removeProperty(MuleProperties.MULE_REPLY_TO_PROPERTY); // Create the replyTo event asynchronous MuleEvent replyToEvent = new DefaultMuleEvent(returnMessage, endpoint, event.getSession(), false); // dispatch the event try { endpoint.dispatch(replyToEvent); if (logger.isInfoEnabled()) { logger.info("reply to sent: " + endpoint); } ((AbstractService) event.getService()).getStatistics().incSentReplyToEvent(); } catch (Exception e) { throw new DispatchException( CoreMessages.failedToDispatchToReplyto(endpoint), replyToEvent.getMessage(), replyToEvent.getEndpoint(), e); } } protected synchronized OutboundEndpoint getEndpoint(MuleEvent event, String endpointUri) throws MuleException { OutboundEndpoint endpoint = (OutboundEndpoint) endpointCache.get(endpointUri); if (endpoint == null) { EndpointFactory endpointFactory = RegistryContext.getRegistry().lookupEndpointFactory(); EndpointBuilder endpointBuilder = endpointFactory.getEndpointBuilder(endpointUri); if (transformers == null) { endpointBuilder.setTransformers(event.getEndpoint().getResponseTransformers()); } endpoint = endpointFactory.getOutboundEndpoint(endpointBuilder); endpointCache.put(endpointUri, endpoint); } return endpoint; } public List getTransformers() { return transformers; } public void setTransformers(List transformers) { this.transformers = transformers; } } mule-2.0.1/core/src/main/java/org/mule/transport/AbstractReceiverWorker.java0000644000175000017500000001721710757615756026771 0ustar charlescharles/* * $Id: AbstractReceiverWorker.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.DefaultMuleMessage; import org.mule.MuleServer; import org.mule.api.MuleContext; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionCallback; import org.mule.api.transaction.TransactionException; import org.mule.api.transport.MessageAdapter; import org.mule.transaction.TransactionCoordination; import org.mule.transaction.TransactionTemplate; import java.io.OutputStream; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.resource.spi.work.Work; /** * A base Worker used by Transport {@link org.mule.api.transport.MessageReceiver} implementations. */ public abstract class AbstractReceiverWorker implements Work { protected List messages; protected InboundEndpoint endpoint; protected AbstractMessageReceiver receiver; protected OutputStream out; public AbstractReceiverWorker(List messages, AbstractMessageReceiver receiver) { this(messages, receiver, null); } public AbstractReceiverWorker(List messages, AbstractMessageReceiver receiver, OutputStream out) { this.messages = messages; this.receiver = receiver; this.endpoint = receiver.getEndpoint(); this.out = out; } /** * This will run the receiver logic and call {@link #release()} once {@link #doRun()} completes. * */ public final void run() { doRun(); release(); } /** * The actual logic used to receive messages from the underlying transport. The default implementation * will execute the processing of messages within a TransactionTemplate. This template will manage the * transaction lifecycle for the list of messages associated with this receiver worker. */ protected void doRun() { // TODO Remove this call to MuleServer.getMuleContext(). The muleContext should be passed // in and stored as a local variable (MuleContextAware). It is used down the line for // getTransactionManager() (XaTransactionFactory) and getQueueManager() (VMTransaction) MuleContext muleContext = MuleServer.getMuleContext(); TransactionTemplate tt = new TransactionTemplate(endpoint.getTransactionConfig(), endpoint.getConnector().getExceptionListener(), muleContext); // Receive messages and process them in a single transaction // Do not enable threading here, but serveral workers // may have been started TransactionCallback cb = new TransactionCallback() { public Object doInTransaction() throws Exception { Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (tx != null) { bindTransaction(tx); } List results = new ArrayList(messages.size()); for (Iterator iterator = messages.iterator(); iterator.hasNext();) { Object o = iterator.next(); o = preProcessMessage(o); if (o != null) { MessageAdapter adapter; if (o instanceof MessageAdapter) { adapter = (MessageAdapter) o; } else { adapter = endpoint.getConnector().getMessageAdapter(o); } DefaultMuleMessage muleMessage = new DefaultMuleMessage(adapter); preRouteMuleMessage(muleMessage); MuleMessage result = receiver.routeMessage(muleMessage, tx, tx != null || endpoint.isSynchronous(), out); if (result != null) { o = postProcessMessage(result); if (o != null) { results.add(o); } } } } return results; } }; try { List results = (List) tt.execute(cb); handleResults(results); } catch (Exception e) { handleException(e); } finally { messages.clear(); } } /** * This callback is called before a message is routed into Mule and can be used by the worker to set connection * specific properties to message before it gets routed * * @param message the next message to be processed * @throws Exception */ protected void preRouteMuleMessage(DefaultMuleMessage message) throws Exception { //no op } /** * Template method used to bind the resources of this receiver to the transaction. Only transactional * transports need implment this method * @param tx the current transaction or null if there is no transaction * @throws TransactionException */ protected abstract void bindTransaction(Transaction tx) throws TransactionException; /** * A conveniece method that passes the exception to the connector's ExceptionListener * @param e */ protected void handleException(Exception e) { endpoint.getConnector().handleException(e); } /** * When Mule has finished processing the current messages, there may be zero or more messages to process * by the receiver if request/response messaging is being used. The result(s) should be passed back to the callee. * @param messages a list of messages. This argument will not be null * @throws Exception */ protected void handleResults(List messages) throws Exception { //no op } /** * Before a message is passed into Mule this callback is called and can be used by the worker to inspect the * message before it gets sent to Mule * @param message the next message to be processed * @return the message to be processed. If Null is returned the message will not get processed. * @throws Exception */ protected Object preProcessMessage(Object message) throws Exception { //no op return message; } /** * If a result is returned back this method will get called before the message is added to te list of * results (these are later passed to {@link #handleResults(java.util.List)}) * @param message the result message, this will never be null * @return the message to add to the list of results. If null is returned nothing is added to the * list of results * @throws Exception */ protected MuleMessage postProcessMessage(MuleMessage message) throws Exception { //no op return message; } /** * This method is called once this worker is no longer required. Any resources *only* associated with * this worker should be cleaned up here. */ public void release() { // no op } } mule-2.0.1/core/src/main/java/org/mule/transport/FatalConnectException.java0000644000175000017500000000217710745677442026563 0ustar charlescharles/* * $Id: FatalConnectException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.lifecycle.FatalException; import org.mule.api.transport.Connectable; import org.mule.config.i18n.Message; /** TODO document */ public class FatalConnectException extends FatalException { /** Serial version */ private static final long serialVersionUID = 3300563235465630595L; public FatalConnectException(Message message, Connectable component) { super(message, component); } public FatalConnectException(Message message, Throwable cause, Connectable component) { super(message, cause, component); } public FatalConnectException(Throwable cause, Connectable component) { super(cause, component); } } mule-2.0.1/core/src/main/java/org/mule/transport/service/0000755000175000017500000000000011351411112023077 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/transport/service/package.html0000644000175000017500000000020710745677442025411 0ustar charlescharles Provides SPI support for building mule connectors and providers using service descriptors. mule-2.0.1/core/src/main/java/org/mule/transport/service/TransportFactoryException.java0000644000175000017500000000265110745677442031203 0ustar charlescharles/* * $Id: TransportFactoryException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.service; import org.mule.api.endpoint.EndpointException; import org.mule.config.i18n.Message; /** * TransportFactoryException is thrown by the endpoint factory if the * endpoint service cannot be found in the META-INF/services directory or if any part * of the endpoint cannot be instanciated. * */ public class TransportFactoryException extends EndpointException { /** * Serial version */ private static final long serialVersionUID = -4166766364690837213L; /** * @param message the exception message */ public TransportFactoryException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public TransportFactoryException(Message message, Throwable cause) { super(message, cause); } public TransportFactoryException(Throwable cause) { super(cause); } } mule-2.0.1/core/src/main/java/org/mule/transport/service/TransportServiceException.java0000644000175000017500000000244010745677442031170 0ustar charlescharles/* * $Id: TransportServiceException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.service; import org.mule.config.i18n.Message; /** * TransportServiceException is thrown if a ProviderServicedescriptor * has a service error set. This is usually because the endpoint/connector cannot be * created from a service descriptor * */ public class TransportServiceException extends TransportFactoryException { /** * Serial version */ private static final long serialVersionUID = 5377271625492627661L; /** * @param message the exception message */ public TransportServiceException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that cause this exception to be thrown */ public TransportServiceException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/transport/service/TransportServiceDescriptor.java0000644000175000017500000000623110757615756031355 0ustar charlescharles/* * $Id: TransportServiceDescriptor.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.service; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointURIBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.registry.ServiceDescriptor; import org.mule.api.service.Service; import org.mule.api.transaction.TransactionFactory; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.MessageDispatcherFactory; import org.mule.api.transport.MessageReceiver; import org.mule.api.transport.MessageRequesterFactory; import org.mule.api.transport.SessionHandler; import java.util.List; import java.util.Properties; /** * TransportServiceDescriptor describes the necessary information for * creating a connector from a service descriptor. A service descriptor should be * located at META-INF/services/org/mule/providers/ where protocol is the * protocol of the connector to be created The service descriptor is in the form of * string key value pairs and supports a number of properties, descriptions of which * can be found here: http://www.muledocs.org/Transport+Service+Descriptors. */ public interface TransportServiceDescriptor extends ServiceDescriptor { public MessageAdapter createMessageAdapter(Object message) throws TransportServiceException; public SessionHandler createSessionHandler() throws TransportServiceException; public MessageReceiver createMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws MuleException; public MessageReceiver createMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint, Object[] args) throws MuleException; public MessageDispatcherFactory createDispatcherFactory() throws TransportServiceException; public MessageRequesterFactory createRequesterFactory() throws TransportServiceException; public TransactionFactory createTransactionFactory() throws TransportServiceException; public Connector createConnector() throws TransportServiceException; public List createInboundTransformers() throws TransportFactoryException; public List createOutboundTransformers() throws TransportFactoryException; public List createResponseTransformers() throws TransportFactoryException; public EndpointURIBuilder createEndpointBuilder() throws TransportFactoryException; public void setExceptionMappings(Properties props); public Properties getExceptionMappings(); } mule-2.0.1/core/src/main/java/org/mule/transport/service/TransportServiceNotFoundException.java0000644000175000017500000000253310745677442032650 0ustar charlescharles/* * $Id: TransportServiceNotFoundException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.service; import org.mule.config.i18n.MessageFactory; /** * TransportServiceNotFoundException is thorown if no matching service * endpoint descriptor is found for the connector protocol. * */ public class TransportServiceNotFoundException extends TransportFactoryException { /** * Serial version */ private static final long serialVersionUID = -8321406750213654479L; /** * @param location the path of the service */ public TransportServiceNotFoundException(String location) { super(MessageFactory.createStaticMessage(location)); } /** * @param location the path of the service * @param cause the exception that cause this exception to be thrown */ public TransportServiceNotFoundException(String location, Throwable cause) { super(MessageFactory.createStaticMessage(location), cause); } } mule-2.0.1/core/src/main/java/org/mule/transport/service/DefaultTransportServiceDescriptor.java0000644000175000017500000004341010767604414032650 0ustar charlescharles/* * $Id: DefaultTransportServiceDescriptor.java 11405 2008-03-18 00:13:00Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.service; import org.mule.MuleSessionHandler; import org.mule.api.MuleException; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.EndpointURIBuilder; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.registry.AbstractServiceDescriptor; import org.mule.api.registry.Registry; import org.mule.api.service.Service; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transaction.TransactionFactory; import org.mule.api.transformer.Transformer; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.MessageDispatcherFactory; import org.mule.api.transport.MessageReceiver; import org.mule.api.transport.MessageRequesterFactory; import org.mule.api.transport.SessionHandler; import org.mule.config.i18n.CoreMessages; import org.mule.endpoint.UrlEndpointURIBuilder; import org.mule.transaction.XaTransactionFactory; import org.mule.transport.NullPayload; import org.mule.util.ClassUtils; import org.mule.util.CollectionUtils; import java.util.List; import java.util.Properties; /** @inheritDocs */ public class DefaultTransportServiceDescriptor extends AbstractServiceDescriptor implements TransportServiceDescriptor { private String connector; private String dispatcherFactory; private String requesterFactory; private String transactionFactory; private String messageAdapter; private String messageReceiver; private String transactedMessageReceiver; private String xaTransactedMessageReceiver; private String endpointBuilder; private String sessionHandler; private String defaultInboundTransformer; private String defaultOutboundTransformer; private String defaultResponseTransformer; private Transformer inboundTransformer; private Transformer outboundTransformer; private Transformer responseTransformer; // private EndpointBuilder endpointBuilderImpl; private Properties exceptionMappings = new Properties(); public DefaultTransportServiceDescriptor(String service, Properties props, Registry registry) { super(service); connector = removeProperty(MuleProperties.CONNECTOR_CLASS, props); dispatcherFactory = removeProperty(MuleProperties.CONNECTOR_DISPATCHER_FACTORY, props); requesterFactory = removeProperty(MuleProperties.CONNECTOR_REQUESTER_FACTORY, props); transactionFactory = removeProperty(MuleProperties.CONNECTOR_DISPATCHER_FACTORY, props); messageReceiver = removeProperty(MuleProperties.CONNECTOR_MESSAGE_RECEIVER_CLASS, props); transactedMessageReceiver = removeProperty(MuleProperties.CONNECTOR_TRANSACTED_MESSAGE_RECEIVER_CLASS, props); xaTransactedMessageReceiver = removeProperty(MuleProperties.CONNECTOR_XA_TRANSACTED_MESSAGE_RECEIVER_CLASS, props); messageAdapter = removeProperty(MuleProperties.CONNECTOR_MESSAGE_ADAPTER, props); defaultInboundTransformer = removeProperty(MuleProperties.CONNECTOR_INBOUND_TRANSFORMER, props); defaultOutboundTransformer = removeProperty(MuleProperties.CONNECTOR_OUTBOUND_TRANSFORMER, props); defaultResponseTransformer = removeProperty(MuleProperties.CONNECTOR_RESPONSE_TRANSFORMER, props); endpointBuilder = removeProperty(MuleProperties.CONNECTOR_ENDPOINT_BUILDER, props); sessionHandler = removeProperty(MuleProperties.CONNECTOR_SESSION_HANDLER, props); // try // { // registerDefaultTransformers(registry); // } // catch (Exception e) // { // e.printStackTrace(); // } } public void setOverrides(Properties props) { if (props == null || props.size() == 0) { return; } connector = props.getProperty(MuleProperties.CONNECTOR_CLASS, connector); dispatcherFactory = props.getProperty(MuleProperties.CONNECTOR_DISPATCHER_FACTORY, dispatcherFactory); requesterFactory = props.getProperty(MuleProperties.CONNECTOR_REQUESTER_FACTORY, requesterFactory); messageReceiver = props.getProperty(MuleProperties.CONNECTOR_MESSAGE_RECEIVER_CLASS, messageReceiver); transactedMessageReceiver = props.getProperty( MuleProperties.CONNECTOR_TRANSACTED_MESSAGE_RECEIVER_CLASS, transactedMessageReceiver); xaTransactedMessageReceiver = props.getProperty( MuleProperties.CONNECTOR_XA_TRANSACTED_MESSAGE_RECEIVER_CLASS, xaTransactedMessageReceiver); messageAdapter = props.getProperty(MuleProperties.CONNECTOR_MESSAGE_ADAPTER, messageAdapter); String temp = props.getProperty(MuleProperties.CONNECTOR_INBOUND_TRANSFORMER); if (temp != null) { defaultInboundTransformer = temp; inboundTransformer = null; } temp = props.getProperty(MuleProperties.CONNECTOR_OUTBOUND_TRANSFORMER); if (temp != null) { defaultOutboundTransformer = temp; outboundTransformer = null; } temp = props.getProperty(MuleProperties.CONNECTOR_RESPONSE_TRANSFORMER); if (temp != null) { defaultResponseTransformer = temp; responseTransformer = null; } temp = props.getProperty(MuleProperties.CONNECTOR_ENDPOINT_BUILDER); if (temp != null) { endpointBuilder = temp; } } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createMessageAdapter(java.lang.Object) */ public MessageAdapter createMessageAdapter(Object message) throws TransportServiceException { return createMessageAdapter(message, messageAdapter); } protected MessageAdapter createMessageAdapter(Object message, String clazz) throws TransportServiceException { if (message == null) { message = NullPayload.getInstance(); } if (messageAdapter != null) { try { return (MessageAdapter) ClassUtils.instanciateClass(clazz, new Object[]{message}); } catch (Exception e) { throw new TransportServiceException(CoreMessages.failedToCreateObjectWith("Message Adapter", clazz), e); } } else { throw new TransportServiceException(CoreMessages.objectNotSetInService("Message Adapter", getService())); } } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createSessionHandler() */ public SessionHandler createSessionHandler() throws TransportServiceException { if (sessionHandler == null) { sessionHandler = MuleSessionHandler.class.getName(); if (logger.isDebugEnabled()) { logger.debug("No session.handler set in service description, defaulting to: " + sessionHandler); } } try { return (SessionHandler) ClassUtils.instanciateClass(sessionHandler, ClassUtils.NO_ARGS, getClass()); } catch (Throwable e) { throw new TransportServiceException(CoreMessages.failedToCreateObjectWith("SessionHandler", sessionHandler), e); } } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createMessageReceiver(org.mule.api.transport.Connector, org.mule.api.Component, org.mule.api.endpoint.Endpoint) */ public MessageReceiver createMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws MuleException { return createMessageReceiver(connector, service, endpoint, null); } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createMessageReceiver(org.mule.api.transport.Connector, org.mule.api.Component, org.mule.api.endpoint.Endpoint, java.lang.Object[]) */ public MessageReceiver createMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint, Object[] args) throws MuleException { String receiverClass = messageReceiver; if (endpoint.getTransactionConfig() != null && endpoint.getTransactionConfig().getAction() != TransactionConfig.ACTION_NONE) { boolean xaTx = endpoint.getTransactionConfig().getFactory() instanceof XaTransactionFactory; if (transactedMessageReceiver != null && !xaTx) { receiverClass = transactedMessageReceiver; } else if (xaTransactedMessageReceiver != null && xaTx) { receiverClass = xaTransactedMessageReceiver; } } if (receiverClass != null) { Object[] newArgs; if (args != null && args.length != 0) { newArgs = new Object[3 + args.length]; } else { newArgs = new Object[3]; } newArgs[0] = connector; newArgs[1] = service; newArgs[2] = endpoint; if (args != null && args.length != 0) { System.arraycopy(args, 0, newArgs, 3, newArgs.length - 3); } try { return (MessageReceiver) ClassUtils.instanciateClass(receiverClass, newArgs); } catch (Exception e) { throw new TransportServiceException(CoreMessages.failedToCreateObjectWith("Message Receiver", getService()), e); } } else { throw new TransportServiceException(CoreMessages.objectNotSetInService("Message Receiver", getService())); } } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createDispatcherFactory() */ public MessageDispatcherFactory createDispatcherFactory() throws TransportServiceException { if (dispatcherFactory != null) { try { return (MessageDispatcherFactory) ClassUtils.instanciateClass(dispatcherFactory, ClassUtils.NO_ARGS); } catch (Exception e) { throw new TransportServiceException(CoreMessages.failedToCreateObjectWith("Message Dispatcher Factory", dispatcherFactory), e); } } else { //Its valid not to have a Dispatcher factory on the transport return null; } } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createRequesterFactory() */ public MessageRequesterFactory createRequesterFactory() throws TransportServiceException { if (requesterFactory != null) { try { return (MessageRequesterFactory) ClassUtils.instanciateClass(requesterFactory, ClassUtils.NO_ARGS); } catch (Exception e) { throw new TransportServiceException( CoreMessages.failedToCreateObjectWith("Message Requester Factory", requesterFactory), e); } } else { //Its valid not to have a Dispatcher factory on the transport return null; } } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createTransactionFactory() */ public TransactionFactory createTransactionFactory() throws TransportServiceException { if (transactionFactory != null) { try { return (TransactionFactory) ClassUtils.instanciateClass(transactionFactory, ClassUtils.NO_ARGS); } catch (Exception e) { throw new TransportServiceException(CoreMessages.failedToCreateObjectWith("Transaction Factory", transactionFactory), e); } } else { return null; } } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createConnector(java.lang.String) */ public Connector createConnector() throws TransportServiceException { Connector newConnector; // if there is a factory, use it try { if (connector != null) { newConnector = (Connector) ClassUtils.loadClass(connector, TransportFactory.class) .newInstance(); } else { throw new TransportServiceException(CoreMessages.objectNotSetInService("Connector", getService())); } } catch (TransportServiceException e) { throw e; } catch (Exception e) { throw new TransportServiceException(CoreMessages.failedToCreateObjectWith("Connector", connector), e); } if (newConnector.getName() == null) { newConnector.setName("_" + newConnector.getProtocol() + "Connector#" + connector.hashCode()); } return newConnector; } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createInboundTransformer() */ public List createInboundTransformers() throws TransportFactoryException { if (inboundTransformer != null) { return CollectionUtils.singletonList(inboundTransformer); } if (defaultInboundTransformer != null) { logger.info("Loading default inbound transformer: " + defaultInboundTransformer); try { inboundTransformer = (Transformer) ClassUtils.instanciateClass( defaultInboundTransformer, ClassUtils.NO_ARGS); return CollectionUtils.singletonList(inboundTransformer); } catch (Exception e) { throw new TransportFactoryException(CoreMessages.failedToLoadTransformer("inbound", defaultInboundTransformer), e); } } return null; } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createOutboundTransformer() */ public List createOutboundTransformers() throws TransportFactoryException { if (outboundTransformer != null) { return CollectionUtils.singletonList(outboundTransformer); } if (defaultOutboundTransformer != null) { logger.info("Loading default outbound transformer: " + defaultOutboundTransformer); try { outboundTransformer = (Transformer) ClassUtils.instanciateClass( defaultOutboundTransformer, ClassUtils.NO_ARGS); return CollectionUtils.singletonList(outboundTransformer); } catch (Exception e) { throw new TransportFactoryException(CoreMessages.failedToLoadTransformer("outbound", defaultOutboundTransformer), e); } } return null; } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createResponseTransformer() */ public List createResponseTransformers() throws TransportFactoryException { if (responseTransformer != null) { return CollectionUtils.singletonList(responseTransformer); } if (defaultResponseTransformer != null) { logger.info("Loading default response transformer: " + defaultResponseTransformer); try { responseTransformer = (Transformer) ClassUtils.instanciateClass( defaultResponseTransformer, ClassUtils.NO_ARGS); return CollectionUtils.singletonList(responseTransformer); } catch (Exception e) { throw new TransportFactoryException(CoreMessages.failedToLoadTransformer("response", defaultResponseTransformer), e); } } return null; } /* (non-Javadoc) * @see org.mule.transport.service.TransportServiceDescriptor#createEndpointBuilder() */ public EndpointURIBuilder createEndpointBuilder() throws TransportFactoryException { if (endpointBuilder == null) { logger.debug("Endpoint resolver not set, Loading default resolver: " + UrlEndpointURIBuilder.class.getName()); return new UrlEndpointURIBuilder(); } else { logger.debug("Loading endpointUri resolver: " + endpointBuilder); try { return (EndpointURIBuilder) ClassUtils.instanciateClass(endpointBuilder, ClassUtils.NO_ARGS); } catch (Exception e) { throw new TransportFactoryException(CoreMessages.failedToLoad("Endpoint Builder: " + endpointBuilder), e); } } } public void setExceptionMappings(Properties props) { this.exceptionMappings = props; } public Properties getExceptionMappings() { return this.exceptionMappings; } } mule-2.0.1/core/src/main/java/org/mule/transport/service/TransportFactory.java0000644000175000017500000001444410754365306027320 0ustar charlescharles/* * $Id: TransportFactory.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.service; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.registry.ServiceDescriptorFactory; import org.mule.api.registry.ServiceException; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.transport.AbstractConnector; import org.mule.util.BeanUtils; import org.mule.util.ObjectNameHelper; import java.util.Collection; import java.util.Iterator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * TransportFactory can be used for generically creating endpoints * from an url. Note that for some endpoints, the url alone is not enough to create * the endpoint if a connector for the endpoint has not already been configured with * the Mule Manager. * */ public class TransportFactory { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(TransportFactory.class); /** * Creates an uninitialied connector from the provided MuleEndpointURI. The * scheme is used to determine what kind of connector to create. Any params set * on the uri can be used to initialise bean properties on the created connector. *

    Note that the initalise method will need to be called on the connector * returned. This is so that developers can control when the connector * initialisation takes place as this is likely to initialse all connecotr * resources. * * @param url the MuleEndpointURI url to create the connector with * @return a new Connector * @throws TransportFactoryException */ public static Connector createConnector(EndpointURI url, MuleContext muleContext) throws TransportFactoryException { try { Connector connector; String scheme = url.getSchemeMetaInfo(); TransportServiceDescriptor sd = (TransportServiceDescriptor) RegistryContext.getRegistry().lookupServiceDescriptor(ServiceDescriptorFactory.PROVIDER_SERVICE_TYPE, scheme, null); if (sd == null) { throw new ServiceException(CoreMessages.noServiceTransportDescriptor(scheme)); } connector = sd.createConnector(); if (connector != null) { if (connector instanceof AbstractConnector) { ((AbstractConnector)connector).initialiseFromUrl(url); } } else { throw new TransportFactoryException( CoreMessages.objectNotSetInService("Connector", scheme)); } connector.setName(ObjectNameHelper.getConnectorName(connector)); // TODO Do we still need to support this for 2.x? // set any manager default properties for the connector // these are set on the Manager with a protocol i.e. // jms.specification=1.1 // Map props = new HashMap(); // PropertiesUtils.getPropertiesWithPrefix(RegistryContext.getRegistry().lookupProperties(), // connector.getProtocol().toLowerCase(), props); // if (props.size() > 0) // { // props = PropertiesUtils.removeNamespaces(props); // BeanUtils.populateWithoutFail(connector, props, true); // } return connector; } catch (Exception e) { throw new TransportFactoryException( CoreMessages.failedToCreateObjectWith("Endpoint", url), e); } } public static Connector getOrCreateConnectorByProtocol(ImmutableEndpoint endpoint, MuleContext muleContext) throws TransportFactoryException { return getOrCreateConnectorByProtocol(endpoint.getEndpointURI(), muleContext); } /** * Returns an initialized connector. */ public static Connector getOrCreateConnectorByProtocol(EndpointURI uri, MuleContext muleContext) throws TransportFactoryException { String connectorName = uri.getConnectorName(); if (null != connectorName) { // TODO this lookup fails currently on Mule 2.x! MuleAdminAgentTestCase Connector connector = RegistryContext.getRegistry().lookupConnector(connectorName); if (connector != null) { return connector; } } Connector connector = getConnectorByProtocol(uri.getFullScheme()); if (connector == null) { connector = createConnector(uri, muleContext); try { BeanUtils.populate(connector, uri.getParams()); connector.setMuleContext(muleContext); muleContext.getRegistry().registerConnector(connector); } catch (Exception e) { throw new TransportFactoryException(e); } } return connector; } public static Connector getConnectorByProtocol(String protocol) { Connector connector; Connector resultConnector = null; Collection connectors = RegistryContext.getRegistry().lookupObjects(Connector.class); for (Iterator iterator = connectors.iterator(); iterator.hasNext();) { connector = (Connector)iterator.next(); if (connector.supportsProtocol(protocol)) { if(resultConnector==null) { resultConnector = connector; } else { throw new IllegalStateException( CoreMessages.moreThanOneConnectorWithProtocol(protocol).getMessage()); } } } return resultConnector; } } mule-2.0.1/core/src/main/java/org/mule/transport/AbstractMessageReceiver.java0000644000175000017500000005254610774254333027075 0ustar charlescharles/* * $Id: AbstractMessageReceiver.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleSession; import org.mule.NullSessionHandler; import org.mule.OptimizedRequestContext; import org.mule.RequestContext; import org.mule.ResponseOutputStream; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.config.MuleProperties; import org.mule.api.context.WorkManager; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.SecurityException; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transport.ConnectionStrategy; import org.mule.api.transport.Connector; import org.mule.api.transport.InternalMessageListener; import org.mule.api.transport.MessageReceiver; import org.mule.config.ExceptionHelper; import org.mule.config.i18n.CoreMessages; import org.mule.context.notification.ConnectionNotification; import org.mule.context.notification.MessageNotification; import org.mule.context.notification.SecurityNotification; import org.mule.transaction.TransactionCoordination; import org.mule.util.ClassUtils; import org.mule.util.StringMessageUtils; import org.mule.util.concurrent.WaitableBoolean; import java.io.OutputStream; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractMessageReceiver provides common methods for all Message * Receivers provided with Mule. A message receiver enables an endpoint to receive a * message from an external system. */ public abstract class AbstractMessageReceiver implements MessageReceiver { /** logger used by this class */ protected final Log logger = LogFactory.getLog(getClass()); /** The Service with which this receiver is associated with */ protected Service service = null; /** The endpoint descriptor which is associated with this receiver */ protected InboundEndpoint endpoint = null; private InternalMessageListener listener; /** the connector associated with this receiver */ protected AbstractConnector connector = null; protected final AtomicBoolean disposing = new AtomicBoolean(false); protected final WaitableBoolean connected = new WaitableBoolean(false); protected final WaitableBoolean stopped = new WaitableBoolean(true); protected final AtomicBoolean connecting = new AtomicBoolean(false); /** * Stores the key to this receiver, as used by the Connector to * store the receiver. */ protected String receiverKey = null; /** * Stores the endpointUri that this receiver listens on. This enpoint can be * different to the endpointUri in the endpoint stored on the receiver as * endpoint endpointUri may get rewritten if this endpointUri is a wildcard * endpointUri such as jms.* */ private EndpointURI endpointUri; private WorkManager workManager; protected ConnectionStrategy connectionStrategy; protected boolean responseEndpoint = false; /** * Creates the Message Receiver * * @param connector the endpoint that created this listener * @param service the service to associate with the receiver. When data is * received the service dispatchEvent or * sendEvent is used to dispatch the data to the * relivant UMO. * @param endpoint the provider contains the endpointUri on which the receiver * will listen on. The endpointUri can be anything and is specific to * the receiver implementation i.e. an email address, a directory, a * jms destination or port address. * @see Service * @see InboundEndpoint */ public AbstractMessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { setConnector(connector); setService(service); setEndpoint(endpoint); if (service.getResponseRouter() != null && service.getResponseRouter().getEndpoints().contains(endpoint)) { responseEndpoint = true; } } /** * Method used to perform any initialisation work. If a fatal error occurs during * initialisation an InitialisationException should be thrown, * causing the Mule instance to shutdown. If the error is recoverable, say by * retrying to connect, a RecoverableException should be thrown. * There is no guarantee that by throwing a Recoverable exception that the Mule * instance will not shut down. * * @throws org.mule.api.lifecycle.InitialisationException * if a fatal error occurs causing the Mule * instance to shutdown * @throws org.mule.api.lifecycle.RecoverableException * if an error occurs that can be recovered from */ public void initialise() throws InitialisationException { listener = new DefaultInternalMessageListener(); endpointUri = endpoint.getEndpointURI(); try { workManager = this.connector.getReceiverWorkManager("receiver"); } catch (MuleException e) { throw new InitialisationException(e, this); } connectionStrategy = this.endpoint.getConnectionStrategy(); doInitialise(); } /* * (non-Javadoc) * * @see org.mule.api.transport.MessageReceiver#getEndpointName() */ public InboundEndpoint getEndpoint() { return endpoint; } /* * (non-Javadoc) * * @see org.mule.api.transport.MessageReceiver#getExceptionListener() */ public void handleException(Exception exception) { if (exception instanceof ConnectException) { logger.info("Exception caught is a ConnectException, disconnecting receiver and invoking ReconnectStrategy"); try { disconnect(); } catch (Exception e) { connector.getExceptionListener().exceptionThrown(e); } } connector.getExceptionListener().exceptionThrown(exception); if (exception instanceof ConnectException) { try { logger.warn("Reconnecting after exception: " + exception.getMessage(), exception); connectionStrategy.connect(this); } catch (MuleException e) { connector.getExceptionListener().exceptionThrown(e); } } } /** * This method is used to set any additional aand possibly transport specific * information on the return message where it has an exception payload. * * @param message * @param exception */ protected void setExceptionDetails(MuleMessage message, Throwable exception) { String propName = ExceptionHelper.getErrorCodePropertyName(connector.getProtocol()); // If we dont find a error code property we can assume there are not // error code mappings for this connector if (propName != null) { String code = ExceptionHelper.getErrorMapping(connector.getProtocol(), exception.getClass()); if (logger.isDebugEnabled()) { logger.debug("Setting error code for: " + connector.getProtocol() + ", " + propName + "=" + code); } message.setProperty(propName, code); } } public Connector getConnector() { return connector; } public void setConnector(Connector connector) { if (connector != null) { if (connector instanceof AbstractConnector) { this.connector = (AbstractConnector) connector; } else { throw new IllegalArgumentException(CoreMessages.propertyIsNotSupportedType( "connector", AbstractConnector.class, connector.getClass()).getMessage()); } } else { throw new IllegalArgumentException(CoreMessages.objectIsNull("connector").getMessage()); } } public Service getService() { return service; } public final MuleMessage routeMessage(MuleMessage message) throws MuleException { return routeMessage(message, (endpoint.isSynchronous() || TransactionCoordination.getInstance() .getTransaction() != null)); } public final MuleMessage routeMessage(MuleMessage message, boolean synchronous) throws MuleException { Transaction tx = TransactionCoordination.getInstance().getTransaction(); return routeMessage(message, tx, tx != null || synchronous, null); } public final MuleMessage routeMessage(MuleMessage message, Transaction trans, boolean synchronous) throws MuleException { return routeMessage(message, trans, synchronous, null); } public final MuleMessage routeMessage(MuleMessage message, OutputStream outputStream) throws MuleException { return routeMessage(message, endpoint.isSynchronous(), outputStream); } public final MuleMessage routeMessage(MuleMessage message, boolean synchronous, OutputStream outputStream) throws MuleException { Transaction tx = TransactionCoordination.getInstance().getTransaction(); return routeMessage(message, tx, tx != null || synchronous, outputStream); } public final MuleMessage routeMessage(MuleMessage message, Transaction trans, boolean synchronous, OutputStream outputStream) throws MuleException { if (connector.isEnableMessageEvents()) { connector.fireNotification( new MessageNotification(message, endpoint, service.getName(), MessageNotification.MESSAGE_RECEIVED)); } //IF REMOTE_SYNCis set on the endpoint, we need to set it on the message if (endpoint.isRemoteSync()) { message.setBooleanProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, true); } //Enforce a sync endpoint if remote sync is set if (message.getBooleanProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, false)) { synchronous = true; } if (logger.isDebugEnabled()) { logger.debug("Message Received from: " + endpoint.getEndpointURI()); } if (logger.isTraceEnabled()) { try { logger.trace("Message Payload: \n" + StringMessageUtils.truncate(StringMessageUtils.toString(message.getPayload()), 200, false)); } catch (Exception e) { // ignore } } // Apply the endpoint filter if one is configured if (endpoint.getFilter() != null) { if (!endpoint.getFilter().accept(message)) { //TODO RM* This ain't pretty, we don't yet have an event context since the message hasn't gon to the //message listener yet. So we need to create a new context so that EventAwareTransformers can be applied //to response messages where the filter denied the message //Maybe the filter should be checked in the MessageListener... message = handleUnacceptedFilter(message); RequestContext.setEvent(new DefaultMuleEvent(message, endpoint, new DefaultMuleSession(message, new NullSessionHandler(), connector.getMuleContext()), synchronous)); return message; } } return listener.onMessage(message, trans, synchronous, outputStream); } protected MuleMessage handleUnacceptedFilter(MuleMessage message) { String messageId; messageId = message.getUniqueId(); if (logger.isDebugEnabled()) { logger.debug("Message " + messageId + " failed to pass filter on endpoint: " + endpoint + ". Message is being ignored"); } return message; } /* * (non-Javadoc) * * @see org.mule.api.transport.MessageReceiver#setEndpoint(org.mule.api.endpoint.Endpoint) */ public void setEndpoint(InboundEndpoint endpoint) { if (endpoint == null) { throw new IllegalArgumentException("Endpoint cannot be null"); } this.endpoint = endpoint; } /* * (non-Javadoc) * * @see org.mule.api.transport.MessageReceiver#setSession(org.mule.api.MuleSession) */ public void setService(Service service) { if (service == null) { throw new IllegalArgumentException("Service cannot be null"); } this.service = service; } public final void dispose() { stop(); disposing.set(true); doDispose(); } public EndpointURI getEndpointURI() { return endpointUri; } protected WorkManager getWorkManager() { return workManager; } protected void setWorkManager(WorkManager workManager) { this.workManager = workManager; } public void connect() throws Exception { if (connected.get()) { return; } if (connecting.compareAndSet(false, true)) { if (logger.isDebugEnabled()) { logger.debug("Connecting: " + this); } connectionStrategy.connect(this); logger.info("Connected: " + this); return; } try { //Make sure the connector has connected. If it is connected, this method does nothing connectionStrategy.connect(connector); this.doConnect(); connected.set(true); connecting.set(false); connector.fireNotification(new ConnectionNotification(this, getConnectEventId(), ConnectionNotification.CONNECTION_CONNECTED)); } catch (Exception e) { connected.set(false); connecting.set(false); connector.fireNotification(new ConnectionNotification(this, getConnectEventId(), ConnectionNotification.CONNECTION_FAILED)); if (e instanceof ConnectException) { throw (ConnectException) e; } else { throw new ConnectException(e, this); } } } public void disconnect() throws Exception { if (logger.isDebugEnabled()) { logger.debug("Disconnecting: " + this); } this.doDisconnect(); connected.set(false); logger.info("Disconnected: " + this); connector.fireNotification(new ConnectionNotification(this, getConnectEventId(), ConnectionNotification.CONNECTION_DISCONNECTED)); } public String getConnectionDescription() { return endpoint.getEndpointURI().toString(); } public final void start() throws MuleException { if (stopped.compareAndSet(true, false)) { if (!connected.get()) { connectionStrategy.connect(this); } doStart(); } } public final void stop() { try { if (connected.get()) { disconnect(); } } catch (Exception e) { // TODO MULE-863: What should we really do? logger.error(e.getMessage(), e); } if (stopped.compareAndSet(false, true)) { try { doStop(); } catch (MuleException e) { // TODO MULE-863: What should we really do? logger.error(e.getMessage(), e); } } } public final boolean isConnected() { return connected.get(); } public InternalMessageListener getListener() { return listener; } public void setListener(InternalMessageListener listener) { this.listener = listener; } private class DefaultInternalMessageListener implements InternalMessageListener { public MuleMessage onMessage(MuleMessage message, Transaction trans, boolean synchronous, OutputStream outputStream) throws MuleException { MuleMessage resultMessage = null; ResponseOutputStream ros = null; if (outputStream != null) { if (outputStream instanceof ResponseOutputStream) { ros = (ResponseOutputStream) outputStream; } else { ros = new ResponseOutputStream(outputStream); } } MuleSession session = new DefaultMuleSession(message, connector.getSessionHandler(), service, connector.getMuleContext()); MuleEvent muleEvent = new DefaultMuleEvent(message, endpoint, session, synchronous, ros); muleEvent = OptimizedRequestContext.unsafeSetEvent(muleEvent); message = muleEvent.getMessage(); // Apply Security filter if one is set boolean authorised = false; if (endpoint.getSecurityFilter() != null) { try { endpoint.getSecurityFilter().authenticate(muleEvent); authorised = true; } catch (SecurityException e) { logger.warn("Request was made but was not authenticated: " + e.getMessage(), e); connector.fireNotification(new SecurityNotification(e, SecurityNotification.SECURITY_AUTHENTICATION_FAILED)); handleException(e); resultMessage = RequestContext.getEvent().getMessage(); } } else { authorised = true; } if (authorised) { // This is a replyTo event for a current request if (responseEndpoint) { // Transform response message before it is processed by response router(s) muleEvent.transformMessage(); service.getResponseRouter().route(muleEvent); return null; } else { resultMessage = service.getInboundRouter().route(muleEvent); } } if (resultMessage != null) { if (resultMessage.getExceptionPayload() != null) { setExceptionDetails(resultMessage, resultMessage.getExceptionPayload().getException()); } resultMessage.applyTransformers(endpoint.getResponseTransformers()); } return resultMessage; } } protected String getConnectEventId() { return connector.getName() + ".receiver (" + endpoint.getEndpointURI() + ")"; } public void setReceiverKey(String receiverKey) { this.receiverKey = receiverKey; } public String getReceiverKey() { return receiverKey; } public String toString() { final StringBuffer sb = new StringBuffer(80); sb.append(ClassUtils.getSimpleName(this.getClass())); sb.append("{this=").append(Integer.toHexString(System.identityHashCode(this))); sb.append(", receiverKey=").append(receiverKey); sb.append(", endpoint=").append(endpoint.getEndpointURI()); sb.append('}'); return sb.toString(); } protected void doInitialise() throws InitialisationException { //nothing to do //TODO this was addd to complete the lifecycle phases on the message receivers however, we ened to //review each receiver to move logic from the contstructor to the init method. The Connector will //call this method when the receiver is created. see MULE-2113 for more information about lifecycle clean up } protected abstract void doStart() throws MuleException; protected abstract void doStop() throws MuleException; protected abstract void doConnect() throws Exception; protected abstract void doDisconnect() throws Exception; protected abstract void doDispose(); } mule-2.0.1/core/src/main/java/org/mule/transport/TransactedPollingMessageReceiver.java0000644000175000017500000001530510757615756030752 0ustar charlescharles/* * $Id: TransactedPollingMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleException; import org.mule.api.config.ThreadingProfile; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transaction.TransactionCallback; import org.mule.api.transport.Connector; import org.mule.transaction.TransactionTemplate; import java.util.Iterator; import java.util.List; import javax.resource.spi.work.Work; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; /** * The TransactedPollingMessageReceiver is an abstract receiver that handles polling * and transaction management. Derived implementations of these class must be thread * safe as several threads can be started at once for an improveded throuput. */ public abstract class TransactedPollingMessageReceiver extends AbstractPollingMessageReceiver { /** determines whether messages will be received in a transaction template */ private boolean receiveMessagesInTransaction = true; /** determines whether Multiple receivers are created to improve throughput */ private boolean useMultipleReceivers = true; public TransactedPollingMessageReceiver(Connector connector, Service service, final InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); this.setReceiveMessagesInTransaction(endpoint.getTransactionConfig().getFactory() != null); } /** * @deprecated please use * {@link #TransactedPollingMessageReceiver(Connector,Service,InboundEndpoint,long,TimeUnit)} * instead */ public TransactedPollingMessageReceiver(Connector connector, Service service, final InboundEndpoint endpoint, long frequency) throws CreateException { this(connector, service, endpoint); this.setFrequency(frequency); } public boolean isReceiveMessagesInTransaction() { return receiveMessagesInTransaction; } public void setReceiveMessagesInTransaction(boolean useTx) { receiveMessagesInTransaction = useTx; } public boolean isUseMultipleTransactedReceivers() { return useMultipleReceivers; } public void setUseMultipleTransactedReceivers(boolean useMultiple) { useMultipleReceivers = useMultiple; } // @Override public void doStart() throws MuleException { // Connector property overrides any implied value this.setUseMultipleTransactedReceivers(connector.isCreateMultipleTransactedReceivers()); ThreadingProfile tp = connector.getReceiverThreadingProfile(); int numReceiversToStart = 1; if (this.isReceiveMessagesInTransaction() && this.isUseMultipleTransactedReceivers() && tp.isDoThreading()) { numReceiversToStart = connector.getNumberOfConcurrentTransactedReceivers(); } for (int i = 0; i < numReceiversToStart; i++) { super.doStart(); } } public void poll() throws Exception { TransactionTemplate tt = new TransactionTemplate(endpoint.getTransactionConfig(), connector.getExceptionListener(), connector.getMuleContext()); if (this.isReceiveMessagesInTransaction()) { // Receive messages and process them in a single transaction // Do not enable threading here, but several workers // may have been started TransactionCallback cb = new TransactionCallback() { public Object doInTransaction() throws Exception { List messages = getMessages(); if (messages != null && messages.size() > 0) { for (Iterator it = messages.iterator(); it.hasNext();) { TransactedPollingMessageReceiver.this.processMessage(it.next()); } } return null; } }; tt.execute(cb); } else { // Receive messages and launch a worker for each message List messages = getMessages(); if (messages != null && messages.size() > 0) { final CountDownLatch countdown = new CountDownLatch(messages.size()); for (Iterator it = messages.iterator(); it.hasNext();) { try { this.getWorkManager().scheduleWork( new MessageProcessorWorker(tt, countdown, it.next())); } catch (Exception e) { countdown.countDown(); throw e; } } countdown.await(); } } } protected class MessageProcessorWorker implements Work, TransactionCallback { private final TransactionTemplate tt; private final Object message; private final CountDownLatch latch; public MessageProcessorWorker(TransactionTemplate tt, CountDownLatch latch, Object message) { this.tt = tt; this.message = message; this.latch = latch; } public void release() { // nothing to do } public void run() { try { tt.execute(this); } catch (Exception e) { handleException(e); } finally { latch.countDown(); } } public Object doInTransaction() throws Exception { TransactedPollingMessageReceiver.this.processMessage(message); return null; } } protected abstract List getMessages() throws Exception; protected abstract void processMessage(Object message) throws Exception; } mule-2.0.1/core/src/main/java/org/mule/transport/PollingReceiverWorkerSchedule.java0000644000175000017500000000230110745677442030270 0ustar charlescharles/* * $Id: PollingReceiverWorkerSchedule.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.context.WorkManager; public class PollingReceiverWorkerSchedule implements Runnable { protected final PollingReceiverWorker worker; protected final WorkManager workManager; protected final AbstractPollingMessageReceiver receiver; protected PollingReceiverWorkerSchedule(PollingReceiverWorker work) { super(); worker = work; receiver = work.getReceiver(); workManager = receiver.getWorkManager(); } public void run() { try { if (!worker.isRunning()) { workManager.scheduleWork(worker); } } catch (Exception e) { receiver.handleException(e); } } } mule-2.0.1/core/src/main/java/org/mule/transport/AbstractMessageRequesterFactory.java0000644000175000017500000000537610757615756030652 0ustar charlescharles/* * $Id: AbstractMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; import org.mule.api.transport.MessageRequesterFactory; import org.mule.util.ClassUtils; /** * A base implementation of the {@link org.mule.api.transport.MessageRequesterFactory} interface for managing the * lifecycle of message requesters. * * @see org.mule.api.transport.MessageDispatcherFactory */ public abstract class AbstractMessageRequesterFactory implements MessageRequesterFactory { public AbstractMessageRequesterFactory() { super(); } /** * This default implementation of * {@link org.mule.api.transport.MessageDispatcherFactory#isCreateDispatcherPerRequest()} returns * false, which means that dispatchers are pooled according to * their lifecycle as described in {@link org.mule.api.transport.MessageRequester}. * * @return false by default, unless overwritten by a subclass. */ public boolean isCreateRequesterPerRequest() { return false; } public abstract MessageRequester create(InboundEndpoint endpoint) throws MuleException; public void activate(InboundEndpoint endpoint, MessageRequester requester) throws MuleException { requester.activate(); } public void destroy(InboundEndpoint endpoint, MessageRequester requester) { requester.dispose(); } public void passivate(InboundEndpoint endpoint, MessageRequester requester) { requester.passivate(); } public boolean validate(InboundEndpoint endpoint, MessageRequester requester) { // Unless requesters are to be disposed of after every request, we check if // the requester is still valid or has e.g. disposed itself after an // exception. return (!this.isCreateRequesterPerRequest() && requester.validate()); } // @Override public String toString() { final StringBuffer sb = new StringBuffer(60); sb.append(ClassUtils.getSimpleName(this.getClass())); sb.append("{this=").append(Integer.toHexString(System.identityHashCode(this))); sb.append(", createRequesterPerRequest=").append(this.isCreateRequesterPerRequest()); sb.append('}'); return sb.toString(); } }mule-2.0.1/core/src/main/java/org/mule/transport/AbstractMessageRequester.java0000644000175000017500000000603111005754621027265 0ustar charlescharles/* * $Id: AbstractMessageRequester.java 11662 2008-04-30 02:29:37Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleMessage; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.DispatchException; import org.mule.api.transport.MessageRequester; import org.mule.api.transport.ReceiveException; import org.mule.context.notification.MessageNotification; /** * Provide a default dispatch (client) support for handling threads lifecycle and validation. */ public abstract class AbstractMessageRequester extends AbstractConnectable implements MessageRequester { public AbstractMessageRequester(InboundEndpoint endpoint) { super(endpoint); } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was available * @throws Exception if the call to the underlying protocol causes an exception */ public final MuleMessage request(long timeout) throws Exception { try { // Make sure we are connected connectionStrategy.connect(this); MuleMessage result = doRequest(timeout); if (result != null && connector.isEnableMessageEvents()) { connector.fireNotification(new MessageNotification(result, endpoint, null, MessageNotification.MESSAGE_REQUESTED)); } return result; } catch (DispatchException e) { disposeAndLogException(); throw e; } catch (Exception e) { disposeAndLogException(); throw new ReceiveException(endpoint, timeout, e); } } /** * Make a specific request to the underlying transport * * @param timeout the maximum time the operation should block before returning. * The call should return immediately if there is data available. If * no data becomes available before the timeout elapses, null will be * returned * @return the result of the request wrapped in a MuleMessage object. Null will be * returned if no data was avaialable * @throws Exception if the call to the underlying protocal cuases an exception */ protected abstract MuleMessage doRequest(long timeout) throws Exception; }mule-2.0.1/core/src/main/java/org/mule/transport/AbstractMessageAdapter.java0000644000175000017500000004564011003210707026665 0ustar charlescharles/* * $Id: AbstractMessageAdapter.java 11617 2008-04-21 22:14:31Z aguenther $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.MuleServer; import org.mule.api.ExceptionPayload; import org.mule.api.MuleContext; import org.mule.api.MuleRuntimeException; import org.mule.api.ThreadSafeAccess; import org.mule.api.config.MuleProperties; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.PropertyScope; import org.mule.api.transport.UniqueIdNotSupportedException; import org.mule.config.MuleManifest; import org.mule.config.i18n.CoreMessages; import org.mule.util.FileUtils; import org.mule.util.IOUtils; import org.mule.util.StringUtils; import org.mule.util.UUID; import java.io.InputStream; import java.util.Collections; import java.util.Iterator; import java.util.Map; import java.util.Set; import javax.activation.DataHandler; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentMap; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicReference; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractMessageAdapter provides a base implementation for simple * message types that maybe don't normally allow for meta information, such as a File * or TCP. */ public abstract class AbstractMessageAdapter implements MessageAdapter, ThreadSafeAccess { /** logger used by this class */ protected static transient Log logger; /** Scoped properties for this message */ protected MessagePropertiesContext properties = new MessagePropertiesContext(); /** Collection of attachments associatated with this message */ protected ConcurrentMap attachments = new ConcurrentHashMap(); /** The encoding used by this message. This is usually used when working with String representations of the message payload */ protected String encoding = FileUtils.DEFAULT_ENCODING; /** If an excpetion occurs while processing this message an exception payload will be attached here */ protected ExceptionPayload exceptionPayload; /** the default UUID for the message. If the underlying transport has the notion of a message id, this uuid will be ignorred */ protected String id = UUID.getUUID(); // these are transient because serisalisation generates a new instance // so we allow mutation again (and we can't serialize threads anyway) private transient AtomicReference ownerThread = null; private transient AtomicBoolean mutable = null; protected AbstractMessageAdapter() { // usual access for subclasses logger = LogFactory.getLog(getClass()); } /** * Creates a message adapter copying values from an existing one * @param template */ protected AbstractMessageAdapter(MessageAdapter template) { logger = LogFactory.getLog(getClass()); if (null != template) { Iterator propertyNames = template.getPropertyNames().iterator(); while (propertyNames.hasNext()) { String key = (String) propertyNames.next(); try { setProperty(key, template.getProperty(key)); } catch (Exception e) { throw new MuleRuntimeException(CoreMessages.failedToReadPayload(), e); } } Iterator attachmentNames = template.getAttachmentNames().iterator(); while (attachmentNames.hasNext()) { String key = (String) attachmentNames.next(); try { addAttachment(key, template.getAttachment(key)); } catch (Exception e) { throw new MuleRuntimeException(CoreMessages.failedToReadPayload(), e); } } encoding = template.getEncoding(); exceptionPayload = template.getExceptionPayload(); try { id = template.getUniqueId(); } catch (UniqueIdNotSupportedException e) { // Don't copy the id if it's not supported. } } } public String toString() { assertAccess(READ); StringBuffer buf = new StringBuffer(120); buf.append(getClass().getName()); buf.append("/" + super.toString()); buf.append('{'); buf.append("id=").append(getUniqueId()); buf.append(", payload=").append(getPayload().getClass().getName()); buf.append(", correlationId=").append(getCorrelationId()); buf.append(", correlationGroup=").append(getCorrelationGroupSize()); buf.append(", correlationSeq=").append(getCorrelationSequence()); buf.append(", encoding=").append(getEncoding()); buf.append(", exceptionPayload=").append(exceptionPayload); if (logger.isDebugEnabled()) { buf.append(", properties=").append(properties); } buf.append('}'); return buf.toString(); } /** {@inheritDoc} */ public void addProperties(Map props) { addProperties(props, properties.getDefaultScope()); assertAccess(WRITE); if (props != null) { synchronized (props) { for (Iterator iter = props.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); setProperty((String) entry.getKey(), entry.getValue()); } } } } /** {@inheritDoc} */ public void addProperties(Map props, PropertyScope scope) { assertAccess(WRITE); if (props != null) { synchronized (props) { for (Iterator iter = props.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); setProperty((String) entry.getKey(), entry.getValue(), scope); } } } } /** * A convenience method for extending classes to Set inbound scoped properties on the message * properties that arrive on the inbound message should be set as inbound-scoped properties. These are * read-only * @param props the properties to set * @see org.mule.api.transport.PropertyScope */ protected void addInboundProperties(Map props) { properties.addInboundProperties(props); } /** {@inheritDoc} */ public void clearProperties() { assertAccess(WRITE); properties.clearProperties(); } /** {@inheritDoc} */ public Object removeProperty(String key) { assertAccess(WRITE); return properties.removeProperty(key); } /** {@inheritDoc} */ public Object getProperty(String key) { assertAccess(READ); return properties.getProperty(key); } /** {@inheritDoc} */ public Set getPropertyNames() { assertAccess(READ); return properties.getPropertyNames(); } /** {@inheritDoc} */ public void setProperty(String key, Object value) { assertAccess(WRITE); if (key != null) { if (value != null) { properties.setProperty(key, value); } else { logger.warn("setProperty(key, value) called with null value; removing key: " + key + "; please report the following stack trace to " + MuleManifest.getDevListEmail(), new Throwable()); properties.removeProperty(key); } } else { logger.warn("setProperty(key, value) ignored because of null key for object: " + value + "; please report the following stack trace to " + MuleManifest.getDevListEmail(), new Throwable()); } } /** {@inheritDoc} */ public void setProperty(String key, Object value, PropertyScope scope) { assertAccess(WRITE); if (key != null) { if (value != null) { properties.setProperty(key, value, scope); } else { logger.warn("setProperty(key, value) called with null value; removing key: " + key + "; please report the following stack trace to " + MuleManifest.getDevListEmail(), new Throwable()); properties.removeProperty(key); } } else { logger.warn("setProperty(key, value) ignored because of null key for object: " + value + "; please report the following stack trace to " + MuleManifest.getDevListEmail(), new Throwable()); } } /** {@inheritDoc} */ public String getUniqueId() { assertAccess(READ); return id; } /** {@inheritDoc} */ public Object getProperty(String name, Object defaultValue) { assertAccess(READ); return properties.getProperty(name, defaultValue); } /** {@inheritDoc} */ public int getIntProperty(String name, int defaultValue) { assertAccess(READ); return properties.getIntProperty(name, defaultValue); } /** {@inheritDoc} */ public long getLongProperty(String name, long defaultValue) { assertAccess(READ); return properties.getLongProperty(name, defaultValue); } /** {@inheritDoc} */ public double getDoubleProperty(String name, double defaultValue) { assertAccess(READ); return properties.getDoubleProperty(name, defaultValue); } /** {@inheritDoc} */ public boolean getBooleanProperty(String name, boolean defaultValue) { assertAccess(READ); return properties.getBooleanProperty(name, defaultValue); } /** {@inheritDoc} */ public String getStringProperty(String name, String defaultValue) { assertAccess(READ); return properties.getStringProperty(name, defaultValue); } /** {@inheritDoc} */ public void setBooleanProperty(String name, boolean value) { assertAccess(WRITE); setProperty(name, Boolean.valueOf(value)); } /** {@inheritDoc} */ public void setIntProperty(String name, int value) { assertAccess(WRITE); setProperty(name, new Integer(value)); } public void setLongProperty(String name, long value) { assertAccess(WRITE); setProperty(name, new Long(value)); } public void setDoubleProperty(String name, double value) { assertAccess(WRITE); setProperty(name, new Double(value)); } /** {@inheritDoc} */ public void setStringProperty(String name, String value) { assertAccess(WRITE); setProperty(name, value); } /** {@inheritDoc} */ public Object getReplyTo() { assertAccess(READ); return getProperty(MuleProperties.MULE_REPLY_TO_PROPERTY); } /** {@inheritDoc} */ public void setReplyTo(Object replyTo) { assertAccess(WRITE); if (replyTo != null) { setProperty(MuleProperties.MULE_REPLY_TO_PROPERTY, replyTo); } else { removeProperty(MuleProperties.MULE_REPLY_TO_PROPERTY); } } /** {@inheritDoc} */ public String getCorrelationId() { assertAccess(READ); return (String) getProperty(MuleProperties.MULE_CORRELATION_ID_PROPERTY); } /** {@inheritDoc} */ public void setCorrelationId(String correlationId) { assertAccess(WRITE); if (StringUtils.isNotBlank(correlationId)) { setProperty(MuleProperties.MULE_CORRELATION_ID_PROPERTY, correlationId); } else { removeProperty(MuleProperties.MULE_CORRELATION_ID_PROPERTY); } } /** {@inheritDoc} */ public int getCorrelationSequence() { assertAccess(READ); return getIntProperty(MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY, -1); } /** {@inheritDoc} */ public void setCorrelationSequence(int sequence) { assertAccess(WRITE); setIntProperty(MuleProperties.MULE_CORRELATION_SEQUENCE_PROPERTY, sequence); } /** {@inheritDoc} */ public int getCorrelationGroupSize() { assertAccess(READ); return getIntProperty(MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY, -1); } /** {@inheritDoc} */ public void setCorrelationGroupSize(int size) { assertAccess(WRITE); setIntProperty(MuleProperties.MULE_CORRELATION_GROUP_SIZE_PROPERTY, size); } public ExceptionPayload getExceptionPayload() { assertAccess(READ); return exceptionPayload; } /** {@inheritDoc} */ public void setExceptionPayload(ExceptionPayload payload) { assertAccess(WRITE); exceptionPayload = payload; } /** {@inheritDoc} */ public void addAttachment(String name, DataHandler dataHandler) throws Exception { assertAccess(WRITE); attachments.put(name, dataHandler); } /** {@inheritDoc} */ public void removeAttachment(String name) throws Exception { assertAccess(WRITE); attachments.remove(name); } /** {@inheritDoc} */ public DataHandler getAttachment(String name) { assertAccess(READ); return (DataHandler) attachments.get(name); } /** {@inheritDoc} */ public Set getAttachmentNames() { assertAccess(READ); return Collections.unmodifiableSet(attachments.keySet()); } /** {@inheritDoc} */ public String getEncoding() { assertAccess(READ); return encoding; } /** {@inheritDoc} */ public void setEncoding(String encoding) { assertAccess(WRITE); this.encoding = encoding; } /** {@inheritDoc} */ public void release() { //TODO handle other stream types if(getPayload() instanceof InputStream) { IOUtils.closeQuietly((InputStream)getPayload()); } properties.clearProperties(); attachments.clear(); } ///////////////////////// ThreadSafeAccess impl ///////////////////////////////////// /** {@inheritDoc} */ public void assertAccess(boolean write) { MuleContext context = MuleServer.getMuleContext(); if (context !=null && context.getConfiguration().isAssertMessageAccess()) { initAccessControl(); setOwner(); checkMutable(write); } } private void setOwner() { if (null == ownerThread.get()) { ownerThread.compareAndSet(null, Thread.currentThread()); } } private void checkMutable(boolean write) { // IF YOU SEE AN EXCEPTION THAT IS RAISED FROM WITHIN THIS CODE // ============================================================ // // First, understand that the exception here is not the "real" problem. These exceptions // give early warning of a much more serious issue that results in unreliable and unpredictable // code - more than one thread is attempting to change the contents of a message. // // Having said that, you can disable these exceptions by defining // MuleProperties.MULE_THREAD_UNSAFE_MESSAGES_PROPERTY (mule.disable.threadsafemessages) // (ie by adding -Dmule.disable.threadsafemessages=true to the java command line). // // To remove the underlying cause, however, you probably need to do one of: // // - make sure that the message adapter you are using correclty implements the // ThreadSafeAccess interface // // - make sure that dispatcher and receiver classes copy ThreadSafeAccess instances when // they are passed between threads Thread currentThread = Thread.currentThread(); if (currentThread.equals(ownerThread.get())) { if (write && !mutable.get()) { if (isDisabled()) { logger.warn("Writing to immutable message (exception disabled)"); } else { throw newException("Cannot write to immutable message"); } } } else { if (write) { if (isDisabled()) { logger.warn("Non-owner writing to message (exception disabled)"); } else { throw newException("Only owner thread can write to message: " + ownerThread.get() + "/" + Thread.currentThread()); } } else { // access by another thread mutable.set(false); } } } protected IllegalStateException newException(String message) { IllegalStateException exception = new IllegalStateException(message); logger.warn("Message access violation", exception); return exception; } protected boolean isDisabled() { return !MuleServer.getMuleContext().getConfiguration().isFailOnMessageScribbling(); } private synchronized void initAccessControl() { if (null == ownerThread) { ownerThread = new AtomicReference(); } if (null == mutable) { mutable = new AtomicBoolean(true); } } /** {@inheritDoc} */ public synchronized void resetAccessControl() { // just reset the internal state here as this method is explicitly intended not to // be used from the outside if (ownerThread != null) { ownerThread.set(null); } if (mutable != null) { mutable.set(true); } } /** {@inheritDoc} */ public ThreadSafeAccess newThreadCopy() { if (logger.isInfoEnabled()) { logger.info("The newThreadCopy method in AbstractMessageAdapter is being used directly. " + "This code may be susceptible to 'scribbling' issues with messages. " + "Please consider implementing the ThreadSafeAccess interface in the message adapter."); } return this; } } mule-2.0.1/core/src/main/java/org/mule/transport/UnsupportedMessageDispatcherFactory.java0000644000175000017500000000153610757615756031540 0ustar charlescharles/* * $Id: UnsupportedMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; public final class UnsupportedMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new UnsupportedMessageDispatcher(endpoint); } } mule-2.0.1/core/src/main/java/org/mule/transport/AbstractReceiverResourceWorker.java0000644000175000017500000000444410745677442030474 0ustar charlescharles/* * $Id: AbstractReceiverResourceWorker.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import java.io.OutputStream; import java.util.ArrayList; /** * This is a Message receiver worker used by transports that do not have a way for the underlying transport * to call back to the receiver when a message is available such as Jms. This worker provides a * callback {@link #getNextMessage(Object)} where the receiver can read the next message from the underlying * transport. */ public abstract class AbstractReceiverResourceWorker extends AbstractReceiverWorker { protected Object resource; public AbstractReceiverResourceWorker(Object resource, AbstractMessageReceiver receiver) { this(resource, receiver, null); } public AbstractReceiverResourceWorker(Object resource, AbstractMessageReceiver receiver, OutputStream out) { super(new ArrayList(), receiver, out); this.resource = resource; } /** * (non-Javadoc) * */ //@Override public void doRun() { try { Object message = null; do { message = getNextMessage(resource); messages.add(message); super.doRun(); } while (message != null && hasMoreMessages(message)); } catch (Exception e) { handleException(e); } } protected boolean hasMoreMessages(Object message) { return true; } /** * The method used to read the next message from the underlying transport. * @param resource the resource to read from, this may be a socket, a directory or some higher level * representation. * @return the message read from the resource. This can be raw data such as a byte[] or a MessageAdapter. * @throws Exception */ protected abstract Object getNextMessage(Object resource) throws Exception; } mule-2.0.1/core/src/main/java/org/mule/transport/AbstractPollingMessageReceiver.java0000644000175000017500000001312010757615756030416 0ustar charlescharles/* * $Id: AbstractPollingMessageReceiver.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.config.i18n.CoreMessages; import org.mule.util.ObjectUtils; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.Future; import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionException; import edu.emory.mathcs.backport.java.util.concurrent.ScheduledExecutorService; import edu.emory.mathcs.backport.java.util.concurrent.ScheduledFuture; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; /** * AbstractPollingMessageReceiver implements a base class for polling * message receivers. The receiver provides a {@link #poll()} method that implementations * must implement to execute their custom code. Note that the receiver will not poll if * the associated connector is not started. */ public abstract class AbstractPollingMessageReceiver extends AbstractMessageReceiver { public static final long DEFAULT_POLL_FREQUENCY = 1000; public static final TimeUnit DEFAULT_POLL_TIMEUNIT = TimeUnit.MILLISECONDS; public static final long DEFAULT_STARTUP_DELAY = 1000; private long frequency = DEFAULT_POLL_FREQUENCY; private TimeUnit timeUnit = DEFAULT_POLL_TIMEUNIT; // @GuardedBy(itself) protected final List schedules = new LinkedList(); public AbstractPollingMessageReceiver(Connector connector, Service service, final InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); } protected void doStart() throws MuleException { try { this.schedule(); } catch (Exception ex) { this.stop(); throw new CreateException(CoreMessages.failedToScheduleWork(), ex, this); } } protected void doStop() throws MuleException { this.unschedule(); } /** * This method registers this receiver for periodic polling ticks with the connectors * scheduler. Subclasses can override this in case they want to handle their polling * differently. * * @throws RejectedExecutionException * @throws NullPointerException * @throws IllegalArgumentException * @see {@link ScheduledExecutorService#scheduleWithFixedDelay(Runnable, long, long, TimeUnit)} */ protected void schedule() throws RejectedExecutionException, NullPointerException, IllegalArgumentException { synchronized (schedules) { // we use scheduleWithFixedDelay to prevent queue-up of tasks when // polling takes longer than the specified frequency, e.g. when the // polled database or network is slow or returns large amounts of // data. ScheduledFuture schedule = connector.getScheduler().scheduleWithFixedDelay( new PollingReceiverWorkerSchedule(this.createWork()), DEFAULT_STARTUP_DELAY, this.getFrequency(), this.getTimeUnit()); schedules.add(schedule); if (logger.isDebugEnabled()) { logger.debug(ObjectUtils.identityToShortString(this) + " scheduled " + ObjectUtils.identityToShortString(schedule) + " with " + frequency + " " + getTimeUnit() + " polling frequency"); } } } /** * This method cancels the schedules which were created in {@link #schedule()}. * * @see {@link Future#cancel(boolean)} */ protected void unschedule() { synchronized (schedules) { // cancel our schedules gently: do not interrupt when polling is in progress for (Iterator i = schedules.iterator(); i.hasNext();) { ScheduledFuture schedule = (ScheduledFuture)i.next(); schedule.cancel(false); i.remove(); if (logger.isDebugEnabled()) { logger.debug(ObjectUtils.identityToShortString(this) + " cancelled polling schedule: " + ObjectUtils.identityToShortString(schedule)); } } } } protected PollingReceiverWorker createWork() { return new PollingReceiverWorker(this); } public long getFrequency() { return frequency; } // TODO a nifty thing would be on-the-fly adjustment (via JMX?) of the // polling frequency by rescheduling without explicit stop() public void setFrequency(long value) { if (value <= 0) { frequency = DEFAULT_POLL_FREQUENCY; } else { frequency = value; } } public TimeUnit getTimeUnit() { return timeUnit; } public void setTimeUnit(TimeUnit timeUnit) { this.timeUnit = timeUnit; } public abstract void poll() throws Exception; } mule-2.0.1/core/src/main/java/org/mule/transport/UnsupportedMessageRequesterFactory.java0000644000175000017500000000152510757615756031427 0ustar charlescharles/* * $Id: UnsupportedMessageRequesterFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageRequester; public final class UnsupportedMessageRequesterFactory extends AbstractMessageRequesterFactory { public MessageRequester create(InboundEndpoint endpoint) throws MuleException { return new UnsupportedMessageRequester(endpoint); } }mule-2.0.1/core/src/main/java/org/mule/transport/SingleAttemptConnectionStrategy.java0000644000175000017500000000233010745677442030655 0ustar charlescharles/* * $Id: SingleAttemptConnectionStrategy.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.transport.Connectable; import org.mule.config.i18n.CoreMessages; /** * Attempts to make a connection once and fails if there is an exception */ public class SingleAttemptConnectionStrategy extends AbstractConnectionStrategy { public void doConnect(Connectable connectable) throws FatalConnectException { try { connectable.connect(); } catch (Exception e) { throw new FatalConnectException( CoreMessages.reconnectStrategyFailed(this.getClass(), this.getDescription(connectable)), e, connectable); } } /** * Resets any state stored in the retry strategy */ public void resetState() { // no op } } mule-2.0.1/core/src/main/java/org/mule/transport/AbstractMessageDispatcher.java0000644000175000017500000002640110776773267027424 0ustar charlescharles/* * $Id: AbstractMessageDispatcher.java 11546 2008-04-08 22:50:31Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.OptimizedRequestContext; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.config.MuleProperties; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.ResponseRouterCollection; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transport.DispatchException; import org.mule.api.transport.MessageDispatcher; import org.mule.context.notification.MessageNotification; import org.mule.context.notification.SecurityNotification; import org.mule.transaction.TransactionCoordination; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkManager; /** * Provide a default dispatch (client) support for handling threads lifecycle and validation. */ public abstract class AbstractMessageDispatcher extends AbstractConnectable implements MessageDispatcher { public AbstractMessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); } /* * (non-Javadoc) * * @see org.mule.api.transport.MessageDispatcher#dispatch(org.mule.api.MuleEvent) */ public final void dispatch(MuleEvent event) throws DispatchException { event.setSynchronous(false); event.getMessage().setProperty(MuleProperties.MULE_ENDPOINT_PROPERTY, event.getEndpoint().getEndpointURI().toString()); event = OptimizedRequestContext.criticalSetEvent(event); // MULE-2112 // Apply Security filter if one is set ImmutableEndpoint endpoint = event.getEndpoint(); if (endpoint.getSecurityFilter() != null) { try { endpoint.getSecurityFilter().authenticate(event); } catch (org.mule.api.security.SecurityException e) { // TODO MULE-863: Do we need this warning? logger.warn("Outbound Request was made but was not authenticated: " + e.getMessage(), e); connector.fireNotification(new SecurityNotification(e, SecurityNotification.ADMIN_EVENT_ACTION_START_RANGE)); connector.handleException(e); return; } catch (MuleException e) { disposeAndLogException(); throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } } try { Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (isDoThreading() && !event.isSynchronous() && tx == null) { workManager.scheduleWork(new Worker(event), WorkManager.INDEFINITE, null, connector); } else { // Make sure we are connected connectionStrategy.connect(this); doDispatch(event); if (connector.isEnableMessageEvents()) { String component = null; if (event.getService() != null) { component = event.getService().getName(); } connector.fireNotification(new MessageNotification(event.getMessage(), event .getEndpoint(), component, MessageNotification.MESSAGE_DISPATCHED)); } } } catch (DispatchException e) { disposeAndLogException(); throw e; } catch (Exception e) { disposeAndLogException(); throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } } public final MuleMessage send(MuleEvent event) throws DispatchException { // No point continuing if the service has rolledback the transaction if (isTransactionRollback()) { return event.getMessage(); } event.setSynchronous(true); event.getMessage().setProperty(MuleProperties.MULE_ENDPOINT_PROPERTY, event.getEndpoint().getEndpointURI().getUri().toString()); event = OptimizedRequestContext.unsafeSetEvent(event); // Apply Security filter if one is set ImmutableEndpoint endpoint = event.getEndpoint(); if (endpoint.getSecurityFilter() != null) { try { endpoint.getSecurityFilter().authenticate(event); } catch (org.mule.api.security.SecurityException e) { logger.warn("Outbound Request was made but was not authenticated: " + e.getMessage(), e); connector.fireNotification(new SecurityNotification(e, SecurityNotification.SECURITY_AUTHENTICATION_FAILED)); connector.handleException(e); return event.getMessage(); } catch (MuleException e) { disposeAndLogException(); throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } } try { // Make sure we are connected connectionStrategy.connect(this); MuleMessage result = doSend(event); if (connector.isEnableMessageEvents()) { String component = null; if (event.getService() != null) { component = event.getService().getName(); } connector.fireNotification(new MessageNotification(event.getMessage(), event.getEndpoint(), component, MessageNotification.MESSAGE_SENT)); } //TODO: This chunk can be removed since there is no need to remove any properites since they are now scoped // Once a dispatcher has done its work we need to remove this property // so that it is not propagated to the next request // if (result != null // && result.getPropertyNames().contains(MuleProperties.MULE_REMOTE_SYNC_PROPERTY)) //{ // result = RequestContext.safeMessageCopy(result); // result.removeProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY); //} return result; } catch (DispatchException e) { disposeAndLogException(); throw e; } catch (Exception e) { disposeAndLogException(); throw new DispatchException(event.getMessage(), event.getEndpoint(), e); } } /** * RemoteSync causes the message dispatch to wait for a response to an event on a * response channel after it sends the event. The following rules apply to * RemoteSync 1. The connector has to support remoteSync. Some transports do not * have the notion of a response channel 2. Check if the endpoint has been * configured for remoteSync 3. Check if the REMOTE_SYNC message header has been * set 4. Finally, if the current service has a response router configured, * that the router will handle the response channel event and we should not try * and receive a response in the Message dispatcher If remotesync should not be * used we must remove the REMOTE_SYNC header Note the MuleClient will * automatically set the REMOTE_SYNC header when client.send(..) is called so * that results are returned from remote invocations too. * * @param event the current event * @return true if a response channel should be used to get a resposne from the * event dispatch. */ protected boolean useRemoteSync(MuleEvent event) { boolean remoteSync = false; if (event.getEndpoint().getConnector().isRemoteSyncEnabled()) { remoteSync = event.getEndpoint().isRemoteSync() || event.getMessage().getBooleanProperty( MuleProperties.MULE_REMOTE_SYNC_PROPERTY, false); if (remoteSync) { // service will be null for client calls if (event.getService() != null) { ResponseRouterCollection responseRouters = event.getService().getResponseRouter(); if (responseRouters != null && responseRouters.hasEndpoints()) { remoteSync = false; } else { remoteSync = true; } } } } if (!remoteSync) { event.getMessage().removeProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY); } return remoteSync; } private class Worker implements Work { private MuleEvent event; public Worker(MuleEvent event) { this.event = event; } /* * (non-Javadoc) * * @see java.lang.Runnable#run() */ public void run() { try { event = RequestContext.setEvent(event); // Make sure we are connected connectionStrategy.connect(AbstractMessageDispatcher.this); AbstractMessageDispatcher.this.doDispatch(event); if (connector.isEnableMessageEvents()) { String component = null; if (event.getService() != null) { component = event.getService().getName(); } connector.fireNotification(new MessageNotification(event.getMessage(), event .getEndpoint(), component, MessageNotification.MESSAGE_DISPATCHED)); } } catch (Exception e) { AbstractMessageDispatcher.this.getConnector().handleException(e); } } public void release() { // nothing to do } } /** * Checks to see if the current transaction has been rolled back * * @return */ protected boolean isTransactionRollback() { try { Transaction tx = TransactionCoordination.getInstance().getTransaction(); if (tx != null && tx.isRollbackOnly()) { return true; } } catch (TransactionException e) { // TODO MULE-863: What should we really do? logger.warn(e.getMessage()); } return false; } protected abstract void doDispatch(MuleEvent event) throws Exception; protected abstract MuleMessage doSend(MuleEvent event) throws Exception; } mule-2.0.1/core/src/main/java/org/mule/transport/AbstractJndiConnector.java0000644000175000017500000000676710745677442026577 0ustar charlescharles/* * $Id: AbstractJndiConnector.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.lifecycle.InitialisationException; import org.mule.config.i18n.CoreMessages; import java.util.Hashtable; import java.util.Map; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; /** * This class acts as common baseclass for both Rmi & EjbConnector Resolves Jndi root for connector usage * */ public abstract class AbstractJndiConnector extends AbstractConnector { protected String jndiInitialFactory; protected String jndiUrlPkgPrefixes; protected String jndiProviderUrl; protected Context jndiContext; protected Map jndiProviderProperties = null; protected void initJndiContext() throws InitialisationException { if (null == jndiContext) { Hashtable props = new Hashtable(); if (null != jndiInitialFactory) { props.put(Context.INITIAL_CONTEXT_FACTORY, jndiInitialFactory); } if (jndiProviderUrl != null) { props.put(Context.PROVIDER_URL, jndiProviderUrl); } if (jndiUrlPkgPrefixes != null) { props.put(Context.URL_PKG_PREFIXES, jndiUrlPkgPrefixes); } if (jndiProviderProperties != null) { props.putAll(jndiProviderProperties); } try { jndiContext = new InitialContext(props); } catch (NamingException e) { throw new InitialisationException(e, this); } } } public Context getJndiContext(String jndiProviderUrl) throws InitialisationException { try { setJndiProviderUrl(jndiProviderUrl); initJndiContext(); } catch (Exception e) { throw new InitialisationException( CoreMessages.failedToCreate("AbstractJndiConnector"), e, this); } return jndiContext; } public Context getJndiContext() { return jndiContext; } public void setJndiContext(Context jndiContext) { this.jndiContext = jndiContext; } public void setJndiInitialFactory(String jndiInitialFactory) { this.jndiInitialFactory = jndiInitialFactory; } public String getJndiInitialFactory() { return jndiInitialFactory; } public void setJndiUrlPkgPrefixes(String jndiUrlPkgPrefixes) { this.jndiUrlPkgPrefixes = jndiUrlPkgPrefixes; } public String getJndiUrlPkgPrefixes() { return jndiUrlPkgPrefixes; } public String getJndiProviderUrl() { return jndiProviderUrl; } public void setJndiProviderUrl(String jndiProviderUrl) { this.jndiProviderUrl = jndiProviderUrl; } public Map getJndiProviderProperties() { return jndiProviderProperties; } public void setJndiProviderProperties(Map jndiProviderProperties) { this.jndiProviderProperties = jndiProviderProperties; } } mule-2.0.1/core/src/main/java/org/mule/transport/ConnectException.java0000644000175000017500000000215710745677442025611 0ustar charlescharles/* * $Id: ConnectException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.lifecycle.LifecycleException; import org.mule.api.transport.Connectable; import org.mule.config.i18n.Message; /** TODO document */ public class ConnectException extends LifecycleException { /** Serial version */ private static final long serialVersionUID = -7802483584780922653L; public ConnectException(Message message, Connectable component) { super(message, component); } public ConnectException(Message message, Throwable cause, Connectable component) { super(message, cause, component); } public ConnectException(Throwable cause, Connectable component) { super(cause, component); } } mule-2.0.1/core/src/main/java/org/mule/message/0000755000175000017500000000000011351411101021025 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/message/package.html0000644000175000017500000000023610745677442023343 0ustar charlescharles Mule Wire message implementations. These are standard message types used by various Mule objects. mule-2.0.1/core/src/main/java/org/mule/message/BaseMessage.java0000644000175000017500000000530310745677442024104 0ustar charlescharles/* * $Id: BaseMessage.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.message; import java.io.Serializable; import java.util.HashMap; import java.util.Map; /** * BaseMessage A default message implementation used for messages sent * over the wire. client messages should NOT implement MuleMessage. */ public class BaseMessage implements Serializable { /** * Serial version */ private static final long serialVersionUID = -6105691921086093748L; protected Object message; protected Map context; public BaseMessage(Object message) { this.message = message; context = new HashMap(); } /** * Converts the message implementation into a String representation * * @return String representation of the message payload * @throws Exception Implementation may throw an endpoint specific exception */ public String getPayloadAsString(String encoding) throws Exception { return message.toString(); } /** * Converts the message implementation into a String representation * * @return String representation of the message * @throws Exception Implemetation may throw an endpoint specific exception */ public byte[] getPayloadAsBytes() throws Exception { return getPayloadAsString(message.toString()).getBytes(); } /** * @return the current message */ public Object getPayload() { return message; } /** * Adds a map of properties to associated with this message * * @param properties the properties add to this message */ public void addProperties(Map properties) { context.putAll(properties); } /** * Removes all properties on this message */ public void clearProperties() { context.clear(); } /** * Returns a map of all properties on this message * * @return a map of all properties on this message */ public Map getProperties() { return context; } public void setProperty(Object key, Object value) { context.put(key, value); } public Object getProperty(Object key) { return context.get(key); } public String toString() { return "BaseMessage{" + "message=" + message + ", context=" + context + "}"; } } mule-2.0.1/core/src/main/java/org/mule/message/DefaultExceptionPayload.java0000644000175000017500000000336010745677442026503 0ustar charlescharles/* * $Id: DefaultExceptionPayload.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.message; import org.mule.api.MuleException; import org.mule.api.ExceptionPayload; import org.mule.config.ExceptionHelper; import java.util.Map; /** * DefaultExceptionPayload TODO */ public class DefaultExceptionPayload implements ExceptionPayload { /** * Serial version */ private static final long serialVersionUID = -7114836033686599024L; private int code = 0; private String message = null; private Map info = null; private Throwable exception; public DefaultExceptionPayload(Throwable exception) { this.exception = exception; MuleException muleRoot = ExceptionHelper.getRootMuleException(exception); if (muleRoot != null) { message = muleRoot.getMessage(); code = muleRoot.getExceptionCode(); info = muleRoot.getInfo(); } else { message = exception.getMessage(); } } public Throwable getRootException() { return ExceptionHelper.getRootException(exception); } public int getCode() { return code; } public String getMessage() { return message; } public Map getInfo() { return info; } public Throwable getException() { return exception; } } mule-2.0.1/core/src/main/java/org/mule/message/ExceptionMessage.java0000644000175000017500000000470710746275214025167 0ustar charlescharles/* * $Id: ExceptionMessage.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.message; import org.mule.RequestContext; import org.mule.api.MuleEventContext; import org.mule.api.MuleMessage; import org.mule.api.endpoint.EndpointURI; import java.util.Date; import java.util.Iterator; /** * ExceptionMessage is used by the DefaultServiceExceptionStrategy * for wrapping an exception with a message to send via an endpointUri. */ public class ExceptionMessage extends BaseMessage { /** * Serial version */ private static final long serialVersionUID = -538516243574950621L; private Throwable exception; private String componentName; private EndpointURI endpointUri; private Date timeStamp; public ExceptionMessage(Object message, Throwable exception, String componentName, EndpointURI endpointUri) { super(message); this.exception = exception; timeStamp = new Date(); this.componentName = componentName; this.endpointUri = endpointUri; MuleEventContext ctx = RequestContext.getEventContext(); if (ctx != null) { MuleMessage msg = ctx.getMessage(); for (Iterator iterator = msg.getPropertyNames().iterator(); iterator.hasNext();) { String propertyKey = (String) iterator.next(); setProperty(propertyKey, msg.getProperty(propertyKey)); } } } public String getComponentName() { return componentName; } public EndpointURI getEndpoint() { return endpointUri; } public Date getTimeStamp() { return timeStamp; } public Throwable getException() { return exception; } public String toString() { return "ExceptionMessage{" + "message=" + message + ", context=" + context + "exception=" + exception + ", componentName='" + componentName + "'" + ", endpointUri=" + endpointUri + ", timeStamp=" + timeStamp + "}"; } } mule-2.0.1/core/src/main/java/org/mule/util/0000755000175000017500000000000011351411131020361 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/queue/0000755000175000017500000000000011351411127021512 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/queue/package.html0000644000175000017500000000023010240602467023773 0ustar charlescharles Mule A resource manager that allow access to transactional queues with optional persistence. mule-2.0.1/core/src/main/java/org/mule/util/queue/TransactionalQueueSession.java0000644000175000017500000001131311003725410027524 0ustar charlescharles/* * $Id: TransactionalQueueSession.java 11636 2008-04-23 21:32:56Z aguenther $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; import org.mule.util.xa.AbstractXAResourceManager; import org.mule.util.xa.DefaultXASession; import java.io.IOException; /** * A Queue session that is used to manage the transaction context of a Queue */ class TransactionalQueueSession extends DefaultXASession implements QueueSession { protected TransactionalQueueManager queueManager; public TransactionalQueueSession(AbstractXAResourceManager resourceManager, TransactionalQueueManager queueManager) { super(resourceManager); this.queueManager = queueManager; } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueueSession#getQueue(java.lang.String) */ public Queue getQueue(String name) { QueueInfo queue = queueManager.getQueue(name); return new QueueImpl(queue); } protected class QueueImpl implements Queue { protected QueueInfo queue; public QueueImpl(QueueInfo queue) { this.queue = queue; } public void put(Object item) throws InterruptedException { offer(item, Long.MAX_VALUE); } public boolean offer(Object item, long timeout) throws InterruptedException { if (localContext != null) { return ((TransactionalQueueManager.QueueTransactionContext) localContext).offer(queue, item, timeout); } else { try { Object id = queueManager.doStore(queue, item); try { if (!queue.offer(id, 0, timeout)) { queueManager.doRemove(queue, item); return false; } else { return true; } } catch (InterruptedException e) { queueManager.doRemove(queue, item); throw e; } } catch (IOException e) { throw new RuntimeException(e); } } } public Object take() throws InterruptedException { return poll(Long.MAX_VALUE); } public Object poll(long timeout) throws InterruptedException { try { if (localContext != null) { return ((TransactionalQueueManager.QueueTransactionContext) localContext).poll(queue, timeout); } else { Object id = queue.poll(timeout); if (id != null) { Object item = queueManager.doLoad(queue, id); queueManager.doRemove(queue, id); return item; } return null; } } catch (IOException e) { throw new RuntimeException(e); } } public Object peek() throws InterruptedException { try { if (localContext != null) { return ((TransactionalQueueManager.QueueTransactionContext) localContext).peek(queue); } else { Object id = queue.peek(); if (id != null) { return queueManager.doLoad(queue, id); } return null; } } catch (IOException e) { throw new RuntimeException(e); } } public int size() { if (localContext != null) { return ((TransactionalQueueManager.QueueTransactionContext) localContext).size(queue); } else { return queue.list.size(); } } } } mule-2.0.1/core/src/main/java/org/mule/util/queue/EventFilePersistenceStrategy.java0000644000175000017500000000140710745677442030214 0ustar charlescharles/* * $Id: EventFilePersistenceStrategy.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; import org.mule.api.MuleEvent; public class EventFilePersistenceStrategy extends FilePersistenceStrategy { public EventFilePersistenceStrategy() { super(); } protected String getId(Object obj) { MuleEvent event = (MuleEvent) obj; return event.getId(); } } mule-2.0.1/core/src/main/java/org/mule/util/queue/QueueConfiguration.java0000644000175000017500000000275710664630335026216 0ustar charlescharles/* * $Id: QueueConfiguration.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; public class QueueConfiguration { protected int capacity; protected boolean persistent; public QueueConfiguration(int capacity, boolean persistent) { this.capacity = capacity; this.persistent = persistent; } public QueueConfiguration(int capacity) { this(capacity, false); } public QueueConfiguration(boolean persistent) { this(0, persistent); } public QueueConfiguration() { this(0, false); } /** * @return Returns the capacity. */ public int getCapacity() { return capacity; } /** * @param capacity The capacity to set. */ public void setCapacity(int capacity) { this.capacity = capacity; } /** * @return Returns the persistent. */ public boolean isPersistent() { return persistent; } /** * @param persistent The persistent to set. */ public void setPersistent(boolean persistent) { this.persistent = persistent; } } mule-2.0.1/core/src/main/java/org/mule/util/queue/EventMemoryPersistenceStrategy.java0000644000175000017500000000124610745677442030606 0ustar charlescharles/* * $Id: EventMemoryPersistenceStrategy.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; import org.mule.api.MuleEvent; public class EventMemoryPersistenceStrategy extends MemoryPersistenceStrategy { protected Object getId(Object obj) { return ((MuleEvent) obj).getId(); } } mule-2.0.1/core/src/main/java/org/mule/util/queue/QueueSession.java0000644000175000017500000000133110664630335025015 0ustar charlescharles/* * $Id: QueueSession.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; import org.mule.util.xa.ResourceManagerException; public interface QueueSession { Queue getQueue(String name); void begin() throws ResourceManagerException; void commit() throws ResourceManagerException; void rollback() throws ResourceManagerException; } mule-2.0.1/core/src/main/java/org/mule/util/queue/FilePersistenceStrategy.java0000644000175000017500000001424310766204322027176 0ustar charlescharles/* * $Id: FilePersistenceStrategy.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.context.MuleContextAware; import org.mule.util.FileUtils; import org.mule.util.file.DeleteException; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.safehaus.uuid.UUIDGenerator; public class FilePersistenceStrategy implements QueuePersistenceStrategy, MuleContextAware { private static final Log logger = LogFactory.getLog(FilePersistenceStrategy.class); /** The default queueStore directory for persistence */ public static final String DEFAULT_QUEUE_STORE = "queuestore"; public static final String EXTENSION = ".msg"; private File store; private UUIDGenerator gen = UUIDGenerator.getInstance(); protected MuleContext muleContext; public FilePersistenceStrategy() { super(); } public void setMuleContext(MuleContext context) { this.muleContext = context; } protected String getId(Object obj) { String id = gen.generateRandomBasedUUID().toString(); return id; } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueuePersistenceStrategy#store(java.lang.Object) */ public Object store(String queue, Object obj) throws IOException { String id = getId(obj); File file = FileUtils.newFile(store, queue + File.separator + id + EXTENSION); file.getParentFile().mkdirs(); ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file)); oos.writeObject(obj); oos.close(); return id; } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueuePersistenceStrategy#remove(java.lang.Object) */ public void remove(String queue, Object id) throws IOException { File file = FileUtils.newFile(store, queue + File.separator + id + EXTENSION); if (file.exists()) { if (!file.delete()) { throw new DeleteException(file); } } else { throw new FileNotFoundException(file.toString()); } } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueuePersistenceStrategy#load(java.lang.Object) */ public Object load(String queue, Object id) throws IOException { File file = FileUtils.newFile(store, queue + File.separator + id + EXTENSION); ObjectInputStream ois = null; try { ois = new ObjectInputStream(new FileInputStream(file)); Object obj = ois.readObject(); return obj; } catch (ClassNotFoundException e) { throw (IOException) new IOException("Error loading persistent object").initCause(e); } finally { if (ois != null) { ois.close(); } } } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueuePersistenceStrategy#restore() */ public List restore() throws IOException { List msgs = new ArrayList(); if (store == null) { logger.warn("No store has be set on the File Persistence Strategy. Not restoring at this time"); return msgs; } try { restoreFiles(store, msgs); logger.debug("Restore retrieved " + msgs.size() + " objects"); return msgs; } catch (ClassNotFoundException e) { throw (IOException) new IOException("Could not restore").initCause(e); } } protected void restoreFiles(File dir, List msgs) throws IOException, ClassNotFoundException { File[] files = dir.listFiles(); if (files == null) { return; } for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { restoreFiles(files[i], msgs); } else if (files[i].getName().endsWith(EXTENSION)) { String id = files[i].getCanonicalPath(); id = id.substring(store.getCanonicalPath().length() + 1, id.length() - EXTENSION.length()); String queue = id.substring(0, id.indexOf(File.separator)); id = id.substring(queue.length() + 1); msgs.add(new HolderImpl(queue, id)); } } } /* * (non-Javadoc) * * @see org.mule.util.queue.QueuePersistenceStrategy#open() */ public void open() throws IOException { String path = RegistryContext.getConfiguration().getWorkingDirectory() + File.separator + DEFAULT_QUEUE_STORE; store = FileUtils.newFile(path).getCanonicalFile(); store.mkdirs(); } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueuePersistenceStrategy#close() */ public void close() throws IOException { // Nothing to do } protected static class HolderImpl implements Holder { private String queue; private Object id; public HolderImpl(String queue, Object id) { this.queue = queue; this.id = id; } public Object getId() { return id; } public String getQueue() { return queue; } } public boolean isTransient() { return false; } } mule-2.0.1/core/src/main/java/org/mule/util/queue/TransactionalQueueManager.java0000644000175000017500000003156010744075231027473 0ustar charlescharles/* * $Id: TransactionalQueueManager.java 10380 2008-01-18 10:08:25Z akuzmin $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; import org.mule.util.queue.QueuePersistenceStrategy.Holder; import org.mule.util.xa.AbstractTransactionContext; import org.mule.util.xa.AbstractXAResourceManager; import org.mule.util.xa.ResourceManagerException; import org.mule.util.xa.ResourceManagerSystemException; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.transaction.xa.XAResource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * The Transactional Queue Manager is responsible for creating and Managing * transactional Queues. Queues can also be persistent by setting a persistence * strategy on the manager. Default straties are provided for Memory, Jounaling, * Cache and File. */ public class TransactionalQueueManager extends AbstractXAResourceManager implements QueueManager { private static Log logger = LogFactory.getLog(TransactionalQueueManager.class); private Map queues = new HashMap(); private QueuePersistenceStrategy memoryPersistenceStrategy = new MemoryPersistenceStrategy(); private QueuePersistenceStrategy persistenceStrategy; private QueueConfiguration defaultQueueConfiguration = new QueueConfiguration(false); public synchronized QueueSession getQueueSession() { return new TransactionalQueueSession(this, this); } public synchronized void setDefaultQueueConfiguration(QueueConfiguration config) { this.defaultQueueConfiguration = config; } public synchronized void setQueueConfiguration(String queueName, QueueConfiguration config) { getQueue(queueName).config = config; } protected synchronized QueueInfo getQueue(String name) { QueueInfo q = (QueueInfo) queues.get(name); if (q == null) { q = new QueueInfo(); q.name = name; q.list = new LinkedList(); q.config = defaultQueueConfiguration; queues.put(name, q); } return q; } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#getLogger() */ protected Log getLogger() { return logger; } public void close() { try { stop(SHUTDOWN_MODE_NORMAL); } catch (ResourceManagerException e) { // TODO MULE-863: What should we really do? logger.error("Error disposing manager", e); } } protected void doStart() throws ResourceManagerSystemException { if (persistenceStrategy != null) { try { persistenceStrategy.open(); } catch (IOException e) { throw new ResourceManagerSystemException(e); } } } protected boolean shutdown(int mode, long timeoutMSecs) { try { if (persistenceStrategy != null) { persistenceStrategy.close(); } } catch (IOException e) { // TODO MULE-863: What should we really do? logger.error("Error closing persistent store", e); } return super.shutdown(mode, timeoutMSecs); } protected void recover() throws ResourceManagerSystemException { if (persistenceStrategy != null) { try { List msgs = persistenceStrategy.restore(); for (Iterator it = msgs.iterator(); it.hasNext();) { Holder h = (Holder) it.next(); getQueue(h.getQueue()).putNow(h.getId()); } } catch (Exception e) { throw new ResourceManagerSystemException(e); } } } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#createTransactionContext() */ protected AbstractTransactionContext createTransactionContext(Object session) { return new QueueTransactionContext(); } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#doBegin(org.mule.transaction.xa.AbstractTransactionContext) */ protected void doBegin(AbstractTransactionContext context) { // Nothing special to do } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#doPrepare(org.mule.transaction.xa.AbstractTransactionContext) */ protected int doPrepare(AbstractTransactionContext context) { return XAResource.XA_OK; } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#doCommit(org.mule.transaction.xa.AbstractTransactionContext) */ protected void doCommit(AbstractTransactionContext context) throws ResourceManagerException { QueueTransactionContext ctx = (QueueTransactionContext) context; try { if (ctx.added != null) { for (Iterator it = ctx.added.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); QueueInfo queue = (QueueInfo) entry.getKey(); List queueAdded = (List) entry.getValue(); if (queueAdded != null && queueAdded.size() > 0) { for (Iterator itAdded = queueAdded.iterator(); itAdded.hasNext();) { Object object = itAdded.next(); Object id = doStore(queue, object); queue.putNow(id); } } } } if (ctx.removed != null) { for (Iterator it = ctx.removed.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); QueueInfo queue = (QueueInfo) entry.getKey(); List queueRemoved = (List) entry.getValue(); if (queueRemoved != null && queueRemoved.size() > 0) { for (Iterator itRemoved = queueRemoved.iterator(); itRemoved.hasNext();) { Object id = itRemoved.next(); doRemove(queue, id); } } } } } catch (Exception e) { // throw new ResourceManagerException("Could not commit // transaction", e); // TODO: add an i18n Message throw new ResourceManagerException(e); } finally { ctx.added = null; ctx.removed = null; } } protected Object doStore(QueueInfo queue, Object object) throws IOException { QueuePersistenceStrategy ps = (queue.config.persistent) ? persistenceStrategy : memoryPersistenceStrategy; Object id = ps.store(queue.name, object); return id; } protected void doRemove(QueueInfo queue, Object id) throws IOException { QueuePersistenceStrategy ps = (queue.config.persistent) ? persistenceStrategy : memoryPersistenceStrategy; ps.remove(queue.name, id); } protected Object doLoad(QueueInfo queue, Object id) throws IOException { QueuePersistenceStrategy ps = (queue.config.persistent) ? persistenceStrategy : memoryPersistenceStrategy; Object obj = ps.load(queue.name, id); return obj; } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#doRollback(org.mule.transaction.xa.AbstractTransactionContext) */ protected void doRollback(AbstractTransactionContext context) throws ResourceManagerException { QueueTransactionContext ctx = (QueueTransactionContext) context; if (ctx.removed != null) { for (Iterator it = ctx.removed.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); QueueInfo queue = (QueueInfo) entry.getKey(); List queueRemoved = (List) entry.getValue(); if (queueRemoved != null && queueRemoved.size() > 0) { for (Iterator itRemoved = queueRemoved.iterator(); itRemoved.hasNext();) { Object id = itRemoved.next(); queue.putNow(id); } } } } ctx.added = null; ctx.removed = null; } protected class QueueTransactionContext extends AbstractTransactionContext { protected Map added; protected Map removed; public boolean offer(QueueInfo queue, Object item, long timeout) throws InterruptedException { readOnly = false; if (added == null) { added = new HashMap(); } List queueAdded = (List) added.get(queue); if (queueAdded == null) { queueAdded = new ArrayList(); added.put(queue, queueAdded); } // wait for enough room if (queue.offer(null, queueAdded.size(), timeout)) { queueAdded.add(item); return true; } else { return false; } } public Object poll(QueueInfo queue, long timeout) throws IOException, InterruptedException { readOnly = false; if (added != null) { List queueAdded = (List)added.get(queue); if (queueAdded != null) { return queueAdded.remove(queueAdded.size() - 1); } } Object o = queue.poll(timeout); if (o != null) { if (removed == null) { removed = new HashMap(); } List queueRemoved = (List) removed.get(queue); if (queueRemoved == null) { queueRemoved = new ArrayList(); removed.put(queue, queueRemoved); } queueRemoved.add(o); o = doLoad(queue, o); } return o; } public Object peek(QueueInfo queue) throws IOException, InterruptedException { readOnly = false; if (added != null) { List queueAdded = (List) added.get(queue); if (queueAdded != null) { return queueAdded.get(queueAdded.size() - 1); } } Object o = queue.peek(); if (o != null) { o = doLoad(queue, o); } return o; } public int size(QueueInfo queue) { int sz = queue.list.size(); if (added != null) { List queueAdded = (List) added.get(queue); if (queueAdded != null) { sz += queueAdded.size(); } } return sz; } } /** * @return Returns the persistenceStrategy. */ public QueuePersistenceStrategy getPersistenceStrategy() { return persistenceStrategy; } /** * @param persistenceStrategy The persistenceStrategy to set. */ public void setPersistenceStrategy(QueuePersistenceStrategy persistenceStrategy) { if (operationMode != OPERATION_MODE_STOPPED) { throw new IllegalStateException(); } this.persistenceStrategy = persistenceStrategy; } public QueuePersistenceStrategy getMemoryPersistenceStrategy() { return memoryPersistenceStrategy; } public void setMemoryPersistenceStrategy(QueuePersistenceStrategy memoryPersistenceStrategy) { if (operationMode != OPERATION_MODE_STOPPED) { throw new IllegalStateException(); } this.memoryPersistenceStrategy = memoryPersistenceStrategy; } } mule-2.0.1/core/src/main/java/org/mule/util/queue/QueueManager.java0000644000175000017500000000264310664630335024753 0ustar charlescharles/* * $Id: QueueManager.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; import org.mule.util.xa.ResourceManagerSystemException; /** * A Queue manager is responsible for manageing one or more Queue resources and * providing common support fot transactions and persistence */ public interface QueueManager { void start() throws ResourceManagerSystemException; void stop() throws ResourceManagerSystemException; QueueSession getQueueSession(); void close(); void setDefaultQueueConfiguration(QueueConfiguration config); void setQueueConfiguration(String queueName, QueueConfiguration config); /** * @return Returns the persistenceStrategy. */ QueuePersistenceStrategy getPersistenceStrategy(); /** * @param persistenceStrategy The persistenceStrategy to set. */ void setPersistenceStrategy(QueuePersistenceStrategy persistenceStrategy); QueuePersistenceStrategy getMemoryPersistenceStrategy(); void setMemoryPersistenceStrategy(QueuePersistenceStrategy memoryPersistenceStrategy); } mule-2.0.1/core/src/main/java/org/mule/util/queue/QueuePersistenceStrategy.java0000644000175000017500000000373310664630335027411 0ustar charlescharles/* * $Id: QueuePersistenceStrategy.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; import java.io.IOException; import java.util.List; /** * QueuePersistenceStrategy defines the The api to a persistent queue * store. A persistence strategy can be transient (in memory or non-restorable) or * non-transient such as File system or DB. */ public interface QueuePersistenceStrategy { public interface Holder { Object getId(); String getQueue(); } /** * Stores an object and returns its generated id. * * @param obj the object to be stored * @return the id of the stored object * @throws IOException */ Object store(String queue, Object obj) throws IOException; /** * Loads an object specified by the given id. * * @param id the id of the stored object * @return the object * @throws IOException */ Object load(String queue, Object id) throws IOException; /** * Removes the object specified by the given id from the store. * * @param id the id of the stored object * @throws IOException */ void remove(String queue, Object id) throws IOException; /** * Retrieves the ids of the stored objects. * * @return the list of ids * @throws IOException */ List restore() throws IOException; /** * Open the store. * * @throws IOException */ void open() throws IOException; /** * Closes the store. * * @throws IOException */ void close() throws IOException; boolean isTransient(); } mule-2.0.1/core/src/main/java/org/mule/util/queue/QueueInfo.java0000644000175000017500000000612010664630335024266 0ustar charlescharles/* * $Id: QueueInfo.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; import java.util.LinkedList; /** * Stores information about a Queue */ public class QueueInfo { protected LinkedList list; protected String name; protected QueueConfiguration config; public boolean equals(Object obj) { return (obj instanceof QueueInfo && name.equals(((QueueInfo) obj).name)); } public int hashCode() { return name.hashCode(); } public void putNow(Object o) { synchronized (list) { list.addLast(o); list.notifyAll(); } } public boolean offer(Object o, int room, long timeout) throws InterruptedException { if (Thread.interrupted()) { throw new InterruptedException(); } synchronized (list) { if (config.capacity > 0) { if (config.capacity <= room) { throw new IllegalStateException("Can not add more objects than the capacity in one time"); } long l1 = timeout > 0L ? System.currentTimeMillis() : 0L; long l2 = timeout; while (list.size() >= config.capacity - room) { if (l2 <= 0L) { return false; } list.wait(l2); l2 = timeout - (System.currentTimeMillis() - l1); } } if (o != null) { list.addLast(o); } list.notifyAll(); return true; } } public Object poll(long timeout) throws InterruptedException { if (Thread.interrupted()) { throw new InterruptedException(); } synchronized (list) { long l1 = timeout > 0L ? System.currentTimeMillis() : 0L; long l2 = timeout; while (list.isEmpty()) { if (l2 <= 0L) { return null; } list.wait(l2); l2 = timeout - (System.currentTimeMillis() - l1); } Object o = list.removeFirst(); list.notifyAll(); return o; } } public Object peek() throws InterruptedException { if (Thread.interrupted()) { throw new InterruptedException(); } synchronized (list) { if (list.isEmpty()) { return null; } else { return list.getFirst(); } } } } mule-2.0.1/core/src/main/java/org/mule/util/queue/MemoryPersistenceStrategy.java0000644000175000017500000000476010664630335027576 0ustar charlescharles/* * $Id: MemoryPersistenceStrategy.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.safehaus.uuid.UUIDGenerator; public class MemoryPersistenceStrategy implements QueuePersistenceStrategy { private UUIDGenerator gen = UUIDGenerator.getInstance(); private Map map = Collections.synchronizedMap(new HashMap()); protected Object getId(Object obj) { return gen.generateRandomBasedUUID(); } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueuePersistenceStrategy#store(java.lang.Object) */ public Object store(String queue, Object obj) throws IOException { if (obj == null) { throw new IllegalArgumentException("Cannot store null object."); } Object id = getId(obj); map.put(id, obj); return id; } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueuePersistenceStrategy#load(java.lang.Object) */ public Object load(String queue, Object id) throws IOException { return map.get(id); } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueuePersistenceStrategy#remove(java.lang.Object) */ public void remove(String queue, Object id) throws IOException { map.remove(id); } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueuePersistenceStrategy#restore() */ public List restore() throws IOException { return new ArrayList(); } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueuePersistenceStrategy#open() */ public void open() throws IOException { // nothing to do } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.QueuePersistenceStrategy#close() */ public void close() throws IOException { // nothing to do } public boolean isTransient() { return true; } } mule-2.0.1/core/src/main/java/org/mule/util/queue/Queue.java0000644000175000017500000000214310664630335023453 0ustar charlescharles/* * $Id: Queue.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; /** * Queue TODO */ public interface Queue { /** * Returns the number of elements in this queue. * * @return */ int size(); /** * Puts a new object in this queue and wait if necessary. * * @param o the object to put */ void put(Object o) throws InterruptedException; /** * Blocks and retrieves an object from this queue. * * @return an object. */ Object take() throws InterruptedException; Object peek() throws InterruptedException; Object poll(long timeout) throws InterruptedException; boolean offer(Object o, long timeout) throws InterruptedException; } mule-2.0.1/core/src/main/java/org/mule/util/ExceptionUtils.java0000644000175000017500000000111310664630335024216 0ustar charlescharles/* * $Id: ExceptionUtils.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; /** * Mule exception utilities. */ public class ExceptionUtils extends org.apache.commons.lang.exception.ExceptionUtils { // nop } mule-2.0.1/core/src/main/java/org/mule/util/FilenameUtils.java0000644000175000017500000000245310664630335024010 0ustar charlescharles/* * $Id: FilenameUtils.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.io.File; public class FilenameUtils extends org.apache.commons.io.FilenameUtils { public static File fileWithPathComponents(String[] pathComponents) { if (pathComponents == null) { return null; } StringBuffer buf = new StringBuffer(64); for (int i = 0; i < pathComponents.length; i++) { String component = pathComponents[i]; if (component == null) { continue; } buf.append(component); if (i < pathComponents.length - 1) { buf.append(File.separator); } } return FileUtils.newFile(buf.toString()); } /** * Never create instances of this class. */ private FilenameUtils() { super(); } } mule-2.0.1/core/src/main/java/org/mule/util/FileUtils.java0000644000175000017500000006357310766204322023155 0ustar charlescharles/* * $Id: FileUtils.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.MuleServer; import org.mule.api.MuleRuntimeException; import org.mule.config.i18n.MessageFactory; import java.io.BufferedOutputStream; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.JarURLConnection; import java.net.URI; import java.net.URL; import java.net.URLConnection; import java.net.URLDecoder; import java.nio.channels.FileChannel; import java.util.Enumeration; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * FileUtils contains useful methods for dealing with files & * directories. */ // @ThreadSafe public class FileUtils extends org.apache.commons.io.FileUtils { private static final Log logger = LogFactory.getLog(FileUtils.class); public static final String DEFAULT_ENCODING = "UTF-8"; public static synchronized void copyStreamToFile(InputStream input, File destination) throws IOException { if (destination.exists() && !destination.canWrite()) { throw new IOException("Destination file does not exist or is not writeable"); } try { FileOutputStream output = new FileOutputStream(destination); try { IOUtils.copy(input, output); } finally { IOUtils.closeQuietly(output); } } finally { IOUtils.closeQuietly(input); } } // TODO Document me! public static File createFile(String filename) throws IOException { File file = FileUtils.newFile(filename); if (!file.canWrite()) { String dirName = file.getPath(); int i = dirName.lastIndexOf(File.separator); if (i > -1) { dirName = dirName.substring(0, i); File dir = FileUtils.newFile(dirName); dir.mkdirs(); } file.createNewFile(); } return file; } // TODO Document me! public static String prepareWinFilename(String filename) { filename = filename.replaceAll("<", "("); filename = filename.replaceAll(">", ")"); filename = filename.replaceAll("[/\\*?|:;\\]\\[\"]", "-"); return filename; } // TODO Document me! public static File openDirectory(String directory) throws IOException { File dir = FileUtils.newFile(directory); if (!dir.exists()) { dir.mkdirs(); } if (!dir.isDirectory() || !dir.canRead()) { throw new IOException("Path: " + directory + " exists but isn't a directory"); } return dir; } /** * Reads the incoming String into a file at at the given destination. * * @param filename name and path of the file to create * @param data the contents of the file * @return the new file. * @throws IOException If the creating or writing to the file stream fails */ public static File stringToFile(String filename, String data) throws IOException { return stringToFile(filename, data, false); } // TODO Document me! public static synchronized File stringToFile(String filename, String data, boolean append) throws IOException { return stringToFile(filename, data, append, false); } // TODO Document me! public static synchronized File stringToFile(String filename, String data, boolean append, boolean newLine) throws IOException { File f = createFile(filename); BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(f, append)); writer.write(data); if (newLine) { writer.newLine(); } } finally { if (writer != null) { writer.close(); } } return f; } // TODO Document me! public static String getResourcePath(String resourceName, Class callingClass) throws IOException { return getResourcePath(resourceName, callingClass, DEFAULT_ENCODING); } // TODO Document me! public static String getResourcePath(String resourceName, Class callingClass, String encoding) throws IOException { if (resourceName == null) { // no name return null; } URL url = IOUtils.getResourceAsUrl(resourceName, callingClass); if (url == null) { // not found return null; } return normalizeFilePath(url, encoding); } /** * Remove from uri to file prefix file:/ * Add if need file separator to begin * * @param url file uri to resource * @param encoding - Java encoding names * @return normalized file path * @throws UnsupportedEncodingException if encoding is unknown */ public static String normalizeFilePath(URL url, String encoding) throws UnsupportedEncodingException { String resource = URLDecoder.decode(url.toExternalForm(), encoding); if (resource != null) { if (resource.startsWith("file:/")) { resource = resource.substring(6); } if (!resource.startsWith(File.separator)) { resource = File.separator + resource; } } return resource; } /** * Delete a file tree recursively. * @param dir dir to wipe out * @return false when the first unsuccessful attempt encountered */ public static boolean deleteTree(File dir) { return deleteTree(dir, null); } /** * Delete a file tree recursively. This method additionally tries to be * gentle with specified top-level dirs. E.g. this is the case when a * transaction manager asynchronously handles the recovery log, and the test * wipes out everything, leaving the transaction manager puzzled. * @param dir dir to wipe out * @param topLevelDirsToIgnore which top-level directories to ignore, * if null or empty then ignored * @return false when the first unsuccessful attempt encountered */ public static boolean deleteTree(File dir, final String[] topLevelDirsToIgnore) { if (dir == null || !dir.exists()) { return true; } File[] files = dir.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { OUTER: if (files[i].isDirectory()) { if (topLevelDirsToIgnore != null) { for (int j = 0; j < topLevelDirsToIgnore.length; j++) { String ignored = topLevelDirsToIgnore[j]; if (ignored.equals(FilenameUtils.getBaseName(files[i].getName()))) { break OUTER; } } } if (!deleteTree(files[i])) { return false; } } else { if (!files[i].delete()) { return false; } } } } return dir.delete(); } /** * Unzip the specified archive to the given directory */ public static void unzip(File archive, File directory) throws IOException { ZipFile zip = null; if (directory.exists()) { if (!directory.isDirectory()) { throw new IOException("Directory is not a directory: " + directory); } } else { if (!directory.mkdirs()) { throw new IOException("Could not create directory: " + directory); } } try { zip = new ZipFile(archive); for (Enumeration entries = zip.entries(); entries.hasMoreElements();) { ZipEntry entry = (ZipEntry) entries.nextElement(); File f = FileUtils.newFile(directory, entry.getName()); if (entry.isDirectory()) { if (!f.mkdirs()) { throw new IOException("Could not create directory: " + f); } } else { InputStream is = zip.getInputStream(entry); OutputStream os = new BufferedOutputStream(new FileOutputStream(f)); IOUtils.copy(is, os); IOUtils.closeQuietly(is); IOUtils.closeQuietly(os); } } } finally { if (zip != null) { zip.close(); } } } /** * Workaround for JDK bug * 4117557. More in-context information at * MULE-1112 *

    * Factory methods correspond to constructors of the java.io.File class. * No physical file created in this method. * * @see File */ public static File newFile(String pathName) { try { return new File(pathName).getCanonicalFile(); } catch (IOException e) { throw new MuleRuntimeException( MessageFactory.createStaticMessage("Unable to create a canonical file for " + pathName), e); } } /** * Workaround for JDK bug * 4117557. More in-context information at * MULE-1112 *

    * Factory methods correspond to constructors of the java.io.File class. * No physical file created in this method. * * @see File */ public static File newFile(URI uri) { try { return new File(uri).getCanonicalFile(); } catch (IOException e) { throw new MuleRuntimeException( MessageFactory.createStaticMessage("Unable to create a canonical file for " + uri), e); } } /** * Workaround for JDK bug * 4117557. More in-context information at * MULE-1112 *

    * Factory methods correspond to constructors of the java.io.File class. * No physical file created in this method. * * @see File */ public static File newFile(File parent, String child) { try { return new File(parent, child).getCanonicalFile(); } catch (IOException e) { throw new MuleRuntimeException( MessageFactory.createStaticMessage("Unable to create a canonical file for parent: " + parent + " and child: " + child), e); } } /** * Workaround for JDK bug * 4117557. More in-context information at * MULE-1112 *

    * Factory methods correspond to constructors of the java.io.File class. * No physical file created in this method. * * @see File */ public static File newFile(String parent, String child) { try { return new File(parent, child).getCanonicalFile(); } catch (IOException e) { throw new MuleRuntimeException( MessageFactory.createStaticMessage("Unable to create a canonical file for parent: " + parent + " and child: " + child), e); } } /** * Extract the specified resource to the given directory for * remain all directory struct * * @param resourceName - full resource name * @param callingClass - classloader for this class is used * @param outputDir - extract to this directory * @param keepParentDirectory true - full structure of directories is kept; false - file - removed all directories, directory - started from resource point * @throws IOException if any errors */ public static void extractResources(String resourceName, Class callingClass, File outputDir, boolean keepParentDirectory) throws IOException { URL url = callingClass.getClassLoader().getResource(resourceName); URLConnection connection = url.openConnection(); if (connection instanceof JarURLConnection) { extractJarResources((JarURLConnection) connection, outputDir, keepParentDirectory); } else { extractFileResources(normalizeFilePath(url, MuleServer.getMuleContext().getConfiguration().getDefaultEncoding()), outputDir, resourceName, keepParentDirectory); } } /** * Extract resources contain in file * * @param path - path to file * @param outputDir Directory for unpack recources * @param resourceName * @param keepParentDirectory true - full structure of directories is kept; false - file - removed all directories, directory - started from resource point * @throws IOException if any error */ private static void extractFileResources(String path, File outputDir, String resourceName, boolean keepParentDirectory) throws IOException { File file = FileUtils.newFile(path); if (!file.exists()) { throw new IOException("The resource by path " + path + " "); } if (file.isDirectory()) { if (keepParentDirectory) { outputDir = FileUtils.newFile(outputDir.getPath() + File.separator + resourceName); if (!outputDir.exists()) { outputDir.mkdirs(); } } else { outputDir = FileUtils.newFile(outputDir.getPath()); } copyDirectory(file, outputDir); } else { if (keepParentDirectory) { outputDir = FileUtils.newFile(outputDir.getPath() + File.separator + resourceName); } else { outputDir = FileUtils.newFile(outputDir.getPath() + File.separator + file.getName()); } copyFile(file, outputDir); } } /** * Extract recources contain if jar (have to in classpath) * * @param connection JarURLConnection to jar library * @param outputDir Directory for unpack recources * @param keepParentDirectory true - full structure of directories is kept; false - file - removed all directories, directory - started from resource point * @throws IOException if any error */ private static void extractJarResources(JarURLConnection connection, File outputDir, boolean keepParentDirectory) throws IOException { JarFile jarFile = connection.getJarFile(); JarEntry jarResource = connection.getJarEntry(); Enumeration entries = jarFile.entries(); InputStream inputStream = null; OutputStream outputStream = null; int jarResourceNameLenght = jarResource.getName().length(); for (; entries.hasMoreElements();) { JarEntry entry = (JarEntry) entries.nextElement(); if (entry.getName().startsWith(jarResource.getName())) { String path = outputDir.getPath() + File.separator + entry.getName(); //remove directory struct for file and first dir for directory if (!keepParentDirectory) { if (entry.isDirectory()) { if (entry.getName().equals(jarResource.getName())) { continue; } path = outputDir.getPath() + File.separator + entry.getName().substring(jarResourceNameLenght, entry.getName().length()); } else { if (entry.getName().length() > jarResourceNameLenght) { path = outputDir.getPath() + File.separator + entry.getName().substring(jarResourceNameLenght, entry.getName().length()); } else { path = outputDir.getPath() + File.separator + entry.getName().substring(entry.getName().lastIndexOf("/"), entry.getName().length()); } } } File file = FileUtils.newFile(path); if (!file.getParentFile().exists()) { if (!file.getParentFile().mkdirs()) { throw new IOException("Could not create directory: " + file.getParentFile()); } } if (entry.isDirectory()) { if (!file.exists() && !file.mkdirs()) { throw new IOException("Could not create directory: " + file); } } else { try { inputStream = jarFile.getInputStream(entry); outputStream = new BufferedOutputStream(new FileOutputStream(file)); IOUtils.copy(inputStream, outputStream); } finally { IOUtils.closeQuietly(inputStream); IOUtils.closeQuietly(outputStream); } } } } } public static boolean renameFileHard(String srcFilePath, String destFilePath) { if (StringUtils.isNotBlank(srcFilePath) && StringUtils.isNotBlank(destFilePath)) { return renameFileHard(new File(srcFilePath), new File(destFilePath)); } else { return false; } } public static boolean renameFileHard(File srcFile, File destFile) { boolean isRenamed = false; if (srcFile != null && destFile != null) { logger.debug("Moving file " + srcFile.getAbsolutePath() + " to " + destFile.getAbsolutePath()); if (!destFile.exists()) { try { if (srcFile.isFile()) { logger.debug("Trying to rename file"); FileInputStream in = null; FileOutputStream out = null; try { in = new FileInputStream(srcFile); out = new FileOutputStream(destFile); out.getChannel().transferFrom(in.getChannel(), 0, srcFile.length()); isRenamed = true; } catch (Exception e) { logger.debug(e); } finally { if (in != null) { try { in.close(); } catch (Exception inNotClosed) { logger.debug(inNotClosed); } } if (out != null) { try { out.close(); } catch (Exception outNotClosed) { logger.debug(outNotClosed); } } } logger.debug("File renamed: " + isRenamed); if (isRenamed) { srcFile.delete(); } else { destFile.delete(); } } else { logger.debug(srcFile.getAbsolutePath() + " is not a valid file."); } } catch (Exception e) { logger.debug("Error renaming file from " + srcFile.getAbsolutePath() + " to " + destFile.getAbsolutePath()); } } else { logger.debug("Error renaming file " + srcFile.getAbsolutePath() + ". Destination file " + destFile.getAbsolutePath() + " already exists."); } } return isRenamed; } public static boolean renameFile(String srcFilePath, String destFilePath) { if (StringUtils.isNotBlank(srcFilePath) && StringUtils.isNotBlank(destFilePath)) { return renameFile(new File(srcFilePath), new File(destFilePath)); } else { return false; } } public static boolean renameFile(File srcFile, File destFile) { boolean isRenamed = false; if (srcFile != null && destFile != null) { logger.debug("Moving file " + srcFile.getAbsolutePath() + " to " + destFile.getAbsolutePath()); if (!destFile.exists()) { try { if (srcFile.isFile()) { logger.debug("Trying to rename file"); isRenamed = srcFile.renameTo(destFile); if (!isRenamed && srcFile.exists()) { logger.debug("Trying hard copy, assuming partition crossing ..."); isRenamed = renameFileHard(srcFile, destFile); } logger.debug("File renamed: " + isRenamed); } else { logger.debug(srcFile.getAbsolutePath() + " is not a valid file"); } } catch (Exception e) { logger.debug("Error moving file from " + srcFile.getAbsolutePath() + " to " + destFile.getAbsolutePath(), e); } } else { logger.debug("Error renaming file " + srcFile.getAbsolutePath() + ". Destination file " + destFile.getAbsolutePath() + " already exists."); } } else { logger.debug("Error renaming file. Source or destination file is null."); } return isRenamed; } /** Try to move a file by renaming with backup attempt by copying/deleting via NIO */ public static boolean moveFile(File sourceFile, File destinationFile) { // try fast file-system-level move/rename first boolean success = sourceFile.renameTo(destinationFile); if (!success) { // try again using NIO copy FileInputStream fis = null; FileOutputStream fos = null; try { fis = new FileInputStream(sourceFile); fos = new FileOutputStream(destinationFile); FileChannel srcChannel = fis.getChannel(); FileChannel dstChannel = fos.getChannel(); dstChannel.transferFrom(srcChannel, 0, srcChannel.size()); srcChannel.close(); dstChannel.close(); success = sourceFile.delete(); } catch (IOException ioex) { // grr! success = false; } finally { IOUtils.closeQuietly(fis); IOUtils.closeQuietly(fos); } } return success; } } mule-2.0.1/core/src/main/java/org/mule/util/package.html0000644000175000017500000000020510204257011022640 0ustar charlescharles Common helper classes for reading/writing files setting bean properties and SPI helpers. mule-2.0.1/core/src/main/java/org/mule/util/StringMessageUtils.java0000644000175000017500000001511510766457177025060 0ustar charlescharles/* * $Id: StringMessageUtils.java 11359 2008-03-14 11:16:15Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.MuleServer; import org.mule.api.MuleRuntimeException; import org.mule.config.i18n.CoreMessages; import java.io.UnsupportedEncodingException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Map; /** * Useful methods for formatting message strings for logging or exceptions. */ // @ThreadSafe public final class StringMessageUtils { // The maximum number of Collection and Array elements used for messages public static final int MAX_ELEMENTS = 50; public static final int DEFAULT_MESSAGE_WIDTH = 80; /** Do not instanciate. */ private StringMessageUtils () { // no-op } public static String getFormattedMessage(String msg, Object[] arguments) { if (arguments != null) { for (int i = 0; i < arguments.length; i++) { arguments[i] = toString(arguments[i]); } } return MessageFormat.format(msg, arguments); } public static String getBoilerPlate(String message) { return getBoilerPlate(message, '*', DEFAULT_MESSAGE_WIDTH); } public static String getBoilerPlate(String message, char c, int maxlength) { return getBoilerPlate(new ArrayList(Arrays.asList(new String[]{message})), c, maxlength); } public static String getBoilerPlate(List messages, char c, int maxlength) { int size; StringBuffer buf = new StringBuffer(messages.size() * maxlength); int trimLength = maxlength - (c == ' ' ? 2 : 4); for (int i = 0; i < messages.size(); i++) { size = messages.get(i).toString().length(); if (size > trimLength) { String temp = messages.get(i).toString(); int k = i; int x; int len; messages.remove(i); while (temp.length() > 0) { len = (trimLength <= temp.length() ? trimLength : temp.length()); String msg = temp.substring(0, len); x = msg.indexOf(SystemUtils.LINE_SEPARATOR); if (x > -1) { msg = msg.substring(0, x); len = x + 1; } else { x = msg.lastIndexOf(' '); if (x > -1 && len == trimLength) { msg = msg.substring(0, x); len = x + 1; } } if (msg.startsWith(" ")) { msg = msg.substring(1); } temp = temp.substring(len); messages.add(k, msg); k++; } } } buf.append(SystemUtils.LINE_SEPARATOR); if (c != ' ') { buf.append(StringUtils.repeat(c, maxlength)); } for (int i = 0; i < messages.size(); i++) { buf.append(SystemUtils.LINE_SEPARATOR); if (c != ' ') { buf.append(c); } buf.append(" "); buf.append(messages.get(i)); String osEncoding = CharSetUtils.defaultCharsetName(); int padding; try { padding = trimLength - messages.get(i).toString().getBytes(osEncoding).length; } catch (UnsupportedEncodingException ueex) { throw new MuleRuntimeException(CoreMessages.failedToConvertStringUsingEncoding(osEncoding), ueex); } if (padding > 0) { buf.append(StringUtils.repeat(' ', padding)); } buf.append(' '); if (c != ' ') { buf.append(c); } } buf.append(SystemUtils.LINE_SEPARATOR); if (c != ' ') { buf.append(StringUtils.repeat(c, maxlength)); } return buf.toString(); } public static String truncate(String message, int length, boolean includeCount) { if (message == null) { return null; } if (message.length() <= length) { return message; } String result = message.substring(0, length) + "..."; if (includeCount) { result += "[" + length + " of " + message.length() + "]"; } return result; } public static byte[] getBytes(String string) { try { return string.getBytes(MuleServer.getMuleContext().getConfiguration().getDefaultEncoding()); } catch (UnsupportedEncodingException e) { // We can ignore this as the encoding is validated on start up return null; } } public static String getString(byte[] bytes, String encoding) { try { return new String(bytes, encoding); } catch (UnsupportedEncodingException e) { // We can ignore this as the encoding is validated on start up return null; } } /** * @see {@link ArrayUtils#toString(Object, int)} * @see {@link CollectionUtils#toString(Collection, int)} * @see {@link MapUtils#toString(Map, boolean)} */ public static String toString(Object o) { if (o == null) { return "null"; } else if (o instanceof Class) { return ((Class) o).getName(); } else if (o instanceof Map) { return MapUtils.toString((Map) o, false); } else if (o.getClass().isArray()) { return ArrayUtils.toString(o, MAX_ELEMENTS); } else if (o instanceof Collection) { return CollectionUtils.toString((Collection) o, MAX_ELEMENTS); } else { return o.toString(); } } } mule-2.0.1/core/src/main/java/org/mule/util/monitor/0000755000175000017500000000000011351411130022047 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/monitor/package.html0000644000175000017500000000012610226612401024333 0ustar charlescharles Various resource monitor implementations. mule-2.0.1/core/src/main/java/org/mule/util/monitor/FileListener.java0000644000175000017500000000143710664630335025324 0ustar charlescharles/* * $Id: FileListener.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.monitor; import java.io.File; import java.io.IOException; /** * Interface for listening to disk file changes. */ public interface FileListener { /** * Called when one of the monitored files are created, deleted or modified. * * @param file File which has been changed. */ void fileChanged(File file) throws IOException; } mule-2.0.1/core/src/main/java/org/mule/util/monitor/FileMonitor.java0000644000175000017500000001430410664630335025163 0ustar charlescharles/* * $Id: FileMonitor.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.monitor; import java.beans.ExceptionListener; import java.io.File; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Timer; import java.util.TimerTask; /** * Class for monitoring changes in disk files. Usage: 1. Implement the FileListener * interface. 2. Create a FileMonitor instance. 3. Add the file(s)/directory(ies) to * listen for. fileChanged() will be called when a monitored file is created, deleted * or its modified time changes. */ public class FileMonitor { private Timer timer; private Map files; private List listeners; private long pollingInterval; /** * Create a file monitor instance with specified polling interval. * * @param pollingInterval Polling interval in milli seconds. */ public FileMonitor(long pollingInterval) { files = new HashMap(); listeners = new ArrayList(); timer = new Timer(true); this.pollingInterval = pollingInterval; } /** * Stop the file monitor polling. */ public void stop() { timer.cancel(); } public void start() { timer.schedule(new FileMonitorNotifier(), 0, pollingInterval); } /** * Add file to listen for. File may be any java.io.File (including a directory) * and may well be a non-existing file in the case where the creating of the file * is to be trepped.

    More than one file can be listened for. When the * specified file is created, modified or deleted, listeners are notified. * * @param file File to listen for. */ public void addFile(File file) { if (!files.containsKey(file)) { long modifiedTime = file.exists() ? file.lastModified() : -1; files.put(file, new Long(modifiedTime)); } } /** * Remove specified file for listening. * * @param file File to remove. */ public void removeFile(File file) { files.remove(file); } /** * Add listener to this file monitor. * * @param fileListener Listener to add. */ public void addListener(FileListener fileListener) { // Don't add if its already there for (Iterator i = listeners.iterator(); i.hasNext();) { WeakReference reference = (WeakReference) i.next(); FileListener listener = (FileListener) reference.get(); if (listener == fileListener) { return; } } // Use WeakReference to avoid memory leak if this becomes the // sole reference to the object. listeners.add(new WeakReference(fileListener)); } /** * Remove listener from this file monitor. * * @param fileListener Listener to remove. */ public void removeListener(FileMonitor fileListener) { for (Iterator i = listeners.iterator(); i.hasNext();) { WeakReference reference = (WeakReference) i.next(); FileMonitor listener = (FileMonitor) reference.get(); if (listener == fileListener) { i.remove(); break; } } } /** * This is the timer thread which is executed every n milliseconds according to * the setting of the file monitor. */ public class FileMonitorNotifier extends TimerTask { private ExceptionListener exceptionListener; public FileMonitorNotifier() { super(); } public FileMonitorNotifier(ExceptionListener exceptionListener) { this.exceptionListener = exceptionListener; } public void run() { // Loop over the registered files and see which have changed. // Use a copy of the list in case listener wants to alter the // list within its fileChanged method. Collection fileKeys = new ArrayList(files.keySet()); for (Iterator i = fileKeys.iterator(); i.hasNext();) { File file = (File) i.next(); long lastModifiedTime = ((Long) files.get(file)).longValue(); long newModifiedTime = file.exists() ? file.lastModified() : -1; // Chek if file has changed if (newModifiedTime != lastModifiedTime) { // Register new modified time files.put(file, new Long(newModifiedTime)); // Notify listeners for (Iterator j = listeners.iterator(); j.hasNext();) { WeakReference reference = (WeakReference) j.next(); FileListener listener = (FileListener) reference.get(); // Remove from list if the back-end object has been GC'd if (listener == null) { j.remove(); } else { try { listener.fileChanged(file); } catch (IOException e) { // TODO MULE-863: What should we do if null? if (exceptionListener != null) { exceptionListener.exceptionThrown(e); } } } } } } } } } mule-2.0.1/core/src/main/java/org/mule/util/monitor/ExpiryMonitor.java0000644000175000017500000001132010745677442025571 0ustar charlescharles/* * $Id: ExpiryMonitor.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.monitor; import org.mule.api.lifecycle.Disposable; import java.util.Iterator; import java.util.Map; import java.util.Timer; import java.util.TimerTask; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * ExpiryMonitor can monitor objects beased on an expiry time and can * invoke a callback method once the object time has expired. If the object does * expire it is removed from this monitor. */ // TODO we should probably rewrite this with ScheduledExecutor for stability IF we // need it; right now this class is unused public class ExpiryMonitor extends TimerTask implements Disposable { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(ExpiryMonitor.class); private Timer timer; private Map monitors; public ExpiryMonitor() { this(1000); } public ExpiryMonitor(long monitorFrequency) { timer = new Timer(true); timer.schedule(this, monitorFrequency, monitorFrequency); monitors = new ConcurrentHashMap(); } /** * Adds an expirable object to monitor. If the Object is already being monitored * it will be reset and the millisecond timeout will be ignored * * @param milliseconds * @param expirable */ public void addExpirable(long milliseconds, Expirable expirable) { if (isRegistered(expirable)) { resetExpirable(expirable); } else { if (logger.isDebugEnabled()) { logger.debug("Adding new expirable: " + expirable); } monitors.put(expirable, new ExpirableHolder(milliseconds, expirable)); } } public boolean isRegistered(Expirable expirable) { return (monitors.get(expirable) != null); } public void removeExpirable(Expirable expirable) { if (logger.isDebugEnabled()) { logger.debug("Removing expirable: " + expirable); } monitors.remove(expirable); } public void resetExpirable(Expirable expirable) { ExpirableHolder eh = (ExpirableHolder) monitors.get(expirable); if (eh != null) { eh.reset(); if (logger.isDebugEnabled()) { logger.debug("Reset expirable: " + expirable); } } } /** * The action to be performed by this timer task. */ public void run() { ExpirableHolder holder; for (Iterator iterator = monitors.values().iterator(); iterator.hasNext();) { holder = (ExpirableHolder) iterator.next(); if (holder.isExpired()) { removeExpirable(holder.getExpirable()); holder.getExpirable().expired(); } } } public void dispose() { logger.info("disposing monitor"); timer.cancel(); ExpirableHolder holder; for (Iterator iterator = monitors.values().iterator(); iterator.hasNext();) { holder = (ExpirableHolder) iterator.next(); removeExpirable(holder.getExpirable()); try { holder.getExpirable().expired(); } catch (Exception e) { // TODO MULE-863: What should we really do? logger.debug(e.getMessage()); } } } private class ExpirableHolder { private long milliseconds; private Expirable expirable; private long created; public ExpirableHolder(long milliseconds, Expirable expirable) { this.milliseconds = milliseconds; this.expirable = expirable; created = System.currentTimeMillis(); } public long getMilliseconds() { return milliseconds; } public Expirable getExpirable() { return expirable; } public boolean isExpired() { return (System.currentTimeMillis() - milliseconds) > created; } public void reset() { created = System.currentTimeMillis(); } } } mule-2.0.1/core/src/main/java/org/mule/util/monitor/Expirable.java0000644000175000017500000000111710664630335024645 0ustar charlescharles/* * $Id: Expirable.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.monitor; /** * Expirable implementing classes can be notified when they expire */ public interface Expirable { void expired(); } mule-2.0.1/core/src/main/java/org/mule/util/expression/0000755000175000017500000000000011351411126022564 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/expression/MuleContextExpressionEvaluator.java0000644000175000017500000001000710770570616031655 0ustar charlescharles/* * $Id: MuleContextExpressionEvaluator.java 11457 2008-03-20 23:21:50Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.MuleServer; import org.mule.RequestContext; import org.mule.api.MuleContext; import org.mule.api.MuleEventContext; import org.mule.api.MuleRuntimeException; import org.mule.config.i18n.CoreMessages; /** * This property extractor exposes mule context information as expressions. This can be context information about * the server itself such as the server id or about the current request such as the current service name. *

      *
    • serviceName - returns the name of the service currently processing the event.
    • *
    • modelName - returns the name of the model that hosts the current service
    • *
    • inboundEndpoint - returns the URI string of the endpoint that received the current messgae.
    • *
    • serverId - the Mule instance server Id.
    • *
    • clusterId - the Mule instance cluster Id.
    • *
    • domainId - the Mule instance domain Id.
    • *
    • workingDir - Mule's working directory.
    • *
    • homeDir - Mule's home directory
    • *
    */ public class MuleContextExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "mule"; /** * Extracts a single property from the message * * @param expression the property expression or expression * @param message the message to extract from * @return the result of the extraction or null if the property was not found */ public Object evaluate(String expression, Object message) { if (expression.equals("serviceName")) { return getEventContext().getService().getName(); } else if (expression.equals("modelName")) { return getEventContext().getService().getModel().getName(); } else if (expression.equals("inboundEndpoint")) { return getEventContext().getEndpointURI(); } else if (expression.equals("serverId")) { return getMuleContext().getConfiguration().getId(); } else if (expression.equals("clusterId")) { return getMuleContext().getConfiguration().getClusterId(); } else if (expression.equals("domainId")) { return getMuleContext().getConfiguration().getDomainId(); } else if (expression.equals("workingDir")) { return getMuleContext().getConfiguration().getWorkingDirectory(); } else if (expression.equals("homeDir")) { return getMuleContext().getConfiguration().getMuleHomeDirectory(); } else { throw new IllegalArgumentException(expression); } } protected MuleContext getMuleContext() { if(MuleServer.getMuleContext()==null) { throw new MuleRuntimeException(CoreMessages.objectIsNull("MuleContext")); } else { return MuleServer.getMuleContext(); } } protected MuleEventContext getEventContext() { if(RequestContext.getEventContext()==null) { throw new MuleRuntimeException(CoreMessages.objectIsNull("MuleEventContext")); } else { return RequestContext.getEventContext(); } } /** * Gts the name of the object * * @return the name of the object */ public String getName() { return NAME; } /** * Sets the name of the object * * @param name the name of the object */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } }mule-2.0.1/core/src/main/java/org/mule/util/expression/ExpressionRuntimeException.java0000644000175000017500000000237410765042126031027 0ustar charlescharles/* * $Id: ExpressionRuntimeException.java 11297 2008-03-09 20:11:02Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.MuleRuntimeException; import org.mule.config.i18n.Message; /** * If thrown by the {@link org.mule.util.expression.ExpressionEvaluatorManager} if an expression returns null * and failIfNull was set when {@link org.mule.util.expression.ExpressionEvaluatorManager#evaluate(String, Object, boolean)} * was called. */ public class ExpressionRuntimeException extends MuleRuntimeException { /** * @param message the exception message */ public ExpressionRuntimeException(Message message) { super(message); } /** * @param message the exception message * @param cause the exception that triggered this exception */ public ExpressionRuntimeException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/util/expression/MapPayloadExpressionEvaluator.java0000644000175000017500000000251410764057561031443 0ustar charlescharles/* * $Id: MapPayloadExpressionEvaluator.java 11231 2008-03-06 21:17:37Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.transport.MessageAdapter; import java.util.Map; /** * If the message payload is a map this extractor will look up the property value in * the map */ public class MapPayloadExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "map"; public Object evaluate(String name, Object message) { Object payload = message; if (message instanceof MessageAdapter) { payload = ((MessageAdapter) message).getPayload(); } if (payload instanceof Map) { return ((Map) payload).get(name); } return null; } /** {@inheritDoc} */ public String getName() { return NAME; } /** {@inheritDoc} */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } } mule-2.0.1/core/src/main/java/org/mule/util/expression/MessageAttachmentsExpressionEvaluator.java0000644000175000017500000000526310770356575033204 0ustar charlescharles/* * $Id: MessageAttachmentsExpressionEvaluator.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.transport.MessageAdapter; import org.mule.config.i18n.CoreMessages; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; /** * Looks up the attachment(s) on the message using the expression given. The expression can contain a comma-separated list * of header names to lookup. A {@link java.util.Map} of key value pairs is returned. * * @see MessageAttachmentsListExpressionEvaluator * @see MessageAttachmentExpressionEvaluator * @see ExpressionEvaluator * @see ExpressionEvaluatorManager */ public class MessageAttachmentsExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "attachments"; public static final String DELIM = ","; public Object evaluate(String expression, Object message) { boolean required = false; //This is a bit of a hack to manage required headers if(expression.endsWith("required")) { required = true; expression = expression.substring(0, expression.length() - 8); } if (message instanceof MessageAdapter) { StringTokenizer tokenizer = new StringTokenizer(expression, DELIM); Map result = new HashMap(tokenizer.countTokens()); while(tokenizer.hasMoreTokens()) { String s = tokenizer.nextToken(); s = s.trim(); Object val = ((MessageAdapter) message).getAttachment(s); if (val != null) { result.put(s, val); } else if(required) { throw new ExpressionRuntimeException(CoreMessages.expressionEvaluatorReturnedNull(NAME, expression)); } } if (result.size() == 0) { return null; } else { return result; } } return null; } /** * {@inheritDoc} */ public String getName() { return NAME; } /** * {@inheritDoc} */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } }mule-2.0.1/core/src/main/java/org/mule/util/expression/ExpressionEvaluator.java0000644000175000017500000000237110764057561027474 0ustar charlescharles/* * $Id: ExpressionEvaluator.java 11231 2008-03-06 21:17:37Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.NamedObject; /** * ExpressionEvaluator extracts a property from the message in a generic * way. i.e. composite properties can be pulled and aggregated depending on this * strategy. This can be used to extract Correlation Ids, Message Ids etc. * * These objects are used to execute property expressions (usually on the * current message) at runtime to extracta dynamic value. */ public interface ExpressionEvaluator extends NamedObject { /** * Extracts a single property from the message * * @param expression the property expression or expression * @param message the message to extract from * @return the result of the extraction or null if the property was not found */ Object evaluate(String expression, Object message); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/core/src/main/java/org/mule/util/expression/MessageAttachmentsListExpressionEvaluator.javamule-2.0.1/core/src/main/java/org/mule/util/expression/MessageAttachmentsListExpressionEvaluator.jav0000644000175000017500000000523410765042126033661 0ustar charlescharles/* * $Id: MessageAttachmentsListExpressionEvaluator.java 11297 2008-03-09 20:11:02Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.transport.MessageAdapter; import org.mule.config.i18n.CoreMessages; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; /** * Looks up the attachment(s) on the message using the expression given. The expression can contain a comma-separated list * of header names to lookup. A {@link java.util.List} of values is returned. * * @see MessageAttachmentsExpressionEvaluator * @see MessageAttachmentExpressionEvaluator * @see ExpressionEvaluator * @see ExpressionEvaluatorManager */ public class MessageAttachmentsListExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "attachments-list"; public static final String DELIM = ","; public Object evaluate(String expression, Object message) { boolean required = false; //This is a bit of a hack to manage required headers if(expression.endsWith("required")) { required = true; expression = expression.substring(0, expression.length() - 8); } if (message instanceof MessageAdapter) { StringTokenizer tokenizer = new StringTokenizer(expression, DELIM); List result = new ArrayList(tokenizer.countTokens()); while(tokenizer.hasMoreTokens()) { String s = tokenizer.nextToken(); s = s.trim(); Object val = ((MessageAdapter) message).getAttachment(s); if (val != null) { result.add(val); } else if(required) { throw new ExpressionRuntimeException(CoreMessages.expressionEvaluatorReturnedNull(NAME, expression)); } } if(result.size()==0) { return null; } else { return result; } } return null; } /** {@inheritDoc} */ public String getName() { return NAME; } /** {@inheritDoc} */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } }mule-2.0.1/core/src/main/java/org/mule/util/expression/MessageHeaderExpressionEvaluator.java0000644000175000017500000000250010770356575032110 0ustar charlescharles/* * $Id: MessageHeaderExpressionEvaluator.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.transport.MessageAdapter; /** * Looks up the property on the message using the property name given. * * @see MessageHeadersListExpressionEvaluator * @see MessageHeadersExpressionEvaluator * @see ExpressionEvaluator * @see ExpressionEvaluatorManager */ public class MessageHeaderExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "header"; public Object evaluate(String expression, Object message) { if (message instanceof MessageAdapter) { return ((MessageAdapter) message).getProperty(expression); } return null; } /** {@inheritDoc} */ public String getName() { return NAME; } /** {@inheritDoc} */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } }mule-2.0.1/core/src/main/java/org/mule/util/expression/MessageAttachmentExpressionEvaluator.java0000644000175000017500000000273410764745436033022 0ustar charlescharles/* * $Id: MessageAttachmentExpressionEvaluator.java 11286 2008-03-09 11:33:50Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.transport.MessageAdapter; import javax.activation.DataHandler; /** * Looks up an attachment with the given name. * * @see org.mule.util.expression.MessageAttachmentsListExpressionEvaluator * @see org.mule.util.expression.MessageAttachmentsExpressionEvaluator * @see org.mule.util.expression.ExpressionEvaluator * @see org.mule.util.expression.ExpressionEvaluatorManager */ public class MessageAttachmentExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "attachment"; public Object evaluate(String name, Object message) { if (message instanceof MessageAdapter) { DataHandler dh = ((MessageAdapter) message).getAttachment(name); return dh; } return null; } /** {@inheritDoc} */ public String getName() { return NAME; } /** {@inheritDoc} */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } }mule-2.0.1/core/src/main/java/org/mule/util/expression/EndpointInfoExpressionEvaluator.java0000644000175000017500000000471510777661265032023 0ustar charlescharles/* * $Id: EndpointInfoExpressionEvaluator.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.MuleServer; import org.mule.config.i18n.CoreMessages; import org.mule.endpoint.AbstractEndpointBuilder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Looks up information about a global endpoint * * @see org.mule.util.expression.ExpressionEvaluator * @see org.mule.util.expression.ExpressionEvaluatorManager */ public class EndpointInfoExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "endpoint"; /** * logger used by this class */ protected transient final Log logger = LogFactory.getLog(EndpointInfoExpressionEvaluator.class); public Object evaluate(String expression, Object message) { int i = expression.indexOf("."); String endpointName; String property; if(i > 0) { endpointName = expression.substring(0, i); property = expression.substring(i + 1); } else { throw new IllegalArgumentException(CoreMessages.expressionMalformed(expression, getName()).getMessage()); } AbstractEndpointBuilder eb = (AbstractEndpointBuilder)MuleServer.getMuleContext().getRegistry().lookupEndpointBuilder(endpointName); if(eb!=null) { if(property.equalsIgnoreCase("address")) { return eb.getEndpointBuilder().getEndpoint().getAddress(); } else //TODO more properties { throw new IllegalArgumentException(CoreMessages.expressionInvalidForProperty(property, expression).getMessage()); } } else { logger.warn("There is no endpoint registered with name: " + endpointName); return null; } } /** {@inheritDoc} */ public String getName() { return NAME; } /** {@inheritDoc} */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } }mule-2.0.1/core/src/main/java/org/mule/util/expression/MessageHeadersExpressionEvaluator.java0000644000175000017500000000522510770356575032302 0ustar charlescharles/* * $Id: MessageHeadersExpressionEvaluator.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.transport.MessageAdapter; import org.mule.config.i18n.CoreMessages; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; /** * Looks up the property on the message using the expression given. The expression can contain a comma-separated list * of header names to lookup. A {@link java.util.Map} of key value pairs is returned. * * @see org.mule.util.expression.MessageHeadersListExpressionEvaluator * @see org.mule.util.expression.ExpressionEvaluator * @see org.mule.util.expression.ExpressionEvaluatorManager */ public class MessageHeadersExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "headers"; public static final String DELIM = ","; public Object evaluate(String expression, Object message) { boolean required = false; //This is a bit of a hack to manage required headers if(expression.endsWith("required")) { required = true; expression = expression.substring(0, expression.length() - 8); } if (message instanceof MessageAdapter) { StringTokenizer tokenizer = new StringTokenizer(expression, DELIM); Map result = new HashMap(tokenizer.countTokens()); while(tokenizer.hasMoreTokens()) { String s = tokenizer.nextToken(); s = s.trim(); Object val = ((MessageAdapter) message).getProperty(s); if(val!=null) { result.put(s, val); } else if(required) { throw new ExpressionRuntimeException(CoreMessages.expressionEvaluatorReturnedNull(NAME, expression)); } } if(result.size()==0) { return null; } else { return result; } } return null; } /** {@inheritDoc} */ public String getName() { return NAME; } /** {@inheritDoc} */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } } mule-2.0.1/core/src/main/java/org/mule/util/expression/MessageHeadersListExpressionEvaluator.java0000644000175000017500000000522710765042126033124 0ustar charlescharles/* * $Id: MessageHeadersListExpressionEvaluator.java 11297 2008-03-09 20:11:02Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.transport.MessageAdapter; import org.mule.config.i18n.CoreMessages; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; /** * Looks up the property on the message using the expression given. The expression can contain a comma-separated list * of header names to lookup. A {@link java.util.List} of values is returned. * * @see org.mule.util.expression.MessageHeadersExpressionEvaluator * @see org.mule.util.expression.ExpressionEvaluator * @see org.mule.util.expression.ExpressionEvaluatorManager */ public class MessageHeadersListExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "headers-list"; public static final String DELIM = ","; public Object evaluate(String expression, Object message) { boolean required = false; //This is a bit of a hack to manage required headers if(expression.endsWith("required")) { required = true; expression = expression.substring(0, expression.length() - 8); } if (message instanceof MessageAdapter) { StringTokenizer tokenizer = new StringTokenizer(expression, DELIM); List result = new ArrayList(tokenizer.countTokens()); while(tokenizer.hasMoreTokens()) { String s = tokenizer.nextToken(); s = s.trim(); Object val = ((MessageAdapter) message).getProperty(s); if(val!=null) { result.add(val); } else if(required) { throw new ExpressionRuntimeException(CoreMessages.expressionEvaluatorReturnedNull(NAME, expression)); } } if(result.size()==0) { return null; } else { return result; } } return null; } /** {@inheritDoc} */ public String getName() { return NAME; } /** {@inheritDoc} */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } }mule-2.0.1/core/src/main/java/org/mule/util/expression/MessagePayloadExpressionEvaluator.java0000644000175000017500000000645511002723735032307 0ustar charlescharles/* * $Id: MessagePayloadExpressionEvaluator.java 11614 2008-04-20 20:30:21Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.MuleMessage; import org.mule.api.MuleRuntimeException; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.MessageAdapter; import org.mule.config.i18n.CoreMessages; import org.mule.util.ClassUtils; import org.mule.util.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Returns the message payload. If the expression is set to a class name then Mule will attempt to transform the payload by * discovering the correct transformer(s) in the registry. This is only suited for simple transformations between common types. *

    * * ${payload:byte[]} * *

    * or *

    * * ${payload:org.mule.api.OutputHandler} * *

    * If the object passed in is not a MuleMessage, the same object will be returned. * * @see ExpressionEvaluator * @see ExpressionEvaluatorManager */ public class MessagePayloadExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "payload"; public static final String BYTE_ARRAY = "byte[]"; /** * logger used by this class */ protected transient final Log logger = LogFactory.getLog(MessagePayloadExpressionEvaluator.class); public Object evaluate(String expression, Object message) { if (message instanceof MuleMessage) { if (StringUtils.isEmpty(expression)) { return ((MuleMessage) message).getPayload(); } else { try { if (expression.equals(BYTE_ARRAY)) { return ((MuleMessage) message).getPayload(byte[].class); } else { return ((MuleMessage) message).getPayload(ClassUtils.loadClass(expression, getClass())); } } catch (TransformerException e) { throw new MuleRuntimeException(CoreMessages.failedToProcessExtractorFunction(expression), e); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } else { logger.warn("Message is not of type MuleMessage, the expression will return the object without modification"); if (message instanceof MessageAdapter) { return ((MessageAdapter) message).getPayload(); } } return message; } /** * {@inheritDoc} */ public String getName() { return NAME; } /** * {@inheritDoc} */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } }mule-2.0.1/core/src/main/java/org/mule/util/expression/ExpressionEvaluatorManager.java0000644000175000017500000002757211003360060030753 0ustar charlescharles/* * $Id: ExpressionEvaluatorManager.java 11630 2008-04-22 12:55:12Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.lifecycle.Disposable; import org.mule.config.i18n.CoreMessages; import org.mule.util.TemplateParser; import java.util.Iterator; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentMap; /** * Provides universal access for evaluating expressions embedded in Mule configurations, such as Xml, Java, * scripting and annotations. * * Users can register or unregister {@link ExpressionEvaluator} through this interface. * */ public class ExpressionEvaluatorManager { public static final String DEFAULT_EXPRESSION_PREFIX = "${"; private static TemplateParser parser = TemplateParser.createAntStyleParser(); private static ConcurrentMap evaluators = new ConcurrentHashMap(8); public static void registerEvaluator(ExpressionEvaluator extractor) { if (extractor == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("extractor").getMessage()); } Object previous = evaluators.putIfAbsent(extractor.getName(), extractor); if (previous != null) { throw new IllegalArgumentException(CoreMessages.objectAlreadyExists(extractor.getName()).getMessage()); } } /** * Checks whether an evaluator is registered with the manager * @param name the name of the expression evaluator * @return true if the evaluator is registered with the manager, false otherwise */ public static boolean isEvaluatorRegistered(String name) { return evaluators.containsKey(name); } /** * Removes the evaluator with the given name * @param name the name of the evaluator to remove */ public static ExpressionEvaluator unregisterEvaluator(String name) { if (name==null) { return null; } ExpressionEvaluator evaluator = (ExpressionEvaluator) ExpressionEvaluatorManager.evaluators.remove(name); if (evaluator instanceof Disposable) { ((Disposable) evaluator).dispose(); } return evaluator; } /** * Evaluates the given expression. The expression should be a single expression definition with or without * enclosing braces. i.e. "mule:serviceName" and "${mule:serviceName}" are both valid. For situations where * one or more expressions need to be parsed within a single text, the {@link #parse(String, Object, boolean)} * method should be used since it will iterate through all expressions in a string. * * @param expression a single expression i.e. xpath://foo * @param object The object (usually {@link org.mule.api.MuleMessage}) to evaluate the expression on. * @return the result of the evaluation * @throws ExpressionRuntimeException if the expression is invalid, or a null is found for the expression and * 'failIfNull is set to true. */ public static Object evaluate(String expression, Object object) throws ExpressionRuntimeException { return evaluate(expression, object, DEFAULT_EXPRESSION_PREFIX, false); } /** * Evaluates the given expression. The expression should be a single expression definition with or without * enclosing braces. i.e. "mule:serviceName" and "${mule:serviceName}" are both valid. For situations where * one or more expressions need to be parsed within a single text, the {@link #parse(String, Object, boolean)} * method should be used since it will iterate through all expressions in a string. * * @param expression a single expression i.e. xpath://foo * @param object The object (usually {@link org.mule.api.MuleMessage}) to evaluate the expression on. * @param failIfNull determines if an exception should be thrown if expression could not be evaluated or returns * null. * @return the result of the evaluation * @throws ExpressionRuntimeException if the expression is invalid, or a null is found for the expression and * 'failIfNull is set to true. */ public static Object evaluate(String expression, Object object, boolean failIfNull) throws ExpressionRuntimeException { return evaluate(expression, object, DEFAULT_EXPRESSION_PREFIX, failIfNull); } /** * Evaluates the given expression. The expression should be a single expression definition with or without * enclosing braces. i.e. "mule:serviceName" and "${mule:serviceName}" are both valid. For situations where * one or more expressions need to be parsed within a single text, the {@link #parse(String, Object, boolean)} * method should be used since it will iterate through all expressions in a string. * * @param expression a single expression i.e. xpath://foo * @param evaluator the evaluator to use when executing the expression * @param object The object (usually {@link org.mule.api.MuleMessage}) to evaluate the expression on. * It is unlikely that users will want to change this execpt maybe to use "[" instead. * @param failIfNull determines if an exception should be thrown if expression could not be evaluated or returns * null. * @return the result of the evaluation * @throws ExpressionRuntimeException if the expression is invalid, or a null is found for the expression and * 'failIfNull is set to true. */ public static Object evaluate(String expression, String evaluator, Object object, boolean failIfNull) throws ExpressionRuntimeException { ExpressionEvaluator extractor = (ExpressionEvaluator) evaluators.get(evaluator); if (extractor == null) { throw new IllegalArgumentException(CoreMessages.expressionEvaluatorNotRegistered(evaluator).getMessage()); } Object result = extractor.evaluate(expression, object); if (result == null && failIfNull) { throw new ExpressionRuntimeException(CoreMessages.expressionEvaluatorReturnedNull(evaluator, expression)); } return result; } /** * Evaluates the given expression. The expression should be a single expression definition with or without * enclosing braces. i.e. "mule:serviceName" and "${mule:serviceName}" are both valid. For situations where * one or more expressions need to be parsed within a single text, the {@link #parse(String, Object, boolean)} * method should be used since it will iterate through all expressions in a string. * * @param expression a single expression i.e. xpath://foo * @param object The object (usually {@link org.mule.api.MuleMessage}) to evaluate the expression on. * @param expressionPrefix the expression prefix to use. The default is "${" but any character is valid. * It is unlikely that users will want to change this execpt maybe to use "[" instead. * @param failIfNull determines if an exception should be thrown if expression could not be evaluated or returns * null. * @return the result of the evaluation * @throws ExpressionRuntimeException if the expression is invalid, or a null is found for the expression and * 'failIfNull is set to true. */ public static Object evaluate(String expression, Object object, String expressionPrefix, boolean failIfNull) throws ExpressionRuntimeException { String name; if (expression == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("expression").getMessage()); } if (expression.startsWith(expressionPrefix)) { expression = expression.substring(2, expression.length()-1); } int i = expression.indexOf(":"); if (i >- 1) { name = expression.substring(0, i); expression = expression.substring(i+1); } else { name = expression; expression = null; } return evaluate(expression, name, object, failIfNull); } /** * Evaluates expressions in a given string. This method will iterate through each expression and evaluate it. If * a user needs to evaluate a single expression they can use {@link #evaluate(String, Object, boolean)}. * * @param expression a single expression i.e. xpath://foo * @param object The object (usually {@link org.mule.api.MuleMessage}) to evaluate the expression on. * @return the result of the evaluation * @throws ExpressionRuntimeException if the expression is invalid, or a null is found for the expression and * 'failIfNull is set to true. */ public static String parse(String expression, Object object) throws ExpressionRuntimeException { return parse(expression, object, false); } /** * Evaluates expressions in a given string. This method will iterate through each expression and evaluate it. If * a user needs to evaluate a single expression they can use {@link #evaluate(String, Object, boolean)}. * * @param expression a single expression i.e. xpath://foo * @param object The object (usually {@link org.mule.api.MuleMessage}) to evaluate the expression on. * @param failIfNull determines if an exception should be thrown if expression could not be evaluated or returns * null. * @return the result of the evaluation * @throws ExpressionRuntimeException if the expression is invalid, or a null is found for the expression and * 'failIfNull is set to true. */ public static String parse(final String expression, final Object object, final boolean failIfNull) throws ExpressionRuntimeException { return parser.parse(new TemplateParser.TemplateCallback() { public Object match(String token) { return evaluate(token, object, failIfNull); } }, expression); } /** * Clears all registered evaluators from the manager. */ public static synchronized void clearEvaluators() { for (Iterator iterator = evaluators.values().iterator(); iterator.hasNext();) { ExpressionEvaluator evaluator = (ExpressionEvaluator)iterator.next(); if(evaluator instanceof Disposable) { ((Disposable) evaluator).dispose(); } } evaluators.clear(); } /** * Determines if the expression is valid or not. This only validates single expressions. * @param expression the expression to validate * @return true if the expression evaluator is recognised */ public static boolean isValidExpression(String expression) { return isValidExpression(expression, DEFAULT_EXPRESSION_PREFIX); } /** * Determines if the expression is valid or not. This only validates single expressions. * @param expression the expression to validate * @param expressionPrefix the prefix used for this expression. if the expression is ${bean:msg.header} * the prefix is "${" * @return true if the expression evaluator is recognised */ public static boolean isValidExpression(String expression, String expressionPrefix) { if(expression.startsWith(expressionPrefix)) { expression = expression.substring(2, expression.length()-1); } String name; int i = expression.indexOf(":"); if(i>-1) { name = expression.substring(0, i); } else { name = expression; } return isEvaluatorRegistered(name); } } mule-2.0.1/core/src/main/java/org/mule/util/expression/FunctionExpressionEvaluator.java0000644000175000017500000001161510764232304031171 0ustar charlescharles/* * $Id: FunctionExpressionEvaluator.java 11246 2008-03-07 12:27:48Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.expression; import org.mule.api.MuleRuntimeException; import org.mule.config.i18n.CoreMessages; import org.mule.util.DateUtils; import org.mule.util.UUID; import java.net.InetAddress; import java.net.UnknownHostException; import java.sql.Timestamp; import java.util.Date; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong; /** * This property extractor doesn't actually extract a property from the message, instead it allows for certain functions * to be called and returns a result. The functions it supports are - *

      *
    • now - returns an {@link java.sql.Timestamp} with the current time.
    • *
    • date - returns a {@link java.util.Date} with the current time.
    • *
    • dateStamp - returns a {@link java.lang.String} that contains the current date formatted according to {@link #DEFAULT_DATE_FORMAT}.
    • *
    • dateStamp(dd-MM-yyyy) - returns a {@link java.lang.String} that contains the current date formatted according to the format passed into the function.
    • *
    • uuid - returns a globally unique identifier
    • *
    • hostname - returns the hostname of the machine Mule is running on
    • *
    • ip - returns the ip address of the machine Mule is running on
    • *
    • count - returns a local count that will increment for each call. If the server is re-started the counter will return to zero
    • *
    */ public class FunctionExpressionEvaluator implements ExpressionEvaluator { public static final String NAME = "function"; public static final String DEFAULT_DATE_FORMAT = "dd-MM-yy_HH-mm-ss.SSS"; /** * A local counter that will increment for each call. If the server is re-started the * counter will return to zero */ private final AtomicLong count = new AtomicLong(0); public static final String NOW_FUNCTION = "now"; public static final String DATE_FUNCTION = "date"; public static final String DATESTAMP_FUNCTION = "datestamp"; public static final String SYSTIME_FUNCTION = "systime"; public static final String UUID_FUNCTION = "uuid"; public static final String HOSTNAME_FUNCTION = "hostname"; public static final String IP_FUNCTION = "ip"; public static final String COUNT_FUNCTION = "count"; public Object evaluate(String name, Object message) { if (name.equalsIgnoreCase(NOW_FUNCTION)) { return new Timestamp(System.currentTimeMillis()); } else if (name.equalsIgnoreCase(DATE_FUNCTION)) { return new Date(System.currentTimeMillis()); } else if (name.toLowerCase().startsWith(DATESTAMP_FUNCTION)) { String temp = name.substring(DATESTAMP_FUNCTION.length()); if (temp.length()==0) { return DateUtils.getTimeStamp(DEFAULT_DATE_FORMAT); } else { temp = temp.substring(1); return DateUtils.getTimeStamp(temp); } } else if (name.equalsIgnoreCase(UUID_FUNCTION)) { return UUID.getUUID(); } else if (name.equalsIgnoreCase(SYSTIME_FUNCTION)) { return new Long(System.currentTimeMillis()); } else if (name.equalsIgnoreCase(HOSTNAME_FUNCTION)) { try { return InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { throw new MuleRuntimeException(CoreMessages.failedToProcessExtractorFunction(name), e); } } else if (name.equalsIgnoreCase(IP_FUNCTION)) { try { return InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException e) { throw new MuleRuntimeException(CoreMessages.failedToProcessExtractorFunction(name), e); } } else if (name.equalsIgnoreCase(COUNT_FUNCTION)) { return new Long(count.getAndIncrement()); } else { throw new IllegalArgumentException(name); } } /** * Gts the name of the object * * @return the name of the object */ public String getName() { return NAME; } /** * Sets the name of the object * * @param name the name of the object */ public void setName(String name) { throw new UnsupportedOperationException("setName"); } } mule-2.0.1/core/src/main/java/org/mule/util/CollectionUtils.java0000644000175000017500000001301410746275214024360 0ustar charlescharles/* * $Id: CollectionUtils.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.lang.reflect.Array; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.List; // @ThreadSafe public class CollectionUtils extends org.apache.commons.collections.CollectionUtils { /** * Creates an array of the given Collection's elements, but with the given * Class as element type. Useful for arrays of objects that * implement multiple interfaces and a "typed view" onto these objects is * required. * * @param objects a Collection of objects * @param clazz the desired service type of the new array * @return null when objects is null, or a new * array containing the elements of the source array which is typed to * the given clazz parameter. * @throws IllegalArgumentException if the clazz argument is * null. * @throws ArrayStoreException if the elements in objects cannot * be cast to clazz. */ public static Object[] toArrayOfComponentType(Collection objects, Class clazz) { if (objects == null) { return null; } if (clazz == null) { throw new IllegalArgumentException("Array target class must not be null"); } if (objects.isEmpty()) { return (Object[]) Array.newInstance(clazz, 0); } int i = 0, size = objects.size(); Object[] result = (Object[]) Array.newInstance(clazz, size); Iterator iter = objects.iterator(); while (i < size && iter.hasNext()) { result[i++] = iter.next(); } return result; } /** * Creates a String representation of the given Collection, with optional * newlines between elements. Class objects are represented by their full names. * * @param c the Collection to format * @param newline indicates whether elements are to be split across lines * @return the formatted String */ public static String toString(Collection c, boolean newline) { if (c == null || c.isEmpty()) { return "[]"; } return toString(c, c.size(), newline); } /** * Calls {@link #toString(Collection, int, boolean)} with false * for newline. */ public static String toString(Collection c, int maxElements) { return toString(c, maxElements, false); } /** * Creates a String representation of the given Collection, with optional * newlines between elements. Class objects are represented by their full names. * Considers at most maxElements values; overflow is indicated by * an appended "[..]" ellipsis. * * @param c the Collection to format * @param maxElements the maximum number of elements to take into account * @param newline indicates whether elements are to be split across lines * @return the formatted String */ public static String toString(Collection c, int maxElements, boolean newline) { if (c == null || c.isEmpty()) { return "[]"; } int origNumElements = c.size(); int numElements = Math.min(origNumElements, maxElements); boolean tooManyElements = (origNumElements > maxElements); StringBuffer buf = new StringBuffer(numElements * 32); buf.append('['); if (newline) { buf.append(SystemUtils.LINE_SEPARATOR); } Iterator items = c.iterator(); for (int i = 0; i < numElements - 1; i++) { Object item = items.next(); if (item instanceof Class) { buf.append(((Class) item).getName()); } else { buf.append(item); } if (newline) { buf.append(SystemUtils.LINE_SEPARATOR); } else { buf.append(',').append(' '); } } // don't forget the last one Object lastItem = items.next(); if (lastItem instanceof Class) { buf.append(((Class) lastItem).getName()); } else { buf.append(lastItem); } if (newline) { buf.append(SystemUtils.LINE_SEPARATOR); } if (tooManyElements) { buf.append(" [..]"); } buf.append(']'); return buf.toString(); } /** * Some code uses null to indicate "unset", which makes appending items complex. */ public static List addCreate(List list, Object value) { if (null == list) { return singletonList(value); } else { list.add(value); return list; } } public static List singletonList(Object value) { List list = new LinkedList(); list.add(value); return list; } } mule-2.0.1/core/src/main/java/org/mule/util/timer/0000755000175000017500000000000011351411127021506 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/timer/package.html0000644000175000017500000000016010204257011023760 0ustar charlescharles An Event based timer extending the java.util.Timer* classes. mule-2.0.1/core/src/main/java/org/mule/util/timer/EventTimerTask.java0000644000175000017500000000625410664630335025277 0ustar charlescharles/* * $Id: EventTimerTask.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.timer; import java.util.ArrayList; import java.util.List; import java.util.TimerTask; /** * EventTimerTask is a task that causes TimeEvent to be fired to * listening objects when a specific number of milliseconds have passed. This * implementation is based on the java.util.TimerTask. */ public class EventTimerTask extends TimerTask { /** * A list of listeners on this task */ private List listeners = null; /** * The name of the task */ private String name = null; /** * Determines if the task has been started */ private boolean started = true; /** * Constructs a EventTimeTask and registers a listener with it * * @param listener the listener to register */ public EventTimerTask(TimeEventListener listener) { super(); addListener(listener); this.name = "EventTimerTask." + hashCode(); } /** * Constructs a EventTimeTask and registers a listener with it * * @param listener the listener to register * @param name the name for the task */ public EventTimerTask(TimeEventListener listener, String name) { super(); addListener(listener); this.name = name; } /** * The action to be performed by this timer task. The fireTime event method is * called. */ public void run() { TimeEvent event = new TimeEvent(this, getName(), scheduledExecutionTime()); fireTimerEvent(event); } /** * Gets the task name (this is also the timer thread name) * * @return the task name */ public String getName() { return name; } public void removeListener(TimeEventListener listener) { if (listeners != null && listeners.contains(listener)) { listeners.remove(listener); } } public void removeAllListeners() { listeners = new ArrayList(); } public void addListener(TimeEventListener listener) { if (listeners == null) { listeners = new ArrayList(); listeners.add(listener); } else if (!listeners.contains(listener)) { listeners.add(listener); } } protected void fireTimerEvent(TimeEvent event) { if (listeners != null && started) { int count = listeners.size(); for (int i = 0; i < count; i++) { ((TimeEventListener) listeners.get(i)).timeExpired(event); } } } public void stop() { started = false; } public void start() { started = true; } public boolean isStarted() { return started; } } mule-2.0.1/core/src/main/java/org/mule/util/timer/TimeEvent.java0000644000175000017500000000242210664630335024263 0ustar charlescharles/* * $Id: TimeEvent.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.timer; import java.util.EventObject; /** * TimeEvent TODO is an event that occurs at a specified number of * milliseconds. */ public class TimeEvent extends EventObject { /** * Serial version */ private static final long serialVersionUID = -7540426406525372393L; /** * The event name */ private String name; /** */ private long timeExpired; /** * @param source * @param name * @param timeExpired */ public TimeEvent(Object source, String name, long timeExpired) { super(source); this.name = name; this.timeExpired = timeExpired; } /** * @return */ public String getName() { return name; } /** * @return */ public long getTimeExpired() { return timeExpired; } } mule-2.0.1/core/src/main/java/org/mule/util/timer/TimeEventListener.java0000644000175000017500000000144510664630335025775 0ustar charlescharles/* * $Id: TimeEventListener.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.timer; import java.util.EventListener; /** * TimeEventListener provides a method to pass timer events to * implementing objects. */ public interface TimeEventListener extends EventListener { /** * Passes the TimeEvent to an object * * @param e the time event that occurred */ void timeExpired(TimeEvent e); } mule-2.0.1/core/src/main/java/org/mule/util/XMLUtils.java0000644000175000017500000000443410740712271022724 0ustar charlescharles/* * $Id: XMLUtils.java 10256 2008-01-08 15:20:25Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * These only depend on standard (JSE) XML classes and are used by Spring config code. * For a more extensive (sub-)class, see the XMLUtils class in the XML module. */ public class XMLUtils { public static String elementToString(Element e) { StringBuffer buf = new StringBuffer(); buf.append(e.getTagName()).append("{"); for (int i = 0; i < e.getAttributes().getLength(); i++) { if (i > 0) { buf.append(", "); } Node n = e.getAttributes().item(i); buf.append(attributeName((Attr) n)).append("=").append(n.getNodeValue()); } buf.append("}"); return buf.toString(); } public static boolean isLocalName(Element element, String name) { return element.getLocalName().equals(name); } public static String attributeName(Attr attribute) { String name = attribute.getLocalName(); if (null == name) { name = attribute.getName(); } return name; } public static String getTextChild(Element element) { NodeList children = element.getChildNodes(); String value = null; for (int i = 0; i < children.getLength(); ++i) { Node child = children.item(i); if (child.getNodeType() == Node.TEXT_NODE) { if (null != value) { throw new IllegalStateException( "Element " + elementToString(element) + " has more than one text child."); } else { value = child.getNodeValue(); } } } return value; } } mule-2.0.1/core/src/main/java/org/mule/util/SpiUtils.java0000644000175000017500000000576310774260226023032 0ustar charlescharles/* * $Id: SpiUtils.java 11518 2008-03-31 22:07:18Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.api.registry.ServiceDescriptorFactory; import org.mule.config.ExceptionHelper; import org.mule.transport.service.TransportFactory; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; // TODO This will eventually use the OSGi Service Registry for locating services // @ThreadSafe public class SpiUtils { private static final Log logger = LogFactory.getLog(SpiUtils.class); public static final String SERVICE_ROOT = "META-INF/services/"; public static final String PROVIDER_SERVICE_PATH = "org/mule/providers/"; public static final String EXCEPTION_SERVICE_PATH = "org/mule/config/"; public static Properties findServiceDescriptor(String type, String name) { if (type.equals(ServiceDescriptorFactory.PROVIDER_SERVICE_TYPE)) { return findServiceDescriptor(PROVIDER_SERVICE_PATH, name, TransportFactory.class); } else if (type.equals(ServiceDescriptorFactory.EXCEPTION_SERVICE_TYPE)) { return findServiceDescriptor(EXCEPTION_SERVICE_PATH, name, ExceptionHelper.class); } else { logger.warn("Attempt to lookup unrecognized service type: " + type); return null; } } public static Properties findServiceDescriptor(String path, String name, Class currentClass) { if (!name.endsWith(".properties")) { name += ".properties"; } if (path.startsWith("/")) { path = path.substring(1); } if (!path.endsWith("/")) { path += "/"; } if (path.startsWith(SERVICE_ROOT)) { path += name; } else { path = SERVICE_ROOT + path + name; } try { InputStream is = IOUtils.getResourceAsStream(path, currentClass, false, false); if (is != null) { Properties props = new Properties(); try { props.load(is); return props; } catch (IOException e) { logger.warn("Descriptor found but unable to load properties for service " + name); return null; } } else { return null; } } catch (IOException e) { return null; } } } mule-2.0.1/core/src/main/java/org/mule/util/JndiContextHelper.java0000644000175000017500000000301510764146523024635 0ustar charlescharles/* * $Id: JndiContextHelper.java 11244 2008-03-07 05:06:27Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.util.Hashtable; import java.util.Map; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; /** * Common code for initialising the JNDI context. */ public final class JndiContextHelper { /** Do not instanciate. */ private JndiContextHelper () { // no-op } /** * Create a new initial context. * * @param environment JNDI properties or null. In the latter case * a default constructor of InitialContext will be * called with standard JNDI lookup properties semantics. * @return jndi context * @throws NamingException if there was a JNDI error */ public static Context initialise(final Map environment) throws NamingException { Context context; if (environment != null && environment.size() > 0) { context = new InitialContext(new Hashtable(environment)); } else { context = new InitialContext(); } return context; } } mule-2.0.1/core/src/main/java/org/mule/util/NumberUtils.java0000644000175000017500000000344310664630335023520 0ustar charlescharles/* * $Id: NumberUtils.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; /** * NumberUtils contains useful methods for manipulating numbers. */ // @ThreadSafe public class NumberUtils extends org.apache.commons.lang.math.NumberUtils { public static long toLong(Object obj) { if (obj == null) { throw new IllegalArgumentException("Unable to convert null object to long"); } else if (obj instanceof String) { return toLong((String) obj); } else if (obj instanceof Number) { return ((Number) obj).longValue(); } else { throw new IllegalArgumentException("Unable to convert object of type: " + obj.getClass().getName() + " to long."); } } public static int toInt(Object obj) { if (obj == null) { throw new IllegalArgumentException("Unable to convert null object to int"); } else if (obj instanceof String) { return toInt((String) obj); } else if (obj instanceof Number) { return ((Number) obj).intValue(); } else { throw new IllegalArgumentException("Unable to convert object of type: " + obj.getClass().getName() + " to int."); } } } mule-2.0.1/core/src/main/java/org/mule/util/file/0000755000175000017500000000000011351411127021305 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/file/FileManager.java0000644000175000017500000000523410664630335024340 0ustar charlescharles/* * $Id: FileManager.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.file; import org.mule.util.xa.AbstractTransactionContext; import org.mule.util.xa.AbstractXAResourceManager; import org.mule.util.xa.ResourceManagerException; import javax.transaction.xa.XAResource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class FileManager extends AbstractXAResourceManager { private static Log logger = LogFactory.getLog(FileManager.class); public synchronized FileSession createSession() { return new TransactedFileSession(this); } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#getLogger() */ protected Log getLogger() { return logger; } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#createTransactionContext(java.lang.Object) */ protected AbstractTransactionContext createTransactionContext(Object session) { return new FileTransactionContext(); } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#doBegin(org.mule.transaction.xa.AbstractTransactionContext) */ protected void doBegin(AbstractTransactionContext context) { // template method } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#doPrepare(org.mule.transaction.xa.AbstractTransactionContext) */ protected int doPrepare(AbstractTransactionContext context) { return XAResource.XA_OK; } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#doCommit(org.mule.transaction.xa.AbstractTransactionContext) */ protected void doCommit(AbstractTransactionContext context) throws ResourceManagerException { // template method } /* * (non-Javadoc) * * @see org.mule.transaction.xa.AbstractResourceManager#doRollback(org.mule.transaction.xa.AbstractTransactionContext) */ protected void doRollback(AbstractTransactionContext context) throws ResourceManagerException { // template method } protected class FileTransactionContext extends AbstractTransactionContext { // nothing here yet } } mule-2.0.1/core/src/main/java/org/mule/util/file/FileSession.java0000644000175000017500000000360110664630335024405 0ustar charlescharles/* * $Id: FileSession.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.file; import org.mule.util.xa.ResourceManagerException; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.RandomAccessFile; public interface FileSession { void begin() throws ResourceManagerException; void commit() throws ResourceManagerException; void rollback() throws ResourceManagerException; FileInputStream openInputStream(File f) throws IOException; FileOutputStream openOutputStream(File f, boolean append) throws IOException; FileOutputStream openOutputStream(File f) throws IOException; boolean mkdir(File f) throws IOException; RandomAccessFile openRandomAccess(File f, String mode) throws IOException; /** * Delete the given file. * * @throw IllegalStateException if this transaction has already been committed or * rolled back * @throw FileNotFoundException if the file does not exist * @throw DeleteException if the deletion fails * @throw TransactionException if there is a problem maintaining transaction * information * @throw InconsistentStateException if this transaction cannot be restored to a * consistent state (either no effect or all effects); failure of * atomicity */ void delete(File f) throws IOException; void copy(File source, File dest) throws IOException; void rename(File source, File dest) throws IOException; } mule-2.0.1/core/src/main/java/org/mule/util/file/package.html0000644000175000017500000000020210240611201023547 0ustar charlescharles Mule A file resource manager to allow acid operations on file systems. mule-2.0.1/core/src/main/java/org/mule/util/file/DeleteException.java0000644000175000017500000000147010664630335025245 0ustar charlescharles/* * $Id: DeleteException.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.file; import java.io.File; import java.io.IOException; public class DeleteException extends IOException { /** * Serial version */ private static final long serialVersionUID = 6725758458721277194L; public DeleteException() { super(); } public DeleteException(File f) { super(f != null ? f.toString() : "null"); } } mule-2.0.1/core/src/main/java/org/mule/util/file/TransactedFileSession.java0000644000175000017500000001025210664630335026416 0ustar charlescharles/* * $Id: TransactedFileSession.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.file; import org.mule.util.xa.AbstractXAResourceManager; import org.mule.util.xa.DefaultXASession; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.RandomAccessFile; import org.apache.commons.io.IOUtils; /** * TODO document * */ public class TransactedFileSession extends DefaultXASession implements FileSession { public TransactedFileSession(AbstractXAResourceManager resourceManager) { super(resourceManager); } /* * (non-Javadoc) * * @see org.mule.transaction.xa.file.FileSession#openInputStream(java.io.File) */ public FileInputStream openInputStream(File f) throws IOException { if (localContext != null) { // TODO return null; } else { return new FileInputStream(f); } } /* * (non-Javadoc) * * @see org.mule.transaction.xa.file.FileSession#openOutputStream(java.io.File, * boolean) */ public FileOutputStream openOutputStream(File f, boolean append) throws IOException { if (localContext != null) { // TODO return null; } else { return new FileOutputStream(f, append); } } /* * (non-Javadoc) * * @see org.mule.transaction.xa.file.FileSession#openOutputStream(java.io.File) */ public FileOutputStream openOutputStream(File f) throws IOException { return openOutputStream(f, false); } /* * (non-Javadoc) * * @see org.mule.transaction.xa.file.FileSession#mkdir(java.io.File) */ public boolean mkdir(File f) throws IOException { if (localContext != null) { // TODO return false; } else { return f.mkdir(); } } /* * (non-Javadoc) * * @see org.mule.transaction.xa.file.FileSession#openRandomAccess(java.io.File, * java.lang.String) */ public RandomAccessFile openRandomAccess(File f, String mode) throws IOException { if (localContext != null) { // TODO return null; } else { return new RandomAccessFile(f, mode); } } /* * (non-Javadoc) * * @see org.mule.transaction.xa.file.FileSession#delete(java.io.File) */ public void delete(File f) throws IOException { if (localContext != null) { // TODO } else { if (!f.delete()) { throw new DeleteException(f); } } } /* * (non-Javadoc) * * @see org.mule.transaction.xa.file.FileSession#copy(java.io.File, java.io.File) */ public void copy(File source, File dest) throws IOException { if (dest.exists()) { delete(dest); } InputStream is = null; OutputStream os = null; try { is = openInputStream(source); try { os = openOutputStream(dest); IOUtils.copy(is, os); } finally { IOUtils.closeQuietly(os); } } finally { IOUtils.closeQuietly(is); } } /* * (non-Javadoc) * * @see org.mule.transaction.xa.file.FileSession#rename(java.io.File, * java.io.File) */ public void rename(File source, File dest) throws IOException { copy(source, dest); delete(dest); } } mule-2.0.1/core/src/main/java/org/mule/util/MapUtils.java0000644000175000017500000001027710664630335023010 0ustar charlescharles/* * $Id: MapUtils.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.Map; // @ThreadSafe public class MapUtils extends org.apache.commons.collections.MapUtils { /** * Convenience method for CollectionUtil#mapWithKeysAndValues(Class, Iterator, * Iterator); keys and values can be null or empty. */ public static Map mapWithKeysAndValues(Class mapClass, Object[] keys, Object[] values) { Collection keyCollection = (keys != null ? Arrays.asList(keys) : Collections.EMPTY_LIST); Collection valuesCollection = (values != null ? Arrays.asList(values) : Collections.EMPTY_LIST); return mapWithKeysAndValues(mapClass, keyCollection.iterator(), valuesCollection.iterator()); } /** * Convenience method for CollectionUtil#mapWithKeysAndValues(Class, Iterator, * Iterator); keys and values can be null or empty. */ public static Map mapWithKeysAndValues(Class mapClass, Collection keys, Collection values) { keys = (keys != null ? keys : Collections.EMPTY_LIST); values = (values != null ? values : Collections.EMPTY_LIST); return mapWithKeysAndValues(mapClass, keys.iterator(), values.iterator()); } /** * Create & populate a Map of arbitrary class. Populating stops when either the * keys or values iterator is null or exhausted. * * @param mapClass the Class of the Map to instantiate * @param keys iterator for Objects ued as keys * @param values iterator for Objects used as values * @return the instantiated Map */ public static Map mapWithKeysAndValues(Class mapClass, Iterator keys, Iterator values) { Map m = null; if (mapClass == null) { throw new IllegalArgumentException("Map class must not be null!"); } try { m = (Map) mapClass.newInstance(); } catch (Exception ex) { throw new RuntimeException(ex); } if (keys != null && values != null) { while (keys.hasNext() && values.hasNext()) { m.put(keys.next(), values.next()); } } return m; } /** * Creates a String representation of the given Map, with optional newlines * between elements. * * @param props the map to format * @param newline indicates whether elements are to be split across lines * @return the formatted String */ public static String toString(Map props, boolean newline) { if (props == null || props.isEmpty()) { return "{}"; } StringBuffer buf = new StringBuffer(props.size() * 32); buf.append('{'); if (newline) { buf.append(SystemUtils.LINE_SEPARATOR); } Object[] entries = props.entrySet().toArray(); int i; for (i = 0; i < entries.length - 1; i++) { Map.Entry property = (Map.Entry) entries[i]; buf.append(property.getKey()); buf.append('='); buf.append(PropertiesUtils.maskedPropertyValue(property)); if (newline) { buf.append(SystemUtils.LINE_SEPARATOR); } else { buf.append(',').append(' '); } } // don't forget the last one Map.Entry lastProperty = (Map.Entry) entries[i]; buf.append(lastProperty.getKey().toString()); buf.append('='); buf.append(PropertiesUtils.maskedPropertyValue(lastProperty)); if (newline) { buf.append(SystemUtils.LINE_SEPARATOR); } buf.append('}'); return buf.toString(); } } mule-2.0.1/core/src/main/java/org/mule/util/ClassUtils.java0000644000175000017500000006133310754365306023342 0ustar charlescharles/* * $Id: ClassUtils.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.routing.filters.WildcardFilter; import java.io.BufferedReader; import java.io.CharArrayReader; import java.io.IOException; import java.io.Reader; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; /** * Extend the Apache Commons ClassUtils to provide additional functionality. *

    *

    This class is useful for loading resources and classes in a fault tolerant manner * that works across different applications servers. The resource and classloading * methods are SecurityManager friendly.

    */ // @ThreadSafe public class ClassUtils extends org.apache.commons.lang.ClassUtils { public static final Object[] NO_ARGS = new Object[]{}; public static final Class[] NO_ARGS_TYPE = new Class[]{}; private static final Map wrapperToPrimitiveMap = new HashMap(); static { wrapperToPrimitiveMap.put(Boolean.class, Boolean.TYPE); wrapperToPrimitiveMap.put(Byte.class, Byte.TYPE); wrapperToPrimitiveMap.put(Character.class, Character.TYPE); wrapperToPrimitiveMap.put(Short.class, Short.TYPE); wrapperToPrimitiveMap.put(Integer.class, Integer.TYPE); wrapperToPrimitiveMap.put(Long.class, Long.TYPE); wrapperToPrimitiveMap.put(Double.class, Double.TYPE); wrapperToPrimitiveMap.put(Float.class, Float.TYPE); wrapperToPrimitiveMap.put(Void.TYPE, Void.TYPE); } public static boolean isConcrete(Class clazz) { if (clazz == null) { throw new IllegalArgumentException("clazz may not be null"); } return !(clazz.isInterface() || Modifier.isAbstract(clazz.getModifiers())); } /** * Load a given resource.

    This method will try to load the resource using * the following methods (in order): *

      *
    • From * {@link Thread#getContextClassLoader() Thread.currentThread().getContextClassLoader()} *
    • From * {@link Class#getClassLoader() ClassUtils.class.getClassLoader()} *
    • From the {@link Class#getClassLoader() callingClass.getClassLoader() } *
    * * @param resourceName The name of the resource to load * @param callingClass The Class object of the calling object */ public static URL getResource(final String resourceName, final Class callingClass) { URL url = (URL) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { final ClassLoader cl = Thread.currentThread().getContextClassLoader(); return cl != null ? cl.getResource(resourceName) : null; } }); if (url == null) { url = (URL) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return ClassUtils.class.getClassLoader().getResource(resourceName); } }); } if (url == null) { url = (URL) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return callingClass.getClassLoader().getResource(resourceName); } }); } return url; } public static Enumeration getResources(final String resourceName, final Class callingClass) { Enumeration enumeration = (Enumeration) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { final ClassLoader cl = Thread.currentThread().getContextClassLoader(); return cl != null ? cl.getResources(resourceName) : null; } catch (IOException e) { return null; } } }); if (enumeration == null) { enumeration = (Enumeration) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { return ClassUtils.class.getClassLoader().getResources(resourceName); } catch (IOException e) { return null; } } }); } if (enumeration == null) { enumeration = (Enumeration) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { return callingClass.getClassLoader().getResources(resourceName); } catch (IOException e) { return null; } } }); } return enumeration; } /** * Load a class with a given name.

    It will try to load the class in the * following order: *

      *
    • From * {@link Thread#getContextClassLoader() Thread.currentThread().getContextClassLoader()} *
    • Using the basic {@link Class#forName(java.lang.String) } *
    • From * {@link Class#getClassLoader() ClassLoaderUtil.class.getClassLoader()} *
    • From the {@link Class#getClassLoader() callingClass.getClassLoader() } *
    * * @param className The name of the class to load * @param callingClass The Class object of the calling object * @throws ClassNotFoundException If the class cannot be found anywhere. */ public static Class loadClass(final String className, final Class callingClass) throws ClassNotFoundException { Class clazz = (Class) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { final ClassLoader cl = Thread.currentThread().getContextClassLoader(); return cl != null ? cl.loadClass(className) : null; } catch (ClassNotFoundException e) { return null; } } }); if (clazz == null) { clazz = (Class) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { return Class.forName(className); } catch (ClassNotFoundException e) { return null; } } }); } if (clazz == null) { clazz = (Class) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { return ClassUtils.class.getClassLoader().loadClass(className); } catch (ClassNotFoundException e) { return null; } } }); } if (clazz == null) { clazz = (Class) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { return callingClass.getClassLoader().loadClass(className); } catch (ClassNotFoundException e) { return null; } } }); } if (clazz == null) { throw new ClassNotFoundException(className); } return clazz; } /** Prints the current classloader hierarchy - useful for debugging. */ public static void printClassLoader() { System.out.println("ClassLoaderUtils.printClassLoader"); printClassLoader(Thread.currentThread().getContextClassLoader()); } /** * Prints the classloader hierarchy from a given classloader - useful for * debugging. */ public static void printClassLoader(ClassLoader cl) { System.out.println("ClassLoaderUtils.printClassLoader(cl = " + cl + ")"); if (cl != null) { printClassLoader(cl.getParent()); } } /** * Ensure that the given class is properly initialized when the argument is passed in * as .class literal. This method can never fail unless the bytecode is corrupted or * the VM is otherwise seriously confused. * * @param clazz the Class to be initialized * @return the same class but initialized */ public static Class initializeClass(Class clazz) { try { return getClass(clazz.getName(), true); } catch (ClassNotFoundException e) { throw new IllegalStateException(); } } public static Object instanciateClass(Class clazz, Object[] constructorArgs) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Class[] args; if (constructorArgs != null) { args = new Class[constructorArgs.length]; for (int i = 0; i < constructorArgs.length; i++) { if (constructorArgs[i] == null) { args[i] = null; } else { args[i] = constructorArgs[i].getClass(); } } } else { args = new Class[0]; } // try the arguments as given Constructor ctor = getConstructor(clazz, args); if (ctor == null) { // try again but adapt value classes to primitives ctor = getConstructor(clazz, wrappersToPrimitives(args)); } if (ctor == null) { StringBuffer argsString = new StringBuffer(100); for (int i = 0; i < args.length; i++) { argsString.append(args[i].getName()).append(", "); } throw new NoSuchMethodException("could not find constructor with matching arg params: " + argsString); } return ctor.newInstance(constructorArgs); } public static Object instanciateClass(String name, Object[] constructorArgs) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Class clazz = loadClass(name, ClassUtils.class); return instanciateClass(clazz, constructorArgs); } public static Object instanciateClass(String name, Object[] constructorArgs, Class callingClass) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Class clazz = loadClass(name, callingClass); return instanciateClass(clazz, constructorArgs); } public static Class[] getParameterTypes(Object bean, String methodName) { if (!methodName.startsWith("set")) { methodName = "set" + methodName.substring(0, 1).toUpperCase() + methodName.substring(1); } Method methods[] = bean.getClass().getMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName)) { return methods[i].getParameterTypes(); } } return new Class[]{}; } /** * Returns a matching method for the given name and parameters on the given class * If the parameterTypes arguments is null it will return the first matching * method on the class. * * @param clazz the class to find the method on * @param name the method name to find * @param parameterTypes an array of argument types or null * @return the Method object or null if none was found */ public static Method getMethod(Class clazz, String name, Class[] parameterTypes) { Method[] methods = clazz.getMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(name)) { if (parameterTypes == null) { return methods[i]; } else if (compare(methods[i].getParameterTypes(), parameterTypes, true)) { return methods[i]; } } } return null; } public static Constructor getConstructor(Class clazz, Class[] paramTypes) { Constructor[] ctors = clazz.getConstructors(); for (int i = 0; i < ctors.length; i++) { Class[] types = ctors[i].getParameterTypes(); if (types.length == paramTypes.length) { boolean match = true; for (int x = 0; x < types.length; x++) { if (paramTypes[x] == null) { match = true; } else { match = types[x].isAssignableFrom(paramTypes[x]); } } if (match) { return ctors[i]; } } } return null; } /** * A helper method that will find all matching methods on a class with the given * parameter type * * @param implementation the class to build methods on * @param parameterTypes the argument param types to look for * @param voidOk whether void methods shouldbe included in the found list * @param matchOnObject determines whether parameters of Object type are matched * when they are of Object.class type * @param ignoredMethodNames a Set of method names to ignore. Often 'equals' is * not a desired match. This argument can be null. * @return a List of methods on the class that match the criteria. If there are * none, an empty list is returned */ public static List getSatisfiableMethods(Class implementation, Class[] parameterTypes, boolean voidOk, boolean matchOnObject, Set ignoredMethodNames) { return getSatisfiableMethods(implementation, parameterTypes, voidOk, matchOnObject, ignoredMethodNames, null); } /** * A helper method that will find all matching methods on a class with the given * parameter type * * @param implementation the class to build methods on * @param parameterTypes the argument param types to look for * @param voidOk whether void methods shouldbe included in the found list * @param matchOnObject determines whether parameters of Object type are matched * when they are of Object.class type * @param ignoredMethodNames a Set of method names to ignore. Often 'equals' is * not a desired match. This argument can be null. * @return a List of methods on the class that match the criteria. If there are * none, an empty list is returned */ public static List getSatisfiableMethods(Class implementation, Class[] parameterTypes, boolean voidOk, boolean matchOnObject, Collection ignoredMethodNames, WildcardFilter filter) { List result = new ArrayList(); if (ignoredMethodNames == null) { ignoredMethodNames = Collections.EMPTY_SET; } Method[] methods = implementation.getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; //supporting wildcards if (filter != null && filter.accept(method.getName())) { continue; } Class[] methodParams = method.getParameterTypes(); if (compare(methodParams, parameterTypes, matchOnObject)) { if (!ignoredMethodNames.contains(method.getName())) { String returnType = method.getReturnType().getName(); if ((returnType.equals("void") && voidOk) || !returnType.equals("void")) { result.add(method); } } } } return result; } public static List getSatisfiableMethodsWithReturnType(Class implementation, Class returnType, boolean matchOnObject, Set ignoredMethodNames) { List result = new ArrayList(); if (ignoredMethodNames == null) { ignoredMethodNames = Collections.EMPTY_SET; } Method[] methods = implementation.getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; Class returns = method.getReturnType(); if (compare(new Class[]{returns}, new Class[]{returnType}, matchOnObject)) { if (!ignoredMethodNames.contains(method.getName())) { result.add(method); } } } return result; } /** * Can be used by serice endpoints to select which service to use based on what's * loaded on the classpath * * @param className The class name to look for * @param currentClass the calling class * @return true if the class is on the path */ public static boolean isClassOnPath(String className, Class currentClass) { try { return (loadClass(className, currentClass) != null); } catch (ClassNotFoundException e) { return false; } } /** * Used for creating an array of class types for an array or single object * * @param object single object or array. If this parameter is null or a zero length * array then {@link #NO_ARGS_TYPE} is returned * @return an array of class types for the object */ public static Class[] getClassTypes(Object object) { if (object == null) { return NO_ARGS_TYPE; } Class[] types; if (object instanceof Object[]) { Object[] objects = (Object[]) object; if (objects.length == 0) { return NO_ARGS_TYPE; } types = new Class[objects.length]; for (int i = 0; i < objects.length; i++) { types[i] = objects[i].getClass(); } } else { types = new Class[]{object.getClass()}; } return types; } public static String getClassName(Class clazz) { if (clazz == null) { return null; } String name = clazz.getName(); return name.substring(name.lastIndexOf(".") + 1); } public static boolean compare(Class[] c1, Class[] c2, boolean matchOnObject) { if (c1.length != c2.length) { return false; } for (int i = 0; i < c1.length; i++) { if (c1[i].equals(Object.class) && !matchOnObject) { return false; } if (!c1[i].isAssignableFrom(c2[i])) { return false; } } return true; } public static Class wrapperToPrimitive(Class wrapper) { return (Class) MapUtils.getObject(wrapperToPrimitiveMap, wrapper, wrapper); } public static Class[] wrappersToPrimitives(Class[] wrappers) { if (wrappers == null) { return null; } if (wrappers.length == 0) { return wrappers; } Class[] primitives = new Class[wrappers.length]; for (int i = 0; i < wrappers.length; i++) { primitives[i] = (Class) MapUtils.getObject(wrapperToPrimitiveMap, wrappers[i], wrappers[i]); } return primitives; } /** * Provide a simple-to-understand class name (with access to only Java 1.4 API). * * @param clazz The class whose name we will generate * @return A readable name for the class */ public static String getSimpleName(Class clazz) { if (null == clazz) { return "null"; } else { return classNameHelper(new BufferedReader(new CharArrayReader(clazz.getName().toCharArray()))); } } private static String classNameHelper(Reader encodedName) { // I did consider separating this data from the code, but I could not find a // solution that was as clear to read, or clearly motivated (these data are not // used elsewhere). try { encodedName.mark(1); switch (encodedName.read()) { case -1: return "null"; case 'Z': return "boolean"; case 'B': return "byte"; case 'C': return "char"; case 'D': return "double"; case 'F': return "float"; case 'I': return "int"; case 'J': return "long"; case 'S': return "short"; case '[': return classNameHelper(encodedName) + "[]"; case 'L': return shorten(new BufferedReader(encodedName).readLine()); default: encodedName.reset(); return shorten(new BufferedReader(encodedName).readLine()); } } catch (IOException e) { return "unknown type: " + e.getMessage(); } } /** * @param clazz A class name (with possible package and trailing semicolon) * @return The short name for the class */ private static String shorten(String clazz) { if (null != clazz && clazz.endsWith(";")) { clazz = clazz.substring(0, clazz.length() - 1); } if (null != clazz && clazz.lastIndexOf(".") > -1) { clazz = clazz.substring(clazz.lastIndexOf(".") + 1, clazz.length()); } return clazz; } /** * Is there a better place for this? Simple helper for writing object equalities. */ public static boolean equal(Object a, Object b) { if (null == a) { return null == b; } else { return null != b && a.equals(b); } } public static int hash(Object[] state) { int hash = 0; for (int i = 0; i < state.length; ++i) { hash = hash * 31 + (null == state[i] ? 0 : state[i].hashCode()); } return hash; } } mule-2.0.1/core/src/main/java/org/mule/util/ChainedReader.java0000644000175000017500000000453410664630335023727 0ustar charlescharles/* * $Id: ChainedReader.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.io.IOException; import java.io.Reader; /** * ChainedReader allows Reader objects to be chained together. Useful * for concatenating data from multiple Reader objects. */ public class ChainedReader extends Reader { private final Reader first; private final Reader second; private boolean firstRead = false; public ChainedReader(Reader first, Reader second) { this.first = first; this.second = second; } public void close() throws IOException { first.close(); second.close(); } public int read(char[] cbuf, int off, int len) throws IOException { if (!firstRead) { int i = first.read(cbuf, off, len); if (i < len) { firstRead = true; int x = second.read(cbuf, i, len - i); return x + i; } else { return i; } } else { return second.read(cbuf, off, len); } } public int read() throws IOException { if (!firstRead) { int i = first.read(); if (i == -1) { firstRead = true; return second.read(); } else { return i; } } else { return second.read(); } } public int read(char[] cbuf) throws IOException { if (!firstRead) { int i = first.read(cbuf); if (i < cbuf.length) { firstRead = true; int x = second.read(cbuf, i, cbuf.length - i); return x + i; } else { return i; } } else { return second.read(cbuf); } } } mule-2.0.1/core/src/main/java/org/mule/util/PropertiesUtils.java0000644000175000017500000001775110745677442024445 0ustar charlescharles/* * $Id: PropertiesUtils.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.config.i18n.CoreMessages; import org.mule.config.i18n.Message; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList; /** * PropertiesHelper is a utility class for manipulating and filtering * property Maps. */ // @ThreadSafe public final class PropertiesUtils { // @GuardedBy(itself) private static final List maskedProperties = new CopyOnWriteArrayList(); static { // When printing property lists mask password fields // Users can register their own fields to mask registerMaskedPropertyName("password"); } /** Do not instanciate. */ protected PropertiesUtils() { // no-op } /** * Register a property name for masking. This will prevent certain values from * leaking e.g. into debugging output or logfiles. * * @param name the key of the property to be masked. * @throws IllegalArgumentException is name is null or empty. */ public static void registerMaskedPropertyName(String name) { if (StringUtils.isNotEmpty(name)) { maskedProperties.add(name); } else { throw new IllegalArgumentException("Cannot mask empty property name."); } } /** * Returns the String representation of the property value or a masked String if * the property key has been registered previously via * {@link #registerMaskedPropertyName(String)}. * * @param property a key/value pair * @return String of the property value or a "masked" String that hides the * contents, or null if the property, its key or its value * is null. */ public static String maskedPropertyValue(Map.Entry property) { if (property == null) { return null; } Object key = property.getKey(); Object value = property.getValue(); if (key == null || value == null) { return null; } if (maskedProperties.contains(key)) { return ("*****"); } else { return value.toString(); } } /** * Read in the properties from a properties file. The file may be on the file * system or the classpath. * * @param fileName - The name of the properties file * @param callingClass - The Class which is calling this method. This is used to * determine the classpath. * @return a java.util.Properties object containing the properties. */ public static synchronized Properties loadProperties(String fileName, final Class callingClass) throws IOException { InputStream is = IOUtils.getResourceAsStream(fileName, callingClass, /* tryAsFile */true, /* tryAsUrl */false); if (is == null) { Message error = CoreMessages.cannotLoadFromClasspath(fileName); throw new IOException(error.toString()); } try { Properties props = new Properties(); props.load(is); return props; } finally { is.close(); } } public static String removeXmlNamespacePrefix(String eleName) { int i = eleName.indexOf(':'); return (i == -1 ? eleName : eleName.substring(i + 1, eleName.length())); } public static String removeNamespacePrefix(String eleName) { int i = eleName.lastIndexOf('.'); return (i == -1 ? eleName : eleName.substring(i + 1, eleName.length())); } public static Map removeNamespaces(Map properties) { HashMap props = new HashMap(properties.size()); Map.Entry entry; for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) { entry = (Map.Entry) iter.next(); props.put(removeNamespacePrefix((String) entry.getKey()), entry.getValue()); } return props; } /** * Will create a map of properties where the names have a prefix Allows the * callee to supply the target map so a comparator can be set * * @param props the source set of properties * @param prefix the prefix to filter on * @param newProps return map containing the filtered list of properties or an * empty map if no properties matched the prefix */ public static void getPropertiesWithPrefix(Map props, String prefix, Map newProps) { if (props == null) { return; } for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); Object key = entry.getKey(); if (key.toString().startsWith(prefix)) { newProps.put(key, entry.getValue()); } } } public static Map getPropertiesWithoutPrefix(Map props, String prefix) { Map newProps = new HashMap(); for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); Object key = entry.getKey(); if (!key.toString().startsWith(prefix)) { newProps.put(key, entry.getValue()); } } return newProps; } public static Properties getPropertiesFromQueryString(String query) { Properties props = new Properties(); if (query == null) { return props; } query = new StringBuffer(query.length() + 1).append('&').append(query).toString(); int x = 0; while ((x = addProperty(query, x, '&', props)) != -1) { // run } return props; } public static Properties getPropertiesFromString(String query, char separator) { Properties props = new Properties(); if (query == null) { return props; } query = new StringBuffer(query.length() + 1).append(separator).append(query).toString(); int x = 0; while ((x = addProperty(query, x, separator, props)) != -1) { // run } return props; } private static int addProperty(String query, int start, char separator, Properties properties) { int i = query.indexOf(separator, start); int i2 = query.indexOf(separator, i + 1); String pair; if (i > -1 && i2 > -1) { pair = query.substring(i + 1, i2); } else if (i > -1) { pair = query.substring(i + 1); } else { return -1; } int eq = pair.indexOf('='); if (eq <= 0) { String key = pair; String value = StringUtils.EMPTY; properties.setProperty(key, value); } else { String key = pair.substring(0, eq); String value = (eq == pair.length() ? StringUtils.EMPTY : pair.substring(eq + 1)); properties.setProperty(key, value); } return i2; } /** @deprecated Use {@link MapUtils#toString(Map, boolean)} instead */ public static String propertiesToString(Map props, boolean newline) { return MapUtils.toString(props, newline); } } mule-2.0.1/core/src/main/java/org/mule/util/counters/0000755000175000017500000000000011351411131022223 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/counters/CounterFactory.java0000644000175000017500000001561510664630335026064 0ustar charlescharles/* * $Id: CounterFactory.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters; import org.mule.util.counters.impl.CounterFactoryImpl; import java.util.Iterator; /** * This class is the Counter's factory. It is the main entry point for operations on * counters. The user can: *
      *
    • retrieve a counter by its name
    • *
    • create a counter
    • *
    • retrieve a list of public counters
    • *
    */ public final class CounterFactory { /** Do not instanciate. */ private CounterFactory () { // no-op } /** * Enum class for all different types of counters. The type of a counter is * defined on creation and can be retrieved on each counter. */ public static final class Type { /** A basic counter representing a double value */ public static final Type NUMBER = new Type("Number"); /** Counter representing the sum of two counters */ public static final Type SUM = new Type("Sum"); /** Counter representing the minimum value of a counter */ public static final Type MIN = new Type("Min"); /** Counter representing the maximum value of a counter */ public static final Type MAX = new Type("Max"); /** Counter representing the average value of a counter */ public static final Type AVERAGE = new Type("Average"); /** Counter representing the time average value of a counter */ public static final Type TIME_AVERAGE = new Type("TimeAverage"); /** Counter representing the variation of a counter */ public static final Type DELTA = new Type("Delta"); /** Counter representing the instant rate of a counter */ public static final Type INSTANT_RATE = new Type("InstantRate"); /** Counter representing rate per second of a counter */ public static final Type RATE_PER_SECOND = new Type("RatePerSecond"); /** Counter representing rate per minute of a counter */ public static final Type RATE_PER_MINUTE = new Type("RatePerMinute"); /** Counter representing rate per hour of a counter */ public static final Type RATE_PER_HOUR = new Type("RatePerHour"); /** Counter represening the sum of two other counters */ public static final Type PLUS = new Type("Plus"); /** Counter represening the difference of two other counters */ public static final Type MINUS = new Type("Minus"); /** Counter represening the multiplication of two other counters */ public static final Type MULTIPLY = new Type("Multiply"); /** Counter represening the division of two other counters */ public static final Type DIVIDE = new Type("Divide"); /** The string representation of this counter type */ private String name; /** * Constructor of the type * * @param name the name of the counter type */ protected Type(String name) { this.name = name; } public String getName() { return this.name; } } /** * Search the defined counters for a counter of the given name. * * @param name the name of the counter to retrieve * @return the counter */ public static Counter getCounter(String name) { return CounterFactoryImpl.getCounter(name); } /** * Create a new public counter of the given type. * * @param name the name of the counter to create * @param type the type of the counter * @return the newly created counter */ public static Counter createCounter(String name, Type type) { return createCounter(name, null, null, type, true); } /** * Create a new counter of the given type and visibility. * * @param name the name of the counter to create * @param type the type of the counter * @param visible boolean specifying if the counter is public or not * @return the newly created counter */ public static Counter createCounter(String name, Type type, boolean visible) { return createCounter(name, null, null, type, visible); } /** * Create a new public aggregate counter of the given type. * * @param name the name of the counter to create * @param base the name of the counter to use for computation * @param type the type of the counter * @return the newly created counter */ public static Counter createCounter(String name, String base, Type type) { return createCounter(name, base, null, type, true); } /** * Create a new aggregate counter of the given type and visibility. * * @param name the name of the counter to create * @param base the name of the counter to use for computation * @param type the type of the counter * @param visible boolean specifying if the counter is public or not * @return the newly created counter */ public static Counter createCounter(String name, String base, Type type, boolean visible) { return createCounter(name, base, null, type, visible); } /** * Create a new public aggregate counter of the given type. * * @param name the name of the counter to create * @param first the name of the first counter to use for computation * @param second the name of the first counter to use for computation * @param type the type of the counter * @return the newly created counter */ public static Counter createCounter(String name, String first, String second, Type type) { return createCounter(name, first, second, type, true); } /** * Create a new aggregate counter of the given type and visibility. * * @param name the name of the counter to create * @param first the name of the first counter to use for computation * @param second the name of the first counter to use for computation * @param type the type of the counter * @param visible boolean specifying if the counter is public or not * @return the newly created counter */ public static Counter createCounter(String name, String first, String second, Type type, boolean visible) { return CounterFactoryImpl.createCounter(name, first, second, type, visible); } /** * Retrieve an iterator giving the list of public defined counters. * * @return an iterator to walk throught the list of public defined counters */ public static Iterator getCounters() { return CounterFactoryImpl.getCounters(); } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/0000755000175000017500000000000011351411131023164 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/counters/impl/Operator.java0000644000175000017500000000317610664630335025650 0ustar charlescharles/* * $Id: Operator.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.Counter; import org.mule.util.counters.CounterFactory.Type; public class Operator extends AggregateCounter { private final Counter base2; private double val1; private double val2; public Operator(String name, AbstractCounter base, AbstractCounter base2, Type type) { super(name, type, base); this.base2 = base2; base2.addAggregate(this); } public double nextValue() { Type type = this.getType(); if (type == Type.PLUS) { return val1 + val2; } else if (type == Type.MINUS) { return val1 - val2; } else if (type == Type.MULTIPLY) { return val1 * val2; } else if (type == Type.DIVIDE) { return val2 == 0.0 ? (val1 >= 0 ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY) : (val1 / val2); } else { throw new IllegalStateException(); } } public void doCompute() { this.val1 = this.getBase().nextValue(); this.val2 = base2.nextValue(); } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/Min.java0000644000175000017500000000164710664630335024601 0ustar charlescharles/* * $Id: Min.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.CounterFactory.Type; public class Min extends AggregateCounter { private double min = Double.MAX_VALUE; public Min(String name, AbstractCounter base) { super(name, Type.MIN, base); } public double nextValue() { return min; } public void doCompute() { double next = getBase().nextValue(); if (Double.isNaN(min) || (next < min)) { min = next; } } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/Number.java0000644000175000017500000000236110664630335025300 0ustar charlescharles/* * $Id: Number.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.CounterFactory.Type; public class Number extends AbstractCounter { private double value = 0.0; public Number(String name) { super(name, Type.NUMBER); } public synchronized double increment() { this.value++; propagate(); return this.value; } public synchronized double incrementBy(double value) { this.value += value; propagate(); return this.value; } public synchronized double decrement() { this.value--; propagate(); return this.value; } public synchronized void setRawValue(double value) { this.value = value; propagate(); } public synchronized double nextValue() { return this.value; } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/CounterFactoryImpl.java0000644000175000017500000001136010664630335027640 0ustar charlescharles/* * $Id: CounterFactoryImpl.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.Counter; import org.mule.util.counters.CounterFactory.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public final class CounterFactoryImpl { private static Map counters = new HashMap(); private static ArrayList publicCounters = new ArrayList(); /** Do not instanciate. */ private CounterFactoryImpl () { // no-op } public static Counter getCounter(String name) { return (Counter) counters.get(name); } public static Counter createCounter(String name, String first, String second, Type type, boolean visible) { Counter counter = getCounter(name); if (counter != null) { throw new IllegalStateException(); } else { counter = internalCreateCounter(name, first, second, type, visible); } return counter; } public static Iterator getCounters() { return publicCounters.iterator(); } protected static AbstractCounter internalCreateCounter(String name, String first, String second, Type type, boolean visible) { AbstractCounter counter = null; if (name == null) { throw new IllegalStateException(); } else if (first == null && second == null) { if (type == Type.NUMBER) { counter = new Number(name); } else { throw new IllegalStateException(); } } else if (first != null && second == null) { AbstractCounter b = (AbstractCounter) getCounter(first); if (b == null) { throw new IllegalStateException(); } if (type == Type.MIN) { counter = new Min(name, b); } else if (type == Type.MAX) { counter = new Max(name, b); } else if (type == Type.SUM) { counter = new Sum(name, b); } else if (type == Type.AVERAGE) { counter = new Average(name, b); } else if (type == Type.TIME_AVERAGE) { counter = new TimeAverage(name, b); } else if (type == Type.DELTA) { counter = new Delta(name, b); } else if (type == Type.INSTANT_RATE) { counter = new InstantRate(name, b); } else if (type == Type.RATE_PER_SECOND || type == Type.RATE_PER_MINUTE || type == Type.RATE_PER_HOUR) { counter = new RatePerUnit(name, null, type, b); } else { throw new IllegalStateException(); } } else if (first != null && second != null) { AbstractCounter b = (AbstractCounter) getCounter(first); if (b == null) { throw new IllegalStateException(); } if (type == Type.RATE_PER_SECOND || type == Type.RATE_PER_MINUTE || type == Type.RATE_PER_HOUR) { counter = new RatePerUnit(name, second, type, b); } else if (type == Type.PLUS || type == Type.MINUS || type == Type.MULTIPLY || type == Type.DIVIDE) { AbstractCounter b2 = (AbstractCounter) getCounter(second); if (b2 == null) { throw new IllegalStateException(); } counter = new Operator(name, b, b2, type); } else { throw new IllegalStateException(); } } else { throw new IllegalStateException(); } counters.put(name, counter); if (visible) { publicCounters.add(counter); } return counter; } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/Sum.java0000644000175000017500000000150110664630335024607 0ustar charlescharles/* * $Id: Sum.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.CounterFactory.Type; public class Sum extends AggregateCounter { private double value; public Sum(String name, AbstractCounter base) { super(name, Type.SUM, base); } public double nextValue() { return this.value; } public void doCompute() { this.value += getBase().nextValue(); } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/Average.java0000644000175000017500000000162610664630335025425 0ustar charlescharles/* * $Id: Average.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.CounterFactory.Type; public class Average extends AggregateCounter { private double sum = 0; private long times = 0; public Average(String name, AbstractCounter base) { super(name, Type.AVERAGE, base); } public double nextValue() { return (times > 0) ? sum / times : 0; } public void doCompute() { this.sum += getBase().nextValue(); this.times++; } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/Max.java0000644000175000017500000000165410664630335024601 0ustar charlescharles/* * $Id: Max.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.CounterFactory.Type; public class Max extends AggregateCounter { private double max = Double.MIN_VALUE; public Max(String name, AbstractCounter base) { super(name, Type.MAX, base); } public double nextValue() { return max; } public void doCompute() { double next = this.getBase().nextValue(); if (Double.isNaN(max) || (next > max)) { max = next; } } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/RatePerUnit.java0000644000175000017500000000660610664630335026260 0ustar charlescharles/* * $Id: RatePerUnit.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.CounterFactory.Type; import java.security.InvalidParameterException; import java.util.Iterator; import java.util.LinkedList; public class RatePerUnit extends AggregateCounter { private static class Sample { private double value; private long time; public Sample(double value, long time) { this.value = value; this.time = time; } /** * @return the time of the sample */ public long getTime() { return time; } /** * @return the value of the sample */ public double getValue() { return value; } } private final LinkedList samples; private final long unit; private final long length; private final long baseTime; public RatePerUnit(String name, String p, Type type, AbstractCounter base) { super(name, type, base); if (type == Type.RATE_PER_SECOND) { unit = 1000; } else if (type == Type.RATE_PER_MINUTE) { unit = 60 * 1000; } else if (type == Type.RATE_PER_HOUR) { unit = 60 * 60 * 1000; } else { throw new InvalidParameterException(); } long newLength = 0; try { newLength = Long.parseLong(p); } catch (Exception e) { newLength = 0; } finally { if (newLength <= 0) { newLength = 128; } length = newLength; } samples = new LinkedList(); baseTime = System.currentTimeMillis(); } public double nextValue() { if (samples.isEmpty()) { return 0.0; } else { double total = 0.0; long current = getTime(); Iterator it = samples.iterator(); Sample sample = null; while (it.hasNext()) { sample = (Sample) it.next(); if (current - sample.time > length) { break; } total += sample.value; } return total / (1 + current - (sample != null ? sample.time : 0)); } } public void doCompute() { Sample l = samples.isEmpty() ? null : (Sample) samples.getFirst(); long t = getTime(); if (l == null || t > l.time) { Sample s = new Sample(this.getBase().nextValue(), t); samples.addFirst(s); } else { l.value += getBase().nextValue(); } while (samples.size() > length) { samples.removeLast(); } } protected long getTime() { return (System.currentTimeMillis() - baseTime) / unit; } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/AggregateCounter.java0000644000175000017500000000272110664630335027276 0ustar charlescharles/* * $Id: AggregateCounter.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.Counter; import org.mule.util.counters.CounterFactory.Type; public abstract class AggregateCounter extends AbstractCounter { private final Counter base; public AggregateCounter(String name, Type type, AbstractCounter base) { super(name, type); this.base = base; base.addAggregate(this); } public double increment() { throw new UnsupportedOperationException(); } public double incrementBy(double value) { throw new UnsupportedOperationException(); } public double decrement() { throw new UnsupportedOperationException(); } public void setRawValue(double value) { throw new UnsupportedOperationException(); } public final synchronized void compute() { this.doCompute(); this.propagate(); } public Counter getBase() { return this.base; } public abstract double nextValue(); public abstract void doCompute(); } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/Delta.java0000644000175000017500000000207210664630335025100 0ustar charlescharles/* * $Id: Delta.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.CounterFactory.Type; public class Delta extends AggregateCounter { private double first = 0.0; private double second = 0.0; public Delta(String name, AbstractCounter base) { super(name, Type.DELTA, base); } public double nextValue() { if (Double.isNaN(first) || Double.isNaN(second)) { return Double.NaN; } else { return second - first > 0.0 ? second - first : 0.0; } } public void doCompute() { first = second; second = this.getBase().nextValue(); } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/InstantRate.java0000644000175000017500000000221610664630335026303 0ustar charlescharles/* * $Id: InstantRate.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.CounterFactory.Type; public class InstantRate extends AggregateCounter { private double firstTime; private double lastTime; private double value; public InstantRate(String name, AbstractCounter base) { super(name, Type.INSTANT_RATE, base); } public double nextValue() { if (firstTime == 0 || firstTime == lastTime) { return Double.NaN; } else { return value / (lastTime - firstTime) * 1000.0; } } public void doCompute() { firstTime = lastTime; lastTime = System.currentTimeMillis(); value = getBase().nextValue(); } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/AbstractCounter.java0000644000175000017500000000330610664630335027153 0ustar charlescharles/* * $Id: AbstractCounter.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.Counter; import org.mule.util.counters.CounterFactory.Type; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; public abstract class AbstractCounter implements Counter { private final Type type; private final String name; private final List aggregates; public AbstractCounter(String name, Type type) { super(); this.name = name; this.type = type; this.aggregates = Collections.synchronizedList(new ArrayList()); } public Type getType() { return this.type; } public String getName() { return this.name; } public abstract double increment(); public abstract double incrementBy(double value); public abstract double decrement(); public abstract void setRawValue(double value); public abstract double nextValue(); protected void addAggregate(AggregateCounter counter) { this.aggregates.add(counter); } protected void propagate() { Iterator it = this.aggregates.iterator(); while (it.hasNext()) { AggregateCounter agg = (AggregateCounter) it.next(); agg.compute(); } } } mule-2.0.1/core/src/main/java/org/mule/util/counters/impl/TimeAverage.java0000644000175000017500000000236010664630335026240 0ustar charlescharles/* * $Id: TimeAverage.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters.impl; import org.mule.util.counters.CounterFactory.Type; public class TimeAverage extends AggregateCounter { private double sum = 0.0; private double lastValue = 0.0; private final long firstTime = System.currentTimeMillis(); private long lastTime = firstTime; public TimeAverage(String name, AbstractCounter base) { super(name, Type.AVERAGE, base); } public double nextValue() { long current = System.currentTimeMillis(); return (sum + lastValue * (current - this.lastTime)) / (current - firstTime); } public void doCompute() { long current = System.currentTimeMillis(); this.sum += this.lastValue * (current - this.lastTime); this.lastValue = getBase().nextValue(); this.lastTime = current; } } mule-2.0.1/core/src/main/java/org/mule/util/counters/Counter.java0000644000175000017500000000420310664630335024523 0ustar charlescharles/* * $Id: Counter.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters; /** * This interface is the interface implemented for all counter types. A Counter can * represent a real counter or a virtual counter that will be computed using one or * more other counters.
    *

    Real counters

    * are counters which represent real values. The user will call methods of such * counters to modify the associated value of the counter. *

    Computed counters

    * are computed using one or more associated counters. Such counters represent * operations computed on associated counters. Usually, these counters will never be * used directly, but will only used to retrieve the computed values. */ public interface Counter { /** * Accessor for the counter type. * * @return the type of the counter */ CounterFactory.Type getType(); /** * Accessor for the counter's name. * * @return the name of the counter */ String getName(); /** * Increment the counter's value by 1.0. * * @return the new value of the counter */ double increment(); /** * Increment the counter's value by the specified amount. * * @param value the amount to increment the counter by * @return the new value of the counter */ double incrementBy(double value); /** * Decrement the counter's value by 1.0. * * @return the new value of the counter */ double decrement(); /** * Set the counter's value to a new value. * * @param value the new value of the counter */ void setRawValue(double value); /** * Compute and return the value of the counter. * * @return the value of the counter */ double nextValue(); } mule-2.0.1/core/src/main/java/org/mule/util/CharSetUtils.java0000644000175000017500000000235010766457177023633 0ustar charlescharles/* * $Id$ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.io.ByteArrayOutputStream; import java.io.OutputStreamWriter; import java.lang.reflect.Method; import java.nio.charset.Charset; public class CharSetUtils extends org.apache.commons.lang.CharSetUtils { public static String defaultCharsetName() { try { if (SystemUtils.IS_JAVA_1_4) { return new OutputStreamWriter(new ByteArrayOutputStream()).getEncoding(); } else { Class target = Charset.class; Method defaultCharset = target.getMethod("defaultCharset", ArrayUtils.EMPTY_CLASS_ARRAY); Charset cs = (Charset) defaultCharset.invoke(target, (Class[]) null); return cs.name(); } } catch (Exception ex) { throw new Error(ex); } } } mule-2.0.1/core/src/main/java/org/mule/util/TimedSocket.java0000644000175000017500000000571210674366610023466 0ustar charlescharles/* * $Id: TimedSocket.java 8504 2007-09-20 03:48:24Z aguenther $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.io.IOException; import java.io.InterruptedIOException; import java.net.Socket; /** * This class implements a timeout feature on socket connections. */ public final class TimedSocket { private static final int WATCHDOG_FREQUENCY = 100; private TimedSocket() { // utility class only } /** * Creates a socket and waits until the given timeout is reached. * * @param host * @param port * @param timeout in milliseconds * @return Connected socket or null. * @throws InterruptedIOException * @throws IOException */ public static Socket createSocket(String host, int port, int timeout) throws IOException { SocketConnector connector = new SocketConnector(host, port); connector.start(); int timer = 0; while (!connector.isConnected()) { if (connector.hasException()) { throw (connector.getException()); } try { Thread.sleep(WATCHDOG_FREQUENCY); } catch (InterruptedException unexpectedInterruption) { throw new InterruptedIOException("Connection interruption: " + unexpectedInterruption.getMessage()); } timer += WATCHDOG_FREQUENCY; if (timer >= timeout) { throw new InterruptedIOException("Connection timeout on " + host + ":" + port + " after " + timer + " milliseconds"); } } return connector.getSocket(); } static class SocketConnector extends Thread { private volatile Socket connectedSocket; private String host; private int port; private IOException exception; public SocketConnector(String host, int port) { this.host = host; this.port = port; } public void run() { try { connectedSocket = new Socket(host, port); } catch (IOException ioe) { exception = ioe; } } public boolean isConnected() { return connectedSocket != null; } public boolean hasException() { return exception != null; } public Socket getSocket() { return connectedSocket; } public IOException getException() { return exception; } } } mule-2.0.1/core/src/main/java/org/mule/util/DateUtils.java0000644000175000017500000000535510664630335023151 0ustar charlescharles/* * $Id: DateUtils.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.config.i18n.CoreMessages; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Date; /** * DateUtils contains some useful methods dealing date/time * conversion, formatting etc. */ // @ThreadSafe public class DateUtils extends org.apache.commons.lang.time.DateUtils { public static String getTimeStamp(String format) { // Format the current time. SimpleDateFormat formatter = new SimpleDateFormat(format); Date currentTime = new Date(); return formatter.format(currentTime); } public static String formatTimeStamp(Date dateTime, String format) { // Format the current time. SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.format(dateTime); } public static String getStringFromDate(Date date, String format) { // converts from date to strin using the standard TIME_STAMP_FORMAT // pattern SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.format(date); } public static Date getDateFromString(String date, String format) { // The date must always be in the format of TIME_STAMP_FORMAT // i.e. JAN 29 2001 22:50:40 GMT SimpleDateFormat formatter = new SimpleDateFormat(format); ParsePosition pos = new ParsePosition(0); // Parse the string back into a Time Stamp. return formatter.parse(date, pos); } public static String getFormattedDuration(long mills) { long days = mills / 86400000; mills = mills - (days * 86400000); long hours = mills / 3600000; mills = mills - (hours * 3600000); long mins = mills / 60000; mills = mills - (mins * 60000); long secs = mills / 1000; mills = mills - (secs * 1000); StringBuffer bf = new StringBuffer(60); bf.append(days).append(" ").append(CoreMessages.days().getMessage()).append(", "); bf.append(hours).append(" ").append(CoreMessages.hours().getMessage()).append(", "); bf.append(mins).append(" ").append(CoreMessages.minutes().getMessage()).append(", "); bf.append(secs).append(".").append(mills).append(" ").append(CoreMessages.seconds().getMessage()); return bf.toString(); } } mule-2.0.1/core/src/main/java/org/mule/util/compression/0000755000175000017500000000000011351411130022721 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/compression/package.html0000644000175000017500000000014210204257011025201 0ustar charlescharles Compression support used by Mule transformers. mule-2.0.1/core/src/main/java/org/mule/util/compression/CompressionStrategy.java0000644000175000017500000000254010664630335027631 0ustar charlescharles/* * $Id: CompressionStrategy.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.compression; import java.io.IOException; /** * CompressionStrategy is a base interface for Different compression * strategies */ public interface CompressionStrategy { /** * The fully qualified class name of the fallback * CompressionStrategy implementation class to use, if no other * can be found. the default is * org.mule.util.compression.GZipCompression */ String COMPRESSION_DEFAULT = "org.mule.util.compression.GZipCompression"; /** * JDK1.3+ 'Service Provider' specification ( * http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html ) */ String SERVICE_ID = "META-INF/services/org.mule.util.compression.CompressionStrategy"; byte[] compressByteArray(byte[] bytes) throws IOException; byte[] uncompressByteArray(byte[] bytes) throws IOException; boolean isCompressed(byte[] bytes) throws IOException; } mule-2.0.1/core/src/main/java/org/mule/util/compression/CompressionException.java0000644000175000017500000000164710664630335027774 0ustar charlescharles/* * $Id: CompressionException.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.compression; import java.io.IOException; /** * CompressionException TODO document */ public class CompressionException extends IOException { /** * Serial version */ private static final long serialVersionUID = 8587532237749889185L; public CompressionException(String message) { super(message); } public CompressionException(String message, Throwable cause) { super(message); initCause(cause); } } mule-2.0.1/core/src/main/java/org/mule/util/compression/CompressionHelper.java0000644000175000017500000000433710664630335027254 0ustar charlescharles/* * $Id: CompressionHelper.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.compression; import org.mule.util.ClassUtils; import java.security.AccessController; import java.security.PrivilegedAction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * CompressionHelper a static class that provides facilities for * compressing and uncompressing byte arrays */ public final class CompressionHelper { /** * logger used by this class */ private static Log logger = LogFactory.getLog(CompressionHelper.class); private static CompressionStrategy defaultStrategy; /** Do not instanciate. */ private CompressionHelper () { // no-op } public static synchronized CompressionStrategy getDefaultCompressionStrategy() { if (defaultStrategy == null) { defaultStrategy = (CompressionStrategy) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { Object o = ClassUtils.loadClass(CompressionStrategy.COMPRESSION_DEFAULT, CompressionHelper.class).newInstance(); if (logger.isDebugEnabled()) { logger.debug("Found CompressionStrategy: " + o.getClass().getName()); } return o; } catch (Exception e) { // TODO MULE-863: What should we really do? Document this? logger.warn("Failed to build compression strategy: " + e.getMessage()); } return null; } }); } return defaultStrategy; } } mule-2.0.1/core/src/main/java/org/mule/util/compression/GZipCompression.java0000644000175000017500000001343410664630335026704 0ustar charlescharles/* * $Id: GZipCompression.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.compression; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * GZipCompression is a CompressionStrategy implementation using the * GZip library included in the JDK java.util.zip. This is the default * CompressionStrategy used by the CompressionHelper discovery when no other * implementation is discovered. */ public class GZipCompression implements CompressionStrategy { public static final int DEFAULT_BUFFER_SIZE = 32768; /** * The logger for this class */ private static final Log logger = LogFactory.getLog(GZipCompression.class); /** * Determines if a byte array is compressed. The java.util.zip GZip * implementaiton does not expose the GZip header so it is difficult to determine * if a string is compressed. * * @param bytes an array of bytes * @return true if the array is compressed or false otherwise * @throws java.io.IOException if the byte array couldn't be read */ public boolean isCompressed(byte[] bytes) throws IOException { if ((bytes == null) || (bytes.length < 2)) { return false; } else { return ((bytes[0] == (byte) (GZIPInputStream.GZIP_MAGIC)) && (bytes[1] == (byte) (GZIPInputStream.GZIP_MAGIC >> 8))); } } /** * Used for compressing a byte array into a new byte array using GZIP * * @param bytes An array of bytes to compress * @return a compressed byte array * @throws java.io.IOException if it fails to write to a GZIPOutputStream * @see java.util.zip.GZIPOutputStream */ public byte[] compressByteArray(byte[] bytes) throws IOException { // TODO add strict behaviour as option if (bytes == null || isCompressed(bytes)) { // nothing to compress if (logger.isDebugEnabled()) { logger.debug("Data already compressed; doing nothing"); } return bytes; } if (logger.isDebugEnabled()) { logger.debug("Compressing message of size: " + bytes.length); } ByteArrayOutputStream baos = null; GZIPOutputStream gzos = null; try { baos = new ByteArrayOutputStream(DEFAULT_BUFFER_SIZE); gzos = new GZIPOutputStream(baos); gzos.write(bytes, 0, bytes.length); gzos.finish(); gzos.close(); byte[] compressedByteArray = baos.toByteArray(); baos.close(); if (logger.isDebugEnabled()) { logger.debug("Compressed message to size: " + compressedByteArray.length); } return compressedByteArray; } catch (IOException ioex) { throw ioex; } finally { IOUtils.closeQuietly(gzos); IOUtils.closeQuietly(baos); } } /** * Used for uncompressing a byte array into a uncompressed byte array using GZIP * * @param bytes An array of bytes to uncompress * @return an uncompressed byte array * @throws java.io.IOException if it fails to read from a GZIPInputStream * @see java.util.zip.GZIPInputStream */ public byte[] uncompressByteArray(byte[] bytes) throws IOException { // TODO add strict behaviour as option if (!isCompressed(bytes)) { /* * if (strict) { // throw a specific exception here to allow users of * this method to // diffientiate between general IOExceptions and an * invalid format logger.warn("Data is not of type GZIP compressed." + " * The data may not have been compressed in the first place."); throw new * CompressionException("Not in GZIP format"); } */ // nothing to uncompress if (logger.isDebugEnabled()) { logger.debug("Data already uncompressed; doing nothing"); } return bytes; } if (logger.isDebugEnabled()) { logger.debug("Uncompressing message of size: " + bytes.length); } ByteArrayInputStream bais = null; GZIPInputStream gzis = null; ByteArrayOutputStream baos = null; try { bais = new ByteArrayInputStream(bytes); gzis = new GZIPInputStream(bais); baos = new ByteArrayOutputStream(DEFAULT_BUFFER_SIZE); IOUtils.copy(gzis, baos); gzis.close(); bais.close(); byte[] uncompressedByteArray = baos.toByteArray(); baos.close(); if (logger.isDebugEnabled()) { logger.debug("Uncompressed message to size: " + uncompressedByteArray.length); } return uncompressedByteArray; } catch (IOException ioex) { throw ioex; } finally { IOUtils.closeQuietly(gzis); IOUtils.closeQuietly(bais); IOUtils.closeQuietly(baos); } } } mule-2.0.1/core/src/main/java/org/mule/util/Multicaster.java0000644000175000017500000000713110664630335023541 0ustar charlescharles/* * $Id: Multicaster.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; /** * Multicaster is a utility that can call a given method on a * collection of objects that implement one or more common interfaces. The create * method returns a proxy that can be cast to any of the the interfaces passed and be * used like a single object. */ // @ThreadSafe public final class Multicaster { /** Do not instanciate. */ private Multicaster () { // no-op } public static Object create(Class theInterface, Collection objects) { return create(new Class[]{theInterface}, objects); } public static Object create(Class theInterface, Collection objects, InvokeListener listener) { return create(new Class[]{theInterface}, objects, listener); } public static Object create(Class[] interfaces, Collection objects) { return create(interfaces, objects, null); } public static Object create(Class[] interfaces, Collection objects, InvokeListener listener) { return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new CastingHandler(objects, listener)); } private static class CastingHandler implements InvocationHandler { private final Collection objects; private final InvokeListener listener; public CastingHandler(Collection objects) { this(objects, null); } public CastingHandler(Collection objects, InvokeListener listener) { this.objects = objects; this.listener = listener; } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { List results = new ArrayList(); Object item = null; Object result; for (Iterator iterator = objects.iterator(); iterator.hasNext();) { try { item = iterator.next(); result = method.invoke(item, args); if (listener != null) { listener.afterExecute(item, method, args); } if (result != null) { results.add(result); } } catch (Throwable t) { // TODO MULE-863: What should we do if null? if (listener != null) { t = listener.onException(item, method, args, t); if (t != null) { throw t; } } } } return results; } } public static interface InvokeListener { void afterExecute(Object object, Method method, Object[] args); Throwable onException(Object object, Method method, Object[] args, Throwable t); } } mule-2.0.1/core/src/main/java/org/mule/util/ArrayUtils.java0000644000175000017500000001147410746275214023353 0ustar charlescharles/* * $Id: ArrayUtils.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.lang.reflect.Array; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; // @ThreadSafe public class ArrayUtils extends org.apache.commons.lang.ArrayUtils { /** * Like {@link #toString(Object)} but considers at most maxElements * values; overflow is indicated by an appended "[..]" ellipsis. */ public static String toString(Object array, int maxElements) { String result; Class componentType = array.getClass().getComponentType(); if (Object.class.isAssignableFrom(componentType)) { result = ArrayUtils.toString((ArrayUtils.subarray((Object[]) array, 0, maxElements))); } else if (componentType.equals(Boolean.TYPE)) { result = ArrayUtils.toString((ArrayUtils.subarray((boolean[]) array, 0, maxElements))); } else if (componentType.equals(Byte.TYPE)) { result = ArrayUtils.toString((ArrayUtils.subarray((byte[]) array, 0, maxElements))); } else if (componentType.equals(Character.TYPE)) { result = ArrayUtils.toString((ArrayUtils.subarray((char[]) array, 0, maxElements))); } else if (componentType.equals(Short.TYPE)) { result = ArrayUtils.toString((ArrayUtils.subarray((short[]) array, 0, maxElements))); } else if (componentType.equals(Integer.TYPE)) { result = ArrayUtils.toString((ArrayUtils.subarray((int[]) array, 0, maxElements))); } else if (componentType.equals(Long.TYPE)) { result = ArrayUtils.toString((ArrayUtils.subarray((long[]) array, 0, maxElements))); } else if (componentType.equals(Float.TYPE)) { result = ArrayUtils.toString((ArrayUtils.subarray((float[]) array, 0, maxElements))); } else if (componentType.equals(Double.TYPE)) { result = ArrayUtils.toString((ArrayUtils.subarray((double[]) array, 0, maxElements))); } else { throw new IllegalArgumentException("Unknown array service type: " + componentType.getName()); } if (Array.getLength(array) > maxElements) { StringBuffer buf = new StringBuffer(result); buf.insert(buf.length() - 1, " [..]"); result = buf.toString(); } return result; } /** * Creates a copy of the given array, but with the given Class as * element type. Useful for arrays of objects that implement multiple interfaces * and a "typed view" onto these objects is required. * * @param objects the array of objects * @param clazz the desired service type of the new array * @return null when objects is null, or a new * array containing the elements of the source array which is typed to * the given clazz parameter. If clazz is * already the service type of the source array, the source array is * returned (i.e. no copy is created). * @throws IllegalArgumentException if the clazz argument is * null. * @throws ArrayStoreException if the elements in objects cannot * be cast to clazz. */ public static Object[] toArrayOfComponentType(Object[] objects, Class clazz) { if (objects == null || objects.getClass().getComponentType().equals(clazz)) { return objects; } if (clazz == null) { throw new IllegalArgumentException("Array target class must not be null"); } Object[] result = (Object[]) Array.newInstance(clazz, objects.length); System.arraycopy(objects, 0, result, 0, objects.length); return result; } public static Object[] setDifference(Object[] a, Object[] b) { Collection aCollecn = new HashSet(Arrays.asList(a)); Collection bCollecn = Arrays.asList(b); aCollecn.removeAll(bCollecn); return aCollecn.toArray(); } public static String[] setDifference(String[] a, String[] b) { Object[] ugly = setDifference((Object[])a, b); String[] copy = new String[ugly.length]; System.arraycopy(ugly, 0, copy, 0, ugly.length); return copy; } } mule-2.0.1/core/src/main/java/org/mule/util/TemplateParser.java0000644000175000017500000001724510770575360024210 0ustar charlescharles/* * $Id: TemplateParser.java 11460 2008-03-21 00:01:52Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * TemplateParser is a simple string parser that will substitute * tokens in a string with values supplied in a Map. */ public final class TemplateParser { public static final String ANT_TEMPLATE_STYLE = "ant"; public static final String SQUARE_TEMPLATE_STYLE = "square"; public static final String CURLY_TEMPLATE_STYLE = "curly"; /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(TemplateParser.class); private final Pattern pattern; private final int pre; private final int post; private final String style; public static TemplateParser createAntStyleParser() { return new TemplateParser(ANT_TEMPLATE_STYLE); } public static TemplateParser createSquareBracesStyleParser() { return new TemplateParser(SQUARE_TEMPLATE_STYLE); } public static TemplateParser createCurlyBracesStyleParser() { return new TemplateParser(CURLY_TEMPLATE_STYLE); } private TemplateParser(String style) { if (ANT_TEMPLATE_STYLE.equals(style)) { pattern = Pattern.compile("\\$\\{[^\\}]+\\}"); pre = 2; post = 1; } else if (SQUARE_TEMPLATE_STYLE.equals(style)) { pattern = Pattern.compile("\\[[^\\]]+\\]"); pre = 1; post = 1; } else if (CURLY_TEMPLATE_STYLE.equals(style)) { pattern = Pattern.compile("\\{[^\\}]+\\}"); pre = 1; post = 1; } else { throw new IllegalArgumentException("Unknown template style: " + style); } this.style = style; } /** * Matches one or more templates against a Map of key value pairs. If a value for * a template is not found in the map the template is left as is in the return * String * * @param props the key/value pairs to match against * @param template the string containing the template place holders i.e. My name * is ${name} * @return the parsed String */ public String parse(Map props, String template) { return parse(props, template, null); } /** * Matches one or more templates against a Map of key value pairs. If a value for * a template is not found in the map the template is left as is in the return * String * * @param callback a callback used to resolve the property name * @param template the string containing the template place holders i.e. My name * is ${name} * @return the parsed String */ public String parse(TemplateCallback callback, String template) { return parse(null, template, callback); } protected String parse(Map props, String template, TemplateCallback callback) { String result = template; Matcher m = pattern.matcher(template); while (m.find()) { Object value = null; String match = m.group(); String propname = match.substring(pre, match.length() - post); if (callback != null) { value = callback.match(propname); } else if (props != null) { value = props.get(propname); } if (value == null) { if (logger.isDebugEnabled()) { logger.debug("Value " + propname + " not found in context"); } } else { String matchRegex = escape(match); String valueString = value.toString(); if (valueString.indexOf('\\') != -1) { valueString = valueString.replaceAll("\\\\", "\\\\\\\\"); } result = result.replaceAll(matchRegex, valueString); } } return result; } /** * Matches one or more templates against a Map of key value pairs. If a value for * a template is not found in the map the template is left as is in the return * String * * @param props the key/value pairs to match against * @param templates A List of templates * @return the parsed String */ public List parse(Map props, List templates) { if (templates == null) { return new ArrayList(); } List list = new ArrayList(templates.size()); for (Iterator iterator = templates.iterator(); iterator.hasNext();) { list.add(parse(props, iterator.next().toString())); } return list; } /** * Matches one or more templates against a Map of key value pairs. If a value for * a template is not found in the map the template is left as is in the return * String * * @param props the key/value pairs to match against * @param templates A Map of templates. The values for each map entry will be * parsed * @return the parsed String */ public Map parse(final Map props, Map templates) { return parse(new TemplateCallback(){ public Object match(String token) { return props.get(token); } }, templates); } public Map parse(TemplateCallback callback, Map templates) { if (templates == null) { return new HashMap(); } Map map = new HashMap(templates.size()); Map.Entry entry; for (Iterator iterator = templates.entrySet().iterator(); iterator.hasNext();) { entry = (Map.Entry) iterator.next(); map.put(entry.getKey(), parse(callback, entry.getValue().toString())); } return map; } private String escape(String string) { int length = string.length(); if (length == 0) { // nothing to do return string; } else { StringBuffer buffer = new StringBuffer(length * 2); for (int i = 0; i < length; i++) { char currentCharacter = string.charAt(i); switch (currentCharacter) { case '[' : case ']' : case '{' : case '}' : case '$' : buffer.append("\\"); // fall through to append original character default : buffer.append(currentCharacter); } } return buffer.toString(); } } public String getStyle() { return style; } public boolean isContainsTemplate(String value) { if(value==null) return false; Matcher m = pattern.matcher(value); return m.find(); } public static interface TemplateCallback { Object match(String token); } } mule-2.0.1/core/src/main/java/org/mule/util/UUID.java0000644000175000017500000000147310723034704022010 0ustar charlescharles/* * $Id: UUID.java 9905 2007-11-27 15:37:40Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.safehaus.uuid.UUIDGenerator; /** * UUID Generates a UUID using the JUG library */ // @ThreadSafe public final class UUID { private static final UUIDGenerator generator = UUIDGenerator.getInstance(); private UUID() { // no go } public static String getUUID() { return generator.generateTimeBasedUUID().toString(); } } mule-2.0.1/core/src/main/java/org/mule/util/xa/0000755000175000017500000000000011351411126020775 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/xa/package.html0000644000175000017500000000020610240602467023262 0ustar charlescharles Mule An abstract resource manager that supports local and xa transactions. mule-2.0.1/core/src/main/java/org/mule/util/xa/DefaultXASession.java0000644000175000017500000002554310664630335025045 0ustar charlescharles/* * $Id: DefaultXASession.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.xa; import javax.transaction.Status; import javax.transaction.xa.XAException; import javax.transaction.xa.XAResource; import javax.transaction.xa.Xid; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * TODO document */ public class DefaultXASession implements XAResource { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); protected AbstractTransactionContext localContext; protected Xid localXid; protected AbstractXAResourceManager resourceManager; public DefaultXASession(AbstractXAResourceManager resourceManager) { this.localContext = null; this.localXid = null; this.resourceManager = resourceManager; } public XAResource getXAResource() { return this; } public Object getResourceManager() { return resourceManager; } // // Local transaction implementation // public void begin() throws ResourceManagerException { if (localXid != null) { throw new IllegalStateException( "Cannot start local transaction. An XA transaction is already in progress."); } if (localContext != null) { throw new IllegalStateException( "Cannot start local transaction. A local transaction already in progress."); } localContext = resourceManager.createTransactionContext(this); resourceManager.beginTransaction(localContext); } public void commit() throws ResourceManagerException { if (localXid != null) { throw new IllegalStateException( "Cannot commit local transaction as an XA transaction is in progress."); } if (localContext == null) { throw new IllegalStateException("Cannot commit local transaction as no transaction was begun"); } resourceManager.commitTransaction(localContext); localContext = null; } public void rollback() throws ResourceManagerException { if (localXid != null) { throw new IllegalStateException( "Cannot rollback local transaction as an XA transaction is in progress."); } if (localContext == null) { throw new IllegalStateException("Cannot commit local transaction as no transaction was begun"); } resourceManager.rollbackTransaction(localContext); localContext = null; } // // XAResource implementation // public boolean isSameRM(XAResource xares) throws XAException { return xares instanceof DefaultXASession && ((DefaultXASession) xares).getResourceManager().equals(resourceManager); } public Xid[] recover(int flag) throws XAException { return null; } public void start(Xid xid, int flags) throws XAException { if (logger.isDebugEnabled()) { logger.debug(new StringBuffer(128).append("Thread ").append(Thread.currentThread()).append( flags == TMNOFLAGS ? " starts" : flags == TMJOIN ? " joins" : " resumes").append( " work on behalf of transaction branch ").append(xid).toString()); } // A local transaction is already begun if (this.localContext != null) { throw new XAException(XAException.XAER_PROTO); } // This session has already been associated with an xid if (this.localXid != null) { throw new XAException(XAException.XAER_PROTO); } switch (flags) { // a new transaction case TMNOFLAGS : case TMJOIN : default : try { localContext = resourceManager.createTransactionContext(this); resourceManager.beginTransaction(localContext); } catch (Exception e) { // TODO MULE-863: Is logging necessary? logger.error("Could not create new transactional resource", e); throw (XAException) new XAException(e.getMessage()).initCause(e); } break; case TMRESUME : localContext = resourceManager.getSuspendedTransactionalResource(xid); if (localContext == null) { throw new XAException(XAException.XAER_NOTA); } // TODO: resume context resourceManager.removeSuspendedTransactionalResource(xid); break; } localXid = xid; resourceManager.addActiveTransactionalResource(localXid, localContext); } public void end(Xid xid, int flags) throws XAException { if (logger.isDebugEnabled()) { logger.debug(new StringBuffer(128).append("Thread ").append(Thread.currentThread()).append( flags == TMSUSPEND ? " suspends" : flags == TMFAIL ? " fails" : " ends").append( " work on behalf of transaction branch ").append(xid).toString()); } // No transaction is already begun if (localContext == null) { throw new XAException(XAException.XAER_NOTA); } // This session has already been associated with an xid if (localXid == null || !localXid.equals(xid)) { throw new XAException(XAException.XAER_PROTO); } try { switch (flags) { case TMSUSPEND : // TODO: suspend context resourceManager.addSuspendedTransactionalResource(localXid, localContext); resourceManager.removeActiveTransactionalResource(localXid); break; case TMFAIL : resourceManager.setTransactionRollbackOnly(localContext); break; case TMSUCCESS : // no-op default : // no-op break; } } catch (ResourceManagerException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } localXid = null; localContext = null; } public void commit(Xid xid, boolean onePhase) throws XAException { if (xid == null) { throw new XAException(XAException.XAER_PROTO); } AbstractTransactionContext context = resourceManager.getActiveTransactionalResource(xid); if (context == null) { throw new XAException(XAException.XAER_NOTA); } if (logger.isDebugEnabled()) { logger.debug("Committing transaction branch " + xid); } if (context.status == Status.STATUS_MARKED_ROLLBACK) { throw new XAException(XAException.XA_RBROLLBACK); } try { if (context.status != Status.STATUS_PREPARED) { if (onePhase) { resourceManager.prepareTransaction(context); } else { throw new XAException(XAException.XAER_PROTO); } } resourceManager.commitTransaction(context); } catch (ResourceManagerException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } resourceManager.removeActiveTransactionalResource(xid); resourceManager.removeSuspendedTransactionalResource(xid); } public void rollback(Xid xid) throws XAException { if (xid == null) { throw new XAException(XAException.XAER_PROTO); } AbstractTransactionContext context = resourceManager.getActiveTransactionalResource(xid); if (context == null) { throw new XAException(XAException.XAER_NOTA); } if (logger.isDebugEnabled()) { logger.debug("Rolling back transaction branch " + xid); } try { resourceManager.rollbackTransaction(context); } catch (ResourceManagerException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } resourceManager.removeActiveTransactionalResource(xid); resourceManager.removeSuspendedTransactionalResource(xid); } public int prepare(Xid xid) throws XAException { if (xid == null) { throw new XAException(XAException.XAER_PROTO); } AbstractTransactionContext context = resourceManager.getTransactionalResource(xid); if (context == null) { throw new XAException(XAException.XAER_NOTA); } if (logger.isDebugEnabled()) { logger.debug("Preparing transaction branch " + xid); } if (context.status == Status.STATUS_MARKED_ROLLBACK) { throw new XAException(XAException.XA_RBROLLBACK); } try { return resourceManager.prepareTransaction(context); } catch (ResourceManagerException e) { throw (XAException) new XAException(XAException.XAER_RMERR).initCause(e); } } public void forget(Xid xid) throws XAException { if (logger.isDebugEnabled()) { logger.debug("Forgetting transaction branch " + xid); } AbstractTransactionContext context = resourceManager.getTransactionalResource(xid); if (context == null) { throw new XAException(XAException.XAER_NOTA); } resourceManager.removeActiveTransactionalResource(xid); resourceManager.removeSuspendedTransactionalResource(xid); } /* * (non-Javadoc) * * @see javax.transaction.xa.XAResource#getDefaultTransactionTimeout() */ public int getTransactionTimeout() throws XAException { return (int)(resourceManager.getDefaultTransactionTimeout() / 1000); } /* * (non-Javadoc) * * @see javax.transaction.xa.XAResource#setDefaultTransactionTimeout(int) */ public boolean setTransactionTimeout(int timeout) throws XAException { resourceManager.setDefaultTransactionTimeout(timeout * 1000); return false; } } mule-2.0.1/core/src/main/java/org/mule/util/xa/ResourceManagerException.java0000644000175000017500000000231010745677442026622 0ustar charlescharles/* * $Id: ResourceManagerException.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.xa; import org.mule.api.MuleException; import org.mule.config.i18n.Message; public class ResourceManagerException extends MuleException { /** * Serial version */ private static final long serialVersionUID = -2710661653314559260L; /** * */ public ResourceManagerException() { super(); } /** * @param message */ public ResourceManagerException(Message message) { super(message); } /** * @param cause */ public ResourceManagerException(Throwable cause) { super(cause); } /** * @param message * @param cause */ public ResourceManagerException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/util/xa/AbstractTransactionContext.java0000644000175000017500000000521010664630335027167 0ustar charlescharles/* * $Id: AbstractTransactionContext.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.xa; import javax.transaction.Status; import org.safehaus.uuid.UUIDGenerator; public class AbstractTransactionContext { private static UUIDGenerator gen = UUIDGenerator.getInstance(); protected String id = gen.generateTimeBasedUUID().toString(); protected long timeout; protected int status; protected boolean readOnly; protected boolean suspended; protected boolean finished; public AbstractTransactionContext() { status = Status.STATUS_NO_TRANSACTION; suspended = false; finished = false; readOnly = true; } public String toString() { StringBuffer sb = new StringBuffer(); sb.append(id).append("["); sb.append(getStatusString()); if (suspended) { sb.append(", suspended"); } if (readOnly) { sb.append(", readonly"); } if (finished) { sb.append(", finished"); } sb.append("]"); return sb.toString(); } private String getStatusString() { switch (status) { case Status.STATUS_ACTIVE : return "active"; case Status.STATUS_MARKED_ROLLBACK : return "marked rollback"; case Status.STATUS_PREPARED : return "prepared"; case Status.STATUS_COMMITTED : return "committed"; case Status.STATUS_ROLLEDBACK : return "rolled back"; case Status.STATUS_UNKNOWN : return "unknown"; case Status.STATUS_NO_TRANSACTION : return "no transaction"; case Status.STATUS_PREPARING : return "preparing"; case Status.STATUS_COMMITTING : return "committing"; case Status.STATUS_ROLLING_BACK : return "rolling back"; default : return "undefined status"; } } public synchronized void finalCleanUp() throws ResourceManagerException { // nothing to do (yet?) } public synchronized void notifyFinish() { finished = true; notifyAll(); } } mule-2.0.1/core/src/main/java/org/mule/util/xa/AbstractResourceManager.java0000644000175000017500000003413310664630335026425 0ustar charlescharles/* * $Id: AbstractResourceManager.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.xa; import org.mule.config.i18n.CoreMessages; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import javax.transaction.Status; import org.apache.commons.logging.Log; /** * This code is based on code coming from the commons-transaction * project. */ public abstract class AbstractResourceManager { /** * Shutdown mode: Wait for all transactions to complete */ public static final int SHUTDOWN_MODE_NORMAL = 0; /** * Shutdown mode: Try to roll back all active transactions */ public static final int SHUTDOWN_MODE_ROLLBACK = 1; /** * Shutdown mode: Try to stop active transaction NOW, do no rollbacks */ public static final int SHUTDOWN_MODE_KILL = 2; protected static final int OPERATION_MODE_STOPPED = 0; protected static final int OPERATION_MODE_STOPPING = 1; protected static final int OPERATION_MODE_STARTED = 2; protected static final int OPERATION_MODE_STARTING = 3; protected static final int OPERATION_MODE_RECOVERING = 4; protected static final int DEFAULT_TIMEOUT_MSECS = 5000; protected static final int DEFAULT_COMMIT_TIMEOUT_FACTOR = 2; protected Collection globalTransactions = Collections.synchronizedCollection(new ArrayList()); protected int operationMode = OPERATION_MODE_STOPPED; protected long defaultTimeout = DEFAULT_TIMEOUT_MSECS; protected Log logger = getLogger(); protected boolean dirty = false; protected abstract Log getLogger(); public synchronized void start() throws ResourceManagerSystemException { logger.info("Starting ResourceManager"); operationMode = OPERATION_MODE_STARTING; // TODO: recover and sync doStart(); recover(); // sync(); operationMode = OPERATION_MODE_STARTED; if (dirty) { logger .warn("Started ResourceManager, but in dirty mode only (Recovery of pending transactions failed)"); } else { logger.info("Started ResourceManager"); } } protected void doStart() throws ResourceManagerSystemException { // template method } protected void recover() throws ResourceManagerSystemException { // nothing to do (yet?) } public synchronized void stop() throws ResourceManagerSystemException { stop(SHUTDOWN_MODE_NORMAL); } public synchronized boolean stop(int mode) throws ResourceManagerSystemException { return stop(mode, getDefaultTransactionTimeout() * DEFAULT_COMMIT_TIMEOUT_FACTOR); } public synchronized boolean stop(int mode, long timeOut) throws ResourceManagerSystemException { logger.info("Stopping ResourceManager"); operationMode = OPERATION_MODE_STOPPING; // TODO: sync // sync(); boolean success = shutdown(mode, timeOut); // TODO: release // releaseGlobalOpenResources(); if (success) { operationMode = OPERATION_MODE_STOPPED; logger.info("Stopped ResourceManager"); } else { logger.warn("Failed to stop ResourceManager"); } return success; } protected boolean shutdown(int mode, long timeoutMSecs) { switch (mode) { case SHUTDOWN_MODE_NORMAL : return waitForAllTxToStop(timeoutMSecs); case SHUTDOWN_MODE_ROLLBACK : throw new UnsupportedOperationException(); // return rollBackOrForward(); case SHUTDOWN_MODE_KILL : return true; default : return false; } } /** * Gets the default transaction timeout in milliseconds. */ public long getDefaultTransactionTimeout() { return defaultTimeout; } /** * Sets the default transaction timeout. * * @param timeout timeout in milliseconds */ public void setDefaultTransactionTimeout(long timeout) { defaultTimeout = timeout; } /** * Starts a new transaction and associates it with the current thread. All * subsequent changes in the same thread made to the map are invisible from other * threads until {@link #commitTransaction()} is called. Use * {@link #rollbackTransaction()} to discard your changes. After calling either * method there will be no transaction associated to the current thread any * longer.
    *
    * Caution: Be careful to finally call one of those methods, as * otherwise the transaction will lurk around for ever. * * @see #prepareTransaction() * @see #commitTransaction() * @see #rollbackTransaction() */ public AbstractTransactionContext startTransaction(Object session) throws ResourceManagerException { return createTransactionContext(session); } public void beginTransaction(AbstractTransactionContext context) throws ResourceManagerException { // can only start a new transaction when not already stopping assureStarted(); synchronized (context) { if (logger.isDebugEnabled()) { logger.debug("Beginning transaction " + context); } doBegin(context); context.status = Status.STATUS_ACTIVE; if (logger.isDebugEnabled()) { logger.debug("Began transaction " + context); } } globalTransactions.add(context); } public int prepareTransaction(AbstractTransactionContext context) throws ResourceManagerException { assureReady(); synchronized (context) { if (logger.isDebugEnabled()) { logger.debug("Preparing transaction " + context); } context.status = Status.STATUS_PREPARING; int status = doPrepare(context); context.status = Status.STATUS_PREPARED; if (logger.isDebugEnabled()) { logger.debug("Prepared transaction " + context); } return status; } } public void rollbackTransaction(AbstractTransactionContext context) throws ResourceManagerException { assureReady(); synchronized (context) { if (logger.isDebugEnabled()) { logger.debug("Rolling back transaction " + context); } try { context.status = Status.STATUS_ROLLING_BACK; doRollback(context); context.status = Status.STATUS_ROLLEDBACK; } catch (Error e) { setDirty(context, e); throw e; } catch (RuntimeException e) { setDirty(context, e); throw e; } catch (ResourceManagerSystemException e) { setDirty(context, e); throw e; } finally { globalTransactions.remove(context); context.finalCleanUp(); // tell shutdown thread this tx is finished context.notifyFinish(); } if (logger.isDebugEnabled()) { logger.debug("Rolled back transaction " + context); } } } public void setTransactionRollbackOnly(AbstractTransactionContext context) throws ResourceManagerException { context.status = Status.STATUS_MARKED_ROLLBACK; } public void commitTransaction(AbstractTransactionContext context) throws ResourceManagerException { assureReady(); if (context.status == Status.STATUS_MARKED_ROLLBACK) { throw new ResourceManagerException(CoreMessages.transactionMarkedForRollback()); } synchronized (context) { if (logger.isDebugEnabled()) { logger.debug("Committing transaction " + context); } try { context.status = Status.STATUS_COMMITTING; doCommit(context); context.status = Status.STATUS_COMMITTED; } catch (Error e) { setDirty(context, e); throw e; } catch (RuntimeException e) { setDirty(context, e); throw e; } catch (ResourceManagerSystemException e) { setDirty(context, e); throw e; } catch (ResourceManagerException e) { logger.warn("Could not commit tx " + context + ", rolling back instead", e); doRollback(context); } finally { globalTransactions.remove(context); context.finalCleanUp(); // tell shutdown thread this tx is finished context.notifyFinish(); } if (logger.isDebugEnabled()) { logger.debug("Committed transaction " + context); } } } protected abstract AbstractTransactionContext createTransactionContext(Object session); protected abstract void doBegin(AbstractTransactionContext context); protected abstract int doPrepare(AbstractTransactionContext context); protected abstract void doCommit(AbstractTransactionContext context) throws ResourceManagerException; protected abstract void doRollback(AbstractTransactionContext context) throws ResourceManagerException; // TODO // protected boolean rollBackOrForward() { // } protected boolean waitForAllTxToStop(long timeoutMSecs) { long startTime = System.currentTimeMillis(); // be sure not to lock globalTransactions for too long, as we need to // give // txs the chance to complete (otherwise deadlocks are very likely to // occur) // instead iterate over a copy as we can be sure no new txs will be // registered // after operation level has been set to stopping Collection transactionsToStop; synchronized (globalTransactions) { transactionsToStop = new ArrayList(globalTransactions); } for (Iterator it = transactionsToStop.iterator(); it.hasNext();) { long remainingTimeout = startTime - System.currentTimeMillis() + timeoutMSecs; if (remainingTimeout <= 0) { return false; } AbstractTransactionContext context = (AbstractTransactionContext) it.next(); synchronized (context) { if (!context.finished) { logger.info("Waiting for tx " + context + " to finish for " + remainingTimeout + " milli seconds"); } while (!context.finished && remainingTimeout > 0) { try { context.wait(remainingTimeout); } catch (InterruptedException e) { return false; } remainingTimeout = startTime - System.currentTimeMillis() + timeoutMSecs; } if (context.finished) { logger.info("Tx " + context + " finished"); } else { logger.warn("Tx " + context + " failed to finish in given time"); } } } return (globalTransactions.size() == 0); } /** * Flag this resource manager as dirty. No more operations will be allowed until * a recovery has been successfully performed. * * @param context * @param t */ protected void setDirty(AbstractTransactionContext context, Throwable t) { logger.error("Fatal error during critical commit/rollback of transaction " + context + ", setting resource manager to dirty.", t); dirty = true; } /** * Check that the FileManager is started. * * @throws FileManagerSystemException if the FileManager is not started. */ protected void assureStarted() throws ResourceManagerSystemException { if (operationMode != OPERATION_MODE_STARTED) { throw new ResourceManagerSystemException(CoreMessages.resourceManagerNotStarted()); } // do not allow any further writing or commit or rollback when db is // corrupt if (dirty) { throw new ResourceManagerSystemException(CoreMessages.resourceManagerDirty()); } } /** * Check that the FileManager is ready. * * @throws FileManagerSystemException if the FileManager is neither started not * stopping. */ protected void assureReady() throws ResourceManagerSystemException { if (operationMode != OPERATION_MODE_STARTED && operationMode != OPERATION_MODE_STOPPING) { throw new ResourceManagerSystemException(CoreMessages.resourceManagerNotReady()); } // do not allow any further writing or commit or rollback when db is // corrupt if (dirty) { throw new ResourceManagerSystemException(CoreMessages.resourceManagerDirty()); } } } mule-2.0.1/core/src/main/java/org/mule/util/xa/AbstractXAResourceManager.java0000644000175000017500000000373710664630335026664 0ustar charlescharles/* * $Id: AbstractXAResourceManager.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.xa; import java.util.HashMap; import java.util.Map; import javax.transaction.xa.Xid; public abstract class AbstractXAResourceManager extends AbstractResourceManager { protected Map suspendedContexts = new HashMap(); protected Map activeContexts = new HashMap(); public AbstractXAResourceManager() { super(); } protected boolean includeBranchInXid() { return true; } AbstractTransactionContext getTransactionalResource(Xid xid) { AbstractTransactionContext context = getActiveTransactionalResource(xid); if (context != null) { return context; } else { return getSuspendedTransactionalResource(xid); } } AbstractTransactionContext getActiveTransactionalResource(Xid xid) { return (AbstractTransactionContext) activeContexts.get(xid); } AbstractTransactionContext getSuspendedTransactionalResource(Xid xid) { return (AbstractTransactionContext) suspendedContexts.get(xid); } void addActiveTransactionalResource(Xid xid, AbstractTransactionContext context) { activeContexts.put(xid, context); } void addSuspendedTransactionalResource(Xid xid, AbstractTransactionContext context) { suspendedContexts.put(xid, context); } void removeActiveTransactionalResource(Xid xid) { activeContexts.remove(xid); } void removeSuspendedTransactionalResource(Xid xid) { suspendedContexts.remove(xid); } } mule-2.0.1/core/src/main/java/org/mule/util/xa/ResourceManagerSystemException.java0000644000175000017500000000232510664630335030023 0ustar charlescharles/* * $Id: ResourceManagerSystemException.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.xa; import org.mule.config.i18n.Message; public class ResourceManagerSystemException extends ResourceManagerException { /** * Serial version */ private static final long serialVersionUID = 1202058044460490597L; /** * */ public ResourceManagerSystemException() { super(); } /** * @param message */ public ResourceManagerSystemException(Message message) { super(message); } /** * @param cause */ public ResourceManagerSystemException(Throwable cause) { super(cause); } /** * @param message * @param cause */ public ResourceManagerSystemException(Message message, Throwable cause) { super(message, cause); } } mule-2.0.1/core/src/main/java/org/mule/util/NetworkUtils.java0000644000175000017500000000334310674366610023723 0ustar charlescharles/* * $Id: NetworkUtils.java 8504 2007-09-20 03:48:24Z aguenther $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.net.Socket; import java.net.URL; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public final class NetworkUtils { private static final Log logger = LogFactory.getLog(NetworkUtils.class); private NetworkUtils() { // utility class only } public static boolean isServerReachable(URL url, int timeout) { int port = url.getPort() != -1 ? url.getPort() : url.getDefaultPort(); return isServerReachable(url.getHost(), port, timeout); } public static boolean isServerReachable(String host, int port, int timeout) { boolean isServerReachable = false; Socket socket = null; try { socket = TimedSocket.createSocket(host, port, timeout); isServerReachable = true; } catch (Exception e) { logger.debug("Server at " + host + ":" + port + " not reachable. " + e.getMessage()); try { if (socket != null) { socket.close(); } } catch (Exception socketNotClosed) { logger.debug(socketNotClosed); } } return isServerReachable; } } mule-2.0.1/core/src/main/java/org/mule/util/MuleLogger.java0000644000175000017500000000664110664630335023314 0ustar charlescharles/* * $Id: MuleLogger.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.util.Arrays; import java.util.List; import org.apache.commons.logging.Log; /** * A {@link Log} wrapper that supports boilerplate logging for high impact messages */ // @Immutable public class MuleLogger implements Log { private final Log logger; public MuleLogger(Log logger) { if (logger == null) { throw new IllegalArgumentException("logger may not be null"); } this.logger = logger; } public boolean isDebugEnabled() { return logger.isDebugEnabled(); } public boolean isErrorEnabled() { return logger.isErrorEnabled(); } public boolean isFatalEnabled() { return logger.isFatalEnabled(); } public boolean isInfoEnabled() { return logger.isInfoEnabled(); } public boolean isTraceEnabled() { return logger.isTraceEnabled(); } public boolean isWarnEnabled() { return logger.isWarnEnabled(); } public void trace(Object o) { logger.trace(o); } public void trace(Object o, Throwable throwable) { logger.trace(o, throwable); } public void debug(Object o) { logger.debug(o); } public void debug(Object o, Throwable throwable) { logger.debug(o, throwable); } public void info(Object o) { logger.info(o); } public void info(Object o, Throwable throwable) { logger.info(o, throwable); } public void warn(Object o) { logger.warn(o); } public void warn(Object o, Throwable throwable) { logger.warn(o, throwable); } public void error(Object o) { logger.error(o); } public void error(Object o, Throwable throwable) { logger.error(o, throwable); } public void fatal(Object o) { logger.fatal(o); } public void fatal(Object o, Throwable throwable) { logger.fatal(o, throwable); } public void boilerPlate(String message) { boilerPlate(message, '*', StringMessageUtils.DEFAULT_MESSAGE_WIDTH); } public void logBoilerPlate(List messages) { boilerPlate(messages, '*', StringMessageUtils.DEFAULT_MESSAGE_WIDTH); } public void logBoilerPlate(String[] messages) { boilerPlate(Arrays.asList(messages), '*', StringMessageUtils.DEFAULT_MESSAGE_WIDTH); } public void boilerPlate(String message, char c, int maxlength) { if (logger.isInfoEnabled()) { logger.info("\n" + StringMessageUtils.getBoilerPlate(message, c, maxlength)); } } public void boilerPlate(List messages, char c, int maxlength) { if (logger.isInfoEnabled()) { logger.info("\n" + StringMessageUtils.getBoilerPlate(messages, c, maxlength)); } } public void boilerPlate(String[] messages, char c, int maxlength) { boilerPlate(Arrays.asList(messages), c, maxlength); } } mule-2.0.1/core/src/main/java/org/mule/util/MuleUrlStreamHandlerFactory.java0000644000175000017500000001025610746416636026645 0ustar charlescharles/* * $Id: MuleUrlStreamHandlerFactory.java 10540 2008-01-25 17:34:22Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.net.URL; import java.net.URLStreamHandler; import java.net.URLStreamHandlerFactory; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * A factory for loading URL protocol handlers. This factory is necessary to make * Mule work in cases where the standard approach using system properties does not * work, e.g. in application servers or with maven's surefire tests. *

    * Client classes can register a subclass of {@link URLStreamHandler} for a given * protocol. This implementation first checks its registered handlers before * resorting to the default mechanism. *

    * @see java.net.URL#URL(String, String, int, String) */ public class MuleUrlStreamHandlerFactory extends Object implements URLStreamHandlerFactory { private static final String HANDLER_PKGS_SYSTEM_PROPERTY = "java.protocol.handler.pkgs"; private static final Log log = LogFactory.getLog(MuleUrlStreamHandlerFactory.class); private static Map registry = Collections.synchronizedMap(new HashMap()); /** * Install an instance of this class as UrlStreamHandlerFactory. This may be done exactly * once as {@link URL} will throw an {@link Error} on subsequent invocations. *

    * This method takes care that multiple invocations are possible, but the * UrlStreamHandlerFactory is installed only once. */ public static synchronized void installUrlStreamHandlerFactory() { /* * When running under surefire, this class will be loaded by different class loaders and * will be running in multiple "main" thread objects. Thus, there is no way for this class * to register a globally available variable to store the info whether our custom * UrlStreamHandlerFactory was already registered. * * The only way to accomplish this is to catch the Error that is thrown by URL when * trying to re-register the custom UrlStreamHandlerFactory. */ try { URL.setURLStreamHandlerFactory(new MuleUrlStreamHandlerFactory()); } catch (Error err) { if (log.isDebugEnabled()) { log.debug("Custom MuleUrlStreamHandlerFactory already registered", err); } } } public static void registerHandler(String protocol, URLStreamHandler handler) { registry.put(protocol, handler); } public URLStreamHandler createURLStreamHandler(String protocol) { URLStreamHandler handler = (URLStreamHandler) registry.get(protocol); if (handler == null) { handler = this.defaultHandlerCreateStrategy(protocol); } return handler; } private URLStreamHandler defaultHandlerCreateStrategy(String protocol) { String packagePrefixList = System.getProperty(HANDLER_PKGS_SYSTEM_PROPERTY, ""); if (packagePrefixList.endsWith("|") == false) { packagePrefixList += "|sun.net.www.protocol"; } StringTokenizer tokenizer = new StringTokenizer(packagePrefixList, "|"); URLStreamHandler handler = null; while (handler == null && tokenizer.hasMoreTokens()) { String packagePrefix = tokenizer.nextToken().trim(); String className = packagePrefix + "." + protocol + ".Handler"; try { handler = (URLStreamHandler) ClassUtils.instanciateClass(className, null); } catch (Exception ex) { // not much we can do here } } return handler; } } mule-2.0.1/core/src/main/java/org/mule/util/IOUtils.java0000644000175000017500000002127310766061326022601 0ustar charlescharles/* * $Id: IOUtils.java 11338 2008-03-12 23:10:14Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.config.i18n.CoreMessages; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; // @ThreadSafe /** * Mule input/output utilities. */ public class IOUtils extends org.apache.commons.io.IOUtils { /** Logger. */ private static final Log logger = LogFactory.getLog(IOUtils.class); /** * Attempts to load a resource from the file system, from a URL, or from the * classpath, in that order. * * @param resourceName The name of the resource to load * @param callingClass The Class object of the calling object * @return the requested resource as a string * @throws java.io.IOException IO error */ public static String getResourceAsString(final String resourceName, final Class callingClass) throws IOException { InputStream is = getResourceAsStream(resourceName, callingClass); if (is != null) { return toString(is); } else { throw new IOException("Unable to load resource " + resourceName); } } /** * Attempts to load a resource from the file system, from a URL, or from the * classpath, in that order. * * @param resourceName The name of the resource to load * @param callingClass The Class object of the calling object * @return an InputStream to the resource or null if resource not found * @throws java.io.IOException IO error */ public static InputStream getResourceAsStream(final String resourceName, final Class callingClass) throws IOException { return getResourceAsStream(parseResourceName(resourceName), callingClass, true, true); } /** * Attempts to load a resource from the file system, from a URL, or from the * classpath, in that order. * * @param resourceName The name of the resource to load * @param callingClass The Class object of the calling object * @param tryAsFile - try to load the resource from the local file system * @param tryAsUrl - try to load the resource as a URL * @return an InputStream to the resource or null if resource not found * @throws java.io.IOException IO error */ public static InputStream getResourceAsStream(final String resourceName, final Class callingClass, boolean tryAsFile, boolean tryAsUrl) throws IOException { URL url = getResourceAsUrl(resourceName, callingClass, tryAsFile, tryAsUrl); if (url == null) { return null; } else { return url.openStream(); } } /** * Attempts to load a resource from the file system or from the classpath, in * that order. * * @param resourceName The name of the resource to load * @param callingClass The Class object of the calling object * @return an URL to the resource or null if resource not found */ public static URL getResourceAsUrl(final String resourceName, final Class callingClass) { return getResourceAsUrl(resourceName, callingClass, true, true); } /** * Attempts to load a resource from the file system or from the classpath, in * that order. * * @param resourceName The name of the resource to load * @param callingClass The Class object of the calling object * @param tryAsFile - try to load the resource from the local file system * @param tryAsUrl - try to load the resource as a Url string * @return an URL to the resource or null if resource not found */ public static URL getResourceAsUrl(final String resourceName, final Class callingClass, boolean tryAsFile, boolean tryAsUrl) { if (resourceName == null) { throw new IllegalArgumentException( CoreMessages.objectIsNull("Resource name").getMessage()); } URL url = null; // Try to load the resource from the file system. if (tryAsFile) { try { File file = FileUtils.newFile(resourceName); if (file.exists()) { url = file.getAbsoluteFile().toURL(); } else { logger.debug("Unable to load resource from the file system: " + file.getAbsolutePath()); } } catch (Exception e) { logger.debug("Unable to load resource from the file system: " + e.getMessage()); } } // Try to load the resource from the classpath. if (url == null) { try { url = (URL)AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return ClassUtils.getResource(resourceName, callingClass); } }); if (url == null) { logger.debug("Unable to load resource " + resourceName + " from the classpath"); } } catch (Exception e) { logger.debug("Unable to load resource " + resourceName + " from the classpath: " + e.getMessage()); } } if(url==null) { try { url = new URL(resourceName); } catch (MalformedURLException e) { //ignore } } return url; } /** * This method checks whether the name of the resource needs to be parsed. If it * is, it parses the name and tries to get the variable from the Environmental * Variables configured on the system. * * @param src * @return */ private static String parseResourceName(String src) { String var; String[] split; String ps = File.separator; if (src.indexOf('$') > -1) { split = src.split("}"); } else { return src; } var = split[0].substring(2); var = SystemUtils.getenv(var); if (split.length > 1) { if (var == null) { var = System.getProperty(split[0].substring(2)); if (var == null) { return split[1].substring(1); } else { return var + ps + split[1].substring(1); } } else { return var + ps + split[1].substring(1); } } else { if (var == null) { return ""; } else { return var; } } } /** * This method wraps {@link org.apache.commons.io.IOUtils}' toString(InputStream) * method but catches any {@link IOException} and wraps it into a {@link RuntimeException}. */ public static String toString(InputStream input) { try { return org.apache.commons.io.IOUtils.toString(input); } catch (IOException iox) { throw new RuntimeException(iox); } } /** * This method wraps {@link org.apache.commons.io.IOUtils}' toByteArray(InputStream) * method but catches any {@link IOException} and wraps it into a {@link RuntimeException}. */ public static byte[] toByteArray(InputStream input) { try { return org.apache.commons.io.IOUtils.toByteArray(input); } catch (IOException iox) { throw new RuntimeException(iox); } } } mule-2.0.1/core/src/main/java/org/mule/util/ObjectUtils.java0000644000175000017500000002264510722540631023475 0ustar charlescharles/* * $Id: ObjectUtils.java 9865 2007-11-26 12:52:41Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class ObjectUtils extends org.apache.commons.lang.ObjectUtils { /** logger used by this class */ protected static final Log logger = LogFactory.getLog(ObjectUtils.class); /** * Like {@link #identityToString(Object)} but without the object's full package * name. * * @param obj the object for which the identity description is to be generated * @return the object's identity description in the form of * "ClassName@IdentityCode" or "null" if the argument was null. */ public static String identityToShortString(Object obj) { if (obj == null) { return "null"; } else { return new StringBuffer(40).append( ClassUtils.getSimpleName(obj.getClass())) .append('@') .append(Integer.toHexString(System.identityHashCode(obj)) ).toString(); } } /** * Gets a String from a value in a null-safe manner. *

    * * @param answer the object value * @param defaultValue the default to use if null or of incorrect type * @return the value as a String, or the defaultValue */ public static String getString(final Object answer, String defaultValue) { if (answer != null) { return answer.toString(); } else { return defaultValue; } } /** * Gets a boolean from a value in a null-safe manner. *

    * * @param answer the object value * @param defaultValue the default to use if null or of incorrect type * @return the value as a boolean, or the defaultValue */ public static boolean getBoolean(final Object answer, boolean defaultValue) { if (answer != null) { if (answer instanceof Boolean) { return ((Boolean) answer).booleanValue(); } else if (answer instanceof String) { return Boolean.valueOf((String) answer).booleanValue(); } else if (answer instanceof Number) { Number n = (Number) answer; return ((n.intValue() > 0) ? Boolean.TRUE : Boolean.FALSE).booleanValue(); } else { if (logger.isWarnEnabled()) { logger.warn("Value exists but cannot be converted to boolean: " + answer + ", returning default value: " + defaultValue); } return defaultValue; } } return defaultValue; } /** * Gets a byte from a value in a null-safe manner. *

    * * @param answer the object value * @param defaultValue the default to use if null or of incorrect type * @return the value as a byte, or the defaultValue */ public static byte getByte(final Object answer, byte defaultValue) { if (answer == null) { return defaultValue; } else if (answer instanceof Number) { return ((Number) answer).byteValue(); } else if (answer instanceof String) { try { return Byte.valueOf((String) answer).byteValue(); } catch (NumberFormatException e) { //handled below } } if (logger.isWarnEnabled()) { logger.warn("Value exists but cannot be converted to byte: " + answer + ", returning default value: " + defaultValue); } return defaultValue; } /** * Gets a short from a value in a null-safe manner. *

    * * @param answer the object value * @param defaultValue the default to use if null or of incorrect type * @return the value as a short, or the defaultValue */ public static short getShort(final Object answer, short defaultValue) { if (answer == null) { return defaultValue; } else if (answer instanceof Number) { return ((Number) answer).shortValue(); } else if (answer instanceof String) { try { return Short.valueOf((String) answer).shortValue(); } catch (NumberFormatException e) { //handled below } } if (logger.isWarnEnabled()) { logger.warn("Value exists but cannot be converted to short: " + answer + ", returning default value: " + defaultValue); } return defaultValue; } /** * Gets a int from a value in a null-safe manner. *

    * * @param answer the object value * @param defaultValue the default to use if null or of incorrect type * @return the value as a int, or the defaultValue */ public static int getInt(final Object answer, int defaultValue) { if (answer == null) { return defaultValue; } else if (answer instanceof Number) { return ((Number) answer).intValue(); } else if (answer instanceof String) { try { return Integer.valueOf((String) answer).intValue(); } catch (NumberFormatException e) { //handled below } } if (logger.isWarnEnabled()) { logger.warn("Value exists but cannot be converted to int: " + answer + ", returning default value: " + defaultValue); } return defaultValue; } /** * Gets a long from a value in a null-safe manner. *

    * * @param answer the object value * @param defaultValue the default to use if null or of incorrect type * @return the value as a long, or the defaultValue */ public static long getLong(final Object answer, long defaultValue) { if (answer == null) { return defaultValue; } else if (answer instanceof Number) { return ((Number) answer).longValue(); } else if (answer instanceof String) { try { return Long.valueOf((String) answer).longValue(); } catch (NumberFormatException e) { //handled below } } if (logger.isWarnEnabled()) { logger.warn("Value exists but cannot be converted to long: " + answer + ", returning default value: " + defaultValue); } return defaultValue; } /** * Gets a float from a value in a null-safe manner. *

    * * @param answer the object value * @param defaultValue the default to use if null or of incorrect type * @return the value as a float, or the defaultValue */ public static float getFloat(final Object answer, float defaultValue) { if (answer == null) { return defaultValue; } else if (answer instanceof Number) { return ((Number) answer).floatValue(); } else if (answer instanceof String) { try { return Float.valueOf((String) answer).floatValue(); } catch (NumberFormatException e) { //handled below } } if (logger.isWarnEnabled()) { logger.warn("Value exists but cannot be converted to float: " + answer + ", returning default value: " + defaultValue); } return defaultValue; } /** * Gets a double from a value in a null-safe manner. *

    * * @param answer the object value * @param defaultValue the default to use if null or of incorrect type * @return the value as a double, or the defaultValue */ public static double getDouble(final Object answer, double defaultValue) { if (answer == null) { return defaultValue; } else if (answer instanceof Number) { return ((Number) answer).doubleValue(); } else if (answer instanceof String) { try { return Double.valueOf((String) answer).doubleValue(); } catch (NumberFormatException e) { //handled below } } if (logger.isWarnEnabled()) { logger.warn("Value exists but cannot be converted to double: " + answer + ", returning default value: " + defaultValue); } return defaultValue; } }mule-2.0.1/core/src/main/java/org/mule/util/BeanUtils.java0000644000175000017500000000677310721634256023146 0ustar charlescharles/* * $Id: BeanUtils.java 9852 2007-11-23 20:31:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * BeanUtils provides functions for altering the way commons BeanUtils * works */ // @ThreadSafe public class BeanUtils extends org.apache.commons.beanutils.BeanUtils { public static final String SET_PROPERTIES_METHOD = "setProperties"; /** logger used by this class */ private static final Log logger = LogFactory.getLog(BeanUtils.class); /** Exception safe version of BeanUtils.populateWithoutFail */ public static void populateWithoutFail(Object object, Map props, boolean logWarnings) { // Check to see if our object has a setProperties method where the properties // map should be set if (ClassUtils.getMethod(object.getClass(), SET_PROPERTIES_METHOD, new Class[]{Map.class}) != null) { try { BeanUtils.setProperty(object, "properties", props); } catch (Exception e) { // this should never happen since we explicitly check for the method // above if (logWarnings) { logger.warn("Property: " + SET_PROPERTIES_METHOD + "=" + Map.class.getName() + " not found on object: " + object.getClass().getName()); } } } else { for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); try { BeanUtils.setProperty(object, entry.getKey().toString(), entry.getValue()); } catch (Exception e) { if (logWarnings) { logger.warn("Property: " + entry.getKey() + "=" + entry.getValue() + " not found on object: " + object.getClass().getName()); } } } } } /** * The Apache BeanUtils version of this converts all values to String, which is pretty useless, it also includes * stuff not defined by the user * * @param object the object to Describe * @return a map of the properties on the object */ public static Map describe(Object object) { Map props = new HashMap(object.getClass().getDeclaredFields().length); for (int i = 0; i < object.getClass().getDeclaredFields().length; i++) { Field field = object.getClass().getDeclaredFields()[i]; field.setAccessible(true); try { props.put(field.getName(), field.get(object)); } catch (IllegalAccessException e) { logger.debug("Unable to read field: " + field.getName() + " on object: " + object); } } return props; } } mule-2.0.1/core/src/main/java/org/mule/util/Base64.java0000644000175000017500000014470410664630335022301 0ustar charlescharles/* * $Id: Base64.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ /* * Encodes and decodes to and from Base64 notation. * *

    * Change Log: *

    *
      *
    • current - cleaned up by Holger Hoffstaette (holger@codehaus.org) for Mule; * removed System.out/err printing and properly throw IOExceptions from all methods. *
    • v2.1 - Cleaned up javadoc comments and unused variables and methods. Added * some convenience methods for reading and writing to and from files.
    • *
    • v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems * with other encodings (like EBCDIC).
    • *
    • v2.0.1 - Fixed an error when decoding a single byte, that is, when the * encoded data was a single byte.
    • *
    • v2.0 - I got rid of methods that used booleans to set options. * Now everything is more consolidated and cleaner. The code now detects * when data that's being decoded is gzip-compressed and will decompress it * automatically. Generally things are cleaner. You'll probably have to * change some method calls that you were making to support the new * options format (ints that you "OR" together).
    • *
    • v1.5.1 - Fixed bug when decompressing and decoding to a * byte[] using decode( String s, boolean gzipCompressed ). * Added the ability to "suspend" encoding in the Output Stream so * you can turn on and off the encoding if you need to embed base64 * data in an otherwise "normal" stream (like an XML file).
    • *
    • v1.5 - Output stream pases on flush() command but doesn't do anything itself. * This helps when using GZIP streams. * Added the ability to GZip-compress objects before encoding them.
    • *
    • v1.4 - Added helper methods to read/write files.
    • *
    • v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.
    • *
    • v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream * where last buffer being read, if not completely full, was not returned.
    • *
    • v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.
    • *
    • v1.3.3 - Fixed I/O streams which were totally messed up.
    • *
    * *

    * I am placing this code in the Public Domain. Do with it as you will. * This software comes with no guarantees or warranties but with * plenty of well-wishing instead! * Please visit http://iharder.net/base64 * periodically to check for updates or to contribute improvements. *

    * * @author Robert Harder * @author rob@iharder.net * @version 2.1 */ package org.mule.util; import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FilterInputStream; import java.io.FilterOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.ByteArrayOutputStream; public final class Base64 { /* ******** P U B L I C F I E L D S ******** */ /** No options specified. Value is zero. */ public static final int NO_OPTIONS = 0; /** Specify encoding. */ public static final int ENCODE = 1; /** Specify decoding. */ public static final int DECODE = 0; /** Specify that data should be gzip-compressed. */ public static final int GZIP = 2; /** Don't break lines when encoding (violates strict Base64 specification) */ public static final int DONT_BREAK_LINES = 8; /** Preferred encoding. */ public static final String PREFERRED_ENCODING = "UTF-8"; /* ******** P R I V A T E F I E L D S ******** */ /** Maximum line length (76) of Base64 output. */ private static final int MAX_LINE_LENGTH = 76; /** The equals sign (=) as a byte. */ private static final byte EQUALS_SIGN = (byte) '='; /** The new line character (\n) as a byte. */ private static final byte NEW_LINE = (byte) '\n'; /** The 64 valid Base64 values. */ private static final byte[] ALPHABET; private static final byte[] NATIVE_ALPHABET = /* May be something funny like EBCDIC */ { (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N', (byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U', (byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j', (byte) 'k', (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o', (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't', (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', (byte) 'y', (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) '+', (byte) '/' }; /** Determine which ALPHABET to use. */ static { byte[] bytes; try { bytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".getBytes(PREFERRED_ENCODING); } // end try catch (java.io.UnsupportedEncodingException use) { bytes = NATIVE_ALPHABET; // Fall back to native encoding } // end catch ALPHABET = bytes; } // end static /** * Translates a Base64 value to either its 6-bit reconstruction value or a * negative number indicating some other meaning. */ private static final byte[] DECODABET = {-9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal // 0 - // 8 -5, -5, // Whitespace: Tab and Linefeed -9, -9, // Decimal 11 - 12 -5, // Whitespace: Carriage Return -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 14 - 26 -9, -9, -9, -9, -9, // Decimal 27 - 31 -5, // Whitespace: Space -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 33 - 42 62, // Plus sign at decimal 43 -9, -9, -9, // Decimal 44 - 46 63, // Slash at decimal 47 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // Numbers zero through nine -9, -9, -9, // Decimal 58 - 60 -1, // Equals sign at decimal 61 -9, -9, -9, // Decimal 62 - 64 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, // Letters 'A' through 'N' 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // Letters 'O' through 'Z' -9, -9, -9, -9, -9, -9, // Decimal 91 - 96 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // Letters 'a' through // 'm' 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // Letters 'n' through // 'z' -9, -9, -9, -9 // Decimal 123 - 126 /* * ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139 * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152 * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165 * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178 * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191 * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204 * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217 * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230 * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243 * -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255 */ }; // I think I end up not using the BAD_ENCODING indicator. // private static final byte BAD_ENCODING = -9; // Indicates error in // encoding private static final byte WHITE_SPACE_ENC = -5; // Indicates white space in // encoding private static final byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in // encoding /** Defeats instantiation. */ private Base64() { super(); } /* ******** E N C O D I N G M E T H O D S ******** */ /** * Encodes up to the first three bytes of array threeBytes and * returns a four-byte array in Base64 notation. The actual number of significant * bytes in your array is given by numSigBytes. The array * threeBytes needs only be as big as numSigBytes. Code * can reuse a byte array by passing a four-byte array as b4. * * @param b4 A reusable byte array to reduce array instantiation * @param threeBytes the array to convert * @param numSigBytes the number of significant bytes in your array * @return four byte array in Base64 notation. * @since 1.5.1 */ private static byte[] encode3to4(byte[] b4, byte[] threeBytes, int numSigBytes) { encode3to4(threeBytes, 0, numSigBytes, b4, 0); return b4; } // end encode3to4 /** * Encodes up to three bytes of the array source and writes the * resulting four Base64 bytes to destination. The source and * destination arrays can be manipulated anywhere along their length by * specifying srcOffset and destOffset. This method does * not check to make sure your arrays are large enough to accomodate * srcOffset + 3 for the source array or destOffset + * 4 for the destination array. The actual number of significant * bytes in your array is given by numSigBytes. * * @param source the array to convert * @param srcOffset the index where conversion begins * @param numSigBytes the number of significant bytes in your array * @param destination the array to hold the conversion * @param destOffset the index where output will be put * @return the destination array * @since 1.3 */ private static byte[] encode3to4(byte[] source, int srcOffset, int numSigBytes, byte[] destination, int destOffset) { // 1 2 3 // 01234567890123456789012345678901 Bit position // --------000000001111111122222222 Array position from threeBytes // --------| || || || | Six bit groups to index ALPHABET // >>18 >>12 >> 6 >> 0 Right shift necessary // 0x3f 0x3f 0x3f Additional AND // Create buffer with zero-padding if there are only one or two // significant bytes passed in the array. // We have to shift left 24 in order to flush out the 1's that appear // when Java treats a value as negative that is cast from a byte to an // int. int inBuff = (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8) : 0) | (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16) : 0) | (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24) : 0); switch (numSigBytes) { case 3 : destination[destOffset] = ALPHABET[(inBuff >>> 18)]; destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f]; destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f]; destination[destOffset + 3] = ALPHABET[(inBuff) & 0x3f]; return destination; case 2 : destination[destOffset] = ALPHABET[(inBuff >>> 18)]; destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f]; destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f]; destination[destOffset + 3] = EQUALS_SIGN; return destination; case 1 : destination[destOffset] = ALPHABET[(inBuff >>> 18)]; destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f]; destination[destOffset + 2] = EQUALS_SIGN; destination[destOffset + 3] = EQUALS_SIGN; return destination; default : return destination; } // end switch } // end encode3to4 /** * Serializes an object and returns the Base64-encoded version of that serialized * object. If the object cannot be serialized or there is another error, the * method will return null. The object is not GZip-compressed before * being encoded. * * @param serializableObject The object to encode * @return The Base64-encoded object * @since 1.4 */ public static String encodeObject(Serializable serializableObject) throws IOException { return encodeObject(serializableObject, NO_OPTIONS); } // end encodeObject /** * Serializes an object and returns the Base64-encoded version of that serialized * object. If the object cannot be serialized or there is another error, the * method will return null. *

    * Valid options: * *

         *              GZIP: gzip-compresses object before encoding it.
         *              DONT_BREAK_LINES: don't break lines at 76 characters
         *                <i>Note: Technically, this makes your encoding non-compliant.</i>
         * 
    * *

    * Example: encodeObject( myObj, Base64.GZIP ) or *

    * Example: * encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES ) * * @param serializableObject The object to encode * @param options Specified options * @return The Base64-encoded object * @see Base64#GZIP * @see Base64#DONT_BREAK_LINES * @since 2.0 */ public static String encodeObject(Serializable serializableObject, int options) throws IOException { // Streams ByteArrayOutputStream baos = null; OutputStream b64os = null; ObjectOutputStream oos = null; GZIPOutputStream gzos = null; // Isolate options int gzip = (options & GZIP); int dontBreakLines = (options & DONT_BREAK_LINES); try { // ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); b64os = new Base64.OutputStream(baos, ENCODE | dontBreakLines); // GZip? if (gzip == GZIP) { gzos = new GZIPOutputStream(b64os); oos = new ObjectOutputStream(gzos); } // end if: gzip else { oos = new ObjectOutputStream(b64os); } oos.writeObject(serializableObject); if (gzos != null) { gzos.finish(); gzos.close(); } oos.close(); } // end try catch (IOException e) { return null; } // end catch finally { IOUtils.closeQuietly(oos); IOUtils.closeQuietly(gzos); IOUtils.closeQuietly(b64os); IOUtils.closeQuietly(baos); } // end finally // Return value according to relevant encoding. try { return new String(baos.toByteArray(), PREFERRED_ENCODING); } // end try catch (UnsupportedEncodingException uue) { return new String(baos.toByteArray()); } // end catch } // end encode /** * Encodes a byte array into Base64 notation. Does not GZip-compress data. * * @param source The data to convert * @since 1.4 */ public static String encodeBytes(byte[] source) throws IOException { return encodeBytes(source, 0, source.length, NO_OPTIONS); } // end encodeBytes /** * Encodes a byte array into Base64 notation. *

    * Valid options: * *

         *               GZIP: gzip-compresses object before encoding it.
         *               DONT_BREAK_LINES: don't break lines at 76 characters
         *                 <i>Note: Technically, this makes your encoding non-compliant.</i>
         * 
    * *

    * Example: encodeBytes( myData, Base64.GZIP ) or *

    * Example: * encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES ) * * @param source The data to convert * @param options Specified options * @see Base64#GZIP * @see Base64#DONT_BREAK_LINES * @since 2.0 */ public static String encodeBytes(byte[] source, int options) throws IOException { return encodeBytes(source, 0, source.length, options); } // end encodeBytes /** * Encodes a byte array into Base64 notation. Does not GZip-compress data. * * @param source The data to convert * @param off Offset in array where conversion should begin * @param len Length of data to convert * @since 1.4 */ public static String encodeBytes(byte[] source, int off, int len) throws IOException { return encodeBytes(source, off, len, NO_OPTIONS); } // end encodeBytes /** * Encodes a byte array into Base64 notation. *

    * Valid options: * *

         *              GZIP: gzip-compresses object before encoding it.
         *              DONT_BREAK_LINES: don't break lines at 76 characters
         *                <i>Note: Technically, this makes your encoding non-compliant.</i>
         * 
    * *

    * Example: encodeBytes( myData, Base64.GZIP ) or *

    * Example: * encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES ) * * @param source The data to convert * @param off Offset in array where conversion should begin * @param len Length of data to convert * @param options Specified options * @see Base64#GZIP * @see Base64#DONT_BREAK_LINES * @since 2.0 */ public static String encodeBytes(byte[] source, int off, int len, int options) throws IOException { // Isolate options int dontBreakLines = (options & DONT_BREAK_LINES); int gzip = (options & GZIP); // Compress? if (gzip == GZIP) { ByteArrayOutputStream baos = null; GZIPOutputStream gzos = null; Base64.OutputStream b64os = null; try { // GZip -> Base64 -> ByteArray baos = new ByteArrayOutputStream(4096); b64os = new Base64.OutputStream(baos, ENCODE | dontBreakLines); gzos = new GZIPOutputStream(b64os); gzos.write(source, off, len); gzos.finish(); gzos.close(); } // end try catch (IOException e) { throw e; } // end catch finally { IOUtils.closeQuietly(gzos); IOUtils.closeQuietly(b64os); IOUtils.closeQuietly(baos); } // end finally // Return value according to relevant encoding. try { return new String(baos.toByteArray(), PREFERRED_ENCODING); } // end try catch (UnsupportedEncodingException uue) { return new String(baos.toByteArray()); } // end catch } // end if: compress // Else, don't compress. Better not to use streams at all then. else { // Convert option to boolean in way that code likes it. boolean breakLines = dontBreakLines == 0; int len43 = len * 4 / 3; byte[] outBuff = new byte[(len43) // Main 4:3 + ((len % 3) > 0 ? 4 : 0) // Account for // padding + (breakLines ? (len43 / MAX_LINE_LENGTH) : 0)]; // New // lines int d = 0; int e = 0; int len2 = len - 2; int lineLength = 0; for (; d < len2; d += 3, e += 4) { encode3to4(source, d + off, 3, outBuff, e); lineLength += 4; if (breakLines && lineLength == MAX_LINE_LENGTH) { outBuff[e + 4] = NEW_LINE; e++; lineLength = 0; } // end if: end of line } // en dfor: each piece of array if (d < len) { encode3to4(source, d + off, len - d, outBuff, e); e += 4; } // end if: some padding needed // Return value according to relevant encoding. try { return new String(outBuff, 0, e, PREFERRED_ENCODING); } // end try catch (UnsupportedEncodingException uue) { return new String(outBuff, 0, e); } // end catch } // end else: don't compress } // end encodeBytes /* ******** D E C O D I N G M E T H O D S ******** */ /** * Decodes four bytes from array source and writes the resulting * bytes (up to three of them) to destination. The source and * destination arrays can be manipulated anywhere along their length by * specifying srcOffset and destOffset. This method does * not check to make sure your arrays are large enough to accomodate * srcOffset + 4 for the source array or destOffset + * 3 for the destination array. This method returns the actual number * of bytes that were converted from the Base64 encoding. * * @param source the array to convert * @param srcOffset the index where conversion begins * @param destination the array to hold the conversion * @param destOffset the index where output will be put * @return the number of decoded bytes converted * @since 1.3 */ private static int decode4to3(byte[] source, int srcOffset, byte[] destination, int destOffset) { // Example: Dk== if (source[srcOffset + 2] == EQUALS_SIGN) { // Two ways to do the same thing. Don't know which way I like best. // int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 // ) // | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 ); int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12); destination[destOffset] = (byte) (outBuff >>> 16); return 1; } // Example: DkL= else if (source[srcOffset + 3] == EQUALS_SIGN) { // Two ways to do the same thing. Don't know which way I like best. // int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 // ) // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 ) // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 ); int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6); destination[destOffset] = (byte) (outBuff >>> 16); destination[destOffset + 1] = (byte) (outBuff >>> 8); return 2; } // Example: DkLE else { try { // Two ways to do the same thing. Don't know which way I like // best. // int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) // >>> 6 ) // | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 ) // | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 ) // | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 ); int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6) | ((DECODABET[source[srcOffset + 3]] & 0xFF)); destination[destOffset] = (byte) (outBuff >> 16); destination[destOffset + 1] = (byte) (outBuff >> 8); destination[destOffset + 2] = (byte) (outBuff); return 3; } catch (Exception e) { // this is not good. StringBuffer msg = new StringBuffer(64); msg.append(source[srcOffset]).append(": ").append(DECODABET[source[srcOffset]]); msg.append(source[srcOffset + 1]).append(": ").append(DECODABET[source[srcOffset + 1]]); msg.append(source[srcOffset + 2]).append(": ").append(DECODABET[source[srcOffset + 2]]); msg.append(source[srcOffset + 3]).append(": ").append(DECODABET[source[srcOffset + 3]]); throw (IllegalStateException) new IllegalStateException(msg.toString()).initCause(e); } // end catch } } // end decodeToBytes /** * Very low-level access to decoding ASCII characters in the form of a byte * array. Does not support automatically gunzipping or any other "fancy" * features. * * @param source The Base64 encoded data * @param off The offset of where to begin decoding * @param len The length of characters to decode * @return decoded data * @since 1.3 */ public static byte[] decode(byte[] source, int off, int len) { int len34 = len * 3 / 4; byte[] outBuff = new byte[len34]; // Upper limit on size of output int outBuffPosn = 0; byte[] b4 = new byte[4]; int b4Posn = 0; int i = 0; byte sbiCrop = 0; byte sbiDecode = 0; for (i = off; i < off + len; i++) { sbiCrop = (byte) (source[i] & 0x7f); // Only the low seven bits sbiDecode = DECODABET[sbiCrop]; if (sbiDecode >= WHITE_SPACE_ENC) // White space, Equals sign or // better { if (sbiDecode >= EQUALS_SIGN_ENC) { b4[b4Posn++] = sbiCrop; if (b4Posn > 3) { outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn); b4Posn = 0; // If that was the equals sign, break out of 'for' loop if (sbiCrop == EQUALS_SIGN) { break; } } // end if: quartet built } // end if: equals sign or better } // end if: white space, equals sign or better else { throw new IllegalArgumentException("Bad Base64 input character at " + i + ": " + source[i] + "(decimal)"); } // end else: } // each input character byte[] out = new byte[outBuffPosn]; System.arraycopy(outBuff, 0, out, 0, outBuffPosn); return out; } // end decode /** * Decodes data from Base64 notation, automatically detecting gzip-compressed * data and decompressing it. * * @param s the string to decode * @return the decoded data * @since 1.4 */ public static byte[] decode(String s) { byte[] bytes; try { bytes = s.getBytes(PREFERRED_ENCODING); } // end try catch (UnsupportedEncodingException uee) { bytes = s.getBytes(); } // end catch // // Decode bytes = decode(bytes, 0, bytes.length); // Check to see if it's gzip-compressed // GZIP Magic Two-Byte Number: 0x8b1f (35615) if (bytes != null && bytes.length >= 4) { int head = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00); if (GZIPInputStream.GZIP_MAGIC == head) { ByteArrayInputStream bais = null; GZIPInputStream gzis = null; ByteArrayOutputStream baos = null; byte[] buffer = new byte[4096]; int length = 0; try { baos = new ByteArrayOutputStream(4096); bais = new ByteArrayInputStream(bytes); gzis = new GZIPInputStream(bais); while ((length = gzis.read(buffer)) >= 0) { baos.write(buffer, 0, length); } // end while: reading input // No error? Get new bytes. bytes = baos.toByteArray(); } // end try catch (IOException e) { // Just return originally-decoded bytes } // end catch finally { IOUtils.closeQuietly(baos); IOUtils.closeQuietly(gzis); IOUtils.closeQuietly(bais); } // end finally } // end if: gzipped } // end if: bytes.length >= 2 return bytes; } // end decode /** * Attempts to decode Base64 data and deserialize a Java Object within. Returns * null if there was an error. * * @param encodedObject The Base64 data to decode * @return The decoded and deserialized object * @since 1.5 */ public static Object decodeToObject(String encodedObject) throws IOException, ClassNotFoundException { // Decode and gunzip if necessary byte[] objBytes = decode(encodedObject); ByteArrayInputStream bais = null; ObjectInputStream ois = null; Object obj = null; try { bais = new ByteArrayInputStream(objBytes); ois = new ObjectInputStream(bais); obj = ois.readObject(); } // end try catch (IOException e) { throw e; } // end catch catch (java.lang.ClassNotFoundException e) { throw e; } // end catch finally { IOUtils.closeQuietly(bais); IOUtils.closeQuietly(ois); } // end finally return obj; } // end decodeObject /** * Convenience method for encoding data to a file. * * @param dataToEncode byte array of data to encode in base64 form * @param filename Filename for saving encoded data * @since 2.1 */ public static void encodeToFile(byte[] dataToEncode, String filename) throws IOException { Base64.OutputStream bos = null; try { bos = new Base64.OutputStream(new FileOutputStream(filename), Base64.ENCODE); bos.write(dataToEncode); } // end try catch (IOException e) { throw e; } // end catch: IOException finally { IOUtils.closeQuietly(bos); } // end finally } // end encodeToFile /** * Convenience method for decoding data to a file. * * @param dataToDecode Base64-encoded data as a string * @param filename Filename for saving decoded data * @since 2.1 */ public static void decodeToFile(String dataToDecode, String filename) throws IOException { Base64.OutputStream bos = null; try { bos = new Base64.OutputStream(new FileOutputStream(filename), Base64.DECODE); bos.write(dataToDecode.getBytes(PREFERRED_ENCODING)); } // end try catch (IOException e) { throw e; } // end catch: IOException finally { IOUtils.closeQuietly(bos); } // end finally } // end decodeToFile /** * Convenience method for reading a base64-encoded file and decoding it. * * @param filename Filename for reading encoded data * @return decoded byte array or null if unsuccessful * @since 2.1 */ public static byte[] decodeFromFile(String filename) throws IOException { byte[] decodedData = null; Base64.InputStream bis = null; try { // Set up some useful variables File file = FileUtils.newFile(filename); byte[] buffer = null; int length = 0; int numBytes = 0; // Check for size of file if (file.length() > Integer.MAX_VALUE) { throw new IllegalArgumentException("File is too big for this convenience method (" + file.length() + " bytes)."); } // end if: file too big for int index buffer = new byte[(int) file.length()]; // Open a stream bis = new Base64.InputStream(new BufferedInputStream(new FileInputStream(file)), Base64.DECODE); // Read until done while ((numBytes = bis.read(buffer, length, 4096)) >= 0) { length += numBytes; } // Save in a variable to return decodedData = new byte[length]; System.arraycopy(buffer, 0, decodedData, 0, length); } // end try catch (IOException e) { throw e; } // end catch: IOException finally { IOUtils.closeQuietly(bis); } // end finally return decodedData; } // end decodeFromFile /** * Convenience method for reading a binary file and base64-encoding it. * * @param filename Filename for reading binary data * @return base64-encoded string or null if unsuccessful * @since 2.1 */ public static String encodeFromFile(String filename) throws IOException { String encodedData = null; Base64.InputStream bis = null; try { // Set up some useful variables File file = FileUtils.newFile(filename); byte[] buffer = new byte[(int) (file.length() * 1.4)]; int length = 0; int numBytes = 0; // Open a stream bis = new Base64.InputStream(new BufferedInputStream(new FileInputStream(file)), Base64.ENCODE); // Read until done while ((numBytes = bis.read(buffer, length, 4096)) >= 0) { length += numBytes; } // Save in a variable to return encodedData = new String(buffer, 0, length, Base64.PREFERRED_ENCODING); } // end try catch (IOException e) { throw e; } // end catch: IOException finally { IOUtils.closeQuietly(bis); } // end finally return encodedData; } // end encodeFromFile /* ******** I N N E R C L A S S I N P U T S T R E A M ******** */ /** * A {@link Base64.InputStream} will read data from another InputStream, * given in the constructor, and encode/decode to/from Base64 notation on the * fly. * * @see Base64 * @since 1.3 */ public static class InputStream extends FilterInputStream { private boolean encode; // Encoding or decoding private int position; // Current position in the buffer private byte[] buffer; // Small buffer holding converted data private int bufferLength; // Length of buffer (3 or 4) private int numSigBytes; // Number of meaningful bytes in the buffer private int lineLength; private boolean breakLines; // Break lines at less than 80 characters /** * Constructs a {@link Base64.InputStream} in DECODE mode. * * @param in the InputStream from which to read data. * @since 1.3 */ public InputStream(java.io.InputStream in) { this(in, DECODE); } // end constructor /** * Constructs a {@link Base64.InputStream} in either ENCODE or DECODE mode. *

    * Valid options: * *

             *              ENCODE or DECODE: Encode or Decode as data is read.
             *              DONT_BREAK_LINES: don't break lines at 76 characters
             *                (only meaningful when encoding)
             *                <i>Note: Technically, this makes your encoding non-compliant.</i>
             * 
    * *

    * Example: new Base64.InputStream( in, Base64.DECODE ) * * @param in the InputStream from which to read data. * @param options Specified options * @see Base64#ENCODE * @see Base64#DECODE * @see Base64#DONT_BREAK_LINES * @since 2.0 */ public InputStream(java.io.InputStream in, int options) { super(in); this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES; this.encode = (options & ENCODE) == ENCODE; this.bufferLength = encode ? 4 : 3; this.buffer = new byte[bufferLength]; this.position = -1; this.lineLength = 0; } // end constructor /** * Reads enough of the input stream to convert to/from Base64 and returns the * next byte. * * @return next byte * @since 1.3 */ public int read() throws IOException { // Do we need to get data? if (position < 0) { if (encode) { byte[] b3 = new byte[3]; int numBinaryBytes = 0; for (int i = 0; i < 3; i++) { try { int b = in.read(); // If end of stream, b is -1. if (b >= 0) { b3[i] = (byte) b; numBinaryBytes++; } // end if: not end of stream } // end try: read catch (IOException e) { // Only a problem if we got no data at all. if (i == 0) { throw e; } } // end catch } // end for: each needed input byte if (numBinaryBytes > 0) { encode3to4(b3, 0, numBinaryBytes, buffer, 0); position = 0; numSigBytes = 4; } // end if: got data else { return -1; } // end else } // end if: encoding // Else decoding else { byte[] b4 = new byte[4]; int i = 0; for (i = 0; i < 4; i++) { // Read four "meaningful" bytes: int b = 0; do { b = in.read(); } while (b >= 0 && DECODABET[b & 0x7f] <= WHITE_SPACE_ENC); if (b < 0) { break; // Reads a -1 if end of stream } b4[i] = (byte) b; } // end for: each needed input byte if (i == 4) { numSigBytes = decode4to3(b4, 0, buffer, 0); position = 0; } // end if: got four characters else if (i == 0) { return -1; } // end else if: also padded correctly else { // Must have broken out from above. throw new IOException("Improperly padded Base64 input."); } // end } // end else: decode } // end else: get data // Got data? if (position >= 0) { // End of relevant data? if ( /* !encode && */position >= numSigBytes) { return -1; } if (encode && breakLines && lineLength >= MAX_LINE_LENGTH) { lineLength = 0; return '\n'; } // end if else { lineLength++; // This isn't important when decoding // but throwing an extra "if" seems // just as wasteful. int b = buffer[position++]; if (position >= bufferLength) { position = -1; } return b & 0xFF; // This is how you "cast" a byte that's // intended to be unsigned. } // end else } // end if: position >= 0 // Else error else { // When JDK1.4 is more accepted, use an assertion here. throw new IOException("Error in Base64 code reading stream."); } // end else } // end read /** * Calls {@link #read()} repeatedly until the end of stream is reached or * len bytes are read. Returns number of bytes read into array or * -1 if end of stream is encountered. * * @param dest array to hold values * @param off offset for array * @param len max number of bytes to read into array * @return bytes read into array or -1 if end of stream is encountered. * @since 1.3 */ public int read(byte[] dest, int off, int len) throws IOException { int i; int b; for (i = 0; i < len; i++) { b = read(); // if( b < 0 && i == 0 ) // return -1; if (b >= 0) { dest[off + i] = (byte) b; } else if (i == 0) { return -1; } else { break; // Out of 'for' loop } } // end for: each byte read return i; } // end read } // end inner class InputStream /* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */ /** * A {@link Base64.OutputStream} will write data to another OutputStream, * given in the constructor, and encode/decode to/from Base64 notation on the * fly. * * @see Base64 * @since 1.3 */ public static class OutputStream extends FilterOutputStream { private boolean encode; private int position; private byte[] buffer; private int bufferLength; private int lineLength; private boolean breakLines; private byte[] b4; // Scratch used in a few places private boolean suspendEncoding; /** * Constructs a {@link Base64.OutputStream} in ENCODE mode. * * @param out the OutputStream to which data will be written. * @since 1.3 */ public OutputStream(java.io.OutputStream out) { this(out, ENCODE); } // end constructor /** * Constructs a {@link Base64.OutputStream} in either ENCODE or DECODE mode. *

    * Valid options: * *

             *              ENCODE or DECODE: Encode or Decode as data is read.
             *              DONT_BREAK_LINES: don't break lines at 76 characters
             *                (only meaningful when encoding)
             *                <i>Note: Technically, this makes your encoding non-compliant.</i>
             * 
    * *

    * Example: new Base64.OutputStream( out, Base64.ENCODE ) * * @param out the OutputStream to which data will be written. * @param options Specified options. * @see Base64#ENCODE * @see Base64#DECODE * @see Base64#DONT_BREAK_LINES * @since 1.3 */ public OutputStream(java.io.OutputStream out, int options) { super(out); this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES; this.encode = (options & ENCODE) == ENCODE; this.bufferLength = encode ? 3 : 4; this.buffer = new byte[bufferLength]; this.position = 0; this.lineLength = 0; this.suspendEncoding = false; this.b4 = new byte[4]; } // end constructor /** * Writes the byte to the output stream after converting to/from Base64 * notation. When encoding, bytes are buffered three at a time before the * output stream actually gets a write() call. When decoding, bytes are * buffered four at a time. * * @param theByte the byte to write * @since 1.3 */ public void write(int theByte) throws IOException { // Encoding suspended? if (suspendEncoding) { super.out.write(theByte); return; } // end if: supsended // Encode? if (encode) { buffer[position++] = (byte) theByte; if (position >= bufferLength) // Enough to encode. { out.write(encode3to4(b4, buffer, bufferLength)); lineLength += 4; if (breakLines && lineLength >= MAX_LINE_LENGTH) { out.write(NEW_LINE); lineLength = 0; } // end if: end of line position = 0; } // end if: enough to output } // end if: encoding // Else, Decoding else { // Meaningful Base64 character? if (DECODABET[theByte & 0x7f] > WHITE_SPACE_ENC) { buffer[position++] = (byte) theByte; if (position >= bufferLength) // Enough to output. { int len = Base64.decode4to3(buffer, 0, b4, 0); out.write(b4, 0, len); // out.write( Base64.decode4to3( buffer ) ); position = 0; } // end if: enough to output } // end if: meaningful base64 character else if (DECODABET[theByte & 0x7f] != WHITE_SPACE_ENC) { throw new IOException("Invalid character in Base64 data."); } // end else: not white space either } // end else: decoding } // end write /** * Calls {@link #write(int)} repeatedly until len bytes are * written. * * @param theBytes array from which to read bytes * @param off offset for array * @param len max number of bytes to read into array * @since 1.3 */ public void write(byte[] theBytes, int off, int len) throws IOException { // Encoding suspended? if (suspendEncoding) { super.out.write(theBytes, off, len); return; } // end if: supsended for (int i = 0; i < len; i++) { write(theBytes[off + i]); } // end for: each byte written } // end write /** * Method added by PHIL. [Thanks, PHIL. -Rob] This pads the buffer without * closing the stream. */ public void flushBase64() throws IOException { if (position > 0) { if (encode) { out.write(encode3to4(b4, buffer, position)); position = 0; } // end if: encoding else { throw new IOException("Base64 input not properly padded."); } // end else: decoding } // end if: buffer partially full } // end flush /** * Flushes and closes (I think, in the superclass) the stream. * * @since 1.3 */ public void close() throws IOException { // 1. Ensure that pending characters are written flushBase64(); // 2. Actually close the stream // Base class both flushes and closes. super.close(); buffer = null; out = null; } // end close /** * Suspends encoding of the stream. May be helpful if you need to embed a * piece of base640-encoded data in a stream. * * @since 1.5.1 */ public void suspendEncoding() throws IOException { flushBase64(); this.suspendEncoding = true; } // end suspendEncoding /** * Resumes encoding of the stream. May be helpful if you need to embed a * piece of base640-encoded data in a stream. * * @since 1.5.1 */ public void resumeEncoding() { this.suspendEncoding = false; } // end resumeEncoding } // end inner class OutputStream } // end class Base64 mule-2.0.1/core/src/main/java/org/mule/util/StringUtils.java0000644000175000017500000000763710725073732023547 0ustar charlescharles/* * $Id: StringUtils.java 9968 2007-12-03 21:40:42Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.util.ArrayList; import java.util.List; import org.apache.commons.lang.CharUtils; /** * StringUtils contains useful methods for manipulating Strings. */ // @ThreadSafe public class StringUtils extends org.apache.commons.lang.StringUtils { /** * Like {@link org.mule.util.StringUtils#split(String, String)}, but * additionally trims whitespace from the result tokens. */ public static String[] splitAndTrim(String string, String delim) { if (string == null) { return null; } if (isEmpty(string)) { return ArrayUtils.EMPTY_STRING_ARRAY; } String[] rawTokens = split(string, delim); List tokens = new ArrayList(); String token; if (rawTokens != null) { for (int i = 0; i < rawTokens.length; i++) { token = trim(rawTokens[i]); if (isNotEmpty(token)) { tokens.add(token); } } } return (String[]) ArrayUtils.toArrayOfComponentType(tokens.toArray(), String.class); } /** * Convert a hexadecimal string into its byte representation. * * @param hex The hexadecimal string. * @return The converted bytes or null if the hex String is null. */ public static byte[] hexStringToByteArray(String hex) { if (hex == null) { return null; } int stringLength = hex.length(); if (stringLength % 2 != 0) { throw new IllegalArgumentException("Hex String must have even number of characters!"); } byte[] result = new byte[stringLength / 2]; int j = 0; for (int i = 0; i < result.length; i++) { char hi = Character.toLowerCase(hex.charAt(j++)); char lo = Character.toLowerCase(hex.charAt(j++)); result[i] = (byte) ((Character.digit(hi, 16) << 4) | Character.digit(lo, 16)); } return result; } /** * Like {@link #repeat(String, int)} but with a single character as argument. */ public static String repeat(char c, int len) { return repeat(CharUtils.toString(c), len); } /** * @see #toHexString(byte[]) */ public static String toHexString(byte[] bytes) { return StringUtils.toHexString(bytes, false); } /** * Convert a byte array to a hexadecimal string. * * @param bytes The bytes to format. * @param uppercase When true creates uppercase hex characters * instead of lowercase (the default). * @return A hexadecimal representation of the specified bytes. */ public static String toHexString(byte[] bytes, boolean uppercase) { if (bytes == null) { return null; } int numBytes = bytes.length; StringBuffer str = new StringBuffer(numBytes * 2); String table = (uppercase ? HEX_CHARACTERS_UC : HEX_CHARACTERS); for (int i = 0; i < numBytes; i++) { str.append(table.charAt(bytes[i] >>> 4 & 0x0f)); str.append(table.charAt(bytes[i] & 0x0f)); } return str.toString(); } // lookup tables needed for toHexString(byte[], boolean) private static final String HEX_CHARACTERS = "0123456789abcdef"; private static final String HEX_CHARACTERS_UC = HEX_CHARACTERS.toUpperCase(); } mule-2.0.1/core/src/main/java/org/mule/util/XMLEntityCodec.java0000644000175000017500000015321010664630335024040 0ustar charlescharles/* * $Id: XMLEntityCodec.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.io.IOException; import java.io.Writer; import java.util.HashMap; import java.util.Map; /** * This encoder contains methods that convert characters to Character entities as * defined by http://www.w3.org/TR/REC-html40/sgml/entities.html. More precisely it * combines the functionality of {@link org.apache.commons.lang.StringEscapeUtils#escapeXml(String)} and * {@link org.apache.commons.lang.StringEscapeUtils#escapeHtml(String)} into a single pass. */ // @ThreadSafe public final class XMLEntityCodec { private static final Entities MuleEntities = new Entities(); static { MuleEntities.addEntities(Entities.APOS_ARRAY); MuleEntities.addEntities(Entities.BASIC_ARRAY); MuleEntities.addEntities(Entities.ISO8859_1_ARRAY); MuleEntities.addEntities(Entities.HTML40_ARRAY); } protected XMLEntityCodec() { // no-op } public static String encodeString(String str) { if (StringUtils.isEmpty(str)) { return str; } return MuleEntities.escape(str); } public static String decodeString(String str) { if (StringUtils.isEmpty(str)) { return str; } return MuleEntities.unescape(str); } /** *

    * Returns the name of the entity identified by the specified value. *

    * * @param value the value to locate * @return entity name associated with the specified value */ public static String entityName(int value) { return MuleEntities.map.name(value); } /** *

    * Returns the value of the entity identified by the specified name. *

    * * @param name the name to locate * @return entity value associated with the specified name */ public static int entityValue(String name) { return MuleEntities.map.value(name); } // // everything from here on is copied from commons-lang 2.2 + svn since it is not // extensible and referencing the package-private class can lead to classloader // problems :-( // /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** *

    Provides HTML and XML entity utilities.

    * * @see ISO Entities * @see HTML 3.2 Character Entities for ISO Latin-1 * @see HTML 4.0 Character entity references * @see HTML 4.01 Character References * @see HTML 4.01 Code positions * * @author Alexander Day Chaffee * @author Gary Gregory * @since 2.0 * @version $Id: XMLEntityCodec.java 8077 2007-08-27 20:15:25Z aperepel $ */ private static class Entities { private static final String[][] BASIC_ARRAY = { {"quot", "34"}, // " - double-quote {"amp", "38"}, // & - ampersand {"lt", "60"}, // < - less-than {"gt", "62"}, // > - greater-than }; private static final String[][] APOS_ARRAY = { {"apos", "39"}, // XML apostrophe }; // package scoped for testing static final String[][] ISO8859_1_ARRAY = { {"nbsp", "160"}, // non-breaking space {"iexcl", "161"}, //inverted exclamation mark {"cent", "162"}, //cent sign {"pound", "163"}, //pound sign {"curren", "164"}, //currency sign {"yen", "165"}, //yen sign = yuan sign {"brvbar", "166"}, //broken bar = broken vertical bar {"sect", "167"}, //section sign {"uml", "168"}, //diaeresis = spacing diaeresis {"copy", "169"}, // - copyright sign {"ordf", "170"}, //feminine ordinal indicator {"laquo", "171"}, //left-pointing double angle quotation mark = left pointing guillemet {"not", "172"}, //not sign {"shy", "173"}, //soft hyphen = discretionary hyphen {"reg", "174"}, // - registered trademark sign {"macr", "175"}, //macron = spacing macron = overline = APL overbar {"deg", "176"}, //degree sign {"plusmn", "177"}, //plus-minus sign = plus-or-minus sign {"sup2", "178"}, //superscript two = superscript digit two = squared {"sup3", "179"}, //superscript three = superscript digit three = cubed {"acute", "180"}, //acute accent = spacing acute {"micro", "181"}, //micro sign {"para", "182"}, //pilcrow sign = paragraph sign {"middot", "183"}, //middle dot = Georgian comma = Greek middle dot {"cedil", "184"}, //cedilla = spacing cedilla {"sup1", "185"}, //superscript one = superscript digit one {"ordm", "186"}, //masculine ordinal indicator {"raquo", "187"}, //right-pointing double angle quotation mark = right pointing guillemet {"frac14", "188"}, //vulgar fraction one quarter = fraction one quarter {"frac12", "189"}, //vulgar fraction one half = fraction one half {"frac34", "190"}, //vulgar fraction three quarters = fraction three quarters {"iquest", "191"}, //inverted question mark = turned question mark {"Agrave", "192"}, // - uppercase A, grave accent {"Aacute", "193"}, // - uppercase A, acute accent {"Acirc", "194"}, // - uppercase A, circumflex accent {"Atilde", "195"}, // - uppercase A, tilde {"Auml", "196"}, // - uppercase A, umlaut {"Aring", "197"}, // - uppercase A, ring {"AElig", "198"}, // - uppercase AE {"Ccedil", "199"}, // - uppercase C, cedilla {"Egrave", "200"}, // - uppercase E, grave accent {"Eacute", "201"}, // - uppercase E, acute accent {"Ecirc", "202"}, // - uppercase E, circumflex accent {"Euml", "203"}, // - uppercase E, umlaut {"Igrave", "204"}, // - uppercase I, grave accent {"Iacute", "205"}, // - uppercase I, acute accent {"Icirc", "206"}, // - uppercase I, circumflex accent {"Iuml", "207"}, // - uppercase I, umlaut {"ETH", "208"}, // - uppercase Eth, Icelandic {"Ntilde", "209"}, // - uppercase N, tilde {"Ograve", "210"}, // - uppercase O, grave accent {"Oacute", "211"}, // - uppercase O, acute accent {"Ocirc", "212"}, // - uppercase O, circumflex accent {"Otilde", "213"}, // - uppercase O, tilde {"Ouml", "214"}, // - uppercase O, umlaut {"times", "215"}, //multiplication sign {"Oslash", "216"}, // - uppercase O, slash {"Ugrave", "217"}, // - uppercase U, grave accent {"Uacute", "218"}, // - uppercase U, acute accent {"Ucirc", "219"}, // - uppercase U, circumflex accent {"Uuml", "220"}, // - uppercase U, umlaut {"Yacute", "221"}, // - uppercase Y, acute accent {"THORN", "222"}, // - uppercase THORN, Icelandic {"szlig", "223"}, // - lowercase sharps, German {"agrave", "224"}, // - lowercase a, grave accent {"aacute", "225"}, // - lowercase a, acute accent {"acirc", "226"}, // - lowercase a, circumflex accent {"atilde", "227"}, // - lowercase a, tilde {"auml", "228"}, // - lowercase a, umlaut {"aring", "229"}, // - lowercase a, ring {"aelig", "230"}, // - lowercase ae {"ccedil", "231"}, // - lowercase c, cedilla {"egrave", "232"}, // - lowercase e, grave accent {"eacute", "233"}, // - lowercase e, acute accent {"ecirc", "234"}, // - lowercase e, circumflex accent {"euml", "235"}, // - lowercase e, umlaut {"igrave", "236"}, // - lowercase i, grave accent {"iacute", "237"}, // - lowercase i, acute accent {"icirc", "238"}, // - lowercase i, circumflex accent {"iuml", "239"}, // - lowercase i, umlaut {"eth", "240"}, // - lowercase eth, Icelandic {"ntilde", "241"}, // - lowercase n, tilde {"ograve", "242"}, // - lowercase o, grave accent {"oacute", "243"}, // - lowercase o, acute accent {"ocirc", "244"}, // - lowercase o, circumflex accent {"otilde", "245"}, // - lowercase o, tilde {"ouml", "246"}, // - lowercase o, umlaut {"divide", "247"}, // division sign {"oslash", "248"}, // - lowercase o, slash {"ugrave", "249"}, // - lowercase u, grave accent {"uacute", "250"}, // - lowercase u, acute accent {"ucirc", "251"}, // - lowercase u, circumflex accent {"uuml", "252"}, // - lowercase u, umlaut {"yacute", "253"}, // - lowercase y, acute accent {"thorn", "254"}, // - lowercase thorn, Icelandic {"yuml", "255"}, // - lowercase y, umlaut }; // http://www.w3.org/TR/REC-html40/sgml/entities.html // package scoped for testing static final String[][] HTML40_ARRAY = { // {"fnof", "402"}, //latin small f with hook = function= florin, U+0192 ISOtech --> // {"Alpha", "913"}, //greek capital letter alpha, U+0391 --> {"Beta", "914"}, //greek capital letter beta, U+0392 --> {"Gamma", "915"}, //greek capital letter gamma,U+0393 ISOgrk3 --> {"Delta", "916"}, //greek capital letter delta,U+0394 ISOgrk3 --> {"Epsilon", "917"}, //greek capital letter epsilon, U+0395 --> {"Zeta", "918"}, //greek capital letter zeta, U+0396 --> {"Eta", "919"}, //greek capital letter eta, U+0397 --> {"Theta", "920"}, //greek capital letter theta,U+0398 ISOgrk3 --> {"Iota", "921"}, //greek capital letter iota, U+0399 --> {"Kappa", "922"}, //greek capital letter kappa, U+039A --> {"Lambda", "923"}, //greek capital letter lambda,U+039B ISOgrk3 --> {"Mu", "924"}, //greek capital letter mu, U+039C --> {"Nu", "925"}, //greek capital letter nu, U+039D --> {"Xi", "926"}, //greek capital letter xi, U+039E ISOgrk3 --> {"Omicron", "927"}, //greek capital letter omicron, U+039F --> {"Pi", "928"}, //greek capital letter pi, U+03A0 ISOgrk3 --> {"Rho", "929"}, //greek capital letter rho, U+03A1 --> // {"Sigma", "931"}, //greek capital letter sigma,U+03A3 ISOgrk3 --> {"Tau", "932"}, //greek capital letter tau, U+03A4 --> {"Upsilon", "933"}, //greek capital letter upsilon,U+03A5 ISOgrk3 --> {"Phi", "934"}, //greek capital letter phi,U+03A6 ISOgrk3 --> {"Chi", "935"}, //greek capital letter chi, U+03A7 --> {"Psi", "936"}, //greek capital letter psi,U+03A8 ISOgrk3 --> {"Omega", "937"}, //greek capital letter omega,U+03A9 ISOgrk3 --> {"alpha", "945"}, //greek small letter alpha,U+03B1 ISOgrk3 --> {"beta", "946"}, //greek small letter beta, U+03B2 ISOgrk3 --> {"gamma", "947"}, //greek small letter gamma,U+03B3 ISOgrk3 --> {"delta", "948"}, //greek small letter delta,U+03B4 ISOgrk3 --> {"epsilon", "949"}, //greek small letter epsilon,U+03B5 ISOgrk3 --> {"zeta", "950"}, //greek small letter zeta, U+03B6 ISOgrk3 --> {"eta", "951"}, //greek small letter eta, U+03B7 ISOgrk3 --> {"theta", "952"}, //greek small letter theta,U+03B8 ISOgrk3 --> {"iota", "953"}, //greek small letter iota, U+03B9 ISOgrk3 --> {"kappa", "954"}, //greek small letter kappa,U+03BA ISOgrk3 --> {"lambda", "955"}, //greek small letter lambda,U+03BB ISOgrk3 --> {"mu", "956"}, //greek small letter mu, U+03BC ISOgrk3 --> {"nu", "957"}, //greek small letter nu, U+03BD ISOgrk3 --> {"xi", "958"}, //greek small letter xi, U+03BE ISOgrk3 --> {"omicron", "959"}, //greek small letter omicron, U+03BF NEW --> {"pi", "960"}, //greek small letter pi, U+03C0 ISOgrk3 --> {"rho", "961"}, //greek small letter rho, U+03C1 ISOgrk3 --> {"sigmaf", "962"}, //greek small letter final sigma,U+03C2 ISOgrk3 --> {"sigma", "963"}, //greek small letter sigma,U+03C3 ISOgrk3 --> {"tau", "964"}, //greek small letter tau, U+03C4 ISOgrk3 --> {"upsilon", "965"}, //greek small letter upsilon,U+03C5 ISOgrk3 --> {"phi", "966"}, //greek small letter phi, U+03C6 ISOgrk3 --> {"chi", "967"}, //greek small letter chi, U+03C7 ISOgrk3 --> {"psi", "968"}, //greek small letter psi, U+03C8 ISOgrk3 --> {"omega", "969"}, //greek small letter omega,U+03C9 ISOgrk3 --> {"thetasym", "977"}, //greek small letter theta symbol,U+03D1 NEW --> {"upsih", "978"}, //greek upsilon with hook symbol,U+03D2 NEW --> {"piv", "982"}, //greek pi symbol, U+03D6 ISOgrk3 --> // {"bull", "8226"}, //bullet = black small circle,U+2022 ISOpub --> // {"hellip", "8230"}, //horizontal ellipsis = three dot leader,U+2026 ISOpub --> {"prime", "8242"}, //prime = minutes = feet, U+2032 ISOtech --> {"Prime", "8243"}, //double prime = seconds = inches,U+2033 ISOtech --> {"oline", "8254"}, //overline = spacing overscore,U+203E NEW --> {"frasl", "8260"}, //fraction slash, U+2044 NEW --> // {"weierp", "8472"}, //script capital P = power set= Weierstrass p, U+2118 ISOamso --> {"image", "8465"}, //blackletter capital I = imaginary part,U+2111 ISOamso --> {"real", "8476"}, //blackletter capital R = real part symbol,U+211C ISOamso --> {"trade", "8482"}, //trade mark sign, U+2122 ISOnum --> {"alefsym", "8501"}, //alef symbol = first transfinite cardinal,U+2135 NEW --> // // {"larr", "8592"}, //leftwards arrow, U+2190 ISOnum --> {"uarr", "8593"}, //upwards arrow, U+2191 ISOnum--> {"rarr", "8594"}, //rightwards arrow, U+2192 ISOnum --> {"darr", "8595"}, //downwards arrow, U+2193 ISOnum --> {"harr", "8596"}, //left right arrow, U+2194 ISOamsa --> {"crarr", "8629"}, //downwards arrow with corner leftwards= carriage return, U+21B5 NEW --> {"lArr", "8656"}, //leftwards double arrow, U+21D0 ISOtech --> // {"uArr", "8657"}, //upwards double arrow, U+21D1 ISOamsa --> {"rArr", "8658"}, //rightwards double arrow,U+21D2 ISOtech --> // {"dArr", "8659"}, //downwards double arrow, U+21D3 ISOamsa --> {"hArr", "8660"}, //left right double arrow,U+21D4 ISOamsa --> // {"forall", "8704"}, //for all, U+2200 ISOtech --> {"part", "8706"}, //partial differential, U+2202 ISOtech --> {"exist", "8707"}, //there exists, U+2203 ISOtech --> {"empty", "8709"}, //empty set = null set = diameter,U+2205 ISOamso --> {"nabla", "8711"}, //nabla = backward difference,U+2207 ISOtech --> {"isin", "8712"}, //element of, U+2208 ISOtech --> {"notin", "8713"}, //not an element of, U+2209 ISOtech --> {"ni", "8715"}, //contains as member, U+220B ISOtech --> // {"prod", "8719"}, //n-ary product = product sign,U+220F ISOamsb --> // {"sum", "8721"}, //n-ary summation, U+2211 ISOamsb --> // {"minus", "8722"}, //minus sign, U+2212 ISOtech --> {"lowast", "8727"}, //asterisk operator, U+2217 ISOtech --> {"radic", "8730"}, //square root = radical sign,U+221A ISOtech --> {"prop", "8733"}, //proportional to, U+221D ISOtech --> {"infin", "8734"}, //infinity, U+221E ISOtech --> {"ang", "8736"}, //angle, U+2220 ISOamso --> {"and", "8743"}, //logical and = wedge, U+2227 ISOtech --> {"or", "8744"}, //logical or = vee, U+2228 ISOtech --> {"cap", "8745"}, //intersection = cap, U+2229 ISOtech --> {"cup", "8746"}, //union = cup, U+222A ISOtech --> {"int", "8747"}, //integral, U+222B ISOtech --> {"there4", "8756"}, //therefore, U+2234 ISOtech --> {"sim", "8764"}, //tilde operator = varies with = similar to,U+223C ISOtech --> // {"cong", "8773"}, //approximately equal to, U+2245 ISOtech --> {"asymp", "8776"}, //almost equal to = asymptotic to,U+2248 ISOamsr --> {"ne", "8800"}, //not equal to, U+2260 ISOtech --> {"equiv", "8801"}, //identical to, U+2261 ISOtech --> {"le", "8804"}, //less-than or equal to, U+2264 ISOtech --> {"ge", "8805"}, //greater-than or equal to,U+2265 ISOtech --> {"sub", "8834"}, //subset of, U+2282 ISOtech --> {"sup", "8835"}, //superset of, U+2283 ISOtech --> // {"sube", "8838"}, //subset of or equal to, U+2286 ISOtech --> {"supe", "8839"}, //superset of or equal to,U+2287 ISOtech --> {"oplus", "8853"}, //circled plus = direct sum,U+2295 ISOamsb --> {"otimes", "8855"}, //circled times = vector product,U+2297 ISOamsb --> {"perp", "8869"}, //up tack = orthogonal to = perpendicular,U+22A5 ISOtech --> {"sdot", "8901"}, //dot operator, U+22C5 ISOamsb --> // // {"lceil", "8968"}, //left ceiling = apl upstile,U+2308 ISOamsc --> {"rceil", "8969"}, //right ceiling, U+2309 ISOamsc --> {"lfloor", "8970"}, //left floor = apl downstile,U+230A ISOamsc --> {"rfloor", "8971"}, //right floor, U+230B ISOamsc --> {"lang", "9001"}, //left-pointing angle bracket = bra,U+2329 ISOtech --> // {"rang", "9002"}, //right-pointing angle bracket = ket,U+232A ISOtech --> // // {"loz", "9674"}, //lozenge, U+25CA ISOpub --> // {"spades", "9824"}, //black spade suit, U+2660 ISOpub --> // {"clubs", "9827"}, //black club suit = shamrock,U+2663 ISOpub --> {"hearts", "9829"}, //black heart suit = valentine,U+2665 ISOpub --> {"diams", "9830"}, //black diamond suit, U+2666 ISOpub --> // {"OElig", "338"}, // -- latin capital ligature OE,U+0152 ISOlat2 --> {"oelig", "339"}, // -- latin small ligature oe, U+0153 ISOlat2 --> // {"Scaron", "352"}, // -- latin capital letter S with caron,U+0160 ISOlat2 --> {"scaron", "353"}, // -- latin small letter s with caron,U+0161 ISOlat2 --> {"Yuml", "376"}, // -- latin capital letter Y with diaeresis,U+0178 ISOlat2 --> // {"circ", "710"}, // -- modifier letter circumflex accent,U+02C6 ISOpub --> {"tilde", "732"}, //small tilde, U+02DC ISOdia --> // {"ensp", "8194"}, //en space, U+2002 ISOpub --> {"emsp", "8195"}, //em space, U+2003 ISOpub --> {"thinsp", "8201"}, //thin space, U+2009 ISOpub --> {"zwnj", "8204"}, //zero width non-joiner,U+200C NEW RFC 2070 --> {"zwj", "8205"}, //zero width joiner, U+200D NEW RFC 2070 --> {"lrm", "8206"}, //left-to-right mark, U+200E NEW RFC 2070 --> {"rlm", "8207"}, //right-to-left mark, U+200F NEW RFC 2070 --> {"ndash", "8211"}, //en dash, U+2013 ISOpub --> {"mdash", "8212"}, //em dash, U+2014 ISOpub --> {"lsquo", "8216"}, //left single quotation mark,U+2018 ISOnum --> {"rsquo", "8217"}, //right single quotation mark,U+2019 ISOnum --> {"sbquo", "8218"}, //single low-9 quotation mark, U+201A NEW --> {"ldquo", "8220"}, //left double quotation mark,U+201C ISOnum --> {"rdquo", "8221"}, //right double quotation mark,U+201D ISOnum --> {"bdquo", "8222"}, //double low-9 quotation mark, U+201E NEW --> {"dagger", "8224"}, //dagger, U+2020 ISOpub --> {"Dagger", "8225"}, //double dagger, U+2021 ISOpub --> {"permil", "8240"}, //per mille sign, U+2030 ISOtech --> {"lsaquo", "8249"}, //single left-pointing angle quotation mark,U+2039 ISO proposed --> // {"rsaquo", "8250"}, //single right-pointing angle quotation mark,U+203A ISO proposed --> // {"euro", "8364"}, // -- euro sign, U+20AC NEW --> }; // package scoped for testing private EntityMap map = new Entities.LookupEntityMap(); /** *

    * Adds entities to this entity. *

    * * @param entityArray array of entities to be added */ public void addEntities(String[][] entityArray) { for (int i = 0; i < entityArray.length; ++i) { addEntity(entityArray[i][0], Integer.parseInt(entityArray[i][1])); } } /** *

    * Add an entity to this entity. *

    * * @param name name of the entity * @param value vale of the entity */ public void addEntity(String name, int value) { map.add(name, value); } /** *

    * Returns the name of the entity identified by the specified value. *

    * * @param value the value to locate * @return entity name associated with the specified value */ public String entityName(int value) { return map.name(value); } /** *

    * Returns the value of the entity identified by the specified name. *

    * * @param name the name to locate * @return entity value associated with the specified name */ public int entityValue(String name) { return map.value(name); } /** *

    * Escapes the characters in a String. *

    *

    * For example, if you have called addEntity("foo", 0xA1), * escape("\u00A1") will return "&foo;" *

    * * @param str The String to escape. * @return A new escaped String. */ public String escape(String str) { // TODO: rewrite to use a Writer StringBuffer buf = new StringBuffer(str.length() * 2); for (int i = 0; i < str.length(); ++i) { char ch = str.charAt(i); String entityName = this.entityName(ch); if (entityName == null) { if (ch > 0x7F) { buf.append('&'); buf.append('#'); buf.append((int) ch); buf.append(';'); } else { buf.append(ch); } } else { buf.append('&'); buf.append(entityName); buf.append(';'); } } return buf.toString(); } /** *

    * Escapes the characters in the String passed and writes the * result to the Writer passed. *

    * * @param writer The Writer to write the results of the * escaping to. Assumed to be a non-null value. * @param str The String to escape. Assumed to be a non-null * value. * @throws IOException when Writer passed throws the exception * from calls to the {@link Writer#write(int)} methods. * @see #escape(String) * @see Writer */ public void escape(Writer writer, String str) throws IOException { int len = str.length(); for (int i = 0; i < len; i++) { char c = str.charAt(i); String entityName = this.entityName(c); if (entityName == null) { if (c > 0x7F) { writer.write("&#"); writer.write(Integer.toString(c, 10)); writer.write(';'); } else { writer.write(c); } } else { writer.write('&'); writer.write(entityName); writer.write(';'); } } } /** *

    * Unescapes the entities in a String. *

    *

    * For example, if you have called addEntity("foo", 0xA1), * unescape("&foo;") will return "\u00A1" *

    * * @param str The String to escape. * @return A new escaped String or str itself if no unescaping * was necessary. */ public String unescape(String str) { int firstAmp = str.indexOf('&'); if (firstAmp < 0) { return str; } StringBuffer buf = new StringBuffer(str.length()); buf.append(str.substring(0, firstAmp)); for (int i = firstAmp; i < str.length(); ++i) { char ch = str.charAt(i); if (ch == '&') { int semi = str.indexOf(';', i + 1); if (semi == -1) { buf.append(ch); continue; } int amph = str.indexOf('&', i + 1); if (amph != -1 && amph < semi) { // Then the text looks like &...&...; buf.append(ch); continue; } String entityName = str.substring(i + 1, semi); int entityValue; if (entityName.length() == 0) { entityValue = -1; } else if (entityName.charAt(0) == '#') { if (entityName.length() == 1) { entityValue = -1; } else { char charAt1 = entityName.charAt(1); try { if (charAt1 == 'x' || charAt1 == 'X') { entityValue = Integer.valueOf(entityName.substring(2), 16).intValue(); } else { entityValue = Integer.parseInt(entityName.substring(1)); } if (entityValue > 0xFFFF) { entityValue = -1; } } catch (NumberFormatException ex) { entityValue = -1; } } } else { entityValue = this.entityValue(entityName); } if (entityValue == -1) { buf.append('&'); buf.append(entityName); buf.append(';'); } else { buf.append((char) (entityValue)); } i = semi; } else { buf.append(ch); } } return buf.toString(); } /** *

    * Unescapes the escaped entities in the String passed and * writes the result to the Writer passed. *

    * * @param writer The Writer to write the results to; assumed * to be non-null. * @param string The String to write the results to; assumed * to be non-null. * @throws IOException when Writer passed throws the exception * from calls to the {@link Writer#write(int)} methods. * @see #escape(String) * @see Writer */ public void unescape(Writer writer, String string) throws IOException { int firstAmp = string.indexOf('&'); if (firstAmp < 0) { writer.write(string); return; } writer.write(string, 0, firstAmp); int len = string.length(); for (int i = firstAmp; i < len; i++) { char c = string.charAt(i); if (c == '&') { int nextIdx = i + 1; int semiColonIdx = string.indexOf(';', nextIdx); if (semiColonIdx == -1) { writer.write(c); continue; } int amphersandIdx = string.indexOf('&', i + 1); if (amphersandIdx != -1 && amphersandIdx < semiColonIdx) { // Then the text looks like &...&...; writer.write(c); continue; } String entityContent = string.substring(nextIdx, semiColonIdx); int entityValue = -1; int entityContentLen = entityContent.length(); if (entityContentLen > 0) { if (entityContent.charAt(0) == '#') { // escaped value content is an integer (decimal or // hexidecimal) if (entityContentLen > 1) { char isHexChar = entityContent.charAt(1); try { switch (isHexChar) { case 'X' : case 'x' : entityValue = Integer.parseInt(entityContent.substring(2), 16); break; default : entityValue = Integer.parseInt(entityContent.substring(1), 10); } if (entityValue > 0xFFFF) { entityValue = -1; } } catch (NumberFormatException e) { entityValue = -1; } } } else { // escaped value content is an entity name entityValue = this.entityValue(entityContent); } } if (entityValue == -1) { writer.write('&'); writer.write(entityContent); writer.write(';'); } else { writer.write(entityValue); } i = semiColonIdx; // move index up to the semi-colon } else { writer.write(c); } } } private static interface EntityMap { /** *

    * Add an entry to this entity map. *

    * * @param name the entity name * @param value the entity value */ void add(String name, int value); /** *

    * Returns the name of the entity identified by the specified value. *

    * * @param value the value to locate * @return entity name associated with the specified value */ String name(int value); /** *

    * Returns the value of the entity identified by the specified name. *

    * * @param name the name to locate * @return entity value associated with the specified name */ int value(String name); } private static class PrimitiveEntityMap implements EntityMap { private Map mapNameToValue = new HashMap(); private IntHashMap mapValueToName = new IntHashMap(); /** * {@inheritDoc} */ public void add(String name, int value) { mapNameToValue.put(name, new Integer(value)); mapValueToName.put(value, name); } /** * {@inheritDoc} */ public String name(int value) { return (String) mapValueToName.get(value); } /** * {@inheritDoc} */ public int value(String name) { Object value = mapNameToValue.get(name); if (value == null) { return -1; } return ((Integer) value).intValue(); } } private static class LookupEntityMap extends PrimitiveEntityMap { private static final int LOOKUP_TABLE_SIZE = 256; private String[] lookupTable; /** * {@inheritDoc} */ public String name(int value) { if (value < LOOKUP_TABLE_SIZE) { return lookupTable()[value]; } return super.name(value); } /** *

    * Returns the lookup table for this entity map. The lookup table is * created if it has not been previously. *

    * * @return the lookup table */ private String[] lookupTable() { if (lookupTable == null) { createLookupTable(); } return lookupTable; } /** *

    * Creates an entity lookup table of LOOKUP_TABLE_SIZE elements, * initialized with entity names. *

    */ private void createLookupTable() { lookupTable = new String[LOOKUP_TABLE_SIZE]; for (int i = 0; i < LOOKUP_TABLE_SIZE; ++i) { lookupTable[i] = super.name(i); } } } /** *

    * A hash map that uses primitive ints for the key rather than objects. *

    *

    * Note that this class is for internal optimization purposes only, and may * not be supported in future releases of Jakarta Commons Lang. Utilities of * this sort may be included in future releases of Jakarta Commons * Collections. *

    * * @author Justin Couch * @author Alex Chaffee (alex@apache.org) * @author Stephen Colebourne * @since 2.0 * @version $Revision: 8077 $ * @see java.util.HashMap */ private static class IntHashMap { /** * The hash table data. */ private transient Entry table[]; /** * The total number of entries in the hash table. */ private transient int count; /** * The table is rehashed when its size exceeds this threshold. (The value * of this field is (int)(capacity * loadFactor).) * * @serial */ private int threshold; /** * The load factor for the hashtable. * * @serial */ private float loadFactor; /** *

    * Innerclass that acts as a datastructure to create a new entry in the * table. *

    */ private static class Entry { int hash; int key; Object value; Entry next; /** *

    * Create a new entry with the given values. *

    * * @param hash The code used to hash the object with * @param key The key used to enter this in the table * @param value The value for this key * @param next A reference to the next entry in the table */ protected Entry(int hash, int key, Object value, Entry next) { this.hash = hash; this.key = key; this.value = value; this.next = next; } } /** *

    * Constructs a new, empty hashtable with a default capacity and load * factor, which is 20 and 0.75 * respectively. *

    */ public IntHashMap() { this(20, 0.75f); } /** *

    * Constructs a new, empty hashtable with the specified initial capacity * and default load factor, which is 0.75. *

    * * @param initialCapacity the initial capacity of the hashtable. * @throws IllegalArgumentException if the initial capacity is less than * zero. */ public IntHashMap(int initialCapacity) { this(initialCapacity, 0.75f); } /** *

    * Constructs a new, empty hashtable with the specified initial capacity * and the specified load factor. *

    * * @param initialCapacity the initial capacity of the hashtable. * @param loadFactor the load factor of the hashtable. * @throws IllegalArgumentException if the initial capacity is less than * zero, or if the load factor is nonpositive. */ public IntHashMap(int initialCapacity, float loadFactor) { super(); if (initialCapacity < 0) { throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity); } if (loadFactor <= 0) { throw new IllegalArgumentException("Illegal Load: " + loadFactor); } if (initialCapacity == 0) { initialCapacity = 1; } this.loadFactor = loadFactor; table = new Entry[initialCapacity]; threshold = (int) (initialCapacity * loadFactor); } /** *

    * Returns the number of keys in this hashtable. *

    * * @return the number of keys in this hashtable. */ public int size() { return count; } /** *

    * Tests if this hashtable maps no keys to values. *

    * * @return true if this hashtable maps no keys to values; * false otherwise. */ public boolean isEmpty() { return count == 0; } /** *

    * Tests if some key maps into the specified value in this hashtable. * This operation is more expensive than the containsKey * method. *

    *

    * Note that this method is identical in functionality to containsValue, * (which is part of the Map interface in the collections framework). *

    * * @param value a value to search for. * @return true if and only if some key maps to the * value argument in this hashtable as determined * by the equals method; false * otherwise. * @throws NullPointerException if the value is null. * @see #containsKey(int) * @see #containsValue(Object) * @see java.util.Map */ public boolean contains(Object value) { if (value == null) { throw new IllegalArgumentException("parameter value may not be null"); } Entry tab[] = table; for (int i = tab.length; i-- > 0;) { for (Entry e = tab[i]; e != null; e = e.next) { if (e.value.equals(value)) { return true; } } } return false; } /** *

    * Returns true if this HashMap maps one or more keys to * this value. *

    *

    * Note that this method is identical in functionality to contains (which * predates the Map interface). *

    * * @param value value whose presence in this HashMap is to be tested. * @return boolean true if the value is contained * @see java.util.Map * @since JDK1.2 */ public boolean containsValue(Object value) { return contains(value); } /** *

    * Tests if the specified object is a key in this hashtable. *

    * * @param key possible key. * @return true if and only if the specified object is a * key in this hashtable, as determined by the equals * method; false otherwise. * @see #contains(Object) */ public boolean containsKey(int key) { Entry tab[] = table; int hash = key; int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index]; e != null; e = e.next) { if (e.hash == hash) { return true; } } return false; } /** *

    * Returns the value to which the specified key is mapped in this map. *

    * * @param key a key in the hashtable. * @return the value to which the key is mapped in this hashtable; * null if the key is not mapped to any value in * this hashtable. * @see #put(int, Object) */ public Object get(int key) { Entry tab[] = table; int hash = key; int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index]; e != null; e = e.next) { if (e.hash == hash) { return e.value; } } return null; } /** *

    * Increases the capacity of and internally reorganizes this hashtable, * in order to accommodate and access its entries more efficiently. *

    *

    * This method is called automatically when the number of keys in the * hashtable exceeds this hashtable's capacity and load factor. *

    */ protected void rehash() { int oldCapacity = table.length; Entry oldMap[] = table; int newCapacity = oldCapacity * 2 + 1; Entry newMap[] = new Entry[newCapacity]; threshold = (int) (newCapacity * loadFactor); table = newMap; for (int i = oldCapacity; i-- > 0;) { for (Entry old = oldMap[i]; old != null;) { Entry e = old; old = old.next; int index = (e.hash & 0x7FFFFFFF) % newCapacity; e.next = newMap[index]; newMap[index] = e; } } } /** *

    * Maps the specified key to the specified * value in this hashtable. The key cannot be * null. *

    *

    * The value can be retrieved by calling the get method * with a key that is equal to the original key. *

    * * @param key the hashtable key. * @param value the value. * @return the previous value of the specified key in this hashtable, or * null if it did not have one. * @throws NullPointerException if the key is null. * @see #get(int) */ public Object put(int key, Object value) { // Makes sure the key is not already in the hashtable. Entry tab[] = table; int hash = key; int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index]; e != null; e = e.next) { if (e.hash == hash) { Object old = e.value; e.value = value; return old; } } if (count >= threshold) { // Rehash the table if the threshold is exceeded rehash(); tab = table; index = (hash & 0x7FFFFFFF) % tab.length; } // Creates the new entry. Entry e = new Entry(hash, key, value, tab[index]); tab[index] = e; count++; return null; } /** *

    * Removes the key (and its corresponding value) from this hashtable. *

    *

    * This method does nothing if the key is not present in the hashtable. *

    * * @param key the key that needs to be removed. * @return the value to which the key had been mapped in this hashtable, * or null if the key did not have a mapping. */ public Object remove(int key) { Entry tab[] = table; int hash = key; int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e = tab[index], prev = null; e != null; prev = e, e = e.next) { if (e.hash == hash) { if (prev != null) { prev.next = e.next; } else { tab[index] = e.next; } count--; Object oldValue = e.value; e.value = null; return oldValue; } } return null; } /** *

    Clears this hashtable so that it contains no keys.

    */ public synchronized void clear() { Entry tab[] = table; for (int index = tab.length; --index >= 0;) { tab[index] = null; } count = 0; } } } } mule-2.0.1/core/src/main/java/org/mule/util/ObjectNameHelper.java0000644000175000017500000000742210765313375024423 0ustar charlescharles/* * $Id: ObjectNameHelper.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.RegistryContext; import org.mule.api.endpoint.EndpointURI; import org.mule.api.transport.Connector; /** * Generates consistent objects names for Mule components */ // @ThreadSafe public final class ObjectNameHelper { public static final String SEPARATOR = "."; //public static final char HASH = '#'; public static final String CONNECTOR_PREFIX = "connector"; public static final String ENDPOINT_PREFIX = "endpoint"; /** Do not instanciate. */ protected ObjectNameHelper () { // no-op } public static String getEndpointName(final EndpointURI endpointUri) { String address = endpointUri.getAddress(); if (StringUtils.isBlank(address)) { // for some endpoints in TCK like test://xxx address = endpointUri.toString(); } // Make sure we include the endpoint scheme in the name address = (address.indexOf(":/") > -1 ? address : endpointUri.getScheme() + SEPARATOR + address); String name = ENDPOINT_PREFIX + SEPARATOR + replaceObjectNameChars(address); return ensureUniqueEndpoint(name); } protected static String ensureUniqueEndpoint(String name) { int i = 0; String tempName = name; // Check that the generated name does not conflict with an existing global // endpoint. // We can't check local edpoints right now but the chances of conflict are // very small and will be // reported during JMX object registration while (RegistryContext.getRegistry().lookupObject(tempName) != null) { i++; tempName = name + SEPARATOR + i; } return tempName; } protected static String ensureUniqueConnector(String name) { int i = 0; String tempName = name; // Check that the generated name does not conflict with an existing global // endpoint. // We can't check local edpoints right now but the chances of conflict are // very small and will be // reported during JMX object registration try { while (RegistryContext.getRegistry().lookupConnector(tempName) != null) { i++; tempName = name + SEPARATOR + i; } } catch (Exception e) { //ignore } return tempName; } public static String getConnectorName(Connector connector) { if (connector.getName() != null && connector.getName().indexOf('#') == -1) { String name = replaceObjectNameChars(connector.getName()); return ensureUniqueConnector(name); } else { int i = 0; String name = CONNECTOR_PREFIX + SEPARATOR + connector.getProtocol() + SEPARATOR + i; return ensureUniqueConnector(name); } } public static String replaceObjectNameChars(String name) { String value = name.replaceAll("//", SEPARATOR); value = value.replaceAll("\\p{Punct}", SEPARATOR); value = value.replaceAll("\\" + SEPARATOR + "{2,}", SEPARATOR); if (value.endsWith(SEPARATOR)) { value = value.substring(0, value.length() - 1); } return value; } } mule-2.0.1/core/src/main/java/org/mule/util/ExceptionHolder.java0000644000175000017500000000232310745677442024351 0ustar charlescharles/* * $Id: ExceptionHolder.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.beans.ExceptionListener; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** TODO */ public class ExceptionHolder implements ExceptionListener { private List exceptions = new ArrayList(2); public void exceptionThrown(Exception e) { exceptions.add(e); } public List getExceptions() { return exceptions; } public boolean isExceptionThrown() { return exceptions.size() > 0; } public void clear() { exceptions.clear(); } public void print() { for (Iterator iterator = exceptions.iterator(); iterator.hasNext();) { Exception exception = (Exception) iterator.next(); exception.printStackTrace(); } } } mule-2.0.1/core/src/main/java/org/mule/util/pool/0000755000175000017500000000000011351411126021336 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/pool/CommonsPoolObjectPool.java0000644000175000017500000001551110774254333026447 0ustar charlescharles/* * $Id: CommonsPoolObjectPool.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.pool; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.object.ObjectFactory; import org.mule.config.PoolingProfile; import org.mule.config.i18n.MessageFactory; import java.util.ArrayList; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.pool.PoolableObjectFactory; import org.apache.commons.pool.impl.GenericObjectPool; /** * CommonsPoolProxyPool is an implementation of {@link ObjectPool} * that internally uses the commons-pool {@link GenericObjectPool} and uses a * {@link ObjectFactory} for creating new pooled instances. */ public class CommonsPoolObjectPool implements ObjectPool, Initialisable, Disposable { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(CommonsPoolObjectPool.class); /** * The pool */ protected GenericObjectPool pool; /** * The ObjectFactory used to create new pool instances */ protected ObjectFactory objectFactory; /** * The pooling profile used to configure and initialise pool */ protected PoolingProfile poolingProfile; /** * Creates a new pool and an Object factory with the UMODescriptor * * @param descriptor the descriptor to use when constructing MuleProxy objects in * the pool */ public CommonsPoolObjectPool(ObjectFactory objectFactory, PoolingProfile poolingProfile) { this.objectFactory = objectFactory; this.poolingProfile = poolingProfile; } public void initialise() throws InitialisationException { GenericObjectPool.Config config = new GenericObjectPool.Config(); if (poolingProfile != null) { config.maxIdle = poolingProfile.getMaxIdle(); config.maxActive = poolingProfile.getMaxActive(); config.maxWait = poolingProfile.getMaxWait(); config.whenExhaustedAction = (byte) poolingProfile.getExhaustedAction(); } pool = new GenericObjectPool(getPooledObjectFactory(), config); try { applyInitialisationPolicy(); } catch (Exception e) { throw new InitialisationException(e, this); } } /** * Template method to be overridden by implementations that do more than just * invoke objectFactory * * @return */ protected PoolableObjectFactory getPooledObjectFactory() { return new PoolabeObjectFactoryAdaptor(); } protected void applyInitialisationPolicy() throws Exception { if (poolingProfile != null) { int numToBorrow = 0; int initPolicy = poolingProfile.getInitialisationPolicy(); if (initPolicy == PoolingProfile.INITIALISE_ALL) { numToBorrow = poolingProfile.getMaxActive(); } else if (initPolicy == PoolingProfile.INITIALISE_ONE) { numToBorrow = 1; } List holderList = new ArrayList(numToBorrow); try { for (int t = 0; t < numToBorrow; t++) { holderList.add(objectFactory.getInstance()); } } finally { for (int t = 0; t < holderList.size(); t++) { Object obj = holderList.get(t); if (obj != null) { this.returnObject(obj); } } } } } public Object borrowObject() throws Exception { if (pool != null) { return pool.borrowObject(); } else { throw new InitialisationException( MessageFactory.createStaticMessage("Object pool has not been initialized."), this); } } public void returnObject(Object object) { if (pool != null) { try { pool.returnObject(object); } catch (Exception ex) { // declared Exception is never thrown from pool; this is a known bug // in // the pool API } } } public int getNumActive() { return pool.getNumActive(); } public int getMaxActive() { return pool.getMaxActive(); } public void dispose() { if (pool != null) { try { pool.close(); } catch (Exception e) { // close() never throws - wrong method signature } finally { pool = null; } } } public void clear() { if (pool != null) { pool.clear(); } } public void close() { if (pool != null) { try { pool.close(); } catch (Exception e) { // close() never throws - wrong method signature } finally { pool = null; } } } public void setObjectFactory(ObjectFactory objectFactory) { this.objectFactory = objectFactory; } public ObjectFactory getObjectFactory() { return objectFactory; } /** * Wraps org.mule.object.ObjectFactory with commons-pool PoolableObjectFactory */ class PoolabeObjectFactoryAdaptor implements PoolableObjectFactory { public void activateObject(Object obj) throws Exception { // nothing to do } public void destroyObject(Object obj) throws Exception { if (obj instanceof Disposable) { ((Disposable) obj).dispose(); } } public Object makeObject() throws Exception { return objectFactory.getInstance(); } public void passivateObject(Object obj) throws Exception { // nothing to do } public boolean validateObject(Object obj) { return true; } } } mule-2.0.1/core/src/main/java/org/mule/util/pool/DefaultLifecycleEnabledObjectPool.java0000644000175000017500000001011010774254333030647 0ustar charlescharles/* * $Id: DefaultLifecycleEnabledObjectPool.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.pool; import org.mule.api.MuleException; import org.mule.api.component.JavaComponent; import org.mule.api.component.LifecycleAdapter; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Startable; import org.mule.api.lifecycle.Stoppable; import org.mule.api.object.ObjectFactory; import org.mule.component.PooledJavaComponent; import org.mule.config.PoolingProfile; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.pool.PoolableObjectFactory; /** * A LifecyleEnabledObjectPool implementation for pooling {@link LifecycleAdapter} * instances for implementations of {@link JavaComponent} that require * {@link LifecycleAdapter} pooling such as {@link PooledJavaComponent}. * * @see PooledJavaComponent */ public class DefaultLifecycleEnabledObjectPool extends CommonsPoolObjectPool implements LifecyleEnabledObjectPool { /** * logger used by this class */ protected static final Log logger = LogFactory.getLog(DefaultLifecycleEnabledObjectPool.class); protected AtomicBoolean started = new AtomicBoolean(false); private List items = new LinkedList(); /** * @param objectFactory The object factory that should be used to create new * {@link LifecycleAdapter} instance for the pool * @param poolingProfile The pooling progile ot be used to configure pool */ public DefaultLifecycleEnabledObjectPool(ObjectFactory objectFactory, PoolingProfile poolingProfile) { super(objectFactory, poolingProfile); } protected PoolableObjectFactory getPooledObjectFactory() { return new LifecycleEnabledPoolabeObjectFactoryAdaptor(); } public void start() throws MuleException { synchronized (items) { for (Iterator i = items.iterator(); i.hasNext();) { ((Startable) i.next()).start(); } } } public void stop() throws MuleException { synchronized (items) { for (Iterator i = items.iterator(); i.hasNext();) { ((Stoppable) i.next()).stop(); } } } /** * Wraps org.mule.object.ObjectFactory with commons-pool PoolableObjectFactory */ class LifecycleEnabledPoolabeObjectFactoryAdaptor implements PoolableObjectFactory { public void activateObject(Object obj) throws Exception { // nothing to do } public void destroyObject(Object obj) throws Exception { if (started.get() && obj instanceof Stoppable) { ((Stoppable) obj).stop(); } if (obj instanceof Disposable) { ((Disposable) obj).dispose(); } synchronized (items) { items.remove(obj); } } public Object makeObject() throws Exception { Object object = objectFactory.getInstance(); if (!started.get() && object instanceof Startable) { ((Startable) object).start(); } synchronized (items) { items.add(object); } return object; } public void passivateObject(Object obj) throws Exception { // nothing to do } public boolean validateObject(Object obj) { return true; } } } mule-2.0.1/core/src/main/java/org/mule/util/pool/LifecyleEnabledObjectPool.java0000644000175000017500000000133510767256152027213 0ustar charlescharles/* * $Id: LifecyleEnabledObjectPool.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.pool; import org.mule.api.lifecycle.Startable; import org.mule.api.lifecycle.Stoppable; /** * An ObjectPool that allows Start and Stop life-cycle to be propagated pooled * object. */ public interface LifecyleEnabledObjectPool extends ObjectPool, Startable, Stoppable { } mule-2.0.1/core/src/main/java/org/mule/util/pool/ObjectPool.java0000644000175000017500000000174210767256152024265 0ustar charlescharles/* * $Id: ObjectPool.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.pool; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Initialisable; import org.mule.api.object.ObjectFactory; /** * ObjectPool is a simple pooling interface for objects */ public interface ObjectPool extends Initialisable, Disposable { Object borrowObject() throws Exception; void returnObject(Object object); int getNumActive(); int getMaxActive(); void clear(); void close(); void setObjectFactory(ObjectFactory objectFactory); ObjectFactory getObjectFactory(); } mule-2.0.1/core/src/main/java/org/mule/util/JarUtils.java0000644000175000017500000001514010734757176023014 0ustar charlescharles/* * $Id: JarUtils.java 10147 2007-12-27 17:18:54Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Enumeration; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.JarOutputStream; import java.util.zip.ZipEntry; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public final class JarUtils { private static final Log logger = LogFactory.getLog(JarUtils.class); private JarUtils() { // utility class only } public static LinkedHashMap readJarFileEntries(File jarFile) throws Exception { LinkedHashMap entries = new LinkedHashMap(); JarFile jarFileWrapper = null; if (jarFile != null) { logger.debug("Reading jar entries from " + jarFile.getAbsolutePath()); try { jarFileWrapper = new JarFile(jarFile); Enumeration iter = jarFileWrapper.entries(); while (iter.hasMoreElements()) { ZipEntry zipEntry = (ZipEntry) iter.nextElement(); InputStream entryStream = jarFileWrapper.getInputStream(zipEntry); ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream(); try { IOUtils.copy(entryStream, byteArrayStream); entries.put(zipEntry.getName(), byteArrayStream.toByteArray()); logger.debug("Read jar entry " + zipEntry.getName() + " from " + jarFile.getAbsolutePath()); } finally { byteArrayStream.close(); } } } finally { if (jarFileWrapper != null) { try { jarFileWrapper.close(); } catch (Exception ignore) { logger.debug(ignore); } } } } return entries; } public static void appendJarFileEntries(File jarFile, LinkedHashMap entries) throws Exception { if (entries != null) { LinkedHashMap combinedEntries = readJarFileEntries(jarFile); combinedEntries.putAll(entries); File tmpJarFile = File.createTempFile(jarFile.getName(), null); createJarFileEntries(tmpJarFile, combinedEntries); jarFile.delete(); FileUtils.renameFile(tmpJarFile, jarFile); } } public static void createJarFileEntries(File jarFile, LinkedHashMap entries) throws Exception { JarOutputStream jarStream = null; FileOutputStream fileStream = null; if (jarFile != null) { logger.debug("Creating jar file " + jarFile.getAbsolutePath()); try { fileStream = new FileOutputStream(jarFile); jarStream = new JarOutputStream(fileStream); if (entries != null && !entries.isEmpty()) { Iterator iter = entries.keySet().iterator(); while (iter.hasNext()) { String jarFilePath = (String) iter.next(); Object content = entries.get(jarFilePath); JarEntry entry = new JarEntry(jarFilePath); jarStream.putNextEntry(entry); logger.debug("Adding jar entry " + jarFilePath + " to " + jarFile.getAbsolutePath()); if (content instanceof String) { writeJarEntry(jarStream, ((String) content).getBytes()); } else if (content instanceof byte[]) { writeJarEntry(jarStream, (byte[]) content); } else if (content instanceof File) { writeJarEntry(jarStream, (File) content); } } } jarStream.flush(); fileStream.getFD().sync(); } finally { if (jarStream != null) { try { jarStream.close(); } catch (Exception jarNotClosed) { logger.debug(jarNotClosed); } } if (fileStream != null) { try { fileStream.close(); } catch (Exception fileNotClosed) { logger.debug(fileNotClosed); } } } } } private static void writeJarEntry(OutputStream stream, byte[] entry) throws IOException { stream.write(entry, 0, entry.length); } private static void writeJarEntry(OutputStream stream, File entry) throws IOException { FileInputStream fileContentStream = null; try { fileContentStream = new FileInputStream(entry); IOUtils.copy(fileContentStream, stream); } finally { if (fileContentStream != null) { try { fileContentStream.close(); } catch (Exception fileContentNotClosed) { logger.debug(fileContentNotClosed); } } } } } mule-2.0.1/core/src/main/java/org/mule/util/MapCombiner.java0000644000175000017500000001140610745677442023453 0ustar charlescharles/* * $Id: MapCombiner.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * This allows a collection (list) of maps to be defined in Spring, via the "list" property, and * then presents all the maps as a single combine map at run time. For efficiency the combination * of maps is done once and then cached. */ public class MapCombiner implements Map { public static final String LIST = "list"; // the setter/getter public static final int UNLIMITED_DEPTH = -1; private Log logger = LogFactory.getLog(getClass()); private int maxDepth = UNLIMITED_DEPTH; private List list; private Map cachedMerge = new HashMap(); private boolean isMerged = false; private synchronized Map getCachedMerge() { if (!isMerged) { for (Iterator maps = list.iterator(); maps.hasNext();) { mergeMaps(maxDepth, cachedMerge, (Map) maps.next()); } isMerged = true; } return cachedMerge; } public void setMaxDepth(int maxDepth) { this.maxDepth = maxDepth; } private void mergeMaps(int headroom, Map accumulator, Map extra) { for (Iterator keys = extra.keySet().iterator(); keys.hasNext();) { Object key = keys.next(); Object valueExtra = extra.get(key); if (accumulator.containsKey(key)) { Object valueOriginal = accumulator.get(key); if (valueExtra instanceof Map && valueOriginal instanceof Map && headroom != 0) { mergeMaps(headroom - 1, (Map) valueOriginal, (Map) valueExtra); } else if (valueExtra instanceof Collection && valueOriginal instanceof Collection && headroom != 0) { ((Collection) valueOriginal).addAll((Collection) valueExtra); } else { if (logger.isDebugEnabled()) { logger.debug("Overwriting " + valueOriginal + " for " + key + " during map merge"); } accumulator.put(key, valueExtra); } } else { accumulator.put(key, valueExtra); } } } public void setList(List list) { assertNotMerged(); this.list = list; } public List getList() { assertNotMerged(); return list; } private synchronized void assertNotMerged() { if (isMerged) { throw new IllegalStateException("Maps have already been merged"); } } // hashcode, equals and toString don't trigger merge public int hashCode() { return cachedMerge.hashCode(); } public boolean equals(Object o) { return cachedMerge.equals(o); } public String toString() { if (isMerged) { return "merged: " + cachedMerge.toString(); } else { return "unmerged: " + (null == list ? null : list.toString()); } } public int size() { return getCachedMerge().size(); } public void clear() { getCachedMerge().clear(); } public boolean isEmpty() { return getCachedMerge().isEmpty(); } public boolean containsKey(Object key) { return getCachedMerge().containsKey(key); } public boolean containsValue(Object value) { return getCachedMerge().containsValue(value); } public Collection values() { return getCachedMerge().values(); } public void putAll(Map t) { getCachedMerge().putAll(t); } public Set entrySet() { return getCachedMerge().entrySet(); } public Set keySet() { return getCachedMerge().keySet(); } public Object get(Object key) { return getCachedMerge().get(key); } public Object remove(Object key) { return getCachedMerge().remove(key); } public Object put(Object key, Object value) { return getCachedMerge().put(key, value); } }mule-2.0.1/core/src/main/java/org/mule/util/DebugUtils.java0000644000175000017500000000542610664630335023321 0ustar charlescharles/* * $Id: DebugUtils.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.security.Provider; import java.security.Security; import java.util.HashSet; import java.util.Iterator; import java.util.Set; /** * Useful for enumerating debug information about the current Java environment */ // @ThreadSafe public final class DebugUtils { /** Do not instanciate. */ private DebugUtils () { // no-op } /** * @return all available services types */ public static String[] listSecurityServiceTypes() { Set result = new HashSet(); // All all providers Provider[] providers = Security.getProviders(); for (int i = 0; i < providers.length; i++) { // Get services provided by each provider Set keys = providers[i].keySet(); for (Iterator it = keys.iterator(); it.hasNext();) { String key = (String) it.next(); key = key.split(" ")[0]; if (key.startsWith("Alg.Alias.")) { // Strip the alias key = key.substring(10); } int ix = key.indexOf('.'); result.add(key.substring(0, ix)); } } return (String[]) result.toArray(new String[result.size()]); } /** * @return the available implementations for a service type */ public static String[] listCryptoImplementations(String serviceType) { Set result = new HashSet(); // All all providers Provider[] providers = Security.getProviders(); for (int i = 0; i < providers.length; i++) { // Get services provided by each provider Set keys = providers[i].keySet(); for (Iterator it = keys.iterator(); it.hasNext();) { String key = (String) it.next(); key = key.split(" ")[0]; if (key.startsWith(serviceType + ".")) { result.add(key.substring(serviceType.length() + 1)); } else if (key.startsWith("Alg.Alias." + serviceType + ".")) { // This is an alias result.add(key.substring(serviceType.length() + 11)); } } } return (String[]) result.toArray(new String[result.size()]); } } mule-2.0.1/core/src/main/java/org/mule/util/SystemUtils.java0000644000175000017500000003003210774260226023546 0ustar charlescharles/* * $Id: SystemUtils.java 11518 2008-03-31 22:07:18Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.api.DefaultMuleException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.lang.reflect.Method; import java.util.Collections; import java.util.HashMap; import java.util.Map; import org.apache.commons.cli.BasicParser; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; // @ThreadSafe public class SystemUtils extends org.apache.commons.lang.SystemUtils { // class logger protected static final Log logger = LogFactory.getLog(SystemUtils.class); // bash prepends: declare -x // zsh prepends: typeset -x private static final String[] UNIX_ENV_PREFIXES = new String[]{"declare -", "typeset -"}; // the environment of the VM process private static Map environment = null; /** * Get the operating system environment variables. This should work for Windows * and Linux. * * @return Map or an empty map if there was an error. */ public static synchronized Map getenv() { if (environment == null) { try { if (SystemUtils.IS_JAVA_1_4) { // fallback to external process environment = Collections.unmodifiableMap(getenvJDK14()); } else { // the following runaround is necessary since we still want to // compile on JDK 1.4 Class target = System.class; Method envMethod = target.getMethod("getenv", ArrayUtils.EMPTY_CLASS_ARRAY); environment = Collections.unmodifiableMap((Map) envMethod.invoke(target, (Object[]) null)); } } catch (Exception ex) { logger.error("Could not access OS environment: ", ex); environment = Collections.EMPTY_MAP; } } return environment; } private static Map getenvJDK14() throws Exception { Map env = new HashMap(); Process process = null; try { boolean isUnix = true; String command; if (SystemUtils.IS_OS_WINDOWS) { command = "cmd /c set"; isUnix = false; } else { command = "env"; } process = Runtime.getRuntime().exec(command); BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; while ((line = br.readLine()) != null) { for (int prefix = 0; prefix < UNIX_ENV_PREFIXES.length; prefix++) { if (line.startsWith(UNIX_ENV_PREFIXES[prefix])) { line = line.substring(UNIX_ENV_PREFIXES[prefix].length()); } } int index = -1; if ((index = line.indexOf('=')) > -1) { String key = line.substring(0, index).trim(); String value = line.substring(index + 1).trim(); // remove quotes, if any if (isUnix && value.length() > 1 && (value.startsWith("\"") || value.startsWith("'"))) { value = value.substring(1, value.length() - 1); } env.put(key, value); } else { env.put(line, StringUtils.EMPTY); } } } catch (Exception e) { throw e; // bubble up } finally { if (process != null) { process.destroy(); } } return env; } public static String getenv(String name) { return (String) SystemUtils.getenv().get(name); } public static boolean isSunJDK() { return SystemUtils.JAVA_VM_VENDOR.toUpperCase().indexOf("SUN") != -1; } public static boolean isIbmJDK() { return SystemUtils.JAVA_VM_VENDOR.toUpperCase().indexOf("IBM") != -1; } // TODO MULE-1947 Command-line arguments should be handled exclusively by the bootloader private static CommandLine parseCommandLine(String args[], String opts[][]) throws DefaultMuleException { Options options = new Options(); for (int i = 0; i < opts.length; i++) { options.addOption(opts[i][0], opts[i][1].equals("true") ? true : false, opts[i][2]); } BasicParser parser = new BasicParser(); try { CommandLine line = parser.parse(options, args, true); if (line == null) { throw new DefaultMuleException("Unknown error parsing the Mule command line"); } return line; } catch (ParseException p) { throw new DefaultMuleException("Unable to parse the Mule command line because of: " + p.toString(), p); } } /** * Returns the value corresponding to the given option from the command line, for * example if the options are "-config mule-config.xml" * getCommandLineOption("config") would return "mule-config.xml" */ // TODO MULE-1947 Command-line arguments should be handled exclusively by the bootloader public static String getCommandLineOption(String option, String args[], String opts[][]) throws DefaultMuleException { CommandLine line = parseCommandLine(args, opts); return line.getOptionValue(option); } /** * Checks whether a command line option is set. This is useful for command line * options that don't have an argument, like "-cluster", which means that this * Mule instance is part of a cluster. */ // TODO MULE-1947 Command-line arguments should be handled exclusively by the bootloader public static boolean hasCommandLineOption(String option, String args[], String opts[][]) throws DefaultMuleException { CommandLine line = parseCommandLine(args, opts); return line.hasOption(option); } /** * Returns a Map of all options in the command line. The Map is keyed off the * option name. The value will be whatever is present on the command line. * Options that don't have an argument will have the String "true". */ // TODO MULE-1947 Command-line arguments should be handled exclusively by the bootloader public static Map getCommandLineOptions(String args[], String opts[][]) throws DefaultMuleException { CommandLine line = parseCommandLine(args, opts); Map ret = new HashMap(); Option[] options = line.getOptions(); for (int i = 0; i < options.length; i++) { Option option = options[i]; ret.put(option.getOpt(), option.getValue("true")); } return ret; } /** * Returns a Map of all valid property definitions in -Dkey=value * format. -Dkey is interpreted as -Dkey=true, * everything else is ignored. Whitespace in values is properly handled but needs * to be quoted properly: -Dkey="some value". * * @param input String with property definitionn * @return a {@link Map} of property String keys with their defined values * (Strings). If no valid key-value pairs can be parsed, the map is * empty. */ public static Map parsePropertyDefinitions(String input) { if (StringUtils.isEmpty(input)) { return Collections.EMPTY_MAP; } // the result map of property key/value pairs final Map result = new HashMap(); // where to begin looking for key/value tokens int tokenStart = 0; // this is the main loop that scans for all tokens findtoken : while (tokenStart < input.length()) { // find first definition or bail tokenStart = StringUtils.indexOf(input, "-D", tokenStart); if (tokenStart == StringUtils.INDEX_NOT_FOUND) { break findtoken; } else { // skip leading -D tokenStart += 2; } // find key int keyStart = tokenStart; int keyEnd = keyStart; if (keyStart == input.length()) { // short input: '-D' only break; } // let's check out what we have next char cursor = input.charAt(keyStart); // '-D xxx' if (cursor == ' ') { continue findtoken; } // '-D=' if (cursor == '=') { // skip over garbage to next potential definition tokenStart = StringUtils.indexOf(input, ' ', tokenStart); if (tokenStart != StringUtils.INDEX_NOT_FOUND) { // '-D= ..' - continue with next token continue findtoken; } else { // '-D=' - get out of here break findtoken; } } // apparently there's a key, so find the end findkey : while (keyEnd < input.length()) { cursor = input.charAt(keyEnd); // '-Dkey ..' if (cursor == ' ') { tokenStart = keyEnd; break findkey; } // '-Dkey=..' if (cursor == '=') { break findkey; } // keep looking keyEnd++; } // yay, finally a key String key = StringUtils.substring(input, keyStart, keyEnd); // assume that there is no value following int valueStart = keyEnd; int valueEnd = keyEnd; // default value String value = "true"; // now find the value, but only if the current cursor is not a space if (keyEnd < input.length() && cursor != ' ') { // bump value start/end valueStart = keyEnd + 1; valueEnd = valueStart; // '-Dkey="..' cursor = input.charAt(valueStart); if (cursor == '"') { // opening " valueEnd = StringUtils.indexOf(input, '"', ++valueStart); } else { // unquoted value valueEnd = StringUtils.indexOf(input, ' ', valueStart); } // no '"' or ' ' delimiter found - use the rest of the string if (valueEnd == StringUtils.INDEX_NOT_FOUND) { valueEnd = input.length(); } // create value value = StringUtils.substring(input, valueStart, valueEnd); } // finally create key and value && loop again for next token result.put(key, value); // start next search at end of value tokenStart = valueEnd; } return result; } } mule-2.0.1/core/src/main/java/org/mule/util/concurrent/0000755000175000017500000000000011351411125022546 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/util/concurrent/WaitableBoolean.java0000644000175000017500000000756310664630335026470 0ustar charlescharles/* * $Id: WaitableBoolean.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.concurrent; // @ThreadSafe public class WaitableBoolean extends SynchronizedVariable { // @GuardedBy(lock) private boolean value; public WaitableBoolean(boolean initialValue) { super(); synchronized (lock) { value = initialValue; } } public WaitableBoolean(boolean initialValue, Object lock) { super(lock); synchronized (this.lock) { value = initialValue; } } public int compareTo(boolean other) { synchronized (lock) { return (value == other ? 0 : (value ? 1 : -1)); } } public int compareTo(WaitableBoolean other) { return this.compareTo(other.get()); } public int compareTo(Object other) { return this.compareTo((WaitableBoolean) other); } public boolean equals(Object other) { if (other == this) { return true; } else if (other instanceof WaitableBoolean) { synchronized (lock) { return (value == ((WaitableBoolean) other).get()); } } else { return false; } } public int hashCode() { return (this.get() ? 3412688 : 8319343); // entirely arbitrary } public String toString() { return Boolean.toString(this.get()); } public boolean get() { synchronized (lock) { return value; } } public boolean set(boolean newValue) { synchronized (lock) { lock.notifyAll(); boolean oldValue = value; value = newValue; return oldValue; } } public boolean compareAndSet(boolean assumedValue, boolean newValue) { synchronized (lock) { boolean success = (value == assumedValue); if (success) { value = newValue; lock.notifyAll(); } return success; } } public boolean complement() { synchronized (lock) { lock.notifyAll(); return (value = !value); } } public boolean and(boolean b) { synchronized (lock) { lock.notifyAll(); return (value &= b); } } public synchronized boolean or(boolean b) { synchronized (lock) { lock.notifyAll(); return (value |= b); } } public boolean xor(boolean b) { synchronized (lock) { lock.notifyAll(); return (value ^= b); } } public void whenTrue(Runnable action) throws InterruptedException { this.whenEqual(true, action); } public void whenFalse(Runnable action) throws InterruptedException { this.whenNotEqual(true, action); } public void whenEqual(boolean condition, Runnable action) throws InterruptedException { synchronized (lock) { while (value != condition) { lock.wait(); } if (action != null) { this.execute(action); } } } public void whenNotEqual(boolean condition, Runnable action) throws InterruptedException { this.whenEqual(!condition, action); } } mule-2.0.1/core/src/main/java/org/mule/util/concurrent/SynchronizedVariable.java0000644000175000017500000000203210664630335027547 0ustar charlescharles/* * $Id: SynchronizedVariable.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.concurrent; import edu.emory.mathcs.backport.java.util.concurrent.Executor; // @ThreadSafe public abstract class SynchronizedVariable implements Executor { // @GuardedBy(itself) protected final Object lock; public SynchronizedVariable() { super(); lock = this; } public SynchronizedVariable(Object lock) { super(); this.lock = lock; } public Object getLock() { return lock; } public void execute(Runnable command) { synchronized (lock) { command.run(); } } } mule-2.0.1/core/src/main/java/org/mule/util/concurrent/WaitPolicy.java0000644000175000017500000000423310705704377025517 0ustar charlescharles/* * $Id: WaitPolicy.java 9208 2007-10-18 16:25:35Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.concurrent; import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionException; import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionHandler; import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; /** * A handler for unexecutable tasks that waits until the task can be submitted for * execution or times out. Generously snipped from the jsr166 repository at: . */ // @Immutable public class WaitPolicy implements RejectedExecutionHandler { private final long time; private final TimeUnit timeUnit; /** * Constructs a WaitPolicy which waits (almost) forever. */ public WaitPolicy() { // effectively waits forever this(Long.MAX_VALUE, TimeUnit.SECONDS); } /** * Constructs a WaitPolicy with timeout. A negative time * value is interpreted as Long.MAX_VALUE. */ public WaitPolicy(long time, TimeUnit timeUnit) { super(); this.time = (time < 0 ? Long.MAX_VALUE : time); this.timeUnit = timeUnit; } public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { try { if (e.isShutdown() || !e.getQueue().offer(r, time, timeUnit)) { // TODO better message throw new RejectedExecutionException(); } } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new RejectedExecutionException(ie); } } } mule-2.0.1/core/src/main/java/org/mule/util/concurrent/DaemonThreadFactory.java0000644000175000017500000000152510664630335027313 0ustar charlescharles/* * $Id: DaemonThreadFactory.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.concurrent; import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory; public class DaemonThreadFactory extends NamedThreadFactory implements ThreadFactory { public DaemonThreadFactory(String name) { super(name); } public Thread newThread(Runnable runnable) { Thread t = super.newThread(runnable); t.setDaemon(true); return t; } } mule-2.0.1/core/src/main/java/org/mule/util/concurrent/ConcurrentHashSet.java0000644000175000017500000000564110664630335027035 0ustar charlescharles/* * $Id: ConcurrentHashSet.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.concurrent; /* * Written by Doug Lea with assistance from members of JCP JSR-166 Expert Group and * released to the public domain, as explained at * http://creativecommons.org/licenses/publicdomain */ import java.io.IOException; import java.io.Serializable; import java.util.AbstractSet; import java.util.Collection; import java.util.Iterator; import java.util.Set; import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap; public class ConcurrentHashSet/* */extends AbstractSet/* */implements Set/* */, Serializable { private static final long serialVersionUID = 2454657854757543876L; private final ConcurrentHashMap/* */map; private transient Set/* */keySet; public ConcurrentHashSet() { map = new ConcurrentHashMap/* */(); keySet = map.keySet(); } public ConcurrentHashSet(int initialCapacity) { map = new ConcurrentHashMap/* */(initialCapacity); keySet = map.keySet(); } public ConcurrentHashSet(int initialCapacity, float loadFactor, int concurrencyLevel) { map = new ConcurrentHashMap/* */(initialCapacity, loadFactor, concurrencyLevel); keySet = map.keySet(); } public int size() { return map.size(); } public boolean isEmpty() { return map.isEmpty(); } public boolean contains(Object o) { return map.containsKey(o); } public Iterator/* */iterator() { return keySet.iterator(); } public Object[] toArray() { return keySet.toArray(); } public/* T[] */Object[] toArray(Object[]/* T[] */a) { return keySet.toArray(a); } public boolean add(Object/* E */e) { return map.put(e, Boolean.TRUE) == null; } public boolean remove(Object o) { return map.remove(o) != null; } public boolean removeAll(Collection/* */c) { return keySet.removeAll(c); } public boolean retainAll(Collection/* */c) { return keySet.retainAll(c); } public void clear() { map.clear(); } public boolean equals(Object o) { return keySet.equals(o); } public int hashCode() { return keySet.hashCode(); } private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); keySet = map.keySet(); } } mule-2.0.1/core/src/main/java/org/mule/util/concurrent/Latch.java0000644000175000017500000000117110664630335024460 0ustar charlescharles/* * $Id: Latch.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.concurrent; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; // @ThreadSafe public class Latch extends CountDownLatch { public Latch() { super(1); } } mule-2.0.1/core/src/main/java/org/mule/util/concurrent/NamedThreadFactory.java0000644000175000017500000000227210664630335027134 0ustar charlescharles/* * $Id: NamedThreadFactory.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.concurrent; import org.mule.util.StringUtils; import edu.emory.mathcs.backport.java.util.concurrent.ThreadFactory; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong; public class NamedThreadFactory implements ThreadFactory { private final String name; private final AtomicLong counter; public NamedThreadFactory(String name) { if (StringUtils.isEmpty(name)) { throw new IllegalArgumentException("NamedThreadFactory must have a proper name."); } this.name = name; this.counter = new AtomicLong(1); } public Thread newThread(Runnable runnable) { Thread t = new Thread(runnable, name + '.' + counter.getAndIncrement()); return t; } } mule-2.0.1/core/src/main/java/org/mule/interceptor/0000755000175000017500000000000011351411102021740 5ustar charlescharlesmule-2.0.1/core/src/main/java/org/mule/interceptor/RequestContextInvocation.java0000644000175000017500000000174710762020555027660 0ustar charlescharles/* * $Id: RequestContextInvocation.java 11130 2008-02-29 15:14:53Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.interceptor; import org.mule.api.interceptor.Invocation; import org.mule.api.MuleMessage; import org.mule.api.MuleEvent; import org.mule.api.service.Service; import org.mule.RequestContext; public abstract class RequestContextInvocation implements Invocation { public Service getService() { return RequestContext.getEventContext().getService(); } public MuleEvent getEvent() { return RequestContext.getEvent(); } public MuleMessage getMessage() { return getEvent().getMessage(); } } mule-2.0.1/core/src/main/java/org/mule/interceptor/InterceptorException.java0000644000175000017500000000117110762020555026775 0ustar charlescharles/* * $Id: InterceptorException.java 11130 2008-02-29 15:14:53Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.interceptor; import org.mule.api.MuleException; public class InterceptorException extends MuleException { public InterceptorException(Throwable e) { super(e); } } mule-2.0.1/core/src/main/resources/0000755000175000017500000000000011351411132016745 5ustar charlescharlesmule-2.0.1/core/src/main/resources/configuration-builders.properties0000644000175000017500000000037210754403514025556 0ustar charlescharles# Properties format: # fileExtenstion=builderClass # Spring xml=org.mule.config.spring.SpringXmlConfigurationBuilder # Groovy groovy=org.mule.config.builders.ScriptConfigurationBuilder # JRuby rb=org.mule.config.builders.ScriptConfigurationBuilder mule-2.0.1/core/src/main/resources/MULE_LICENSE.txt0000644000175000017500000006623410664630335021443 0ustar charlescharlesCommon Public Attribution License Version 1.0 (CPAL) 1. "Definitions" 1.0.1 "Commercial Use" means distribution or otherwise making the Covered Code available to a third party. 1.1 "Contributor" means each entity that creates or contributes to the creation of Modifications. 1.2 "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. 1.3 "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. 1.4 "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data. 1.5 "Executable" means Covered Code in any form other than Source Code. 1.6 "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. 1.7 "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. 1.8 "License" means this document. 1.8.1 "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 1.9 "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is: A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. B. Any new file that contains any part of the Original Code or previous Modifications. 1.10 "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. 1.10.1 "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. 1.11 "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. 1.12 "You" (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. Source Code License. 2.1 The Initial Developer Grant. The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and (b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof). (c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License. (d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices. 2.2 Contributor Grant. Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). (c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code. (d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor. 3. Distribution Obligations. 3.1 Application of License. The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. 3.2 Availability of Source Code. Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. 3.3 Description of Modifications. You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. 3.4 Intellectual Property Matters (a) Third Party Claims. If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. (b) Contributor APIs. If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file. (c) Representations. Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License. 3.5 Required Notices. You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 3.6 Distribution of Executable Versions. You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer, Original Developer or any Contributor. You hereby agree to indemnify the Initial Developer, Original Developer and every Contributor for any liability incurred by the Initial Developer, Original Developer or such Contributor as a result of any such terms You offer. 3.7 Larger Works. You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. 4. Inability to Comply Due to Statute or Regulation. If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Application of this License. This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code. 6. Versions of the License. 6.1 New Versions. MuleSource, Inc. ("MuleSource") may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. 6.2 Effect of New Versions. Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Socialtext. No one other than MuleSource has the right to modify the terms applicable to Covered Code created under this License. 6.3 Derivative Works. If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases "MuleSource", "CPAL" or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the CPAL. (Filling in the name of the Initial Developer, Original Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.) 7. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER, ORIGINAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 8. TERMINATION. 8.1 This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 8.2 If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer, Original Developer or a Contributor (the Initial Developer, Original Developer or Contributor against whom You file such action is referred to as "Participant") alleging that: (a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above. (b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant. 8.3 If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license. 8.4 In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination. 9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ORIGINAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 10. U.S. GOVERNMENT END USERS. The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. 11. MISCELLANEOUS. This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. 12. RESPONSIBILITY FOR CLAIMS. As between Initial Developer, Original Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer, Original Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. 13. MULTIPLE-LICENSED CODE. Initial Developer may designate portions of the Covered Code as Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the CPAL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A. 14. ADDITIONAL TERM: ATTRIBUTION (a) As a modest attribution to the organizer of the development of the Original Code ("Original Developer"), in the hope that its promotional value may help justify the time, money and effort invested in writing the Original Code, the Original Developer may include in Exhibit B ("Attribution Information") a requirement that each time an Executable and Source Code or a Larger Work is launched or initially run (which includes initiating a session), a prominent display of the Original Developer's Attribution Information (as defined below) must occur on the graphic user interface employed by the end user to access such Covered Code (which may include display on a splash screen), if any. The size of the graphic image should be consistent with the size of the other elements of the Attribution Information. If the access by the end user to the Executable and Source Code does not create a graphic user interface for access to the Covered Code, this obligation shall not apply. If the Original Code displays such Attribution Information in a particular form (such as in the form of a splash screen, notice at login, an "about" display, or dedicated attribution area on user interface screens), continued use of such form for that Attribution Information is one way of meeting this requirement for notice. (b) Attribution information may only include a copyright notice, a brief phrase, graphic image and a URL ("Attribution Information") and is subject to the Attribution Limits as defined below. For these purposes, prominent shall mean display for sufficient duration to give reasonable notice to the user of the identity of the Original Developer and that if You include Attribution Information or similar information for other parties, You must ensure that the Attribution Information for the Original Developer shall be no less prominent than such Attribution Information or similar information for the other party. For greater certainty, the Original Developer may choose to specify in Exhibit B below that the above attribution requirement only applies to an Executable and Source Code resulting from the Original Code or any Modification, but not a Larger Work. The intent is to provide for reasonably modest attribution, therefore the Original Developer cannot require that You display, at any time, more than the following information as Attribution Information: (a) a copyright notice including the name of the Original Developer; (b) a word or one phrase (not exceeding 10 words); (c) one graphic image provided by the Original Developer; and (d) a URL (collectively, the "Attribution Limits"). (c) If Exhibit B does not include any Attribution Information, then there are no requirements for You to display any Attribution Information of the Original Developer. (d) You acknowledge that all trademarks, service marks and/or trade names contained within the Attribution Information distributed with the Covered Code are the exclusive property of their owners and may only be used with the permission of their owners, or under circumstances otherwise permitted by law or as expressly set out in this License. 15. ADDITIONAL TERM: NETWORK USE. The term "External Deployment" means the use, distribution, or communication of the Original Code or Modifications in any way such that the Original Code or Modifications may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Code or Modifications as a distribution under section 3.1 and make Source Code available under Section 3.2. EXHIBIT A. Common Public Attribution License Version 1.0. "The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mulesource.com/CPAL/. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is MuleSource Mule The Initial Developer of the Original Code is MuleSource Inc. All portions of the code are Copyright (c) 2003-2007 MuleSource Inc. All Rights Reserved. EXHIBIT B. Attribution Information Subject to the limitations and other requirements in Section 14 of the License, the Original Developer requires You to display the following Attribution Information: Attribution Copyright Notice: Copyright (c) 2003-2007 MuleSource Inc. Attribution Phrase (not exceeding 10 words): Powered by Mule. MuleSource is Open for Integration. Attribution URL: http://www.mulesource.com Graphic Image provided in the Covered Code as file: http://www.mulesource.com/images/mulesource_license_logo.gif Redistributions of the Covered Code in binary form or source code form, must ensure that the first time the resulting executable program is launched, a user interface, if any, shall include the attribution information set forth below prominently. If the executable program does not launch a user interface, the Company name and URL shall be included in the notice section of each file of the Covered Code. : Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL. mule-2.0.1/core/src/main/resources/META-INF/0000755000175000017500000000000011351411132020105 5ustar charlescharlesmule-2.0.1/core/src/main/resources/META-INF/services/0000755000175000017500000000000011351411131021727 5ustar charlescharlesmule-2.0.1/core/src/main/resources/META-INF/services/org/0000755000175000017500000000000011351411131022516 5ustar charlescharlesmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/0000755000175000017500000000000011351411132023461 5ustar charlescharlesmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/providers/0000755000175000017500000000000011351411132025476 5ustar charlescharlesmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/providers/test.properties0000644000175000017500000000073010745677442030623 0ustar charlescharlesconnector=org.mule.tck.testmodels.mule.TestConnector message.adapter=org.mule.transport.DefaultMessageAdapter dispatcher.factory=org.mule.tck.testmodels.mule.TestMessageDispatcherFactory endpoint.builder=org.mule.endpoint.ResourceNameEndpointURIBuilder inbound.transformer=org.mule.tck.testmodels.mule.TestInboundTransformer response.transformer=org.mule.tck.testmodels.mule.TestResponseTransformer outbound.transformer=org.mule.tck.testmodels.mule.TestOutboundTransformermule-2.0.1/core/src/main/resources/META-INF/services/org/mule/providers/test2.properties0000644000175000017500000000037510745677442030712 0ustar charlescharlesconnector=org.mule.tck.testmodels.mule.TestConnector2 message.adapter=org.mule.transport.DefaultMessageAdapter dispatcher.factory=org.mule.tck.testmodels.mule.TestMessageDispatcherFactory endpoint.builder=org.mule.endpoint.ResourceNameEndpointURIBuildermule-2.0.1/core/src/main/resources/META-INF/services/org/mule/models/0000755000175000017500000000000011351411132024744 5ustar charlescharlesmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/models/inherited.properties0000644000175000017500000000030610565333253031051 0ustar charlescharles#Note this model type is abstract in that it is only used to hold Service decriptors during configuration when #processing Mule 1.x legacy configuration model=org.mule.config.support.InheritedModelmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/models/direct.properties0000644000175000017500000000004710745677442030365 0ustar charlescharlesmodel=org.mule.model.direct.DirectModelmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/models/streaming.properties0000644000175000017500000000005510745677442031103 0ustar charlescharlesmodel=org.mule.model.streaming.StreamingModelmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/models/pipeline.properties0000644000175000017500000000005310745677442030715 0ustar charlescharlesmodel=org.mule.model.pipeline.PipelineModelmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/models/simple.properties0000644000175000017500000000004710745677442030404 0ustar charlescharlesmodel=org.mule.model.simple.SimpleModelmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/models/seda-optimised.properties0000644000175000017500000000006610745677442032023 0ustar charlescharlesmodel=org.mule.model.seda.optimised.OptimisedSedaModelmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/models/seda.properties0000644000175000017500000000004310745677442030023 0ustar charlescharlesmodel=org.mule.model.seda.SedaModelmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/models/default.properties0000644000175000017500000000004310745677442030533 0ustar charlescharlesmodel=org.mule.model.seda.SedaModelmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/i18n/0000755000175000017500000000000011351411132024240 5ustar charlescharlesmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/i18n/core-messages.properties0000644000175000017500000003674011002221467031130 0ustar charlescharles0=No Message was set 1=Mule Version Info not set 2=Server started: {0} 3=Server shutdown: {0} 4=Agents Running: 5=Not Set 6=Version: {0} 7=Mule shut down normally on: {0} 8=Server was up for: {0} 9=\n\n\ *******************************************************************************\n\ No config file specified and no config by the name of mule-config.xml\n\ found on the classpath.\n\ \nUsage: mule -config [-builder ] [-debug] [-version]\n\ \n mule-configuration - a URL for the Mule Config XML to use,\ \n if not specified the config will be loaded from\ \n the classpath\n\ \n config-builder - a fully qualified class name of the builder to use\ \n to configure Mule.\n\ \n debug - configure Mule for JPDA remote debugging.\ \n Customize settings by editing a JPDA_OPTS variable\ \n in the 'mule' startup script\n\ \n version - print full product information\n\ *******************************************************************************\n\n 10=A Fatal error has occurred while the server was running: 11=Root Exception stack trace: 12=Exception stack is: 13=For more information about this exception see - 14=For more information see - 15=JavaDoc Reference: 16=Documentation Reference: 17=See exception below for details 18=Message payload is of type: {0} 19=Message Details: 20=The error is fatal, the system must shutdown 21=The server is shutting down due to normal shutdown request 22=None 23=Not clustered 30=Failed to route event via endpoint: {0} 31=No component implementation found as local reference using: {0} 32=Cannot perform an action on a connector when it is or while it is being disposed 33=Connector that caused exception is: {0} 34=Endpoint cannot be null when registering a listener 35=There is already a listener registered on this connector on endpointUri: {0} 36=Connector "{0}" has not been started. Cannot create dispatcher 37=Object "{0}" has already been initialised 38=Component that caused exception is: {0} 39=Object that caused exception is: {0} 40={0} Failed to initialise 41=Failed to stop {0} 42=Failed to start {0} 43=Proxy pool timed out 44=Failed to borrow object from pool 45=The required object/property "{0}" is null 46=Component not registered: {0} 47=Failed to register listener {0} on endpoint {1} 48=Failed to unregister listener {0} on endpoint {1} 49=Failed to pause {0} 50=Failed to resume {0} 51=The endpoint "{0}" is malformed and cannot be parsed. If this is the name of a global endpoint, check the name is correct, that the endpoint exists, and that you are using the correct configuration (eg the "ref" attribute). Note that names on inbound and outbound endpoints cannot be used to send or receive messages; use a named global endpoint instead. 52=Failed to transform message before applying the filter 53=The object transformed is of type: "{0}", but the expected return type is "{1}" 54=The transformer "{0}" does not support source type "{1}". Endpoint is "{2}" 55=Failed to transform data from {0} 57=Failed to load {0} transformer "{1}" 58=Failed to load {0} 59=Message type "{0}" is not supported by adapter "{1}" 60=Found too many possible methods on object "{0}" that accept parameters "{1}" 61=Failed to set property "{0}" on object "{1}" with parameter type "{2}" 62=Failed to obtain session for component "{0}" while reloading persistent queue 63=Failed to find endpoint "{0}" for component "{1}" while reloading persistent queue 64=Cannot dispatch event, Endpoint is a receiver endpoint and there is no current component 65=Failed to create {0} 66=There is no Correlation Id set on the message 67=Failed while disposing {0} 68=Failed to invoke {0} 69=Could not read message payload as bytes (byte[]). Payload type is "{0}" 70=Could not read message payload as String. Payload type is "{0}" 71=Class "{0}" not found on classpath 72=Failed to route event to component "{0}". The endpoint received on is "{0}" 73=Failed to instanciate finder class "{0}" 74=Failed to create "{0}" with "{1}" 75="{0}" not set in service descriptor "{1}" 76=Object "{0}" not found in container 77=Cannot commit transaction transaction is marked for rollback 78=Can not bind resource to a null key 79=Can not bind a null resource 80=Only a single resource can be bound to this type of transaction 81=This transformer can only be invoked when an event is being processed. It needs a current event to perform a transform 82=OBject of type "{0}" with name "{1}" is not available in the registry 83=Failed to set properties on {0} 84=Failed to create connector from Uri: {0} 85=Initialisation Failure: {0} 86=Failed to initialise interceptors on component "{0}" 87=Failed to create endpoint from service location: {0} 88=Manager is already started 89=No endpoints are set on this router, cannot route message 90=Response timed out ({0}ms) waiting for message response id "{1}" or this action was interrupted. 91=Component implementation type is "local" but no property called "{0}" is set on the descriptor "{1}" 92=Failed to instanciate non-container managed object reference "{0}" 93=Failed to receive event over: {0} (timeout={1}) 94=Failed to write message id "{0}" to store: {1} 95=Failed to read from store: {0} 96=Can not start {0} transaction 97=Transaction commit failed 98=Transaction rollback failed 99=Unable to read transaction state 100=A resource has already been enlisted for key "{0}" 101=There is no outbound router configured on component "{0}" 102=Failed to set property "{0}" on object "{1}" 103=A transaction is available for this session, but transaction action is "{0}" 104=A transaction is not available for this session, but transaction action is "{0}" 105=Cannot route event in Catch all as no endpoint has been set 106=Interrupted while queue event for "{0}" 107=Failed unbind transaction, current transaction and referenced transaction are not the same 108=Cannot bind transaction as a transaction is already bound 109=Invocation error. Method "{0}", with parameters "{1}" not found on "{2}" 110=Failed to transform from "{0}" to "{1}" 112=Crypto Failure 115=The Endpoint Uri scheme "{0}" is not compatible with Connector "{1}" 116=Could not find entry point on: "{0}" with arguments: "{1}" 117=There is no Security Provider reqistered called "{0}" 120=Can only bind "{0}" type resources 122=Failed to load "{0}" from classpath or file system 124=Failed to read payload data 126=Endpoint "{0}" not found 127=Failed to process event for component "{0}" 128=Failed to dispatch event on replyTo destination "{0}" 130=Crypto strategy is: {0} 131=The authentication type {0} is not recognised by the Security Manager 132=A Security Manager has not been configured on this Mule instance 133=Registered authentication is set to {0} but there was no security context on the session 135=Authentication failed for principal {0} 136=The Endpoint that this security filter is associated with must be able to send or receive (it cannot be global). 137=No Authentication Provider registered for "{0}" 140=The transaction manager on the MuleManager cannot be set one has already been set 141=Could not recover container configuration from fragment 142=For this builder the config resources should be null (and "mule-config.xml" will be used by default)\ or a single name of the resuorces to look up should be specified 143=Only CustomEvent events can be fired through the MuleManager 144=Failed to create UMOManager instance "{0}" 145=Failed to clone {0} 146=Exception occurred on connector "{0}". Exception evaluator is not set. This could result in message loss 147=Adapter "{0}" does not support unique identifiers 148=Failed to persist queued event {0} 150=Server Notification Manager is not enabled. Cannot register event listeners. This usually occurs if the Mule is running in client mode. 151=Failed to schedule work with the Work manager 152=No credentials set 154=The value "{0}" is invalid for property "{1}", check the relevant documentation 155=A container is already registered with the name "{0}" 156=A connector with protocol "{0}" is not registered with this Mule instance 157=Object "{0}" is not of supported type "{1}" it is of type "{2}" 161=Resource manager has not been started 162=Resource manager is set to dirty, this *may* mean it is corrupt. No modifications are allowed until a recovery run has been performed! 163=Resource manager is not ready 164=ReconnectStrategy "{0}" failed to reconnect receiver on endpoint "{1}" 165=Cannot not set property "{0}" once it has already been set 166=Event type "{0}" not recognised by this event manager 167=Cannot route event as component "{0}" is stopped 168=The required property "{0}" is not set on the event 171=Descriptor "{0}" already exists in the model 172=Failed to invoke REST service "{0}" 174=There is no Encryption Strategy registered called "{0}" 175=Header field "{0}" is malformed. Value is "{1}" 176=A transaction manager is required but no set on this Mule instance 177=Transform on event for component "{0}" not of type requested by component, type needed is "{1}" 178=An endpoint cannot use remote Sync when it is transacted. Check your endpoint configuration 180=Failed to build message. See next excpetion trace for more details 181=There were no matching methods for args "{0}" on object "{1}" #No longer Used #182=There were too many matching methods for args "{0}" on object "{1}" 183=Property "{0}" not set. One or more of them must be set 184=Script engine is invalid, it must be a compilable engine. 185=Object "{0}" not of correct type. It must be of type "{1}" 188=Failed to convert a string using the {0} encoding 189=Property "{0}" has an incorrect or unsupported value "{1}" # post 1.2 messages 190=Space Action "{0}" was interrupted 191=Failed to create Space. See preceeding exception for details 192=Scheme of the endpoint cannot be changed at runtime for this type router. Old sche was "{0}" new scheme is "{1}" 193=days 194=hours 195=mins 196=sec #Post mule_1_3 branch merge 197=Template Endpoint "{0}" resolved into a Malformed endpoint "{1}" 198=Could not determine Destination component from endpoint "{0}" 200=There is no Transaction currently bound 201=Session variable "{0}" is malfomed and cannot be read #Post 1.3-rc1 202=This type of router can only have a single endpoint registered on it 203=The endpoint is not a streaming endpoint: "{0}" 204=The endpoint does not support streaming: "{0}" 205=Streaming failed. Could not get output stream 206=Endpoint scheme must be compatible with the connector scheme. Connector is: "{0}", endpoint is "{1}" 207=Failed to read attachment "{0}" #Post 1.3-rc2 208=Failed to initialize security provider "{0}" #Post Mule 1.3.3 209=Streaming is not supported by the "{0}" transport 210=Streaming Component "{0}" must have exactly one endpoint on the outbound router 211=Streaming Endpoint "{0}" does not provide a response output stream, you need to either add an outbound endpoint or mark the endpoint as asynchronous 212=Streaming failed for endpoint "{0}" 213=Streaming endpoints don't currently support transformers 214=Only Streaming endpoints can be used with the streaming model 215=setter method for binding interface "{0}" not found on service component "{1}" 216=There are too many matching methods on object "{1}" with a return type of "{0}" 217=Failed to set nested binding proxy "{0}" on service component "{1}" 218=This interface already has one router associated with it. If you want to bind to an interface with more than one method you need to configure the method names explicitly on the bindings in the Nested Router. 219=Cannot find binding for method name "{0}" 220=There are no matching methods on object "{1}" with a return type of "{0}" 221=There are at least 2 connectors matching protocol "{0}", so the connector to use must be specified on the endpoint using the ''connector'' property/attribute #Post Mule 1.4 223=Failed to get output stream 224=No-args method "{1}" not found for object "{0}" 225=Both "class" and "method" attributes must be configured on this component if no "delegateInstance" provided 226=No "class" must be specified if "ref" is specified for this component #Post Mule 2.0 227=No service descriptor found for transport: "{0}". This transport does not appear to be installed. 228=Failed to invoke lifecycle phase "{0}" on object: {1} 229=Unrecognised servce type: "{0}" 230=ServiceFinder unable to locate the real service "{0}" 231="Model name on descriptor: "{0}" is "{1}" but doesn't match the model being registered on: "{2}" 232=The endpoint "{0}" is not an inbound endpoint. Inbound endpoints must be used with the inbound router collection "{1} 233=The endpoint "{0}" is not an outbound endpoint. Outbound endpoints must be used with the outbound router "{1} 234=The endpoint "{0}" is not a response endpoint. Response endpoints must be used with the response router collection "{1} 235=The endpoint "{0}" is not a outbound endpoint. Outbound endpoints must be used with the exception strategy "{1} # 227 in Mule 1.4 236=\n\n\ *******************************************************************************\ \n{0}\ \nVersion: {1}\ \n{2}\n\ *******************************************************************************\n\n 237=Could not find a transformer to transform "{0}" to "{1}". 238=Could not read InputStream. 239=No-args method "{0}" not found for object "{1}" using resolver "{2}" 240=Could not find entry point on: "{0}" with arguments: "{1}" using resolver "{2}" 241=There are no matching methods on object "{0}" with a return type of "{1}" using resolver "{2}" 242=Found too many possible methods on object "{0}" that accept parameters "{1}" using resolver "{2}" 243=There are too many matching methods on object "{0}" with a return type of "{1}" using resolver "{2}" 244=Object "{0}" does not implement required interface "{1}" 245=Invocation was successful, cannot set error message 246=Could not find entry point on: "{0}" with method name: "{1}" using resolver "{2}" 247=No JTA transaction associated with thread {0} 248={0} is not an instance of Mule XaTransaction 249=No queue timeout value set on component "{0}" 250=Failed to process Expression Evaluation "{0}" 251=An Expression Evaluator for "{0}" is not registered with Mule. Make sure you have the the module for this expression type on your classpath. 252=Object already exists or is already registered: "{0}" 253=Mule transaction is null, but enlist method is called 254=Object "{0}" has already been registered in the Registry. Registered object is "{1}", Object being registered is "{2}" 255=Transformer does not implement Discoverable interface, it must do so to be registered via the Registry Bootstrap. Transformer is "{0}" 256=There are two transformers that are an exact match for input: "{0}", output: "{1}". Transformers are: "{2}" and "{3}" 257=Configured Mule using "{0}" with "{1}" resource(s) 258=Configured Mule using "{0}" with configuration resource(s): "{1}" 259=No suitable configuration builder for resource "{0}" found. Check you have configuration module on your classpath and are using correct file extension. 260=Configuration with "{0}" failed. 261=Unsupported request for retry in nested lifetime transition. 263=Expression Evaluator "{0}" with expression "{1}" returned null but a value was required. 264=You must supply a valid xpression for property "{0}" the invalid expression is "{1}" 265=Expression "{0}" is malformed for evaluator "{1}". Please check the documentation for this evaluator. 266=Correlation timed out while waiting on event group with Id: "{0}" 267=An invalid return type "{0}" was specified for transformer "{1}" mule-2.0.1/core/src/main/resources/META-INF/services/org/mule/config/0000755000175000017500000000000011351411132024726 5ustar charlescharlesmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/config/registry-bootstrap.properties0000644000175000017500000000174510776735545032771 0ustar charlescharlesobject.1=org.mule.util.expression.MapPayloadExpressionEvaluator object.2=org.mule.util.expression.MessageHeaderExpressionEvaluator object.3=org.mule.util.expression.MessageHeadersExpressionEvaluator object.4=org.mule.util.expression.MessageHeadersListExpressionEvaluator object.5=org.mule.util.expression.MessageAttachmentExpressionEvaluator object.6=org.mule.util.expression.MessageAttachmentsExpressionEvaluator object.7=org.mule.util.expression.MessageAttachmentsListExpressionEvaluator object.8=org.mule.util.expression.MessagePayloadExpressionEvaluator object.9=org.mule.util.expression.FunctionExpressionEvaluator object.10=org.mule.util.expression.MuleContextExpressionEvaluator object.11=org.mule.util.expression.EndpointInfoExpressionEvaluator transformer.1=org.mule.transformer.simple.ObjectToString transformer.2=org.mule.transformer.simple.ObjectToByteArray transformer.3=org.mule.transformer.simple.ObjectToOutputHandler transformer.4=org.mule.transformer.simple.ObjectToInputStream ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/config/mule-exception-codes.propertiesmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/config/mule-exception-codes.properties0000644000175000017500000000620610745677442033131 0ustar charlescharles#Base codes #core=10000 #manager=20000 #messaging=30000 #routing=40000 #security=50000 #endpoint=60000 #lifecycle=70000 #component=80000 #transaction=90000 #model=100000 #core exception codes org.mule.api.MuleException=10000 org.mule.api.DefaultMuleException=11000 org.mule.api.MuleRuntimeException=12000 org.mule.api.config.ConfigurationException=13000 #Manager exception org.mule.api.context.MuleContextException=20000 org.mule.api.context.ContainerException=21000 org.mule.api.context.ObjectNotFoundException=21100 org.mule.management.ManagementException=22000 org.mule.management.JmxManagementException=23000 #Messaging exception codes org.mule.api.MessagingException=30000 org.mule.api.transport.MessageTypeNotSupported=31000 #Routing exceptions org.mule.api.routing.RoutingException=40000 org.mule.api.routing.ResponseTimeoutException=41000 org.mule.api.routing.RoutePathNotFoundException=42000 org.mule.api.transport.DispatchException=43000 org.mule.api.routing.CouldNotRouteOutboundMessageException=44000 org.mule.api.routing.CouldNotRouteInboundEventException=45000 org.mule.api.transport.ReceiveException=46000 #SecurityException codes org.mule.api.security.SecurityException=50000 org.mule.api.security.SecurityProviderNotFoundException=51000 org.mule.api.security.UnknownAuthenticationTypeException=52000 org.mule.api.security.EncryptionNotSupportedException=53000 org.mule.api.security.UnsupportedAuthenticationSchemeException=54000 org.mule.api.security.UnauthorisedException=55000 org.mule.api.security.CredentialsNotSetException=55100 org.mule.api.security.CryptoFailureException=56000 #endpoint Exceptions org.mule.api.endpoint.EndpointException=60000 org.mule.transport.service.ConnectorFactoryException=61000 org.mule.transport.service.ConnectorServiceException=62000 org.mule.transport.ConnectorServiceNotFoundException=63000 org.mule.api.endpoint.MalformedEndpointException=64000 org.mule.api.transformer.TransformerException=65000 org.mule.api.endpoint.EndpointNotFoundException=66000 org.mule.api.transport.NoReceiverForEndpointException=67000 org.mule.api.transport.ConnectorException=68000 #Lifecycle exceptions org.mule.api.lifecycle.LifecycleException=70000 org.mule.api.lifecycle.DisposeException=71000 org.mule.api.lifecycle.InitialisationException=72000 org.mule.api.lifecycle.AlreadyInitialisedException=73000 org.mule.api.lifecycle.RecoverableException=74000 org.mule.api.lifecycle.FatalException=75000 #Component exceptions org.mule.api.component.ComponentException=80000 org.mule.FailedToQueueEventException=81000 #Transaction exceptions org.mule.api.transaction.TransactionException=90000 org.mule.transaction.TransactionStatusException=91000 org.mule.transaction.TransactionInProgressException=91100 org.mule.transaction.TransactionNotInProgressException=91200 org.mule.transaction.IllegalTransactionStateException=91300 org.mule.transaction.TransactionRollbackException=92000 #Model exceptions org.mule.api.model.ModelException=101000 org.mule.model.resolvers.NoSatisfiableMethodsException=101100 org.mule.model.resolvers.TooManySatisfiableMethodsException=101200 org.mule.model.SessionException=103000 #Misc #org.mule.util.compression.CompressionException= ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/config/mule-exception-config.propertiesmule-2.0.1/core/src/main/resources/META-INF/services/org/mule/config/mule-exception-config.propertie0000644000175000017500000001377310570104146033103 0ustar charlescharles#doc links for specific exceptions that occur javadoc.org.mule=http://mule.mulesource.org/docs/apidocs javadoc.EDU.oswego.cs.dl.util.concurrent=http://gee.cs.oswego.edu/dl/classes #JDK 1.4 Package Mappings javadoc.1.4.java=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.accessibility=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.crypto=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.imageio=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.naming=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.net=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.print=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.rmi=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.security=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.sound=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.sql=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.swing=http://java.sun.com/j2se/1.4.2/docs/api #javadoc.1.4.javax.transaction=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.javax.xml=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.ietf.jgss=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.omg.CORBA=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.omg.CORBA_2_3=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.omg.CosNaming=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.omg.Dynamic=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.omg.DynamicAny=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.omg.IOP=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.omg.Messaging=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.omg.PortableInterceptor=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.omg.PortableServer=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.omg.SendingContext=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.omg.stub.java.rmi=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.w3c.dom=http://java.sun.com/j2se/1.4.2/docs/api javadoc.1.4.org.xml.sax=http://java.sun.com/j2se/1.4.2/docs/api #JDK 1.5 package Mappings javadoc.1.5.java=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.accessibility=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.crypto=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.imageio=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.naming=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.net=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.print=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.rmi=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.management=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.security=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.sound=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.sql=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.swing=http://java.sun.com/j2se/1.5.0/docs/api #javadoc.1.5.javax.transaction=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.javax.xml.transform=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.ietf.jgss=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.omg.CORBA=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.omg.CORBA_2_3=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.omg.CosNaming=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.omg.Dynamic=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.omg.DynamicAny=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.omg.IOP=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.omg.Messaging=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.omg.PortableInterceptor=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.omg.PortableServer=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.omg.SendingContext=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.omg.stub.java.rmi=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.w3c.dom=http://java.sun.com/j2se/1.5.0/docs/api javadoc.1.5.org.xml.sax=http://java.sun.com/j2se/1.5.0/docs/api #J2EE SDK 1.3 Package mappings javadoc.1.3ee.javax=http://java.sun.com/j2ee/sdk_1.3/techdocs/api javadoc.1.3ee.javax.activation=http://java.sun.com/j2ee/sdk_1.3/techdocs/api javadoc.1.3ee.javax.ejb=http://java.sun.com/j2ee/sdk_1.3/techdocs/api javadoc.1.3ee.javax.jms=http://java.sun.com/j2ee/sdk_1.3/techdocs/api javadoc.1.3ee.javax.mail=http://java.sun.com/j2ee/sdk_1.3/techdocs/api javadoc.1.3ee.javax.resource=http://java.sun.com/j2ee/sdk_1.3/techdocs/api javadoc.1.3ee.javax.servlet=http://java.sun.com/j2ee/sdk_1.3/techdocs/api javadoc.1.3ee.javax.transaction=http://java.sun.com/j2ee/sdk_1.3/techdocs/api #J2EE SDK 1.4 Package mappings javadoc.1.4ee.javax.activation=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.ejb=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.enterprise.deploy=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.jms=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.mail=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.management.j2ee=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.management.loading=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.management.modelmbean=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.management.monitor=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.management.openmbean=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.management.relation=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.management.timer=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.resource=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.servlet=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.transaction=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.xml.namespace=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.xml.parsers=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.xml.registry=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.xml.rpc=http://java.sun.com/j2ee/1.4/docs/api javadoc.1.4ee.javax.xml.soap=http://java.sun.com/j2ee/1.4/docs/api mule-2.0.1/core/src/main/resources/META-INF/mime.types0000644000175000017500000000234510647303074022142 0ustar charlescharlestext/plain txt cgi java text/xml xml text/html htm html shtml application/octet-stream bin class application/postscript ps eps ai application/pdf pdf # Image specific MIME types image/x-xbitmap xbm image/x-xpixmap xpm image/x-xwindowdump xwd image/x-xbitmap xbm image/x-cmu-raster ras image/x-portable-anymap pnm image/x-portable-bitmap pbm image/x-portable-graymap pgm image/x-rgb rgb image/gif gif image/jpeg jpeg jpe jpg image/tiff tiff tif # Audio video specific MIME types audio/basic au snd audio/x-wav wav video/mpeg mpeg mpe mpg video/quicktime mov qt video/x-sgi-movie movie application/java java application/x-csh csh application/x-sh sh application/x-tcl tcl application/x-shar shar application/x-tar tar application/x-dvi dvi application/x-hdf hdf application/x-x509-ca-cert cer cert # zip files multipart/x-zip zip application/zip zip mule-2.0.1/core/src/test/0000755000175000017500000000000011351411100014761 5ustar charlescharlesmule-2.0.1/core/src/test/java/0000755000175000017500000000000011351411067015716 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/0000755000175000017500000000000011351411067016505 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/0000755000175000017500000000000011351411076017447 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/AbstractExceptionListenerTestCase.java0000644000175000017500000000702710765313375027117 0ustar charlescharles/* * $Id: AbstractExceptionListenerTestCase.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.endpoint.InvalidEndpointTypeException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.routing.outbound.AbstractOutboundRouter; import org.mule.routing.outbound.TransformerRouter; import org.mule.tck.AbstractMuleTestCase; import java.util.ArrayList; import java.util.List; public class AbstractExceptionListenerTestCase extends AbstractMuleTestCase { public void testAddGoodEndpoint() throws Exception { AbstractOutboundRouter router=new TransformerRouter(); OutboundEndpoint endpoint= getTestOutboundEndpoint("test"); router.addEndpoint(endpoint); assertNotNull(router.getEndpoints()); assertTrue(router.getEndpoints().contains(endpoint)); } // public void testAddBadEndpoint() // { // AbstractOutboundRouter router=new TransformerRouter(); // try{ // router.addEndpoint(new InboundEndpoint()); // fail("Invalid endpoint: Exception expected"); // } // catch(Exception e){ // assertEquals(InvalidEndpointTypeException.class, e.getClass()); // } // } // // public void testAddBadEndpoint2() // { // AbstractOutboundRouter router=new TransformerRouter(); // try{ // router.addEndpoint(new InboundEndpoint()); // fail("Invalid endpoint: Exception exceptions"); // } // catch(Exception e){ // assertEquals(InvalidEndpointTypeException.class, e.getClass()); // } // } public void testSetGoodEndpoints() throws Exception { List list= new ArrayList(); list.add(getTestOutboundEndpoint("test")); list.add(getTestOutboundEndpoint("test")); AbstractOutboundRouter router=new TransformerRouter(); assertNotNull(router.getEndpoints()); assertEquals(0, router.getEndpoints().size()); router.addEndpoint(getTestOutboundEndpoint("test")); assertEquals(1, router.getEndpoints().size()); router.setEndpoints(list); assertNotNull(router.getEndpoints()); assertEquals(2, router.getEndpoints().size()); } public void testSetBadEndpoints() throws Exception { List list= new ArrayList(); list.add(getTestInboundEndpoint("test")); list.add(getTestOutboundEndpoint("test")); AbstractOutboundRouter router=new TransformerRouter(); try{ router.setEndpoints(list); fail("Invalid endpoint: Exception exceptions"); } catch(Exception e){ assertEquals(InvalidEndpointTypeException.class, e.getClass()); } } public void testSetBad2Endpoints() throws Exception { List list= new ArrayList(); list.add(getTestInboundEndpoint("test")); list.add(getTestOutboundEndpoint("test")); AbstractOutboundRouter router=new TransformerRouter(); try{ router.setEndpoints(list); fail("Invalid endpoint: Exception exceptions"); } catch(Exception e){ assertEquals(InvalidEndpointTypeException.class, e.getClass()); } } } mule-2.0.1/core/src/test/java/org/mule/object/0000755000175000017500000000000011351411075020714 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/object/PrototypeObjectFactoryTestCase.java0000644000175000017500000000253510767256152027721 0ustar charlescharles/* * $Id: PrototypeObjectFactoryTestCase.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.object; import org.mule.api.object.ObjectFactory; import org.mule.object.PrototypeObjectFactory; public class PrototypeObjectFactoryTestCase extends AbstractObjectFactoryTestCase { // @Override public ObjectFactory getObjectFactory() { return new PrototypeObjectFactory(); } // @Override public void testGetObjectClass() throws Exception { PrototypeObjectFactory factory = (PrototypeObjectFactory) getObjectFactory(); factory.setObjectClass(Object.class); factory.initialise(); assertEquals(Object.class, factory.getObjectClass()); } // @Override public void testGet() throws Exception { PrototypeObjectFactory factory = (PrototypeObjectFactory) getObjectFactory(); factory.setObjectClass(Object.class); factory.initialise(); assertNotSame(factory.getInstance(), factory.getInstance()); } } mule-2.0.1/core/src/test/java/org/mule/object/SingletonObjectFactoryTestCase.java0000644000175000017500000000253210767256152027653 0ustar charlescharles/* * $Id: SingletonObjectFactoryTestCase.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.object; import org.mule.api.object.ObjectFactory; import org.mule.object.SingletonObjectFactory; public class SingletonObjectFactoryTestCase extends AbstractObjectFactoryTestCase { // @Override public ObjectFactory getObjectFactory() { return new SingletonObjectFactory(); } // @Override public void testGetObjectClass() throws Exception { SingletonObjectFactory factory = (SingletonObjectFactory) getObjectFactory(); factory.setObjectClass(Object.class); factory.initialise(); assertEquals(Object.class, factory.getObjectClass()); } // @Override public void testGet() throws Exception { SingletonObjectFactory factory = (SingletonObjectFactory) getObjectFactory(); factory.setObjectClass(Object.class); factory.initialise(); assertSame(factory.getInstance(), factory.getInstance()); } } mule-2.0.1/core/src/test/java/org/mule/object/AbstractObjectFactoryTestCase.java0000644000175000017500000000543010767256152027454 0ustar charlescharles/* * $Id: AbstractObjectFactoryTestCase.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.object; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.object.ObjectFactory; import org.mule.object.AbstractObjectFactory; import org.mule.tck.AbstractMuleTestCase; public abstract class AbstractObjectFactoryTestCase extends AbstractMuleTestCase { public void testInitialisationFailure() throws Exception { AbstractObjectFactory factory = (AbstractObjectFactory) getObjectFactory(); try { factory.initialise(); fail("expected InitialisationException"); } catch (InitialisationException iex) { // OK } try { factory.getInstance(); fail("expected InitialisationException"); } catch (InitialisationException iex) { // OK } } public void testInitialiseWithClass() throws Exception { AbstractObjectFactory factory = (AbstractObjectFactory) getObjectFactory(); factory.setObjectClass(Object.class); try { factory.initialise(); } catch (InitialisationException iex) { fail(iex.getDetailedMessage()); } assertNotNull(factory.getInstance()); } public void testInitialiseWithClassName() throws Exception { AbstractObjectFactory factory = (AbstractObjectFactory) getObjectFactory(); factory.setObjectClassName(Object.class.getName()); try { factory.initialise(); } catch (InitialisationException iex) { fail(iex.getDetailedMessage()); } assertNotNull(factory.getInstance()); } public void testDispose() throws Exception { AbstractObjectFactory factory = (AbstractObjectFactory) getObjectFactory(); factory.setObjectClass(Object.class); factory.initialise(); factory.dispose(); assertNull(factory.getObjectClass()); try { factory.getInstance(); fail("expected InitialisationException"); } catch (InitialisationException iex) { // OK } } public abstract ObjectFactory getObjectFactory(); public abstract void testGetObjectClass() throws Exception; public abstract void testGet() throws Exception; } mule-2.0.1/core/src/test/java/org/mule/expression/0000755000175000017500000000000011351411073021643 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/expression/PayloadExpressionEvaluatorTestCase.java0000644000175000017500000000752610764750654031532 0ustar charlescharles/* * $Id: PayloadExpressionEvaluatorTestCase.java 11290 2008-03-09 12:01:48Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.expression; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Banana; import org.mule.tck.testmodels.fruit.FruitBasket; import org.mule.tck.testmodels.fruit.FruitBowl; import org.mule.tck.testmodels.fruit.FruitBowlToFruitBasket; import org.mule.util.expression.ExpressionEvaluatorManager; import org.mule.util.expression.MessagePayloadExpressionEvaluator; import java.io.ByteArrayInputStream; import java.util.ArrayList; import java.util.List; public class PayloadExpressionEvaluatorTestCase extends AbstractMuleTestCase { public void testSimple() throws Exception { MessagePayloadExpressionEvaluator eval = new MessagePayloadExpressionEvaluator(); MuleMessage message = new DefaultMuleMessage("test"); //no expression Object result = eval.evaluate(null, message); assertNotNull(result); assertEquals("test", result); //no expression result = eval.evaluate(null, new ArrayList(1)); assertNotNull(result); assertTrue(result instanceof List); result = eval.evaluate(null, null); assertNull(result); } /** * Make sure the evaluator gets registered properly * @throws Exception if the test fails */ public void testSimpleUsingManager() throws Exception { MuleMessage message = new DefaultMuleMessage("test"); Object result = ExpressionEvaluatorManager.evaluate("${payload}", message); assertNotNull(result); assertEquals("test", result); result = ExpressionEvaluatorManager.evaluate("${payload}", new ArrayList(1)); assertNotNull(result); assertTrue(result instanceof List); result = ExpressionEvaluatorManager.evaluate("${payload}", null); assertNull(result); } public void testWithTransform() throws Exception { MessagePayloadExpressionEvaluator eval = new MessagePayloadExpressionEvaluator(); MuleMessage message = new DefaultMuleMessage("test"); //i.e. ${payload:byte[]} Object result = eval.evaluate("byte[]", message); assertNotNull(result); assertTrue(result instanceof byte[]); assertEquals("test", new String((byte[])result)); ByteArrayInputStream bais = new ByteArrayInputStream("test2".getBytes()); //i.e. ${payload:java.lang.String} result = eval.evaluate("java.lang.String", new DefaultMuleMessage(bais)); assertNotNull(result); assertEquals("test2", result); } public void testWithMoreComplexTransform() throws Exception { MessagePayloadExpressionEvaluator eval = new MessagePayloadExpressionEvaluator(); MuleMessage message = new DefaultMuleMessage(new FruitBowl(new Apple(), new Banana())); //Lets register our transformer so Mule can find it muleContext.getRegistry().registerTransformer(new FruitBowlToFruitBasket()); //i.e. ${payload:org.mule.tck.testmodels.fruit.FruitBasket} Object result = eval.evaluate("org.mule.tck.testmodels.fruit.FruitBasket", message); assertNotNull(result); assertTrue(result instanceof FruitBasket); FruitBasket fb = (FruitBasket)result; assertEquals(2, fb.getFruit().size()); assertTrue(fb.hasBanana()); assertTrue(fb.hasApple()); } } mule-2.0.1/core/src/test/java/org/mule/expression/AttachmentsExpressionEvaluatorTestCase.java0000644000175000017500000001777710764750654032425 0ustar charlescharles/* * $Id: AttachmentsExpressionEvaluatorTestCase.java 11290 2008-03-09 12:01:48Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.expression; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.expression.ExpressionEvaluatorManager; import org.mule.util.expression.MessageAttachmentExpressionEvaluator; import org.mule.util.expression.MessageAttachmentsExpressionEvaluator; import org.mule.util.expression.MessageAttachmentsListExpressionEvaluator; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.List; import java.util.Map; import javax.activation.DataHandler; import javax.activation.DataSource; public class AttachmentsExpressionEvaluatorTestCase extends AbstractMuleTestCase { private MuleMessage message; //@Override protected void doSetUp() throws Exception { message = new DefaultMuleMessage("test"); try { message.addAttachment("foo", new DataHandler(new StringDataSource("moo"))); message.addAttachment("bar", new DataHandler(new StringDataSource("mar"))); message.addAttachment("baz", new DataHandler(new StringDataSource("maz"))); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } } public void testSingleAttachment() throws Exception { MessageAttachmentExpressionEvaluator eval = new MessageAttachmentExpressionEvaluator(); Object result = eval.evaluate("foo", message); assertNotNull(result); assertTrue(result instanceof DataHandler); ByteArrayOutputStream baos = new ByteArrayOutputStream(4); ((DataHandler)result).writeTo(baos); assertEquals("moo", baos.toString()); result = eval.evaluate("fool", message); assertNull(result); result = eval.evaluate("foo", new Object()); assertNull(result); } public void testMapHeaders() throws Exception { MessageAttachmentsExpressionEvaluator eval = new MessageAttachmentsExpressionEvaluator(); Object result = eval.evaluate("foo, baz", message); assertNotNull(result); assertTrue(result instanceof Map); assertEquals(2, ((Map)result).size()); assertNotNull(((Map)result).get("foo")); assertTrue(((Map)result).get("foo") instanceof DataHandler); DataHandler dh = (DataHandler)((Map)result).get("foo"); ByteArrayOutputStream baos = new ByteArrayOutputStream(4); dh.writeTo(baos); assertEquals("moo", baos.toString()); assertNotNull(((Map)result).get("baz")); assertTrue(((Map)result).get("baz") instanceof DataHandler); dh = (DataHandler)((Map)result).get("baz"); baos = new ByteArrayOutputStream(4); dh.writeTo(baos); assertEquals("maz", baos.toString()); result = eval.evaluate("fool", message); assertNull(result); result = eval.evaluate("foo", new Object()); assertNull(result); } public void testListHeaders() throws Exception { MessageAttachmentsListExpressionEvaluator eval = new MessageAttachmentsListExpressionEvaluator(); Object result = eval.evaluate("foo, baz", message); assertNotNull(result); assertTrue(result instanceof List); assertEquals(2, ((List)result).size()); assertTrue(((List)result).get(0) instanceof DataHandler); DataHandler dh = (DataHandler)((List)result).get(0); ByteArrayOutputStream baos = new ByteArrayOutputStream(4); dh.writeTo(baos); assertEquals("moo", baos.toString()); assertTrue(((List)result).get(1) instanceof DataHandler); dh = (DataHandler)((List)result).get(1); baos = new ByteArrayOutputStream(4); dh.writeTo(baos); assertEquals("maz", baos.toString()); result = eval.evaluate("fool", message); assertNull(result); result = eval.evaluate("foo", new Object()); assertNull(result); } public void testSingleAttachmentUsingManager() throws Exception { Object result = ExpressionEvaluatorManager.evaluate("${attachment:foo}", message); assertNotNull(result); assertTrue(result instanceof DataHandler); ByteArrayOutputStream baos = new ByteArrayOutputStream(4); ((DataHandler)result).writeTo(baos); assertEquals("moo", baos.toString()); result = ExpressionEvaluatorManager.evaluate("${attachment:fool}", message); assertNull(result); result = ExpressionEvaluatorManager.evaluate("${attachment:foo}", new Object()); assertNull(result); } public void testMapHeadersUsingManager() throws Exception { Object result = ExpressionEvaluatorManager.evaluate("${attachments:foo, baz}", message); assertNotNull(result); assertTrue(result instanceof Map); assertEquals(2, ((Map)result).size()); assertNotNull(((Map)result).get("foo")); assertTrue(((Map)result).get("foo") instanceof DataHandler); DataHandler dh = (DataHandler)((Map)result).get("foo"); ByteArrayOutputStream baos = new ByteArrayOutputStream(4); dh.writeTo(baos); assertEquals("moo", baos.toString()); assertNotNull(((Map)result).get("baz")); assertTrue(((Map)result).get("baz") instanceof DataHandler); dh = (DataHandler)((Map)result).get("baz"); baos = new ByteArrayOutputStream(4); dh.writeTo(baos); assertEquals("maz", baos.toString()); result = ExpressionEvaluatorManager.evaluate("${attachments:fool}", message); assertNull(result); result = ExpressionEvaluatorManager.evaluate("${attachments:foo}", new Object()); assertNull(result); } public void testListHeadersUsingManager() throws Exception { Object result = ExpressionEvaluatorManager.evaluate("${attachments-list:foo,baz}", message); assertNotNull(result); assertTrue(result instanceof List); assertEquals(2, ((List)result).size()); assertTrue(((List)result).get(0) instanceof DataHandler); DataHandler dh = (DataHandler)((List)result).get(0); ByteArrayOutputStream baos = new ByteArrayOutputStream(4); dh.writeTo(baos); assertEquals("moo", baos.toString()); assertTrue(((List)result).get(1) instanceof DataHandler); dh = (DataHandler)((List)result).get(1); baos = new ByteArrayOutputStream(4); dh.writeTo(baos); assertEquals("maz", baos.toString()); result = ExpressionEvaluatorManager.evaluate("${attachments-list:fool}", message); assertNull(result); result = ExpressionEvaluatorManager.evaluate("${attachments-list:foo}", new Object()); assertNull(result); } // silly little fake DataSource so that we don't need to use javamail protected static class StringDataSource implements DataSource { protected String content; public StringDataSource(String payload) { super(); content = payload; } public InputStream getInputStream() throws IOException { return new ByteArrayInputStream(content.getBytes()); } public OutputStream getOutputStream() { throw new UnsupportedOperationException("Read-only javax.activation.DataSource"); } public String getContentType() { return "text/plain"; } public String getName() { return "StringDataSource"; } } }mule-2.0.1/core/src/test/java/org/mule/expression/MuleContextExpressionEvaluatorTestCase.java0000644000175000017500000000764710770570616032407 0ustar charlescharles/* * $Id: MuleContextExpressionEvaluatorTestCase.java 11457 2008-03-20 23:21:50Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.expression; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleRuntimeException; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.util.expression.ExpressionEvaluatorManager; import org.mule.util.expression.MuleContextExpressionEvaluator; public class MuleContextExpressionEvaluatorTestCase extends AbstractMuleTestCase { //@Override protected void doSetUp() throws Exception { MuleEvent event = getTestEvent("testing", getTestService("apple", Apple.class), getTestInboundEndpoint("test", "test://foo")); RequestContext.setEvent(event); } public void testExpressions() throws Exception { MuleMessage message = new DefaultMuleMessage("test"); MuleContextExpressionEvaluator extractor = new MuleContextExpressionEvaluator(); Object o = extractor.evaluate("serviceName", message); assertEquals("apple", o); o = extractor.evaluate("modelName", message); assertNotNull(o); o = extractor.evaluate("inboundEndpoint", message); assertEquals("test://foo", o.toString()); o = extractor.evaluate("serverId", message); assertNotNull(o); o = extractor.evaluate("clusterId", message); assertNotNull(o); o = extractor.evaluate("domainId", message); assertNotNull(o); o = extractor.evaluate("workingDir", message); assertNotNull(o); try { o = extractor.evaluate("bork", message); fail("bork is not a valid mule context value"); } catch (Exception e) { //expected } } public void testExpressionsFromExtractorManager() throws Exception { MuleMessage message = new DefaultMuleMessage("test"); Object o = ExpressionEvaluatorManager.evaluate("mule:serviceName", message); assertEquals("apple", o); o = ExpressionEvaluatorManager.evaluate("mule:modelName", message); assertNotNull(o); o = ExpressionEvaluatorManager.evaluate("mule:inboundEndpoint", message); assertEquals("test://foo", o.toString()); o = ExpressionEvaluatorManager.evaluate("mule:serverId", message); assertNotNull(o); o = ExpressionEvaluatorManager.evaluate("mule:clusterId", message); assertNotNull(o); o = ExpressionEvaluatorManager.evaluate("mule:domainId", message); assertNotNull(o); o = ExpressionEvaluatorManager.evaluate("mule:workingDir", message); assertNotNull(o); try { o = ExpressionEvaluatorManager.evaluate("mule:bork", message); fail("bork is not a valid mule context value"); } catch (Exception e) { //expected } } public void testMissingEventContext() throws Exception { RequestContext.clear(); MuleMessage message = new DefaultMuleMessage("test"); MuleContextExpressionEvaluator extractor = new MuleContextExpressionEvaluator(); Object o = extractor.evaluate("serverId", message); assertNotNull(o); try { o = extractor.evaluate("serviceName", message); fail("There is no current event context"); } catch (MuleRuntimeException e) { //expected } } }mule-2.0.1/core/src/test/java/org/mule/expression/FunctionExpressionEvaluatorTestCase.java0000644000175000017500000000567310764752051031720 0ustar charlescharles/* * $Id: FunctionExpressionEvaluatorTestCase.java 11292 2008-03-09 12:12:25Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.expression; import org.mule.DefaultMuleMessage; import org.mule.util.expression.FunctionExpressionEvaluator; import org.mule.util.expression.ExpressionEvaluatorManager; import org.mule.api.MuleMessage; import org.mule.tck.AbstractMuleTestCase; import java.net.InetAddress; import java.sql.Timestamp; import java.util.Date; public class FunctionExpressionEvaluatorTestCase extends AbstractMuleTestCase { public void testFunctions() throws Exception { MuleMessage message = new DefaultMuleMessage("test"); FunctionExpressionEvaluator extractor = new FunctionExpressionEvaluator(); Object o = extractor.evaluate("uuid", message); assertNotNull(o); o = extractor.evaluate("now", message); assertNotNull(o); assertTrue(o instanceof Timestamp); o = extractor.evaluate("date", message); assertNotNull(o); assertTrue(o instanceof Date); o = extractor.evaluate("hostname", message); assertNotNull(o); assertEquals(InetAddress.getLocalHost().getHostName(), o); o = extractor.evaluate("ip", message); assertNotNull(o); assertEquals(InetAddress.getLocalHost().getHostAddress(), o); try { o = extractor.evaluate("bork", message); fail("bork is not a valid function"); } catch (Exception e) { //expected } } public void testFunctionsFromExtractorManager() throws Exception { MuleMessage message = new DefaultMuleMessage("test"); Object o = ExpressionEvaluatorManager.evaluate("function:uuid", message); assertNotNull(o); o = ExpressionEvaluatorManager.evaluate("function:now", message); assertNotNull(o); assertTrue(o instanceof Timestamp); o = ExpressionEvaluatorManager.evaluate("function:date", message); assertNotNull(o); assertTrue(o instanceof Date); o = ExpressionEvaluatorManager.evaluate("function:hostname", message); assertNotNull(o); assertEquals(InetAddress.getLocalHost().getHostName(), o); o = ExpressionEvaluatorManager.evaluate("function:ip", message); assertNotNull(o); assertEquals(InetAddress.getLocalHost().getHostAddress(), o); try { o = ExpressionEvaluatorManager.evaluate("function:bork", message); fail("bork is not a valid function"); } catch (Exception e) { //expected } } } mule-2.0.1/core/src/test/java/org/mule/expression/ExpressionEvaluatorManagerTestCase.java0000644000175000017500000000342210764752051031473 0ustar charlescharles/* * $Id: ExpressionEvaluatorManagerTestCase.java 11292 2008-03-09 12:12:25Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.expression; import org.mule.DefaultMuleMessage; import org.mule.util.expression.ExpressionEvaluatorManager; import org.mule.util.expression.MapPayloadExpressionEvaluator; import org.mule.api.MuleMessage; import org.mule.tck.AbstractMuleTestCase; import java.sql.Timestamp; public class ExpressionEvaluatorManagerTestCase extends AbstractMuleTestCase { public void testManager() throws Exception { MuleMessage message = new DefaultMuleMessage("test"); Object o = ExpressionEvaluatorManager.evaluate("function:uuid", message); assertNotNull(o); o = ExpressionEvaluatorManager.evaluate("function:now", message); assertNotNull(o); assertTrue(o instanceof Timestamp); } public void testRegistration() throws Exception { try { ExpressionEvaluatorManager.registerEvaluator(new MapPayloadExpressionEvaluator()); fail("extractor already exists"); } catch (IllegalArgumentException e) { //Expected } try { ExpressionEvaluatorManager.registerEvaluator(null); fail("null extractor"); } catch (IllegalArgumentException e) { //Expected } assertNull(ExpressionEvaluatorManager.unregisterEvaluator(null)); } } mule-2.0.1/core/src/test/java/org/mule/expression/HeadersExpressionEvaluatorTestCase.java0000644000175000017500000001221110764750654031477 0ustar charlescharles/* * $Id: HeadersExpressionEvaluatorTestCase.java 11290 2008-03-09 12:01:48Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.expression; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.expression.MessageHeaderExpressionEvaluator; import org.mule.util.expression.MessageHeadersExpressionEvaluator; import org.mule.util.expression.MessageHeadersListExpressionEvaluator; import org.mule.util.expression.ExpressionEvaluatorManager; import java.util.HashMap; import java.util.List; import java.util.Map; public class HeadersExpressionEvaluatorTestCase extends AbstractMuleTestCase { private Map props; //@Override public void doSetUp() { props = new HashMap(3); props.put("foo", "moo"); props.put("bar", "mar"); props.put("baz", "maz"); } public void testSingleHeader() throws Exception { MessageHeaderExpressionEvaluator eval = new MessageHeaderExpressionEvaluator(); MuleMessage message = new DefaultMuleMessage("test", props); Object result = eval.evaluate("foo", message); assertNotNull(result); assertEquals("moo", result); result = eval.evaluate("fool", message); assertNull(result); result = eval.evaluate("foo", new Object()); assertNull(result); } public void testMapHeaders() throws Exception { MessageHeadersExpressionEvaluator eval = new MessageHeadersExpressionEvaluator(); MuleMessage message = new DefaultMuleMessage("test", props); Object result = eval.evaluate("foo, baz", message); assertNotNull(result); assertTrue(result instanceof Map); assertEquals(2, ((Map)result).size()); assertTrue(((Map)result).values().contains("moo")); assertTrue(((Map)result).values().contains("maz")); assertFalse(((Map)result).values().contains("mar")); result = eval.evaluate("fool", message); assertNull(result); result = eval.evaluate("foo", new Object()); assertNull(result); } public void testListHeaders() throws Exception { MessageHeadersListExpressionEvaluator eval = new MessageHeadersListExpressionEvaluator(); MuleMessage message = new DefaultMuleMessage("test", props); Object result = eval.evaluate("foo, baz", message); assertNotNull(result); assertTrue(result instanceof List); assertEquals(2, ((List)result).size()); assertTrue(((List)result).contains("moo")); assertTrue(((List)result).contains("maz")); assertFalse(((List)result).contains("mar")); result = eval.evaluate("fool", message); assertNull(result); result = eval.evaluate("foo", new Object()); assertNull(result); } public void testSingleHeaderUsingManager() throws Exception { MuleMessage message = new DefaultMuleMessage("test", props); Object result = ExpressionEvaluatorManager.evaluate("${header:foo}", message); assertNotNull(result); assertEquals("moo", result); result = ExpressionEvaluatorManager.evaluate("${header:fool}", message); assertNull(result); result = ExpressionEvaluatorManager.evaluate("${header:foo}", new Object()); assertNull(result); } public void testMapHeadersUsingManager() throws Exception { MuleMessage message = new DefaultMuleMessage("test", props); Object result = ExpressionEvaluatorManager.evaluate("${headers:foo, baz}", message); assertNotNull(result); assertTrue(result instanceof Map); assertEquals(2, ((Map)result).size()); assertTrue(((Map)result).values().contains("moo")); assertTrue(((Map)result).values().contains("maz")); assertFalse(((Map)result).values().contains("mar")); result = ExpressionEvaluatorManager.evaluate("${headers:fool}", message); assertNull(result); result = ExpressionEvaluatorManager.evaluate("${headers:foo}", new Object()); assertNull(result); } public void testListHeadersUsingManager() throws Exception { MuleMessage message = new DefaultMuleMessage("test", props); Object result = ExpressionEvaluatorManager.evaluate("${headers-list:foo, baz}", message); assertNotNull(result); assertTrue(result instanceof List); assertEquals(2, ((List)result).size()); assertTrue(((List)result).contains("moo")); assertTrue(((List)result).contains("maz")); assertFalse(((List)result).contains("mar")); result = ExpressionEvaluatorManager.evaluate("${headers-list:fool}", message); assertNull(result); result = ExpressionEvaluatorManager.evaluate("${headers-list:foo}", new Object()); assertNull(result); } } mule-2.0.1/core/src/test/java/org/mule/MuleWorkManagerTestCase.java0000644000175000017500000001130410745677442025026 0ustar charlescharles/* * $Id: MuleWorkManagerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.config.ThreadingProfile; import org.mule.tck.AbstractMuleTestCase; import org.mule.work.MuleWorkManager; import javax.resource.spi.work.Work; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Tests the following behavior: *
      *
    1. ScheduleWorkExecutor - e.g. use the backing thread pool to execute work items asynchronously *
    2. StartWorkExecutor - block till the work is started, then async *
    3. SyncWorkExecutor - blocking executor, meaning we should be running in the very same thread. *
    * It's not really important to make a distinction between scheduleWork() and * startWork() for this test, thus they just check for async execution. */ public class MuleWorkManagerTestCase extends AbstractMuleTestCase { private final transient Log logger = LogFactory.getLog(getClass()); public void testDoWorkExecutesSynchronously() throws Exception { final Thread callerThread = Thread.currentThread(); MuleWorkManager wm = new MuleWorkManager(ThreadingProfile.DEFAULT_THREADING_PROFILE, null); try { wm.start(); wm.doWork(new Work() { public void release() { // no-op } public void run() { Thread calleeThread = Thread.currentThread(); assertEquals("WorkManager.doWork() should have been executed in the same thread.", callerThread, calleeThread); if (logger.isDebugEnabled()) { logger.debug("WORK: " + Thread.currentThread()); } } }); if (logger.isDebugEnabled()) { logger.debug("MAIN: " + Thread.currentThread()); } } finally { wm.dispose(); } } public void testScheduleWorkExecutesAsynchronously() throws Exception { final Thread callerThread = Thread.currentThread(); MuleWorkManager wm = new MuleWorkManager(ThreadingProfile.DEFAULT_THREADING_PROFILE, null); try { wm.start(); wm.scheduleWork(new Work() { public void release() { // no-op } public void run() { Thread calleeThread = Thread.currentThread(); assertFalse("WorkManager.scheduleWork() should have been executed in a different thread.", callerThread.equals(calleeThread)); if (logger.isDebugEnabled()) { logger.debug("WORK: " + Thread.currentThread()); } } }); if (logger.isDebugEnabled()) { logger.debug("MAIN: " + Thread.currentThread()); } } finally { wm.dispose(); } } public void testStartWorkExecutesAsynchronously() throws Exception { final Thread callerThread = Thread.currentThread(); MuleWorkManager wm = new MuleWorkManager(ThreadingProfile.DEFAULT_THREADING_PROFILE, null); try { wm.start(); wm.startWork(new Work() { public void release() { // no-op } public void run() { Thread calleeThread = Thread.currentThread(); assertFalse("WorkManager.startWork() should have been executed in a different thread.", callerThread.equals(calleeThread)); if (logger.isDebugEnabled()) { logger.debug("WORK: " + Thread.currentThread()); } } }); if (logger.isDebugEnabled()) { logger.debug("MAIN: " + Thread.currentThread()); } } finally { wm.dispose(); } } } mule-2.0.1/core/src/test/java/org/mule/endpoint/0000755000175000017500000000000011351411067021267 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/endpoint/MuleCopiedEndpointURITestCase.java0000644000175000017500000000335610754403514027710 0ustar charlescharles/* * $Id: MuleCopiedEndpointURITestCase.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; public class MuleCopiedEndpointURITestCase extends AbstractMuleTestCase { /** * See MULE-2164 * @throws Exception */ public void testCopyMetaSchemeEndpointURI() throws Exception { // Create and test values ImmutableEndpoint endpoint = MuleTestUtils.getTestSchemeMetaInfoOutboundEndpoint("testEndpoint", "protocol", muleContext); EndpointURI endpointUri = endpoint.getEndpointURI(); assertEquals("protocol", endpointUri.getScheme()); assertEquals("test", endpointUri.getSchemeMetaInfo()); assertEquals("test:protocol", endpointUri.getFullScheme()); assertEquals("test", endpointUri.getAddress()); // Copy and test values EndpointURI newEndpointUri = new MuleEndpointURI(endpointUri); newEndpointUri.initialise(); assertEquals("protocol", newEndpointUri.getScheme()); assertEquals("test", newEndpointUri.getSchemeMetaInfo()); assertEquals("test:protocol", newEndpointUri.getFullScheme()); assertEquals("test", newEndpointUri.getAddress()); assertEquals(endpointUri, newEndpointUri); } } mule-2.0.1/core/src/test/java/org/mule/endpoint/EndpointURIEndpointBuilderTestCase.java0000644000175000017500000001130710766637211030752 0ustar charlescharles/* * $Id: EndpointURIEndpointBuilderTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.mule.TestConnector; import org.mule.tck.testmodels.mule.TestInboundTransformer; import org.mule.tck.testmodels.mule.TestOutboundTransformer; import org.mule.tck.testmodels.mule.TestResponseTransformer; import org.mule.transaction.MuleTransactionConfig; import org.mule.transport.SingleAttemptConnectionStrategy; import org.mule.util.ObjectNameHelper; public class EndpointURIEndpointBuilderTestCase extends AbstractMuleTestCase { public void testBuildInboundEndpoint() throws MuleException { String uri = "test://address"; EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(uri, muleContext); try { ImmutableEndpoint ep = endpointBuilder.buildInboundEndpoint(); assertTrue(ep instanceof InboundEndpoint); assertFalse(ep instanceof OutboundEndpoint); assertNotNull(ep.getTransformers()); assertEquals(1, ep.getTransformers().size()); assertTrue(ep.getTransformers().get(0) instanceof TestInboundTransformer); assertNotNull(ep.getResponseTransformers()); assertEquals(1, ep.getResponseTransformers().size()); assertTrue(ep.getResponseTransformers().get(0) instanceof TestResponseTransformer); testDefaultCommonEndpointAttributes(ep); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testBuildOutboundEndpoint() throws MuleException { String uri = "test://address"; EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(uri, muleContext); try { ImmutableEndpoint ep = endpointBuilder.buildOutboundEndpoint(); assertFalse(ep instanceof InboundEndpoint); assertTrue(ep instanceof OutboundEndpoint); assertTrue(ep.getTransformers() != null); assertTrue(ep.getTransformers().get(0) instanceof TestOutboundTransformer); assertTrue(ep.getResponseTransformers().isEmpty()); testDefaultCommonEndpointAttributes(ep); } catch (Exception e) { fail("Unexpected exception: " + e.getStackTrace()); } } // TODO DF: Test more than defaults with tests using builder to set non-default // values protected void testDefaultCommonEndpointAttributes(ImmutableEndpoint ep) { assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); assertEquals(muleContext.getConfiguration().getDefaultSynchronousEventTimeout(), ep.getRemoteSyncTimeout()); assertEquals(muleContext.getConfiguration().isDefaultSynchronousEndpoints() || muleContext.getConfiguration().isDefaultRemoteSync(), ep.isSynchronous()); assertEquals(muleContext.getConfiguration().isDefaultRemoteSync(), ep.isRemoteSync()); assertTrue(ep.getConnectionStrategy() instanceof SingleAttemptConnectionStrategy); assertTrue(ep.getTransactionConfig() instanceof MuleTransactionConfig); assertTrue(ep.getTransactionConfig() instanceof MuleTransactionConfig); assertEquals(null, ep.getSecurityFilter()); assertTrue(ep.getConnector() instanceof TestConnector); assertEquals(ObjectNameHelper.getEndpointName(ep.getEndpointURI()), ep.getName()); assertFalse(ep.isDeleteUnacceptedMessages()); assertEquals(muleContext.getConfiguration().getDefaultEncoding(), ep.getEncoding()); assertEquals(null, ep.getFilter()); assertEquals(ImmutableEndpoint.INITIAL_STATE_STARTED, ep.getInitialState()); } public void testHasSetEncodingMethod() throws EndpointException, SecurityException, NoSuchMethodException { String uri = "test://address"; EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(uri, muleContext); assertNotNull(endpointBuilder.getClass().getMethod("setEncoding", new Class[]{String.class})); } } mule-2.0.1/core/src/test/java/org/mule/endpoint/EndpointFactoryTestCase.java0000644000175000017500000003144510766204322026710 0ustar charlescharles/* * $Id: EndpointFactoryTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.MuleException; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointFactory; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.registry.Registry; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.mule.TestConnector; public class EndpointFactoryTestCase extends AbstractMuleTestCase { public void testCreateInboundEndpoint() throws MuleException { String uri = "test://address"; EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { ImmutableEndpoint ep = endpointFactory.getInboundEndpoint(uri); assertEquals(DefaultInboundEndpoint.class, ep.getClass()); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); assertTrue(ep instanceof InboundEndpoint); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testCreateInboundEndpointFromGlobalEndpoint() throws MuleException { muleContext.getRegistry().registerEndpointBuilder("myGlobalEndpoint", new EndpointURIEndpointBuilder("test://address", muleContext)); String uri = "myGlobalEndpoint"; EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { ImmutableEndpoint ep = endpointFactory.getInboundEndpoint(uri); assertEquals(DefaultInboundEndpoint.class, ep.getClass()); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); assertTrue(ep instanceof InboundEndpoint); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testCreateInboundEndpointFromNamedConcreteEndpoint() throws MuleException { muleContext.getRegistry().registerEndpointBuilder("&myNamedConcreateEndpoint", new EndpointURIEndpointBuilder("test://address", muleContext)); String uri = "&myNamedConcreateEndpoint"; EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { ImmutableEndpoint ep = endpointFactory.getInboundEndpoint(uri); assertEquals(DefaultInboundEndpoint.class, ep.getClass()); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); assertTrue(ep instanceof InboundEndpoint); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testCreateOutboundEndpoint() throws MuleException { String uri = "test://address"; EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { ImmutableEndpoint ep = endpointFactory.getOutboundEndpoint(uri); assertEquals(DefaultOutboundEndpoint.class, ep.getClass()); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); assertTrue(ep instanceof OutboundEndpoint); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testCreateoutboundEndpointFromGlobalEndpoint() throws MuleException { muleContext.getRegistry().registerEndpointBuilder("myGlobalEndpoint", new EndpointURIEndpointBuilder("test://address", muleContext)); String uri = "myGlobalEndpoint"; EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { ImmutableEndpoint ep = endpointFactory.getOutboundEndpoint(uri); assertEquals(DefaultOutboundEndpoint.class, ep.getClass()); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); assertTrue(ep instanceof OutboundEndpoint); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testCreateoutboundEndpointFromNamedConcreteEndpoint() throws MuleException { muleContext.getRegistry().registerEndpointBuilder("&myNamedConcreateEndpoint", new EndpointURIEndpointBuilder("test://address", muleContext)); String uri = "&myNamedConcreateEndpoint"; EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { ImmutableEndpoint ep = endpointFactory.getOutboundEndpoint(uri); assertEquals(DefaultOutboundEndpoint.class, ep.getClass()); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); assertTrue(ep instanceof OutboundEndpoint); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testCreateInboundEndpointWithBuilder() throws MuleException { EndpointBuilder builder = new EndpointURIEndpointBuilder("test://address", muleContext); EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { ImmutableEndpoint ep = endpointFactory.getInboundEndpoint(builder); assertEquals(DefaultInboundEndpoint.class, ep.getClass()); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); assertTrue(ep instanceof InboundEndpoint); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testCreateOutboundEndpointWithBuilder() throws MuleException { EndpointBuilder builder = new EndpointURIEndpointBuilder("test://address", muleContext); EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { ImmutableEndpoint ep = endpointFactory.getOutboundEndpoint(builder); assertEquals(DefaultOutboundEndpoint.class, ep.getClass()); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); assertTrue(ep instanceof OutboundEndpoint); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testCreateEndpoint() throws MuleException { String uri = "test://address"; EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { ImmutableEndpoint ep = endpointFactory.getInboundEndpoint(uri); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testCreateEndpointFromGlobalEndpoint() throws MuleException { Registry r = muleContext.getRegistry(); r.registerObject("myGlobalEndpoint", new EndpointURIEndpointBuilder("test://address", muleContext), muleContext); String uri = "myGlobalEndpoint"; EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { ImmutableEndpoint ep = endpointFactory.getInboundEndpoint(uri); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testCreateEndpointFromNamedConcreteEndpoint() throws MuleException { Registry r = muleContext.getRegistry(); r.registerObject("&myNamedConcreateEndpoint", new EndpointURIEndpointBuilder("test://address", muleContext)); String uri = "&myNamedConcreateEndpoint"; EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { ImmutableEndpoint ep = endpointFactory.getInboundEndpoint(uri); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } public void testCreateEndpointByCustomizingEndpointBuilder() throws MuleException { // Create and register two connectors TestConnector testConnector1 = new TestConnector(); testConnector1.setName("testConnector1"); TestConnector testConnector2 = new TestConnector(); testConnector2.setName("testConnector2"); muleContext.getRegistry().registerConnector(testConnector1); muleContext.getRegistry().registerConnector(testConnector2); String globalEndpointName = "concreteEndpoint"; // Create and register a endpoint builder (global endpoint) with connector1 EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("test://address", muleContext); endpointBuilder.setConnector(testConnector1); muleContext.getRegistry().registerObject(globalEndpointName, endpointBuilder); EndpointFactory endpointFactory = new DefaultEndpointFactory(); endpointFactory.setMuleContext(muleContext); try { // Test that DefaultEndpointFactory.getEndpointBuilder() returns a new // EndpointBuilder instance equal to // the one we registered earlier EndpointBuilder endpointBuilder1 = endpointFactory.getEndpointBuilder(globalEndpointName); assertNotSame(endpointBuilder1, endpointBuilder); assertTrue(endpointBuilder1.equals(endpointBuilder)); // Test that DefaultEndpointFactory.getEndpointBuilder() returns a new // EndpointBuilder instance equal to // the one we registered earlier EndpointBuilder endpointBuilder2 = endpointFactory.getEndpointBuilder(globalEndpointName); assertNotSame(endpointBuilder2, endpointBuilder); assertTrue(endpointBuilder2.equals(endpointBuilder)); // Check that all EndpointBuilder's returned are unique but equal assertNotSame(endpointBuilder1, endpointBuilder2); assertTrue(endpointBuilder1.equals(endpointBuilder2)); assertEquals(endpointBuilder1.hashCode(), endpointBuilder2.hashCode()); // Test creating an endpoint from endpointBuilder1 endpointBuilder1.setSynchronous(true); endpointBuilder1.setRemoteSyncTimeout(99); ImmutableEndpoint ep = endpointFactory.getInboundEndpoint(endpointBuilder1); assertEquals(ep.getEndpointURI().getUri().toString(), "test://address"); assertTrue(ep.isSynchronous()); assertEquals(99, ep.getRemoteSyncTimeout()); assertNotNull(ep.getConnector()); assertEquals(testConnector1, ep.getConnector()); // Test creating an endpoint from endpointBuilder2 endpointBuilder2.setSynchronous(false); endpointBuilder2.setRemoteSyncTimeout(0); endpointBuilder2.setConnector(testConnector2); ImmutableEndpoint ep2 = endpointFactory.getInboundEndpoint(endpointBuilder2); assertEquals(ep2.getEndpointURI().getUri().toString(), "test://address"); assertFalse(ep2.isSynchronous()); assertEquals(0, ep2.getRemoteSyncTimeout()); assertNotNull(ep.getConnector()); assertEquals(testConnector2, ep2.getConnector()); // Test creating a new endpoint from endpointBuilder1 ImmutableEndpoint ep3 = endpointFactory.getInboundEndpoint(endpointBuilder1); assertEquals(ep3.getEndpointURI().getUri().toString(), "test://address"); assertTrue(ep3.getRemoteSyncTimeout() != 0); assertTrue(ep3.isSynchronous()); assertNotNull(ep.getConnector()); assertEquals(testConnector1, ep3.getConnector()); } catch (Exception e) { fail("Unexpected exception: " + e.getMessage()); } } } mule-2.0.1/core/src/test/java/org/mule/endpoint/MuleEndpointURITestCase.java0000644000175000017500000000240710745677442026575 0ustar charlescharles/* * $Id: MuleEndpointURITestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.tck.AbstractMuleTestCase; public class MuleEndpointURITestCase extends AbstractMuleTestCase { public void testEquality() throws Exception { MuleEndpointURI u1 = new MuleEndpointURI("test://mule:secret@jabber.org:6666/ross@jabber.org"); MuleEndpointURI u2 = new MuleEndpointURI("test://mule:secret@jabber.org:6666/ross@jabber.org"); assertEquals(u1, u2); assertEquals(u2, u1); assertEquals(u1.hashCode(), u2.hashCode()); assertEquals(u2.hashCode(), u1.hashCode()); MuleEndpointURI u3 = new MuleEndpointURI(u1); assertEquals(u1, u3); assertEquals(u2, u3); assertEquals(u3, u1); assertEquals(u3, u2); assertEquals(u1.hashCode(), u3.hashCode()); assertEquals(u2.hashCode(), u3.hashCode()); } } mule-2.0.1/core/src/test/java/org/mule/endpoint/URIBuilderTestCase.java0000644000175000017500000000560010777050076025547 0ustar charlescharles/* * $Id: URIBuilderTestCase.java 11549 2008-04-09 05:12:30Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.endpoint; import org.mule.api.endpoint.EndpointURI; import org.mule.tck.AbstractMuleTestCase; import java.util.HashMap; import java.util.Map; public class URIBuilderTestCase extends AbstractMuleTestCase { private static final Map queries; static { queries = new HashMap(); queries.put("aname", "avalue"); queries.put("bname", "bvalue"); } public void testAddressForProtocol() { URIBuilder uri = new URIBuilder(); uri.setProtocol("foo"); uri.setAddress("foo://bar"); assertEquals("foo://bar", uri.toString()); } public void testAddressForMeta() { URIBuilder uri = new URIBuilder(); uri.setMeta("foo"); uri.setAddress("baz://bar"); assertEquals("foo:baz://bar", uri.toString()); } public void testQueriesWithAddress() { URIBuilder uri = new URIBuilder(); uri.setAddress("foo://bar"); uri.setQueryMap(queries); assertEquals("foo://bar?aname=avalue&bname=bvalue", uri.toString()); } // note that explicit properties over-rule those in the uri when duplicated // and we keep parameter ordering as in original url public void testLiteralQueries() { URIBuilder uri1 = new URIBuilder(); uri1.setAddress("foo://bar?cname=cvalue&aname=anothervalue"); uri1.setQueryMap(queries); assertEquals("foo://bar?cname=cvalue&aname=avalue&bname=bvalue", uri1.toString()); URIBuilder uri2 = new URIBuilder(); uri2.setQueryMap(queries); uri2.setAddress("foo://bar?cname=cvalue&aname=anothervalue"); assertEquals("foo://bar?cname=cvalue&aname=avalue&bname=bvalue", uri2.toString()); } public void testNullQueries() { URIBuilder uri1 = new URIBuilder(); uri1.setAddress("foo://bar?cname&aname"); uri1.setQueryMap(queries); assertEquals("foo://bar?cname&aname=avalue&bname=bvalue", uri1.toString()); } public void testFromString() { URIBuilder uri = new URIBuilder("test://bar"); EndpointURI endpointURI = uri.getEndpoint(); assertEquals("test://bar", endpointURI.getUri().toString()); assertEquals("test", endpointURI.getSchemeMetaInfo()); uri = new URIBuilder("meta:test://bar"); endpointURI = uri.getEndpoint(); assertEquals("test://bar", endpointURI.getUri().toString()); assertEquals("meta", endpointURI.getSchemeMetaInfo()); } }mule-2.0.1/core/src/test/java/org/mule/model/0000755000175000017500000000000011351411073020544 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/model/seda/0000755000175000017500000000000011351411073021460 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/model/seda/SedaServiceTestCase.java0000644000175000017500000000636410767256152026204 0ustar charlescharles/* * $Id: SedaServiceTestCase.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.seda; import org.mule.api.MuleRuntimeException; import org.mule.component.DefaultJavaComponent; import org.mule.object.PrototypeObjectFactory; import org.mule.tck.AbstractMuleTestCase; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkEvent; import javax.resource.spi.work.WorkException; public class SedaServiceTestCase extends AbstractMuleTestCase // AbstractServiceTestCase { // Cannot extend AbstractServiceTestCase because of inconsistent behaviour. See // MULE-2843 // protected void doSetUp() throws Exception // { // service = new SedaService(); // service.setName("seda"); // service.setServiceFactory(new PrototypeObjectFactory(Object.class)); // service.setMuleContext(muleContext); // service.setModel(new SedaModel()); // service.getModel().setMuleContext(muleContext); // service.getModel().initialise(); // } // // protected void doTearDown() throws Exception // { // service = null; // } public void testSedaModelEventTimeoutDefault() throws Exception { SedaService service = new SedaService(); service.setName("test"); service.setComponent(new DefaultJavaComponent(new PrototypeObjectFactory(Object.class))); service.setModel(new SedaModel()); service.setMuleContext(muleContext); service.getModel().setMuleContext(muleContext); service.getModel().initialise(); service.initialise(); assertNotNull(service.getQueueTimeout()); assertTrue(service.getQueueTimeout().intValue() != 0); } public void testSpiWorkThrowableHandling() throws Exception { try { // getTestComponent() currently already returns a SedaService, but // here we are safe-guarding for any future changes SedaService service = new SedaService(); service.setName("test"); service.setComponent(new DefaultJavaComponent(new PrototypeObjectFactory(Object.class))); service.setModel(new SedaModel()); service.handleWorkException(getTestWorkEvent(), "workRejected"); } catch (MuleRuntimeException mrex) { assertNotNull(mrex); assertTrue(mrex.getCause().getClass() == Throwable.class); assertEquals("testThrowable", mrex.getCause().getMessage()); } } private WorkEvent getTestWorkEvent() { return new WorkEvent(this, // source WorkEvent.WORK_REJECTED, getTestWork(), new WorkException(new Throwable("testThrowable"))); } private Work getTestWork() { return new Work() { public void release() { // noop } public void run() { // noop } }; } } mule-2.0.1/core/src/test/java/org/mule/model/direct/0000755000175000017500000000000011351411073022016 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/model/direct/DirectServiceTestCase.java0000644000175000017500000000236310767256152027073 0ustar charlescharles/* * $Id: DirectServiceTestCase.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model.direct; import org.mule.api.MuleException; import org.mule.component.DefaultJavaComponent; import org.mule.model.AbstractServiceTestCase; import org.mule.object.SingletonObjectFactory; public class DirectServiceTestCase extends AbstractServiceTestCase { protected void doSetUp() throws Exception { service = new DirectService(); service.setName("direct"); service.setComponent(new DefaultJavaComponent(new SingletonObjectFactory(Object.class))); service.setModel(new DirectModel()); service.setMuleContext(muleContext); } protected void doTearDown() throws Exception { service = null; } public void testStop() throws MuleException { // TODO Remove this overridden empty implementation once MULE-2844 is resolved } } mule-2.0.1/core/src/test/java/org/mule/model/AbstractServiceTestCase.java0000644000175000017500000000737110766654216026160 0ustar charlescharles/* * $Id: AbstractServiceTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.model; import org.mule.api.MuleException; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.tck.AbstractMuleTestCase; public abstract class AbstractServiceTestCase extends AbstractMuleTestCase { protected Service service; public void testStart() throws MuleException { try { service.start(); fail("Exception expected: Cannot start an uninitialised service"); } catch (Exception e) { // expected } service.initialise(); service.start(); try { service.initialise(); fail("Exception expected: Cannot initialise an already initialised service"); } catch (InitialisationException e) { // expected } service.dispose(); } public void testPause() throws MuleException { assertFalse(service.isStarted()); assertFalse(service.isPaused()); service.initialise(); // Pausing a service that is not started does not throw an exception assertFalse(service.isStarted()); assertFalse(service.isPaused()); service.resume(); assertFalse(service.isPaused()); service.start(); assertTrue(service.isStarted()); assertFalse(service.isPaused()); service.pause(); assertTrue(service.isPaused()); service.pause(); assertTrue(service.isPaused()); service.dispose(); } public void testResume() throws MuleException { assertFalse(service.isStarted()); assertFalse(service.isPaused()); service.initialise(); assertFalse(service.isStarted()); assertFalse(service.isPaused()); service.resume(); assertFalse(service.isPaused()); service.start(); assertTrue(service.isStarted()); assertFalse(service.isPaused()); service.resume(); assertFalse(service.isPaused()); service.pause(); assertTrue(service.isPaused()); service.resume(); assertFalse(service.isPaused()); service.resume(); assertFalse(service.isPaused()); service.dispose(); } public void testStop() throws MuleException { assertFalse(service.isStarted()); assertFalse(service.isPaused()); service.stop(); try { service.resume(); fail("Exception expected: Cannot stop an uninitialised service"); } catch (MuleException e) { // expected } service.initialise(); assertFalse(service.isStarted()); service.stop(); assertFalse(service.isStarted()); service.start(); assertTrue(service.isStarted()); service.stop(); assertFalse(service.isStarted()); service.stop(); assertFalse(service.isStarted()); service.dispose(); } public void testDispose() throws MuleException { assertFalse(service.isStarted()); assertFalse(service.isPaused()); service.dispose(); service.initialise(); assertFalse(service.isStarted()); service.dispose(); assertFalse(service.isStarted()); service.dispose(); } } mule-2.0.1/core/src/test/java/org/mule/DefaultMuleContextFactoryTestCase.java0000644000175000017500000003127710766637211027076 0ustar charlescharles/* * $Id: DefaultMuleContextFactoryTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleContext; import org.mule.api.config.ConfigurationException; import org.mule.api.config.MuleConfiguration; import org.mule.api.config.MuleProperties; import org.mule.api.context.WorkManager; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.lifecycle.LifecycleManager; import org.mule.api.model.Model; import org.mule.config.DefaultMuleConfiguration; import org.mule.config.builders.AbstractConfigurationBuilder; import org.mule.config.builders.SimpleConfigurationBuilder; import org.mule.context.DefaultMuleContextBuilder; import org.mule.context.DefaultMuleContextFactory; import org.mule.context.notification.ServerNotificationManager; import org.mule.model.seda.SedaModel; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Banana; import java.util.ArrayList; import java.util.List; import java.util.Properties; import javax.resource.spi.work.WorkListener; public class DefaultMuleContextFactoryTestCase extends AbstractMuleTestCase { private DefaultMuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); private static String TEST_STRING_KEY = "test"; private static String TEST_STRING_VALUE = "test_value"; private static String TEST_STRING_KEY2 = "test2"; private static String TEST_STRING_VALUE2 = "test_value2"; private static String TEST_OBJECT_NAME = "testObject"; private static String TEST_MODEL_NAME = "testModel"; public void testCreateMuleContext() throws InitialisationException, ConfigurationException { MuleContext muleContext = muleContextFactory.createMuleContext(); // Assert MuleContext config testMuleContext(muleContext); testDefaults(muleContext); } public void testCreateMuleContextConfigurationBuilder() throws InitialisationException, ConfigurationException { MuleContext muleContext = muleContextFactory.createMuleContext(new TestConfigurationBuilder()); // Assert MuleContext config testMuleContext(muleContext); testConfigurationBuilder1Objects(muleContext); testNoDefaults(muleContext); } public void testCreateMuleContextListMuleContextBuilder() throws InitialisationException, ConfigurationException { List configBuilders = new ArrayList(); configBuilders.add(new TestConfigurationBuilder()); configBuilders.add(new TestConfigurationBuilder2()); TestMuleContextBuilder muleContextBuilder = new TestMuleContextBuilder(); MuleContext muleContext = muleContextFactory.createMuleContext(configBuilders, muleContextBuilder); // Assert MuleContext config testCustomMuleContext(muleContext); // Assert configured objects testConfigurationBuilder1Objects(muleContext); testConfigurationBuilder2Objects(muleContext); testNoDefaults(muleContext); } public void testCreateMuleContextMuleContextBuilder() throws InitialisationException, ConfigurationException { TestMuleContextBuilder muleContextBuilder = new TestMuleContextBuilder(); MuleContext muleContext = muleContextFactory.createMuleContext(new SimpleConfigurationBuilder(null), muleContextBuilder); // Assert MuleContext config testCustomMuleContext(muleContext); testNoDefaults(muleContext); } public void testCreateMuleContextConfigurationBuilderMuleContextBuilder() throws InitialisationException, ConfigurationException { TestMuleContextBuilder muleContextBuilder = new TestMuleContextBuilder(); MuleContext muleContext = muleContextFactory.createMuleContext(new TestConfigurationBuilder2(), muleContextBuilder); // Assert MuleContext config testCustomMuleContext(muleContext); testConfigurationBuilder2Objects(muleContext); testNoDefaults(muleContext); } public void testCreateMuleContextString() throws InitialisationException, ConfigurationException { MuleContext muleContext = null; try { muleContext = muleContextFactory.createMuleContext("log4j.properties"); } catch (ConfigurationException e) { assertEquals( "No suitable configuration builder for resource \"[ConfigResource{resourceName='log4j.properties'}]\" found. " + "Check you have configuration module on your classpath and are using correct file extension. " + "(org.mule.api.config.ConfigurationException)", e.getMessage()); } assertNull(muleContext); } public void testCreateMuleContextStringProperties() throws InitialisationException, ConfigurationException { Properties properties = new Properties(); properties.put("testKey1", "testValue1"); properties.put("testKey2", "testValue2"); MuleContext muleContext = null; try { muleContext = muleContextFactory.createMuleContext("log4j.properties", properties); } catch (ConfigurationException e) { assertEquals( "No suitable configuration builder for resource \"[ConfigResource{resourceName='log4j.properties'}]\" found. " + "Check you have configuration module on your classpath and are using correct file extension. " + "(org.mule.api.config.ConfigurationException)", e.getMessage()); } assertNull(muleContext); } public void testCreateMuleContextConfigurationBuilderProperties() throws InitialisationException, ConfigurationException { Properties properties = new Properties(); properties.put("testKey3", "testValue3"); properties.put("testKey4", "testValue4"); MuleContext muleContext = muleContextFactory.createMuleContext(new TestConfigurationBuilder(), properties); // Assert MuleContext config testMuleContext(muleContext); testConfigurationBuilder1Objects(muleContext); assertEquals("testValue3", muleContext.getRegistry().lookupObject("testKey3")); assertEquals("testValue4", muleContext.getRegistry().lookupObject("testKey4")); testNoDefaults(muleContext); } private void testDefaults(MuleContext muleContext) { // Asert existance of defauts in registry assertNotNull(muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_QUEUE_MANAGER)); assertNotNull(muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_SECURITY_MANAGER)); assertNotNull(muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_SYSTEM_MODEL)); assertNotNull(muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_MULE_ENDPOINT_FACTORY)); assertNotNull(muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_MULE_SIMPLE_REGISTRY_BOOTSTRAP)); } private void testNoDefaults(MuleContext muleContext) { // Asert non-existance of defauts in registry assertNull(muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_QUEUE_MANAGER)); assertNull(muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_SECURITY_MANAGER)); assertNull(muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_SYSTEM_MODEL)); assertNull(muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_MULE_ENDPOINT_FACTORY)); assertNull(muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_MULE_SIMPLE_REGISTRY_BOOTSTRAP)); } private void testMuleContext(MuleContext muleContext) { assertNotNull(muleContext); assertEquals(DefaultMuleContext.class, muleContext.getClass()); assertTrue(muleContext.isInitialised()); assertNotNull(muleContext.getConfiguration()); assertEquals(DefaultMuleConfiguration.class, muleContext.getConfiguration().getClass()); assertNotNull(muleContext.getLifecycleManager().getClass()); assertNotNull(muleContext.getLifecycleManager().getLifecycles().toArray()[0]); assertNotNull(muleContext.getLifecycleManager().getLifecycles().toArray()[1]); assertNotNull(muleContext.getLifecycleManager().getLifecycles().toArray()[2]); assertNotNull(muleContext.getLifecycleManager().getLifecycles().toArray()[3]); assertNotNull(muleContext.getNotificationManager()); assertNotNull(muleContext.getWorkManager()); } private void testCustomMuleContext(MuleContext muleContext) { assertNotNull(muleContext); assertEquals(TestMuleContext.class, muleContext.getClass()); assertTrue(muleContext.isInitialised()); assertNotNull(muleContext.getConfiguration()); assertNotNull(muleContext.getLifecycleManager().getClass()); assertNotNull(muleContext.getLifecycleManager().getLifecycles().toArray()[0]); assertNotNull(muleContext.getLifecycleManager().getLifecycles().toArray()[1]); assertNotNull(muleContext.getLifecycleManager().getLifecycles().toArray()[2]); assertNotNull(muleContext.getLifecycleManager().getLifecycles().toArray()[3]); assertNotNull(muleContext.getNotificationManager()); assertNotNull(muleContext.getWorkManager()); } private void testConfigurationBuilder1Objects(MuleContext muleContext) { // Test Registry contents for existance of object configured by // TestConfigurationBuilder assertEquals(TEST_STRING_VALUE, muleContext.getRegistry().lookupObject(TEST_STRING_KEY)); Object obj = muleContext.getRegistry().lookupObject(TEST_OBJECT_NAME); assertNotNull(obj); assertEquals(Banana.class, obj.getClass()); } private void testConfigurationBuilder2Objects(MuleContext muleContext) { // Test Registry contents for existance of object configured by // TestConfigurationBuilder2 assertEquals(TEST_STRING_VALUE2, muleContext.getRegistry().lookupObject(TEST_STRING_KEY2)); assertNotNull(muleContext.getRegistry().lookupModel(TEST_MODEL_NAME)); assertEquals(TEST_MODEL_NAME, muleContext.getRegistry().lookupModel(TEST_MODEL_NAME).getName()); } /** * Override, we don't want a {@link MuleContext} created for this test case. */ protected MuleContext createMuleContext() throws Exception { return null; } static class TestConfigurationBuilder extends AbstractConfigurationBuilder { protected void doConfigure(MuleContext muleContext) throws Exception { muleContext.getRegistry().registerObject(TEST_STRING_KEY, TEST_STRING_VALUE); muleContext.getRegistry().registerObject(TEST_OBJECT_NAME, new Banana()); } } static class TestConfigurationBuilder2 extends AbstractConfigurationBuilder { protected void doConfigure(MuleContext muleContext) throws Exception { muleContext.getRegistry().registerObject(TEST_STRING_KEY2, TEST_STRING_VALUE2); Model testModel = new SedaModel(); testModel.setName(TEST_MODEL_NAME); muleContext.getRegistry().registerModel(testModel); } } static class TestMuleContextBuilder extends DefaultMuleContextBuilder { public MuleContext buildMuleContext() { MuleContext muleContext = new TestMuleContext(getMuleConfiguration(), getWorkManager(), getWorkListener(), getLifecycleManager(), getNotificationManager()); return muleContext; } } static class TestMuleContext extends DefaultMuleContext { public TestMuleContext(MuleConfiguration config, WorkManager workManager, WorkListener workListener, LifecycleManager lifecycleManager, ServerNotificationManager notificationManager) { super(config, workManager, workListener, lifecycleManager, notificationManager); } } static class TestMuleConfiguration extends DefaultMuleConfiguration { // just a skeleton } } mule-2.0.1/core/src/test/java/org/mule/transformer/0000755000175000017500000000000011351411075022010 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/transformer/wire/0000755000175000017500000000000011351411074022755 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/transformer/wire/SerializedMuleMessageWireFormatTestCase.javamule-2.0.1/core/src/test/java/org/mule/transformer/wire/SerializedMuleMessageWireFormatTestCase.java0000644000175000017500000000257410770356575033531 0ustar charlescharles/* * $Id: SerializedMuleMessageWireFormatTestCase.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.wire; import org.mule.api.transformer.wire.WireFormat; import org.mule.transformer.simple.ByteArrayToMuleMessage; import org.mule.transformer.simple.MuleMessageToByteArray; public class SerializedMuleMessageWireFormatTestCase extends AbstractMuleMessageWireFormatTestCase { protected WireFormat getWireFormat() { return new SerializedMuleMessageWireFormat(); } public void testGetDefaultInboundTransformer() { SerializedMuleMessageWireFormat wireFormat = (SerializedMuleMessageWireFormat) getWireFormat(); assertEquals(ByteArrayToMuleMessage.class, wireFormat.getInboundTransformer().getClass()); } public void testGetDefaultOutboundTransformer() { SerializedMuleMessageWireFormat wireFormat = (SerializedMuleMessageWireFormat) getWireFormat(); assertEquals(MuleMessageToByteArray.class, wireFormat.getOutboundTransformer().getClass()); } } mule-2.0.1/core/src/test/java/org/mule/transformer/wire/SerializationWireFormatTestCase.java0000644000175000017500000000244110745677442032115 0ustar charlescharles/* * $Id: SerializationWireFormatTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.wire; import org.mule.api.transformer.wire.WireFormat; import org.mule.transformer.simple.ByteArrayToSerializable; import org.mule.transformer.simple.SerializableToByteArray; public class SerializationWireFormatTestCase extends AbstractWireFormatTestCase { protected WireFormat getWireFormat() { return new SerializationWireFormat(); } public void testGetDefaultInboundTransformer() { SerializationWireFormat wireFormat = new SerializationWireFormat(); assertEquals(ByteArrayToSerializable.class, wireFormat.getInboundTransformer().getClass()); } public void testGetDefaultOutboundTransformer() { SerializationWireFormat wireFormat = new SerializationWireFormat(); assertEquals(SerializableToByteArray.class, wireFormat.getOutboundTransformer().getClass()); } } mule-2.0.1/core/src/test/java/org/mule/transformer/wire/AbstractWireFormatTestCase.java0000644000175000017500000000670510767262171031043 0ustar charlescharles/* * $Id: AbstractWireFormatTestCase.java 11377 2008-03-16 18:18:33Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.wire; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.transformer.wire.WireFormat; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transformer.simple.ObjectToString; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.util.Properties; public abstract class AbstractWireFormatTestCase extends AbstractMuleTestCase { public void testWriteReadMessage() throws Exception { // Create message to send over wire Properties messageProerties = new Properties(); messageProerties.put("key1", "val1"); MuleMessage inMessage = new DefaultMuleMessage("testMessage", messageProerties); Object outMessage = readWrite(inMessage); // NOTE: Since we are not using SerializedMuleMessageWireFormat we only get // the payload back and not the MuleMessage. assertTrue(outMessage instanceof String); assertEquals("testMessage", outMessage); } public void testWriteReadPayload() throws Exception { // Create orange to send over the wire Properties messageProerties = new Properties(); messageProerties.put("key1", "val1"); Orange inOrange = new Orange(); inOrange.setBrand("Walmart"); inOrange.setMapProperties(messageProerties); Object outObject = readWrite(inOrange); // Test deserialized Fruit assertTrue(outObject instanceof Orange); assertEquals("Walmart", ((Orange) outObject).getBrand()); assertEquals("val1", ((Orange) outObject).getMapProperties().get("key1")); } protected Object readWrite(Object inObject) throws Exception { // Serialize WireFormat wireFormat = getWireFormat(); ByteArrayOutputStream out = new ByteArrayOutputStream(); wireFormat.write(out, inObject, "UTF-8"); // De-serialize ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); Object outMessage = wireFormat.read(in); assertNotNull(outMessage); return outMessage; } public void testSetInboundTransformer() throws Exception { TransformerPairWireFormat transPairWireFormat = (TransformerPairWireFormat) getWireFormat(); transPairWireFormat.setInboundTransformer(new ObjectToString()); assertTrue(transPairWireFormat.getInboundTransformer() instanceof ObjectToString); } public void testSetOutboundTransformer() throws Exception { TransformerPairWireFormat transPairWireFormat = (TransformerPairWireFormat) getWireFormat(); transPairWireFormat.setInboundTransformer(new ObjectToString()); assertTrue(transPairWireFormat.getInboundTransformer() instanceof ObjectToString); } public abstract void testGetDefaultInboundTransformer() throws Exception; public abstract void testGetDefaultOutboundTransformer() throws Exception; protected abstract WireFormat getWireFormat() throws Exception; } mule-2.0.1/core/src/test/java/org/mule/transformer/wire/AbstractMuleMessageWireFormatTestCase.java0000644000175000017500000000376710770356575033206 0ustar charlescharles/* * $Id: AbstractMuleMessageWireFormatTestCase.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.wire; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.tck.testmodels.fruit.Orange; import java.util.Properties; public abstract class AbstractMuleMessageWireFormatTestCase extends AbstractWireFormatTestCase { public void testWriteReadMessage() throws Exception { // Create message to send over wire Properties messageProerties = new Properties(); messageProerties.put("key1", "val1"); MuleMessage inMessage = new DefaultMuleMessage("testMessage", messageProerties); Object outMessage = readWrite(inMessage); // Test deserialized message // NOTE: As we are using SerializedMuleMessageWireFormat we get // MuleMessage rather than just the payload assertTrue(outMessage instanceof MuleMessage); assertEquals("testMessage", ((MuleMessage) outMessage).getPayload()); assertEquals("val1", ((MuleMessage) outMessage).getProperty("key1")); } public void testWriteReadPayload() throws Exception { // Create orange to send over the wire Properties messageProerties = new Properties(); messageProerties.put("key1", "val1"); Orange inOrange = new Orange(); inOrange.setBrand("Walmart"); inOrange.setMapProperties(messageProerties); try { readWrite(inOrange); fail("Expected exception: MuleMessageWireFormat does not support other types"); } catch (Exception e) { // Expected } } } mule-2.0.1/core/src/test/java/org/mule/transformer/encryption/0000755000175000017500000000000011351411075024202 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/transformer/encryption/EncryptionTransformerTestCase.java0000644000175000017500000000553410766014216033072 0ustar charlescharles/* * $Id:EncryptionTransformerTestCase.java 5937 2007-04-09 22:35:04Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.encryption; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.security.CryptoFailureException; import org.mule.api.transformer.Transformer; import org.mule.security.PasswordBasedEncryptionStrategy; import org.mule.transformer.AbstractTransformerTestCase; import java.util.Arrays; public class EncryptionTransformerTestCase extends AbstractTransformerTestCase { private static final String TEST_DATA = "the quick brown fox jumped over the lazy dog the quick brown fox jumped over the lazy dog the quick brown fox jumped over the lazy dog"; private PasswordBasedEncryptionStrategy strat; // @Override protected void doSetUp() throws Exception { strat = new PasswordBasedEncryptionStrategy(); strat.setPassword("mule"); strat.initialise(); } public Object getResultData() { try { return strat.encrypt(TEST_DATA.getBytes(), null); } catch (CryptoFailureException e) { fail(e.getMessage()); return null; } } public Object getTestData() { return TEST_DATA; } public Transformer getTransformer() { EncryptionTransformer transformer = new EncryptionTransformer(); transformer.setStrategy(strat); try { transformer.initialise(); } catch (InitialisationException e) { fail(e.getMessage()); } return transformer; } public Transformer getRoundTripTransformer() { DecryptionTransformer transformer = new DecryptionTransformer(); transformer.setStrategy(strat); transformer.setReturnClass(String.class); try { transformer.initialise(); } catch (InitialisationException e) { fail(e.getMessage()); } return transformer; } // @Override public boolean compareResults(Object src, Object result) { if (src == null && result == null) { return true; } if (src == null || result == null) { return false; } if (src instanceof byte[] && result instanceof byte[]) { return Arrays.equals((byte[]) src, (byte[]) result); } else { return super.compareResults(src, result); } } } mule-2.0.1/core/src/test/java/org/mule/transformer/NullResultTestCase.java0000644000175000017500000000356210754365306026441 0ustar charlescharles/* * $Id: NullResultTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.transport.NullPayload; public class NullResultTestCase extends AbstractTransformerTestCase { private final NullResultTransformer transformer = new NullResultTransformer(); public Object getTestData() { return new Object(); } public Object getResultData() { return NullPayload.getInstance(); } public Transformer getTransformer() throws Exception { return transformer; } public Transformer getRoundTripTransformer() throws Exception { return null; } public void testNullNotExpected() throws Exception { transformer.setReturnClass(String.class); try { testTransform(); fail("Transformer should have thrown an exception because the return class doesn't match the result."); } catch (TransformerException e) { // expected } } public static final class NullResultTransformer extends AbstractTransformer { public NullResultTransformer() { super(); this.registerSourceType(Object.class); this.setReturnClass(NullPayload.class); } public Object doTransform(Object src, String encoding) throws TransformerException { return null; } } } mule-2.0.1/core/src/test/java/org/mule/transformer/simple/0000755000175000017500000000000011351411075023301 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/transformer/simple/OutboundAppendTransformer.java0000644000175000017500000000126010754403514031322 0ustar charlescharles/* * $Id: OutboundAppendTransformer.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.transformer.simple.StringAppendTransformer; public class OutboundAppendTransformer extends StringAppendTransformer { public OutboundAppendTransformer() { super(" outbound"); } }././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/transformer/simple/HexStringByteArrayTransformersTestCase.javamule-2.0.1/core/src/test/java/org/mule/transformer/simple/HexStringByteArrayTransformersTestCase.jav0000644000175000017500000000461710766014216033620 0ustar charlescharles/* * $Id: HexStringByteArrayTransformersTestCase.java 11336 2008-03-12 17:53:18Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformerTestCase; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.Arrays; public class HexStringByteArrayTransformersTestCase extends AbstractTransformerTestCase { public Transformer getTransformer() { return new HexStringToByteArray(); } public Transformer getRoundTripTransformer() { return new ByteArrayToHexString(); } public Object getTestData() { return "01020aff"; } public Object getResultData() { return new byte[]{1, 2, 10, (byte)0xff}; } // @Override public boolean compareResults(Object src, Object result) { if (src == null && result == null) { return true; } if (src == null || result == null) { return false; } return Arrays.equals((byte[])src, (byte[])result); } // @Override public boolean compareRoundtripResults(Object src, Object result) { if (src == null && result == null) { return true; } if (src == null || result == null) { return false; } return src.equals(result); } // extra test for uppercase output public void testUppercase() throws TransformerException { ByteArrayToHexString t = new ByteArrayToHexString(); t.setUpperCase(true); assertEquals(((String)getTestData()).toUpperCase(), t.transform(getResultData())); } public void testStreaming() throws TransformerException { ByteArrayToHexString transformer = new ByteArrayToHexString(); InputStream input = new ByteArrayInputStream((byte[]) this.getResultData()); assertEquals(this.getTestData(), transformer.transform(input)); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/transformer/simple/ObjectByteArrayTransformersWithObjectsTestCase.javamule-2.0.1/core/src/test/java/org/mule/transformer/simple/ObjectByteArrayTransformersWithObjectsTest0000644000175000017500000000162010745677442033712 0ustar charlescharles/* * $Id: ObjectByteArrayTransformersWithObjectsTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.Transformer; public class ObjectByteArrayTransformersWithObjectsTestCase extends SerialisedObjectTransformersTestCase { // @Override public Transformer getTransformer() throws Exception { return new ObjectToByteArray(); } // @Override public Transformer getRoundTripTransformer() throws Exception { return new ByteArrayToObject(); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/transformer/simple/ObjectByteArrayTransformersWithResultStreamTestCase.javamule-2.0.1/core/src/test/java/org/mule/transformer/simple/ObjectByteArrayTransformersWithResultStrea0000644000175000017500000000240610766014216033724 0ustar charlescharles/* * $Id: ObjectByteArrayTransformersWithResultStreamTestCase.java 11336 2008-03-12 17:53:18Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.util.IOUtils; import java.io.ByteArrayInputStream; import java.io.InputStream; public class ObjectByteArrayTransformersWithResultStreamTestCase extends ObjectByteArrayTransformersWithObjectsTestCase { // @Override public Object getResultData() { byte[] resultData = (byte[])super.getResultData(); return new ByteArrayInputStream(resultData); } // @Override public boolean compareResults(Object expected, Object result) { if (expected instanceof InputStream) { InputStream input = (InputStream)expected; byte[] bytes = IOUtils.toByteArray(input); return super.compareResults(bytes, result); } return super.compareResults(expected, result); } } mule-2.0.1/core/src/test/java/org/mule/transformer/simple/StringByteArrayTransformersTestCase.java0000644000175000017500000000326710754365306033322 0ustar charlescharles/* * $Id: StringByteArrayTransformersTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.Transformer; import org.mule.transformer.AbstractTransformerTestCase; import java.util.Arrays; public class StringByteArrayTransformersTestCase extends AbstractTransformerTestCase { public Transformer getTransformer() throws Exception { return new ObjectToByteArray(); } public Transformer getRoundTripTransformer() throws Exception { return new ByteArrayToObject(); } public Object getTestData() { return "Test"; } public Object getResultData() { return "Test".getBytes(); } // @Override public boolean compareResults(Object src, Object result) { if (src == null && result == null) { return true; } if (src == null || result == null) { return false; } return Arrays.equals((byte[]) src, (byte[]) result); } // @Override public boolean compareRoundtripResults(Object src, Object result) { if (src == null && result == null) { return true; } if (src == null || result == null) { return false; } return src.equals(result); } } mule-2.0.1/core/src/test/java/org/mule/transformer/simple/ResponseAppendTransformer.java0000644000175000017500000000126410754403514031325 0ustar charlescharles/* * $Id: ResponseAppendTransformer.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.transformer.simple.StringAppendTransformer; public class ResponseAppendTransformer extends StringAppendTransformer { public ResponseAppendTransformer() { super(" response"); } } mule-2.0.1/core/src/test/java/org/mule/transformer/simple/InboundAppendTransformer.java0000644000175000017500000000126010754403514031121 0ustar charlescharles/* * $Id: InboundAppendTransformer.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.transformer.simple.StringAppendTransformer; public class InboundAppendTransformer extends StringAppendTransformer { public InboundAppendTransformer() { super(" inbound"); } } mule-2.0.1/core/src/test/java/org/mule/transformer/simple/ObjectToStringWithMapTestCase.java0000644000175000017500000000264510754365306032014 0ustar charlescharles/* * $Id: ObjectToStringWithMapTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.Transformer; import org.mule.transformer.AbstractTransformerTestCase; import java.util.Map; import java.util.TreeMap; public class ObjectToStringWithMapTestCase extends AbstractTransformerTestCase { public Transformer getTransformer() throws Exception { return new ObjectToString(); } public Object getTestData() { // TreeMap guarantees the order of keys. This is important for creating a test result // that is guaranteed to be comparable to the output of getResultData. Map map = new TreeMap(); map.put("existingValue", "VALUE"); map.put("nonexistingValue", null); return map; } public Object getResultData() { return "{existingValue=VALUE, nonexistingValue=null}"; } public Transformer getRoundTripTransformer() throws Exception { // we do not want round trip transforming tested return null; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/transformer/simple/StringObjectArrayTransformersTestCase.javamule-2.0.1/core/src/test/java/org/mule/transformer/simple/StringObjectArrayTransformersTestCase.java0000644000175000017500000000343110754365306033616 0ustar charlescharles/* * $Id: StringObjectArrayTransformersTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.Transformer; import org.mule.transformer.AbstractTransformerTestCase; public class StringObjectArrayTransformersTestCase extends AbstractTransformerTestCase { public Transformer getTransformer() throws Exception { return new StringToObjectArray(); } public Transformer getRoundTripTransformer() throws Exception { return new ObjectArrayToString(); } public Object getTestData() { return "test1 test2 test3"; } public Object getResultData() { return new String[]{"test1", "test2", "test3"}; } // @Override public boolean compareResults(Object src, Object result) { if (src == null || result == null) { return false; } if (result instanceof Object[]) { Object[] out = (Object[]) result; assertEquals(out[0].toString(), "test1"); assertEquals(out[1].toString(), "test2"); assertEquals(out[2].toString(), "test3"); return true; } return false; } // @Override public boolean compareRoundtripResults(Object src, Object result) { if (src == null || result == null) { return false; } return src.equals(result); } } mule-2.0.1/core/src/test/java/org/mule/transformer/simple/ObjectToStringWithCollectionTestCase.java0000644000175000017500000000235210754365306033365 0ustar charlescharles/* * $Id: ObjectToStringWithCollectionTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.Transformer; import org.mule.transformer.AbstractTransformerTestCase; import java.util.ArrayList; import java.util.List; public class ObjectToStringWithCollectionTestCase extends AbstractTransformerTestCase { public Transformer getTransformer() throws Exception { return new ObjectToString(); } public Object getTestData() { List list = new ArrayList(); list.add("one"); list.add(null); list.add("three"); return list; } public Object getResultData() { return "[one, null, three]"; } public Transformer getRoundTripTransformer() throws Exception { // we do not want round trip transforming tested return null; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/transformer/simple/SerializedUMOMessageTransformersTestCase.javamule-2.0.1/core/src/test/java/org/mule/transformer/simple/SerializedUMOMessageTransformersTestCase.j0000644000175000017500000001005210766204322033501 0ustar charlescharles/* * $Id:SerializedUMOMessageTransformersTestCase.java 5937 2007-04-09 22:35:04Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.MuleMessage; import org.mule.api.transformer.Transformer; import org.mule.tck.MuleTestUtils; import org.mule.tck.testmodels.fruit.Apple; import org.mule.transformer.AbstractTransformerTestCase; import java.io.IOException; import java.io.ObjectOutputStream; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import org.apache.commons.io.output.ByteArrayOutputStream; public class SerializedUMOMessageTransformersTestCase extends AbstractTransformerTestCase { private MuleMessage testObject = null; // @Override protected void doSetUp() throws Exception { Map props = new HashMap(); props.put("object", new Apple()); props.put("number", new Integer(1)); props.put("string", "hello"); testObject = new DefaultMuleMessage("test", props); RequestContext.setEvent( new DefaultMuleEvent(testObject, getTestOutboundEndpoint("test"), MuleTestUtils.getTestSession(muleContext), true)); } // @Override protected void doTearDown() throws Exception { RequestContext.clear(); } // @Override public void testTransform() throws Exception { // this depends on the ordering of properties in the map. // because we now make a copy of maps in RequestContext this order can change //super.testTransform(); } public Transformer getTransformer() throws Exception { return new MuleMessageToByteArray(); } public Transformer getRoundTripTransformer() throws Exception { return new ByteArrayToMuleMessage(); } public Object getTestData() { return testObject; } public Object getResultData() { try { ByteArrayOutputStream bs = null; ObjectOutputStream os = null; bs = new ByteArrayOutputStream(); os = new ObjectOutputStream(bs); os.writeObject(testObject); os.flush(); os.close(); return bs.toByteArray(); } catch (IOException e) { throw new IllegalStateException(e.getMessage()); } } // @Override public boolean compareResults(Object src, Object result) { if (src == null && result == null) { return true; } if (src == null || result == null) { return false; } return Arrays.equals((byte[])src, (byte[])result); } // @Override public boolean compareRoundtripResults(Object src, Object result) { if (src == null && result == null) { return true; } if (src == null || result == null) { return false; } if (src instanceof MuleMessage && result instanceof MuleMessage) { return ((MuleMessage)src).getPayload().equals(((MuleMessage)result).getPayload()) && ((MuleMessage)src).getProperty("object").equals( ((MuleMessage)result).getProperty("object")) && ((MuleMessage)src).getProperty("string").equals( ((MuleMessage)result).getProperty("string")) && ((MuleMessage)src).getIntProperty("number", -1) == ((MuleMessage)result) .getIntProperty("number", -2); } else { return false; } } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/transformer/simple/StringObjectArrayTransformersStreamingTestCase.javamule-2.0.1/core/src/test/java/org/mule/transformer/simple/StringObjectArrayTransformersStreamingTest0000644000175000017500000000212010765525116033745 0ustar charlescharles/* * $Id: StringObjectArrayTransformersStreamingTestCase.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.util.IOUtils; import java.io.ByteArrayInputStream; import java.io.InputStream; public class StringObjectArrayTransformersStreamingTestCase extends StringObjectArrayTransformersTestCase { public Object getTestData() { String testData = (String) super.getTestData(); return new ByteArrayInputStream(testData.getBytes()); } public boolean compareRoundtripResults(Object src, Object result) { InputStream input = (InputStream) src; String expected = IOUtils.toString(input); return expected.equals(result); } } mule-2.0.1/core/src/test/java/org/mule/transformer/simple/WrappedPayloadTransformationTestCase.java0000644000175000017500000000177710745677442033501 0ustar charlescharles/* * $Id: WrappedPayloadTransformationTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.DefaultMuleMessage; import org.mule.api.transformer.TransformerException; public class WrappedPayloadTransformationTestCase extends HexStringByteArrayTransformersTestCase { // extra test for MULE-1274: transforming UMOMessages with regular payload public void testPayloadWrappedInUMOMessage() throws TransformerException { Object wrappedPayload = new DefaultMuleMessage(this.getResultData()); assertEquals(this.getTestData(), this.getRoundTripTransformer().transform(wrappedPayload)); } } mule-2.0.1/core/src/test/java/org/mule/transformer/simple/SerialisedObjectTransformersTestCase.java0000644000175000017500000000240210766014216033424 0ustar charlescharles/* * $Id: SerialisedObjectTransformersTestCase.java 11336 2008-03-12 17:53:18Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; import org.mule.api.transformer.Transformer; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transformer.AbstractTransformerTestCase; import org.apache.commons.lang.SerializationUtils; public class SerialisedObjectTransformersTestCase extends AbstractTransformerTestCase { private Orange testObject = new Orange(new Integer(4), new Double(14.3), "nice!"); public Transformer getTransformer() throws Exception { return new SerializableToByteArray(); } public Transformer getRoundTripTransformer() throws Exception { return new ByteArrayToSerializable(); } public Object getTestData() { return testObject; } public Object getResultData() { return SerializationUtils.serialize(testObject); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/transformer/simple/ObjectByteArrayTransformersWithStringsTestCase.javamule-2.0.1/core/src/test/java/org/mule/transformer/simple/ObjectByteArrayTransformersWithStringsTest0000644000175000017500000000145610766014216033744 0ustar charlescharles/* * $Id: ObjectByteArrayTransformersWithStringsTestCase.java 11336 2008-03-12 17:53:18Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.simple; public class ObjectByteArrayTransformersWithStringsTestCase extends ObjectByteArrayTransformersWithObjectsTestCase { private String testObject = "test"; public Object getTestData() { return testObject; } public Object getResultData() { return testObject.getBytes(); } } mule-2.0.1/core/src/test/java/org/mule/transformer/codec/0000755000175000017500000000000011351411075023065 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/transformer/codec/Base64TransformersTestCase.java0000644000175000017500000000260310766061620031025 0ustar charlescharles/* * $Id: Base64TransformersTestCase.java 11339 2008-03-12 23:13:20Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.codec; import org.mule.api.transformer.Transformer; import org.mule.transformer.AbstractTransformerTestCase; import org.mule.util.Base64; public class Base64TransformersTestCase extends AbstractTransformerTestCase { private static final String TEST_DATA = "the quick brown fox jumped over the lazy dog"; public Object getResultData() { try { return Base64.encodeBytes(TEST_DATA.getBytes()); } catch (Exception ex) { fail(); return null; } } public Object getTestData() { return TEST_DATA; } public Transformer getTransformer() { return new Base64Encoder(); } public Transformer getRoundTripTransformer() { Transformer t = new Base64Decoder(); // our input is a String so we expect a String as output t.setReturnClass(String.class); return t; } } mule-2.0.1/core/src/test/java/org/mule/transformer/codec/XMLEntityTransformersTestCase.java0000644000175000017500000000435110754365306031645 0ustar charlescharles/* * $Id: XMLEntityTransformersTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.codec; import org.mule.api.transformer.Transformer; import org.mule.transformer.AbstractTransformerTestCase; public class XMLEntityTransformersTestCase extends AbstractTransformerTestCase { public Object getResultData() { return "<?xml version="1.0" encoding="utf-8"?><string xmlns="http://www.webserviceX.NET/"><StockQuotes><Stock><Symbol>IBM</Symbol><Last>91.52</Last><Date>11/3/2006</Date><Time>11:10am</Time><Change>-0.16</Change><Open>91.76</Open><High>92.34</High><Low>91.43</Low><Volume>1856600</Volume><MktCap>139.3B</MktCap><PreviousClose>91.68</PreviousClose><PercentageChange>-0.17%</PercentageChange><AnnRange>72.73 - 92.68</AnnRange><Earns>5.815</Earns><P-E>15.77</P-E><Name>INTL BUSINESS MAC</Name></Stock></StockQuotes></string>"; } public Object getTestData() { return "IBM91.5211/3/2006-0.1691.7692.3491.431856600139.3B91.68-0.17%72.73 - 92.685.81515.77INTL BUSINESS MAC"; } public Transformer getTransformer() { return new XmlEntityEncoder(); } public Transformer getRoundTripTransformer() { return new XmlEntityDecoder(); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/transformer/codec/XmlEntityTransformersStreamingTestCase.javamule-2.0.1/core/src/test/java/org/mule/transformer/codec/XmlEntityTransformersStreamingTestCase.java0000644000175000017500000000171710765525116033621 0ustar charlescharles/* * $Id: XmlEntityTransformersStreamingTestCase.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.codec; import java.io.ByteArrayInputStream; public class XmlEntityTransformersStreamingTestCase extends XMLEntityTransformersTestCase { // @Override public Object getTestData() { String string = (String)super.getTestData(); return new ByteArrayInputStream(string.getBytes()); } // @Override public Object getResultData() { String string = (String)super.getResultData(); return new ByteArrayInputStream(string.getBytes()); } } mule-2.0.1/core/src/test/java/org/mule/transformer/compression/0000755000175000017500000000000011351411074024350 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/transformer/compression/GZipTransformerStreamTestCase.java0000644000175000017500000000312610766061620033130 0ustar charlescharles/* * $Id: GZipTransformerStreamTestCase.java 11339 2008-03-12 23:13:20Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.compression; import org.mule.api.transformer.TransformerException; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.Arrays; import org.apache.commons.lang.SerializationUtils; public class GZipTransformerStreamTestCase extends GZipTransformerTestCase { public void testStreamingCompression() throws TransformerException { GZipCompressTransformer transformer = new GZipCompressTransformer(); InputStream input = new ByteArrayInputStream(SerializationUtils.serialize(TEST_DATA)); byte[] expected = (byte[]) this.getResultData(); byte[] result = (byte[]) transformer.transform(input); assertTrue(Arrays.equals(expected, result)); } public void testStreamingDecompression() throws TransformerException { GZipUncompressTransformer transformer = new GZipUncompressTransformer(); InputStream input = new ByteArrayInputStream((byte[]) this.getResultData()); byte[] resultBytes = (byte[]) transformer.transform(input); assertEquals(TEST_DATA, SerializationUtils.deserialize(resultBytes)); } } mule-2.0.1/core/src/test/java/org/mule/transformer/compression/GZipTransformerTestCase.java0000644000175000017500000000367710766035006031766 0ustar charlescharles/* * $Id: GZipTransformerTestCase.java 11337 2008-03-12 20:16:06Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.compression; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transformer.Transformer; import org.mule.transformer.AbstractTransformerTestCase; import org.mule.util.compression.GZipCompression; import org.apache.commons.lang.SerializationUtils; public class GZipTransformerTestCase extends AbstractTransformerTestCase { protected static final String TEST_DATA = "the quick brown fox jumped over the lazy dog the quick brown fox jumped over the lazy dog the quick brown fox jumped over the lazy dog"; protected GZipCompression strat; // @Override protected void doSetUp() throws Exception { strat = new GZipCompression(); } public Object getResultData() { try { return strat.compressByteArray(SerializationUtils.serialize(TEST_DATA)); } catch (Exception e) { fail(e.getMessage()); return null; } } public Object getTestData() { return TEST_DATA; } public Transformer getTransformer() { return new GZipCompressTransformer(); } public Transformer getRoundTripTransformer() { GZipUncompressTransformer transformer = new GZipUncompressTransformer(); transformer.setReturnClass(String.class); try { transformer.initialise(); } catch (InitialisationException e) { fail(e.getMessage()); } return transformer; } } mule-2.0.1/core/src/test/java/org/mule/transformer/compression/GZipTransformerRawBytesTestCase.java0000644000175000017500000000373410745677442033456 0ustar charlescharles/* * $Id: GZipTransformerRawBytesTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer.compression; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.transformer.Transformer; import java.io.UnsupportedEncodingException; public class GZipTransformerRawBytesTestCase extends GZipTransformerTestCase { // @Override public Object getResultData() { try { return strat.compressByteArray((byte[]) this.getTestData()); } catch (Exception e) { fail(e.getMessage()); return null; } } // @Override public Object getTestData() { try { return ((String) super.getTestData()).getBytes("UTF8"); } catch (UnsupportedEncodingException uex) { fail(uex.getMessage()); return null; } } // @Override public Transformer getRoundTripTransformer() { GZipUncompressTransformer transformer = new GZipUncompressTransformer(); try { transformer.initialise(); } catch (InitialisationException e) { fail(e.getMessage()); } return transformer; } // @Override public void doTestBadReturnType(Transformer tran, Object src) throws Exception { /* * Disabled, otherwise the test for invalid return types would fail. The * "invalid" class that is configured as returnType by the test harness would * actually be a valid return type for our roundTripTransformer. */ } } mule-2.0.1/core/src/test/java/org/mule/transformer/TransformerChainingTestCase.java0000644000175000017500000001714611003232007030251 0ustar charlescharles/* * $Id: TransformerChainingTestCase.java 11619 2008-04-22 00:40:39Z aguenther $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.DefaultMuleMessage; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.tck.AbstractMuleTestCase; import java.util.Collections; public class TransformerChainingTestCase extends AbstractMuleTestCase { public void testSingleChainedTransformer() throws Exception { AbstractTransformer validTransformer = (AbstractTransformer) this.getIncreaseByOneTransformer(); assertNotNull(validTransformer); DefaultMuleMessage message = new DefaultMuleMessage(new Integer(0)); Transformer messageTransformer = new TransformerCollection(new Transformer[]{ validTransformer }); message.applyTransformers(Collections.singletonList(messageTransformer)); Object transformedMessage = message.getPayload(); assertNotNull(transformedMessage); assertEquals(new Integer(1), transformedMessage); } public void testTwoChainedTransformers() throws Exception { AbstractTransformer validTransformer = (AbstractTransformer) this.getIncreaseByOneTransformer(); assertNotNull(validTransformer); DefaultMuleMessage message = new DefaultMuleMessage(new Integer(0)); Transformer messageTransformer = new TransformerCollection( new Transformer[]{ validTransformer, validTransformer }); message.applyTransformers(Collections.singletonList(messageTransformer)); Object transformedMessage = message.getPayload(); assertNotNull(transformedMessage); assertEquals(new Integer(2), transformedMessage); } public void testThreeChainedTransformers() throws Exception { AbstractTransformer validTransformer = (AbstractTransformer) this.getIncreaseByOneTransformer(); assertNotNull(validTransformer); DefaultMuleMessage message = new DefaultMuleMessage(new Integer(0)); Transformer messageTransformer = new TransformerCollection( new Transformer[]{ validTransformer, validTransformer, validTransformer }); message.applyTransformers(Collections.singletonList(messageTransformer)); Object transformedMessage = message.getPayload(); assertNotNull(transformedMessage); assertEquals(new Integer(3), transformedMessage); } public void testIgnoreBadInputDoesNotBreakChainWithTransformationOrderInvalidValid() throws Exception { AbstractTransformer invalidTransformer = (AbstractTransformer) this.getInvalidTransformer(); assertNotNull(invalidTransformer); invalidTransformer.setIgnoreBadInput(true); AbstractTransformer validTransformer = (AbstractTransformer) this.getIncreaseByOneTransformer(); assertNotNull(validTransformer); DefaultMuleMessage message = new DefaultMuleMessage(new Integer(0)); Transformer messageTransformer = new TransformerCollection(new Transformer[]{invalidTransformer, validTransformer}); message.applyTransformers(Collections.singletonList(messageTransformer)); Object transformedMessage = message.getPayload(); assertNotNull(transformedMessage); assertEquals(new Integer(1), transformedMessage); } public void testIgnoreBadInputBreaksChainWithTransformationOrderInvalidValid() throws Exception { AbstractTransformer invalidTransformer = (AbstractTransformer) this.getInvalidTransformer(); assertNotNull(invalidTransformer); invalidTransformer.setIgnoreBadInput(false); AbstractTransformer validTransformer = (AbstractTransformer) this.getIncreaseByOneTransformer(); assertNotNull(validTransformer); DefaultMuleMessage message = new DefaultMuleMessage(new Integer(0)); Transformer messageTransformer = new TransformerCollection(new Transformer[]{invalidTransformer, validTransformer}); try { message.applyTransformers(Collections.singletonList(messageTransformer)); fail("Transformer chain is expected to fail because of invalid transformer within chain."); } catch (TransformerException tfe) { ; // ignore } } public void testIgnoreBadInputDoesNotBreakChainWithTransformationOrderValidInvalid() throws Exception { AbstractTransformer invalidTransformer = (AbstractTransformer) this.getInvalidTransformer(); assertNotNull(invalidTransformer); invalidTransformer.setIgnoreBadInput(true); AbstractTransformer validTransformer = (AbstractTransformer) this.getIncreaseByOneTransformer(); assertNotNull(validTransformer); DefaultMuleMessage message = new DefaultMuleMessage(new Integer(0)); Transformer messageTransformer = new TransformerCollection(new Transformer[]{validTransformer, invalidTransformer}); message.applyTransformers(Collections.singletonList(messageTransformer)); Object transformedMessage = message.getPayload(); assertNotNull(transformedMessage); assertEquals(new Integer(1), transformedMessage); } public void testIgnoreBadInputBreaksChainWithTransformationOrderValidInvalid() throws Exception { AbstractTransformer invalidTransformer = (AbstractTransformer) this.getInvalidTransformer(); assertNotNull(invalidTransformer); invalidTransformer.setIgnoreBadInput(false); AbstractTransformer validTransformer = (AbstractTransformer) this.getIncreaseByOneTransformer(); assertNotNull(validTransformer); DefaultMuleMessage message = new DefaultMuleMessage(new Integer(0)); Transformer messageTransformer = new TransformerCollection(new Transformer[]{validTransformer, invalidTransformer}); try { message.applyTransformers(Collections.singletonList(messageTransformer)); fail("Transformer chain is expected to fail because of invalid transformer within chain."); } catch (TransformerException tfe) { assertNotNull(tfe); } } private Transformer getInvalidTransformer() throws Exception { AbstractTransformer transformer = new AbstractTransformer() { protected Object doTransform(final Object src, final String encoding) throws TransformerException { throw new RuntimeException("This transformer must not perform any transformations."); } }; // Use this class as a bogus source type to enforce a simple invalid transformer transformer.registerSourceType(this.getClass()); return transformer; } private Transformer getIncreaseByOneTransformer() throws Exception { AbstractTransformer transformer = new AbstractTransformer() { protected Object doTransform(Object src, String encoding) throws TransformerException { return new Integer(((Integer) src).intValue() + 1); } }; transformer.registerSourceType(Integer.class); transformer.setReturnClass(Integer.class); return transformer; } } mule-2.0.1/core/src/test/java/org/mule/transformer/AbstractTransformerTestCase.java0000644000175000017500000001233410765525116030312 0ustar charlescharles/* * $Id: AbstractTransformerTestCase.java 11316 2008-03-11 15:50:38Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.MuleMessage; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.InvalidSatsuma; import org.mule.util.IOUtils; import java.io.InputStream; import java.util.Arrays; public abstract class AbstractTransformerTestCase extends AbstractMuleTestCase { //@Override protected void doSetUp() throws Exception { // setup a dummy context for transformers that are event aware RequestContext.setEvent(getTestEvent("test")); } //@Override protected void doTearDown() throws Exception { RequestContext.setEvent(null); } // Remove tabs and line breaks in the passed String; this makes comparison of XML // fragments easier protected String normalizeString(String rawString) { rawString = rawString.replaceAll("\r", ""); rawString = rawString.replaceAll("\n", ""); return rawString.replaceAll("\t", ""); } public void testTransform() throws Exception { Object result = this.getTransformer().transform(getTestData()); assertNotNull(result); Object expectedResult = this.getResultData(); assertNotNull(expectedResult); assertTrue(this.compareResults(expectedResult, result)); } public void testRoundtripTransform() throws Exception { Transformer roundTripTransformer = this.getRoundTripTransformer(); if (roundTripTransformer != null) { Object result = roundTripTransformer.transform(this.getResultData()); assertNotNull(result); assertTrue(this.compareRoundtripResults(this.getTestData(), result)); } } public void testBadReturnType() throws Exception { this.doTestBadReturnType(this.getTransformer(), this.getTestData()); } public void testRoundtripBadReturnType() throws Exception { if (this.getRoundTripTransformer() != null) { this.doTestBadReturnType(this.getRoundTripTransformer(), this.getResultData()); } } public void testRoundTrip() throws Exception { if (this.getRoundTripTransformer() != null) { Transformer trans = this.getTransformer(); Transformer trans2 = this.getRoundTripTransformer(); MuleMessage message = new DefaultMuleMessage(getTestData()); message.applyTransformers(Arrays.asList( new Transformer[]{trans, trans2})); Object result = message.getPayload(); this.compareRoundtripResults(this.getTestData(), result); } } public void doTestBadReturnType(Transformer tran, Object src) throws Exception { tran.setReturnClass(InvalidSatsuma.class); try { tran.transform(src); fail("Should throw exception for bad return type"); } catch (TransformerException e) { // expected } } protected void doTestClone(Transformer original, Transformer clone) throws Exception { assertNotSame(original, clone); } public abstract Transformer getTransformer() throws Exception; public abstract Transformer getRoundTripTransformer() throws Exception; public abstract Object getTestData(); public abstract Object getResultData(); public boolean compareResults(Object expected, Object result) { if (expected == null && result == null) { return true; } if (expected == null || result == null) { return false; } if (expected instanceof Object[] && result instanceof Object[]) { return Arrays.equals((Object[]) expected, (Object[]) result); // TODO check if RetroTranslating Mule to JDK 1.4 makes this method // available // return Arrays.deepEquals((Object[])src, (Object[])result); } else if (expected instanceof byte[] && result instanceof byte[]) { return Arrays.equals((byte[]) expected, (byte[]) result); } if (expected instanceof InputStream) { expected = IOUtils.toString((InputStream)expected); } // Special case for Strings: normalize comparison arguments if (expected instanceof String && result instanceof String) { expected = this.normalizeString((String) expected); result = this.normalizeString((String) result); } return expected.equals(result); } public boolean compareRoundtripResults(Object expected, Object result) { return compareResults(expected, result); } } mule-2.0.1/core/src/test/java/org/mule/transformer/TransformerWeightingTestCase.java0000644000175000017500000001604410774040205030465 0ustar charlescharles/* * $Id: TransformerWeightingTestCase.java 11516 2008-03-31 01:38:13Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transformer; import org.mule.api.transformer.TransformerException; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.Transformer; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.FruitBowl; import org.mule.tck.testmodels.fruit.Orange; import org.mule.tck.testmodels.fruit.Fruit; import org.mule.tck.testmodels.fruit.BloodOrange; import org.mule.transformer.simple.ObjectToByteArray; import org.mule.transformer.simple.SerializableToByteArray; import java.io.FilterInputStream; import java.io.IOException; import java.util.List; import java.util.Iterator; public class TransformerWeightingTestCase extends AbstractMuleTestCase { public void testExactMatch() throws Exception { DummyTransformer trans = new DummyTransformer(); trans.setReturnClass(byte[].class); trans.registerSourceType(IOException.class); TransformerWeighting weighting = new TransformerWeighting(IOException.class, byte[].class, trans); assertFalse(weighting.isNotMatch()); assertTrue(weighting.isExactMatch()); } public void testNearMatch() throws Exception { ObjectToByteArray trans = new ObjectToByteArray(); TransformerWeighting weighting = new TransformerWeighting(FilterInputStream.class, byte[].class, trans); assertFalse(weighting.isNotMatch()); assertFalse(weighting.isExactMatch()); assertEquals(1, weighting.getInputWeighting()); assertEquals(0, weighting.getOutputWeighting()); } public void testNoMatchWeighting() throws Exception { SerializableToByteArray trans = new SerializableToByteArray(); TransformerWeighting weighting = new TransformerWeighting(FruitBowl.class, byte[].class, trans); assertTrue(weighting.isNotMatch()); assertEquals(-1, weighting.getInputWeighting()); assertEquals(0, weighting.getOutputWeighting()); } public void testCompareWeightingWithNearMatches() throws Exception { ObjectToByteArray trans1 = new ObjectToByteArray(); DummyTransformer trans2 = new DummyTransformer(); trans2.setReturnClass(byte[].class); trans2.registerSourceType(Exception.class); TransformerWeighting weighting1 = new TransformerWeighting(IOException.class, byte[].class, trans1); TransformerWeighting weighting2 = new TransformerWeighting(IOException.class, byte[].class, trans2); assertFalse(weighting1.isNotMatch()); assertFalse(weighting2.isNotMatch()); assertFalse(weighting1.isExactMatch()); assertFalse(weighting2.isExactMatch()); //Weighting2 two is a better match assertEquals(1, weighting2.compareTo(weighting1)); assertEquals(2, weighting1.getInputWeighting()); assertEquals(1, weighting2.getInputWeighting()); assertEquals(0, weighting1.getOutputWeighting()); assertEquals(0, weighting2.getOutputWeighting()); } public void testCompareWeightingWithExactMatch() throws Exception { ObjectToByteArray trans1 = new ObjectToByteArray(); DummyTransformer trans2 = new DummyTransformer(); trans2.setReturnClass(byte[].class); trans2.registerSourceType(IOException.class); TransformerWeighting weighting1 = new TransformerWeighting(IOException.class, byte[].class, trans1); TransformerWeighting weighting2 = new TransformerWeighting(IOException.class, byte[].class, trans2); assertFalse(weighting1.isNotMatch()); assertFalse(weighting2.isNotMatch()); assertFalse(weighting1.isExactMatch()); assertTrue(weighting2.isExactMatch()); //Weighting2 two is an exact match assertEquals(1, weighting2.compareTo(weighting1)); assertEquals(2, weighting1.getInputWeighting()); assertEquals(0, weighting2.getInputWeighting()); assertEquals(0, weighting1.getOutputWeighting()); assertEquals(0, weighting2.getOutputWeighting()); } public void testCompareWeightingWithNoMatch() throws Exception { ObjectToByteArray trans1 = new ObjectToByteArray(); DummyTransformer trans2 = new DummyTransformer(); trans2.setReturnClass(byte[].class); trans2.registerSourceType(FruitBowl.class); TransformerWeighting weighting1 = new TransformerWeighting(IOException.class, byte[].class, trans1); TransformerWeighting weighting2 = new TransformerWeighting(IOException.class, byte[].class, trans2); assertFalse(weighting1.isNotMatch()); assertTrue(weighting2.isNotMatch()); assertFalse(weighting1.isExactMatch()); assertFalse(weighting2.isExactMatch()); //Weighting2 two is not a match assertEquals(-1, weighting2.compareTo(weighting1)); assertEquals(2, weighting1.getInputWeighting()); assertEquals(-1, weighting2.getInputWeighting()); assertEquals(0, weighting1.getOutputWeighting()); assertEquals(0, weighting2.getOutputWeighting()); } public void testPriorityMatching() throws Exception { DummyTransformer t1 = new DummyTransformer(); t1.setName("--t1"); t1.registerSourceType(Orange.class); t1.setReturnClass(Fruit.class); muleContext.getRegistry().registerTransformer(t1); DummyTransformer t2 = new DummyTransformer(); t2.setName("--t2"); t2.registerSourceType(Object.class); t2.setReturnClass(Fruit.class); muleContext.getRegistry().registerTransformer(t2); List trans = muleContext.getRegistry().lookupTransformers(BloodOrange.class, Fruit.class); assertEquals(2, trans.size()); for (Iterator iterator = trans.iterator(); iterator.hasNext();) { Transformer transformer = (Transformer) iterator.next(); assertTrue(transformer.getName().startsWith("--")); } Transformer result = muleContext.getRegistry().lookupTransformer(BloodOrange.class, Fruit.class); assertNotNull(result); assertEquals("--t1", result.getName()); } private class DummyTransformer extends AbstractTransformer implements DiscoverableTransformer { private int weighting; public int getPriorityWeighting() { return weighting; } public void setPriorityWeighting(int weighting) { this.weighting = weighting; } protected Object doTransform(Object src, String encoding) throws TransformerException { return src; } } } mule-2.0.1/core/src/test/java/org/mule/ExceptionsTestCase.java0000644000175000017500000000365010745677442024114 0ustar charlescharles/* * $Id: ExceptionsTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleException; import org.mule.api.DefaultMuleException; import org.mule.api.context.MuleContextException; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.RoutingException; import org.mule.config.i18n.MessageFactory; import org.mule.tck.AbstractMuleTestCase; public class ExceptionsTestCase extends AbstractMuleTestCase { public void testExceptionChaining() { String rootMsg = "Root Test Exception Message"; String msg = "Test Exception Message"; Exception e = new MuleContextException(MessageFactory.createStaticMessage(msg), new DefaultMuleException( MessageFactory.createStaticMessage(rootMsg))); assertEquals(rootMsg, e.getCause().getMessage()); assertEquals(msg, e.getMessage()); assertEquals(e.getClass().getName() + ": " + msg, e.toString()); } public final void testRoutingExceptionNullUMOMessageNullUMOImmutableEndpoint() throws MuleException { RoutingException rex = new RoutingException(null, null); assertNotNull(rex); } public final void testRoutingExceptionNullUMOMessageValidUMOImmutableEndpoint() throws MuleException { ImmutableEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint("test://outbound"); assertNotNull(endpoint); RoutingException rex = new RoutingException(null, endpoint); assertNotNull(rex); assertSame(endpoint, rex.getEndpoint()); } } mule-2.0.1/core/src/test/java/org/mule/management/0000755000175000017500000000000011351411076021563 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/management/LifecycleNotificationTestCase.java0000644000175000017500000000212310745205313030327 0ustar charlescharles/* * $Id: LifecycleNotificationTestCase.java 10442 2008-01-21 21:12:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management; import org.mule.tck.AbstractMuleTestCase; public class LifecycleNotificationTestCase extends AbstractMuleTestCase { public void testManageLifecycle() throws Exception { assertTrue(muleContext.isInitialised()); // muleContext.start(); // assertTrue(muleContext.isStarted()); // muleContext.stop(); // assertFalse(muleContext.isStarted()); // muleContext.dispose(); // assertTrue(muleContext.isDisposed()); // muleContext.initialise(); // assertTrue(muleContext.isInitialised()); // muleContext.start(); // assertTrue(muleContext.isStarted()); } } mule-2.0.1/core/src/test/java/org/mule/management/DummyListener.java0000644000175000017500000000135310745677442025252 0ustar charlescharles/* * $Id: DummyListener.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.ServerNotificationListener; public class DummyListener implements ServerNotificationListener { public void onNotification(ServerNotification notification) { // empty } } mule-2.0.1/core/src/test/java/org/mule/management/ServerNotificationsTestCase.java0000644000175000017500000002124610763554366030107 0ustar charlescharles/* * $Id: ServerNotificationsTestCase.java 11181 2008-03-05 17:31:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.management; import org.mule.api.context.notification.ServiceNotificationListener; import org.mule.api.context.notification.CustomNotificationListener; import org.mule.api.context.notification.MuleContextNotificationListener; import org.mule.api.context.notification.ModelNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.context.notification.ServiceNotification; import org.mule.context.notification.CustomNotification; import org.mule.context.notification.MuleContextNotification; import org.mule.context.notification.ModelNotification; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; public class ServerNotificationsTestCase extends AbstractMuleTestCase implements ModelNotificationListener, MuleContextNotificationListener { private final AtomicBoolean managerStopped = new AtomicBoolean(false); private final AtomicInteger managerStoppedEvents = new AtomicInteger(0); private final AtomicBoolean modelStopped = new AtomicBoolean(false); private final AtomicInteger componentStartedCount = new AtomicInteger(0); private final AtomicInteger customNotificationCount = new AtomicInteger(0); public ServerNotificationsTestCase() { setStartContext(true); } // @Override protected void doTearDown() throws Exception { managerStopped.set(true); managerStoppedEvents.set(0); } public void testStandardNotifications() throws Exception { muleContext.registerListener(this); muleContext.stop(); assertTrue(modelStopped.get()); assertTrue(managerStopped.get()); } public void testMultipleRegistrations() throws Exception { muleContext.registerListener(this); muleContext.registerListener(this); muleContext.stop(); assertTrue(managerStopped.get()); assertEquals(2, managerStoppedEvents.get()); } public void testUnregistering() throws Exception { muleContext.registerListener(this); muleContext.unregisterListener(this); muleContext.stop(); // these should still be false because we unregistered ourselves assertFalse(modelStopped.get()); assertFalse(managerStopped.get()); } public void testMismatchingUnregistrations() throws Exception { // this has changed in 2.x. now, unregistering removes all related entries muleContext.registerListener(this); DummyListener dummy = new DummyListener(); muleContext.registerListener(dummy); muleContext.registerListener(dummy); muleContext.unregisterListener(dummy); muleContext.stop(); assertTrue(managerStopped.get()); assertEquals(1, managerStoppedEvents.get()); } public void testStandardNotificationsWithSubscription() throws Exception { final CountDownLatch latch = new CountDownLatch(1); muleContext.registerListener(new ServiceNotificationListener() { public void onNotification(ServerNotification notification) { if (notification.getAction() == ServiceNotification.SERVICE_STARTED) { componentStartedCount.incrementAndGet(); assertEquals("component1", notification.getResourceIdentifier()); latch.countDown(); } } }, "component1"); getTestService("component2", Apple.class); getTestService("component1", Apple.class); // Wait for the notifcation event to be fired as they are queued latch.await(20000, TimeUnit.MILLISECONDS); assertEquals(1, componentStartedCount.get()); } public void testStandardNotificationsWithWildcardSubscription() throws Exception { final CountDownLatch latch = new CountDownLatch(2); muleContext.registerListener(new ServiceNotificationListener() { public void onNotification(ServerNotification notification) { if (notification.getAction() == ServiceNotification.SERVICE_STARTED) { componentStartedCount.incrementAndGet(); assertFalse("noMatchComponent".equals(notification.getResourceIdentifier())); latch.countDown(); } } }, "component*"); //Components automatically get registered getTestService("component2", Apple.class); getTestService("component1", Apple.class); getTestService("noMatchComponent", Apple.class); // Wait for the notifcation event to be fired as they are queued latch.await(2000, TimeUnit.MILLISECONDS); assertEquals(2, componentStartedCount.get()); } public void testCustomNotifications() throws Exception { final CountDownLatch latch = new CountDownLatch(2); muleContext.registerListener(new DummyNotificationListener() { public void onNotification(ServerNotification notification) { if (notification.getAction() == DummyNotification.EVENT_RECEIVED) { customNotificationCount.incrementAndGet(); assertEquals("hello", notification.getSource()); latch.countDown(); } } }); muleContext.fireNotification(new DummyNotification("hello", DummyNotification.EVENT_RECEIVED)); muleContext.fireNotification(new DummyNotification("hello", DummyNotification.EVENT_RECEIVED)); // Wait for the notifcation event to be fired as they are queued latch.await(2000, TimeUnit.MILLISECONDS); assertEquals(2, customNotificationCount.get()); } public void testCustomNotificationsWithWildcardSubscription() throws Exception { final CountDownLatch latch = new CountDownLatch(2); muleContext.registerListener(new DummyNotificationListener() { public void onNotification(ServerNotification notification) { if (notification.getAction() == DummyNotification.EVENT_RECEIVED) { customNotificationCount.incrementAndGet(); assertFalse("e quick bro".equals(notification.getResourceIdentifier())); latch.countDown(); } } }, "* quick brown*"); muleContext.fireNotification(new DummyNotification("the quick brown fox jumped over the lazy dog", DummyNotification.EVENT_RECEIVED)); muleContext.fireNotification(new DummyNotification("e quick bro", DummyNotification.EVENT_RECEIVED)); muleContext.fireNotification(new DummyNotification(" quick brown", DummyNotification.EVENT_RECEIVED)); // Wait for the notifcation event to be fired as they are queued latch.await(20000, TimeUnit.MILLISECONDS); assertEquals(2, customNotificationCount.get()); } public void onNotification(ServerNotification notification) { if (notification.getAction() == ModelNotification.MODEL_STOPPED) { modelStopped.set(true); } else { if (notification.getAction() == MuleContextNotification.CONTEXT_STOPPED) { managerStopped.set(true); managerStoppedEvents.incrementAndGet(); } } } public static interface DummyNotificationListener extends CustomNotificationListener { // no methods } public class DummyNotification extends CustomNotification { /** * Serial version */ private static final long serialVersionUID = -1117307108932589331L; public static final int EVENT_RECEIVED = -999999; public DummyNotification(String message, int action) { super(message, action); resourceIdentifier = message; } } } mule-2.0.1/core/src/test/java/org/mule/component/0000755000175000017500000000000011351411073021446 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/component/AbstractComponentTestCase.java0000644000175000017500000000110510766654216027411 0ustar charlescharles/* * $Id: AbstractComponentTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component; import org.mule.tck.AbstractMuleTestCase; public class AbstractComponentTestCase extends AbstractMuleTestCase { } mule-2.0.1/core/src/test/java/org/mule/component/SimpleCallableJavaComponentTestCase.java0000644000175000017500000000714411005423136031310 0ustar charlescharles/* * $Id: SimpleCallableJavaComponentTestCase.java 11653 2008-04-28 19:32:46Z moosa $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component; import org.mule.api.DefaultMuleException; import org.mule.api.lifecycle.DisposeException; import org.mule.object.PrototypeObjectFactory; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Orange; public class SimpleCallableJavaComponentTestCase extends AbstractComponentTestCase { public void testComponentCreationWithObjectFactory() throws Exception { PrototypeObjectFactory objectFactory = new PrototypeObjectFactory( Apple.class); objectFactory.setObjectClass(Apple.class); objectFactory.initialise(); SimpleCallableJavaComponent component = new SimpleCallableJavaComponent( objectFactory); assertNotNull(component.getObjectFactory()); assertEquals(objectFactory, component.getObjectFactory()); assertEquals(Apple.class, component.getObjectFactory().getObjectClass()); assertEquals(Apple.class, component.getObjectType()); objectFactory = new PrototypeObjectFactory(Orange.class); objectFactory.setObjectClass(Orange.class); objectFactory.initialise(); try { component = new SimpleCallableJavaComponent(objectFactory); } catch (Exception e) { assertSame(DefaultMuleException.class, e.getClass()); } } public void testDirectComponentCreation() throws Exception { SimpleCallableJavaComponent component = new SimpleCallableJavaComponent( Apple.class); assertNotNull(component.getObjectFactory()); assertEquals(Apple.class, component.getObjectFactory().getObjectClass()); assertEquals(Apple.class, component.getObjectType()); try { component = new SimpleCallableJavaComponent(Orange.class); } catch (Exception e) { assertSame(DefaultMuleException.class, e.getClass()); } } public void testSimpleComponentCreation() throws Exception { SimpleCallableJavaComponent component = new SimpleCallableJavaComponent( new Apple()); assertNotNull(component.getObjectFactory()); assertEquals(Apple.class, component.getObjectFactory().getObjectClass()); assertEquals(Apple.class, component.getObjectType()); try { component = new SimpleCallableJavaComponent(new Orange()); } catch (Exception e) { assertSame(DefaultMuleException.class, e.getClass()); } } public void testLifecycle() throws Exception { SimpleCallableJavaComponent component = new SimpleCallableJavaComponent( new Apple()); component.setService(getTestService()); component.initialise(); component.start(); assertNull(component.borrowComponentLifecycleAdaptor()); Object obj = component.getObjectFactory().getInstance(); assertNotNull(obj); component.stop(); component.dispose(); try { component.checkDisposed(); } catch (Exception e) { assertSame(DisposeException.class, e.getClass()); } } } mule-2.0.1/core/src/test/java/org/mule/component/PooledJavaComponentTestCase.java0000644000175000017500000003331310770356575027702 0ustar charlescharles/* * $Id: PooledJavaComponentTestCase.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component; import org.mule.api.component.LifecycleAdapter; import org.mule.config.PoolingProfile; import org.mule.object.PrototypeObjectFactory; import org.mule.tck.services.UniqueComponent; import org.mule.tck.testmodels.fruit.Orange; import org.mule.tck.testmodels.fruit.WaterMelon; import org.mule.util.ExceptionUtils; public class PooledJavaComponentTestCase extends AbstractComponentTestCase { public static final byte MAX_ACTIVE = 3; public static final long MAX_WAIT = 1500; protected PoolingProfile getDefaultPoolingProfile() { PoolingProfile pp = new PoolingProfile(); pp.setExhaustedAction(PoolingProfile.WHEN_EXHAUSTED_FAIL); pp.setMaxActive(MAX_ACTIVE); pp.setMaxWait(MAX_WAIT); pp.setInitialisationPolicy(PoolingProfile.INITIALISE_NONE); return pp; } // @Override protected PrototypeObjectFactory getObjectFactory() { return new PrototypeObjectFactory(Orange.class); } // @Override public void testComponentCreation() throws Exception { PrototypeObjectFactory objectFactory = getObjectFactory(); objectFactory.setObjectClass(Orange.class); objectFactory.initialise(); PoolingProfile pp = getDefaultPoolingProfile(); pp.setExhaustedAction(PoolingProfile.WHEN_EXHAUSTED_FAIL); PooledJavaComponent component = new PooledJavaComponent(objectFactory, pp); assertNotNull(component.getObjectFactory()); assertEquals(objectFactory, component.getObjectFactory()); assertEquals(Orange.class, component.getObjectFactory().getObjectClass()); assertEquals(Orange.class, component.getObjectType()); assertNotNull(component.getPoolingProfile()); assertEquals(pp, component.getPoolingProfile()); assertEquals(PoolingProfile.WHEN_EXHAUSTED_FAIL, component.getPoolingProfile().getExhaustedAction()); } public void testPoolCreation() throws Exception { PooledJavaComponent component = new PooledJavaComponent(getObjectFactory(), getDefaultPoolingProfile()); assertNull(component.lifecycleAdapterPool); component.setService(getTestService()); component.initialise(); assertNull(component.lifecycleAdapterPool); component.start(); assertNotNull(component.lifecycleAdapterPool); component.stop(); assertNull(component.lifecycleAdapterPool); } // @Override public void test() throws Exception { PooledJavaComponent component = new PooledJavaComponent(getObjectFactory(), getDefaultPoolingProfile()); component.setService(getTestService()); component.initialise(); component.start(); assertNotSame(component.borrowComponentLifecycleAdaptor(), component.borrowComponentLifecycleAdaptor()); component.stop(); component.start(); assertNotSame(((DefaultLifecycleAdapter) component.borrowComponentLifecycleAdaptor()).componentObject, ((DefaultLifecycleAdapter) component.borrowComponentLifecycleAdaptor()).componentObject); } public void testCreatePool() throws Exception { PooledJavaComponent component = new PooledJavaComponent(getObjectFactory(), getDefaultPoolingProfile()); component.setService(getTestService()); component.initialise(); component.start(); assertEquals(0, component.lifecycleAdapterPool.getNumActive()); LifecycleAdapter borrowed = component.borrowComponentLifecycleAdaptor(); assertNotNull(borrowed); assertEquals(1, component.lifecycleAdapterPool.getNumActive()); component.returnComponentLifecycleAdaptor(borrowed); assertEquals(0, component.lifecycleAdapterPool.getNumActive()); borrowed = component.borrowComponentLifecycleAdaptor(); assertNotNull(borrowed); assertEquals(1, component.lifecycleAdapterPool.getNumActive()); Object borrowed2 = component.borrowComponentLifecycleAdaptor(); assertNotNull(borrowed2); assertEquals(2, component.lifecycleAdapterPool.getNumActive()); } public void testFailOnExhaust() throws Exception { PoolingProfile pp = getDefaultPoolingProfile(); pp.setExhaustedAction(PoolingProfile.WHEN_EXHAUSTED_WAIT); PooledJavaComponent component = new PooledJavaComponent(getObjectFactory(), pp); component.setService(getTestService()); component.initialise(); component.start(); Object borrowed = null; for (int i = 0; i < MAX_ACTIVE; i++) { borrowed = component.borrowComponentLifecycleAdaptor(); assertNotNull(borrowed); assertEquals(component.lifecycleAdapterPool.getNumActive(), i + 1); } try { borrowed = component.borrowComponentLifecycleAdaptor(); fail("Should throw an Exception"); } catch (Exception e) { // expected } } public void testBlockExpiryOnExhaust() throws Exception { PoolingProfile pp = getDefaultPoolingProfile(); pp.setExhaustedAction(PoolingProfile.WHEN_EXHAUSTED_WAIT); PooledJavaComponent component = new PooledJavaComponent(getObjectFactory(), pp); component.setService(getTestService()); component.initialise(); component.start(); Object borrowed = null; assertEquals(0, component.lifecycleAdapterPool.getNumActive()); borrowed = component.borrowComponentLifecycleAdaptor(); assertNotNull(borrowed); borrowed = component.borrowComponentLifecycleAdaptor(); assertNotNull(borrowed); borrowed = component.borrowComponentLifecycleAdaptor(); assertNotNull(borrowed); assertEquals(3, component.lifecycleAdapterPool.getNumActive()); // TODO // long starttime = System.currentTimeMillis(); try { borrowed = component.borrowComponentLifecycleAdaptor(); fail("Should throw an Exception"); } catch (Exception e) { // TODO // long totalTime = System.currentTimeMillis() - starttime; // Need to allow for alittle variance in system time // This is unreliable // assertTrue(totalTime < (DEFAULT_WAIT + 300) && totalTime > // (DEFAULT_WAIT - 300)); } } public void testBlockOnExhaust() throws Exception { PoolingProfile pp = getDefaultPoolingProfile(); pp.setExhaustedAction(PoolingProfile.WHEN_EXHAUSTED_WAIT); PooledJavaComponent component = new PooledJavaComponent(getObjectFactory(), pp); component.setService(getTestService()); component.initialise(); component.start(); Object borrowed = null; assertEquals(0, component.lifecycleAdapterPool.getNumActive()); borrowed = component.borrowComponentLifecycleAdaptor(); borrowed = component.borrowComponentLifecycleAdaptor(); assertEquals(2, component.lifecycleAdapterPool.getNumActive()); // TODO // long starttime = System.currentTimeMillis(); long borrowerWait = 500; Borrower borrower = new Borrower(component, borrowerWait); borrower.start(); // Make sure the borrower borrows first try { Thread.sleep(200); } catch (InterruptedException e) { // ignore } borrowed = component.borrowComponentLifecycleAdaptor(); // TODO // long totalTime = System.currentTimeMillis() - starttime; // Need to allow for alittle variance in system time // This is unreliable // assertTrue(totalTime < (borrowerWait + 300) && totalTime > // (borrowerWait -300)); assertNotNull(borrowed); } public void testGrowOnExhaust() throws Exception { PoolingProfile pp = getDefaultPoolingProfile(); pp.setExhaustedAction(PoolingProfile.WHEN_EXHAUSTED_GROW); PooledJavaComponent component = new PooledJavaComponent(getObjectFactory(), pp); component.setService(getTestService()); component.initialise(); component.start(); Object borrowed = component.borrowComponentLifecycleAdaptor(); borrowed = component.borrowComponentLifecycleAdaptor(); borrowed = component.borrowComponentLifecycleAdaptor(); assertEquals(3, component.lifecycleAdapterPool.getNumActive()); // assertEquals(3, pool.getMaxSize()); // Should now grow borrowed = component.borrowComponentLifecycleAdaptor(); assertNotNull(borrowed); assertEquals(4, component.lifecycleAdapterPool.getNumActive()); } public void testClearPool() throws Exception { PoolingProfile pp = getDefaultPoolingProfile(); pp.setExhaustedAction(PoolingProfile.WHEN_EXHAUSTED_FAIL); PooledJavaComponent component = new PooledJavaComponent(getObjectFactory(), pp); component.setService(getTestService()); component.initialise(); component.start(); LifecycleAdapter borrowed = component.borrowComponentLifecycleAdaptor(); assertEquals(1, component.lifecycleAdapterPool.getNumActive()); component.returnComponentLifecycleAdaptor(borrowed); component.stop(); component.start(); assertEquals(0, component.lifecycleAdapterPool.getNumActive()); } public void testObjectUniqueness() throws Exception { PoolingProfile pp = getDefaultPoolingProfile(); pp.setExhaustedAction(PoolingProfile.WHEN_EXHAUSTED_FAIL); PooledJavaComponent component = new PooledJavaComponent(new PrototypeObjectFactory(UniqueComponent.class), pp); component.setService(getTestService()); component.initialise(); component.start(); assertEquals(0, component.lifecycleAdapterPool.getNumActive()); Object obj; obj = ((DefaultLifecycleAdapter) component.borrowComponentLifecycleAdaptor()).componentObject; assertNotNull(obj); assertTrue("Object should be of type UniqueComponent", obj instanceof UniqueComponent); String id1 = ((UniqueComponent) obj).getId(); assertNotNull(id1); obj = ((DefaultLifecycleAdapter) component.borrowComponentLifecycleAdaptor()).componentObject; assertNotNull(obj); assertTrue("Object should be of type UniqueComponent", obj instanceof UniqueComponent); String id2 = ((UniqueComponent) obj).getId(); assertNotNull(id2); obj = ((DefaultLifecycleAdapter) component.borrowComponentLifecycleAdaptor()).componentObject; assertNotNull(obj); assertTrue("Object should be of type UniqueComponent", obj instanceof UniqueComponent); String id3 = ((UniqueComponent) obj).getId(); assertNotNull(id3); assertFalse("Service IDs " + id1 + " and " + id2 + " should be different", id1.equals(id2)); assertFalse("Service IDs " + id2 + " and " + id3 + " should be different", id2.equals(id3)); } public void testDisposingFactoryDisposesObject() throws Exception { PooledJavaComponent component = new PooledJavaComponent(new PrototypeObjectFactory(WaterMelon.class), getDefaultPoolingProfile()); component.setService(getTestService()); component.initialise(); component.start(); DefaultLifecycleAdapter lifecycleAdapter = (DefaultLifecycleAdapter) component.borrowComponentLifecycleAdaptor(); component.returnComponentLifecycleAdaptor(lifecycleAdapter); component.dispose(); assertEquals("disposed", ((WaterMelon) lifecycleAdapter.componentObject).getState()); } public void testLifeCycleMethods() throws Exception { PooledJavaComponent component = new PooledJavaComponent(new PrototypeObjectFactory(WaterMelon.class), getDefaultPoolingProfile()); component.setService(getTestService()); component.initialise(); component.start(); Object obj = component.lifecycleAdapterPool.getObjectFactory().getInstance(); assertNotNull(obj); // assertTrue(of.validateObject(obj)); // of.activateObject(obj); // of.passivateObject(obj); // of.destroyObject(obj); } private class Borrower extends Thread { private PooledJavaComponent component; private long time; public Borrower(PooledJavaComponent component, long time) { super("Borrower"); if (component == null) { throw new IllegalArgumentException("Pool cannot be null"); } this.component = component; if (time < 500) { time = 500; } this.time = time; } public void run() { try { LifecycleAdapter object = component.borrowComponentLifecycleAdaptor(); try { sleep(time); } catch (InterruptedException e) { // ignore } component.returnComponentLifecycleAdaptor(object); } catch (Exception e) { fail("Borrower thread failed:\n" + ExceptionUtils.getStackTrace(e)); } } } } mule-2.0.1/core/src/test/java/org/mule/component/DefaultJavaComponentTestCase.java0000644000175000017500000000525311004415201030013 0ustar charlescharles/* * $Id: DefaultJavaComponentTestCase.java 11645 2008-04-25 17:53:05Z moosa $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.component; import org.mule.object.PrototypeObjectFactory; import org.mule.tck.testmodels.fruit.Orange; import org.mule.tck.testmodels.fruit.WaterMelon; public class DefaultJavaComponentTestCase extends AbstractComponentTestCase { public void testComponentCreation() throws Exception { PrototypeObjectFactory objectFactory = new PrototypeObjectFactory(Orange.class); objectFactory.setObjectClass(Orange.class); objectFactory.initialise(); DefaultJavaComponent component = new DefaultJavaComponent(objectFactory); assertNotNull(component.getObjectFactory()); assertEquals(objectFactory, component.getObjectFactory()); assertEquals(Orange.class, component.getObjectFactory().getObjectClass()); assertEquals(Orange.class, component.getObjectType()); } public void testLifecycle() throws Exception { DefaultJavaComponent component = new DefaultJavaComponent(new PrototypeObjectFactory(Orange.class)); component.setService(getTestService()); component.initialise(); component.start(); assertNotSame(component.borrowComponentLifecycleAdaptor(), component.borrowComponentLifecycleAdaptor()); Object obj = component.getObjectFactory().getInstance(); assertNotNull(obj); component.stop(); component.start(); assertNotSame( ((DefaultLifecycleAdapter) component.borrowComponentLifecycleAdaptor()).componentObject, ((DefaultLifecycleAdapter) component.borrowComponentLifecycleAdaptor()).componentObject); } public void testComponentDisposal() throws Exception { DefaultJavaComponent component = new DefaultJavaComponent( new PrototypeObjectFactory(WaterMelon.class)); component.setService(getTestService()); component.initialise(); component.start(); DefaultLifecycleAdapter lifecycleAdapter = (DefaultLifecycleAdapter) component.borrowComponentLifecycleAdaptor(); component.returnComponentLifecycleAdaptor(lifecycleAdapter); component.dispose(); assertEquals("disposed", ((WaterMelon) lifecycleAdapter.componentObject).getState()); } } mule-2.0.1/core/src/test/java/org/mule/api/0000755000175000017500000000000011351411076020220 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/api/TlsPropertiesSocketTestCase.java0000644000175000017500000000245410745677442026535 0ustar charlescharles/* * $Id: TlsPropertiesSocketTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.api.security.tls.TlsConfiguration; import org.mule.api.security.tls.TlsPropertiesSocketFactory; import org.mule.tck.AbstractMuleTestCase; public class TlsPropertiesSocketTestCase extends AbstractMuleTestCase { public void testSimpleSocket() throws Exception { TlsConfiguration configuration = new TlsConfiguration(TlsConfiguration.DEFAULT_KEYSTORE); configuration.setKeyPassword("mulepassword"); configuration.setKeyStorePassword("mulepassword"); configuration.setKeyStore("clientKeystore"); configuration.initialise(false, TlsConfiguration.JSSE_NAMESPACE); TlsPropertiesSocketFactory socketFactory = new TlsPropertiesSocketFactory(true, TlsConfiguration.JSSE_NAMESPACE); assertTrue("socket is useless", socketFactory.getSupportedCipherSuites().length > 0); } } mule-2.0.1/core/src/test/java/org/mule/api/FutureMessageResultTestCase.java0000644000175000017500000000707010745677442026522 0ustar charlescharles/* * $Id: FutureMessageResultTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.api.FutureMessageResult; import org.mule.api.transformer.TransformerException; import org.mule.tck.AbstractMuleTestCase; import edu.emory.mathcs.backport.java.util.concurrent.Callable; import edu.emory.mathcs.backport.java.util.concurrent.ExecutionException; import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService; import edu.emory.mathcs.backport.java.util.concurrent.Executors; import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionException; import edu.emory.mathcs.backport.java.util.concurrent.TimeoutException; public class FutureMessageResultTestCase extends AbstractMuleTestCase { private static Callable Dummy = new Callable() { public Object call() { return null; } }; volatile boolean wasCalled; protected void doSetUp() throws Exception { super.doSetUp(); wasCalled = false; } public void testCreation() { try { new FutureMessageResult(null); fail(); } catch (NullPointerException npe) { // OK: see FutureTask(Callable) } try { FutureMessageResult f = new FutureMessageResult(Dummy); f.setExecutor(null); fail(); } catch (IllegalArgumentException iex) { // OK: no null ExecutorService } } public void testExecute() throws ExecutionException, InterruptedException, TransformerException { Callable c = new Callable() { public Object call() { wasCalled = true; return null; } }; FutureMessageResult f = new FutureMessageResult(c); f.execute(); assertNull(f.getMessage()); assertTrue(wasCalled); } public void testExecuteWithShutdownExecutor() { ExecutorService e = Executors.newCachedThreadPool(); e.shutdown(); FutureMessageResult f = new FutureMessageResult(Dummy); f.setExecutor(e); try { f.execute(); fail(); } catch (RejectedExecutionException rex) { // OK: fail with shutdown Executor } } public void testExecuteWithTimeout() throws ExecutionException, InterruptedException, TransformerException { Callable c = new Callable() { public Object call() throws InterruptedException { // I'm slow, have patience with me Thread.sleep(3000L); wasCalled = true; return null; } }; FutureMessageResult f = new FutureMessageResult(c); f.execute(); try { f.getMessage(500L); fail(); } catch (TimeoutException tex) { // OK: we did not wait long enough for our straggler, so let's tell him // to forget about his task f.cancel(true); } finally { assertFalse(wasCalled); } } } mule-2.0.1/core/src/test/java/org/mule/api/TlsConfigurationTestCase.java0000644000175000017500000000443210745677442026035 0ustar charlescharles/* * $Id: TlsConfigurationTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.api; import org.mule.api.security.tls.TlsConfiguration; import org.mule.tck.AbstractMuleTestCase; import javax.net.ssl.SSLSocketFactory; public class TlsConfigurationTestCase extends AbstractMuleTestCase { public void testEmptyConfiguration() throws Exception { TlsConfiguration configuration = new TlsConfiguration(TlsConfiguration.DEFAULT_KEYSTORE); try { configuration.initialise(false, TlsConfiguration.JSSE_NAMESPACE); fail("no key password"); } catch (IllegalArgumentException e) { assertNotNull("expected", e); } configuration.setKeyPassword("mulepassword"); try { configuration.initialise(false, TlsConfiguration.JSSE_NAMESPACE); fail("no store password"); } catch (IllegalArgumentException e) { assertNotNull("expected", e); } configuration.setKeyStorePassword("mulepassword"); configuration.setKeyStore(""); // guaranteed to not exist try { configuration.initialise(false, TlsConfiguration.JSSE_NAMESPACE); fail("no keystore"); } catch (Exception e) { assertNotNull("expected", e); } } public void testSimpleSocket() throws Exception { TlsConfiguration configuration = new TlsConfiguration(TlsConfiguration.DEFAULT_KEYSTORE); configuration.setKeyPassword("mulepassword"); configuration.setKeyStorePassword("mulepassword"); configuration.setKeyStore("clientKeystore"); configuration.initialise(false, TlsConfiguration.JSSE_NAMESPACE); SSLSocketFactory socketFactory = configuration.getSocketFactory(); assertTrue("socket is useless", socketFactory.getSupportedCipherSuites().length > 0); } } mule-2.0.1/core/src/test/java/org/mule/context/0000755000175000017500000000000011351411071021126 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/context/notification/0000755000175000017500000000000011351411071023614 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/context/notification/Listener1.java0000644000175000017500000000101510745677442026350 0ustar charlescharles/* * $Id: Listener1.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; public class Listener1 extends AbstractListener { // empty } mule-2.0.1/core/src/test/java/org/mule/context/notification/ServerNotificationManagerTestCase.java0000644000175000017500000001566610745677442033267 0ustar charlescharles/* * $Id: ServerNotificationManagerTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.tck.AbstractMuleTestCase; public class ServerNotificationManagerTestCase extends AbstractMuleTestCase { protected Listener1 listener1; protected Listener2 listener2; protected ServerNotificationManager manager; protected void doSetUp() throws Exception { listener1 = new Listener1(); listener2 = new Listener2(); manager = new ServerNotificationManager(); } protected void registerDefaultEvents() throws ClassNotFoundException { manager.addInterfaceToType(Listener1.class, SubEvent1.class); manager.addInterfaceToType(Listener2.class, Event2.class); } public void testNoListenersMeansNoEvents() throws ClassNotFoundException { registerDefaultEvents(); assertNoEventsEnabled(); } protected void assertNoEventsEnabled() { assertFalse(manager.isNotificationEnabled(Event1.class)); assertFalse(manager.isNotificationEnabled(SubEvent1.class)); assertFalse(manager.isNotificationEnabled(SubSubEvent1.class)); assertFalse(manager.isNotificationEnabled(Event2.class)); assertFalse(manager.isNotificationEnabled(SubEvent2.class)); assertFalse(manager.isNotificationEnabled(Event3.class)); } protected void registerDefaultListeners() { manager.addListenerSubscription(listener1, "id1"); manager.addListener(listener2); } public void testAssociationOfInterfacesAndEvents() throws ClassNotFoundException { registerDefaultEvents(); registerDefaultListeners(); assertStandardEventsEnabled(); } protected void assertStandardEventsEnabled() { assertTrue("via subclass", manager.isNotificationEnabled(Event1.class)); assertTrue("direct", manager.isNotificationEnabled(SubEvent1.class)); assertTrue("via superclass", manager.isNotificationEnabled(SubSubEvent1.class)); assertTrue("direct", manager.isNotificationEnabled(Event2.class)); assertTrue("via superclass", manager.isNotificationEnabled(SubEvent2.class)); assertFalse("not specified at all", manager.isNotificationEnabled(Event3.class)); } public void testDynamicResponseToDisablingEvents() throws ClassNotFoundException { registerDefaultEvents(); registerDefaultListeners(); assertStandardEventsEnabled(); // now disable event 2 manager.disableType(Event2.class); assertTrue("via subclass", manager.isNotificationEnabled(Event1.class)); assertTrue("direct", manager.isNotificationEnabled(SubEvent1.class)); assertFalse("disabled", manager.isNotificationEnabled(Event2.class)); assertFalse("no listener", manager.isNotificationEnabled(SubEvent2.class)); assertFalse("not specified at all", manager.isNotificationEnabled(Event3.class)); // the subclass should be blocked too manager.addInterfaceToType(Listener2.class, SubEvent2.class); assertTrue("via subclass", manager.isNotificationEnabled(Event1.class)); assertTrue("direct", manager.isNotificationEnabled(SubEvent1.class)); assertFalse("disabled", manager.isNotificationEnabled(Event2.class)); assertFalse("disabled", manager.isNotificationEnabled(SubEvent2.class)); assertFalse("not specified at all", manager.isNotificationEnabled(Event3.class)); } public void testDynamicResponseToDisablingInterfaces() throws ClassNotFoundException { registerDefaultEvents(); registerDefaultListeners(); assertStandardEventsEnabled(); // now disable listener 1 manager.disableInterface(Listener1.class); assertFalse("via subclass, but no listener", manager.isNotificationEnabled(Event1.class)); assertFalse("disabled", manager.isNotificationEnabled(SubEvent1.class)); assertFalse("via superclass, but no listener", manager.isNotificationEnabled(SubSubEvent1.class)); assertTrue("direct", manager.isNotificationEnabled(Event2.class)); assertTrue("via superclass", manager.isNotificationEnabled(SubEvent2.class)); assertFalse("not specified at all", manager.isNotificationEnabled(Event3.class)); } /** * A new policy should only be generated when the configuration changes */ public void testPolicyCaching() throws ClassNotFoundException { registerDefaultEvents(); registerDefaultListeners(); Policy policy = manager.getPolicy(); assertStandardEventsEnabled(); assertSame(policy, manager.getPolicy()); manager.disableType(Event2.class); assertNotSame(policy, manager.getPolicy()); } public void testDynamicManagerDecisions() throws ClassNotFoundException { registerDefaultEvents(); registerDefaultListeners(); manager.setNotificationDynamic(true); OptimisedNotificationHandler decision = new OptimisedNotificationHandler(manager, Event2.class); assertTrue(decision.isNotificationEnabled(Event2.class)); manager.disableType(Event2.class); assertFalse(decision.isNotificationEnabled(Event2.class)); } /** * When the manager is not dynamic (the default), decisions should not change */ public void testNonDynamicManagerDecisions() throws ClassNotFoundException { registerDefaultEvents(); registerDefaultListeners(); OptimisedNotificationHandler decision = new OptimisedNotificationHandler(manager, Event2.class); assertTrue(decision.isNotificationEnabled(Event2.class)); manager.disableType(Event2.class); assertTrue(decision.isNotificationEnabled(Event2.class)); } public void testNotification() throws ClassNotFoundException { registerDefaultEvents(); registerDefaultListeners(); assertNoListenersNotified(); manager.notifyListeners(new Event1()); assertNoListenersNotified(); manager.notifyListeners(new SubEvent1()); assertNoListenersNotified(); manager.notifyListeners(new Event1("id1")); assertNoListenersNotified(); manager.notifyListeners(new SubSubEvent1("id1")); assertTrue(listener1.isNotified()); assertFalse(listener2.isNotified()); manager.notifyListeners(new Event2()); assertTrue(listener1.isNotified()); assertTrue(listener2.isNotified()); } protected void assertNoListenersNotified() { assertFalse(listener1.isNotified()); assertFalse(listener2.isNotified()); } } mule-2.0.1/core/src/test/java/org/mule/context/notification/Listener2.java0000644000175000017500000000101410745677442026350 0ustar charlescharles/* * $Id: Listener2.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; public class Listener2 extends AbstractListener { // empty }mule-2.0.1/core/src/test/java/org/mule/context/notification/SubSubEvent1.java0000644000175000017500000000117010745677442026772 0ustar charlescharles/* * $Id: SubSubEvent1.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; public class SubSubEvent1 extends SubEvent1 { public SubSubEvent1() { // empty } public SubSubEvent1(String id) { super(id); } }mule-2.0.1/core/src/test/java/org/mule/context/notification/SubEvent1.java0000644000175000017500000000115210745677442026320 0ustar charlescharles/* * $Id: SubEvent1.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; public class SubEvent1 extends Event1 { public SubEvent1() { // empty } public SubEvent1(String id) { super(id); } } mule-2.0.1/core/src/test/java/org/mule/context/notification/Event2.java0000644000175000017500000000126310745677442025652 0ustar charlescharles/* * $Id: Event2.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; public class Event2 extends ServerNotification { public Event2() { super("", 0); } public Event2(String id) { super("", 0, id); } }mule-2.0.1/core/src/test/java/org/mule/context/notification/Event3.java0000644000175000017500000000126310745677442025653 0ustar charlescharles/* * $Id: Event3.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; public class Event3 extends ServerNotification { public Event3() { super("", 0); } public Event3(String id) { super("", 0, id); } }mule-2.0.1/core/src/test/java/org/mule/context/notification/AbstractListener.java0000644000175000017500000000164410745677442027763 0ustar charlescharles/* * $Id: AbstractListener.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.ServerNotificationListener; public abstract class AbstractListener implements ServerNotificationListener { private ServerNotification notification = null; public void onNotification(ServerNotification notification) { this.notification = notification; } public boolean isNotified() { return null != notification; } } mule-2.0.1/core/src/test/java/org/mule/context/notification/Event1.java0000644000175000017500000000126410745677442025652 0ustar charlescharles/* * $Id: Event1.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; import org.mule.api.context.notification.ServerNotification; public class Event1 extends ServerNotification { public Event1() { super("", 0); } public Event1(String id) { super("", 0, id); } } mule-2.0.1/core/src/test/java/org/mule/context/notification/SubEvent2.java0000644000175000017500000000115110745677442026320 0ustar charlescharles/* * $Id: SubEvent2.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.context.notification; public class SubEvent2 extends Event2 { public SubEvent2() { // empty } public SubEvent2(String id) { super(id); } }mule-2.0.1/core/src/test/java/org/mule/transaction/0000755000175000017500000000000011351411071021767 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/transaction/TransactionCoordinationTestCase.java0000644000175000017500000000465110745677442031160 0ustar charlescharles/* * $Id: TransactionCoordinationTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.api.transaction.Transaction; import org.mule.tck.AbstractMuleTestCase; import com.mockobjects.dynamic.Mock; public class TransactionCoordinationTestCase extends AbstractMuleTestCase { volatile TransactionCoordination tc; protected void doSetUp() throws Exception { tc = TransactionCoordination.getInstance(); } protected void doTearDown() throws Exception { tc.unbindTransaction(tc.getTransaction()); } public void testBindTransaction() throws Exception { assertNull(tc.getTransaction()); Mock mockTx = new Mock(Transaction.class, "trans"); Transaction tx = (Transaction)mockTx.proxy(); tc.bindTransaction(tx); assertEquals(tx, tc.getTransaction()); tc.unbindTransaction(tx); } public void testBindTransactionWithAlreadyBound() throws Exception { assertNull(tc.getTransaction()); Mock mockTx = new Mock(Transaction.class, "trans"); Transaction tx = (Transaction)mockTx.proxy(); tc.bindTransaction(tx); assertEquals(tx, tc.getTransaction()); try { Transaction tx2 = (Transaction)new Mock(Transaction.class, "trans").proxy(); tc.bindTransaction(tx2); fail(); } catch (IllegalTransactionStateException e) { // expected } tc.unbindTransaction(tx); } public void testUnbindTransactionWithoutBound() throws Exception { assertNull(tc.getTransaction()); Mock mockTx = new Mock(Transaction.class, "trans"); Transaction tx = (Transaction)mockTx.proxy(); tc.unbindTransaction(tx); } public void testSetInstanceWithBound() throws Exception { assertNull(tc.getTransaction()); Mock mockTx = new Mock(Transaction.class, "trans"); Transaction tx = (Transaction)mockTx.proxy(); tc.bindTransaction(tx); tc.unbindTransaction(tx); } } mule-2.0.1/core/src/test/java/org/mule/transaction/BatchConstraintTestCase.java0000644000175000017500000000244710745677442027411 0ustar charlescharles/* * $Id: BatchConstraintTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.api.MuleEvent; import org.mule.tck.AbstractMuleTestCase; import org.mule.transaction.constraints.BatchConstraint; import org.mule.transaction.constraints.ConstraintFilter; import com.mockobjects.dynamic.Mock; public class BatchConstraintTestCase extends AbstractMuleTestCase { public void testConstraintFilter() throws Exception { MuleEvent testEvent = (MuleEvent)new Mock(MuleEvent.class).proxy(); BatchConstraint filter = new BatchConstraint(); filter.setBatchSize(3); assertEquals(3, filter.getBatchSize()); assertTrue(!filter.accept(testEvent)); ConstraintFilter clone = (ConstraintFilter)filter.clone(); assertNotNull(clone); assertNotSame(filter, clone); assertTrue(!filter.accept(testEvent)); assertTrue(filter.accept(testEvent)); } } mule-2.0.1/core/src/test/java/org/mule/transaction/TransactionConstraintTestCase.java0000644000175000017500000000170610664630335030640 0ustar charlescharles/* * $Id: TransactionConstraintTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.tck.AbstractMuleTestCase; import org.mule.transaction.constraints.ConstraintFilter; public class TransactionConstraintTestCase extends AbstractMuleTestCase { public void testConstraintFilter() throws Exception { ConstraintFilter filter = new ConstraintFilter(); assertTrue(filter.accept(getTestEvent("test"))); ConstraintFilter clone = (ConstraintFilter)filter.clone(); assertNotNull(clone); assertNotSame(filter, clone); } } mule-2.0.1/core/src/test/java/org/mule/transaction/TransactionNotificationsTestCase.java0000644000175000017500000000732110745677442031336 0ustar charlescharles/* * $Id: TransactionNotificationsTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transaction; import org.mule.api.context.notification.ServerNotification; import org.mule.api.context.notification.TransactionNotificationListener; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.context.notification.TransactionNotification; import org.mule.tck.AbstractMuleTestCase; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public class TransactionNotificationsTestCase extends AbstractMuleTestCase { public void testTransactionNotifications() throws Exception { final CountDownLatch latch = new CountDownLatch(3); muleContext.registerListener(new TransactionNotificationListener() { public void onNotification(ServerNotification notification) { if (notification.getAction() == TransactionNotification.TRANSACTION_BEGAN) { assertEquals("begin", notification.getActionName()); latch.countDown(); } else { if (notification.getAction() == TransactionNotification.TRANSACTION_COMMITTED) { assertEquals("commit", notification.getActionName()); latch.countDown(); } else { if (notification.getAction() == TransactionNotification.TRANSACTION_ROLLEDBACK) { assertEquals("rollback", notification.getActionName()); latch.countDown(); } } } } }); // the code is simple and deceptive :) The trick is this dummy transaction is handled by // a global TransactionCoordination instance, which binds it to the current thread. Transaction transaction = new DummyTransaction(); transaction.begin(); transaction.commit(); transaction.rollback(); // Wait for the notifcation event to be fired as they are queued latch.await(2000, TimeUnit.MILLISECONDS); assertEquals("There are still some notifications left unfired.", 0, latch.getCount()); } private class DummyTransaction extends AbstractTransaction { protected void doBegin() throws TransactionException { // nothing to do } protected void doCommit() throws TransactionException { // nothing to do } protected void doRollback() throws TransactionException { // nothing to do } public int getStatus() throws TransactionException { return 0; } public Object getResource(Object key) { return null; } public boolean hasResource(Object key) { return false; } public void bindResource(Object key, Object resource) throws TransactionException { // nothing to do } public void setRollbackOnly() throws TransactionException { // nothing to do } } } mule-2.0.1/core/src/test/java/org/mule/AbstractThreadSafeAccessTestCase.java0000644000175000017500000000544710766637211026606 0ustar charlescharles/* * $Id$ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleMessage; import org.mule.api.ThreadSafeAccess; import org.mule.model.direct.DirectService; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import java.util.Map; public abstract class AbstractThreadSafeAccessTestCase extends AbstractMuleTestCase { protected ThreadSafeAccess dummyEvent() throws Exception { MuleMessage message = new DefaultMuleMessage(new Object(), (Map) null); return new DefaultMuleEvent(message, MuleTestUtils.getTestInboundEndpoint("test", muleContext), new DefaultMuleSession(new DirectService(), muleContext), false); } protected void resetAccessControl(ThreadSafeAccess target) throws InterruptedException { target.assertAccess(true); newThread(target, true, new boolean[]{true}); target.resetAccessControl(); newThread(target, false, new boolean[]{true}); } protected void basicPattern(ThreadSafeAccess target) throws InterruptedException { newThread(target, false, new boolean[]{true, true, false, true}); newThread(target, false, new boolean[]{false}); newThread(target, true, new boolean[]{true}); } protected void newCopy(ThreadSafeAccess target) throws InterruptedException { basicPattern(target); basicPattern(target.newThreadCopy()); } protected void newThread(ThreadSafeAccess target, boolean error, boolean[] pattern) throws InterruptedException { Caller caller = new Caller(target, pattern); Thread thread = new Thread(caller); thread.start(); thread.join(); assertEquals(error, caller.isError()); } protected static class Caller implements Runnable { private boolean isError = false; private ThreadSafeAccess target; private boolean[] write; public Caller(ThreadSafeAccess target, boolean[] write) { this.target = target; this.write = write; } public void run() { try { for (int i = 0; i < write.length; i++) { target.assertAccess(write[i]); } } catch (IllegalStateException e) { isError = true; } } public boolean isError() { return isError; } } } mule-2.0.1/core/src/test/java/org/mule/tck/0000755000175000017500000000000011351411071020223 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/tck/package.html0000644000175000017500000000024310754365306022522 0ustar charlescharles Mule Provides a suite of abstract test cases that can be used to test you custom Mule extensions. mule-2.0.1/core/src/test/java/org/mule/tck/TestCaseWatchdog.java0000644000175000017500000000353710754365306024311 0ustar charlescharles/* * $Id: TestCaseWatchdog.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class TestCaseWatchdog extends Thread { protected static final AtomicInteger threadNumber = new AtomicInteger(0); protected final Log log = LogFactory.getLog(getClass()); protected final long delay; protected final TimeUnit unit; protected final TestCaseWatchdogTimeoutHandler handler; public TestCaseWatchdog(long delay, TimeUnit unit, TestCaseWatchdogTimeoutHandler timeoutHandler) { super("WatchdogThread-" + threadNumber.getAndIncrement()); this.setDaemon(true); this.delay = delay; this.unit = unit; this.handler = timeoutHandler; } public void run() { long millisToWait = this.unit.toMillis(this.delay); if (log.isDebugEnabled()) { log.debug("Starting with " + millisToWait + "ms timeout."); } try { Thread.sleep(millisToWait); handler.handleTimeout(delay, unit); } catch (InterruptedException interrupted) { if (log.isDebugEnabled()) { log.debug("Watchdog stopped."); } } } public void cancel() { this.interrupt(); } } mule-2.0.1/core/src/test/java/org/mule/tck/AbstractMuleTestCase.java0000644000175000017500000005272010766654216025141 0ustar charlescharles/* * $Id: AbstractMuleTestCase.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck; import org.mule.MuleServer; import org.mule.RegistryContext; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleEventContext; import org.mule.api.MuleSession; import org.mule.api.config.ConfigurationBuilder; import org.mule.api.context.MuleContextBuilder; import org.mule.api.context.MuleContextFactory; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.filter.Filter; import org.mule.api.service.Service; import org.mule.api.transformer.Transformer; import org.mule.config.builders.DefaultsConfigurationBuilder; import org.mule.config.builders.SimpleConfigurationBuilder; import org.mule.context.DefaultMuleContextBuilder; import org.mule.context.DefaultMuleContextFactory; import org.mule.tck.testmodels.mule.TestConnector; import org.mule.util.FileUtils; import org.mule.util.MuleUrlStreamHandlerFactory; import org.mule.util.StringMessageUtils; import org.mule.util.StringUtils; import org.mule.util.SystemUtils; import org.mule.util.concurrent.Latch; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.security.CodeSource; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; import junit.framework.TestCase; import junit.framework.TestResult; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import org.apache.commons.collections.IteratorUtils; import org.apache.commons.collections.Predicate; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * AbstractMuleTestCase is a base class for Mule testcases. This * implementation provides services to test code for creating mock and test objects. */ public abstract class AbstractMuleTestCase extends TestCase implements TestCaseWatchdogTimeoutHandler { /** * Top-level directories under .mule which are not deleted on each * test case recycle. This is required, e.g. to play nice with transaction manager * recovery service object store. */ public static final String[] IGNORED_DOT_MULE_DIRS = new String[]{"transaction-log"}; protected static MuleContext muleContext; /** * This flag controls whether the text boxes will be logged when starting each test case. */ private static final boolean verbose; // A Map of test case extension objects. JUnit creates a new TestCase instance for // every method, so we need to record metainfo outside the test. private static final Map testInfos = Collections.synchronizedMap(new HashMap()); // A logger that should be suitable for most test cases. protected final transient Log logger = LogFactory.getLog(this.getClass()); /** * Start the muleContext once it's configured (defaults to false for AbstractMuleTestCase, true for FunctionalTestCase). */ private boolean startContext = false; // Should be set to a string message describing any prerequisites not met. private boolean offline = "true".equalsIgnoreCase(System.getProperty("org.mule.offline")); // Barks if the test exceeds its time limit private TestCaseWatchdog watchdog; static { String muleOpts = SystemUtils.getenv("MULE_TEST_OPTS"); if (StringUtils.isNotBlank(muleOpts)) { Map parsedOpts = SystemUtils.parsePropertyDefinitions(muleOpts); String optVerbose = (String) parsedOpts.get("mule.verbose"); verbose = Boolean.valueOf(optVerbose).booleanValue(); } else { // per default, revert to the old behaviour verbose = true; } // register the custom UrlStreamHandlerFactory. MuleUrlStreamHandlerFactory.installUrlStreamHandlerFactory(); } /** * Convenient test message for unit testing. */ public static final String TEST_MESSAGE = "Test Message"; /** * Default timeout for multithreaded tests (using CountDownLatch, WaitableBoolean, etc.), * in milliseconds. The higher this value, the more reliable the test will be, so it * should be set high for Continuous Integration. However, this can waste time during * day-to-day development cycles, so you may want to temporarily lower it while debugging. */ public static final long LOCK_TIMEOUT = 30000; /** * Default timeout for waiting for responses */ public static final int RECEIVE_TIMEOUT = 5000; /** * Use this as a semaphore to the unit test to indicate when a callback has successfully been called. */ protected Latch callbackCalled; public AbstractMuleTestCase() { super(); TestInfo info = (TestInfo) testInfos.get(getClass().getName()); if (info == null) { info = this.createTestInfo(); testInfos.put(getClass().getName(), info); } this.registerTestMethod(); } protected void registerTestMethod() { if (this.getName() != null) { this.getTestInfo().incTestCount(getName()); } } public void setName(String name) { super.setName(name); registerTestMethod(); } protected TestInfo createTestInfo() { return new TestInfo(this); } protected TestInfo getTestInfo() { return (TestInfo) testInfos.get(this.getClass().getName()); } private void clearInfo() { testInfos.remove(this.getClass().getName()); } public String getName() { if (verbose && super.getName() != null) { return super.getName().substring(4).replaceAll("([A-Z])", " $1").toLowerCase() + " "; } return super.getName(); } public void run(TestResult result) { if (this.isExcluded()) { if (verbose) { logger.info(this.getClass().getName() + " excluded"); } return; } if (this.isDisabledInThisEnvironment()) { if (verbose) { logger.info(this.getClass().getName() + " disabled"); } return; } super.run(result); } /** * Shamelessly copy from Spring's ConditionalTestCase so in MULE-2.0 we can extend * this class from ConditionalTestCase. * * Subclasses can override isDisabledInThisEnvironment to skip a single test. */ public void runBare() throws Throwable { // getName will return the name of the method being run. Use the real JUnit implementation, // this class has a different implementation if (this.isDisabledInThisEnvironment(super.getName())) { logger.warn(this.getClass().getName() + "." + super.getName() + " disabled in this environment"); return; } // Let JUnit handle execution super.runBare(); } /** * Subclasses can override this method to skip the execution of the entire test class. * * @return true if the test class should not be run. */ protected boolean isDisabledInThisEnvironment() { return false; } /** * Indicates whether this test has been explicitly disabled through the configuration * file loaded by TestInfo. * * @return whether the test has been explicitly disabled */ protected boolean isExcluded() { return getTestInfo().isExcluded(); } /** * Should this test run? * * @param testMethodName name of the test method * @return whether the test should execute in the current envionment */ protected boolean isDisabledInThisEnvironment(String testMethodName) { return false; } public boolean isOffline(String method) { if (offline) { logger.warn(StringMessageUtils.getBoilerPlate( "Working offline cannot run test: " + method, '=', 80)); } return offline; } protected boolean isDisposeManagerPerSuite() { return getTestInfo().isDisposeManagerPerSuite(); } protected void setDisposeManagerPerSuite(boolean val) { getTestInfo().setDisposeManagerPerSuite(val); } protected TestCaseWatchdog createWatchdog() { return new TestCaseWatchdog(10, TimeUnit.MINUTES, this); } public void handleTimeout(long timeout, TimeUnit unit) { logger.fatal("Timeout of " + unit.toMillis(timeout) + "ms exceeded - exiting VM!"); Runtime.getRuntime().halt(1); } protected final void setUp() throws Exception { // start a watchdog thread watchdog = createWatchdog(); watchdog.start(); if (verbose) { System.out.println(StringMessageUtils.getBoilerPlate("Testing: " + toString(), '=', 80)); } try { if (getTestInfo().getRunCount() == 0) { if (getTestInfo().isDisposeManagerPerSuite()) { // We dispose here jut in case disposeManager(); } suitePreSetUp(); } if (!getTestInfo().isDisposeManagerPerSuite()) { // We dispose here just in case disposeManager(); } muleContext = createMuleContext(); if (isStartContext() && null != muleContext && muleContext.isStarted() == false) { muleContext.start(); } doSetUp(); } catch (Exception e) { getTestInfo().incRunCount(); throw e; } } protected MuleContext createMuleContext() throws Exception { // Should we set up the manager for every method? MuleContext context; if (getTestInfo().isDisposeManagerPerSuite() && muleContext != null) { context = muleContext; } else { MuleContextFactory muleContextFactory = new DefaultMuleContextFactory(); List builders = new ArrayList(); builders.add(new SimpleConfigurationBuilder(getStartUpProperties())); builders.add(getBuilder()); MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder(); configureMuleContext(contextBuilder); context = muleContextFactory.createMuleContext(builders, contextBuilder); } return context; } /** * Override this method to set properties of the MuleContextBuilder before it is * used to create the MuleContext. */ protected void configureMuleContext(MuleContextBuilder contextBuilder) { contextBuilder.setWorkListener(new TestingWorkListener()); } protected ConfigurationBuilder getBuilder() throws Exception { return new DefaultsConfigurationBuilder(); } protected String getConfigurationResources() { return StringUtils.EMPTY; } protected Properties getStartUpProperties() { return null; } /** * Run before any testcase setup. */ protected void suitePreSetUp() throws Exception { // nothing to do } /** * Run after all testcase teardowns. */ protected void suitePostTearDown() throws Exception { // nothing to do } protected final void tearDown() throws Exception { try { doTearDown(); if (!getTestInfo().isDisposeManagerPerSuite()) { disposeManager(); } } finally { try { getTestInfo().incRunCount(); if (getTestInfo().getRunCount() == getTestInfo().getTestCount()) { try { suitePostTearDown(); } finally { clearInfo(); disposeManager(); } } } finally { // remove the watchdog thread in any case watchdog.cancel(); } } } protected void disposeManager() { try { if (muleContext != null && !(muleContext.isDisposed() || muleContext.isDisposing())) { muleContext.dispose(); if (RegistryContext.getRegistry() != null) { final String workingDir = muleContext.getConfiguration().getWorkingDirectory(); // do not delete TM recovery object store, everything else is good to go FileUtils.deleteTree(FileUtils.newFile(workingDir), IGNORED_DOT_MULE_DIRS); RegistryContext.getRegistry().dispose(); } } FileUtils.deleteTree(FileUtils.newFile("./ActiveMQ")); } finally { muleContext = null; RegistryContext.setRegistry(null); MuleServer.setMuleContext(muleContext); } } protected void doSetUp() throws Exception { // template method } protected void doTearDown() throws Exception { // template method } public static InboundEndpoint getTestInboundEndpoint(String name) throws Exception { return MuleTestUtils.getTestInboundEndpoint(name, muleContext); } public static OutboundEndpoint getTestOutboundEndpoint(String name) throws Exception { return MuleTestUtils.getTestOutboundEndpoint(name, muleContext); } public static InboundEndpoint getTestInboundEndpoint(String name, String uri) throws Exception { return MuleTestUtils.getTestInboundEndpoint(name, muleContext, uri, null, null, null); } public static OutboundEndpoint getTestOutboundEndpoint(String name, String uri) throws Exception { return MuleTestUtils.getTestOutboundEndpoint(name, muleContext, uri, null, null, null); } public static InboundEndpoint getTestInboundEndpoint(String name, List transformers) throws Exception { return MuleTestUtils.getTestInboundEndpoint(name, muleContext, null, transformers, null, null); } public static OutboundEndpoint getTestOutboundEndpoint(String name, List transformers) throws Exception { return MuleTestUtils.getTestOutboundEndpoint(name, muleContext, null, transformers, null, null); } public static InboundEndpoint getTestInboundEndpoint(String name, String uri, List transformers, Filter filter, Map properties) throws Exception { return MuleTestUtils.getTestInboundEndpoint(name, muleContext, uri, transformers, filter, properties); } public static OutboundEndpoint getTestOutboundEndpoint(String name, String uri, List transformers, Filter filter, Map properties) throws Exception { return MuleTestUtils.getTestOutboundEndpoint(name, muleContext, uri, transformers, filter, properties); } public static MuleEvent getTestEvent(Object data, Service service) throws Exception { return MuleTestUtils.getTestEvent(data, service, muleContext); } public static MuleEvent getTestEvent(Object data) throws Exception { return MuleTestUtils.getTestEvent(data, muleContext); } public static MuleEvent getTestInboundEvent(Object data) throws Exception { return MuleTestUtils.getTestInboundEvent(data, muleContext); } public static MuleEventContext getTestEventContext(Object data) throws Exception { return MuleTestUtils.getTestEventContext(data, muleContext); } public static Transformer getTestTransformer() throws Exception { return MuleTestUtils.getTestTransformer(); } public static MuleEvent getTestEvent(Object data, ImmutableEndpoint endpoint) throws Exception { return MuleTestUtils.getTestEvent(data, endpoint, muleContext); } public static MuleEvent getTestEvent(Object data, Service service, ImmutableEndpoint endpoint) throws Exception { return MuleTestUtils.getTestEvent(data, service, endpoint, muleContext); } public static MuleSession getTestSession(Service service, MuleContext context) { return MuleTestUtils.getTestSession(service, context); } public static TestConnector getTestConnector() throws Exception { return MuleTestUtils.getTestConnector(muleContext); } public static Service getTestService() throws Exception { return MuleTestUtils.getTestService(muleContext); } public static Service getTestService(String name, Class clazz) throws Exception { return MuleTestUtils.getTestService(name, clazz, muleContext); } public static Service getTestService(String name, Class clazz, Map props) throws Exception { return MuleTestUtils.getTestService(name, clazz, props, muleContext); } public static class TestInfo { /** * Whether to dispose the manager after every method or once all tests for * the class have run */ private final String name; private boolean disposeManagerPerSuite = false; private boolean excluded = false; private volatile int testCount = 0; private volatile int runCount = 0; // @GuardedBy(this) private Set registeredTestMethod = new HashSet(); // this is a shorter version of the snippet from: // http://www.davidflanagan.com/blog/2005_06.html#000060 // (see comments; DF's "manual" version works fine too) public static URL getClassPathRoot(Class clazz) { CodeSource cs = clazz.getProtectionDomain().getCodeSource(); return (cs != null ? cs.getLocation() : null); } public TestInfo(TestCase test) { this.name = test.getClass().getName(); // load test exclusions try { // We find the physical classpath root URL of the test class and // use that to find the correct resource. Works fine everywhere, // regardless of classloaders. See MULE-2414 URL[] urls = new URL[]{getClassPathRoot(test.getClass())}; URL fileUrl = new URLClassLoader(urls).getResource("mule-test-exclusions.txt"); if (fileUrl != null) { // in case .txt is in jar URI fileUri = new URI(StringUtils.removeStart(fileUrl.toString(), "jar:")); // this iterates over all lines in the exclusion file Iterator lines = FileUtils.lineIterator(FileUtils.newFile(fileUri)); // ..and this finds non-comments that match the test case name excluded = IteratorUtils.filteredIterator(lines, new Predicate() { public boolean evaluate(Object object) { return StringUtils.equals(name, StringUtils.trimToEmpty((String) object)); } }).hasNext(); } } catch (IOException ioex) { // ignore } catch (URISyntaxException e) { // ignore } } public int getTestCount() { return testCount; } public synchronized void incTestCount(String name) { if (!registeredTestMethod.contains(name)) { testCount++; registeredTestMethod.add(name); } } public int getRunCount() { return runCount; } public void incRunCount() { runCount++; } public String getName() { return name; } public boolean isDisposeManagerPerSuite() { return disposeManagerPerSuite; } public void setDisposeManagerPerSuite(boolean disposeManagerPerSuite) { this.disposeManagerPerSuite = disposeManagerPerSuite; } public boolean isExcluded() { return excluded; } public synchronized String toString() { StringBuffer buf = new StringBuffer(); return buf.append(name).append(", (").append(runCount).append(" / ").append(testCount).append( ") tests run, disposePerSuite=").append(disposeManagerPerSuite).toString(); } } protected boolean isStartContext() { return startContext; } protected void setStartContext(boolean startContext) { this.startContext = startContext; } } mule-2.0.1/core/src/test/java/org/mule/tck/TestCaseWatchdogTimeoutHandler.java0000644000175000017500000000117010754365306027145 0ustar charlescharles/* * $Id: TestCaseWatchdogTimeoutHandler.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; public interface TestCaseWatchdogTimeoutHandler { void handleTimeout(long timeout, TimeUnit unit); } mule-2.0.1/core/src/test/java/org/mule/tck/MuleTestUtils.java0000644000175000017500000004160510767256152023700 0ustar charlescharles/* * $Id: MuleTestUtils.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck; import org.mule.DefaultMuleContext; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.DefaultMuleSession; import org.mule.RequestContext; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleEventContext; import org.mule.api.MuleException; import org.mule.api.MuleSession; import org.mule.api.endpoint.EndpointBuilder; import org.mule.api.endpoint.EndpointURI; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.object.ObjectFactory; import org.mule.api.routing.OutboundRouter; import org.mule.api.routing.filter.Filter; import org.mule.api.service.Service; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionFactory; import org.mule.api.transformer.Transformer; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageDispatcher; import org.mule.api.transport.MessageDispatcherFactory; import org.mule.component.DefaultJavaComponent; import org.mule.endpoint.EndpointURIEndpointBuilder; import org.mule.endpoint.MuleEndpointURI; import org.mule.model.seda.SedaModel; import org.mule.model.seda.SedaService; import org.mule.object.SingletonObjectFactory; import org.mule.routing.outbound.OutboundPassThroughRouter; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.mule.TestAgent; import org.mule.tck.testmodels.mule.TestCompressionTransformer; import org.mule.tck.testmodels.mule.TestConnector; import org.mule.transport.AbstractConnector; import org.mule.util.ClassUtils; import com.mockobjects.dynamic.Mock; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Utilities for creating test and Mock Mule objects */ public final class MuleTestUtils { // public static Endpoint getTestEndpoint(String name, String type, MuleContext context) throws Exception // { // Map props = new HashMap(); // props.put("name", name); // props.put("type", type); // props.put("endpointURI", new MuleEndpointURI("test://test")); // props.put("connector", "testConnector"); // // need to build endpoint this way to avoid depenency to any endpoint jars // AbstractConnector connector = null; // connector = (AbstractConnector)ClassUtils.loadClass("org.mule.tck.testmodels.mule.TestConnector", // AbstractMuleTestCase.class).newInstance(); // // connector.setName("testConnector"); // connector.setMuleContext(context); // context.applyLifecycle(connector); // // EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("test://test", context); // endpointBuilder.setConnector(connector); // endpointBuilder.setName(name); // if (ImmutableEndpoint.ENDPOINT_TYPE_RECEIVER.equals(type)) // { // return (Endpoint) context.getRegistry().lookupEndpointFactory().getInboundEndpoint(endpointBuilder); // } // else if (ImmutableEndpoint.ENDPOINT_TYPE_SENDER.equals(type)) // { // return (Endpoint) context.getRegistry().lookupEndpointFactory().getOutboundEndpoint(endpointBuilder); // } // else // { // throw new IllegalArgumentException("The endpoint type: " + type + "is not recognized."); // // } // } public static InboundEndpoint getTestInboundEndpoint(String name, final MuleContext context) throws Exception { return (InboundEndpoint) getTestEndpoint(name, null, null, null, null, context, new EndpointSource() { public ImmutableEndpoint getEndpoint(EndpointBuilder builder) throws MuleException { return context.getRegistry().lookupEndpointFactory().getInboundEndpoint(builder); } }); } public static OutboundEndpoint getTestOutboundEndpoint(String name, final MuleContext context) throws Exception { return (OutboundEndpoint) getTestEndpoint(name, null, null, null, null, context, new EndpointSource() { public ImmutableEndpoint getEndpoint(EndpointBuilder builder) throws MuleException { return context.getRegistry().lookupEndpointFactory().getOutboundEndpoint(builder); } }); } public static InboundEndpoint getTestInboundEndpoint(String name, final MuleContext context, String uri, List transformers, Filter filter, Map properties) throws Exception { return (InboundEndpoint) getTestEndpoint(name, uri, transformers, filter, properties, context, new EndpointSource() { public ImmutableEndpoint getEndpoint(EndpointBuilder builder) throws MuleException { return context.getRegistry().lookupEndpointFactory().getInboundEndpoint(builder); } }); } public static OutboundEndpoint getTestOutboundEndpoint(String name, final MuleContext context, String uri, List transformers, Filter filter, Map properties) throws Exception { return (OutboundEndpoint) getTestEndpoint(name, uri, transformers, filter, properties, context, new EndpointSource() { public ImmutableEndpoint getEndpoint(EndpointBuilder builder) throws MuleException { return context.getRegistry().lookupEndpointFactory().getOutboundEndpoint(builder); } }); } private static ImmutableEndpoint getTestEndpoint(String name, String uri, List transformers, Filter filter, Map properties, MuleContext context, EndpointSource source) throws Exception { Map props = new HashMap(); props.put("name", name); props.put("endpointURI", new MuleEndpointURI("test://test")); props.put("connector", "testConnector"); // need to build endpoint this way to avoid depenency to any endpoint jars AbstractConnector connector = (AbstractConnector) ClassUtils.loadClass( "org.mule.tck.testmodels.mule.TestConnector", AbstractMuleTestCase.class).newInstance(); connector.setName("testConnector"); connector.setMuleContext(context); context.applyLifecycle(connector); String endpoingUri = uri == null ? "test://test" : uri; EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(endpoingUri, context); endpointBuilder.setConnector(connector); endpointBuilder.setName(name); if (transformers != null) { endpointBuilder.setTransformers(transformers); } if (properties != null) { endpointBuilder.setProperties(properties); } endpointBuilder.setFilter(filter); return source.getEndpoint(endpointBuilder); } private interface EndpointSource { ImmutableEndpoint getEndpoint(EndpointBuilder builder) throws MuleException; } // public static Endpoint getTestSchemeMetaInfoEndpoint(String name, String type, String protocol, MuleContext context) // throws Exception // { // // need to build endpoint this way to avoid depenency to any endpoint jars // AbstractConnector connector = null; // connector = (AbstractConnector) ClassUtils.loadClass("org.mule.tck.testmodels.mule.TestConnector", // AbstractMuleTestCase.class).newInstance(); // // connector.setName("testConnector"); // connector.setMuleContext(context); // context.applyLifecycle(connector); // connector.registerSupportedProtocol(protocol); // // EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("test:" + protocol + "://test", context); // endpointBuilder.setConnector(connector); // endpointBuilder.setName(name); // if (ImmutableEndpoint.ENDPOINT_TYPE_RECEIVER.equals(type)) // { // return (Endpoint) context.getRegistry().lookupEndpointFactory().getInboundEndpoint(endpointBuilder); // } // else if (ImmutableEndpoint.ENDPOINT_TYPE_SENDER.equals(type)) // { // return (Endpoint) context.getRegistry().lookupEndpointFactory().getOutboundEndpoint(endpointBuilder); // } // else // { // throw new IllegalArgumentException("The endpoint type: " + type + "is not recognized."); // // } // } public static ImmutableEndpoint getTestSchemeMetaInfoInboundEndpoint(String name, String protocol, final MuleContext context) throws Exception { return getTestSchemeMetaInfoEndpoint(name, protocol, context, new EndpointSource() { public ImmutableEndpoint getEndpoint(EndpointBuilder builder) throws MuleException { return context.getRegistry().lookupEndpointFactory().getInboundEndpoint(builder); } }); } public static ImmutableEndpoint getTestSchemeMetaInfoOutboundEndpoint(String name, String protocol, final MuleContext context) throws Exception { return getTestSchemeMetaInfoEndpoint(name, protocol, context, new EndpointSource() { public ImmutableEndpoint getEndpoint(EndpointBuilder builder) throws MuleException { return context.getRegistry().lookupEndpointFactory().getOutboundEndpoint(builder); } }); } private static ImmutableEndpoint getTestSchemeMetaInfoEndpoint(String name, String protocol, MuleContext context, EndpointSource source) throws Exception { // need to build endpoint this way to avoid depenency to any endpoint jars AbstractConnector connector = (AbstractConnector) ClassUtils.loadClass("org.mule.tck.testmodels.mule.TestConnector", AbstractMuleTestCase.class).newInstance(); connector.setName("testConnector"); connector.setMuleContext(context); context.applyLifecycle(connector); connector.registerSupportedProtocol(protocol); EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("test:" + protocol + "://test", context); endpointBuilder.setConnector(connector); endpointBuilder.setName(name); return source.getEndpoint(endpointBuilder); } /** Supply no service, no endpoint */ public static MuleEvent getTestEvent(Object data, MuleContext context) throws Exception { return getTestEvent(data, getTestService(context), context); } public static MuleEvent getTestInboundEvent(Object data, MuleContext context) throws Exception { return getTestInboundEvent(data, getTestService(context), context); } /** Supply service but no endpoint */ public static MuleEvent getTestEvent(Object data, Service service, MuleContext context) throws Exception { return getTestEvent(data, service, getTestOutboundEndpoint("test1", context), context); } public static MuleEvent getTestInboundEvent(Object data, Service service, MuleContext context) throws Exception { return getTestEvent(data, service, getTestInboundEndpoint("test1", context), context); } /** Supply endpoint but no service */ public static MuleEvent getTestEvent(Object data, ImmutableEndpoint endpoint, MuleContext context) throws Exception { return getTestEvent(data, getTestService(context), endpoint, context); } public static MuleEvent getTestEvent(Object data, Service service, ImmutableEndpoint endpoint, MuleContext context) throws Exception { MuleSession session = getTestSession(service, context); return new DefaultMuleEvent(new DefaultMuleMessage(data, new HashMap()), endpoint, session, true); } public static MuleEventContext getTestEventContext(Object data, MuleContext context) throws Exception { try { MuleEvent event = getTestEvent(data, context); RequestContext.setEvent(event); return RequestContext.getEventContext(); } finally { RequestContext.setEvent(null); } } public static Transformer getTestTransformer() throws Exception { Transformer t = new TestCompressionTransformer(); t.initialise(); return t; } public static MuleSession getTestSession(Service service, MuleContext context) { return new DefaultMuleSession(service, context); } public static MuleSession getTestSession(MuleContext context) { return getTestSession(null, context); } public static TestConnector getTestConnector(MuleContext context) throws Exception { TestConnector testConnector = new TestConnector(); testConnector.setName("testConnector"); testConnector.setMuleContext(context); context.applyLifecycle(testConnector); return testConnector; } public static Service getTestService(MuleContext context) throws Exception { return getTestService("appleService", Apple.class, context); } public static Service getTestService(String name, Class clazz, MuleContext context) throws Exception { return getTestService(name, clazz, null, context); } public static Service getTestService(String name, Class clazz, Map props, MuleContext context) throws Exception { return getTestService(name, clazz, props, context, true); } public static Service getTestService(String name, Class clazz, Map props, MuleContext context, boolean initialize) throws Exception { SedaModel model = new SedaModel(); model.setMuleContext(context); context.applyLifecycle(model); Service c = new SedaService(); c.setName(name); ObjectFactory of = new SingletonObjectFactory(clazz, props); of.initialise(); c.setComponent(new DefaultJavaComponent(of)); c.setModel(model); if (initialize) { context.getRegistry().registerService(c); //TODO Why is this necessary OutboundRouter router = new OutboundPassThroughRouter(); c.getOutboundRouter().addRouter(router); } return c; } public static TestAgent getTestAgent() throws Exception { TestAgent t = new TestAgent(); t.initialise(); return t; } public static Mock getMockSession() { return new Mock(MuleSession.class, "umoSession"); } public static Mock getMockMessageDispatcher() { return new Mock(MessageDispatcher.class, "umoMessageDispatcher"); } public static Mock getMockMessageDispatcherFactory() { return new Mock(MessageDispatcherFactory.class, "umoMessageDispatcherFactory"); } public static Mock getMockConnector() { return new Mock(Connector.class, "umoConnector"); } public static Mock getMockEvent() { return new Mock(MuleEvent.class, "umoEvent"); } public static Mock getMockMuleContext() { return new Mock(DefaultMuleContext.class, "muleMuleContext"); } public static Mock getMockInboundEndpoint() { return new Mock(InboundEndpoint.class, "umoEndpoint"); } public static Mock getMockOutboundEndpoint() { return new Mock(OutboundEndpoint.class, "umoEndpoint"); } public static Mock getMockEndpointURI() { return new Mock(EndpointURI.class, "umoEndpointUri"); } public static Mock getMockTransaction() { return new Mock(Transaction.class, "umoTransaction"); } public static Mock getMockTransactionFactory() { return new Mock(TransactionFactory.class, "umoTransactionFactory"); } } mule-2.0.1/core/src/test/java/org/mule/tck/services/0000755000175000017500000000000011351411070022045 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/tck/services/MatchingMethodsComponent.java0000644000175000017500000000154210754365306027673 0ustar charlescharles/* * $Id: MatchingMethodsComponent.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.services; import org.mule.util.StringUtils; import java.rmi.Remote; /** * A test service that has two service methods with matching signature */ public class MatchingMethodsComponent implements Remote { public String reverseString(String string) { return StringUtils.reverse(string); } public String upperCaseString(String string) { return string.toUpperCase(); } } mule-2.0.1/core/src/test/java/org/mule/tck/services/UniqueComponent.java0000644000175000017500000000174010756272260026061 0ustar charlescharles/* * $Id: UniqueComponent.java 10838 2008-02-18 12:06:08Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.services; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; import org.mule.util.UUID; /** * Each instance of this service should contain a unique ID. * Useful for testing object pools. */ public class UniqueComponent implements Callable { String id = UUID.getUUID(); public Object onCall(MuleEventContext eventContext) throws Exception { return getId(); } public String getId() { return id; } public void setId(String id) { this.id = id; } } mule-2.0.1/core/src/test/java/org/mule/tck/services/SimpleMathsComponent.java0000644000175000017500000000121210754365306027035 0ustar charlescharles/* * $Id: SimpleMathsComponent.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.services; import java.rmi.Remote; public class SimpleMathsComponent implements Remote { public Integer addTen(Integer number) { return new Integer(number.intValue() + 10); } } mule-2.0.1/core/src/test/java/org/mule/tck/TestingWorkListener.java0000644000175000017500000000221210766460477025100 0ustar charlescharles/* * $Id: TestingWorkListener.java 11362 2008-03-14 11:27:59Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck; import org.mule.work.DefaultWorkListener; import javax.resource.spi.work.WorkEvent; public class TestingWorkListener extends DefaultWorkListener { protected void handleWorkException(WorkEvent event, String type) { super.handleWorkException(event, type); if (event.getException() != null) { Throwable t = event.getException().getCause(); if (t != null) { if (t instanceof Error) { throw (Error)t; } else if (t instanceof RuntimeException) { throw (RuntimeException)t; } } } } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/0000755000175000017500000000000011351411070022405 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/0000755000175000017500000000000011351411071023537 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/package.html0000644000175000017500000000021710754365306026037 0ustar charlescharles Mule Contains the Fruit test model used by the tck and all other testcases in Mule. mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/AbstractFruit.java0000644000175000017500000000120210754365306027171 0ustar charlescharles/* * $Id: AbstractFruit.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; /** * AbstractFruit is a base class for fruity test objects. yum! */ public abstract class AbstractFruit implements Fruit { // abstract class for test objects } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/FruitLover.java0000644000175000017500000000200310754365306026515 0ustar charlescharles/* * $Id: FruitLover.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class FruitLover { private final List eatList = Collections.synchronizedList(new ArrayList()); private final String catchphrase; public FruitLover(String catchphrase) { this.catchphrase = catchphrase; } public void eatFruit(Fruit fruit) { fruit.bite(); eatList.add(fruit.getClass()); } public List getEatList() { return eatList; } public String speak() { return catchphrase; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/FruitBowlToFruitBasket.java0000644000175000017500000000375310764745332031017 0ustar charlescharles/* * $Id: FruitBowlToFruitBasket.java 11283 2008-03-09 11:32:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; /** * Converts a FruitBowl to a FruitBasket (for testing obviously :) */ public class FruitBowlToFruitBasket extends AbstractTransformer implements DiscoverableTransformer { private int weighting = 1; public FruitBowlToFruitBasket() { registerSourceType(FruitBowl.class); setReturnClass(FruitBasket.class); } protected Object doTransform(Object src, String encoding) throws TransformerException { FruitBowl bowl = (FruitBowl)src; FruitBasket basket = new FruitBasket(); basket.setFruit(bowl.getFruit()); return basket; } /** * If 2 or more discoverable transformers are equal, this value can be used to select the correct one * * @return the priority weighting for this transformer. This is a value between * {@link #MIN_PRIORITY_WEIGHTING} and {@link #MAX_PRIORITY_WEIGHTING}. */ public int getPriorityWeighting() { return weighting; } /** * If 2 or more discoverable transformers are equal, this value can be used to select the correct one * * @param weighting the priority weighting for this transformer. This is a value between * {@link #MIN_PRIORITY_WEIGHTING} and {@link #MAX_PRIORITY_WEIGHTING}. */ public void setPriorityWeighting(int weighting) { this.weighting = weighting; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/Fruit.java0000644000175000017500000000107610754365306025516 0ustar charlescharles/* * $Id: Fruit.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import java.io.Serializable; public interface Fruit extends Serializable { void bite(); boolean isBitten(); } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/FruitCleaner.java0000644000175000017500000000105110754365306027001 0ustar charlescharles/* * $Id: FruitCleaner.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; public interface FruitCleaner { void wash(Fruit fruit); void polish(Fruit fruit); } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/RedApple.java0000644000175000017500000000123710754365306026120 0ustar charlescharles/* * $Id: RedApple.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; public class RedApple extends Apple { /** * Serial version */ private static final long serialVersionUID = 1731005445509956204L; public String getColour() { return "red"; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/Banana.java0000644000175000017500000000254310754365306025605 0ustar charlescharles/* * $Id: Banana.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import java.util.EventObject; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class Banana implements Fruit { /** * Serial version */ private static final long serialVersionUID = -1371515374040436874L; /** * logger used by this class */ private static final Log logger = LogFactory.getLog(Banana.class); private boolean peeled = false; private boolean bitten = false; public void peel() { peeled = true; } public void peelEvent(EventObject e) { logger.debug("Banana got peel event in peelEvent(EventObject)! MuleEvent says: " + e.getSource().toString()); peel(); } public boolean isPeeled() { return peeled; } public void bite() { bitten = true; } public boolean isBitten() { return bitten; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/Orange.java0000644000175000017500000001276610754365306025650 0ustar charlescharles/* * $Id: Orange.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import org.mule.api.MuleException; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class Orange implements Fruit, Callable { /** * Serial version */ private static final long serialVersionUID = 2556604671068150589L; /** * logger used by this class */ private static final Log logger = LogFactory.getLog(Orange.class); private boolean bitten = false; private Integer segments = new Integer(10); private Double radius = new Double(4.34); private String brand; private FruitCleaner cleaner; private Map mapProperties; private List listProperties; private List arrayProperties; public Orange() { super(); } public Orange(Integer segments, Double radius, String brand) { super(); this.segments = segments; this.radius = radius; this.brand = brand; } public Orange(HashMap props) throws MuleException { setBrand((String) props.get("brand")); setRadius((Double) props.get("radius")); setSegments((Integer) props.get("segments")); } public void bite() { bitten = true; } public boolean isBitten() { return bitten; } public Object onCall(MuleEventContext context) throws MuleException { logger.debug("Orange received an event in UMOCallable.onEvent! MuleEvent says: " + context.getMessageAsString()); bite(); return null; } /** * @return */ public String getBrand() { return brand; } /** * @return */ public Integer getSegments() { return segments; } /** * @return */ public Double getRadius() { return radius; } /** * @param string */ public void setBrand(String string) { brand = string; } /** * @param integer */ public void setSegments(Integer integer) { segments = integer; } /** * @param double1 */ public void setRadius(Double double1) { radius = double1; } /** * @return Returns the listProperties. */ public List getListProperties() { return listProperties; } /** * @param listProperties The listProperties to set. */ public void setListProperties(List listProperties) { this.listProperties = listProperties; } /** * @return Returns the mapProperties. */ public Map getMapProperties() { return mapProperties; } /** * @param mapProperties The mapProperties to set. */ public void setMapProperties(Map mapProperties) { this.mapProperties = mapProperties; } /** * @return Returns the arrayProperties. */ public List getArrayProperties() { return arrayProperties; } /** * @param arrayProperties The arrayProperties to set. */ public void setArrayProperties(List arrayProperties) { this.arrayProperties = arrayProperties; } public FruitCleaner getCleaner() { return cleaner; } public void setCleaner(FruitCleaner cleaner) { this.cleaner = cleaner; } public void wash() { cleaner.wash(this); } public void polish() { cleaner.polish(this); } public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (bitten ? 1231 : 1237); result = prime * result + ((brand == null) ? 0 : brand.hashCode()); result = prime * result + ((radius == null) ? 0 : radius.hashCode()); result = prime * result + ((segments == null) ? 0 : segments.hashCode()); return result; } public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Orange other = (Orange) obj; if (bitten != other.bitten) { return false; } if (brand == null) { if (other.brand != null) { return false; } } else if (!brand.equals(other.brand)) { return false; } if (radius == null) { if (other.radius != null) { return false; } } else if (!radius.equals(other.radius)) { return false; } if (segments == null) { if (other.segments != null) { return false; } } else if (!segments.equals(other.segments)) { return false; } return true; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/BananaFactory.java0000644000175000017500000000242010774254333027126 0ustar charlescharles/* * $Id: BananaFactory.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import org.mule.api.lifecycle.InitialisationCallback; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.object.ObjectFactory; /** * BananaFactory is a test factory that creates Bananas */ public class BananaFactory implements ObjectFactory { public void initialise() throws InitialisationException { // nothing to do } public void dispose() { // nothing to do } public Object getInstance() throws Exception { return new Banana(); } public Class getObjectClass() { return Banana.class; } public void addObjectInitialisationCallback(InitialisationCallback callback) { throw new UnsupportedOperationException(); } public boolean isSingleton() { return false; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/InvalidSatsuma.java0000644000175000017500000000202710754365306027346 0ustar charlescharles/* * $Id: InvalidSatsuma.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; /** * InvalidSatsuma has no discoverable methods */ public class InvalidSatsuma implements Fruit { /** * Serial version */ private static final long serialVersionUID = -6328691504772842584L; private boolean bitten = false; /* * (non-Javadoc) * * @see org.mule.testmodels.fruit.Fruit#bite() */ public void bite() { bitten = true; } /* * (non-Javadoc) * * @see org.mule.testmodels.fruit.Fruit#isBitten() */ public boolean isBitten() { return bitten; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/FruitBasket.java0000644000175000017500000000266710764745332026661 0ustar charlescharles/* * $Id: FruitBasket.java 11283 2008-03-09 11:32:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import java.util.Map; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.ArrayList; /** * TODO */ public class FruitBasket { private final Map basket = Collections.synchronizedMap(new HashMap()); public boolean hasApple() { return basket.get(Apple.class) != null; } public boolean hasBanana() { return basket.get(Banana.class) != null; } public void setFruit(Fruit[] fruit) { for (int i = 0; i < fruit.length; i++) { basket.put(fruit[i].getClass(), fruit[i]); } } public void setFruit(List fruit) { this.setFruit((Fruit[]) fruit.toArray(new Fruit[fruit.size()])); } public List getFruit() { return new ArrayList(basket.values()); } public Apple getApple() { return (Apple) basket.get(Apple.class); } public Banana getBanana() { return (Banana) basket.get(Banana.class); } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/ObjectToFruitLover.java0000644000175000017500000000210310754365306030150 0ustar charlescharles/* * $Id: ObjectToFruitLover.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; public class ObjectToFruitLover extends AbstractTransformer { public ObjectToFruitLover() { this.setReturnClass(FruitLover.class); this.registerSourceType(String.class); this.registerSourceType(FruitLover.class); } public Object doTransform(Object src, String encoding) throws TransformerException { if (src instanceof FruitLover) { return src; } else { return new FruitLover((String) src); } } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/BloodOrange.java0000644000175000017500000000155110774040205026604 0ustar charlescharles/* * $Id: BloodOrange.java 11516 2008-03-31 01:38:13Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import org.mule.api.MuleException; import java.util.HashMap; /** * A specialisation of Orange */ public class BloodOrange extends Orange { public BloodOrange() { } public BloodOrange(HashMap props) throws MuleException { super(props); } public BloodOrange(Integer segments, Double radius, String brand) { super(segments, radius, brand); } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/Apple.java0000644000175000017500000000537710754365306025476 0ustar charlescharles/* * $Id: Apple.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import org.mule.api.MuleException; import org.mule.api.MuleEventContext; import org.mule.api.lifecycle.Callable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class Apple implements Fruit, Callable { /** * Serial version */ private static final long serialVersionUID = -7631993371500076921L; /** * logger used by this class */ private static final Log logger = LogFactory.getLog(Apple.class); private boolean bitten = false; private boolean washed = false; private FruitCleaner cleaner; public void wash() { if (cleaner != null) { cleaner.wash(this); } washed = true; } public void polish() { cleaner.polish(this); } public boolean isWashed() { return washed; } public void bite() { bitten = true; } public boolean isBitten() { return bitten; } public Object onCall(MuleEventContext context) throws MuleException { logger.debug("Apple received an event in UMOCallable.onEvent! MuleEvent says: " + context.getMessageAsString()); wash(); return null; } public FruitCleaner getAppleCleaner() { return cleaner; } public void setAppleCleaner(FruitCleaner cleaner) { this.cleaner = cleaner; } public Object methodReturningNull() { return null; } public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final Apple apple = (Apple) o; if (bitten != apple.bitten) { return false; } if (washed != apple.washed) { return false; } return true; } public int hashCode() { int result; result = (bitten ? 1 : 0); result = 29 * result + (washed ? 1 : 0); return result; } public String toString() { return "Just an apple."; } public void setBitten(boolean bitten) { this.bitten = bitten; } public void setWashed(boolean washed) { this.washed = washed; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/FruitBowl.java0000644000175000017500000000552710764745332026351 0ustar charlescharles/* * $Id: FruitBowl.java 11283 2008-03-09 11:32:42Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class FruitBowl { /** logger used by this class */ private static final Log logger = LogFactory.getLog(FruitBowl.class); private final Map bowl = Collections.synchronizedMap(new HashMap()); public FruitBowl() { super(); } public FruitBowl(Fruit fruit[]) { for (int i = 0; i < fruit.length; i++) { bowl.put(fruit[i].getClass(), fruit[i]); } } public FruitBowl(Apple apple, Banana banana) { bowl.put(Apple.class, apple); bowl.put(Banana.class, banana); } public boolean hasApple() { return bowl.get(Apple.class) != null; } public boolean hasBanana() { return bowl.get(Banana.class) != null; } public Fruit[] addAppleAndBanana(Apple apple, Banana banana) { bowl.put(Apple.class, apple); bowl.put(Banana.class, banana); return new Fruit[]{apple, banana}; } public Fruit[] addBananaAndApple(Banana banana, Apple apple) { bowl.put(Apple.class, apple); bowl.put(Banana.class, banana); return new Fruit[]{banana, apple}; } public List getFruit() { return new ArrayList(bowl.values()); } public Object consumeFruit(FruitLover fruitlover) { logger.debug("Got a fruit lover who says: " + fruitlover.speak()); for (Iterator iter = bowl.values().iterator(); iter.hasNext();) { ((Fruit) iter.next()).bite(); } return fruitlover; } public void setFruit(Fruit[] fruit) { for (int i = 0; i < fruit.length; i++) { bowl.put(fruit[i].getClass(), fruit[i]); } } public void setFruit(List fruit) { this.setFruit((Fruit[]) fruit.toArray(new Fruit[fruit.size()])); } public Apple getApple() { return (Apple) bowl.get(Apple.class); } public void setApple(Apple apple) { bowl.put(Apple.class, apple); } public Banana getBanana() { return (Banana) bowl.get(Banana.class); } public void setBanana(Banana banana) { bowl.put(Banana.class, banana); } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/WaterMelon.java0000644000175000017500000000725310774254333026504 0ustar charlescharles/* * $Id: WaterMelon.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.lifecycle.Disposable; import org.mule.api.lifecycle.Startable; import org.mule.api.lifecycle.Stoppable; import java.util.HashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class WaterMelon implements Fruit, Startable, Stoppable, Disposable { /** * Serial version */ private static final long serialVersionUID = -8860598811203869100L; /** * logger used by this class */ private static final Log logger = LogFactory.getLog(WaterMelon.class); private boolean bitten = false; private Integer seeds = new Integer(100); private Double radius = new Double(4.34); private String brand; private String state = "void"; public WaterMelon() { super(); } public WaterMelon(HashMap props) throws MuleException { logger.info("Initialisaing Water melon with hashmap constructor"); setBrand((String) props.get("namespace.brand")); setRadius((Double) props.get("another.namespace.radius")); setSeeds((Integer) props.get("seeds")); state = "initialised"; } public void bite() { bitten = true; } public boolean isBitten() { return bitten; } public void myEventHandler(MuleEvent event) throws MuleException { logger.debug("Water Melon received an event in MyEventHandler! MuleEvent says: " + event.getMessageAsString()); bite(); } /** * @return */ public String getBrand() { return brand; } /** * @return */ public Integer getSeeds() { return seeds; } /** * @return */ public Double getRadius() { return radius; } /** * @param string */ public void setBrand(String string) { brand = string; } /** * @param integer */ public void setSeeds(Integer integer) { seeds = integer; } /** * @param double1 */ public void setRadius(Double double1) { radius = double1; } public String getState() { return state; } public void start() { state = "started"; } public void stop() { state = "stopped"; } public void dispose() { state = "disposed"; } /* * (non-Javadoc) * * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { if (obj instanceof WaterMelon) { WaterMelon melon = (WaterMelon) obj; return (getBrand().equals(melon.getBrand()) && getRadius().equals(melon.getRadius()) && getSeeds().equals(melon.getSeeds()) && getState().equals(getState())); } return super.equals(obj); } public int hashCode () { int result; result = (bitten ? 1 : 0); result = 31 * result + seeds.hashCode(); result = 31 * result + radius.hashCode(); result = 31 * result + (brand != null ? brand.hashCode() : 0); result = 31 * result + state.hashCode(); return result; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/fruit/Kiwi.java0000644000175000017500000000220110754365306025317 0ustar charlescharles/* * $Id: Kiwi.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.fruit; import org.mule.api.MuleEventContext; /** * A test object not implementing Callable, but having a matching method accepting * MuleEventContext. */ public class Kiwi implements Fruit { /** * Serial version */ private static final long serialVersionUID = -1468423665948468954L; private boolean bitten; public void handle(MuleEventContext eventContext) throws Exception { final Object payload = eventContext.transformMessage(); if (payload instanceof FruitLover) { this.bite(); } } public void bite() { this.bitten = true; } public boolean isBitten() { return this.bitten; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/0000755000175000017500000000000011351411070023347 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestCompressionTransformer.java0000644000175000017500000000413110754365306031615 0ustar charlescharles/* * $Id: TestCompressionTransformer.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.transformer.TransformerException; import org.mule.transformer.compression.AbstractCompressionTransformer; import org.mule.util.compression.GZipCompression; public class TestCompressionTransformer extends AbstractCompressionTransformer { private String beanProperty1; private String containerProperty; private int beanProperty2; public TestCompressionTransformer() { super(); this.setStrategy(new GZipCompression()); } public Object doTransform(Object src, String encoding) throws TransformerException { return null; } public String getBeanProperty1() { return beanProperty1; } public void setBeanProperty1(String beanProperty1) { this.beanProperty1 = beanProperty1; } public int getBeanProperty2() { return beanProperty2; } public void setBeanProperty2(int beanProperty2) { this.beanProperty2 = beanProperty2; } public String getContainerProperty() { return containerProperty; } public void setContainerProperty(String containerProperty) { this.containerProperty = containerProperty; } /* * (non-Javadoc) * * @see java.lang.Object#clone() ensures that isn't not cloned before all * properties have been set on it */ public Object clone() throws CloneNotSupportedException { if (containerProperty == null) { throw new IllegalStateException( "Transformer cannot be cloned until all properties have been set on it"); } return super.clone(); } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestSedaService.java0000644000175000017500000000126610766654216027300 0ustar charlescharles/* * $Id: TestSedaService.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.model.seda.SedaService; /** * Exposes some internals of the SedaService useful for unit testing. */ public class TestSedaService extends SedaService { public TestSedaService() { super(); } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestMessageDispatcher.java0000644000175000017500000000317410757615756030504 0ustar charlescharles/* * $Id: TestMessageDispatcher.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.RoutingException; import org.mule.transport.AbstractMessageDispatcher; public class TestMessageDispatcher extends AbstractMessageDispatcher { public TestMessageDispatcher(final OutboundEndpoint endpoint) { super(endpoint); } protected void doDispose() { // template method } protected void doDispatch(MuleEvent event) throws Exception { if (event.getEndpoint().getEndpointURI().toString().equals("test://AlwaysFail")) { throw new RoutingException(event.getMessage(), event.getEndpoint()); } } protected MuleMessage doSend(MuleEvent event) throws Exception { if (event.getEndpoint().getEndpointURI().toString().equals("test://AlwaysFail")) { throw new RoutingException(event.getMessage(), event.getEndpoint()); } return event.getMessage(); } protected void doConnect() throws Exception { // no op } protected void doDisconnect() throws Exception { // no op } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestAgent.java0000644000175000017500000000320410774254333026126 0ustar charlescharles/* * $Id: TestAgent.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.MuleException; import org.mule.api.agent.Agent; import org.mule.api.lifecycle.InitialisationException; import java.util.Collections; import java.util.List; /** * Mock agent */ public class TestAgent implements Agent { private String frobbit; public String getName() { return "Test Agent"; } public void setName(String name) { // nothing to do } public String getDescription() { return "Test JMX Agent"; } public void initialise() throws InitialisationException { // nothing to do } public void start() throws MuleException { // nothing to do } public void stop() throws MuleException { // nothing to do } public void dispose() { // nothing to do } public void registered() { // nothing to do } public void unregistered() { // nothing to do } public List getDependentAgents() { return Collections.EMPTY_LIST; } public String getFrobbit() { return frobbit; } public void setFrobbit(String frobbit) { this.frobbit = frobbit; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestMessageDispatcherFactory.java0000644000175000017500000000210510757615756032025 0ustar charlescharles/* * $Id: TestMessageDispatcherFactory.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; import org.mule.transport.AbstractMessageDispatcherFactory; /** * A Test message dispatcher factory that is used for testing configuration loading since "test://" * endpoints can be used instead of bringing in other dependencies into Mule core */ public class TestMessageDispatcherFactory extends AbstractMessageDispatcherFactory { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new TestMessageDispatcher(endpoint); } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestOutboundTransformer.java0000644000175000017500000000140210754365306031111 0ustar charlescharles/* * $Id: TestOutboundTransformer.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; public class TestOutboundTransformer extends AbstractTransformer { protected Object doTransform(Object src, String encoding) throws TransformerException { return src; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestInboundTransformer.java0000644000175000017500000000140010754365306030706 0ustar charlescharles/* * $Id: TestInboundTransformer.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; public class TestInboundTransformer extends AbstractTransformer { protected Object doTransform(Object src, String encoding) throws TransformerException { return src; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestResponseAggregator.java0000644000175000017500000000137010777661265030704 0ustar charlescharles/* * $Id: TestResponseAggregator.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.routing.response.ResponseCorrelationAggregator; /** * TestResponseAggregator is a mock response Agrregator object used * for testing configuration * */ public class TestResponseAggregator extends ResponseCorrelationAggregator { // nothing to do } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestTransaction.java0000644000175000017500000000371310770773146027366 0ustar charlescharles/* * $Id: TestTransaction.java 11468 2008-03-21 17:54:46Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.transaction.TransactionException; import org.mule.transaction.AbstractSingleResourceTransaction; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; /** * A test transaction that does nothing on commit or rollback. The transaction does retain a status so that * developers can determine if the the transaction was rolled back or committed. */ public class TestTransaction extends AbstractSingleResourceTransaction { private AtomicBoolean committed = new AtomicBoolean(false); private AtomicBoolean rolledBack = new AtomicBoolean(false); /** * Really begin the transaction. Note that resources are enlisted yet. * * @throws org.mule.api.transaction.TransactionException * */ protected void doBegin() throws TransactionException { //do nothing } /** * Commit the transaction on the underlying resource * * @throws org.mule.api.transaction.TransactionException * */ protected void doCommit() throws TransactionException { committed.set(true); } /** * Rollback the transaction on the underlying resource * * @throws org.mule.api.transaction.TransactionException * */ protected void doRollback() throws TransactionException { rolledBack.set(true); } // public boolean isCommitted() // { // return committed.get(); // } // // public boolean isRolledBack() // { // return rolledBack.get(); // } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestDefaultLifecycleAdapter.java0000644000175000017500000000263210766654216031606 0ustar charlescharles/* * $Id: TestDefaultLifecycleAdapter.java 11373 2008-03-15 05:03:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.MuleException; import org.mule.api.component.JavaComponent; import org.mule.api.model.EntryPointResolverSet; import org.mule.component.DefaultLifecycleAdapter; /** TestDefaultLifecycleAdapter TODO document */ public class TestDefaultLifecycleAdapter extends DefaultLifecycleAdapter { /** * @param service * @param descriptor * @throws MuleException */ public TestDefaultLifecycleAdapter(Object pojoService, JavaComponent service) throws MuleException { super(pojoService, service); } /** * @param service * @param descriptor * @param epResolver * @throws MuleException */ public TestDefaultLifecycleAdapter(Object pojoService, JavaComponent service, EntryPointResolverSet epResolver) throws MuleException { super(pojoService, service, epResolver); } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestConnector2.java0000644000175000017500000000120310754365306027102 0ustar charlescharles/* * $Id: TestConnector2.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; /** * TestConnector use a mock connector */ public class TestConnector2 extends TestConnector { public String getProtocol() { return "test2"; } }mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestResponseTransformer.java0000644000175000017500000000140210754365306031110 0ustar charlescharles/* * $Id: TestResponseTransformer.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.transformer.TransformerException; import org.mule.transformer.AbstractTransformer; public class TestResponseTransformer extends AbstractTransformer { protected Object doTransform(Object src, String encoding) throws TransformerException { return src; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestConnector.java0000644000175000017500000001100310770575334027021 0ustar charlescharles/* * $Id: TestConnector.java 11459 2008-03-21 00:01:32Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.MessagingException; import org.mule.api.MuleException; import org.mule.api.ThreadSafeAccess; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.api.service.Service; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.MessageDispatcher; import org.mule.api.transport.MessageReceiver; import org.mule.transport.AbstractConnector; import org.mule.transport.AbstractMessageAdapter; import org.mule.transport.AbstractMessageDispatcherFactory; import org.mule.transport.AbstractMessageReceiver; /** * TestConnector use a mock connector */ public class TestConnector extends AbstractConnector { public static final String TEST = "test"; private String someProperty; public TestConnector() { super(); setDispatcherFactory(new AbstractMessageDispatcherFactory() { public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new TestMessageDispatcher(endpoint); } }); } protected void doInitialise() throws InitialisationException { // template method } protected void doDispose() { // template method } protected void doConnect() throws Exception { // template method } protected void doDisconnect() throws Exception { // template method } protected void doStart() throws MuleException { // template method } protected void doStop() throws MuleException { // template method } public String getProtocol() { return TEST; } public MessageAdapter getMessageAdapter(Object message) throws MessagingException { return new DummyMessageAdapter(message); } public String getSomeProperty() { return someProperty; } public void setSomeProperty(String someProperty) { this.someProperty = someProperty; } public MessageReceiver createReceiver(Service service, InboundEndpoint endpoint) throws Exception { MessageReceiver receiver = new AbstractMessageReceiver(this, service, endpoint) { protected void doInitialise() throws InitialisationException { //nothing to do } protected void doConnect() throws Exception { // nothing to do } protected void doDisconnect() throws Exception { // nothing to do } protected void doStart() throws MuleException { // nothing to do } protected void doStop() throws MuleException { // nothing to do } protected void doDispose() { // nothing to do } }; return receiver; } public void destroyReceiver(MessageReceiver receiver, InboundEndpoint endpoint) throws Exception { // nothing to do } public class DummyMessageAdapter extends AbstractMessageAdapter { /** * Serial version */ private static final long serialVersionUID = -2304322766342059136L; private Object message = new String("DummyMessage"); public DummyMessageAdapter(Object message) { this.message = message; } public Object getPayload() { return message; } public byte[] getPayloadAsBytes() throws Exception { return message.toString().getBytes(); } public String getPayloadAsString(String encoding) throws Exception { return message.toString(); } public void setPayload(Object payload) { this.message = payload; } public ThreadSafeAccess newThreadCopy() { return this; } } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestExceptionStrategy.java0000644000175000017500000000200610754365306030551 0ustar charlescharles/* * $Id: TestExceptionStrategy.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.DefaultExceptionStrategy; /** * TestExceptionStrategy is used by the Mule test cases as a direct replacement of the {@link org.mule.DefaultExceptionStrategy} * This is used to test that overriding the default Exception strategy works */ public class TestExceptionStrategy extends DefaultExceptionStrategy { private String testProperty; public String getTestProperty() { return testProperty; } public void setTestProperty(String testProperty) { this.testProperty = testProperty; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestEntryPointResolverSet.java0000644000175000017500000000301510754365306031402 0ustar charlescharles/* * $Id: TestEntryPointResolverSet.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.MuleEventContext; import org.mule.api.model.EntryPointResolver; import org.mule.api.model.EntryPointResolverSet; /** * TestEntryPointResolver is a test EntryPointResolver that doesn't provide * any functionality. It is usually used to test confguration options */ public class TestEntryPointResolverSet implements EntryPointResolverSet { /** * Will add a resolver to the list of resolvers to invoke on a compoent. * Implementations must maintain an ordered list of resolvers * * @param resolver the resolver to add */ public void addEntryPointResolver(EntryPointResolver resolver) { } public Object invoke(Object component, MuleEventContext context) throws Exception { return null; } /** * Removes a resolver from the list * * @param resolver the resolver to remove * @return true if the resolver was found and removed from the list */ public boolean removeEntryPointResolver(EntryPointResolver resolver) { return false; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestTransactionFactory.java0000644000175000017500000000235310777661265030722 0ustar charlescharles/* * $Id: TestTransactionFactory.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.MuleContext; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionException; import org.mule.api.transaction.TransactionFactory; /** * TestTransactionFactory creates a {@link org.mule.tck.testmodels.mule.TestTransaction} * */ public class TestTransactionFactory implements TransactionFactory { // for testsing properties private String value; public Transaction beginTransaction(MuleContext muleContext) throws TransactionException { return new TestTransaction(); } public boolean isTransacted() { return true; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestDefaultLifecycleAdapterFactory.java0000644000175000017500000000244710767355640033142 0ustar charlescharles/* * $Id: TestDefaultLifecycleAdapterFactory.java 11379 2008-03-17 02:46:56Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.MuleException; import org.mule.api.component.JavaComponent; import org.mule.api.component.LifecycleAdapter; import org.mule.api.component.LifecycleAdapterFactory; import org.mule.api.model.EntryPointResolverSet; public class TestDefaultLifecycleAdapterFactory implements LifecycleAdapterFactory { public TestDefaultLifecycleAdapterFactory() { super(); } /* * (non-Javadoc) * * @see org.mule.api.lifecycle.LifecycleAdapterFactory#create(java.lang.Object, * org.mule.api.UMODescriptor, org.mule.api.model.EntryPointResolver) */ public LifecycleAdapter create(Object pojoService, JavaComponent service, EntryPointResolverSet resolver) throws MuleException { return new TestDefaultLifecycleAdapter(pojoService, service, resolver); } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestCatchAllStrategy.java0000644000175000017500000000240510757615756030303 0ustar charlescharles/* * $Id: TestCatchAllStrategy.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.RouterCatchAllStrategy; import org.mule.api.routing.RoutingException; import org.mule.util.StringMessageUtils; public class TestCatchAllStrategy implements RouterCatchAllStrategy { private OutboundEndpoint endpoint; public void setEndpoint(OutboundEndpoint endpoint) { this.endpoint = endpoint; } public OutboundEndpoint getEndpoint() { return endpoint; } public MuleMessage catchMessage(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { System.out.println(StringMessageUtils.getBoilerPlate("Caught an event in the router!", '*', 40)); return null; } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestMuleProxy.java0000644000175000017500000000200210767256152027032 0ustar charlescharles/* * $Id: TestMuleProxy.java 11376 2008-03-16 17:44:10Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.MuleException; import org.mule.api.object.ObjectFactory; import org.mule.component.DefaultJavaComponent; /** * Makes the underlying POJO service object available for unit testing. */ public class TestMuleProxy extends DefaultJavaComponent { public TestMuleProxy(ObjectFactory objectFactory) throws MuleException { super(objectFactory); } /** Returns the underlying POJO service object for unit testing. */ public Object getPojoService() throws Exception { return objectFactory.getInstance(); } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestDependentObject.java0000644000175000017500000000210410754365306030124 0ustar charlescharles/* * $Id: TestDependentObject.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.api.config.PropertyFactory; import org.mule.tck.testmodels.fruit.Orange; import java.util.Map; /** * TestDependentObject is used as a mock dependency for an object */ public class TestDependentObject implements PropertyFactory { public Object create(Map properties) throws Exception { // make sure that both test properties are set here if (properties.get("test1") == null || properties.get("test2") == null) { throw new Exception("Both properties should be set before the factory method is called"); } return new Orange(); } } mule-2.0.1/core/src/test/java/org/mule/tck/testmodels/mule/TestTransactionManagerFactory.java0000644000175000017500000000316610774254333032207 0ustar charlescharles/* * $Id: TestTransactionManagerFactory.java 11517 2008-03-31 21:34:19Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck.testmodels.mule; import org.mule.transaction.lookup.GenericTransactionManagerLookupFactory; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import javax.transaction.TransactionManager; /** * TestTransactionManagerFactory TODO */ public class TestTransactionManagerFactory extends GenericTransactionManagerLookupFactory { public TransactionManager create() throws Exception { return (TransactionManager) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {TransactionManager.class}, new InternalInvocationHandler()); } public void initialise() { // shortcut super's implementation } public class InternalInvocationHandler implements InvocationHandler { public TestTransactionManagerFactory getParent() { return TestTransactionManagerFactory.this; } public Object invoke (Object proxy, Method method, Object[] args) throws Throwable { return null; } } } mule-2.0.1/core/src/test/java/org/mule/tck/AbstractTxThreadAssociationTestCase.java0000644000175000017500000002631710754365306030156 0ustar charlescharles/* * $Id: AbstractTxThreadAssociationTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tck; import org.mule.DefaultExceptionStrategy; import org.mule.api.transaction.TransactionCallback; import org.mule.api.transaction.TransactionConfig; import org.mule.api.transaction.TransactionManagerFactory; import org.mule.transaction.MuleTransactionConfig; import org.mule.transaction.TransactionTemplate; import org.mule.transaction.XaTransaction; import org.mule.transaction.XaTransactionFactory; import javax.transaction.Status; import javax.transaction.Transaction; import javax.transaction.TransactionManager; /** * Validate certain expectations when working with JTA API. It is called to catch discrepancies in TM implementations * and alert early. Subclasses are supposed to plug in specific transaction managers for tests. */ public abstract class AbstractTxThreadAssociationTestCase extends AbstractMuleTestCase { /* To allow access from the dead TX threads we spawn. */ private TransactionManager tm; protected static final int TRANSACTION_TIMEOUT_SECONDS = 3; protected void doSetUp() throws Exception { super.doSetUp(); TransactionManagerFactory factory = getTransactionManagerFactory(); tm = factory.create(); assertNotNull("Transaction Manager should be available.", tm); assertNull("There sould be no current transaction associated.", tm.getTransaction()); } public void testTxHandleCommitKeepsThreadAssociation() throws Exception { // don't wait for ages, has to be set before TX is begun tm.setTransactionTimeout(TRANSACTION_TIMEOUT_SECONDS); tm.begin(); Transaction tx = tm.getTransaction(); assertNotNull("Transaction should have started.", tx); assertEquals("TX should have been active", Status.STATUS_ACTIVE, tx.getStatus()); tx.commit(); tx = tm.getTransaction(); assertNotNull("Committing via TX handle should NOT disassociated TX from the current thread.", tx); assertEquals("TX status should have been COMMITTED.", Status.STATUS_COMMITTED, tx.getStatus()); // Remove the TX-thread association. The only public API to achieve it is suspend(), // technically we never resume the same transaction (TX forget). Transaction suspended = tm.suspend(); assertTrue("Wrong TX suspended?.", suspended.equals(tx)); assertNull("TX should've been disassociated from the thread.", tm.getTransaction()); // should be no-op and never fail tm.resume(null); // ensure we don't have any TX-Thread association lurking around a main thread assertNull(tm.getTransaction()); } public void testTxManagerCommitDissassociatesThread() throws Exception { // don't wait for ages, has to be set before TX is begun tm.setTransactionTimeout(TRANSACTION_TIMEOUT_SECONDS); tm.begin(); Transaction tx = tm.getTransaction(); assertNotNull("Transaction should have started.", tx); assertEquals("TX should have been active", Status.STATUS_ACTIVE, tx.getStatus()); tm.commit(); assertNull("Committing via TX Manager should have disassociated TX from the current thread.", tm.getTransaction()); } public void testTxManagerRollbackDissassociatesThread() throws Exception { // don't wait for ages, has to be set before TX is begun tm.setTransactionTimeout(TRANSACTION_TIMEOUT_SECONDS); tm.begin(); Transaction tx = tm.getTransaction(); assertNotNull("Transaction should have started.", tx); assertEquals("TX should have been active", Status.STATUS_ACTIVE, tx.getStatus()); tm.rollback(); assertNull("Committing via TX Manager should have disassociated TX from the current thread.", tm.getTransaction()); } /** * AlwaysBegin action suspends current transaction and begins a new one. * * @throws Exception if any error */ public void testAlwaysBeginXaTransactionSuspendResume() throws Exception { muleContext.setTransactionManager(tm); assertNull("There sould be no current transaction associated.", tm.getTransaction()); // don't wait for ages, has to be set before TX is begun tm.setTransactionTimeout(TRANSACTION_TIMEOUT_SECONDS); // this is one component with a TX always begin TransactionConfig config = new MuleTransactionConfig(); config.setFactory(new XaTransactionFactory()); config.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN); TransactionTemplate template = new TransactionTemplate(config, new DefaultExceptionStrategy(),muleContext); // and the callee component which should begin new transaction, current must be suspended final TransactionConfig nestedConfig = new MuleTransactionConfig(); nestedConfig.setFactory(new XaTransactionFactory()); nestedConfig.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN); // start the call chain template.execute(new TransactionCallback() { public Object doInTransaction() throws Exception { // the callee executes within its own TX template, but uses the same global XA transaction, // bound to the current thread of execution via a ThreadLocal TransactionTemplate nestedTemplate = new TransactionTemplate(nestedConfig, new DefaultExceptionStrategy(),muleContext); final Transaction firstTx = tm.getTransaction(); assertNotNull(firstTx); assertEquals(firstTx.getStatus(), Status.STATUS_ACTIVE); return nestedTemplate.execute(new TransactionCallback() { public Object doInTransaction() throws Exception { Transaction secondTx = tm.getTransaction(); assertNotNull(secondTx); assertEquals(firstTx.getStatus(), Status.STATUS_ACTIVE); assertEquals(secondTx.getStatus(), Status.STATUS_ACTIVE); try { tm.resume(firstTx); fail("Second transaction must be active"); } catch (java.lang.IllegalStateException e) { // expected //Thrown if the thread is already associated with another transaction. //Second tx is associated with the current thread } try { Transaction currentTx = tm.suspend(); assertTrue(currentTx.equals(secondTx)); tm.resume(firstTx); assertEquals(firstTx, tm.getTransaction()); assertEquals(firstTx.getStatus(), Status.STATUS_ACTIVE); assertEquals(secondTx.getStatus(), Status.STATUS_ACTIVE); Transaction a = tm.suspend(); assertTrue(a.equals(firstTx)); tm.resume(secondTx); } catch (Exception e) { fail("Error: " + e); } // do not care about the return really return null; } }); } }); assertNull("Committing via TX Manager should have disassociated TX from the current thread.", tm.getTransaction()); } /** * This is a former XaTransactionTestCase. * * @throws Exception in case of any error */ public void testXaTransactionTermination() throws Exception { muleContext.setTransactionManager(tm); assertNull("There sould be no current transaction associated.", tm.getTransaction()); // don't wait for ages, has to be set before TX is begun tm.setTransactionTimeout(TRANSACTION_TIMEOUT_SECONDS); XaTransaction muleTx = new XaTransaction(tm); assertFalse(muleTx.isBegun()); assertEquals(Status.STATUS_NO_TRANSACTION, muleTx.getStatus()); muleTx.begin(); assertTrue(muleTx.isBegun()); muleTx.commit(); Transaction jtaTx = tm.getTransaction(); assertNull("Committing via TX Manager should have disassociated TX from the current thread.", jtaTx); assertEquals(Status.STATUS_NO_TRANSACTION, muleTx.getStatus()); } /** * This is a former TransactionTemplateTestCase. * http://mule.mulesource.org/jira/browse/MULE-1494 * * @throws Exception in case of any error */ public void testNoNestedTxStarted() throws Exception { muleContext.setTransactionManager(tm); assertNull("There sould be no current transaction associated.", tm.getTransaction()); // don't wait for ages, has to be set before TX is begun tm.setTransactionTimeout(TRANSACTION_TIMEOUT_SECONDS); // this is one service with a TX always begin TransactionConfig config = new MuleTransactionConfig(); config.setFactory(new XaTransactionFactory()); config.setAction(TransactionConfig.ACTION_ALWAYS_BEGIN); TransactionTemplate template = new TransactionTemplate(config, new DefaultExceptionStrategy(), muleContext); // and the callee service which should join the current XA transaction, not begin a nested one final TransactionConfig nestedConfig = new MuleTransactionConfig(); nestedConfig.setFactory(new XaTransactionFactory()); nestedConfig.setAction(TransactionConfig.ACTION_BEGIN_OR_JOIN); // start the call chain template.execute(new TransactionCallback() { public Object doInTransaction() throws Exception { // the callee executes within its own TX template, but uses the same global XA transaction, // bound to the current thread of execution via a ThreadLocal TransactionTemplate nestedTemplate = new TransactionTemplate(nestedConfig, new DefaultExceptionStrategy(), muleContext); return nestedTemplate.execute(new TransactionCallback() { public Object doInTransaction() throws Exception { // do not care about the return really return null; } }); } }); } protected TransactionManager getTransactionManager() { return tm; } protected abstract TransactionManagerFactory getTransactionManagerFactory(); } mule-2.0.1/core/src/test/java/org/mule/MuleTransactionConfigTestCase.java0000644000175000017500000000300610745677442026224 0ustar charlescharles/* * $Id:MuleTransactionConfigTestCase.java 7383 2007-07-07 22:21:30Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.tck.AbstractMuleTestCase; import org.mule.transaction.MuleTransactionConfig; public class MuleTransactionConfigTestCase extends AbstractMuleTestCase { public void testActionAndStringConversion() { MuleTransactionConfig c = new MuleTransactionConfig(); c.setAction(MuleTransactionConfig.ACTION_ALWAYS_BEGIN); assertEquals(MuleTransactionConfig.ACTION_ALWAYS_BEGIN_STRING, c.getActionAsString()); c.setAction(MuleTransactionConfig.ACTION_ALWAYS_JOIN); assertEquals(MuleTransactionConfig.ACTION_ALWAYS_JOIN_STRING, c.getActionAsString()); c.setAction(MuleTransactionConfig.ACTION_BEGIN_OR_JOIN); assertEquals(MuleTransactionConfig.ACTION_BEGIN_OR_JOIN_STRING, c.getActionAsString()); c.setAction(MuleTransactionConfig.ACTION_JOIN_IF_POSSIBLE); assertEquals(MuleTransactionConfig.ACTION_JOIN_IF_POSSIBLE_STRING, c.getActionAsString()); c.setAction(MuleTransactionConfig.ACTION_NONE); assertEquals(MuleTransactionConfig.ACTION_NONE_STRING, c.getActionAsString()); } } mule-2.0.1/core/src/test/java/org/mule/registry/0000755000175000017500000000000011351411076021317 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/registry/TransformerCachingTestCase.java0000644000175000017500000000510610745677442027420 0ustar charlescharles/* * $Id: TransformerCachingTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.registry; import org.mule.api.transformer.DiscoverableTransformer; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.tck.AbstractMuleTestCase; import org.mule.transformer.AbstractTransformer; import org.mule.transformer.simple.ObjectToByteArray; import java.io.FilterInputStream; import java.io.InputStream; public class TransformerCachingTestCase extends AbstractMuleTestCase { public void testCacheUpdate() throws Exception { Transformer trans = muleContext.getRegistry().lookupTransformer(FilterInputStream.class, byte[].class); assertNotNull(trans); assertTrue(trans instanceof ObjectToByteArray); Transformer trans2 = new FilterInputStreamToByteArray(); muleContext.getRegistry().registerTransformer(trans2); trans = muleContext.getRegistry().lookupTransformer(FilterInputStream.class, byte[].class); assertNotNull(trans); assertTrue(trans instanceof FilterInputStreamToByteArray); trans = muleContext.getRegistry().lookupTransformer(InputStream.class, byte[].class); assertNotNull(trans); assertTrue(trans instanceof ObjectToByteArray); muleContext.getRegistry().unregisterTransformer(trans2.getName()); trans = muleContext.getRegistry().lookupTransformer(FilterInputStream.class, byte[].class); assertNotNull(trans); assertTrue(trans instanceof ObjectToByteArray); } public static class FilterInputStreamToByteArray extends AbstractTransformer implements DiscoverableTransformer { public FilterInputStreamToByteArray() { registerSourceType(FilterInputStream.class); setReturnClass(byte[].class); } protected Object doTransform(Object src, String encoding) throws TransformerException { throw new UnsupportedOperationException("This is a transformer only to be used for testing"); } public int getPriorityWeighting() { return 0; } public void setPriorityWeighting(int weighting) { //no-op } } } mule-2.0.1/core/src/test/java/org/mule/registry/RequestContextTestCase.java0000644000175000017500000001363711001634510026615 0ustar charlescharles/* * $Id: RequestContextTestCase.java 11585 2008-04-17 11:49:28Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.registry; import org.mule.DefaultMuleMessage; import org.mule.OptimizedRequestContext; import org.mule.RequestContext; import org.mule.api.MuleContext; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.ThreadSafeAccess; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.security.Credentials; import org.mule.api.service.Service; import org.mule.api.transformer.TransformerException; import org.mule.message.DefaultExceptionPayload; import org.mule.tck.AbstractMuleTestCase; import java.io.OutputStream; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean; public class RequestContextTestCase extends AbstractMuleTestCase { private boolean threadSafeEvent; public void testSetExceptionPayloadAcrossThreads() throws InterruptedException { threadSafeEvent = true; MuleEvent event = new DummyEvent(); runThread(event, false); runThread(event, true); } public void testFailureWithoutThreadSafeEvent() throws InterruptedException { threadSafeEvent = false; MuleEvent event = new DummyEvent(); runThread(event, false); runThread(event, true); } protected void runThread(MuleEvent event, boolean doTest) throws InterruptedException { AtomicBoolean success = new AtomicBoolean(false); Thread thread = new Thread(new SetExceptionPayload(event, success)); thread.start(); thread.join(); if (doTest) { assertEquals(threadSafeEvent, success.get()); } } private class SetExceptionPayload implements Runnable { private MuleEvent event; private AtomicBoolean success; public SetExceptionPayload(MuleEvent event, AtomicBoolean success) { this.event = event; this.success = success; } public void run() { try { OptimizedRequestContext.unsafeSetEvent(event); RequestContext.setExceptionPayload(new DefaultExceptionPayload(new Exception())); success.set(true); } catch (RuntimeException e) { logger.error("error in thread", e); } } } private class DummyEvent implements MuleEvent, ThreadSafeAccess { private MuleMessage message = new DefaultMuleMessage(null); public MuleMessage getMessage() { return message; } public Credentials getCredentials() { return null; } public byte[] getMessageAsBytes() throws MuleException { return new byte[0]; } public Object transformMessage() throws TransformerException { return null; } public Object transformMessage(Class outputType) throws TransformerException { return null; } public byte[] transformMessageToBytes() throws TransformerException { return new byte[0]; } public String transformMessageToString() throws TransformerException { return null; } public String getMessageAsString() throws MuleException { return null; } public String getTransformedMessageAsString(String encoding) throws TransformerException { return null; } public String getMessageAsString(String encoding) throws MuleException { return null; } public String getId() { return null; } public Object getProperty(String name, boolean exhaustiveSearch) { return null; } public Object getProperty(String name, Object defaultValue, boolean exhaustiveSearch) { return null; } public ImmutableEndpoint getEndpoint() { return null; } public MuleSession getSession() { return null; } public Service getService() { return null; } public boolean isStopFurtherProcessing() { return false; } public void setStopFurtherProcessing(boolean stopFurtherProcessing) { // no action } public boolean isSynchronous() { return false; } public void setSynchronous(boolean value) { // no action } public int getTimeout() { return 0; } public void setTimeout(int timeout) { // no action } public OutputStream getOutputStream() { return null; } public String getEncoding() { return null; } public MuleContext getMuleContext() { return null; } public void assertAccess(boolean write) { // no action } public void resetAccessControl() { // no action } public ThreadSafeAccess newThreadCopy() { if (threadSafeEvent) { return new DummyEvent(); } else { return this; } } } } mule-2.0.1/core/src/test/java/org/mule/registry/DuplicateRegistrationTestCase.java0000644000175000017500000000330210761043432030122 0ustar charlescharles/* * $Id: DuplicateRegistrationTestCase.java 11035 2008-02-26 17:06:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.registry; import org.mule.api.registry.RegistrationException; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.StringUtils; import java.util.Collection; public class DuplicateRegistrationTestCase extends AbstractMuleTestCase { public void testComponentAlreadyDefinedThrowsException() throws Exception { Collection components = muleContext.getRegistry().lookupServices(); assertEquals(0, components.size()); final String componentName = "TEST_COMPONENT_1"; getTestService(componentName, Object.class); components = muleContext.getRegistry().lookupServices(); assertEquals(1, components.size()); // register it again with the same name try { getTestService(componentName, Object.class); fail("Trying to register a service with the same name must have thrown an exception."); } catch (RegistrationException e) { // expected assertTrue("Exception message should contain service name", StringUtils.contains(e.getMessage(), componentName)); } components = muleContext.getRegistry().lookupServices(); assertEquals(1, components.size()); } } mule-2.0.1/core/src/test/java/org/mule/DefaultExceptionStrategyTestCase.java0000644000175000017500000000600710745677442026760 0ustar charlescharles/* * $Id: DefaultExceptionStrategyTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.context.notification.ExceptionNotificationListener; import org.mule.api.context.notification.ServerNotification; import org.mule.context.notification.ExceptionNotification; import org.mule.tck.AbstractMuleTestCase; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; public class DefaultExceptionStrategyTestCase extends AbstractMuleTestCase { // MULE-1404 public void testExceptions() throws Exception { InstrumentedExceptionStrategy strategy = new InstrumentedExceptionStrategy(); strategy.setMuleContext(muleContext); strategy.exceptionThrown(new IllegalArgumentException("boom")); assertEquals(1, strategy.getCount()); } // MULE-1627 public void testExceptionNotifications() throws Exception { final CountDownLatch latch = new CountDownLatch(1); final AtomicInteger notificationCount = new AtomicInteger(0); muleContext.registerListener(new ExceptionNotificationListener() { public void onNotification(ServerNotification notification) { if (notification.getAction() == ExceptionNotification.EXCEPTION_ACTION) { assertEquals("exception", notification.getActionName()); assertEquals("Wrong info type", ServerNotification.TYPE_ERROR, notification.getType()); notificationCount.incrementAndGet(); latch.countDown(); } } }); // throwing exception InstrumentedExceptionStrategy strategy = new InstrumentedExceptionStrategy(); strategy.setMuleContext(muleContext); strategy.exceptionThrown(new IllegalArgumentException("boom")); // Wait for the notifcation event to be fired as they are queue latch.await(2000, TimeUnit.MILLISECONDS); assertEquals(1, notificationCount.get()); } private class InstrumentedExceptionStrategy extends DefaultExceptionStrategy { private volatile int count = 0; // @Override protected void defaultHandler(Throwable t) { count++; super.defaultHandler(t); } // @Override protected void logException(Throwable t) { // do not log anything here, we're running as part of a unit test } public int getCount() { return count; } } } mule-2.0.1/core/src/test/java/org/mule/VoidResultTestCase.java0000644000175000017500000000172510745677442024074 0ustar charlescharles/* * $Id: VoidResultTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.tck.AbstractMuleTestCase; import org.apache.commons.lang.SerializationUtils; public class VoidResultTestCase extends AbstractMuleTestCase { public void testUniqueDeserialization() { VoidResult result = VoidResult.getInstance(); byte[] serialized = SerializationUtils.serialize(result); assertNotNull(serialized); Object deserialized = SerializationUtils.deserialize(serialized); assertSame(deserialized, result); assertEquals(deserialized, result); } } mule-2.0.1/core/src/test/java/org/mule/DefaultMuleContextBuilderTestCase.java0000644000175000017500000000761610766637211027055 0ustar charlescharles/* * $Id: DefaultMuleContextBuilderTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleContext; import org.mule.api.config.ThreadingProfile; import org.mule.config.DefaultMuleConfiguration; import org.mule.context.DefaultMuleContextBuilder; import org.mule.context.notification.ServerNotificationManager; import org.mule.lifecycle.GenericLifecycleManager; import org.mule.lifecycle.phases.MuleContextDisposePhase; import org.mule.lifecycle.phases.MuleContextInitialisePhase; import org.mule.lifecycle.phases.MuleContextStartPhase; import org.mule.lifecycle.phases.MuleContextStopPhase; import org.mule.tck.AbstractMuleTestCase; import org.mule.work.MuleWorkManager; public class DefaultMuleContextBuilderTestCase extends AbstractMuleTestCase { public void testBuildMuleContextDefault() { // Build DefaultMuleContextBuilder builder = new DefaultMuleContextBuilder(); MuleContext muleContext = builder.buildMuleContext(); // Assert assertNotNull(muleContext); assertEquals(DefaultMuleConfiguration.class, muleContext.getConfiguration().getClass()); assertEquals(GenericLifecycleManager.class, muleContext.getLifecycleManager().getClass()); assertEquals(MuleContextInitialisePhase.class, muleContext.getLifecycleManager() .getLifecycles() .toArray()[0].getClass()); assertEquals(MuleContextStartPhase.class, muleContext.getLifecycleManager().getLifecycles().toArray()[1].getClass()); assertEquals(MuleContextStopPhase.class, muleContext.getLifecycleManager().getLifecycles().toArray()[2].getClass()); assertEquals(MuleContextDisposePhase.class, muleContext.getLifecycleManager() .getLifecycles() .toArray()[3].getClass()); assertEquals(ServerNotificationManager.class, muleContext.getNotificationManager().getClass()); assertEquals(MuleWorkManager.class, muleContext.getWorkManager().getClass()); } public void testBuildMuleContextCustom() { // Build DefaultMuleContextBuilder builder = new DefaultMuleContextBuilder(); builder.setMuleConfiguration(new MyMuleConfiguration()); builder.setLifecycleManager(new MyLifeCycleManager()); builder.setNotificationManager(new MyServerNotificationManager()); builder.setWorkManager(new MyWorkManager(ThreadingProfile.DEFAULT_THREADING_PROFILE, "test")); MuleContext muleContext = builder.buildMuleContext(); // Assert assertNotNull(muleContext); assertEquals(MyMuleConfiguration.class, muleContext.getConfiguration().getClass()); assertEquals(MyLifeCycleManager.class, muleContext.getLifecycleManager().getClass()); assertEquals(MyServerNotificationManager.class, muleContext.getNotificationManager().getClass()); assertEquals(MyWorkManager.class, muleContext.getWorkManager().getClass()); } /** * Override, we don't want a {@link MuleContext} created for this test case. */ protected MuleContext createMuleContext() throws Exception { return null; } static class MyLifeCycleManager extends GenericLifecycleManager { } static class MyMuleConfiguration extends DefaultMuleConfiguration { } static class MyServerNotificationManager extends ServerNotificationManager { } static class MyWorkManager extends MuleWorkManager { public MyWorkManager(ThreadingProfile profile, String name) { super(profile, name); } } } mule-2.0.1/core/src/test/java/org/mule/routing/0000755000175000017500000000000011351411072021132 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/routing/response/0000755000175000017500000000000011351411072022770 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/routing/response/ResponseRouterCollectionTestCase.java0000644000175000017500000000541210765313375032323 0ustar charlescharles/* * $Id: ResponseRouterCollectionTestCase.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.response; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.InvalidEndpointTypeException; import org.mule.tck.AbstractMuleTestCase; import java.util.ArrayList; import java.util.List; public class ResponseRouterCollectionTestCase extends AbstractMuleTestCase { public void testAddGoodEndpoint() throws Exception { DefaultResponseRouterCollection router=new DefaultResponseRouterCollection(); InboundEndpoint endpoint=getTestInboundEndpoint("test"); router.addEndpoint(endpoint); assertNotNull(router.getEndpoints()); assertTrue(router.getEndpoints().contains(endpoint)); } public void testSetGoodEndpoints() throws Exception { List list= new ArrayList(); list.add(getTestInboundEndpoint("test")); list.add(getTestInboundEndpoint("test")); DefaultResponseRouterCollection router=new DefaultResponseRouterCollection(); assertNotNull(router.getEndpoints()); assertEquals(0, router.getEndpoints().size()); router.addEndpoint(getTestInboundEndpoint("test")); assertEquals(1, router.getEndpoints().size()); router.setEndpoints(list); assertNotNull(router.getEndpoints()); assertEquals(2, router.getEndpoints().size()); } public void testSetBadEndpoints() throws Exception { List list= new ArrayList(); list.add(getTestInboundEndpoint("test")); list.add(getTestOutboundEndpoint("test")); DefaultResponseRouterCollection router=new DefaultResponseRouterCollection(); try{ router.setEndpoints(list); fail("Invalid endpoint: Exception exceptions"); } catch(Exception e){ assertEquals(InvalidEndpointTypeException.class, e.getClass()); } } public void testSetBad2Endpoints() throws Exception { List list= new ArrayList(); list.add(getTestInboundEndpoint("test")); list.add(getTestOutboundEndpoint("test")); DefaultResponseRouterCollection router=new DefaultResponseRouterCollection(); try{ router.setEndpoints(list); fail("Invalid endpoint: Exception exceptions"); } catch(Exception e){ assertEquals(InvalidEndpointTypeException.class, e.getClass()); } } } mule-2.0.1/core/src/test/java/org/mule/routing/inbound/0000755000175000017500000000000011351411072022570 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/routing/inbound/InboundRouterCollectionTestCase.java0000644000175000017500000000545410765313375031731 0ustar charlescharles/* * $Id: InboundRouterCollectionTestCase.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.InvalidEndpointTypeException; import org.mule.tck.AbstractMuleTestCase; import java.util.ArrayList; import java.util.List; public class InboundRouterCollectionTestCase extends AbstractMuleTestCase { public void testAddGoodEndpoint() throws Exception { DefaultInboundRouterCollection router = new DefaultInboundRouterCollection(); InboundEndpoint endpoint = getTestInboundEndpoint("test"); router.addEndpoint(endpoint); assertNotNull(router.getEndpoints()); assertTrue(router.getEndpoints().contains(endpoint)); } public void testSetGoodEndpoints() throws Exception { List list = new ArrayList(); list.add(getTestInboundEndpoint("test")); list.add(getTestInboundEndpoint("test")); DefaultInboundRouterCollection router = new DefaultInboundRouterCollection(); assertNotNull(router.getEndpoints()); assertEquals(0, router.getEndpoints().size()); router.addEndpoint(getTestInboundEndpoint("test")); assertEquals(1, router.getEndpoints().size()); router.setEndpoints(list); assertNotNull(router.getEndpoints()); assertEquals(2, router.getEndpoints().size()); } public void testSetBadEndpoints() throws Exception { List list = new ArrayList(); list.add(getTestInboundEndpoint("test")); list.add(getTestOutboundEndpoint("test")); DefaultInboundRouterCollection router = new DefaultInboundRouterCollection(); try { router.setEndpoints(list); fail("Invalid endpoint: Exception exceptions"); } catch (Exception e) { assertEquals(InvalidEndpointTypeException.class, e.getClass()); } } public void testSetBad2Endpoints() throws Exception { List list = new ArrayList(); list.add(getTestInboundEndpoint("test")); list.add(getTestOutboundEndpoint("test")); DefaultInboundRouterCollection router = new DefaultInboundRouterCollection(); try { router.setEndpoints(list); fail("Invalid endpoint: Exception exceptions"); } catch (Exception e) { assertEquals(InvalidEndpointTypeException.class, e.getClass()); } } } mule-2.0.1/core/src/test/java/org/mule/routing/inbound/SelectiveConsumerTestCase.java0000644000175000017500000001162410754403514030542 0ustar charlescharles/* * $Id: SelectiveConsumerTestCase.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.service.Service; import org.mule.routing.LoggingCatchAllStrategy; import org.mule.routing.filters.PayloadTypeFilter; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import org.mule.tck.testmodels.fruit.Apple; import org.mule.transformer.simple.ObjectToByteArray; import org.mule.util.CollectionUtils; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; public class SelectiveConsumerTestCase extends AbstractMuleTestCase { public void testSelectiveConsumer() throws Exception { Mock session = MuleTestUtils.getMockSession(); Service testService = getTestService("test", Apple.class); InboundRouterCollection messageRouter = new DefaultInboundRouterCollection(); SelectiveConsumer router = new SelectiveConsumer(); messageRouter.addRouter(router); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); PayloadTypeFilter filter = new PayloadTypeFilter(String.class); router.setFilter(filter); assertEquals(filter, router.getFilter()); MuleMessage message = new DefaultMuleMessage("test event"); ImmutableEndpoint endpoint = getTestOutboundEndpoint("Test1Provider"); MuleEvent event = new DefaultMuleEvent(message, endpoint, (MuleSession) session.proxy(), false); assertTrue(router.isMatch(event)); session.expect("dispatchEvent", C.eq(event)); session.expectAndReturn("getService", testService); messageRouter.route(event); session.verify(); event = new DefaultMuleEvent(message, endpoint, (MuleSession) session.proxy(), true); session.expectAndReturn("sendEvent", C.eq(event), message); session.expectAndReturn("getService", testService); MuleMessage result = messageRouter.route(event); assertNotNull(result); assertEquals(message, result); session.verify(); session.expectAndReturn("getService", testService); session.expectAndReturn("toString", ""); message = new DefaultMuleMessage(new Exception()); event = new DefaultMuleEvent(message, endpoint, (MuleSession) session.proxy(), false); assertTrue(!router.isMatch(event)); messageRouter.route(event); session.verify(); } public void testSelectiveConsumerWithTransformer() throws Exception { Mock session = MuleTestUtils.getMockSession(); Service testService = getTestService("test", Apple.class); InboundRouterCollection messageRouter = new DefaultInboundRouterCollection(); SelectiveConsumer router = new SelectiveConsumer(); messageRouter.addRouter(router); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); PayloadTypeFilter filter = new PayloadTypeFilter(byte[].class); router.setFilter(filter); assertEquals(filter, router.getFilter()); MuleMessage message = new DefaultMuleMessage("test event"); ImmutableEndpoint endpoint = getTestOutboundEndpoint("Test1Provider", CollectionUtils.singletonList(new ObjectToByteArray())); MuleEvent event = new DefaultMuleEvent(message, endpoint, (MuleSession) session.proxy(), false); assertTrue(router.isMatch(event)); session.expect("dispatchEvent", C.eq(event)); session.expectAndReturn("getService", testService); messageRouter.route(event); session.verify(); event = new DefaultMuleEvent(message, endpoint, (MuleSession) session.proxy(), true); session.expectAndReturn("sendEvent", C.eq(event), message); session.expectAndReturn("getService", testService); MuleMessage result = messageRouter.route(event); assertNotNull(result); assertEquals(message, result); session.verify(); session.expectAndReturn("getService", testService); session.expectAndReturn("toString", ""); message = new DefaultMuleMessage("Hello String"); event = new DefaultMuleEvent(message, endpoint, (MuleSession) session.proxy(), false); router.setTransformFirst(false); assertTrue(!router.isMatch(event)); messageRouter.route(event); session.verify(); } } mule-2.0.1/core/src/test/java/org/mule/routing/inbound/EventGroupTestCase.java0000644000175000017500000001324510745677442027217 0ustar charlescharles/* * $Id: EventGroupTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.UUID; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.apache.commons.collections.IteratorUtils; public class EventGroupTestCase extends AbstractMuleTestCase { public void testConcurrentIteration() throws Exception { EventGroup eg = new EventGroup(UUID.getUUID()); assertFalse(eg.iterator().hasNext()); // add to events to start with eg.addEvent(getTestEvent("foo1")); eg.addEvent(getTestEvent("foo2")); assertTrue(eg.iterator().hasNext()); // now add events while we iterate over the group Iterator i = eg.iterator(); assertNotNull(i.next()); eg.addEvent(getTestEvent("foo3")); assertNotNull(i.next()); eg.addEvent(getTestEvent("foo4")); assertFalse(i.hasNext()); // the added events should be in there though assertEquals(4, eg.size()); } public void testEquals() { EventGroup g1 = new EventGroup("foo"); EventGroup g2 = new EventGroup("foo"); EventGroup g3 = new EventGroup("bar"); assertEquals(g1, g2); assertFalse(g1.equals(g3)); MyEventGroup mg = new MyEventGroup("foo"); assertEquals(g1, mg); assertEquals(mg, g1); mg = new MyEventGroup("bar"); assertFalse(g1.equals(mg)); assertFalse(mg.equals(g1)); } public void testHashCode() { String uuid = UUID.getUUID(); EventGroup g1 = new EventGroup(uuid); EventGroup g2 = new EventGroup(uuid); EventGroup g3 = new EventGroup(UUID.getUUID()); assertEquals(g1.hashCode(), g2.hashCode()); assertEquals(g1, g2); assertFalse(g1.hashCode() == g3.hashCode()); assertFalse(g1.equals(g3)); assertFalse(g3.equals(g1)); // now test Set compatibility Set s = new HashSet(); s.add(g1); // make sure g1 is in the set assertTrue(s.contains(g1)); assertEquals(1, s.size()); // g2 has the same hash, so it should match assertTrue(s.contains(g2)); // even though there is only one object in the set assertEquals(1, s.size()); // make sure g3 cannot be found assertFalse(s.contains(g3)); // now add it assertTrue(s.add(g3)); // make sure it is in there assertTrue(s.contains(g3)); // make sure it is really in there assertEquals(2, s.size()); } public void testCompareTo() { String uuid = UUID.getUUID(); EventGroup g1 = new EventGroup(uuid); EventGroup g2 = new EventGroup(uuid); EventGroup g3 = new EventGroup(UUID.getUUID()); // test comparison against null try { g1.compareTo(null); fail("expected NullPointerException"); } catch (NullPointerException npe) { // expected } // test comparison against incompatible object try { g1.compareTo("foo"); fail("expected ClassCastException"); } catch (ClassCastException cce) { // expected } // these tests use the groupId assertEquals(0, g1.compareTo(g2)); assertTrue(g1.compareTo(g3) < 0); assertTrue(g3.compareTo(g1) > 0); assertTrue(g3.compareTo(g2) > 0); // when the groupId is not Comparable, the creation time is used as fallback g1 = new EventGroup(new Object()); g2 = new EventGroup(new Object()); // g1 is older (smaller) than g2 assertTrue(g1.compareTo(g2) < 0); assertTrue(g2.compareTo(g1) > 0); } public void testToArray() throws Exception { EventGroup eg = new EventGroup(UUID.getUUID()); eg.addEvent(getTestEvent("foo1")); eg.addEvent(getTestEvent("foo2")); Object[] array1 = IteratorUtils.toArray(eg.iterator()); MuleEvent[] array2 = eg.toArray(); assertTrue(Arrays.equals(array1, array2)); } public void testToString() throws Exception { EventGroup eg = new EventGroup(UUID.getUUID()); String es = eg.toString(); assertTrue(es.endsWith("events=0}")); MuleEvent e = getTestEvent("foo"); eg.addEvent(e); es = eg.toString(); assertTrue(es.indexOf("events=1") != -1); assertTrue(es.endsWith("[" + e.getMessage().getUniqueId() + "]}")); MuleEvent e2 = new DefaultMuleEvent(new DefaultMuleMessage("foo2"), e); eg.addEvent(e2); es = eg.toString(); assertTrue(es.indexOf("events=2") != -1); assertTrue(es.endsWith(e.getMessage().getUniqueId() + ", " + e2.getMessage().getUniqueId() + "]}")); } private static class MyEventGroup extends EventGroup { private static final long serialVersionUID = 1L; public MyEventGroup(Object groupId) { super(groupId); } public MyEventGroup(Object groupId, int expectedSize) { super(groupId, expectedSize); } } } mule-2.0.1/core/src/test/java/org/mule/routing/inbound/EventResequencerTestCase.java0000644000175000017500000001034710754403514030367 0ustar charlescharles/* * $Id: EventResequencerTestCase.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.service.Service; import org.mule.routing.LoggingCatchAllStrategy; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import org.mule.tck.testmodels.fruit.Apple; import com.mockobjects.dynamic.Mock; import java.util.Comparator; public class EventResequencerTestCase extends AbstractMuleTestCase { public void testMessageResequencer() throws Exception { Mock session = MuleTestUtils.getMockSession(); Service testService = getTestService("test", Apple.class); assertNotNull(testService); InboundRouterCollection messageRouter = new DefaultInboundRouterCollection(); SimpleEventResequencer router = new SimpleEventResequencer(3); messageRouter.addRouter(router); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); MuleMessage message1 = new DefaultMuleMessage("test event A"); MuleMessage message2 = new DefaultMuleMessage("test event B"); MuleMessage message3 = new DefaultMuleMessage("test event C"); ImmutableEndpoint endpoint = getTestOutboundEndpoint("Test1Provider"); MuleEvent event1 = new DefaultMuleEvent(message1, endpoint, (MuleSession)session.proxy(), false); MuleEvent event2 = new DefaultMuleEvent(message2, endpoint, (MuleSession)session.proxy(), false); MuleEvent event3 = new DefaultMuleEvent(message3, endpoint, (MuleSession)session.proxy(), false); assertTrue(router.isMatch(event1)); assertTrue(router.isMatch(event2)); assertTrue(router.isMatch(event3)); assertNull(router.process(event2)); assertNull(router.process(event3)); MuleEvent[] results = router.process(event1); assertNotNull(results); assertEquals(3, results.length); assertEquals("test event B", results[0].getMessageAsString()); assertEquals("test event C", results[1].getMessageAsString()); assertEquals("test event A", results[2].getMessageAsString()); // set a resequencing comparator router.setComparator(new EventPayloadComparator()); assertNull(router.process(event2)); assertNull(router.process(event3)); results = router.process(event1); assertNotNull(results); assertEquals(3, results.length); assertEquals("test event A", results[0].getMessageAsString()); assertEquals("test event B", results[1].getMessageAsString()); assertEquals("test event C", results[2].getMessageAsString()); } public static class SimpleEventResequencer extends AbstractEventResequencer { private int eventCount = 0; private int eventthreshold = 1; public SimpleEventResequencer(int eventthreshold) { this.eventthreshold = eventthreshold; } protected boolean shouldResequenceEvents(EventGroup events) { eventCount++; if (eventCount == eventthreshold) { eventCount = 0; return true; } return false; } } public static class EventPayloadComparator implements Comparator { public int compare(Object o1, Object o2) { try { return ((MuleEvent)o1).getMessageAsString().compareTo(((MuleEvent)o2).getMessageAsString()); } catch (MuleException e) { throw new IllegalArgumentException(e.getMessage()); } } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/routing/inbound/IdempotentInMemoryMessageIdStoreTestCase.javamule-2.0.1/core/src/test/java/org/mule/routing/inbound/IdempotentInMemoryMessageIdStoreTestCase.java0000644000175000017500000000651310702442532033467 0ustar charlescharles/* * $Id: IdempotentInMemoryMessageIdStoreTestCase.java 8996 2007-10-08 14:57:30Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.tck.AbstractMuleTestCase; public class IdempotentInMemoryMessageIdStoreTestCase extends AbstractMuleTestCase { public void testTimedExpiry() throws Exception { // entryTTL=3 and expiryInterval=1 will cause background expiry IdempotentInMemoryMessageIdStore store = new IdempotentInMemoryMessageIdStore("timed", 2, 3, 1); // store entries in quick succession assertTrue(store.storeId("1")); assertTrue(store.storeId("2")); assertTrue(store.storeId("3")); // they should still be alive at this point assertTrue(store.containsId("1")); assertTrue(store.containsId("2")); assertTrue(store.containsId("3")); // wait until the entry TTL has been exceeded Thread.sleep(4000); // make sure all values are gone assertFalse(store.containsId("1")); assertFalse(store.containsId("2")); assertFalse(store.containsId("3")); } public void testMaxSize() throws Exception { // entryTTL=-1 means we will have to expire manually IdempotentInMemoryMessageIdStore store = new IdempotentInMemoryMessageIdStore("bounded", 3, -1, 1); assertTrue(store.storeId("1")); assertTrue(store.storeId("2")); assertTrue(store.storeId("3")); assertTrue(store.containsId("1")); assertTrue(store.containsId("2")); assertTrue(store.containsId("3")); // sleep a bit to make sure that entries are not expired, even though the expiry // thread is running every second Thread.sleep(3000); assertTrue(store.containsId("1")); assertTrue(store.containsId("2")); assertTrue(store.containsId("3")); // exceed threshold assertTrue(store.storeId("4")); // the oldest entry should still be there assertTrue(store.containsId("1")); // expire manually store.expire(); assertFalse(store.containsId("1")); assertTrue(store.containsId("2")); assertTrue(store.containsId("3")); assertTrue(store.containsId("4")); // exceed some more assertTrue(store.storeId("5")); store.expire(); assertFalse(store.containsId("2")); assertTrue(store.containsId("3")); assertTrue(store.containsId("4")); assertTrue(store.containsId("5")); // and multiple times assertTrue(store.storeId("6")); assertTrue(store.storeId("7")); assertTrue(store.storeId("8")); assertTrue(store.storeId("9")); store.expire(); assertTrue(store.containsId("7")); assertTrue(store.containsId("8")); assertTrue(store.containsId("9")); assertFalse(store.containsId("3")); assertFalse(store.containsId("4")); assertFalse(store.containsId("5")); assertFalse(store.containsId("6")); } } mule-2.0.1/core/src/test/java/org/mule/routing/inbound/EventAggregatorTestCase.java0000644000175000017500000001151210777661265030201 0ustar charlescharles/* * $Id: EventAggregatorTestCase.java 11567 2008-04-11 13:08:05Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.service.Service; import org.mule.routing.AggregationException; import org.mule.routing.EventCorrelatorCallback; import org.mule.routing.LoggingCatchAllStrategy; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import java.util.Iterator; import java.util.Map; public class EventAggregatorTestCase extends AbstractMuleTestCase { public void testMessageAggregator() throws Exception { Service testService = getTestService("test", Apple.class); MuleSession session = getTestSession(testService, muleContext); InboundRouterCollection messageRouter = new DefaultInboundRouterCollection(); SimpleEventAggregator router = new SimpleEventAggregator(3); messageRouter.addRouter(router); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); router.setMuleContext(muleContext); router.initialise(); MuleMessage message1 = new DefaultMuleMessage("test event A"); MuleMessage message2 = new DefaultMuleMessage("test event B"); MuleMessage message3 = new DefaultMuleMessage("test event C"); message1.setCorrelationId(message1.getUniqueId()); message2.setCorrelationId(message1.getUniqueId()); message3.setCorrelationId(message1.getUniqueId()); ImmutableEndpoint endpoint = getTestOutboundEndpoint("Test1Provider"); MuleEvent event1 = new DefaultMuleEvent(message1, endpoint, session, false); MuleEvent event2 = new DefaultMuleEvent(message2, endpoint, session, false); MuleEvent event3 = new DefaultMuleEvent(message3, endpoint, session, false); assertTrue(router.isMatch(event1)); assertTrue(router.isMatch(event2)); assertTrue(router.isMatch(event3)); assertNull(router.process(event1)); assertNull(router.process(event2)); MuleEvent[] results = router.process(event3); assertNotNull(results); assertEquals(1, results.length); assertEquals("test event A test event B test event C ", results[0].getMessageAsString()); } public static class SimpleEventAggregator extends AbstractEventAggregator { protected final int eventThreshold; protected int eventCount = 0; public SimpleEventAggregator(int eventThreshold) { this.eventThreshold = eventThreshold; } protected EventCorrelatorCallback getCorrelatorCallback() { return new EventCorrelatorCallback() { public boolean shouldAggregateEvents(EventGroup events) { eventCount++; if (eventCount == eventThreshold) { eventCount = 0; return true; } return false; } public EventGroup createEventGroup(MuleEvent event, Object groupId) { return new EventGroup(groupId, eventThreshold); } public MuleMessage aggregateEvents(EventGroup events) throws AggregationException { if (events.size() != eventThreshold) { throw new IllegalStateException("eventThreshold not yet reached?"); } StringBuffer newPayload = new StringBuffer(80); for (Iterator iterator = events.iterator(); iterator.hasNext();) { MuleEvent event = (MuleEvent) iterator.next(); try { newPayload.append(event.getMessageAsString()).append(" "); } catch (MuleException e) { throw new AggregationException(events, event.getEndpoint(), e); } } return new DefaultMuleMessage(newPayload.toString(), (Map) null); } }; } } } mule-2.0.1/core/src/test/java/org/mule/routing/inbound/IdempotentReceiverTestCase.java0000644000175000017500000000636410754403514030705 0ustar charlescharles/* * $Id: IdempotentReceiverTestCase.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.inbound; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.InboundRouterCollection; import org.mule.api.service.Service; import org.mule.routing.LoggingCatchAllStrategy; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import org.mule.tck.testmodels.fruit.Apple; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; public class IdempotentReceiverTestCase extends AbstractMuleTestCase { public void testIdempotentReceiver() throws Exception { IdempotentReceiver router = new IdempotentReceiver(); Mock session = MuleTestUtils.getMockSession(); Service testService = getTestService("test", Apple.class); InboundRouterCollection messageRouter = new DefaultInboundRouterCollection(); messageRouter.addRouter(router); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); MuleMessage message = new DefaultMuleMessage("test event"); ImmutableEndpoint endpoint = getTestOutboundEndpoint("Test1Provider"); MuleEvent event = new DefaultMuleEvent(message, endpoint, (MuleSession) session.proxy(), false); // called by idempotent receiver as this is the fist event it will try // and initialize the id store session.expectAndReturn("getService", testService); assertTrue(router.isMatch(event)); session.expect("dispatchEvent", C.eq(event)); // called by Inbound message router session.expectAndReturn("getService", testService); // called by idempotent receiver session.expectAndReturn("getService", testService); messageRouter.route(event); session.verify(); message = new DefaultMuleMessage("test event"); event = new DefaultMuleEvent(message, endpoint, (MuleSession) session.proxy(), true); session.expectAndReturn("sendEvent", C.eq(event), message); // called by idempotent receiver session.expectAndReturn("getService", testService); // called by Inbound message router session.expectAndReturn("getService", testService); MuleMessage result = messageRouter.route(event); assertNotNull(result); assertEquals(message, result); session.verify(); session.expect("toString"); // called by idempotent receiver session.expectAndReturn("getService", testService); event = new DefaultMuleEvent(message, endpoint, (MuleSession) session.proxy(), false); // we've already received this message assertTrue(!router.isMatch(event)); messageRouter.route(event); session.verify(); } } mule-2.0.1/core/src/test/java/org/mule/routing/filters/0000755000175000017500000000000011351411072022602 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/routing/filters/LogicFiltersTestCase.java0000644000175000017500000001023310755024144027475 0ustar charlescharles/* * $Id:LogicFiltersTestCase.java 5937 2007-04-09 22:35:04Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.DefaultMuleMessage; import org.mule.routing.filters.logic.AndFilter; import org.mule.routing.filters.logic.NotFilter; import org.mule.routing.filters.logic.OrFilter; import org.mule.tck.AbstractMuleTestCase; import java.util.LinkedList; public class LogicFiltersTestCase extends AbstractMuleTestCase { public void testAndFilter() { AndFilter filter = new AndFilter(); assertEquals(0, filter.getFilters().size()); // both null assertFalse(filter.accept(new DefaultMuleMessage("foo"))); // only one filter set filter.getFilters().add(new EqualsFilter("foo")); assertTrue(filter.accept(new DefaultMuleMessage("foo"))); // another one set too, but does not accept filter.getFilters().add(new EqualsFilter("foo")); assertFalse(filter.accept(new DefaultMuleMessage("bar"))); // both accept assertTrue(filter.accept(new DefaultMuleMessage("foo"))); WildcardFilter left = new WildcardFilter("blah.blah.*"); WildcardFilter right = new WildcardFilter("blah.*"); filter = new AndFilter(left, right); assertEquals(2,filter.getFilters().size()); assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah"))); assertTrue(right.accept(new DefaultMuleMessage("blah.blah"))); assertTrue(!left.accept(new DefaultMuleMessage("blah.blah"))); assertTrue(!filter.accept(new DefaultMuleMessage("blah.blah"))); filter = new AndFilter(); filter.getFilters().add(left); filter.getFilters().add(right); assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah"))); assertTrue(!filter.accept(new DefaultMuleMessage("blah.blah"))); } public void testOrFilter() { OrFilter filter = new OrFilter(); assertEquals(0, filter.getFilters().size()); assertFalse(filter.accept(new DefaultMuleMessage("foo"))); WildcardFilter left = new WildcardFilter("blah.blah.*"); WildcardFilter right = new WildcardFilter("blah.b*"); filter = new OrFilter(left, right); assertEquals(2, filter.getFilters().size()); assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah"))); assertTrue(right.accept(new DefaultMuleMessage("blah.blah"))); assertTrue(!left.accept(new DefaultMuleMessage("blah.blah"))); assertTrue(filter.accept(new DefaultMuleMessage("blah.blah"))); assertTrue(!filter.accept(new DefaultMuleMessage("blah.x.blah"))); filter = new OrFilter(); LinkedList filters = new LinkedList(); filters.addLast(left); filters.addLast(right); filter.setFilters(filters); assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah"))); assertTrue(filter.accept(new DefaultMuleMessage("blah.blah"))); assertTrue(!filter.accept(new DefaultMuleMessage("blah.x.blah"))); } public void testNotFilter() { NotFilter notFilter = new NotFilter(); assertNull(notFilter.getFilter()); assertFalse(notFilter.accept(new DefaultMuleMessage("foo"))); assertFalse(notFilter.accept(new DefaultMuleMessage(null))); WildcardFilter filter = new WildcardFilter("blah.blah.*"); notFilter = new NotFilter(filter); assertNotNull(notFilter.getFilter()); assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah"))); assertTrue(!notFilter.accept(new DefaultMuleMessage("blah.blah.blah"))); notFilter = new NotFilter(); notFilter.setFilter(filter); assertTrue(filter.accept(new DefaultMuleMessage("blah.blah.blah"))); assertTrue(!notFilter.accept(new DefaultMuleMessage("blah.blah.blah"))); } } mule-2.0.1/core/src/test/java/org/mule/routing/filters/RegExFilterTestCase.java0000644000175000017500000000404310664630335027275 0ustar charlescharles/* * $Id: RegExFilterTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.tck.AbstractMuleTestCase; public class RegExFilterTestCase extends AbstractMuleTestCase { public void testRegexFilterNoPattern() { // start with default RegExFilter filter = new RegExFilter(); assertNull(filter.getPattern()); assertFalse(filter.accept("No tengo dinero")); // activate a pattern filter.setPattern("(.*) brown fox"); assertTrue(filter.accept("The quick brown fox")); // remove pattern again, i.e. block all filter.setPattern(null); assertFalse(filter.accept("oh-oh")); } public void testRegexFilter() { RegExFilter filter = new RegExFilter("The quick (.*)"); assertNotNull(filter.getPattern()); assertTrue(filter.accept("The quick brown fox")); assertTrue(filter.accept("The quick ")); assertTrue(!filter.accept("The quickbrown fox")); assertTrue(!filter.accept("he quick brown fox")); filter.setPattern("(.*) brown fox"); assertTrue(filter.accept("The quick brown fox")); assertTrue(filter.accept(" brown fox")); assertTrue(!filter.accept("The quickbrown fox")); assertTrue(!filter.accept("The quick brown fo")); filter.setPattern("(.*) brown (.*)"); assertTrue(filter.accept("The quick brown fox")); assertTrue(filter.accept("(.*) brown fox")); assertTrue(!filter.accept("The quickbrown fox")); assertTrue(filter.accept("The quick brown fo")); filter.setPattern("(.*)"); assertTrue(filter.accept("The quick brown fox")); } } mule-2.0.1/core/src/test/java/org/mule/routing/filters/ExceptionTypeFilterTestCase.java0000644000175000017500000000251410745677442031076 0ustar charlescharles/* * $Id: ExceptionTypeFilterTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.message.DefaultExceptionPayload; import org.mule.tck.AbstractMuleTestCase; import java.io.IOException; public class ExceptionTypeFilterTestCase extends AbstractMuleTestCase { public void testExceptionTypeFilter() { ExceptionTypeFilter filter = new ExceptionTypeFilter(); assertNull(filter.getExpectedType()); MuleMessage m = new DefaultMuleMessage("test"); assertTrue(!filter.accept(m)); m.setExceptionPayload(new DefaultExceptionPayload(new IllegalArgumentException("test"))); assertTrue(filter.accept(m)); filter = new ExceptionTypeFilter(IOException.class); assertTrue(!filter.accept(m)); m.setExceptionPayload(new DefaultExceptionPayload(new IOException("test"))); assertTrue(filter.accept(m)); } } mule-2.0.1/core/src/test/java/org/mule/routing/filters/PayloadTypeFilterTestCase.java0000644000175000017500000000310710745677442030530 0ustar charlescharles/* * $Id: PayloadTypeFilterTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.DefaultMuleMessage; import org.mule.tck.AbstractMuleTestCase; public class PayloadTypeFilterTestCase extends AbstractMuleTestCase { public void testPayloadTypeFilterNoExpectedType() { PayloadTypeFilter filter = new PayloadTypeFilter(); assertNull(filter.getExpectedType()); assertFalse(filter.accept(new DefaultMuleMessage("test"))); filter.setExpectedType(String.class); assertTrue(filter.accept(new DefaultMuleMessage("test"))); filter.setExpectedType(null); assertFalse(filter.accept(new DefaultMuleMessage("test"))); } public void testPayloadTypeFilter() { PayloadTypeFilter filter = new PayloadTypeFilter(Exception.class); assertNotNull(filter.getExpectedType()); assertTrue(filter.accept(new DefaultMuleMessage(new Exception("test")))); assertTrue(!filter.accept(new DefaultMuleMessage("test"))); filter.setExpectedType(String.class); assertTrue(filter.accept(new DefaultMuleMessage("test"))); assertTrue(!filter.accept(new DefaultMuleMessage(new Exception("test")))); } } mule-2.0.1/core/src/test/java/org/mule/routing/filters/WildcardFilterTestCase.java0000644000175000017500000000660410664630335030021 0ustar charlescharles/* * $Id: WildcardFilterTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.tck.AbstractMuleTestCase; public class WildcardFilterTestCase extends AbstractMuleTestCase { public void testWildcardFilterNoPattern() { // start with default WildcardFilter filter = new WildcardFilter(); assertFalse(filter.accept("No tengo dinero")); // activate a pattern filter.setPattern("* brown fox"); assertTrue(filter.accept("The quick brown fox")); // remove pattern again, i.e. block all filter.setPattern(null); assertFalse(filter.accept("oh-oh")); } public void testWildcardFilterPostfix() { WildcardFilter filter = new WildcardFilter("The quick *"); assertNotNull(filter.getPattern()); assertTrue(filter.accept("The quick brown fox")); assertTrue(filter.accept("The quick *")); assertTrue(!filter.accept("The quickbrown fox")); assertTrue(!filter.accept("he quick brown fox")); } public void testWildcardFilterPrefix() { WildcardFilter filter = new WildcardFilter(); filter.setPattern("* brown fox"); assertTrue(filter.accept("The quick brown fox")); assertTrue(filter.accept("* brown fox")); assertTrue(!filter.accept("The quickbrown fox")); assertTrue(!filter.accept("The quick brown fo")); } public void testWildcardFilterPrePost() { WildcardFilter filter = new WildcardFilter(); filter.setPattern("* brown *"); assertTrue(filter.accept("The quick brown fox")); assertTrue(filter.accept("* brown fox")); assertTrue(!filter.accept("The quickbrown fox")); assertTrue(filter.accept("The quick brown fo")); filter.setPattern("**"); assertTrue(filter.accept("The quick brown fox")); filter.setPattern("*w*"); assertTrue(filter.accept("The quick brown fox")); filter.setPattern("*"); assertTrue(filter.accept("The quick brown fox")); filter.setPattern("*.*"); assertTrue(filter.accept("test.xml")); filter.setPattern("*.txt"); assertTrue(filter.accept("test.txt")); } public void testWildcardFilterMultiplePatterns() { WildcardFilter filter = new WildcardFilter(); filter.setPattern("* brown*, The*"); assertTrue(filter.accept("The quick brown fox")); assertTrue(filter.accept(" brown fox")); assertTrue(filter.accept("The quickbrown fox")); filter.setPattern("* if, The*"); assertTrue(!filter.accept("What The!")); assertTrue(!filter.accept("simplify")); } public void testWildcardFilterCasesensitive() { WildcardFilter filter = new WildcardFilter(); filter.setPattern("* brown fox"); assertFalse(filter.accept("The quick Brown fox")); assertTrue(filter.accept("* brown fox")); filter.setCaseSensitive(false); assertTrue(filter.accept("The quick Brown fox")); } } mule-2.0.1/core/src/test/java/org/mule/routing/filters/ExpressionFilterTestCase.java0000644000175000017500000001062310771050152030413 0ustar charlescharles/* * $Id: ExpressionFilterTestCase.java 11477 2008-03-22 00:18:50Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.message.DefaultExceptionPayload; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import java.io.IOException; public class ExpressionFilterTestCase extends AbstractMuleTestCase { public void testHeaderFilter() throws Exception { ExpressionFilter filter = new ExpressionFilter("header", "foo=bar"); MuleMessage message = new DefaultMuleMessage("blah"); assertTrue(!filter.accept(message)); message.setProperty("foo", "bar"); assertTrue(filter.accept(message)); } public void testHeaderFilterWithNot() throws Exception { ExpressionFilter filter = new ExpressionFilter("header", "foo!=bar"); MuleMessage message = new DefaultMuleMessage("blah"); assertTrue(filter.accept(message)); message.setProperty("foo", "bar"); assertTrue(!filter.accept(message)); message.setProperty("foo", "car"); assertTrue(filter.accept(message)); } public void testHeaderFilterWithNotNull() throws Exception { ExpressionFilter filter = new ExpressionFilter("header", "foo!=null"); MuleMessage message = new DefaultMuleMessage("blah"); assertTrue(!filter.accept(message)); message.removeProperty("foo"); assertTrue(!filter.accept(message)); message.setProperty("foo", "car"); assertTrue(filter.accept(message)); } public void testRegexFilterNoPattern() { // start with default RegExFilter filter = new RegExFilter(); assertNull(filter.getPattern()); assertFalse(filter.accept("No tengo dinero")); // activate a pattern filter.setPattern("(.*) brown fox"); assertTrue(filter.accept("The quick brown fox")); // remove pattern again, i.e. block all filter.setPattern(null); assertFalse(filter.accept("oh-oh")); } public void testRegexFilter() { ExpressionFilter filter = new ExpressionFilter("regex", "The quick (.*)"); assertNotNull(filter.getExpression()); assertTrue(filter.accept(new DefaultMuleMessage("The quick brown fox"))); assertTrue(filter.accept(new DefaultMuleMessage("The quick "))); assertTrue(!filter.accept(new DefaultMuleMessage("The quickbrown fox"))); assertTrue(!filter.accept(new DefaultMuleMessage("he quick brown fox"))); } public void testExceptionTypeFilter() { ExpressionFilter filter = new ExpressionFilter("exception-type:java.lang.Exception"); MuleMessage m = new DefaultMuleMessage("test"); assertTrue(!filter.accept(m)); m.setExceptionPayload(new DefaultExceptionPayload(new IllegalArgumentException("test"))); assertTrue(filter.accept(m)); filter = new ExpressionFilter("exception-type:java.io.IOException"); assertTrue(!filter.accept(m)); m.setExceptionPayload(new DefaultExceptionPayload(new IOException("test"))); assertTrue(filter.accept(m)); } public void testPayloadTypeFilter() { ExpressionFilter filter = new ExpressionFilter("payload-type:org.mule.tck.testmodels.fruit.Apple"); assertTrue(filter.accept(new DefaultMuleMessage(new Apple()))); assertTrue(!filter.accept(new DefaultMuleMessage("test"))); filter = new ExpressionFilter("payload-type:java.lang.String"); assertTrue(filter.accept(new DefaultMuleMessage("test"))); assertTrue(!filter.accept(new DefaultMuleMessage(new Exception("test")))); } public void testWildcardFilterMultiplePatterns() { ExpressionFilter filter = new ExpressionFilter("wildcard:* brown*, The*"); assertTrue(filter.accept(new DefaultMuleMessage("The quick brown fox"))); assertTrue(filter.accept(new DefaultMuleMessage(" brown fox"))); assertTrue(filter.accept(new DefaultMuleMessage("The quickbrown fox"))); } }mule-2.0.1/core/src/test/java/org/mule/routing/filters/MessagePropertyFilterTestCase.java0000644000175000017500000000604110745677442031426 0ustar charlescharles/* * $Id: MessagePropertyFilterTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.tck.AbstractMuleTestCase; public class MessagePropertyFilterTestCase extends AbstractMuleTestCase { public void testMessagePropertyFilter() throws Exception { MessagePropertyFilter filter = new MessagePropertyFilter("foo=bar"); MuleMessage message = new DefaultMuleMessage("blah"); assertTrue(!filter.accept(message)); message.setProperty("foo", "bar"); assertTrue(filter.accept(message)); } public void testMessagePropertyFilterWithNot() throws Exception { MessagePropertyFilter filter = new MessagePropertyFilter("foo!=bar"); MuleMessage message = new DefaultMuleMessage("blah"); assertTrue(filter.accept(message)); message.setProperty("foo", "bar"); assertTrue(!filter.accept(message)); message.setProperty("foo", "car"); assertTrue(filter.accept(message)); } public void testMessagePropertyFilterWithNotNull() throws Exception { MessagePropertyFilter filter = new MessagePropertyFilter("foo!=null"); MuleMessage message = new DefaultMuleMessage("blah"); assertTrue(!filter.accept(message)); message.removeProperty("foo"); assertTrue(!filter.accept(message)); message.setProperty("foo", "car"); assertTrue(filter.accept(message)); } public void testMessagePropertyFilterWithCaseSensitivity() throws Exception { MessagePropertyFilter filter = new MessagePropertyFilter("foo=Bar"); MuleMessage message = new DefaultMuleMessage("blah"); message.setProperty("foo", "bar"); assertTrue(!filter.accept(message)); filter.setCaseSensitive(false); assertTrue(filter.accept(message)); } public void testMessagePropertyFilterDodgyValues() throws Exception { MessagePropertyFilter filter = new MessagePropertyFilter(); assertFalse(filter.accept(null)); filter = new MessagePropertyFilter("foo = bar"); MuleMessage message = new DefaultMuleMessage("blah"); message.setProperty("foo", "bar"); assertTrue(filter.accept(message)); filter.setCaseSensitive(false); filter = new MessagePropertyFilter("foo2 =null"); message.removeProperty("foo2"); assertTrue(filter.accept(message)); filter = new MessagePropertyFilter("foo2 ="); message.setProperty("foo2", ""); assertTrue(filter.accept(message)); message.removeProperty("foo2"); assertTrue(!filter.accept(message)); } } mule-2.0.1/core/src/test/java/org/mule/routing/filters/EqualsFilterTestCase.java0000644000175000017500000000247010664630335027517 0ustar charlescharles/* * $Id: EqualsFilterTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.filters; import org.mule.tck.AbstractMuleTestCase; public class EqualsFilterTestCase extends AbstractMuleTestCase { public void testEqualsFilterNoPattern() { EqualsFilter filter = new EqualsFilter(); assertNull(filter.getPattern()); assertFalse(filter.accept("foo")); filter.setPattern("foo"); assertTrue(filter.accept("foo")); filter.setPattern(null); assertFalse(filter.accept("foo")); } public void testEqualsFilter() { Exception obj = new Exception("test"); EqualsFilter filter = new EqualsFilter(obj); assertNotNull(filter.getPattern()); assertTrue(filter.accept(obj)); assertTrue(!filter.accept(new Exception("tes"))); filter.setPattern("Hello"); assertTrue(filter.accept("Hello")); assertTrue(!filter.accept("Helo")); } } mule-2.0.1/core/src/test/java/org/mule/routing/CatchAllStrategiesTestCase.java0000644000175000017500000001571410766204322027156 0ustar charlescharles/* * $Id: CatchAllStrategiesTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transformer.TransformerException; import org.mule.api.transport.MessageDispatcher; import org.mule.endpoint.MuleEndpointURI; import org.mule.routing.filters.PayloadTypeFilter; import org.mule.routing.outbound.DefaultOutboundRouterCollection; import org.mule.routing.outbound.FilteringOutboundRouter; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import org.mule.transformer.AbstractTransformer; import org.mule.util.CollectionUtils; import com.mockobjects.constraint.Constraint; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.HashMap; public class CatchAllStrategiesTestCase extends AbstractMuleTestCase { public void testLoggingOnlyStrategy() throws Exception { MuleEvent event = getTestEvent("UncaughtEvent"); LoggingCatchAllStrategy strategy = new LoggingCatchAllStrategy(); try { strategy.setEndpoint(getTestOutboundEndpoint("testProvider")); fail("Illegal operation exception should have been thrown"); } catch (Exception e) { // expected } assertNull(strategy.getEndpoint()); strategy.catchMessage(event.getMessage(), null, false); } public void testForwardingStrategy() throws Exception { ForwardingCatchAllStrategy strategy = new ForwardingCatchAllStrategy(); Mock endpoint = MuleTestUtils.getMockOutboundEndpoint(); Mock dispatcher = new Mock(MessageDispatcher.class); Mock connector = MuleTestUtils.getMockConnector(); MuleEvent event = getTestEvent("UncaughtEvent"); strategy.setEndpoint((OutboundEndpoint)endpoint.proxy()); endpoint.expectAndReturn("getProperties", new HashMap()); endpoint.expectAndReturn("getProperties", new HashMap()); endpoint.expectAndReturn("getEndpointURI", new MuleEndpointURI("test://dummy")); endpoint.expectAndReturn("getEndpointURI", new MuleEndpointURI("test://dummy")); endpoint.expect("dispatch", C.isA(DefaultMuleEvent.class)); strategy.catchMessage(event.getMessage(), null, false); endpoint.verify(); dispatcher.verify(); connector.verify(); assertNotNull(strategy.getEndpoint()); } private class TestEventTransformer extends AbstractTransformer { /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformer#doTransform(java.lang.Object) */ public Object doTransform(Object src, String encoding) throws TransformerException { return "Transformed Test Data"; } } public void testForwardingStrategyWithTransform() throws Exception { ForwardingCatchAllStrategy strategy = new ForwardingCatchAllStrategy(); strategy.setSendTransformed(true); Mock endpoint = MuleTestUtils.getMockOutboundEndpoint(); Mock dispatcher = new Mock(MessageDispatcher.class); Mock connector = MuleTestUtils.getMockConnector(); MuleEvent event = getTestEvent("UncaughtEvent"); strategy.setEndpoint((OutboundEndpoint) endpoint.proxy()); endpoint.expectAndReturn("getTransformers", CollectionUtils.singletonList(new TestEventTransformer())); endpoint.expectAndReturn("getTransformers", CollectionUtils.singletonList(new TestEventTransformer())); endpoint.expectAndReturn("getProperties", new HashMap()); endpoint.expectAndReturn("getProperties", new HashMap()); endpoint.expectAndReturn("getEndpointURI", new MuleEndpointURI("test://dummy")); endpoint.expectAndReturn("getEndpointURI", new MuleEndpointURI("test://dummy")); endpoint.expect("send", new Constraint() { public boolean eval(Object arg0) { if (arg0 instanceof MuleEvent) { return "Transformed Test Data".equals(((MuleEvent)arg0).getMessage().getPayload()); } return false; } }); strategy.catchMessage(event.getMessage(), null, true); endpoint.verify(); dispatcher.verify(); connector.verify(); assertNotNull(strategy.getEndpoint()); } public void testFullRouter() throws Exception { final int[] count1 = new int[]{0}; final int[] count2 = new int[]{0}; final int[] catchAllCount = new int[]{0}; DefaultOutboundRouterCollection messageRouter = new DefaultOutboundRouterCollection(); FilteringOutboundRouter filterRouter1 = new FilteringOutboundRouter() { public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) { count1[0]++; return message; } }; FilteringOutboundRouter filterRouter2 = new FilteringOutboundRouter() { public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) { count2[0]++; return message; } }; filterRouter1.setFilter(new PayloadTypeFilter(Exception.class)); filterRouter2.setFilter(new PayloadTypeFilter(StringBuffer.class)); messageRouter.addRouter(filterRouter1); messageRouter.addRouter(filterRouter2); LoggingCatchAllStrategy strategy = new LoggingCatchAllStrategy() { public MuleMessage catchMessage(MuleMessage message, MuleSession session, boolean synchronous) { catchAllCount[0]++; return null; } }; messageRouter.setCatchAllStrategy(strategy); MuleSession session = getTestSession(getTestService(), muleContext); messageRouter.route(new DefaultMuleMessage("hello"), session, true); assertEquals(1, catchAllCount[0]); assertEquals(0, count1[0]); assertEquals(0, count2[0]); messageRouter.route(new DefaultMuleMessage(new StringBuffer()), session, true); assertEquals(1, catchAllCount[0]); assertEquals(0, count1[0]); assertEquals(1, count2[0]); messageRouter.route(new DefaultMuleMessage(new Exception()), session, true); assertEquals(1, catchAllCount[0]); assertEquals(1, count1[0]); assertEquals(1, count2[0]); } } mule-2.0.1/core/src/test/java/org/mule/routing/outbound/0000755000175000017500000000000011351411072022771 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/routing/outbound/FilteringOutboundRouterTestCase.java0000644000175000017500000001067610757615756032176 0ustar charlescharles/* * $Id: FilteringOutboundRouterTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transformer.TransformerException; import org.mule.routing.LoggingCatchAllStrategy; import org.mule.routing.filters.PayloadTypeFilter; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import org.mule.transformer.AbstractTransformer; import org.mule.util.CollectionUtils; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class FilteringOutboundRouterTestCase extends AbstractMuleTestCase { public void testFilteringOutboundRouter() throws Exception { Mock session = MuleTestUtils.getMockSession(); DefaultOutboundRouterCollection messageRouter = new DefaultOutboundRouterCollection(); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); ImmutableEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider"); assertNotNull(endpoint1); FilteringOutboundRouter router = new FilteringOutboundRouter(); PayloadTypeFilter filter = new PayloadTypeFilter(String.class); router.setFilter(filter); List endpoints = new ArrayList(); endpoints.add(endpoint1); router.setEndpoints(endpoints); assertFalse(router.isUseTemplates()); assertEquals(filter, router.getFilter()); MuleMessage message = new DefaultMuleMessage("test event"); assertTrue(router.isMatch(message)); session.expect("dispatchEvent", C.eq(message, endpoint1)); router.route(message, (MuleSession)session.proxy(), false); session.verify(); message = new DefaultMuleMessage("test event"); session.expectAndReturn("sendEvent", C.eq(message, endpoint1), message); MuleMessage result = router.route(message, (MuleSession)session.proxy(), true); assertNotNull(result); assertEquals(message, result); session.verify(); message = new DefaultMuleMessage(new Exception("test event")); assertTrue(!router.isMatch(message)); router.setTransformers( CollectionUtils.singletonList( new AbstractTransformer() { public Object doTransform(Object src, String encoding) throws TransformerException { return ((Exception)src).getMessage(); } } ) ); assertTrue(router.isMatch(message)); } public void testFilteringOutboundRouterWithTemplates() throws Exception { DefaultOutboundRouterCollection messageRouter = new DefaultOutboundRouterCollection(); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); OutboundEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider", "test://foo?[barValue]"); assertNotNull(endpoint1); FilteringOutboundRouter router = new FilteringOutboundRouter(); PayloadTypeFilter filter = new PayloadTypeFilter(String.class); router.setFilter(filter); List endpoints = new ArrayList(); endpoints.add(endpoint1); router.setEndpoints(endpoints); assertTrue(router.isUseTemplates()); assertEquals(filter, router.getFilter()); Map m = new HashMap(); m.put("barValue", "bar"); MuleMessage message = new DefaultMuleMessage("test event", m); assertTrue(router.isMatch(message)); OutboundEndpoint ep = router.getEndpoint(0, message); // MULE-2690: assert that templated endpoints are not mutated assertNotSame(endpoint1, ep); // assert that the returned endpoint has a resolved URI assertEquals("test://foo?bar", ep.getEndpointURI().toString()); } } mule-2.0.1/core/src/test/java/org/mule/routing/outbound/MessageSplitterRouterTestCase.java0000644000175000017500000000751610757615756031645 0ustar charlescharles/* * $Id: MessageSplitterRouterTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import org.mule.util.StringUtils; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class MessageSplitterRouterTestCase extends AbstractMuleTestCase { public void testMessageSplitterRouter() throws Exception { Mock session = MuleTestUtils.getMockSession(); OutboundEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider", "test://endpointUri.1"); OutboundEndpoint endpoint2 = getTestOutboundEndpoint("Test2Provider", "test://endpointUri.2"); OutboundEndpoint endpoint3 = getTestOutboundEndpoint("Test3Provider", "test://endpointUri.3"); // Dummy message splitter AbstractMessageSplitter router = new AbstractMessageSplitter() { private List parts; protected void initialise(MuleMessage message) { multimatch = false; parts = Arrays.asList(StringUtils.splitAndTrim(message.getPayload().toString(), ",")); } protected MuleMessage getMessagePart(MuleMessage message, OutboundEndpoint endpoint) { if (endpoint.getEndpointURI().getAddress().equals("endpointUri.1")) { return new DefaultMuleMessage(parts.get(0)); } else if (endpoint.getEndpointURI().getAddress().equals("endpointUri.2")) { return new DefaultMuleMessage(parts.get(1)); } else if (endpoint.getEndpointURI().getAddress().equals("endpointUri.3")) { return new DefaultMuleMessage(parts.get(2)); } else { return null; } } protected void cleanup() { parts = null; } }; List endpoints = new ArrayList(); endpoints.add(endpoint1); endpoints.add(endpoint2); endpoints.add(endpoint3); router.setEndpoints(endpoints); MuleMessage message = new DefaultMuleMessage("test,mule,message"); assertTrue(router.isMatch(message)); session.expect("dispatchEvent", C.args(C.isA(MuleMessage.class), C.eq(endpoint1))); session.expect("dispatchEvent", C.args(C.isA(MuleMessage.class), C.eq(endpoint2))); session.expect("dispatchEvent", C.args(C.isA(MuleMessage.class), C.eq(endpoint3))); router.route(message, (MuleSession)session.proxy(), false); session.verify(); message = new DefaultMuleMessage("test,mule,message"); session.expectAndReturn("sendEvent", C.args(C.isA(MuleMessage.class), C.eq(endpoint1)), message); session.expectAndReturn("sendEvent", C.args(C.isA(MuleMessage.class), C.eq(endpoint2)), message); session.expectAndReturn("sendEvent", C.args(C.isA(MuleMessage.class), C.eq(endpoint3)), message); MuleMessage result = router.route(message, (MuleSession)session.proxy(), true); assertNotNull(result); assertEquals(message, result); session.verify(); } } mule-2.0.1/core/src/test/java/org/mule/routing/outbound/FilteringListMessageSplitterTestCase.java0000644000175000017500000000335010766204322033113 0ustar charlescharles/* * $Id: FilteringListMessageSplitterTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.service.Service; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import java.util.ArrayList; import java.util.List; public class FilteringListMessageSplitterTestCase extends AbstractMuleTestCase { public void testCorrelationGroupSizePropertySet() throws Exception { Service testService = getTestService("test", Apple.class); MuleSession session = getTestSession(testService, muleContext); OutboundEndpoint endpoint = getTestOutboundEndpoint("Test1Provider"); FilteringListMessageSplitter router = new FilteringListMessageSplitter(); router.setFilter(null); router.addEndpoint(endpoint); List payload = new ArrayList(); payload.add("one"); payload.add("two"); payload.add("three"); payload.add("four"); MuleMessage message = new DefaultMuleMessage(payload); MuleMessage result = router.route(message, session, true); assertNotNull(result); assertEquals("Correlation group size has not been set.", 4, result.getCorrelationGroupSize()); } } mule-2.0.1/core/src/test/java/org/mule/routing/outbound/ExceptionBasedRouterTestCase.java0000644000175000017500000002337110770356575031420 0ustar charlescharles/* * $Id: ExceptionBasedRouterTestCase.java 11433 2008-03-20 03:43:57Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleException; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.CouldNotRouteOutboundMessageException; import org.mule.api.routing.RoutingException; import org.mule.message.DefaultExceptionPayload; import org.mule.routing.LoggingCatchAllStrategy; import org.mule.routing.filters.RegExFilter; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.ArrayList; import java.util.List; public class ExceptionBasedRouterTestCase extends AbstractMuleTestCase { /** * Multiple endpoints, no failures. MuleEvent dispatched asynchronously, but forced * into sync mode. Test case ends here. */ public void testSuccessfulExceptionRouter() throws Exception { Mock session = MuleTestUtils.getMockSession(); DefaultOutboundRouterCollection messageRouter = new DefaultOutboundRouterCollection(); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); ImmutableEndpoint endpoint1 = muleContext.getRegistry() .lookupEndpointFactory() .getOutboundEndpoint("test://Dummy1"); ImmutableEndpoint endpoint2 = muleContext.getRegistry() .lookupEndpointFactory() .getOutboundEndpoint("test://Dummy2"); ImmutableEndpoint endpoint3 = muleContext.getRegistry() .lookupEndpointFactory() .getOutboundEndpoint("test://Dummy3"); ExceptionBasedRouter router = new ExceptionBasedRouter(); RegExFilter filter = new RegExFilter("(.*) event"); router.setFilter(filter); List endpoints = new ArrayList(); endpoints.add(endpoint1); endpoints.add(endpoint2); endpoints.add(endpoint3); router.setEndpoints(endpoints); assertEquals(filter, router.getFilter()); MuleMessage message = new DefaultMuleMessage("test event"); assertTrue(router.isMatch(message)); session.expect("sendEvent", C.eq(message, endpoint1)); MuleMessage result = router.route(message, (MuleSession)session.proxy(), false); assertNull("Async call should've returned null.", result); session.verify(); message = new DefaultMuleMessage("test event"); // only one send should be called and succeed, the others should not be // called session.expectAndReturn("sendEvent", C.eq(message, endpoint1), message); result = router.route(message, (MuleSession)session.proxy(), true); assertNotNull(result); assertEquals(message, result); session.verify(); } /** * Both endpoints fail during dispatch. The first endpoint should be forced into * sync mode. */ public void testBothFailing() throws Exception { Mock mockSession = MuleTestUtils.getMockSession(); DefaultOutboundRouterCollection messageRouter = new DefaultOutboundRouterCollection(); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); ImmutableEndpoint endpoint1 = muleContext.getRegistry() .lookupEndpointFactory() .getOutboundEndpoint("test://AlwaysFail"); ImmutableEndpoint endpoint2 = muleContext.getRegistry() .lookupEndpointFactory() .getOutboundEndpoint("test://AlwaysFail"); ExceptionBasedRouter router = new ExceptionBasedRouter(); RegExFilter filter = new RegExFilter("(.*) event"); router.setFilter(filter); List endpoints = new ArrayList(); endpoints.add(endpoint1); endpoints.add(endpoint2); router.setEndpoints(endpoints); assertEquals(filter, router.getFilter()); MuleMessage message = new DefaultMuleMessage("test event"); assertTrue(router.isMatch(message)); // exception to throw MuleException rex = new RoutingException(message, endpoint1); mockSession.expectAndThrow("sendEvent", C.args(C.eq(message), C.eq(endpoint1)), rex); mockSession.expectAndThrow("dispatchEvent", C.args(C.eq(message), C.eq(endpoint2)), rex); MuleSession session = (MuleSession)mockSession.proxy(); MuleMessage result = null; try { result = router.route(message, session, false); fail("Should have thrown exception as both endpoints would have failed"); } catch (CouldNotRouteOutboundMessageException e) { // expected } assertNull("Async call should've returned null.", result); mockSession.verify(); message = new DefaultMuleMessage("test event"); } /** * The first endpoint fails, second succeeds. Events are being sent * synchronously. */ public void testFailFirstSuccessSecondSync() throws Exception { Mock mockSession = MuleTestUtils.getMockSession(); OutboundEndpoint endpoint1 = getTestOutboundEndpoint("TestFailEndpoint", "test://Failure"); OutboundEndpoint endpoint2 = getTestOutboundEndpoint("TestSuccessEndpoint", "test://Success"); ExceptionBasedRouter router = new ExceptionBasedRouter(); router.addEndpoint(endpoint1); router.addEndpoint(endpoint2); MuleMessage message = new DefaultMuleMessage("test event"); MuleMessage expectedResultMessage = new DefaultMuleMessage("Return event"); assertTrue(router.isMatch(message)); final MuleSession session = (MuleSession)mockSession.proxy(); // exception to throw MuleException rex = new RoutingException(message, endpoint1); // 1st failure mockSession.expectAndThrow("sendEvent", C.args(C.eq(message), C.eq(endpoint1)), rex); // next endpoint mockSession.expectAndReturn("sendEvent", C.args(C.eq(message), C.eq(endpoint2)), expectedResultMessage); MuleMessage actualResultMessage = router.route(message, session, true); mockSession.verify(); assertEquals("Got an invalid return message.", expectedResultMessage, actualResultMessage); } /** * The first endpoint fails, second succeeds. Events are being forced into a sync * mode, until we reach the last one. */ public void testFailFirstSuccessSecondAsync() throws Exception { Mock mockSession = MuleTestUtils.getMockSession(); OutboundEndpoint endpoint1 = getTestOutboundEndpoint("TestFailEndpoint", "test://Failure"); OutboundEndpoint endpoint2 = getTestOutboundEndpoint("TestSuccessEndpoint", "test://Success"); ExceptionBasedRouter router = new ExceptionBasedRouter(); router.addEndpoint(endpoint1); router.addEndpoint(endpoint2); MuleMessage message = new DefaultMuleMessage("test event"); MuleMessage expectedResultMessage = new DefaultMuleMessage("Return event"); assertTrue(router.isMatch(message)); final MuleSession session = (MuleSession)mockSession.proxy(); // exception to throw MuleException rex = new RoutingException(message, endpoint1); // 1st failure mockSession.expectAndThrow("sendEvent", C.args(C.eq(message), C.eq(endpoint1)), rex); // next endpoint mockSession.expectAndReturn("dispatchEvent", C.args(C.eq(message), C.eq(endpoint2)), expectedResultMessage); MuleMessage actualResultMessage = router.route(message, session, false); assertNull("Async call should not return any results.", actualResultMessage); mockSession.verify(); } /** * The first endpoint contains exception payload in return message, second * succeeds. Events are being sent synchronously. */ public void testFirstHadExceptionPayloadSuccessSecondSyncWithExceptionPayload() throws Exception { Mock mockSession = MuleTestUtils.getMockSession(); OutboundEndpoint endpoint1 = getTestOutboundEndpoint("TestFailEndpoint", "test://Failure"); OutboundEndpoint endpoint2 = getTestOutboundEndpoint("TestSuccessEndpoint", "test://Success"); ExceptionBasedRouter router = new ExceptionBasedRouter(); router.addEndpoint(endpoint1); router.addEndpoint(endpoint2); MuleMessage message = new DefaultMuleMessage("test event"); MuleMessage expectedResultMessage = new DefaultMuleMessage("Return event"); assertTrue(router.isMatch(message)); // remote endpoint failed and set an exception payload on the returned // message MuleMessage exPayloadMessage = new DefaultMuleMessage("there was a failure"); exPayloadMessage.setExceptionPayload(new DefaultExceptionPayload(new RuntimeException())); final MuleSession session = (MuleSession)mockSession.proxy(); // 1st failure mockSession.expectAndReturn("sendEvent", C.args(C.eq(message), C.eq(endpoint1)), exPayloadMessage); // next endpoint mockSession.expectAndReturn("sendEvent", C.args(C.eq(message), C.eq(endpoint2)), expectedResultMessage); MuleMessage actualResultMessage = router.route(message, session, true); mockSession.verify(); assertEquals("Got an invalid return message.", expectedResultMessage, actualResultMessage); } } mule-2.0.1/core/src/test/java/org/mule/routing/outbound/AbstractOutboundRouterTestCase.java0000644000175000017500000000606410765313375032001 0ustar charlescharles/* * $Id: AbstractOutboundRouterTestCase.java 11311 2008-03-10 20:15:57Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.api.endpoint.InvalidEndpointTypeException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.tck.AbstractMuleTestCase; import java.util.ArrayList; import java.util.List; public class AbstractOutboundRouterTestCase extends AbstractMuleTestCase { public void testAddGoodEndpoint() throws Exception { AbstractOutboundRouter router=new TransformerRouter(); OutboundEndpoint endpoint=getTestOutboundEndpoint("test"); router.addEndpoint(endpoint); assertNotNull(router.getEndpoints()); assertTrue(router.getEndpoints().contains(endpoint)); } // public void testAddBadEndpoint2() // { // AbstractOutboundRouter router=new TransformerRouter(); // try{ // router.addEndpoint(new InboundEndpoint()); // fail("Invalid endpoint: Exception exceptions"); // } // catch(Exception e){ // assertEquals(InvalidEndpointTypeException.class, e.getClass()); // } // } public void testSetGoodEndpoints() throws Exception { List list= new ArrayList(); list.add(getTestOutboundEndpoint("test")); list.add(getTestOutboundEndpoint("test")); AbstractOutboundRouter router=new TransformerRouter(); assertNotNull(router.getEndpoints()); assertEquals(0, router.getEndpoints().size()); router.addEndpoint(getTestOutboundEndpoint("test")); assertEquals(1, router.getEndpoints().size()); router.setEndpoints(list); assertNotNull(router.getEndpoints()); assertEquals(2, router.getEndpoints().size()); } public void testSetBadEndpoints() throws Exception { List list= new ArrayList(); list.add(getTestInboundEndpoint("test")); list.add(getTestOutboundEndpoint("test")); AbstractOutboundRouter router=new TransformerRouter(); try{ router.setEndpoints(list); fail("Invalid endpoint: Exception exceptions"); } catch(Exception e){ assertEquals(InvalidEndpointTypeException.class, e.getClass()); } } public void testSetBad2Endpoints() throws Exception { List list= new ArrayList(); list.add(getTestOutboundEndpoint("test")); list.add(getTestInboundEndpoint("test")); AbstractOutboundRouter router=new TransformerRouter(); try{ router.setEndpoints(list); fail("Invalid endpoint: Exception exceptions"); } catch(Exception e){ assertEquals(InvalidEndpointTypeException.class, e.getClass()); } } } mule-2.0.1/core/src/test/java/org/mule/routing/outbound/OutboundMessageRouterTestCase.java0000644000175000017500000001545410766204322031615 0ustar charlescharles/* * $Id: OutboundMessageRouterTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.routing.RoutingException; import org.mule.routing.LoggingCatchAllStrategy; import org.mule.routing.filters.PayloadTypeFilter; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import org.mule.transport.DefaultMessageAdapter; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.ArrayList; import java.util.List; public class OutboundMessageRouterTestCase extends AbstractMuleTestCase { public void testOutboundMessageRouter() throws Exception { Mock session = MuleTestUtils.getMockSession(); session.expectAndReturn("getService", getTestService()); DefaultOutboundRouterCollection messageRouter = new DefaultOutboundRouterCollection(); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); assertNotNull(messageRouter.getCatchAllStrategy()); ImmutableEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider"); assertNotNull(endpoint1); ImmutableEndpoint endpoint2 = getTestOutboundEndpoint("Test2Provider"); assertNotNull(endpoint2); FilteringOutboundRouter router1 = new FilteringOutboundRouter(); PayloadTypeFilter filter = new PayloadTypeFilter(String.class); router1.setFilter(filter); List endpoints = new ArrayList(); endpoints.add(endpoint1); router1.setEndpoints(endpoints); FilteringOutboundRouter router2 = new FilteringOutboundRouter(); PayloadTypeFilter filter2 = new PayloadTypeFilter(); filter2.setExpectedType(Exception.class); router2.setFilter(filter2); endpoints = new ArrayList(); endpoints.add(endpoint2); router2.setEndpoints(endpoints); messageRouter.addRouter(router1); assertEquals(1, messageRouter.getRouters().size()); assertNotNull(messageRouter.removeRouter(router1)); assertEquals(0, messageRouter.getRouters().size()); List list = new ArrayList(); list.add(router1); list.add(router2); messageRouter.setRouters(list); MuleMessage message = new DefaultMuleMessage("test event"); session.expect("dispatchEvent", C.eq(message, endpoint1)); messageRouter.route(message, (MuleSession)session.proxy(), false); session.verify(); message = new DefaultMuleMessage(new IllegalArgumentException()); session.expectAndReturn("getService", getTestService()); session.expect("dispatchEvent", C.eq(message, endpoint2)); messageRouter.route(message, (MuleSession)session.proxy(), false); session.verify(); FilteringOutboundRouter router3 = new FilteringOutboundRouter(); router3.setFilter(new PayloadTypeFilter(Object.class)); endpoints = new ArrayList(); endpoints.add(endpoint2); router3.setEndpoints(endpoints); messageRouter.addRouter(router3); // now the message should be routed twice to different endpoints message = new DefaultMuleMessage("testing multiple routing"); session.expectAndReturn("getService", getTestService()); session.expectAndReturn("getService", getTestService()); session.expect("dispatchEvent", C.eq(message, endpoint1)); session.expect("dispatchEvent", C.eq(message, endpoint2)); messageRouter.setMatchAll(true); messageRouter.route(message, (MuleSession)session.proxy(), false); session.verify(); } public void testRouterWithCatchAll() throws Exception { final int[] count1 = new int[]{0}; final int[] count2 = new int[]{0}; final int[] catchAllCount = new int[]{0}; DefaultOutboundRouterCollection messageRouter = new DefaultOutboundRouterCollection(); FilteringOutboundRouter filterRouter1 = new FilteringOutboundRouter() { public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { count1[0]++; return message; } }; FilteringOutboundRouter filterRouter2 = new FilteringOutboundRouter() { public MuleMessage route(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { count2[0]++; return message; } }; filterRouter1.setFilter(new PayloadTypeFilter(Exception.class)); filterRouter2.setFilter(new PayloadTypeFilter(StringBuffer.class)); messageRouter.addRouter(filterRouter1); messageRouter.addRouter(filterRouter2); LoggingCatchAllStrategy strategy = new LoggingCatchAllStrategy() { public MuleMessage catchMessage(MuleMessage message, MuleSession session, boolean synchronous) throws RoutingException { catchAllCount[0]++; return null; } }; messageRouter.setCatchAllStrategy(strategy); MuleSession session = getTestSession(getTestService(), muleContext); messageRouter.route(new DefaultMuleMessage("hello"), session, true); assertEquals(1, catchAllCount[0]); assertEquals(0, count1[0]); assertEquals(0, count2[0]); messageRouter.route(new DefaultMuleMessage(new StringBuffer()), session, true); assertEquals(1, catchAllCount[0]); assertEquals(0, count1[0]); assertEquals(1, count2[0]); messageRouter.route(new DefaultMuleMessage(new Exception()), session, true); assertEquals(1, catchAllCount[0]); assertEquals(1, count1[0]); assertEquals(1, count2[0]); } public void testCorrelation() throws Exception { FilteringOutboundRouter filterRouter = new FilteringOutboundRouter(); MuleSession session = getTestSession(getTestService(), muleContext); MuleMessage message = new DefaultMuleMessage(new DefaultMessageAdapter(new StringBuffer())); OutboundEndpoint endpoint = getTestOutboundEndpoint("test"); filterRouter.setMessageProperties(session, message, endpoint); assertNotNull(message.getCorrelationId()); } } mule-2.0.1/core/src/test/java/org/mule/routing/outbound/MulticastingRouterTestCase.java0000644000175000017500000000507410754403514031152 0ustar charlescharles/* * $Id: MulticastingRouterTestCase.java 10790 2008-02-12 20:53:32Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.routing.LoggingCatchAllStrategy; import org.mule.routing.filters.RegExFilter; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.ArrayList; import java.util.List; public class MulticastingRouterTestCase extends AbstractMuleTestCase { public void testMulticastingRouter() throws Exception { Mock session = MuleTestUtils.getMockSession(); DefaultOutboundRouterCollection messageRouter = new DefaultOutboundRouterCollection(); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); ImmutableEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider"); assertNotNull(endpoint1); ImmutableEndpoint endpoint2 = getTestOutboundEndpoint("Test2Provider"); assertNotNull(endpoint2); MulticastingRouter router = new MulticastingRouter(); RegExFilter filter = new RegExFilter("(.*) event"); router.setFilter(filter); List endpoints = new ArrayList(); endpoints.add(endpoint1); endpoints.add(endpoint2); router.setEndpoints(endpoints); assertEquals(filter, router.getFilter()); MuleMessage message = new DefaultMuleMessage("test event"); assertTrue(router.isMatch(message)); session.expect("dispatchEvent", C.eq(message, endpoint1)); session.expect("dispatchEvent", C.eq(message, endpoint2)); router.route(message, (MuleSession)session.proxy(), false); session.verify(); message = new DefaultMuleMessage("test event"); session.expectAndReturn("sendEvent", C.eq(message, endpoint1), message); session.expectAndReturn("sendEvent", C.eq(message, endpoint2), message); MuleMessage result = router.route(message, (MuleSession)session.proxy(), true); assertNotNull(result); assertEquals(message, result); session.verify(); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/routing/outbound/FilterListMessageSplitterRouterTestCase.javamule-2.0.1/core/src/test/java/org/mule/routing/outbound/FilterListMessageSplitterRouterTestCase.java0000644000175000017500000000730310757615756033641 0ustar charlescharles/* * $Id: FilterListMessageSplitterRouterTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.routing.filters.PayloadTypeFilter; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Orange; import com.mockobjects.constraint.Constraint; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.ArrayList; import java.util.List; public class FilterListMessageSplitterRouterTestCase extends AbstractMuleTestCase { public void testMessageSplitterRouter() throws Exception { Mock session = MuleTestUtils.getMockSession(); OutboundEndpoint endpoint1 = getTestOutboundEndpoint("Test1endpoint", "test://endpointUri.1", null, new PayloadTypeFilter(Apple.class), null); OutboundEndpoint endpoint2 = getTestOutboundEndpoint("Test2Endpoint", "test://endpointUri.2", null, new PayloadTypeFilter(Orange.class), null); OutboundEndpoint endpoint3 = getTestOutboundEndpoint("Test3Endpoint", "test://endpointUri.3"); FilteringListMessageSplitter router = new FilteringListMessageSplitter(); router.setFilter(new PayloadTypeFilter(List.class)); router.addEndpoint(endpoint1); router.addEndpoint(endpoint2); router.addEndpoint(endpoint3); List payload = new ArrayList(); payload.add(new Apple()); payload.add(new Apple()); payload.add(new Orange()); payload.add(new String()); MuleMessage message = new DefaultMuleMessage(payload); assertTrue(router.isMatch(message)); session.expect("dispatchEvent", C.args(new PayloadConstraint(Apple.class), C.eq(endpoint1))); session.expect("dispatchEvent", C.args(new PayloadConstraint(Apple.class), C.eq(endpoint1))); session.expect("dispatchEvent", C.args(new PayloadConstraint(Orange.class), C.eq(endpoint2))); session.expect("dispatchEvent", C.args(new PayloadConstraint(String.class), C.eq(endpoint3))); router.route(message, (MuleSession) session.proxy(), false); session.verify(); message = new DefaultMuleMessage(payload); session.expectAndReturn("sendEvent", C.args(new PayloadConstraint(Apple.class), C.eq(endpoint1)), message); session.expectAndReturn("sendEvent", C.args(new PayloadConstraint(Apple.class), C.eq(endpoint1)), message); session.expectAndReturn("sendEvent", C.args(new PayloadConstraint(Orange.class), C.eq(endpoint2)), message); session.expectAndReturn("sendEvent", C.args(new PayloadConstraint(String.class), C.eq(endpoint3)), message); MuleMessage result = router.route(message, (MuleSession) session.proxy(), true); assertNotNull(result); assertEquals(message, result); session.verify(); } private class PayloadConstraint implements Constraint { private Class type; public PayloadConstraint(Class type) { this.type = type; } public boolean eval(Object o) { return ((MuleMessage) o).getPayload().getClass().equals(type); } } } mule-2.0.1/core/src/test/java/org/mule/routing/outbound/StaticRecipientListRouterTestCase.java0000644000175000017500000001007210754403514032427 0ustar charlescharles/* * $Id:StaticRecipientListRouterTestCase.java 5937 2007-04-09 22:35:04Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.RoutingException; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.ArrayList; import java.util.List; public class StaticRecipientListRouterTestCase extends AbstractMuleTestCase { public void testRecipientListRouter() throws Exception { Mock session = MuleTestUtils.getMockSession(); ImmutableEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider"); assertNotNull(endpoint1); List recipients = new ArrayList(); recipients.add("test://recipient1"); recipients.add("test://recipient2"); StaticRecipientList router = new StaticRecipientList(); router.setRecipients(recipients); List endpoints = new ArrayList(); endpoints.add(endpoint1); router.setEndpoints(endpoints); router.setMuleContext(muleContext); assertEquals(2, router.getRecipients().size()); MuleMessage message = new DefaultMuleMessage("test event"); assertTrue(router.isMatch(message)); // note this router clones endpoints so that the endpointUri can be // changed // The static recipient list router duplicates the message for each endpoint // so we can't // check for equality on the arguments passed to the dispatch / send methods session.expect("dispatchEvent", C.args(C.isA(MuleMessage.class), C.isA(ImmutableEndpoint.class))); session.expect("dispatchEvent", C.args(C.isA(MuleMessage.class), C.isA(ImmutableEndpoint.class))); router.route(message, (MuleSession)session.proxy(), false); session.verify(); message = new DefaultMuleMessage("test event"); router.getRecipients().add("test://recipient3"); session.expectAndReturn("sendEvent", C.args(C.isA(MuleMessage.class), C.isA(ImmutableEndpoint.class)), message); session.expectAndReturn("sendEvent", C.args(C.isA(MuleMessage.class), C.isA(ImmutableEndpoint.class)), message); session.expectAndReturn("sendEvent", C.args(C.isA(MuleMessage.class), C.isA(ImmutableEndpoint.class)), message); MuleMessage result = router.route(message, (MuleSession)session.proxy(), true); assertNotNull(result); assertTrue(result.getPayload() instanceof List); assertEquals(3, ((List)result.getPayload()).size()); session.verify(); } public void testBadRecipientListRouter() throws Exception { Mock session = MuleTestUtils.getMockSession(); ImmutableEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider"); assertNotNull(endpoint1); List recipients = new ArrayList(); recipients.add("malformed-endpointUri-recipient1"); StaticRecipientList router = new StaticRecipientList(); router.setRecipients(recipients); List endpoints = new ArrayList(); endpoints.add(endpoint1); router.setEndpoints(endpoints); assertEquals(1, router.getRecipients().size()); MuleMessage message = new DefaultMuleMessage("test event"); assertTrue(router.isMatch(message)); try { router.route(message, (MuleSession)session.proxy(), false); fail("Should not allow malformed endpointUri"); } catch (RoutingException e) { // ignore } session.verify(); } } mule-2.0.1/core/src/test/java/org/mule/routing/outbound/ChainingRouterTestCase.java0000644000175000017500000001241510757615756030244 0ustar charlescharles/* * $Id: ChainingRouterTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.endpoint.DynamicURIOutboundEndpoint; import org.mule.endpoint.MuleEndpointURI; import org.mule.routing.LoggingCatchAllStrategy; import org.mule.routing.filters.PayloadTypeFilter; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class ChainingRouterTestCase extends AbstractMuleTestCase { private Mock session; private ChainingRouter router; private List endpoints; protected void doSetUp() throws Exception { super.doSetUp(); session = MuleTestUtils.getMockSession(); router = new ChainingRouter(); DefaultOutboundRouterCollection messageRouter = new DefaultOutboundRouterCollection(); messageRouter.setCatchAllStrategy(new LoggingCatchAllStrategy()); ImmutableEndpoint endpoint1 = getTestOutboundEndpoint("Test1Provider"); assertNotNull(endpoint1); ImmutableEndpoint endpoint2 = getTestOutboundEndpoint("Test2Provider"); assertNotNull(endpoint2); PayloadTypeFilter filter = new PayloadTypeFilter(String.class); router.setFilter(filter); endpoints = new ArrayList(); endpoints.add(endpoint1); endpoints.add(endpoint2); router.setEndpoints(endpoints); assertEquals(filter, router.getFilter()); } public void testChainingOutboundRouterSynchronous() throws Exception { MuleMessage message = new DefaultMuleMessage("test event"); assertTrue(router.isMatch(message)); message = new DefaultMuleMessage("test event"); session.expectAndReturn("sendEvent", C.eq(message, endpoints.get(0)), message); session.expectAndReturn("sendEvent", C.eq(message, endpoints.get(1)), message); final MuleMessage result = router.route(message, (MuleSession)session.proxy(), true); assertNotNull("This is a sync call, we need a result returned.", result); assertEquals(message, result); session.verify(); } public void testChainingOutboundRouterSynchronousWithTemplate() throws Exception { OutboundEndpoint endpoint3 = getTestOutboundEndpoint("Test3Provider", "test://foo?[barValue]"); assertNotNull(endpoint3); router.addEndpoint(endpoint3); Map m = new HashMap(); m.put("barValue", "bar"); MuleMessage message = new DefaultMuleMessage("test event", m); assertTrue(router.isMatch(message)); ImmutableEndpoint ep = router.getEndpoint(2, message); assertEquals("test://foo?bar", ep.getEndpointURI().toString()); session.expectAndReturn("sendEvent", C.eq(message, new DynamicURIOutboundEndpoint( (OutboundEndpoint) router.getEndpoints().get(0), new MuleEndpointURI("test://test"))), message); session.expectAndReturn("sendEvent", C.eq(message, new DynamicURIOutboundEndpoint( (OutboundEndpoint) router.getEndpoints().get(1), new MuleEndpointURI("test://test"))), message); session.expectAndReturn("sendEvent", C.eq(message, new DynamicURIOutboundEndpoint( (OutboundEndpoint) router.getEndpoints().get(2), new MuleEndpointURI("test://foo?bar"))), message); final MuleMessage result = router.route(message, (MuleSession)session.proxy(), true); assertNotNull("This is a sync call, we need a result returned.", result); assertEquals(message, result); session.verify(); } public void testChainingOutboundRouterAsynchronous() throws Exception { MuleMessage message = new DefaultMuleMessage("test event"); assertTrue(router.isMatch(message)); message = new DefaultMuleMessage("test event"); session.expectAndReturn("sendEvent", C.eq(message, endpoints.get(0)), message); session.expectAndReturn("dispatchEvent", C.eq(message, endpoints.get(1)), message); final MuleMessage result = router.route(message, (MuleSession)session.proxy(), false); assertNull("Async call shouldn't return any result.", result); session.verify(); } /** * One of the endpoints returns null and breaks the chain */ public void testBrokenChain() throws Exception { final MuleMessage message = new DefaultMuleMessage("test event"); final ImmutableEndpoint endpoint1 = (ImmutableEndpoint)endpoints.get(0); session.expect("sendEvent", C.eq(message, endpoint1)); MuleMessage result = router.route(message, (MuleSession)session.proxy(), false); session.verify(); assertNull(result); } } mule-2.0.1/core/src/test/java/org/mule/routing/outbound/EndpointSelectorTestCase.java0000644000175000017500000000764011005753365030572 0ustar charlescharles/* * $Id: EndpointSelectorTestCase.java 11659 2008-04-30 02:18:29Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.routing.outbound; import org.mule.DefaultMuleMessage; import org.mule.api.MuleMessage; import org.mule.api.MuleSession; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.routing.RoutingException; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.MuleTestUtils; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class EndpointSelectorTestCase extends AbstractMuleTestCase { Mock session; ImmutableEndpoint dest1; ImmutableEndpoint dest2; ImmutableEndpoint dest3; EndpointSelector router; protected void doSetUp() throws Exception { super.doSetUp(); session = MuleTestUtils.getMockSession(); dest1 = getTestOutboundEndpoint("dest1"); dest2 = getTestOutboundEndpoint("dest2"); dest3 = getTestOutboundEndpoint("dest3"); List endpoints = new ArrayList(); endpoints.add(dest1); endpoints.add(dest2); endpoints.add(dest3); router = new EndpointSelector(); router.setEndpoints(endpoints); router.setMuleContext(muleContext); } public void testSelectEndpointDefaultProperty() throws Exception { Map props = new HashMap(); props.put("apple", "red"); props.put(router.DEFAULT_SELECTOR_EXPRESSION, "dest3"); props.put("banana", "yellow"); MuleMessage message = new DefaultMuleMessage("test event", props); assertTrue(router.isMatch(message)); session.expect("dispatchEvent", C.eq(message, dest3)); router.route(message, (MuleSession) session.proxy(), false); session.verify(); } public void testSelectEndpointCustomProperty() throws Exception { // The "wayOut" property will determine which endpoint the message gets sent // to. router.setExpression("wayOut"); router.setEvaluator("header"); Map props = new HashMap(); props.put("apple", "red"); props.put("wayOut", "dest2"); props.put("banana", "yellow"); MuleMessage message = new DefaultMuleMessage("test event", props); assertTrue(router.isMatch(message)); session.expect("dispatchEvent", C.eq(message, dest2)); router.route(message, (MuleSession) session.proxy(), false); session.verify(); } public void testSelectEndpointNoMatch() throws Exception { Map props = new HashMap(); props.put(router.DEFAULT_SELECTOR_EXPRESSION, "dest5"); try { // this test used to fail at the router; it now fails earlier when the message is // constructed. i don't think this is a problem. MuleMessage message = new DefaultMuleMessage("test event", props); router.route(message, (MuleSession) session.proxy(), false); fail("Router should have thrown an exception if endpoint was not found."); } catch (Exception e) { // expected } } public void testSelectEndpointNoPropertySet() throws Exception { MuleMessage message = new DefaultMuleMessage("test event"); try { router.route(message, (MuleSession) session.proxy(), false); fail("Router should have thrown an exception if no selector property was set on the message."); } catch (RoutingException e) { // expected } } } mule-2.0.1/core/src/test/java/org/mule/agent/0000755000175000017500000000000011351411073020542 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/agent/MockAgent_D.java0000644000175000017500000000110010776664712023534 0ustar charlescharles/* * $Id: MockAgent_D.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.agent; public class MockAgent_D extends MockAgent { public MockAgent_D(Class[] classes) { super(classes); } } mule-2.0.1/core/src/test/java/org/mule/agent/MockAgent_C.java0000644000175000017500000000116710776664712023550 0ustar charlescharles/* * $Id: MockAgent_C.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.agent; public class MockAgent_C extends MockAgent { public MockAgent_C() { super(); } public MockAgent_C(Class[] classes) { super(classes); } } mule-2.0.1/core/src/test/java/org/mule/agent/MockAgent_A.java0000644000175000017500000000117310776664712023543 0ustar charlescharles/* * $Id: MockAgent_A.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.agent; public class MockAgent_A extends MockAgent { public MockAgent_A() { super(); } public MockAgent_A(Class[] classes) { super(classes); } } mule-2.0.1/core/src/test/java/org/mule/agent/AgentSorterTestCase.java0000644000175000017500000000753110776664712025330 0ustar charlescharles/* * $Id: AgentSorterTestCase.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.agent; import java.util.ArrayList; import java.util.List; import junit.framework.Assert; import junit.framework.TestCase; public class AgentSorterTestCase extends TestCase { public void testListWithoutDependencies() { MockAgent a = new MockAgent_A(); MockAgent b = new MockAgent_B(); MockAgent c = new MockAgent_C(); List agents = new ArrayList(); agents.add(a); agents.add(b); agents.add(c); List result = AgentSorter.sortAgents(agents); Assert.assertEquals(3, result.size()); } public void testSortWithSimpleDependency() { MockAgent a = new MockAgent_A(); MockAgent b = new MockAgent_B(); MockAgent c = new MockAgent_C(new Class[] { MockAgent_A.class }); List agents = new ArrayList(); agents.add(a); agents.add(b); agents.add(c); List result = AgentSorter.sortAgents(agents); Assert.assertEquals(3, result.size()); int indexOfA = result.indexOf(a); int indexOfC = result.indexOf(c); Assert.assertTrue(indexOfA < indexOfC); } public void testSortWithForwardDependency() { MockAgent a = new MockAgent_A(new Class[] { MockAgent_C.class }); MockAgent b = new MockAgent_B(); MockAgent c = new MockAgent_C(); List agents = new ArrayList(); agents.add(a); agents.add(b); agents.add(c); List result = AgentSorter.sortAgents(agents); Assert.assertEquals(3, result.size()); int indexOfA = result.indexOf(a); Assert.assertTrue(indexOfA > -1); int indexOfC = result.indexOf(c); Assert.assertTrue(indexOfC > -1); Assert.assertTrue(indexOfC < indexOfA); } public void testCyclicDependency() { MockAgent a = new MockAgent_A(new Class[] { MockAgent_B.class }); MockAgent b = new MockAgent_B(new Class[] { MockAgent_A.class }); List agents = new ArrayList(); agents.add(a); agents.add(b); try { AgentSorter.sortAgents(agents); Assert.fail(); } catch (IllegalArgumentException iae) { // expected exception } } public void testSortComplexDependencies() { MockAgent a = new MockAgent_A(); MockAgent b = new MockAgent_B(new Class[] { MockAgent_A.class }); MockAgent c = new MockAgent_C(new Class[] { MockAgent_B.class }); MockAgent d = new MockAgent_D(new Class[] { MockAgent_A.class, MockAgent_C.class }); List agents = new ArrayList(); agents.add(a); agents.add(d); agents.add(c); agents.add(b); List result = AgentSorter.sortAgents(agents); Assert.assertEquals(4, result.size()); Assert.assertEquals(a, result.get(0)); Assert.assertEquals(b, result.get(1)); Assert.assertEquals(c, result.get(2)); Assert.assertEquals(d, result.get(3)); } public void testSortWithMissingDependency() { MockAgent a = new MockAgent_A(); MockAgent b = new MockAgent_B(new Class[] { MockAgent_C.class }); List agents = new ArrayList(); agents.add(a); agents.add(b); List result = AgentSorter.sortAgents(agents); Assert.assertEquals(2, result.size()); } } mule-2.0.1/core/src/test/java/org/mule/agent/MockAgent_B.java0000644000175000017500000000116710776664712023547 0ustar charlescharles/* * $Id: MockAgent_B.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.agent; public class MockAgent_B extends MockAgent { public MockAgent_B() { super(); } public MockAgent_B(Class[] classes) { super(classes); } } mule-2.0.1/core/src/test/java/org/mule/agent/MockAgent.java0000644000175000017500000000337410776664712023310 0ustar charlescharles/* * $Id: MockAgent.java 11530 2008-04-08 12:49:14Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.agent; import org.mule.api.MuleException; import org.mule.api.agent.Agent; import org.mule.api.lifecycle.InitialisationException; import org.mule.util.ClassUtils; import java.util.Arrays; import java.util.Collections; import java.util.List; public class MockAgent extends Object implements Agent { private String name; private List dependencies = Collections.EMPTY_LIST; public MockAgent() { super(); } public MockAgent(Class[] classes) { super(); dependencies = Arrays.asList(classes); } public List getDependentAgents() { return dependencies; } public String getDescription() { return ClassUtils.getSimpleName(this.getClass()); } public void registered() { // nothing to do } public void unregistered() { // nothing to do } public void initialise() throws InitialisationException { // nothing to do } public void start() throws MuleException { // nothing to do } public void stop() throws MuleException { // nothing to do } public void dispose() { // nothing to do } public String getName() { return name; } public void setName(String name) { this.name = name; } } mule-2.0.1/core/src/test/java/org/mule/transport/0000755000175000017500000000000011351411073021500 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/core/src/test/java/org/mule/transport/KeyedPoolMessageDispatcherFactoryAdapterTestCase.javamule-2.0.1/core/src/test/java/org/mule/transport/KeyedPoolMessageDispatcherFactoryAdapterTestCase.ja0000644000175000017500000000161210745677442033534 0ustar charlescharles/* * $Id: KeyedPoolMessageDispatcherFactoryAdapterTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.tck.AbstractMuleTestCase; public class KeyedPoolMessageDispatcherFactoryAdapterTestCase extends AbstractMuleTestCase { public void testNullFactory() { try { new KeyedPoolMessageDispatcherFactoryAdapter(null); fail("expected IllegalArgumentException"); } catch (IllegalArgumentException iex) { // OK } } } mule-2.0.1/core/src/test/java/org/mule/transport/GenericConnectorTestCase.java0000644000175000017500000000371310745677442027256 0ustar charlescharles/* * $Id: GenericConnectorTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.MuleRuntimeException; import org.mule.tck.AbstractMuleTestCase; import javax.resource.spi.work.Work; import javax.resource.spi.work.WorkEvent; import javax.resource.spi.work.WorkException; /** * The test is not there in AbstractConnector, because we need to call a protected * method, and the latter class is in a different package. */ public class GenericConnectorTestCase extends AbstractMuleTestCase { /** * Throwable should not cause a ClassCastException (MULE-802). * * @throws Exception */ public void testSpiWorkThrowableHandling() throws Exception { try { AbstractConnector connector = getTestConnector(); connector.handleWorkException(getTestWorkEvent(), "workRejected"); } catch (MuleRuntimeException mrex) { assertNotNull(mrex); assertTrue(mrex.getCause().getClass() == Throwable.class); assertEquals("testThrowable", mrex.getCause().getMessage()); } } private WorkEvent getTestWorkEvent() { WorkEvent event = new WorkEvent(this, // source WorkEvent.WORK_REJECTED, getTestWork(), new WorkException(new Throwable("testThrowable"))); return event; } private Work getTestWork() { return new Work() { public void release() { // noop } public void run() { // noop } }; } } mule-2.0.1/core/src/test/java/org/mule/transport/NullPayloadTestCase.java0000644000175000017500000000174310745677442026254 0ustar charlescharles/* * $Id: NullPayloadTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.tck.AbstractMuleTestCase; import org.apache.commons.lang.SerializationUtils; public class NullPayloadTestCase extends AbstractMuleTestCase { public void testUniqueDeserialization() { NullPayload result = NullPayload.getInstance(); byte[] serialized = SerializationUtils.serialize(result); assertNotNull(serialized); Object deserialized = SerializationUtils.deserialize(serialized); assertSame(deserialized, result); assertEquals(deserialized, result); } } mule-2.0.1/core/src/test/java/org/mule/transport/AbstractMessageAdapterTestCase.java0000644000175000017500000000535510754365306030375 0ustar charlescharles/* * $Id: AbstractMessageAdapterTestCase.java 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.api.MessagingException; import org.mule.api.MuleMessage; import org.mule.api.transport.MessageAdapter; import org.mule.tck.AbstractMuleTestCase; public abstract class AbstractMessageAdapterTestCase extends AbstractMuleTestCase { protected void doSetUp() throws Exception { RequestContext.setEvent(getTestEvent("hello")); } protected void doTearDown() throws Exception { RequestContext.clear(); } protected void doTestMessageEqualsPayload(Object message, Object payload) throws Exception { assertEquals(message, payload); } public void testMessageRetrieval() throws Exception { Object message = getValidMessage(); MessageAdapter adapter = createAdapter(message); MuleMessage muleMessage = new DefaultMuleMessage(adapter); doTestMessageEqualsPayload(message, adapter.getPayload()); byte[] bytes = muleMessage.getPayloadAsBytes(); assertNotNull(bytes); String stringMessage = muleMessage.getPayloadAsString(); assertNotNull(stringMessage); assertNotNull(adapter.getPayload()); } public void testMessageProps() throws Exception { MessageAdapter adapter = createAdapter(getValidMessage()); adapter.setProperty("TestString", "Test1"); adapter.setProperty("TestLong", new Long(20000000)); adapter.setProperty("TestInt", new Integer(200000)); assertNotNull(adapter.getPropertyNames()); Object prop = adapter.getProperty("TestString"); assertNotNull(prop); assertEquals("Test1", prop); prop = adapter.getProperty("TestLong"); assertNotNull(prop); assertEquals(new Long(20000000), prop); prop = adapter.getProperty("TestInt"); assertNotNull(prop); assertEquals(new Integer(200000), prop); } public Object getInvalidMessage() { return new InvalidMessage(); } public abstract Object getValidMessage() throws Exception; public abstract MessageAdapter createAdapter(Object payload) throws MessagingException; final class InvalidMessage { public String toString() { return "invalid message"; } } } mule-2.0.1/core/src/test/java/org/mule/transport/AbstractMessageReceiverTestCase.java0000644000175000017500000000435210757615756030567 0ustar charlescharles/* * $Id: AbstractMessageReceiverTestCase.java 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.MessageReceiver; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Orange; public abstract class AbstractMessageReceiverTestCase extends AbstractMuleTestCase { protected Service service; protected InboundEndpoint endpoint; protected void doSetUp() throws Exception { service = getTestService("orange", Orange.class); endpoint = getEndpoint(); } public void testCreate() throws Exception { Service service = getTestService("orange", Orange.class); InboundEndpoint endpoint = getTestInboundEndpoint("Test"); MessageReceiver receiver = getMessageReceiver(); assertNotNull(receiver.getEndpoint()); assertNotNull(receiver.getConnector()); try { receiver.setEndpoint(null); fail("Provider cannot be set to null"); } catch (IllegalArgumentException e) { // expected } try { receiver.setService(null); fail("service cannot be set to null"); } catch (IllegalArgumentException e) { // expected } receiver.setService(service); assertNotNull(receiver.getService()); receiver.setEndpoint(endpoint); assertNotNull(receiver.getEndpoint()); receiver.dispose(); } public abstract MessageReceiver getMessageReceiver() throws Exception; /** * Implementations of this method should ensure that the correct connector is set * on the endpoint * * @return * @throws Exception */ public abstract InboundEndpoint getEndpoint() throws Exception; } mule-2.0.1/core/src/test/java/org/mule/transport/AbstractConnectorTestCase.java0000644000175000017500000002063410761043432027426 0ustar charlescharles/* * $Id: AbstractConnectorTestCase.java 11035 2008-02-26 17:06:34Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport; import org.mule.api.DefaultMuleException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import org.mule.api.transport.MessageDispatcherFactory; import org.mule.api.transport.MessageRequesterFactory; import org.mule.config.i18n.MessageFactory; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import com.mockobjects.dynamic.C; import com.mockobjects.dynamic.Mock; import java.beans.ExceptionListener; /** * AbstractConnectorTestCase tests common behaviour of all endpoints and * provides 'reminder' methods for implementation specific interface methods */ public abstract class AbstractConnectorTestCase extends AbstractMuleTestCase { protected String connectorName; public AbstractConnectorTestCase() { setStartContext(true); } /* * (non-Javadoc) * * @see junit.framework.TestCase#setUp() */ protected void doSetUp() throws Exception { Connector connector = createConnector(); connectorName = connector.getName(); if (connectorName == null) { fail("You need to set the connector name on the connector before returning it"); } connector.setMuleContext(muleContext); muleContext.getRegistry().registerConnector(connector); } protected void doTearDown() throws Exception { Connector connector = getConnector(); if (connector.isDisposed()) { fail("Connector has been disposed prematurely - lifecycle problem? Instance: " + connector); } connector.dispose(); } /** Look up the connector from the Registry */ protected Connector getConnector() { return muleContext.getRegistry().lookupConnector(connectorName); } public void testConnectorExceptionHandling() throws Exception { Connector connector = getConnector(); assertNotNull(connector); // Text exception handler Mock ehandlerMock = new Mock(ExceptionListener.class, "exceptionHandler"); ehandlerMock.expect("exceptionThrown", C.isA(Exception.class)); assertNotNull(connector.getExceptionListener()); connector.setExceptionListener((ExceptionListener) ehandlerMock.proxy()); connector.handleException(new DefaultMuleException(MessageFactory.createStaticMessage("Dummy"))); if (connector instanceof AbstractConnector) { ehandlerMock.expect("exceptionThrown", C.isA(Exception.class)); ((AbstractConnector) connector).exceptionThrown( new DefaultMuleException(MessageFactory.createStaticMessage("Dummy"))); } ehandlerMock.verify(); connector.setExceptionListener(null); try { connector.handleException(new DefaultMuleException(MessageFactory.createStaticMessage("Dummy"))); fail("Should have thrown exception as no strategy is set"); } catch (RuntimeException e) { // expected } } public void testConnectorLifecycle() throws Exception { // this test used to use the connector created for this test, but since we need to // simulate disposal as well we have to create an extra instance here. Connector localConnector = this.createConnector(); localConnector.setMuleContext(muleContext); localConnector.setName(connectorName+"-temp"); // the connector did not come from the registry, so we need to initialise manually localConnector.initialise(); localConnector.start(); assertNotNull(localConnector); assertTrue(localConnector.isStarted()); assertTrue(!localConnector.isDisposed()); localConnector.stop(); assertTrue(!localConnector.isStarted()); assertTrue(!localConnector.isDisposed()); localConnector.dispose(); assertTrue(!localConnector.isStarted()); assertTrue(localConnector.isDisposed()); try { localConnector.start(); fail("Connector cannot be restarted after being disposing"); } catch (Exception e) { // expected } } public void testConnectorListenerSupport() throws Exception { Connector connector = getConnector(); assertNotNull(connector); Service service = getTestService("anApple", Apple.class); InboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getInboundEndpoint(getTestEndpointURI()); try { connector.registerListener(null, null); fail("cannot register null"); } catch (Exception e) { // expected } try { connector.registerListener(null, endpoint); fail("cannot register null"); } catch (Exception e) { // expected } try { connector.registerListener(service, null); fail("cannot register null"); } catch (Exception e) { // expected } connector.registerListener(service, endpoint); // this should work connector.unregisterListener(service, endpoint); // so should this try { connector.unregisterListener(null, null); fail("cannot unregister null"); } catch (Exception e) { // expected } try { connector.unregisterListener(service, null); fail("cannot unregister null"); } catch (Exception e) { // expected } try { connector.unregisterListener(null, endpoint); fail("cannot unregister null"); } catch (Exception e) { // expected } connector.unregisterListener(service, endpoint); muleContext.getRegistry().unregisterService(service.getName()); } public void testConnectorBeanProps() throws Exception { Connector connector = getConnector(); assertNotNull(connector); try { connector.setName(null); fail("Should throw IllegalArgumentException if name set to null"); } catch (IllegalArgumentException e) { // expected } connector.setName("Test"); assertEquals("Test", connector.getName()); assertNotNull("Protocol must be set as a constant", connector.getProtocol()); } public void testConnectorMessageAdapter() throws Exception { Connector connector = getConnector(); assertNotNull(connector); MessageAdapter adapter = connector.getMessageAdapter(getValidMessage()); assertNotNull(adapter); } public void testConnectorMessageDispatcherFactory() throws Exception { Connector connector = getConnector(); assertNotNull(connector); MessageDispatcherFactory factory = connector.getDispatcherFactory(); assertNotNull(factory); } public void testConnectorMessageRequesterFactory() throws Exception { Connector connector = getConnector(); assertNotNull(connector); MessageRequesterFactory factory = connector.getRequesterFactory(); assertNotNull(factory); } public void testConnectorInitialise() throws Exception { Connector connector = getConnector(); try { connector.initialise(); fail("A connector cannot be initialised more than once"); } catch (Exception e) { // expected } } public abstract Connector createConnector() throws Exception; public abstract Object getValidMessage() throws Exception; public abstract String getTestEndpointURI(); } mule-2.0.1/core/src/test/java/org/mule/MuleMessageTestCase.java0000644000175000017500000000504210754375733024175 0ustar charlescharles/* * $Id: MuleMessageTestCase.java 10789 2008-02-12 20:04:43Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.tck.AbstractMuleTestCase; import org.mule.transformer.simple.ByteArrayToObject; import org.mule.transformer.simple.ObjectToByteArray; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.activation.DataHandler; import javax.activation.DataSource; public class MuleMessageTestCase extends AbstractMuleTestCase { public void testAttachmentPersistence() throws Exception { ObjectToByteArray transformer = new ObjectToByteArray(); transformer.setAcceptUMOMessage(true); MuleEvent event = RequestContext.setEvent(getTestEvent("Mmm... attachments!")); MuleMessage msg = event.getMessage(); msg.addAttachment("test-attachment", new DataHandler(new StringDataSource("attachment"))); Object serialized = transformer.transform(msg); assertNotNull(serialized); MuleMessage deserialized = (MuleMessage) new ByteArrayToObject().transform(serialized); assertNotNull(deserialized); assertEquals(deserialized.getUniqueId(), msg.getUniqueId()); assertEquals(deserialized.getPayload(), msg.getPayload()); assertEquals(deserialized.getAttachmentNames(), msg.getAttachmentNames()); } // silly little fake DataSource so that we don't need to use javamail protected static class StringDataSource implements DataSource { protected String content; public StringDataSource(String payload) { super(); content = payload; } public InputStream getInputStream() throws IOException { return new ByteArrayInputStream(content.getBytes()); } public OutputStream getOutputStream() { throw new UnsupportedOperationException("Read-only javax.activation.DataSource"); } public String getContentType() { return "text/plain"; } public String getName() { return "StringDataSource"; } } } mule-2.0.1/core/src/test/java/org/mule/mule/0000755000175000017500000000000011351411074020407 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/mule/model/0000755000175000017500000000000011351411074021507 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/mule/model/LegacyEntryPointResolverTestCase.java0000644000175000017500000002676310746275214031021 0ustar charlescharles/* * $Id: LegacyEntryPointResolverTestCase.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule.model; import org.mule.RequestContext; import org.mule.api.MuleException; import org.mule.api.config.MuleProperties; import org.mule.api.model.EntryPointResolverSet; import org.mule.model.resolvers.ArrayEntryPointResolver; import org.mule.model.resolvers.EntryPointNotFoundException; import org.mule.model.resolvers.LegacyEntryPointResolverSet; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Banana; import org.mule.tck.testmodels.fruit.Fruit; import org.mule.tck.testmodels.fruit.FruitBowl; import org.mule.tck.testmodels.fruit.FruitCleaner; import org.mule.tck.testmodels.fruit.FruitLover; import org.mule.tck.testmodels.fruit.Kiwi; import org.mule.tck.testmodels.fruit.Orange; import org.mule.tck.testmodels.fruit.WaterMelon; import java.util.Arrays; public class LegacyEntryPointResolverTestCase extends AbstractMuleTestCase { /** Name of the method override property on the event. */ private static final String METHOD_PROPERTY_NAME = MuleProperties.MULE_METHOD_PROPERTY; /** Name of the non-existent method. */ private static final String INVALID_METHOD_NAME = "nosuchmethod"; public void testExplicitMethodMatch() throws Exception { try { LegacyEntryPointResolverSet resolver = new LegacyEntryPointResolverSet(); resolver.invoke(new WaterMelon(), getTestEventContext("blah")); } catch (MuleException e) { fail("Test should have passed: " + e); } } public void testExplicitMethodMatchComplexObject() throws Exception { try { LegacyEntryPointResolverSet resolver = new LegacyEntryPointResolverSet(); resolver.invoke(new FruitBowl(), getTestEventContext(new FruitLover("Mmmm"))); } catch (MuleException e) { fail("Test should have passed: " + e); } } public void testExplicitMethodMatchSetArrayFail() throws Exception { try { LegacyEntryPointResolverSet resolver = new LegacyEntryPointResolverSet(); resolver.invoke(new FruitBowl(), getTestEventContext(new Fruit[]{new Apple(), new Orange()})); fail("Test should have failed because the arguments were not wrapped properly: "); } catch (MuleException e) { //expected } } public void testExplicitMethodMatchSetArrayPass() throws Exception { try { LegacyEntryPointResolverSet resolver = new LegacyEntryPointResolverSet(); resolver.invoke(new FruitBowl(), getTestEventContext(new Object[]{new Fruit[]{new Apple(), new Orange()}})); } catch (MuleException e) { fail("Test should have passed: " + e); } } /* this tests the same as above except it uses the {@link ArrayEntryPointResolver} and does not wrap the args with an array */ public void testExplicitMethodMatchSetArrayPassUsingExplicitResolver() throws Exception { try { LegacyEntryPointResolverSet resolver = new LegacyEntryPointResolverSet(); resolver.addEntryPointResolver(new ArrayEntryPointResolver()); resolver.invoke(new FruitBowl(), getTestEventContext(new Fruit[]{new Apple(), new Orange()})); } catch (MuleException e) { fail("Test should have passed: " + e); } } // public ComponentMethodMapping[] getComponentMappings() // { // ComponentMethodMapping[] mappings = new ComponentMethodMapping[5]; // mappings[0] = new ComponentMethodMapping(WaterMelon.class, "myEventHandler", MuleEvent.class); // mappings[1] = new ComponentMethodMapping(FruitBowl.class, "consumeFruit", FruitLover.class); // // see testArrayArgumentResolution // mappings[2] = new ComponentMethodMapping(FruitBowl.class, "setFruit", Fruit[].class); // // see testListArgumentResolution // mappings[3] = new ComponentMethodMapping(FruitBowl.class, "setFruit", Collection.class); // mappings[4] = new ComponentMethodMapping(Banana.class, "peelEvent", EventObject.class); // // // TODO This fails because "implementation" can no longer be a container reference, it must be // // an actual object and InvocationHandler does not have a default constructor. // // // test proxy objects // //mappings[5] = new ComponentMethodMapping(InvocationHandler.class, "invoke", FruitLover.class, true); // // return mappings; // } // // @Override // public UMODescriptor getDescriptorToResolve(String className) throws Exception // { // UMODescriptor descriptor = super.getDescriptorToResolve(className); // descriptor.setInboundRouter(new DefaultInboundRouterCollection()); // Endpoint endpoint = new MuleEndpoint("test://foo", true); // // if (className.equals(FruitBowl.class.getName())) // { // endpoint.setTransformers(CollectionUtils.singletonList(new ObjectToFruitLover())); // descriptor.getInboundRouter().addEndpoint(endpoint); // } // else if (className.equals(InvocationHandler.class.getName())) // { // endpoint.setTransformers(CollectionUtils.singletonList(new ObjectToFruitLover())); // descriptor.getInboundRouter().addEndpoint(endpoint); // } // return descriptor; // } /** * Tests entrypoint discovery when there is more than one discoverable method * with MuleEventContext parameter. */ public void testFailEntryPointMultiplePayloadMatches() throws Exception { EntryPointResolverSet resolverSet = new LegacyEntryPointResolverSet(); try { RequestContext.setEvent(getTestEvent("Hello")); resolverSet.invoke(new MultiplePayloadsTestObject(), RequestContext.getEventContext()); fail("Should have failed to find entrypoint."); } catch (EntryPointNotFoundException itex) { // expected } } /** * If there was a method parameter specified to override the discovery mechanism * and no such method exists, an exception should be thrown, and no fallback to * the default discovery should take place. */ public void testMethodOverrideDoesNotFallback() throws Exception { EntryPointResolverSet resolverSet = new LegacyEntryPointResolverSet(); RequestContext.setEvent(getTestEvent(new FruitLover("Yummy!"))); // those are usually set on the endpoint and copied over to the message final String methodName = "nosuchmethod"; final String propertyName = MuleProperties.MULE_METHOD_PROPERTY; RequestContext.getEventContext().getMessage().setProperty(propertyName, methodName); resolverSet.invoke(new FruitBowl(), RequestContext.getEventContext()); // fail("Should have failed to find an entrypoint."); } /** * If there was a method parameter specified to override the discovery mechanism * and a Callable instance is serving the request, call the Callable, ignore the * method override parameter. */ public void testMethodOverrideIgnoredWithCallable() throws Exception { EntryPointResolverSet resolver = new LegacyEntryPointResolverSet(); RequestContext.setEvent(getTestEvent(new FruitLover("Yummy!"))); // those are usually set on the endpoint and copied over to the message RequestContext.getEventContext().getMessage().setProperty(METHOD_PROPERTY_NAME, INVALID_METHOD_NAME); Apple apple = new Apple(); apple.setAppleCleaner(new FruitCleaner() { public void wash(Fruit fruit) { // dummy } public void polish(Fruit fruit) { // dummy } }); resolver.invoke(apple, RequestContext.getEventContext()); } /** * If there was a method parameter specified to override the discovery mechanism * and a target instance has a method accepting MuleEventContext, proceed to call * this method, ignore the method override parameter. */ public void testMethodOverrideIgnoredWithEventContext() throws Exception { EntryPointResolverSet resolverSet = new LegacyEntryPointResolverSet(); RequestContext.setEvent(getTestEvent(new FruitLover("Yummy!"))); // those are usually set on the endpoint and copied over to the message final String methodName = "nosuchmethod"; final String propertyName = MuleProperties.MULE_METHOD_PROPERTY; RequestContext.getEventContext().getMessage().setProperty(propertyName, methodName); try { resolverSet.invoke(new Kiwi(), RequestContext.getEventContext()); fail("no such method on service"); } catch (EntryPointNotFoundException e) { // expected } } /** Test for proper resolution of a method that takes an array as argument. */ // TODO MULE-1088: currently fails, therefore disabled public void testArrayArgumentResolution() throws Exception { EntryPointResolverSet resolverSet = new LegacyEntryPointResolverSet(); Object payload = new Object[]{new Fruit[]{new Apple(), new Banana()}}; RequestContext.setEvent(getTestEvent(payload)); FruitBowl bowl = new FruitBowl(); assertFalse(bowl.hasApple()); assertFalse(bowl.hasBanana()); resolverSet.invoke(bowl, RequestContext.getEventContext()); assertTrue(bowl.hasApple()); assertTrue(bowl.hasBanana()); } /** Test for proper resolution of a method that takes a List as argument. */ public void testListArgumentResolution() throws Exception { EntryPointResolverSet resolverSet = new LegacyEntryPointResolverSet(); Object payload = Arrays.asList(new Fruit[]{new Apple(), new Banana()}); RequestContext.setEvent(getTestEvent(payload)); FruitBowl bowl = new FruitBowl(); assertFalse(bowl.hasApple()); assertFalse(bowl.hasBanana()); resolverSet.invoke(bowl, RequestContext.getEventContext()); assertTrue(bowl.hasApple()); assertTrue(bowl.hasBanana()); } /** Test for proper resolution of an existing method specified as override */ public void testExplicitOverride() throws Exception { EntryPointResolverSet resolverSet = new LegacyEntryPointResolverSet(); Object payload = Arrays.asList(new Fruit[]{new Apple(), new Banana()}); RequestContext.setEvent(getTestEvent(payload)); final String methodName = "setFruit"; final String propertyName = MuleProperties.MULE_METHOD_PROPERTY; RequestContext.getEventContext().getMessage().setProperty(propertyName, methodName); FruitBowl bowl = new FruitBowl(); assertFalse(bowl.hasApple()); assertFalse(bowl.hasBanana()); resolverSet.invoke(bowl, RequestContext.getEventContext()); assertTrue(bowl.hasApple()); assertTrue(bowl.hasBanana()); } } mule-2.0.1/core/src/test/java/org/mule/mule/model/NoArgsEntryPointResolverTestCase.java0000644000175000017500000000653210746275214030776 0ustar charlescharles/* * $Id: NoArgsEntryPointResolverTestCase.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule.model; import org.mule.api.model.InvocationResult; import org.mule.model.resolvers.AbstractArgumentEntryPointResolver; import org.mule.model.resolvers.NoArgumentsEntryPointResolver; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.InvalidSatsuma; import org.mule.transport.NullPayload; public class NoArgsEntryPointResolverTestCase extends AbstractMuleTestCase { public void testExplicitMethodMatch() throws Exception { AbstractArgumentEntryPointResolver resolver = new NoArgumentsEntryPointResolver(); resolver.addMethod("bite"); InvocationResult result = resolver.invoke(new InvalidSatsuma(), getTestEventContext("blah")); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } public void testExplicitMethodMatch2() throws Exception { AbstractArgumentEntryPointResolver resolver = new NoArgumentsEntryPointResolver(); resolver.addMethod("wash"); InvocationResult result = resolver.invoke(new Apple(), getTestEventContext("blah")); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } public void testDynamicMethodMatchFail() throws Exception { AbstractArgumentEntryPointResolver resolver = new NoArgumentsEntryPointResolver(); InvocationResult result = resolver.invoke(new Apple(), getTestEventContext("blah")); assertEquals("Apple service has a number of matching method, so should have failed", result.getState(), InvocationResult.STATE_INVOKED_FAILED); } public void testDynamicMethodMatchPass() throws Exception { AbstractArgumentEntryPointResolver resolver = new NoArgumentsEntryPointResolver(); InvocationResult result = resolver.invoke(new InvalidSatsuma(), getTestEventContext("blah")); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } public void testDynamicMethodMatchFailOnWildcardMatch() throws Exception { AbstractArgumentEntryPointResolver resolver = new NoArgumentsEntryPointResolver(); assertTrue(resolver.removeIgnoredMethod("is*")); InvocationResult result = resolver.invoke(new InvalidSatsuma(), getTestEventContext("blah")); assertEquals("Satsuma service has a number of matching method, so should have failed", result.getState(), InvocationResult.STATE_INVOKED_FAILED); } /** Having a null payload should make no difference */ public void testExplicitMethodMatchAndNullPayload() throws Exception { AbstractArgumentEntryPointResolver resolver = new NoArgumentsEntryPointResolver(); resolver.addMethod("wash"); InvocationResult result = resolver.invoke(new Apple(), getTestEventContext(NullPayload.getInstance())); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } } mule-2.0.1/core/src/test/java/org/mule/mule/model/CallableEntryPointDiscoveryTestCase.java0000644000175000017500000000272610746275214031453 0ustar charlescharles/* * $Id: CallableEntryPointDiscoveryTestCase.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule.model; import org.mule.api.model.InvocationResult; import org.mule.model.resolvers.CallableEntryPointResolver; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.WaterMelon; public class CallableEntryPointDiscoveryTestCase extends AbstractMuleTestCase { public void testBadMatch() throws Exception { CallableEntryPointResolver resolver = new CallableEntryPointResolver(); InvocationResult result = resolver.invoke(new WaterMelon(), getTestEventContext(new StringBuffer("foo"))); assertEquals("Service doesn't implement Callable", result.getState(), InvocationResult.STATE_INVOKE_NOT_SUPPORTED); } public void testGoodMatch() throws Exception { CallableEntryPointResolver resolver = new CallableEntryPointResolver(); InvocationResult result = resolver.invoke(new Apple(), getTestEventContext("blah")); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } } mule-2.0.1/core/src/test/java/org/mule/mule/model/ReflectionEntryPointResolverTestCase.java0000644000175000017500000001211410745677442031700 0ustar charlescharles/* * $Id: ReflectionEntryPointResolverTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule.model; import org.mule.RequestContext; import org.mule.api.model.InvocationResult; import org.mule.model.resolvers.ReflectionEntryPointResolver; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Banana; import org.mule.tck.testmodels.fruit.Fruit; import org.mule.tck.testmodels.fruit.FruitBowl; import org.mule.tck.testmodels.fruit.FruitLover; import org.mule.tck.testmodels.fruit.Kiwi; import org.mule.tck.testmodels.fruit.Orange; import org.mule.tck.testmodels.fruit.WaterMelon; import org.mule.transport.NullPayload; public class ReflectionEntryPointResolverTestCase extends AbstractMuleTestCase { public void testExplicitMethodMatch() throws Exception { ReflectionEntryPointResolver resolver = new ReflectionEntryPointResolver(); InvocationResult result = resolver.invoke(new WaterMelon(), getTestEventContext("blah")); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } public void testExplicitMethodMatchComplexObject() throws Exception { ReflectionEntryPointResolver resolver = new ReflectionEntryPointResolver(); InvocationResult result = resolver.invoke(new FruitBowl(), getTestEventContext(new FruitLover("Mmmm"))); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } public void testMethodMatchWithArguments() throws Exception { ReflectionEntryPointResolver resolver = new ReflectionEntryPointResolver(); InvocationResult result = resolver.invoke(new FruitBowl(), getTestEventContext(new Object[]{new Apple(), new Banana()})); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); assertTrue(result.getResult() instanceof Fruit[]); //test that the correct methd was called assertTrue(((Fruit[]) result.getResult())[0] instanceof Apple); assertTrue(((Fruit[]) result.getResult())[1] instanceof Banana); assertEquals("addAppleAndBanana", result.getMethodCalled()); result = resolver.invoke(new FruitBowl(), getTestEventContext(new Object[]{new Banana(), new Apple()})); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); assertTrue(result.getResult() instanceof Fruit[]); assertTrue(((Fruit[]) result.getResult())[0] instanceof Banana); assertTrue(((Fruit[]) result.getResult())[1] instanceof Apple); assertEquals("addBananaAndApple", result.getMethodCalled()); } public void testExplicitMethodMatchSetArrayFail() throws Exception { ReflectionEntryPointResolver resolver = new ReflectionEntryPointResolver(); InvocationResult result = resolver.invoke(new FruitBowl(), getTestEventContext(new Fruit[]{new Apple(), new Orange()})); assertEquals("Test should have failed because the arguments were not wrapped properly: ", result.getState(), InvocationResult.STATE_INVOKED_FAILED); } public void testExplicitMethodMatchSetArrayPass() throws Exception { ReflectionEntryPointResolver resolver = new ReflectionEntryPointResolver(); InvocationResult result = resolver.invoke(new FruitBowl(), getTestEventContext(new Object[]{new Fruit[]{new Apple(), new Orange()}})); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } /** * Tests entrypoint discovery when there is more than one discoverable method * with MuleEventContext parameter. */ public void testFailEntryPointMultiplePayloadMatches() throws Exception { ReflectionEntryPointResolver resolver = new ReflectionEntryPointResolver(); RequestContext.setEvent(getTestEvent("Hello")); InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), RequestContext.getEventContext()); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_FAILED); } public void testMatchOnNoArgs() throws Exception { ReflectionEntryPointResolver resolver = new ReflectionEntryPointResolver(); //This should fail because the Kiwi.bite() method has a void return type, and by default //void methods are ignorred InvocationResult result = resolver.invoke(new Kiwi(), getTestEventContext(NullPayload.getInstance())); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_FAILED); resolver.setAcceptVoidMethods(true); result = resolver.invoke(new Kiwi(), getTestEventContext(NullPayload.getInstance())); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); assertEquals("bite", result.getMethodCalled()); } } mule-2.0.1/core/src/test/java/org/mule/mule/model/ExplicitMethodEntryPointResolverTestCase.java0000644000175000017500000000462010745677442032533 0ustar charlescharles/* * $Id: ExplicitMethodEntryPointResolverTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule.model; import org.mule.api.model.InvocationResult; import org.mule.model.resolvers.ExplicitMethodEntryPointResolver; import org.mule.tck.AbstractMuleTestCase; public class ExplicitMethodEntryPointResolverTestCase extends AbstractMuleTestCase { public void testMethodSetPass() throws Exception { ExplicitMethodEntryPointResolver resolver = new ExplicitMethodEntryPointResolver(); resolver.addMethod("someBusinessMethod"); InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), getTestEventContext("blah")); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } public void testMethodSetMatchFirst() throws Exception { ExplicitMethodEntryPointResolver resolver = new ExplicitMethodEntryPointResolver(); resolver.addMethod("someBusinessMethod"); resolver.addMethod("someSetter"); InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), getTestEventContext("blah")); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } public void testMethodNotFound() throws Exception { ExplicitMethodEntryPointResolver resolver = new ExplicitMethodEntryPointResolver(); resolver.addMethod("noMethod"); resolver.addMethod("noMethod2"); InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), getTestEventContext("blah")); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_FAILED); } public void testNoMethodSet() throws Exception { ExplicitMethodEntryPointResolver resolver = new ExplicitMethodEntryPointResolver(); try { resolver.invoke(new MultiplePayloadsTestObject(), getTestEventContext("blah")); fail("method property is not set, this should cause an error"); } catch (IllegalStateException e) { //Expected } } } mule-2.0.1/core/src/test/java/org/mule/mule/model/MethodHeaderEntryPointResolverTestCase.java0000644000175000017500000000750310745677442032145 0ustar charlescharles/* * $Id: MethodHeaderEntryPointResolverTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule.model; import org.mule.api.MuleEventContext; import org.mule.api.model.InvocationResult; import org.mule.model.resolvers.MethodHeaderPropertyEntryPointResolver; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.transport.NullPayload; public class MethodHeaderEntryPointResolverTestCase extends AbstractMuleTestCase { public void testMethodSetPass() throws Exception { MethodHeaderPropertyEntryPointResolver resolver = new MethodHeaderPropertyEntryPointResolver(); MuleEventContext ctx = getTestEventContext("blah"); ctx.getMessage().setProperty("method", "someBusinessMethod"); InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), ctx); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } public void testMethodSetWithNoArgsPass() throws Exception { MethodHeaderPropertyEntryPointResolver resolver = new MethodHeaderPropertyEntryPointResolver(); MuleEventContext ctx = getTestEventContext(NullPayload.getInstance()); ctx.getMessage().setProperty("method", "wash"); InvocationResult result = resolver.invoke(new Apple(), ctx); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); assertEquals("wash", result.getMethodCalled()); } public void testCustomMethodProperty() throws Exception { MethodHeaderPropertyEntryPointResolver resolver = new MethodHeaderPropertyEntryPointResolver(); resolver.setMethodProperty("serviceMethod"); MuleEventContext ctx = getTestEventContext("blah"); ctx.getMessage().setProperty("serviceMethod", "someBusinessMethod"); InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), ctx); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } public void testCustomMethodPropertyFail() throws Exception { MethodHeaderPropertyEntryPointResolver resolver = new MethodHeaderPropertyEntryPointResolver(); resolver.setMethodProperty("serviceMethod"); MuleEventContext ctx = getTestEventContext("blah"); ctx.getMessage().setProperty("serviceMethod", "noMethod"); InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), ctx); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_FAILED); } public void testMethodPropertyFail() throws Exception { MethodHeaderPropertyEntryPointResolver resolver = new MethodHeaderPropertyEntryPointResolver(); resolver.setMethodProperty("serviceMethod"); MuleEventContext ctx = getTestEventContext("blah"); ctx.getMessage().setProperty("myMethod", "someBusinessMethod"); InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), ctx); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_FAILED); } public void testMethodPropertyMismatch() throws Exception { MethodHeaderPropertyEntryPointResolver resolver = new MethodHeaderPropertyEntryPointResolver(); MuleEventContext ctx = getTestEventContext("blah"); ctx.getMessage().setProperty("method", "noMethod"); InvocationResult result = resolver.invoke(new MultiplePayloadsTestObject(), ctx); assertEquals(result.getState(), InvocationResult.STATE_INVOKED_FAILED); } } mule-2.0.1/core/src/test/java/org/mule/mule/model/MultiplePayloadsTestObject.java0000644000175000017500000000154510702553732027645 0ustar charlescharles/* * $Id: MultiplePayloadsTestObject.java 9006 2007-10-09 01:22:34Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule.model; /** * A test object with multiple signatures matching a payload for the discovery to fail. */ public class MultiplePayloadsTestObject { public MultiplePayloadsTestObject() { // nothing to do } public void someBusinessMethod(String parameter) { // nothing to do } public void someSetter(String otherStringParameter) { // nothing to do } } mule-2.0.1/core/src/test/java/org/mule/mule/model/ArrayEntryPointResolverTestCase.java0000644000175000017500000000371110745677442030667 0ustar charlescharles/* * $Id: ArrayEntryPointResolverTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule.model; import org.mule.api.model.InvocationResult; import org.mule.model.resolvers.AbstractArgumentEntryPointResolver; import org.mule.model.resolvers.ArrayEntryPointResolver; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Fruit; import org.mule.tck.testmodels.fruit.FruitBowl; import org.mule.tck.testmodels.fruit.Orange; public class ArrayEntryPointResolverTestCase extends AbstractMuleTestCase { public void testArrayMatch() throws Exception { AbstractArgumentEntryPointResolver resolver = new ArrayEntryPointResolver(); InvocationResult ctx = resolver.invoke(new FruitBowl(), getTestEventContext(new Fruit[]{new Apple(), new Orange()})); assertEquals(ctx.getState(), InvocationResult.STATE_INVOKED_SUCESSFUL); } public void testArrayMatchGenericFail() throws Exception { AbstractArgumentEntryPointResolver resolver = new ArrayEntryPointResolver(); InvocationResult ctx = resolver.invoke(new FruitBowl(), getTestEventContext(new Object[]{new Apple(), new Orange()})); assertEquals(ctx.getState(), InvocationResult.STATE_INVOKED_FAILED); } public void testArrayMatchFail() throws Exception { AbstractArgumentEntryPointResolver resolver = new ArrayEntryPointResolver(); InvocationResult ctx = resolver.invoke(new Apple(), getTestEventContext(new Object[]{"blah"})); assertEquals(ctx.getState(), InvocationResult.STATE_INVOKED_FAILED); } } mule-2.0.1/core/src/test/java/org/mule/mule/MuleDescriptorTestCase.java0000644000175000017500000000750311003252442025650 0ustar charlescharles/* * $Id: MuleDescriptorTestCase.java 11621 2008-04-22 03:01:54Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.service.Service; import org.mule.component.simple.PassThroughComponent; import org.mule.model.seda.SedaService; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Orange; import org.mule.tck.testmodels.mule.TestExceptionStrategy; public class MuleDescriptorTestCase extends AbstractMuleTestCase { public void testDescriptorDefaults() throws Exception { Service service = new SedaService(); //TODO RM* // MuleConfiguration config = new MuleConfiguration(); // assertEquals(config.getQueueProfile().getMaxOutstandingMessages(), // descriptor.getQueueProfile().getMaxOutstandingMessages()); // assertEquals(config.getThreadingProfile().getMaxBufferSize(), // descriptor.getThreadingProfile().getMaxBufferSize()); // assertEquals(config.getPoolingProfile().getMaxIdle(), descriptor.getPoolingProfile().getMaxIdle()); // assertEquals(config.getPoolingProfile().getMaxWait(), descriptor.getPoolingProfile().getMaxWait()); // assertEquals(config.getPoolingProfile().getMaxActive(), descriptor.getPoolingProfile().getMaxActive()); // assertEquals("1.0", descriptor.getVersion()); // assertEquals(2, descriptor.getInitialisationPolicy()); //assertNull("Factory should be null but is " + service.getServiceFactory(), service.getServiceFactory()); assertNotNull(service.getComponent()); assertTrue(service.getComponent() instanceof PassThroughComponent); // assertEquals(0, service.getProperties().size()); } // These validations seems a bit silly, IMHO. // public void testDescriptorNullValidation() throws Exception // { // Service service = new SedaService(); // try // { // service.setExceptionListener(null); // fail("setting exeption strategy to null should fail"); // } // catch (RuntimeException e) // { // // expected // } // // try // { // service.setName(null); // fail("setting name to null should fail"); // } // catch (RuntimeException e) // { // // expected // } // // try // { // service.setServiceFactory(null); // fail("setting serviceFactory to null should fail"); // } // catch (RuntimeException e) // { // // expected // } // // } public void testEndpointValidation() throws Exception { Service service = getTestService("Terry", Orange.class); TestExceptionStrategy es = new TestExceptionStrategy(); service.setExceptionListener(es); assertEquals(1, service.getOutboundRouter().getRouters().size()); // TODO Why should there be an outbound endpoint configured? //Endpoint ep = (Endpoint)((OutboundRouter)service.getOutboundRouter().getRouters().get(0)).getEndpoints().get(0); //assertNotNull(ep); //assertNotNull(ep.getConnector().getExceptionListener()); // create receive endpoint InboundEndpoint endpoint = getTestInboundEndpoint("test2"); service.getInboundRouter().addEndpoint(endpoint); // Add receive endpoint, this shoulbe set as default assertNotNull(endpoint.getConnector().getExceptionListener()); } } mule-2.0.1/core/src/test/java/org/mule/mule/MuleEventTestCase.java0000644000175000017500000002227610766204322024630 0ustar charlescharles/* * $Id: MuleEventTestCase.java 11343 2008-03-13 10:58:26Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule; import org.mule.DefaultMuleEvent; import org.mule.DefaultMuleMessage; import org.mule.RequestContext; import org.mule.ResponseOutputStream; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.ImmutableEndpoint; import org.mule.api.security.Credentials; import org.mule.api.transformer.Transformer; import org.mule.api.transformer.TransformerException; import org.mule.routing.filters.PayloadTypeFilter; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Orange; import org.mule.transformer.AbstractTransformer; import org.mule.transformer.simple.ByteArrayToObject; import org.mule.transformer.simple.SerializableToByteArray; import org.mule.util.CollectionUtils; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Properties; public class MuleEventTestCase extends AbstractMuleTestCase { public void testEventInitialise() throws Exception { String data = "Test Data"; DefaultMuleEvent event = (DefaultMuleEvent)getTestEvent(data, getTestService("orange", Orange.class)); RequestContext.setEvent(event); assertEquals("MuleEvent data should equal " + data, data, event.getMessage().getPayload()); assertEquals("MuleEvent data should equal " + data, data, event.getMessageAsString()); assertEquals("MuleEvent data should equal " + data, data, event.transformMessage()); assertEquals("MuleEvent data should be a byte array 9 bytes in length", 9, event .transformMessageToBytes().length); assertEquals("MuleEvent data should be a byte array 9 bytes in length", 9, event.getMessageAsBytes().length); assertEquals("MuleEvent data should equal " + data, data, event.getSource()); assertEquals("MuleBeanPropertiesRule", event.getMessage().getProperty("MuleBeanPropertiesRule", "MuleBeanPropertiesRule")); event.getMessage().setProperty("Test", "Test1"); assertFalse(event.getMessage().getPropertyNames().isEmpty()); assertEquals("bla2", event.getMessage().getProperty("bla2", "bla2")); assertEquals("Test1", event.getMessage().getProperty("Test")); assertEquals("Test1", event.getMessage().getProperty("Test", "bla2")); assertNotNull(event.getId()); } public void testEventTransformer() throws Exception { String data = "Test Data"; ImmutableEndpoint endpoint = getTestOutboundEndpoint("Test",CollectionUtils.singletonList(new TestEventTransformer())); MuleEvent event = getTestEvent(data, endpoint); RequestContext.setEvent(event); assertEquals("MuleEvent data should equal " + data, data, event.getMessage().getPayload()); assertEquals("MuleEvent data should equal " + data, data, event.getMessageAsString()); assertEquals("MuleEvent data should equal 'Transformed Test Data'", "Transformed Test Data", event .transformMessage()); assertEquals("MuleEvent data should be a byte array 28 bytes in length", 21, event .transformMessageToBytes().length); } public void testEventRewrite() throws Exception { String data = "Test Data"; ImmutableEndpoint endpoint = getTestOutboundEndpoint("Test", CollectionUtils.singletonList(new TestEventTransformer())); DefaultMuleEvent event = new DefaultMuleEvent(new DefaultMuleMessage(data), endpoint, getTestSession(getTestService("apple", Apple.class), muleContext), true, new ResponseOutputStream(System.out)); assertNotNull(event.getId()); assertNotNull(event.getSession()); assertNotNull(event.getEndpoint()); assertNotNull(event.getOutputStream()); assertNotNull(event.getMessage()); assertEquals(data, event.getMessageAsString()); MuleEvent event2 = new DefaultMuleEvent(new DefaultMuleMessage("New Data"), event); assertNotNull(event2.getId()); assertEquals(event.getId(), event2.getId()); assertNotNull(event2.getSession()); assertNotNull(event2.getEndpoint()); assertNotNull(event2.getOutputStream()); assertNotNull(event2.getMessage()); assertEquals("New Data", event2.getMessageAsString()); } public void testProperties() throws Exception { MuleEvent prevEvent; Properties props; MuleMessage msg; ImmutableEndpoint endpoint; MuleEvent event; // nowhere prevEvent = getTestEvent("payload"); props = new Properties(); msg = new DefaultMuleMessage("payload", props); props = new Properties(); endpoint = getTestOutboundEndpoint("Test", null, null, null, props); event = new DefaultMuleEvent(msg, endpoint, prevEvent.getService(), prevEvent); assertNull(event.getMessage().getProperty("prop")); // in previous event => previous event prevEvent.getMessage().setProperty("prop", "value0"); event = new DefaultMuleEvent(msg, endpoint, prevEvent.getService(), prevEvent); assertEquals("value0", event.getMessage().getProperty("prop")); // TODO check if this fragment can be removed // in previous event + endpoint => endpoint // This doesn't apply now as the previous event properties will be the same // as the current event props // props = new Properties(); // props.put("prop", "value2"); // endpoint.setProperties(props); // event = new DefaultMuleEvent(msg, endpoint, prevEvent.getComponent(), prevEvent); // assertEquals("value2", event.getProperty("prop")); // in previous event + message => message props = new Properties(); props.put("prop", "value1"); msg = new DefaultMuleMessage("payload", props); endpoint = getTestOutboundEndpoint("Test"); event = new DefaultMuleEvent(msg, endpoint, prevEvent.getService(), prevEvent); assertEquals("value1", event.getMessage().getProperty("prop")); // in previous event + endpoint + message => message props = new Properties(); props.put("prop", "value1"); msg = new DefaultMuleMessage("payload", props); Properties props2 = new Properties(); props2.put("prop", "value2"); endpoint = getTestOutboundEndpoint("Test", null, null, null, props2); event = new DefaultMuleEvent(msg, endpoint, prevEvent.getService(), prevEvent); assertEquals("value1", event.getMessage().getProperty("prop")); } /** * See http://mule.mulesource.org/jira/browse/MULE-384 for details. */ public void testNoPasswordNoNullPointerException() throws Exception { // provide the username, but not the password, as is the case for SMTP // cannot set SMTP endpoint type, because the module doesn't have this // dependency ImmutableEndpoint endpoint = getTestOutboundEndpoint("AuthTest", "test://john.doe@xyz.fr"); MuleEvent event = getTestEvent(new Object(), endpoint); Credentials credentials = event.getCredentials(); assertNull("Credentials must not be created for endpoints without a password.", credentials); } public void testEventSerialization() throws Exception { Transformer trans1 = new TestEventTransformer(); trans1.setName("OptimusPrime"); Transformer trans2 = new TestEventTransformer(); trans2.setName("Bumblebee"); List transformers = new ArrayList(); transformers.add(trans1); transformers.add(trans2); ImmutableEndpoint endpoint = getTestOutboundEndpoint("Test", null,transformers, new PayloadTypeFilter(Object.class) , null); MuleEvent event = RequestContext.setEvent(getTestEvent("payload", endpoint)); Serializable serialized = (Serializable)new SerializableToByteArray().transform(event); assertNotNull(serialized); MuleEvent deserialized = (MuleEvent)new ByteArrayToObject().transform(serialized); assertNotNull(deserialized); assertEquals(endpoint, deserialized.getEndpoint()); List deserializedTransformers = deserialized.getEndpoint().getTransformers(); assertEquals(2, deserializedTransformers.size()); assertEquals(trans1.getName(), ((Transformer)deserializedTransformers.get(0)).getName()); assertEquals(trans2.getName(), ((Transformer)deserializedTransformers.get(1)).getName()); assertEquals(PayloadTypeFilter.class,deserialized.getEndpoint().getFilter().getClass()); } private class TestEventTransformer extends AbstractTransformer { public Object doTransform(Object src, String encoding) throws TransformerException { return "Transformed Test Data"; } } } mule-2.0.1/core/src/test/java/org/mule/mule/security/0000755000175000017500000000000011351411074022256 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/mule/security/PbeEncryptionStrategyTestCase.java0000644000175000017500000000205210745677442031103 0ustar charlescharles/* * $Id: PbeEncryptionStrategyTestCase.java 10489 2008-01-23 17:53:38Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule.security; import org.mule.security.PasswordBasedEncryptionStrategy; import org.mule.tck.AbstractMuleTestCase; public class PbeEncryptionStrategyTestCase extends AbstractMuleTestCase { public void testRoundTripEncryption() throws Exception { PasswordBasedEncryptionStrategy pbe = new PasswordBasedEncryptionStrategy(); pbe.setPassword("test"); pbe.initialise(); byte[] b = pbe.encrypt("hello".getBytes(), null); assertNotSame(new String(b), "hello"); String s = new String(pbe.decrypt(b, null), "UTF-8"); assertEquals("hello", s); } } mule-2.0.1/core/src/test/java/org/mule/mule/security/SecretKeyEncryptionStrategyTestCase.java0000644000175000017500000000426210760504151032257 0ustar charlescharles/* * $Id: SecretKeyEncryptionStrategyTestCase.java 10976 2008-02-25 09:20:41Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.mule.security; import org.mule.security.SecretKeyEncryptionStrategy; import org.mule.security.SecretKeyFactory; import org.mule.tck.AbstractMuleTestCase; public class SecretKeyEncryptionStrategyTestCase extends AbstractMuleTestCase { public void testRoundTripEncryptionBlowfish() throws Exception { SecretKeyEncryptionStrategy ske = new SecretKeyEncryptionStrategy(); ske.setAlgorithm("Blowfish"); ske.setKey("shhhhh"); ske.initialise(); byte[] b = ske.encrypt("hello".getBytes(), null); assertNotSame(new String(b), "hello"); String s = new String(ske.decrypt(b, null), "UTF-8"); assertEquals("hello", s); } public void testRoundTripEncryptionBlowfishWithKeyFactory() throws Exception { SecretKeyEncryptionStrategy ske = new SecretKeyEncryptionStrategy(); ske.setAlgorithm("Blowfish"); ske.setKeyFactory(new SecretKeyFactory() { public byte[] getKey() { return "shhhh".getBytes(); } }); ske.initialise(); byte[] b = ske.encrypt("hello".getBytes(), null); assertNotSame(new String(b), "hello"); String s = new String(ske.decrypt(b, null), "UTF-8"); assertEquals("hello", s); } public void testRoundTripEncryptionTripleDES() throws Exception { SecretKeyEncryptionStrategy ske = new SecretKeyEncryptionStrategy(); ske.setAlgorithm("TripleDES"); ske.setKey("shhhhh"); ske.initialise(); byte[] b = ske.encrypt("hello".getBytes(), null); assertNotSame(new String(b), "hello"); String s = new String(ske.decrypt(b, null), "UTF-8"); assertEquals("hello", s); } } mule-2.0.1/core/src/test/java/org/mule/ThreadUnsafeAccessTestCase.java0000644000175000017500000000257110766637211025460 0ustar charlescharles/* * $Id$ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.api.ThreadSafeAccess; import org.mule.api.context.MuleContextBuilder; import org.mule.config.DefaultMuleConfiguration; import org.mule.transport.DefaultMessageAdapter; public class ThreadUnsafeAccessTestCase extends AbstractThreadSafeAccessTestCase { //@Override protected void configureMuleContext(MuleContextBuilder contextBuilder) { super.configureMuleContext(contextBuilder); DefaultMuleConfiguration config = new DefaultMuleConfiguration(); config.setFailOnMessageScribbling(false); contextBuilder.setMuleConfiguration(config); } public void testDisable() throws InterruptedException { assertFalse(muleContext.getConfiguration().isFailOnMessageScribbling()); ThreadSafeAccess target = new DefaultMessageAdapter(new Object()); newThread(target, false, new boolean[]{true, true, false, true}); newThread(target, false, new boolean[]{false}); newThread(target, false, new boolean[]{true}); } } mule-2.0.1/core/src/test/java/org/mule/ThreadSafeAccessTestCase.java0000644000175000017500000000264510766637211025117 0ustar charlescharles/* * $Id: ThreadSafeAccessTestCase.java 11371 2008-03-15 03:12:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule; import org.mule.transport.DefaultMessageAdapter; import java.util.Map; public class ThreadSafeAccessTestCase extends AbstractThreadSafeAccessTestCase { public void testConfig() { assertTrue(muleContext.getConfiguration().isFailOnMessageScribbling()); } public void testMessage() throws InterruptedException { basicPattern(new DefaultMuleMessage(new Object(), (Map)null)); newCopy(new DefaultMuleMessage(new Object(), (Map)null)); resetAccessControl(new DefaultMuleMessage(new Object(), (Map)null)); } public void testAdapter() throws InterruptedException { basicPattern(new DefaultMessageAdapter(new Object())); newCopy(new DefaultMessageAdapter(new Object())); resetAccessControl(new DefaultMessageAdapter(new Object())); } public void testEvent() throws Exception { basicPattern(dummyEvent()); newCopy(dummyEvent()); resetAccessControl(dummyEvent()); } } mule-2.0.1/core/src/test/java/org/mule/util/0000755000175000017500000000000011351411100020410 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/util/queue/0000755000175000017500000000000011351411076021550 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/util/queue/AbstractTransactionQueueManagerTestCase.java0000644000175000017500000004176311003704621032326 0ustar charlescharles/* * $Id: AbstractTransactionQueueManagerTestCase.java 11635 2008-04-23 19:10:09Z aguenther $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.concurrent.Latch; import org.mule.util.xa.AbstractResourceManager; import java.util.Random; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public abstract class AbstractTransactionQueueManagerTestCase extends AbstractMuleTestCase { /** * logger used by this class */ protected transient Log logger = LogFactory.getLog(getClass()); protected abstract TransactionalQueueManager createQueueManager() throws Exception; protected abstract boolean isPersistent(); public void testPutTake() throws Exception { TransactionalQueueManager mgr = createQueueManager(); mgr.start(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); assertEquals("Queue size", 0, q.size()); q.put("String1"); assertEquals("Queue size", 1, q.size()); Object o = q.take(); assertNotNull(o); assertEquals("Queue content", "String1", o); assertEquals("Queue size", 0, q.size()); purgeQueue(q); mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } public void testTakePut() throws Exception { final TransactionalQueueManager mgr = createQueueManager(); mgr.start(); final Latch latch = new Latch(); Thread t = new Thread() { public void run() { try { latch.countDown(); Thread.sleep(200); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); assertEquals("Queue size", 0, q.size()); q.put("String1"); } catch (Exception e) { // ignore, let test fail } } }; t.start(); latch.await(); long t0 = System.currentTimeMillis(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); assertEquals("Queue size", 0, q.size()); Object o = q.take(); long t1 = System.currentTimeMillis(); t.join(); assertNotNull(o); assertEquals("Queue content", "String1", o); assertEquals("Queue size", 0, q.size()); assertTrue(t1 - t0 > 100); purgeQueue(q); mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } public void testTakePutRollbackPut() throws Exception { final TransactionalQueueManager mgr = createQueueManager(); mgr.start(); final Latch latch = new Latch(); Thread t = new Thread() { public void run() { try { latch.countDown(); Thread.sleep(200); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); assertEquals("Queue size", 0, q.size()); s.begin(); q.put("String1"); s.rollback(); s.begin(); q.put("String2"); s.commit(); } catch (Exception e) { // ignore, let test fail } } }; t.start(); latch.await(); long t0 = System.currentTimeMillis(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); assertEquals("Queue size", 0, q.size()); Object o = q.take(); long t1 = System.currentTimeMillis(); t.join(); assertNotNull(o); assertEquals("Queue content", "String2", o); assertEquals("Queue size", 0, q.size()); assertTrue(t1 - t0 > 100); purgeQueue(q); mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } public void testTakePutOverCapacity() throws Exception { final TransactionalQueueManager mgr = createQueueManager(); mgr.start(); mgr.setDefaultQueueConfiguration(new QueueConfiguration(2)); final Latch latch = new Latch(); Thread t = new Thread() { public void run() { try { latch.await(); Thread.sleep(200); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); Object o = q.take(); assertEquals("Queue content", "String1", o); } catch (Exception e) { // ignore, let test fail } } }; t.start(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); assertEquals("Queue size", 0, q.size()); q.put("String1"); q.put("String2"); latch.countDown(); long t0 = System.currentTimeMillis(); q.put("String3"); long t1 = System.currentTimeMillis(); t.join(); assertEquals("Queue size", 2, q.size()); assertTrue(t1 - t0 > 100); purgeQueue(q); mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } public void testPutWithPersistence() throws Exception { if (isPersistent()) { TransactionalQueueManager mgr = createQueueManager(); try { mgr.start(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); q.put("String1"); assertEquals("Queue size", 1, q.size()); q = s.getQueue("queue1"); assertEquals("Queue size", 1, q.size()); } finally { mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } mgr = createQueueManager(); try { mgr.start(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); assertEquals("Queue size", 1, q.size()); purgeQueue(q); } finally { mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } } else { logger.info("Ignoring test because queue manager is not persistent"); } } public void testTransactedPutCommitWithPersistence() throws Exception { if (isPersistent()) { TransactionalQueueManager mgr = createQueueManager(); try { mgr.start(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); s.begin(); q.put("String1"); assertEquals("Queue size", 1, q.size()); s.commit(); assertEquals("Queue size", 1, q.size()); s = mgr.getQueueSession(); q = s.getQueue("queue1"); assertEquals("Queue size", 1, q.size()); mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); mgr = createQueueManager(); mgr.start(); s = mgr.getQueueSession(); q = s.getQueue("queue1"); assertEquals("Queue size", 1, q.size()); purgeQueue(q); } finally { mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } } else { logger.info("Ignoring test because queue manager is not persistent"); } } public void testTransactedPutRollbackWithPersistence() throws Exception { if (isPersistent()) { TransactionalQueueManager mgr = createQueueManager(); try { mgr.start(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); s.begin(); q.put("String1"); assertEquals("Queue size", 1, q.size()); s.rollback(); assertEquals("Queue size", 0, q.size()); s = mgr.getQueueSession(); q = s.getQueue("queue1"); assertEquals("Queue size", 0, q.size()); mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); mgr = createQueueManager(); mgr.start(); s = mgr.getQueueSession(); q = s.getQueue("queue1"); assertEquals("Queue size", 0, q.size()); purgeQueue(q); } finally { mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } } else { logger.info("Ignoring test because queue manager is not persistent"); } } public void testTransactionsOnMultipleQueues() throws Exception { TransactionalQueueManager mgr = createQueueManager(); try { mgr.start(); QueueSession s1 = mgr.getQueueSession(); QueueSession s2 = mgr.getQueueSession(); Queue q1s1 = s1.getQueue("queue1"); Queue q1s2 = s2.getQueue("queue1"); Queue q2s1 = s1.getQueue("queue2"); Queue q2s2 = s2.getQueue("queue2"); q1s1.put("String1"); assertEquals("Queue size", 1, q1s1.size()); assertEquals("Queue size", 1, q1s2.size()); s1.begin(); Object o = q1s1.take(); assertNotNull(o); assertEquals("String1", o); assertEquals("Queue size", 0, q1s1.size()); assertEquals("Queue size", 0, q1s2.size()); q2s1.put("String2"); assertEquals("Queue size", 1, q2s1.size()); assertEquals("Queue size", 0, q2s2.size()); s1.commit(); assertEquals("Queue size", 0, q1s1.size()); assertEquals("Queue size", 0, q1s2.size()); assertEquals("Queue size", 1, q2s1.size()); assertEquals("Queue size", 1, q2s2.size()); s1.begin(); o = q2s1.take(); assertNotNull(o); assertEquals("String2", o); assertEquals("Queue size", 0, q1s1.size()); assertEquals("Queue size", 0, q1s2.size()); assertEquals("Queue size", 0, q2s1.size()); assertEquals("Queue size", 0, q2s2.size()); q1s1.put("String1"); assertEquals("Queue size", 1, q1s1.size()); assertEquals("Queue size", 0, q1s2.size()); assertEquals("Queue size", 0, q2s1.size()); assertEquals("Queue size", 0, q2s2.size()); s1.rollback(); assertEquals("Queue size", 0, q1s1.size()); assertEquals("Queue size", 0, q1s2.size()); assertEquals("Queue size", 1, q2s1.size()); assertEquals("Queue size", 1, q2s2.size()); purgeQueue(q1s1); purgeQueue(q1s2); purgeQueue(q2s1); purgeQueue(q2s2); } finally { mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } } public void testPoll() throws Exception { final TransactionalQueueManager mgr = createQueueManager(); try { mgr.start(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); assertEquals("Queue size", 0, q.size()); Object o = q.poll(0); assertEquals("Queue size", 0, q.size()); assertNull(o); o = q.poll(1000); assertEquals("Queue size", 0, q.size()); assertNull(o); q.put("String1"); assertEquals("Queue size", 1, q.size()); o = q.poll(0); assertEquals("Queue size", 0, q.size()); assertEquals("Queue content", "String1", o); new Thread(new Runnable() { public void run() { try { Thread.sleep(500); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); q.put("String1"); } catch (Exception e) { e.printStackTrace(); } } }).start(); o = q.poll(1000); assertEquals("Queue size", q.size(), 0); assertEquals("Queue content", "String1", o); purgeQueue(q); } finally { mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } } public void testPeek() throws Exception { TransactionalQueueManager mgr = createQueueManager(); try { mgr.start(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); assertEquals("Queue size", 0, q.size()); Object o = q.peek(); assertEquals("Queue size", 0, q.size()); assertNull(o); q.put("String1"); assertEquals("Queue size", 1, q.size()); o = q.peek(); assertEquals("Queue size", 1, q.size()); assertEquals("Queue content", "String1", o); o = q.poll(1000); assertEquals("Queue size", 0, q.size()); assertEquals("Queue content", "String1", o); purgeQueue(q); } finally { mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } } public void testOffer() throws Exception { final TransactionalQueueManager mgr = createQueueManager(); mgr.setDefaultQueueConfiguration(new QueueConfiguration(1)); try { mgr.start(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); assertEquals("Queue size", 0, q.size()); assertTrue(q.offer("String1", 0L)); assertEquals("Queue size", 1, q.size()); assertFalse(q.offer("String2", 1000)); assertEquals("Queue size", 1, q.size()); new Thread(new Runnable() { public void run() { try { Thread.sleep(500); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); assertEquals("Queue content", "String1", q.take()); } catch (Exception e) { e.printStackTrace(); } } }).start(); assertTrue(q.offer("String2", 1000)); assertEquals("Queue size", 1, q.size()); purgeQueue(q); } finally { mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } } public void testBench() throws Exception { TransactionalQueueManager mgr = createQueueManager(); try { mgr.start(); QueueSession s = mgr.getQueueSession(); Queue q = s.getQueue("queue1"); Random rnd = new Random(); long t0 = System.currentTimeMillis(); for (int i = 0; i < 1; i++) { for (int j = 0; j < 500; j++) { byte[] o = new byte[2048]; rnd.nextBytes(o); q.put(o); } while (q.size() > 0) { q.take(); } } long t1 = System.currentTimeMillis(); logger.info("Time: " + (t1 - t0) + " ms"); purgeQueue(q); } finally { mgr.stop(AbstractResourceManager.SHUTDOWN_MODE_NORMAL); } } protected void purgeQueue(Queue queue) throws InterruptedException { while(queue.size() > 0) { queue.poll(1000); } assertEquals("Queue must be fully consumed after successful test run. Queue size:", 0, queue.size()); } } mule-2.0.1/core/src/test/java/org/mule/util/queue/FilePersistenceTestCase.java0000644000175000017500000000210010664630335027133 0ustar charlescharles/* * $Id: FilePersistenceTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; public class FilePersistenceTestCase extends AbstractTransactionQueueManagerTestCase { protected TransactionalQueueManager createQueueManager() throws Exception { TransactionalQueueManager mgr = new TransactionalQueueManager(); mgr.setPersistenceStrategy(new FilePersistenceStrategy()); mgr.setDefaultQueueConfiguration(new QueueConfiguration(true)); return mgr; } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.AbstractTransactionQueueManagerTestCase#isPersistent() */ protected boolean isPersistent() { return true; } } mule-2.0.1/core/src/test/java/org/mule/util/queue/NoPersistenceTestCase.java0000644000175000017500000000221110664630335026633 0ustar charlescharles/* * $Id: NoPersistenceTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.queue; public class NoPersistenceTestCase extends AbstractTransactionQueueManagerTestCase { /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.AbstractTransactionQueueManagerTestCase#createQueueManager() */ protected TransactionalQueueManager createQueueManager() throws Exception { TransactionalQueueManager mgr = new TransactionalQueueManager(); mgr.setPersistenceStrategy(new MemoryPersistenceStrategy()); return mgr; } /* * (non-Javadoc) * * @see org.mule.transaction.xa.queue.AbstractTransactionQueueManagerTestCase#isPersistent() */ protected boolean isPersistent() { return false; } } mule-2.0.1/core/src/test/java/org/mule/util/StringMessageUtilsTestCase.java0000644000175000017500000001531010664630335026526 0ustar charlescharles/* * $Id: StringMessageUtilsTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.util.ArrayList; import java.util.Collection; import java.util.List; public class StringMessageUtilsTestCase extends AbstractMuleTestCase { public void testToString() throws Exception { Object test = "Oscar"; Object result = StringMessageUtils.toString(test); assertEquals("Oscar", result); test = getClass(); result = StringMessageUtils.toString(test); assertEquals(getClass().getName(), result); test = new TestObject("Ernie"); result = StringMessageUtils.toString(test); assertEquals(test.toString(), result); test = new AnotherTestObject("Bert"); result = StringMessageUtils.toString(test); assertEquals("Bert", result); test = new String[]{"foo", "bar"}; result = StringMessageUtils.toString(test); assertEquals("{foo,bar}", result); test = new byte[]{1, 2}; result = StringMessageUtils.toString(test); assertEquals("{1,2}", result); // create an array that is too long to be printed test = new byte[StringMessageUtils.MAX_ELEMENTS + 100]; for (int i = 0; i < ((byte[]) test).length; i++) { ((byte[]) test)[i] = (byte) i; } // the String will contain not more than exactly MAX_ARRAY_LENGTH elements result = StringMessageUtils.toString(test); assertTrue(((String) result).endsWith("[..]}")); assertEquals(StringMessageUtils.MAX_ELEMENTS - 1, StringUtils.countMatches((String) result, ",")); test = new long[]{5068875495743534L, 457635546759674L}; result = StringMessageUtils.toString(test); assertEquals("{5068875495743534,457635546759674}", result); test = new double[] {1.1, 2.02}; result = StringMessageUtils.toString(test); assertEquals("{1.1,2.02}", result); // create a Collection that is too long to be printed test = new ArrayList(100); for (int i = 0; i < 100; i++) { ((Collection) test).add(new Integer(i)); } // the String will contain not more than exactly MAX_ARRAY_LENGTH elements result = StringMessageUtils.toString(test); assertTrue(((String) result).endsWith("[..]]")); assertEquals(StringMessageUtils.MAX_ELEMENTS - 1, StringUtils.countMatches((String) result, ",")); } public void testFormattedString() throws Exception { String result; String msg1 = "There is not substitution here"; result = StringMessageUtils.getFormattedMessage(msg1, null); assertEquals(msg1, result); result = StringMessageUtils.getFormattedMessage(msg1, new Object[]{}); assertEquals(msg1, result); String msg2 = "There should be a variable {0}, {1} and {2}"; result = StringMessageUtils.getFormattedMessage(msg2, new Object[]{"here", "there", "everywhere"}); assertEquals("There should be a variable here, there and everywhere", result); } public void testBoilerPlateSingleLine() { String plate = StringMessageUtils.getBoilerPlate("Single message.", '*', 12); assertEquals(SystemUtils.LINE_SEPARATOR + "************" + SystemUtils.LINE_SEPARATOR + "* Single *" + SystemUtils.LINE_SEPARATOR + "* message. *" + SystemUtils.LINE_SEPARATOR + "************", plate); } public void testBoilerPlate() throws Exception { List msgs = new ArrayList(); msgs.add("This"); msgs.add("is a"); msgs.add("Boiler Plate"); String plate = StringMessageUtils.getBoilerPlate(msgs, '*', 12); assertEquals(SystemUtils.LINE_SEPARATOR + "************" + SystemUtils.LINE_SEPARATOR + "* This *" + SystemUtils.LINE_SEPARATOR + "* is a *" + SystemUtils.LINE_SEPARATOR + "* Boiler *" + SystemUtils.LINE_SEPARATOR + "* Plate *" + SystemUtils.LINE_SEPARATOR + "************", plate); } public void testBoilerPlate2() throws Exception { List msgs = new ArrayList(); msgs.add("This"); msgs.add("is a"); msgs.add("Boiler Plate Message that should get wrapped to the next line if it is working properly"); String plate = StringMessageUtils.getBoilerPlate(msgs, '*', 12); assertEquals(SystemUtils.LINE_SEPARATOR + "************" + SystemUtils.LINE_SEPARATOR + "* This *" + SystemUtils.LINE_SEPARATOR + "* is a *" + SystemUtils.LINE_SEPARATOR + "* Boiler *" + SystemUtils.LINE_SEPARATOR + "* Plate *" + SystemUtils.LINE_SEPARATOR + "* Message *" + SystemUtils.LINE_SEPARATOR + "* that *" + SystemUtils.LINE_SEPARATOR + "* should *" + SystemUtils.LINE_SEPARATOR + "* get *" + SystemUtils.LINE_SEPARATOR + "* wrapped *" + SystemUtils.LINE_SEPARATOR + "* to the *" + SystemUtils.LINE_SEPARATOR + "* next *" + SystemUtils.LINE_SEPARATOR + "* line if *" + SystemUtils.LINE_SEPARATOR + "* it is *" + SystemUtils.LINE_SEPARATOR + "* working *" + SystemUtils.LINE_SEPARATOR + "* properly *" + SystemUtils.LINE_SEPARATOR + "************", plate); } public void testTruncate() { String msg = "this is a test message for truncating"; String result = StringMessageUtils.truncate(msg, 100, true); assertEquals(msg, result); result = StringMessageUtils.truncate(msg, 10, false); assertEquals("this is a ...", result); result = StringMessageUtils.truncate(msg, 10, true); assertEquals("this is a ...[10 of 37]", result); } private class TestObject { private String name; public TestObject(String name) { this.name = name; } public String getName() { return name; } } private class AnotherTestObject extends TestObject { public AnotherTestObject(String name) { super(name); } public String toString() { return getName(); } } } mule-2.0.1/core/src/test/java/org/mule/util/timer/0000755000175000017500000000000011351411076021544 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/util/timer/TimerTestCase.java0000644000175000017500000000732010664630335025134 0ustar charlescharles/* * $Id: TimerTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.timer; import org.mule.tck.AbstractMuleTestCase; import java.util.Timer; public class TimerTestCase extends AbstractMuleTestCase implements TimeEventListener { volatile boolean fired; public void testTimer() throws Exception { Timer timer = new Timer(); EventTimerTask task = new EventTimerTask(this); timer.schedule(task, 0, 1000); task.start(); Thread.sleep(1500); assertTrue(fired); } public void testStopTimer() throws Exception { fired = false; Timer timer = new Timer(); EventTimerTask task = new EventTimerTask(this); timer.schedule(task, 0, 1000); task.start(); Thread.sleep(1500); assertTrue(fired); fired = false; task.stop(); Thread.sleep(1500); assertTrue(!fired); } public void testMultipleListeners() throws Exception { fired = false; Timer timer = new Timer(); AnotherListener listener = new AnotherListener(); EventTimerTask task = new EventTimerTask(this); task.addListener(listener); timer.schedule(task, 0, 1000); task.start(); Thread.sleep(1500); assertTrue(fired); assertTrue(listener.wasFired()); listener.setWasFired(false); fired = false; task.stop(); Thread.sleep(1500); assertTrue(!fired); assertTrue(!listener.wasFired()); } public void testRemoveListeners() throws Exception { fired = false; Timer timer = new Timer(); AnotherListener listener = new AnotherListener(); EventTimerTask task = new EventTimerTask(this); task.addListener(listener); timer.schedule(task, 0, 1000); task.start(); Thread.sleep(1500); assertTrue(fired); assertTrue(listener.wasFired()); listener.setWasFired(false); fired = false; task.stop(); task.removeListener(this); task.start(); Thread.sleep(1500); assertTrue(!fired); assertTrue(listener.wasFired()); listener.setWasFired(false); task.stop(); task.removeAllListeners(); task.start(); Thread.sleep(1500); assertTrue(!fired); assertTrue(!listener.wasFired()); } /* * (non-Javadoc) * * @see org.mule.util.timer.TimeEventListener#timeExpired(org.mule.util.timer.TimeEvent) */ public void timeExpired(TimeEvent e) { assertTrue(e.getTimeExpired() > 0); assertNotNull(e.getName()); fired = true; } private class AnotherListener implements TimeEventListener { private boolean wasFired; /* * (non-Javadoc) * * @see org.mule.util.timer.TimeEventListener#timeExpired(org.mule.util.timer.TimeEvent) */ public void timeExpired(TimeEvent e) { wasFired = true; } /** * @return Returns the wasFired. */ public boolean wasFired() { return wasFired; } /** * @param wasFired The wasFired to set. */ public void setWasFired(boolean wasFired) { this.wasFired = wasFired; } } } mule-2.0.1/core/src/test/java/org/mule/util/ExpiryMonitorTestCase.java0000644000175000017500000000536210664630335025570 0ustar charlescharles/* * $Id: ExpiryMonitorTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.monitor.Expirable; import org.mule.util.monitor.ExpiryMonitor; public class ExpiryMonitorTestCase extends AbstractMuleTestCase { private boolean expired = false; protected void doSetUp() throws Exception { expired = false; } public void testExpiry() throws InterruptedException { ExpiryMonitor monitor = new ExpiryMonitor(100); Expirable e = new Expirable() { public void expired() { expired = true; } }; monitor.addExpirable(300, e); Thread.sleep(800); assertTrue(expired); assertTrue(!monitor.isRegistered(e)); } public void testNotExpiry() throws InterruptedException { ExpiryMonitor monitor = new ExpiryMonitor(100); Expirable e = new Expirable() { public void expired() { expired = true; } }; monitor.addExpirable(800, e); Thread.sleep(300); assertTrue(!expired); Thread.sleep(800); assertTrue(expired); assertTrue(!monitor.isRegistered(e)); } public void testExpiryWithReset() throws InterruptedException { ExpiryMonitor monitor = new ExpiryMonitor(100); Expirable e = new Expirable() { public void expired() { expired = true; } }; monitor.addExpirable(600, e); Thread.sleep(200); assertTrue(!expired); monitor.resetExpirable(e); Thread.sleep(200); assertTrue(!expired); Thread.sleep(600); assertTrue(expired); assertTrue(!monitor.isRegistered(e)); } public void testNotExpiryWithRemove() throws InterruptedException { ExpiryMonitor monitor = new ExpiryMonitor(100); Expirable e = new Expirable() { public void expired() { expired = true; } }; monitor.addExpirable(1000, e); Thread.sleep(200); assertTrue(!expired); Thread.sleep(200); monitor.removeExpirable(e); Thread.sleep(800); assertTrue(!expired); assertTrue(!monitor.isRegistered(e)); } } mule-2.0.1/core/src/test/java/org/mule/util/PropertiesUtilsTestCase.java0000644000175000017500000000662210702427761026115 0ustar charlescharles/* * $Id: PropertiesUtilsTestCase.java 8988 2007-10-08 13:26:09Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.text.NumberFormat; import java.util.HashMap; import java.util.Map; import org.apache.commons.collections.keyvalue.DefaultMapEntry; public class PropertiesUtilsTestCase extends AbstractMuleTestCase { public void testRemoveNameSpacePrefix() { String temp = "this.is.a.namespace"; String result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); temp = "this.namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); temp = "namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); temp = "this_is-a-namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("this_is-a-namespace", result); } public void testRemoveXMLNameSpacePrefix() { String temp = "j:namespace"; String result = PropertiesUtils.removeXmlNamespacePrefix(temp); assertEquals("namespace", result); temp = "this-namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("this-namespace", result); temp = "namespace"; result = PropertiesUtils.removeNamespacePrefix(temp); assertEquals("namespace", result); } public void testRemoveNamespaces() throws Exception { Map props = new HashMap(); props.put("blah.booleanProperty", "true"); props.put("blah.blah.doubleProperty", NumberFormat.getInstance().format(0.124)); props.put("blah.blah.Blah.intProperty", "14"); props.put("longProperty", "999999999"); props.put("3456.stringProperty", "string"); props = PropertiesUtils.removeNamespaces(props); assertTrue(MapUtils.getBooleanValue(props, "booleanProperty", false)); assertEquals(0.124, 0, MapUtils.getDoubleValue(props, "doubleProperty", 0)); assertEquals(14, MapUtils.getIntValue(props, "intProperty", 0)); assertEquals(999999999, 0, MapUtils.getLongValue(props, "longProperty", 0)); assertEquals("string", MapUtils.getString(props, "stringProperty", "")); } public void testMaskedProperties() { // test nulls assertNull(PropertiesUtils.maskedPropertyValue(null)); assertNull(PropertiesUtils.maskedPropertyValue(new DefaultMapEntry(null, "value"))); assertNull(PropertiesUtils.maskedPropertyValue(new DefaultMapEntry("key", null))); // try non-masked value Map.Entry property = new DefaultMapEntry("secretname", "secret"); assertTrue("secret".equals(PropertiesUtils.maskedPropertyValue(property))); // now mask value PropertiesUtils.registerMaskedPropertyName("secretname"); String masked = PropertiesUtils.maskedPropertyValue(property); assertFalse("secret".equals(masked)); assertTrue(masked.startsWith("*")); } } mule-2.0.1/core/src/test/java/org/mule/util/test.properties0000644000175000017500000000002710606537630023527 0ustar charlescharlestest1=test1 test2=test2mule-2.0.1/core/src/test/java/org/mule/util/counters/0000755000175000017500000000000011351411077022267 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/util/counters/CountersTestCase.java0000644000175000017500000001524510664630335026405 0ustar charlescharles/* * $Id: CountersTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.counters; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.counters.CounterFactory.Type; import java.util.Iterator; public class CountersTestCase extends AbstractMuleTestCase { private static final double delta = 1E-10; public void testCreate() { assertNotNull(CounterFactory.createCounter("create1", Type.NUMBER)); assertNotNull(CounterFactory.createCounter("create2", Type.NUMBER, false)); assertNotNull(CounterFactory.createCounter("create3", "create1", Type.MIN)); assertNotNull(CounterFactory.createCounter("create4", "create1", Type.MIN, false)); assertNotNull(CounterFactory.createCounter("create5", "create1", "create2", Type.PLUS)); assertNotNull(CounterFactory.createCounter("create6", "create1", "create2", Type.PLUS, false)); assertNotNull(CounterFactory.getCounter("create1")); assertNull(CounterFactory.getCounter("zzz")); for (Iterator it = CounterFactory.getCounters(); it.hasNext();) { Counter ct = (Counter)it.next(); assertNotNull(ct); } try { CounterFactory.createCounter("create1", Type.NUMBER); fail("The creation of a duplicate counter should have failed"); } catch (IllegalStateException e) { // expected } } public void testNumber() { Counter ct = CounterFactory.createCounter("testNumber", Type.NUMBER); assertEquals("Default value", 0.0, ct.nextValue(), delta); ct.setRawValue(10.0); assertEquals("setRawValue", 10.0, ct.nextValue(), delta); ct.increment(); assertEquals("increment", 11.0, ct.nextValue(), delta); ct.incrementBy(2.0); assertEquals("incrementBy", 13.0, ct.nextValue(), delta); ct.decrement(); assertEquals("decrement", 12.0, ct.nextValue(), delta); } public void testMinMax() { Counter ct = CounterFactory.createCounter("testMinMax", Type.NUMBER); Counter min = CounterFactory.createCounter("testMinMax.min", "testMinMax", Type.MIN); Counter max = CounterFactory.createCounter("testMinMax.max", "testMinMax", Type.MAX); assertEquals("Min default value", Double.MAX_VALUE, min.nextValue(), delta); assertEquals("Max default value", Double.MIN_VALUE, max.nextValue(), delta); ct.setRawValue(10.0); ct.setRawValue(12.0); ct.setRawValue(18.0); ct.setRawValue(16.0); assertEquals("Min", 10.0, min.nextValue(), delta); assertEquals("Max", 18.0, max.nextValue(), delta); } public void testDelta() { Counter ct = CounterFactory.createCounter("testDelta", Type.NUMBER); Counter dt = CounterFactory.createCounter("testDelta.delta", "testDelta", Type.DELTA); assertEquals("Default value", 0.0, dt.nextValue(), delta); ct.setRawValue(10.0); assertEquals("First value", 10.0, dt.nextValue(), delta); ct.setRawValue(12.0); assertEquals("Delta", 2.0, dt.nextValue(), delta); ct.setRawValue(18.0); assertEquals("Delta", 6.0, dt.nextValue(), delta); ct.setRawValue(16.0); assertEquals("Delta", 0.0, dt.nextValue(), delta); } public void testSum() { Counter ct = CounterFactory.createCounter("testSum", Type.NUMBER); Counter sum = CounterFactory.createCounter("testSum.sum", "testSum", Type.SUM); assertEquals("Default value", 0.0, sum.nextValue(), delta); ct.setRawValue(10.0); assertEquals("First value", 10.0, sum.nextValue(), delta); ct.setRawValue(12.0); assertEquals("Sum", 22.0, sum.nextValue(), delta); ct.setRawValue(18.0); assertEquals("Sum", 40.0, sum.nextValue(), delta); ct.setRawValue(16.0); assertEquals("Sum", 56.0, sum.nextValue(), delta); } public void testAverage() { Counter ct = CounterFactory.createCounter("testAverage", Type.NUMBER); Counter avg = CounterFactory.createCounter("testAverage.avg", "testAverage", Type.AVERAGE); assertEquals("Default value", 0.0, avg.nextValue(), delta); ct.setRawValue(10.0); assertEquals("First value", 10.0, avg.nextValue(), delta); ct.setRawValue(12.0); assertEquals("Average", 11.0, avg.nextValue(), delta); ct.setRawValue(18.0); assertEquals("Average", 40.0 / 3.0, avg.nextValue(), delta); ct.setRawValue(16.0); assertEquals("Average", 14.0, avg.nextValue(), delta); } /** * Serious non-portable timing issues :( * * @throws InterruptedException */ public void _disabled_testInstantRate() throws InterruptedException { Counter ct = CounterFactory.createCounter("testRate", Type.NUMBER); Counter rate = CounterFactory.createCounter("testRate.rate", "testRate", Type.INSTANT_RATE); assertTrue("InstantRate", Double.isNaN(rate.nextValue())); Thread.sleep(10); ct.setRawValue(1); assertTrue("InstantRate", Double.isNaN(rate.nextValue())); Thread.sleep(100); ct.setRawValue(20); assertEquals("InstantRate", 200, rate.nextValue(), 200 * 0.20); Thread.sleep(300); ct.setRawValue(30); assertEquals("InstantRate", 100, rate.nextValue(), 100 * 0.20); ct.setRawValue(30); ct.setRawValue(30); assertTrue("InstantRate", Double.isNaN(rate.nextValue())); } public void testRatePerUnit() throws InterruptedException { Counter ct = CounterFactory.createCounter("testRatePerUnit", Type.NUMBER); assertNotNull(ct); Counter rsec = CounterFactory.createCounter("testRatePerUnit.rate.sec", "testRatePerUnit", Type.RATE_PER_SECOND); assertNotNull(rsec); Counter rmin = CounterFactory.createCounter("testRatePerUnit.rate.min", "testRatePerUnit", Type.RATE_PER_MINUTE); assertNotNull(rmin); assertEquals("Rate", 0.0, rsec.nextValue(), delta); for (int i = 0; i < 5; i++) { ct.setRawValue(10); Thread.sleep(1000); } assertEquals("RatePerSecond", 10.0, rsec.nextValue(), 10.0 * 0.20); assertEquals("RatePerMinute", 50.0, rmin.nextValue(), 10.0 * 0.20); } } mule-2.0.1/core/src/test/java/org/mule/util/FilenameUtilsTestCase.java0000644000175000017500000000407510664630335025501 0ustar charlescharles/* * $Id: FilenameUtilsTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import java.io.File; import junit.framework.TestCase; public class FilenameUtilsTestCase extends TestCase { public void testFileWithPathComponentsNullParameter() { File result = FilenameUtils.fileWithPathComponents(null); assertNull(result); } public void testFileWithNullElements() { File tempDir = getBuidDirectory(); File result = FilenameUtils.fileWithPathComponents( new String[] {tempDir.getAbsolutePath(), "tmp", null, "bar"}); // make sure that we can validate the test result on all platforms. String resultNormalized = result.getAbsolutePath().replace(File.separatorChar, '|'); String excpected = tempDir.getAbsolutePath().replace(File.separatorChar, '|') + "|tmp|bar"; assertEquals(excpected, resultNormalized); } public void testFileWithPathComponents() { String tempDirPath = getBuidDirectory().getAbsolutePath(); File result = FilenameUtils.fileWithPathComponents(new String[]{tempDirPath, "tmp", "foo", "bar"}); // make sure that we can validate the test result on all platforms. String resultNormalized = result.getAbsolutePath().replace(File.separatorChar, '|'); String expected = tempDirPath.replace(File.separatorChar, '|') + "|tmp|foo|bar"; assertEquals(expected, resultNormalized); } /** * Used to obtain base directory used in tests. Uses the build directory; * "target" in the current working directory. */ private File getBuidDirectory() { return FileUtils.newFile(SystemUtils.getUserDir(), "target"); } } mule-2.0.1/core/src/test/java/org/mule/util/MulticasterTestCase.java0000644000175000017500000000243210664630335025227 0ustar charlescharles/* * $Id: MulticasterTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Banana; import org.mule.tck.testmodels.fruit.Fruit; import org.mule.tck.testmodels.fruit.WaterMelon; import java.util.ArrayList; import java.util.List; public class MulticasterTestCase extends AbstractMuleTestCase { public void testMulticating() throws Exception { List fruit = new ArrayList(); Apple apple = new Apple(); Banana banana = new Banana(); WaterMelon melon = new WaterMelon(); fruit.add(apple); fruit.add(banana); fruit.add(melon); Fruit caster = (Fruit)Multicaster.create(Fruit.class, fruit); caster.bite(); assertTrue(apple.isBitten()); assertTrue(banana.isBitten()); assertTrue(melon.isBitten()); } } mule-2.0.1/core/src/test/java/org/mule/util/DateUtilsTestCase.java0000644000175000017500000000256410664630335024637 0ustar charlescharles/* * $Id: DateUtilsTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.util.Date; public class DateUtilsTestCase extends AbstractMuleTestCase { private final String TEST_DATE_FORMAT = "dd/MM/yyyy hh:mm:ss"; private final String TEST_DATE_FORMAT_2 = "dd-MM-yy, hh:mm"; public void testDateUtils() throws Exception { String date = "12/11/2002 12:06:47"; Date result = DateUtils.getDateFromString(date, TEST_DATE_FORMAT); assertTrue(result.before(new Date(System.currentTimeMillis()))); String newDate = DateUtils.getStringFromDate(result, TEST_DATE_FORMAT); assertEquals(date, newDate); String timestamp = DateUtils.formatTimeStamp(result, TEST_DATE_FORMAT_2); assertEquals("12-11-02, 12:06", timestamp); String newTimestamp = DateUtils.getTimeStamp(TEST_DATE_FORMAT_2); assertEquals(DateUtils.getStringFromDate(new Date(), TEST_DATE_FORMAT_2), newTimestamp); } } mule-2.0.1/core/src/test/java/org/mule/util/TemplateParserTestCase.java0000644000175000017500000001047310664630335025667 0ustar charlescharles/* * $Id: TemplateParserTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class TemplateParserTestCase extends AbstractMuleTestCase { public void testStringParserSquareBraces() { TemplateParser tp = TemplateParser.createSquareBracesStyleParser(); Map props = new HashMap(); props.put("fromAddress", "ross.mason@symphonysoft.com"); String string = "smtp://[fromAddress]"; String result = tp.parse(props, string); assertEquals("smtp://ross.mason@symphonysoft.com", result); string = "smtp://[toAddress]"; result = tp.parse(props, string); assertEquals("smtp://[toAddress]", result); } public void testStringParserAntBraces() { TemplateParser tp = TemplateParser.createAntStyleParser(); Map props = new HashMap(); props.put("prop1", "value1"); props.put("prop2", "value2"); String string = "Some String with ${prop1} and ${prop2} in it"; String result = tp.parse(props, string); assertEquals("Some String with value1 and value2 in it", result); string = "${prop1}${prop1}${prop2}"; result = tp.parse(props, string); assertEquals("value1value1value2", result); // MULE-978: a property with backslashes (on Windows) String homeDir = System.getProperty("user.home"); props.put("homeDir", homeDir); string = "${homeDir}/foo"; result = tp.parse(props, string); assertEquals(homeDir + "/foo", result); // whitespace is really popular too String whitespaceValue = "C:\\Documents and Settings\\"; props.put("whitespaceValue", whitespaceValue); string = "start${whitespaceValue}end"; result = tp.parse(props, string); assertEquals("start" + whitespaceValue + "end", result); } public void testListParserAntBraces() { TemplateParser tp = TemplateParser.createAntStyleParser(); Map props = new HashMap(); props.put("prop1", "value1"); props.put("prop2", "value2"); List list = new ArrayList(); list.add("Some String with ${prop1} and ${prop2} in it"); list.add("Some String with ${prop1} in it"); List result = tp.parse(props, list); assertEquals("Some String with value1 and value2 in it", result.get(0)); assertEquals("Some String with value1 in it", result.get(1)); result = tp.parse(props, (List)null); assertNotNull(result); assertEquals(0, result.size()); } public void testMapParserAntBraces() { TemplateParser tp = TemplateParser.createAntStyleParser(); Map props = new HashMap(); props.put("prop1", "value1"); props.put("prop2", "value2"); Map map = new HashMap(); map.put("value1", "Some String with ${prop1} and ${prop2} in it"); map.put("value2", "Some String with ${prop1} in it"); Map result = tp.parse(props, map); assertEquals("Some String with value1 and value2 in it", result.get("value1")); assertEquals("Some String with value1 in it", result.get("value2")); result = tp.parse(props, (Map)null); assertNotNull(result); assertEquals(0, result.size()); } public void testStringParserAntBracesWithSimilarNames() { TemplateParser tp = TemplateParser.createAntStyleParser(); Map props = new HashMap(); props.put("prop1", "value1"); props.put("prop1-2", "value2"); String string = "Some String with ${prop1} and ${prop1-2} in it"; String result = tp.parse(props, string); assertEquals("Some String with value1 and value2 in it", result); string = "A${prop1-2}B${prop1}C${prop2}"; result = tp.parse(props, string); assertEquals("Avalue2Bvalue1C${prop2}", result); } } mule-2.0.1/core/src/test/java/org/mule/util/TimedSocketTestCase.java0000644000175000017500000001166310714714756025162 0ustar charlescharles/* * $Id: TimedSocketTestCase.java 9671 2007-11-08 23:21:18Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.io.IOException; import java.io.InterruptedIOException; import java.net.MalformedURLException; import java.net.ServerSocket; import java.net.Socket; import java.net.SocketException; /** * Note: *

    These test cases do not cover all possible connection failures. * It is e.g. not easily possible to simulate an unplugged cable.

    * * Note: this test will fail if off-line. */ public class TimedSocketTestCase extends AbstractMuleTestCase { private static final String REACHABLE_HOSTNAME = "127.0.0.1"; private static final int REACHABLE_PORT = 3333; private static final String UNREACHABLE_HOSTNAME = "4.7.1.1"; private static final int UNREACHABLE_PORT = 4711; private static final int TEST_TIMEOUT = 1000; private static final int TEST_TIMEOUT_DELTA = 300; public void testWorkingConnection() throws Exception { Socket client = null; ServerSocket server = null; try { server = new ServerSocket(REACHABLE_PORT); assertNotNull(server); client = TimedSocket.createSocket(REACHABLE_HOSTNAME, REACHABLE_PORT, TEST_TIMEOUT); assertNotNull(client); } catch (InterruptedIOException iioe) { fail("Server timed out"); } catch (SocketException se) { fail("Client/Server socket exception"); } catch (IOException ioe) { fail("Client/Server network I/O error - " + ioe); } finally { try { if (client != null) { client.close(); } } catch (Exception ignore) { fail("Error closing client connection"); } finally { try { if (server != null) { server.close(); } } catch (Exception ignore) { fail("Error closing server connection"); } } } } public void testConnectionTimeoutInterruptionOnReachableHostnameAndUnreachablePort() throws Exception { Socket client = null; try { client = TimedSocket.createSocket(REACHABLE_HOSTNAME, UNREACHABLE_PORT, TEST_TIMEOUT); fail("Socket exception is expected"); } catch (InterruptedIOException iioe) { assertNull(client); } catch (MalformedURLException mue) { fail("Invalid URL"); } catch (SocketException se) { assertNull(client); } catch (IOException ioe) { fail("Network I/O error - " + ioe); } finally { try { if (client != null) { client.close(); } } catch (Exception ignore) { fail("Error closing connection"); } } } public void testConnectionTimeoutInterruptionOnUnreachableHostnameAndPost() throws Exception { Socket client = null; long startTime = 0; long stopTime = 0; try { startTime = System.currentTimeMillis(); client = TimedSocket.createSocket(UNREACHABLE_HOSTNAME, UNREACHABLE_PORT, TEST_TIMEOUT); fail("Timeout is expected"); } catch (InterruptedIOException iioe) { stopTime = System.currentTimeMillis(); assertTrue("Remote host timeout was longer than expected. Expected: " + TEST_TIMEOUT + ", but was" + stopTime, (stopTime - startTime) > (TEST_TIMEOUT - TEST_TIMEOUT_DELTA)); } catch (MalformedURLException mue) { fail("Invalid URL"); } catch (SocketException se) { fail("Socket exception"); } catch (IOException ioe) { fail("Network I/O error - " + ioe); } finally { try { if (client != null) { client.close(); } } catch (Exception ignore) { fail("Error closing connection"); } } } } mule-2.0.1/core/src/test/java/org/mule/util/compression/0000755000175000017500000000000011351411076022765 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/util/compression/CompressionTestCase.java0000644000175000017500000000633510664630335027603 0ustar charlescharles/* * $Id: CompressionTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.compression; import org.mule.tck.AbstractMuleTestCase; import java.util.Arrays; public class CompressionTestCase extends AbstractMuleTestCase { public void testCompressDefaultGZip() throws Exception { String temp = "This is a compressed string"; CompressionStrategy strategy = CompressionHelper.getDefaultCompressionStrategy(); byte[] compressed = strategy.compressByteArray(temp.getBytes()); // For small test data the compressed data will be bigger than the real data assertTrue(compressed.length > temp.getBytes().length); byte[] uncompressed = strategy.uncompressByteArray(compressed); assertTrue(uncompressed.length == temp.getBytes().length); assertEquals(temp, new String(uncompressed)); String tempLarge = temp; for (int i = 0; i < 100; i++) { tempLarge += temp; } compressed = strategy.compressByteArray(tempLarge.getBytes()); assertTrue(compressed.length < tempLarge.getBytes().length); uncompressed = strategy.uncompressByteArray(compressed); assertTrue(uncompressed.length == tempLarge.getBytes().length); assertEquals(tempLarge, new String(uncompressed)); } public void testNullIsCompressed() throws Exception { CompressionStrategy strategy = CompressionHelper.getDefaultCompressionStrategy(); assertFalse(strategy.isCompressed(null)); } public void testEmptyIsCompressed() throws Exception { CompressionStrategy strategy = CompressionHelper.getDefaultCompressionStrategy(); assertFalse(strategy.isCompressed(new byte[0])); } public void testCompressNullBytes() throws Exception { CompressionStrategy strategy = CompressionHelper.getDefaultCompressionStrategy(); assertNull(strategy.compressByteArray(null)); } public void testCompressEmptyBytes() throws Exception { CompressionStrategy strategy = CompressionHelper.getDefaultCompressionStrategy(); byte[] bytes = new byte[0]; byte[] result = strategy.compressByteArray(bytes); assertTrue(strategy.isCompressed(result)); } public void testUncompressNullBytes() throws Exception { CompressionStrategy strategy = CompressionHelper.getDefaultCompressionStrategy(); assertNull(strategy.uncompressByteArray(null)); } public void testUncompressEmptyBytes() throws Exception { CompressionStrategy strategy = CompressionHelper.getDefaultCompressionStrategy(); byte[] bytes = new byte[0]; byte[] cmpbytes = strategy.compressByteArray(bytes); assertTrue(strategy.isCompressed(cmpbytes)); byte[] result = strategy.uncompressByteArray(cmpbytes); assertTrue(Arrays.equals(bytes, result)); } } mule-2.0.1/core/src/test/java/org/mule/util/ObjectUtilsTestCase.java0000644000175000017500000001364010722540631025157 0ustar charlescharles/* * $Id: ObjectUtilsTestCase.java 9865 2007-11-26 12:52:41Z rossmason $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.util.HashMap; public class ObjectUtilsTestCase extends AbstractMuleTestCase { public void testIdentityToShortString() { assertEquals("null", ObjectUtils.identityToShortString(null)); String source = "foo"; String description = ObjectUtils.identityToShortString(source); String[] components = StringUtils.split(description, '@'); assertNotNull(components); assertEquals(2, components.length); assertEquals("String", components[0]); assertEquals(Integer.toHexString(System.identityHashCode(source)), components[1]); } public void testBooleanConversion() throws Exception { Object value = "true"; assertTrue(ObjectUtils.getBoolean(value, false)); value = "xyz"; assertFalse(ObjectUtils.getBoolean(value, false)); value = new Integer(6); assertTrue(ObjectUtils.getBoolean(value, false)); value = new Integer(1); assertTrue(ObjectUtils.getBoolean(value, false)); value = new Integer(0); assertFalse(ObjectUtils.getBoolean(value, false)); value = new Integer(-41); assertFalse(ObjectUtils.getBoolean(value, false)); value = null; assertFalse(ObjectUtils.getBoolean(value, false)); } public void testShortConversion() throws Exception { Object value = "123"; assertEquals((short) 123, ObjectUtils.getShort(value, (short) -1)); value = "xyz"; assertEquals((short) -1, ObjectUtils.getShort(value, (short) -1)); value = new Integer(6); assertEquals((short) 6, ObjectUtils.getShort(value, (short) -1)); value = new Double(63.4); assertEquals((short) 63, ObjectUtils.getShort(value, (short) -1)); value = new Float(-163.2); assertEquals((short) -163, ObjectUtils.getShort(value, (short) -1)); value = null; assertEquals((short) -1, ObjectUtils.getShort(value, (short) -1)); } public void testByteConversion() throws Exception { Object value = "123"; assertEquals((byte) 123, ObjectUtils.getByte(value, (byte) -1)); value = "xyz"; assertEquals((byte) -1, ObjectUtils.getByte(value, (byte) -1)); value = new Integer(6); assertEquals((byte) 6, ObjectUtils.getByte(value, (byte) -1)); value = new Double(63.4); assertEquals((byte) 63, ObjectUtils.getByte(value, (byte) -1)); value = new Float(-163.2); assertEquals((byte) -163, ObjectUtils.getByte(value, (byte) -1)); value = null; assertEquals((byte) -1, ObjectUtils.getByte(value, (byte) -1)); } public void testIntConversion() throws Exception { Object value = "123"; assertEquals(123, ObjectUtils.getInt(value, -1)); value = "xyz"; assertEquals(-1, ObjectUtils.getInt(value, -1)); value = new Integer(6); assertEquals(6, ObjectUtils.getInt(value, -1)); value = new Double(63.4); assertEquals(63, ObjectUtils.getInt(value, -1)); value = new Float(-163.2); assertEquals(-163, ObjectUtils.getInt(value, -1)); value = null; assertEquals(-1, ObjectUtils.getInt(value, -1)); } public void testLongConversion() throws Exception { Object value = "123"; assertEquals(123, ObjectUtils.getLong(value, -1)); value = "xyz"; assertEquals(-1, ObjectUtils.getLong(value, -1)); value = new Integer(6); assertEquals(6, ObjectUtils.getLong(value, -1)); value = new Double(63.4); assertEquals(63, ObjectUtils.getLong(value, -1)); value = new Float(-163.2); assertEquals(-163, ObjectUtils.getLong(value, -1)); value = null; assertEquals(-1, ObjectUtils.getLong(value, -1)); } public void testFloatConversion() throws Exception { Object value = "123.34"; assertEquals(123.34, ObjectUtils.getFloat(value, -1), 0.1f); value = "xyz"; assertEquals(-1, ObjectUtils.getFloat(value, -1), 0.1f); value = new Integer(6); assertEquals(6, ObjectUtils.getFloat(value, -1), 0.1f); value = new Double(63.4); assertEquals(63.4, ObjectUtils.getFloat(value, -1), 0.1f); value = new Float(-163.2); assertEquals(-163.2, ObjectUtils.getFloat(value, -1), 0.1f); value = null; assertEquals(-1, ObjectUtils.getFloat(value, -1), 0.1f); } public void testDoubleConversion() throws Exception { Object value = "123.34"; assertEquals(123.34, ObjectUtils.getDouble(value, -1), 0.1d); value = "xyz"; assertEquals(-1, ObjectUtils.getDouble(value, -1), 0.1d); value = new Integer(6); assertEquals(6, ObjectUtils.getDouble(value, -1), 0.1d); value = new Double(63.4); assertEquals(63.4, ObjectUtils.getDouble(value, -1), 0.1d); value = new Float(-163.2); assertEquals(-163.2, ObjectUtils.getDouble(value, -1), 0.1d); value = null; assertEquals(-1, ObjectUtils.getDouble(value, -1), 0.1d); } public void testStringConversion() throws Exception { Object value = "hello"; assertEquals("hello", ObjectUtils.getString(value, "x")); value = new HashMap(); assertEquals(new HashMap().toString(), ObjectUtils.getString(value, "x")); value = null; assertEquals("x", ObjectUtils.getString(value, "x")); } } mule-2.0.1/core/src/test/java/org/mule/util/ArrayUtilsTestCase.java0000644000175000017500000000410110746275214025027 0ustar charlescharles/* * $Id: ArrayUtilsTestCase.java 10529 2008-01-25 05:58:36Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.util.List; public class ArrayUtilsTestCase extends AbstractMuleTestCase { public void testToArrayOfComponentType() { // null array assertNull(ArrayUtils.toArrayOfComponentType(null, String.class)); // empty array, same result String[] a = new String[]{}; String[] a2 = (String[])ArrayUtils.toArrayOfComponentType(a, String.class); assertSame(a2, a); // null service type is not allowed try { ArrayUtils.toArrayOfComponentType(a, null); fail(); } catch (IllegalArgumentException iex) { // ok } // single element a = new String[]{":-)"}; CharSequence[] cs = (CharSequence[])ArrayUtils.toArrayOfComponentType(a, CharSequence.class); assertEquals(a.length, cs.length); assertSame(a[0], cs[0]); // incompatible element types are not a good idea either try { ArrayUtils.toArrayOfComponentType(a, List.class); fail(); } catch (ArrayStoreException asx) { // ok } } public void testToStringMaxLength() { Object test = new byte[100]; for (int i = 0; i < ((byte[])test).length; i++) { ((byte[])test)[i] = (byte)i; } // the String will contain not more than exactly MAX_ARRAY_LENGTH elements String result = ArrayUtils.toString(test, 10); assertTrue(result.endsWith("[..]}")); assertEquals(9, StringUtils.countMatches(result, ",")); } } mule-2.0.1/core/src/test/java/org/mule/util/MapCombinerTestCase.java0000644000175000017500000001110710766061620025124 0ustar charlescharles/* * $Id: MapCombinerTestCase.java 11339 2008-03-12 23:13:20Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; public class MapCombinerTestCase extends AbstractMuleTestCase { public void testBasicMerge() { doTestMerge(new MapCombiner(), "[a:[b:B,c:C]]", "[a:[d:D]]", "[a:[b:B,c:C,d:D]]"); } public void testOverwrite() { MapCombiner combiner = new MapCombiner(); combiner.setMaxDepth(0); doTestMerge(combiner, "[a:[b:B,c:C]]", "[a:[d:D]]", "[a:[d:D]]"); } public void testDeepMerge() { doTestMerge(new MapCombiner(), "[a:[b:B,c:C,d:[e:E,f:F]]]", "[a:[d:[g:G]]]", "[a:[b:B,c:C,d:[e:E,f:F,g:G]]]"); } public void testRestrictedMerge() { MapCombiner combiner = new MapCombiner(); combiner.setMaxDepth(1); doTestMerge(combiner, "[a:[b:B,c:C,d:[e:E,f:F]]]", "[a:[d:[g:G]]]", "[a:[b:B,c:C,d:[g:G]]]"); } public void testMergeLists() { doTestMerge(new MapCombiner(), "[a:(b,c)]", "[a:(d)]", "[a:(b,c,d)]"); } protected void doTestMerge(MapCombiner combiner, String spec1, String spec2, String specResult) { Map map1 = buildMap(spec1); Map map2 = buildMap(spec2); Map map3 = buildMap(specResult); combiner.setList(new LinkedList()); combiner.getList().add(map1); combiner.getList().add(map2); assertFalse(combiner.isEmpty()); // trigger merge assertEquals(combiner, map3); } public void testInfrastructure() { Map map = buildMap("[a:(b,c)]"); assertTrue(map.get("a") instanceof List); List list = (List) map.get("a"); assertTrue(list.contains("b")); assertTrue(list.contains("c")); } public static Map buildMap(String spec) { Map map = new HashMap(); String empty = fillMap(map, spec); assertTrue("after parsing " + spec + " left with " + empty, empty.equals("")); return map; } protected static String fillMap(Map map, String spec) { spec = drop(spec, "["); while (! spec.startsWith("]")) { assertTrue("spec finished early (missing ']'?)", spec.length() > 1); String key = spec.substring(0, 1); spec = drop(spec, key); spec = drop(spec, ":"); if (spec.startsWith("[")) { Map value = new HashMap(); spec = fillMap(value, spec); map.put(key, value); } else if (spec.startsWith("(")) { List value = new LinkedList(); spec = fillList(value, spec); map.put(key, value); } else { String value = spec.substring(0, 1); spec = drop(spec, value); map.put(key, value); } if (spec.startsWith(",")) { spec = drop(spec, ","); } } return drop(spec, "]"); } protected static String fillList(List list, String spec) { spec = drop(spec, "("); while (! spec.startsWith(")")) { assertTrue("spec finished early (missing ')'?)", spec.length() > 1); if (spec.startsWith("[")) { Map value = new HashMap(); spec = fillMap(value, spec); list.add(value); } else if (spec.startsWith("(")) { List value = new LinkedList(); spec = fillList(value, spec); list.add(value); } else { String value = spec.substring(0, 1); spec = drop(spec, value); list.add(value); } if (spec.startsWith(",")) { spec = drop(spec, ","); } } return drop(spec, ")"); } protected static String drop(String spec, String delim) { assertTrue("expected " + delim + " but spec is " + spec, spec.startsWith(delim)); return spec.substring(1); } }mule-2.0.1/core/src/test/java/org/mule/util/StringUtilsTestCase.java0000644000175000017500000000667210725073732025234 0ustar charlescharles/* * $Id: StringUtilsTestCase.java 9968 2007-12-03 21:40:42Z tcarlson $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.util.Arrays; public class StringUtilsTestCase extends AbstractMuleTestCase { public void testSplitAndTrim1() { String[] result = StringUtils.splitAndTrim(null, ",,"); assertNull(result); result = StringUtils.splitAndTrim("", ","); assertNotNull(result); assertTrue(Arrays.equals(ArrayUtils.EMPTY_STRING_ARRAY, result)); result = StringUtils.splitAndTrim(" ", ","); assertNotNull(result); assertTrue(Arrays.equals(ArrayUtils.EMPTY_STRING_ARRAY, result)); } public void testSplitAndTrim2() { String[] inputValues = new String[]{"foo", "bar", "baz", "kaboom"}; String inputString = new StringBuffer(40) .append(inputValues[0]) .append(" ,") .append(", ") .append(inputValues[1]) .append(" ,") .append(inputValues[2]) .append(" , ") .append(inputValues[3]) .append(" ") .toString(); assertTrue(Arrays.equals(inputValues, StringUtils.splitAndTrim(inputString, ","))); } public void testSplitAndTrim3() { String[] inputValues = new String[]{"foo", "bar", "baz", "kaboom"}; String inputString = "foo, bar,\nbaz, \nkaboom"; assertTrue(Arrays.equals(inputValues, StringUtils.splitAndTrim(inputString, ","))); } public void testHexStringToByteArray() { assertNull(StringUtils.hexStringToByteArray(null)); try { StringUtils.hexStringToByteArray("1"); fail(); } catch (IllegalArgumentException iex) { // OK } assertTrue(Arrays.equals(new byte[]{}, StringUtils.hexStringToByteArray(""))); assertTrue(Arrays.equals(new byte[]{1}, StringUtils.hexStringToByteArray("01"))); assertTrue(Arrays.equals(new byte[]{1, 2}, StringUtils.hexStringToByteArray("0102"))); assertTrue(Arrays.equals(new byte[]{10, 14}, StringUtils.hexStringToByteArray("0A0E"))); assertTrue(Arrays.equals(new byte[]{10, 14}, StringUtils.hexStringToByteArray("0a0e"))); assertTrue(Arrays.equals(new byte[]{10, (byte)0xff}, StringUtils.hexStringToByteArray("0AFF"))); assertTrue(Arrays.equals(new byte[]{10, (byte)0xff}, StringUtils.hexStringToByteArray("0aff"))); } public void testByteArrayToHexString() { assertNull(StringUtils.toHexString(null)); assertEquals("", StringUtils.toHexString(new byte[]{})); assertEquals("01", StringUtils.toHexString(new byte[]{1})); assertEquals("0102", StringUtils.toHexString(new byte[]{1, 2})); assertEquals("0a0e", StringUtils.toHexString(new byte[]{10, 14})); assertEquals("0A0E", StringUtils.toHexString(new byte[]{10, 14}, true)); assertEquals("0aff", StringUtils.toHexString(new byte[]{10, (byte)0xff})); assertEquals("0AFF", StringUtils.toHexString(new byte[]{10, (byte)0xff}, true)); } } mule-2.0.1/core/src/test/java/org/mule/util/IOUtilsTestCase.java0000644000175000017500000000161610664630335024266 0ustar charlescharles/* * $Id: IOUtilsTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.io.InputStream; public class IOUtilsTestCase extends AbstractMuleTestCase { public void testLoadingResourcesAsStream() throws Exception { InputStream is = IOUtils.getResourceAsStream("log4j.properties", getClass(), false, false); assertNotNull(is); is = IOUtils.getResourceAsStream("does-not-exist.properties", getClass(), false, false); assertNull(is); } } mule-2.0.1/core/src/test/java/org/mule/util/JarUtilsTestCase.java0000644000175000017500000000761010674366610024476 0ustar charlescharles/* * $Id: JarUtilsTestCase.java 8504 2007-09-20 03:48:24Z aguenther $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.io.File; import java.util.Arrays; import java.util.Iterator; import java.util.LinkedHashMap; /** * Test suite for jar utilities. */ public class JarUtilsTestCase extends AbstractMuleTestCase { /** *
      *
    1. Create jar file with all supported entries
    2. *
    3. Append jar file with additional entry
    4. *
    5. Read jar file and compare against previous entries written
    6. *
    */ public void testCreateAppendReadJarFileEntries() { File jarFile = null; File jarEntryFile = null; try { // Create jar file from scratch String jarEntryString = "testString"; jarEntryFile = File.createTempFile("test", "file"); byte[] jarEntryBytes = jarEntryString.getBytes(); LinkedHashMap jarEntries = new LinkedHashMap(); jarEntries.put("META-INF/string", jarEntryString); jarEntries.put("META-INF/file", jarEntryFile); jarEntries.put("META-INF/byte", jarEntryBytes); jarFile = File.createTempFile("test", ".jar"); assertTrue(jarFile.delete()); JarUtils.createJarFileEntries(jarFile, jarEntries); // Append entry to jar file LinkedHashMap additionalJarEntries = new LinkedHashMap(); additionalJarEntries.put("META-INF/append/string", jarEntryString); jarEntries.put("META-INF/append/string", jarEntryString); JarUtils.appendJarFileEntries(jarFile, additionalJarEntries); // Read jar file and verify previously written values LinkedHashMap readJarEntries = JarUtils.readJarFileEntries(jarFile); assertEquals(jarEntries.size(), readJarEntries.size()); Iterator jarEntryIter = jarEntries.keySet().iterator(); Iterator readJarEntryIter = readJarEntries.keySet().iterator(); // Iterate through original and read jar entries, which must be equal. while (jarEntryIter.hasNext()) { String jarEntryPath = (String) jarEntryIter.next(); String readJarEntryPath = (String) readJarEntryIter.next(); assertNotNull(jarEntryPath); assertNotNull(readJarEntryPath); assertEquals(jarEntryPath, readJarEntryPath); Object jarEntry = jarEntries.get(jarEntryPath); Object readJarEntry = jarEntries.get(readJarEntryPath); if (jarEntry instanceof String || jarEntry instanceof File) { assertEquals(jarEntry, readJarEntry); } else if (jarEntry instanceof byte[]) { assertTrue(Arrays.equals((byte[]) jarEntry, (byte[]) readJarEntry)); } else { fail("Unsupported jar entry read for " + jarEntryPath); } } } catch (Exception e) { fail(e.getMessage()); } finally { if (jarFile != null) { jarFile.delete(); } if (jarEntryFile != null) { jarEntryFile.delete(); } } } } mule-2.0.1/core/src/test/java/org/mule/util/SpiUtilsTestCase.java0000644000175000017500000000443410664630335024513 0ustar charlescharles/* * $Id: SpiUtilsTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; public class SpiUtilsTestCase extends AbstractMuleTestCase { public void testThisIsJustAnEmptyPlaceholder() { // needed to avoid triggering false TestSuite failures with no test methods. } // public void testDiscoverDefault() throws Exception // { // Class c = SpiUtils.findService(Fruit.class, Banana.class.getName(), getClass()); // assertNotNull(c); // assertEquals(Banana.class.getName(), c.getName()); // } // // public void testDiscoverNotFound() throws Exception // { // Class c = SpiUtils.findService(Fruit.class, getClass()); // assertNull(c); // } // // public void testDiscoverFromProperty() throws Exception // { // System.setProperty(Fruit.class.getName(), Apple.class.getName()); // Class c = SpiUtils.findService(Fruit.class, getClass()); // assertNotNull(c); // assertEquals(Apple.class.getName(), c.getName()); // Properties p = System.getProperties(); // p.remove(Fruit.class.getName()); // System.setProperties(p); // } // // public void testDiscoverFromPropertyFile() throws Exception // { // InputStream is = IOUtils.getResourceAsStream("test-spi.properties", getClass()); // assertNotNull("Test resource not found.", is); // Properties p = new Properties(); // p.load(is); // assertNotNull(p); // Class c = SpiUtils.findService(Fruit.class, p, getClass()); // assertNotNull(c); // assertEquals(Banana.class.getName(), c.getName()); // } // // public void testDiscoverFromResource() throws Exception // { // Class c = SpiUtils.findService(Fruit.class, "test-spi.properties", Apple.class.getName(), getClass()); // assertNotNull(c); // assertEquals(Banana.class.getName(), c.getName()); // } } mule-2.0.1/core/src/test/java/org/mule/util/FileUtilsTestCase.java0000644000175000017500000002676710674366610024657 0ustar charlescharles/* * $Id: FileUtilsTestCase.java 8504 2007-09-20 03:48:24Z aguenther $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.io.File; import java.io.IOException; import junit.framework.TestCase; public class FileUtilsTestCase extends AbstractMuleTestCase { private final String TEST_FILE = "testFile.txt"; private final String TEST_DIRECTORY = "target" + File.separator + "testDirectory"; private final File toDir = FileUtils.newFile(TEST_DIRECTORY); protected void doSetUp() throws Exception { super.doSetUp(); if (!toDir.exists()) { toDir.mkdirs(); } } protected void doTearDown() throws Exception { super.doTearDown(); toDir.delete(); } public void testFileTools() throws Exception { File file = null; try { file = FileUtils.stringToFile(TEST_FILE, "this is a test file"); assertNotNull(file); assertTrue(file.exists()); file = FileUtils.stringToFile(TEST_FILE, " and this is appended content", true); String content = FileUtils.readFileToString(FileUtils.newFile(TEST_FILE), null); assertNotNull(content); assertTrue(content.indexOf("this is a test file") > -1); assertTrue(content.indexOf(" and this is appended content") > -1); file = FileUtils.newFile(TEST_FILE); assertNotNull(file); assertTrue(file.exists()); file = FileUtils.createFile(TEST_FILE); assertNotNull(file); assertTrue(file.exists()); file = FileUtils.createFile(TEST_FILE + "2"); assertNotNull(file); assertTrue(file.exists()); assertTrue(file.canRead()); file.delete(); file = FileUtils.newFile(TEST_FILE); file.delete(); File dir = FileUtils.openDirectory("src"); assertNotNull(dir); assertTrue(dir.exists()); assertTrue(dir.canRead()); assertTrue(dir.isDirectory()); dir = FileUtils.openDirectory("doesNotExist"); assertNotNull(dir); assertTrue(dir.exists()); assertTrue(dir.canRead()); assertTrue(dir.isDirectory()); dir.delete(); } finally { if (file != null) { file.delete(); } } } public void testFileNameTools() throws Exception { String filename = "Blah.txt"; String result = FileUtils.prepareWinFilename(filename); assertEquals("Blah(Blah).txt", result); filename = "Bla]h.txt"; result = FileUtils.prepareWinFilename(filename); assertEquals("Bla-h(Blah-a-b-c-d=e_f-g).txt", result); filename = "B\"la-h.txt"; result = FileUtils.prepareWinFilename(filename); assertEquals("B-la-h(Blah-a-b-c-d=e_f-g).txt", result); } public void testDirectoryTools() throws Exception { File dir = FileUtils.openDirectory("src"); assertNotNull(dir); assertTrue(dir.exists()); assertTrue(dir.canRead()); assertTrue(dir.isDirectory()); dir = FileUtils.openDirectory("doesNotExist"); assertNotNull(dir); assertTrue(dir.exists()); assertTrue(dir.canRead()); assertTrue(dir.isDirectory()); FileUtils.deleteTree(dir); } public void testExtractResource() throws Exception { String testDir = TEST_DIRECTORY + File.separator + "Test-1"; File outputDir = FileUtils.newFile(testDir); if (!outputDir.exists()) { assertTrue("Failed to create output dirs.", outputDir.mkdirs()); } String res = "META-INF/MANIFEST.MF"; FileUtils.extractResources(res, TestCase.class, outputDir, true); File result = FileUtils.newFile(testDir, res); assertNotNull(result); assertTrue(result.exists()); assertTrue(result.canRead()); assertTrue(result.isFile()); assertTrue(result.length() > 0); FileUtils.deleteTree(outputDir); } public void testExtractResources() throws Exception { String testDir = TEST_DIRECTORY + File.separator + "Test-2"; File outputDir = FileUtils.newFile(testDir); if (!outputDir.exists()) { outputDir.mkdirs(); } String res = "META-INF/"; FileUtils.extractResources(res, TestCase.class, outputDir, true); File result = FileUtils.newFile(testDir, res); assertNotNull(result); assertTrue(result.exists()); assertTrue(result.canRead()); assertTrue(result.isDirectory()); FileUtils.deleteTree(outputDir); } public void testExtractFileResource() throws Exception { String testDir = TEST_DIRECTORY + File.separator + "Test-3"; File outputDir = FileUtils.newFile(testDir); if (!outputDir.exists()) { outputDir.mkdirs(); } String res = "org/mule/util/FileUtils.class"; FileUtils.extractResources(res, FileUtils.class, outputDir, true); File result = FileUtils.newFile(testDir, res); assertNotNull(result); assertTrue(result.exists()); assertTrue(result.canRead()); assertTrue(result.isFile()); assertTrue(result.length() > 0); FileUtils.deleteTree(outputDir); } public void testExtractFileResources() throws Exception { String testDir = TEST_DIRECTORY + File.separator + "Test-4"; File outputDir = FileUtils.newFile(testDir); if (!outputDir.exists()) { outputDir.mkdirs(); } String res = "org/mule/util/"; FileUtils.extractResources(res, FileUtils.class, outputDir, true); File result = FileUtils.newFile(testDir, res); assertNotNull(result); assertTrue(result.exists()); assertTrue(result.canRead()); assertTrue(result.isDirectory()); FileUtils.deleteTree(outputDir); } public void testExtractResourceWithoutKeepingDirStructure() throws Exception { String testDir = TEST_DIRECTORY + File.separator + "Test-5"; File outputDir = FileUtils.newFile(testDir); if (!outputDir.exists()) { outputDir.mkdirs(); } String fileName = "MANIFEST.MF"; String res = "META-INF/" + fileName; FileUtils.extractResources(res, TestCase.class, outputDir, false); File result = FileUtils.newFile(testDir, fileName); assertNotNull(result); assertTrue(result.exists()); assertTrue(result.canRead()); assertTrue(result.isFile()); assertTrue(result.length() > 0); FileUtils.deleteTree(outputDir); } public void testExtractResourcesWithoutKeepingDirStructure() throws Exception { String testDir = TEST_DIRECTORY + File.separator + "Test-6"; File outputDir = FileUtils.newFile(testDir); if (!outputDir.exists()) { outputDir.mkdirs(); } String fileName = "util/FileUtilsTestCase.class"; String res = "org/mule/"; FileUtils.extractResources(res, FileUtilsTestCase.class, outputDir, false); File result = FileUtils.newFile(testDir, fileName); assertNotNull(result); assertTrue(result.exists()); assertTrue(result.canRead()); assertTrue(result.isFile()); assertTrue(result.length() > 0); FileUtils.deleteTree(outputDir); } public void testExtractFileResourceWithoutKeepingDirStructure() throws Exception { String testDir = TEST_DIRECTORY + File.separator + "Test-7"; File outputDir = FileUtils.newFile(testDir); if (!outputDir.exists()) { outputDir.mkdirs(); } String fileName = "FileUtils.class"; String res = "org/mule/util/" + fileName; FileUtils.extractResources(res, FileUtils.class, outputDir, false); File result = FileUtils.newFile(testDir, fileName); assertNotNull(result); assertTrue(result.exists()); assertTrue(result.canRead()); assertTrue(result.isFile()); assertTrue(result.length() > 0); FileUtils.deleteTree(outputDir); } public void testExtractFileResourcesWithoutKeepingDirStructure() throws Exception { String testDir = TEST_DIRECTORY + File.separator + "Test-8"; File outputDir = FileUtils.newFile(testDir); if (!outputDir.exists()) { outputDir.mkdirs(); } String fileName = "util/FileUtilsTestCase.class"; String res = "org/mule/"; FileUtils.extractResources(res, FileUtilsTestCase.class, outputDir, false); File result = FileUtils.newFile(testDir, fileName); assertNotNull(result); assertTrue(result.exists()); assertTrue(result.canRead()); assertTrue(result.isFile()); assertTrue(result.length() > 0); FileUtils.deleteTree(outputDir); } public void testDeleteTreeWithIgnoredDirectories() throws Exception { final String testDir = TEST_DIRECTORY + File.separator + "Test-deleting"; File outputDir = FileUtils.newFile(testDir); if (!outputDir.exists()) { outputDir.mkdirs(); } File toBeDeleted1 = FileUtils.newFile(outputDir, "toBeDeleted1/"); toBeDeleted1.mkdirs(); File toBeDeleted2 = FileUtils.newFile(outputDir, "toBeDeleted2/"); toBeDeleted2.mkdirs(); File keepMeIntact = FileUtils.newFile(outputDir, "keepMeIntact/"); keepMeIntact.mkdirs(); FileUtils.deleteTree(outputDir, new String[] {"keepMeIntact"}); assertTrue("Shouldn't have been deleted.", keepMeIntact.exists()); FileUtils.deleteTree(outputDir); } public void testRenameFile() { try { File sourceFile = createTestFile("source"); File destFile = createTestFile("dest"); assertTrue(destFile.delete()); assertTrue(FileUtils.renameFile(sourceFile, destFile)); assertTrue(destFile.exists()); assertTrue(destFile.delete()); } catch (Exception e) { fail(e.getMessage()); } } public void testRenameFileAcrossFolders() { try { File dir = createTestDir("test"); File sourceFile = createTestFile("source"); File destFile = new File(dir, "dest"); assertTrue(FileUtils.renameFile(sourceFile, destFile)); assertTrue(destFile.exists()); assertTrue(destFile.delete()); assertTrue(dir.delete()); } catch (Exception e) { fail(e.getMessage()); } } private File createTestFile(String filePath) throws IOException { return File.createTempFile(filePath, ".junit"); } private File createTestDir(String dirPath) throws IOException { File file = createTestFile(dirPath); file.delete(); file.mkdir(); return file; } } mule-2.0.1/core/src/test/java/org/mule/util/CollectionUtilsTestCase.java0000644000175000017500000000720010664630335026045 0ustar charlescharles/* * $Id: CollectionUtilsTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; public class CollectionUtilsTestCase extends AbstractMuleTestCase { public void testToArrayOfComponentTypeNullCollection() { assertNull(CollectionUtils.toArrayOfComponentType(null, String.class)); } public void testToArrayOfComponentTypeNullType() { try { CollectionUtils.toArrayOfComponentType(Collections.EMPTY_LIST, null); fail("should have thrown IllegalArgumentException"); } catch (IllegalArgumentException iex) { // OK } } public void testToArrayOfComponentTypeEmptyCollection() { assertTrue(Arrays.equals(new String[0], CollectionUtils.toArrayOfComponentType( Collections.EMPTY_LIST, String.class))); } public void testToArrayOfComponentTypeWrongElement() { try { CollectionUtils.toArrayOfComponentType(Collections.singleton("foo"), Integer.class); fail("should have thrown ArrayStoreException"); } catch (ArrayStoreException asx) { // OK } } public void testToArrayOfComponentTypeOK() { String[] objects = new String[]{"foo", "bar", "baz"}; assertTrue(Arrays.equals(objects, CollectionUtils.toArrayOfComponentType(Arrays.asList(objects), String.class))); } public void testToStringNull() throws Exception { Collection c = null; assertEquals("[]", CollectionUtils.toString(c, false)); assertEquals("[]", CollectionUtils.toString(c, true)); } public void testToStringEmpty() throws Exception { Collection c = new ArrayList(); assertEquals("[]", CollectionUtils.toString(c, false)); assertEquals("[]", CollectionUtils.toString(c, true)); } public void testToStringSingleElement() throws Exception { Collection c = Arrays.asList(new Object[]{"foo"}); assertEquals("[foo]", CollectionUtils.toString(c, false)); assertEquals("[" + SystemUtils.LINE_SEPARATOR + "foo" + SystemUtils.LINE_SEPARATOR + "]", CollectionUtils.toString(c, true)); } public void testToStringMultipleElements() throws Exception { Collection c = Arrays.asList(new Object[]{"foo", this.getClass()}); assertEquals("[foo, " + this.getClass().getName() + "]", CollectionUtils.toString(c, false)); assertEquals("[" + SystemUtils.LINE_SEPARATOR + "foo" + SystemUtils.LINE_SEPARATOR + this.getClass().getName() + SystemUtils.LINE_SEPARATOR + "]", CollectionUtils .toString(c, true)); } public void testToStringTooManyElements() { Collection test = new ArrayList(100); for (int i = 0; i < 100; i++) { test.add(new Integer(i)); } // the String will contain not more than exactly MAX_ARRAY_LENGTH elements String result = CollectionUtils.toString(test, 10); assertTrue(result.endsWith("[..]]")); assertEquals(9, StringUtils.countMatches(result, ",")); } } mule-2.0.1/core/src/test/java/org/mule/util/NumberUtilsTestCase.java0000644000175000017500000000303110664630335025200 0ustar charlescharles/* * $Id: NumberUtilsTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.util.Calendar; public class NumberUtilsTestCase extends AbstractMuleTestCase { static final long l = 1000000000; public void testStringToLong() { assertEquals(l, NumberUtils.toLong("1000000000")); } public void testLongToLong() { assertEquals(l, NumberUtils.toLong(new Long(l))); } public void testIntegerToLong() { assertEquals(l, NumberUtils.toLong(new Integer(1000000000))); } public void testIncompatible() { try { NumberUtils.toLong(Calendar.getInstance().getTime()); fail(); } catch (IllegalArgumentException e) { // expected } } public void testNull() { try { // need to cast to Object, otherwise compiler would resolve method to // superclass' implementation NumberUtils.toLong((Object)null); fail(); } catch (IllegalArgumentException e) { // expected } } } mule-2.0.1/core/src/test/java/org/mule/util/MapUtilsTestCase.java0000644000175000017500000000600710664630335024473 0ustar charlescharles/* * $Id: MapUtilsTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.collections.map.CaseInsensitiveMap; public class MapUtilsTestCase extends AbstractMuleTestCase { public void testMapCreationNullClass() { try { MapUtils.mapWithKeysAndValues(null, (String[])null, (String[])null); fail(); } catch (IllegalArgumentException ex) { // expected } } public void testMapCreationWithoutElements() { Map m = MapUtils.mapWithKeysAndValues(HashMap.class, (List)null, (List)null); assertTrue(m.isEmpty()); } public void testCaseInsensitiveMapCreation() { List strings = Arrays.asList(new String[]{"foo"}); Map m = MapUtils.mapWithKeysAndValues(CaseInsensitiveMap.class, strings.iterator(), strings .iterator()); assertEquals("foo", m.get("foo")); assertEquals("foo", m.get("Foo")); assertEquals("foo", m.get("FOO")); } public void testToStringNull() throws Exception { Map props = null; assertEquals("{}", MapUtils.toString(props, false)); assertEquals("{}", MapUtils.toString(props, true)); } public void testToStringEmpty() throws Exception { Map props = new HashMap(); assertEquals("{}", MapUtils.toString(props, false)); assertEquals("{}", MapUtils.toString(props, true)); } public void testToStringSingleElement() throws Exception { Map props = MapUtils.mapWithKeysAndValues(HashMap.class, new Object[]{"foo"}, new Object[]{"bar"}); assertEquals("{foo=bar}", MapUtils.toString(props, false)); assertEquals("{" + SystemUtils.LINE_SEPARATOR + "foo=bar" + SystemUtils.LINE_SEPARATOR + "}", MapUtils.toString(props, true)); } public void testToStringMultipleElements() throws Exception { Map props = MapUtils.mapWithKeysAndValues(HashMap.class, new Object[]{"foo", "foozle"}, new Object[]{ "bar", "doozle"}); String result = MapUtils.toString(props, false); assertTrue(result.indexOf("foo=bar") != -1); assertTrue(result.indexOf("foozle=doozle") != -1); result = MapUtils.toString(props, true); assertTrue(result.startsWith("{" + SystemUtils.LINE_SEPARATOR)); assertTrue(result.indexOf("foo=bar") != -1); assertTrue(result.indexOf("foozle=doozle") != -1); assertTrue(result.endsWith(SystemUtils.LINE_SEPARATOR + "}")); } } mule-2.0.1/core/src/test/java/org/mule/util/SystemUtilsTestCase.java0000644000175000017500000001111310664630335025234 0ustar charlescharles/* * $Id: SystemUtilsTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class SystemUtilsTestCase extends AbstractMuleTestCase { public void testEnvironment() throws Exception { Map env = SystemUtils.getenv(); assertNotNull(env); assertFalse(env.isEmpty()); assertSame(env, SystemUtils.getenv()); String envVarToTest = (SystemUtils.IS_OS_WINDOWS ? "Path" : "PATH"); // This is a hack to catch Cygwin environments; it won't work in cases where // the user has a different term from /etc/termcaps if (SystemUtils.IS_OS_WINDOWS) { String term = (String) env.get("TERM"); if (term != null && term.equals("cygwin")) { envVarToTest = "PATH"; } } assertNotNull(env.get(envVarToTest)); } public void testParsePropertyDefinitions() { Map expected = Collections.EMPTY_MAP; String input; assertEquals(expected, SystemUtils.parsePropertyDefinitions(null)); assertEquals(expected, SystemUtils.parsePropertyDefinitions("")); assertEquals(expected, SystemUtils.parsePropertyDefinitions(" ")); assertEquals(expected, SystemUtils.parsePropertyDefinitions("foo")); assertEquals(expected, SystemUtils.parsePropertyDefinitions("-D")); assertEquals(expected, SystemUtils.parsePropertyDefinitions("-D=")); expected = Collections.singletonMap("-D", "true"); assertEquals(expected, SystemUtils.parsePropertyDefinitions("-D-D")); expected = Collections.singletonMap("-D-D", "true"); assertEquals(expected, SystemUtils.parsePropertyDefinitions("-D-D-D")); expected = Collections.singletonMap("-D-D-D", "true"); assertEquals(expected, SystemUtils.parsePropertyDefinitions("-D-D-D-D")); assertEquals(Collections.EMPTY_MAP, SystemUtils.parsePropertyDefinitions("-D=noKey")); assertEquals(Collections.EMPTY_MAP, SystemUtils.parsePropertyDefinitions("=-D")); assertEquals(Collections.EMPTY_MAP, SystemUtils.parsePropertyDefinitions("foo =foo foo")); expected = Collections.singletonMap("k", "true"); assertEquals(expected, SystemUtils.parsePropertyDefinitions(" -Dk ")); expected = Collections.singletonMap("key", "true"); assertEquals(expected, SystemUtils.parsePropertyDefinitions("-Dkey")); expected = Collections.singletonMap("k", "v"); assertEquals(expected, SystemUtils.parsePropertyDefinitions(" -Dk=v ")); expected = Collections.singletonMap("key", "value"); assertEquals(expected, SystemUtils.parsePropertyDefinitions("-Dkey=value")); expected = Collections.singletonMap("key", "quoted"); assertEquals(expected, SystemUtils.parsePropertyDefinitions("-Dkey=\"quoted\"")); expected = MapUtils.mapWithKeysAndValues(HashMap.class, new String[]{"key", "foo"}, new String[]{ "-Dvalue", "bar"}); assertEquals(expected, SystemUtils.parsePropertyDefinitions("-Dkey=-Dvalue -Dfoo=bar")); assertEquals(Collections.EMPTY_MAP, SystemUtils.parsePropertyDefinitions("-D=-Dfoo-D== =foo")); expected = Collections.singletonMap("key", "split value"); assertEquals(expected, SystemUtils.parsePropertyDefinitions("-Dkey=\"split value\"")); expected = MapUtils.mapWithKeysAndValues(HashMap.class, new String[]{"key1", "key2"}, new String[]{ "split one", "split two"}); input = "-Dkey1=\"split one\" -Dkey2=\"split two\" "; assertEquals(expected, SystemUtils.parsePropertyDefinitions(input)); expected = Collections.singletonMap("key", "open end"); input = "-Dkey=\"open end"; assertEquals(expected, SystemUtils.parsePropertyDefinitions(input)); expected = MapUtils.mapWithKeysAndValues(HashMap.class, new String[]{"keyOnly", "mule.foo", "mule.bar"}, new String[]{"true", "xfoo", "xbar"}); input = " standalone key=value -D -D= -DkeyOnly -D=noKey -Dmule.foo=xfoo -Dmule.bar=xbar "; assertEquals(expected, SystemUtils.parsePropertyDefinitions(input)); } } mule-2.0.1/core/src/test/java/org/mule/util/concurrent/0000755000175000017500000000000011351411076022606 5ustar charlescharlesmule-2.0.1/core/src/test/java/org/mule/util/concurrent/WaitableBooleanTestCase.java0000644000175000017500000001637210664630335030155 0ustar charlescharles/* * $Id: WaitableBooleanTestCase.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.concurrent; import org.mule.tck.AbstractMuleTestCase; public class WaitableBooleanTestCase extends AbstractMuleTestCase { protected final WaitableBoolean TRUE = new WaitableBoolean(true); protected final WaitableBoolean FALSE = new WaitableBoolean(false); public void testCompareToBoolean() { assertEquals(0, TRUE.compareTo(true)); assertEquals(1, TRUE.compareTo(false)); assertEquals(0, FALSE.compareTo(false)); assertEquals(-1, FALSE.compareTo(true)); } public void testCompareToWaitableBoolean() { assertEquals(0, TRUE.compareTo(new WaitableBoolean(true))); assertEquals(1, TRUE.compareTo(new WaitableBoolean(false))); assertEquals(0, FALSE.compareTo(new WaitableBoolean(false))); assertEquals(-1, FALSE.compareTo(new WaitableBoolean(true))); assertEquals(0, TRUE.compareTo((Object)TRUE)); } public void testCompareToObject() { assertEquals(0, TRUE.compareTo((Object)TRUE)); } public void testEquals() { assertTrue(TRUE.equals(TRUE)); assertFalse(TRUE.equals(FALSE)); assertFalse(FALSE.equals(TRUE)); assertTrue(TRUE.equals(new WaitableBoolean(true))); assertTrue(FALSE.equals(new WaitableBoolean(false))); assertFalse(TRUE.equals(":-)")); } public void testHashCode() { assertTrue(TRUE.hashCode() != FALSE.hashCode()); assertEquals(TRUE.hashCode(), (new WaitableBoolean(true)).hashCode()); assertEquals(FALSE.hashCode(), (new WaitableBoolean(false)).hashCode()); } public void testToString() { assertEquals("true", TRUE.toString()); assertEquals("false", FALSE.toString()); } public void testGet() { assertTrue(TRUE.get()); assertFalse(FALSE.get()); } public void testSet() { assertTrue(TRUE.set(true)); assertTrue(TRUE.set(false)); assertFalse(TRUE.set(true)); assertFalse(FALSE.set(false)); assertFalse(FALSE.set(true)); assertTrue(FALSE.set(true)); } public void testCommit() { assertTrue(TRUE.compareAndSet(true, true)); assertTrue(TRUE.get()); assertFalse(TRUE.compareAndSet(false, true)); assertTrue(TRUE.compareAndSet(true, false)); assertFalse(TRUE.get()); assertTrue(TRUE.compareAndSet(false, true)); assertTrue(TRUE.get()); } public void testComplement() { assertFalse(TRUE.complement()); assertFalse(TRUE.get()); assertTrue(FALSE.complement()); assertTrue(FALSE.get()); } public void testAnd() { assertTrue((new WaitableBoolean(true)).and(true)); assertFalse((new WaitableBoolean(true)).and(false)); assertFalse((new WaitableBoolean(false)).and(false)); assertFalse((new WaitableBoolean(false)).and(true)); assertTrue(TRUE.and(true)); assertTrue(TRUE.get()); assertFalse(TRUE.and(false)); assertFalse(TRUE.get()); } public void testOr() { assertTrue((new WaitableBoolean(true)).or(true)); assertTrue((new WaitableBoolean(true)).or(false)); assertFalse((new WaitableBoolean(false)).or(false)); assertTrue((new WaitableBoolean(false)).or(true)); assertTrue(TRUE.or(true)); assertTrue(TRUE.get()); assertTrue(TRUE.or(false)); assertTrue(TRUE.get()); } public void testXor() { assertFalse((new WaitableBoolean(true)).xor(true)); assertTrue((new WaitableBoolean(true)).xor(false)); assertFalse((new WaitableBoolean(false)).xor(false)); assertTrue((new WaitableBoolean(false)).xor(true)); } public void testWhenFalse() throws InterruptedException { final WaitableBoolean blocker = new WaitableBoolean(true); final WaitableBoolean actionPerformed = new WaitableBoolean(false); Runnable switcher = new Runnable() { public void run() { try { Thread.sleep(500); blocker.set(false); } catch (InterruptedException iex) { Thread.currentThread().interrupt(); throw new RuntimeException(iex); } } }; Runnable action = new Runnable() { public void run() { actionPerformed.set(true); } }; new Thread(switcher).start(); blocker.whenFalse(action); assertFalse(blocker.get()); assertTrue(actionPerformed.get()); } public void testWhenFalseAlreadyFalse() throws InterruptedException { final WaitableBoolean blocker = new WaitableBoolean(false); final WaitableBoolean actionPerformed = new WaitableBoolean(false); Runnable action = new Runnable() { public void run() { actionPerformed.set(true); } }; blocker.whenFalse(action); assertFalse(blocker.get()); assertTrue(actionPerformed.get()); } public void testWhenTrue() throws InterruptedException { final WaitableBoolean blocker = new WaitableBoolean(false); final WaitableBoolean actionPerformed = new WaitableBoolean(false); Runnable switcher = new Runnable() { public void run() { try { Thread.sleep(500); blocker.set(true); } catch (InterruptedException iex) { Thread.currentThread().interrupt(); throw new RuntimeException(iex); } } }; Runnable action = new Runnable() { public void run() { actionPerformed.set(true); } }; new Thread(switcher).start(); blocker.whenTrue(action); assertTrue(blocker.get()); assertTrue(actionPerformed.get()); } public void testWhenTrueAlreadyTrue() throws InterruptedException { final WaitableBoolean blocker = new WaitableBoolean(true); final WaitableBoolean actionPerformed = new WaitableBoolean(false); Runnable action = new Runnable() { public void run() { actionPerformed.set(true); } }; blocker.whenTrue(action); assertTrue(blocker.get()); assertTrue(actionPerformed.get()); } public void testGetLock() { WaitableBoolean b = new WaitableBoolean(true); assertSame(b, b.getLock()); b = new WaitableBoolean(true, this); assertSame(this, b.getLock()); } } mule-2.0.1/core/src/test/java/org/mule/util/concurrent/WaitPolicyTestCase.java0000644000175000017500000002622010734651325027202 0ustar charlescharles/* * $Id: WaitPolicyTestCase.java 10140 2007-12-27 07:23:01Z holger $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util.concurrent; import org.mule.tck.AbstractMuleTestCase; import org.mule.util.StringUtils; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue; import edu.emory.mathcs.backport.java.util.concurrent.RejectedExecutionException; import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicInteger; import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock; public class WaitPolicyTestCase extends AbstractMuleTestCase { private ExceptionCollectingThreadGroup threadGroup; private ThreadPoolExecutor executor; private ReentrantLock executorLock; // @Override protected void doSetUp() throws Exception { super.doSetUp(); // allow 1 active & 1 queued Thread executor = new ThreadPoolExecutor(1, 1, 10000L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(1)); executor.prestartAllCoreThreads(); // the lock must be fair to guarantee FIFO access to the executor; // 'synchronized' on a monitor is not good enough. executorLock = new ReentrantLock(true); // this is a Threadgroup that collects uncaught exceptions. Necessary for JDK // 1.4.x only. threadGroup = new ExceptionCollectingThreadGroup(); // reset counter of active SleepyTasks SleepyTask.activeTasks.set(0); } // @Override protected void doTearDown() throws Exception { executor.shutdown(); threadGroup.destroy(); super.doTearDown(); } // Submit the given Runnables to an ExecutorService, but do so in separate // threads to avoid blocking the test case when the Executors queue is full. // Returns control to the caller when the threads have been started in // order to avoid OS-dependent delays in the control flow. // A submitting thread waits on a fair Lock to guarantee FIFO ordering. // At the time of return the Runnables may or may not be in the queue, // rejected, running or already finished. :-) protected LinkedList/* */execute(final List/* */tasks) throws InterruptedException { if (tasks == null || tasks.isEmpty()) { throw new IllegalArgumentException("List must not be empty"); } LinkedList submitters = new LinkedList(); executorLock.lock(); for (Iterator i = tasks.iterator(); i.hasNext();) { final Runnable task = (Runnable)i.next(); Runnable submitterAction = new Runnable() { public void run() { // the lock is important because otherwise two submitters might // stumble over each other, submitting their runnables out-of-order // and causing test failures. try { executorLock.lock(); executor.execute(task); } finally { executorLock.unlock(); } } }; Thread submitter = new Thread(threadGroup, submitterAction); submitter.setDaemon(true); submitters.add(submitter); submitter.start(); // wait until the thread is actually enqueued on the lock while (submitter.isAlive() && !executorLock.hasQueuedThread(submitter)) { Thread.sleep(10); } } executorLock.unlock(); return submitters; } public void testWaitPolicyWithShutdownExecutor() throws Exception { assertEquals(0, SleepyTask.activeTasks.get()); // wants to wait forever, but will fail immediately executor.setRejectedExecutionHandler(new LastRejectedWaitPolicy()); executor.shutdown(); // create a task List tasks = new ArrayList(); tasks.add(new SleepyTask("rejected", 1000)); // should fail and return immediately LinkedList submitters = this.execute(tasks); assertFalse(submitters.isEmpty()); // let submitted tasks run Thread.sleep(1000); LinkedList exceptions = threadGroup.collectedExceptions(); assertEquals(1, exceptions.size()); Map.Entry threadFailure = (Map.Entry)((Map)(exceptions.getFirst())).entrySet().iterator().next(); assertEquals(submitters.getFirst(), threadFailure.getKey()); assertEquals(RejectedExecutionException.class, threadFailure.getValue().getClass()); assertEquals(0, SleepyTask.activeTasks.get()); } public void testWaitPolicyForever() throws Exception { assertEquals(0, SleepyTask.activeTasks.get()); // tasks wait forever LastRejectedWaitPolicy policy = new LastRejectedWaitPolicy(-1, TimeUnit.SECONDS); executor.setRejectedExecutionHandler(policy); // create tasks List tasks = new ArrayList(); // task 1 runs immediately tasks.add(new SleepyTask("run", 1000)); // task 2 is queued tasks.add(new SleepyTask("queued", 1000)); // task 3 is initially rejected but waits forever Runnable waiting = new SleepyTask("waitingForever", 1000); tasks.add(waiting); // submit tasks LinkedList submitters = this.execute(tasks); assertFalse(submitters.isEmpty()); // the last task should have been queued assertFalse(executor.awaitTermination(4000, TimeUnit.MILLISECONDS)); assertSame(waiting, policy.lastRejectedRunnable()); assertEquals(0, SleepyTask.activeTasks.get()); } public void testWaitPolicyWithTimeout() throws Exception { assertEquals(0, SleepyTask.activeTasks.get()); // set a reasonable retry interval LastRejectedWaitPolicy policy = new LastRejectedWaitPolicy(2500, TimeUnit.MILLISECONDS); executor.setRejectedExecutionHandler(policy); // create tasks List tasks = new ArrayList(); // task 1 runs immediately tasks.add(new SleepyTask("run", 1000)); // task 2 is queued tasks.add(new SleepyTask("queued", 1000)); // task 3 is initially rejected but will eventually succeed Runnable waiting = new SleepyTask("waiting", 1000); tasks.add(waiting); // submit tasks LinkedList submitters = this.execute(tasks); assertFalse(submitters.isEmpty()); assertFalse(executor.awaitTermination(5000, TimeUnit.MILLISECONDS)); assertSame(waiting, policy.lastRejectedRunnable()); assertEquals(0, SleepyTask.activeTasks.get()); } public void testWaitPolicyWithTimeoutFailure() throws Exception { assertEquals(0, SleepyTask.activeTasks.get()); // set a really short wait interval long failureInterval = 100L; LastRejectedWaitPolicy policy = new LastRejectedWaitPolicy(failureInterval, TimeUnit.MILLISECONDS); executor.setRejectedExecutionHandler(policy); // create tasks List tasks = new ArrayList(); // task 1 runs immediately tasks.add(new SleepyTask("run", 1000)); // task 2 is queued tasks.add(new SleepyTask("queued", 1000)); // task 3 is initially rejected & will retry but should fail quickly Runnable failedTask = new SleepyTask("waitAndFail", 1000); tasks.add(failedTask); // submit tasks LinkedList submitters = this.execute(tasks); assertFalse(submitters.isEmpty()); // give failure a chance Thread.sleep(failureInterval * 10); // make sure there was one failure LinkedList exceptions = threadGroup.collectedExceptions(); assertEquals(1, exceptions.size()); // make sure the failed task was the right one Map.Entry threadFailure = (Map.Entry)((Map)(exceptions.getFirst())).entrySet().iterator().next(); assertEquals(submitters.getLast(), threadFailure.getKey()); assertEquals(RejectedExecutionException.class, threadFailure.getValue().getClass()); executor.shutdown(); assertTrue(executor.awaitTermination(2500, TimeUnit.MILLISECONDS)); assertSame(failedTask, policy.lastRejectedRunnable()); assertEquals(0, SleepyTask.activeTasks.get()); } } class LastRejectedWaitPolicy extends WaitPolicy { // needed to hand the last rejected Runnable back to the TestCase private volatile Runnable _rejected; public LastRejectedWaitPolicy() { super(); } public LastRejectedWaitPolicy(long time, TimeUnit timeUnit) { super(time, timeUnit); } public Runnable lastRejectedRunnable() { return _rejected; } // @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { _rejected = r; super.rejectedExecution(r, e); } } // task to execute - just sleeps for the given interval class SleepyTask extends Object implements Runnable { public static final AtomicInteger activeTasks = new AtomicInteger(0); private final String name; private final long sleepTime; public SleepyTask(String name, long sleepTime) { if (StringUtils.isEmpty(name)) { throw new IllegalArgumentException("SleepyTask needs a name!"); } this.name = name; this.sleepTime = sleepTime; } public String toString() { return this.getClass().getName() + '{' + name + ", " + sleepTime + '}'; } public void run() { activeTasks.incrementAndGet(); try { Thread.sleep(sleepTime); } catch (InterruptedException iex) { Thread.currentThread().interrupt(); } finally { activeTasks.decrementAndGet(); } } } // ThreadGroup wrapper that collects uncaught exceptions class ExceptionCollectingThreadGroup extends ThreadGroup { private final LinkedList/* > */exceptions = new LinkedList(); public ExceptionCollectingThreadGroup() { super("ExceptionCollectingThreadGroup"); } // collected Map(Thread, Throwable) associations public LinkedList collectedExceptions() { return exceptions; } // all uncaught Thread exceptions end up here // @Override public void uncaughtException(Thread t, Throwable e) { synchronized (exceptions) { exceptions.add(Collections.singletonMap(t, e)); } } } mule-2.0.1/core/src/test/java/org/mule/util/ClassUtilsTestCase.java0000644000175000017500000002002210735007163025010 0ustar charlescharles/* * $Id: ClassUtilsTestCase.java 10160 2007-12-27 20:43:31Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.util; import org.mule.tck.AbstractMuleTestCase; import org.mule.tck.testmodels.fruit.AbstractFruit; import org.mule.tck.testmodels.fruit.Apple; import org.mule.tck.testmodels.fruit.Banana; import org.mule.tck.testmodels.fruit.Fruit; import org.mule.tck.testmodels.fruit.FruitBowl; import org.mule.tck.testmodels.fruit.Orange; import org.mule.tck.testmodels.fruit.WaterMelon; import java.lang.reflect.Method; import java.net.URL; import java.util.Arrays; import java.util.Enumeration; import java.util.HashSet; import java.util.List; import java.util.Set; public class ClassUtilsTestCase extends AbstractMuleTestCase { // we do not want to match these methods when looking for a service method to // invoke protected final Set ignoreMethods = new HashSet(Arrays.asList(new String[]{"equals", "getInvocationHandler"})); public void testIsConcrete() throws Exception { assertTrue(ClassUtils.isConcrete(Orange.class)); assertTrue(!ClassUtils.isConcrete(Fruit.class)); assertTrue(!ClassUtils.isConcrete(AbstractFruit.class)); try { ClassUtils.isConcrete(null); fail("Class cannot be null, exception should be thrown"); } catch (RuntimeException e) { // expected } } public void testLoadClass() throws Exception { Class clazz = ClassUtils.loadClass("java.lang.String", getClass()); assertNotNull(clazz); assertEquals(clazz.getName(), "java.lang.String"); try { ClassUtils.loadClass("java.lang.Bing", getClass()); fail("ClassNotFoundException should be thrown"); } catch (ClassNotFoundException e) { // expected } } public void testInstanciateClass() throws Exception { Object object = ClassUtils.instanciateClass("org.mule.tck.testmodels.fruit.Orange", new Object[]{}); assertNotNull(object); assertTrue(object instanceof Orange); object = ClassUtils.instanciateClass("org.mule.tck.testmodels.fruit.FruitBowl", new Object[]{ new Apple(), new Banana()}); assertNotNull(object); assertTrue(object instanceof FruitBowl); FruitBowl bowl = (FruitBowl)object; assertTrue(bowl.hasApple()); assertTrue(bowl.hasBanana()); try { ClassUtils.instanciateClass("java.lang.Bing", new Object[]{}); fail("Class does not exist, ClassNotFoundException should have been thrown"); } catch (ClassNotFoundException e) { // expected } } public void testGetParameterTypes() throws Exception { FruitBowl bowl = new FruitBowl(); Class[] classes = ClassUtils.getParameterTypes(bowl, "apple"); assertNotNull(classes); assertEquals(1, classes.length); assertEquals(Apple.class, classes[0]); classes = ClassUtils.getParameterTypes(bowl, "invalid"); assertNotNull(classes); assertEquals(0, classes.length); } public void testLoadingResources() throws Exception { URL resource = ClassUtils.getResource("log4j.properties", getClass()); assertNotNull(resource); resource = ClassUtils.getResource("does-not-exist.properties", getClass()); assertNull(resource); } public void testLoadingResourceEnumeration() throws Exception { Enumeration enumeration = ClassUtils.getResources("log4j.properties", getClass()); assertNotNull(enumeration); assertTrue(enumeration.hasMoreElements()); enumeration = ClassUtils.getResources("does-not-exist.properties", getClass()); assertNotNull(enumeration); assertTrue(!enumeration.hasMoreElements()); } public void testGetSatisfiableMethods() throws Exception { List methods = ClassUtils.getSatisfiableMethods(FruitBowl.class, new Class[]{Apple.class}, true, true, ignoreMethods); assertNotNull(methods); assertEquals(1, methods.size()); methods = ClassUtils.getSatisfiableMethods(FruitBowl.class, new Class[]{Apple.class}, false, true, ignoreMethods); assertNotNull(methods); assertEquals(0, methods.size()); // Test object param being unacceptible methods = ClassUtils.getSatisfiableMethods(DummyObject.class, new Class[]{WaterMelon.class}, true, false, ignoreMethods); assertNotNull(methods); assertEquals(0, methods.size()); // Test object param being acceptible methods = ClassUtils.getSatisfiableMethods(DummyObject.class, new Class[]{WaterMelon.class}, true, true, ignoreMethods); assertNotNull(methods); assertEquals(2, methods.size()); // Test object param being acceptible but not void methods = ClassUtils.getSatisfiableMethods(DummyObject.class, new Class[]{WaterMelon.class}, false, true, ignoreMethods); assertNotNull(methods); assertEquals(1, methods.size()); assertEquals("doSomethingElse", ((Method)methods.get(0)).getName()); // Test object param being acceptible by interface Type methods = ClassUtils.getSatisfiableMethods(FruitBowl.class, new Class[]{WaterMelon[].class}, true, true, ignoreMethods); assertNotNull(methods); assertEquals(1, methods.size()); assertEquals("setFruit", ((Method)methods.get(0)).getName()); } public void testSimpleName() { simpleNameHelper("String", "foo".getClass()); simpleNameHelper("int[]", (new int[0]).getClass()); simpleNameHelper("Object[][]", (new Object[0][0]).getClass()); simpleNameHelper("null", null); } public void testEqual() { Object a1 = new HashBlob(1); Object a2 = new HashBlob(1); Object b = new HashBlob(2); assertTrue(ClassUtils.equal(a1, a2)); assertTrue(ClassUtils.equal(b, b)); assertTrue(ClassUtils.equal(null, null)); assertFalse(ClassUtils.equal(a1, b)); assertFalse(ClassUtils.equal(a2, b)); assertFalse(ClassUtils.equal(null, b)); assertFalse(ClassUtils.equal(b, a1)); assertFalse(ClassUtils.equal(b, a2)); assertFalse(ClassUtils.equal(b, null)); } public void testHash() { Object a = new HashBlob(1); Object b = new HashBlob(2); assertTrue(ClassUtils.hash(new Object[]{a, b, a, b}) == ClassUtils.hash(new Object[]{a, b, a, b})); assertFalse(ClassUtils.hash(new Object[]{a, b, a}) == ClassUtils.hash(new Object[]{a, b, a, b})); assertFalse(ClassUtils.hash(new Object[]{a, b, a, a}) == ClassUtils.hash(new Object[]{a, b, a, b})); assertFalse(ClassUtils.hash(new Object[]{b, a, b, a}) == ClassUtils.hash(new Object[]{a, b, a, b})); } private void simpleNameHelper(String target, Class clazz) { assertEquals(target, ClassUtils.getSimpleName(clazz)); } private static class DummyObject { public void doSomething(Object object) { // do nothing } public Object doSomethingElse(Object object) { return object; } } private static class HashBlob { private int hash; public HashBlob(int hash) { this.hash = hash; } public int hashCode() { return hash; } public boolean equals(Object other) { if (null == other || !getClass().equals(other.getClass())) return false; return hash == ((HashBlob) other).hash; } } } mule-2.0.1/core/src/test/resources/0000755000175000017500000000000011351411101016774 5ustar charlescharlesmule-2.0.1/core/src/test/resources/serverKeystore0000644000175000017500000000335610577432653022012 0ustar charlescharles muleclient '3X.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'. muleserver ,6N00 +*d;j5V3g2+sDjav}tKmn@GFzS̛-ps냦""AYNZMgGqYS"IW٥ .17e7i??i~?k5ݺZT((`){B|.쵱L6&/rՒpFt$jXesἕVSQ 8,]tKϪ>țbE=K\{_\./S~If#9Ysk BCGEkFw BqTW>uΓ$6ռD.G@{-ɍ\@ҡ `>d gZ6Z?4( 3 .bzX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlOnOO}*Hgmule-2.0.1/core/src/test/resources/log4j.properties0000644000175000017500000000065510745677442022173 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # settings for specific packages #log4j.logger.org.mule=DEBUG # block warnings in ThreadSafeAccessTestCase log4j.logger.org.mule.transport.DefaultMessageAdapter=ERROR mule-2.0.1/core/src/test/resources/clientKeystore0000644000175000017500000000335610577432653021762 0ustar charlescharles muleclient 00 +*(+lAJv;ǸH H#Vpab^ko5t(vaH~3D9V&\b(hMRtF Y}0ɤ^qIT_ZTZ%0qe4kh#_skyXhغQrpcA *k`XgE  ۲i ⎝"&m- zi[I8_"#F>>'Lu@P`!D/4&) fbYFmpքzޭŏX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'. muleserver -X.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlOU_PT}Kmule-2.0.1/core/src/test/resources/trustStore0000644000175000017500000003736210577432653021160 0ustar charlescharlesqӓ=:0  *H 01 0 UUS10U VeriSign, Inc.1<0:U 3Class 1 Public Primary Certification Authority - G21:08U 1(c) 1998 VeriSign, Inc. - For authorized use only10U VeriSign Trust Network0 980518000000Z 280801235959Z01 0 UUS10U VeriSign, Inc.1<0:U 3Class 1 Public Primary Certification Authority - G21:08U 1(c) 1998 VeriSign, Inc. - For authorized use only10U VeriSign Trust Network00  *H 0к-v1ʔVooR6nuV UC!e~!k2?4A5ݪY?SmO*ZĦE]>d$vͫo{Qan4A @s=ku0  *H O g,٨-u~;r~\- km`|Ő# \JЯ]Ƕ  vOÛu[kܬrNOdt{•AesXJKl#P&D#q$GuȦ0  *H +9t^dXJ-73G\`'ER?dh|`3ibTk`BШ;\&#
    ZW%v ,75xdT@Qɿ⊂7U!vhKK%f"VlYmepqv>wLPVH).JYIT,s:i9mpgH-{0  *H ~e~:qFǠ@&> Z7a[i;D S kI>5l\:/`KM _d{\w9YoӵMMBVv_8_u_{厀|Pwww.verisign.com/repository/TestCPS Incorp. By Ref. Liab. LTD.1F0DU =For VeriSign authorized testing only. No assurances (C)VS19970 980204000000Z 030304235959Z010U  VeriSign, Inc1G0EU >www.verisign.com/repository/TestCPS Incorp. By Ref. Liab. LTD.1F0DU =For VeriSign authorized testing only. No assurances (C)VS19970\0  *H K0HAƤ&'8œn@˟6~sNбFm@p(Y4Mێ'C;;rN`oQ0  *H Am$g$]upy;N4 د¯NJg {rGc{HL/وQ9 u?verisign class 1 ca individual subscriber-persona not validated ɮX.509j0f0Ϡ O[uj)0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority0 980512000000Z 080512235959Z010U VeriSign, Inc.10U VeriSign Trust Network1F0DU =www.verisign.com/repository/RPA Incorp. By Ref.,LIAB.LTD(c)981H0FU?VeriSign Class 1 CA Individual Subscriber-Persona Not Validated00  *H 0ZDUz-Ox6 JoTw*h1ApzKHV-BD\B/;' ]6B3nTOJƚj$e~7jJ 00 `HB05U.0,0*(&$http://crl.verisign.com/pca1.1.1.crl0GU @0>0< `HE0-0++www.verisign.com/repository/RPA0U00 U0  *H B|ߌyLMU/P^N.^2ye JRը1!l4x BZъު"!e3 3 >5d$[h|7d Ž33>>s muleclient ɯX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612163615Z 090308163615Z041 0 UUS10U Mule ESB10U localhost00  *H 0ևl*9 ^j}W?=׉gP-~*X\] U 7˟OꞨtڵx?0v<[=#nOاoqh;5jQ0  *H n5bMt rYP/t"6m:[M0Sff*F?Dn#q K@96`?I!o~pdPqxa*ÄM+_ e#'.%2q^P' #˦B7verisign class 1 public primary certification authority ɮkX.509A0=0ͺVT"rU0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority0 960129000000Z 280801235959Z0_1 0 UUS10U VeriSign, Inc.1705U .Class 1 Public Primary Certification Authority00  *H 0mVa-Hqg޹뷞 8%Fs$] en VsߴX9knը?14׏4g NEVixG)6c\-{2{0*/1g0  *H L?hC3]Mz36ؕ"6hl|B.?OvJ͠ )"]݁#{%F0yK@<_SH䆴{5{%ӎ?84qthawte personal basic ca ɮX.509%0!00  *H 01 0 UZA10U Western Cape10U Cape Town10U Thawte Consulting1(0&U Certification Services Division1!0UThawte Personal Basic CA1(0& *H  personal-basic@thawte.com0 960101000000Z 201231235959Z01 0 UZA10U Western Cape10U Cape Town10U Thawte Consulting1(0&U Certification Services Division1!0UThawte Personal Basic CA1(0& *H  personal-basic@thawte.com00  *H 0SmPOH5ZoBGwurݍIWx?Qi v"jQK7 M458WJpYC}O= bzu݈NN@ۨ2to D يo)(;@(Z<յ ʤQL,YڹuB#.pG*verisign international server ca - class 3 ɮ6X.50900%K8BXݮ"n0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 3 Public Primary Certification Authority0 970417000000Z 111024235959Z010U VeriSign Trust Network10U VeriSign, Inc.1301U *VeriSign International Server CA - Class 31I0GU @www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign00  *H 0؂}9%e+Ӽ6;Ll[( ;MN9\IZӲp0B+QZ<:"OSO4{o00U00DU =0;09 `HE0*0(+https://www.verisign.com/CPS04U%-0+++ `HB `HE0 U0 `HB01U*0(0&$" http://crl.verisign.com/pca3.crl0  *H hBs#:T#>j:36 o)+rDѬ -8=܆aN&_^ $p&C=I.R_>f)N,Fus~ gTR muleserver ɯFX.50900HD0  *H 041 0 UUS10U Mule ESB10U localhost0 060612165625Z 090308165625Z041 0 UUS10U Mule ESB10U localhost00  *H 0օ&w<˸<?w2+b!Re< פ2AvI&,Xl b6}2@ No+Lmcȡܹ Ji:Ky'j1?0  *H G=˾_ռDeYRngXX͛+zH6AoF(ת}*R@"sz~Ecm+FښYI& u~j ECع]u!UlO?verisign class 3 ca individual subscriber-persona not validated ɮ'X.5095010#l+ t`0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 3 Public Primary Certification Authority0 970417000000Z 040107235959Z010U VeriSign Trust Network10U VeriSign, Inc.1301U *VeriSign International Server CA - Class 31I0GU @www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97 VeriSign00  *H 0؂}9%e+Ӽ6;Ll[( ;MN9\IZӲp0B+QZ<:"OSO4{o00U00 U0 `HB0 U%0 `HE `HB05U ,0(0$ `HE00(+https://www.verisign.com/CPS0+00VeriSign, Inc.0VeriSign's Certification Practice Statement, www.verisign.com/CPS, governs this certificate & is incorporated by reference herein. SOME WARRANTIES DISCLAIMED & LIABILITY LTD. (c)1997 VeriSign0  *H +Hrh tcXE"N3bZ!$lBE:gHk7K}xU1fF}x`UlUibp|MC (ьFP1f$J[Kf^eU_7?verisign class 2 ca individual subscriber-persona not validated ɮX.509V0R0R |΂Es0  *H 0_1 0 UUS10U VeriSign, Inc.1705U .Class 2 Public Primary Certification Authority0 980512000000Z 040106235959Z010U VeriSign, Inc.10U VeriSign Trust Network1F0DU =www.verisign.com/repository/RPA Incorp. By Ref.,LIAB.LTD(c)981402U+VeriSign Class 2 CA - Individual Subscriber00  *H 0T^%,Y_ kJK >~/e_c, k^Ih%$_#iM;}ڏ ϥX:Kخu""(`0!p^H!T_8)SzSX ]PK9Ti00 `HB05U.0,0*(&$http://crl.verisign.com/pca2.1.1.crl0GU @0>0< `HE0-0++www.verisign.com/repository/RPA0U00 U0  *H  cQ"U_8$^;ID7RuĊRXٮdV/4H׏bƅel@~h!4Z_p LܠA(/ F @LC@1Tmule-2.0.1/core/src/test/resources/open-security.policy0000644000175000017500000000473610577411741023060 0ustar charlescharles // Standard extensions get all permissions by default grant codeBase "file:/*" { permission java.security.AllPermission; }; // default permissions granted to all domains grant { // Allows any thread to stop itself using the java.lang.Thread.stop() // method that takes no argument. // Note that this permission is granted by default only to remain // backwards compatible. // It is strongly recommended that you either remove this permission // from this policy file or further restrict it to code sources // that you specify, because Thread.stop() is potentially unsafe. // See "http://java.sun.com/notes" for more information. permission java.lang.RuntimePermission "stopThread"; // allows anyone to listen on un-privileged ports permission java.net.SocketPermission "localhost:1024-", "listen"; // "standard" properies that can be read by anyone permission java.util.PropertyPermission "java.version", "read"; permission java.util.PropertyPermission "java.vendor", "read"; permission java.util.PropertyPermission "java.vendor.url", "read"; permission java.util.PropertyPermission "java.class.version", "read"; permission java.util.PropertyPermission "os.name", "read"; permission java.util.PropertyPermission "os.version", "read"; permission java.util.PropertyPermission "os.arch", "read"; permission java.util.PropertyPermission "file.separator", "read"; permission java.util.PropertyPermission "path.separator", "read"; permission java.util.PropertyPermission "line.separator", "read"; permission java.util.PropertyPermission "java.specification.version", "read"; permission java.util.PropertyPermission "java.specification.vendor", "read"; permission java.util.PropertyPermission "java.specification.name", "read"; permission java.util.PropertyPermission "java.vm.specification.version", "read"; permission java.util.PropertyPermission "java.vm.specification.vendor", "read"; permission java.util.PropertyPermission "java.vm.specification.name", "read"; permission java.util.PropertyPermission "java.vm.version", "read"; permission java.util.PropertyPermission "java.vm.vendor", "read"; permission java.util.PropertyPermission "java.vm.name", "read"; }; mule-2.0.1/core/src/test/resources/mule-test-exclusions.txt0000644000175000017500000000103011003725410023645 0ustar charlescharles# # Test cases listed in this file are not run. # # only works with network connection #org.mule.util.TimedSocketTestCase # MULE-2164 org.mule.endpoint.MuleCopiedEndpointURITestCase # Duplicate registration doesn't currently produce an exception, should it? # See comment in TransientRegistry.doRegisterObject() # Blocked by MULE-2162 since the MuleConfiguration is being registered more than once. org.mule.registry.DuplicateRegistrationTestCase # MULE-2964: MuleMessage does not serialize attachments org.mule.MuleMessageTestCase mule-2.0.1/core/src/test/resources/test-spi.properties0000644000175000017500000000011010577411741022675 0ustar charlescharlesorg.mule.tck.testmodels.fruit.Fruit=org.mule.tck.testmodels.fruit.Bananamule-2.0.1/core/pom.xml0000644000175000017500000001742311006063605014551 0ustar charlescharles 4.0.0 org.mule mule 2.0.1 mule-core Mule Core Mule server and core classes org.apache.maven.plugins maven-jar-plugin test-jar javax.activation activation provided org.apache.geronimo.specs geronimo-j2ee-connector_1.5_spec org.apache.geronimo.specs geronimo-jta_1.0.1B_spec org.safehaus.jug jug 2.0.0 asl log4j log4j backport-util-concurrent backport-util-concurrent 3.1 commons-beanutils commons-beanutils 1.7.0 commons-logging commons-logging commons-cli commons-cli 1.0 commons-logging commons-logging commons-collections commons-collections 3.2 commons-discovery commons-discovery 0.2 commons-logging commons-logging commons-io commons-io 1.3.1 commons-lang commons-lang 2.3 org.slf4j jcl104-over-slf4j 1.4.3 org.slf4j slf4j-api 1.4.3 org.slf4j slf4j-log4j12 1.4.3 commons-pool commons-pool 1.4 junit junit mockobjects mockobjects-core 0.09 osgi org.apache.felix maven-bundle-plugin org.mule, org.mule.components.*, org.mule.config.*, org.mule.impl, org.mule.endpoint, org.mule.container, org.mule.work, org.mule.jndi, org.mule.message, org.mule.model.*, org.mule.security.*, org.mule.internal.*, org.mule.interceptors, org.mule.management.stats.*, org.mule.model, org.mule.persistence.*, org.mule.transport.*, org.mule.registry.*, org.mule.registry.metadata, org.mule.routing.*, org.mule.transaction.*, org.mule.transformer.*, org.mule.api.*, org.mule.util.* org.mule.*, org.apache.commons.cli.*, org.safehaus.uuid.* mule-2.0.1/tools/0000755000175000017500000000000011351410675013443 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/0000755000175000017500000000000011351410665020032 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/0000755000175000017500000000000011351410664020620 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/0000755000175000017500000000000011351410664021544 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/java/0000755000175000017500000000000011351410664022465 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/java/org/0000755000175000017500000000000011351410664023254 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/java/org/mule/0000755000175000017500000000000011351410664024216 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/java/org/mule/tools/0000755000175000017500000000000011351410664025356 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/java/org/mule/tools/maven/0000755000175000017500000000000011351410664026464 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/java/org/mule/tools/maven/archetype/0000755000175000017500000000000011351410664030450 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/java/org/mule/tools/maven/archetype/ProjectArchetypeMojo.javamule-2.0.1/tools/mule-project-archetype/src/main/java/org/mule/tools/maven/archetype/ProjectArchetyp0000644000175000017500000001142310716605644033512 0ustar charlescharlespackage org.mule.tools.maven.archetype; /* * Copyright 2001-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.maven.archetype.Archetype; import org.apache.maven.archetype.ArchetypeDescriptorException; import org.apache.maven.archetype.ArchetypeNotFoundException; import org.apache.maven.archetype.ArchetypeTemplateProcessingException; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; /** * Builds archetype containers. * * @goal create * @description The archetype creation goal looks for an archetype with a given newGroupId, newArtifactId, and * newVersion and retrieves it from the remote repository. Once the archetype is retrieve it is process against * a set of user parameters to create a working Maven project. This is a modified newVersion for bobber to support additional functionality. * @requiresProject false */ public class ProjectArchetypeMojo extends AbstractMojo { /** * @parameter expression="${component.org.apache.maven.archetype.Archetype}" * @required */ private Archetype archetype; /** * @parameter expression="${localRepository}" * @required */ private ArtifactRepository localRepository; /** * @parameter expression="${archetypeGroupId}" default-value="org.mule.tools" * @required */ private String archetypeGroupId; /** * @parameter expression="${archetypeArtifactId}" default-value="mule-project-archetype" * @required */ private String archetypeArtifactId; /** * @parameter expression="${archetypeVersion}" default-value="${muleVersion}" * @required */ private String archetypeVersion; /** * @parameter expression="${muleVersion}" default-value="2.0.0-RC1-SNAPSHOT" * @required */ private String muleVersion; /** * @parameter expression="${groupId}" alias="newGroupId" default-value="default" * @require */ private String groupId; /** * @parameter expression="${artifactId}" alias="newArtifactId" default-value="default" * @require */ private String artifactId; /** * @parameter expression="${version}" alias="newVersion" default-value="1.0-SNAPSHOT" * @require */ private String version; /** @parameter expression="${packageName}" alias="package" */ private String packageName; /** * @parameter expression="${project.remoteArtifactRepositories}" * @required */ private List remoteRepositories; public void execute() throws MojoExecutionException { // ---------------------------------------------------------------------- // archetypeGroupId // archetypeArtifactId // archetypeVersion // // localRepository // remoteRepository // parameters // ---------------------------------------------------------------------- String basedir = System.getProperty("user.dir"); if (packageName == null) { getLog().info("Defaulting package to group ID: " + groupId); packageName = groupId; } // TODO: context mojo more appropriate? Map map = new HashMap(); map.put("basedir", basedir); map.put("package", packageName); map.put("packageName", packageName); map.put("groupId", groupId); map.put("artifactId", artifactId); map.put("version", version); map.put("muleVersion", muleVersion); try { archetype.createArchetype(archetypeGroupId, archetypeArtifactId, archetypeVersion, localRepository, remoteRepositories, map); } catch (ArchetypeNotFoundException e) { throw new MojoExecutionException("Error creating from archetype", e); } catch (ArchetypeDescriptorException e) { throw new MojoExecutionException("Error creating from archetype", e); } catch (ArchetypeTemplateProcessingException e) { throw new MojoExecutionException("Error creating from archetype", e); } } } mule-2.0.1/tools/mule-project-archetype/src/main/resources/0000755000175000017500000000000011351410664023556 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/resources/META-INF/0000755000175000017500000000000011351410664024716 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/resources/META-INF/archetype.xml0000644000175000017500000001240610764576756027455 0ustar charlescharles maven-archetype-mule-project description Provide a description of what the project does: muleVersion Which version of Mule is this module targeted at? ${muleVersion} package What is the base Java package path for this module? (i.e. org/mule/modules or org/mule/examples): org/mule/applications forgeProject Will This project be hosted on MuleForge? [y] or [n] y projectType What type of project is this? - [s]tand alone project - [m]ule module to be hosted on the MuleForge on in the Mule distribution s hasCustomSchema Will This project have a custom schema for configuring the module in Xml? n hasBootstrap Will This project need to make objects available in the Registry as soon as it's loaded? n mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/0000755000175000017500000000000011351410664027552 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/pom.vm0000644000175000017500000002330110764576756030736 0ustar charlescharles #set($ModuleName = "$artifactId") #set($ModuleName = "${ModuleName.substring(0,1).toUpperCase()}${ModuleName.substring(1).toLowerCase()}") #set($ModuleNameLower = "${ModuleName.toLowerCase()}") #set($MuleVersion = "$muleVersion") #set($id = "") #set($groupId = "$package.replaceAll('/', '.')") #if($projectType == "m") #set($artifactId = "mule-module-${ModuleNameLower}") #set($ModuleType = "Module") #else #set($artifactId = "${ModuleNameLower}") #set($ModuleType = "Application") #end #set($MuleMajorMinorVersion = "$MuleVersion.substring(0, 3)") 4.0.0 #if($projectType == "m") org.mule.modules mule-modules ${MuleVersion} #end ${groupId} ${artifactId} jar Mule ${ModuleName} ${ModuleType} ${version} ${description} ${MuleVersion} #if($forgeProject == "y") Jira http://mule.mulesource.org/jira/browse/${ModuleName.toUpperCase()} scm:svn:http://svn.muleforge.org/${artifactId}/ scm:svn:https://svn.muleforge.org/${artifactId}/ HEAD http://svn.${artifactId}.muleforge.org/ Bamboo http://bamboo.muleforge.org/browse/${ModuleName.toUpperCase()}-FORGE muleforge.webdav.releases dav:https://dav.muleforge.org/repository/${artifactId}/ muleforge.webdav.snapshots dav:https://dav.muleforge.org/snapshots.repository/${artifactId}/ muleforge.webdav.sites dav:https://dav.muleforge.org/${artifactId}/ ch-dep Codehaus Dependencies http://dist.codehaus.org/mule/dependencies/maven2 default ${thransportId}-deps ${MUleTransport} Dependencies http://dist.muleforge.org/${artefactId}/dependencies/maven2 false #end maven-assembly-plugin ${artifactId}-${version} assembly.xml false org.apache.maven.plugins maven-surefire-report-plugin #if($forgeProject == "y") org.apache.maven.plugins maven-checkstyle-plugin http://mulesource.org/download/attachments/92/checkstyle.xml?version=1 #end org.apache.maven.plugins maven-pmd-plugin 1.5 org.codehaus.mojo cobertura-maven-plugin org.codehaus.mojo taglist-maven-plugin TODO @todo FIXME @fixme @deprecated org.apache.maven.plugins maven-jxr-plugin org.apache.maven.plugins maven-javadoc-plugin http://java.sun.com/j2ee/1.4/docs/api http://java.sun.com/j2se/1.4.2/docs/api http://java.sun.com/j2se/1.5.0/docs/api org.codehaus.mojo jdepend-maven-plugin org.codehaus.mojo findbugs-maven-plugin org.mule mule-core ${mule.version} org.mule.modules mule-module-client ${mule.version} org.mule.modules mule-module-spring-config ${mule.version} org.mule.modules mule-module-scripting ${mule.version} org.mule.modules mule-module-xml ${mule.version} org.mule.modules mule-module-management ${mule.version} org.mule.transports mule-transport-vm ${mule.version} org.mule.transports mule-transport-jms ${mule.version} org.mule.transports mule-transport-cxf ${mule.version} org.mule.transports mule-transport-file ${mule.version} org.mule.transports mule-transport-http ${mule.version} org.mule.transports mule-transport-jdbc ${mule.version} org.mule.transports mule-transport-tcp ${mule.version} org.mule.tests mule-tests-functional ${mule.version} test org.mule.transports mule-transport-stdio ${mule.version} test junit junit 3.8.1 test mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/0000755000175000017500000000000011351410664030341 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/0000755000175000017500000000000011351410664031265 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/0000755000175000017500000000000011351410664032206 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/0000755000175000017500000000000011351410664032775 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mul0000755000175000017500000000000011351410664033513 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/modules/mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mul0000755000175000017500000000000011351410664033513 5ustar charlescharles././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/modules/config/mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mul0000755000175000017500000000000011351410664033513 5ustar charlescharles././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/modules/config/NamespaceHandler.vmmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mul0000644000175000017500000000211510764576756033542 0ustar charlescharles/* * Generated by the Mule project wizard. http://mule.mulesource.org * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package ${groupId}.${ModuleNameLower}.config; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; /** * Registers a Bean Definition Parser for handling elements defned in META-INF/mule-${ModuleNameLower}.xsd * */ public class ${ModuleName}NamespaceHandler extends NamespaceHandlerSupport { public void init() { //TODO you need to register a definition parser for each element defined in META-INF/mule-${ModuleNameLower}.xsd //Mule provides many parsrs out of the box which are suitable for most configuration parsing. see //http://muledocs.org/Xml+Configuration for more information. //for example: // registerBeanDefinitionParser("foo", new OrphanDefinitionParser(${ModuleName}Foo.class, true)); } }././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/modules/package.vmmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mul0000644000175000017500000000015510754365306033526 0ustar charlescharles Mule - ${ModuleName} Module

    ${description}

    ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/modules/Messages.vmmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/java/org/mul0000644000175000017500000000120210764576756033536 0ustar charlescharles/* * Generated by the Mule project wizard. http://mule.mulesource.org * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package ${groupId}.${ModuleNameLower}.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class ${ModuleName}Messages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("${ModuleNameLower}"); /* public static Message exampleMessage() { return createMessage(BUNDLE_PATH, 1); } */ } mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/0000755000175000017500000000000011351410664033277 5ustar charlescharles././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/ME0000755000175000017500000000000011351410664033521 5ustar charlescharles././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas.vmmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/ME0000644000175000017500000000022310754365306033530 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/${ModuleNameLower}/${MuleMajorMinorVersion}/mule-${ModuleNameLower}.xsd=META-INF/mule-${ModuleNameLower}.xsd././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/schema.vmmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/ME0000644000175000017500000000543210754365306033537 0ustar charlescharles ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/ME0000755000175000017500000000000011351410664033521 5ustar charlescharles././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/ME0000755000175000017500000000000011351410664033521 5ustar charlescharles././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule/mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/ME0000755000175000017500000000000011351410664033521 5ustar charlescharles././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule/i18n/mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/ME0000755000175000017500000000000011351410664033521 5ustar charlescharles././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule/i18n/messages.vmmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/ME0000644000175000017500000000122510754365306033533 0ustar charlescharles#Add any string messages here that are specific to your transport #Messages put here can be translated into other languages #Each message should be given a unique numerical id i.e. # #1=This is a test message with a single argument {0} # #Arguments can be placed in the message using {0}, {1}, etc placeholders # #To get a message listed here use the following - # new Message("${ModuleName}", "" [, , ]); # # "${ModuleName}" is the protocol of this transport # is the id of the message in this file # is a list of String arguments to pass to the message # # For more info see http://mule.mulesource.org/wiki/x/zQU././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule/config/mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/ME0000755000175000017500000000000011351410664033521 5ustar charlescharles././@LongLink0000000000000000000000000000024200000000000011563 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule/config/registry-bootstrap.propertiesmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/ME0000644000175000017500000000351710745677442033550 0ustar charlescharles# This file allows modules and transports to make certain objects available by default in the Registry. The most # common use case is for a module or transport to load stateless transformers into the registry. # For this file to be located it must be present in the modules META-INF directory under # META-INF/services/org/mule/config/ # # The format of this file is a simple key / value pair. i.e. # # myobject=org.foo.MyObject # # # Will register an instance of MyObject with a key of 'myobject'. If you don't care about the object name and want to # ensure that the ojbect gets a unique name you can use - # # # object.1=org.foo.MyObject # object.2=org.bar.MyObject # # # or # # # myFoo=org.foo.MyObject # myBar=org.bar.MyObject # # # # Loading transformers has a slightly different notation since you can define the 'returnClass' and 'name'of # the transformer as parameters i.e. # # # transformer.1=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=byte[] # transformer.2=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=java.lang.String, name=JMSMessageToString # transformer.3=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=java.util.Hashtable) # # # Note that the key used for transformers must be 'transformer.x' where 'x' is a sequential number. The transformer name will be # automatically generated as JMSMessageToXXX where XXX is the return class name i.e. JMSMessageToString unless a 'name' # parameter is specified. If no 'returnClass' is specified the defualt in the transformer will be used. # # Note that all objects defined have to have a default constructor. They can implement injection interfaces such as # {@link org.mule.MuleContextAware} and lifecylce interfaces such as {@link org.mule.api.lifecycle.Initialisable}.././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers.vmmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/main/resources/ME0000644000175000017500000000022610754365306033533 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/${ModuleNameLower}/${MuleMajorMinorVersion}=${groupId}.${ModuleNameLower}.config.${ModuleName}NamespaceHandler mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/0000755000175000017500000000000011351410664031320 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/java/0000755000175000017500000000000011351410664032241 5ustar charlescharlesmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/java/org/0000755000175000017500000000000011351410664033030 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/java/org/mul0000755000175000017500000000000011351410664033546 5ustar charlescharles././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/modules/mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/java/org/mul0000755000175000017500000000000011351410664033546 5ustar charlescharles././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/modules/NamespaceHandlerTestCase.vmmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/java/org/mul0000644000175000017500000000147310764576756033603 0ustar charlescharles/* * Generated by the Mule project wizard. http://mule.mulesource.org * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package ${groupId}.${ModuleNameLower}; import org.mule.tck.FunctionalTestCase; /** * TODO */ public class ${ModuleName}NamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { //TODO You'll need to edit this file to configure the properties specific to your module elements return "${ModuleNameLower}-namespace-config.xml"; } public void test${ModuleName}Config() throws Exception { //TODO Assert specific properties are configured correctly fail("Not implemented yet"); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/modules/FunctionalTestCase.vmmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/java/org/mul0000644000175000017500000000223510764576756033600 0ustar charlescharles/* * Generated by the Mule project wizard. http://mule.mulesource.org * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package ${groupId}.${ModuleNameLower}; import org.mule.api.MuleMessage; import org.mule.module.client.MuleClient; import org.mule.tck.FunctionalTestCase; import org.mule.transport.NullPayload; public class ${ModuleName}TestCase extends FunctionalTestCase { protected String getConfigResources() { //TODO You'll need to edit this file to make the test applicable to your module return "${ModuleNameLower}-functional-test-config.xml"; } public void test${ModuleName}() throws Exception { MuleClient client = new MuleClient(); MuleMessage result = client.send("vm://in", "some data", null); assertNotNull(result); assertNull(result.getExceptionPayload()); assertFalse(result.getPayload() instanceof NullPayload); //TODO Assert the correct data has been received assertEquals("some data Received", result.getPayloadAsString()); } } mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/resources/0000755000175000017500000000000011351410664033332 5ustar charlescharles././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/resources/namespace-config.xml.vmmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/resources/na0000644000175000017500000000162610754365306033670 0ustar charlescharles ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/resources/functional-test-config.xml.vmmule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/src/test/resources/fu0000644000175000017500000000357710764576756033731 0ustar charlescharles mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/assembly.xml.vm0000644000175000017500000000221110754365306032540 0ustar charlescharles ${ModuleName} zip tar.gz src pom.xml src/** target . *.jar target/site site examples/target examples *.jar lib/user ${artifactId}.${extension} test org.mule.tests:mule-tests-functional mule-2.0.1/tools/mule-project-archetype/src/main/resources/archetype-resources/LICENSE.vm0000644000175000017500000006612310766463006031217 0ustar charlescharlesCommon Public Attribution License Version 1.0 (CPAL) 1. "Definitions" 1.0.1 "Commercial Use" means distribution or otherwise making the Covered Code available to a third party. 1.1 "Contributor" means each entity that creates or contributes to the creation of Modifications. 1.2 "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. 1.3 "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. 1.4 "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data. 1.5 "Executable" means Covered Code in any form other than Source Code. 1.6 "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. 1.7 "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. 1.8 "License" means this document. 1.8.1 "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 1.9 "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is: A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. B. Any new file that contains any part of the Original Code or previous Modifications. 1.10 "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. 1.10.1 "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. 1.11 "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. 1.12 "You" (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. Source Code License. 2.1 The Initial Developer Grant. The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and (b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof). (c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License. (d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices. 2.2 Contributor Grant. Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). (c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code. (d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor. 3. Distribution Obligations. 3.1 Application of License. The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. 3.2 Availability of Source Code. Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. 3.3 Description of Modifications. You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. 3.4 Intellectual Property Matters (a) Third Party Claims. If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. (b) Contributor APIs. If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file. (c) Representations. Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License. 3.5 Required Notices. You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 3.6 Distribution of Executable Versions. You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer, Original Developer or any Contributor. You hereby agree to indemnify the Initial Developer, Original Developer and every Contributor for any liability incurred by the Initial Developer, Original Developer or such Contributor as a result of any such terms You offer. 3.7 Larger Works. You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. 4. Inability to Comply Due to Statute or Regulation. If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Application of this License. This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code. 6. Versions of the License. 6.1 New Versions. MuleSource, Inc. ("MuleSource") may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. 6.2 Effect of New Versions. Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Socialtext. No one other than MuleSource has the right to modify the terms applicable to Covered Code created under this License. 6.3 Derivative Works. If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases "MuleSource", "CPAL" or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the CPAL. (Filling in the name of the Initial Developer, Original Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.) 7. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER, ORIGINAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 8. TERMINATION. 8.1 This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 8.2 If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer, Original Developer or a Contributor (the Initial Developer, Original Developer or Contributor against whom You file such action is referred to as "Participant") alleging that: (a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above. (b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant. 8.3 If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license. 8.4 In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination. 9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ORIGINAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 10. U.S. GOVERNMENT END USERS. The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. 11. MISCELLANEOUS. This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. 12. RESPONSIBILITY FOR CLAIMS. As between Initial Developer, Original Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer, Original Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. 13. MULTIPLE-LICENSED CODE. Initial Developer may designate portions of the Covered Code as Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the CPAL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A. 14. ADDITIONAL TERM: ATTRIBUTION (a) As a modest attribution to the organizer of the development of the Original Code ("Original Developer"), in the hope that its promotional value may help justify the time, money and effort invested in writing the Original Code, the Original Developer may include in Exhibit B ("Attribution Information") a requirement that each time an Executable and Source Code or a Larger Work is launched or initially run (which includes initiating a session), a prominent display of the Original Developer's Attribution Information (as defined below) must occur on the graphic user interface employed by the end user to access such Covered Code (which may include display on a splash screen), if any. The size of the graphic image should be consistent with the size of the other elements of the Attribution Information. If the access by the end user to the Executable and Source Code does not create a graphic user interface for access to the Covered Code, this obligation shall not apply. If the Original Code displays such Attribution Information in a particular form (such as in the form of a splash screen, notice at login, an "about" display, or dedicated attribution area on user interface screens), continued use of such form for that Attribution Information is one way of meeting this requirement for notice. (b) Attribution information may only include a copyright notice, a brief phrase, graphic image and a URL ("Attribution Information") and is subject to the Attribution Limits as defined below. For these purposes, prominent shall mean display for sufficient duration to give reasonable notice to the user of the identity of the Original Developer and that if You include Attribution Information or similar information for other parties, You must ensure that the Attribution Information for the Original Developer shall be no less prominent than such Attribution Information or similar information for the other party. For greater certainty, the Original Developer may choose to specify in Exhibit B below that the above attribution requirement only applies to an Executable and Source Code resulting from the Original Code or any Modification, but not a Larger Work. The intent is to provide for reasonably modest attribution, therefore the Original Developer cannot require that You display, at any time, more than the following information as Attribution Information: (a) a copyright notice including the name of the Original Developer; (b) a word or one phrase (not exceeding 10 words); (c) one graphic image provided by the Original Developer; and (d) a URL (collectively, the "Attribution Limits"). (c) If Exhibit B does not include any Attribution Information, then there are no requirements for You to display any Attribution Information of the Original Developer. (d) You acknowledge that all trademarks, service marks and/or trade names contained within the Attribution Information distributed with the Covered Code are the exclusive property of their owners and may only be used with the permission of their owners, or under circumstances otherwise permitted by law or as expressly set out in this License. 15. ADDITIONAL TERM: NETWORK USE. The term "External Deployment" means the use, distribution, or communication of the Original Code or Modifications in any way such that the Original Code or Modifications may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Code or Modifications as a distribution under section 3.1 and make Source Code available under Section 3.2. EXHIBIT A. Common Public Attribution License Version 1.0. "The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mulesource.com/CPAL/. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is MuleSource Mule The Initial Developer of the Original Code is MuleSource Inc. All portions of the code are Copyright (c) 2003-2007 MuleSource Inc. All Rights Reserved. EXHIBIT B. Attribution Information Subject to the limitations and other requirements in Section 14 of the License, the Original Developer requires You to display the following Attribution Information: Attribution Copyright Notice: Copyright (c) 2003-2008 MuleSource Inc. Attribution Phrase (not exceeding 10 words): Powered by Mule. MuleSource is Open for Integration. Attribution URL: http://www.mulesource.com Graphic Image provided in the Covered Code as file: http://www.mulesource.com/images/mulesource_license_logo.gif Redistributions of the Covered Code in binary form or source code form, must ensure that the first time the resulting executable program is launched, a user interface, if any, shall include the attribution information set forth below prominently. If the executable program does not launch a user interface, the Company name and URL shall be included in the notice section of each file of the Covered Code. : Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL. mule-2.0.1/tools/mule-project-archetype/pom.xml0000644000175000017500000000363611006063605021352 0ustar charlescharles 4.0.0 org.mule.tools mule-tools 2.0.1 maven-plugin Mule Project Archetype mule-project-archetype 2.0.1 An architype for creating Mule projects. This can handle the subtle configuration differences between a stand-alone prject, a Mule module being hosted on MuleForge and a Mule example. org.mule mule-core ${version} org.mule.tools bobberplus ${version} org.apache.maven maven-embedder 2.0.4 test org.apache.maven maven-core 2.0.7 test mule-2.0.1/tools/mule-transport-archetype/0000755000175000017500000000000011351410700020406 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/0000755000175000017500000000000011351410675021210 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/0000755000175000017500000000000011351410675022134 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/java/0000755000175000017500000000000011351410675023055 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/java/org/0000755000175000017500000000000011351410675023644 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/java/org/mule/0000755000175000017500000000000011351410675024606 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/java/org/mule/tools/0000755000175000017500000000000011351410675025746 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/java/org/mule/tools/maven/0000755000175000017500000000000011351410675027054 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/java/org/mule/tools/maven/archetype/0000755000175000017500000000000011351410675031040 5ustar charlescharles././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/java/org/mule/tools/maven/archetype/TransportArchetypeMojo.javamule-2.0.1/tools/mule-transport-archetype/src/main/java/org/mule/tools/maven/archetype/TransportArch0000644000175000017500000001170010745677442033571 0ustar charlescharlespackage org.mule.tools.maven.archetype; /* * Copyright 2001-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.maven.archetype.Archetype; import org.apache.maven.archetype.ArchetypeDescriptorException; import org.apache.maven.archetype.ArchetypeNotFoundException; import org.apache.maven.archetype.ArchetypeTemplateProcessingException; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; /** * Builds archetype containers. * * @goal create * @description The archetype creation goal looks for an archetype with a given newGroupId, newArtifactId, and * newVersion and retrieves it from the remote repository. Once the archetype is retrieve it is process against * a set of user parameters to create a working Maven project. This is a modified newVersion for bobber to support additional functionality. * @requiresProject false */ public class TransportArchetypeMojo extends AbstractMojo { /** * @parameter expression="${component.org.apache.maven.archetype.Archetype}" * @required */ private Archetype archetype; /** * @parameter expression="${localRepository}" * @required */ private ArtifactRepository localRepository; /** * @parameter expression="${archetypeGroupId}" default-value="org.mule.tools" * @required */ private String archetypeGroupId; /** * @parameter expression="${archetypeArtifactId}" default-value="mule-transport-archetype" * @required */ private String archetypeArtifactId; /** * @parameter expression="${archetypeVersion}" default-value="${muleVersion}" * @required */ private String archetypeVersion; /** * @parameter expression="${muleVersion}" * @required */ private String muleVersion; /** * @parameter expression="${transportId}" * @required */ private String transportId; /** * @parameter expression="${groupId}" alias="newGroupId" default-value="org.mule.transport.${transportId} * @require */ private String groupId; /** * @parameter expression="${artifactId}" alias="newArtifactId" default-value="mule-transport-${transportId}" * @require */ private String artifactId; /** * @parameter expression="${version}" alias="newVersion" default-value="1.0-SNAPSHOT" * @require */ private String version; /** @parameter expression="${packageName}" alias="package" */ private String packageName; /** * @parameter expression="${project.remoteArtifactRepositories}" * @required */ private List remoteRepositories; public void execute() throws MojoExecutionException { // ---------------------------------------------------------------------- // archetypeGroupId // archetypeArtifactId // archetypeVersion // // localRepository // remoteRepository // parameters // ---------------------------------------------------------------------- String basedir = System.getProperty("user.dir"); if (packageName == null) { getLog().info("Defaulting package to group ID: " + groupId); packageName = groupId; } // TODO: context mojo more appropriate? Map map = new HashMap(); map.put("basedir", basedir); map.put("package", packageName); map.put("packageName", packageName); map.put("groupId", groupId); map.put("artifactId", artifactId); map.put("version", version); map.put("muleVersion", muleVersion); map.put("transportId", transportId); try { archetype.createArchetype(archetypeGroupId, archetypeArtifactId, archetypeVersion, localRepository, remoteRepositories, map); } catch (ArchetypeNotFoundException e) { throw new MojoExecutionException("Error creating from archetype", e); } catch (ArchetypeDescriptorException e) { throw new MojoExecutionException("Error creating from archetype", e); } catch (ArchetypeTemplateProcessingException e) { throw new MojoExecutionException("Error creating from archetype", e); } } } mule-2.0.1/tools/mule-transport-archetype/src/main/resources/0000755000175000017500000000000011351410675024146 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/resources/META-INF/0000755000175000017500000000000011351410675025306 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/resources/META-INF/archetype.xml0000644000175000017500000002741110745677442030036 0ustar charlescharles maven-archetype-mule-transport description Provide a description of what the transport does: muleVersion Which version of Mule is this transport targeted at? ${muleVersion} forgeProject Will This project be hosted on MuleForge? [y] or [n] y hasCustomSchema Will This transport have a custom schema for configuring the transport in Xml? y hasReceiver Can the transport receive inbound requests? [y] or [n] y isPollingReceiver Does the Message Receiver need to poll the underlying resource? [y] or [n] n inboundTransformer If this transport will have a default inbound transformer, enter the name of the transformer? (i.e. JmsMessageToObject) n hasDispatcher Can the transport dispatch outbound requests? y outboundTransformer If this transport will have a default outbound transformer, enter the name of the transformer? (i.e. ObjectToJmsMessage) n hasTransactions Does this transport support transactions? [y] or [n] n hasCustomTransactions Does this transport use a non-JTA Transaction manager? [y] or [n] (i.e. needs to wrap proprietary transaction management) n endpointBuilder What type of Endpoints does this transport use? - [r]esource endpoints (i.e. jms://my.queue) - [u]rl endpoints (i.e. http://localhost:1234/context/foo?param=1) - [s]ocket endpoints (i.e. tcp://localhost:1234) - [c]ustom - parse your own r mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/0000755000175000017500000000000011351410700030127 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/pom.vm0000644000175000017500000001542710754365306031320 0ustar charlescharles #set($TransportName = "$transportId") #set($TransportName = "${TransportName.substring(0,1).toUpperCase()}${TransportName.substring(1).toLowerCase()}") #set($TransportNameLower = "${TransportName.toLowerCase()}") #set($MuleVersion = "$muleVersion") #set($id = "") #if(!$groupId) #set($groupId = "org.mule.transports") #end #if(!$artifactId) #set($artifactId = "mule-transport-${TransportNameLower}") #end #set($MuleMajorMinorVersion = "$MuleVersion.substring(0, 3)") 4.0.0 ${groupId} ${artifactId} jar Mule ${TransportName} Transport ${version} ${description} ${MuleVersion} #if($forgeProject == "y") Jira http://mule.mulesource.org/jira/browse/${TransportName.toUpperCase()} scm:svn:http://svn.muleforge.org/${artifactId}/ scm:svn:https://svn.muleforge.org/${artifactId}/ HEAD http://svn.${artifactId}.muleforge.org/ Bamboo http://bamboo.muleforge.org/browse/${TransportName.toUpperCase()}-FORGE muleforge.webdav.releases dav:https://dav.muleforge.org/repository/${artifactId}/ muleforge.webdav.snapshots dav:https://dav.muleforge.org/snapshots.repository/${artifactId}/ muleforge.webdav.sites dav:https://dav.muleforge.org/${artifactId}/ ch-dep Codehaus Dependencies http://dist.codehaus.org/mule/dependencies/maven2 default ${thransportId}-deps ${TransportName} Dependencies http://dist.muleforge.org/${artefactId}/dependencies/maven2 false #end maven-assembly-plugin ${artifactId}-${version} assembly.xml false org.apache.maven.plugins maven-surefire-report-plugin #if($forgeProject == "y") org.apache.maven.plugins maven-checkstyle-plugin http://mulesource.org/download/attachments/92/checkstyle.xml?version=1 #end org.apache.maven.plugins maven-pmd-plugin 1.5 org.codehaus.mojo cobertura-maven-plugin org.codehaus.mojo taglist-maven-plugin TODO @todo FIXME @fixme @deprecated org.apache.maven.plugins maven-jxr-plugin org.apache.maven.plugins maven-javadoc-plugin http://java.sun.com/j2ee/1.4/docs/api http://java.sun.com/j2se/1.4.2/docs/api http://java.sun.com/j2se/1.5.0/docs/api org.codehaus.mojo jdepend-maven-plugin org.codehaus.mojo findbugs-maven-plugin org.mule mule-core ${mule.version} org.mule.tests mule-tests-functional ${mule.version} test junit junit 3.8.1 test mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/0000755000175000017500000000000011351410677030733 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/0000755000175000017500000000000011351410700031642 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/0000755000175000017500000000000011351410677032600 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/0000755000175000017500000000000011351410677033367 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000755000175000017500000000000011351410677033544 5ustar charlescharles././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000755000175000017500000000000011351410700033527 5ustar charlescharles././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/InboundTransformer.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000000426610754365306033562 0ustar charlescharles/* * $Id: InboundTransformer.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}.transformers; import org.mule.transformers.AbstractEventAwareTransformer; import org.mule.api.transformer.TransformerException; import org.mule.api.MuleEventContext; /** * ${inboundTransformer} TODO Document */ public class ${inboundTransformer} extends AbstractEventAwareTransformer { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public ${inboundTransformer}() { /* IMPLEMENTATION NOTE: Here you can set default types that the transformer will accept at runtime. Mule will then validate the transformer at runtime. You can register one or more source types. eg. registerSourceType(XXX.class.getName()); */ /* IMPLEMENTATION NOTE: It's good practice to set the expected return type for this transformer here This helps Mule validate event flows and Transformer chains setReturnClass(YYY.class); */ } public Object transform(Object src, String encoding, MuleEventContext context) throws TransformerException { /* IMPLEMENTATION NOTE: If you only have a single source type registered you can cast the 'src' object directly to that type, otherwise you need to check the instance type of 'src' for each registered source type */ // TODO Transformer the source object here. You have access to the // Current message (including //headers and attachments from the // context.getMessage()) // Make sure you return a transfromed object that matches the // returnClass type throw new UnsupportedOperationException("transform"); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/Transaction.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000000621210754365306033553 0ustar charlescharles/* * $Id: Transaction.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}; import org.mule.config.i18n.Message; import org.mule.transaction.AbstractSingleResourceTransaction; import org.mule.transaction.IllegalTransactionStateException; import org.mule.api.TransactionException; /** * ${TransportName}Transaction is a wrapper for a * ${TransportName} local transaction. This object holds the tx resource and * controls the when the transaction committed or rolled back. * */ public class ${TransportName}Transaction extends AbstractSingleResourceTransaction { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public void bindResource(Object key, Object resource) throws TransactionException { /* IMPLEMENTATION NOTE: Validate as necessary, the resource here and then pass it to the super class to bind it to the key and also do any other specific binding here. eg. try { // TODO Validate Resource state here if necessary } catch (XXXException e) { throw new IllegalTransactionStateException(new Message(Messages.TX_CANT_READ_STATE), e); } */ super.bindResource(key, resource); } protected void doBegin() throws TransactionException { /* IMPLEMENTATION NOTE: Sometimes the resource has already begun the transaction when its been made available i.e. A transacted Jms Session doesn't have a .begin() method, because initiation is handled by the Jms provider. eg. try { // TODO begin transaction - i.e. .begin(); } catch (XXXException e) { throw new TransactionException(new Message(Messages.TX_COMMIT_FAILED), e); } */ } protected void doCommit() throws TransactionException { /* IMPLEMENTATION NOTE: Commit the transaction here. Throw an appropriate TransactionException on failure. eg. try { // TODO commit transaction - i.e. .commit(); } catch (XXXException e) { throw new TransactionException(new Message(Messages.TX_COMMIT_FAILED), e); } */ } protected void doRollback() throws TransactionException { /* IMPLEMENTATION NOTE: Rollback the transaction here. Throw an appropriate TransactionException on failure. eg, try { // TODO rollback transaction - i.e. .rollback(); } catch (XXXException e) { throw new TransactionException(new Message(Messages.TX_ROLLBACK_FAILED), e); } */ } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/OutboundTransformer.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000000351510754365306033556 0ustar charlescharles/* * $Id: OutboundTransformer.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}.transformers; import org.mule.transformer.AbstractMessageAwareTransformer; import org.mule.api.transformer.TransformerException; import org.mule.api.MuleEventContext; /** * ${outboundTransformer} TODO Document */ public class ${outboundTransformer} extends AbstractMessageAwareTransformer { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public ${outboundTransformer}() { /* IMPLEMENTATION NOTE: Here you can set default types that the transformer will accept at runtime. Mule will then validate the transformer at runtime. You can register one or more source types. registerSourceType(XXX.class.getName()); */ /* IMPLEMENTATION NOTE: It's good practice to set the expected return type for this transformer here This helps Mule validate event flows and Transformer chains setReturnClass(YYY.class); */ } public Object transform(MuleMessage message, String encoding) throws TransformerException { // TODO Transformer the message here. See comments in {@link AbstractMessageAwareTransformer} // Make sure you return a transfromed object that matches the // returnClass type throw new UnsupportedOperationException("transform"); } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/TransactedMessageReceiver.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000001352310757615756033570 0ustar charlescharles/* * $Id: TransactedMessageReceiver.vm 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}; import org.mule.config.i18n.Message; import org.mule.DefaultMuleMessage; import org.mule.transport.ConnectException; import org.mule.transport.TransactedPollingMessageReceiver; import org.mule.api.service.Service; import org.mule.api.endpoint.Endpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.transport.Connector; import org.mule.api.transport.MessageAdapter; import java.util.List; /** * ${TransportName} Todo Document * */ public class ${TransportName}TransactedMessageReceiver extends TransactedPollingMessageReceiver { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public ${TransportName}TransactedMessageReceiver(Connector connector, Service service, final InboundEndpoint endpoint, long pollingFrequency) throws CreateException { super(connector, service, endpoint, pollingFrequency); } protected List getMessages() throws Exception { /* IMPLEMENTATION NOTE: You can just return a single message in a list or return a batch of messages to be processed. It's always recommend to process single messages to start with and then experiment with batching */ // TODO Consume one or more messages from the underlying technology // This method is executed within a transaction template so all // operations will be part of the transation throw new UnsupportedOperationException("getMessages"); } protected void processMessage(Object message) throws Exception { // TODO Process the current message. The object will be of the same // type returned in the List from getMessages() // Here is how to pass the message to Mule. Most MessageReceivers // will need to do nothing more than this MessageAdapter adapter = connector.getMessageAdapter(message); routeMessage(new MuleMessage(adapter), endpoint.isSynchronous()); } public void doConnect() throws ConnectException { /* IMPLEMENTATION NOTE: Should make a connection to the underlying transport i.e. connect to a socket or register a soap service. When there is no connection to be made this method should be used to chack that resources are available. For example the FileMessageReceiver checks that the directories it will be using are available and readable. The MessageReceiver should remain in a 'stopped' state even after the doConnect() method is called. This means that a connection has been made but no events will be received until the start() method is called. Calling start() on the MessageReceiver will call doConnect() if the receiver hasn't connected. */ /* IMPLEMENTATION NOTE: If you need to spawn any threads such as worker threads for this receiver you can Schedule a worker thread with the work manager i.e. getWorkManager().scheduleWork(worker, WorkManager.INDEFINITE, null, null); Where 'worker' implemments javax.resource.spi.work.Work */ /* IMPLEMENTATION NOTE: When throwing an exception from this method you need to throw a ConnectException that accepts a Message, a cause exception and a reference to this MessageReceiver i.e. throw new ConnectException(new Message(Messages.FAILED_TO_SCHEDULE_WORK), e, this); */ // TODO the code necessay to Connect to the underlying resource } public void doDisconnect() throws ConnectException { /* IMPLEMENTATION NOTE: Disconnects and tidies up any rources allocted using the doConnect() method. This method should return the MessageReceiver into a disconnected state so that it can be connected again using the doConnect() method. */ // TODO release any resources } public void doStart() { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Should perform any actions necessary to enable the reciever to start reciving events. This is different to the doConnect() method which actually makes a connection to the transport, but leaves the MessageReceiver in a stopped state. For polling-based MessageReceivers the start() method simply starts the polling thread, for the Axis Message receiver the start method on the SOAPService is called. What action is performed here depends on the transport being used. Most of the time a custom provider doesn't need to override this method. */ } public void doStop() { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Should perform any actions necessary to stop the reciever from receiving events. */ } public void doDispose() { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Is called when the Conector is being dispoed and should clean up any resources. The doStop() and doDisconnect() methods will be called implicitly when this method is called. */ } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/MessageAdapter.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000000452310754365306033556 0ustar charlescharles/* * $Id: MessageAdapter.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}; import org.mule.transport.AbstractMessageAdapter; import org.mule.api.MessagingException; import org.mule.api.transport.MessageTypeNotSupportedException; /** * ${TransportName}MessageAdapter TODO document */ public class ${TransportName}MessageAdapter extends AbstractMessageAdapter { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ /* IMPLEMENTATION NOTE: The MessageAdapter is used to wrap an underlying message. It should store a copy of the underlying message as an instance variable. */ /* IMPLEMENTATION NOTE: If the underlying transport data is available as a stream it is recommended that you pass the stream object into the MessageAdapter as the payload. This will ensure that Mule will use streaming where possible. */ public ${TransportName}MessageAdapter(Object message) throws MessagingException { /* IMPLEMENTATION NOTE: The constructor should determine that the message is of the correct type or throw an exception i.e. if (message instanceof byte[]) { this.message = (byte[]) message; } else { throw new MessageTypeNotSupportedException(message, getClass()); } */ } public String getPayloadAsString(String encoding) throws Exception { // TODO return the string representation of the wrapped message throw new UnsupportedOperationException("getPayloadAsString"); } public byte[] getPayloadAsBytes() throws Exception { // TODO return the byte[] representation of the wrapped message throw new UnsupportedOperationException("getPayloadAsBytes"); } public Object getPayload() { // TODO return the actual wrapped message throw new UnsupportedOperationException("getPayload"); } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/MessageDispatcher.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000001012610757615756033564 0ustar charlescharles/* * $Id: MessageDispatcher.vm 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}; import org.mule.transport.AbstractMessageDispatcher; import org.mule.api.MuleEvent; import org.mule.api.MuleMessage; import org.mule.api.endpoint.OutboundEndpoint; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * ${TransportName}MessageDispatcher TODO document */ public class ${TransportName}MessageDispatcher extends AbstractMessageDispatcher { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public ${TransportName}MessageDispatcher(OutboundEndpoint endpoint) { super(endpoint); /* IMPLEMENTATION NOTE: If you need a reference to the specific connector for this dispatcher use: ${TransportName}Connector cnn = (${TransportName}Connector)endpoint.getConnector(); */ } public void doConnect() throws Exception { /* IMPLEMENTATION NOTE: Makes a connection to the underlying resource. Where connections are managed by the connector this method may do nothing */ // If a resource for this Dispatcher needs a connection established, // then this is the place to do it } public void doDisconnect() throws Exception { /* IMPLEMENTATION NOTE: Disconnect any conections made in the connect method */ // If the connect method did not do anything then this method // shouldn't do anything either } public void doDispatch(MuleEvent event) throws Exception { /* IMPLEMENTATION NOTE: This is invoked when the endpoint is asynchronous. It should invoke the transport but not return any result. If a result is returned it should be ignorred, but if the underlying transport does have a notion of asynchronous processing, that should be invoked. This method is executed in a different thread to the request thread. */ // TODO Write the client code here to dispatch the event over this // transport throw new UnsupportedOperationException("doDispatch"); } public MuleMessage doSend(MuleEvent event) throws Exception { /* IMPLEMENTATION NOTE: Should send the event payload over the transport. If there is a response from the transport it shuold be returned from this method. The sendEvent method is called when the endpoint is running synchronously and any response returned will ultimately be passed back to the callee. This method is executed in the same thread as the request thread. */ // TODO Write the client code here to send the event over this // transport (or to dispatch the event to a store or repository) // TODO Once the event has been sent, return the result (if any) // wrapped in a MuleMessage object throw new UnsupportedOperationException("doSend"); } public MuleMessage doReceive(long timeout) throws Exception { /* IMPLEMENTATION NOTE: Can be used to make arbitary requests to a transport resource. if the timeout is 0 the method should block until an event on the endpoint is received. */ // TODO Write the client code here to perform a request over the // transport throw new UnsupportedOperationException("receive"); } public void doDispose() { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Is called when the Dispatcher is being disposed and should clean up any open resources. */ } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/MessageReceiver.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000001234510757615756033571 0ustar charlescharles/* * $Id: MessageReceiver.vm 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}; import org.mule.transport.ConnectException; #if( $isPollingReceiver == "y") import org.mule.transport.AbstractPollingMessageReceiver; #else import org.mule.transport.AbstractMessageReceiver; #end import org.mule.api.service.Service; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.lifecycle.CreateException; import org.mule.api.transport.Connector; /** * ${TransportName}MessageReceiver TODO document */ public class ${TransportName}MessageReceiver extends #if( $isPollingReceiver == "y") AbstractPollingMessageReceiver #else AbstractMessageReceiver #end { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public ${TransportName}MessageReceiver(Connector connector, Service service, InboundEndpoint endpoint) throws CreateException { super(connector, service, endpoint); } public void doConnect() throws ConnectException { /* IMPLEMENTATION NOTE: This method should make a connection to the underlying transport i.e. connect to a socket or register a soap service. When there is no connection to be made this method should be used to check that resources are available. For example the FileMessageReceiver checks that the directories it will be using are available and readable. The MessageReceiver should remain in a 'stopped' state even after the doConnect() method is called. This means that a connection has been made but no events will be received until the start() method is called. Calling start() on the MessageReceiver will call doConnect() if the receiver hasn't connected already. */ /* IMPLEMENTATION NOTE: If you need to spawn any threads such as worker threads for this receiver you can schedule a worker thread with the work manager i.e. getWorkManager().scheduleWork(worker, WorkManager.INDEFINITE, null, null); Where 'worker' implemments javax.resource.spi.work.Work */ /* IMPLEMENTATION NOTE: When throwing an exception from this method you need to throw an ConnectException that accepts a Message, a cause exception and a reference to this MessageReceiver i.e. throw new ConnectException(new Message(Messages.FAILED_TO_SCHEDULE_WORK), e, this); */ // TODO the code necessay to Connect to the underlying resource } public void doDisconnect() throws ConnectException { /* IMPLEMENTATION NOTE: Disconnects and tidies up any rources allocted using the doConnect() method. This method should return the MessageReceiver into a disconnected state so that it can be connected again using the doConnect() method. */ // TODO release any resources here } public void doStart() { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Should perform any actions necessary to enable the reciever to start reciving events. This is different to the doConnect() method which actually makes a connection to the transport, but leaves the MessageReceiver in a stopped state. For polling-based MessageReceivers the start() method simply starts the polling thread, for the Axis Message receiver the start method on the SOAPService is called. What action is performed here depends on the transport being used. Most of the time a custom provider doesn't need to override this method. */ } public void doStop() { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Should perform any actions necessary to stop the reciever from receiving events. */ } public void doDispose() { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Is called when the Conector is being dispoed and should clean up any resources. The doStop() and doDisconnect() methods will be called implicitly when this method is called. */ } #if( $isPollingReceiver == "y") public void poll() throws Exception { /* IMPLEMENTATION NOTE: Once you have read the object it can be passed into Mule by first wrapping the object with the Message adapter for this transport and calling routeMessage i.e. MessageAdapter adapter = connector.getMessageAdapter(object); routeMessage(new MuleMessage(adapter), endpoint.isSynchronous()); */ // TODO request a message from the underlying technology e.g. Read a file } #end } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/config/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000755000175000017500000000000011351410677033544 5ustar charlescharles././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/config/NamespaceHandler.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000000203210754365306033547 0ustar charlescharles/* * $Id: NamespaceHandler.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}.config; import org.mule.config.spring.parsers.generic.OrphanDefinitionParser; import org.mule.transport.${TransportNameLower}.${TransportName}Connector; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; /** * Registers a Bean Definition Parser for handling <${TransportNameLower}:connector> elements. * */ public class ${TransportName}NamespaceHandler extends NamespaceHandlerSupport { public void init() { registerBeanDefinitionParser("connector", new OrphanDefinitionParser(${TransportName}Connector.class, true)); } }././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/Connector.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000000576110754365306033563 0ustar charlescharles/* * $Id: Connector.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}; import org.mule.transport.AbstractConnector; import org.mule.api.MuleException; import org.mule.api.lifecycle.InitialisationException; /** * ${TransportName}Connector TODO document */ public class ${TransportName}Connector extends AbstractConnector { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ /* IMPLEMENTATION NOTE: All configuaration for the transport should be set on the Connector object, this is the object that gets configured in MuleXml */ public void doInitialise() throws InitialisationException { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Is called once all bean properties have been set on the connector and can be used to validate and initialise the connectors state. */ } public void doConnect() throws Exception { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Makes a connection to the underlying resource. When connections are managed at the receiver/dispatcher level, this method may do nothing */ } public void doDisconnect() throws Exception { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Disconnects any connections made in the connect method If the connect method did not do anything then this method shouldn't do anything either. */ } public void doStart() throws MuleException { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: If there is a single server instance or connection associated with the connector i.e. AxisServer or a Jms Connection or Jdbc Connection, this method should put the resource in a started state here. */ } public void doStop() throws MuleException { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Should put any associated resources into a stopped state. Mule will automatically call the stop() method. */ } public void doDispose() { // Optional; does not need to be implemented. Delete if not required /* IMPLEMENTATION NOTE: Should clean up any open resources associated with the connector. */ } public String getProtocol() { return "${TransportNameLower}"; } } ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/MessageDispatcherFactory.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000000216510757615756033570 0ustar charlescharles/* * $Id: MessageDispatcherFactory.vm 10961 2008-02-22 19:01:02Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}; import org.mule.transport.AbstractMessageDispatcherFactory; import org.mule.api.MuleException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.transport.MessageDispatcher; /** * ${TransportName}MessageDispatcherFactory Todo document */ public class ${TransportName}MessageDispatcherFactory extends AbstractMessageDispatcherFactory { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public MessageDispatcher create(OutboundEndpoint endpoint) throws MuleException { return new ${TransportName}MessageDispatcher(endpoint); } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/package.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000000016310754365306033552 0ustar charlescharles Mule - ${TransportName} Transport

    ${description}

    ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/EndpointBuilder.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000000411711000000257033525 0ustar charlescharles/* * $Id: EndpointBuilder.vm 11571 2008-04-12 00:22:07Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}; import org.mule.api.endpoint.EndpointException; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.endpoint.MalformedEndpointException; import org.mule.api.endpoint.OutboundEndpoint; import org.mule.api.lifecycle.InitialisationException; import org.mule.endpoint.AbstractEndpointBuilder; import java.net.URI; import java.util.Properties; /** * ${TransportName}EndpointBuilder TODO Document */ public class ${TransportName}EndpointBuilder extends AbstractEndpointBuilder { protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException { /* IMPLEMENTATION NOTE: This method should set the this.address variable to the endpoint value to be retruned when calling MuleEndpointURI.getAddress(). Mule uses this portion to pass to the underlying technology */ // TODO extract the endpoint config from the uri throw new UnsupportedOperationException("setEndpoint"); } protected InboundEndpoint doBuildInboundEndpoint() throws EndpointException, InitialisationException { // TODO implement me throw new UnsupportedOperationException("doBuildInboundEndpoint"); } protected OutboundEndpoint doBuildOutboundEndpoint() throws EndpointException, InitialisationException { // TODO implement me throw new UnsupportedOperationException("doBuildInboundEndpoint"); } protected ImmutableEndpoint doBuildResponseEndpoint() throws EndpointException, InitialisationException { // TODO implement me throw new UnsupportedOperationException("doBuildResponseEndpoint"); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/Messages.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000000146510754365306033560 0ustar charlescharles/* * $Id: Messages.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}.i18n; import org.mule.config.i18n.Message; import org.mule.config.i18n.MessageFactory; public class ${TransportName}Messages extends MessageFactory { private static final String BUNDLE_PATH = getBundlePath("${TransportNameLower}"); /* public static Message exampleMessage() { return createMessage(BUNDLE_PATH, 1); } */ } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/mule/transport/TransactionFactory.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/java/org/m0000644000175000017500000000242210754365306033552 0ustar charlescharles/* * $Id: TransactionFactory.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}; import org.mule.api.transaction.TransactionException; import org.mule.api.transaction.Transaction; import org.mule.api.transaction.TransactionFactory; import org.mule.api.MuleContext; /** * ${TransportName}TransactionFactory Creates a * ${TransportName}Transaction * * @see ${TransportName}Transaction */ public class ${TransportName}TransactionFactory implements TransactionFactory { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public Transaction beginTransaction(MuleContext muleContext) throws TransactionException { ${TransportName}Transaction tx = new ${TransportName}Transaction(); tx.begin(); return tx; } public boolean isTransacted() { return true; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000755000175000017500000000000011351410700033654 5ustar charlescharles././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000755000175000017500000000000011351410700033654 5ustar charlescharles././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.schemas.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000644000175000017500000000023410754365306033676 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/${TransportNameLower}/${MuleMajorMinorVersion}/mule-${TransportNameLower}.xsd=META-INF/mule-${TransportNameLower}.xsd././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/schema.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000644000175000017500000000521610754365306033703 0ustar charlescharles ${description} ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000755000175000017500000000000011351410700033654 5ustar charlescharles././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000755000175000017500000000000011351410700033654 5ustar charlescharles././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000755000175000017500000000000011351410700033654 5ustar charlescharles././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule/providers/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000755000175000017500000000000011351410700033654 5ustar charlescharles././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule/providers/csd.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000644000175000017500000000522111000000257033647 0ustar charlescharles#This file is the service descriptor for your transport #It ties all the implementation classes together so that Mule can #construct endpoints for your transport protocol at runtime #For a full list of properties that can be set here see - #http://mule.mulesource.org/wiki/x/pwI #The connector class for your transport. This is alwas required connector=org.mule.transport.${TransportNameLower}.${TransportName}Connector #Used as the Mule internal representation of a message received or sent by #your transport. This is always required. message.adapter=org.mule.transport.${TransportNameLower}.${TransportName}MessageAdapter #if( $Streaming == "y") #The message adapter to use if the inbound endpoint is marked for streaming streaming.message.adapter=org.mule.transport.${TransportNameLower}.${TransportName}StreamingMessageAdapter #end #if( $hasDispatcher == "y") #The factory used to create dispatchers responsible for sending events from the underlying technology dispatcher.factory=org.mule.transport.${TransportNameLower}.${TransportName}MessageDispatcherFactory #end #if( $Receiver == "y") #The standard message receiver used to consume events from the underlying technology message.receiver=org.mule.transport.${TransportNameLower}.${TransportName}MessageReceiver #end #if( $hasTransactions == "y") #The message receiver to use if the endpoint is marked as transacted. transacted.message.receiver=org.mule.transport.${TransportNameLower}.${TransportName}TransactedMessageReceiver #end #if( $inboundTransformer && $inboundTransformer != "n") #The Default inbound transformer for this component inbound.transformer=org.mule.transport.${TransportNameLower}.transformers.$inboundTransformer #end #if( $outboundTransformer && $outboundTransformer != "n") #The Default utbound transformer for this component outbound.transformer=org.mule.transport.${TransportNameLower}.transformers.$outboundTransformer #end #Defines the way in which endpoints for your transport will be constructed #Options are (but you can write your own) - #org.mule.endpoint.ResourceEndpointBuilder i.e. vm://my.queue #org.mule.endpoint.UrlEndpointBuilder i.e. axis:http://localhost:1234/context/Service?params #org.mule.endpoint.SocketEndpointBuilder i.e. udp://localhost:2222 #if($endpointBuilder == "r") endpoint.builder=org.mule.endpoint.ResourceEndpointURIBuilder #elseif($endpointBuilder == "u") endpoint.builder=org.mule.endpoint.UrlEndpointURIBuilder #elseif($endpointBuilder == "s") endpoint.builder=org.mule.endpoint.SocketEndpointURIBuilder #else endpoint.builder=org.mule.transport.${TransportNameLower}.${TransportName}EndpointURIBuilder #end #For more information see - http://mule.mulesource.org/wiki/x/DQ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule/i18n/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000755000175000017500000000000011351410700033654 5ustar charlescharles././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/services/org/mule/i18n/messages.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000644000175000017500000000123310754365306033676 0ustar charlescharles#Add any string messages here that are specific to your transport #Messages put here can be translated into other languages #Each message should be given a unique numerical id i.e. # #1=This is a test message with a single argument {0} # #Arguments can be placed in the message using {0}, {1}, etc placeholders # #To get a message listed here use the following - # new Message("${TransportName}", "" [, , ]); # # "${TransportName}" is the protocol of this transport # is the id of the message in this file # is a list of String arguments to pass to the message # # For more info see http://mule.mulesource.org/wiki/x/zQU././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/META-INF/spring.handlers.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/main/resources/0000644000175000017500000000024710754365306033702 0ustar charlescharleshttp\://www.mulesource.org/schema/mule/${TransportNameLower}/${MuleMajorMinorVersion}=org.mule.transport.${TransportNameLower}.config.${TransportName}NamespaceHandler mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/0000755000175000017500000000000011351410677031712 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/0000755000175000017500000000000011351410675032631 5ustar charlescharlesmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/0000755000175000017500000000000011351410675033420 5ustar charlescharles././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/m0000755000175000017500000000000011351410675033575 5ustar charlescharles././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/transport/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/m0000755000175000017500000000000011351410677033577 5ustar charlescharles././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/transport/ConnectorTestCase.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/m0000644000175000017500000000352510754365306033612 0ustar charlescharles/* * $Id: ConnectorTestCase.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ #set($TransportName = "${TransportName.substring(0,1).toUpperCase()}${TransportName.substring(1)}") package org.mule.transport.${TransportName.toLowerCase()}; import org.mule.transport.AbstractConnectorTestCase; import org.mule.api.service.Service; import org.mule.api.transport.Connector; public class ${TransportName}ConnectorTestCase extends AbstractConnectorTestCase { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public Connector createConnector() throws Exception { /* IMPLEMENTATION NOTE: Create and initialise an instance of your connector here. Do not actually call the connect method. */ ${TransportName}Connector c = new ${TransportName}Connector(); c.setName("Test"); // TODO Set any additional properties on the connector here return c; } public String getTestEndpointURI() { // TODO Return a valid endpoint for you transport here throw new UnsupportedOperationException("getTestEndpointURI"); } public Object getValidMessage() throws Exception { // TODO Return an valid message for your transport throw new UnsupportedOperationException("getValidMessage"); } public void testProperties() throws Exception { // TODO test setting and retrieving any custom properties on the // Connector as necessary } } ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/transport/ConnectorFactoryTestCase.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/m0000644000175000017500000000304711000000257033561 0ustar charlescharles/* * $Id: ConnectorFactoryTestCase.vm 11571 2008-04-12 00:22:07Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ #set($TransportName = "${TransportName.substring(0,1).toUpperCase()}${TransportName.substring(1)}") package org.mule.transport.${TransportName.toLowerCase()}; import org.mule.api.endpoint.InboundEndpoint; import org.mule.tck.AbstractMuleTestCase; public class ${TransportName}ConnectorFactoryTestCase extends AbstractMuleTestCase { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public void testCreateFromFactory() throws Exception { InboundEndpoint endpoint = muleContext.getRegistry() .lookupEndpointFactory().getInboundEndpoint(getEndpointURI()); assertNotNull(endpoint); assertNotNull(endpoint.getConnector()); assertTrue(endpoint.getConnector() instanceof ${TransportName}Connector); assertEquals(getEndpointURI(), endpoint.getEndpointURI().getAddress()); } public String getEndpointURI() { // TODO return a valid endpoint URI string for your transport // i.e. tcp://localhost:1234 throw new UnsupportedOperationException("getEndpointURI"); } } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/transport/MessageReceiverTestCase.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/m0000644000175000017500000000356611000000257033567 0ustar charlescharles/* * $Id: MessageReceiverTestCase.vm 11571 2008-04-12 00:22:07Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ #set($TransportName = "${TransportName.substring(0,1).toUpperCase()}${TransportName.substring(1)}") package org.mule.transport.${TransportName.toLowerCase()}; import com.mockobjects.dynamic.Mock; import org.mule.transport.AbstractConnector; import org.mule.transport.${TransportName.toLowerCase()}.${TransportName}MessageReceiver; import org.mule.tck.providers.AbstractMessageReceiverTestCase; import org.mule.api.service.Service; import org.mule.api.endpoint.InboundEndpoint; import org.mule.api.transport.MessageReceiver; public class ${TransportName}MessageReceiverTestCase extends AbstractMessageReceiverTestCase { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public MessageReceiver getMessageReceiver() throws Exception { Mock mockService = new Mock(Service.class); mockService.expectAndReturn("getResponseTransformer", null); #if( $isPollingReceiver == "y") return new ${TransportName}MessageReceiver(endpoint.getConnector(), (Service) mockService.proxy(), endpoint, 1000); #else return new ${TransportName}MessageReceiver(endpoint.getConnector(), (Service) mockService.proxy(), endpoint); #end } public InboundEndpoint getEndpoint() throws Exception { // TODO return a valid endpoint i.e. // return new MuleEndpoint("tcp://localhost:1234", true) throw new UnsupportedOperationException("getEndpoint"); } } ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/transport/NamespaceHandlerTestCase.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/m0000644000175000017500000000231010754365306033601 0ustar charlescharles/* * $Id: NamespaceHandlerTestCase.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}; import org.mule.tck.FunctionalTestCase; /** * TODO */ public class ${TransportName}NamespaceHandlerTestCase extends FunctionalTestCase { protected String getConfigResources() { //TODO You'll need to edit this file to configure the properties specific to your transport return "${TransportNameLower}-namespace-config.xml"; } public void test${TransportName}Config() throws Exception { ${TransportName}Connector c = (${TransportName}Connector) muleContext.getRegistry().lookupConnector("${TransportNameLower}Connector"); assertNotNull(c); assertTrue(c.isConnected()); assertTrue(c.isStarted()); //TODO Assert specific properties are configured correctly } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/transport/EndpointTestCase.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/m0000644000175000017500000000305111000000257033554 0ustar charlescharles/* * \$Id: EndpointTestCase.vm 11571 2008-04-12 00:22:07Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ #set($TransportName = "${TransportName.substring(0,1).toUpperCase()}${TransportName.substring(1)}") package org.mule.transport.${TransportName.toLowerCase()}; import org.mule.endpoint.MuleEndpointURI; import org.mule.tck.AbstractMuleTestCase; import org.mule.api.endpoint.EndpointURI; public class ${TransportName}EndpointTestCase extends AbstractMuleTestCase { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public void testValidEndpointURI() throws Exception { // TODO test creating and asserting Endpoint values eg /* EndpointURI url = new MuleEndpointURI("tcp://localhost:7856"); assertEquals("tcp", url.getScheme()); assertEquals("tcp://localhost:7856", url.getAddress()); assertNull(url.getEndpointName()); assertEquals(7856, url.getPort()); assertEquals("localhost", url.getHost()); assertEquals("tcp://localhost:7856", url.getAddress()); assertEquals(0, url.getParams().size()); */ throw new UnsupportedOperationException("testValidEndpointURI"); } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/transport/MessageAdapterTestCase.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/m0000644000175000017500000000242710754365306033612 0ustar charlescharles/* * $Id: MessageAdapterTestCase.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ #set($TransportName = "${TransportName.substring(0,1).toUpperCase()}${TransportName.substring(1)}") package org.mule.transport.${TransportName.toLowerCase()}; import org.mule.transport.AbstractMessageAdapterTestCase; import org.mule.api.transport.MessageAdapter; import org.mule.api.MessagingException; public class ${TransportName}MessageAdapterTestCase extends AbstractMessageAdapterTestCase { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public Object getValidMessage() throws Exception { // TODO Create a valid message for your transport throw new UnsupportedOperationException("getValidMessage"); } public MessageAdapter createAdapter(Object payload) throws MessagingException { return new ${TransportName}MessageAdapter(payload); } } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/mule/transport/TransformersTestCase.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/java/org/m0000644000175000017500000000504310754365306033607 0ustar charlescharles/* * $Id: TransformersTestCase.vm 10787 2008-02-12 18:51:50Z dfeist $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.transport.${TransportNameLower}.transformers; import org.mule.transformer.AbstractTransformerTestCase; import org.mule.api.transformer.Transformer; public class ${TransportName}TransformersTestCase extends AbstractTransformerTestCase { /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformerTestCase#getTestData() */ public Object getTestData() { // TODO create a test data object that will be passed into the // transformer throw new UnsupportedOperationException("getResultData"); } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformerTestCase#getResultData() */ public Object getResultData() { try { // TODO Return the result data expected once the getTestData() // value has been transformed throw new UnsupportedOperationException("getResultData"); } catch (Exception ex) { return null; } } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformerTestCase#getTransformers() */ public Transformer getTransformer() { #if( $inboundTransformer != "n") Transformer t = new ${inboundTransformer}(); // Set the correct return class for this roundtrip test t.setReturnClass(this.getResultData().getClass()); return t; #else // No Inbound transformer was created for this Transport return null; #end } /* * (non-Javadoc) * * @see org.mule.transformer.AbstractTransformerTestCase#getRoundTripTransformer() */ public Transformer getRoundTripTransformer() { #if( $outboundTransformer != "n") Transformer t = new ${outboundTransformer}(); // Set the correct return class for this roundtrip test t.setReturnClass(this.getTestData().getClass()); return t; #else // No Outbound transformer was created for this Transport return null; #end } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/resources/mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/resources/0000755000175000017500000000000011351410677033724 5ustar charlescharles././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/resources/namespace-config.xml.vmmule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/src/test/resources/0000644000175000017500000000176710754365306033745 0ustar charlescharles <${TransportNameLower}:connector name="${TransportNameLower}Connector"> mule-2.0.1/tools/mule-transport-archetype/src/main/resources/archetype-resources/assembly.xml.vm0000644000175000017500000000221410754365306033131 0ustar charlescharles ${TransportName} zip tar.gz src pom.xml src/** target . *.jar target/site site examples/target examples *.jar lib/user ${artifactId}.${extension} test org.mule.tests:mule-tests-functional mule-2.0.1/tools/mule-transport-archetype/pom.xml0000644000175000017500000000336711006063605021741 0ustar charlescharles 4.0.0 org.mule.tools mule-tools 2.0.1 maven-plugin Mule Transport Archetype mule-transport-archetype Archetype for Mule 2.0 and above transport projects. org.mule mule-core ${version} org.mule.tools bobberplus ${version} org.apache.maven maven-embedder 2.0.4 test org.apache.maven maven-core 2.0.7 test mule-2.0.1/tools/bobberplus/0000755000175000017500000000000011351410664015600 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/0000755000175000017500000000000011351410664016367 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/0000755000175000017500000000000011351410664017313 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/java/0000755000175000017500000000000011351410664020234 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/java/org/0000755000175000017500000000000011351410664021023 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/java/org/apache/0000755000175000017500000000000011351410664022244 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/java/org/apache/maven/0000755000175000017500000000000011351410664023352 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/java/org/apache/maven/plugin/0000755000175000017500000000000011351410664024650 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/java/org/apache/maven/plugin/archetype/0000755000175000017500000000000011351410664026634 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tools/bobberplus/src/main/java/org/apache/maven/plugin/archetype/BobberArchetypeMojo.javamule-2.0.1/tools/bobberplus/src/main/java/org/apache/maven/plugin/archetype/BobberArchetypeMojo.java0000644000175000017500000001110310734757176033400 0ustar charlescharles/* * Copyright 2001-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.maven.plugin.archetype; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.maven.archetype.Archetype; import org.apache.maven.archetype.ArchetypeDescriptorException; import org.apache.maven.archetype.ArchetypeNotFoundException; import org.apache.maven.archetype.ArchetypeTemplateProcessingException; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; /** * Builds archetype containers. * * @goal create * @description The archetype creation goal looks for an archetype with a given groupId, artifactId, and * version and retrieves it from the remote repository. Once the archetype is retrieve it is process against * a set of user parameters to create a working Maven project. This is a modified version for bobber to support additional functionality. * @requiresProject false */ public class BobberArchetypeMojo extends AbstractMojo { /** * @parameter expression="${component.org.apache.maven.archetype.Archetype}" * @required */ private Archetype archetype; /** * @parameter expression="${localRepository}" * @required */ private ArtifactRepository localRepository; /** * @parameter expression="${archetypeGroupId}" default-value="org.apache.maven.archetypes" * @required */ private String archetypeGroupId; /** * @parameter expression="${archetypeArtifactId}" default-value="maven-archetype-quickstart" * @required */ private String archetypeArtifactId; /** * @parameter expression="${archetypeVersion}" default-value="RELEASE" * @required */ private String archetypeVersion; /** * @parameter expression="${groupId}" * @required */ private String groupId; /** * @parameter expression="${artifactId}" * @required */ private String artifactId; /** * @parameter expression="${version}" default-value="1.0-SNAPSHOT" * @required */ private String version; /** @parameter expression="${packageName}" alias="package" */ private String packageName; /** * @parameter expression="${project.remoteArtifactRepositories}" * @required */ private List remoteRepositories; public void execute() throws MojoExecutionException { // TODO: prompt for missing values // TODO: configurable license // ---------------------------------------------------------------------- // archetypeGroupId // archetypeArtifactId // archetypeVersion // // localRepository // remoteRepository // parameters // ---------------------------------------------------------------------- String basedir = System.getProperty("user.dir"); if (packageName == null) { getLog().info("Defaulting package to group ID: " + groupId); packageName = groupId; } // TODO: context mojo more appropriate? Map map = new HashMap(); map.put("basedir", basedir); map.put("package", packageName); map.put("packageName", packageName); map.put("groupId", groupId); map.put("artifactId", artifactId); map.put("version", version); try { archetype.createArchetype(archetypeGroupId, archetypeArtifactId, archetypeVersion, localRepository, remoteRepositories, map); } catch (ArchetypeNotFoundException e) { throw new MojoExecutionException("Error creating from archetype", e); } catch (ArchetypeDescriptorException e) { throw new MojoExecutionException("Error creating from archetype", e); } catch (ArchetypeTemplateProcessingException e) { throw new MojoExecutionException("Error creating from archetype", e); } } } mule-2.0.1/tools/bobberplus/src/main/java/com/0000755000175000017500000000000011351410664021012 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/java/com/javaforge/0000755000175000017500000000000011351410664022756 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/java/com/javaforge/bobber/0000755000175000017500000000000011351410664024211 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/java/com/javaforge/bobber/plugin/0000755000175000017500000000000011351410664025507 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/java/com/javaforge/bobber/plugin/archetype/0000755000175000017500000000000011351410664027473 5ustar charlescharles././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmule-2.0.1/tools/bobberplus/src/main/java/com/javaforge/bobber/plugin/archetype/BobberArchetype.javamule-2.0.1/tools/bobberplus/src/main/java/com/javaforge/bobber/plugin/archetype/BobberArchetype.java0000644000175000017500000005444610734757176033433 0ustar charlescharles/* * Copyright 2001-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.javaforge.bobber.plugin.archetype; import com.javaforge.bobber.archetype.model.Template; import com.javaforge.bobber.archetype.model.Variable; import com.javaforge.bobber.archetype.model.io.xpp3.BobberArchetypeXpp3Reader; import java.io.File; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.StringWriter; import java.io.Writer; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.zip.ZipEntry; import org.apache.maven.archetype.Archetype; import org.apache.maven.archetype.ArchetypeDescriptorException; import org.apache.maven.archetype.ArchetypeNotFoundException; import org.apache.maven.archetype.ArchetypeTemplateProcessingException; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.ArtifactResolutionException; import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.settings.MavenSettingsBuilder; import org.apache.velocity.VelocityContext; import org.codehaus.plexus.components.interactivity.InputHandler; import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.codehaus.plexus.velocity.VelocityComponent; //source blatantly copied from org.apache.maven.archetype.DefaultArchetype. Also stole code from DefaultPluginVersionManager.java //and maven-model for the mdo public class BobberArchetype extends AbstractLogEnabled implements Archetype { private static final String NEW_LINE = System.getProperty("line.separator"); // ---------------------------------------------------------------------- // Components // ---------------------------------------------------------------------- /** @component */ private VelocityComponent velocity; /** @component */ private ArtifactResolver artifactResolver; /** @component */ private InputHandler inputHandler; /** @component */ private ArtifactFactory artifactFactory; /** @component */ private MavenSettingsBuilder settingsBuilder; private static final int MESSAGE_LINE_LENGTH = 80; public void createArchetype(String archetypeGroupId, String archetypeArtifactId, String archetypeVersion, ArtifactRepository localRepository, List remoteRepositories, Map parameters) throws ArchetypeNotFoundException, ArchetypeDescriptorException, ArchetypeTemplateProcessingException { // --------------------------------------------------------------------- //locate the archetype file // --------------------------------------------------------------------- Artifact archetypeArtifact = artifactFactory.createArtifact(archetypeGroupId, archetypeArtifactId, archetypeVersion, Artifact.SCOPE_RUNTIME, "jar"); try { artifactResolver.resolve(archetypeArtifact, remoteRepositories, localRepository); } catch (ArtifactResolutionException e) { throw new ArchetypeDescriptorException("Error attempting to download archetype: " + e.getMessage(), e); } // ---------------------------------------------------------------------- // Load the archetype descriptor // ---------------------------------------------------------------------- BobberArchetypeXpp3Reader builder = new BobberArchetypeXpp3Reader(); com.javaforge.bobber.archetype.model.BobberArchetype archetype; JarFile archetypeJarFile; try { archetypeJarFile = new JarFile(archetypeArtifact.getFile()); final ZipEntry zipEntry = archetypeJarFile.getEntry(ARCHETYPE_DESCRIPTOR); InputStream is = archetypeJarFile.getInputStream(zipEntry); if (is == null) { throw new ArchetypeDescriptorException( "The " + ARCHETYPE_DESCRIPTOR + " descriptor cannot be found."); } archetype = builder.read(new InputStreamReader(is)); archetypeJarFile.close(); } catch (IOException e) { throw new ArchetypeDescriptorException("Error reading the " + ARCHETYPE_DESCRIPTOR + " descriptor.", e); } catch (XmlPullParserException e) { throw new ArchetypeDescriptorException("Error reading the " + ARCHETYPE_DESCRIPTOR + " descriptor.", e); } // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- String basedir = (String) parameters.get("basedir"); String artifactId = (String) parameters.get("artifactId"); File pomFile = new File(basedir, ARCHETYPE_POM); File outputDirectoryFile; if (pomFile.exists() && archetype.isAllowPartial()) { outputDirectoryFile = new File(basedir); } else { outputDirectoryFile = new File(basedir, artifactId); // TODO temporarily allow partial generation, remove it later if (!archetype.isAllowPartial() && outputDirectoryFile.exists() && outputDirectoryFile.listFiles().length > 0) { throw new ArchetypeTemplateProcessingException( outputDirectoryFile.getName() + " already exists - please run from a clean directory"); } outputDirectoryFile.mkdir(); } String outputDirectory = outputDirectoryFile.getAbsolutePath(); // ---------------------------------------------------------------------- // Set up the Velocity context // ---------------------------------------------------------------------- VelocityContext context = new VelocityContext(); String packageName = (String) parameters.get("package"); addParamToContext("package", packageName, context); addParamToContext("packagePath", StringUtils.replace(packageName, ".", "/"), context); for (Iterator iterator = parameters.keySet().iterator(); iterator.hasNext();) { String key = (String) iterator.next(); Object value = parameters.get(key); addParamToContext(key, value, context); } //add in the specified system properties //if this were a mojo could have set the settings using the ${settings} expression. Since it is not need to get it from the settings builder boolean inInteractiveMode = false; try { inInteractiveMode = settingsBuilder.buildSettings().getInteractiveMode().booleanValue(); //TODO there must be a cleaner way of doing this String temp = System.getProperty("interactive", null); if (temp != null) { inInteractiveMode = Boolean.valueOf(temp).booleanValue(); } getLogger().info("Interactive is: " + inInteractiveMode); } catch (Exception ie) { throw new ArchetypeTemplateProcessingException("unable to read settings ", ie); } if (inInteractiveMode) { getLogger().info("Please enter the values for the following archetype variables:"); } final List variables = archetype.getVariables(); processVariables(variables.iterator(), context, inInteractiveMode); // --------------------------------------------------------------------- // Get Logger and display all parameters used // --------------------------------------------------------------------- if (getLogger().isInfoEnabled()) { Object[] keys = context.getKeys(); if (keys.length > 0) { getLogger().info("----------------------------------------------------------------------------"); getLogger().info("Using following parameters for creating Archetype: " + archetypeArtifactId + ":" + archetypeVersion); getLogger().info("----------------------------------------------------------------------------"); for (int i = 0; i < keys.length; i++) { String parameterName = (String) keys[i]; Object parameterValue = context.get(parameterName); getLogger().info("Parameter: " + parameterName + " = " + parameterValue); } } else { getLogger().info("No Parameters found for creating Archetype"); } } // ---------------------------------------------------------------------- // Extract the archetype to the chosen directory // ---------------------------------------------------------------------- try { archetypeJarFile = new JarFile(archetypeArtifact.getFile()); Enumeration entries = archetypeJarFile.entries(); while (entries.hasMoreElements()) { JarEntry entry = (JarEntry) entries.nextElement(); String path = entry.getName(); if (!path.startsWith(ARCHETYPE_RESOURCES) || path.endsWith(".vm")) { continue; } File t = new File(outputDirectory, path.substring(19)); if (entry.isDirectory()) { // Assume directories are stored parents first then children. getLogger().debug("Extracting directory: " + entry.getName() + " to " + t.getAbsolutePath()); t.mkdir(); continue; } getLogger().debug("Extracting file: " + entry.getName() + " to " + t.getAbsolutePath()); t.createNewFile(); IOUtil.copy(archetypeJarFile.getInputStream(entry), new FileOutputStream(t)); } archetypeJarFile.close(); //remove the archetype descriptor File t = new File(outputDirectory, ARCHETYPE_DESCRIPTOR); t.delete(); } catch (IOException ioe) { throw new ArchetypeTemplateProcessingException("Error extracting archetype", ioe); } // ---------------------------------------------------------------------- // Process the templates // ---------------------------------------------------------------------- // use the out of the box codehaus velocity component that loads templates //from the class path ClassLoader old = Thread.currentThread().getContextClassLoader(); try { URL[] urls = new URL[1]; urls[0] = archetypeArtifact.getFile().toURI().toURL(); URLClassLoader archetypeJarLoader = new URLClassLoader(urls); Thread.currentThread().setContextClassLoader(archetypeJarLoader); for (Iterator i = archetype.getTemplates().iterator(); i.hasNext();) { final Template template = (Template) i.next(); // Check the optional 'condition' property on the template. // If present and the variable it points to is 'true', then // continue processing. If it's false, then skip. // If condition is not specified, assume the template should // be processed. boolean shouldProcess = true; String condition = template.getDependsOnVar(); String requiredValue = null; List options = new ArrayList(); if (StringUtils.isNotEmpty(condition)) { //Crappy logic processing -- for now boolean not = false; //Allow very simple matching logic to match templates against variable values int x = condition.indexOf("!="); getLogger().debug("Processing Condition : " + condition); if (x > -1) { not = true; requiredValue = condition.substring(x + 2).trim(); options = getListOfValues(requiredValue); condition = condition.substring(0, x).trim(); } else { x = condition.indexOf("="); if (x > -1) { requiredValue = condition.substring(x + 1); options = getListOfValues(requiredValue); condition = condition.substring(0, x); } } getLogger().debug("Not Expr: " + not); getLogger().debug("Condition Value: '" + condition + "'"); getLogger().debug("Required Value: '" + requiredValue + "'"); final Variable var = (Variable) findVariable(condition, variables); if (var != null) { final String strValue = (String) context.get(var.getName()); getLogger().debug("Variable Value is: '" + strValue + "'"); if (requiredValue == null) { if (!Boolean.valueOf(strValue).booleanValue()) { shouldProcess = false; } } else { if (!options.contains(strValue)) { shouldProcess = false; } } } else { getLogger().debug("Variable Value is: null"); shouldProcess = false; } if (not) { shouldProcess = !shouldProcess; } } if (shouldProcess) { processTemplate(template, outputDirectory, context); } else { getLogger().debug("Condition not met, skipping " + template.getOutput()); } } } catch (MalformedURLException mfe) { throw new ArchetypeTemplateProcessingException("Error loading archetype resources into the classpath", mfe); } finally { Thread.currentThread().setContextClassLoader(old); } // ---------------------------------------------------------------------- // Log message on Archetype creation // ---------------------------------------------------------------------- if (getLogger().isInfoEnabled()) { getLogger().info("Archetype created in dir: " + outputDirectory); } } protected void addParamToContext(String key, Object value, VelocityContext context) { getLogger().info("Adding Parameter to template Context: " + key + "=" + value); context.put(key, value); } protected void processVariables(Iterator variables, VelocityContext context, final boolean interactiveMode) throws ArchetypeTemplateProcessingException { while (variables.hasNext()) { Variable var = (Variable) variables.next(); String val = System.getProperty(var.getName(), var.getDefvalue()); if (interactiveMode) { StringBuffer message = new StringBuffer(); message.append(var.getName()).append(": ") .append(NEW_LINE) .append(StringUtils.repeat("*", MESSAGE_LINE_LENGTH)) .append(NEW_LINE) .append(NEW_LINE) .append(StringUtils.center(var.getDescription(), MESSAGE_LINE_LENGTH)) .append(NEW_LINE) .append(StringUtils.leftPad("[default: " + val + "]", MESSAGE_LINE_LENGTH)) .append(NEW_LINE) .append(StringUtils.repeat("*", MESSAGE_LINE_LENGTH)); getLogger().info(message.toString()); try { String answer = inputHandler.readLine(); if (!StringUtils.isEmpty(answer)) { val = answer; } } catch (IOException ie) { throw new ArchetypeTemplateProcessingException(ie); } context.put(var.getName(), val); } else { context.put(var.getName(), val); } if (val.toLowerCase().equals("false") || val.toLowerCase().equals("n")) { if (var.getVariables() != null) { //keep processing the variables picking up the default values processVariables(var.getVariables().iterator(), context, interactiveMode); } } else if (var.getVariables() != null) { //keep processing the variables picking up the default values processVariables(var.getVariables().iterator(), context, interactiveMode); } } } protected List getListOfValues(String s) { List options = new ArrayList(); for (StringTokenizer stringTokenizer = new StringTokenizer(s, "|"); stringTokenizer.hasMoreTokens();) { options.add(stringTokenizer.nextToken()); } return options; } protected void processTemplate(Template template, String outputDirectory, VelocityContext context) throws ArchetypeTemplateProcessingException { File outFile; try { StringWriter wout = new StringWriter(); velocity.getEngine().evaluate(context, wout, "output value", template.getOutput()); outFile = new File(outputDirectory, wout.toString()); getLogger().debug(outFile.getAbsolutePath()); FileUtils.forceMkdir(outFile.getParentFile()); getLogger().debug("Created directory: " + outFile.getParentFile() + ", Dir exists = " + outFile.getParentFile().exists()); } catch (Exception e) { e.printStackTrace(); throw new ArchetypeTemplateProcessingException("error evaluating output file name " + template.getOutput(), e); } Writer writer = null; try { getLogger().info("Processing Template: " + template.getFile()); String templateLocation = ARCHETYPE_RESOURCES + "/" + template.getFile(); writer = new FileWriter(outFile); velocity.getEngine().mergeTemplate(templateLocation, context, writer); writer.flush(); } catch (Exception e) { throw new ArchetypeTemplateProcessingException("Error merging velocity templates", e); } finally { IOUtil.close(writer); getLogger().info("Written Template to: " + outFile + ", file exists = " + outFile.exists()); } // Delete archetype-originated folders in case the output path is also templated. // Otherwise, there will be a processed folder AND the original folder. try { final File templateFile = new File(outputDirectory, template.getFile()); final String templateDir = FileUtils.dirname(templateFile.getCanonicalPath()); final String outputDir = FileUtils.dirname(outFile.getCanonicalPath()); if (getLogger().isDebugEnabled()) { getLogger().debug("TemplateDir=" + templateDir); getLogger().debug("OutputDir=" + outputDir); } if (!outputDir.startsWith(templateDir)) { getLogger().debug("Deleting Template Dir:" + templateDir); FileUtils.forceDelete(templateDir); } } catch (IOException e) { throw new ArchetypeTemplateProcessingException("Failed to cleanup the working dir.", e); } } /** * Find the variable. * * @param variableName name * @param variables all variables of the artifact * @return variable value or null of not found */ protected Object findVariable(String variableName, List variables) { for (int i = 0; i < variables.size(); i++) { Variable var = (Variable) variables.get(i); if (variableName.equals(var.getName())) { return var; } else if (var.getVariables() != null) { Object o = findVariable(variableName, var.getVariables()); if (o != null) { return o; } } } return null; } } mule-2.0.1/tools/bobberplus/src/main/resources/0000755000175000017500000000000011351410664021325 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/resources/META-INF/0000755000175000017500000000000011351410664022465 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/resources/META-INF/plexus/0000755000175000017500000000000011351410664024005 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/resources/META-INF/plexus/components.xml0000644000175000017500000000156510611673117026725 0ustar charlescharles org.apache.maven.archetype.Archetype com.javaforge.bobber.plugin.archetype.BobberArchetype org.codehaus.plexus.velocity.VelocityComponent org.apache.maven.artifact.resolver.ArtifactResolver org.apache.maven.artifact.factory.ArtifactFactory org.codehaus.plexus.components.interactivity.InputHandler org.apache.maven.settings.MavenSettingsBuilder mule-2.0.1/tools/bobberplus/src/main/mdo/0000755000175000017500000000000011351410664020072 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/main/mdo/bobberarchetype.mdo0000644000175000017500000000755210611673117023746 0ustar charlescharles bobberarchetype BobberArchetype package com.javaforge.bobber.archetype.model BobberArchetype Describes the assembly layout and packaging. 1.0.0 id 1.0.0 true String allowPartial 1.0.0 true boolean variables 1.0.0 Variable * templates 1.0.0 Template * Variable 1.0.0 name 1.0.0 true String description 1.0.0 String defvalue 1.0.0 true String variables 1.0.0 Variable * Template 1.0.0 file 1.0.0 true String output 1.0.0 true String dependsOnVar If the specified variable is true, the template will be processed, otherwise skipped. 1.0.0 false String mule-2.0.1/tools/bobberplus/src/site/0000755000175000017500000000000011351410664017333 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/site/site.xml0000644000175000017500000000113110611673117021017 0ustar charlescharles Bobber http://maven.apache.org/images/apache-maven-project.png http://maven.apache.org/ http://maven.apache.org/images/maven-small.gif ${reports} mule-2.0.1/tools/bobberplus/src/site/apt/0000755000175000017500000000000011351410664020117 5ustar charlescharlesmule-2.0.1/tools/bobberplus/src/site/apt/usage.apt0000644000175000017500000001606310611673117021741 0ustar charlescharles ------ How to use Bobber Archetypes ------ Overview Maven 2 introduced the concept of archetypes which allow a developer to create maven project templates that could be invoked by a developer to create a new project instance. The ability to create maven templates promotes project standardization and expedites maven project developement by automatically generating boilerplate code. The archetype functionality uses the Velocity templating engine to generate the POM file. There are a few limitations with the new archetype functionality. First only the POM file is processed as a velocity template. Second only four system properties are passed into the Velocity engine so one those four variables may be used in templates. Also although archetype-resource files are included in an archetype generated by the default archetype plugin only those files listed in the archetype descriptor are extracted when an archetype is created. Finally the default archetype support does not allow for template renaming which could be used to change the package/directory structure of generated archetype Java files. The Bobber archetype plugin attempts to address those limitations by redefining the archetype descriptor and implementation. The Bobber archetype plugin uses a new descriptor file that defines all the template variables the archetype uses along with default values. When an archetype is created and interactive mode is enabled in the maven 2 settings the values for the variables will be prompted to the maven user, the default being either the system property value set on the command line or the default value from the archetype descriptor. The second section of the archetype descriptor contains velocity template paths in the archetype and the paths that the generated output is to be stored. The Bobber archetype extracts all files from the archetype except for the archetype resources file and Velocity template files that end with .vm to the file sytem in addition to the processed templates. Using the Bobber Archetype * Install Bobber ** Configuring Maven Add Bobber to the pluginGroup portion of the ~/.m2/settings.xml . If this file does not exist, create it with the following values: ------------------------------------------------- com.javaforge.bobber ------------------------------------------------- The global settings.xml is located in the maven 2 installation directory under conf. next add the Bobber plugin repository the to ~/.m2/settings.xml or $MAVEN_HOME/conf/settings.xml for setting it globally: ------------------------------------------------- com.javaforge.bobber mortbay-repo mortbay-repo http://SOMEURL GOES HERE ------------------------------------------------- Once the environment is set one can create an archetype. Use the exact same procedure as creating a default maven archetype except use the new format for the archetype descriptor. The following variables are required for archetype generation, just as in the default archetype plugin. ------------------------------------------------- package packageName groupId artifactId version ------------------------------------------------- If package is not set with a value then groupid is used. packagePath is a computed value based on the package converting the . to / that is also available to vm templates in addition to the variables above. Additional variables that are used by templates must be declared in the archetype descriptor. ------------------------------------------------------------------------------------------------------------------ ... ComponentName JBI Component Name JBI ... ------------------------------------------------------------------------------------------------------------------ The name is the name used in the templates. If maven interactive mode is enabled it is also displayed along with the description on the terminal when the value for the variable is prompted for. The defvalue is the default value to use if a value is not specified on the command line. Currently the element does not support Velocity ML. Use the extension .vm for all velocity templates in the archetype. Make sure to add new Template entries in the archetype descriptor for the templates, using the location in the archeype as the file element and the new location in the generated POM as the output element. The output can be a static string or a Velocity ML string that will be proccessed by the Velocity engine, ie. For file /archetype-resources/src/main/java/MyClass.vm specifying a archetype descriptor: ------------------------------------------------------------------------------------------------------------------ my project aVariable a variable used in a Velocity template aValue ------------------------------------------------------------------------------------------------------------------ To create an archtype, use the following syntax, the same as the default archetype:create plugin : ------------------------------------------------------------------------------------------------------------------ mvn bobber-archetype:create -DarchetypeGroupId=com.javaforge.bobber -DarchetypeArtifactId=maven-archetype-jbi-component \ -DarchetypeVersion=1.0-SNAPSHOT -DgroupId=org.bobber.test -DartifactId=SPML ------------------------------------------------------------------------------------------------------------------ One can disable interactive mode by setting the flag (lookup flag) or set new values for variables defined in the archetype descriptor by setting the values on the command line: ------------------------------------------------------------------------------------------------------------------ mvn bobber-archetype:create -B -DarchetypeGroupId=com.javaforge.bobber -DarchetypeArtifactId=maven-archetype-jbi-component \ -DarchetypeVersion=1.0-SNAPSHOT -DgroupId=org.bobber.test -DartifactId=SPML -DComponentName=SPML ------------------------------------------------------------------------------------------------------------------ mule-2.0.1/tools/bobberplus/pom.xml0000644000175000017500000000475511006063605017124 0ustar charlescharles 4.0.0 org.mule.tools mule-tools 2.0.1 bobberplus maven-plugin BobberPlus Archetype Plugin Extended Bobber Custom Archetype Creator org.apache.maven maven-plugin-api RELEASE org.apache.maven maven-settings RELEASE org.apache.maven maven-archetype-core RELEASE org.codehaus.plexus plexus-utils 1.4.3 org.codehaus.plexus plexus-interactivity-api 1.0-alpha-6 org.codehaus.modello modello-maven-plugin xpp3-reader xpp3-writer java src/main/mdo/bobberarchetype.mdo 1.0.0 mule-2.0.1/tools/schemadocs/0000755000175000017500000000000011351410665015553 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/0000755000175000017500000000000011351410665016342 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/main/0000755000175000017500000000000011351410665017266 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/main/java/0000755000175000017500000000000011351410665020207 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/main/java/org/0000755000175000017500000000000011351410665020776 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/main/java/org/mule/0000755000175000017500000000000011351410665021740 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/main/java/org/mule/tools/0000755000175000017500000000000011351410665023100 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/main/java/org/mule/tools/schemadocs/0000755000175000017500000000000011351410665025211 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/main/java/org/mule/tools/schemadocs/SchemaDocsMain.java0000644000175000017500000002470310764243005030677 0ustar charlescharles/* * $Id: SchemaDocsMain.java 11248 2008-03-07 13:41:25Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tools.schemadocs; import org.mule.util.IOUtils; import java.io.File; import java.io.FileOutputStream; import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.JarURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.Arrays; import java.util.Enumeration; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.jar.JarEntry; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Source; import javax.xml.transform.Templates; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; public class SchemaDocsMain { public static final String BACKUP = ".bak"; public static final String XSD = ".xsd"; public static final String MULE = "mule"; public static final String TAG = "tag"; public static final String XSL_FILE = "rename-tag.xsl"; public static final List TARGET_PATH = Arrays.asList(new String[]{"tools", "schemadocs", "target"}); public static final String[] BLOCKED = new String[]{"wssecurity"}; protected final Log logger = LogFactory.getLog(getClass()); public static void main(String[] args) throws IOException, TransformerException, ParserConfigurationException { if (null == args || args.length != 3) { throw new IllegalArgumentException("Needs 3 arguments: prefix, postfix and destination"); } new SchemaDocsMain(args[0], args[1], args[2]); } public SchemaDocsMain(String prefix, String postfix, String normalizedPath) throws IOException, TransformerException, ParserConfigurationException { logger.info("Generating " + normalizedPath); logger.debug("prefix: " + prefix); logger.debug("postfix: " + postfix); File normalized = inTargetDir(normalizedPath); backup(normalized); InputStream xslSource = IOUtils.getResourceAsStream(XSL_FILE, getClass()); if (null == xslSource) { throw new IllegalStateException("Cannot open " + XSL_FILE); } create(normalized, false); OutputStream out = new FileOutputStream(normalized); logger.debug("out: " + out); OutputStreamWriter outWriter = new OutputStreamWriter(out); IOUtils.copy(IOUtils.getResourceAsStream(prefix, getClass()), outWriter); outWriter.flush(); processSchema(xslSource, out); out.flush(); IOUtils.copy(IOUtils.getResourceAsStream(postfix, getClass()), outWriter); outWriter.close(); } protected void create(File file, boolean dir) throws IOException { if (!file.getParentFile().exists()) { create(file.getParentFile(), true); } logger.debug("creating " + file); if (dir) { file.mkdir(); } else { file.createNewFile(); } } // if possible, and path not absolute, place in target directory protected File inTargetDir(String path) { if (path.startsWith(File.separator)) { return new File(path); } else { File dir = new File("."); Iterator dirs = TARGET_PATH.iterator(); boolean foundPath = false; while (dirs.hasNext()) { File next = new File(dir, (String) dirs.next()); if (next.exists()) { foundPath = true; dir = next; } else if (foundPath) { // in this case we started down the path, but failed // (this avoids us placing the file somewhere other than "target" // to workaround, specify absolute path) throw new IllegalArgumentException("Could not find " + next + " while placing in target directory"); } } File target = new File(dir, path); logger.info("Target: " + target); return target; } } protected void processSchema(InputStream xslSource, OutputStream out) throws TransformerException, IOException, ParserConfigurationException { TransformerFactory factory = TransformerFactory.newInstance(); Templates template = factory.newTemplates(new StreamSource(xslSource)); Transformer xformer = template.newTransformer(); Iterator urls = listSchema2().iterator(); while (urls.hasNext()) { URL url = (URL) urls.next(); String tag = tagFromFileName(url.getFile()); logger.info(tag + " : " + url); xformer.setParameter(TAG, tag); Source source = new StreamSource(url.openStream()); xformer.transform(source, new StreamResult(out)); // xformer.transform(source, new StreamResult(System.out)); out.flush(); } } // this avoids using File objects since we may be dealing with classpath jars etc etc protected static String tagFromFileName(String name) { String dropExtension = toLeftOf(name, ".", name); String dropSlash = toRightOf(dropExtension, "/", dropExtension, true); String dropBackslash = toRightOf(dropSlash, "\\", dropSlash, true); return toRightOf(dropBackslash, "-", "mule", false); } protected static String toRightOf(String text, String delim, String deflt, boolean far) { int index = far ? text.lastIndexOf(delim) : text.indexOf(delim); if (index > -1) { return text.substring(index+1); } else { return deflt; } } protected static String toLeftOf(String text, String delim, String deflt) { int index = text.lastIndexOf(delim); if (index > -1) { return text.substring(0, index); } else { return deflt; } } // for some reason, this doesn't work protected List listSchema1() throws IOException { PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(getClass().getClassLoader()); Resource[] resources = resolver.getResources("**/META-INF/*.xsd"); List list = new LinkedList(); for (int i = 0; i < resources.length; ++i) { list.add(resources[i].getURL()); } return list; } // this is a bit ad-hoc, but seems to work efficiently // http://forum.java.sun.com/thread.jspa?threadID=286026&messageID=1119510 protected List listSchema2() throws IOException { ClassLoader loader = getClass().getClassLoader(); List files = new LinkedList(); Enumeration resources = loader.getResources("META-INF"); FilenameFilter filter = new FilenameFilter() { public boolean accept(File dir, String name) { if (name.startsWith(MULE) && name.endsWith(XSD)) { for (int i = 0; i < BLOCKED.length; ++i) { if (name.indexOf(BLOCKED[i]) > -1) { return false; } } return true; } else { return false; } } }; while (resources.hasMoreElements()) { URL url = (URL) resources.nextElement(); logger.debug("url: " + url); if (url.toString().startsWith("jar:")) { readFromJar(url, files); } else if ("file".equals(url.getProtocol())) { readFromDirectory(new File(url.getFile()), files, filter); } } return files; } // this is used from within idea protected void readFromDirectory(File dir, List files, FilenameFilter filter) throws MalformedURLException { String[] names = dir.list(filter); for (int i = 0; i < names.length; ++i) { String name = names[i]; logger.debug("file: " + name); files.add(new File(dir, name).toURL()); } } // this is used from within maven protected void readFromJar(URL jarUrl, List resources) throws IOException { JarURLConnection jarConnection = (JarURLConnection) jarUrl.openConnection(); Enumeration entries = jarConnection.getJarFile().entries(); while (entries.hasMoreElements()) { JarEntry entry = (JarEntry) entries.nextElement(); String name = new File(entry.getName()).getName(); if (name.startsWith(MULE) && name.endsWith(XSD)) { logger.debug("entry: " + entry); resources.add(new URL(jarUrl, entry.getName())); } } } protected void backup(File file) throws IOException { if (file.exists()) { File backup = new File(file.getAbsoluteFile().getParent(), file.getName() + BACKUP); if (backup.exists()) { logger.debug("deleting " + backup.getCanonicalPath()); backup.delete(); } logger.debug("renaming " + file.getCanonicalPath() + " to " + backup.getCanonicalPath()); file.renameTo(backup); } } } mule-2.0.1/tools/schemadocs/src/main/resources/0000755000175000017500000000000011351410665021300 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/main/resources/transport-to-wiki.xsl0000644000175000017500000000621010766463006025452 0ustar charlescharles h2. Detailed Configuration Information * [ connector|#-] * [Global endpoint|#-] * [|#-] {cache:showDate=true|showRefresh=true} {xslt:style=#http://svn.codehaus.org/mule/branches/mule-2.0.x/tools/schemadocs/src/main/resources/xslt/single-element.xsl|source=#http://dev.mulesource.com/docs/xsd-doc/normalized.xsd|elementName=:} {xslt} {cache} \\ mule-2.0.1/tools/schemadocs/src/main/resources/log4j.properties0000644000175000017500000000052510712347752024445 0ustar charlescharles # default properties to initialise log4j log4j.rootLogger=WARN, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%d{MM-dd HH:mm:ss}] %-5p %c{1} [%t]: %m%n # this is used when running the schema normalizer #log4j.logger.org.mule=DEBUG mule-2.0.1/tools/schemadocs/src/main/resources/full-doc-html.xsl0000644000175000017500000001435410754365306024515 0ustar charlescharles
    start element end element start element reference end element reference
    start complexType end complexType start complexContent end complexContent start extension end extension start sequence end sequence start group reference end group reference start group end group start choice end choice
    mule-2.0.1/tools/schemadocs/src/main/resources/default-links.xsl0000644000175000017500000000240010754365306024575 0ustar charlescharles SchemaBasics mule-2.0.1/tools/schemadocs/src/main/resources/links.xml0000644000175000017500000007406610774266536023175 0ustar charlescharles mule:modelConfiguring+Models mule:serviceConfiguring+Models mule:custom-serviceConfiguring+Models mule:inboundConfiguring+Models mule:outboundConfiguring+Models mule:async-replyConfiguring+Models mule:componentConfiguring+Models mule:component-threading-profileConfiguring+Models mule:bridge-componentConfiguring+Models mule:echo-componentConfiguring+Models mule:log-componentConfiguring+Models mule:null-componentConfiguring+Models mule:default-service-exception-strategyConfiguring+Models mule:default-connector-exception-strategyConfiguring+Models mule:custom-exception-strategyConfiguring+Models mule:legacy-entry-point-resolver-setConfiguring+Models mule:entry-point-resolver-setConfiguring+Models mule:custom-entry-point-resolver-setConfiguring+Models mule:callable-entry-point-resolverConfiguring+Models mule:custom-entry-point-resolverConfiguring+Models mule:property-entry-point-resolverConfiguring+Models mule:method-entry-point-resolverConfiguring+Models mule:reflection-entry-point-resolverConfiguring+Models mule:array-entry-point-resolverConfiguring+Models mule:no-arguments-entry-point-resolverConfiguring+Models mule:exclude-object-methodsConfiguring+Models mule:exclude-entry-pointConfiguring+Models mule:include-entry-pointConfiguring+Models mule:queue-profileConfiguring+Models mule:logging-catch-all-strategyConfiguring+Models mule:custom-catch-all-strategyConfiguring+Models mule:forwarding-catch-all-strategyConfiguring+Models mule:custom-forwarding-catch-all-strategyConfiguring+Models mule:idempotent-secure-hash-receiver-routerConfiguring+Models mule:inbound-pass-through-routerConfiguring+Models mule:idempotent-receiver-routerConfiguring+Models mule:wire-tap-routerConfiguring+Models mule:forwarding-routerConfiguring+Models mule:selective-consumer-routerConfiguring+Models mule:correlation-resequencer-routerConfiguring+Models mule:message-chunking-aggregator-routerConfiguring+Models mule:custom-correlation-aggregator-routerConfiguring+Models mule:custom-inbound-routerConfiguring+Models mule:spring-objectConfiguring+Models mule:singleton-objectConfiguring+Models mule:prototype-objectConfiguring+Models mule:pooled-objectConfiguring+Models mule:bindingConfiguring+Models mule:pooling-profileConfiguring+Models mule:outbound-pass-through-routerConfiguring+Models mule:filtering-routerConfiguring+Models mule:chaining-routerConfiguring+Models mule:exception-based-routerConfiguring+Models mule:multicasting-routerConfiguring+Models mule:template-endpoint-routerConfiguring+Models mule:endpoint-selector-routerConfiguring+Models mule:list-message-splitter-routerConfiguring+Models mule:message-chunking-routerConfiguring+Models mule:static-recipient-list-routerConfiguring+Models mule:custom-outbound-routerConfiguring+Models mule:propertyAdditional+Configuration mule:propertiesAdditional+Configuration mule:jndi-provider-propertyAdditional+Configuration mule:jndi-provider-propertiesAdditional+Configuration mule:custom-transactionAdditional+Configuration mule:filterAdditional+Configuration mule:not-filterAdditional+Configuration mule:and-filterAdditional+Configuration mule:or-filterAdditional+Configuration mule:wildcard-filterAdditional+Configuration mule:regex-filterAdditional+Configuration mule:message-property-filterAdditional+Configuration mule:exception-type-filterAdditional+Configuration mule:payload-type-filterAdditional+Configuration mule:custom-filterAdditional+Configuration mule:custom-property-extractorAdditional+Configuration mule:map-property-extractorAdditional+Configuration mule:message-property-extractorAdditional+Configuration mule:correlation-property-extractorAdditional+Configuration mule:function-property-extractorAdditional+Configuration mule:transformerAdditional+Configuration mule:custom-transformerAdditional+Configuration mule:message-properties-transformerAdditional+Configuration mule:no-action-transformerAdditional+Configuration mule:base64-encoder-transformerAdditional+Configuration mule:base64-decoder-transformerAdditional+Configuration mule:xml-entity-encoder-transformerAdditional+Configuration mule:xml-entity-decoder-transformerAdditional+Configuration mule:gzip-compress-transformerAdditional+Configuration mule:gzip-uncompress-transformerAdditional+Configuration mule:byte-array-to-hex-string-transformerAdditional+Configuration mule:hex-string-to-byte-array-transformerAdditional+Configuration mule:byte-array-to-object-transformerAdditional+Configuration mule:object-to-byte-array-transformerAdditional+Configuration mule:object-to-string-transformerAdditional+Configuration mule:byte-array-to-serializable-transformerAdditional+Configuration mule:serializable-to-byte-array-transformerAdditional+Configuration mule:byte-array-to-string-transformerAdditional+Configuration mule:string-to-byte-array-transformerAdditional+Configuration mule:append-string-transformerAdditional+Configuration mule:encrypt-transformerAdditional+Configuration mule:decrypt-transformerAdditional+Configuration mule:expression-transformerAdditional+Configuration mule:encryption-security-filterAdditional+Configuration mule:inbound-endpointConfiguring+Endpoints mule:outbound-endpointConfiguring+Endpoints mule:endpointConfiguring+Endpoints mule:transformersConfiguring+Endpoints mule:response-transformersConfiguring+Endpoints mule:receiver-threading-profileGeneral+Transport+Configuration mule:dispatcher-threading-profileGeneral+Transport+Configuration mule:service-overridesGeneral+Transport+Configuration axis:connectorAxis+Transport axis:inbound-endpointAxis+Transport axis:outbound-endpointAxis+Transport axis:endpointAxis+Transport axis:optionsAxis+Transport axis:optionAxis+Transport axis:bean-typeAxis+Transport axis:soap-serviceAxis+Transport axis:soap-methodAxis+Transport axis:soap-parameterAxis+Transport axis:soap-returnAxis+Transport axis:supported-schemeAxis+Transport bpm:connectorBPM+Transport bpm:inbound-endpointBPM+Transport bpm:outbound-endpointBPM+Transport bpm:endpointBPM+Transport cxf:connectorCXF+Transport cxf:inbound-endpointCXF+Transport cxf:outbound-endpointCXF+Transport cxf:endpointCxf+Transport cxf:featuresCxf+Transport ejb:connectorEJB+Transport ejb:inbound-endpointEJB+Transport ejb:outbound-endpointEJB+Transport ejb:endpointEJB+Transport email:email-to-string-transformerEmail+Transport email:string-to-email-transformerEmail+Transport email:object-to-mime-transformerEmail+Transport email:mime-to-bytes-transformerEmail+Transport email:bytes-to-mime-transformerEmail+Transport file:connectorFile+Transport file:filename-parserFile+Transport file:inbound-endpointFile+Transport file:outbound-endpointFile+Transport file:endpointFile+Transport file:filename-wildcard-filterFile+Transport file:file-to-byte-array-transformerFile+Transport file:file-to-string-transformerFile+Transport ftp:connectorFTP+Transport ftp:filename-parserFTP+Transport ftp:inbound-endpointFTP+Transport ftp:outbound-endpointFTP+Transport ftp:endpointFTP+Transport http:connectorHTTP+Transport http:rest-service-componentHTTP+Transport http:payloadParameterNameHTTP+Transport http:requiredParameterHTTP+Transport http:optionalParameterHTTP+Transport http:http-client-response-to-object-transformerHTTP+Transport http:http-response-to-string-transformerHTTP+Transport http:object-to-http-client-request-transformerHTTP+Transport http:message-to-http-response-transformerHTTP+Transport http:inbound-endpointHTTP+Transport http:outbound-endpointHTTP+Transport http:endpointHTTP+Transport https:connectorHTTPS+Transport https:tls-clientHTTPS+Transport https:tls-key-storeHTTPS+Transport https:tls-serverHTTPS+Transport https:tls-protocol-handlerHTTPS+Transport https:inbound-endpointHTTPS+Transport https:outbound-endpointHTTPS+Transport https:endpointHTTPS+Transport imap:connectorIMAP+Transport imap:inbound-endpointIMAP+Transport imap:endpointIMAP+Transport imaps:connectorIMAPS+Transport imaps:tls-clientIMAPS+Transport imaps:tls-trust-storeIMAPS+Transport imaps:inbound-endpointIMAPS+Transport imaps:endpointIMAPS+Transport jdbc:connectorJDBC+Transport jdbc:inbound-endpointJDBC+Transport jdbc:outbound-endpointJDBC+Transport jdbc:endpointJDBC+Transport jdbc:transactionJDBC+Transport jdbc:queryJDBC+Transport jetty:connectorJetty+Transport jetty:inbound-endpointJetty+Transport jetty:outbound-endpointJetty+Transport jetty:endpointJetty+Transport jms:connectorJMS+Transport jms:custom-connectorJMS+Transport jms:activemq-connectorJMS+Transport jms:activemq-xa-connectorJMS+Transport jms:weblogic-connectorJMS+Transport jms:websphere-connectorJMS+Transport jms:transactionJMS+Transport jms:client-ack-transactionJMS+Transport jms:xa-transactionJMS+Transport jms:jmsmessage-to-object-transformerJMS+Transport jms:object-to-jmsmessage-transformerJMS+Transport jms:inbound-endpointJMS+Transport jms:outbound-endpointJMS+Transport jms:endpointJMS+Transport jms:selectorJMS+Transport jms:property-filterJMS+Transport jnp:connectorJNP+Transport jnp:inbound-endpointJNP+Transport jnp:outbound-endpointJNP+Transport jnp:endpointJNP+Transport multicast:connectorMulticast+Transport multicast:inbound-endpointMulticast+Transport multicast:outbound-endpointMulticast+Transport multicast:endpointMulticast+Transport pop3:connectorPOP3+Transport pop3:inbound-endpointPOP3+Transport pop3:endpointPOP3+Transport pop3s:connectorPOP3S+Transport pop3s:tls-clientPOP3S+Transport pop3s:tls-trust-storePOP3S+Transport pop3s:inbound-endpointPOP3S+Transport pop3s:endpointPOP3S+Transport quartz:connectorQuartz+Transport quartz:factory-propertyQuartz+Transport quartz:factory-propertiesQuartz+Transport quartz:outbound-endpointQuartz+Transport quartz:endpointQuartz+Transport rmi:connectorRMI+Transport rmi:inbound-endpointRMI+Transport rmi:outbound-endpointRMI+Transport rmi:endpointRMI+Transport servlet:connectorServlet+Transport servlet:inbound-endpointServlet+Transport servlet:outbound-endpointServlet+Transport servlet:endpointServlet+Transport smtp:connectorSMTP+Transport smtp:headerSMTP+Transport smtp:outbound-endpointSMTP+Transport smtp:endpointSMTP+Transport smtps:connectorSMTPS+Transport smtps:headerSMTPS+Transport smtps:tls-clientSMTPS+Transport smtps:tls-trust-storeSMTPS+Transport smtps:outbound-endpointSMTPS+Transport smtps:endpointSMTPS+Transport soap:http-to-soap-request-transformerSOAP+Transport ssl:connectorSSL+Transport ssl:clientSSL+Transport ssl:key-storeSSL+Transport ssl:serverSSL+Transport ssl:protocol-handlerSSL+Transport ssl:inbound-endpointSSL+Transport ssl:outbound-endpointSSL+Transport ssl:endpointSSL+Transport stdio:connectorSTDIO+Transport stdio:inbound-endpointSTDIO+Transport stdio:outbound-endpointSTDIO+Transport stdio:endpointSTDIO+Transport tcp:connectorTCP+Transport tcp:streaming-protocolTCP+Transport tcp:xml-protocolTCP+Transport tcp:xml-eof-protocolTCP+Transport tcp:eof-protocolTCP+Transport tcp:direct-protocolTCP+Transport tcp:safe-protocolTCP+Transport tcp:length-protocolTCP+Transport tcp:custom-protocolTCP+Transport tcp:inbound-endpointTCP+Transport tcp:outbound-endpointTCP+Transport tcp:endpointTCP+Transport tls:connectorTLS+Transport tls:clientTLS+Transport tls:key-storeTLS+Transport tls:serverTLS+Transport tls:protocol-handlerTLS+Transport tls:inbound-endpointTLS+Transport tls:outbound-endpointTLS+Transport tls:endpointTLS+Transport udp:connectorUDP+Transport udp:inbound-endpointUDP+Transport udp:outbound-endpointUDP+Transport udp:endpointUDP+Transport vm:connectorVM+Transport vm:queueProfileVM+Transport vm:inbound-endpointVM+Transport vm:outbound-endpointVM+Transport vm:endpointVM+Transport wsdl-xfire:inbound-endpointWSDL-XFire+Transport wsdl-xfire:outbound-endpointWSDL-XFire+Transport wsdl-xfire:endpointWSDL-XFire+Transport xfire:connectorXFire+Transport xfire:client-in-handlerXFire+Transport xfire:client-out-handlerXFire+Transport xfire:client-serviceXFire+Transport xfire:server-in-handlerXFire+Transport xfire:server-out-handlerXFire+Transport xfire:inbound-endpointXFire+Transport xfire:outbound-endpointXFire+Transport xfire:endpointXFire+Transport xfire:soap-11-transportXFire+Transport xfire:complex-typeXFire+Transport xmpp:connectorXMPP+Transport xmpp:inbound-endpointXMPP+Transport xmpp:outbound-endpointXMPP+Transport xmpp:endpointXMPP+Transport xmpps:connectorXMPPS+Transport xmpps:inbound-endpointXMPPS+Transport xmpps:outbound-endpointXMPPS+Transport xmpps:endpointXMPPS+Transport acegi:security-managerAcegi+Module acegi:delegate-security-providerAcegi+Module acegi:security-propertyAcegi+Module acegi:http-security-filterAcegi+Module client:remote-dispatcher-agentClient+Module client:remote-endpointClient+Module client:xml-wire-formatClient+Module client:serialization-wire-formatClient+Module client:custom-wire-formatClient+Module jaas:security-managerJAAS+Module jaas:password-encryption-strategyJAAS+Module jaas:security-providerJAAS+Module jaas:jaas-security-filterJAAS+Module jbossts:transaction-managerJBossTS+Module management:jmx-serverManagement+Module management:connector-serverManagement+Module management:credentialsManagement+Module management:jmx-mx4j-adaptorManagement+Module management:socketFactoryPropertiesManagement+Module management:rmi-serverManagement+Module management:jmx-log4jManagement+Module management:jmx-default-configManagement+Module management:credentialsManagement+Module management:jmx-notificationsManagement+Module management:log4j-notificationsManagement+Module management:level-mappingManagement+Module management:chainsaw-notificationsManagement+Module management:level-mappingManagement+Module management:publish-notificationsManagement+Module management:yourkit-profilerManagement+Module management:custom-agentManagement+Module ognl:filterOGNL+Module ognl:expressionOGNL+Module pgp:security-managerPGP+Module pgp:security-providerPGP+Module pgp:keybased-encryption-strategyPGP+Module pgp:security-filterPGP+Module scripting:scriptScripting+Module scripting:groovy-refreshableScripting+Module scripting:langScripting+Module xml:is-xml-filterXML+Module xml:jxpath-filterXML+Module xml:namespaceXML+Module xml:context-propertyXML+Module xml:message-splitterXML+Module xml:namespaceXML+Module xml:round-robin-splitterXML+Module xml:dom-to-xml-transformerXML+Module xml:dom-to-output-handler-transformerXML+Module xml:jxpath-extractor-transformerXML+Module xml:object-to-xml-transformerXML+Module xml:xml-to-dom-transformerXML+Module xml:xml-to-object-transformerXML+Module xml:xslt-transformerXML+Module xml:xslt-textXML+Module xml:context-propertyXML+Module xml:xml-prettyprinter-transformerXML+Module xml:jxpath-property-extractorXML+Module xml:xpath-property-extractorXML+Module xml:bean-property-extractorXML+Module mule-2.0.1/tools/schemadocs/src/main/resources/schemadoc-prefix.txt0000644000175000017500000000121010754365306025263 0ustar charlescharles mule-2.0.1/tools/schemadocs/src/main/resources/xslt/0000755000175000017500000000000011351410665022272 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/main/resources/xslt/single-element.xsl0000644000175000017500000000305110766463006025737 0ustar charlescharles mule-2.0.1/tools/schemadocs/src/main/resources/xslt/transport-or-module.xsl0000644000175000017500000000561410766463006026773 0ustar charlescharles

    Detailed Configuration Information

  • mule-2.0.1/tools/schemadocs/src/main/resources/xslt/schemadoc-core.xsl0000644000175000017500000005017210766463006025711 0ustar charlescharles

    < ...>

    Attributes

    Name Type Required Default Description

    Child Elements

    Name Description

    From reference for element .

    From declaration of element .

    From declaration of type . From type declaration.

    / yes no

    A element

    The following elements can be used here:

    This is an abstract element; another element with a compatible type must be used in its place. However, no replacements were found when generating this documentation.

  • This element can be used as a substitute for < ...>

    integer boolean long port number class name name (no spaces) name list of names #- -
    mule-2.0.1/tools/schemadocs/src/main/resources/transport-to-links.xsl0000644000175000017500000000261510766463006025634 0ustar charlescharles :+ mule-2.0.1/tools/schemadocs/src/main/resources/schemadoc-postfix.txt0000644000175000017500000000111110763014436025455 0ustar charlescharles A Spring property definition. This allows an arbitrary value to be set on the parent object being created. Typically this is used only when configuring custom classes which do not have a specific schema. See Spring documentation for further details (the "bean" on which this value is set should be clear from the context - it is typically a filter, transformer, etc).
    mule-2.0.1/tools/schemadocs/src/main/resources/rename-tag.xsl0000644000175000017500000001200510760554453024055 0ustar charlescharles mule-2.0.1/tools/schemadocs/src/test/0000755000175000017500000000000011351410665017321 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/test/java/0000755000175000017500000000000011351410665020242 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/test/java/org/0000755000175000017500000000000011351410665021031 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/test/java/org/mule/0000755000175000017500000000000011351410665021773 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/test/java/org/mule/tools/0000755000175000017500000000000011351410665023133 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/test/java/org/mule/tools/schemadocs/0000755000175000017500000000000011351410665025244 5ustar charlescharlesmule-2.0.1/tools/schemadocs/src/test/java/org/mule/tools/schemadocs/PathTestCase.java0000644000175000017500000000204410764243005030436 0ustar charlescharles/* * $Id: PathTestCase.java 11248 2008-03-07 13:41:25Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package org.mule.tools.schemadocs; import junit.framework.TestCase; public class PathTestCase extends TestCase { public void testTagFromFileName() { assertEquals("quartz", SchemaDocsMain.tagFromFileName("/opt/j2ee/data/bamboo/xml-data/build-dir/MULE-MULEV20X/transports/quartz/target/mule-transport-quartz-2.0.0-RC3-SNAPSHOT.jar!/META-INF/mule-quartz.xsd")); assertEquals("foo-bar", SchemaDocsMain.tagFromFileName("/opt/j2ee/data/bamboo/xml-data/build-dir/MULE-MULEV20X/transports/quartz/target/mule-transport-quartz-2.0.0-RC3-SNAPSHOT.jar!/META-INF/mule-foo-bar.xsd")); } } mule-2.0.1/tools/schemadocs/src/test/resources/0000755000175000017500000000000011351410665021333 5ustar charlescharlesmule-2.0.1/tools/schemadocs/pom.xml0000644000175000017500000002245511006063605017073 0ustar charlescharles 4.0.0 org.mule.tools mule-tools 2.0.1 mule-tools-schemadocs jar Schema Docs These are the tools used to generate docs from schema org.mule.tests mule-tests-functional ${version} test org.mule mule-core ${version} org.mule.transports mule-transport-axis ${version} org.mule.transports mule-transport-bpm ${version} org.mule.transports mule-transport-cxf ${version} org.mule.transports mule-transport-ejb ${version} org.mule.transports mule-transport-email ${version} org.mule.transports mule-transport-file ${version} org.mule.transports mule-transport-ftp ${version} org.mule.transports mule-transport-http ${version} org.mule.transports mule-transport-jbpm ${version} org.mule.transports mule-transport-jdbc ${version} org.mule.transports mule-transport-jms ${version} org.mule.transports mule-transport-multicast ${version} org.mule.transports mule-transport-quartz ${version} org.mule.transports mule-transport-rmi ${version} org.mule.transports mule-transport-soap ${version} org.mule.transports mule-transport-ssl ${version} org.mule.transports mule-transport-stdio ${version} org.mule.transports mule-transport-tcp ${version} org.mule.transports mule-transport-udp ${version} org.mule.transports mule-transport-vm ${version} org.mule.transports mule-transport-xmpp ${version} org.mule.modules mule-module-acegi ${version} org.mule.modules mule-module-client ${version} org.mule.modules mule-module-jaas ${version} org.mule.modules mule-module-jbossts ${version} org.mule.modules mule-module-management ${version} org.mule.modules mule-module-ognl ${version} org.mule.modules mule-module-pgp ${version} org.mule.modules mule-module-scripting ${version} org.mule.modules mule-module-spring-config ${version} org.mule.modules mule-module-spring-extras ${version} org.mule.modules mule-module-xml ${version} schemadocs org.codehaus.mojo exec-maven-plugin process-classes org.mule.tools.schemadocs.SchemaDocsMain schemadoc-prefix.txt schemadoc-postfix.txt /www/html/docs/xsd-doc/normalized.xsd java mule-2.0.1/tools/installer/0000755000175000017500000000000011351410675015440 5ustar charlescharlesmule-2.0.1/tools/installer/distribution/0000755000175000017500000000000011351410665020156 5ustar charlescharlesmule-2.0.1/tools/installer/resources/0000755000175000017500000000000011351410675017452 5ustar charlescharlesmule-2.0.1/tools/installer/resources/LICENSE.txt0000644000175000017500000006623410672263414021312 0ustar charlescharlesCommon Public Attribution License Version 1.0 (CPAL) 1. "Definitions" 1.0.1 "Commercial Use" means distribution or otherwise making the Covered Code available to a third party. 1.1 "Contributor" means each entity that creates or contributes to the creation of Modifications. 1.2 "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. 1.3 "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. 1.4 "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data. 1.5 "Executable" means Covered Code in any form other than Source Code. 1.6 "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. 1.7 "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. 1.8 "License" means this document. 1.8.1 "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 1.9 "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is: A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. B. Any new file that contains any part of the Original Code or previous Modifications. 1.10 "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. 1.10.1 "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. 1.11 "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. 1.12 "You" (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. Source Code License. 2.1 The Initial Developer Grant. The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and (b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof). (c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License. (d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices. 2.2 Contributor Grant. Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). (c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code. (d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor. 3. Distribution Obligations. 3.1 Application of License. The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. 3.2 Availability of Source Code. Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. 3.3 Description of Modifications. You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. 3.4 Intellectual Property Matters (a) Third Party Claims. If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. (b) Contributor APIs. If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file. (c) Representations. Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License. 3.5 Required Notices. You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 3.6 Distribution of Executable Versions. You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer, Original Developer or any Contributor. You hereby agree to indemnify the Initial Developer, Original Developer and every Contributor for any liability incurred by the Initial Developer, Original Developer or such Contributor as a result of any such terms You offer. 3.7 Larger Works. You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. 4. Inability to Comply Due to Statute or Regulation. If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Application of this License. This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code. 6. Versions of the License. 6.1 New Versions. MuleSource, Inc. ("MuleSource") may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. 6.2 Effect of New Versions. Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Socialtext. No one other than MuleSource has the right to modify the terms applicable to Covered Code created under this License. 6.3 Derivative Works. If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases "MuleSource", "CPAL" or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the CPAL. (Filling in the name of the Initial Developer, Original Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.) 7. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER, ORIGINAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 8. TERMINATION. 8.1 This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 8.2 If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer, Original Developer or a Contributor (the Initial Developer, Original Developer or Contributor against whom You file such action is referred to as "Participant") alleging that: (a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above. (b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant. 8.3 If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license. 8.4 In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination. 9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ORIGINAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 10. U.S. GOVERNMENT END USERS. The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. 11. MISCELLANEOUS. This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. 12. RESPONSIBILITY FOR CLAIMS. As between Initial Developer, Original Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer, Original Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. 13. MULTIPLE-LICENSED CODE. Initial Developer may designate portions of the Covered Code as Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the CPAL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A. 14. ADDITIONAL TERM: ATTRIBUTION (a) As a modest attribution to the organizer of the development of the Original Code ("Original Developer"), in the hope that its promotional value may help justify the time, money and effort invested in writing the Original Code, the Original Developer may include in Exhibit B ("Attribution Information") a requirement that each time an Executable and Source Code or a Larger Work is launched or initially run (which includes initiating a session), a prominent display of the Original Developer's Attribution Information (as defined below) must occur on the graphic user interface employed by the end user to access such Covered Code (which may include display on a splash screen), if any. The size of the graphic image should be consistent with the size of the other elements of the Attribution Information. If the access by the end user to the Executable and Source Code does not create a graphic user interface for access to the Covered Code, this obligation shall not apply. If the Original Code displays such Attribution Information in a particular form (such as in the form of a splash screen, notice at login, an "about" display, or dedicated attribution area on user interface screens), continued use of such form for that Attribution Information is one way of meeting this requirement for notice. (b) Attribution information may only include a copyright notice, a brief phrase, graphic image and a URL ("Attribution Information") and is subject to the Attribution Limits as defined below. For these purposes, prominent shall mean display for sufficient duration to give reasonable notice to the user of the identity of the Original Developer and that if You include Attribution Information or similar information for other parties, You must ensure that the Attribution Information for the Original Developer shall be no less prominent than such Attribution Information or similar information for the other party. For greater certainty, the Original Developer may choose to specify in Exhibit B below that the above attribution requirement only applies to an Executable and Source Code resulting from the Original Code or any Modification, but not a Larger Work. The intent is to provide for reasonably modest attribution, therefore the Original Developer cannot require that You display, at any time, more than the following information as Attribution Information: (a) a copyright notice including the name of the Original Developer; (b) a word or one phrase (not exceeding 10 words); (c) one graphic image provided by the Original Developer; and (d) a URL (collectively, the "Attribution Limits"). (c) If Exhibit B does not include any Attribution Information, then there are no requirements for You to display any Attribution Information of the Original Developer. (d) You acknowledge that all trademarks, service marks and/or trade names contained within the Attribution Information distributed with the Covered Code are the exclusive property of their owners and may only be used with the permission of their owners, or under circumstances otherwise permitted by law or as expressly set out in this License. 15. ADDITIONAL TERM: NETWORK USE. The term "External Deployment" means the use, distribution, or communication of the Original Code or Modifications in any way such that the Original Code or Modifications may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Code or Modifications as a distribution under section 3.1 and make Source Code available under Section 3.2. EXHIBIT A. Common Public Attribution License Version 1.0. "The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mulesource.com/CPAL/. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is MuleSource Mule The Initial Developer of the Original Code is MuleSource Inc. All portions of the code are Copyright (c) 2003-2007 MuleSource Inc. All Rights Reserved. EXHIBIT B. Attribution Information Subject to the limitations and other requirements in Section 14 of the License, the Original Developer requires You to display the following Attribution Information: Attribution Copyright Notice: Copyright (c) 2003-2007 MuleSource Inc. Attribution Phrase (not exceeding 10 words): Powered by Mule. MuleSource is Open for Integration. Attribution URL: http://www.mulesource.com Graphic Image provided in the Covered Code as file: http://www.mulesource.com/images/mulesource_license_logo.gif Redistributions of the Covered Code in binary form or source code form, must ensure that the first time the resulting executable program is launched, a user interface, if any, shall include the attribution information set forth below prominently. If the executable program does not launch a user interface, the Company name and URL shall be included in the notice section of each file of the Covered Code. : Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL. mule-2.0.1/tools/installer/resources/INSTALL.txt0000644000175000017500000000670110672263414021327 0ustar charlescharles+----------------------------+ | Welcome to Mule! | |----------------------------| | http://mule.mulesource.org | +----------------------------+ Mule is a highly scalable Enterprise Services framework and messaging broker. Here is some useful information to get you started. +--------------+ | INSTALLATION | +--------------+ If you're reading this, it means you've already downloaded and unpacked the distribution. The only other thing you need to do to get started using Mule is to set the location of your Mule installation and add it to your path. This will depend on your platform, but is usually something like the following: Linux / Unix ------------ export MULE_HOME=/opt/mule export PATH=$PATH:$MULE_HOME/bin Windows ------- set MULE_HOME=C:\Program Files\Mule set PATH=%PATH%;%MULE_HOME%\bin (or by using the System utility in the Control Panel for Windows NT/2000/XP) +----------------------+ | ADDITIONAL LIBRARIES | +----------------------+ Mule has connectors for a wide variety of technologies, however in some cases in order to actually use the connector, libraries are required which cannot be distributed as part of Mule due to licensing restrictions. In these cases it is up to the user to obtain the needed libraries and place them in the $MULE_HOME/lib/user directory. As a convenience, the very first time Mule is started, it will try to download Sun Microsystems' javax.mail, javax.activation, and jsr223 (scripting) libraries. If you are behind a firewall, you may need to configure your HTTP proxy settings in the file $MULE_HOME/conf/wrapper.conf in order for this download to work. +--------------+ | DISTRIBUTION | +--------------+ The distribution you have downloaded contains the following: ./bin - Shell and batch scripts for controlling Mule from the command line ./conf - Configuration files ./docs - API documentation (javadoc) for Mule and its sub-projects ./examples - Example applications you can run and try building yourself ./lib/boot - Libraries used by the Java Service Wrapper to boot up the server ./lib/mule - Mule libraries ./lib/opt - Non-Mule libraries ./lib/user - This is where you should place your custom classes/libraries. This directory comes before ./lib/mule on the classpath and can therefore be used to patch the distributed Mule classes if necessary. ./licences - License information for all libraries shipped with Mule ./logs - Output will be sent here by default when running in background mode ./sbin - Internal scripts which are not to be run by the user ./src - The source code for all Mule modules, you can import this into your IDE ./INSTALL.txt - erm... this file! ./LICENSE.txt - License agreement for Mule ./USAGE.txt - Basic usage of Mule from the command-line +-----------------+ | GETTING STARTED | +-----------------+ Take a look at the latest documentation on our website: http://www.muledocs.org/Getting+Started+Guide User Guide: http://www.muledocs.org/User+Guide Example Applications: http://www.muledocs.org/Examples +----------+ | FEEDBACK | +----------+ We hope you enjoy using Mule. To help us make it a better product please tell us about any issues (no matter how small), suggestions or other comments you have. You can post on the mailing list - user@mule.codehaus.org or raise issues at http://mule.mulesource.org/jira, or drop in to our IRC channel on irc.codehaus.org#mule Enjoy! The Mule Team mule-2.0.1/tools/installer/resources/USAGE.txt0000644000175000017500000000425110754375733021074 0ustar charlescharles+-------------+ | BASIC USAGE | +-------------+ mule [-config ] (runs in the foreground, stop with Ctrl-C) mule start|stop|restart [-config ] (runs in the background as a daemon) +---------------------+ | CONFIGURATION FILES | +---------------------+ If the "-config" parameter is not specified, a default file name of "mule-config.xml" will be assumed. You may optionally specify more than one file as a comma-separated list (this can be useful for splitting up your Mule configuration to make it more manageable). Your configuration file(s) need to be on the classpath prior to startup. A convenient way to achieve this is by placing them in the "conf" or "lib/user" directory. Alternatively, you can specify an explicit path to their location on the file system. +---------------------+ | CLASSES & LIBRARIES | +---------------------+ Any user classes or libraries used by your configuration should be placed in "lib/user" before starting up the server. Please note that hot deployment is not yet supported, so you will need to restart the server for configuration changes and/or new classes/libraries to take effect. +-----------------------+ | CONFIGURATION BUILDER | +-----------------------+ By default, the "org.mule.config.builders.MuleXmlConfigurationBuilder" class will be used to interpret your configuration file(s). If you wish to use a different configuration builder, you can specify it using the "-builder" option. For example, to use the Spring configuration builder you could specify: mule -config my-config.xml -builder org.mule.module.spring.SpringConfigurationBuilder Since the Spring configuration builder is so commonly used, a shortcut has been created for it, so you can even abbreviate the above with: mule -config my-config.xml -builder spring +------------------+ | ADVANCED OPTIONS | +------------------+ Mule uses the Java Service Wrapper (http://wrapper.tanukisoftware.org) to control the JVM from your native OS. The wrapper provides many advanced options and features, for more information, see http://wrapper.tanukisoftware.org/doc/english/launch.html and http://wrapper.tanukisoftware.org/doc/english/properties.html mule-2.0.1/tools/installer/custom/0000755000175000017500000000000011351410674016751 5ustar charlescharlesmule-2.0.1/tools/installer/custom/src/0000755000175000017500000000000011351410674017540 5ustar charlescharlesmule-2.0.1/tools/installer/custom/src/izpack/0000755000175000017500000000000011351410674021021 5ustar charlescharlesmule-2.0.1/tools/installer/custom/src/izpack/mule/0000755000175000017500000000000011351410674021763 5ustar charlescharlesmule-2.0.1/tools/installer/custom/src/izpack/mule/installer/0000755000175000017500000000000011351410674023760 5ustar charlescharlesmule-2.0.1/tools/installer/custom/src/izpack/mule/installer/custom/0000755000175000017500000000000011351410674025272 5ustar charlescharlesmule-2.0.1/tools/installer/custom/src/izpack/mule/installer/custom/listener/0000755000175000017500000000000011351410674027117 5ustar charlescharles././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmule-2.0.1/tools/installer/custom/src/izpack/mule/installer/custom/listener/MuleInstallerListener.javamule-2.0.1/tools/installer/custom/src/izpack/mule/installer/custom/listener/MuleInstallerListener.ja0000644000175000017500000000516310664630335033732 0ustar charlescharles/* * $Id: MuleInstallerListener.java 8077 2007-08-27 20:15:25Z aperepel $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ package com.izpack.mule.installer.custom.listener; import com.izforge.izpack.Pack; import com.izforge.izpack.event.SimpleInstallerListener; import com.izforge.izpack.installer.AutomatedInstallData; import com.izforge.izpack.util.AbstractUIProgressHandler; import java.io.File; import java.util.List; public class MuleInstallerListener extends SimpleInstallerListener { /** * Default constructor */ public MuleInstallerListener() { super(); } public void beforePacks(AutomatedInstallData idata, Integer npacks, AbstractUIProgressHandler handler) throws Exception { List availablePacks = idata.availablePacks; for (int i = 0; i < availablePacks.size(); i++) { String packagePath = "/" + ((Pack)availablePacks.get(i)).name; File dir = new File(idata.getInstallPath() + packagePath); if (dir.exists()) { deleteDir(dir); } } } public void afterPacks(AutomatedInstallData idata, AbstractUIProgressHandler handler) throws Exception { if (!idata.installSuccess) { List availablePacks = idata.availablePacks; for (int i = 0; i < availablePacks.size(); i++) { String packagePath = "/" + ((Pack)availablePacks.get(i)).name; File dir = new File(idata.getInstallPath() + packagePath); if (dir.exists()) { deleteDir(dir); } } } } // Deletes all files and subdirectories under dir. // Returns true if all deletions were successful. // If a deletion fails, the method stops attempting to delete and returns false. public static boolean deleteDir(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { return false; } } } // The directory is now empty so delete it return dir.delete(); } } mule-2.0.1/tools/installer/images/0000755000175000017500000000000011351410674016704 5ustar charlescharlesmule-2.0.1/tools/installer/images/image_bar3.jpg0000644000175000017500000016643510621717250021415 0ustar charlescharlesJFIFHH YExifMM*bj(1r2i ' 'Adobe Photoshop CS2 Windows2007:01:23 11:56:37T&(. #HHJFIFHH Adobe_CMAdobed            ""?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?ұd~pLޑF6?ȤcRm@PܶwE$SgjgEŁ[Euj> kܪx?tq$GwRKܫG#]0)TkpD@\oFkϐI/hI*Uth`fWӅVZ(/!e6eVD3[0mvp`>[%5]* e]+=̜݃W]DuTewYO)2ӽmu`:cQUY8^Ue7&M&ٹ]muz?c~`jhsi}VCCEc7U}O"yN%Oqto78>K)&ˬ?X~s#eכu]/T7dnQB[&F=4sF\}l?~`tLfӑi Iq1{U oGBE snqvC'߷O 䍿՞E#+-k?_=O;u~n}yX[1~ǿc]e*BA0]oF?KgISձ*kk0#[>훙Z}w,MeYb `[X>wT_k~=j=Mc~ k;olU~u"YuNcE74-8_+1B 6 >ŕ7N:kM6׫eQerNo cv_OkKX#]m}<[=OkOszeؖl31,SB-/C? I'B1IKX_Էҳz-B̲sm-QEz2]ZmJuw@{h-c_зݻ,.(nq[d+mVIq;_c71{7}jl. ooٽk?Q[#[^-'[ pq_V=m3XCtK~uMY[ZHֶڜ0SSc#:?*u۞9],gUqǜݎf41\OsjJvuL"w[K[a"XHp+7~_j"Z)e5cr}6_{ƫ fNYϳ"rөV=MͯvǾ6lqg[׌ 2??z {XuQmFmo\$Tp?y\??OG)w#/-d ״qAUwX;hL}ߝSqy 2+}0{_Su!=V#~*f5l0}Q;-k{CsβFGk6i?W J13߳I=AN̟_}끱NSb7:BFic:ÄoVT힖qakhǐ'PPEf@A 2<3^߳\ߣf#}J?N+4Tԇkn6zh[?۸O_ͤS<mOY,k-"yg%gu ;/4Ơ(gR.LQN~h Ź$<|$NPhotoshop 3.08BIM8BIM%F &Vڰw8BIMHH8BIM&?8BIM x8BIM8BIM 8BIM 8BIM' 8BIMH/fflff/ff2Z5-8BIMp8BIM@@8BIM8BIM_Tinstaller_image2 copyTnullboundsObjcRct1Top longLeftlongBtomlongRghtlongTslicesVlLsObjcslicesliceIDlonggroupIDlongoriginenum ESliceOrigin autoGeneratedTypeenum ESliceTypeImg boundsObjcRct1Top longLeftlongBtomlongRghtlongTurlTEXTnullTEXTMsgeTEXTaltTagTEXTcellTextIsHTMLboolcellTextTEXT horzAlignenumESliceHorzAligndefault vertAlignenumESliceVertAligndefault bgColorTypeenumESliceBGColorTypeNone topOutsetlong leftOutsetlong bottomOutsetlong rightOutsetlong8BIM( ?8BIM8BIM ?"hA #JFIFHH Adobe_CMAdobed            ""?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?ұd~pLޑF6?ȤcRm@PܶwE$SgjgEŁ[Euj> kܪx?tq$GwRKܫG#]0)TkpD@\oFkϐI/hI*Uth`fWӅVZ(/!e6eVD3[0mvp`>[%5]* e]+=̜݃W]DuTewYO)2ӽmu`:cQUY8^Ue7&M&ٹ]muz?c~`jhsi}VCCEc7U}O"yN%Oqto78>K)&ˬ?X~s#eכu]/T7dnQB[&F=4sF\}l?~`tLfӑi Iq1{U oGBE snqvC'߷O 䍿՞E#+-k?_=O;u~n}yX[1~ǿc]e*BA0]oF?KgISձ*kk0#[>훙Z}w,MeYb `[X>wT_k~=j=Mc~ k;olU~u"YuNcE74-8_+1B 6 >ŕ7N:kM6׫eQerNo cv_OkKX#]m}<[=OkOszeؖl31,SB-/C? I'B1IKX_Էҳz-B̲sm-QEz2]ZmJuw@{h-c_зݻ,.(nq[d+mVIq;_c71{7}jl. ooٽk?Q[#[^-'[ pq_V=m3XCtK~uMY[ZHֶڜ0SSc#:?*u۞9],gUqǜݎf41\OsjJvuL"w[K[a"XHp+7~_j"Z)e5cr}6_{ƫ fNYϳ"rөV=MͯvǾ6lqg[׌ 2??z {XuQmFmo\$Tp?y\??OG)w#/-d ״qAUwX;hL}ߝSqy 2+}0{_Su!=V#~*f5l0}Q;-k{CsβFGk6i?W J13߳I=AN̟_}끱NSb7:BFic:ÄoVT힖qakhǐ'PPEf@A 2<3^߳\ߣf#}J?N+4Tԇkn6zh[?۸O_ͤS<mOY,k-"yg%gu ;/4Ơ(gR.LQN~h Ź$<|$8BIM!UAdobe PhotoshopAdobe Photoshop CS28BIMmaniIRFR8BIMAnDsnullAFStlongFrInVlLsObjcnullFrIDlong jdFStsVlLsObjcnullFsIDlongAFrmlongFsFrVlLslong jdLCntlong8BIMRoll8BIMmfri8BIM:http://ns.adobe.com/xap/1.0/ image/jpeg Adobe Photoshop CS2 Windows 2007-01-23T11:56:37+01:00 2007-01-23T11:56:37+01:00 2007-01-23T11:56:37+01:00 uuid:A660C531D0AADB1192B9B72243274F14 uuid:A760C531D0AADB1192B9B72243274F14 uuid:0CA1F41FF89EDB11A9B9FC666DA3F428 uuid:0BA1F41FF89EDB11A9B9FC666DA3F428 1 720000/10000 720000/10000 2 256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;5985301636841D6C3106A7C425BF675F 84 400 1 36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;77B0DF75A4F45563B123707B5507B9E1 3 sRGB IEC61966-2.1 XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmAdobed@T   !1"A# Qa23$Bqb4%RCST5&6 !1AQaq"2#BRbr3$Ccs4DS& ?3OijZ;+*d%-K68:QxcQ_?LV.T$RN׵oc!UĢF,\4(om?}NcHzmLly~xo 5)QAEcɒP"EP;G(GGRA~3G{},\m3\x3TzH 211PE:O'WI>Wϕgތ@C:^x+\[  [dBP`5Aqq;y'N =&8WUE<[ 5aiM=f. :@kDR>kkfma#++@L\Ķ#p g|A<@^Yd%μx}]gT,1XBDsB7N0S>2IN@e<$lF5v2E~!LKt\Lǔx% +۝I1.Ő,b4͙6T@DHu`0 ңl}yk z A%,& S4~Qu^r]6 U Wb&t.Ka:S3Tn/9c-\U}=TM(aD?Qp7Џ7yƾz-†S1N:!$Rpte/A2Z )"9fg†L wTK a ٿvaȮ_C)3eoN{= 'dΓ3BZ+1UvD5k%ڍ>nIALپωhbuSHTV0UU5:b2&`:,Z5ou4 9a[^dA Y 01nxۃOQ\Rp8WNj6 ,sQG|' ߺTiA)F^Pv6t64MWui{Ԅ Z %KfT9p>IQ;XcH7Re|Dqzpeͩ,sEϙSNAD#&Z(cY[6L[[ Z*Y&t :+%е *x )owѥ<}xLR2 bAsI~XVt'qG_$:x΅9rvHIdN4J"Àx`;~qZu 0<-U6+řtݻvL~nDѭRƺ+;acZa2bҙ%ĻQ>k"[*u,c:6[ecʦ5nb&B">MfgᬡI PXkzJ`KӴ*D(,,Ax r33AVI3[p|ʕIoYLx3+ FB}}_fΗKz77i_e74}uꨀ(sT;}F%0$(#4c^Qi-j6@C2l}Kh'LLkkcZI +hKUzfg]d|zQU@C卲Q;|S5\(5^"2:*3"v/qE!t.cY [bߜh"bD"*JXpnFNYiΑ (YqeVCUSa&hzq"h가aowA 5Y CcD)gqlh(XT:Y%֣2#~щ~o"27Fn04*ӈ94br3BZk1:1ifBcw|0+O% GНP &<&"VE`r-DFzS"DOoDf3/]utzEtGou?ƧXTu Z zd #^\- ?$1@{WS-Iwi m ƶ/|PbHgMcOHsZҨv bfu6IL4"#r"'GZjưXplexMvHذ*وXJuY:-%r `aUX/=102,fvLy>܈qS@jEx,bי@"z\:JbJKqIG2d5-r'4~ oz]"w;"E2{x:2 P87Wgjp0LY\3%hF79 df']gųc?nqabdf31LVZ+URbyyiS4qʌ\0JԬieT`Q+drk/ (KcB--7ioO{|(:?׵*Q>oDTlӨrduУ_+w;kיʁD *u,-v,s!2GͺKIv D*4)DG}Ĥt-'Yq{ hlRMh0:4uL6 % Ű#ƇZ |GrY4PYv.d4>$Xs3`@TFZ$a! e)"5 &H' i7b Oetfd ZX騶BK!-:Ɠ1QL:qד/}l* {j '3~ +1lyQ2ɚV$LCF=lel i0;wLƿ7b:r Z[PQUsR"B&(&! f5/3$ P\ndу6Ia1 1vŧeLo%YgN' (($b&$@l:Hb2 ߨOk3`&2ͅU!a` H:!:S:H+pI$P52l@ @K"XE|CFYr unطLC֐{¼2'"1D11V8QrIlL axDyDm~ LoBǾ\u],"CL$9 gԘ53"#ZI ՂKŶ- S],Hfͭb|:yvR ΅VJxᤕb%hJ:f%q1:ͧ EWFI^rf)@jLai"GD3:~>@mJWĩO-ۂI Yyߎ1\fC?X2HJ  1`#O[EPfya_67ݳ4?OW~>[u?.MF+ւRQ;kdbDKWJ1`$ר2ksE8IBKND, [dadPF"|5 Eٻ"5֦/YBͤF/Q$O]̅:LLϟ\0'>=zD;L蜒$`!~}'.b"*L( l(m썀m*&Q3b]34B-,4Ɠq|\G9BVmr\%+ c]( kZY[,EɮJVޥ]o7d:7eR$_?VX,@9iN\)c-̻Z2eMC3pucY" WNV Au) A;%M?"tĬx+3"T7kvx!oLgQ/T H²,*MvMvu竷FnK^Zi;8fX5,S;+' bu%BKC^cpG@1>k 是P%p1]Y;P$C* D[&PǏ]CA\N(*p[AөDvƲ>SF&H/qUS~ub9IGؓ?nYȕ GH',aW.&Ovpzn2B. nl%yϋV ++hȉ״ A;i1ܴ n39Ns Z^"KfjX8-zq3fEAơ^[oy++f Kx`R j!Ho%Gf'hI(+ 1B4 ( k۹r&nB=wxa|/W؝uJ1򪶯?z*?>?tx[ۇrxUgg8y/'9Ȫ3d/BD,*f 6"w[EnՊ8j 9]\l0? +Hݸ3#NrczQNS)hHDʞo:Κk YKQQAbh X4Y+'?!r>r]ٜ=K3h_uh`jj(s#ɸ[y6c2UeO3 <6Lk][uܵQB(aP{^rȹmb8a'ߍ9ųpĎ?wx9N+{q}缚4;qd+e5ӄ:$&z|P^'f,12wݬ.E<[2w 9.5Q )T[-@F$‚H* \:">6n~gS# Durx6h +0foX oA03llH1aLX$N0I,38QCHPR3`MS65jWc(;}[}?KOSfl߮寇tjǶ=cVօ7*7ې}e=Jݴz6 ?1LLD5x\֕f-4K"a)zu 4z[ `W8)b&tF`q(~°Xl{T,¢ DwhC%|<1mΠ0pv5ۗp}ܓCXTtgT@ˁEퟐ& vf (( >Pdg{؏g={\/yf:c8fxzceQo..aʯHv;AD<۫o`ANq}vC]Oj)n';Xf_)w DtkJ‚Eԍcз=Kc~U*1U 'G*BȰ${W07;{S9U{;W=WH]5Q ݕL:1**bʔ(Q,]~? |`s]˷,LSnߠ_=nG|7uOJ Lh¿#O\K}D/6* MW&oKKE RQLaReksF0ĔOĨF"Hi&(ϮuYfAf՟9Ɩ,?ջd~3:y5$3Pe:t9bzQgTAl-03HyyO#^Sd`g4kumWhOߗL?vOov#ƹp #ǞH]U6NQdi]E\ƪ F|b#q辥wiy,>Zݮm==ɨLN= {j}w`9q}]'n[S#3N^TU*RjKLȆu^oUݺ$j6qUqYp#+zխ ?πmZrG`$cN2»8/خ{1N`3E|VQ'cGÓxnO3;6]WV2 GS' ʺ/^zۃ1Xcǝ<]wо^HϤ=zKY٧GMz^[Eq?nDio}bSmc4fw&NcE&Cg (Ϗ]Ć}^UEK\AII =+gQugtIA+P#YQ2,KESJFl,#b0STO܍# b\WbHB {EjXB#e:31ۛ~n)ЮOs[du [aQ ,wYG/;;} 2W]9ZLssʄpaj)ɞW2q> ͹{W :IF_x^m;սkw]Q 0⥎wߔ`x1ivkV_quayeWf(-@61Xd& OsEwlnٹ$~Vn6 9xk6gՊnEV3r1o8"ay>_8c\5|k-F`[Wb,.IuhU0bb,?uc /'aA1ތWr'Y]ix5:O5\\ˡF.݅ndN6,ՐtxfVb<Ʀ%IN, V+۠ln6wDa! G'mgK xi+J~:v?h׌*>yÑ5N;*֯&Nc'k-QA^`Kñouczu8=l3(ϵO?L?7v~kR㣗<~Gj?|l.t5)6/ &(.t8>zf"M [:ⶍǤVN%AMzjDVF@@8XѻcڨZd#T CnH}Ym{훻O\=ZO)ŕB*XeAVcB[f6KyE,-ip[=bF1{sK[=ucΤ5*CEM֢=S)Yn,(tV1M=ޡ!w?EeqjB5;ʞU}1Zݲ35KK8}:99~vHNfb#uݸeG׷TVwd,GJKL>zƒ Sw!wb,+4NV *ZoO7Vn2?]w8eW|]v?v?V͢QGyCwM]M8@@&1ˍ&b7:ܶnK{ rzI;-"XO|v dvm,ȁr 6@7k$ קDT"emsϞ[ʹj[ZY{r|OQ7Ҿ[g}?omzf4&D~0FC?XN@p==c`3 &&[7X dGm[M+\G\F8cOXinm'\ԃ^Sgur?1TGi'PjRw7.F6aNhZVv[ഉcb'[>]l4q\JXj=]G+[Jvxbc`w ,TO($p\J9i+_'w P5 Y iz.c.n#qEbg)Nl?n7/n|۩l@t#)"fWXE.J-ZmYH'ϒ3ϠCn]e$c/`@v_]ٱD)-a@~{_Na7fkp\>[SʱYS%_]uh8gԫ,pƂqo=N]V-Y祈׏>}(z_ޱwuQ,!X%gNx.m w3VUJ[5g$]`d@`<_\r6mLzm Oaotۿmՠ~pOiPƬՌ&Sx]V2wgE`W +uMff,V]{Sx;o]6AH%qzlz/R~_mD߷fϤn/o{hW[} ?~jW1 (;1 F13Ig^pRLaHcFSpam5+t)MwߺKؙ!|~J15_u={/+yޯ.!䝧@p<!?_ ,{Xɋ;`FbL-{6w/mVl# iw*n]L*y3C,UY^M6ۮ{i+1_LϟK]oKk5=D|9^[;mزH{Co2TBwN☉[%v-Juښ f ŪnI,'|Q=?00C#̄4Ȍkco{Զm۰|WPU\&Ӝ{3J7ekx\pqsyH8q5Ea+i\VwGjf+AF#R80g wKbJYYdF$x҇˹+û.XN%ybsQ~=َ9Kq}:PUUI-nvՆKj̖7 bfs `p'+}薷5)+<Ɯ~]}w۹<+7}f\ϙ s4<3?1kUg>Mrɟ)һh6@rlk 1}'ĘUijֱW(S*)؆SŻ mS/)i}];_ L\mzxu@Z;Y[Z 8'֩o3ǪYdT! a:iGoOarͫ)p{\,6RvOU{$FRӤ}u???5?#?_3L+A?CG+YI[V]hV.7)U^}=I<' Eq^q1]Ab*KjE>/B&@♍h>Z=C'MXT{b{^\oeL}<.%Ǫc'Abj7B1ΛoM[;]w76A q-ƪj{81,_So[|reXQM-^WahIFql.쯁~B=s)m`4}~?O8܇b1|qy~E-csaFɧ6J8iX֙]gvnȎ{pӭKv-/y<*-&!8M=㙼b~_wm>&؂1yN12rT#9lyD.UMںjX@C#I"1 8)J\7/YL`shvH,4>qq-LE%> Bw~8k xdڔVO8d@$d.ܰ#s}w,m}^YEmu\g􍺯G~6+M5^Φ4pϗZvR1_cg StOtw~zuS5Y O~:n|KNވ9մ\P \Lw;rw5_){|8]pڹ^ܬ~KliZIw엝Th 6AMO C{qV\6Cs:p14v>;;-vgu;l\;C6q8Lf[P>S_KiF2XZΗJAcAWfzW5d!( % 09foqpl=<;?]fCa,Îfs86UcJVeX=`)%Vv`>DT18{aA}G^f; qnL9KkӼWk_ӈ4@׈ B قٱ/XXp6nܥөsЯ8\.s U7v)䰹sݧeJ`>m hi5eA@-}$ zB4† 0!Xf<9*f4N7|1ux;ŋ9 nsѧ׳$ 17|vm}:mX\S&ZP 6՗W}_V6_:}G4k_'1oEϚO׻Z\.ɩsQ+pN:oNOzV> ifئ/3t b9v<빷yUM\ԫy\h9NAd٨7vӖ^ӫc:!sV?|@[&hhqlR0\*XjVr>'W^ozUf\k^vzֽ)I cJFoj>cswS ^ǣ+9:ǫqZcj M@ TiuaXꂍO} ²,6fr'.vwԺ߆Q{"L%`:6ÀrK{e@ˠq ywnqx _Ƨv +1FuRCaH,R`?)ʤ`.wG6XpE&Zr^+\=%)Eꭤ,cb'@Gc"\bYpG<*Y:@/)_pgo`d,w<0ptvWZO'׬'2Cn3.[vݽݜÑR6qZ#FD4)E7Ɏ76:?͊!# (7md(fjǝaIg!FZ$_)=H \E76*[`,8@OozJD྇W}qgGkYG-j%LN5xwwʸ{vϵn\Y~+At l$HlWqͰ;Gٲr|b#ݐ8GS7yu+.lu :?}m^^\&3?ÜEN/?GvپV彫G1ݴe; aތ^!3tp镓.u6vmxӋך( G#ֆwGv#w/wt(ٌ:rkR63¦8&|è6ؔ&@#qFqJSOzݩq>P5i <ۊyOmE"APen1euJF>nQf`p{9Ro[ۻyl=XamIqɳ'^igH2=M_I`¡ƒ5"r5~vןo9O~ 0M KҨszf7( h0#m7❥?3ZʄabgqS_m״0<ml%fT[ŻMU1PP@_ ɺ*"4f؆9uN,VK1.UcqiGp rq>eYA)YI#.nHN\/nʬF\y`Ưn}}wZ*piAh'_X Qo Y&#m4rirk쯶_:˴9>{Sme#wMP Tups `&Nȱۨcq%yO6>^Omb ijl0%Gyx`Fs[ fؼx~'cmת?/Wvݞ}y44r>Qn^ ~_Cw3< xV}\x${eSs~ؾ0UL{.ra0<S/j\&9Eu? ]՝]ސ%6 YdWӻ;5z\2k.prXbC©{x͊AXQP@DaRo#۝wPՙH#k7 mOyM+* }fpUKP/t~c_̀Ân"ˡE <"!X>9q9~;#_e+N5*sCNQ͛v `eo˵|H5I T03^_.C<s =b*  V㫓\? yٹT}@ڹC O?H=rS^l9M,[clg{Ʋws#`KC1K%Ʋވ d6$2 "]I_D])m0n0<x '-vr"⩈)r($*9u٦7Ĺ_e9>OYl.qHȫfx&v Ee&\ZUVH :]F۹]h`B= _sSrZ|:]ƏXWԖݜAS7)].KX\y$\qAɜ\{žI]Tlm5uHû?7n`}}eyF;3'1ԯwa汷Ŗ AVy1M+6n8r ^!ڹ#Ǹ.1^.+/Un6 c#_>mšld'q܎c8F'q׸Mn$̦h; ζTd]v]YRdc$[ {kC]Q|&ek}>>_"fG)ێONSL浜8HBD],͚-4 er&Ols>1+p]v1LG,kRC#1*kVU`//RϻŸ6ٔǽcl;ǑYr*1JD)ݫ| E$k٨Di"Wfn܀A8΁[vۻnV?f4ǻگ.9rVoYvcs 7 c,O1ZRutW`2D=[3FbsQIn؅:`q;ʝ~x9`%/u?: |Fog5zxGO1oGgXUw= j= 9OL3aqʼ_c78T~<6D,׃JKzl[L1ƺkLn$,kQr/O]L۪UeIEQk9$%;$$Xk D :IjL]Sd-ӷ]VwiȉEe%ʓbtVne /Ra%MHZ;Wըk\YKhF#IdyX5pU._|#V c su+[jCŸRm)xHYxk"PA6s~ݵlxÉE-3XO><97_oޟ;K+8_WUrq9j+$$FUDc `pinubx矺S PrrY'8*xz6S($>^}=ưniKo&Ҏ”;+O]#nd2|_\rxsq՞Lym3˂e Ojj 8S=z~mvgr$a9O;yVJ式r|^94.1ѓstCv= u+{y( GsIn1Up 8Nݬ|3 ~)q| XX=תɂR'ƒij}][Rb^~z??WηOzMָ׸ g7.\3T7"`06pٚ$D~d]tIxxW{n/yaƞf>q".I|yYu)8TP^+L\͡ig*tnvkLd*y )";Y_,>Wïc.2*|e_ .bm MqH+IU 0MCT3F|tswm8_ |af:0ǹf,ᲂ,M;FXxoӜƷ3W:sx Ĉ'mA/o]{Goje}}kn73Ἃ `򋸼>R+\ Fջ8G`lm0\CRqձbI# vfqp[sQvUX,.b 3z&-Lx (?U&;/no/]5wA܎qRo}m9Il?肙%NI'>el{;=nf=xm<|\u#H<3/+wL1UN͂m)A8Ն[uW@.M0`H&{cti gINJN M3&~J>:vmm<&0S>Ϯ׺nr*1~ݲ^e`(ɼ!">j:h]Ncߨ6e0^<զmo]#Q=m2}g;p2|c/kNZ;}`!&ԕBvHNHq~Ҳ ă>mZ^ N+ }XϷ-ceؾfwqL7 _[Ƅ"_, JvmBX)1ӯlFi`9#ckc\vuףu>,\W:on\Mp?eTKJ})ƯuT#2jTZ mr}E\R0mAͅ*CjjXMvdK~1V5(Oon4 w[,U^)yϻEi]ؿQ0D7W; vݡ'a*ܻqPL{~wExr#|b06jc;m*՞CńF)b˃kek2IÖKu5-p' ˭W)ox\ˎ`{{\8t\7]O]*mWiUY #{gwTD]``Aƴc03G<{axw9=AE8]ktu#\YLi>9E/;c5ݤP9̷Y-օKUapNb"%:|Q~^iA粩3LCq[;[}=Խ_iS_N's~Vn|:ݦзQmqgīܮCnpvV2\ªiܴFٶ6 nܲK=㗷FĹv9uqX|kxl 4uWۜVZ*=ium3T;oliS9nE毦|e9I11A:b*D5ed3os]sr[kq\nHkP, Q}s;c ]ۥ.+i#Œij|E: θ| {GpYp<_+?i8Fn=>.AٕA.u WiE ž{;G'wO!k2ҵ_3+m׶lF @Y-k2mĐ1b"N?2~y/.EuoTuQ9\ܖNɌF.Zl.Z]U>HmNՍ's@8DUK{iq0xnw?dy `KۯMky\¢s2Z hPS뱋 b6XiSdG$2o\ 1af[ʾyS=81% E}}JH`)bS"$D:m邺r,3g5jߤΝCWs;kLҵ5q²[q\JD.]8'jQ! ё޾ #[b>FLP1;NQb##N ?<_x-n Gcm-#ąU`EK =<^9gD`gU7|x,?e~}WU=O.S6uODQϺ΂t~[5kye_ׅ5oVn;%F25a#bf1[evذ}{+6LG3g^n>S-ܞp{mE1ziVd,$N!+;7FYΫ#.罛vawқtO!BMoyvq<^`SvG [] zp<({qNv5_+ )pjbJ1ܥlZƻ5mEIX33`"eX{>&LE#SYXgӥ+ ~)Ԗ8|(pO\M1IL1z*ƤH+?euᝯ9oqڬy/K^#<&^¢kSFQl5漖b@V,;n_^'l7 " r+OBaiAydBA}43wG)9zfs$YlBT d&Nvǜzq{*58Hi aNI̋T8 (KBg:HxPd5TtQ7nUsA./fӕ#V7lR]{(Ifs:l33mHU[xUs~_o^S_Nvz~6zC~d~wUkƮ|kW&ʹү3mN5jk+]uǏf:fXE'+[NՙX= dl;ʁv cYcUyM {ҿ BRNc\ޘ0XMȍ ~5&T@h_5O']v*FmW/HW"al"|Q}%Ҡ`1?E27Diq |3, kSqcr=>˖[kA~$ hJED u>/ݥ,"5Hjm6;,KW/Q/[TTjnx.j^/JpnaaYW_G̦5Mlc"1Hi()swPS{mGe:9PnHπ/bU/NR2[[Γԥ5ӊ}DhJvo/?// RǏ:EH,WJm.{rmZ=h$OG:SvEνx0`i(NH,a(4>&0쥕$3/E[^?^vkOB9UֲlQ!x\q52'8ɉ go[LxרaQVYvT GEnT!Ah Y#:1?Ihjl+·蒰-M^UZT>i>ZdwxPl"2s՝[\KIY>{eE\v-G'_/`1!mP [$ao Qeј2٦5d}89PCBZ.tW@&BKYAmNݴ 8X1M،uaAevWH(UD%Skp~ >rIц'I:8'I{ 0*5i^dcIKXqDE@qcTrlܮ%Yf#Mu1<Dhu|6plmf%&퟈Α:GjL'4kzUzQmMާK?F:f*0Ź}V1QŞ$,{=H(PmF5 ǀ t5e-[+b‡ޝVΗI GKK~^$J(bbcO—?4n"ynrNckMX X7H 23^bdf"$b|6b>i /*5Odk;[ʞQ܏c^48Z'̲­ . "1X"5nMbn9Sorڭ:Q5bBՎsY_e&+bIb®QRpK5` YC\4Q )pE+\5)=iԓbu#·m81HQh4@DA29+6X4?$kDxqXP_ Eƒy\?NWej&4k gN\cK b XcY9-@+4-F>j1ƭ{׼Y ^c޴ H8]WWݪAas (\W;(ng-c1AQ}baݓynFAϾiVy*{c*sy<᜚firݲ)C]w } nm#ykQݕekla?5GGqmyX{H}u9k5#eS<̍Ն/測2L\ck1xTWf P::8;$^6?g,}8OW>O,'\oSWuQsO.DT0c}<;q.b-vߕx7ꘪd[cR6ߧ8z#qX$|i{"B0'p?mE3^w w(+:cwwujw}FxR}5e-p[Tb@vL˥Oqe;XYݾEndT3N]Nj@.)!m6WQAq qҢ|S~L{_Y꺾.ο[w[x|}MC8FQ[ѧUȵ.Jz;P 6n"4||`+`*IǞteԝi*}M #(88:DΚL br*yPLH1HIf6X cbtF5Ey1<( B[ij eIFu7y|ߏ$,&1Ք) g$4p\4y wg(Qn#FYw}|yW`LD #Rе񭼗ۼp#,ao0] ]?>ublA wKALL|%BV&Xjs>ȸ/Ǭ<Y ϸugcڵZV2L(ۦq{\t)vAβ+e%XATy3YNE~ݸ'-WĻk{ F7$.(o]-cJgsnݫܥ$>5m.0醒֙a\>%ы[̊]vsl k vƑ/9[\lgPF _{ook'^z=okCOMLkի>-#A,p\2ɑX 'ΣF5(#ҼzeF=%M@II%ZdA'd@DL|?NGT>%>v P2Z +v0 6DOd\D>aFVQ*U͐V,)SPM>FBF WLoZ zcj||7[):@$}]-Fcsx׷, ^O_ݵz顝xJ-[mqe5Gt8\%MbӼQc,rM Sd,Įe{{gq mUqyLH7#ಅnth]U5nTO[7-H>}{A;a]sUjѓ׵ (1jj+p\mwˤxbH)$=g5me g!h|W1I<,CC"n*Yfv3ܭ]WL{>5WGI@fp͊ѺPr` mgA%<14"=K2?t}uo.Kg˧>p:^SߍWn8W -BntŊ WfֻK33JRco:TKEp"XmHو&1LjĐf@̶޲EưB"BP%3+@L>_p@qlLW,uFC#MIW0ڒ"(6m:G.-[ ҺNKV%p@zx`IDAҝgHtV0 E_l"Pu'j+d:[-jBR;5 YuE@msƑX^v\Njq.7ų|ԧ?MӤ#vKE{ Y:xWv˳ ض]iSbـEmbdXaʖ9||UѲm3hUyV1iaE SH썚 *dDe>^q{hoZ0m{l4E{6f _#ebc 30I#maBұ=_EwzSlu]Qt=xFUһ[%KpV[" Ef=f ߤ!Z1^lSRv0Kd"Aw|F"+d NRT@) Nw1a=(ZśXI .Tɘ*Ul smo-2r5iю>-p(U a̘2V`X)NDx&|`4Ef ڠZ^£09/'f5Tr_N8O_Q`窬u JFǗnΡǗYou]2rsZu3NDxkmT U6}&jʝ1jf:bV8sJ5Pɞ:Dᬑ'5m1tl9 IHIң{`n&,w!ᑷOwzL[JP?Ώm?OP1Ș&ֿ [b=&xA@Vӄ5۵-Ǐ:~Ѝ $T#ךpጰ1DBȵԘڹNR3[. f(@?V+)QILtf% Jn1>M]]SyMTJvkTE]؃YK LvӂH48|+l`됊/("r9j%"EOw) ~pi}&\ؑuzV#/iE&Jg>~_ "gklUV\#PQ@,S"*LV)gtw&uǺ+)DIb_uJ0DGx.gH2\>n4Kb#D|iΚV d3lK]e#1\T 5|:Z'Aq۩. 5W7\k:F+*潖ok%0sX`I_տ#ŵh 9wU\ 7=4Pӥz{6=Oק>~5!9yuLvOccu׸Huԁ9;(ހ6,b$u)b||$rD1 ?Vc/U(9iWKJŴ 3hP!GeZ𫚃7!d gOe[]Ш$8בl W{R0If1^SZg{> kqo=j[s9.kXM07"CEߨt-$3k%Jf1[OSק|rӮ1Z,Jf>3nj@5kRYo̹<@JJAuWԹ 6%W4}jz3amON&"b>3(3M"1p<|EXTED|}4KeI5%5kmWX-I50:wΚ6a- p8R 2_"64uSڱj%lj f[lF݅E$]? 8fGх},Pj9߄QņiLVZ "PpBNv/qLƞv-G_@ªYnC S䍲}4R64s6̜Th&Ram?<# S30U&)Z&&-VV3z4XAC:?+Tjd3'I%Jvu tstjm&6c15gW;ۺvFBX^?ISmoRmE* KS#ܮ 2ql{1OK@W٪OO_X姙;cǴ\}Wc]γߡߣbե-:Ƹ5u^5ԻfK>=5c'.@ц&2ЃOEqϿ5?wKSw9|'߇/ԩ+Lzoė05Zߜ;?G}-/;Wƌ2kM\~c5~K 3Hs t?;w?Hߨ[oKA;Ck1.u8X8v95k wWnwZRMW>aW]#뉴z>Z#s}3^+OR/7ks,eo95!")QOc>Wl6zcݷ?zC[;Lex?Oߥԏx 8׶ZM4[e~ev7~?>?:imV=ey۶k3~(7coO^VB߫b۶!ոd0,,L.?7=8V*d~sݹz?ԬzQO!̻.]Muck{=O/0Ԭ~ղF mwV _6ߣgmj}b3bbъkpVsVlz۹Hm߳~bK6h۹~/lOM;~'o;,-|=p}EXqvֈ qnf uw4Qf^{5j~h Źgώ_$Photoshop 3.08BIM8BIM%F &Vڰw8BIMHH8BIM&?8BIM x8BIM8BIM 8BIM 8BIM' 8BIMH/fflff/ff2Z5-8BIMp8BIM@@8BIM8BIM_Winstaller_image3 copyWnullboundsObjcRct1Top longLeftlongBtomlongRghtlongWslicesVlLsObjcslicesliceIDlonggroupIDlongoriginenum ESliceOrigin autoGeneratedTypeenum ESliceTypeImg boundsObjcRct1Top longLeftlongBtomlongRghtlongWurlTEXTnullTEXTMsgeTEXTaltTagTEXTcellTextIsHTMLboolcellTextTEXT horzAlignenumESliceHorzAligndefault vertAlignenumESliceVertAligndefault bgColorTypeenumESliceBGColorTypeNone topOutsetlong leftOutsetlong bottomOutsetlong rightOutsetlong8BIM( ?8BIM8BIM u#lC YJFIFHH Adobe_CMAdobed            #"?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?ұdIpLޑF7-DrjXT(-q]pMF΋~hXAi'K^6~R]<,?#BpژtL'*3=|8)4 SuLߊT^|K>I%Jvu tstjm&6c15gW;ۺvFBX^?ISmoRmE* KS#ܮ 2ql{1OK@W٪OO_X姙;cǴ\}Wc]γߡߣbե-:Ƹ5u^5ԻfK>=5c'.@ц&2ЃOEqϿ5?wKSw9|'߇/ԩ+Lzoė05Zߜ;?G}-/;Wƌ2kM\~c5~K 3Hs t?;w?Hߨ[oKA;Ck1.u8X8v95k wWnwZRMW>aW]#뉴z>Z#s}3^+OR/7ks,eo95!")QOc>Wl6zcݷ?zC[;Lex?Oߥԏx 8׶ZM4[e~ev7~?>?:imV=ey۶k3~(7coO^VB߫b۶!ոd0,,L.?7=8V*d~sݹz?ԬzQO!̻.]Muck{=O/0Ԭ~ղF mwV _6ߣgmj}b3bbъkpVsVlz۹Hm߳~bK6h۹~/lOM;~'o;,-|=p}EXqvֈ qnf uw4Qf^{5j~h Źgώ_$8BIM!UAdobe PhotoshopAdobe Photoshop CS28BIMmaniIRFR8BIMAnDsnullAFStlongFrInVlLsObjcnullFrIDlong jdFStsVlLsObjcnullFsIDlongAFrmlongFsFrVlLslong jdLCntlong8BIMRoll8BIMmfri8BIM:http://ns.adobe.com/xap/1.0/ image/jpeg Adobe Photoshop CS2 Windows 2007-01-23T11:58:37+01:00 2007-01-23T11:58:37+01:00 2007-01-23T11:58:37+01:00 uuid:D60D84ADD0AADB1192B9B72243274F14 uuid:D70D84ADD0AADB1192B9B72243274F14 uuid:12A1F41FF89EDB11A9B9FC666DA3F428 uuid:11A1F41FF89EDB11A9B9FC666DA3F428 1 720000/10000 720000/10000 2 256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;EC8F75BCFDF4AD55B2AA8E971A8FD3D0 87 400 1 36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;84C04779581EC7CCC1E688261A37A405 3 sRGB IEC61966-2.1 XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmAdobed@W      !1"A# Q2a q3$BRb4%&!1AQaq"2#BR3$brCc45 ?ݠTb+xc { jW|ggIn(޴azUzLڡ{e sUplƒM a{L՛^*5;[`w 'ߊG,m!, 3'tNM}oԵ26;Tl[9g®%Sjy+-fKH~}eKaǺtnZ'_,UO b _x@I9^$x.iF:?H>!ҭTH5!BMZ2;׶3z[q&yQtqcG%kQ1L &B[F55Ӷ1Y(mm:ŢS :&f%sdZ1۠y``Z:_l(N,Y?'I>X j `%DLγ1ҀAƝ.ͤ@vUҔ3MK@ĚԦl[![lC2?:^;d\+y jjb8e,6IPQ5`Qj$,`v~tWL]$UŤT%!~"w)ELF)Q1F0ݸ5pPǤ&Z4AӲ7K/$ ԵAND}UrqK>>:e#@XQt8'P*Mt}6>b(֭u.Kk?P|`>MQ)+`@$wAHOӡ8upN$J෶ViX?K(1)wNXr58CQE[N[B -Du&Aku56T<ëHQdӮ'WJ^ώ>C,|6i"Ziߣ `4ַ[Mxt5fL1)S1uf"f'16];aNȫPVp d؁ܸT3T2{؝5ja2r_*V񥪑i00Y$d́#DOiG2f8P߳ A7"l,yB&H -6Lpԙyv85~*Ԋ _t GqLȉvzmuL*: LrN]Һ$r'req ;)vH d4/iӥ{{bа5BX@}TCA.&%.;d#lS[0l* 6Pb|( 3AyD:BwN)(N$SQR,kx)Au~[y*Sdb :v6<՗ې%"Ĩ%zוͻ]}3vb.̛JSs 5 dINs(V7*5(x^qm92X`vLiȍ؝Gm+j UV(7o)W r-c"{ gjb 5[.VYCpZHJSHXv8ƅۣ`k $6 X2g :ddƑ3=MBu*EoL (E(l 9dJb 4O, !t*pR-hb*b|c3^Ap2=mﮝ֩3ʥ)m j?D\ u٬kZqUn]E`O!D́BL!S,DHw0sF7Li^ARF0&!&KUH0 ;T4W:w.tJiyJ䲷͖!KD "2EgC\Q̔G3f*tbbǒS\HC$,0NW:΄2G11R`H5R8 JtnjVaB"~*LĒS ח[PԩvW`rqoԇnGiי4&g&K^)' ? S-]|Q 6A$ YD?I&9bfym^` c̀)VИG:\ # b`(&["ibA^*<";5_SF¤ Emc9j&2JC{l/-5%Nn3 <"D4^4X}wևM5JǼIN՛s *kW}i!ٿD+is2(C3\4Aki:eۺ00ػh `>Q[u~V 9 Zzb-vJ")\I ZW!Fj -\$0'N'J k1HE ͹SOq;ןJzҲ{r8<. "yP2kʗ\M/) Kj3RuX$E\;,9ك{?5F[JgIY1VDE 1FrPZcI <)3+ҕ, #3kM*uPk ؁=׿^umCt4}Ԫ,b#2rJa9SU~%?NNie Dyu0+UңI jU i$! LIzA1:LiC;`pV:s垽38591lƧ}+0PSdDQn d Ϻy|ߊwkWSsqCַݐQ_tyguuNmbڹ^Av0Hk۾z Gk_ɧ/ OEcUciB8>zQi6:HtX)IzԸ_i6اigx)Z qM8| Q,ѹ$%:]}BruZidp 2heYΏ6٦ςsVρ83dMe^9,N>ef[^P0&T 9 1 e~#X‘pY tD`9elДMEjl2^j`!ۦ cLm :Lr̃|+8@WPsf҂= $T>T1F1-Um7RlԖSg}Ө~7'ӗ3J-】TVS6n4K'Qp0Hb3 DwaC2RеBf#k\mUfk|X4uHXCYcF 5ff{6 aA bD`6}:Dh{ߤjdS[ TV'j~hq/m<{pGèns+9,}lslЅ~xkfꛞmk"Ep6"%cι/LuݶvW0mHӠg1²o䗧?*=] sS نB/%2<3# DƝrE j kԖUa(?N[gͮ/"H"Y7etf1n8֩MfX7 $ʌ<Ά- k;fxzGi" c*4B ^NUY?oZ0%0l@Im٤k^uvTT.T"Y.Q& Ft^@[DXHgOߏߘX9og1XPo2կY!uP C b ^9ηwލjm0*NHYZ̒ќ(`!J(Z]*xF$Hƻ4f#mvv-iQVgGq㉮{_oO^kbĎFIEj00/{ѻc_~#+8<$ycc/XɯRu>)l+!>j3o?tD`ɑ_\l{ cZGn`[ @ǽ~GS tqnUj\vu[ذ"kFdz-nms%y,0Hɻ:˃η{7 s񁻼O+pNN+]ɾLλblcYb5_co F泀L +&o:$J Z˶4R?lmzn4L"Ֆ=[Z³-$Ozg@x ʶ2^Mʕׅ\Yt<{@7  v?DVQjck F`0c] H9R E>HyWͮl8!`ٗL`,ΝM :v:jNxJ27?3ߎ|9~3'8+)g\]S- -)y@)7n8zRnعnJamY U`F6黎^SM`rg @,b$f¿֕T܍-~aq*)C Jha%:H)dWmv<}4DDfAN$5k|K cCpĶwF՛6>G 0-Dӣ+Lj;>!Ss׋H2Q~9!;dF?epg6:gM] G[FUo} SYHU&Q-&L"gH i~S۾qjn\MO{D.576vwjmp m<çQY~x~pY?V^Goַw޹qE4ׁri){Vo]FmۍC sͶ H8q߹pkx-kb۱ Fa8b ֔ƝT\_^gg'R_񎱎#,5dHTڑ "'izw[.%X  @&N8WnzwkP H kc=uwXo(R=dbՔ^Xc2Evk*7H၌A#eum[")3{}5?Vf+NS%pD[ur:b&zh R`X E/7:1}#PeSvŏܻל{_+ƒ{4%c)Ǯ'%R^"4uAp'+Vf>? ڿn۶TFD}זu\-3ZNFNE刈!kW3gSz,ՖUq)[&ąk!4V$k5 ^KT0c0"91Gj `k>:B a211"C µC9]qEɱ\[-VWfsO{`E4Xivm(YϷL{Roq:qcsy"s-̵1b~I6@vϔ5+ J9дm [,F, 9,A#„|cx׽^޶HTc81FuAzsۗ릟zT*YӥJ- 4״{OMHa^ as6cM4)kЗsS`'b|b+5R&kmi$':ߚ ci`Y2Xuib%î-oyf~DGv$g0W*|74-C͒1^d#'UXkO%ԌXǷ:bD r:+e Uv?dSlc-jGxRDx h8"CH?E5OrlK;2Lb$MqY[.Ζxpbx1 9V~8ql߬8>/לNJ6f.x2ncIJetY@Zt#՝"ݖ6̸k˽b0?IG;iNYj׺zT6B<@hpg:v1ghU,Ċ-M1-`x#b{ۦj h*#:^3]5wXb]=5ј;VlLK y4|g"P"3`8zAc]!IEW aői MGlM`u>55Ba\sI?,=oZ{_nT6Xâ1$@^6k%"lE[/:]vW1$JL{ ʰw{slwPʼn>gg\/f{'1jOgj烍cv nl7!zҸ_*LwOzF]f $IҫI'3 p➽Zx |]@51,# 99*liG3A:LNmO5uGV(]+%Wk@cZ8rJ>5S8qVD׿GoεC߾ ~G0'1G?[Ɣg)bjha}ۍj_D;[ f XFJzS՛=~Z cl`'_W=9 eW$JtmYDXgMFB7J=9ҷgPq]*0cHc={ڏ*V1^$=ه =%d^XYbv)dkҩADn3Allt I$_ j2@N8 $kW]aG-܃13{ vcdŪ1aB8DV6*7݆VI!U'h]@2xK"UG mC7S^9Ȫgpy+'S=}YyO1o`._ϐV5^J̽qnur^ҋy:u/ImOO؉$j' x|B_ğ.2䜃Z-YIm_\Ϳt_!]C$5P"4zVumySq: krtNjΔ@ e\wⷡxK_3gnw; 鱇xt+Ti='~K=WnUm R{Db 3Gκp/`zSQ6(J<7(I(NIN^m nLGf{޼#qcsvրm3mtO׮θӘ3؃'t^ &"j_pY/.SӾ3V!𘫵_ȏ0i$RHL@7*@f}=~]`Q,`UH">'RkؤІ%0lA naԻm9|mI}}k)~XQOOipu/) l{ng'"M;IE^{=uMao\ 1ru 7.y00,V (<*S[ܿ`]b J^ J)f2ie([o #2X\RwU,@]*2s sW7:C'wNKg9%@,I9fk8/Jp,7rޤpG֨Jc?3f eB܃ɆUiDΖwEnIda[@ώXr2ɿ3ock.B ,&6`FoJ䍟i| 8yD'ƹO]= }Vr>UC1zcs\=b) ^Ue$VUʧ9k..~hO[mf׃\9Mr#GۿW<;M\FU gc.,` Rh ȌH(y'Zȿ܅A~o4kq6¸|vsL@&]dF#cS޳uWnVǹGdspxOepwP+veVu/pOŴe'jf*7t!{-SQmusji2>vso;Ǧ+8n)m|z8d֌3U.lfA׬cjt;||Uxuw@ qzOcp~Uȡ9![s\5c9/Vȭxc"$'k B#Ed6ۥ.DesqA%97z-'),Ug!b7*^EWlB&h8 >vVAYXj\8c`,. ̰51 $&?]zv S:4Ps&6mE>dVlB¡(ԵՄHQLW.Iw}R=?&oŔTb0~}^籘 ȫj?;}쪗O9#"Uu=˫iqŎCk9BwNW3oV7sg56&7?ʳ { M"&1,T g Q:nT"Fg.72 9{z/+p1ƳX~y1 x^?uo5 Kbuho,j\¬$Ͼ>"6Ԭ\&3j?12!O ./\\}I5 U{_`=N;lGkY߫^F[Y/teHA#ǻA;%sr֑vh]^6|| c,%>V-K\ hjsݮEniMhκi@*UOG{\)~qwD_R'Px)U`:UYj߾'n$}GG6)kLW?Az+jlg-ןڂX^MRd,mԸ-PE (=cɸˇ}nv/\kjAج8tۨYf9 }lf$N4-gXꞗ@d#1ΣA}.O̾k_?6ݛ!R5d\z!/- M&:랃"I2<ޏ& "GuyRVVZX/qcòg5wF}da=9}Y䲘wyorqx丷"2s=N\өH"4q&܀$|U7oxS ׶mͿ t?2Ce3:uo(˯樞VƮm/ 7n}ν6{c?ʕ?*s=+JxQvE0S)g*勄+,"8~%+ȸ0*䟙މF ĸ <8襅d*a.}bg0lI+t?MzZ1xMGo]n/Z&N?aImL.(9n׸\GILF'Gvem.潼 9*1㨴X?&䜜fZ-pvbzp51w~W=_m=fgoȿD{I4Wy*zv0p†* QitlGR0w;mmqpO1s҈5_c8{=W8*Y .4`R^F6/W:,CZP#Gai%%}}Y X"ϿOd|~<'M_W^:] [ Zc0s'"= /2cOR]Rg4W{ xcWc QIq>ںCf϶-^P11էƐ0 IiğUr-J98sFqɟvʪf7^pZL"|?]G*߇?ƥ~RcL6>^{߃K9_VpIprFsZY Zl"ҥ3"N (^1ic{?ŰGS6wq#G+xSnqɜxc ,DmŽX尿zYЧ'\hFt~@'dyT[o{NCL]֊s\݈co z}Rղx?):l5>GK,bPCd>f'A='֣mأq ')BE9 gI|ɮ'%#^Z [&xvo@v6q> }F!19~7%r.]Fk'ykAGMhSط `',*#$3 =J@(kjIohc 4{& ZEkalM-Bq tdh`V 0,ppSu(q/-8\Up<'ɦ]BDrTqv`;v D.ިux@B0}jkБt3bDkS䳉zxm0ƒ[q> t 驪:CFJu~4/QfpnIܟ| c48:YWcp' Xӟ$H/ՃN91= {;rWn?ǟ>^[}rL 3 7-r_^l|gSIIU$V5 2e쉈OT?t2xGKamb*FAZ@S)6[Z{LpHk hq5QՉ4ڳKފ 3Pk,^נ{|>SFC֯ UP|̪8g8jcEVmDqO5x]c_2lR;V?B`sS*oaau5??nȪidlV?/29Z.BٗUiE 2զ$p]c9Lka@̊*)d0|fUYd\;uoSRX~mhJ3?tiЙՑTω 4um,}V62Lu&2b+UP AwՀu Q(ZI!nsȱVf8Q$|O`؀60+c4)E"P0EjTܐĪq+_R鬖;fC)[{y5xk>'q˄-ٲpBBI[7j7w ˢ¤?uoF,g+[{fs׸fw6:9֤sm2 |Τ1:X;n"yGIVDAe˞D"U*SW']׮f؆e;$c?l+ֈOOG{bsؤqWC3O;J:u&MY,Rm H[cox[%n s*x[ާ4~]iUCy}D6E}ݒcoj/rWrl:O9cƙ3 -z焬&)" /g>dK@&upgOuF7ٽurZeL}6N{™699")d`e&R&K{_es*8m}u썕ԪkH76"LY̨&HT|<' RY͹W$q3N^96R3RéכƽL~ܺlZڠ8p|(M>9Z[!ɹ'%NK'~z n@M<:ȳ0#C!l3+mŝնNqv'X0µt˻kM}\RЀƝ*UJҥ^RtQ N+)Pa1f'NC%iQZnˎkXLDDHp &mU }:y7"%fǮ}_n8ȽWU|{-8I]9cz\n5bO.:yGG.u{GzO:X ,7Uȳ2;fb2(uiuՋwfbp4~:~iWROEN̮jb%@Ȉ/N߬󻰐!Uȕ ٖ ~י̺UC*i96^b#ɅΣ3{Ѷ$ ͭK' ;Kp1c*6Y?ʾQQ0?Y .,9ĉ͘3 ~+F&@ w=wкQ[u闭0M%'k Y'HN5-tzvӺV0 [Sx 8hob<_zG<s k\cٿש6Urq~@`WzZMQ:+}{u g:jec>\},[N΍_rKs?soR f5͂Ϯ܍7,xC)?jvʆ ŷpkr_9$ vטܼWesviW(KL3"n $vF=ꝝiav|Xrol3;v7skȹDn`@vWih^N!C#$P[w d_Aֽ6y%W#}{ ǭL=ϹԯV )In?d/$hOg`IO >kG~?O.},XOϩv a^?VKw r/~3~UĮ^,:N[4bőL(WdƓ~cԛ}VEQvʻ EMzգc զ|\Y/TAkBf4IWq" )ÿ=$dT]eWԺIPbk!GU*m!1}m tkc۱kNUfT"~z2E1x'/VZ" 8lKdfRFGf'$lc>=ۄY⦅OžyszܝnQp>[ȰYl;5 "=3;c)ΣG1Em9c[oKB W6WSZ L iD GS.nKO"gƔSx8s<%fUw"I\s66 e/Rxwc# ,rң!Ucع(H~Qހ9Ӿ5;n }N1OJu]7%XL66a,Y$JqDxm~hl=o,)8Y >Q [ACH!t#n[U }ɲ"Wka)f!ZLDxΝBE*Oj`}i5(QMZ5&|U",9JlٶiΪ/Bf45vٯx ɭ8faj,( u.NMXKҐ"ƴn\DDk#NXܢ\Ȩ1 S.:\0m 4Fe8/}*!,s^Ĝvu@\{뵛e }ԖɧX[vegD@ d Hu.tm'&ԉ1ece Q)mHB!c9kRMV'jI*-;x.<2 8P,T~!bɱ ډKy mYe&3{{Ax?PS0LGgSf2v@aVcȺ)s!jEĔl?ÂA#۹թbN= nI"i6a qlB-1d;CXHT%HƎP\04H2rƲEUpa Ib#"s'5!>#LEVmDf pDzS8N2Hf5{k֖´ֳ,&M`6^s~ԼpS=c4c]E[k[s]TqkYLo(Y Ob{(DD-YxXa*+P3B&thW;YQ],xT9V9p-Z`, .PuuzmL*hB 3%,UVh*D-HYZ%}J`I1В9S\@(4Nf HW2VggOVdOU-$DGsbuN|6~Ldn3rm>xm1=bFcE,88"S3Xzp33w^KJ/xDUg `v,S. ZmHwDvKaS 4Gח-V$DR\!)Ppݺk^yqsICVRU^mu% jNəN:O~SFƬh.NjױN쿍f\5.q^Z‹V11kaH4{v/ƜNP )~/*в̲uӤ|L5ƼC(0Y^(4 Z 5?^8( Sc%X)kbwCyH/47B#¦4ѵ,kֲ<`7׮dX؆(= K^æ_0T\W@RVhYUEas+$dDEsyXvף3*5pѪ=ym1u뵂 &mqfKI`aΙu51B B"~ Xk^WO"1I@(iL^ug(Pq:»݆B1m<1EL`f1]Vɓ"hcb^F :{j/ixRc>;f T%B@M$́iu&Ubt¯S.dD$-4 הE\~߬i^I1kҕe/¬Rb hyW'TK>:DN,muA'u 6vH Z}@d |r QjlLLYtZDOD U;SΚ'LY0UnX ; eF{&;Ƒ¦ d*6\RЉkZ, Eb3 D33oÂD h%]U\o"U*膖BA䟱gOvpc"Z)e8 RYUV՚U~&E`lyJY%:LD ƺ@p1HQVj j5QIfAYͩP-J$H)xxܺƑ.+0HlK, Xw>euU[`"`;uj.ǏI0Wqjs͹;E#XX's+I"Bh$©$:-UCm$TNx;F'dD1)H9DӔ¬1k!IĜ.6@DGד<+q,cJ65֝^71KΤ "tN8c)KU $`Ek4CIc13D3ºZyvGj}ƛem kؔ=u؀l Dm?NB(wSPY KljRPzv5ݦz(bE Eo[w=! 5)y$q2Sx#5:Q(Ʌ+ 2A$pLo6*9;"hQ#:DL?LR.\9 Bj#O`)MLD6 .G)S ^Y|@TNn-Xc^gTʅu r李:-'a*\Dr)ia3,dDi}{tPǙFF| p@ᢥH #1!>阎:*AW_Ԕ GeU˯|ÂhN?^גPN][ljVZwYzVVa3R򓀤ȋry2>DDER xͳ`k5fd~d`j%XDK[K)! "6+BGQ5@S'Mlm,i\ -a_ M6Ifdei|MUB={GV UR4"x.|6"K f PuA ԦV)((_ֱ(V-ՒǞ ky̶?B8lD FF$vNO|t^+i+ gʻ rȲ@ts21æ9H']L\."MR܅ G24lvκQgE#SibTw+.`Vy1)v^"#A:aU0f"*KشvX@$fGwymS@r>V²@7"a,Nݻƚ=Rg,f,F"aĉm`L+21& Lpƣb*tBm땥J",|hEmA^Bii3}g]z;Ž[TVu2.8Rn~ PђOLĜ(cAKqyw YCqi"x)|ªT^=ܨpL!WL>F!v<:B ZD艼FەxUsXEz-XjarĔ̬0&DLQ qՍ%@`4UܴDPMW0 ,mmA/]T$("?{uUEˌ{6 k)r3"Ŏ@h)`:b %,9gƳ7|jă=li!@]J*, -ԩ A)HbKdc"P_qGr(sZxKDǗ9e6wYR`v dz留,핢\TZ{&D+-Ғ2 |?S*lrZP2N.K-^IW1QAnܼi+qkyBɉ_a|R֝]jKuD,HIL31~vF?Ö5uܲ0ğTJĢf~LqZ+gJe"=!55%xT'@mZZbb s@4 x sGlx1ZĪviDBduxs$(Ç}[{al&>55^8T2>5p꒛(]V/YRctumϓf\ A.uu2<8wV2ӷu5c2*hZ23_5BKNogmڶ̾%c b{b若~8bFʍ:X/ J6 UP 4hPQ%zݰ-'4dr9UUq6)=>mule-2.0.1/tools/installer/images/image_bar1.jpg0000644000175000017500000015040710621717250021403 0ustar charlescharlesJFIFHHExifMM*bj(1r2i ' 'Adobe Photoshop CS2 Windows2007:01:23 11:52:53T&(.HHJFIFHH Adobe_CMAdobed            ""?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?'oLtlOΩVLwUQ[VⷢbGz&6V~-~ t3MD)`%rlԗA$]ڛ:ʔ*ߺ< 3ڣX"B} $JOmO*U%)?FoK V+dNodF:iZ'WU-͹3[-5@xqKQH#ڙ.Η]mgegp7B}H~%|n!J4O:U+ u'{,#-]]MՔe_K"VoW3 \2,h bd#&iuZD0kX?Y0/ :uΌBx6 ? ƝΨҘzm)K|S}9NU% i';gׯem2lp5 CliٻMH10UK>%N[+$s}jvwj *Zݯo^Ϧ?CXRYN`em~i7ѵVMM?ɫ PW~P9KjeG^*s<[#Is_gt??Kh=YB#אX۽GmN]Ǧmǽ n4;%O3+_cOqƷo!?'Y6ѱՁ[Ü洰j LƼՐ~{?.&Liȗ1'B \o{3qm͠\UFƀ97a\ǽI/5?ҷpxIP'+_G^n:F./kҪm(QOR=C-t[MX,{\w]!26TکoTO:z q}T:m[sv ]GՏKwu6_w>̼e@^~wš[cv֙mګQf册TIk5э[;k~mUԮd4>uI)cxD}/$Oou$tCK)fH|yˮ͗X*9!OB?*-o̦Ku Qw-p'Q܎ Cq:OhG?RAFIS49zI#iH=1;kƠl~(:${%jKВ?E$싹 `=k(H$3o.{m#UX\HU~۰<_DA7~{#ĎPhotoshop 3.08BIM8BIM%F &Vڰw8BIMHH8BIM&?8BIM x8BIM8BIM 8BIM 8BIM' 8BIMH/fflff/ff2Z5-8BIMp8BIM@@8BIM8BIMYTinstaller_image001TnullboundsObjcRct1Top longLeftlongBtomlongRghtlongTslicesVlLsObjcslicesliceIDlonggroupIDlongoriginenum ESliceOrigin autoGeneratedTypeenum ESliceTypeImg boundsObjcRct1Top longLeftlongBtomlongRghtlongTurlTEXTnullTEXTMsgeTEXTaltTagTEXTcellTextIsHTMLboolcellTextTEXT horzAlignenumESliceHorzAligndefault vertAlignenumESliceVertAligndefault bgColorTypeenumESliceBGColorTypeNone topOutsetlong leftOutsetlong bottomOutsetlong rightOutsetlong8BIM( ?8BIM8BIM "hAJFIFHH Adobe_CMAdobed            ""?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?'oLtlOΩVLwUQ[VⷢbGz&6V~-~ t3MD)`%rlԗA$]ڛ:ʔ*ߺ< 3ڣX"B} $JOmO*U%)?FoK V+dNodF:iZ'WU-͹3[-5@xqKQH#ڙ.Η]mgegp7B}H~%|n!J4O:U+ u'{,#-]]MՔe_K"VoW3 \2,h bd#&iuZD0kX?Y0/ :uΌBx6 ? ƝΨҘzm)K|S}9NU% i';gׯem2lp5 CliٻMH10UK>%N[+$s}jvwj *Zݯo^Ϧ?CXRYN`em~i7ѵVMM?ɫ PW~P9KjeG^*s<[#Is_gt??Kh=YB#אX۽GmN]Ǧmǽ n4;%O3+_cOqƷo!?'Y6ѱՁ[Ü洰j LƼՐ~{?.&Liȗ1'B \o{3qm͠\UFƀ97a\ǽI/5?ҷpxIP'+_G^n:F./kҪm(QOR=C-t[MX,{\w]!26TکoTO:z q}T:m[sv ]GՏKwu6_w>̼e@^~wš[cv֙mګQf册TIk5э[;k~mUԮd4>uI)cxD}/$Oou$tCK)fH|yˮ͗X*9!OB?*-o̦Ku Qw-p'Q܎ Cq:OhG?RAFIS49zI#iH=1;kƠl~(:${%jKВ?E$싹 `=k(H$3o.{m#UX\HU~۰<_DA7~{#Ď8BIM!UAdobe PhotoshopAdobe Photoshop CS28BIMmaniIRFR8BIMAnDsnullAFStlongFrInVlLsObjcnullFrIDlong jdFStsVlLsObjcnullFsIDlongAFrmlongFsFrVlLslong jdLCntlong8BIMRoll8BIMmfri8BIM:http://ns.adobe.com/xap/1.0/ image/jpeg Adobe Photoshop CS2 Windows 2007-01-23T11:52:53+01:00 2007-01-23T11:52:53+01:00 2007-01-23T11:52:53+01:00 uuid:E936D64BCFAADB1192B9B72243274F14 uuid:EA36D64BCFAADB1192B9B72243274F14 uuid:F60BE91ED69FDB1183B3CA461A1DABB5 uuid:F50BE91ED69FDB1183B3CA461A1DABB5 1 720000/10000 720000/10000 2 256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;F3E71F24FB51E0FE05D666CE6E545D7C 84 400 1 36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;77B0DF75A4F45563B123707B5507B9E1 3 sRGB IEC61966-2.1 XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmAdobed@T   !1"A#Qa2$ B34qCRbтc%5!1AQa"q2B#R3brCS4 ?گS8k@8.4Ţ&sOxï%濓H>kѸ?i=>0n@-۱!fJӶP66d4q)6LR:cAbVF^ȉUߌ\#-b'D`1r@g,LǬǧP?*d,:{(P?νXT /ڛLfQaZ?% i,NbD&-YE1 N(7;f7ٟe%m MicAJP5V#%|=zgKu׮@__51xƣ//0n:1pc0$h=Zk\ Q;mUjj&@Cٕ8+dOD |-Ps&"[HaQ1ey<9B'^wF;MH%AՅ¤2 Yej`G+D8bs8}zf)P:^ʶ0wQ5Kr\̙[ d#'AbXzuQg`N"⊪{ c^k`W4_L"g̔{b'."D:×%cMѳ( l)`m,LќQw,dҟiN5mhU .ECmH9RPkP$&Jdf09H`bstnKf+VZ.`6b;124׉OLqPAD(o>jx^6Kx4|M^ٳf߿Uy9?~ξ+Ҵmt$!`WXl])zgj5.фD $bYRYc%N'dl c ӣf]rwGB DC0d*BdbE1ADqoS,/X]WҲ<,c+]69Q_8# fP$6=趣iYQ P숒"дk3s . ,.ZS  :2̯TE*mJJA#. >q"f{|@,ԚP6ڨV #' 0 J2%lbzPDyOr͛.3.GLé4Ù3:ն#(k6⬎pcXpC T?sï&eba}51)o>*pXH1hc!C1`ǬLYC} ٷ #,fZMv[,5< 伦f qY?+7t5y(DOl "`3%3߇xǩ;@5{);R Se૥9V# ) 뙕YF>0.0( R^Ԓ\|RK # lD}zM+ IR\uuVSbuDF3fs0S{:%LoZ E&MX%"Hy"fF1+>amX9tEtŌG2 r G1f^5 0`-z¦I/d@Цu3#@l%P]!i=( %xy S&:YK#ۗ.Lzv|ӻmַ UN/2p Xર4:mMu@:ErBN=&*& q\9;Р%VMk5BwJA+* X{2Uc ' f0 ~2ʍ2-b~3aÌa+,DB0XN38. QMBrJ3KɈ̓җa@u>)\ 3=#y̫dkJY&Rbx/c$gB' դBNWB rLց"d 5kRUf])UQ616n0lLD]ct4cu |Zz\ Zəl(`Rs.?8tăIZS#2e $'2d86f2j``2Q 7c(DpvP֡͜"з:)Y1ZL 9τ4 qD,,8Gu捆yi`ݴ.( h])VeL@aDDS@\AL )E2 b::qI0ÿDQXH)^!aY5uJ$ iZF"=՜s:w2Ɩ |[1YNciȲXfDEŋ13 EE` {bTB]#lڪ䥛y2 ٕM 2<`H$f1-`鮵Y1rW%m\IX[Tqݜw e#t,DdeGlzĪy~y\Ld *}{vfೖǛ2C([FC;eЌ0ۥEB .2k흿o`I6@0[`CpXTeO ǖnfѼ&XÛTtYP坔RswY5;4?~Wel6m|qSێ6wPlӶ; mVb Ȭؙ6JV2T30XF1#a=ScHOH1D Bs-@A@LYE`m+ wӍ ͢Q~BfMD<4DJ2Lz5&ڱb B` `dmAC["#Ia3Eb* ru9VjhJe(۵6!nHq:qa&;؈GwҦr]hbN+Z߯3">l(Ԇ{ ç`܃`wIB Wy:JgO(ݩО=wwaH8c;m3R&ƘW7v+Mw0vESI^(,6v(نg 8/>1#2iMF!壇g?'<ҺpNMonf휓jaHP sŗyqn5cOtZV׻ "lFjD`))GRqjԒۯno詓6.|?JT1b9F}_Զ^m\^ r,bDJJB 38N=pM"-mT!FZFjR{4] b32'鍂TՌ *AVpvD IJ \v41}pp˻Av߅@%TgNƑZar-FX+Ȋqz͎|>Ϋq+k7lOm7EU\ݫlΚ6[{ԕ(+M`xG3),Mۍ/PT"5U4m덵q}m 6TYXXy5#&\jf d/lƦFBppί7αq;[},6ʖ+vN+)p YXnqeS"i޵+x-r뾧 q+Bbm-6$9-Wc#Aiȼ ~4PoƜ߽=?ۯ˟}2jf'ÛYշ-dE$"pZ-:dV ` he`C2?Lv9Y|I4r7erKD%F,Zk '5`mNe"`9ga%*d,BXPЙpgӬ/kLJΘFp|/ߋ q|)EsLBJwh;"cLZĸS }~UK$d[Re42LE)dfU+cjAUIJ4H"1ˆXh{H``}z%.*d%кumˋ9qѦJ^&KIG:HOl1aڠVPV1΂lȵc)c#Pse9d8ϤҊL$Zn[:ϑcXF#m۶\j8Rs~bC+<`Oo`?#9 Jvw/ZyrrOCfaۢ:ޙֶdV‡ѱd,X5NYdQL#Ȱp]rN3I t-Kc+&ɉ#a<(o~Rh1[aBĚ7]rhqJN&t1`]*f+ɼ_Go!\ٶϒ|goUlveq7UطRg ܬ*-NĶ ˈb}&GvrWU6@Ѱ^\[+1 U0lLI  VJSb"7A9QL^C)@#;Ѕ LiYYMj% j $1\+KR39[iDɞLt(6D@ MbDA9ra8u<97AKDArz|dvtVʷљJ\d^xs$;N'Lnj~Zo^V[`STnGo։ouބÄ#Աa)1N(`2d$~پ[}?kVocy_gtiqyOeO,|׷*دN l-eeHkaK '/\T}Z% {qQ[Zbck䓛 f&Jb"pǿQ(㥉in-d}#*6|qyT)H !.>A\{Owz{֝dVhojwC#8̓q+eҟ+FoF|W[vż*Jn~uڷlW!'0%\:?ij:|O.c],iB꽌qIgXwP *DhnX뀊Ei (0k0s8ctCP Ss*VLE[mH&mڻ| ?ۍ'&2-(X 7J vݞG7ʜߦm֍<c9D#>dftI֤')*K%XX ":+0K!O^:3+Blum^\a˛>tqӧ50{/_зm2Eӫ﮲YٜCS13ھZhV 'iYp̵iLQ,)u)(Aab)b-)cKlFwkmC2)dVJɽIzÎ>QsK` k*Ч;H]KWV'29gpX&ɽsG^<^4o*r+R\:QN -V,<[yƂdg5ua(*=b"'Ƕ]1l.pL;9}}v0 D]9COoqU([ ے57 N\YڥC}M` Nݮв) dXCn >V[#a_?w;x[fj]QE@-:5c .8TNqْԈ;,$vl :ZΩU $ "5dbX\02@cЬh ,}v? W}ͬPEzHi˖,h^n-Y_5#/y2xrϓ6OǠb`E ^eѸ qXm%ň+HF0$sŦ+ ,pԎŬm'QjxsS<3 As,c(DI%9(Pq7֞;%*T.n}*:m嘙ϻq$eF;U^'ˁ.f $]LW ~A ƒBXXP`% LZ&ƜW:,*lHOFJJ":$Kp7@k/͏=9 ^O>5Yw@njGȕbu'0Kq\}A5O6"D+`(|ol Qm*l)]IOy،P%\1%sGI͍< _qxLFLnvI[}jՒ2#PHMBXQ0"0))ת4!Lޏ(+)h-q*[2HbxL=m`>tݡy)TXeUyR$/ sఌ'4}WM <)Wmg䏙e[ O2if}7oSҸ!礪 ,ĹiD@R?'0A3Em!J ViPMN2PF!^iĠ1)Qe Q/&/EdMZQ$8E# z%0d#`TR#aBLkAe90OJʨG٪qX8l419gĊ"gӛ`dT4NY P0AU# dA@cEt@H>1/.|)ʻ\zU&Zvj{+kؙΖcBaNXMakFo*Km6{ [C]h"ȘgzH3֭,meM8|i$.:bBTobe V00K69bq}b$%ȵa,:X 0*G>cz[R4 POSi 08[i1DA}Ӹ5kW K04M`,8 18}g=qfo](<57zj[FLɀYH 42w:UCHo{KYd+ؒ YהƎZ˪%b2"SF뱽-<^t!j8b0Ef-[',nնx{J\n9ؾHq6OP+#siS"q17Ur`y>ꦭ`̼ fkuI)jF3 Qٰ!Mg cA=$}c`EY^eJMqr©g. vWHʼnri ~}1.H0İbq0e66ha&lc%a3ѱ")\fZ/>5mx@]Tx s 8ٮ @̯wۓqg*+e!Ҽ0uSCƅbs>*Siָ0^bM`uuY0G&1 ҁP xn`Ęڅ J[5L dXaX/iO״tWԃStS]kVJQ*df"˔Y,g VA|qo+cvQڤ'YAf$k1b 'V?m\\[_,͈( 3#Lc1 I`Z@Sou{x*w*ObҽQԛlv{D ;b>_c᝻}/qw#-UhsPC@wO4c10E.|˕DϿtwPcZq]fKߺl˿pg>ڴtu3_xryvNvZ^\\O׷o( (PfxW02g9]d}{uB57zKqͷj6;{xz5 k+*,Fbpע`wz0f@"ɬ83IB)-i R?t*!Q4EzɪU"t[.m(*m۳$df'42I1:TR8L FBA3"ٕ!`ϴawzvehǜpt_vEurC]lkJd;!5+tJ~Ϋ8ʄ^7C>qg|s_8؝eY.bʕG>%6]Oh74!ˈ2 Vj R G XPKT9-MY\b |g􊠫zHZ/@7Fwrat[ZDpEJsm5`fs#!2Qa& Y(g&&gw_/lplpvf,9.m:Cf:ݡ\=+Pm:A/[ .ͧ{6ͷOʛlpVO8nݛL oq.b>nKl^`+َr'<Ẍ Ů|{kGlAq#ٽVo6r{ԑ⸺z8fԉ.Ӛqd %`NvP! n`+kĀU}Ju x;TI;m[ % 7. Af.?[/xο{֦Nfx`䴪n_{E+UeD%V#&q֨"#C r _̩?%;g"{oo|pQ?dkr-+mfܮw YHsZș&RnbGx#OZH嶽l|jUrhwڶSxhR܂+]}r EI%V J&:M1k<~u56+f%wÛxZ#/bqpJ}U> $y֯y?F~`*) ?7r l Z}n\M#!nŕE$3=R:|:}͇GZji\fA-()1 g9Vc3$$S3N=Vr;NW ?>)훨s̮v_XV3Jmuu@:. )DvEF9;_ВgOj/i4OS |w7{`nEPwtӹTZTJ 0 @$eqqrlEtr_ZTId$sZ5 s3;\>E %ru/2;B)҂_~Hě Pls@tz?>:;f߸l[?|[orb̵[ƁJdɇ$E%03=;O֞Xt058˫1%ؓ 1+ nofb`Z;'$@/QP^A3%X2d[+Dž)A2iJ{h{7*gUaV4!q =Xw4aH$*s\qۻ_nu{g&b(B_qvAv͗$uePt2zUWOUЛrEkrFL4\DV\ڧ(9!";OUo=˛EThw소!܌$]D#.2>w u>i}os}?Y?OpXu&=խ;sԱ{䔩oWYۆo960e%"&z''BP8#S8EM4>Xmm[vxܭk-,T-1Qc0e4(0Aqv|mWgt>CsvG6 7tefp e'G҄׽}V~3tBߑnMZFfX-P;O`ɟ`;C# 7 l{/>Ǯ m{I'I3UkvHEG_!`1I^UV3EK% DPߏf{w+Krk_ Wjf8k,b ZԱ90 :WǓEOM_7ݬjx}Z~ {9e{nKkR%]dyY31 _j}(vLQ#Υ?.3l7x>2d2%}K;>""8Ӣ?R*ӄ9[maΑlLN83=SȠ'Jw+OUJ$n:m_xE*[X,[~L-JTIGcp=;fH h$}~Ѩ^GmS[AY?y.m=?ͧ}^m}ӼWո%/Kd@|Y%C UE43=$1] 3I[DvAWV:@V5Vkj r ᛥ 8-6 эYB%Z(E2+B n\=\iɐq.tA;Kw5esGCb˺k_ծq)XU-RuA"$qǫ>n1cU>#^ 4T8On~^im')vPW{ X 遐'f_xҏBYI&nV۪#r#B)NxG^]lmxW"Ş]jv^Q,#}.vFd?z^^Ǽw֦r?6nY[wW>mK{sŦ4R Ǯܼa]U呏p }ks>Q.ܔrEP*n7Ц;$X|'Sw*#S@sskz87ig\kh-vM{Ewz;݁ͽ93OaZ܊{U1uHOo"6Vs*J!pٯW[ӬxN&D'1:}I-s;źQ+]vݤwrq{lVFɲ+wt}uOF`098ӓD>zIAI< Pkqς>7YlkۑQ bDL" 'G:t;哷o zK=[`6b93d4P2Bj5d߅^ځ-p3F|gfӫ*#cFe, c1L 35%F&Wl|02[*kv}kAWȏ˧_'}0;t͏Fhױ'?|Ϟm9oɶߓp=i^m[SL8zO\w亜?=lkצťIV]x|AvXظ?[.p盷;m*um|s}tL=Z#ط\cmtIKa#oo~wǕ5À PU$(u:FE@Ƕ,IQ9:zyE<6NY(@ O/hu_&dWq[{meX9Ьj4JlZS0N9Lg9Zٳs%D/bʼnH;ec\n|[~j[-M٨h$22XL@uoˑxFa|NUp--KO?* =%ŵ|~J<]uf0s}>vNc'||0:X&Gi@ma@RĜb܀gage3f28w)d/T,iO|ċṕLFfzsOi>ڦAZ%طO@Z/Hg.c 3c[ ]>U̠2fZg.~:7|C7k>d?N6_lxuзŖxժ4!&۳S8 H2eV`-$d`g!&wqX?xEFp-nUjE6/WOVr!)(1 >6EΤOևY}4#o˹o:;u*{PF)٬Uƪ%u\SJ3bCw~?<4V\#1\ ~:w>ZRŸ^״Z4&GnWp,i\!RTL@Ï$&hm"\k =X I@q,F n8bCWKũ&9 &@"1J6f1lcuJ o+ߔ*`O8Lc& 0OxOP\|\5^o\O^^7}[Ϊ6{&G'dn| \{佞l%:7 wl*)Kq%q8r~'; 8cAװ͕ ~N !lۦVgK}wjv8EM˓n !%B0XdoDߥF.R|7&(TߓB*pVzuUPz7ib?-Mbݷ?w vWk.R՞Ѱ A!l߫qd>^Ź& u9rcޘHH:gk̟>ն~j5F KED+6ݟj iB3Sɟ`1 F1|_aݓu;E݃m' 'ƒ*midK123u yS~<*sNԱQ`.*D /&U:ٔBꬡO(t rd =7(|'@ݸnpqM&iqsI  llȶב)'(v%&Iqy4RޞiU j +:T1^#k @S(TxԸQ đ61 "81 2͖{&uP&LבֺS ,S`M2 ,dg21Q-2kY&IἨ"%q 5eX%Ke(ji l?jYq[gs㛾=W|קb ;Ӷi? ) \-8LSaS4aFp#MtpՄja& 5X%䙘=)b1@T9e[GT%rT;wv,K1!=RN/֚̀r8Ϸ}?Ʈ닶J+Q+pDVzd4IX7@kR]]L8GڶZqF6, "_D_|?2]q43VΚ;=d=Awk9%Uh,:|q858u-iS*=|+N'̩ ʣbM wqq YWu){){mY:oe%J|U C"%bc;QiQn8ARmK C9=a8áwX_>2t鐀[Ocn0rz9\UKRLez1 al+%NLut۲o~\oW8d{]]ڛh"[[6M݊ke3PfYKfJ)@GWnoAeLK!2d,HiAײ?glAijKk dcrZ@;DnO* M۷Bo\MJ)Qewa(caL@c1Gjjc@mYQ CT3rb9Ima32)LZ+K)ϔjr1Z̳2 1p:F|C2*U5>9JuLvrP9UDȉ31פt=+4@|N4ǝJ_|WovqwK^LOgw;յԅ8W-)定$.d[?dDN1A!N讖rmץ)9DZhC^z3/+w,b̦)C"kPxcf -HAe Q{G $k Lц |B Y%,`8 L$D3PDCVkS[]kpx-@A( ZXS&2}:VbOBH*?V$1 \ldb_qaN92)Ǽb*˃ V됒iDI(Z ef3."`b&1z`aTY q]UUVݴKz5)},!#,'ę cEǶgUFHdVx%VKF8YcL> AI-.F|Ly.c]7=M3pxر13&0(ZBf?yo%m{:_NŪѝu- d(+deˏG))B@+Юݱ̋24A+H"Ǭ" 1퇧I1%uJw/ Q>נ#yr&_^zcA 3q׶LU`fEث} t4Sv[zȘ%ugJ6bеE1;:W.[ vCz֒z )P*noNm0YC!$T6R1=O@ $@iˊIKXE:BJיѕlC H b M]އvx%ni#Ņ5ÌY Ht#U2v?[Qc1zVٰL|@f c!F0bL[3ǯW 8HXoޱqz%h:[#% *҂8Ń&'f> ,9T tv%Y54X PYq#FLO|=:g= (< ;k{3TaO4L(ȱ`8tf̎{X ^ε̄jF|F2 TJ!=lݗf'T` G0W[Oɩ/#SfC-3bwlзR^8T>90Fr(CgnZNtb&;D3\ںQ֚m.æZ BtޗRd|Ĕb!A@Ɖ2X"Yʜk͔ɉzc)a39ö=dDݺHfzk6@dVUu$Ak G!"G%n`q%8nJҶ@mm׶v"0f\XjV-,87:Pwkj01 bmlEU[XxKXƠ x,zԮf(0g2LH (@۴8ډWelgQj  "O_/_=`/QF$h5ZknQW `#l~SY*Dm@97`$wM-ۯ8Jh$՜V5Uv"17zr `fG:saDɪnjJqf{}12Q=#]far0a?Z^qˎ. }:O4lϺg!e~5ѵ\Zٰ[aC5 y4b:&" đI(!Z”7Ipe H;~hADwny`fsEd x@LX' ̦K Pbю .f!jHPӬCN3R9&Lbp'# "=!`]]_UQ zV` |JJ;%LNj1p @orn\"T +Ř/Dc]Xdzp3f>ӕRbddGUTOfm\03#1xr1Ջn @;v^ MuS4ZJ;QaDZV[Y'#`7/IɈuͩ(k5 ce fNm"4nEmńTm3 /zȶ+ؠ#TLDTxLi1f ~1@UΥPѳNK90RЈmuA,ja m/N;cm*Ӵڲ6U\(sP\2Dzfga߯* ıɴ.)=S79hj4q5Dr29#,RC|e%[ukZYF#0Dx:Bm@ 8,WEnJB 0T2fgߦm@֕ēg+bEF~ZヮARvB[@wA=G":AIU%nUVkn3 ʙP鉘%mM;0%0肴e{Ͼ0%gH0 50pҤHRFL֢>IEIeq$\AIn1W\ \H,Q Јh& ا .2X) }+(A2 |UůYM%']#yYRVV'3L)XRN6!Εh#>wN&:O__f=GhuԳKU,(c" Mbh3l`9'4=:@6a]IڵͨnK ;Y^ȁ([$p&Lz>KgGbxvcrSJ6 X23dGInTϹ""d`q¾@j&ak2JŰfsԈD Y IJo=#uq5~Ǚ"D4̢e` s,D Gl!uHŏKdji5hS25Mm҄>cۧ4Xҳ(U͉)PרћR*PAT' ۼǦ*1m_b7ǡiPt׷ZuJ, 3 8/}[\nV|]WUܠzZLK2qOy2+j7j%7mk+(ST,*-άA2p&QTXќl@Qc\o|gVoOG}߶ղnl֐P6&dp)83'׎n,kCk6+]r<1RK.8a1CLv;"L+t_* Xn$\Ccg#e"i-$5z4V3 k&3&_^gwczZn5ӛ(U\e &Dq8GUPJéq{ܚ/FY,6ղT(31]p9c&B]mzۮl訩i;5Xd֤Ay s bc чLhI˓s_̪؆GȖ-חZNU]VD&kT31k-`F;e_8|;y*p&k}WYMBKza\Yi*ӂzrZ^3–:qkO*[R[nk4&AĘ%1O0:dǓNOL2wp]Nٻªƿֱ SQD-pe>CIMXF\=:S*F^2o+ TB2i`Bs0eI 8҇Y+d?1k~ThevTR^ Z 'Рzh>*Kږ 1c-Q\)v3&.9c:UƠ˸48N։D("HvXtO"FxyCmg+$/!UU x d8`NhRN|,Vwomh?oFQa=aN! [+!Ddf )|I b*pe "+DR]Zu@m)0A8t]^R"-R0ƞqO<Wyn>^>^o{Nf͞׭\2`%T?qD]/^ c~Xw} +G̛1GٴAUOiF$f:V {|0ǣی0O˰ґ2e1OPe IfıQXk"#X`#FH1>Nlz-T!@I^ZSgF˟R+UwJL_+И)3By0<>U:f7qúh91y`hˢ$0X{X#=pìݕC8& }KS} !·- ͳZ i07LjZl Vr*\"/&կ@lJ>@Eۺn VIa,.d+/%+V@J"({vc ͹^iPg20MtIjq b;l0lᭇdV\ cc XdJUF+ Q0]筂eɴcULx|h}c ]U!#^jl0A;j)oS!Rdş<]C^%cO\.]Stiη>pO?5/3SSO/|rm'>]g d OPb.3Tļ,r"&mLXU,{#Oƛu*9O7!FLV>5Xa,)! "([" r UL\Ʈ1cmN ͣ&Zqeph8$6yNYK5̃f=vB/'KВqb.CSc}_ucᬕ$%d}pǡ~[ぽi=YF 9I<~Ce^S>Xd-n+2L`kHa|xp`@$ŵ ^ߗheG;~չ$ڻv-5a 29{ǡGnC8a6bERv{˦U6\a•pWY6+J"¦!w[;c 7`&'k3%/6uu᭩ZvkjV0k3U[8HH6YǼ}Oz-w|F%1 1/etlW n+#mEڷHJ Fg4GwCŗR.43}E1Ze~eO$sڀ:.:U _:VlT-Yډ\/3V5b{W=\ZF[H+u f1M$m.;U+_!s~ݴV[v\I'h 2&KInEZ՞PK@QVa>Xb #=1'i,5[ԭ:$c<{x߂z/Yz~^ks J!d$J#3.]]7Y:tYjft\I ,R=z;Tuќu-5ZUQX!EPEPEPEPEPEPEPEPEPC    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222P" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (wqYub8zo.QU.bI`Ѹ#U[&QE ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( +3ZeVf9#+-S=jaK*K+ A $N. s}GЏʶy%業bb"޾Ϡ{֗,v[L.GJ>prO脜w8Oj֖Os2 TVB~ڲ1vJ*^:vHAu=?ZX/{wQWMlZ0dto@9iД^PFK]`*,gKM[,A\Ji]h7k%` A)ՙ ׍?>!{H5 ""U,3O~W}^8oM!Qρ|(0M{5A ss9O~V|N/^L%dHqz?x<@x,MJO#L?E׋<#!9&xCLmP߈|mY|P<#i"Fgy0X0F$q]^=a '/i, ;r?u?zjZ75?ma{#G8S@M=kd _k?n޸VjƗhvY'%cXgy  mKP;{BMH%sLΰ8~QS^Mѷ[ψuIIQ$<}=&ju[ EFH %֧??ښ/9pmu-aϛp YAIN:^1/k{SwW]rݴ)~'Gt |]]Z94kre1`z:+ _x8їWz=8͔,p5 0Fj-?ixcW)n<{ r @DQ^CsZ!w5Yab@S9 [.ЯЗ 's``ƹh $XFqyh=q8}xwÿ 'ce~3[zݮe.nXy\HcNIIrbt1.6F"ܞ HA;nEJOd`q~h3i0+H$W%XSd:zSig,gZ}?At+-?U]Q<YVdrF%S({xï%Iy'|ĀĿ|COSk&rn`21qʊ=ѨϖT噺Ikǡ|2Z跶e{T91dLtN:iL ;;t61j{j$"N_Huynw:t7`xzIv>on_9@y(_*?mz5xCگڿ.[Ҁ;xKG^wדEc<@TQks^ >^5$q$ PO0:((((((((((((((((((((((((()JZi>PZ?5KqڼR?WZvMQй̻+|Cg6RAXd RiI_ 3g<)5]VRNA#ɮ߅?x5t"$]$<''(F=12p==je{UE`FXx㊺nUv>)%'1\}NsWSڰ|;o*ˈZ)n&,Q[Twv Jȭ{k夶UԎ{Ƹ-{خJadp<'ν+;wf  kò"i"w'TzFbEX)5qҝU=?5 W= ,N̠v ~*l*HuQYQ@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@ sIbI֚m L~V1htQqYCP&cHӲ?JR;mule-2.0.1/tools/installer/images/Installer_bar.ProxySettings.jpg0000644000175000017500000002031710621717250025032 0ustar charlescharlesJFIF``ExifII*nv(1~2i ' 'Adobe Photoshop CS2 Windows2007:02:23 13:10:1102200100PV^(f> ' '"  # !"!%'$ '!!    }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?.~)|6d~m>S;l#6uhR)<j?p\˨K1m#mg9w!*\qZ+džе-"CMMeh;A0 XNr(К׎څZk I=F8COf%o4΁#u~׼-x[r[VTT7) $a"UrL R֛U7[ HIgJ$u9q޶㮌擭iꨢ ( ( ( ( ( ( ( ( (?C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222P" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (wqYub8zo.QU.bI`Ѹ#U[&QE ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( +3ZeVf9#+-S=jaK*K+ A $N. s}GЏʶy%業bb"޾Ϡ{֗,v[L.GJ>prO脜w8Oj֖Os2 TVB~ڲ1vJ*^:vHAu=?ZX/{wQWMlZ0dto@9iД^PFK]`*,gKM[,A\Ji]h7k%` A)ՙڼQ~"Jխz\OGpcc,$OU pQ_17 MH͎Nq8$z㛽BK x&5dW7P?09P"=^x[XWq.kyHvv8w|._%MovtWxW__ݏWG|-V\|K/ Y-U(s1`1<:MC?`,g\Ǘ)۳o?}s_9xe7Z3]^}Q;S 1/]Ʊ5}G\B>bC0GOـʎ9 s+/7>xr~,!mJ;ܛGcր>'/ 1\%z¬=+jRxVC9Q\{Ux zt[7SeտY甶刪18 p S@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@4P::7#3h; <:gg|)jRYbb5Xgc_?[vv&R{OxcNEœ]hZpHQI @gh|-v\K[Y]?t3v5CP^y"T3;@1+þa<_-yL?y(II t xj _DIapK]\0$O &=G,5& KLKIRD=<`l5[PנPT"w@w 2C2k}]g&ERxՁ#~UޕahqM#tPXy#t(sr̅BCp wן7so_|%s5v?yk>(?딟5io ɭst7SnBh`bEu(o ]eϨ]HtPUX3ϥe_[Y:rT~ב|/ׅujaca3$A Ԟ=ğ|;@R𮳧{~%)  2Ph-@"{8" HҹwKÓ9h"Aun?ÁIRc޻[NcY-c 2qpJM3яE_M&yuY4_OjDOV vr*R{#`}[AI)ZA"*Fߘ+'Ҝd݅(H>fX#>?JYӡYl ѯ6=J_oÍ#/jC-U.w6s[}{W!)?jܺ>_lgqRY Wkqq_J)R~u'ƿ$:k1}m"^xIky:~}~U&N98F3nyb۷~ 83M{CӼGϥj{I PAA4rc9u92:)}+| 4zǟDIcyʳpz|>‹6o ؀m=G54&&XoI^VcҀ9$tͤ\Z.j`HpF9'wgm캀;O рAz^৏<_jׄb#oGj;m8Ir5XZƑ3=q,REܠ=A=+Uo{:[Go0[|S=g\F TK;`שYXZ0Y@РHaT€>ue9ڮ-N=R ;x&Brv 9v3^ aw<\ªԓ|5mjMkE/tNRZImy-A9&2xY!S= UԵȒĒF2AY)Ɵh6t8h 楥:txTӬ."+VT! %uB= "װ|}+i;aٓ^@2TpFF |=|1I,&kfE݈Բ| 7£FQ:*?ֺW>&~u+63Yt hZ-yx s >;y_]覮RϧK4?2+ѵ3kڞy?mۻf+zdV3wltZۤg8ڀ9o7_ bu24s( d{F.ͩ#n\F~Ծiu}I]c& 0yT+M/JaujWѣ<" mۖe?1?w6Ɩ^Ikx!ld9 jIc1;ʕ8]ߍa 4BkR9YGPr0NJ-"}N`ۨp6@MɯB^/>hˮ3X(Nz½:8/⏋nbVK֍>욍V>$@߅Vcs",NFŽr5h2U~x Z#ZD{ۂG@e8䞵2"F,I9+X>E-(}ɭ*;%dV[y*G=c\ =W%0[S^us3I54`K;˓*=#UNn1v"iN~X*Ԛ+L@I'fP;?JWy]h$:(B((((a\4oR?(,̦8W|(#ϭu4P;EQEQEQEQEQEQEZ(uρ^ukJY;yy'\c~dn +nk,סJu g@)h ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (!RĒ']A4A"w_i6Q(c<3]1pnO~(í7B^gqqg}%CS(cMRh\΍\ ڊ#*+Ox ߛ )mR'>jr# <,DdQW_ώ<#aeuYHln zIlʤ7](.~br5OVL.#Yǚ72^BYLS ޢ(O5|5>cFGʟ7nHt\tt.[Y뤳_:fk)z ƍ ϭ4W2cF0HY]w?}ʫ1;WVC1h,-KHSYZ'9nN@>eL%v܊&<==cz|F{cOQ9YjIkg[3uEnHx9Gz_ h^ \ B%H@Ff\,C:>oTu$tYÒ 9Nzw89FZj:(:B(((((((((C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222P" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (wqYub8zo.QU.bI`Ѹ#U[&QE ( ( (4QFh(2((()8((((-Q@Q@Q@Q@Q@Q@Q@REPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEp~9x P{l$st~|7gZ,0)eIqy#4X$)`qϼrVѯ?$ԵX]LR$QӞtyoc+iޖ"GA?Zn {~5\zfD ܪ8OqVV0@SKU'N=i2 ^gWkcsn?*F ΍#>5:Sk\5Y9_VpVl]iq Ikrx+r9R1RM+RsAR=:5.wW;h,. `WD7zWF{{p* oOcLS:F~Fkzlj4;0iڍ[KV\aON|uF]X3p>nqֽ Q+i@hëb8Z"B;MW/5RΟM:E\y~&-;WݝӆYQ/;B2@"=ޛX?#d9G\8a<>ď,i$1fv1),IyZ,^ũoϓuZh~4n ҵzZhy*@hȣ";Co|Ia'u[Y:C G8MI[j_ "hn/;Q2l'Ctdzט|R> J`uA!dztc)'#,~o緉5cˍ޻qBl_/gt{{=;U R΁Oobn۽c8q+&S\Anu\>](VIp=Tw{j/m%\YC4vvĬ @:vsn Z{qo+4Zm$mlAr89FGx/Fv{oO7!Bdl J휜C`ct=Ŀ麭ƇKv`pŕ2@dF =GL޲(+=CLA5.W:`1NA㹪4GnXe%s\g߇^#׼ V5]&o7eMVSJ :4=_S֩EW1BBg-=k/ xN ~3_k=+ 7=@OJ VeKɨ]=:jIL$m |[k&ic~66,'pdc8x{Nsş Oր-뺶2-B,&^I-Vf;m( WT{jI6qHHYVS#ڼ㎿?%c+ZxL$pw`d@*;w_ ]_ 5&5в[yuhn:#~(5ᗿ k]Z_z 7=[_EVjgGy3 gP搑܊}~Z Zn6 >5;~z>RH< _ |)}WOy\H~GUt|=R)q,6 >c5cP~s1S^=>-E5ŭ ~w;2+GMuSU;23C9=]M&y$]-EHڊ9 @E|׮[i /_07Gu5rNI,8$^cՕU[t27LG"-',ּg VmJ8dU/̭#qiڷ~7{)mVKI \)\S9vȣ"gԴxj#Շ 1P3F|Mlˍqdȣ 5Mk^kڮtme0sa x? cEޫxy7&8ti|*XIRI} K^_Ꮕw^ UKt.,.[)~S*p@O^QEQEQEQEQEQEQEQEQEQEH=@CҀ#;Muejˑ!E$8#PmQ۽q/mfGvD@s / AyS<-Ǯ7gxwlY+I3$Y)$s'+~/-|)5}&,o!upA< `X״5-2.-&I# +mC^G-CS܋eX( xɮSomv͜b)IVAWx_zWcѢ>ʑQ4Ab x[,O2  q5^njͿ|}J]3hX;$@Rׯ'?fͿ3[Csxkf&skXO)I {=G5w%>w!AT#b@>~>Xo-o d@=S^E^֮YA[$I(Rz`|! ]KºΟgLvĂ2\`(kmB;i$C+;0 Jg_J5/L堉ո[%HOzum9d&p{@9I)4LTnF=}4f(D[ ~}T,ڞf,cE:O1uujݣc~8rAs9GP"-{֥h80Ï(G}c=PL\9tYb  |Ac>7[n \/Rbs)^ ZzkKqE;'Ubd##+J?%ŝVfݻ \g@# 5duS4Hgθ1 '9o|=iꚢku! 99柪|GòrjI׌;8Ѿ mnX|SWvS$yjVgs9# t"3y5xD0]5~f'OHϥO[.C3908?eRXVHbЕX)Å?{5Ns cuO캤Z'!M]5T^xfL@vPYM)fv12[~3{=?J% O>>n_3_tw'{k?>*u_a}w4t:v9Q]A:@4k#ÞӯO]j=\ ~'隖Gl_Cuze'm)>>vocKm|$p9֭x{Nsş Oֺ|;=S+$E2}O9GۛO#^C;#9 ) uW gڛaigȔg~?yM _3|)Ux:ugc*nog9Ҁ+x[7<%xv^'1]5X z 'V*QAEA<3^\׌xEԃ!,oЃ{JGm k=.OsmXO݆c_,H]>~ԵۋK6S+'gZBvLg@Ûo~;Owsp z{WOq =1$Tzz |mI^4,W ;\|&AO: Yq@>7U4k~od3J>Q/}bX9Vuk:f;PE~ gFcp=7>*u_ku,ClgpҺMOM?P6{eF*c`r9d_^^^\7\0;n}$Ӧf׍5}"&9(n3bᏏ;M9'Yϒe$`9 kҼ¿ m4muWUutc$}$>E@ EPEPEPEPEPEPEPEPEPEPHzRO>2ֿqq|]"^`|B#6rjtϖe8<q^9 jV r'!g'|J{M׭M^ 'ளu+cpuoy!xrx90(5FI/ pA;3tRNW h5u[H)5ߚH 8h>Z[$71#3@ :(>|z:wm}lU(F A'`Gwz6-xPV d''^cW1|Cy%%a cЂFOls3((dhɨcO MYoi:r-LraQH<(+s]a9 >-W5N'!qtvQIS+߾Ο.Ȣ+j2ē8''Uvw2N)?qsҺՃyT^^\BKq1bܚݢRVEkX-%s5hrS %9p ? ~uW1Yۼ0HdXOv ?£5Tb*I|&R0 Ib 4dvec)UweVC((((((((((((((((((((*a]Hou *(g@G'zNS?wv'l! ,K<,'f (((((((((((((((((((((((au),I"uMAɏ6m.b.+"(` ivTPRbZcmule-2.0.1/tools/installer/images/image_bar5.jpg0000644000175000017500000011144110621717250021402 0ustar charlescharlesJFIFHHExifMM*bj(1r2i ' 'Adobe Photoshop CS2 Windows2007:01:23 12:01:00V&(.HHJFIFHH Adobe_CMAdobed            ""?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?TI%)$IJI$STI%)$IJI$SUO玛gPnkOޮ*G7 {$/:FDwӯ}V3~ MOz72c$J6َKeb;mԳ ,L75~b}>mOcqpu1RKF8/\VW;I{/U:l:F]K\Z>5JVn+++?;"ź( -;iqgGUV<=aV;*կ87:ߞߣHU^nkݏU%".?7{_̭K97eוoenU_ȷ@,5}M9wyp?$?*='۵/ϮuL16Kݳ͟{v6yG<3"ˌ75Wjp}osCH SuPmMh o ,k(^N Ep;޽,5)?SOU9QԯvWN>==akgޡ2m0İ˷MIO3ſIbϢ~Jx4x%ԥ/~ac;3y6!oV,nZ}:N#㹘זyk={Ƿ_Y2(}=aoӸ?۟t.s=L]^INNNuFO6\'snowcK{a' [k?s޼_]ash?5⏣u^ix}"9nԔ_sVI_w3K]$CzgR7nh5ec}1_S~mE7a`}mݸwkȺ=4=ձ]?߾/֨xnC; s=%;OT)cGIo:S5ۑnUu5FX~}BLW,l8uHN03_eލ_{W6G_E%JTI%)$IJI$STI%)$IJI$SPhotoshop 3.08BIM8BIM%F &Vڰw8BIMHH8BIM&?8BIM x8BIM8BIM 8BIM 8BIM' 8BIMH/fflff/ff2Z5-8BIMp8BIM@@8BIM8BIMaVinstaller_image04 copyVnullboundsObjcRct1Top longLeftlongBtomlongRghtlongVslicesVlLsObjcslicesliceIDlonggroupIDlongoriginenum ESliceOrigin autoGeneratedTypeenum ESliceTypeImg boundsObjcRct1Top longLeftlongBtomlongRghtlongVurlTEXTnullTEXTMsgeTEXTaltTagTEXTcellTextIsHTMLboolcellTextTEXT horzAlignenumESliceHorzAligndefault vertAlignenumESliceVertAligndefault bgColorTypeenumESliceBGColorTypeNone topOutsetlong leftOutsetlong bottomOutsetlong rightOutsetlong8BIM( ?8BIM8BIM "hAJFIFHH Adobe_CMAdobed            ""?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?TI%)$IJI$STI%)$IJI$SUO玛gPnkOޮ*G7 {$/:FDwӯ}V3~ MOz72c$J6َKeb;mԳ ,L75~b}>mOcqpu1RKF8/\VW;I{/U:l:F]K\Z>5JVn+++?;"ź( -;iqgGUV<=aV;*կ87:ߞߣHU^nkݏU%".?7{_̭K97eוoenU_ȷ@,5}M9wyp?$?*='۵/ϮuL16Kݳ͟{v6yG<3"ˌ75Wjp}osCH SuPmMh o ,k(^N Ep;޽,5)?SOU9QԯvWN>==akgޡ2m0İ˷MIO3ſIbϢ~Jx4x%ԥ/~ac;3y6!oV,nZ}:N#㹘זyk={Ƿ_Y2(}=aoӸ?۟t.s=L]^INNNuFO6\'snowcK{a' [k?s޼_]ash?5⏣u^ix}"9nԔ_sVI_w3K]$CzgR7nh5ec}1_S~mE7a`}mݸwkȺ=4=ձ]?߾/֨xnC; s=%;OT)cGIo:S5ۑnUu5FX~}BLW,l8uHN03_eލ_{W6G_E%JTI%)$IJI$STI%)$IJI$S8BIM!UAdobe PhotoshopAdobe Photoshop CS28BIMmaniIRFR8BIMAnDsnullAFStlongFrInVlLsObjcnullFrIDlong jdFStsVlLsObjcnullFsIDlongAFrmlongFsFrVlLslong jdLCntlong8BIMRoll8BIMmfri8BIM:http://ns.adobe.com/xap/1.0/ image/jpeg Adobe Photoshop CS2 Windows 2007-01-23T12:01+01:00 2007-01-23T12:01+01:00 2007-01-23T12:01+01:00 uuid:DB0D84ADD0AADB1192B9B72243274F14 uuid:DC0D84ADD0AADB1192B9B72243274F14 uuid:C5D9905DD49FDB1183B3CA461A1DABB5 uuid:C4D9905DD49FDB1183B3CA461A1DABB5 1 720000/10000 720000/10000 2 256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;F5F26CABEF5FAAF1E3551F54DCEED1CF 86 400 1 36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;6AD9A88A74A7EC88C1E6B04D540F90A8 3 sRGB IEC61966-2.1 XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmAdobed@V    ! 1A" Q#aq2B3$R4% !1AQa"q2B#bRCr3$& ?pppppПpppppџpppppҟpppppӟpppppԟppppp՟ppppp֟pppppןpppppПppƙRli J"ǒ4G9UX"]Q88DCy Wb缏TkUџpɐ*A(CTF!br5jrp M}d @YǐFbJUG5w}8Kѵpktɱ ֍8tȓA{zz ϑȽjGr{NdՖFBޡbt[cȗdڔ|~QǣNJ{\'ӯӀsa /PN`}z0_ǯzp ҟpQQSQSEMecyÛ[g-_q@Z{vřXE)-aH%s!szs#i[:W%y] 7_n[{fE]~DxkMˍ5_uЊ*,y@*¯e}ܖ4j#VvK݂իKNyu>W[7<uUc;34]oɖF UgU₸y#"&HQ 0ODIj@/^QNk'zd|maW ~ښɯ*IGYӲIT3XY$:lzB9"ޥ{WL«ǜnjӢu>t%kdm8RXK^j&z*~^a#z;-a={YQz'T;ӟpp CƝkBZpc_6I.p#N8 Uk'g~[mՋ񛌣*f.w[K%mN2}3,{O <o\퇣Xِ'E 2DbG^^s㿎UQ8^Y9+r#q{Wzq~eQUUQG ^C4Ֆɝ-Q g A,5N ~jɗLǍkFeGI~mKoAEomnMQX*.-dEuWo6S]Wbqm4Z9(I1xws5[ d_l| zH76kH6J{B *= z: 8vvM*k5c½p̟xN'zZS֩T%qYiFȍ&CUS B0!i@:(Xf:|dУtYJİV1k]בg>3u޻&Jùb{ov,Sʍ}V85ͬSy8w:+VA&bC% 8LZӧsAK؛:=vkp)H4VrDW=z׫>՟p}S`!ʪĚ XkR1!O:GTyBx*jvꨙOgym-iRuI?かo.kѶ(ۏ5_kbf09u+k -vg1Ek^9 *F2N,q7~;soZr IoNRc@J0DPb+3UEOO_Nz8FQuT}2E\g_{B@d F(0TN'j4ގONR_+Ƃ8J/CkvaۗoϨ-.;uj^sXS͍ƜXX΋֟p/DBlƫQ;ӢrZ[9iLLy V%綧w :F) ˃{"J,^^1=WT$l6}e-tzS ڢȺcQ_)U)F ]5#szޟgŘՁqm?3T+x4H8nŒbbGb#:zmOرf~^nqy⨕18?Sygq>Av&ҷL)meUXvCSC8Y|$֨@OȬoj/;]wum.2IJv5EFkuBX\Ӯ)}=sbj,pXEVcƪjw5{XQjqy8kU{R5ޝ:/goTӢ'-QJSWBU#TiЕ$RIƌa)jVyW>"~ןpyYcTZdX[*z4[*sC GljJvHisjuV!)ޞIdU]=4[BH(Ҫ#[Ά CfFPE=޿NaN&J+jA[ߡܤ)J+:D"q B6B؈эӓI%EO:VkZ}\C:pӪ~ UOEwGWbCĜc#$;6VIA,fϨ;rSŕi*b <06hw)@/szNޜKem݋okrU*ӸuXܫD̄:+UQS訾}z.7וIO; s"F1;{Z*誺.;uppg p#SW^}Öjqi_jme5ȫUTj/EEϢ,G-?џp Kd8U%f/|h$}h}Hɵd>R\$rsʥViFCݛ%vn]؟{e{Z6 6eG$3C>?@)Bi5+=z/q+nm4k'KV^a]sQ(jKQXR)U7LuʧGֵs?O<Ϟ}1)ZI̻Ϯʰh(# Q :yL#HF ]W1rÉJaT~)>jl+mmrnixbV}Zp&Ƿ.+mU=BƮdC\SE1FA }ƧJ\ʙUN+ -4"YWiN"ővӫM|kwģ)ŻZ_{?]HXþ|Wv+?3QzyD2p5UyOJTй]VUӊiu7WxD\тD+ r* 8@ܒ5b+Nu w.I.Ӕjx[NUl\%%_&3@jK:e,y%JiI$9cGj5 UwFޥ׏;QyVK9>]Ědo%nsRYҲy,(mv4eo<.Y4˴F >>5cYyp1"7(Ұ_ ,o d/W"w}uꛓIE)( _ Z]tyNlp񟆕,EU&Nq'g :7>Qfnop+tl_+T(*EF'ZȐ1;6C}܍wndy׷C2ӱm-ڰZA$0tTRyu]z3)~ZkO뢊m\В YejIk"m4fkI5++母4yE0C0uI"-~2^~r!:5O*LB ZB {QYګ-g{5gseZD3;wkyoW~/}]=}Ο޽y4y^ Voiyr?ZS?ӟ| 9Kڌq G֧;^czUx,#ZW#Uzb/D^}:zzф#0PDFAcVj*/<n_u5.һ6fes&O9/Tev'$>O->{+ѵo7'NJwqk*Tw͞Uǩ ~g^TUX0 6 4`6bkXƵcZ8b{V*̬"usDCf* UGGz"#w5n]_ܘ@=`[U5Nd J]K Fi,9yxL)m6<ګ~T$'5<~]ȴekz0zyqA5)JƆEwN{~Ɉy>GU铯}4Sβ|jrJ֟Ԝ`à`+'TcQWf_@|i'jr7?0GJta +-РJG%|{\#VM{ ꝱCᡒ2Q9&@"0%( bQoj^ 'N^\ D: ~,Y-hhˢ^tAFodWz" k8_rR{պz@X?~ׯ"\Q|ցٛ m6򍁘[8O Hbs811Dj"paYgnd8>MqFTDQ>D4%,) _s53X8>/u7^ <3` 8񗂦rݯk.?Z7OǼ1cq^-1j,:ڱOU! gnj\Iy& :׺"E[B9,F(]UQq;nlN?Jk^2օr^gjRQwS Y2QFvr3zuQp721{{r#EN>|?Lss#*sW\'EG5S*~<[1{Y7QY9mdlvdmOrWNDBI5WTHr(XFSIQc1mkTZA3$D]< \s \#\ a^.wSsd-g:ivr##I.j=*/ 4[V|h%pk5u"9_A‚FH鰬.#3Iʌk3܍mvq,:+.éo=f8_Pti\zMGd5Ёن1msR"̳+4AQTe.HѱX,+0̊L^-sv&#QQ8|>ÓSi/&PCf%#lʎ$۬tg תN dыg~\ɺ=Gֹ֓[ŪVݒKUD(VMj' ;}@љ68=UegO[?<첩RX@xEkV(t/s\N%瞪noZ̻lݚxl˕PVbY EeE-'wy#rG}?*9UX2;$mN2sI4|f'{2:Κd9$8]Lhx4_zMRd(hϝ3l_"FF6U6* S5.p=F}4H'>3f:|m*Փo$ȯkv:%v￙ %II؝@EoTT~Du_Ȭmz:QMieX[QH)"xV\>))+l!>)iZv,nJ`ۇcA TƉNȱ_`昺LYC˶OjL~ǖNhsެjA+/Ɯ 9vkY:V}cA =wu4ZJW$#n5s)3 =\}zb)3*ȝmS%AR68!7 >sꝹ4+HƹNP=U}x}nyRB@C<{6Ql!=DԒ` m9!*0J=_u.ܬ7,41 m񍗜 @3ue%|ǒw**ZDl?mN?.)ISCr6UoH,xmxt Q8)Q5&nb昦$yx sqNW x $W n3QRo'nMc;}g1*5=6'dgmZ ,/ҤY6)Ƹfҵc3mEVC1ZrCT[Cv&/V)/^pWufID̖,:⊛ebKk`N럳sXGwr9P5(y Fxa'!4 [:(e# wrwgѯk [OIuH{n"{*ScmIOb0gVP`^_bOW'/X̍n.rmijRΝ J_3WWcՀN?8÷— 7IɼxrL<e nF O^q8N+ڈw>8v!GyGlVAD,NSd_lQ+%D##k#+DTcBjolLj,n+X֧sDN*5TqΚ-xZJ, ^Z$>aRsT 3oX|neŝS {VF8Փmx]|yעcݨ^?-{M&¾)btT)Q#]:*~~ϰSǽov;:<ք^Kf)n: mk8a}V{O4r\FRFxMCZ'Oʿ:64=]^_k|LsTFuRؤꓪMhЀ#2 DZ=s\kS਼2vυ^SEzC?9ػ&>k5.=:>MaH{unY *$z *w667$G7QҌsH?׀{֚ͅI2(eIOynb\mW׀\+3U*#SN'Fxj _&!+aÿ6N?<5muR*GƢYF%/.[95VN1ڷpӳ׽E9:*f_.ήO"XzMhnV$wEڧ Pdv!eȕ $`d1W 5yilm5cxs+9)4ǒzn^ TLSj_n، {UkU>Adk Ħ$͛O}I2aL4ypo%QJXl׶[3dGr#ގVۼ(jܞ=${GnuNX=N8)wzoi;#ǶeȊ~#FbQeM2 rfDZMor+Zi>vYY#fAŶ+ oc RWU<>`bDL\GV8 S+]k]ˤ GG]O8,n|+՘Q;S1iWD#O>{+-uT 3so̫IU).!aYFzt~ztttO6v% ɘ 9L< !ߔ!_FʖW,svN*y67U5b֜9_ۊeL*ιcB:LJ`dk}=O+n{\47%O]szG}H}LgnyܪZiuhZvҟw/Q78M$2֢D : $:Hƴ?N_̿ǀZŏ^'QicB)e uGyäBU/p:VS^J 9>GsYXVJ D=ݭ\]6q_WcAU]5tyQB՝W;TnE׀qF_2ʶ<ګ|Ei(kF>y0ΝG,ra}EZ@+PD a1Lh61:1ֵ:p e5#g~gPR2f)Ɏy2bc[ԥ szָvU2>ۜ{1klQQQ}xY5oﭷNA̜m6FIa`2Ln5}==:{5\BB4ӟppp2WƎ(yUD9'x 1_iVSθ;ϒcS8.tɓ"DY9[HO]:c/%mOǀԟppp|IVZ_s*?jWFzX3L}jz՟ppppp֟pppppןpppppПpppppџpppppҟpppppӟpppppԟppppp՟ppppp֟pppppןpppppПpppppmule-2.0.1/tools/installer/images/Installer_bar.3of7.rs.jpg0000644000175000017500000001675210621717250023401 0ustar charlescharlesJFIF``OExifII*nv(1~2i ' 'Adobe Photoshop CS2 Windows2007:02:23 13:10:1102200100PV^(fB ' '"  # !"!%'$ '!!    }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?.4X=3XQ2Ah @f}k~ <[^ Q-4k]BEmEۡ޲cTڪx*j^n(!}CRfX*3&TRd ]Sm{*CbsAEY2f.4Wx}ռ]7ImBo#/{&c %4" '`Ch|ȴ|]{YP]]_sf,TPU]qdQ@EQEQEQEt߉&O'thV}xYSCW%5 k3}tvW L}X8sW!ѡ9]BYvh k9˽Uf'j|\_<7mijk+Dp-̸RĮpۑ@>ּwg,oRUXOH| t1:4MV-l+yt#^+wm zޟ·:HY$ ˗behg@GĖZ WBK8rTA'#^U'tg4hMVUEV'HQEQEQEQEQEQEQEQEQEC    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222P" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (wqYub8zo.QU.bI`Ѹ#U[&QE ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( +3ZeVf9#+-S=jaK*K+ A $N. s}GЏʶy%業bb"޾Ϡ{֗,v[L.GJ>prO脜w8Oj֖Os2 TVB~ڲ1vJ*^:vHAu=?ZX/{wQWMlZ0dto@9iД^PFK]`*,gKM[,A\Ji]h7k%` A)ՙKWOѯm$Ic;eRB rHk?nxN+)⁞+su{sq|8oV(dP$g{|cFW·ټ/{vq~\@ڲ (׈'(EyN:α}s'+:K 1!,J)'!v=C|yE,*$eF {mQxKnHY(cuU>5fIw v_W NF5~8}B 7. 6 9c׎1YQ5/vnkp{z9,M?ϊjI{6sDPW`ڢ?M]&HQXdG_~q$XS}Sdhl丑cTRp3^9kt|Eakj;O^ c9pk񎩪<9u Oh$6qS?/N;O xŞ֬#;kud9Os[U߁7].Io7ȂxԺ~d[=OZ!/I[cW(GrG.k.~2T̺{y$($,Gn= _o~ Xѷo k{|+hI#YVuԂqWZEumH"GB A\I4kj5,ɟ۞~|o-ee,x<P=(}ϥx*/s?RD^ W~)k>'[:14W@ /Sx'u4yxFX)  wg?o=Gs|?5$i4 Z9Tݟ(qѺ{PnW_v,qZƪ]ˆ8xשP?^'uxQt@Cg'0@Ԟ s_;x^xg[U0Ʉ f`nm+COhmwE*-ͽbY`20Fx{:Ze(a@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@4P::7#3h; <:gg|)jRYbb5Xgc_?[vv&R{OxcNEœ]hZpHQI @gh|-v\K[Y]?t3v5CP^y"T3;@1+þa<_-yL?y(II t xj _DIapK]\0$O &=G,5& KLKIRD=<`l5[PנPT"w@w 2C2k}]g&ERxՁ#~UޕahqM#tPXy#t(sr̅BCp wן7so_|%s5v?yk>(?딟5io ɭst7SnBh`bEu(o ]eϨ]HtPUX3ϥe_[Y:rT~ב|/ׅujaca3$A Ԟ=ğ|;@R𮳧{~%)  2Ph-@"{8" HҹwKÓ9h"Aun?ÁIRc޻[NcY-c 2qpJM3яE_M&yuY4_OjDOV vr*R{#`}[AI)ZA"*Fߘ+'Ҝd݅(H>fX#>?JYӡYl ѯ6=J_)9*Kúψ/,Keѕ!P:>r@9 }1XT⯃5xZLfxTG^wc d*2~ў$,p<>d+O\xLj6ocn88#P@z_[ht򴖉lR_c.ľ5"W%xWV)ŗKǸo3db †Lu,!i%>w;)HO]7h|AjR 1@8Agӂ suOd q)?ڮM'uI ?G^S4AG?|߯ltgm;0Hw,?s 6ЏZD77P[ӒI@fy OҾq߄|@W}?K63צӌ5qָ?x/Rϊ|]i$:踷X"lO Z 1U#dbYV9!t;W{NƞGvqE2H#О5-b_5[d H꠶r>>~ Y嶶҆לqsX㎘[/W4դzb *Gp0h#!:X\YyJr3?ˌW#ڀ(xp?Tݹ^ǵyOw*ӵSn C+r#pzEI Zԗ.of+{eڪŔ8EОz?~&T>5|#p?_^GKdYEYW|$ |B|2Aוb6ʎr@$p,5`_O :d564d, qZQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQER}+k_ȗ>Ex>_-]+}sw9WmCZ=ŜF ,@@1i^5eggxS0jڤ2!dXF]ſ ~.jDI%ȺIHy NOP5ǧx-jX>*XKt8@daj<o Q#>Bq5I+xX1][He{m7<2@ Fq MQt BA@ԓ__*? ]~:$"`JMwd@HNox4i흺Y[L]ܫHP??yh&^d ʙƺ-=Y/Z4j7yXgh~x[ZNw{Ϫ\S9TfR 9skoiBOU}+/hin{cyd{z﫾s˲($9 tݝ̪a-|SJOb`vURLX0;u&hZ;Im=p6Z$\nNxOzVv<4$7dDoE,.OU9؊Rj<+ɥ:9c{ Rk{@ 2Y$@8+U]tU(5 (P3ȣh- = \XIx>`|Ǹ+?>4?J(~|+åiPyV,z)hҖLJ0)hQEPL Z(0:▊(0(3 Z(((((((((((((((((((((((((((((((((au),I"uMAɏ6m.b.+"(` ivTPRbZcmule-2.0.1/tools/installer/images/Installer_bar.6of7.rs.jpg0000644000175000017500000001650210621717250023375 0ustar charlescharlesJFIF``SExifII*nv(1~2i ' 'Adobe Photoshop CS2 Windows2007:02:23 13:10:1102200100PV^(fG ' '"  # !"!%'$ '!!    }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?.KUtwښeR0,Dɝv#=k>3E7jZdԍ3*q"^ȬlBlIjdZ+u63ŗA56I1%vc nY>u8%c|C;Ks^G)*@.8 x(^~!OFREWW淖'Hް3W/|)ᴝfIN7nxQ;_#H3$12` @=nA((((O5|5>cFGʟ7nHt\tt.[Y뤳_:fk)z ƍ ϭ4W2cF0HY]w?}ʫ1;WVC1h,-KHSYZ'9nN@>eL%v܊&<==cz|F{cOQ9YjIkg[3uEnHx9Gz_ h^ \ B%H@Ff\,C:>oTu$tYÒ 9Nzw89FZj:(:B(((((((((C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222P" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (wqYub8zo.QU.bI`Ѹ#U[&QE ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( +3ZeVf9#+-S=jaK*K+ A $N. s}GЏʶy%業bb"޾Ϡ{֗,v[L.GJ>prO脜w8Oj֖Os2 TVB~ڲ1vJ*^:vHAu=?ZX/{wQWMlZ0dto@9iД^PFK]`*,gKM[,A\Ji]h7k%` A)ՙ7>+ZsxkDM^#46?2;Gڽ?sS7T -[{)u8R AbRRzO:M^/5Aqo+FCcBh(t5֙syЬMFkI%ߐi<GĺB9uHYf|1[("9qkP՟U* s\׃-a<sYml4+-pYcݞyoߡ`W3nH7]BKgAp@+L@Ru%Mo2|n#'~pŸAhW,DN%8W|eIC18Fw|A+;_w_f|ONGO~:}k>0sQ__]"j cv4SIG]׆>xBUm/q&2;a #/K2? kK͒\Gad#}zQ^Wjڌ?tu MGѦcmߕBv7 gU}k^* hԮ$0R31Ը@ExPwMW5Xud3$T`pGc5|8cvz/A"=2lvvWΟ4/Hj0cѢdxfy}H.㚗/ja%Ђ-CAjӨ((((((((((((((((((((((ARR|f~&mw<#ggRÌoυ4JK8# LUT?K @k@_uxחW@?i ik+Wn\ )$`;m⏅}kk2>З 's``ƹh $XFqyh=q8}xwÿ 'ce~3[zݮe.nXy\HcNIIrbt1.6F"ܞ HA;nEJOd`q~h3i0+H$W%XSd:zSig,gZ}?At+-#2jȮ2;psp8ԖzoxW_))$C( '5 %m4{"fc!r{MWO#c}e?}{HrqzPwJ/ oIF<*Z]JCWGw_ic;x^|E1}'KMyG+1qvx9u \I<¦G#ֽEyi#W\ӵ+X5է`2p#=*vJ)ȮH^֫AMZu6?Y!6r\Z}r vHD#HfrH=9__ adW+۶E;O|5`_o Nд]M҄q۷~ d83X yWKsnp\!E%gG\䷵r>?" 65n]}6y?4;Jh'EM]čr}VclgawTݏm*>?O<|78G\cr{WIiֺsB&,g^}{Px;z!կVFknH$Bhi) e+̂fLS% cֶ#{a!ҼyE$[p?µ4OgkL%Xt {dS#Iw .xᴮcMQͷ9uǂ4 a$MAvz7UoVF6`D7ozoi9-C͆ܓou đzp8?m:jw hI{;fnʤ-GQ3B{a5]:& @Av}zu6Vp6 (`"埳 b?V?5u|ҿt>oc({~]ϛyºsڀ;KLڟ@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@!KM?ۊZ}aƾwz?[W__u Xɪ5ҷ>Yp{l<5Y[3Y`̄ܞo*V7^A6_Az~|,G\oğ׈ սWsc$ gt}'@. q}I8z_%%c~?2۝"I%yAYko[ČFyGSAjݵWHe y<ص=BX)V |z\ƹO '{Ȕ[y7B = Ϡ*:ۘՒO&wpI?&=7gwȵ1Fe 𣜮=v($U_֑87FN'L~:|"OqWMʮ:+J{VmQyyq E-Ŋ0#_rkvIYmc@ ceO{L,$ נ]\gn#AMcxvDM>$R _S]&3S9J'&A$%IٔÁҺ8UmEZ +3P((((((((((((((((((((((((((((((((((((((((((((au),I"uMAɏ6m.b.+"(` ivTPRbZcmule-2.0.1/tools/installer/images/image_bar6.jpg0000644000175000017500000007743010621717250021414 0ustar charlescharlesJFIFHHExifMM*bj(1r2i ' 'Adobe Photoshop CS2 Windows2007:01:23 12:03:00S&(.HHJFIFHH Adobe_CMAdobed            !"?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?TI%)$IJI$STI%)$:JRI$T ڮy04!GCȾz}+?Fj=]73On*uL{^ƽ9PA܆eeYgdνrX٘1umf!zM5a}BnU̒Q{e<_UbM,yWotn]Smb^_ݫ&+ً0D]$<.N2,Ik'/5}{4 q@ucW_fdpHDQ+_ӹԿoIΛcI^(i2lFT _@UO>Ů N3]nSY뛃-ei{-;] {cY-'zM~_NoSm-/U5>{m=OUؒScq6Z7~?UӨ+>ճz?Q?psNXe_G>ֺF/UҼwѶnF־4q7:GĤ}K'tnGJĩ]$1;jwUUnI=[`tǼ"j5Q?ބ6m_UMǮc(gѭq{jgkE}Rn>e<YMn]b'K]n#BQ|Ӿt n7 }mloINI$⾬zd: f+son?[Z[m}kXookkms[wj[oBmu[W{2+ȥu׾ۚӭooF6ĔC]KuwMԺ\!}zu3wqF8{1á{M[-{߳wGC/Z=ΉmmzcKs >f}IKoIaRp+O?TI%)$IJI$STI%)$IJI$STI%)$IJI$S Photoshop 3.08BIM8BIM%F &Vڰw8BIMHH8BIM&?8BIM x8BIM8BIM 8BIM 8BIM' 8BIMH/fflff/ff2Z5-8BIMp8BIM@@8BIM8BIMaSinstaller_image 5 copySnullboundsObjcRct1Top longLeftlongBtomlongRghtlongSslicesVlLsObjcslicesliceIDlonggroupIDlongoriginenum ESliceOrigin autoGeneratedTypeenum ESliceTypeImg boundsObjcRct1Top longLeftlongBtomlongRghtlongSurlTEXTnullTEXTMsgeTEXTaltTagTEXTcellTextIsHTMLboolcellTextTEXT horzAlignenumESliceHorzAligndefault vertAlignenumESliceVertAligndefault bgColorTypeenumESliceBGColorTypeNone topOutsetlong leftOutsetlong bottomOutsetlong rightOutsetlong8BIM( ?8BIM8BIM !d>JFIFHH Adobe_CMAdobed            !"?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?TI%)$IJI$STI%)$:JRI$T ڮy04!GCȾz}+?Fj=]73On*uL{^ƽ9PA܆eeYgdνrX٘1umf!zM5a}BnU̒Q{e<_UbM,yWotn]Smb^_ݫ&+ً0D]$<.N2,Ik'/5}{4 q@ucW_fdpHDQ+_ӹԿoIΛcI^(i2lFT _@UO>Ů N3]nSY뛃-ei{-;] {cY-'zM~_NoSm-/U5>{m=OUؒScq6Z7~?UӨ+>ճz?Q?psNXe_G>ֺF/UҼwѶnF־4q7:GĤ}K'tnGJĩ]$1;jwUUnI=[`tǼ"j5Q?ބ6m_UMǮc(gѭq{jgkE}Rn>e<YMn]b'K]n#BQ|Ӿt n7 }mloINI$⾬zd: f+son?[Z[m}kXookkms[wj[oBmu[W{2+ȥu׾ۚӭooF6ĔC]KuwMԺ\!}zu3wqF8{1á{M[-{߳wGC/Z=ΉmmzcKs >f}IKoIaRp+O?TI%)$IJI$STI%)$IJI$STI%)$IJI$S8BIM!UAdobe PhotoshopAdobe Photoshop CS28BIMmaniIRFR8BIMAnDsnullAFStlongFrInVlLsObjcnullFrIDlong jdFStsVlLsObjcnullFsIDlongAFrmlongFsFrVlLslong jdLCntlong8BIMRoll8BIMmfri8BIM:http://ns.adobe.com/xap/1.0/ image/jpeg Adobe Photoshop CS2 Windows 2007-01-23T12:03+01:00 2007-01-23T12:03+01:00 2007-01-23T12:03+01:00 uuid:C14F5A3CD1AADB1192B9B72243274F14 uuid:C24F5A3CD1AADB1192B9B72243274F14 uuid:85B2F10EF89EDB11A9B9FC666DA3F428 uuid:84B2F10EF89EDB11A9B9FC666DA3F428 1 720000/10000 720000/10000 2 256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;A334BC095640D85F485A85AE29A3F58C 83 400 1 36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;2EC4B6124693344ACC642FD7809BD73C 3 sRGB IEC61966-2.1 XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmAdobed@S     !1 AQa q"#Y2$VBR34%5'7W)9I!1AQaq"2BRbr3#C4ђt%Vf ?P @(ПP @(џP @(ҟP @(ӟP @(ԟP @(՟P @(֟P @(ןP @(ПPrbdnH(ikg-Yf1隆3;gK.r"SBqg'Z_Nͤ('Z94^,eefsv߻UJ.tTSk%TEUVP @џ[zdMfH" 6X>q%E=f/^tL1Hu)DO.95a qkjR7M=99]/3Jy]bip5`Nlcr"ɲ7h\שhYqKtooQx`a|Ö[9CM.|cs$ ^;w}{cy(? ep(2.%\ bj?]Nw.P]@67G[YoGqKXaQTO|zh:+׷[xW\_/T1Xy =ussg= 6"w!VeFQ'r-yg[M:xDNK:#U[%,-*cTn<59x9ъM*a"NHOs ppr9zC-Vmݶi?uѿF 'P]u IN틮*QI-tJgoe.n|C)vfT8qnLE.#<]2|XZHqKl%>$w s_?T/`;>.VPӟo?ڣzzz`7F WW<3>K'$8}9dRr?6|L+?՟bN5F׵}jrlf@9LL::#g-qijI\~bMRU9~eR󎣙>m]  6mƆNs(su1sLcmD11&"#R-`JܷzܤܤOiƃU@֟$SNeA&hç+D4A3DkջsvݫPr)$%K<\nͻFSrobI6TFsqyq%,8hZ5U)Tvp@(yjSrƋo@ާƽ>ńWJo#VsޢW][n[@(?ן8x?*&=F)7mcd05'2OIivӍfEHu1LAIe*]{)wms ZEmymToU`ڻZ}ܟ{Qjۧ)Ew]k$Վ RP @(П<?%rht.K*vJ5IUcٚ8HG jQ[99LO-rT:Hq:#OJMf(2K~͛a]tӇ\.t㕔pۗ Uܸ]SUYSs֥lcF1I$D,g9ݜ\6m\j]ϨχU(J"sXVwuqNQPȝ)Y|;n(b` J"j[es \9W`JCttU!sNF N2^H)q1%$WM+v8_J苦bⲟm۰ `aa(19R''M M;PG{5̷w&Ÿ!yxIUWu2󲆆tv2%ם%):R)&F,8܌'R|1ii8=`kDf)e--+P})U$Xi 55{9vZx֔½]Eq_U:mۍ)ӟP @(3ĘT2RT*rb>jcLABJ%𯭋/~%ښkڏboؒg E4>o_N4ᯛt燐)OԿS^q1EٞhqMF 9z,FOAo"%8(P#b]mʧm\c!}\mۑnQY7D"ӑ"){>83r}* @;m>s'UZCe9t t^塟f(n:cVeSLHu '0GCXɺe6;^ː.f݆cj/it=6˄@tA|>= Y;e8{8(ݛ&17("e8Y9\}d1لD˙$!@g(> GP )DZvu ZUs0$QA5ݿ6Kޒ_K?*˯dbЪD}|kᯖ%1ʐ}Հ~:P g2f)cBL)r! %1L ! vr[PrvڤclXۂ{9 [k\_ VMEu`NYG7 sBD\]n&g$KBʴE\<\1bnIdS(@~lrQ{Q0Jb ! j]~ &Nf,ݱsFbįy}X:}iʿ7u=_8M*U}|mM6n S?x~@zqW|yLW۴dm WcܗzɢwOǢ(B9C[Gݬ - œR ߕv3rݵ0uZ"A1CA0 ݢ?aٱ-u1~!f8 #&@UlNqXt .1@ uJzh 蟌LbTZIT$ͳqجЈ;W\Νe1)sY&}B 5@v|?h0kPUyMo\z^1; N7/o~}yVG>yo ~r+:+w׋wnHh> dd,Oh'} +bg3PdVu>=Q%1to^vS-bl#Ik"12Ț!g9V{pS^KdYRi)(N|}( 9LC!b0M(l{NF3;F7+ MlM0 jM&bIk9dxRBrQl95 T2%0@5g}^t.^· S=zƿ&e[h%(DD &( Z@(P &?@͏׆'6<3v'MFao;gJܳm<;7"%IPR P"g&?? $?]#ܧ!rcU@>? ×g)H~?GXUPOC:}~.?TOCOv~Ოl/,?ȞuQcBY֍f=~Z>H^7G˧9PԻso;M<>.[\;rk\x/&\+Mn%Z/"cBr0)@ @0vyP~~߳J~L3n)g,;J2]m=V2uLJ7UDH™NSSo?"g~x6]sDgo4n/<mOW=^ZQ(,ا CEa!ΙJ ^?Ճ77vs6y/$ݳ:46PEVrqJvSvfR )tc` 3خm[v<>vq.dovɊ$魂ʨe#X(țJN-✿ ʼnn=Ȣuyۗ2uӓ($0h7)}B83vZ ~Tӣʩ))sw0&DT% (Qx8\u{s&F׽rFVdCIxvX5q74Btqݫ'-רΡ̡es9&1a1c|DG>%wd }_4f k蹤BƠ/Y줫ĐH h ܞ:6˴*1u%{+R4#ܛr;{x|QQc1n%c&( @( _>@?q)@T>>zb/C7oxu }D5-8~"2I3`gL8UOoׂ.W__Sx5kkmb=cdkVnͺ`H^\ H2J }5c@D9P巽n u3mdב%LABǶԍS Vi4L݁h#FAfZu!Ll'VPZ[%-<Wg(\KTd^OWe+9r Sی!ǔ3׃>ZXpF,[. $lpeN%"h1 RרBwg VrN-]ː ݹ$6$[mDb}䖇zϫ>ֽW{9vtb^]yZ\J<|]#U ZS{woxЛVvZd7ANt*#ٰ%:J.؜vgmgʊq(h' <ϝJc/mSF-]jEUcr F3r‰ >Ǽ*QTrӚ|C2,QPТ&ӚK_܀GNsndX'-iUz>%`k{21`\9HOmC b#d!?Ʒ,hw.KW,JN*src(sC @y^iǒ[x*^=ԱgE]P23idd/AQaD(~e=J֏u+5VTWZּwg,oRUXOH| t1:4MV-l+yt#^+wm zޟ·:HY$ ˗behg@GĖZ WBK8rTA'#^U'tg4hMVUEV'HQEQEQEQEQEQEQEQEQEC    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222P" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (wqYub8zo.QU.bI`Ѹ#U[&QE ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( +3ZeVf9#+-S=jaK*K+ A $N. s}GЏʶy%業bb"޾Ϡ{֗,v[L.GJ>prO脜w8Oj֖Os2 TVB~ڲ1vJ*^:vHAu=?ZX/{wQWMlZ0dto@9iД^PFK]`*,gKM[,A\Ji]h7k%` A)ՙ+?*a o7.m] A%oGg5_jZ.YYx~RQna-w Fñyk$xXмak 6ȶ yhbye#ahєN+O^[XDڕԢ&<Wï:;sioCv:}p}h٨^ 5K_Gw-CJ-r3}k?-gT.m3ԕe88O=p(ۨеǺwOcOT+98qzևŏÚ߄|;*5 #{wD+pCB 0ʂ\A}(čb3{[+ %@JǾ? 5M/]q&\yˀ AFҨ|W:^'#¤+ne-Ѐ:x'/>{oK!y ww\p<0>m_jZ.YYx~RQna-w FñyԜ^oƇXi mOP0''X8vAG x>D%̗ I够!F# ꣞P^C/~$_-;sc˓֧aM}|Ox'_mK @9=t ~b zc/<-u%pAOaH| !XbM{ɹI}9fPQ^q[|y]=AW< 6z=!85S?6e6,ke +vW\Egk-#2HT W)d_hK.+Ə[s鍫Qo WVP3TVy'k5_Nt&<7|HO~ K>s B:;;gExͷω)nlƞk*J~OwOV5#B  V1;d9<ƀ=~/x~i:T3_a283LO8Nz|]쯵[E|{>$[{+ɼO?xƷ uX%u(N>E9Mc^:_XxZy6gqӮ :\ͧtdvܺPzhyAk?֙pŬlo))Ry1@Exޅ=Ӽ-}P~Y^G ִ~+x~|#o5-"b T21(<&]f_&f! O/ k>–:/(%?" mYI^I(_&x}sI֟G,]\̽!p12D޵:y(c̐*s׮4Q^-c/Y|qspHlE#*+q=kG#&kog>cz:ȃ gܞAR2xXǞ+[HeAya Y6 .\(@gn0s_Q{Yͫ;u4S/  esq\熼ixXt8nF=LsS I`xZ~],0먓Z ʍpI|Hp;WxJuEku ]RYg|2~7=+Mlyvkjr(Um\)NN ( ( ( ( ( ( ( ( ( ( ( ( i$zu!@u'o Gf wlcϒ6yu,8z@`7`H AGN0M{揬XkLt zx|k𶡯AEB,dK%O@@jio ׬|Q)?kד3h953iZ95n$=ĊQ͟Pfر gJҿh _\,7 t"_ WwW~,mm m-gcI$۩=F0z?>w.]gO J&R@;AbA0eͶeʹ[LD!pEy{s%&rDs-ؒ'w:IJZDŽ8d=  tᤔg&*7ILii"-?zԉ3]NTF 'Z6 RErU=1VO8I{ Qqvf}̱F} ~ڳB^l6z) A%oG]~^*$)FV{Yv*] @sRY|2|o z>{TRvf_9&7뷨cleu ,-2n o2:k ~eM[r$N7{~5ⶓnnFc#7|A :7ai%qVTfA>Ïk?↯km5mK & AӠ^xך~>=5̷ P$0ZW1y<gl}D>k+Ihֿ5#V<}}f]%q@]X-)ۻhs qSoV4߇=֬5f;Y( GMnxzQN{DF7 30g]6 rqGQ@a^?aQn+sw}+7 xz.-bȻl8*8t'gx""ׯ4RbL;d즵H4[qp&f &0R:if57^52Ў|9qy ? z0-'-mtol.^EdHX  u ח0O|'+WoGƾ#xo$Y$ 5KP<(uijĀ[eAH79#ހ;aҼs,T Go6.:]5Eicݜo4ߍ^'QKy3ny&f[rH=x oxOR7Uǥpz5+:'i6Mo,l"nTm?x~+@9յ6mm7xPɎ{uSEռ I++ > ں3_k66Ey  8ϧ5vZ2[%) ,³_|R :>%wtڠUO4c6Iwɯ>o^+xşa+YԮx'Zt[Ttuubn\R|],?y?N?X~Z&G;9\,wL)gEw? a[퓜jx3Q7NkYfvEܪs=(% OhX&;""yHs+[;^?S84kqp3eaR gt=sJ5Dc yEY[[|Z֤5&Q.XdJ]KG񭇉u?٣ƫsneduv8ǭg3kL@(dk+s_*|̌8ng?|'`?\J覵}[3 Yd v5܃@E9=*> `?mt_ <Z^5Kz mvEܪs=+ ]i{O57),NI+ zХgOt"?j\|002tQEQEQEQEQEQEQEQEQEQEQEQER}+k_ȗ>Ex>_-]+}sw9WmCZ=ŜF ,@@1i^5eggxS0jڤ2!dXF]ſ ~.jDI%ȺIHy NOP5ǧx-jX>*XKt8@daj<o Q#>Bq5I+xX1][He{m7<2@ Fq MQt BA@ԓ__*? ]~:$"`JMwd@HNox4i흺Y[L]ܫHP??yh&^d ʙƺ-=Y/Z4j7yXgh~x[ZNw{Ϫ\S9TfR 9skoiBOU}+/hin{cyd{z﫾s˲($9 tݝ̪a-|SJOb`vURLX0;u&hZ;Im=p6Z$\nNxOzVv<4$7dDoE,.OU9؊Rj<+ɥ:9c{ Rk{@ 2Y$@8+U]tU(5 ( ( ( ( ( ( ( (8ŭ]W6>g-wyz+x֫b&݋(8H~UP-+LѴ};OH--$qpy9$((<[Uử[mV*(W־ZѲ<qw V)tsV`v9&:((((((((((((((((((((((((((((((((au),I"uMAɏ6m.b.+"(` ivTPRbZcmule-2.0.1/tools/installer/images/Installer_bar.5of7.rs.jpg0000644000175000017500000001665510621717250023405 0ustar charlescharlesJFIF``RExifII*nv(1~2i ' 'Adobe Photoshop CS2 Windows2007:02:23 13:10:1102200100PV^(f=3 ' '"  # !"!%'$ '!!    }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?/ERt-+\'e};L '2gd2pd^H C }*?]wg9iE}M!K$lDhP{E2z+V-t^+Zԗ1 Ro7pt{t#HNb^  E[M$PXOes8c3Ai[Bl&dHh@^_>%qYIVM/^oEWaKeXmwjZ|Cwwof[-m-FcFGʟ7nHt\tt.[Y뤳_:fk)z ƍ ϭ4W2cF0HY]w?}ʫ1;WVC1h,-KHSYZ'9nN@>eL%v܊&<==cz|F{cOQ9YjIkg[3uEnHx9Gz_ h^ \ B%H@Ff\,C:>oTu$tYÒ 9Nzw89FZj:(:B(((((((((C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222P" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (wqYub8zo.QU.bI`Ѹ#U[&QE ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( +3ZeVf9#+-S=jaK*K+ A $N. s}GЏʶy%業bb"޾Ϡ{֗,v[L.GJ>prO脜w8Oj֖Os2 TVB~ڲ1vJ*^:vHAu=?ZX/{wQWMlZ0dto@9iД^PFK]`*,gKM[,A\Ji]h7k%` A)ՙ8ZZZd$Kj%uTrG܏JҼ#2cOP3Դɵ K9-Ki3e NV7on4wryw6|DA8<@^K3Gm.e2h{oQuC$;&ݠcossCOgÏ>kFTR]# D޽:/մtm#C85=n\FT^H88FZjw #Ago%ċ @)_#Qua!)+J=^TV\ Wge>7K }xtĎ$X1zkkCo& ' Xa{G^݀:k~5ǁ CR7X$DQ>?5źiisyP232 0MMsޖm,hm\ ;ۂ{ M_:ͯOnҺM݃M5s,>=dN{ O֏xOOPFikgFúW&4J:7? > Iya+R@]`̌9wҹxO>ip]G>q{T+6\3uju|3HQfY<1@`7`H AGN0M{揬XkLt zx|k𶡯AEB,dK%O@@jio ׬|Q)?kד3h953iZ95n$=ĊQ͟Pfر gJҿh _\,7 t"_ WwW~,mm m-gcI$۩=F0z?>w.]gO J&R@;AbA0eͶeʹ[LD!pEy{s%&rDs-ؒ'w:IJZDŽ8d=  tᤔg&*7ILii"-?zԉ3]NTF 'Z6 RErU=1VO8I{ Qqvf}̱F} ~ڳB^l6z-y'`n׉s7 +ēDm^# 7#b cuۉ,=7SW?OIoQ%nzHMZJ{YnIzvP=焼 h%շؔ;g$чn|^‡Fmi:ҒPi!x_̂,<{k3^ |OSZ5.g`̻l&qGjռNuމ {(F@ؔI*r;ro@q >os Ey 1$_5Az&ޞg<__\7e| ۸[fi#Cg{m!Σ$3['ZǏ O?+=~vݱ>Z ^xSqwFm6"1e@݇^>kI9 )jV?5( #, 7BzMS-j}[;yct?/ĝ^2Ѽ L TS`F7c:5[ﰑW' ]/Wu#k\ epq'܂xă_5-|[u$:byW럥E;'d׿t_ <x:f=zveQ?)45/|Gm~ :m@NǒG8$w'&Uj|?kAn ];PHoC?״}YQ(9Dq"FO ߥh>߄ hw%Ͱ{@wH@=v@ۨ'YES%G(͏喱hxsCa;u50(<toB./"KMer3Xw׵[T]]_S Qǐ:@h±-zc\o^;𵶗k ^ke]$\Nr<s+Z6pzW+/Zߋ_YQ0t'/Oƀ(((((((((((((((((((((((|e__ZDw-//uGill[ ,˸py6sj,,0NfBnOZ7+OA[/s? >xž9Um`! $08~-_SwWL"I.EJCmr~8?ٯ=sx}y7O]fWzdžC+o屒r3`Pk_jrvf8>=HT1?@j9f%͖Rk4;"@=pxC{YxLolbVX*@!?fͿ3G94`$`^T~5|eykzm΍m Alcs$ʄĀ<]| |,-ՉHnbF gb#Nxc\' jJKE-ǡgE|QmQzѧݓQ8$@ u x}RZ£2xQW]UCxMr}F[*Yx DkHO{pC\'ܓ֦W}][>]DVe'pNN8eWkmRR~?u=ö򨼼bۯ5EGw`׶ZKo ]Hk'Kw s@.by`&;"&{|)gyrGj.UW^M)S`] si $a]R6ˢQE``zQE1F( 1E`zQE`QE`ztQ@)0=-Q(J(Ҍ (Ҋ(((((((((((((((((((((((((((((((((e9Ԥ$PGM6y&?+ٴmU((d1iQ@I)hmule-2.0.1/tools/installer/images/Installer_bar.7of7.rs.jpg0000644000175000017500000002313210621717250023373 0ustar charlescharlesJFIF``7ExifII*nv(1~2i ' 'Adobe Photoshop CS2 Windows2007:02:23 13:10:1102200100PV^(f ' '"  # !"!%'$ '!!    }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?.h:^Ciwc[_By/ݑ28a!|W=}kzIe2J,2njȥ y9`a9kY_iV;ou.#yX*RTT|5'/iq_JrZM@ExgoK vtthC]6^X%xc3Mjʱ U?}}]7UUIH;bF7NN MԮmF=U޶cNHh B#iDWj~:^:/>jvOdL"97K"?s#ݲ7yҊ<7jo>%uX!R`gͷ!Og2:glbi<`u>2Mf -q5W!uk6d-nܑjT5Z]SP7Igj%pt XՈS^7?qkۍm#[he%i6`~Vbv8cvY[ZoAq&Og rܝ|ˈ,J' Mkpx{V{mB-E[a$LsDnRg@ܑr:~ мAg{+sA*K*̹v&Yvt|ީgMIe雭q$$%Hr:8[ERqFsI֌huTQEbtQ@Q@Q@Q@Q@Q@Q@Q@Q@C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222P" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (wqYub8zo.QU.bI`Ѹ#U[&QE ( ( ( ( ( ( ( (@ E46@>n@r)h(((((((((((Bq@ E REPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEPEp~9x P{l$st~|7gZ,0)eIqy#4X$)`qϼrVѯ?$ԵX]LR$QӞtyoc+iޖ"GA?Zn {~5\zfD ܪ8OqVV0@SKU'N=i2 ^gWkcsn?*F ΍#>5:Sk\5Y9_VpVl]iq Ikrx+r9R1RM+RsAR=:51|S^Ԭ4kvl;˪aX nyׇ3j!iQx6Gmy*N=ϴmOLzy.~ Mѷ OyƏkyK5G$aTⲥwįj1}f+ 9[̬>7]⼟ᇉ<@'k{}wLr{'5xL4V{3++a{x@xM6w42ΰUgU?3/Cן\|?)}qL7og_D7?l:8˷iħ߻׷zlJ3WZ(u{)5?%5Qġ0ޠ3}kׇO!:4 v'ncu{vYZ׃<&^!_jF3q,a(`3<WG~ G%GQ:VǶ8c෉x>[Uj `0ߝOk1͎yizfZ/ʀ[QzVG$²訨E% oG^85x~.h,E+ƗsdT}8Zin5;y\ޫ(ᙸ {FEi;AgHX)c$ :ZxÖ݄SmubN\mfC T\ c_Jೊ]b3ƿ)F:}Eyׁt9M*H7ȷQ0lۏ^a5/ h^'{[[nܪU*O⮔=k)x mjIn!$u.B랃Wa kF$xHb'dGӹ:=—grfaH#9v&W?4ۅYlreZGV^EM*<K{w/  rFN{`2h'ywŏÚ<;4b]BHXЭ*o uҨ6֗ǕWHWeY~tM{ymb㷈<75&&AȀp2?Sa |_j|KzDZP1GdЗ 's``ƹh $XFqyh=q8}xwÿ 'ce~3[zݮe.nXy\HcNIIrbt1.6F"ܞ HA;nEJOd`q~h3i0+H$W%XSd:zSig,gZ}?At+-P*?w9+@ִ~؝b}z] tYr3F 4/|Pmai&gBaQn+SK)&[׸VveQg*rfxTHuߴۈY"Pă= qR⏏u^FдY(̕g%Kς5-tj尌"%U9sяN+_~ע.~k'_ݳq++ԓqYŸCVR 66;C@Q|<̭iH?Nyy+?x&ADrZtvs9Wak,>E𯝦[hHYV<ȹQ?F _ fhH%/%"#y0:)G_ :׋>MFH$w 1H]%!x}~8QdA`H= ]ֱ]+Y4iZbG5گ8HאxEݩ k!R>GC~*Z "J<ԉ:pv3 @1]׀ am"K[i^]Jݸdsi)?Z>5>j6?I5ﬖWo40FcMО!zŞԴ; ӱ6Ȏr@'ǵZ |5`_x{{~R6Ӧ+i Mge %K"$Gq\F'6KQG#n1OQ@?a|4SmGz׌|oP_-yd;hYr9V&wٗM?{g+`y/hOj5Vnzy\~qi_A Ӽ >ȼ.d4@;&j6?K=X_Y,Fh`!#n1OQ@u-QhMRWzVQŸmҨPZ?5KqڼR?WZvMQй̻+|Cg6RAXd RiI_ 3g<)5]VRNA#ɮ߅?x5t"$]$<''(F=12p==je{UE`FXx㊺nUv>)%'1\}NsWSڰ|;o*ˈZ)n&,Q[Twv Jȭ{k夶UԎ{Ƹ-{خJadp<'ν+;wf  kò"i"w'TzFbEX)5qҝU=?5 W= ,N̠v ~*l*HRF-Q@ 0jZ(0(h1KE&Pb Z(0=( `zR@ 0)hLQKE&-PEPL}hLQKE8kU(6ot=}@▊&(.1@ @ Z(1F-((((((((((((((((((((((au),I"uMAɏ6m.b.+"(` ivTPRbZcmule-2.0.1/tools/installer/images/image_bar2.jpg0000644000175000017500000015641310621717250021407 0ustar charlescharlesJFIFHH hExifMM*bj(1r2i ' 'Adobe Photoshop CS2 Windows2007:01:23 11:55:44V&(. 2HHJFIFHH Adobe_CMAdobed            ""?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?ұgF6#B}M1ʡGm[H"=-蘿Y?m3'-{[WIoCǼ$l?#TAD3U*gZ LAO>!OZI$*ts|e墜+Ky2׽/guCW}pz.MŮm/Õo V^9[ff7ׂ4<}Zƶ=Mkݨխ#N9]1]6.}3g >*ey?<`׏AʴR[_/#}v7{^'IU?f?~?HR_﫬HH|~+'탫=-kvU&8nKs*{?+C-صTޠ[Z?7_A];c1Wmy2_{sogZBY_KQqǸ{\vX[֗{?:mV5ml X?el*}e;7&]l,}k>w諣۽}vXܜ{\UuQĹޟѢ?og) ,ơmUC?tj];Ud 9ip1igZʿnՍMM,Vٍ? _ܪ{?7htM-]nh! akg Nx9E¶`^Hm^b_E埙eUWj%oK&?Ie:ʮnImޥDY_Glq7SWE=# prw;qEIOnh/o'E?}6d'}} I)c_/S5=՚F밃mm) 9?U/gb^;N[*SXC{P߃%/Gݻ]-fôon+-w95gP¬VEZѰl-g>Xֿۚ 85- ēN?~?g4|O>)%Į6O)݅{hqs_OC_lIǺߟ{}&cuu䶿{Cu{A#[58k,۱RGth!^ݺUV_/pnOSiim$5z5W]3]WmVW]r[gg社vv~59I{_qem~ϴzזtΜكA;&7g{餥zu%v?ѾQDG,-| 0.mDn9L)@3p.먹c\Muls7[Uv=m<1ÝiQy͘4WGo+uZI#T;?]^g4:C:)>>*:}?p\'JH5JM]>i%jx$ȲYAG{~Eg;C=;oU*ĨdeП4Db=Ies=I$uE?\Photoshop 3.08BIM8BIM%F &Vڰw8BIMHH8BIM&?8BIM x8BIM8BIM 8BIM 8BIM' 8BIMH/fflff/ff2Z5-8BIMp8BIM@@8BIM8BIM_Vinstaller_image1 copyVnullboundsObjcRct1Top longLeftlongBtomlongRghtlongVslicesVlLsObjcslicesliceIDlonggroupIDlongoriginenum ESliceOrigin autoGeneratedTypeenum ESliceTypeImg boundsObjcRct1Top longLeftlongBtomlongRghtlongVurlTEXTnullTEXTMsgeTEXTaltTagTEXTcellTextIsHTMLboolcellTextTEXT horzAlignenumESliceHorzAligndefault vertAlignenumESliceVertAligndefault bgColorTypeenumESliceBGColorTypeNone topOutsetlong leftOutsetlong bottomOutsetlong rightOutsetlong8BIM( ?8BIM8BIM N"hA 2JFIFHH Adobe_CMAdobed            ""?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?ұgF6#B}M1ʡGm[H"=-蘿Y?m3'-{[WIoCǼ$l?#TAD3U*gZ LAO>!OZI$*ts|e墜+Ky2׽/guCW}pz.MŮm/Õo V^9[ff7ׂ4<}Zƶ=Mkݨխ#N9]1]6.}3g >*ey?<`׏AʴR[_/#}v7{^'IU?f?~?HR_﫬HH|~+'탫=-kvU&8nKs*{?+C-صTޠ[Z?7_A];c1Wmy2_{sogZBY_KQqǸ{\vX[֗{?:mV5ml X?el*}e;7&]l,}k>w諣۽}vXܜ{\UuQĹޟѢ?og) ,ơmUC?tj];Ud 9ip1igZʿnՍMM,Vٍ? _ܪ{?7htM-]nh! akg Nx9E¶`^Hm^b_E埙eUWj%oK&?Ie:ʮnImޥDY_Glq7SWE=# prw;qEIOnh/o'E?}6d'}} I)c_/S5=՚F밃mm) 9?U/gb^;N[*SXC{P߃%/Gݻ]-fôon+-w95gP¬VEZѰl-g>Xֿۚ 85- ēN?~?g4|O>)%Į6O)݅{hqs_OC_lIǺߟ{}&cuu䶿{Cu{A#[58k,۱RGth!^ݺUV_/pnOSiim$5z5W]3]WmVW]r[gg社vv~59I{_qem~ϴzזtΜكA;&7g{餥zu%v?ѾQDG,-| 0.mDn9L)@3p.먹c\Muls7[Uv=m<1ÝiQy͘4WGo+uZI#T;?]^g4:C:)>>*:}?p\'JH5JM]>i%jx$ȲYAG{~Eg;C=;oU*ĨdeП4Db=Ies=I$uE?8BIM!UAdobe PhotoshopAdobe Photoshop CS28BIMmaniIRFR8BIMAnDsnullAFStlongFrInVlLsObjcnullFrIDlong jdFStsVlLsObjcnullFsIDlongAFrmlongFsFrVlLslong jdLCntlong8BIMRoll8BIMmfri8BIM:http://ns.adobe.com/xap/1.0/ image/jpeg Adobe Photoshop CS2 Windows 2007-01-23T11:55:44+01:00 2007-01-23T11:55:44+01:00 2007-01-23T11:55:44+01:00 uuid:A160C531D0AADB1192B9B72243274F14 uuid:A260C531D0AADB1192B9B72243274F14 uuid:8BB2F10EF89EDB11A9B9FC666DA3F428 uuid:8AB2F10EF89EDB11A9B9FC666DA3F428 1 720000/10000 720000/10000 2 256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;ECCE5806F8DE1C9DFE40A62D9EEDA41F 86 400 1 36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;6AD9A88A74A7EC88C1E6B04D540F90A8 3 sRGB IEC61966-2.1 XICC_PROFILE HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)KmAdobed@V  !"1A Q2#aB3q$R4T!1AQaq"2B#Rr3$bC ?3Oijz;+*d%-K68;Qu2w0+ج]IRNվoc!U(q&W '&`u[O_|c?RbK܆[QǝqG*RV=l% $UOu6>u)>4wp@Ovg( R@YH)"?~H2Vf2)vnu_Ux+\[  [dBP`5#A uDgN >h+ -]&cA f5Dv3a'M0}Y?K8ݔV Uoj: (z"%$M}z9ci[o]@K`u USsϵY49F:J?Oxeچ5qxi d/3u{%b8/cmO@ϭ}Fm!v|hc;K(umX5 _NgqgƜcaJ9YOM識r!n,&<(F[%9Nbex֠6HUGr5>x*"IRѾT!`]"R Mt^工9j c}})3ՉпWUujV*w$%\\V$dtz[]F35R<"{I$lKb7 Jw( ,@ד½OOˬꝶB5+S@nh@f gASO:?Q=E7Qi]̬_(9lA?[%A;1؆PNΤܘ*.Ő,b4̍Rj*l"$J`v:`0 T iQVזJ @TZBl251m_T^KS* X1b$]N `2'XJftC KXW:*{U Sg &Qfޱ}pSκxHIԅb0!LH dbbtCkW;|$TK a l4/~AS`8un XI=BEEm=uŤ@On?PzE_Ԅ Z %KfT9p?IQ;XcHׯMJU%Sۃ-mIc.|ʚu $2E~zlL4źIŰIŪBI>Œal+gec:O-p4 JFTt H.bV)=ZgIbw~uD4YжӇ.N1l2#Ɛ[6DOt8*qZu 0<-U6+řtݻvL%܉[uBVwJ *=^ǽiA WjdDnO@5SdѵdԊ+DEU5>^Vcw{ a"d"#٬:k(RB=io D%eӵK D}[tIffs\5l%dg\K+%!g1YƟXb4[:(vSW3W9=Iq1ǯFaM`}ꨀ(sT;~F%0$(]yD3IlQ"`P[A?JbdG]:X9LWױ\+BXŊ3:%wuT =J6'tBfcW -TY.S$S'Bg@M:A2 4 چ"+%"W LZjcB9YbV 1՟ 8V0K|N&K-1}B==4)4qʌ\0JԬieT`Q+dr@^Pƺj$^Qox\+Y1̃ b'X5=11ƿ׵*Q>odTlӸrd%FyX۸%ֺ9P"5RC(PΥE{%nd&V=nu F𣵸D*4)DGȀ}Ĥt-'Yq{ hlRMh0:4wL6 % ӫa.h`)WqdC7Yg`봠s!GE38V 4 NnũZFbR#X"d`]=bz D&[,A>i]~V\d;q%'Xf:a+5ʄlX_*,1 |da #3 Dq Y|&[,L"uK!+dm~3Dzu>"\ n.,@6.-oˀfNȈα1ԕ#\k=I@woQMy%, )d 47zLzG?^K+8Wח+q%`; ]33:GIˎ:28-管5qd i`e 60ɍ?mb* wA-^~-|tf {`'H!zi!C'Kk?uUT#f2G ^bڱyzFU<ӏe(dEgrP&!2BP4c_wV-ju%9 DLQLCVj2_fHQɣmHb(1vŧeLo%YgN',0QPILHl:Hb2 ߨOk3\Mg2ͅU!a` HLCB tϤuXGCFO: !ބLHbb5ш1>t,W8^i\HwiaYHl'ML TˤSzq 4ʇozִ@KtνyH+:M OHIk|e؁ DH se(%ջb1OzA 0ȞȊP LD^QXF1ʽ&]2dBFd%0aB[1믺#n8ez=f㭊aa!`LtWu>1׫+8*ğ0:X-q$L[bС5ɋ&l.@wNиAYУU{O\4Q PGlĿUѲRbלYnl)f$ړ2XZhkH@(gO `i@ JRѺ$i? =nQo여m+bU'a@ Wba@A#Dz h `Bd 'cN+f Ėe Z= #n@6֠6xa_ւRq;kdbDKWJ1י]A[P`D$tHA&F&E b'z2:Qvnȍu)aGib{KI0s!q:3YNS^pfl"XtNIA۰@S^>'\DTQҔ5HU6-BrĨZLG| !tF] :l1a4>10Gw{mȁ/iX[DoXfP(fMtt(*R*P|%qٻ*Q$Z}b΋MfrrKneݰz(]&Qt$3>.k$A7PU9A9(=%6h:Gq#5VtCm5bEh;v ȂvY3ϧsaYqƖc|ND䂾/TCOhoiFZLqbf(,S;+' bu%BKC_!pG@1y/b,ъ,ا &ZTM$r7ĚNddF?X8Z휏TPRSZN h3u08G=)Q"wV2*VJoξL]g<vrU)629s[pr%F|34r" JNCZ_ɰ+['Yvu8F=7q]!B\7U6=gV ++hȉҫ^)OL9/]]ϼqxbBO8.a`HDz>컪\VV=:u|#/=pCKJN߮>Ю02PKp,*l5nȚ]@fDRV d߶'HcHna’9\ˎݳf|)ǘ 3,E,bߴN[}/|yHI`Ӌ EZ.%\dQٕjNi{Bdb}4*V[9g =:W- $pFFl5ݯYd7tRlU%)D1F㭹L0n|+ KHƑy-yMt9<}!;dh`ƷipC$AR,jzltz2uutE:PT5jٝ%Li?Kmz[Y& 6>Yf[<7♣㼲|q'3XkXGFl1cIjVg[2sb? ֵ#>|o >󷐸_]Wptrr;Ugk X=e9hF|I.;wb4cXϕU|ݸEU8'ܯr_+}p_Sɼ/ S8%C<^ulHVLFAՋq-vUIP8O ue #aZF8]"x9_ Xb3KNX߬#I=A󉴻g]Vyn>n#$W|ʹmx˃5+@[)ÈVy \3 Fs #Bec-\@ֱ!$&v맨mMP[S]l]mkH5D@Ǭi44Վu&>#7@qo0򖄎H̩馿k)v*(,M^KJ>}m`\ȜdqW~gR#Zڷ<}O#ZJF7 ub?i8Oƴ*ۛ7]Nx?ΞMr☙k]iVb@+,,d(PGq@"gI@hfW)l+1}Bi*,Hgv2ZG-YX/O;frV/~5 HgoyA(EL [nNݽkhqB,OZ|/p:Yo1^ulgul_ z-e=9U 'udYaN3x~5[upm7=yS>x?x\F#fd1xn2N[[r*kf$(62;'sSaİ$c1P]:… 9[^nw'.jmQfN0sX^gh;Mp2>uޱ9im+뉃*y2Y^.,)""hlXrZծ$"%c:NG%-*Y:o#{Dq;,(-=7i=m!bG¿#OnE0:a%"/6* MWbc h*Y*)9:JLnp "D@ ",7,:EbqGnΞmI@J gXX2FF#@-'awg]DtiuA9gΙmƦ™;xÅys<I]Vmt-W7aB6D0co#Z-\q.Ro!ϗ~uN8ҵ[1js+ @)Ы+2lS`LL: bSmc4fw&Nce&Cg (\vWك`cJv^#i=)8ѐ[a}z1,PJmH|(!{nr.[k2&\R|e% Ŗd,D}_Nl= *1UԦ='Y Y@%?Zk@m.DpI*-#/Ւ6ykg3s0IUENd?rV[4xg kw>Ouu6վ )/#q9CE:鮽ŝgF8Y̐L]mpMp_6#'|Yyœ_s1Tkvb" :hQ器&#y?ڏFTr>Ad١͡i=c#tα[ےxhlW/[ aM b81^$`qmܷakug2&(495\S2OƬ( T1~;|7q8Glg g#+u%8v?g'v 펟uy,1>}֚P*lR: 50%149k``1 o۔.{6Al+̕RMq:tX?tejאqT9G3tRfx|W_k՞H5Ȥf%UD'1;&=D۱q)U}zg>+F_*y(IzTԮ%L B*RȜA *7sn}/!]下LXU26ōC2Q DϧLIY²yxW٭0Fo$dq޸mD;b_} dvd"urڒq.bG:= ؞U1G :eaLF@ʑZBt(! &?.W }i W|l.t5)6/ &(.v8>1"M [;oPrGJS\%R'еf5xM/~G/iSanO(l3XXmMt"}[6,XIR{BJ >0xm JXv,r k E,rA#I/i@kl2"9%p^/\0Fеn攮e,N@m4V*-?^hL^p*3(߼7;MzxORl LQy>MjMDf"b}˰f{kUVڄWaY /yf ˍ ȏ\3 NƬTNLZF X>ޛ큤P'[j]I?\&2#/<>z5?Pqح˰ƢRА8}:]ӕH,T.1 >gU;yS[]E/g"NؒWm6 mM,pam?! r UC2 fuu]N %&$m ?-%nL?-ʹ:7Es #Ŏ5v~JԛBF:lv7M,8+Oၪ;V8E2qEY^a`1-c9<^Vn" bzDGS4d5gJ(˲g5zIIG-XdĭRT+M]HuymmUb+ l8n]yك-.41?=PzDӍ͂Uu6  flwLar"NƲzk+qٙpR0?#8iҩxƗsMpüqcM~'VObdJ׌4 daB^I*+Zrj[U9ofۅwԿ:p/#5xx,=EI{K0 Qk t-oݵY(a]JwVQZԖ?c৏Rґ ϩR R$ zkb&tЧVuc}^V_&^9a+ltYmLq߿mgI3f9K77s14r U5_#l:Tp|;wJUnƯ픪> q֤oHs*H3y Gaƌep/&l[#])dz9=j ts'mFҟTok7She8iN{;"ٺ11uI:~wg eg9$6-_28ۘw q>Sbx ÌiŖȼ-Ƹ-&kK7TKӲ;v9J((tDDG_9#.5Aߋ!fO!ܕȊ%)KR' _KR}4&xkl֯-䶫qCp$ %Cv,55x;BZ䙇푯?Jm7t6WwtҲjձP)&J ` j"+ @ulMzSP8ӄ$i\O>aw7.۷Hy>Wsb,d&+[b iDm~ywW$ZۘU8_1*SF3yr~泍*^8\5 kv6#Oicr2*p#>UC- ΜO6~y_G \F f27:74b1d&Ei.ŶʌD/ ۛΥG?=obBոU汴 2QD#ѯmӪ6/ܨ>mF3+`}+ R={~O[WM~A.1A +$T0?Y f4诲&’xnWXsAˆ~Վoxq|St/vnQ?m<6DxwF?33?b j]))W8 0m}?`}^~mqVO d@7V3m>{5̧;Twx^Iʢ#o??\?\|ArSc(xk-Cb/mY, i F0Dџs# ;+y{N;k̹cWL1{ȈNX0@C'l~=jq \kbm5gmՃ>5n퍟ݣrd)(to\ ?HۆѢ:/hƀ/9b (v$\yҮ 5X{-|)FC?OðqO4DcXmUX%zk euy[>X*4OǴ|ٖxq!˱C)V6𡘮5eQ j]&/Sc[j  r)s3q6Շ7Y4dopL( ۭZ-1Ѓ,D:&w<\9RoNWsTl|x ߚRbT g-۬li:)eI{?[O"L\{O^!牰O>8Oǔ.U.,GCd6Č2НѸl.#)eo'Ţ2-qVIfV NнfYIAOK@)44.Q%6\Jd4A)im)+1qvwڑ%uWUK^W/'q e_0mx+ӑÓBؒ:AF6Q[ plhuoTn쭾([FDI9.}ǹ;%㼫`c-ؚQkeq&g'SEv>Lؿnݰd{{.®ӎr|.7ʪXl9bT06Rpf hNZ%ZD5>b@С)w#L(k`rd0:ǤuJ Ʃc ^/*NrŜM&޵cԇْJun1ceRO2bنd!+*JiCe:3$-"$cOMbuGf;)NK],)b,)KQ`H t7Mc8=Uvo?*y臝arənVVpneTv+A-K?bGsB#L?۲5ֆQ5t3 \ozO2j: x|g0Rl:,c#-YJ)mpsY ksٗ Ѽ1)9O5|UJ%\SF?eY8^*&*}¸5!DJEқivàHʈn/> gиo'O s<7S!J<,wr a``HN fll{D@$xY{#9Oږ}ԥ.=)7Qd't~d9/÷ݼ:si{{q'9|m7 NCoZ]f?<&>y\uTSs=[r"B"W@D"#H:u#M1!W4#|Pg<)O\!?ЫkA[qg> Glm=#F[`Wqh~drR{O~w`Yju3|<6О[.X]W9 Y; ֦!ͱF X Ԭ8g;s;'zi㻎eic XDȆȟNq pXr3B 4lA^)H)McdqVY ?\J-5r]FȧA) `ntO[-<Ӻ2{!RuYX}Ÿ;9~60r5Ud{*%Rc 3G#lqV)S"s/ .ODz8 W"Z1C!Q47֋5ZpLaH]V X.Yϋ+R*O.x"z+|?!0N\^U#Oym`6)!RkӏWhcOљI[}X|+'|9?aGv?lbe^F߂ݗe u>-۲ߺcB1˄ОKpw!{qK+\95XK|"ihL ILZcfͿ?x~ŋ4g$n%<ˋj5)"cgۺYb4/}FуҔnXM^n%|u9e+é<}g&@fܮْ5&$Ơܶ"XI]|<< Pct'^/9S H&jdbs" dv[;O^]G|>'޽ cU3UP86rKܛ(=?#6l̦MA':nOBDcV Zea uY5(H$ c+Fшx88q G^/8_M!IeKBSxEfJ&дS;'M}zuZ'"*.hupGJ.9W}6n/[<|N\w[VLJc I`fgIr6>86fl(9#S?+CrWP >%$-#= YǧT­agy-/=Ǜuw*cVÜqAPYY5 Zř&F4ͷ,n-؀@A9ffØ5Ұ.[Cy_񶯕pA[d1Y,l3ez@X7HÕS_ioC]Es =.g~FX/"gq+nW]D@7M0] uInP^aR)p,R4CUrK+u9d$F#n4Gܯ=Uv %gώZ%h^ŋy޶19|l,N`q1e=߅4l&=8&\bYώdUXOpNm5~E4ֹw']Cd+7Òuͬ(RDf~5ˀnڐ>x rT;vXqD5&c1Lt>Gn@SF>{bWjk$ﯳ; wj:iU6LnHZ.!*ML@ %х{V;!`K0 %BAIiky\`W|q_~'a~e!( eڜ(22'3[M( *NظndB*T>< W&f詰3Y.+W1cYc'1lrM3V&]V %$D" eHfȉUyf v OF63-gߍԻO}0xl|W+C&dpbTc9_|y/%UKIc1u6[eO" k7ͻ!>B@`xզXz|1[B&ڸi92[331=)`ƸyF-l/YN&;}ĉZ9xs1]jv}&{xgFI{)Bn6j8Wt+@)QkN[5_I];<,87CG^V2Yb$V (@ alڦ*>xOe!0lv0_X8>U~AXUN9ٓ$I2p: se@ )2'Q2prUYFlL?fr45E,N* "\YDjsVuXrʘN\Bt2#C8-ɘ 0h]2,1:'ncoou0xyVŝ̛#fkjr{3m$EjhluX;:b?}RFc_{_Ls ['[Z8^G5S5lqw@#/ tۗ,:e:{ڮ eVpO,(zg *Lj?d)`6 h:U.DO 0N4E/R:Ը6Y% QI"-+AS:չ~MW7毬\R$s9r72ͫ![ 䙰uo2mm(b쯲sѻr\!X}ny!(AbAj^Q,XW-%숍;bcYTX_5ۼA>;a7HůBj(i>䩨kw I;ŅVy9"OlAeX)ϮY$OPO^1S;^\іnR 5T!N#R*flL h.cXvn-ZFN'Ix۴W&o73a |8|6We R\]V[a~:n:fY`'䷌sje${-<Sڪغ|'vMaIF+{}2;+&-=)3?_uy{x e-Y ,sRX|ŇT(e:k3oԆCvRyoDڍ_ǧ=׆x)NHӕq)q7dL'K;vAhnϺe|^uTUrf.1Ȟ&y 仵ay,q5ǒP:ELVrs>a}ݨyIQ.CrWjQu+y&q-- OYq#^O*Clq{ f/ؾݎ\VyQmEtaqx R\ef;'ѐY.mٴÉ(*2٤Lm?#HxgOP̱ϛ^E 7؂|Zrki6\7,Z#:"VoTd }Vemevȯ8gOjwGIg`h.y>Cxkgr-M6 gZf%)#>_:z63 |6\'Ua ՗oٹ;nը#7$`t#?p1tFѕ6֗@5avf+8 A d$2ɃB51'td&&pN4nB%UkOva"Pzw"`Mb:PV<}:"k|]nص{ IdLX N <**φ~cvDRni3v8$a*% }R =T&e.h0E6K_rT3G`V\X @s:]oy {v(PMoF&s(li-v>?*M6Qn>86ت R+WV1{L*]kL@45 WR\ե43IXXIpۡHY@㦣xλ=&z/\,ǜUmIVuC"8𜓆 H $\lH,~"1힍L`q=x { eg!?N_'$5,;ӏ`9f<ܵ?viro}g\b}kI+75fQU/'x7q)eŢUDr Ԍ&;e1}_w:ύn-e' )ћ(4ihL 0cB*(/4DAEU qK</>)Kg?3Y~d^nqmE8aX1iiR4 .Z_~C#-E:RoYkYU9 M֏Q$.~<0}7DPEtSm$N1liȹjS:7#aLT k5,SʱV GH":[vY ')vEk1vl^hj?Vo2AY4kEZbՆZsahdffuI$.&qSq|Q\m_$m|%/ )b/0bE~}Ѷw#'_kݏB)`<[?[~ۨx=.]*Xۍ/QIIh=][P:~PE{vWoZ8Mi^Vd*A}2ZI~[w&Y~Ux9Ӧfӄ\Z#ޱbQ^*-N~)*uѻ?obOȹ )&y^I͔8`bpW(`(gosk{K c3+szcGW.)Ys8g/)He{5̸RrD4׬k@#9 ^ˠӯI^Day;5NSak!ٌNcb4@? lxu ܲ FxQ꿆q7s̳G"F-f9ųv!++C)J= ">{վΙ|agiKynNG_4rL˵m<\Kk\d3֙]*%iѾjΟo$ E\ l6M!_g|β4m_9$8wьSyKyW9FPb4cf p5)7n>@ p#V)=lM|<(^mbX uJ* J#H{xQG۲-͸w)gi6 |n8VKn'H4;>N_^nͮ#BSƤ2>{!dkbG+#d N-i1"H.)eɰ8^*4ld9J(*+Xy4Ft]VBT9pnz& 8xGOɿR49|8ϏʩY.pSKϹ6+^IaPְ _k@¨$g L,֔=dsrׅ5oVn;%F25a#bf1[evذ}{+6LG\#:N6<48e 'oQHaz0aݶ M,o :I>7Ӗ#&ðx ͆We+5dPf3Vn1B2#]z 'd[a}11ʖ8x6Bb|OzZ+2A|'|VX+DX c6ԍ9Y`HDZAN:EYuP iZL?կQأLuT(EYMd"%-v4kT :O&'1UԴ}Txw2vrvV)D eeAqΑ=_Xi94nQWx;=Jp˳9,Lc*]Bc';cz}`DePVyCI t@|vJNNdZADäJN4*|׫[dUFY Mf{ej e%EJ?섮Nct桞C60'ۺ&L(ͅ,"\l3DκFOXΥV+IY+J=75ֿ)-LCrpg}cSQ[w )in)"?eDв+nq%YQKrCqPeƍ…B30T?9oKWVF-ֽtbʯp^{=ҶF/X׮0-K҅}k(s+Wc{ct{nIgbL[ 8Zlmrlmk[5Ѕ"5Mk7zQVyhv숯Er*=5I5b[3 ?X)5f: :9]:*ZYav4S6ddt-uXZ3Ihu|73*8O!kJb[)SvODjvvD*c8'0`v=GsƄw+S>9+5(♔ƩudV)%1 nn>j0mdV\G*՛)rpJeT]qv݀yqZoȍiN-ՃyqΑm ҺAnK^ܛ@Oz! "b(j{~'}#:SvEνx0`i(NH,a(4=M.aҖT>Jf2}DRe"D6=9N%ƽjAyg*.>ֲlQ!x\q52'8ɉ `_^~Wm3e]C b˵޲ f;+upz @Rȁд)ƚN('P@#Sa_B< U՟&2j"*cDv}ߝc8MH!P}Ɂj?X)'2E1? "cCm:wxR# oH-}i7 G'N#4(wKj%{ "d.1lۤ-@ӏ.];)u{n5:h, 1Բ2{HvmnoAOu)bna\#zRtadN+r^6 D3fWRV+d,Q%;PE`7A2o\$+mFYHv1MFv`퍵\,Ĥ='Hړ&Iƫ %AtZ Qƴ)W+Jqi?3SŹ}1QŞ$,{>H(PmF5 `) H)nF[8]tHb><Z["TL@u\)s)SF (zZdVw LZg #jR"1F'^&\PycMtѨ&\G,lY5AmzLim ./֝x=B`-n$*TVR fs,F4-] Q&Exfl\*J{W oOlw$bb?H;tfHQh4@DA29+6X4>XmƵaA|+!#1f1o\*u)aHV#V\NH2Xu]:_o EZ|[AA|sR(+dɕ)m$BRG?Bb8cBG WEY#"R @A (bN\NITULP͆xX[:Ǯ}W 8[H>1cYa=D1t@N&Hj׶:t%WkVCUwj!rUv-,Y&l33N'rPM89NFQ^N'd$S&v wX\Lc&"":NzՅڶSJt2#| dF BLG]dZtТ5NY)NL k?<$RNX4=[(cPAtA2)x.:Jpf4>Jun&h;CԂEU8C4I{ckIO:]f04@N>7T Jp*R E* (%?:mFR.Ʉ2++jT2*v2j^ L9KQp}&5ݚSPbE*!MS= b@EC!Raؘqn2Jp&1ZWTec>gf ͙-d%C>>.F\6ͱ1NiE' 8kU1,8ӥu3xQD~u׋v'_ #~!:zsKeA'1r`0ELؖf dSczl@21 e2D]MDح51fZ5 *1S$[ӥ:ZY# 5'd^^B G|" ?FBV Q<(T%C)& r0:{:?Ry&ąScxFd3w+U e{3hI\Ĵ,l{1I7.j * kbMWN[o-B)dQa,Tztڍny qɁ8pIcCOQګoARn" i]gC"z="ڿs]DOʘ^`RKmM.oت%`X6*@{g]?1PJ2h\C _"mM?Vҋ *ҵ: Mh dcY>޺zOP\}bt:Qxޒއ)`QfJdgqiC#}%qX1KmԔ,aӰڸJ;õb$f'4j'LtκZYxYދ%5ئ#3B0HNY"G 6@k:^XpKAW(oB B f s`@G?ukk<Ƅ&8ڵՔ&Ȳ$Q&PƔ%/.$&G-ڮWZ* q`Y1Dh&uEvf!kBPLVeA["T ;q0 m93#tH N@tM^0iC VK.bH"uHVN")9nYuUZ)+OIZ~*x,4_k&D-1n;vx5j+l m}zu+'%3:gh»7ɪlL2"{]J 5+l[fuľ*8(Rca3 5ǻX5^U6D{`/Ʊ}p" jUk{T].B wm Di7D]vRyAZI܆b=M2H&t"gHԅK!WCʂbEBK4.p59Lf`Nt43P=WŽԭ:X"aJ%S#Č餞~`šMv]Xd`c*=$zh,F"&u)ЫP(sIvFVh%UAߢ&wzz$,%5 r ٨i1 OM&d<*$ҙ@d6v)-sH{HW&DjsS iL,p\2ɑX 'ΣF5CJP96n%$aka͑s%1YtzdyJ#PA<m2!H`nl̃R - lDADVE@ea ? "r%V Œse5v{:iQPǶie>TZP&\a 7XDD* &k3g R-<1QZ˹3JN-PKj2O33አh*H[DC^l^O}}. ;'#B0P^蘏wKND ?%^sՓ7 ӯn(1kjͫi0n&#NHQeEāA&2+;Bve2vYzf͝GʕuV<# UٱUk#X\PL^[vݠc#lE,\|HQd-MW&TL`Nm}Dw!{!]ڽncQjr W -BntŊ wfֻK3+yIbx~D]-eݮ$mcu \hY֔ZHB$HJe`gn4 )厼(w9oRjJ.ԖFnI:2ղ]AQi2ԉ :TovLŐ0}`w}4nT piBc_owM_3uep&EK$.r(){W%?cmn+[Xc_ֿ [b=xA@Vӄ5۵-5D/Bc, jQ22-u&$6Stg˅Y P"ՊJb6vS6C$R0ۤLDWuiI㮩yMTJvkTE]؃YK lvMiƹ8{͛^L=rE3BU0-ZDDHwiԝDGCX4p>&\ؑuzV#/iE&Jg>0Dϴ6(=1(HA)Vn,:r=>4ډql&~Ͷ2ި]@`0̐ `H8)/QN:mXM65EL3?V.aks7I,5OӤ[fGх},Pj9uWm 2ҙW%6DLȜ^㘙):YHn8`y|'UZζīr8R$m %J:$3aίc2p;MQK텵D09LbVT}hĘ[+ׯ m[bAdI ^\*W̜c^C.g\2vBlD96T< 5HGuzci$):`DeLaҵW,tR@:qMC.U*|T} |fh?=o6֚%Irc8 c1ӏm'36quhZ^n]KþQ}2?;#eFӹ$0݈gKmyt¿mule-2.0.1/tools/installer/images/Installer_bar.UserOptions.jpg0000644000175000017500000001721410621717250024464 0ustar charlescharlesJFIF``sExifII*nv(1~2i ' 'Adobe Photoshop CS2 Windows2007:02:23 13:10:1102200100PV^(9fO ' '"  # !"!%'$ '!!    }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?.|]kZ[mѵwYh 9mө<5x;ǺVaQHڱEiȮ(XM^= ˩Is\ǼcHgVu,L{M: lQ0]^b1Z332HۖX:+ȥ)˭M%E[ιwx]-Fe٢hQ`f7chw+ƕ]51 .|HV\@ƫ`vU+O_o^PηOy_D&*ĊFXɵdn ( ( ( :Q\P'_F?o{[L޼,v{PEJJ ꚅK;Q+`JƾBjg_hiEs.,;Icsܪqk>.xBԴ} 55{8o\D)bWi8mȠBk^;ڳj7h *ݬ' A$g:d ?Ś&tz:TVg|w;O^ =oOMna[R Pܤ,]Tfe˱2˴3#K?ZnK-WLn+!%9*@ Az*3NeC+(((((((((C    $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222P" }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr $4%&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ?( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (wqYub8zo.QU.bI`Ѹ#U[&QE ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( +3ZeVf9#+-S=jaK*K+ A $N. s}GЏʶy%業bb"޾Ϡ{֗,v[L.GJ>prO脜w8Oj֖Os2 TVB~ڲ1vJ*^:vHAu=?ZX/{wQWMlZ0dto@9iД^PFK]`*,gKM[,A\Ji]h7k%` A)ՙ\/oj>:֩k _=Ј;r翥wfq{VO=x 4|Oiwz h:~|tw|Nѷ-x+ZKWW]k_&S nZ` JӾ ?P׉!'h 9@Ey+hgյ%z!Xzs5'MYpg\n7uj=^&5/TѵLڮtm&]ydk5qam8GP ~@@kl/m+/lYE))D}\hh=8?PpGҼ-Q XYnWچ=RῇM+wSM+Y! g 0996O߃[š̩ygt|@ A`񿉿?}Ǜ"7gZ:7U|snݳzp3ywI߆xW$K5˵ٿ k3 |Sx[GYqe F% b`0:PxV΅Z\m%h"ܟ2|듴z7AǯF:WQյ-?-aԊ\G̋2 0b0{Z_|]xk1Ʊ\ kSvz~T `{P^1 kQwxV]eK *7}[_=k#7:˹cdO8a4WjgźOwG=֛f&Fu{,ko*(@`|:NЗ 's``ƹh $XFqyh=q8}xwÿ 'ce~3[zݮe.nXy\HcNIIrbt1.6F"ܞ HA;nEJOd`q~h3i0+H$W%XSd:zSig,gZ}?At+- m3.i N$QPYO^SGDʎх߰UH[\qҹ_?P&Tۊ \r)=1|Mhr\~G|63Yv4R xž:3Z*9U;Yӵ MV -g]d0zea[%ͤRHd0r+$?grbU@Yx;wݼMY0=± h 3=#uPT5CD'!o|CyMG9*I'ڽCy$P**Z|9MvQ(rͶEr@돗!^k(֭xS/{rvBJ |ҵصwY 2jlđdqhM>m3wN:>$@*"Kl 2r=Dj"}*\n[r.pH=؎Ҽ?W𽍧ux4w'6*c /??6ޛ:~~U&N9-6~w+Ѷ8=zzkMJ-2Ѓ؃ @"NC)GjʚǯkL;dgZ{~hy Oceb  A^t&&XI$9y[F=L@}:*?ֽ_Oxž9Um`! $08~-_SwWL"I.EJCmr~8?ٯ=sx}y7O]fWzdžC+o屒r3`Pk_jrvf8>=HT1?@j9f%͖Rk4;"@=pxC{YxLolbVX*@!?fͿ3G94`$`^T~5|eykzm΍m Alcs$ʄĀ<]| |,-ՉHnbF gb#Nxc\' jJKE-ǡgE|QmQzѧݓQ8$@ u x}RZ£2xQW]UCxMr}F[*Yx DkHO{pC\'ܓ֦W}][>]DVe'pNN8eWkmRR~?u=ö򨼼bۯ5EGw`׶ZKo ]Hk'Kw s@.by`&;"&{|)gyrGj.UW^M)S`] si $a]R6ˢQEQEQEQEQEQEQESOQN9/N.6Ou455+6⪸UF0tQ@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@ sIbI֚m L~V1htQqYCP&cHӲ?JR;mule-2.0.1/tools/installer/config/0000755000175000017500000000000011351410665016704 5ustar charlescharlesmule-2.0.1/tools/installer/config/install.xml0000644000175000017500000002475211006063605021101 0ustar charlescharles Mule 2.0.1 http://mule.mulesource.org/ 1.4.2 The compiled distribution code The configuration files for Mule Contains the standard Mule Library Contains the standard Mule Library plus the third party libraries not distributed with mule The License files The base files The sources The log files The documentation The samples mule-2.0.1/tools/installer/config/userInput.xml0000644000175000017500000000254110672263414021431 0ustar charlescharles mule-2.0.1/tools/installer/config/conditions.xml0000644000175000017500000000156510672263414021611 0ustar charlescharles radioselection download radioselection skip radioselection skip radioselection download mule-2.0.1/tools/installer/modified IzPack build file/0000755000175000017500000000000011351410665022341 5ustar charlescharlesmule-2.0.1/tools/installer/modified IzPack build file/build.xml0000644000175000017500000015131710700160711024161 0ustar charlescharles sucessfully created: ${dist.dir}/${installer.name}${ver}.${rel}.jar Fixing linefeeds for several files in: "${dist.src.dir}" and "${dist.bin.dir}" mule-2.0.1/tools/installer/README.txt0000644000175000017500000000020410674375714017145 0ustar charlescharlesFor instructions on how to build the mule-VERSION-installer.jar please go to http://mule.mulesource.org/display/MULE/GUI+Installer. mule-2.0.1/tools/pom.xml0000644000175000017500000000153611006063605014757 0ustar charlescharles 4.0.0 org.mule mule 2.0.1 org.mule.tools mule-tools pom Mule Tools Tools for building and working with Mule projects. bobberplus mule-transport-archetype mule-project-archetype schemadocs mule-2.0.1/pom.xml0000644000175000017500000014565611006073045013632 0ustar charlescharles 4.0.0 org.mule mule pom 2.0.1 MuleSource, Inc. http://www.mulesource.com Mule Mule is a simple yet robust and highly scalable Integration and ESB services framework. It is designed as a light-weight, event-driven component technology that handles communication with disparate systems transparently providing a simple component interface. http://mule.mulesource.org 2003 jira http://mule.mulesource.org/jira/browse/MULE scm:svn:http://svn.codehaus.org/mule/trunk/mule scm:svn:https://svn.codehaus.org/mule/trunk/mule http://svn.mule.codehaus.org http://mule.mulesource.org 2.5.3 2.0.4-incubator 2.2 1.1 2.5 org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType jdk1.4 jdk5 org.apache.geronimo.specs geronimo-annotation_1.0_spec ${geronimoSpecsVersion} org.apache.geronimo.specs geronimo-ejb_2.1_spec ${geronimoSpecsVersion} org.apache.geronimo.specs geronimo-j2ee-connector_1.5_spec ${geronimoSpecsVersion} org.apache.geronimo.specs geronimo-j2ee-management_1.0_spec ${geronimoSpecsVersion} org.apache.geronimo.specs geronimo-jaxrpc_1.1_spec ${geronimoSpecsVersion} org.apache.geronimo.specs geronimo-jms_1.1_spec ${geronimoSpecsVersion} org.apache.geronimo.specs geronimo-jta_1.0.1B_spec ${geronimoSpecsVersion} org.apache.geronimo.specs geronimo-servlet_2.4_spec ${geronimoSpecsVersion} org.apache.geronimo.specs geronimo-ws-metadata_2.0_spec 1.1.1 javax.activation activation 1.1 javax.mail mail 1.4 junit junit 3.8.2 org.springframework spring-beans ${springVersion} commons-logging commons-logging org.springframework spring-context ${springVersion} aopalliance aopalliance commons-logging commons-logging org.springframework spring-core ${springVersion} aopalliance aopalliance commons-logging commons-logging org.springframework spring-jdbc ${springVersion} aopalliance aopalliance commons-logging commons-logging org.springframework spring-support org.springframework spring-jms ${springVersion} aopalliance aopalliance commons-logging commons-logging org.springframework spring-dao ${springVersion} aopalliance aopalliance commons-logging commons-logging org.springframework spring-orm ${springVersion} aopalliance aopalliance commons-logging commons-logging org.springframework spring-aop ${springVersion} commons-logging commons-logging org.springframework spring-web ${springVersion} commons-logging commons-logging mx4j mx4j-jmx 2.1.1 log4j log4j 1.2.14 commons-codec commons-codec 1.3 commons-httpclient commons-httpclient 3.1 commons-logging commons-logging org.apache.derby derby 10.3.1.4 jaxen jaxen 1.1.1 com.ibm.icu icu4j xalan xalan xml-apis xml-apis xerces xercesImpl xerces xmlParserAPIs xom xom dom4j dom4j 1.4 xml-apis xml-apis jaxen jaxen relaxngDatatype relaxngDatatype isorelax isorelax saxpath saxpath msv msv commons-jxpath commons-jxpath 1.2 commons-collections commons-collections commons-beanutils commons-beanutils commons-logging commons-logging xml-apis xml-apis xerces xerces ant ant-optional jdom jdom javax.servlet servlet-api junit junit org.hibernate hibernate 3.2.2.ga commons-collections commons-collections commons-logging commons-logging javax.transaction jta cglib cglib asm asm asm asm-attrs net.sf.ehcache ehcache msv msv relaxngDatatype relaxngDatatype isorelax isorelax xmlunit xmlunit 1.1 org.slf4j jcl104-over-slf4j 1.4.3 org.slf4j slf4j-api 1.4.3 org.slf4j slf4j-log4j12 1.4.3 axis axis-wsdl4j 1.5.1 org.apache.activemq activemq-core 4.1.0-incubator org.apache.geronimo.specs geronimo-jms_1.1_spec org.apache.activemq activemq-jaas commons-pool commons-pool org.apache.derby derby activemq jmdns xalan xalan org.apache.xbean xbean-spring org.springframework spring org.apache.geronimo.specs geronimo-jta_1.0.1B_spec org.apache.geronimo.specs geronimo-j2ee-jacc_1.0_spec backport-util-concurrent backport-util-concurrent commons-logging commons-logging howl howl-logger log4j log4j geronimo geronimo-kernel geronimo geronimo-j2ee activesoap jaxp-api mx4j mx4j-jmx mx4j mx4j-remote mx4j mx4j-tools mx4j mx4j-impl bamboo http://bamboo.mulesource.org/bamboo mail
    scm@mule.codehaus.org
    http://mule.mulesource.org/display/MULE/Download mule-releases Mule Release Repository dav:https://dav.codehaus.org/repository/mule/ mule-snapshots Mule Snapshot Repository dav:https://dav.codehaus.org/snapshots.repository/mule/ false mule-site Mule Website dav:https://dav.codehaus.org/mule/docs/${version} codehaus Codehaus Maven 2.x Release Repository http://repository.codehaus.org false codehaus-snapshots Codehaus Maven 2.x Snapshots Repository http://snapshots.repository.codehaus.org true false mule-deps Mule Dependencies http://dist.codehaus.org/mule/dependencies/maven2 true apache-snapshots Apache Snapshots http://people.apache.org/maven-snapshot-repository true false spring Spring Snapshots http://static.springframework.org/maven2-snapshots true false apache.incubating.releases Apache Incubating Release Distribution Repository http://people.apache.org/repo/m2-incubating-repository apache.snapshots Apache Development Snapshot Repository http://people.apache.org/repo/m2-snapshot-repository false jboss JBoss Repository http://repository.jboss.com/maven2 apache-plugin-snapshots Apache Maven Plugins Snapshot Repository http://people.apache.org/maven-snapshot-repository true false apache-m2-incubator Apache m2 Incubator http://people.apache.org/repo/m2-incubating-repository true true mule-deps Mule Dependencies http://dist.codehaus.org/mule/dependencies/maven2 mule-plugins-deps Mule Plugin Dependencies http://dist.codehaus.org/mule/dependencies/maven2 install org.apache.maven.wagon wagon-webdav org.mule.tools mule-assembly-verifier 1.2 org.apache.maven.plugins maven-site-plugin 2.0-beta-6 org.codehaus.mojo.groovy groovy-maven-plugin 1.0-beta-2 org.apache.maven.plugins maven-enforcer-plugin 1.0-alpha-2 enforce-maven-version enforce-once [2.0.8,) [1.4.2,1.5.0) org.apache.maven.plugins maven-compiler-plugin 1.4 1.4 ISO-8859-1 org.apache.maven.plugins maven-jar-plugin false true true true For more information go to ${productUrl} Get commercial support: ${pom.organization.url}/support Mule ESB and Integration Platform CPAL v1.0 http://www.mulesource.com/CPAL/ ${pom.organization.url} ${productUrl} -//${pom.organization.name} //DTD mule-configuration XML V1.0//EN ${productUrl}/dtds ${buildNumber} ${timestamp} dev@mule.codehaus.org org.apache.maven.plugins maven-surefire-plugin 2.4.2 -Xms64m -Xmx256m **/Abstract*.* org/mule/tck/** org.codehaus.mojo cobertura-maven-plugin ${coberturaVersion} clean clean org.apache.maven.plugins maven-checkstyle-plugin org.mule mule-buildtools ${version} org.apache.maven.plugins maven-eclipse-plugin ${eclipsePluginVersion} true org.eclipse.jdt.launching.JRE_CONTAINER/${vmtype}/${jdk14Name} org.apache.maven.plugins maven-idea-plugin true 1.4 org.apache.maven.plugins maven-project-info-reports-plugin 2.0.1 dependencies index org.mule.tools mule-test-exclusions-report-plugin 1.0 org.apache.maven.plugins maven-javadoc-plugin 2.4 128m 512m ISO-8859-1 ISO-8859-1 1.5 true http://java.sun.com/j2se/1.5.0/docs/api/ http://java.sun.com/j2ee/sdk_1.3/techdocs/api/ http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.7.0/docs/api/ http://jakarta.apache.org/commons/collections/api-3.2/ http://jakarta.apache.org/httpcomponents/httpclient-3.x/apidocs/ http://jakarta.apache.org/commons/io/api-1.2/ http://jakarta.apache.org/commons/lang/api-2.1/ http://jakarta.apache.org/commons/pool/apidocs/ http://logging.apache.org/log4j/1.2/apidocs/ http://www.slf4j.org/api/ http://dcl.mathcs.emory.edu/util/backport-util-concurrent/doc/api/ http://www.junit.org/junit/javadoc/3.8.1/ http://junit.sourceforge.net/javadoc/ Mule Core org.mule* Modules (not part of the Mule core) org.mule.module.*:org.mule.components.* Transports org.mule.transport.* Testing Framework org.mule.tck* Tools org.mule.tools.* Examples org.mule.example.* org.apache.maven.plugins maven-jxr-plugin 2.1 true org.apache.maven.plugins maven-surefire-report-plugin 2.4.2 false org.apache.maven.plugins maven-checkstyle-plugin 2.1 codecheck/checkstyle.xml codecheck/LicenseHeader.txt false org.codehaus.mojo cobertura-maven-plugin ${coberturaVersion} jdk14 !skipJDK14 buildtools core modules transports tests examples tools jdk15 1.5 org.apache.maven.plugins maven-enforcer-plugin 1.0-alpha-2 enforce-maven-version enforce-once [2.0.8,) [1.5.0,) org.apache.maven.plugins maven-compiler-plugin 1.5 1.5 ISO-8859-1 org.apache.maven.plugins maven-eclipse-plugin ${eclipsePluginVersion} true org.eclipse.jdt.launching.JRE_CONTAINER/${vmtype}/${jdk5Name} examples transports tests distributions distributions ci-server file:///home/luntbuild/publish/mule/docs/${version} bamboo file:///var/www/html/docs/site/${version} buildnumber-plugin !skipBuildnumber org.codehaus.mojo buildnumber-maven-plugin 1.0-beta-2-MULE-5675 validate create false false {0,date,yyyy-MMM-dd HH:mm:ss} mac mac org.eclipse.jdt.internal.launching.macosx.MacOSXType
    mule-2.0.1/distributions/0000755000175000017500000000000011351411041015171 5ustar charlescharlesmule-2.0.1/distributions/embedded/0000755000175000017500000000000011351411041016722 5ustar charlescharlesmule-2.0.1/distributions/embedded/assembly.xml0000644000175000017500000000663110766272451021314 0ustar charlescharles embedded jar false / true org.mule:mule-core org.mule.transports:mule-transport-axis org.mule.transports:mule-transport-bpm org.mule.transports:mule-transport-cxf org.mule.transports:mule-transport-ejb org.mule.transports:mule-transport-email org.mule.transports:mule-transport-file org.mule.transports:mule-transport-ftp org.mule.transports:mule-transport-http org.mule.transports:mule-transport-jbpm org.mule.transports:mule-transport-jdbc org.mule.transports:mule-transport-jms org.mule.transports:mule-transport-multicast org.mule.transports:mule-transport-quartz org.mule.transports:mule-transport-rmi org.mule.transports:mule-transport-soap org.mule.transports:mule-transport-ssl org.mule.transports:mule-transport-stdio org.mule.transports:mule-transport-tcp org.mule.transports:mule-transport-udp org.mule.transports:mule-transport-vm org.mule.transports:mule-transport-xmpp org.mule.modules:mule-module-1to2migration org.mule.modules:mule-module-acegi org.mule.modules:mule-module-boot org.mule.modules:mule-module-builders org.mule.modules:mule-module-client org.mule.modules:mule-module-i18n org.mule.modules:mule-module-jaas org.mule.modules:mule-module-jbossts org.mule.modules:mule-module-jotm org.mule.modules:mule-module-management org.mule.modules:mule-module-ognl org.mule.modules:mule-module-pgp org.mule.modules:mule-module-scripting org.mule.modules:mule-module-spring-config org.mule.modules:mule-module-spring-extras org.mule.modules:mule-module-xml org.mule.distributions:mule-embedded mule-2.0.1/distributions/embedded/pom.xml0000644000175000017500000000624711006063605020256 0ustar charlescharles 4.0.0 org.mule.distributions mule-distributions 2.0.1 mule pom Embedded (Single jar file) Assembles the Mule core, modules, and transports into a single library (jar). This is useful for embedding Mule into an existing project. maven-assembly-plugin 2.1 assembly.xml true package attached org.apache.maven.plugins maven-source-plugin false org.mule.examples mule-examples-all ${version} pom org.mule.modules mule-modules-all ${version} pom org.mule.transports mule-transports-all ${version} pom mule-2.0.1/distributions/server/0000755000175000017500000000000011351411041016477 5ustar charlescharlesmule-2.0.1/distributions/server/custom/0000755000175000017500000000000011351411041020011 5ustar charlescharlesmule-2.0.1/distributions/server/custom/assembly.xml0000644000175000017500000000245310672263414022374 0ustar charlescharles zip tar.gz ../src/main/resources docs/* src/* examples/* ../src/main/resources/bin bin 744 ../src/main/resources/lib/boot/exec lib/boot/exec 744 lib/boot ${artifactId}.${extension} org.mule.modules:mule-module-boot tanukisoft:wrapper mule-2.0.1/distributions/server/custom/pom.xml0000644000175000017500000000473011006063605021340 0ustar charlescharles 4.0.0 org.mule.distributions mule-server 2.0.1 mule-custom pom Minimal (Custom) Distribution Assembles the Mule distribution without including any libraries. maven-assembly-plugin 2.1 mule-${version} assembly.xml false gnu package attached org.apache.maven.plugins maven-source-plugin false mule-2.0.1/distributions/server/full/0000755000175000017500000000000011351411006017442 5ustar charlescharlesmule-2.0.1/distributions/server/full/assembly_osgi.xml0000644000175000017500000002233610724024457023047 0ustar charlescharles full zip tar.gz ../src/main/resources ../src/main/resources/bin bin 744 ../src/main/resources/lib/boot/exec lib/boot/exec 744 ../../../examples/hello examples/maven/hello README.txt ../../../examples/hello/dist examples/maven/hello pom.xml ../../../examples/hello/dist examples/maven/hello hello *.bat 744 ../../../examples/hello/conf examples/maven/hello/conf ../../../examples/hello/src examples/maven/hello/src ../../../examples/hello examples/ant/hello README.txt ../../../examples/hello/dist examples/ant/hello build.xml ../../../examples/hello/dist examples/ant/hello hello *.bat 744 ../../../examples/hello/conf examples/ant/hello/conf ../../../examples/hello/src/main/java examples/ant/hello/src ../src/main/resources/bin USAGE.txt ../../../target/site/apidocs docs/api ../../.. src **/*-sources.jar lib/boot ${artifactId}.${extension} org.mule.modules:mule-module-boot commons-cli:commons-cli tanukisoft:wrapper org.knopflerfish:osgi lib/mule ${artifactId}.${extension} runtime org.mule:mule-core org.mule.transports:mule-transport-axis org.mule.transports:mule-transport-bpm org.mule.transports:mule-transport-dq org.mule.transports:mule-transport-ejb org.mule.transports:mule-transport-email org.mule.transports:mule-transport-file org.mule.transports:mule-transport-ftp org.mule.transports:mule-transport-gigaspaces org.mule.transports:mule-transport-glue org.mule.transports:mule-transport-http org.mule.transports:mule-transport-jdbc org.mule.transports:mule-transport-jms org.mule.transports:mule-transport-multicast org.mule.transports:mule-transport-quartz org.mule.transports:mule-transport-rmi org.mule.transports:mule-transport-soap org.mule.transports:mule-transport-space org.mule.transports:mule-transport-ssl org.mule.transports:mule-transport-stdio org.mule.transports:mule-transport-tcp org.mule.transports:mule-transport-udp org.mule.transports:mule-transport-vm org.mule.transports:mule-transport-xfire org.mule.transports:mule-transport-xmpp org.mule.modules:mule-module-acegi org.mule.modules:mule-module-builders org.mule.modules:mule-module-client org.mule.modules:mule-module-jaas org.mule.modules:mule-module-jotm org.mule.modules:mule-module-management org.mule.modules:mule-module-osgi org.mule.modules:mule-module-ognl org.mule.modules:mule-module-pgp org.mule.modules:mule-module-scripting org.mule.modules:mule-module-springcore org.mule.modules:mule-module-spring org.mule.modules:mule-module-util org.mule.modules:mule-module-xml lib/opt ${artifactId}.${extension} runtime org.springframework.osgi:spring-osgi-core org.springframework.osgi:spring-osgi-extender org.springframework.osgi:spring-osgi-io org.springframework.osgi:spring-core org.springframework.osgi:spring-aop org.springframework.osgi:spring-context org.springframework.osgi:spring-beans org.springframework.osgi:spring-jmx org.springframework.osgi:aopalliance.osgi org.springframework.osgi:asm.osgi org.springframework.osgi:aspectjrt.osgi org.springframework.osgi:cglib-nodep.osgi org.springframework.osgi:commons-attributes.osgi org.ops4j.pax.logging:api org.ops4j.pax.logging:service org.ops4j.pax.logging:log4j org.ops4j.pax.logging:jcl org.ops4j.pax.logging:slf4j lib/user runtime ${artifactId}.${extension} org.mule.examples:mule-example-hello-osgi mule-2.0.1/distributions/server/full/assembly.xml0000644000175000017500000005036411001362701022012 0ustar charlescharles full zip tar.gz ../src/main/resources **/osgi/** **/*.xargs ../src/main/resources/bin bin 755 ../src/main/resources/bin bin 644 *.txt ../src/main/resources/lib/boot/exec lib/boot/exec 755 ../src/main/resources/lib/boot/exec lib/boot/exec 644 *.txt ../src/main/resources/bin USAGE.txt ../../../target/site/apidocs docs/api target src mule-*-src.zip ../../../examples examples pom.xml all-examples/** hello-osgi/** **/target/** **/dist/** **/.*/** **/*.iml **/*.ipr **/*.iws webapp/src/test/** ../../../examples/echo/dist examples/echo ../../../examples/echo/dist examples/echo 755 echo echo.bat ../../../examples/errorhandler/dist examples/errorhandler ../../../examples/errorhandler/dist examples/errorhandler 755 errorhandler errorhandler.bat ../../../examples/hello/dist examples/hello ../../../examples/hello/dist examples/hello 755 hello hello.bat ../../../examples/loanbroker/dist examples/loanbroker ../../../examples/loanbroker/dist examples/loanbroker 755 loanbroker loanbroker.bat ../../../examples/loanbroker/common/dist examples/loanbroker/common ../../../examples/loanbroker/common-tests/dist examples/loanbroker/common-tests ../../../examples/loanbroker/credit-agency/dist examples/loanbroker/credit-agency ../../../examples/loanbroker/esb/dist examples/loanbroker/esb ../../../examples/loanbroker/esb/src/main/resources lib/user openejb.conf castor.properties ../../../examples/loanbroker/esn/dist examples/loanbroker/esn ../../../examples/loanbroker/bpm/dist examples/loanbroker/bpm ../../../examples/scripting/dist examples/scripting ../../../examples/scripting/dist examples/scripting 755 scripting scripting.bat ../../../examples/stockquote/dist examples/stockquote ../../../examples/stockquote/dist examples/stockquote 755 stockquote stockquote.bat ../../../examples/webapp/dist examples/webapp ../../../examples/echo/conf examples/webapp/conf echo-config.xml ../../../examples/hello/conf examples/webapp/conf hello-http-config.xml ../../../examples/loanbroker/esn/conf examples/webapp/conf loan-broker-sync-config.xml loan-broker-vm-endpoints-config.xml ../../../examples/stockquote/conf examples/webapp/conf stockquote-rest-config.xml lib/boot org.mule.modules:mule-module-boot commons-cli:commons-cli tanukisoft:wrapper xml-apis:xml-apis xerces:xercesImpl xerces:xml-serializer xalan:xalan lib/mule runtime org.mule:mule-core org.mule.transports:mule-transport-axis org.mule.transports:mule-transport-bpm org.mule.transports:mule-transport-cxf org.mule.transports:mule-transport-ejb org.mule.transports:mule-transport-email org.mule.transports:mule-transport-file org.mule.transports:mule-transport-ftp org.mule.transports:mule-transport-http org.mule.transports:mule-transport-jbpm org.mule.transports:mule-transport-jdbc org.mule.transports:mule-transport-jms org.mule.transports:mule-transport-multicast org.mule.transports:mule-transport-quartz org.mule.transports:mule-transport-rmi org.mule.transports:mule-transport-soap org.mule.transports:mule-transport-ssl org.mule.transports:mule-transport-stdio org.mule.transports:mule-transport-tcp org.mule.transports:mule-transport-udp org.mule.transports:mule-transport-vm org.mule.transports:mule-transport-xmpp org.mule.modules:mule-module-acegi org.mule.modules:mule-module-builders org.mule.modules:mule-module-client org.mule.modules:mule-module-jaas org.mule.modules:mule-module-jbossts org.mule.modules:mule-module-management org.mule.modules:mule-module-ognl org.mule.modules:mule-module-pgp org.mule.modules:mule-module-scripting org.mule.modules:mule-module-spring-config org.mule.modules:mule-module-spring-extras org.mule.modules:mule-module-xml xml-apis:xml-apis xerces:xercesImpl xerces:xml-serializer xalan:xalan lib/opt runtime org.mule:mule-core org.mule.transports:mule-transports-all org.mule.transports:mule-transport-axis org.mule.transports:mule-transport-bpm org.mule.transports:mule-transport-cxf org.mule.transports:mule-transport-ejb org.mule.transports:mule-transport-email org.mule.transports:mule-transport-file org.mule.transports:mule-transport-ftp org.mule.transports:mule-transport-http org.mule.transports:mule-transport-jbpm org.mule.transports:mule-transport-jdbc org.mule.transports:mule-transport-jms org.mule.transports:mule-transport-multicast org.mule.transports:mule-transport-quartz org.mule.transports:mule-transport-rmi org.mule.transports:mule-transport-soap org.mule.transports:mule-transport-ssl org.mule.transports:mule-transport-stdio org.mule.transports:mule-transport-tcp org.mule.transports:mule-transport-udp org.mule.transports:mule-transport-vm org.mule.transports:mule-transport-xfire org.mule.transports:mule-transport-xmpp org.mule.modules:mule-module-acegi org.mule.modules:mule-modules-all org.mule.modules:mule-module-boot org.mule.modules:mule-module-builders org.mule.modules:mule-module-client org.mule.modules:mule-module-jaas org.mule.modules:mule-module-jbossts org.mule.modules:mule-module-jca org.mule.modules:mule-module-management org.mule.modules:mule-module-ognl org.mule.modules:mule-module-pgp org.mule.modules:mule-module-scripting org.mule.modules:mule-module-spring-config org.mule.modules:mule-module-spring-extras org.mule.modules:mule-module-xml org.mule.examples:mule-examples-all org.mule.examples:mule-example-echo org.mule.examples:mule-example-errorhandler org.mule.examples:mule-example-hello org.mule.examples:mule-example-loanbroker-common org.mule.examples:mule-example-loanbroker-esn org.mule.examples:mule-example-loanbroker-esb org.mule.examples:mule-example-loanbroker-bpm org.mule.examples:mule-example-loanbroker-credit-agency org.mule.examples:mule-example-scripting org.mule.examples:mule-example-stockquote org.mule.tests:mule-tests-functional javax.activation:activation javax.mail:mail commons-logging:commons-logging commons-cli:commons-cli tanukisoft:wrapper org.apache.activemq:activemq-core org.apache.activemq:activeio-core com.yourkit:yjp-controller-api-redist xml-apis:xml-apis xerces:xercesImpl xerces:xml-serializer xalan:xalan axis:axis-wsdl4j lib/user runtime ${artifactId}.${extension} org.mule.examples:mule-example-echo org.mule.examples:mule-example-errorhandler org.mule.examples:mule-example-hello org.mule.examples:mule-example-loanbroker-common org.mule.examples:mule-example-loanbroker-esn org.mule.examples:mule-example-loanbroker-esb org.mule.examples:mule-example-loanbroker-bpm org.mule.examples:mule-example-loanbroker-credit-agency org.mule.examples:mule-example-scripting org.mule.examples:mule-example-stockquote xml-apis:xml-apis xerces:xercesImpl xerces:xml-serializer xalan:xalan lib/user test org.mule.tests:mule-tests-core org.mule.tests:mule-tests-functional xml-apis:xml-apis xerces:xercesImpl xerces:xml-serializer xalan:xalan lib/endorsed xml-apis:xml-apis xerces:xercesImpl xerces:xml-serializer xalan:xalan mule-2.0.1/distributions/server/full/pom.xml0000644000175000017500000002226311006073045020770 0ustar charlescharles 4.0.0 org.mule.distributions mule-server 2.0.1 mule-full pom Full Distribution Includes the Mule server with all of its modules and transports. maven-assembly-plugin 2.1 mule-${version} assembly.xml false gnu package attached maven-antrun-plugin generate-sources run org.mule.tools mule-assembly-verifier verify verify mule-${version}.zip assembly-whitelist.txt mule-${version}/lib/endorsed/xml-apis-1.3.04.jar mule-${version}/lib/endorsed/xercesImpl-2.9.1.jar mule-${version}/lib/endorsed/xml-serializer-2.7.1.jar mule-${version}/lib/endorsed/xalan-2.7.1.jar org.codehaus.mojo.groovy groovy-maven-plugin generate-sources execute // splash log.info '*' * 80 log.info('Repackaging sources'.center(80)) log.info('(full build with a -DperformRelease=true must have run before)'.center(80)) log.info '*' * 80 def muleRoot = "${project.build.directory}/../../../../" log.info("Mule project root: ${new File(muleRoot).canonicalPath}") def tempDir = "$project.build.directory/sources-temp" ant.mkdir(dir: tempDir) ant.unjar(dest: tempDir) { fileset(dir: muleRoot) { include(name: '**/*-sources.jar') } } ant.zip(basedir: tempDir, destfile: "${project.build.directory}/mule-${project.version}-src.zip") org.apache.maven.plugins maven-source-plugin false org.mule.examples mule-examples-all ${version} pom org.mule.modules mule-modules-all ${version} pom org.mule.modules.jca mule-module-jca-generic org.mule.modules.jca mule-module-jca-jboss xalan xalan org.mule.transports mule-transports-all ${version} pom xml-apis xml-apis 1.3.04 xerces xercesImpl 2.9.1 xerces xml-serializer 2.7.1 xalan xalan 2.7.1 org.mule mule-core ${version} test-jar org.mule.tests mule-tests-functional ${version} mule-2.0.1/distributions/server/full/assembly-whitelist.txt0000644000175000017500000000631410777662620024065 0ustar charlescharlesacegi-security-1.0.1 ant-1.6.5 antlr-2.7.6 aopalliance-1.0 axis-1.4 axis-jaxrpc-1.4 backport-util-concurrent-3.1 cglib-nodep-2.1_3 commons-beanutils-1.7.0 commons-cli-1.0 commons-codec-1.3 commons-collections-3.2 commons-dbutils-1.1 commons-discovery-0.2 commons-httpclient-3.1 commons-io-1.3.1 commons-jxpath-1.2 commons-lang-2.3 commons-net-1.4.1 commons-pool-1.4 cryptix-jce-api-20050328 cryptix-jce-provider-20050328 cryptix-message-api-20050405 cryptix-openpgp-provider-20050405 cryptix-pki-api-20050405 cxf-api-2.0.4-incubator cxf-common-schemas-2.0.4-incubator cxf-common-utilities-2.0.4-incubator cxf-rt-bindings-soap-2.0.4-incubator cxf-rt-bindings-xml-2.0.4-incubator cxf-rt-core-2.0.4-incubator cxf-rt-databinding-aegis-2.0.4-incubator cxf-rt-databinding-jaxb-2.0.4-incubator cxf-rt-frontend-jaxws-2.0.4-incubator cxf-rt-frontend-simple-2.0.4-incubator cxf-rt-transports-http-2.0.4-incubator cxf-rt-transports-local-2.0.4-incubator cxf-tools-common-2.0.4-incubator dom4j-1.4 geronimo-annotation_1.0_spec-1.1 geronimo-ejb_2.1_spec-1.1 geronimo-j2ee-connector_1.5_spec-1.1 geronimo-j2ee-management_1.0_spec-1.1 geronimo-jaxrpc_1.1_spec-1.1 geronimo-jms_1.1_spec-1.1 geronimo-jta_1.0.1B_spec-1.1 geronimo-servlet_2.4_spec-1.1 geronimo-ws-metadata_2.0_spec-1.1.1 groovy-all-1.5.4 groovy-engine-1.1-jdk14 hibernate-3.2.2.ga javassist-3.6.ga jaxb-api-2.0 jaxb-impl-2.0.5 jaxb-xjc-2.0 jaxen-1.1.1 jaxws-api-2.0 jbossts-common-4.2.3-SP5 jbossts-jta-4.2.3-SP5-patched jbossts-jta-integration-4.2.3-SP5 jbpm-jpdl-3.2.2 jcl104-over-slf4j-1.4.3 jcr-1.0 jdom-1.0 jug-2.0.0-asl junit-3.8.2 log4j-1.2.14 mockobjects-core-0.09 mule-core mule-core-tests mule-example-echo mule-example-errorhandler mule-example-hello mule-example-loanbroker-bpm mule-example-loanbroker-common mule-example-loanbroker-credit-agency mule-example-loanbroker-esb mule-example-loanbroker-esn mule-example-scripting mule-example-stockquote mule-module-acegi mule-module-boot mule-module-builders mule-module-client mule-module-jaas mule-module-jbossts mule-module-management mule-module-ognl mule-module-pgp mule-module-scripting mule-module-spring-config mule-module-spring-extras mule-module-xml mule-tests-functional mule-transport-axis mule-transport-bpm mule-transport-cxf mule-transport-ejb mule-transport-email mule-transport-file mule-transport-ftp mule-transport-http mule-transport-jbpm mule-transport-jdbc mule-transport-jms mule-transport-multicast mule-transport-quartz mule-transport-rmi mule-transport-soap mule-transport-ssl mule-transport-stdio mule-transport-tcp mule-transport-udp mule-transport-vm mule-transport-xmpp mx4j-impl-2.1.1 mx4j-jmx-2.1.1 mx4j-remote-2.1.1 mx4j-tools-2.1.1 neethi-2.0.2 ognl-2.7.2 org.mortbay.jetty-5.1.12 oro-2.0.7 quartz-all-1.6.0 retrotranslator-runtime-1.2.1 saaj-api-1.3 saaj-impl-1.3 script-api-1.0-jdk14 slf4j-api-1.4.3 slf4j-log4j12-1.4.3 smack-2.2.1 spring-aop-2.5.3 spring-beans-2.5.3 spring-context-2.5.3 spring-context-support-2.5.3 spring-core-2.5.3 spring-jdbc-2.5.3 spring-jms-2.5.3 spring-modules-jbpm31-0.9 spring-orm-2.5.3 spring-tx-2.5.3 spring-web-2.5.3 stax-api-1.0.1 stax-utils-20060502 velocity-1.4 velocity-dep-1.4 wrapper-3.2.3 wsdl4j-1.6.1 wstx-asl-3.2.2 xapool-1.4 xml-resolver-1.2 xpp3_min-1.1.3.4.O xstream-1.2.1 XmlSchema-1.3.2 mule-2.0.1/distributions/server/src/0000755000175000017500000000000011351411006017267 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/0000755000175000017500000000000011351411006020213 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/0000755000175000017500000000000011351411041022224 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/examples/0000755000175000017500000000000011351411041024042 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/examples/README.txt0000644000175000017500000000127310747504633025565 0ustar charlescharlesThe Mule examples can be built using either of the following build tools: Ant (version 1.6.5 or newer) http://ant.apache.org Maven (version 2.0.8 or newer) http://maven.apache.org Although Maven aims to make your build simple, the process itself is quite complex, so if you are not familiar with either tool, you will most likely want to start with Ant. Many of the examples are ready to run out-of-the-box and it is not necessary for you to build them. However, some require additional libraries not included as part of the Mule distribution. When this is the case, the additional libraries will be downloaded into the $MULE_HOME/lib/user directory upon building the example. mule-2.0.1/distributions/server/src/main/resources/LICENSE.txt0000644000175000017500000006623410764576756024122 0ustar charlescharlesCommon Public Attribution License Version 1.0 (CPAL) 1. "Definitions" 1.0.1 "Commercial Use" means distribution or otherwise making the Covered Code available to a third party. 1.1 "Contributor" means each entity that creates or contributes to the creation of Modifications. 1.2 "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. 1.3 "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. 1.4 "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data. 1.5 "Executable" means Covered Code in any form other than Source Code. 1.6 "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. 1.7 "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. 1.8 "License" means this document. 1.8.1 "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 1.9 "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is: A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. B. Any new file that contains any part of the Original Code or previous Modifications. 1.10 "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. 1.10.1 "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. 1.11 "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. 1.12 "You" (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. Source Code License. 2.1 The Initial Developer Grant. The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and (b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof). (c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License. (d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code; or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices. 2.2 Contributor Grant. Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). (c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code. (d) Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2) separate from the Contributor Version; 3) for infringements caused by: i) third party modifications of Contributor Version or ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor. 3. Distribution Obligations. 3.1 Application of License. The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. 3.2 Availability of Source Code. Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. 3.3 Description of Modifications. You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. 3.4 Intellectual Property Matters (a) Third Party Claims. If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. (b) Contributor APIs. If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file. (c) Representations. Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License. 3.5 Required Notices. You must duplicate the notice in Exhibit A in each file of the Source Code. If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice. If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A. You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 3.6 Distribution of Executable Versions. You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer, Original Developer or any Contributor. You hereby agree to indemnify the Initial Developer, Original Developer and every Contributor for any liability incurred by the Initial Developer, Original Developer or such Contributor as a result of any such terms You offer. 3.7 Larger Works. You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. 4. Inability to Comply Due to Statute or Regulation. If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Application of this License. This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code. 6. Versions of the License. 6.1 New Versions. MuleSource, Inc. ("MuleSource") may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. 6.2 Effect of New Versions. Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Socialtext. No one other than MuleSource has the right to modify the terms applicable to Covered Code created under this License. 6.3 Derivative Works. If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases "MuleSource", "CPAL" or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the CPAL. (Filling in the name of the Initial Developer, Original Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.) 7. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER, ORIGINAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. 8. TERMINATION. 8.1 This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 8.2 If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer, Original Developer or a Contributor (the Initial Developer, Original Developer or Contributor against whom You file such action is referred to as "Participant") alleging that: (a) such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i) agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant. If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above. (b) any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant. 8.3 If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license. 8.4 In the event of termination under Sections 8.1 or 8.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination. 9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ORIGINAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. 10. U.S. GOVERNMENT END USERS. The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. 11. MISCELLANEOUS. This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. 12. RESPONSIBILITY FOR CLAIMS. As between Initial Developer, Original Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer, Original Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. 13. MULTIPLE-LICENSED CODE. Initial Developer may designate portions of the Covered Code as Multiple-Licensed. Multiple-Licensed means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the CPAL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A. 14. ADDITIONAL TERM: ATTRIBUTION (a) As a modest attribution to the organizer of the development of the Original Code ("Original Developer"), in the hope that its promotional value may help justify the time, money and effort invested in writing the Original Code, the Original Developer may include in Exhibit B ("Attribution Information") a requirement that each time an Executable and Source Code or a Larger Work is launched or initially run (which includes initiating a session), a prominent display of the Original Developer's Attribution Information (as defined below) must occur on the graphic user interface employed by the end user to access such Covered Code (which may include display on a splash screen), if any. The size of the graphic image should be consistent with the size of the other elements of the Attribution Information. If the access by the end user to the Executable and Source Code does not create a graphic user interface for access to the Covered Code, this obligation shall not apply. If the Original Code displays such Attribution Information in a particular form (such as in the form of a splash screen, notice at login, an "about" display, or dedicated attribution area on user interface screens), continued use of such form for that Attribution Information is one way of meeting this requirement for notice. (b) Attribution information may only include a copyright notice, a brief phrase, graphic image and a URL ("Attribution Information") and is subject to the Attribution Limits as defined below. For these purposes, prominent shall mean display for sufficient duration to give reasonable notice to the user of the identity of the Original Developer and that if You include Attribution Information or similar information for other parties, You must ensure that the Attribution Information for the Original Developer shall be no less prominent than such Attribution Information or similar information for the other party. For greater certainty, the Original Developer may choose to specify in Exhibit B below that the above attribution requirement only applies to an Executable and Source Code resulting from the Original Code or any Modification, but not a Larger Work. The intent is to provide for reasonably modest attribution, therefore the Original Developer cannot require that You display, at any time, more than the following information as Attribution Information: (a) a copyright notice including the name of the Original Developer; (b) a word or one phrase (not exceeding 10 words); (c) one graphic image provided by the Original Developer; and (d) a URL (collectively, the "Attribution Limits"). (c) If Exhibit B does not include any Attribution Information, then there are no requirements for You to display any Attribution Information of the Original Developer. (d) You acknowledge that all trademarks, service marks and/or trade names contained within the Attribution Information distributed with the Covered Code are the exclusive property of their owners and may only be used with the permission of their owners, or under circumstances otherwise permitted by law or as expressly set out in this License. 15. ADDITIONAL TERM: NETWORK USE. The term "External Deployment" means the use, distribution, or communication of the Original Code or Modifications in any way such that the Original Code or Modifications may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Code or Modifications as a distribution under section 3.1 and make Source Code available under Section 3.2. EXHIBIT A. Common Public Attribution License Version 1.0. "The contents of this file are subject to the Common Public Attribution License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mulesource.com/CPAL/. The License is based on the Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover use of software over a computer network and provide for limited attribution for the Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is MuleSource Mule The Initial Developer of the Original Code is MuleSource Inc. All portions of the code are Copyright (c) 2003-2007 MuleSource Inc. All Rights Reserved. EXHIBIT B. Attribution Information Subject to the limitations and other requirements in Section 14 of the License, the Original Developer requires You to display the following Attribution Information: Attribution Copyright Notice: Copyright (c) 2003-2008 MuleSource Inc. Attribution Phrase (not exceeding 10 words): Powered by Mule. MuleSource is Open for Integration. Attribution URL: http://www.mulesource.com Graphic Image provided in the Covered Code as file: http://www.mulesource.com/images/mulesource_license_logo.gif Redistributions of the Covered Code in binary form or source code form, must ensure that the first time the resulting executable program is launched, a user interface, if any, shall include the attribution information set forth below prominently. If the executable program does not launch a user interface, the Company name and URL shall be included in the notice section of each file of the Covered Code. : Display of Attribution Information is required in Larger Works which are defined in the CPAL as a work which combines Covered Code or portions thereof with code not governed by the terms of the CPAL. mule-2.0.1/distributions/server/src/main/resources/docs/0000755000175000017500000000000011351411041023154 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/docs/api/0000755000175000017500000000000011351411041023725 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/INSTALL.txt0000644000175000017500000000675510732766104024127 0ustar charlescharles+----------------------------+ | Welcome to Mule! | |----------------------------| | http://mule.mulesource.org | +----------------------------+ Mule is a highly scalable Enterprise Services framework and messaging broker. Here is some useful information to get you started. +--------------+ | INSTALLATION | +--------------+ If you're reading this, it means you've already downloaded and unpacked the distribution. The only other thing you need to do to get started using Mule is to set the location of your Mule installation and add it to your path. This will depend on your platform, but is usually something like the following: Linux / Unix ------------ export MULE_HOME=/opt/mule export PATH=$PATH:$MULE_HOME/bin Windows ------- set MULE_HOME=C:\Mule set PATH=%PATH%;%MULE_HOME%\bin (or by using the System utility in the Control Panel for Windows NT/2000/XP) +----------------------+ | ADDITIONAL LIBRARIES | +----------------------+ Mule has connectors for a wide variety of technologies, however in some cases in order to actually use the connector, libraries are required which cannot be distributed as part of Mule due to licensing restrictions. In these cases it is up to the user to obtain the needed libraries and place them in the $MULE_HOME/lib/user directory. As a convenience, the very first time Mule is started, it will try to download Sun Microsystems' javax.mail, javax.activation, and jsr223 (scripting) libraries. If you are behind a firewall, you may need to configure your HTTP proxy settings in the file $MULE_HOME/conf/wrapper.conf in order for this download to work. +--------------+ | DISTRIBUTION | +--------------+ The distribution you have downloaded contains the following: ./bin - Shell and batch scripts for controlling Mule from the command line ./conf - Configuration files ./docs - API documentation (javadoc) for Mule and its sub-projects ./examples - Example applications you can run and try building yourself ./lib/boot - Libraries used by the Java Service Wrapper to boot up the server ./lib/mule - Mule libraries ./lib/native - Platform-specific (non-Java) libraries ./lib/opt - Non-Mule libraries ./lib/user - This is where you should place your custom classes/libraries. This directory comes before ./lib/mule on the classpath and can therefore be used to patch the distributed Mule classes if necessary. ./licences - License information for all libraries shipped with Mule ./logs - Output will be sent here by default when running in background mode ./src - An export of the Mule source code, useful for importing into your IDE ./INSTALL.txt - erm... this file! ./LICENSE.txt - License agreement for Mule ./USAGE.txt - Basic usage of Mule from the command-line +-----------------+ | GETTING STARTED | +-----------------+ Take a look at the latest documentation on our website: http://www.muledocs.org/Getting+Started+Guide User Guide: http://www.muledocs.org/User+Guide Example Applications: http://www.muledocs.org/Examples +----------+ | FEEDBACK | +----------+ We hope you enjoy using Mule. To help us make it a better product please tell us about any issues (no matter how small), suggestions or other comments you have. You can post on the Mule User's mailing list - user@mule.codehaus.org or raise issues at http://mule.mulesource.org/jira/browse/MULE Enjoy! The Mule Team mule-2.0.1/distributions/server/src/main/resources/conf/0000755000175000017500000000000011351411007023153 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/conf/log4j.properties0000644000175000017500000000133710703246267026332 0ustar charlescharles# Default log level log4j.rootCategory=INFO, console log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%-5p %d [%t] %c: %m%n ################################################ # You can set custom log levels per-package here ################################################ # Apache Commons tend to make a lot of noise which can clutter the log. log4j.logger.org.apache=WARN # Mule classes log4j.logger.org.mule=INFO # Shuts up some innocuous messages if using the JBPM transport log4j.logger.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog=ERROR # Your custom classes log4j.logger.com.mycompany=DEBUG mule-2.0.1/distributions/server/src/main/resources/conf/props.xargs0000644000175000017500000000355010553776311025406 0ustar charlescharles# # Properties used by both init.xargs and restart.xargs # # Prefix for searching for bundle URLs from console or command line -Dorg.knopflerfish.gosg.jars=file:../lib/ # The Service Platform ID should be used by bundles needing to # a unique ID for the platform itself -Dorg.osgi.provisioning.spid=knopflerfish # Initial startup verbosity, 0 is low verbosity -Dorg.knopflerfish.verbosity=0 # Security #-Djava.security.manager= #-Djava.security.policy=file:framework.policy # URL to bundle repository -Doscar.repository.url=http://www.knopflerfish.org/repo/repository.xml # Various debug flags -Dorg.knopflerfish.framework.debug.packages=false -Dorg.knopflerfish.framework.debug.errors=true -Dorg.knopflerfish.framework.debug.classloader=false -Dorg.knopflerfish.framework.debug.startlevel=false -Dorg.knopflerfish.framework.debug.ldap=false # Comma-separated list of packges exported by system classloader -Dorg.osgi.framework.system.packages= #-Dorg.osgi.framework.system.packages=com.ccg.net.ethernet,com.sun.*,javax.crypto.*,javax.naming.*,javax.net.*,javax.security.*,javax.xml.namespace,javax.xml.transform,org.xml.sax,sun.* # Comma-separated list of packages that may be loaded by system classloader -Dorg.osgi.framework.bootdelegation=* #-Dorg.osgi.framework.bootdelegation=com.ccg.net.ethernet,com.sun.*,javax.crypto.*,javax.naming.*,javax.net.*,javax.security.*,javax.xml.namespace,javax.xml.transform,org.xml.sax,sun.* # Web server properties -Dorg.knopflerfish.http.dnslookup=false -Dorg.osgi.service.http.port=8080 -Dorg.knopflerfish.startlevel.use=true # Log service properties -Dorg.knopflerfish.log.out=false -Dorg.knopflerfish.log.level=info -Dorg.knopflerfish.log.grabio=true -Dorg.knopflerfish.log.file=true #consoletelnet properties -Dorg.knopflerfish.consoletelnet.user=admin -Dorg.knopflerfish.consoletelnet.pwd=admin -Dorg.knopflerfish.consoletelnet.port=2323 mule-2.0.1/distributions/server/src/main/resources/conf/init.xargs0000644000175000017500000001024510555737071025207 0ustar charlescharles# Load common properties -xargs ../conf/props.xargs # Remove any previously installed bundles -init # Set Start Level -startlevel 11 ############################################################# # Standard Knopflerfish Bundles (from template.xargs) ############################################################# # Basic KF bundles -initlevel 1 -install boot/osgi/log/log_all-2.0.0.jar -install boot/osgi/cm/cm_all-2.0.0.jar -install boot/osgi/console/console_all-2.0.0.jar -install boot/osgi/component/component_all-2.0.0.jar -install boot/osgi/event/event_all-2.0.0.jar # Some library bundles -initlevel 2 -install boot/osgi/util/util-2.0.0.jar -install boot/osgi/crimson/crimson-2.0.0.jar -install boot/osgi/jsdk/jsdk-2.2.jar # The Bundle repo commands and desktop plugin -install boot/osgi/bundlerepository/bundlerepository_all-2.0.0.jar # More basic KF bundles -initlevel 3 -install boot/osgi/device/device_all-2.0.0.jar -install boot/osgi/useradmin/useradmin_all-2.0.0.jar -initlevel 4 -install boot/osgi/http/http_all-2.0.0.jar # Console command bundles -initlevel 5 -install boot/osgi/frameworkcommands/frameworkcommands-2.0.0.jar -install boot/osgi/logcommands/logcommands-2.0.0.jar -install boot/osgi/cm_cmd/cm_cmd-2.0.0.jar -install boot/osgi/consoletty/consoletty-2.0.0.jar -install boot/osgi/consoletelnet/consoletelnet-2.0.0.jar -initlevel 6 -install boot/osgi/desktop/desktop_all-2.0.0.jar -initlevel 7 -install boot/osgi/httproot/httproot-2.0.0.jar # Start of these bundles are delayed since this makes start order dependencies much easier -start boot/osgi/log/log_all-2.0.0.jar -start boot/osgi/crimson/crimson-2.0.0.jar -start boot/osgi/cm/cm_all-2.0.0.jar -start boot/osgi/console/console_all-2.0.0.jar -start boot/osgi/component/component_all-2.0.0.jar -start boot/osgi/event/event_all-2.0.0.jar -start boot/osgi/device/device_all-2.0.0.jar -start boot/osgi/useradmin/useradmin_all-2.0.0.jar -start boot/osgi/bundlerepository/bundlerepository_all-2.0.0.jar -start boot/osgi/consoletty/consoletty-2.0.0.jar -start boot/osgi/consoletelnet/consoletelnet-2.0.0.jar -start boot/osgi/frameworkcommands/frameworkcommands-2.0.0.jar -start boot/osgi/logcommands/logcommands-2.0.0.jar -start boot/osgi/cm_cmd/cm_cmd-2.0.0.jar # Install but don't start the desktop. #-start boot/osgi/desktop/desktop_all-2.0.0.jar -start boot/osgi/http/http_all-2.0.0.jar -start boot/osgi/httproot/httproot-2.0.0.jar ############################################################# # Common Java libraries ############################################################# -initlevel 8 -istart mule/mule-module-util.jar ############################################################# # PAX Logging - supports log4j, commons-logging, and slf4j APIs ############################################################# -istart opt/api-jdk14.jar -istart opt/service-jdk14.jar -istart opt/log4j-jdk14.jar -istart opt/jcl-jdk14.jar -istart opt/slf4j-jdk14.jar ############################################################# # Spring ############################################################# -initlevel 9 # Spring Dependencies -istart opt/aopalliance.osgi.jar -istart opt/asm.osgi.jar -istart opt/aspectjrt.osgi.jar # -istart opt/cglib-nodep.osgi.jar # -istart opt/commons-attributes.osgi.jar # Spring -istart opt/spring-core.jar -istart opt/spring-aop.jar -istart opt/spring-context.jar -istart opt/spring-beans.jar -istart opt/spring-jmx.jar # Spring OSGi -istart opt/spring-osgi-core-mule.jar -istart opt/spring-osgi-extender-mule.jar -istart opt/spring-osgi-io.jar ############################################################# # Mule ############################################################# -initlevel 10 # Core -istart mule/mule-core.jar -istart mule/mule-module-osgi.jar # Transports -istart mule/mule-transport-file.jar -istart mule/mule-transport-tcp.jar -istart mule/mule-transport-http.jar ############################################################# # User Application ############################################################# -initlevel 11 # Install but don't start the examples -install user/mule-example-hello-osgi.jar mule-2.0.1/distributions/server/src/main/resources/conf/restart.xargs0000644000175000017500000000007710553776311025730 0ustar charlescharles# load common properties -xargs ../conf/props.xargs -launch 0 mule-2.0.1/distributions/server/src/main/resources/conf/wrapper.conf0000644000175000017500000001444710766204322025525 0ustar charlescharles#******************************************************************** # System Properties #******************************************************************** # Location of your Mule installation. wrapper.java.additional.1=-Dmule.home="%MULE_HOME%" wrapper.java.additional.1.stripquotes=TRUE wrapper.java.additional.2=-Dmule.base="%MULE_BASE%" wrapper.java.additional.2.stripquotes=TRUE # These libraries will be downloaded at system startup due to licensing restrictions. wrapper.java.additional.3=-Dmule.bootstrap.library.download.description.1=javax.activation.DataSource,/javax/activation/activation/1.1,activation-1.1.jar wrapper.java.additional.4=-Dmule.bootstrap.library.download.description.2=javax.mail.Message,/javax/mail/mail/1.4,mail-1.4.jar # We check the local Maven repo before downloading to save bandwidth. wrapper.java.additional.5=-Dm2.repo="%M2_REPO%" # *** IMPORTANT *** # If you enable any of the options below, you _must_ change the to be a # consecutive number (based on the number of additional properties) otherwise # Java will not parse this properties file correctly! # (see http://wrapper.tanukisoftware.org/doc/english/prop-java-additional-n.html) # *** IMPORTANT *** # Debug remotely, the application will wait for the external debugger to connect. #wrapper.java.additional.=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 # Specify an HTTP proxy if you are behind a firewall. #wrapper.java.additional.=-Dhttp.proxyHost=YOUR_HOST #wrapper.java.additional.=-Dhttp.proxyPort=YOUR_PORT #wrapper.java.additional.=-Dhttp.proxyUsername=YOUR_USER_NAME #wrapper.java.additional.=-Dhttp.proxyPassword=YOUR_PASSWORD # Identification of your Mule server #wrapper.java.additional.=-Dmule.serverId=YOUR_MULE_SERVER #wrapper.java.additional.=-Dmule.clusterId=YOUR_MULE_CLUSTER #wrapper.java.additional.=-Dmule.domainId=YOUR_MULE_DOMAIN # Mule's working directory for SEDA queue persistence, transactions, etc. #wrapper.java.additional.=-Dmule.workingDirectory=./.mule # Miscellaneous settings #wrapper.java.additional.=-Dmule.encoding=UTF-8 #wrapper.java.additional.=-Dmule.endpoints.synchronous=false #wrapper.java.additional.=-Dmule.remoteSync=false #wrapper.java.additional.=-Dmule.timeout.synchronous=10000 #wrapper.java.additional.=-Dmule.timeout.transaction=30000 #wrapper.java.additional.=-Dmule.systemModelType=seda #wrapper.java.additional.=-Dmule.clientMode=false # Debug options #wrapper.java.additional.=-Dmule.disable.threadsafemessages=false #wrapper.java.additional.=-Dmule.message.cacheBytes=true #wrapper.java.additional.=-Dmule.message.cacheOriginal=true #wrapper.java.additional.=-Dmule.streaming.enable=true #wrapper.java.additional.=-Dmule.message.assertAccess=true #wrapper.java.additional.=-Dmule.transform.autoWrap=true #******************************************************************** # Wrapper Properties #******************************************************************** # Uncomment this line in the case of startup failure. #wrapper.debug=true # Java Application wrapper.java.command=java # Java Main class wrapper.java.mainclass=org.mule.module.boot.MuleBootstrap # Java Classpath wrapper.java.classpath.1=%MULE_LIB% wrapper.java.classpath.2=%MULE_EXE%/../conf wrapper.java.classpath.3=%MULE_HOME%/lib/boot/*.jar # Java Native Library Path (location of .DLL or .so files) wrapper.java.library.path.1=%LD_LIBRARY_PATH% wrapper.java.library.path.2=%MULE_HOME%/lib/boot # Increase the default startup timeout so that the JVM has enough # time to download the required jars on a slow connection wrapper.startup.timeout=120 # Initial Java Heap Size (in MB) #wrapper.java.initmemory=3 # Maximum Java Heap Size (in MB) wrapper.java.maxmemory=512 #******************************************************************** # Wrapper Logging Properties #******************************************************************** # Format of output for the console. (See docs for formats) wrapper.console.format=M # Log Level for console output. (See docs for log levels) wrapper.console.loglevel=INFO # Log file to use for wrapper output logging. wrapper.logfile=%MULE_EXE%/../logs/%MULE_APP%.log # Format of output for the log file. (See docs for formats) wrapper.logfile.format=M # Log Level for log file output. (See docs for log levels) wrapper.logfile.loglevel=INFO # Maximum size that the log file will be allowed to grow to before # the log is rolled. Size is specified in bytes. The default value # of 0, disables log rolling. May abbreviate with the 'k' (kb) or # 'm' (mb) suffix. For example: 10m = 10 megabytes. wrapper.logfile.maxsize=1m # Maximum number of rolled log files which will be allowed before old # files are deleted. The default value of 0 implies no limit. wrapper.logfile.maxfiles=10 # Log Level for sys/event log output. (See docs for log levels) wrapper.syslog.loglevel=NONE #******************************************************************** # Wrapper Windows Properties #******************************************************************** # Title to use when running as a console wrapper.console.title=%MULE_APP_LONG% #******************************************************************** # Wrapper Windows NT/2000/XP Service Properties #******************************************************************** # WARNING - Do not modify any of these properties when an application # using this configuration file has been installed as a service. # Please uninstall the service before modifying this section. The # service can then be reinstalled. # Name of the service wrapper.ntservice.name=%MULE_APP% # Display name of the service wrapper.ntservice.displayname=%MULE_APP_LONG% # Description of the service wrapper.ntservice.description=%MULE_APP_LONG% # Service dependencies. Add dependencies as needed starting from 1 wrapper.ntservice.dependency.1= # Mode in which the service is installed. AUTO_START or DEMAND_START wrapper.ntservice.starttype=AUTO_START # Allow the service to interact with the desktop. wrapper.ntservice.interactive=false # Do not edit lines below! # This include should point to wrapper-additional.conf file in the same directory as this file # ATTENTION: Path must be either absolute or relative to wrapper executable. #include %MULE_EXE%/../conf/wrapper-additional.conf mule-2.0.1/distributions/server/src/main/resources/bin/0000755000175000017500000000000011351411041022774 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/bin/launcher.conf0000644000175000017500000000132510774267673025501 0ustar charlescharles############################################################################## ## ## ## Groovy Classloading Configuration customized for Mule ## ## ## ############################################################################## ## ## $Revision: 11521 $ $Date: 2008-04-01 08:11:55 +0900 (mar. 01 avril 2008) $ ## ## Note: do not add clases from java.lang here. No rt.jar and no tools.jar ## # Load required libraries load ../lib/boot/*.jar load ${mule.home}/lib/user/*.jar load ${mule.home}/lib/mule/*.jar load ${mule.home}/lib/opt/*.jarmule-2.0.1/distributions/server/src/main/resources/bin/setup_local_instance.sh0000644000175000017500000000205410626313515027542 0ustar charlescharles#! /bin/sh # You can only call this script if MULE_HOME and MULE_BASE are defined if [ -z "$MULE_HOME" ] ; then echo "You must first set the MULE_HOME environment variable" echo "to point to your Mule installation directory." exit -1 fi if [ -z "$MULE_BASE" ] ; then echo "You must first set the MULE_BASE environment variable" echo "to point to the local directory from which you want to" echo "run Mule." exit -1 fi echo "Creating Mule directories ..." mkdir $MULE_BASE mkdir $MULE_BASE/lib mkdir $MULE_BASE/lib/user mkdir $MULE_BASE/logs echo "Copying Mule files ..." cp -r $MULE_HOME/bin $MULE_BASE/ cp -r $MULE_HOME/conf $MULE_BASE/ if [ ! -z "$MULE_HOME/examples" ]; then echo "Do you want to copy the examples directories to your local" echo "Mule installation directory [y/n]?" read i if [ 'y' = $i ]; then echo "Copying example files ..." cp -r $MULE_HOME/examples $MULE_BASE/ elif [ 'Y' = $i ]; then echo "Copying example files ..." cp -r $MULE_HOME/examples $MULE_BASE/ fi fi echo "All done!" mule-2.0.1/distributions/server/src/main/resources/bin/additional.groovy0000644000175000017500000001116710761541722026377 0ustar charlescharles/* * $Id: additional.groovy 298 2008-01-31 00:42:47Z andrew $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ File wrapperConfigFile = new File(args[0]) jpdaOpts = args[1] // extracting wrapper conf directory m = wrapperConfigFile.path =~ /^.*[\\\/]/ m.matches() String wrapperConfDir = m[0] File wrapperAdditionalConfFile = new File(wrapperConfDir + 'wrapper-additional.conf') boolean debugEnabled = args.findIndexOf { '-debug'.equalsIgnoreCase(it)} > -1 int profileArgIndex = args.findIndexOf { '-profile'.equalsIgnoreCase(it)} boolean profileEnabled = profileArgIndex > -1 boolean adHocOptionsAvailable = args.findIndexOf { it.startsWith('-M') } > -1 paramIndex = 0 if (debugEnabled || profileEnabled || adHocOptionsAvailable) { // looking for maximum number of wrapper.java.additional property wrapperConfigFile.eachLine { String line -> switch (line) { case ~/^\s*wrapper\.java\.additional\..+/: m = line =~ /^\s*wrapper\.java\.additional\.(\d+).+/ m.find() paramIndex = Math.max(Integer.valueOf(m[0][1]), paramIndex) break } } paramIndex++ wrapperAdditionalConfFile.withWriter() { Writer w -> w << "# Do not edit this file!\n" w << "# This is a generated file to add additional parameters to JVM\n" if (debugEnabled) { writeJpdaOpts(w) } if (profileEnabled) { String profileArg if (args.size() - 1 > profileArgIndex ) { if (args[profileArgIndex + 1][0] != '-') { profileArg = args[profileArgIndex + 1] } } writeProfilerOpts(w, profileArg) } if (adHocOptionsAvailable) { writeAdHocProps(w) } } } else { // remove file if none of the options are specified if (wrapperAdditionalConfFile.exists()) { wrapperAdditionalConfFile.delete() } } //=== next goes procedures definitions /** Ad-hoc options */ def void writeAdHocProps(Writer w) { args.findAll { it.startsWith('-M') }.each { arg -> w << "wrapper.java.additional.${paramIndex}=\"${arg.replaceFirst("^-M", "")}\"\n" w << "wrapper.java.additional.${paramIndex}.stripquotes=TRUE\n" paramIndex++ } } def void writeJpdaOpts(Writer w) { def jvmArgs = [] jpdaOpts.split("\\s-").each {jvmArgs << it} jvmArgs.each {String arg -> w << "wrapper.java.additional.${paramIndex++}=-${arg.replaceFirst("^-", "")}\n" } } def void writeProfilerOpts(Writer w, String optionValue) { if (optionValue == null || optionValue.length() == 0) { optionValue = "sessionname=Mule" } Double javaVersion = new Double(System.getProperty("java.specification.version")) String additional if (javaVersion >= 1.5) { additional = "-agentlib:${getLibraryName()}=$optionValue" } else { additional = "-Xrun${getLibraryName()}:$optionValue" } w << "wrapper.java.additional.${paramIndex++}=$additional\n" } def String getLibraryName() { // Decide whether this is a 32 or 64 bit version of Java. String jvmBits = System.getProperty("sun.arch.data.model", "") // Generate an os name. Most names are used as is, but some are modified. String os = System.getProperty("os.name", "").toLowerCase() switch (os) { case ~/^windows.*/: return "yjpagent-win-$jvmBits" break case "sunos": return "yjpagent-solaris-${getArchitecture()}-$jvmBits" break case ~/^mac.*/: return "yjpagent-mac" break default: // should be some *nix return "yjpagent-linux-$jvmBits" } } def String getArchitecture() { // Generate architecture name. String arch = System.getProperty("os.arch", "").toLowerCase() switch (arch) { case ["amd64", "athlon", "ia32", "ia64", "x86_64", "i686", "i586", "i486", "i386", "x86"]: return "x86" break case ~/^sparc.*/: return "sparc" break default: println "ERROR: Architecture $arch is not supported by profiler" return } } mule-2.0.1/distributions/server/src/main/resources/bin/launcher.bat0000644000175000017500000000041510774267673025321 0ustar charlescharles@echo off set cp=.;%MULE_HOME%\conf;%MULE_HOME%\lib\opt\groovy-all-1.5.4.jar;%MULE_HOME%\lib\boot\commons-cli-1.0.jar java -Dmule.home=%MULE_HOME% -cp "%cp%" org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.GroovyMain --conf %MULE_HOME%\bin\launcher.conf %* mule-2.0.1/distributions/server/src/main/resources/bin/mule.bat0000644000175000017500000001215010761771043024444 0ustar charlescharles@echo off setlocal rem Copyright (c) 1999, 2006 Tanuki Software Inc. rem rem Java Service Wrapper command based script rem if "%OS%"=="Windows_NT" goto nt echo This script only works with NT-based versions of Windows. goto :eof :nt rem Configure remote Java debugging options here rem Setting suspend=y will wait for you to connect before proceeding set JPDA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 rem rem Find the application home. rem rem %~dp0 is location of current script under NT set _REALPATH=%~dp0 rem Decide on the wrapper binary. rem ############################################################### rem Customized for Mule rem ############################################################### rem MULE_HOME must be set if "%MULE_HOME%" == "" ( echo You must set the MULE_HOME environment variable before starting Mule goto :eof ) rem If MULE_BASE is not set, set it to MULE_HOME if "%MULE_BASE%" == "" SET MULE_BASE=%MULE_HOME% if "%MULE_APP%" == "" ( set MULE_APP=mule set MULE_APP_LONG=Mule ) else ( if "%MULE_APP_LONG%" == "" ( set MULE_APP_LONG=%MULE_APP% ) ) set PATH=%PATH%;%MULE_HOME%\lib\native\profiler set _WRAPPER_BASE=%MULE_HOME%\lib\boot\exec\wrapper rem ############################################################### set _WRAPPER_EXE=%_WRAPPER_BASE%-windows-x86-32.exe if exist "%_WRAPPER_EXE%" goto validate set _WRAPPER_EXE=%_WRAPPER_BASE%-windows-x86-64.exe if exist "%_WRAPPER_EXE%" goto validate set _WRAPPER_EXE=%_WRAPPER_BASE%.exe if exist "%_WRAPPER_EXE%" goto validate echo Unable to locate a Wrapper executable using any of the following names: echo %_WRAPPER_BASE%-windows-x86-32.exe echo %_WRAPPER_BASE%-windows-x86-64.exe echo %_WRAPPER_BASE%.exe pause goto :eof :validate rem Find the requested command. for /F %%v in ('echo %1^|findstr "^console$ ^start$ ^pause$ ^resume$ ^stop$ ^restart$ ^install$ ^remove"') do call :exec set COMMAND=%%v if "%COMMAND%" == "" ( rem ############################################################### rem Customized for Mule rem ############################################################### echo Running in console/foreground mode by default, use Ctrl-C to exit... set COMMAND=:console rem pause rem goto :eof rem ############################################################### ) else ( shift ) rem rem Find the wrapper.conf rem :conf set _WRAPPER_CONF="%_REALPATH%..\conf\wrapper.conf" rem ############################################################### rem Customized for Mule rem ############################################################### rem Export the location of this script. This will be used in wrapper.conf rem ATTENTION: %_REALPATH% contains a trailing path delimiter that will cause the wrapper to fail. Do not use that rem (making MULE_EXE as absolute path to enable wrapper include additional configs correctly) for /f "tokens=* delims= " %%a in ('attrib %MULE_HOME%\bin') do set MULE_EXE=%%a rem add XML compatibility jars when running with JDK 1.4 or JDK 1.5 java -version 2>&1 | findstr "1.4" >NUL IF %ERRORLEVEL% == 0 set MULE_ENDORSED=-M-Djava.endorsed.dirs="%MULE_HOME%\lib\endorsed" java -version 2>&1 | findstr "1.5" >NUL IF %ERRORLEVEL% == 0 set MULE_ENDORSED=-M-Djava.endorsed.dirs="%MULE_HOME%\lib\endorsed" rem Mule options: Set the working directory to the current one and pass all command-line rem options (-config, -builder, etc.) straight through to the main() method. set MULE_OPTS=set.MULE_APP=%MULE_APP% set.MULE_APP_LONG=%MULE_APP_LONG% set.MULE_EXE="%MULE_EXE%" set.MULE_LIB=%MULE_LIB% wrapper.working.dir="%CD%" wrapper.app.parameter.1=%1 wrapper.app.parameter.2=%2 wrapper.app.parameter.3=%3 wrapper.app.parameter.4=%4 wrapper.app.parameter.5=%5 wrapper.app.parameter.6=%6 wrapper.app.parameter.7=%7 wrapper.app.parameter.8=%8 wrapper.app.parameter.9=%9 rem Adding additional jvm arguments to wrapper configuration if needed call %MULE_HOME%\bin\launcher.bat %MULE_HOME%\bin\additional.groovy %_WRAPPER_CONF% "%JPDA_OPTS%" "%MULE_ENDORSED%" %* :run rem ############################################################### rem rem Run the application. rem At runtime, the current directory will be that of wrapper.exe rem call :%COMMAND% if errorlevel 1 pause goto :eof rem ############################################################### rem Customized for Mule rem ############################################################### :console "%_WRAPPER_EXE%" -c %_WRAPPER_CONF% %MULE_OPTS% goto :eof :start "%_WRAPPER_EXE%" -t %_WRAPPER_CONF% %MULE_OPTS% goto :eof :pause "%_WRAPPER_EXE%" -a %_WRAPPER_CONF% %MULE_OPTS% goto :eof :resume "%_WRAPPER_EXE%" -e %_WRAPPER_CONF% %MULE_OPTS% goto :eof :stop "%_WRAPPER_EXE%" -p %_WRAPPER_CONF% %MULE_OPTS% goto :eof :install "%_WRAPPER_EXE%" -i %_WRAPPER_CONF% %MULE_OPTS% goto :eof :remove "%_WRAPPER_EXE%" -r %_WRAPPER_CONF% %MULE_OPTS% goto :eof rem ############################################################### :restart call :stop call :start goto :eof :exec %* goto :eof mule-2.0.1/distributions/server/src/main/resources/bin/launcher0000755000175000017500000000040310774267673024554 0ustar charlescharles#! /bin/sh cp=.:$MULE_HOME/conf:$MULE_HOME/lib/opt/groovy-all-1.5.4.jar:$MULE_HOME/lib/boot/commons-cli-1.0.jar java -Dmule.home=$MULE_HOME -cp "$cp" org.codehaus.groovy.tools.GroovyStarter --main groovy.ui.GroovyMain --conf $MULE_HOME/bin/launcher.conf "$@"mule-2.0.1/distributions/server/src/main/resources/bin/USAGE.txt0000644000175000017500000000411310747504633024422 0ustar charlescharles+-------------+ | BASIC USAGE | +-------------+ mule [-config ] (runs in the foreground, stop with Ctrl-C) mule start|stop|restart [-config ] (runs in the background as a daemon) +---------------------+ | CONFIGURATION FILES | +---------------------+ If the "-config" parameter is not specified, a default file name of "mule-config.xml" will be assumed. You may optionally specify more than one file as a comma-separated list (this can be useful for splitting up your Mule configuration to make it more manageable). Your configuration file(s) need to be on the classpath prior to startup. A convenient way to achieve this is by placing them in the "conf" or "lib/user" directory. Alternatively, you can specify an explicit path to their location on the file system as follows: mule -config file:/path/to/my-config.xml +---------------------+ | CLASSES & LIBRARIES | +---------------------+ Any user classes or libraries used by your configuration should be placed in "lib/user" before starting up the server. Please note that hot deployment is not yet supported, so you will need to restart the server for configuration changes and/or new classes/libraries to take effect. +-----------------------+ | CONFIGURATION BUILDER | +-----------------------+ By default, the "org.mule.config.spring.SpringXmlConfigurationBuilder" class will be used to interpret your configuration file(s). If you wish to use a different configuration builder, you can specify it using the "-builder" option. For example, to use the Scripting configuration builder you could specify: mule -config my-scripted-config.xml \ -builder org.mule.config.builders.ScriptConfigurationBuilder +------------------+ | ADVANCED OPTIONS | +------------------+ Mule uses the Java Service Wrapper (http://wrapper.tanukisoftware.org) to control the JVM from your native OS. The wrapper provides many advanced options and features. For more information, see http://wrapper.tanukisoftware.org/doc/english/launch.html and http://wrapper.tanukisoftware.org/doc/english/properties.html mule-2.0.1/distributions/server/src/main/resources/bin/mule0000755000175000017500000004636010761761503023714 0ustar charlescharles#! /bin/sh # Copyright (c) 1999, 2006 Tanuki Software Inc. # # Java Service Wrapper sh script. Suitable for starting and stopping # wrapped Java applications on UNIX platforms. ###################################################################### # Customized for Mule ###################################################################### # Configure remote Java debugging options here # Setting suspend=y will wait for you to connect before proceeding JPDA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005" # Check for MULE_HOME if [ -z "$MULE_HOME" ] ; then echo "You must specify the MULE_HOME environment variable before starting Mule" exit -1 fi # If MULE_BASE is not set, set it to MULE_HOME if [ -z "$MULE_BASE" ] ; then MULE_BASE=$MULE_HOME export MULE_BASE fi # Application if [ "$MULE_APP" = "" ] then MULE_APP="mule" MULE_APP_LONG="Mule" else if [ "$MULE_APP_LONG" = "" ] then MULE_APP_LONG=${MULE_APP} fi fi APP_NAME=${MULE_APP} APP_LONG_NAME=${MULE_APP_LONG} # Wrapper WRAPPER_CMD="${MULE_HOME}/lib/boot/exec/wrapper" WRAPPER_CONF="${MULE_BASE}/conf/wrapper.conf" # Set the startup directory so that any relative paths can be resolved later. STARTUP_DIR=`pwd` # add XML compatibility jars when running with JDK 1.4 or JDK 1.5 if [ "`java -version 2>&1 | grep -e '1.[45]'`" ]; then MULE_ENDORSED=-M-Djava.endorsed.dirs="${MULE_HOME}/lib/endorsed" fi MULE_OPTS="wrapper.working.dir=\"$STARTUP_DIR\" \ wrapper.app.parameter.1=$2 \ wrapper.app.parameter.2=$3 \ wrapper.app.parameter.3=$4 \ wrapper.app.parameter.4=$5 \ wrapper.app.parameter.5=$6 \ wrapper.app.parameter.6=$7 \ wrapper.app.parameter.7=$8 \ wrapper.app.parameter.8=$9 \ wrapper.app.parameter.9=$10" ###################################################################### # Priority at which to run the wrapper. See "man nice" for valid priorities. # nice is only used if a priority is specified. PRIORITY= # Location of the pid file. PIDDIR="." # If uncommented, causes the Wrapper to be shutdown using an anchor file. # When launched with the 'start' command, it will also ignore all INT and # TERM signals. #IGNORE_SIGNALS=true # If specified, the Wrapper will be run as the specified user. # IMPORTANT - Make sure that the user has the required privileges to write # the PID file and wrapper.log files. Failure to be able to write the log # file will cause the Wrapper to exit without any way to write out an error # message. # NOTE - This will set the user which is used to run the Wrapper as well as # the JVM and is not useful in situations where a privileged resource or # port needs to be allocated prior to the user being changed. #RUN_AS_USER= # The following two lines are used by the chkconfig command. Change as is # appropriate for your application. They should remain commented. # chkconfig: 2345 20 80 # description: Mule #----------------------------------------------------------------------------- LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MULE_HOME/lib/native/profiler # Get the fully qualified path to the script case $0 in /*) SCRIPT="$0" ;; *) PWD=`pwd` SCRIPT="$PWD/$0" ;; esac # Resolve the true real path without any sym links. CHANGED=true while [ "X$CHANGED" != "X" ] do # Change spaces to ":" so the tokens can be parsed. SAFESCRIPT=`echo $SCRIPT | sed -e 's; ;:;g'` # Get the real path to this script, resolving any symbolic links TOKENS=`echo $SAFESCRIPT | sed -e 's;/; ;g'` REALPATH= for C in $TOKENS; do # Change any ":" in the token back to a space. C=`echo $C | sed -e 's;:; ;g'` REALPATH="$REALPATH/$C" # If REALPATH is a sym link, resolve it. Loop for nested links. while [ -h "$REALPATH" ] ; do LS="`ls -ld "$REALPATH"`" LINK="`expr "$LS" : '.*-> \(.*\)$'`" if expr "$LINK" : '/.*' > /dev/null; then # LINK is absolute. REALPATH="$LINK" else # LINK is relative. REALPATH="`dirname "$REALPATH"`""/$LINK" fi done done if [ "$REALPATH" = "$SCRIPT" ] then CHANGED="" else SCRIPT="$REALPATH" fi done # Change the current directory to the location of the script cd "`dirname "$REALPATH"`" REALDIR=`pwd` # If the PIDDIR is relative, set its value relative to the full REALPATH to avoid problems if # the working directory is later changed. FIRST_CHAR=`echo $PIDDIR | cut -c1,1` if [ "$FIRST_CHAR" != "/" ] then PIDDIR=$REALDIR/$PIDDIR fi # Same test for WRAPPER_CMD FIRST_CHAR=`echo $WRAPPER_CMD | cut -c1,1` if [ "$FIRST_CHAR" != "/" ] then WRAPPER_CMD=$REALDIR/$WRAPPER_CMD fi # Same test for WRAPPER_CONF FIRST_CHAR=`echo $WRAPPER_CONF | cut -c1,1` if [ "$FIRST_CHAR" != "/" ] then WRAPPER_CONF=$REALDIR/$WRAPPER_CONF fi # Process ID ANCHORFILE="$PIDDIR/$APP_NAME.anchor" ###################################################################### # Patched for Mule ###################################################################### PIDFILE="$PIDDIR/.$APP_NAME.pid" ###################################################################### LOCKDIR="/var/lock/subsys" LOCKFILE="$LOCKDIR/$APP_NAME" pid="" # Resolve the location of the 'ps' command PSEXE="/usr/bin/ps" if [ ! -x "$PSEXE" ] then PSEXE="/bin/ps" if [ ! -x "$PSEXE" ] then echo "Unable to locate 'ps'." echo "Please report this message along with the location of the command on your system." exit 1 fi fi PSKEYWORD="args" # Resolve the os DIST_OS=`uname -s | tr [:upper:] [:lower:] | tr -d [:blank:]` case "$DIST_OS" in 'sunos') DIST_OS="solaris" ;; 'hp-ux' | 'hp-ux64') DIST_OS="hpux" ;; 'darwin') DIST_OS="macosx" PSKEYWORD="command" ;; 'unix_sv') DIST_OS="unixware" ;; 'aix') DIST_OS="aix" ;; esac ###################################################################### # Patched for Mule (MULE-1288, MULE-1322, MULE-1337, MULE-1396) ###################################################################### # Resolve the architecture UNAME_PROC_OPTION="-m" if [ "$DIST_OS" = "aix" ]; then UNAME_PROC_OPTION="-p" fi PROC_ARCH=`uname $UNAME_PROC_OPTION | tr [:upper:] [:lower:] | tr -d [:blank:]` while : do case "$PROC_ARCH" in 'amd64' | 'athlon' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64' | 'i86pc') DIST_ARCH="x86" break;; 'ia32' | 'ia64') DIST_ARCH="ia" break;; 'ip27') DIST_ARCH="mips" break;; 'power' | 'powerpc' | 'power_pc' | 'ppc64' | 'powermacintosh') DIST_ARCH="ppc" break;; 'pa_risc' | 'pa-risc') DIST_ARCH="parisc" break;; 'sun4u' | 'sun4v' | 'sparcv9' | 'sparc') DIST_ARCH="sparc" break;; '9000/800') DIST_ARCH="parisc" break;; *) echo "Your machine's hardware type (uname $UNAME_PROC_OPTION) was not recognized by the Service Wrapper as a supported platform." echo "Please report this message along with your machine's processor/architecture." exit 1 ;; esac done ###################################################################### outputFile() { if [ -f "$1" ] then echo " $1 (Found but not executable.)"; else echo " $1" fi } # Decide on the wrapper binary to use. # If a 32-bit wrapper binary exists then it will work on 32 or 64 bit # platforms, if the 64-bit binary exists then the distribution most # likely wants to use long names. Otherwise, look for the default. # For macosx, we also want to look for universal binaries. WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32" if [ -x "$WRAPPER_TEST_CMD" ] then WRAPPER_CMD="$WRAPPER_TEST_CMD" else if [ "$DIST_OS" = "macosx" ] then WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-32" if [ -x "$WRAPPER_TEST_CMD" ] then WRAPPER_CMD="$WRAPPER_TEST_CMD" else WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64" if [ -x "$WRAPPER_TEST_CMD" ] then WRAPPER_CMD="$WRAPPER_TEST_CMD" else WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-64" if [ -x "$WRAPPER_TEST_CMD" ] then WRAPPER_CMD="$WRAPPER_TEST_CMD" else if [ ! -x "$WRAPPER_CMD" ] then echo "Unable to locate any of the following binaries:" outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32" outputFile "$WRAPPER_CMD-$DIST_OS-universal-32" outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64" outputFile "$WRAPPER_CMD-$DIST_OS-universal-64" outputFile "$WRAPPER_CMD" exit 1 fi fi fi fi else WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64" if [ -x "$WRAPPER_TEST_CMD" ] then WRAPPER_CMD="$WRAPPER_TEST_CMD" else if [ ! -x "$WRAPPER_CMD" ] then echo "Unable to locate any of the following binaries:" outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32" outputFile "$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64" outputFile "$WRAPPER_CMD" exit 1 fi fi fi fi # Build the nice clause if [ "X$PRIORITY" = "X" ] then CMDNICE="" else CMDNICE="nice -$PRIORITY" fi # Build the anchor file clause. if [ "X$IGNORE_SIGNALS" = "X" ] then ANCHORPROP= IGNOREPROP= else ANCHORPROP=wrapper.anchorfile=\"$ANCHORFILE\" IGNOREPROP=wrapper.ignore_signals=TRUE fi # Build the lock file clause. Only create a lock file if the lock directory exists on this platform. LOCKPROP= if [ -d $LOCKDIR ] then if [ -w $LOCKDIR ] then LOCKPROP=wrapper.lockfile=\"$LOCKFILE\" fi fi checkUser() { # $1 touchLock flag # $2 command # Check the configured user. If necessary rerun this script as the desired user. if [ "X$RUN_AS_USER" != "X" ] then # Resolve the location of the 'id' command IDEXE="/usr/xpg4/bin/id" if [ ! -x "$IDEXE" ] then IDEXE="/usr/bin/id" if [ ! -x "$IDEXE" ] then echo "Unable to locate 'id'." echo "Please report this message along with the location of the command on your system." exit 1 fi fi if [ "`$IDEXE -u -n`" = "$RUN_AS_USER" ] then # Already running as the configured user. Avoid password prompts by not calling su. RUN_AS_USER="" fi fi if [ "X$RUN_AS_USER" != "X" ] then # If LOCKPROP and $RUN_AS_USER are defined then the new user will most likely not be # able to create the lock file. The Wrapper will be able to update this file once it # is created but will not be able to delete it on shutdown. If $2 is defined then # the lock file should be created for the current command if [ "X$LOCKPROP" != "X" ] then if [ "X$1" != "X" ] then # Resolve the primary group RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1` if [ "X$RUN_AS_GROUP" = "X" ] then RUN_AS_GROUP=$RUN_AS_USER fi touch $LOCKFILE chown $RUN_AS_USER:$RUN_AS_GROUP $LOCKFILE fi fi # Still want to change users, recurse. This means that the user will only be # prompted for a password once. Variables shifted by 1 su -m $RUN_AS_USER -c "\"$REALPATH\" $2" # Now that we are the original user again, we may need to clean up the lock file. if [ "X$LOCKPROP" != "X" ] then getpid if [ "X$pid" = "X" ] then # Wrapper is not running so make sure the lock file is deleted. if [ -f "$LOCKFILE" ] then rm "$LOCKFILE" fi fi fi exit 0 fi } getpid() { if [ -f "$PIDFILE" ] then if [ -r "$PIDFILE" ] then pid=`cat "$PIDFILE"` if [ "X$pid" != "X" ] then # It is possible that 'a' process with the pid exists but that it is not the # correct process. This can happen in a number of cases, but the most # common is during system startup after an unclean shutdown. # The ps statement below looks for the specific wrapper command running as # the pid. If it is not found then the pid file is considered to be stale. ###################################################################### # TODO MULE-2052: ps -o args gets truncated to 80 columns on Solaris which makes # this test fail if the path is too long. # http://sourceforge.net/tracker/index.php?func=detail&aid=1664303&group_id=39428&atid=425187 ###################################################################### pidtest=`$PSEXE -p $pid -o $PSKEYWORD | grep "$WRAPPER_CMD" | tail -1` if [ "X$pidtest" = "X" ] then # This is a stale pid file. rm -f "$PIDFILE" echo "Removed stale pid file: $PIDFILE" pid="" fi fi else echo "Cannot read $PIDFILE." exit 1 fi fi } testpid() { pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` if [ "X$pid" = "X" ] then # Process is gone so remove the pid file. rm -f "$PIDFILE" pid="" fi } console() { echo "Running $APP_LONG_NAME..." getpid if [ "X$pid" = "X" ] then # The string passed to eval must handle spaces in paths correctly. COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" $ANCHORPROP $LOCKPROP" ###################################################################### # Customized for Mule ###################################################################### eval $COMMAND_LINE $MULE_OPTS ###################################################################### else echo "$APP_LONG_NAME is already running." exit 1 fi } start() { echo "Starting $APP_LONG_NAME..." getpid if [ "X$pid" = "X" ] then # The string passed to eval must handles spaces in paths correctly. COMMAND_LINE="$CMDNICE \"$WRAPPER_CMD\" \"$WRAPPER_CONF\" wrapper.syslog.ident=$APP_NAME wrapper.pidfile=\"$PIDFILE\" wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP" ###################################################################### # Customized for Mule ###################################################################### eval $COMMAND_LINE $MULE_OPTS ###################################################################### else echo "$APP_LONG_NAME is already running." exit 1 fi } stopit() { echo "Stopping $APP_LONG_NAME..." getpid if [ "X$pid" = "X" ] then echo "$APP_LONG_NAME was not running." else if [ "X$IGNORE_SIGNALS" = "X" ] then # Running so try to stop it. kill $pid if [ $? -ne 0 ] then # An explanation for the failure should have been given echo "Unable to stop $APP_LONG_NAME." exit 1 fi else rm -f "$ANCHORFILE" if [ -f "$ANCHORFILE" ] then # An explanation for the failure should have been given echo "Unable to stop $APP_LONG_NAME." exit 1 fi fi # We can not predict how long it will take for the wrapper to # actually stop as it depends on settings in wrapper.conf. # Loop until it does. savepid=$pid CNT=0 TOTCNT=0 while [ "X$pid" != "X" ] do # Show a waiting message every 5 seconds. if [ "$CNT" -lt "5" ] then CNT=`expr $CNT + 1` else echo "Waiting for $APP_LONG_NAME to exit..." CNT=0 fi TOTCNT=`expr $TOTCNT + 1` sleep 1 testpid done pid=$savepid testpid if [ "X$pid" != "X" ] then echo "Failed to stop $APP_LONG_NAME." exit 1 else echo "Stopped $APP_LONG_NAME." fi fi } status() { getpid if [ "X$pid" = "X" ] then echo "$APP_LONG_NAME is not running." exit 1 else echo "$APP_LONG_NAME is running ($pid)." exit 0 fi } dump() { echo "Dumping $APP_LONG_NAME..." getpid if [ "X$pid" = "X" ] then echo "$APP_LONG_NAME was not running." else kill -3 $pid if [ $? -ne 0 ] then echo "Failed to dump $APP_LONG_NAME." exit 1 else echo "Dumped $APP_LONG_NAME." fi fi } checkAdditionalJvmParams() { $MULE_HOME/bin/launcher $MULE_HOME/bin/additional.groovy $WRAPPER_CONF "$JPDA_OPTS" "$MULE_ENDORSED" $@ } ###################################################################### # Customized for Mule ###################################################################### # Export variables to be used in wrapper.conf # The location of this script. MULE_EXE="$REALDIR" export MULE_EXE # The name of the Mule application (defaults to "mule"). export MULE_APP export MULE_APP_LONG ###################################################################### case "$1" in 'console') checkUser touchlock $1 checkAdditionalJvmParams $* console ;; 'start') checkUser touchlock $1 checkAdditionalJvmParams $* start ;; 'stop') checkUser "" $1 stopit ;; 'restart') checkUser touchlock $1 stopit start ;; 'status') checkUser "" $1 status ;; 'dump') checkUser "" $1 dump ;; *) ###################################################################### # Customized for Mule ###################################################################### echo "Running in console (foreground) mode by default, use Ctrl-C to exit..." # Change back to the original startup directory. cd "$STARTUP_DIR" # Call this script recursively with the "console" parameter. "$REALPATH" console $* ###################################################################### ;; esac exit 0 mule-2.0.1/distributions/server/src/main/resources/logs/0000755000175000017500000000000011351411006023171 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/logs/README.txt0000644000175000017500000000154710732766104024714 0ustar charlescharlesThis directory is used for tracing the execution of the Mule server. Application-level logging is configured in the file "conf/log4j.properties" (by default all output is sent to the console). System-level logging is configured in the file "conf/wrapper.conf" (by default all output is sent to the file "logs/mule.log" Note that, unless the application is run in the foreground (i.e., not as a daemon), this means that while the application itself is configured to send its output to the console, the wrapper receives the console output and sends it to the log file. In addition to the application's output, the wrapper also sends any JVM-level or OS-level errors/warnings to the log file. This means that if the JVM crashes and automatically restarts (enabled by default), the time and cause of the crash will remain in the log file after the JVM restarts. mule-2.0.1/distributions/server/src/main/resources/src/0000755000175000017500000000000011351411041023013 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/src/README.txt0000644000175000017500000000032210732766104024525 0ustar charlescharlesAn export of the Mule source code is included in this directory for convenience. If you wish to browse or work directly with the source code, please read the information at http://www.muledocs.org/Subversion mule-2.0.1/distributions/server/src/main/resources/lib/0000755000175000017500000000000011351411041022772 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/lib/opt/0000755000175000017500000000000011351411015023575 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/lib/boot/0000755000175000017500000000000011351411041023735 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/lib/boot/libwrapper-macosx-universal-32.jnilib0000755000175000017500000010500410565334502033034 0ustar charlescharles<( P: H__TEXT __text__TEXTd td__picsymbol_stub__TEXT$__picsymbolstub1__TEXT __cstring__TEXT`p`__DATA  __data__DATA $ __dyld__DATA $ $__la_symbol_ptr__DATA ,P ,__nl_symbol_ptr__DATA | |(__bss__DATA 8__LINKEDIT00 ( 4CfX/usr/lib/libSystem.B.dylib0V5x P++B4*0|B}|}cx= }| x= N |B}h|=kk }iN |B8`!<8H 8!P8`Ȼ|H|B8`!<8H 8!P8`̻|H|B8`!<8H i8!P8`ͻ|Hp|B/!<_B A<8c H8`H q<8`88H <8x8`H<88`HH}8!P<_|b N H\|B!<_B l/A$?< 8c HE8`HH?~ 8H/@0HI|dx<8c H 8!P8`|H8!P|N |B!<_B Ȁ/A(<8c <x8 T~x8 `| x| N!|xyA~CxHy||yA|\HD|dxx| x| N!|{xxH|fxx| x| xdx8N!^xFxxgxx$x| x| N!^<~x8 h8 `x| x| N!|xyAHH;H%/A}/@H|\H݀D|dxx| x| N!|{xxH|fxx| x| xdx8N!^Fxgxxx$xx| x| N!H||yA KXHH; 8!#xA|N |B||x|#x|+x!<8cPH}/A$8!Pxxx|K8!P|N 8`N 8`N |!H8!Pc|H|B}H| x|_xlptx|>^~h<_8b HM|lx<_8B~h^>|xtpl!|}N ||dxB8_!p8a98H8a8|}xH<_}]|~x9"tBt i|].<_x j;xH=,@|}xxHeH8!|N |B}h=k|D}N |B}h=k|(}N |B}h=k| }N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|d}N |B}h=k|H}N |B}h=k|,}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|h}N |B}h=k|L}N |B}h=k|0}N Inside native WrapperManager initialization methodSending SIGQUIT event to process group %d. Unable to send SIGQUIT to JVM process: %s Setting the console title not supported on UNIX platforms.org/tanukisoftware/wrapper/WrapperUNIXUser(II[B[B[B[B)VsetGroup(I[B)VaddGroupDISPLAYwindowsx86323.2.3printf$LDBL128libSystem.dddddddddddddddddddd  @ @ @ @ @ `@ \@ X@ T@ P@ L@ H@ D@ @@ <@ 8@ 4@ 0@ ,@ h@ d@ x@ t@ p@ l@ dd@R\d~ddddԄd$dDhDlDpDtDx $D ?D @ WD XDYDZ$pDqDrDsDt (DDDDdd  40x8C8  tFe d4r{ ] j 0 Ew   (MKPILJOQHFGNURETCSDBMKPILJOQHFGNURETCSDB>A__dyld_func_lookupdyld_stub_binding_helper__mh_bundle_header_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetInteractiveUser_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetJavaPID_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetUser_Java_org_tanukisoftware_wrapper_WrapperManager_nativeInit_Java_org_tanukisoftware_wrapper_WrapperManager_nativeListServices_Java_org_tanukisoftware_wrapper_WrapperManager_nativeRequestThreadDump_Java_org_tanukisoftware_wrapper_WrapperManager_nativeSendServiceControlCode_Java_org_tanukisoftware_wrapper_WrapperManager_nativeSetConsoleTitle_handleHangup_handleInterrupt_handleTermination_endgrent_fflush_getLastErrorText_getenv_geteuid_getgrent_getgrgid_getpid_getpwuid_kill_printf$LDBLStub_puts_setgrent_signal_strcmp_strlen_wrapperJNIDebugging_wrapperJNIHandleSignal_wrapperArch_wrapperBits_wrapperOS_wrapperVersion_Java_org_tanukisoftware_wrapper_WrapperManager_accessViolationInner_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetControlEvent_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetLibraryVersion_checkingControlEvent_lastControlEvent___error_strerror___stub_getrealaddr_NSAddressOfSymbol_NSIsSymbolNameDefinedWithHint_NSLookupAndBindSymbolWithHint_strcpy{standard input}int:t1=r1;-2147483648;2147483647;char:t2=r2;0;127;void:t3=3/SourceCache/Csu/Csu-58/bundle1.s/SourceCache/Csu/Csu-58///SourceCache/Csu/Csu-58/bundle1.s/SourceCache/Csu/Csu-58/bundle1.sdyld_stub_binding_helper:F3dyld_lazy_symbol_binding_entry_pointdyld__mh_bundle_header__dyld_func_lookup:F3dyld_func_lookup_pointer_wrapperProcessId_funcptrH__TEXT__text__TEXT__picsymbol_stub__TEXT__cstring__TEXTP__textcoal_nt__TEXT __DATA__data__DATA$__dyld__DATA$$__IMPORT  __jump_table__IMPORT P __pointers__IMPORTP P 8__LINKEDIT00  4aeCX/usr/lib/libSystem.B.dylib(0F3L P6p30X C XG USD$$E[]USD$$E[]USD$$E[]USUMыt$Z$b[D$$=D$$'D$$a[]U]USu D$$xD[]ËD$$$D$$yjD$$Q$m[]US!yta$-$5[]UWVSEEM`D$ $REuEEЁĜ[^_]ÉUT$ T$L$U$EtE$rEH ME0U:1уL$U$EċM9E0|$1уL$ D$UĉT$M $@E0Uz1уL$U$EȋMyE0|$1уL$ D$UȉT$M $@E0Uz1уL$U$E̋MyE0|$1уL$ D$ỦT$M $@E0Uz 1уL$U$ƋMy EE|$1уL$ D$t$U$M@Ut$ M̉L$UȉT$MĉL$UT$ML$ UT$ML$U$PpEЀ}MED$ D$ML$E$EU$1E‹HME0:1уL$U$ƋM9EE|$1уL$ D$t$U$M@Ut$ML$ UT$MЉL$U$MED$ D$ML$E$EcEԅx TtMD$$\uEԋ@E؋UUMԋ91уL$U$ME܋Eԋ8UU|$уL$ D$U܉T$M $E@UM܉L$U؉T$ ML$UЉT$M $EEUWVS,;EE} u$Pt‰E} EE,[^_] 1,[^_]U1]U1]U*$%UuE]USU E []Uǁt ǁǁ]U ]Inside native WrapperManager initialization methodSending SIGQUIT event to process group %d. Unable to send SIGQUIT to JVM process: %s Setting the console title not supported on UNIX platforms.org/tanukisoftware/wrapper/WrapperUNIXUser(II[B[B[B[B)V(I[B)VsetGroupaddGroupDISPLAYwindowsx86323.2.3$Ë $  d0JUd$aDbDcDd$DeDf$jDkDl(6Dm7Dn8d9dl0hC #$E F, |d1d q7 L(~ '/><@:=;AC978?BD6E25__dyld_func_lookupdyld_stub_binding_helper__mh_bundle_header_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetInteractiveUser_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetJavaPID_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetUser_Java_org_tanukisoftware_wrapper_WrapperManager_nativeInit_Java_org_tanukisoftware_wrapper_WrapperManager_nativeListServices_Java_org_tanukisoftware_wrapper_WrapperManager_nativeRequestThreadDump_Java_org_tanukisoftware_wrapper_WrapperManager_nativeSendServiceControlCode_Java_org_tanukisoftware_wrapper_WrapperManager_nativeSetConsoleTitle___i686.get_pc_thunk.bx_handleHangup_handleInterrupt_handleTermination_endgrent_fflush_getLastErrorText_getenv_geteuid_getgrent_getgrgid_getpid_getpwuid_kill_printf_puts_setgrent_signal_strcmp_wrapperJNIDebugging_wrapperJNIHandleSignal_wrapperArch_wrapperBits_wrapperOS_wrapperVersion_Java_org_tanukisoftware_wrapper_WrapperManager_accessViolationInner_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetControlEvent_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetLibraryVersion___i686.get_pc_thunk.cx_checkingControlEvent_lastControlEvent___error_strerror{standard input}int:t1=r1;-2147483648;2147483647;char:t2=r2;0;127;void:t3=3/SourceCache/Csu/Csu-58/bundle1.s/SourceCache/Csu/Csu-58///SourceCache/Csu/Csu-58/bundle1.s/SourceCache/Csu/Csu-58/bundle1.sdyld_stub_binding_helper:F3dyld__mh_bundle_headerdyld_lazy_symbol_binding_entry_point__dyld_func_lookup:F3dyld_func_lookup_pointer_wrapperProcessIdmule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/0000755000175000017500000000000011351411037024666 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/wrapper-macosx-ppc-320000755000175000017500000033660410567556635030630 0ustar charlescharles 8__PAGEZERO__TEXTpp__text__TEXT%hh__picsymbol_stub__TEXT,$__symbol_stub__TEXT,__picsymbolstub1__TEXT-  __cstring__TEXT8 G( __literal8__TEXT o__literal4__TEXTo__DATA p__data__DATAp__nl_symbol_ptr__DATApqY__la_symbol_ptr__DATAdqu__dyld__DATAr__bss__DATA(__common__DATA08__LINKEDIT@= /usr/lib/dyld 4E0RX/usr/lib/libSystem.B.dylib3p P^d^(%h|: x8!T!48!z8;cW{:|=`ak%}iN!|!B||x|#x|+xH <_ZD<_ZH<_ZL<_B[\/A }N!<_B[d/A }N!H<_ZT /A }N!HH<8ch88H݀a8/AH8<_B[`}/@HD//@|Jx}"Kx 9)|u@/A8 <_ZPH <_bZPx/Ax/@xxx8HđH |uA9+}b[x9@Kp|B}=|9}N |B}=|9D}N |B}=|9}N |B}=|9}N |B}=|9x}N |B}=|9X}N |B}=|9<}N |B}=|9}N |!B<8c 88H8}N!8!`|N |B}=|9}N |bx|uM |Cx//A 8BH 8b|bx|u@N | u@ x~x|8`8(H|`x8^8x^8|^88(8`-H)|`x^88`-8Hq!|N |B}=|9P}N |B}=|9}N |B}=|90}N |!|> x~x|888`-Hq|`x@8@ xBH<_BSD88/A^8T>+A<_8b`Ha<_8bHHu!|N |B}=|9T}N |B}=|9}N |B}=|9T}N |B!p<_<BR8 8a8?H̓R|888}8Hν<_BR<8 8a8H}8888H΍<_BR<8 8a8Hi}8888H]}<88 8HE}<88 @8H-8!|N |8|}x!8a8H A<<b!8`M8!`||Bp=|6p|P|N |B!?~PP/AXH/@Q9k9JH,/"@|Q9k9JH/"A }>Q9J9kA}BSx88!P||N N a|{y||#x!@HHX~/AH8;;@8!`cxa|H/@~x;K8!`a|N |BAۡ?!I|/@8`HH18I|?_;zF?C0H<C0<_a<8F <_ɡ8bG<_(F<_âF,hHlc@aD/@:F;(2rفHAL|H\@[88!lAˡ|N ||}x|#x!c/AH98/A0xH!8cH8!P}x|H8!P|N |~y|B|#x!A|<8TH9/@ ;dH`<x8HH/@ ;eH@<x8\H/@ ;fH <x8hH/@;g8!Px|N |B|~x!<8H/8`[A$<x8Hq/8`\A8`Z8!P|N ,|B!A 8H|Bp|cp)|6p|PcT><@Q})`B})|cU ]~U)>Tc~|cTc|cJ|N |B8!<_<B=48ЀbH |~yA|/Ap<_B=8"H]/A,H̅<|gx8x8`8Hm8`H0/A$<x88`8HE8`H8`8!P|N |B!<_:8p~x~CxH5M:t~Dx8bH|uyAHq|xy@K;xHxyH)xHA@A/@ =?Y): |:xy~x:|vvxHKX/ACxH|xy@PHt;xHMxyHxH߹@A/A~ɳxvxH =?Y): 96|~JyDx:|iHM/@(=?Y9iI |VB:A09|I/\@8\| .:98"|K.;A<8` HW:=?|q.8I) bB #cC;AL-8`W:H9|q.Q@ :H8"::`:;=:s8~ex~CxHM:t~Dx8bH||yAHU|{yAx8*H!/@x8?H |~yAx8(888Hⱀ8/A<_~ܳx::AHV:|b.H~|{x;@@0;xHAxzHߕxHݭ@A/@Z|;~AH:z:|.||HM8@@(~ܳxKh<x88`8~FxH8a8HK|\x|t//A /\@8cxHމ|}xxHx8xHxH|}x8dH/AdHޅ/AHu/@$<8`88~FxxHeH$HY<|gx88`8xHAA xHY6;@@0;xHݹxzH xH%@A/@ =?Z): |:;zx:|v6xHKX/@(=?Z9iI |VB:A0:|I/\@8\| .::8"|K.;A ?<<88T}Hi||xHy}<<88HIH=|~y@ <8`88H;HD/@<<_x;xH/@ <x88`8HÙ;x?_H<<~8X8`>HH~<88pHHE~<<88HH ~<88HaH<_;́7~x8H=/8`@~x8H!w}8`[/@8`Hq<<|88HHm|<88 ?_HH|<88(HqH|<<8@8XHH|<<8`8xH}H̓<88xHa<|ex8xHMHHa/AHH[8<8鴀|8H <}(8Ā|8}H},^,8B+@,8}<,8؀[8`8,Hm|8<`8H~0{K08+@DK,8`8B@|xK0<[88`80HHH+,H@<8@8 `B@|@x 0<[8,8`80HT<8ꄀb8Hِ}8\8/@,(@ 8<888`8HYt<8{8yH}}<^<8B+@,8y<<8\8`8H8`}x8{H<}|8x{8H8}8{H8}{?8H}t/A 8HI }.^AԀb H^b >i$H^b$7<_8i}>Kx? ^8,8a88H}888HU/A>I8BIK}/@(Tc:H}} }Tc:Hi}$^/@<_=?<_):;@;`>>_;Z8,Ex8a8H=u888HY||x Hy8cHx|{.9I |b.H98HEx8a8Hu88~ųxH]Y~ijx|}x$H8[/A x8H8\/A8Z;{YA8W|\x/@dT<8d8bH||x~(/A H(/A(xH8cHx~(HUHt<8t{8Hq|~x}0/AH980/A xH!8cHx}0H/@T{<88H ||x~,/A HՓ,/A xH8cH9x~,Ht<8{8H|~x}4/AHy84/A xHa8cHx}4H-/@T{<88HM||x~8/A H8/A xH8cHyx~8H̓<w8Ȁ|8H|~x}/w@$Hm<|fx8ތ8`8HYH88H/@hH9<|fx8ް8`8?H!}/A4HY/@ >6I/AH>H>H>;VB(/A ,;<_;!8?_;;`H;8zؓ8<@Da9Ha<$xw8:H/@@HN}/0@,/AX,KX;0@VB(/A40,H<|hx8xx8`8HH40,H<|ix8$xxx8`8HH|~x=I8B+A0 /A<|gx88`88HH /A$<8`8D88xH= /@0 /MA$/NA/OA/GA 8 v8+K?}/AHH!/@46I/A HL<|fx88`8H8w/AHH/@46I/A HL<|fx88`8HQ869@8IB4i IBHXV"|^x(/@0A$<8`8l8xHH^4^/A4<8ߜ8`8Hw8H)/@HK<|fx8߼8`8?Hy}/ADH/@0^/A HKq<|fx88`8H58w/AHHe/@46I/A HK!<|fx88`8H8V8" 48!|N |Ba!?~ /A?/@88<888H/}@HHJ/#Ah<_B" /APH5<|fx88`8H!H0?\/A(a@H<>|fx8 8`8H}88Hy/@\/A H<|fx848`8H}/AH/@0\/A HI<|fx88`8HY8H`~ /ADH/@0\/A HIE<|fx88`8H 8 [8" 48!a|N |B|@&|#x|+xA|wx>!8vxH/s@ <_;"x.@ ;HxH;<_B@@$?} /AHyxH} ?_@/@<_B$" /Ap8+Al<_T:8B}".})})N tLLL(4@\h<_8DH<_8PH<_8\H<_8dH<_8lH<_8tH<_8|H<_8⻌H<_8⻜H<_8⻤H<_8⻬H<_8⻰H<_8⻸Hx<_8Hl<_8H`<_8HT<_8HH<_8H<<_8H0<_8 H$?<;8,exxHYx@ <_;"ٌ<~x8ٔ(x88H;H?8$I/A8+Al<_T:8B}".})})N tLLL(4@\h<_8DH<_8PH<_8\H<_8dH<_8lH<_8tH<_8|H<_8⻌H<_8⻜H<_8⻤H<_8⻬H<_8⻰H<_8⻸Hx<_8Hl<_8H`<_8HT<_8HH<_8H<<_8H0<_8 H$?<;8,xexH}x@ <_;"ٌ<(x8~x88H?] b@] H} x8cHa xz@8;H/@$^/A$HDE<|gx8~x88H}z@/ALH=/@0^/A HC<|fx8(8`8H8;@H;8vH8!pxa|}p N |B!?̀^/A<8`8Ԝ8HA^/K@|/@(HF^|ex8L|8`8H%YHHF]8L|ex88`H%=̀^/3@8`84H!9^p/@8!P8`8488|HJ/M@l8`8e8K^/@$HEɀ^|ex8M8`8HHE8M|ex88`8!P|H$x8!P|N |B8 !<_BTbHo8s|}x8`xK8!Px|H|B8`83!H ?8`8G88H#у8]pH^,@d]/A<8`88H=H<8`88H%^B/A</A<8`848HH<8`8H8H?H4=}/AHH /@4>I/A H@<|fx88`8H8?} /AHH/@4>I/A H@q<|fx88`8H58 8<8`]8\84H ]b8!P|N |B8`83!H9?8`8G88H"48]pH\,@8<8`8Ѥ8H]/A</A<8`8h8HQH<8`8|8H9?H2}P/AHHi/@4>4I/A H?%<|fx888`8H8P?}T/AHH/@4>4I/A H><|fx88`8H8T48<8`]8ѐ84Hi]b8!P|N ,|B|#x|~x!@0?<\8 88"8 HuH\?\" /@,<B|+x8p88H5H<|+x8м88H\b8+A\<_T:8B}".})})N $Hd$ /A(<8`88H)H<x8$88HH8< 8<x88HaH8< 8h8`8HH8< 8є8`8HH8< 88`8HHp<8`88HqHX /AL<8`88HMH4<8`8,8H5H<x8l88Hxx?8G8HU~/AHH9/@4/@4?/@K9/AK/A|x8888H/@XH8/#A/&A/6A<_^/AXHm<|fx8H8`8HYH8/A<_^/A<8`8d8H!{/A@HY/@0^/A H8<|fx88`8H88`H8;?|tH,?_>Z8| 鮁bK/@LH{8888H/@8|t/A/AЀ^|;K8+Al<_T:8B(}".})})N tLLL(4@\h<_8«H<_8«H<_8«H<_8«H<_8«H<_8«H<_8«H<_8¬H<_8¬H<_8¬H<_8¬$H<_8¬(H<_8¬0Hx<_8¬@Hl<_8¬PH`<_8¬hHT<_8¬tHH<_8¬H<<_8¬H0<_8¬H$?<;x8xxHx<8΄8`8H8+A@<_T:8B}".})})N XP        Ѐ~H|}x< /A <8`8`8xH<I8B+A0 /A<x8Ƭ8`88H%H /A$<8`8Ƭ88xH< /@0 /MA$/NA/OA/GA 8 z8+KH<8`8t8H]/@</@0/MA$/NA/OA/GA /H@,/A<8`8ƭ88HH|/A <8`8ƭ88H]8]H@]/A<8`88H=]/L@|/@H6}]|8H HH6e8HHԀ~HK9Hă]/A<8`808H]/@(H6 ]|ex8N8`8HHhH58N|ex88`HHL~H|}x\/A <8`88xH9\/KA /M@/@<_0H$<@C0oAH<_LɡH (H5I<_"(|}x?$HxPTHHK9H~K=HZ;Z/A <8 8`8HyZb<x8,H]H4:I/A <8Μx8`8H)~x8H!@<bA<`M| |YP})p|6pB| PT>|P|/@8`H8`8!|N /4|B}H|AHA/3@$H,/8A!;??cxH8L|}xCxH9|~xW>H/A0<xx8PH8!`x|H8`dH3%/ ;@8!`<Fx8T8`|8H|B8`8!<8ļH<_B<<8b8H]<|~x8H/@<x8(H/@<_B" /A??;;\x8`8Hx8`8H<8X8`8H<8`8`8H<8Ũ8`8H<88`8H<888`8H<8|8`8Hy<88`8He<x88`8HM<88`8H9<808`8H%<8l8`8H<8Ǵ8`8H<88`8H<88`8Hx8`8H8!Px8`8|H8!P|N |B|xx!?_؀^@/AHKQ/A^/A<8`808H)^b@8H/@,x?;[8Pb@H|yy&@ 8`dH0/ ;A AH4W > W>@$[<8T8`@8HH8a88P%xHQ/AT8a88 H},A 88a88 Ha,A 88a88 HE|}yA8/ A<8a88 H/@(<88x888`H8`KmKP<8a88H}/@H/;AxHa|~x<888Ƙx8`8Hx8`K K<8a88H!/A<8a88H /@ <8`8888HAK<8a88H/@(<88888`H 8`H*Kl?8a88@H/A4<8a88TH/A<8a88hHi/@/@ <8`8x888HKxHf|~y@$<x8Ǡ8`888HiKHm%8@||x8a8H/@,xHl9<8x8`888H%H<8a88TH/@,xHi<8x8`888HH\<8a88hHy/@,xHl <84x8`888HH<8`8`888HHlIA/ZOB"|&T Hl!<|ex88a8H8p888`KaK?8a88ȌH/A|<8a88ȘH/Ad<8a88ȨH/AL<8a88ȸH/A4<8a88Hm/A<8a88HU/@\/A <x8H5;/A;8Ȍ8a8H/@:؀IH<8a88ȘH/@:؀IH<8a88ȨH/@:؀IHx<8a88ȸH/@:؀IHP<8a88Hy/@:؀IH(<8a88HQ/@:؀I/A$88<88`8|3xHqK88<88`8|3xHQK<8`8$888H5K#xHу؀^b@H/@,^@Ho<|gx8Hx8`8HZxDK}H8!|N N N /|B|~x!A8`xH./AD<_BB/A,bxK1/A8!P|H< 8!P|N |B?@cZ͐;!@8a8;\ bkI8+@ /7@ /A;^/@l/A,<8`8d8Hs8`88K A48`^8HexK^/AHI8BI^/A4b dxK^<|fx88`8Hr^@P8`8HexK%^/@/A<8`88HriH^bȁ>iԀ^b܀^/A K ^/A<8`8`8Hj ; ?;.I/A0A<_8|H <_8²t<8`8x8HiA 8`dH탻]/A<8`88HiHh]/A<8`88HiaH%; /A,]; /A<8`88Hi)]/A<8`88Hi]/G@B8B+@8Kэ/A,]; /A<8`88Hh]/A<8`8<8HhHgH ݀]||x/A,K]/AH!xKQ}ȃ]/A0xK/AH僽xK}HLA[xK~}܀[x"K~/A HTHHTCxxK~}^tx@dxCxK~Y<|fx8\8`8Hgi/A,xCxK~!|dxxK~I[~H[/AL/A/4AHA/3@$H,/8A!Hk<|}x8xHk||xW>Hj/8`A$<x8dxHaxHj8`8!P|N |B8|~x8!<8ƧH^}<c8Hl]/@4HG8!P<|gx8Ƨ|x88H^48!P|N +|B}H|A8A< /A<|fx88`8HYY8a88Hiu^/A<8`88HY)8!`|N |BA!?\\BBP/@|HPHa|\8+IP|.xKBP|b.;/@|CxH`̀\\8" P8@88a88<88A|hx|xx8ơX8`88HQ8!P|N |B|#x!K5H_<_B|" /A\<_BH_/A<8`8ƞ88H<8`8Ɵ$888!P|HQ8!P|N |B|#x!K<8ƞ8`88HP<_Bԁ" /A KlH <_b|dx8`K/@,8!P<8ƞ8`8|8HPh8!P|N |Ba|3x|#x||x!H]<_BDH^M/A8<_B$" /A<x8ƞd8`88H4?[$B|/A0<x8ƞ8`888!`a|HO/fAH/gA/e@<x8`8ƞ88HOi8!`8`a|K_\/@4/@(B/MA/NA/OA /G@<x8ƞ8`88HN۪$8?^88}xH]E/@h^/AX<8`8ƙ88HN}x8H\;/@,H8 <|gx8ƙ8`88HNmH;;$I/A KjaH <_bh|exx8`8OK H,<x8Ɵ8`88HN 8`8KZ{$+I8B+@8!`8`88a|K?~x/@t/A$<8`8Ɵ 88xHM~xxH[y/ATH78!`<|hxx|8ƟH8`88aHML<x8Ɵx8`88K8!`a|N |B|}x|#x|#x!K<_B8!P<"x|x8Kp|B|}x|#x|#x!KA8!P<xx|808fK |B|}x|#x|#x!K8!P<xx|88fK|B|#x!KHY<_BHZ/A,8!P<8ƛ8`8|8HK<8`8ƕT88HK<cD8HY/@4H5 8!P<|gx8ƕh|8`88HK\8!P|N |B|~x88!?}lHY/@p?<I/A\<x8Ɣ|88HJ}l8;HX/@0H4I<|gx8Ɣx88HJH ?;<I/AKf|exH <_\8!Pxx8O|K0|Ba8`!pH&E8`8`8888HY /A<8`88HH<_¤$^/A<8`808HH]x; ;>;<>?_>>>H x;<@8`B;8A< /A<8`888HD8a88HU^/A,<8`88HDHHS)/@(H/<|fx88`8HD8`K88`HTQ<8c88HT}/|~xAP8`HN8xHS8`HN8xHS8`HNx8HS+@ xHNe8`H) =I/A<8`88HCHR1/@,H.<|fx8l88`HC8`K%HA 8`HJՁ=8`I/@8`H(E8!`|N |B!`>/A|8a8=KM8<;@~x:aD~x: }{x|P|TP|/A:@8H :@8p~dxHS5|yyAHLɀ/#A,H-|}xHL<8x8`8HB/@Ѐo8A\8c?HL1|~x/A(HKOx|^"HJ8O؞8BOxH ?X~"ѮxKzA8`HP8A8;`|B?" ::~~x/ @}8AT8cHK||x/A$HJ]x|\HIْ؞]8B]xHX~ѮxKy/A;@Ht}8AT8cHK||x/A$HJm]x|\HIY؞]8B]xHX|;Z;{;@8a8KJ8A8`H<_8`8B888HH/A$<ex8xH?xHHH \<848`08H:z 4/AenHHa<|}x8uxHH|~xW>HHA/A0<xx8H?8!`xA|HH,[<8\8`48KH8!`A|N |BA|#x|}x!KI/@8`H~K/@pxxKU/A\?<8]bHB/A ]<8bHBm/@~KT8`K8`H]<8 bHB9/A ]<8bHB/@KJ8`K8`HK/A,]/A /@~KSHKW5/@x]bZHF]<b8U0HA/A ]<8bHA/@]/AK Hp`@Hp`AH/)\ZL/A|HIZ|{xbzHF<|}x8r,xHFq|~xW>HE/A$<ex8xH<xHEH ZLH#%<|gx8(H\Z(/AHHZ|{xbbHEy<|}x8r,xHE|~xW>HEY/A$<ex8xH<-xHEUHHD/A$<x8xH;xHDH4[,H!<|gx8|x8`8H6ـ[,KK18`H,]<8cH9̀~KQ8`K8`8!`A|N ||#x!/A(~xHBA/AA/@;8!Px|N |a|{x|#x!/AT~xHA/@0^/@ HH</@[/@ H88!`a|N |8`!H?88!P|N ||}x;!cH=A}H=58!Px|H=|;E|{x|#x:8!:8Htcx8%H=|~yA;8%xH=|yyAPx;~óxx:H=~óx~H=U||yAxP@@]x/Axdxx]PH=axH?U@|}x@]x/Axxx]PH=);yHP\x@Ax/Axdxx\PH<{Hdcx]xH>@||xA$Hcx]xH>@||xAx/Axdxx]PH<{/@8!p|N |a|{x|#x!c/AH;18/@ H|x888@;K8a8H=;88cH+@[}";;8a8H=À[8|8!@`a|N |8`!H;88!P|N |Ba|#x|{x!H=9|}xxH=-8}H;<|}x8exxH5xHB/A$8!`<x8ca|H48!`a|N ||~x|#x!H<9 |i9cH9)|H|J|t/ A8/ A0X@|IXP8B|~Z|IA /@8| HBK9k|t/ A / @ 8cB| XP7AxxH: 88!P|鮀|N |B!/A,?8`88`H0/@8!P|N ||yx|#x!c8`/A;xH;Ux;H;AH ;;xDxH9,@H ;;xDxH8,@{;/@8}H9e9|xx||x/A:=H(Pxx8H8;];xDxH8u|{y@xxH9axH:y~||;H(Pxx8H8M;];xDxH8|{y@xxH9xH:C|c9;/@888!px|N ||#x|+x!/A0~xH:q/AA/@H8!Px|N |a|#x|+x|3x!/A(}xH:/AA/@xH}H>dx||xH6|}xxH68!` |`a|N ||#x|+x!/AL~xH9y/A8A/@H$8!P~88|H>\8!Px|N ||#x!/A(~xH8/AA/@8`H~ 8!P|N |a||x8!/A<;`~H4ŀ~~H4~xH4/A xK8!`xa|H4|||x|#x!/A~xH8/AAl/@Hp\HI/@ <H ~;H4 ~H38!Px|H3>^/@K8!P|N |B|#x|yx|#x!|+x|3x|;xH68cH4|{xxH6q9 |i9cH9)|H|J|t/ A8/ A0X@|IXP8B|~Z|IA /@8| HBK9k|t/ A / @ 8cB| XP7AcxxH38x|H58cH49|zxxH59 |i9cH9)|H|J|t/ A8/ A0X@|IXP8B|}Z|IA /@8| HBK9k|t/ A / @ 8cB| XP7ACxxH3 8|/A(}dxH5/AA|/@8`H3M8|}xcxH48cH3%dx}H3y/AT~xH5=/@0^/@ HH8/@Y/]@ H8xDxK cxH3+ @@<cx8HH4@0; xH1/@@xKaH0+@(<cx8XH3@8{K1cxH08!pCx|H0h/ALK|Ba|#x|}x|#x!|+x|3xH3)8c+B@$<x8~8`8H'8`HLx8a8H18a88=H0|ey8`A(8xx8gx88K8`8!Bpa|N |BA|{x|#x<`{|+x<|!n8}H5I||y8`A 8a88BxH4/A8a88 H0,A 88a88 H/,A 8;8H;|t/ A/A/#AxH1,A8@9`|}"|t/"@ik8BHh/#@\/@T /#@@9bX@A$|]Z}i[x9)H@8B@}b[x8c9`H}b|Cx8B@AxxH15,A4|i8@|cH CB@|t/ A/A|t/A<x8}H0@L8}/ @/ A/ AX;B98BxKcxx8KK4/#A,x8=H.Y,A88xcx88KKxH28`!A|N 8K/|B|#x!AL/A(}xH0/AA/@?8~nH5e8n|}xHL/A(}xH0a/AA`/@<_8bnH5<|}x8nH, xH,]8!Px|N }?Kt}K||+x|wx|#x|#x!H/ /|{xAxH.@|zxA/Al~x~xHDx$xexH5)/@ xxExH,H;;|t/@8HT~x~x|t/@ Kܛ;;KKx$xexH4/AK8!p~x|N |B}H|8+ @ /-@ |[;;xH'A8cx|H'<_/bx@ |֐x8!`cxA|H$`8!`A|N |B}H|~/AX@~HDHE/A,H5cH x|ex8uiHU8`H!~HM;{;@xH18cHW:|z.8!px|H;9@xH/AXHcHx|ex<8ciH8!p8`|H /@z[x/@K8!p|N ||@&.aA|}xT:!p|#x|+xH||x@i8|bx8BBxH-8cHx|Hx8(888H8/A4;AHW:xx|.fxK8;@A8a8H@,;x~;/AH;@xH8!aa|}p N |B|{x|+x|3x!>Hcx81HY/A/@D~xzx?H0x8fH8 Hi/@ ; H;;Z|t/@|xyx?H0x8fT8 H/@ ; H;;9|t/@}xzx?H0x8f`8 H/@ ; H;;Z|t/@}x|xH0x818H}/@ ;H;;|t/@țHtxH+|}xA`H`Cx818H!/@ xxx;ZHH<;Z;|t/@8>cx8flH/A/@@~xzx?H0x8ft8H/@ ;H;;Z|t/@|xyx?H0x8f8HI/@ ;H;;9|t/@}x|x?_H0x8f8H/@ ;H;;|t/@}xH0x8fl8H/@ ;H;;{|t/@țHd~óxH+|~x@HLcx8fl8HU/@ x~ijxx;{HH;{;|t/@8H/AcxH8!p<|{~ųx|8fH/Azx|xK~x|x|t/@ Kț;;K;Kx818H}/AK/}x@D|t/@ K@;{;K;{Kcx8fl8H)/AK8!p|N |B! ?~dP/A$>HUd8dP" H>;??>>;aD;8?x8a8H كeWd8}88K}dxHM/@<_dt/@A}H/APH/A@H/A0HucHMx|ex<8caXH 8`H/@<_=?bd<_e;d;^;{H98?x8a8H |888Kɀ|HI/ALH݀/ ÃHŀcHx|fx<x8cb$H 8`HH;@hd8Wd8}KEe}H/AHU/AHE/AH5/ @D<8caH M8`HHX<8caH -8`HmH8H݀cHx|fx<8cb$xH 8`H58!|N |BA|{x!@<_apA?a/@<_ba/A8H,@HEcH|dx<8c_H e8`HHD<_88Bb4bH/ALH/ADH/A4HcH|dx<8c_H 8`HAHalH8`aAK=HpA<b@H/A?}a/AH-<_Bb(a"?_a/@l??b(exb48|?K{b<<{8_8Kـa|8K<[8!A|N |BA|#x8|rx!`|+x8a<|3x|;xH!@<b`MӀA<| 8a8})pA8|6p PH/|{x@HHy<_8|dxB`t;| A ;8BB<;8c[hHQ<_B`Ad=?x)`\x~fxgxx~x~CxK<_B`<|ex8<;XxHQ<_B_/A xH)<_B`A??9``I/A?_`pA0:D< 8^08l8~xH-H D:D~x?K_/@ `pA(>9``V`T~x8bKH$>9``V`T88bK<c`Tc>He`T<_|zx:^@v~xH/|_@4<_68bBc~xI iH|_WC>H_/@@V9``H EcHx|ex<8c^DHa8`HH<~xc`lH -=?)`xx~fxgxxx~x~CxK<|ex|_8 x|_xlptx|>^~h<_8bVdH|lx<_8BZ~h^>|xtpl!|}N |B|H|=9Yt/@!|> x|_xlptx|>^~h<_8bUHQ|lx<_8BYt~h^>|xtpl!|}N |B|H|=9X́/@!|> x|_xlptx|>^~h<_8bUH|lx<_8BX̑~h^>|xtpl!|}N |B|H|=9X$/@!|> x|_xlptx|>^~h<_8bTxH|lx<_8BX$~h^>|xtpl!|}N |B|H|=9W|/@!|> x|_xlptx|>^~h<_8bSHM|lx<_8BW|~h^>|xtpl!|}N ||dxB8_!p8a98He8a8|}xHy<_}]|~x9"S,BS, i|].<_x j;S8xH ,@|}xxH H !8!|N |B}h=k|T}N |B}h=k|Td}N |B}h=k|TH}N |B}h=k|T,}N |B}h=k|T}N |B}h=k|S}N |B}h=k|S}N |B}h=k|S}N |B}h=k|S}N |B}h=k|S}N |B}h=k|Sh}N |B}h=k|SL}N |B}h=k|S0}N |B}h=k|S}N |B}h=k|R}N |B}h=k|R}N |B}h=k|R}N |B}h=k|R}N |B}h=k|R}N |B}h=k|Rl}N |B}h=k|RP}N |B}h=k|R4}N |B}h=k|R}N |B}h=k|Q}N |B}h=k|Q}N |B}h=k|Q}N |B}h=k|Q}N |B}h=k|Q}N |B}h=k|Qp}N |B}h=k|QT}N |B}h=k|Q8}N |B}h=k|Q}N |B}h=k|Q}N |B}h=k|P}N |B}h=k|P}N |B}h=k|P}N |B}h=k|P}N |B}h=k|Pt}N |B}h=k|PX}N |B}h=k|P<}N |B}h=k|P }N |B}h=k|P}N |B}h=k|O}N |B}h=k|O}N |B}h=k|O}N |B}h=k|O}N |B}h=k|Ox}N |B}h=k|O\}N |B}h=k|O@}N |B}h=k|O$}N |B}h=k|O}N |B}h=k|N}N |B}h=k|N}N |B}h=k|N}N |B}h=k|N}N |B}h=k|N|}N |B}h=k|N`}N |B}h=k|ND}N |B}h=k|N(}N |B}h=k|N }N |B}h=k|M}N |B}h=k|M}N |B}h=k|M}N |B}h=k|M}N |B}h=k|M}N |B}h=k|Md}N |B}h=k|MH}N |B}h=k|M,}N |B}h=k|M}N |B}h=k|L}N |B}h=k|L}N |B}h=k|L}N |B}h=k|L}N |B}h=k|L}N |B}h=k|Lh}N |B}h=k|LL}N |B}h=k|L0}N |B}h=k|L}N |B}h=k|K}N |B}h=k|K}N |B}h=k|K}N |B}h=k|K}N |B}h=k|K}N |B}h=k|Kl}N |B}h=k|KP}N |B}h=k|K4}N |B}h=k|K}N |B}h=k|J}N |B}h=k|J}N __dyld_mod_term_funcs__dyld_make_delayed_module_initializer_calls__dyld_image_count__dyld_get_image_name__dyld_get_image_header__dyld_NSLookupSymbolInImage__dyld_NSAddressOfSymbollibobjc__objcInitThe kernel support for the dynamic linker is not present to run this program. 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_set.WRAPPER_BITS=%sset.WRAPPER_ARCH=%sset.WRAPPER_OS=%sset.WRAPPER_FILE_SEPARATOR=/set.WRAPPER_PATH_SEPARATOR=:server socket close failed. (%d)socket close failed. (%d)LOG(ERROR)LOG(FATAL)STARTSTOPRESTARTPINGSTOP_PENDINGSTART_PENDINGSTARTEDSTOPPEDKEYBADKEYLOW_LOG_LEVELPING_TIMEOUTSERVICE_CONTROL_CODEPROPERTIESLOG(DEBUG)LOG(INFO)LOG(STATUS)LOG(WARN)UNKNOWN(%d)wrapperStopProcess(%d) called while stopping. (IGNORED)wrapperStopProcess(%d) called.Got a log message from JVM: %s%sJVM signalled that it was stopped.wrapper.logLPTMLPMWrapper (Version %s) http://wrapper.tanukisoftware.org wrapperRestartProcess() called. (IGNORED)wrapperRestartProcess() called.IGNORESHUTDOWNFORWARD%s must be in the range 0 to %d days (%d seconds). Changing to %d.Unable to set working directory to: %s (%s)Working directory set to: %sGot ping response from JVMJVM signalled a start pending with waitHint of %d millis.JVM signalled a stop pending with waitHint of %d millis.Usage: %s [configuration properties] [...] %s [configuration properties] [...] ( implicitly '-c') %s ( implicitly '%s.conf') %s ( implicitly '-c' and '%s.conf') where can be one of: -c --console run as a Console application -v --version print the wrapper's version information. -? --help print this help message is the wrapper.conf to use. Name must be absolute or relative to the location of %s [configuration properties] are configuration name-value pairs which override values in wrapper.conf. For example: wrapper.debug=true%s.confcwrapper.working.dirwrapper.daemonizewrapper.signal.mode.hupJVM requested a restart.wrapper.java.commandjava"%s"jdbjdb.exewrapper.java.additional.%d"-The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.wrapper.java.additional.%d.stripquotes-Xdebugwrapper.java.initmemory-Xms%dmwrapper.java.maxmemory-Xmx%dmLD_LIBRARY_PATHwrapper.java.library.path-Djava.library.path="%s%c%s\"-Djava.library.path="%s%c%s"-Djava.library.path=%s%c%s-Djava.library.path="%s\"-Djava.library.path="%s"-Djava.library.path=%s-Djava.library.path=wrapper.java.library.path.%d./-classpathwrapper.java.classpath.%dClasspath element, %s, does not match any files: %sClasspath element, %s, does not exist: %sUnable to get information of classpath element: %s (%s)-Dwrapper.key="%s"-Dwrapper.key=%s-Dwrapper.port=%d-Dwrapper.jvm.port=%d-Dwrapper.jvm.port.min=%d-Dwrapper.jvm.port.max=%d-Dwrapper.debug="TRUE"-Dwrapper.debug=TRUE-Dwrapper.pid=%d-Dwrapper.use_system_time="TRUE"-Dwrapper.use_system_time=TRUE-Dwrapper.timer_fast_threshold="%d"-Dwrapper.timer_fast_threshold=%d-Dwrapper.timer_slow_threshold="%d"-Dwrapper.timer_slow_threshold=%d-Dwrapper.version="%s"-Dwrapper.version=%s-Dwrapper.native_library="%s"-Dwrapper.native_library=%s-Dwrapper.ignore_signals="TRUE"-Dwrapper.ignore_signals=TRUE-Dwrapper.service="TRUE"-Dwrapper.service=TRUE-Dwrapper.disable_shutdown_hook="TRUE"-Dwrapper.disable_shutdown_hook=TRUE-Dwrapper.cpu.timeout="%d"-Dwrapper.cpu.timeout=%d-Dwrapper.jvmid=%dwrapper.java.mainclassMainwrapper.app.parameter.%dwrapper.app.parameter.%d.stripquotes------------------------------------------------------------------------The JVM is being launched with a debugger enabled and could possibly besuspended. To avoid unwanted shutdowns, timeouts will be disabled,removing the ability to detect and restart frozen JVMs.Filter trigger matched. Restarting JVM.Filter trigger matched. Shutting down.JVM requested a shutdown. (%d)wrapper.logfilewrapper.logfile.rollmodeSIZEwrapper.logfile.rollmode invalid. Disabling log file rolling.YYYYMMDDwrapper.logfile must contain "%s" for a roll mode of DATE. Disabling log file rolling.wrapper.logfile.formatwrapper.logfile.loglevelINFOwrapper.logfile.maxsize0wrapper.logfile.maxfileswrapper.logfile.inactivity.timeoutwrapper.console.formatPMwrapper.console.loglevelwrapper.console.flushwrapper.syslog.loglevelNONEwrapper.syslog.facilityUSERwrapper.ntservice.namewrapperwrapper.unix.namewrapper.portwrapper.port.minwrapper.port.min must be in the range 1-65535. Changing to %d.wrapper.port.maxwrapper.port.max must be greater than or equal to wrapper.port.min. Changing to %d.wrapper.jvm.portwrapper.jvm.port must not equal wrapper.port. Changing to the default.wrapper.jvm.port.minwrapper.jvm.port.min must be in the range 1-65535. Changing to %d.wrapper.jvm.port.maxwrapper.jvm.port.max must be greater than or equal to wrapper.jvm.port.min. Changing to %d.wrapper.debugwrapper.java.command.loglevelDEBUGwrapper.adviserwrapper.use_system_timewrapper.timer_fast_thresholdwrapper.timer_slow_thresholdwrapper.native_librarywrapper.java.library.path.append_system_pathwrapper.state_outputwrapper.timer_outputwrapper.loop_outputwrapper.sleep_outputwrapper.memory_outputwrapper.memory_output.intervalwrapper.cpu_outputwrapper.cpu_output.intervalwrapper.disable_shutdown_hookwrapper.startup.delaywrapper.startup.delay.consolewrapper.startup.delay.servicewrapper.restart.delaywrapper.restart.reload_configurationwrapper.disable_restartswrapper.cpu.timeoutwrapper.startup.timeoutwrapper.ping.timeoutwrapper.ping.intervalwrapper.shutdown.timeoutwrapper.jvm_exit.timeoutwrapper.ping.interval must be at least 1 second. Changing to 1.wrapper.ping.interval must be at less than or equal to 1 hour (3600 seconds). Changing to 3600.wrapper.ping.timeout must be at least 5 seconds longer than wrapper.ping.interval. Changing to %d.CPU timeout detection may not operate correctly during startup because wrapper.cpu.timeout is not smaller than wrapper.startup.timeout.CPU timeout detection may not operate correctly because wrapper.cpu.timeout is not smaller than wrapper.ping.timeout.CPU timeout detection may not operate correctly during shutdown because wrapper.cpu.timeout is not smaller than wrapper.shutdown.timeout.wrapper.max_failed_invocationswrapper.successful_invocation_timeThe value of wrapper.max_failed_invocations must not be smaller than 1. Changing to 1.wrapper.request_thread_dump_on_failed_jvm_exitwrapper.filter.trigger.%dwrapper.filter.action.%dwrapper.pidfilewrapper.java.pidfilewrapper.lockfilewrapper.java.idfilewrapper.statusfilewrapper.java.statusfilewrapper.commandfilewrapper.command.poll_intervalwrapper.anchorfilewrapper.anchor.poll_intervalwrapper.umaskwrapper.java.umaskwrapper.pidfile.umaskwrapper.lockfile.umaskwrapper.java.pidfile.umaskwrapper.java.idfile.umaskwrapper.statusfile.umaskwrapper.java.statusfile.umaskwrapper.anchorfile.umaskwrapper.logfile.umaskwrapper.ignore_signalsUnable to resolve the full path of the configuration file, %s: %sThe argument '%s' is not a valid property name-value pair.Unable to open configuration file. %sProblem loading wrapper configuration file: %sserver socket creation failed. (%s)server socket ioctlsocket failed. (%s)127.0.0.1unable to bind listener to any port in the range %d-%d. (%s)unable to bind listener port %d, or any port in the range %d-%d. (%s)port %d already in use, using port %d instead.server listening on port %d.server socket listen failed. (%d)socket creation failed. (%s)accepted a socket from %s on port %dsocket ioctlsocket failed. (%s)(Property Values)NULLsocket not open, so packet not sent %s : %ssend a packet %s : %ssocket send failed. (%d)JVM signalled that it was started.--> Wrapper Started as Daemon--> Wrapper Started as ConsoleUsing system timer.Using tick timer.<-- Wrapper Stopped--> Wrapper Started as ServiceJVM process exited with a code of %d, leaving the wrapper exit code set to %d.JVM process exited with a code of %d, setting the wrapper exit code to %d.JVM process exited with a code of %d, however the wrapper exit code was already %d.JVM already down.Unable to start a JVMJVM exited while loading the application.JVM exited before starting the application.JVM exited while starting the application.JVM exited unexpectedly.JVM exited unexpectedly while stopping the application.JVM exited normally.JVM exited on its own while waiting to kill the application.Unexpected jState=%d in wrapperJVMProcessExited.Got key from JVM: %s%dReceived a connection request with an incorrect key. Waiting for another connection.Incorrect key. Connection rejected.socket read failed. (%s)socket read no code (closed?).read a packet %s : %sreceived unknown packet (%d:%s)windowsx86323.2.3UNKNOWNSTARTINGSTOPPINGKILLINGDOWNLAUNCH(DELAY)LAUNCHINGLAUNCHEDw%s Unable to write to the status file: %sStartup failed: Timed out waiting for a signal from the JVM.org.tanukisoftware.wrapper.WrapperSimpleApporg.tanukisoftware.wrapper.WrapperStartStopAppAdvice:The Wrapper consists of a native component as well as a set of classeswhich run within the JVM that it launches. The Java component of theWrapper must be initialized promptly after the JVM is launched or theWrapper will timeout, as just happened. Most likely the main classspecified in the Wrapper configuration file is not correctly initializingthe Wrapper classes: %sWhile it is possible to do so manually, the Wrapper ships with helperclasses to make this initialization processes automatic.Please review the integration section of the Wrapper's documentationfor the various methods which can be employed to launch an applicationwithin the Wrapper: http://wrapper.tanukisoftware.org/doc/english/integrate.html Loop: check command filer+tUnable to read the command file: %sCommand '%s'. Restarting JVM.Command '%s'. Shutting down with exit code %d.PAUSECommand '%s' not supported on this platform, ignoring.RESUMEDUMPCommand '%s'. Requesting a Thread Dump.CONSOLE_LOGLEVELLOGFILE_LOGLEVELSYSLOG_LOGLEVELCommand '%s' is missing its log level.Command '%s' specified an unknown log level: '%'Command '%s'. Set console log level to '%s'.Command '%s'. Set log file log level to '%s'.Command '%s'. Set syslog log level to '%s'.Command '%s' lead to an unexpected state.LOOP_OUTPUTSTATE_OUTPUTMEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTTRUECommand '%s'. Enable %s.Command '%s'. Disable %s.Command '%s' is unknown, ignoring.Unable to delete the command file, %s: %s Last system time tick overflow at: %s Next system time tick overflow at: %s Last tick overflow at: %s Next tick overflow at: %s Set Java State %s Timeout %08lx -> %08lx Set Wrapper State %s -> %s Loop: check anchor fileAnchor file deleted. Shutting down. Set Java State %s -> %sStart Application.startUnable to send the start command to the JVM.Reloading Wrapper configuration...com.silveregg.wrapper.WrapperSimpleAppThe com.silveregg.wrapper.WrapperSimpleApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperSimpleApp class instead.com.silveregg.wrapper.WrapperStartStopAppThe com.silveregg.wrapper.WrapperStartStopApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperStartStopApp class instead.Launching a JVM...JVM Restarts disabled. Shutting down.Waiting %d seconds before launching another JVM.JVM was only running for %d seconds leading to a failed restart count of %d.There were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.Waiting %d seconds before launching the first JVM.wrapper.on_exit.%dwrapper.on_exit.defaultshutdownrestarton_exit trigger matched. Restarting the JVM. (Exit code: %d)on_exit trigger matched. Service is paused, will restart the JVM when resumed. (Exit code: %d)The JVM was launched with debug options so this may be because the JVMis currently suspended by a debugger. Any future timeouts during thisJVM invocation will be silently ignored. DebugJVM timeout. Disable current %s timeout.Shutdown: Timed out waiting for the JVM to terminate.JVM exitShutdown failed: Timed out waiting for the JVM to terminate.Shutdown: Timed out waiting for a signal from the JVM.Shutdown failed: Timed out waiting for signal from JVM.Ping: Timed out waiting for signal from JVM.pingJVM appears hung: Timed out waiting for signal from JVM. Temp: Sending a ping packet.JVM Ping Failed. Temp: Sent a ping packet.Startup: Timed out waiting for a signal from the JVM.startupStartup failed: Timed out waiting for signal from JVM.Event loop started.no Loop: %ssleep Loop: maintain logger Loop: process jvm outputPause reading child output to share cycles. Loop: process socketPause reading socket data to share cycles. Loop: maintain logger(2)Wrapper Process has not received any CPU time for %d seconds. Extending timeouts.truefalse Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%s Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (N/A), Exit=%s, Restart=%s Loop: exit requestedSending stop signal to JVM Loop: handle wrapper state: %sUnknown wState=%d Loop: handle jvm state: %sUnknown jState=%dEvent loop stopped.%d Dumping JVM state.Could not dump JVM state: %sSIGHUPSIGALRMSIGINTSIGKILLSIGQUITSIGCHLDSIGTERMAIO completedunknownkill, sigsend or raisesigqueuetimer expiredmesq state changedUnable to register signal handler for signal %d. %sLaunching Timer thread.Unable to create a timer thread: %d, %s Sleep: nanosleep %dms Sleep: awakeCommand[%d] : %sCall to getrusage failed for Wrapper process: %sCall to getrusage failed for Java process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldUnable to get the path for '%s'-%sUnable to extract path from: %sUnable to set working dir to %s : %sUnable to request JVM process status: %sJVM exited in response to signal %s (%d).WIFEXITED indicates that the JVM exited abnormally.Signal trapped. No details available.Signal trapped. Details: signal number=%d (%s), source="%s" signal err=%d, "%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s)Timer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.Received SIGCHLD, checking JVM process status.JVM process was still running after receiving a SIGCHLD signal.%s trapped, but signals for timer thread are ignored.%s trapped, but ignored.%s trapped. Restarting JVM.%s trapped. Forcing immediate shutdown.%s trapped. Shutting down.%s trapped. Forwarding to JVM process.Unable to forward %s signal to JVM process. %s%s trapped. Unable to forward signal to JVM because it is not running.HUPTERMINTTimer thread received an Quit signal. Ignoring.Could not mask signals for timer thread.Timer thread started.The timer fell behind the system clock by %ldms.The system clock fell behind the timer by %ldms. Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ldJVM did not exit on request. Attempt to terminate process failed: %sJVM did not exit on request, terminatedSpawning intermediate process...Could not spawn daemon process: %ssetsid() failed: %s/dev/nullSpawning daemon process...Failed to read console output from the JVM: %s (%d)Could not init pipe: %sCould not spawn JVM process: %sUnable to set JVM's stdout: %sUnable to set JVM's stderr: %sUnable to start JVM: %s (%d)Failed to set jvm output handle to non blocking mode: %s (%d)Failed to set jvm output handle to close on JVM exit: %s (%d)Unable to write the Java PID file: %sUnable to write the Java ID file: %s?-helpv-version-consoleERROR: Could not write anchor file %s: %sERROR: Could not write pid file %s: %sWARNING: Could not write lock file %s: %s Unrecognized option: -%s %s=%sUnable to set environment variable: %s name:%s value:%sset.default.set.The following property name value pair is too large. Need to increase the internal buffer size: %srt#includeNONE DEBUG INFO STATUSWARN ERROR FATAL ADVICEWARNING - Encountered an unknown thread %ld in getThreadId(). WRAPPERJVMSIZE_OR_WRAPPERSIZE_OR_JVMDATEFATALERRORWARNLOCAL0LOCAL1LOCAL2LOCAL3LOCAL4LOCAL5LOCAL6LOCAL7wrapper wrapperpjvm %-4dsignal main srvmaintimer %c%04d/%02d/%02d %02d:%02d:%02d%04d/%02d/%02d %02d:%02d:%02d.%03dUnable to delete old log file: %s (%s) -YYYYMMDD_YYYYMMDD.YYYYMMDDROLLNUM-ROLLNUM_ROLLNUM.ROLLNUM.%sUnable to rename log file %s to %s. File is in use by another application. Unable to rename log file %s to %s. (%s) Unable to get the current logfile size with ftell: %s Unable to get the current logfile size with stat: %s ????????%04d%02d%02daUnable to open logfile %s: %s printfsprintffprintfsyslogvsnprintf$LDBL128libSystem.C0C0@@08 -29P]L]T]X]\:2|(|0|8|@|H|P|X|`txTX`tp\`0++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++d%hĀd%d%d%<.%D%D%D%D%D%D%D%D&D&D& D&$D&8D&@D&DD&HD&XD&dD&hD&xD&D&D&D&D&D &D&D'D'D'<D'<D'\D'\D'|D'|D'D'D'D'D'D'D'D'D(M$%[@g@s@@ ڀ@8 % (,$tN(-(.(D+(D.(4D0(DD1(PD.(dD.(C$+(_,8g(h(i$hN(j(.(D?(DC(DD(DC(DH(x$?(@>@@@A(($<N((.(DM(DQ(DR(DP(DM(DQ(DR)$M(@L@L@N"(#)$$\N)%).)DY)Dc)4De)DDg)TDi)dDk)tDp)Dq)Dr)Ds)Dt)Dw)Dx)Dz)D{)D|)D*D*D*4D*@D*HDx*XD*dD|*xD|*D{*D{*Dc*Dc*5$Y)K@ZU@Z\8]<ˀ^@_D `H())5FWhỳހ*$N*&yG -U .c /r 0d* 9  +03*E%V++@,( . ;C  5(L  )U $N*P^ (*g ,+5,T u- LC @  0 4% 8$lhK <t L% T9lx3# Hav   ('X^ @x D H L P T  X1 \=MM9p kX  ` t  1 h;;4 A$ T @ H p}   ( 0L(|9HXXg40|Pwd xa d+ 2F =QZ arQ` % 'Pg }  r$ ' p8x{  F t}$x0#/  0 ` x `Iʴ  T73\MH6KQ        (T : Kx __ v <  8  x xy \ @  $\\kը{P84ڔaL  p@f:y<8 x$$ .< X \\F9 D t  x(6ΨΤ D89 U/l6  Π 8Cd< 8 5d h& :޼vP]'4L #T<AS=i01Qd .iȨ7\E$  C,<5C XHO>0mX?$3T``48D< p@4 `74 ho%hI\{2?; TZF`fm RY*72G N? g&.8C o }   K _   dou R f |       , 3 9 E M U ] e n v |N[`K &(68=Y[0]w9PQklz#blsy4  ! 4 7 N W c e h w } < P ] 1%&  ($+-",'/#0 *!2  ). FCEPM2Q/N~?=@1%&  ($+-",'/#0 *!2  ). _NXArgc_NXArgv___progname__dyld_func_lookup__dyld_init_check__start_environdyld_stub_binding_helperstart___darwin_gcc3_preregister_frame_info___keymgr_dwarf2_register_sections__cthread_init_routine__mh_execute_header_atexit_catch_exception_raise_catch_exception_raise_state_catch_exception_raise_state_identity_clock_alarm_reply_do_mach_notify_dead_name_do_mach_notify_no_senders_do_mach_notify_port_deleted_do_mach_notify_send_once_do_seqnos_mach_notify_dead_name_do_seqnos_mach_notify_no_senders_do_seqnos_mach_notify_port_deleted_do_seqnos_mach_notify_send_once_errno_exit_mach_init_routine_main_receive_samples___keymgr_global__dyld_register_func_for_add_image__dyld_register_func_for_remove_image__init_keymgr__keymgr_get_and_lock_processwide_ptr__keymgr_set_and_unlock_processwide_ptr_abort_calloc_free_correctWindowsPath_getOutputFilterActionForName_getSignalMode_keyChars_loadConfiguration_lockProtocolMutex_protocolMutex_protocolOpen_protocolSendBuffer_protocolSendBufferSize_protocolStartServer_protocolStopServer_releaseProtocolMutex_sd_sendProperties_ssd_updateStringValue_validateTimeout_wrapperAddDefaultProperties_wrapperAddToTicks_wrapperBuildJavaCommandArray_wrapperBuildJavaCommandArrayInner_wrapperBuildKey_wrapperBuildUnixDaemonInfo_wrapperDispose_wrapperFreeJavaCommandArray_wrapperGetCurrentTime_wrapperGetFileBase_wrapperGetSystemTicks_wrapperGetTickAge_wrapperInitialize_wrapperJVMProcessExited_wrapperKeyRegistered_wrapperLoadConfigurationProperties_wrapperLogChildOutput_wrapperLogSignalled_wrapperParseArguments_wrapperPingResponded_wrapperProtocolClose_wrapperProtocolFunction_wrapperProtocolGetCodeName_wrapperProtocolRead_wrapperRestartProcess_wrapperRestartRequested_wrapperRunConsole_wrapperRunService_wrapperSetWorkingDir_wrapperSetWorkingDirProp_wrapperStartPendingSignalled_wrapperStartedSignalled_wrapperStopPendingSignalled_wrapperStopProcess_wrapperStopRequested_wrapperStoppedSignalled_wrapperStripQuotes_wrapperTickExpired_wrapperUsage_wrapperVersionBanner___error_accept_addPropertyPair_atoi_bind_ceil_chdir_close_closeLogfile_createProperties_disposeLogging_disposeProperties_fcntl_getBooleanProperty_getIntProperty_getLastError_getLastErrorText_getLogLevelForName_getLogfileRollModeForName_getLowLogLevel_getStringProperty_getSyslogLevelInt_getenv_gettimeofday_glob_globfree_inet_addr_inet_ntoa_initLogging_isQuotableProperty_linearizeProperties_listen_loadProperties_log_printf_log_printf_queue_malloc_memcpy_memset_packetBuffer_printf$LDBLStub_properties_pthread_mutex_lock_pthread_mutex_unlock_putchar_puts_rand_realpath_recv_registerSyslogMessageFile_send_setConsoleFlush_setConsoleLogFormat_setConsoleLogLevel_setConsoleLogLevelInt_setLogfileAutoClose_setLogfileFormat_setLogfileLevel_setLogfileLevelInt_setLogfileMaxFileSize_setLogfileMaxLogFiles_setLogfilePath_setLogfileRollMode_setLogfileUmask_setSyslogEventSourceName_setSyslogFacility_setSyslogLevel_setSyslogLevelInt_socket_sprintf$LDBLStub_srand_stat_strcasecmp_strchr_strcmp_strcpy_strlen_strrchr_strstr_time_unlink_wrapperArch_wrapperBits_wrapperClasspathSeparator_wrapperData_wrapperEventLoop_wrapperGetLastError_wrapperGetPID_wrapperGetTicks_wrapperInitializeRun_wrapperOS_wrapperReportStatus_wrapperSetJavaState_wrapperSetWrapperState_wrapperUpdateJavaStateTimeout_wrapperVersion_anchorPoll_commandPoll_displayLaunchingTimeoutMessage_handleDebugJVMTimeout_jStateDown_jStateKilling_jStateLaunch_jStateLaunched_jStateLaunching_jStateStarted_jStateStarting_jStateStopped_jStateStopping_lastLogfileActivity_logTimerStats_wStateStarted_wStateStarting_wStateStopped_wStateStopping_wrapperGetJState_wrapperGetWState_writeStateFile_asctime_checkPropertyEqual_fclose_fgets_flushLogfile_fopen_fprintf$LDBLStub_getLogfileActivity_getLogfileRollMode_localtime_maintainLogger_remove_rollLogs_umask_wrapperBuildJavaCommand_wrapperDumpCPUUsage_wrapperDumpMemory_wrapperExecute_wrapperGetProcessStatus_wrapperKillProcess_wrapperKillProcessNow_wrapperReadChildOutput_wrapperRequestDumpJVMState_wrapperSleep_appExit_childOutputBuffer_childOutputBufferSize_daemonize_descSignal_ensureSpaceInChildOutputBuffer_getSignalCodeDesc_getSignalName_initializeTimer_jvmOut_pipeInitialized_registerSigAction_setWorkingDir_sigActionAlarm_sigActionChildDeath_sigActionCommon_sigActionHangup_sigActionInterrupt_sigActionQuit_sigActionTermination_timerRunner_timerTicks_writePidFile_dup2_execvp_fork_getpid_getpwuid_getrusage_getsid_kill_logRegisterThread_nanosleep_open_pipe_pipedes_pthread_create_pthread_equal_pthread_self_pthread_sigmask_read_setsid_sigaction_signal_strerror_timerThreadId_waitpid_addProperty_createInnerProperty_disposeInnerProperty_dumpProperties_evaluateEnvironmentVariables_getInnerProperty_insertInnerProperty_loadPropertiesInner_removeProperty_setEnv_setInnerProperty_trim_putenv_strdup_strtol_autoCloseLogfile_buildPrintBuffer_checkAndRollLogs_consoleFlush_currentConsoleLevel_currentLogfacilityLevel_currentLogfileLevel_currentLoginfoLevel_forceFlush_generateLogFileName_getConsoleLogLevelInt_getLogFacilityForName_getLogfileLevelInt_getThreadId_limitLogFileCount_limitLogFileCountHandleFile_lockLoggingMutex_logFileMaxLogFiles_logFileMaxSize_logFileRollMode_logFileUmask_logLevelNames_log_printfMutex_log_printf_message_log_printf_queueInner_logfileFP_queueReadIndex_queueWrapped_queueWriteIndex_releaseLoggingMutex_replaceStringLongWithShort_sendEventlogMessage_sendLoginfoMessage_setLogfileMaxFileSizeInt_setSyslogFacilityInt_threadMessageBuffer_threadMessageBufferSize_threadPrintBuffer_threadPrintBufferSize_unregisterSyslogMessageFile___sF_closelog_consoleFormat_currentLogFileName_fflush_ftell_logFileLastNowDate_logFilePath_logfileActivityCount_logfileFormat_loginfoSourceName_memcmp_openlog_queueLevels_queueMessages_queueSourceIds_queueThreadIds_rename_syslog$LDBLStub_threadIds_vsnprintf$LDBLStub_workLogFileName___stub_getrealaddr_NSAddressOfSymbol_NSIsSymbolNameDefinedWithHint_NSLookupAndBindSymbolWithHintstart.sint:t1=r1;-2147483648;2147483647;char:t2=r2;0;127;/SourceCache/Csu/Csu-58//SourceCache/Csu/Csu-58/crt.cgcc2_compiled._pointer_to__darwin_gcc3_preregister_frame_info_start:F(0,1)argc:P(0,2)argv:P(0,3)envp:P(0,3)p:r(0,4)char:t(0,5)=r(0,5);0;127;:t(0,1)=(0,1)int:t(0,2)=r(0,2);-2147483648;2147483647;:t(0,3)=*(0,4):t(0,4)=*(0,5)q:r(0,3)term:(0,6):t(0,6)=*(0,7):t(0,7)=f(0,1)__call_mod_init_funcs_call_mod_init_funcs:f(0,1)p:(0,6)_crt_basenamecrt_basename:f(0,8)path:P(0,8)s:r(0,8):t(0,8)=*(0,9):t(0,9)=k(0,5)last:r(0,8)_crt_strbeginswithcrt_strbeginswith:f(0,2)s1:P(0,8)s2:P(0,8)i:r(0,2)int:t(0,2)__call_objcInit_call_objcInit:f(0,1)i:r(0,10)unsigned int:t(0,10)=r(0,10);0;037777777777;count:r(0,10)_dyld_image_count_fn:(0,11)_dyld_get_image_name_fn:(0,12)_dyld_get_image_header_fn:(0,13)NSLookupSymbolInImage_fn:(0,14)NSAddressOfSymbol_fn:(0,15)void:t(0,1):t(0,11)=*(0,16):t(0,12)=*(0,17):t(0,13)=*(0,18):t(0,14)=*(0,19):t(0,15)=*(0,20):t(0,16)=f(0,10):t(0,17)=f(0,8):t(0,18)=f(0,21):t(0,19)=f(0,21):t(0,20)=f(0,22):t(0,21)=*(0,23):t(0,22)=*(0,1):t(0,23)=k(0,1)pointer_to__darwin_gcc3_preregister_frame_info:S(0,6)NXArgc:G(0,2)NXArgv:G(0,3)environ:G(0,3)__progname:G(0,4)dyld_lazy_symbol_binding_entry_pointerror_messagedyld_func_lookup_pointer_darwin_unwind_dyld_add_image_hook_darwin_unwind_dyld_remove_image_hook_unknownBuffer.4795_seeded.5428_jvmPid_funcptr_funcptr_funcptr_funcptr_funcptrmule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/wrapper-solaris-x86-320000755000175000017500000033062010567556635030645 0ustar charlescharlesELF?44 (44ssss<<uu/usr/lib/ld.so.1[[  #$'()*,-./123489;<=>@ABEGHKLMPQSUVWY\]_abdghiklmnpqstvxy{|~    !"#%&'()+-/046;<=>?ACDEFHILMNQRSTVZ !"%&+0567:?CDFIJNORTXZ[^`cefjoruwz}  $*,.1235789:@BGJKOPUWXY ;<!8w.4 C>Hl [h pk  T=v i L  <T<4<% (w%;*v 8@ I=R=_;d(vsxo < Pg ," s ] Twd=Z =Hw;0>7!?8 L i y 0C  4=@  `v`w:|\ D<!l4 4 Jx f=l;v?pb G 4m vD?=@w? < < "% 5A0wU id<p  ~Ȍ!ܐ?;E  > $==e d: $[  ';.4w;;B(A e  o$<v@z z <,vFv  >  $  pe >+  :;?>F=Mp g|GU | d  N $ |   N *  W (Ȍ.vE ddwL ` a  n  w( + :X $ NvR f xvH L  t> 0Z  ̌  2  F XU~ Y t:"b & p p   4> l1 : l d Z = Tp   4 =; N Q  _   p t?z  T> @v d1 8 >  1 : w   J " (  5 o G XMA Y <^  r UY ? dv v S H $;  \D <  D;" 4?) Dv4  S   l Dw Pw h 4; P < ( $ hv HH ,w  7 4vA ?I D>Y  j T } z  D $w  < 0v  < wt_  Lwv5 ?w-Q :d LP it  H Q   (?   =d  $Xw5;>< Mp ]>bvrXJ t=  v >4 Ј G "\ 8l Ot  Ut<\vjT { d?<  \  A S  s +T;1:6B Q$>] phI@" >|  D  ?|t $? 4 +t;2:9<>ؐS g(vk _lib_versiongettimeofdaysrandqueueWrappeddisposeInnerPropertydup2getLogfileActivitywrapperVersionBannersigActionChildDeathwrapperDumpCPUUsagefopen_edatadisposeLogginggetIntProperty_Jv_RegisterClassessetConsoleLogFormattimeputsprintfsigActionTerminationcurrentConsoleLevelfreelogLevelNamesgetInnerPropertygetpwuidpthread_selfrecvwrapperVersiongetSignalModeglobfreejStateStoppedprotocolStopServergetLowLogLevel_etextwrapperStoppedSignalledlogfileFPfprintfwrapperGetJStatestrcmpthreadMessageBufferSizepthread_mutex_unlockgetpidenvironjStateLaunchevaluateEnvironmentVariablesjStateLaunchinglogTimerStatsgetSignalCodeDeschandleDebugJVMTimeoutchdirwrapperSleepgetLogFacilityForNamecurrentLogfacilityLevelpacketBuffersprintfloadPropertiesInnerputchargetBooleanPropertywrapperKillProcessNowunregisterSyslogMessageFilefgetsinet_ntoapthread_createaddPropertypipedesisQuotablePropertywrapperJVMProcessExitedkeyCharsstrdupstrerrorqueueReadIndexcommandPollunlinkwrapperSetJavaStateloadPropertiessigActionInterruptwrapperDatacurrentLoginfoLevelwrapperReportStatusstrstrwrapperGetPID_iob_endftellpthread_mutex_lockwStateStoppingflushLogfileceilstrcasecmpwrapperSetWorkingDir_PROCEDURE_LINKAGE_TABLE_jStateKillingwrapperStartPendingSignalledsocketconsoleFlushstrcpywrapperLoadConfigurationPropertiesdaemonizememcpycheckAndRollLogswrapperGetFileBasegetenvwrapperBitsprotocolOpenlogFileLastNowDatesignaladdPropertyPairsetLogfileRollModewrapperGetLastErrordisposePropertiespthread_equalwrapperDisposesendsetsidgetsidregisterSyslogMessageFilewrapperProtocolClosewrapperKeyRegisteredmaintainLoggerlimitLogFileCountHandleFilemainwrapperGetTickswStateStoppedgetLastErrorTextgetSignalNamecreateInnerPropertywrapperLogChildOutput__iobprotocolSendBufferSizeensureSpaceInChildOutputBuffercurrentLogFileNamesetLogfileMaxFileSizeIntconsoleFormatpropertieswrapperPingRespondedlog_printf_queueInnerwrapperBuildKey_environsetSyslogFacilityIntpipeInitializedwrapperSetWorkingDirPropsetSyslogLevelgenerateLogFileNamessdsetLogfileAutoClosesetSyslogFacilitylogFileMaxSizewrapperProtocolFunctionwrapperGetProcessStatusremovePropertyforkerrnowrapperGetSystemTickswritePidFilewrapperSetWrapperStatereleaseProtocolMutexlogRegisterThreadreleaseLoggingMutexwrapperStripQuotes_cleanupjStateStartedcheckPropertyEqualsigActionQuitsetLogfileUmasksigaddsetwrapperGetTickAge__fpstartsetConsoleLogLevelIntwrapperBuildUnixDaemonInfowrapperInitializeRunlocaltimetrimwrapperStartedSignalledremovewrapperParseArgumentssetWorkingDirsetLogfileFormatvsnprintfrollLogsnanosleepwrapperClasspathSeparatorlog_printfjStateStartingwaitpidlockLoggingMutexgetThreadIdmallocchildOutputBufferwriteStateFilewrapperProtocolReadgetLogfileLevelIntloadConfigurationwrapperInitializerandlinearizePropertieswrapperBuildJavaCommandArrayInnerrenamelogFileRollModesdwrapperRequestDumpJVMStatewrapperExecutefcntlwrapperEventLoopgetOutputFilterActionForNamewrapperGetWStatebindputenvtimerTicksdisplayLaunchingTimeoutMessagesetSyslogEventSourceNamethreadMessageBufferthreadPrintBufferSizesendLoginfoMessageinet_addrforceFlushstrrchrqueueMessageswrapperRestartRequestedlogFileUmaskgetStringPropertycurrentLogfileLevelwrapperBuildJavaCommandwrapperOSopenlogpthread_sigmaskbuildPrintBufferwrapperStopProcesssetEnvgetLogLevelForNamelog_printf_queuechildOutputBufferSizesigActionCommonwrapperStopRequestedwrapperArchsetSyslogLevelInt_xstatsetInnerPropertyqueueWriteIndexwrapperFreeJavaCommandArrayregisterSigActionprotocolStartServersigActionHangupstrtolinitLoggingwrapperKillProcesssendPropertieslogfileFormatlisten__register_frame_info_baseslockProtocolMutexgetConsoleLogLevelIntwrapperTickExpiredthreadIdssetConsoleLogLevelupdateStringValuewStateStartedwrapperRunConsolewrapperGetCurrentTimeloginfoSourceNamequeueLevelskilllastLogfileActivitysigActionAlarmwrapperRestartProcessthreadPrintBufferlogFileMaxLogFilesdumpPropertiescloselogprotocolSendBuffercloseLogfilelimitLogFileCountwrapperBuildJavaCommandArraywrapperAddDefaultPropertiessetConsoleFlushcorrectWindowsPathanchorPollgetLogfileRollModequeueThreadIdssigactiongetSyslogLevelInt__deregister_frame_info_basesasctimegetLastErrorautoCloseLogfilerealpathsetLogfilePathinitializeTimeropenlog_printfMutexwStateStartingfclosewrapperUsagewrapperDumpMemory__dso_handlewrapperAddToTicksexecvpwrapperUpdateJavaStateTimeoutwrapperStopPendingSignalledwrapperProtocolGetCodeNamesetLogfileMaxLogFileswrapperReadChildOutput_initstrchrprotocolMutexcreatePropertiesgetLogfileRollModeForNamefflushglobreplaceStringLongWithShorttimerThreadIddescSignalappExitvalidateTimeoutwrapperRunService_GLOBAL_OFFSET_TABLE_setLogfileMaxFileSizecloseexitlogFilePathjStateLaunchedsigemptysetsetLogfileLevelIntworkLogFileName_mcountreadlog_printf_messagejStateDownsysloginsertInnerPropertygetrusagejvmOutjStateStopping_DYNAMIC_startwrapperLogSignalledumaskpipe_finisetLogfileLevelacceptatexitatoilogfileActivityCountsendEventlogMessagequeueSourceIdstimerRunnerlibsocket.so.1SUNW_0.7libpthread.so.1SUNW_0.9libnsl.so.1SUNW_0.7libm.so.1SUNW_1.1librt.so.1SUNW_0.7libc.so.1SUNW_1.1libsocket.so.1libpthread.so.1libnsl.so.1libm.so.1librt.so.1libc.so.1 (=  (=  (=  '=  (= '= sssȌssUss>ssss7sss^ssss=ssTs>tUt`tq t)ttttV t$tc(t,t90t4tP8t/UWVS jjjvVhjP@uX(` 3}h fE jE܍EP5vӆfU@#Y} C;X0~H( P5v0v,v(h jjIA^_PjwJvti P @t2v@4ǀǀe[^_át萧Ph!jj릡뮃ZYPs0s,h@!BX,3P(~!;t Sp(h!jjV ҉X4j5v-@7ަPh!jj"vtU P@tv@4tPh!jj뽐Sh!jjMPh"bPh@"jjfuU(vt = vtÍMPQMQRE> v@ Phj5 v@tevtT P@tv@4xtjPh!jj뽐Ë u -Ph"jj_M R ubPh"jj0   5Ph"jjU vt P@t  vÐ tgPh"jjʐUUBwn$#"ø####!#۸/#Ը7#͸?#ƸC#뿸J#븸X#뱸e#몸z#룐PRh#hww노#{#q#g#]#S#IUWVSU hv]U}sE0$t]۾t395vswc Vw= vt0ۋEPMQ$hB$jjuX =wEۈwSBRjV5w5 v@t hv e[^_Ð u Ƀ8$hX$jju ӐwCwq$$ tۋEt'P]S$h$jju_ xq$҃ P_UWVSDjURPuԸMb+ދ}Ӄ}f]܉U= v_jjuV5 v HUψU3ېjjV5 v3Htƃ`w=]C$8% h`w$<jMQr]ĸMbM+M+fu܍4+U4 e[^__<;떃 h`w)$<x h`w$=^y>Xs=N h`w98 ( h`wSh$jj h`wsVh9 h`w ]SNPh$jj Uτn_`wCS5u 3Ph%jjv, tۃ_t=tϋ=tzPh%뿐=vt= v듐=vuUWS hb3XZj3jCCpjjjGj ==GPLJLJLJLJ聤ǂ t e[_à h%$$%$$$%$$$3놐UWVS,}u V:-t.U%~N{SKe[^_Ë ZB}~U^~ YQy>}3Ej/P\t@Ẽj.ut+]̋ GW] uuPEU3у $I MASh%=wMFBJB]]j/R\ t@Ej.ut+]A Q] uuP_XE05(vh%$ $%Y[uh&XZuh`&$&_Xuh&uY[Vh&hXZuh'Y_XVh 'L$ P$'T$'H$'<$ (0$ $`(Y[uh($ $($@)$a)$ 3O%>}3Ej/P\Tt@E܃j.u<t+]܋A Q] uuPE}ԋ];E3у $ }ЉGuԋh%rMIBJFxUj3j{jjjGj@} Bp胝 Phv)jj蜽tPPh)jjp e{vtm P@@t3v@4Ph)jj%átØPh!jj륐몐Qh)`Qh)(Uj3jyjjjGj| BpWtÐQh*jj腼tPPh)jjYcdvtn P)@t6v@4Ph)jjft詗Ph!jjڻ뢐Qh)`USP8M] w)u]Ð Sh *jjQ ዂuBu$MtNtOtGt ǂǂ뗐 Sh`*jjQq 렐UWVSPu3эy33;} M𐐐2<\t<"tM  CB;|U X[^_;U}ފD2<\t<"t M  \ӋE "CBɋM  \UWVSEQh*h*5C3у $M uɉWSh*PY[h*E0tU:3+у;h*]3tu>3+у ;buDž3@RPh*hR jhQ5S8tx}thj-P[;t|h*S6;tg ShPh*jjjh0+6;t:BTݐhR5 h@+hWM Dž3у Q] ۉt u7Phg+6 j tPh*PjhP5ثD3 Q8Y_PSPjhj+5 ]ۋt( j }Vh+PWjh+5諪~K;}=~Et( j o uSh+PDU 3Pjh+5k63ыу D P}M ɋ@3Ivр|\ V@vRSh+]4a Et& j W}[^h+P.] hDžDž M }ɉ9 3Dž@WPh+hP jhV5t'3IۋuE t4]|\kh,P)}t[=3\у Q] Ћuۉ \PQh,RUt0 j us4h,Pz8~=]t0 jm }5v8h,,P:Et0 j0 us j-} uЉs Pqthg-REt5 j }FVh-PUtLQh-h-5Ӣ3щ $g ]Vhg+P<3pRVh-hQ jhP5go8UhP5艣 Vh-hQ} Dž3у Q] }ۉt uJQhg+U49u j tSh*]4WjhW5N3 QZYPSe[^_W=wth.h .0hE.h\.tWhz. R5(vh.h.,x ^tbMtU j,U ؋}҉ Py gfff+Vh.Sx$^] j,M ؋Eɉt'Pr$gfff+Wh /Sa Wq$gfff+Wh`/׋Pz gfff+Vh/Bh/s=\PWh/ h/Pukh/uSj*Suj?SQjjSfDž9<3I;~1u<@v9A<Q4hg+Mj;% V M< UWhg+P<$N;w ShRh0jj1 lр| /р| \jRQjt.$ ShPh@0jj譩 9t ;wv~1U< @v >F<2VShg+U<N MPPh1jjSDA $p4u:jVjGSb0u e[^ÐEe[^Qh1jjuh1jjS蹩ǂh2ǂRh@2jǂPh2ǂPh2Ph2j됋>Ph3sPh@3jj Qh3jjS) QPh3jh 4UWSwty=v33PIQ,$]3P}E $fU fU54m]mUv L;\G~=Gle[_à j$wcUSP]ۋU tkh4SodtQh#SUet7h4S;fth4S!gtU ‹]ÐUWVS h%h45+$Ph4h45 P膕y7 SgPh%h45͒PtPh4h45讒P葪Ph5h55菒PҗPjh-55+P~ jh`553҅~Wjh`55Ѓ R迪Sh5h55PQh4h55֑P Rjh55ޒP Ph5h55蛑PPh5h55|PPh6h65] Ph%65IP質p芩5džPjh765近 F(h}hD65=螑G,s,NPhhU65lC0S0JC,=~C0Ph6jj茝Pjh65 C8C8~ ;C(Vhyh65ڐC<S95] Pjh`95虍 jh955x j h95= Gtjh955͌ Fxjh95=诌 G|jh955葌 jh95=p jh:55OCt3҅~ =^D CxVt3҅~ =^ C|Vx3҅~ =^ V|3҅~ =^W 3҅~ =^  = S|~;s St~2Cx~;@ C|~ ;Ct ~ ;Ct Pjh@:50 h,h`:5= ҉h Pjh:5Hҋ~SDž9 qǂ _$Uǃ$ǃVGWh:V. jP5{t뺋~P P5 $3҃;$DžSNQjh:50 t)3 Qf_Z0VPC]Qjh:5脈4t)3 Q_Z4VPKlQjh;5 <+t)3 Q螿_Z<VP?Sjh*;55LJ؋@t)3 QEZY@SPPjh>;5&H~"Pjh>;5 ="Pjh>;5H DsPjh\;5貇H~"Pjh\;5虇="Pjh\;5wHPPjhy;55IX =Xh;5$ 5\Xh;5 =`Xh;5چ 5dXh;5赆 =hXh;5萆 5lXh;5k =pXh<5F 5tXh3<5!xPXhL<5Pݜ jhb<5=FS҉|tCe[^3_Vjhy<5 ZYjgjh<5=ÄPPjh\;5NЃVjh<5yLu8t)3 QZYLVP蜼% P赼ǃLPjh>;5迄Ѓ P耼dž@. Peǃ<Qjh<5贃8u8t)3 Q6_Z8VP׻: Pǃ8밃 Pػǃ4Qjh<5',u8t)3 Q詺_Z,VPJI Pcǃ,밃 PKǃ0Qjh<5蚂(u8t)3 Q_Z(VP轺X Pֺǃ(밐@SPh:V费 jS5  3щ $艹XYV 4 h<W? h#P5艁_ X$h#V*[u,;0h4V3ɃT Z붃 4荹 A;|Ph =jj܍ǃqPh=jj赍Ph >jj蘍Rh>jj{C|Ph@?jj[mǃQh?jj4.ǃSh@@Wh^h^jh:h@jj ^Ph^h^jh9h@jj ^vPh^h^jh9h@jj莌 ^%Ph^h^jh9h@jj[ ^Ph^h^jh9h@jj( ^ǃbǃ#ǃPjh@5C臘HBǃ3C<;=~C@PhAC<yhyh7jj_/C8Wh`Ajj;C,;=~C0PhAnC,}h}h6jjhBVöhBh Bjj襊PhBUSQɋ] uShg+ue]ShBjjQΐUSɋ]+ItPMt]ÐSjjejL ~P k PjMj$%B^Xuh&Y[uh`&$&XZuh&^XWh&ܭY[uh'ͭXZWh '$ ĭ$'ȭ$'輭$'谭$ (褭$ 舭$`(茭[^uh(]$ a$(e$@)Y$a)ME e[^_'UVSuVhg+j#3ۋ;} 8uC;|e[^ÃPVuՋ5$[t$\uVh`Ejj諀Y[jjPhEjj茀ۋugu]MtRNtMOtHGtCHt>uǂǂ8hDjjjs̋h DjjjJMUS j 5Hn Pjsj$1]USQҋ]ugu]MtRNtMOtHGtCHt>uǀǀ]hDjjS蠆ΐth DjjS{UÐUWVSu}BTBX] VjZ$i_ZVPBPTXx~hShEjj~ h@Fjj~ hFjj~ hGjjr~EEE Ee[^_N~H|ye[^_UWVS u} t!3;}uC;| Vce[^_à POҐUWVS u] u;t/3 Q0] Ee[^_ɨe[^_à PUSPSt]ÐPjhy<5IqYXjgjh<5pP'US h#]S蓩[th4Sy3ɃT Z‹]UE 3҅~ =^Ph^h^juh@jj|^אUWVS4MjQ]ԸMbEʍ<uпQf+ˋ4эQe[^:_ÐUVu +u 4SƻMbʋƙ[+ʋ^ÐUE+E HÐUU EUVS uZVZu#u 3e[^ÐVh8Gjje{|$Vh`GjjF{UVSPjhG5nt8u 3e[^Ð rPʧutSh8GjjzŃ|$Sh`Gjjz UUGGw $HGøGGGGG۸GԸH͸HƐUSh@HjjCz h}HhH5mYXhHSt]ÃhHSutPhIjjy h Ijjy hiIjjy hIjjy hIjjy h@Jjjy hJjjvy hKjjey hJKjjTySh_KjjEyhKjj4y hKjj#y h Ljjy hLjjy hLjjx hLjjx h Ijjx hIjjxUWVSLɋuu e[^_ÐTVtXRQLj荤i[MM>N5O,G#Qh@MjjwXZjjzȃtD4Gt4 G3tGhGPhMjjj~ 8ǃ8TpPDžL PZYhMT $uV jdBLL ~ThMjjvPVT PhGhMW襣<$譣뿃8GH9QhMjjqvUWVS@ue[^_ÃHuhtXQS@j<3ېhN@ârC 8tVjPW蹢j W荡tj Wxtj Wct C; th NWСWhNjju$NQ Y5@ @t%5DuHiu$=@h@Njjt 뱃hjNWu73t S VWhNjjHtVj}.hNWʠthNW赠uWhNjjshNW茠u WhOjjs$Oh(OWW:' Siu SWh@Ojjs p:h(OWuk VV$WhOjjQWŝ4 #h QW蛝hQW肝h&QWih1QWP~h>QW7eWh`Qy=@hQjjXp} jd"<|ShQjj/pUWVS|J̓76tMe[^_ÐuWhQ}W9hQhQhR5b PW5b tJ4Gt4G3tGhGRhMjjjv 8ǃ8U#pu3 uٛZYhMu؛$辛u3 jdG: ~uhMjjnShGhMV蓛4$蛛׃8G/H9h RjjTnǃPǃWhRjjmtJ4Gt4G3tGhGRhMjjjt 8ǃ8}pU3 uIZYhMuH$. jdG9 ~uh8G\H9Hu ;ǃaǃH6Vuǃ<utz EtE3 u)Y[hMu($uV jdG7 ~uhMjjlPhRjWuhMV˜4$ʘ뵃P Ph Sjjk ǃǃ jHZYP$hOSjjjr f@ɉ9hǃHVuɋǃ<} tEu3 uIZYhMuH$.u jdG6 ~uSuVP WPh Sjji 5ǃǃ, jHZYP$hOSjjjp  hSjj|ihSjjkitJ4Gt4G3tGhGRhMjjjop 8ǃ8Mp}3 u轕ZYhMu輕$袕 jdG4 ~u8G^H9J Pu tPh TjjZh 9SpǃEċbuąǃH4uuIɋǃ<}ty tEU3 u}ZYhMu|$buS jdGL3 ~uhMjjWguąWIuhTPSuhMV4$!븃P CPh Sjjf ǃǃ jHZYP$hOSjjjm eIWhQ}WhQhQhR5-Y PW5eY tJ4Gt4G3tGhGRhMjjj5m 8ǃ8Upu3 u聒ZYhMu耒$f jdGL1 ~u8G\H9HhTUWVSLJ̓u} 7<ǃGǃǃuts jGtEU uyZYhMux$^u/ jdI0OyuhMjjVde[^_PuhMV9ue[^_7 jGi^_P[$hOSjjjTk tVx~!+n Qh}HhH5eVXZhUSr>Wh@UjjXc hUjjGctJ4Gt4G3tGhGRhMjjjKj 8ǃ8MtepE3 u蝏ZYhMu蜏$肏u< jdGl. ~uhMjjwbǃShGhMVN4$V̓8G*H9hVS Wh@Vjjb hVjjatJ4Gt4G3tGhGRhMjjjh 8ǃ8u pU3 uBZYhMuA$' jdG - ~u8G^H9JC TK-PhVjj`.0{x=ǃIWVɋ<ǃ} tẺuȿ uZYhMuЋ$u jd+OyuPuP #Ph Sjj_ 7 jIZYP$hOSjjjf <ǃIǃǃM jIEtE uZYhMuċ$݋u jd*OyuzPu jI^_P $hOSjjjf ,Vjy/=tJ4Gt4G3tGhGRhMjjje 8ǃ8pEE u֊ZYhMW׊$轊u jd)MyWZPhGo8GZH9FPhWjj]HtJ4Gt4G3tGhGRhMjjjd 8ǃ8up}3 uΉ[^hMu͉$賉i jdG( ~u(8G^H9JC^USPU ҋ]&SWHTPXtG@Xuǀǀ]h#Wh@Wjj[Qh Ijj[hWhWjj[ hWjj[ h Xjj[ hXjj[ h Ijj}[CPhXjja[$e0 ǁ5S lP ulQh#Wjgj5x3u PhXjjZܡtQhYjjZPh@YjjZ뀃SjY+=VUWVSx]SʆظM+ȍ}<$Md} U$\ PhWuVz}3EPhYjjD YuV}}} U$ PhW]S }3EPhYjjD dY Q te[^__;ظʃ }uV+}e} U$] PhWEP{}3D MQhYjjXӸEPuu} U$ PhWMQ }3}WhZjjD eX UWVSlf:ETH`5Et#MɸIu&ZPh*ZjjW]=EH` )g3EGlE__-9a;wt5WWNaWu;Ct҉}4Gt4G3tG̐Qh Ijjq>u hWjj`>hWjjO> h Xjj>> hXjj-> h Ijj>IUhjj3j!LtÐj4jjjj4j ސUÐUhj8j GtÃj9j퐐UÐUSSE ]uuu]ÐS=x QTtQh)[h@[S8 j ǃאSj =r|USP ҋ]ulPhv[jdjtx& Ax~PSjKj]ÐjPh[jja<$eǂŐPh[jj1<USSE ]u]ÐSx QTtRh)[h@[SPh[jj;$ǃːSju =fpUSSE ]uqu]ÐSMx QTu"Ph@\jj";E]PhQh\S&럐Sj =v냐USSE ]uqu]ÐS豾x QTu"Ph\jj:E]Phx\h\S럐Sj9 =v냐USSE ]u5u]ÐSx]Sj =uU(,8ug<uI4u+Lu uc Peᐐ Re Re뤐 Re놐 Ree Rwe?USP]f u]Ðh_jjj(@C"$(a_$@a_QRP3h_jjj?C uKSu se`tRsPs eZYPs h `jjj? F PeZYPsh^`jjjg? 둸t`h{`^`T`J`@`6`,` ````hajjj>UWVS }u ]d5Pdt7 u e[^_Ð Vhajjjw> ې|uff?et Vhaj뿃 Vhajjj+>E e[^_guË8v~Uu2W58vDdJ7ZYPVh bjI Vh`bjjj= 뵃 Vhb_u{uqMtfNtaOt\GtW Vhbjjj^=jj:z 8E 8Ee[^_ Vh cjjj=5džj 뛐UWVS8]jEE>$'c_XjS-cY^jS#cXZjSc^_jScZYjSc jSjc  jdyDvC+DvUЋ+]ԃҋtEuÐ;Z$YJ ;|(tPSVW5Dvh`cjj4 뽐 Rhcjjr4볐 QhdPh1djjD44Ph`djj-4UU   MEu9jURa uÐPhdjj3Rhdjj3UWVS CPt'30 sP^BPQjMQuVEE/{L3U;}5 }4VhdsLj 3FU ;}ԋ 4Vr]3U;CP;|0 YPF;~uu胴e[^_Ð=U_P<3 Q]XZM4ZP4]U똋UZ ZP4]{PF ɋuUWVS wu" h_w ju==_+ǂui \^_Xj5_x7j5_2PhdjjZ1e[^_2Phe␃ 3ɃQ8v5 w3- SUء wu w$wV5$wPSV$wYD5 woV wUVSPj@j58vuY3ۃucu(PuDvSPjOVe[^ÐhgjjV1XZj58v*Xx륃+$hgjjV1 ӐUSj5u5 %XiM`X@jj]X jjhh\XtL jTXZjSW$TYXjSW$TXZjSW j5uatWx0u"  Q4]à jpS_*Ph hjj)$,믐PhChjj(닃 SS]*Ph^hjj($ hYn)Ph hjj($wShhjjm(KUWVS } Aeu? j1[^VSRu7S)$Shhjj ( je[^_Ðj/VS VTt($Vhi랃Wueth%i2,Tth'i2Tu 7{Yjs3Uh-i 1Sth/i3Su  Wt-pP  7藫 XS^Xh8i 1CS0u 0t%(L8(,uBh$T dRZYheVR$RtPWh!eVR4$R뛃 '$,h@ijj%=LJ, ^+T `eRZYheVfR$LRt"SWh!eVXR4$`Ro&$5(hi S xQZYheVQ$Qt"SWh!eVQ4$Qk%$Lhi[hi56#Q2hi3PX7wXNVh jjjE$`UÐUVS uQXZheuQ$PtPu h!eVP4$P3e[^ÐUSPhgjj]S+YXj58vbQx]Ð$$hgjjS* ڐUEw5$@j_øt`{``鸊`⸒`ې`Ѹ`ʐUEw.$j_ø````␐`ِUu mPСuÐ5RUPthjjjj)АhkUS] SxjfSh%ku]ÐUu ROYZ5POth@kjjj)Ðhgjjjp)XZj58vOyՃ.#$hgjjj?) 뵐Uu hkjjj) Q u6DvPj=tÐhkjjj(琐ȐUS] S\jfShlu]ÐUS] S4Shlu]ÐUVS,U U܍URuN j]SVEO3҅u e[^Ð"[ZPVh ljjj(ҐUSP uGjhjhue[^_ÐPSVE)Ɛ@j%PEt+xPWSTE$Ƅ/E+9su`3эY9suFRSD)QSVD)끋+UWVS @MA] Ph@VS 3щ $ CMA33I3;}2.Jv Ex;C3FI;|ЋMq3e[^_ËUB PmCE@u&{ {C3e[^_Ãh#nVB;t1>#tj=VBt jj@PVul 딍~{~ t<} {PhB{W{M AQWu1J{{> t뱐D0H$T0 tt|3#t3ˍS;ыw 3D3C;vI֐F< t<t]UWVS Uۋ} t$W3B3t [u3tBFVtGPt9~z 6@Yv@F4$~@e[^_ËMƋ]SUWVS8EU MUЉE3ۋEME}ùыuQI?Eù}у3}Њ8 t u;s@鐋]Њ t u;vI+ȋCU3ù Q>Eùу30 t u;s@1 t u;vI+ȋC7};ut$u3@3҅t [u3҅ҋBuMuS3MUKS }I 3}Iw u>]]e[^_>h,nu1?;EuȋUUƹ[щM̋M̃ Q=Suh1nPa=4$AmVh@n>Whhnu>;E$} }W>CE}܋ƹ}ع΃ Q<uuh1nP<$ASU j<@@@}ع3щ $n<ZYuP=_XSu 0VSQup=EWSPuZ=0UWVSuE 3ۅɈEMt~ЉU3}E܋ƹэ Myэ\ }܃uW@=tCGUzuW =tCGEHCɉMu CS{;uۉEE]}}U2uV<t)+ލKRQVu]<]MK]wƒVu;3uэDE=]EsXZuVY<t&+ލSQRVu;]MK]wƃVuN;3ыEtUu]{E}MEe[^_ÐUVSUۋu t$V3Y<3҅t [u3ҍe[^Uj :@@@ÐUS]3:Ys:C$:]U ju u-ÐUj9@UWVS }7Gt5 ^67:Xv(:F4$:ۋũ W:e[^_ÐUWVSU U]3‹щM}MQ8uSh1nP8V=u e[^_Ðu E@ne[^_9UWVS ]3ыu 3 t u;s@ t u;vI+ȋGu 7e[^_RW QVe9UWBU 3сBvRhnjjn ‹}ÐRW8YXj=WV9t uu@PWu/3붐UVSUۋu t$V393҅t [u3҅ҋEtBe[^UVSUۋu t$V3e93҅t [u3҅ҋEtB Pj;XZuS9$7e[^UWVS Uۋu }tV381t7[u3t PEE Ue[^_:e[^_ËΐUMɋUE thnhnPRÐhnhnUVSUۋu t$V3U83҅t [u33tB e[^ÐUSSUt" s3hnjjV [ u]UWVS 3} ыuI]M]Et }IMU9Uw3E8t%M;ɋ} u=Mu"u]u;u܋]Ee[^_ÐPuuum6ʊ}GC}ŐUS hXo]S#7u‹]Ãh]oS7t߃hboS6tŃhjoS6thnoS6th~oS6 shoS|63҃JRUS hXo]SS6hQoS56hoS6hoS5tfhoS5tLh5oS5t2hoS5thoS53҃‹‹]US ho]Sk5hoSM5hoS/5hoS5hoS4tphoS4tVhoS4t<hoS4t"hoS43҃JP¸‹]UWVS ]3 Q52E3EE3I;}@ƒMMKtsJЀ vX-tS3FI;| ]US2v~ Ev uq2e[^_Ð}EG}랐E뇐ktmvEhUWVS 3E} 3I3;}4M  Dw$p E3} CI;|̋LwF95Pw3E} 3ILw;ً}tM  DwI$p}tk}t[PuhoVj0E쐐M9MthoVJ03} CI;|Lwe[^_Ãho륃ho뛃}tM}~3}t }t hpvhpihp\}u҃hpHh'p;U P4vh/pV/E(Wu$3Ƀ}IσQPQh2p΋M1qqq QBRylWh5pVA/E u}7www WBRlWh`pV/E0 R/XV.УLw5Pw 3}$эtUWVS]}uu Sq.XZh [configuration properties] [...] %s [configuration properties] [...] ( implicitly '-c') %s ( implicitly '%s.conf') %s ( implicitly '-c' and '%s.conf') where can be one of: -c --console run as a Console application -v --version print the wrapper's version information. -? --help print this help message is the wrapper.conf to use. Name must be absolute or relative to the location of %s [configuration properties] are configuration name-value pairs which override values in wrapper.conf. For example: wrapper.debug=true--> Wrapper Started as DaemonUsing system timer.<-- Wrapper StoppedUsing tick timer.--> Wrapper Started as Console--> Wrapper Started as ServicewrapperStopProcess(%d) called while stopping. (IGNORED)wrapperStopProcess(%d) called.javawrapper.java.command"%s"jdbjdb.exewrapper.java.additional.%d"-The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.-Xdebugwrapper.java.additional.%d.stripquotes%swrapper.java.initmemory-Xms%dmwrapper.java.maxmemory-Xmx%dmwrapper.java.library.path-Djava.library.path="%s%c%s"-classpathwrapper.java.classpath.%d"-Dwrapper.key="%s"-Dwrapper.port=%d-Dwrapper.jvm.port=%d-Dwrapper.jvm.port.min=%d-Dwrapper.jvm.port.max=%d-Dwrapper.debug="TRUE"-Dwrapper.pid=%d-Dwrapper.use_system_time="TRUE"-Dwrapper.version="%s"-Dwrapper.native_library="%s"-Dwrapper.ignore_signals="TRUE"-Dwrapper.service="TRUE"-Dwrapper.disable_shutdown_hook="TRUE"-Dwrapper.cpu.timeout="%d"-Dwrapper.jvmid=%dMainwrapper.java.mainclasswrapper.app.parameter.%dwrapper.app.parameter.%d.stripquotes-Dwrapper.cpu.timeout=%d-Dwrapper.disable_shutdown_hook=TRUE-Dwrapper.service=TRUE-Dwrapper.ignore_signals=TRUE-Dwrapper.native_library=%s-Dwrapper.version=%s-Dwrapper.use_system_time=TRUE-Dwrapper.timer_fast_threshold="%d"-Dwrapper.timer_slow_threshold="%d"-Dwrapper.timer_slow_threshold=%d-Dwrapper.timer_fast_threshold=%d-Dwrapper.debug=TRUE-Dwrapper.key=%s\./Classpath element, %s, does not match any files: %sClasspath element, %s, does not exist: %sUnable to get information of classpath element: %s (%s)-Djava.library.path="%s%c%s\"-Djava.library.path=%s%c%s-Djava.library.path="%s"-Djava.library.path="%s\"-Djava.library.path=%s-Djava.library.path=wrapper.java.library.path.%dLD_LIBRARY_PATHJVM process exited with a code of %d, setting the wrapper exit code to %d.JVM already down.Unable to start a JVMJVM exited while loading the application.JVM exited before starting the application.JVM exited while starting the application.JVM exited unexpectedly.JVM exited unexpectedly while stopping the application.JVM exited normally.JVM exited on its own while waiting to kill the application.Unexpected jState=%d in wrapperJVMProcessExited.JVM process exited with a code of %d, however the wrapper exit code was already %d.JVM process exited with a code of %d, leaving the wrapper exit code set to %d.mmnn*n %swUnable to write to the status file: %s%s Loop: check anchor filer+tRESTARTCommand '%s'. Restarting JVM.Unable to delete the command file, %s: %sSTOPCommand '%s'. Shutting down with exit code %d.PAUSERESUMECommand '%s' not supported on this platform, ignoring.DUMPCommand '%s'. Requesting a Thread Dump.CONSOLE_LOGLEVELCommand '%s' specified an unknown log level: '%'Command '%s'. Set console log level to '%s'.%dLOGFILE_LOGLEVELCommand '%s'. Set log file log level to '%s'.SYSLOG_LOGLEVELCommand '%s'. Set syslog log level to '%s'.Command '%s' lead to an unexpected state.Command '%s' is missing its log level.LOOP_OUTPUTTRUECommand '%s'. Enable %s.Command '%s'. Disable %s.STATE_OUTPUTMEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTCommand '%s' is unknown, ignoring.Unable to read the command file: %s Loop: check command filewrapper.on_exit.%drestartshutdownwrapper.on_exit.defaulton_exit trigger matched. Service is paused, will restart the JVM when resumed. (Exit code: %d)JVM Restarts disabled. Shutting down.Waiting %d seconds before launching another JVM. Set Java State %s Timeout %08lx -> %08lx Set Java State %s -> %sThere were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.JVM was only running for %d seconds leading to a failed restart count of %d.Waiting %d seconds before launching the first JVM.on_exit trigger matched. Restarting the JVM. (Exit code: %d)com.silveregg.wrapper.WrapperSimpleAppThe com.silveregg.wrapper.WrapperSimpleApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperSimpleApp class instead.com.silveregg.wrapper.WrapperStartStopAppThe com.silveregg.wrapper.WrapperStartStopApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperStartStopApp class instead.Launching a JVM...Reloading Wrapper configuration...ping DebugJVM timeout. Disable current %s timeout.Ping: Timed out waiting for signal from JVM.%sThe JVM was launched with debug options so this may be because the JVMis currently suspended by a debugger. Any future timeouts during thisJVM invocation will be silently ignored.JVM appears hung: Timed out waiting for signal from JVM. Temp: Sent a ping packet.JVM Ping Failed. Temp: Sending a ping packet. Last system time tick overflow at: %s Next system time tick overflow at: %s Last tick overflow at: %s Next tick overflow at: %sno Loop: %ssleeptrue Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%s Loop: handle wrapper state: %sUnknown wState=%dEvent loop stopped.startupStartup: Timed out waiting for a signal from the JVM.startUnable to send the start command to the JVM.Start Application.Startup failed: Timed out waiting for signal from JVM.Shutdown: Timed out waiting for a signal from the JVM.Shutdown failed: Timed out waiting for signal from JVM.JVM exitShutdown: Timed out waiting for the JVM to terminate.Shutdown failed: Timed out waiting for the JVM to terminate.Unknown jState=%d Loop: handle jvm state: %sSending stop signal to JVM Loop: exit requestedfalse Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (N/A), Exit=%s, Restart=%sWrapper Process has not received any CPU time for %d seconds. Extending timeouts. Loop: maintain logger(2)Pause reading socket data to share cycles. Loop: process socketPause reading child output to share cycles. Loop: process jvm output Loop: maintain loggerEvent loop started.?RcSignal trapped. Details:kill, sigsend or raiseSIGALRM signal number=%d (%s), source="%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s) signal err=%d, "%s"SIGHUPSIGINTSIGQUITSIGKILLSIGTERMUNKNOWNSIGCHLDmesq state changedAIO completedtimer expiredsigqueueunknownSignal trapped. No details available.Zdnx%s trapped, but signals for timer thread are ignored.%s trapped, but ignored.%s trapped. Restarting JVM.Unable to forward %s signal to JVM process. %s%s trapped. Forwarding to JVM process.%s trapped. Unable to forward signal to JVM because it is not running.%s trapped. Shutting down.%s trapped. Forcing immediate shutdown. Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ldThe system clock fell behind the timer by %ldms.The timer fell behind the system clock by %ldms.Timer thread started.Could not mask signals for timer thread. Sleep: awake Sleep: nanosleep %dmsCommand[%d] : %sUnable to set JVM's stderr: %sUnable to set JVM's stdout: %sw%d Unable to write the Java ID file: %sUnable to write the Java PID file: %sFailed to set jvm output handle to close on JVM exit: %s (%d)Failed to set jvm output handle to non blocking mode: %s (%d)Could not spawn JVM process: %sCould not init pipe: %sUnable to start JVM: %s (%d)JVM exited in response to signal %s (%d).WIFEXITED indicates that the JVM exited abnormally.Unable to request JVM process status: %s Failed to read console output from the JVM: %s (%d)Dumping JVM state.Could not dump JVM state: %s/dev/nullCould not spawn daemon process: %sSpawning daemon process...setsid() failed: %sSpawning intermediate process...Unable to get the path for '%s'-%sUnable to set working dir to %s : %s?-helpv-versioncWARNING: Could not write lock file %s: %sERROR: Could not write pid file %s: %sERROR: Could not write anchor file %s: %s-console Unrecognized option: -%s Unable to extract path from: %s            'NU\clETimer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.INTTimer thread received an Quit signal. Ignoring.Received SIGCHLD, checking JVM process status.JVM process was still running after receiving a SIGCHLD signal.TERMHUPUnable to register signal handler for signal %d. %sUnable to create a timer thread: %d, %sLaunching Timer thread.Call to getrusage failed for Wrapper process: %sCall to getrusage failed for Java process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldJVM did not exit on request. Attempt to terminate process failed: %sJVM did not exit on request, terminatedrt#includeset.%s=%sUnable to set environment variable: %s set.default.The following property name value pair is too large. Need to increase the internal buffer size: %struefalse name:%s value:%sNONE DEBUG INFO STATUSWARN ERROR FATAL ADVICENONESIZEWRAPPERJVMSIZE_OR_WRAPPERSIZE_OR_JVMDATEFATALERRORWARNINFODEBUGUSERLOCAL0LOCAL1LOCAL2LOCAL3LOCAL4LOCAL5LOCAL6LOCAL7jvm %-4d | wrapper wrapperpunknowntimer srvmainsignal main %s%c%04d/%02d/%02d %02d:%02d:%02d%04d/%02d/%02d %02d:%02d:%02d.%03d         %    =   E      M         9 \   ^ b   {       YYYYMMDDROLLNUM-ROLLNUM_ROLLNUM.ROLLNUM.%s-YYYYMMDD_YYYYMMDD.YYYYMMDDa%s Unable to open logfile %s: %s wrapper.log%04d%02d%02dWARNING - Encountered an unknown thread %ld in getThreadId(). %dUnable to delete old log file: %s (%s) Unable to rename log file %s to %s. (%s) Unable to rename log file %s to %s. File is in use by another application. Unable to get the current logfile size with ftell: %s Unable to get the current logfile size with stat: %s ????????uz::::::::: ;;*;:;J;Z;j;z;;;;;;;;; <<*<:<J<Z<j<z<<<<<<<<< ==*=:=J=Z=j=z========= >>*>:>J>Z>j>z>>>>>>>>> ??*?:?J?Z?j?z??????!-7B t x! L  o o6o77oosXMGGGG: o'o.o5ol h k  T=$v+ :i I ]L  q<vT<{4<% (w;v @ ==;(vxo < Pg 1," @s G] _Twid=qZ =Hw;>!8    0C  54=;@ H ^`vv`w:|\ D<l4  x =;? pb G 24m JvSD?Z=c@wr? ~< < % 0w d<  Ȍ! ܐ?;'E 6 > C$=H=Se hd: $[  ;4w;(A   $<@z z <',v3Fv @ S>Z j }$  pe >  ;>=p |GU  d  &N B$ G| W e vN *  W Ȍv dL  ` $ / a D  Z n j s  w (  X $ v   v H % L =  L t>Q W  m 0Z z  ̌   XU~ t:" & p    ' 4>1 l1 C :M l c d ~ Z = Tp  = N    t?  T> @v- d1 8 8 G >O  ` 1 l :s w  J (  o XMA <  UY  ?! dv1 v4 S O H ^ $;d  u \D < D; 4? Dv    DwPwh /4;9P D<L (Z$ rhvHH ,w 4v?D>  T z  D .$wD T< i0vu < *w>t_ M cLwuv5 ?wQ d P t  H .Q 9  L([?e  w =d  Xw;< p >vXJ t=  -v: L>S4 qЈ G \ l t  t<vT  d?"<'  BP\ [ cA sS  s T;: $> hI@" >|  &D  1?8|t L$?V 4 t;:<ؐ (k ../../bin/wrappercrt1.scrti.svalues-Xa.ccrtstuff.c__CTOR_LIST____DTOR_LIST____EH_FRAME_BEGIN____JCR_LIST__p.0completed.1__do_global_dtors_auxobject.2frame_dummywrapper.cunknownBuffer.0seeded.1wrapperinfo.cwrappereventloop.cwrapper_unix.cjvmPidproperty.clogger.ccrtstuff.c__CTOR_END____DTOR_END____FRAME_END____JCR_END____do_global_ctors_auxcrtn.o_START__END__lib_versiongettimeofdaysrandqueueWrappeddisposeInnerPropertydup2getLogfileActivitywrapperVersionBannersigActionChildDeathwrapperDumpCPUUsagefopen_edatadisposeLogginggetIntProperty_Jv_RegisterClassessetConsoleLogFormattimeputsprintfsigActionTerminationcurrentConsoleLevelfreelogLevelNamesgetInnerPropertygetpwuidpthread_selfrecvwrapperVersiongetSignalModeglobfreejStateStoppedprotocolStopServergetLowLogLevel_etextwrapperStoppedSignalledlogfileFPfprintfwrapperGetJStatestrcmpthreadMessageBufferSizepthread_mutex_unlockgetpidenvironjStateLaunchevaluateEnvironmentVariablesjStateLaunchinglogTimerStatsgetSignalCodeDeschandleDebugJVMTimeoutchdirwrapperSleepgetLogFacilityForNamecurrentLogfacilityLevelpacketBuffersprintfloadPropertiesInnerputchargetBooleanPropertywrapperKillProcessNowunregisterSyslogMessageFilefgetsinet_ntoapthread_createaddPropertypipedesisQuotablePropertywrapperJVMProcessExitedkeyCharsstrdupstrerrorqueueReadIndexcommandPollunlinkwrapperSetJavaStateloadPropertiessigActionInterruptwrapperDatacurrentLoginfoLevelwrapperReportStatusstrstrwrapperGetPID_iob_endftellpthread_mutex_lockwStateStoppingflushLogfileceilstrcasecmpwrapperSetWorkingDir_PROCEDURE_LINKAGE_TABLE_jStateKillingwrapperStartPendingSignalledsocketconsoleFlushstrcpywrapperLoadConfigurationPropertiesdaemonizememcpycheckAndRollLogswrapperGetFileBasegetenvwrapperBitsprotocolOpenlogFileLastNowDatesignaladdPropertyPairsetLogfileRollModewrapperGetLastErrordisposePropertiespthread_equalwrapperDisposesendsetsidgetsidregisterSyslogMessageFilewrapperProtocolClosewrapperKeyRegisteredmaintainLoggerlimitLogFileCountHandleFilemainwrapperGetTickswStateStoppedgetLastErrorTextgetSignalNamecreateInnerPropertywrapperLogChildOutput__iobprotocolSendBufferSizeensureSpaceInChildOutputBuffercurrentLogFileNamesetLogfileMaxFileSizeIntconsoleFormatpropertieswrapperPingRespondedlog_printf_queueInnerwrapperBuildKey_environsetSyslogFacilityIntpipeInitializedwrapperSetWorkingDirPropsetSyslogLevelgenerateLogFileNamessdsetLogfileAutoClosesetSyslogFacilitylogFileMaxSizewrapperProtocolFunctionwrapperGetProcessStatusremovePropertyforkerrnowrapperGetSystemTickswritePidFilewrapperSetWrapperStatereleaseProtocolMutexlogRegisterThreadreleaseLoggingMutexwrapperStripQuotes_cleanupjStateStartedcheckPropertyEqualsigActionQuitsetLogfileUmasksigaddsetwrapperGetTickAge__fpstartsetConsoleLogLevelIntwrapperBuildUnixDaemonInfowrapperInitializeRunlocaltimetrimwrapperStartedSignalledremovewrapperParseArgumentssetWorkingDirsetLogfileFormatvsnprintfrollLogsnanosleepwrapperClasspathSeparatorlog_printfjStateStartingwaitpidlockLoggingMutexgetThreadIdmallocchildOutputBufferwriteStateFilewrapperProtocolReadgetLogfileLevelIntloadConfigurationwrapperInitializerandlinearizePropertieswrapperBuildJavaCommandArrayInnerrenamelogFileRollModesdwrapperRequestDumpJVMStatewrapperExecutefcntlwrapperEventLoopgetOutputFilterActionForNamewrapperGetWStatebindputenvtimerTicksdisplayLaunchingTimeoutMessagesetSyslogEventSourceNamethreadMessageBufferthreadPrintBufferSizesendLoginfoMessageinet_addrforceFlushstrrchrqueueMessageswrapperRestartRequestedlogFileUmaskgetStringPropertycurrentLogfileLevelwrapperBuildJavaCommandwrapperOSopenlogpthread_sigmaskbuildPrintBufferwrapperStopProcesssetEnvgetLogLevelForNamelog_printf_queuechildOutputBufferSizesigActionCommonwrapperStopRequestedwrapperArchsetSyslogLevelInt_xstatsetInnerPropertyqueueWriteIndexwrapperFreeJavaCommandArrayregisterSigActionprotocolStartServersigActionHangupstrtolinitLoggingwrapperKillProcesssendPropertieslogfileFormatlisten__register_frame_info_baseslockProtocolMutexgetConsoleLogLevelIntwrapperTickExpiredthreadIdssetConsoleLogLevelupdateStringValuewStateStartedwrapperRunConsolewrapperGetCurrentTimeloginfoSourceNamequeueLevelskilllastLogfileActivitysigActionAlarmwrapperRestartProcessthreadPrintBufferlogFileMaxLogFilesdumpPropertiescloselogprotocolSendBuffercloseLogfilelimitLogFileCountwrapperBuildJavaCommandArraywrapperAddDefaultPropertiessetConsoleFlushcorrectWindowsPathanchorPollgetLogfileRollModequeueThreadIdssigactiongetSyslogLevelInt__deregister_frame_info_basesasctimegetLastErrorautoCloseLogfilerealpathsetLogfilePathinitializeTimeropenlog_printfMutexwStateStartingfclosewrapperUsagewrapperDumpMemory__dso_handlewrapperAddToTicksexecvpwrapperUpdateJavaStateTimeoutwrapperStopPendingSignalledwrapperProtocolGetCodeNamesetLogfileMaxLogFileswrapperReadChildOutput_initstrchrprotocolMutexcreatePropertiesgetLogfileRollModeForNamefflushglobreplaceStringLongWithShorttimerThreadIddescSignalappExitvalidateTimeoutwrapperRunService_GLOBAL_OFFSET_TABLE_setLogfileMaxFileSizecloseexitlogFilePathjStateLaunchedsigemptysetsetLogfileLevelIntworkLogFileName_mcountreadlog_printf_messagejStateDownsysloginsertInnerPropertygetrusagejvmOutjStateStopping_DYNAMIC_startwrapperLogSignalledumaskpipe_finisetLogfileLevelacceptatexitatoilogfileActivityCountsendEventlogMessagequeueSourceIdstimerRunnerGNU C crt1.sas: Forte Developer 7 Compiler Common 7.0 IA32-iteam 2001/12/12GNU C crti.sas: Forte Developer 7 Compiler Common 7.0 IA32-iteam 2001/12/12@(#)SunOS 5.9 Generic_112234-03 November 2002GCC: (GNU) 3.3.2as: Forte Developer 7 Compiler Common 7.0 IA32-iteam 2001/12/12GCC: (GNU) 3.3.2as: Forte Developer 7 Compiler Common 7.0 IA32-iteam 2001/12/12GCC: (GNU) 3.3.2as: Forte Developer 7 Compiler Common 7.0 IA32-iteam 2001/12/12GCC: (GNU) 3.3.2as: Forte Developer 7 Compiler Common 7.0 IA32-iteam 2001/12/12GCC: (GNU) 3.3.2as: Forte Developer 7 Compiler Common 7.0 IA32-iteam 2001/12/12GCC: (GNU) 3.3.2as: Forte Developer 7 Compiler Common 7.0 IA32-iteam 2001/12/12GCC: (GNU) 3.3.2as: Forte Developer 7 Compiler Common 7.0 IA32-iteam 2001/12/12GCC: (GNU) 3.3.2as: Forte Developer 7 Compiler Common 7.0 IA32-iteam 2001/12/12GNU C crtn.oas: Forte Developer 7 Compiler Common 7.0 IA32-iteam 2001/12/12ld: Software Generation Utilities - Solaris Link Editors: 5.9-1.377 <Y4.interp.hash.dynsym.dynstr.SUNW_version.rel.got.rel.bss.rel.plt.plt.text.init.fini.rodata.got.dynamic.data.ctors.dtors.eh_frame.jcr.data.rel.local.bss.symtab.strtab.comment.stab.index.shstrtab.stab.indexstrvalues-Xa.cXa ; O ; V=3.1 ; R=Sun WorkShop 6 update 1 C 5.2 Patch 109514-03 2001/03/12/build-gk/on81-patch/usr/src/lib/libc/i386; /opt/SUNWspro.40/SC6.1/bin/../WS6U1/bin/cc -O -W0,-xc99=%%none -Xa -xildoff -errtags=yes -errwarn=%%all -erroff=E_EMPTY_TRANSLATION_UNIT -D_REENTRANT -Di386 -Iinc -I../inc -DTEXT_DOMAIN='\"SUNW_OST_OSLIB\"' -I/build-gk/on81-patch/proto/root_i386/usr/include -c -o values-Xa.o ../port/gen/values-Xa.c -W0,-xp     "x!x!Lo66- B776 B77? B77 Hd:d:pM??Stt Y_T gsspluuuvv {vvvvvvvvvvvv vp= LT8$  \Gmule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/wrapper-solaris-sparc-320000755000175000017500000033363010567556635031334 0ustar charlescharlesELF;44 (44vvvvD5zz/usr/lib/ld.so.1a_  #$&')*,-/024678:;=@ABCEFHKLNOPQSUVWYZ\]^_`acdhijkmopqrtuxz|~    !#$&'*,-./0124568;>@CDFHJLNQRSTUWYZ\ !"%(+.1359<>?DGIJMRTX[befglnsvwy{}  "%()+379:<=?ABEGIKMOPVX[]^x l` (݈ 4=L Ww\ye vy\w P   '  l   "yh,($  < Z rxyv~$P yz | l8 wpyyx< v! 0 4 Jl$ _$@ t ` z|% w{ w  x*  w4$$ . A X kyt{D ( | d '  |zLH x \, }1 6h EzK\ Z( o(<  x|(  v {&  z lT |vyD* 64 Ez@LzdSx0X gzv)  d )$ |"x x T ', l0 $ t ?  Q$H nT &\  z& \0  'x  '@ x'(P wPt #d ; I|] k&P  ~(0     zXx`(p 4 wE |& . B, R*l X& i\  t{|zpx${xTy&D  %@, (,  "| 2y 9 L| `(d  uw |y  `P  D |  4h &h,    w@ ( : IH ^| u{ x@ x G( T   { { L y  +4 A(8 P( ^ $l e vD v    M  Hd    ) w { ո )l EP  Q ]8 w, `   R, wvt |  X0 {  x xH $ / ( ;y Bx  I| T` a&  t &  Tl z vxl v '   |  #S 6 D \j|| y, ? x )    *  0D x {L D 4;t ;|Ov Wx@!\\ pxu( (H w( i00 y\ z(l( |{ H$ @'{4|Fx UPbd  p{v x|w|Ud  xQ  &{y4z!=y8JwOUx t ,8 lT %8 $$ ӨX t{I$ w|(wdר` yP|*\ :xA( L az4hC\ ul HH L(00 !  D y|vD8 Vx@w/z;w8E| MvTy,]xxh&  y L %lX  ` k` wQ|L |`wL{ )wXlocaltimeevaluateEnvironmentVariablestimerRunnerwrapperLoadConfigurationPropertiesputsgetpwuidwrapperEventLoopsigemptysetstrrchrworkLogFileNamejStateStoppedwrapperLogSignalledcheckPropertyEqualreleaseLoggingMutexregisterSigActionwrapperGetJStatewrapperAddDefaultPropertiessigaddsetsetConsoleFlushwrapperUpdateJavaStateTimeoutwrapperStoppedSignalledceilatexitinitLoggingnanosleepsigaction_environwrapperBuildJavaCommandlogFileMaxLogFilesgetSignalModeglobfreefopenpipegetenvwrapperBuildJavaCommandArrayrealpathgetBooleanPropertyhandleDebugJVMTimeoutsigActionTerminationwrapperStopRequestedwrapperFreeJavaCommandArrayopenlogsetLogfilePathputcharwrapperOSwrapperReadChildOutputgettimeofdaywrapperGetLastErrorchdir_finisigActionChildDeathinet_ntoasigActionInterruptgetLogLevelForNamewrapperSetWrapperStatesendLoginfoMessagepthread_sigmaskwrapperRestartProcesssetConsoleLogLevelprotocolSendBufferisQuotablePropertysetConsoleLogLevelIntqueueWriteIndexmemcmpsigActionQuitfprintfwrapperGetTickAgeloginfoSourceNamemainjStateStoppingftellwrapperExecutereleaseProtocolMutexgetSyslogLevelIntumasklog_printfMutexaddPropertyPairinet_addrcorrectWindowsPathwrapperArchsetLogfileLevelIntgetrusagedaemonizevalidateTimeoutqueueReadIndex_exitpthread_equalcommandPollsendPropertiesstrtolfflushstatloadPropertiespthread_creategetLastErrorwrapperBuildUnixDaemonInfolog_printf_queueInnerthreadMessageBufferlog_printf_queuewriteStateFilewrapperStripQuotessetConsoleLogFormatdisposeInnerPropertyreplaceStringLongWithShortlockProtocolMutexgetOutputFilterActionForNamegetInnerPropertysetLogfileUmasksysloggetLogfileActivitywrapperGetCurrentTimewrapperSetWorkingDirsetLogfileAutoCloseflushLogfile.udivcloseLogfilememcpywrapperSetJavaStatewrapperRestartRequestedwStateStartedlastLogfileActivitywrapperGetPIDgetLogfileRollModesetSyslogLevelIntwrapperVersionBannerwrapperPingRespondedwrapperData.umulasctimesetSyslogFacilityanchorPoll.divwrapperProtocolGetCodeNameconsoleFlushsetLogfileLevelloadPropertiesInnersigActionHangup_initlockLoggingMutexjStateDowncurrentLogfacilityLevelprotocolSendBufferSizevsnprintfwrapperVersionsranddup2setLogfileRollModelogRegisterThreadsetSyslogEventSourceNamewrapperStartPendingSignalledpipeInitializedsignalprotocolStopServercurrentLogfileLevelsetSyslogFacilityIntmemsetexecvpwrapperAddToTickslog_printfwrapperTickExpiredjStateLaunchlogFileMaxSizegetIntPropertysetLogfileFormatcurrentLogFileNamelogFileLastNowDatepthread_mutex_lockwrapperDumpMemoryjStateLaunchedlogfileActivityCountchildOutputBufferSizessdwrapperSleepwrapperLogChildOutputwrapperProtocolFunctionwStateStoppedappExitinsertInnerPropertywrapperBitswrapperClasspathSeparatorwStateStoppingforkwrapperReportStatuswrapperKillProcessNowgetLowLogLevelqueueMessagessetEnvsetInnerPropertywrapperKillProcessmalloclogfileFormatsendEventlogMessagewrapperParseArgumentsgetStringPropertylimitLogFileCountunregisterSyslogMessageFilebindlogFileUmaskjStateStartinglimitLogFileCountHandleFileaddPropertylogFilePathgetLogfileRollModeForNamewrapperSetWorkingDirPropwrapperRequestDumpJVMStatesetLogfileMaxFileSizewrapperRunServiceautoCloseLogfilewrapperDumpCPUUsagesigActionCommonlogLevelNamesremoveunlinkpropertiesqueueLevelssetsidstrchrdescSignalwritePidFilegetLogfileLevelIntgetLogFacilityForNamesetLogfileMaxLogFileswrapperGetFileBaserenamesprintf_GLOBAL_OFFSET_TABLE_getConsoleLogLevelIntremovePropertycurrentLoginfoLevelgetSignalCodeDescwrapperStopProcessconsoleFormat__deregister_frame_infotimerThreadIdthreadPrintBufferwrapperGetSystemTickswrapperGetTicksprotocolStartServerfgetswrapperUsagetrim_lib_versiondumpPropertiesstrstrsetWorkingDirjvmOutwrapperInitializewrapperStopPendingSignalled_startcurrentConsoleLevel_etext__ioblinearizePropertiesglobinitializeTimersetSyslogLevelacceptwrapperInitializeRunwrapperJVMProcessExitedgetpiddisposePropertiesputenvrollLogsqueueWrappedtimerTickscreateInnerPropertythreadIds__dso_handlechildOutputBuffersigActionAlarmpacketBufferlogTimerStatslogFileRollModefcntl__register_frame_infostrcmplogfileFPpthread_mutex_unlockwrapperBuildJavaCommandArrayInner_Jv_RegisterClasses_endwrapperGetProcessStatusbuildPrintBufferprotocolMutexcloselogpthread_selfrecverrnoensureSpaceInChildOutputBuffercreatePropertiesjStateStartedupdateStringValuedisposeLoggingmaintainLoggerwStateStartingwrapperProtocolReadlistenqueueSourceIdssendjStateKillingkillthreadPrintBufferSizejStateLaunchingfcloseforceFlushwrapperKeyRegisteredstrdupprotocolOpenloadConfigurationwrapperStartedSignalledqueueThreadIdslog_printf_messagecheckAndRollLogswrapperDisposewaitpidthreadMessageBufferSize_PROCEDURE_LINKAGE_TABLE_generateLogFileName_DYNAMICwrapperProtocolClosesocketstrerrorstrcasecmpsetLogfileMaxFileSizeIntgetsidgetSignalNamegetThreadIddisplayLaunchingTimeoutMessagewrapperGetWStatewrapperBuildKeyatoiwrapperRunConsole_edatastrlenkeyCharspipedesgetLastErrorTextstrcpylibsocket.so.1SISCD_2.3libpthread.so.1SUNW_0.9libnsl.so.1libm.so.1SUNW_1.1librt.so.1SUNW_0.7libc.so.10 zt?I =(Yb zt?n ='x =( ='xv@v8v<(xHvtvvVvvvvvv$vMvvNwwKw2w(w44w@wLZwX^wd4wpw|w/ww'wWww wuwIw,wxx xx$x0\x<"xHxTx`xlxxOxxxsx1xKxxBx9xxxy#yy Qy,Ny8&yDWyP6y\yhyt9yy!yyyyDyyyy y zz^zRz( z4<z@ZzL@zXzd[zpz|*zmz$zzG @D# @"@@;, @ "@+@@㿐/#`  @  `@@`" `@$@`````@q`  +㿐㿐/ή`  ``@[ ```$ `@P㿐X% x'@2$@2#cԦ$@;b? @3-1#ؐ!@0# @3#?@%c?@3 ?#0@3 ?P'@3    c, ?@2? *c `c H@2o! `"`H4 '?p @6Ѱ 0,#?# @ d %#`H? cc!`? #Ȑ$@$`H@H @7   ?@6`x   @%ހ?$ @ ?+c?`()    ??7@ P'7 @ ?Qc@,  }`Fc 0 c`( 5@6`0`(`,``#\ @6^?@:@ @? c@}? c?$c? ` ` `4ࠀ "?@+`?@6: ?@6'c 0 ,єc `, ( #?a @6!c .% 4@H ?R@+ ?@6a@@?c@2??$c#`"?@+`?@5 ??! @5!h`,Z @67 ?@5ݔ!@?c@?Җ?c`Ԁ @6 a?@5ƒ x%?c#c_ '@?F$c'`3c @˔ ?? @??$>"4 "?@+`?@5 ?` @,@5%ؐ?@5| 0'@?@5p c@*  ` @5" ?@5\ 㿐!#?@}??$#c `"?@*b@?@5> ?㿐. :`?`2(`Q C`@bh!="p:bx7"41".+(b!%""b"*> !ߒc @ 0# ( 8cH!#XchEEEEEEEFF\F\FF F,F8FDFPF\FFFFFF㿐-@.`:` scx @  %! _@̐$ %??)# (! !* @ݐ   @ڰ ?C# 9;?@*? +@6c0 .`.`F:` ?@6 !'cࠀ`?.`.<  %В?@6o ?#c@@h @ܒ#'@%ޓ* 72`?!ϔ @ ? # cPϔ @~ tOϐ )#cP. ],< `E#(`1S  @ecP@ @W'@U#$@* 75 +  @& , * ` @w @@ @AcP@ݒ @;cP@ג @Ӓ @ϒ @ cP˒ #` "ƒ < cP!? @3̒  < cP@  < ` ?@3 < `π/ . -` 21Q3 ? 8@3 0@)'  _@ @ @#  %` @3'X?@3 0#  ?0ذ #JJJJJJJKKJKKKKKKK@K@K@K@K@K@㿐!@r"!! @$##?" " p 3@ s   G?@! @*##$& & P& & @*& #&! @5"a ``x@6  @6( @6.`@67 @6n @6~ @6 @6 @6 㿐 '`K@ -##`#`?# # `# Ͱ?`#K``5 ?`# # ` @@2 /@L 2 @F . 2$@ @?,@@@ $ @`?`# ?# # @@ /@@ 2 @ . 2$@Ԑ`@#!.@ @ @'@a0@!x@a@@@b(@@ %@0#@bP!@"@ @ @b@א#@@ؐ @ؐ`@Ր@Ґc@͐ 0.#@@ /@ 2 @ . 2$@m @,@@@c $ @Y``?m# 㿐 @^ 3 ? G?@1#?@)" p B# c?@2  #`  ``8! P?@2 @!#? #@3?"#?$##?#4 @1 h# `"?@'z`?@1 ?㿐 @  3 ? G?@1#@(" p ;? @1Ԕ`#`  ``8 P?@1ƒ @M!k#? #@?#?$##?"`4`h@1 # `"?@'/ਐ?@1 ?㿐9#`Ȁ` ` %?`@3 ```2#``M `N`O`G?#`##` #`?  @3#㿐@ # ?N \ +`;"" .@  &N .@  H`\`"2.@ .@  .@ .@ h 4'H@-pa@o@L H&`! (@=@a0  @X$?!@}!8   @J$?+  p)!@@/@-7 "q)L" "!@\ -"9@S!`? ;@0ah@ *.&+@Aa/͔?" T@-ea@ېH`& @@Ր H@ .@ & @ 2-(@"@a @-& "ת@͐@ "0## @,a袒 -o`&  @ .5&@c @,b @ " @v .& @m  5c /! @,"( ;@{.@x@ @SH &@m  @hH`\J%H@6  @4 .9&@,"h 6@*$H.  &Ǩ$  bx@'c @,5  @1 ̀"H K\" '@☀ @.#@`\@ H &+c/ \@   @%.4;&@Ӓbc8   @/.`89&@"ж "@ c. (@.|-c``@'7c@.%c@'1 c@'-H@.|'@.f @.1$``@'X $`( x 1@'P!'`,`,!?#@}' @'A$`0 0(d , ,#瀢 4 # 0`?@* c#; @'(`#%8`8 $c`( Ac##aX%@'#$<`%#``$c`t@/c#@% c$a# ;!,@%{c#%a?c c(@%'$a`# @##@0a #a$@,"a #'a$#"-%#X!@ c@% #"a A#@* $a  @ݑ+ %$a@63#;/`X@͐c @$#,`@ @Ő #$@a @@cx@cp@$֒#p@$ [ #$@ՠ`# lc#c% @$a0 ]  @@ @$a0# `3##c@$ a4 $  @@u @$a4c  '#c! @$#Ƞa<' % " @|@Y @z$a</ @$pa@  " @g@D @e$a@! @$#  #@$ . .#@$   #$aD c#!  @$z%  c @$s . . @$l  o c$aP8#@$b #$aXcX@$[`H#cX$\ `@$S#caX$`!@$K x#cX'ad@$C #cX%h# @$;`#c!X$l`@$3 #cX&!p @$+#cX%t!@$#!#Xc$x@$a0@*#c#aH@$. #&!|``2d?c @$#a`c x$a#@#Ɛ g#Q%a @#  @#a!L `"lc@~@~ @~$!Lcc@~$!L#@#ٔ T#@~/$a@@~$a<@# !8 `"#@~@~c @~$!8#@~$!8@~$a4c @#q!, `"#@~h@~E @~f$!,#@~h$!,@~d$a0- @#Tآ!( `"#@~K@~( @~I$!(#@~K$!(@~b` ?l \#,` `@~;#!! @ ## 1@&!# $a "P@&?c?@&ݒ #?aP@&ג ##`|`?@&В #1#`"@?@&Ȓ # #`⨘ #\? #@&bw#\? - @&a#\? / @&K#\? @& 5"#\? @& 1 @##8$`9@* c%?" @ c#4;# @cP?$`< @&lap##`8! @&e?c@ c#4!# 0#!?$`, @&Q @)0a#@}` `? @&A` ? @&: p ?$` 㿐5` `@&(!(? @&"`㿀!#` 2^ ``I`M_  eB #  @# M   @,@ M? `\@} .? J@?@)#@}a(  p#|aa( @| q @ ђ  s @}0 `@%Đ? o!0 f?aX@%#㿐1# `?` L`|` ?@+#|@5@#@%ap#㿐#`  ? @%a0㿐7? @%za` !` 2#``M`N`O`G`H"#` 2?#`#` aВ?@'k #` ?@'_ 㿈!#` $`?? M L `8 M:@ @'` ?@|@'@@# ?@%b #㿐5 `?`  N  ?@`@@  N@$bh㿈!#` `8K M`? < `?@@@i'bа ?@|b@'@j ?@$̔b#㿐7` D``K`ME  e `  @: `  M@f@1  M?`| @'| ` L@R 3 @ 4`p  4 @[ @  L? ? @$zbXb#@{c?@ w c@{y#c @ l?#@{nc?@ a c?c0@ [ c?cP@ U 㿈 @{&@{#6 㿐!#?#@{[?c?$#` "?@`?@$ ?c"4㿐ް @{Jc㿐ް @{Rca8㿐@{= /@{V 2  .@{P 2$@{  @{I.#`݁c㿐@{ /@{2 2  .@{+ 2$@z @{$#@{!,@@{" @{"`@{!0@{x@{a@{ @{ a%@{(#@{`@{ !@{"0P@z@zb@z"@z @z@z@@z @zc`@zc@zc@z߁㿐3c`a( @#sc aV?a .J@ ca &a 0G@zŐ cc!$`[ `\;? c@#M  ?c(@#F #`2!c` 2c``M`N`O`G`H"c` #`#`? 7@%8#c` 3 a @%,?㿐c@  s> @zN㿐7`` ``#``M`N`O`G`H"` 2?#`#`?a@$ #ࠀa?@$ 㿐!#" X" T &@@y* &#`TcX? & `x? @"?@" ?c@" ? @"`8@"`| `` 㿐   ,   &, @yʐ0@y&㿐    @y@y &@y@y&㿐!#`% a`@# !x@$aʒ g$!㿐@yҒbp   [@y˒b`  \㿈` " #\? b @",x @yp@yo#< + d"%?(`@@y.  ,`*2 # *@ *`@@y d 2   (` 㿐&@  (`# @yG(`" 2 *`@ @ 㿐c @y{   ?  p @!ܰ 0 @"-?` @!Ѱ?㿐c @` "! N #@yN   ? `p@! 0 @"?` @!?? " * e t@ a!!a( !8 !HaP!`!h(4@LXd㿐? @!npc@a@x˒aЀ f@xŒ" `cऀ [? !"0@!P1"8? @!K5?@!G ?b@!B ?@!= ?# @!8 ?h@!3 ?c @!-5?@!) `?@!# ? @! ? h@! ?@! ?` @!58? @! 3aP? @!"0 "8? @ ?@ #caL aT c` vaL@xYh [cc``2W`􀢠2S``MN`NL`OJ`GH?!@ ˒  - c`Ȁ(;c`c%!P4 !H4=8'38-?! @" c 8!8 " !p -@x3@x2@x, d@ʦ b?@  cP$T+aP@xb8@xc˘ )9Ę!`? @ pac㾸)#a@ aHl #` a@@w̒h Q# ##b`@@w  ~   `?@ #i P@wܔ +@w 2*@w 2*@w  , L " h@w 2&? !@ "p  `Ӑ@w#@w@?#D>%H@ S'#a@?@ ##@wyb   @w?? -@F Ѐ`/@wa  @wZc8  #? @˖`@wL@ 2 ? #H@@^ `-@w<p Z c@ِ  Ȑ? @`@#5p@w! !@"! ? @@##z #  @# `/0@v  pꭔj`-@v @"~#ܔ`H@v`8 2@"ِД ? x @\0͐@vޒc @vג8 -@vВ؀ L   !@vƒ " @v #"``a#a ? -@v耢 #" @va@ ## /@vP #"@va` #"p@v #$ @v耢  @vya@  @vrP  `@vk  #@vdap " - #a@!?@ђ #@ d ? @ǔb@l#p+c`̀ 7@ `?Kc`􀢠"```x"`a"Ua  ?@ac``c`#!4aP !H4;8%38) - ?@  c 8!8y" !p ;@vb@v@v ` d@ ;b? @i]c%P@ub8@uSc͘ '9Ƙ`Tc!&j! $! V  H`O$ Rc ; $ $ c!<c  !t;@uĐb@uÐ@u` d@[ b?@ c` )`!? %@u8@ucb  b0? @c$ $ S P H ?`@ c  $!!!6S! `@  H8$ c $@ # # c!<c   !t;@uRb@uQ@uK` d@   b0? @@c""  H ?`@ c? -@? @bc` c`;4P aH4+83!8` # a?@z c 8!8V" !p ;@tb@t@t` d@ ;ݘ 9֘`! Ac! ?@:cWc`pj"a`c U% HN$ 5 `: $ $ c!< u !t;@tb@t@t` d@> " @?c`"c-h@tb8@tF  !"0? @$ $  6'3 H?  @`c`%'@sے@#Д#@ c >c``"c`!4P !H4*83!8- a?@ c 8!8" !p ;@t%b@t$@t`! d@  ;ޘ 9ט`c)`? #@qc?b#􀢠62`c``2\c`);@svc#@#Д#%@ >c`"c`-4aP H4*8/38') !?@I c 8!8%" !p ;@sb@s@s` d@ W ;ޘ #9טa`c!`?  (c"㿐#c̀`7@ `?@" ) #c` @ c!?a@@sA Z? 1@є %? @̔8c` c`534P aH4;8738` a?@Ĕ c 8!8`" !p %@s;@s:@s4 d@ Ҵ b?@ c # 5!P8@s#@s$c͘ 9Ƙ!`@r H?@t ?a@o c`c`%!4P !H4*813!87 a @g?c 8!8`" !p %@rސ@rݐ@rא d@ u ޘ 39טa`@cn$ @ ? @'(@ ` c xS5 `2A  I$ " +c$ a< 9$ `c%at @r@r@r   d@ ,?b@ #b8@r@rB   ?0@ܚ6%3 I?  @`c 2# c Ia<$ $ $ `%at @rM@rL@rF Ð d@ ?! I"` ?@ @ 6 ucc`"c`1!4!P !H4/833a8 7 ?@ c 8!8" !p% @r@r@q   d@ o?8paP٘ 59Ҙ` %@N@ hc` "c`534P aH4*8738` a?@A c 8!8`" !p %@q@q@q d@ O ~ޘ 9ט!`@"c`'c G!<""." X%!t @q@q@q   d@ !?3b8<9 Gb` ?@ c㿐` 3c` Lc` Ec T 7  X`? ? # X# n#  "h1?@"pc 1@"8⨖b?@ ?"@ ?(@ ?cp@ "8?@ c?@c@ 9 c?;"`cu 2c` #  g!䜔"h c`#`? @\ cc "c?`(@P c?@J ܐ @  {3@@p @pȠ"@p''`'`''` '`'`'`'`'` @p'Ȓ⨔@p-@pO`@+?ߐ?@  8 @p  '@p''' ''''' @p'Ȓ⨔@o@p! ?*ߖ@ޔ`pc `^@_ @pb# @pt'''' ''''' @pb'Ȓ⨔@oː@o` +ߐ?@ 8 @p4  '@pF''' '!'''' @p3'Ȓ⨔@o@o*ߔ ?@| 㿀@%`#aT #aH#`#`K#`` A?/` "0`?@W )? !@#`1@ V  #`5 ``` G"`  c  ฀`!@@#` `̀ 2`@2$܀ @3t r` 7`:`+`4 aH`4,1`3a8! >``ې`#`#\``!#d !a#h5Ȑ? @ƐQ ' ` `G$ `H  `"`3`4 aH`4;!`3!8?bP@ ``4!`4}`8`3! !`"x? @}฀  `83(`+sa€`9`D/?@] SN ``'`L  T`7 X? ?# X# # +?b 5@3p 3@-b8?Ȓ #@&b?b @ ;? c(@!? @#pb8?@ @ Ɛ ?#`@  ` +  d*c c x$[  `2I  K$ c 2$ a< s$ `6 at;@nhb@ng@na@ d`` ?b @T1@nR"8@nRK   ?b0@c! K"` ?@ c2*  Ka<$ $ %$ ` at;@nb@n@n` @ d '@n 8#Ɛ K?  @tb`c? @Z@  Lc1?#8@Q U ` '`C  T`2 X1? @8#P0)@Ԓ ``M ``"``  T`55 X? ?Ѐ # X? 5#@pc 3@b8⨐? c@;? b@!? @#(?#p@ b8?@ ? @@  v@z p`A ``"h``ʒ ` T ".+ X ? ?# X`8 3@b8;? b!@ H?"@ ?(@ ?cp@ b8?@ ? c@1 '` ` "`` &@ r@ `?b  ?@h` 3 @ 7##`L2``+4aH  4>13a83 a?@W  4!8`" !p ;@lΐb@l͐@lǐ@e d ;b?@$   4 @  aH@l"8@l 8ɘ!P59˜``9`  8@ ז##` G2`"`'4` aH48+38` 5 ?@  9!8`a" !p ;@llb@lk@le @ d b?E 3a`@lX8@lY?8ϘaP9ɘ `8aP`9!`@I `5 e є  `$`  `M` MF$  2 $ $ !<` ݦ !t;@lb@l@l@ d ?b@e 8@k@k   ?b0@P$ $  ! M"` ?@Q `2*  M<$ $ `$  t;@kb@k@k @U d +@kb8m1j M?  @"`?@ ] eT#  $ G<$ $ H$ I t;@k{b@kz@kt{@ d`` m0 H- G ?`@ڔ ? @b0`8۴!P3`9Դa`3`4 aH`4#;!`3!8`+  #\ a#``a!!#d'ϔ`8aP`9ݦ` ?@a( x |$ @qw X@ rP&j`Ȁ G@ #e`>&`+?a@P 0.?@K $ Ȁ`!0? @@ah ?8@:  ?!@4 0#?a@. 0@c d?`@% ?`,4 4aH 4  3!8   8aP 9!`㿐% @j@j@j   d@"?b@ b8@jy@jz㿐!#`$`4 aH`4]`38#`4 aH44G1%387 ?@Ŕ #!8D" `4 aH`4(`33a8`##p @j/b@j.@j(   d@?b@ !"8@j@j`8ߤP`9ؤ!`8!P59``8!P`9a`㿐!`p#`  &`&``` ?b0@N#"`"`㿐#c GA$ Gc , $ $ c!<B #!t @ib@i@i   d@O?@ 8@i@ie  b0? @c$ $ V S? @b`c㿐!## X? b8 3?? bp`## X@#@b?@ɒ ?"@Ē ?(@ ?cp@ b8?@ ## # 㿐  3 @ ## `L 4Ȱ  4 @ r 㿐1# 8 @ e## 9` G 㿐!`#` v` #`TȀ b@  #?"@ #㿐7` ! dc܁  ? #x  K`?@;@ ? "` #8@0?㿐!`!#` "` #`T? bȀ#P)@@Ő #?" @ #㿐!`#` ` #`Tc#? #@ @@| #㿐!`#` ` #`T`H 8? #Ձ@ @q@T #㿐`#` `  @@< 㿐!#!(`,!,`$!8`!<`!4` !L t@g@g@g#@g#@g#@g#@gߐ#㿈 {c `|!??@h h5*5v @€a ``I(`v"@#\?  ? @Fb   M@g  b8@g   1#\#`"H??@* 07@g ??@  ͂b7ʂ5ǂ3Ăb!3b7b#5#?c?@ @LXdppڸ|ڈڔڸڸڸڸڸڠڸڸڸڸ<ڬڸڸĝ㿐@gw@gw ;c `}?@? @ca|mf"?`ge c??@ 0a?? cx@?슁2;c ``2?@g@ I@Ӹ?? @ ? 0 @c?? ` ?``M`N`O`G ?7@hX?ݷ c`Ȁ ?q 8?? 5@Wxc?@&acζ#x @@f @f@f @f @f @f   @f L )#` @'/;-@G d `" $$@ # $(`? +`  +? ` +#`? 0ߚ@#\͠ @#?@Ӓ '?ax@̒ )㿈!#. `#(`#*'*`' @f#  a?@ 01? @! 㿈' P`@   `P@eע`,` P" ` @e P#`P''뭔 L`; 耢  ! L,` ?@l!`@ *`@e}$`P @    @  P"`@  0@eP@ed P$@@e@㿐! @ea  $ @r?@\@e?5 `#`` #`a\@e7 @e   @e  ?@_! @@W?b`!! 2!3$#@:&c# @e Y# @e   Fa0"4yl@eo8@em@eg 5@ef@@eg0c!4bH? ah@eSc"8@eQ@eK 3@eJb@@eK0?p@  @ b?b@  @ 7"?@  #!#?ز ? @ȑ2@ w@ ΰ?p#85P@eE@@ b? @ hP@dn 㿈c @@e3 ɀ UD ș: `3?c 0 `&(`y"X@ ? @Jc 0-bb"c? @*#p b "@ ccؐ?@ hx7䀢?訐ܸ   @#+$@, * `$ @d V @-+-ߠL (`?' , `@ v@c̐$`ߔ#$@d`` *?@c%?  1?+@ 2آ`0G@c$` ߞ$ `& @c`` *@c%!"  @ "?`@ n  " ! ?-.@ @cw$` %$$ @c  @,@c%㿐5  @@d  3c @a  ?c`  O@: @c  6c@ sX?@+ c㿐@Y?@C!#` m@c ]W@c?F @cݐ  @cے ?@c  @c@c  @c@c @c  &@E # @c  )# ؂@4 @@ !1? @ Ȕ 0 #?@  0@b0@ ? @ `  !@b @ ? @    0?`x@  0㻐>  @L @@b @ a? @   0@bՒ / *@c  @ !XO  !#@@b  #@bߒሀ #t@  0@bҒa  ##@b˒a X  #`  ` O@ ^  #@bX#@@ba ##!`@ @  #@ #L`U#(`.#!,`Þ@b#@bd#@bb8@b` !@b"@@b0@ 6# a,a@ ڐ?#"a,@b#@bfa`"8@bd@b^` @@b]@b^#@ #a(1? 2!@b#@bCx#@bAb8@b;` @b:b@@b;#@ !#aL? "|@@b"8 "o##@aH0Sa8?@ ~  b㿐@b b8@b@bb@ @a@a 㿐? @ k`@c@b   @ ? @ ] X * |!@ ab" " c#!c|pĂ `|(`"@ a " bb"!T`lxH㿐@a``@a??  bh?"? @ 㿐m fb㿐d@ay?@ay ?? `@?"@ ƕ @ İ?c @ah?  @ @ X㿐<??c@  c `??*?   @ 8[㿐 fcx㿐c!cp'@a&ؐ 'Д @aH  @  ??c@ e 㿐#?` w  !@a, @  ?c@ 4 0@ 0c|b'@`ؒР  'Д @a 3|@ nc??  @ $?#`"`"`!w! @` @ M1#? @ 0w?c@ !$'@`' @`˔  |@ 1#?? Ę H@`' ' @` " |@ !#??  't@`zx  'p @`p " }@ 1#??  X`l@`d'T P'P @` " }@c??  8`@`M'4 0'0 @`q "w@?# ?j # `dacށa@`S  `@ ?`@X@`E?  #@ ?`8@_@_#h#\l#@_#``#dd#h@_##l h @0?㿐! #ߒ" @_;` $`d $ @_r  `@ @_U*$`㿐#c @ @_! c  G??#?a0 $cҟ@_n@_  ?`@@;  @?!!# "` ?@Ք!㻐@^  /@ ?a@ @_ * @_H @aX? ? @a8 㿐 "  @_#@ 4   2 &` `2 `&&  &`&`&` `2 `&$ 㽐.@N R@^ % G % @^ڐ A$@^Ô*=@^ڐ $$* @^ 2 .@N`2֐0"@^&@@^&@$ 2.@@^&@@^f?c  '`"?@   @^M @^* & @^H@ @@ `   *` *& @^=& ?ނca@@^  ??ިac+b@^ e@^D 2*@^> 2*L `? `? `N@ `? `?@*;#@]  N@ `"s`# `?@   @ J` #_ .@   @]֐ "N@@J  `? `?@ "N@*? @J  `? `?2*N@   @^ 0@@]ْH"N`N@`#@]Ӓ =  * @Z 䀤 ` 4ހ bՒ[Ԁ  L` "   @ @  +?  `?| @㿐  @] 4 `  2 ```` ``"&`#`@]U@`@]R$@$`@]O0& 㿐@]>@] @]9N@  `? `?@ @:N@`N@ ` ` `?`?@@*`N@  `? `? " ?N@  `?`?@ 8?" 2@ ,@\@\ِ @\N?  `? `?@  @:N`N ` ` `? `?@@*`N  `? `?  " ?N  `?`?@  8?" y  .@]     2 `Q D$ $ @\ 7@\ǒX+ @\ @\@\@\h @\@\@\\ @\Sap@], !@\!x0@\  @\f@\c@ @\> @\8 "" " " @\R@\/ @\P$o@\f@\aB,㿐! .`@\4@\0 @@\Z>` ` @\Q>` `   @[@7- @\;>`  @`@\$ *  @[@[ =*@\">`  "  @\ +  @[@[+@Τ`,㿐  @\     2 㿐@[ "" " " 㿐@[ @[&& @[b 㿐@[ "" 㿐& `&@@[``@[$@$`@[ 2@@[㿐@[@[`@[a@[Xap@\1 @[!x㿐@[nN  `?`?@  @:N`N   `? `?@@*`N  `?`?  " ?N  `? `?@ 8?" ".@ @[R.@?a@[)?a  ? a@۰ 0@[@[@ = ` (@ư 㿐  @[I     2 ``㿐  @[0     2 ``@[@[@ZӰ`?㿐  @[   2   @[m b cb㿐  @Z     2 ` ` 㿐  ! ? @C"  2㿐@Zu @Zm"N ,@@[  2 @L`2 ,@@ZpL ,@`㿐bp@Z  ,bx@Z  %@Z}  @Zv  "@Zo  @Zib  @Za`?* 㿐bp@ZU  1bh@ZN  *@ZG  #@Z@  "@Z9  bH@Z2  @Z,  !@Z%"؀`?㿐b@Z  :b@Z 3@Z  ,@Z %#@Y c@Y @Y 1@Y#  !@Y# ` P 㿐 =@Y  @Yg 4 @Y6$,*;``M"'`k`K"$И ;`` - `?@ ,`$`m'@Ys!ߖ $ @Z$ @Y\㿀\`   @YH@ -M?`8`(`  `  @Y0`   Ѐ  #`Ԁ@ Т +Ф @Y@6M?`l (`!@ @??c(8@X @ @ ۢ`+@X˒cH@XcPc`chpx#ޑ.`@ǒc”@? ?`Q#     #\#`lc@X      #\#` l#dc@X@Xo$`q%@Xj%k# ԁ(H0\||tttttttttlttttttt㿐@X/3@X|c  c,3@Xoc cā # c  0@X$ @W`(  0 `@ `PcŔ h @Xؒ#'@Xܪ@XiԀ଀@-@<`'J@6`!#2o`/@P%؀# ^!!~ c@X)-!@X(` E$@X ؀ !5#@-@@Wݐ`h@X} `w@s@̔@ʔ0j@Wc)"#\#`K 7@W/Hܤ&H@W $ *@!!@W]  @Wے`$! `` l @WK`#`'#\!%!@W` "f-@X!b-@W c@+      + @Wf` G 㿐'P'T'X)@W3 (@W c@+  @    +  @WG`9!ߢP d ̀`"$'  Ȕ@Wߖ ̀@`@Ẁ@ ``d& @V?$ Ȁ`   Ȃ`d$&&@VՐ d $ Ȑ @V (bށa,㿐`8  .` P@  cߒ @W!@W@W    008@@H! ؀ ~/# -+X'ߒ @Vac Ma@Vؒ  `@Va  "` ` a@V`@WH $ca@V~?@VSac a@WD ( 4ac  @W7a /⸀`+`)` n#!a!%@Vr @W 0aP@Vj` " aXa!@V#$ *㿐@Vy S @.` @Vl F&`@&.`@V| ;'`@V, @V́ @V@Uݐ &@U'.`" @ #`&.@VP @U&@U@V 0x@U. ,  $@@Uǐ@U @U$@ ؔ @U؀`  @U , @  , 0@U,  oؠ  0@U#`4`!  ]`؀ @VY   P0a@U@V5 0C@Uh ⸀` ` w!.@U (! ؀ ' !%! 1! " !!d`!*!,@U%$ ,@㿐'T'X d T@U@U L&   @U 9@U c@+  @    +  @U `1 9 7#*";a "@' 5&L&@ && #+@T + $ 1#@Tڐ0 d㿐!% Ā@(/@T( Ā  LcĖ?+` @Ē`` $ $  Ā@@T(*#c@ +   #@# +   #@  㿐@T . @" 㿐@T c@+  @    +  @T`㿐%@T` '`)@T`@T^@T\!@T0 @TQ$@T+$*@T'%!*ށ cށcށ c b݁cX߁ `߁`㿐"`߁ `߁ ` aH aH㿐߰ @T`(㿐߰ @T`(㿐!#@T (`ؐ`@Tca$`*@T (߁ `ܝ㿐!@S (`؀ @T@S ( b݁cX߁ `߁`㿐"`߁ `߁ `߁`㿐"`ށ c㿐"c ߐa݁cX `߀ ` 4㿐@T\b  㿐@T c@+  @    +  @S`) % '+``" a " 1$!L&$ $ % +@Sa + $ 㿐/S`@?㿐㿠Ĥ㿠o0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_set.WRAPPER_BITS=%sset.WRAPPER_ARCH=%sset.WRAPPER_OS=%sset.WRAPPER_FILE_SEPARATOR=/set.WRAPPER_PATH_SEPARATOR=:Unable to open configuration file. %sProblem loading wrapper configuration file: %sThe argument '%s' is not a valid property name-value pair.Unable to resolve the full path of the configuration file, %s: %s127.0.0.1unable to bind listener port %d, or any port in the range %d-%d. (%s)server socket close failed. (%d)unable to bind listener to any port in the range %d-%d. (%s)port %d already in use, using port %d instead.server socket listen failed. (%d)server listening on port %d.server socket ioctlsocket failed. (%s)server socket creation failed. (%s)socket ioctlsocket failed. (%s)accepted a socket from %s on port %dsocket creation failed. (%s)socket close failed. (%d)STARTSTOPRESTARTPINGSTOP_PENDINGSTART_PENDINGSTARTEDSTOPPEDKEYBADKEYLOW_LOG_LEVELPING_TIMEOUTSERVICE_CONTROL_CODEPROPERTIESUNKNOWN(%d)LOG(DEBUG)LOG(INFO)LOG(STATUS)LOG(WARN)LOG(ERROR)LOG(FATAL)(Property Values)socket send failed. (%d)send a packet %s : %sNULLsocket not open, so packet not sent %s : %sreceived unknown packet (%d:%s)read a packet %s : %ssocket read no code (closed?).socket read failed. (%s)wrapper.logLPTMLPMc%s.confWrapper (Version %s) http://wrapper.tanukisoftware.org Usage: ( implicitly '-c' and '%s.conf') %s [configuration properties] [...] %s [configuration properties] [...] ( implicitly '-c') %s ( implicitly '%s.conf') %s where can be one of: -c --console run as a Console application -v --version print the wrapper's version information. -? --help print this help message is the wrapper.conf to use. Name must be absolute or relative to the location of %s [configuration properties] are configuration name-value pairs which override values in wrapper.conf. For example: wrapper.debug=true--> Wrapper Started as Daemon--> Wrapper Started as ConsoleUsing system timer.Using tick timer.<-- Wrapper Stopped--> Wrapper Started as ServicewrapperStopProcess(%d) called while stopping. (IGNORED)wrapperStopProcess(%d) called.javawrapper.java.command"%s"%sjdbjdb.exewrapper.java.additional.%d"-The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.-Xdebugwrapper.java.additional.%d.stripquoteswrapper.java.initmemory-Xms%dmwrapper.java.maxmemory-Xmx%dmwrapper.java.library.path-Djava.library.path="%s%c%s"-classpathwrapper.java.classpath.%d"-Dwrapper.key="%s"-Dwrapper.port=%d-Dwrapper.jvm.port=%d-Dwrapper.jvm.port.min=%d-Dwrapper.jvm.port.max=%d-Dwrapper.debug="TRUE"-Dwrapper.debug=TRUE-Dwrapper.pid=%d-Dwrapper.use_system_time="TRUE"-Dwrapper.use_system_time=TRUE-Dwrapper.version="%s"-Dwrapper.native_library="%s"-Dwrapper.ignore_signals="TRUE"-Dwrapper.ignore_signals=TRUE-Dwrapper.service="TRUE"-Dwrapper.service=TRUE-Dwrapper.disable_shutdown_hook="TRUE"-Dwrapper.disable_shutdown_hook=TRUE-Dwrapper.cpu.timeout="%d"-Dwrapper.jvmid=%dMainwrapper.java.mainclasswrapper.app.parameter.%dwrapper.app.parameter.%d.stripquotes-Dwrapper.cpu.timeout=%d-Dwrapper.native_library=%s-Dwrapper.version=%s-Dwrapper.timer_fast_threshold="%d"-Dwrapper.timer_slow_threshold="%d"-Dwrapper.timer_slow_threshold=%d-Dwrapper.timer_fast_threshold=%d-Dwrapper.key=%s\./Classpath element, %s, does not match any files: %sClasspath element, %s, does not exist: %sUnable to get information of classpath element: %s (%s)-Djava.library.path="%s%c%s\"-Djava.library.path=%s%c%s-Djava.library.path=%s-Djava.library.path="%s"-Djava.library.path="%s\"-Djava.library.path=wrapper.java.library.path.%dLD_LIBRARY_PATHJVM process exited with a code of %d, however the wrapper exit code was already %d.JVM process exited with a code of %d, setting the wrapper exit code to %d.Unexpected jState=%d in wrapperJVMProcessExited.JVM already down.Unable to start a JVMJVM exited while loading the application.JVM exited before starting the application.JVM exited while starting the application.JVM exited unexpectedly.JVM exited unexpectedly while stopping the application.JVM exited normally.JVM exited on its own while waiting to kill the application.JVM process exited with a code of %d, leaving the wrapper exit code set to %d.AFIGNORESHUTDOWNFORWARDwrapper.logfilewrapper.logfile.rollmodeSIZEwrapper.logfile.formatwrapper.logfile.loglevelINFOwrapper.logfile.maxsize0wrapper.logfile.maxfileswrapper.logfile.inactivity.timeoutwrapper.console.formatPMUSERwrapper.console.loglevelwrapperwrapper.console.flushwrapper.ntservice.nameNONEwrapper.syslog.loglevelwrapper.unix.namewrapper.syslog.facilitywrapper.port.minwrapper.portwrapper.port.min must be in the range 1-65535. Changing to %d.wrapper.port.maxwrapper.jvm.portwrapper.jvm.port must not equal wrapper.port. Changing to the default.wrapper.jvm.port.minwrapper.jvm.port.min must be in the range 1-65535. Changing to %d.wrapper.jvm.port.maxwrapper.debugwrapper.java.command.loglevelDEBUGwrapper.adviserwrapper.timer_fast_thresholdwrapper.timer_slow_thresholdwrapper.native_librarywrapper.java.library.path.append_system_pathwrapper.state_outputwrapper.timer_outputwrapper.loop_outputwrapper.sleep_outputwrapper.memory_outputwrapper.memory_output.intervalwrapper.cpu_outputwrapper.cpu_output.intervalwrapper.disable_shutdown_hookwrapper.startup.delaywrapper.startup.delay.consolewrapper.startup.delay.servicewrapper.restart.delaywrapper.restart.reload_configurationwrapper.disable_restartswrapper.cpu.timeoutwrapper.startup.timeoutwrapper.ping.timeoutwrapper.ping.intervalwrapper.shutdown.timeoutwrapper.jvm_exit.timeoutwrapper.ping.timeout must be at least 5 seconds longer than wrapper.ping.interval. Changing to %d.CPU timeout detection may not operate correctly during startup because wrapper.cpu.timeout is not smaller than wrapper.startup.timeout.CPU timeout detection may not operate correctly because wrapper.cpu.timeout is not smaller than wrapper.ping.timeout.CPU timeout detection may not operate correctly during shutdown because wrapper.cpu.timeout is not smaller than wrapper.shutdown.timeout.wrapper.max_failed_invocationswrapper.successful_invocation_timewrapper.request_thread_dump_on_failed_jvm_exitwrapper.filter.trigger.%dwrapper.filter.action.%dwrapper.java.pidfilewrapper.java.idfilewrapper.java.statusfilewrapper.commandfilewrapper.command.poll_intervalwrapper.anchor.poll_intervalwrapper.umaskwrapper.java.umaskwrapper.pidfile.umaskwrapper.lockfile.umaskwrapper.java.pidfile.umaskwrapper.java.idfile.umaskwrapper.statusfile.umaskwrapper.java.statusfile.umaskwrapper.anchorfile.umaskwrapper.logfile.umaskwrapper.ignore_signalswrapper.daemonizewrapper.signal.mode.hupwrapper.anchorfilewrapper.statusfilewrapper.lockfilewrapper.pidfileThe value of wrapper.max_failed_invocations must not be smaller than 1. Changing to 1.wrapper.ping.interval must be at less than or equal to 1 hour (3600 seconds). Changing to 3600.wrapper.ping.interval must be at least 1 second. Changing to 1.%s must be in the range 0 to %d days (%d seconds). Changing to %d.wrapper.use_system_timewrapper.jvm.port.max must be greater than or equal to wrapper.jvm.port.min. Changing to %d.wrapper.port.max must be greater than or equal to wrapper.port.min. Changing to %d.YYYYMMDDwrapper.logfile must contain "%s" for a roll mode of DATE. Disabling log file rolling.wrapper.logfile.rollmode invalid. Disabling log file rolling.Got a log message from JVM: %sReceived a connection request with an incorrect key. Waiting for another connection.%dIncorrect key. Connection rejected.Got key from JVM: %sGot ping response from JVMJVM requested a shutdown. (%d)JVM requested a restart.wrapperRestartProcess() called.wrapperRestartProcess() called. (IGNORED)JVM signalled a stop pending with waitHint of %d millis.@@JVM signalled that it was stopped.JVM signalled a start pending with waitHint of %d millis.@@JVM signalled that it was started.Filter trigger matched. Shutting down.Filter trigger matched. Restarting JVM.------------------------------------------------------------------------The JVM is being launched with a debugger enabled and could possibly besuspended. To avoid unwanted shutdowns, timeouts will be disabled,removing the ability to detect and restart frozen JVMs.Working directory set to: %sUnable to set working directory to: %s (%s)wrapper.working.dir3.2.332x86windowsUNKNOWNDOWNLAUNCH(DELAY)LAUNCHINGLAUNCHEDSTARTINGSTARTEDSTOPPINGSTOPPEDKILLINGStartup failed: Timed out waiting for a signal from the JVM.Mainwrapper.java.mainclassorg.tanukisoftware.wrapper.WrapperSimpleApporg.tanukisoftware.wrapper.WrapperStartStopApp------------------------------------------------------------------------Advice:The Wrapper consists of a native component as well as a set of classeswhich run within the JVM that it launches. The Java component of theWrapper must be initialized promptly after the JVM is launched or theWrapper will timeout, as just happened. Most likely the main classspecified in the Wrapper configuration file is not correctly initializingthe Wrapper classes: %sWhile it is possible to do so manually, the Wrapper ships with helperclasses to make this initialization processes automatic.Please review the integration section of the Wrapper's documentationfor the various methods which can be employed to launch an applicationwithin the Wrapper: http://wrapper.tanukisoftware.org/doc/english/integrate.html Loop: check anchor fileAnchor file deleted. Shutting down. Set Wrapper State %s -> %swUnable to write to the status file: %s%s Loop: check command filer+tRESTARTCommand '%s'. Restarting JVM.Unable to delete the command file, %s: %sSTOPCommand '%s'. Shutting down with exit code %d.PAUSECommand '%s' not supported on this platform, ignoring.RESUMEDUMPCommand '%s'. Requesting a Thread Dump.CONSOLE_LOGLEVELLOGFILE_LOGLEVELCommand '%s' is missing its log level.Command '%s' specified an unknown log level: '%'Command '%s'. Set console log level to '%s'.%dSYSLOG_LOGLEVELCommand '%s'. Set log file log level to '%s'.Command '%s' lead to an unexpected state.Command '%s'. Set syslog log level to '%s'.LOOP_OUTPUTSTATE_OUTPUTTRUECommand '%s'. Disable %s.Command '%s'. Enable %s.MEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTCommand '%s' is unknown, ignoring.Unable to read the command file: %sJVM Restarts disabled. Shutting down.Waiting %d seconds before launching another JVM. Set Java State %s Timeout %08lx -> %08lx Set Java State %s -> %sThere were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.JVM was only running for %d seconds leading to a failed restart count of %d.Waiting %d seconds before launching the first JVM.wrapper.on_exit.%dwrapper.on_exit.defaultshutdownrestarton_exit trigger matched. Restarting the JVM. (Exit code: %d)on_exit trigger matched. Service is paused, will restart the JVM when resumed. (Exit code: %d)com.silveregg.wrapper.WrapperSimpleAppcom.silveregg.wrapper.WrapperStartStopAppThe com.silveregg.wrapper.WrapperSimpleApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperSimpleApp class instead.The com.silveregg.wrapper.WrapperStartStopApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperStartStopApp class instead.Launching a JVM...Reloading Wrapper configuration...ping DebugJVM timeout. Disable current %s timeout.%sPing: Timed out waiting for signal from JVM.The JVM was launched with debug options so this may be because the JVMis currently suspended by a debugger. Any future timeouts during thisJVM invocation will be silently ignored.JVM appears hung: Timed out waiting for signal from JVM. Temp: Sending a ping packet. Temp: Sent a ping packet.JVM Ping Failed. Last system time tick overflow at: %s Next system time tick overflow at: %s Last tick overflow at: %s Next tick overflow at: %sEvent loop started.no Loop: %ssleep Loop: process jvm outputPause reading child output to share cycles. Loop: process socketPause reading socket data to share cycles.truefalse Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%s Loop: exit requested Loop: handle wrapper state: %sUnknown wState=%dUnknown jState=%dEvent loop stopped.startupStartup: Timed out waiting for a signal from the JVM.startUnable to send the start command to the JVM.Start Application.Startup failed: Timed out waiting for signal from JVM.Shutdown failed: Timed out waiting for signal from JVM.Shutdown: Timed out waiting for a signal from the JVM.Shutdown failed: Timed out waiting for the JVM to terminate.JVM exitShutdown: Timed out waiting for the JVM to terminate. Loop: handle jvm state: %sSending stop signal to JVM Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (N/A), Exit=%s, Restart=%sWrapper Process has not received any CPU time for %d seconds. Extending timeouts. Loop: maintain logger(2) Loop: maintain loggerSignal trapped. Details:UNKNOWNSIGALRMunknownkill, sigsend or raise signal number=%d (%s), source="%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s) signal err=%d, "%s"mesq state changedAIO completedtimer expiredsigqueueSIGHUPSIGINTSIGQUITSIGKILLSIGTERMSIGCHLDSignal trapped. No details available.%s trapped, but signals for timer thread are ignored.%s trapped. Restarting JVM.%s trapped, but ignored.%s trapped. Unable to forward signal to JVM because it is not running.Unable to forward %s signal to JVM process. %s%s trapped. Forwarding to JVM process.%s trapped. Shutting down.%s trapped. Forcing immediate shutdown.Timer thread started.The timer fell behind the system clock by %ldms.The system clock fell behind the timer by %ldms. Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ldCould not mask signals for timer thread. Sleep: awake Sleep: nanosleep %dmsCommand[%d] : %sUnable to set JVM's stderr: %sUnable to set JVM's stdout: %sw%d Unable to write the Java ID file: %sUnable to write the Java PID file: %sFailed to set jvm output handle to close on JVM exit: %s (%d)Failed to set jvm output handle to non blocking mode: %s (%d)Could not spawn JVM process: %sCould not init pipe: %sUnable to start JVM: %s (%d)WIFEXITED indicates that the JVM exited abnormally.JVM exited in response to signal %s (%d).Unable to request JVM process status: %sFailed to read console output from the JVM: %s (%d)Dumping JVM state.Could not dump JVM state: %sSpawning intermediate process.../dev/nullSpawning daemon process...Could not spawn daemon process: %ssetsid() failed: %sUnable to get the path for '%s'-%sUnable to extract path from: %sUnable to set working dir to %s : %s?-helpv-versioncWARNING: Could not write lock file %s: %sERROR: Could not write pid file %s: %sERROR: Could not write anchor file %s: %s-console Unrecognized option: -%s Timer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.INTTimer thread received an Quit signal. Ignoring.Received SIGCHLD, checking JVM process status.JVM process was still running after receiving a SIGCHLD signal.TERMHUPUnable to register signal handler for signal %d. %sUnable to create a timer thread: %d, %sLaunching Timer thread.Call to getrusage failed for Wrapper process: %sCall to getrusage failed for Java process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldJVM did not exit on request. Attempt to terminate process failed: %sJVM did not exit on request, terminatedrt#includeset.default.set.%s=%sUnable to set environment variable: %s The following property name value pair is too large. Need to increase the internal buffer size: %struefalse name:%s value:%sNONE DEBUG INFO STATUSWARN ERROR FATAL ADVICENONESIZEWRAPPERJVMSIZE_OR_WRAPPERSIZE_OR_JVMDATEFATALERRORWARNINFODEBUGUSERLOCAL0LOCAL1LOCAL2LOCAL3LOCAL4LOCAL5LOCAL6LOCAL7wrapper jvm %-4d | wrapperpmain srvmaintimer unknownsignal %s%c%04d/%02d/%02d %02d:%02d:%02d%04d/%02d/%02d %02d:%02d:%02d.%03dYYYYMMDDROLLNUM-ROLLNUM_ROLLNUM.ROLLNUM.%s-YYYYMMDD_YYYYMMDD.YYYYMMDDaUnable to open logfile %s: %s %s wrapper.log%04d%02d%02dWARNING - Encountered an unknown thread %ld in getThreadId(). %dUnable to delete old log file: %s (%s) Unable to rename log file %s to %s. (%s) Unable to rename log file %s to %s. File is in use by another application. Unable to get the current logfile size with ftell: %s Unable to get the current logfile size with stat: %s ????????z|T|d|`|\|X|H00<0H0T0`0l0x00000000000000 0,080D0P0\0h0t0000000000000~0{0x(0u40r@0oL0lX0id0fp0c|0`0]0Z0W0T0Q0N0K0H0E0B0? 0<09$06003<00H0-T0*`0'l0$x0!0000000 0 00000 0,080D0P0\0h00Ibn *l *!  ouo6oD77@ oovD*MXPPPP:r0r8r@rHrPrXr`rhMX|P !67@7d7; *l * * v vDz{|D|L|T|X|\|`Q&6{ NxT Sy X&D  k%@, }(,  | y  | (d  w y  &`P 1 DD Q| ` 4h o&h,    w@   H | { @ x ,G( DT R Z n{ z{ L y  4 (8 (  $l  D v !  / CM Y Hd k   ) w { ո l P   8 , !` <  RR, vtd|u X0 { xxH (yx | ` &   &  1Tl DzKv MxlSv i'   |  S   |  xy#, 3? GxM }) Z   _* l 0D {x {L D ;t |v x@!\ x( (H %w(, Ai00 Yy`\ rz(yl( |{H$ @{|x Pd  {v -x4|>w|SUd u zxQ  { ]yz0!y8wx  ,8 $lT 6%8 E$$ TӨX {cI$ ww~|(wdר` yP|\ x(  z4C\ l HH 0L(?00 R!  cD ryz|vD8 x@ 7wzwE| vy,xx&  y L '%lX 3 R` ck` swxQ|L |`wL{ wX../../bin/wrappercrti.svalues-Xa.ccrtstuff.ccall___do_global_dtors_auxcall_frame_dummyforce_to_data__CTOR_LIST____DTOR_LIST____EH_FRAME_BEGIN__object.2completed.1p.0__JCR_LIST__wrapper.cunknownBuffer.0seeded.1wrapperinfo.cwrappereventloop.cwrapper_unix.cjvmPidproperty.clogger.c__DTOR_END__call___do_global_ctors_aux__CTOR_END____JCR_END____FRAME_END__crtn.s_START__END_localtimeevaluateEnvironmentVariablestimerRunnerwrapperLoadConfigurationPropertiesputsgetpwuidwrapperEventLoopsigemptysetstrrchrworkLogFileNamejStateStoppedwrapperLogSignalledcheckPropertyEqualreleaseLoggingMutexregisterSigActionwrapperGetJStatewrapperAddDefaultPropertiessigaddsetsetConsoleFlushwrapperUpdateJavaStateTimeoutwrapperStoppedSignalledceilatexitinitLoggingnanosleepsigaction_environwrapperBuildJavaCommandlogFileMaxLogFilesgetSignalModeglobfreefopenpipegetenvwrapperBuildJavaCommandArrayrealpathgetBooleanPropertyhandleDebugJVMTimeoutsigActionTerminationwrapperStopRequestedwrapperFreeJavaCommandArrayopenlogsetLogfilePathputcharwrapperOSwrapperReadChildOutputgettimeofdaywrapperGetLastErrorchdir_finisigActionChildDeathinet_ntoasigActionInterruptgetLogLevelForNamewrapperSetWrapperStatesendLoginfoMessagepthread_sigmaskwrapperRestartProcesssetConsoleLogLevelprotocolSendBufferisQuotablePropertysetConsoleLogLevelIntqueueWriteIndexmemcmpsigActionQuitfprintfwrapperGetTickAgeloginfoSourceNamemainjStateStoppingftellwrapperExecutereleaseProtocolMutexgetSyslogLevelIntumasklog_printfMutexaddPropertyPairinet_addrcorrectWindowsPathwrapperArchsetLogfileLevelIntgetrusagedaemonizevalidateTimeoutqueueReadIndex_exitpthread_equalcommandPollsendPropertiesstrtolfflushstatloadPropertiespthread_creategetLastErrorwrapperBuildUnixDaemonInfolog_printf_queueInnerthreadMessageBufferlog_printf_queuewriteStateFilewrapperStripQuotessetConsoleLogFormatdisposeInnerPropertyreplaceStringLongWithShortlockProtocolMutexgetOutputFilterActionForNamegetInnerPropertysetLogfileUmasksysloggetLogfileActivitywrapperGetCurrentTimewrapperSetWorkingDirsetLogfileAutoCloseflushLogfile.udivcloseLogfilememcpywrapperSetJavaStatewrapperRestartRequestedwStateStartedlastLogfileActivitywrapperGetPIDgetLogfileRollModesetSyslogLevelIntwrapperVersionBannerwrapperPingRespondedwrapperData.umulasctimesetSyslogFacilityanchorPoll.divwrapperProtocolGetCodeNameconsoleFlushsetLogfileLevelloadPropertiesInnersigActionHangup_initlockLoggingMutexjStateDowncurrentLogfacilityLevelprotocolSendBufferSizevsnprintfwrapperVersionsranddup2setLogfileRollModelogRegisterThreadsetSyslogEventSourceNamewrapperStartPendingSignalledpipeInitializedsignalprotocolStopServercurrentLogfileLevelsetSyslogFacilityIntmemsetexecvpwrapperAddToTickslog_printfwrapperTickExpiredjStateLaunchlogFileMaxSizegetIntPropertysetLogfileFormatcurrentLogFileNamelogFileLastNowDatepthread_mutex_lockwrapperDumpMemoryjStateLaunchedlogfileActivityCountchildOutputBufferSizessdwrapperSleepwrapperLogChildOutputwrapperProtocolFunctionwStateStoppedappExitinsertInnerPropertywrapperBitswrapperClasspathSeparatorwStateStoppingforkwrapperReportStatuswrapperKillProcessNowgetLowLogLevelqueueMessagessetEnvsetInnerPropertywrapperKillProcessmalloclogfileFormatsendEventlogMessagewrapperParseArgumentsgetStringPropertylimitLogFileCountunregisterSyslogMessageFilebindlogFileUmaskjStateStartinglimitLogFileCountHandleFileaddPropertylogFilePathgetLogfileRollModeForNamewrapperSetWorkingDirPropwrapperRequestDumpJVMStatesetLogfileMaxFileSizewrapperRunServiceautoCloseLogfilewrapperDumpCPUUsagesigActionCommonlogLevelNamesremoveunlinkpropertiesqueueLevelssetsidstrchrdescSignalwritePidFilegetLogfileLevelIntgetLogFacilityForNamesetLogfileMaxLogFileswrapperGetFileBaserenamesprintf_GLOBAL_OFFSET_TABLE_getConsoleLogLevelIntremovePropertycurrentLoginfoLevelgetSignalCodeDescwrapperStopProcessconsoleFormat__deregister_frame_infotimerThreadIdthreadPrintBufferwrapperGetSystemTickswrapperGetTicksprotocolStartServerfgetswrapperUsagetrim_lib_versiondumpPropertiesstrstrsetWorkingDirjvmOutwrapperInitializewrapperStopPendingSignalled_startcurrentConsoleLevel_etext__ioblinearizePropertiesglobinitializeTimersetSyslogLevelacceptwrapperInitializeRunwrapperJVMProcessExitedgetpiddisposePropertiesputenvrollLogsqueueWrappedtimerTickscreateInnerPropertythreadIds__dso_handlechildOutputBuffersigActionAlarmpacketBufferlogTimerStatslogFileRollModefcntl__register_frame_infostrcmplogfileFPpthread_mutex_unlockwrapperBuildJavaCommandArrayInner_Jv_RegisterClasses_endwrapperGetProcessStatusbuildPrintBufferprotocolMutexcloselogpthread_selfrecverrnoensureSpaceInChildOutputBuffercreatePropertiesjStateStartedupdateStringValuedisposeLoggingmaintainLoggerwStateStartingwrapperProtocolReadlistenqueueSourceIdssendjStateKillingkillthreadPrintBufferSizejStateLaunchingfcloseforceFlushwrapperKeyRegisteredstrdupprotocolOpenloadConfigurationwrapperStartedSignalledqueueThreadIdslog_printf_messagecheckAndRollLogswrapperDisposewaitpidthreadMessageBufferSize_PROCEDURE_LINKAGE_TABLE_generateLogFileName_DYNAMICwrapperProtocolClosesocketstrerrorstrcasecmpsetLogfileMaxFileSizeIntgetsidgetSignalNamegetThreadIddisplayLaunchingTimeoutMessagewrapperGetWStatewrapperBuildKeyatoiwrapperRunConsole_edatastrlenkeyCharspipedesgetLastErrorTextstrcpyas: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 @(#)SunOS 5.9 Generic May 2002as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 ld: Software Generation Utilities - Solaris Link Editors: 5.9-1.373 <Y4.interp.hash.dynsym.dynstr.SUNW_version.rela.got.rela.bss.rela.plt.text.init.fini.rodata.dynamic.data.ctors.dtors.eh_frame.jcr.data.rel.local.symtab.strtab.comment.stab.index.shstrtab.stab.indexstrvalues-Xa.cXa ; O ; V=3.1 ; R=Sun WorkShop 6 update 1 C 5.2 Patch 109513-05 2001/06/04/on81-builds/on81_58shwpl3/usr/src/lib/libc/sparc; /opt/SUNWspro.40/SC6.1/bin/../WS6U1/bin/cc -xO3 -xarch=v8 -xspace -W0,-Lt -Xa -xildoff -errtags=yes -errwarn=%%all -erroff=E_EMPTY_TRANSLATION_UNIT -D_REENTRANT -Dsparc -Iinc -I../inc -DTEXT_DOMAIN='"SUNW_OST_OSLIB"' -I/on81-builds/on81_58shwpl3/proto/root_sparc/usr/include -c -o values-Xa.o ../port/gen/values-Xa.c -W0,-xp    "!!o66-B7@7@$  7B7d7d$ AB77D K;;Q*l*lW**]**Ky2vv(FvDvDx ezzn{{t|D|D{|L|L|T|T|X|X|\|\<|`|`|`A P%8$  \;mule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/wrapper-solaris-sparc-640000755000175000017500000044204010567556635031335 0ustar charlescharlesELF+K@<@8@@@X!!((@//usr/lib/sparcv9/ld.so.1[\ !$%()*+,./013456:;=>?@BCDGIJMNORSUWXY[^_acdfijkmnoqstvwy{|~     #$%'()*+-/1268=>?@ACEFGIJMNORSTUW[  "#&'-2789<AEFHKLPQTVZ\]`beghlpruxz} !"&,.034579:;<BDHKLPQVXYZ` !. $AF l0[ To H@h` [  << p\h `  U85 :@H lLY@bot1  *  ! `  ʘ0 "@7?!xGN  `[ `p\x '  Q $h  6@ u  b (@0 pdC ]\Y |u{ fHDhX  q(T@  @ "" l1 S8DX \l @x [! ` &d p   +t! >ER L|u Fh `   U@\ H ` n x O 1? lTQ `@gl`s W[ t L ` H [|L H & P4 (  <  l`$4; R ]qp l  X   P>x \ Ɉ / 0,>`B ~pV j x,| [ > e  ,  O  ( $ @ 6 , J o ] \X k o| ~ S     Ȉ$  x  Ƅ  W     m % , < = _ K e a x j` t     (  ,  (| `    @  ^  T " $` 5 j I dpP [ p }@?d   O  9   8X  ,h     0t ' . 9 < R f( |    @   `P     7t   oT  ' /@ ? x<4 P n c m8 j s }  H  1H  l     a `,< V4|N Pdb UPr`y hx E08 DD  @ Ȭ  ,  , 4P& &4 j$F ,\(hmh S È   q|L    ČH2 D (`` p Ą Ϥ(  (  X8  V' &p6= J [\Pi { "     XT A | h& rd@ lQ qlq l ,P ,  ǔl ( w 7  8 ' ! 1 1 < \lOV]g _|{ ) K @  @,`@(  4h,gettimeofday_lib_versionsrandqueueWrappedgetLogfileActivitydup2disposeInnerPropertysigActionChildDeathwrapperVersionBanner_edatafopenwrapperDumpCPUUsagedisposeLoggingsetConsoleLogFormatgetIntProperty_Jv_RegisterClasses_exitputsasctimevsnprintfsigActionTerminationcurrentConsoleLevelglobfreelogLevelNamesgetInnerPropertygetpwuidpthread_selfrecvwrapperVersiongetSignalModejStateStoppedprotocolStopServer_etextgetLowLogLevelwrapperStoppedSignalledwrapperGetJStatelogfileFPfprintfstrcmpthreadMessageBufferSizepthread_mutex_unlockmemcmp_environgetpidjStateLaunchevaluateEnvironmentVariablesjStateLaunchinglogTimerStatsgetSignalCodeDeschandleDebugJVMTimeoutchdirwrapperSleepsprintfgetLogFacilityForNamecurrentLogfacilityLevelpacketBufferloadPropertiesInnerputchargetBooleanPropertywrapperKillProcessNowunregisterSyslogMessageFilefgetsinet_ntoapthread_createaddPropertypipedeskeyCharswrapperJVMProcessExitedisQuotablePropertystrerrorstrdupqueueReadIndexcommandPollunlinkwrapperSetJavaStateloadPropertiessigActionInterruptcurrentLoginfoLevelwrapperReportStatuswrapperDatastrstrwrapperGetPID__iob_endftellpthread_mutex_lockwStateStoppingceilflushLogfilewrapperSetWorkingDir_PROCEDURE_LINKAGE_TABLE_strcasecmpjStateKillingsocketwrapperStartPendingSignalledstrcpyconsoleFlushwrapperLoadConfigurationPropertiesdaemonizememcpywrapperGetFileBasegetenvcheckAndRollLogswrapperBitsprotocolOpenlogFileLastNowDatesignaladdPropertyPairsetLogfileRollModewrapperGetLastError__register_frame_infopthread_equaldisposePropertieswrapperDisposesetsidsendgetsidwrapperProtocolClosewrapperKeyRegisteredmaintainLoggerlimitLogFileCountHandleFilewrapperGetTicksmainwStateStoppedgetSignalNamegetLastErrorTextwrapperLogChildOutputcreateInnerPropertystrlenprotocolSendBufferSizeensureSpaceInChildOutputBuffercurrentLogFileNamesetLogfileMaxFileSizeIntconsoleFormatpropertieswrapperPingRespondedlog_printf_queueInnerwrapperBuildKeysetSyslogFacilityIntwrapperSetWorkingDirProppipeInitializedsetSyslogLevelssdgenerateLogFileNamesetLogfileAutoClosesetSyslogFacilitylogFileMaxSizewrapperProtocolFunctionwrapperGetProcessStatusremovePropertyforkerrnowrapperGetSystemTicksreleaseProtocolMutexwritePidFilewrapperSetWrapperStatelogRegisterThreadreleaseLoggingMutexwrapperStripQuotesjStateStartedcheckPropertyEqualsigActionQuitsetLogfileUmasksigaddsetwrapperGetTickAgesetConsoleLogLevelIntwrapperBuildUnixDaemonInfowrapperInitializeRunlocaltimewrapperStartedSignalledtrimremovesetLogfileFormatsetWorkingDirwrapperParseArgumentsrollLogsnanosleepwrapperClasspathSeparatorlog_printfwaitpidjStateStartinglockLoggingMutexgetThreadIdmallocchildOutputBuffermemsetwriteStateFilewrapperProtocolReadloadConfigurationgetLogfileLevelIntlinearizePropertieswrapperInitializewrapperBuildJavaCommandArrayInnerrenamelogFileRollModewrapperRequestDumpJVMStatewrapperExecutefcntlwrapperEventLoopgetOutputFilterActionForNamewrapperGetWStatebinddisplayLaunchingTimeoutMessageputenvtimerTickssetSyslogEventSourceNamethreadMessageBufferthreadPrintBufferSizesendLoginfoMessageinet_addrforceFlushstrrchrqueueMessageswrapperRestartRequestedcurrentLogfileLevelwrapperBuildJavaCommandlogFileUmaskgetStringPropertywrapperOSopenlogpthread_sigmaskbuildPrintBufferwrapperStopProcesssetEnvgetLogLevelForNamechildOutputBufferSizelog_printf_queuesigActionCommonwrapperStopRequested__deregister_frame_infowrapperArchsetSyslogLevelIntsetInnerPropertywrapperFreeJavaCommandArrayqueueWriteIndexregisterSigActionprotocolStartServersigActionHangupstrtolinitLoggingwrapperKillProcesssendPropertieslogfileFormatlistenwrapperTickExpiredgetConsoleLogLevelIntlockProtocolMutexthreadIdssetConsoleLogLevelupdateStringValuewStateStartedwrapperRunConsolewrapperGetCurrentTimequeueLevelskillloginfoSourceNamelastLogfileActivitysigActionAlarmwrapperRestartProcessthreadPrintBufferlogFileMaxLogFilesdumpPropertiescloselogprotocolSendBuffercloseLogfilewrapperBuildJavaCommandArraylimitLogFileCountwrapperAddDefaultPropertiessetConsoleFlushcorrectWindowsPathanchorPollgetLogfileRollModesigactiongetSyslogLevelIntqueueThreadIdsgetLastErrorautoCloseLogfilerealpathsetLogfilePathstatinitializeTimerlog_printfMutexwStateStartingfclosewrapperUsagewrapperDumpMemory__dso_handlewrapperAddToTicksexecvpwrapperUpdateJavaStateTimeoutwrapperStopPendingSignalledsetLogfileMaxLogFileswrapperProtocolGetCodeNamewrapperReadChildOutput_initstrchrfflushprotocolMutexgetLogfileRollModeForNamecreatePropertiesreplaceStringLongWithShortglobtimerThreadIdwrapperRunServicedescSignalappExitvalidateTimeout_GLOBAL_OFFSET_TABLE_setLogfileMaxFileSizeatexitlogFilePathjStateLaunchedsigemptysetsetLogfileLevelIntworkLogFileNamejStateDownlog_printf_messagesyslogjvmOutgetrusageinsertInnerPropertyjStateStopping_DYNAMIC_startwrapperLogSignalledumaskpipe_finisetLogfileLevelacceptlogfileActivityCountqueueSourceIdsatoisendEventlogMessagetimerRunnerlibsocket.so.1SUNW_0.7libpthread.so.1SUNW_0.9libnsl.so.1libm.so.1SUNW_1.1librt.so.1libc.so.1 =(.7 =(GP =(.\ ='fo =(.z ='f`phpxU@p @6`_ ?@`V@Wau @*`Ye @;`R17  g@K`](Y 4@Q` '%? @`vGqC @`R* F@t`l!-AK @H`+2I @`V [#0h@h`*p g" @h @T, @  +0 x r@?W@h@h@#/gh`] `@` ]X@Y" \`t\X@ ?``H]`@g]` ])@@@/gЮ `@`]`]@g]  `(]^`8]@@gׁ@)+ (p aX\'@Gt@G1  *p   gX+p ,0 ~ v\`@g- ?@HT^ ` )p g,0 ~ #Z@g ?@H@^ ` )p g,0 ~ #(Z@g? @H-^ g ?(p  ^@H##@g ?+ ^ #`@H * @Y!@`@@<`* * ?a@\\?[ `@HY@ @9\ @O .0 *p @a@\X\@Gh] X "@\\ `@hH  g`Y X+0 ? @M h<?" @ΰ H5% g\,p \X? o\ Y` ,0 -g@Z@? oc+0  a@@g^t`X^Y`X@gY` ?@@M', h^\ ? @M^`  %  (p @g  '~@? `@$:  @g ?@-/?*0 +h@Ya@`8 @  `wߕ)0 7߂w@f``'+ 7@C `@f ?@p@?q  }+0 @ @`@bXa@@ O * @a@\`8 @F@M#h\`E 8+p E " D +p @``@frD?Hl@>  h*0 @? @LaP@?@ @fS: ?"@ \@+p ?$`*p @o]@Ȁ`"O@>)h`?-p  @La o)<  h+ ?  @LU!xo`<o @L/)h-p ? @LEa@-?G/@f: ?OÚ)0 @\!@oǀ@L h*0 @ ? @L'! )+~ (p ``?@~`+0  `d@H : 'ے@eۀ?@`$@-/+p @\Ȁ`@DD@ @e ?"@(\?"@ @eƑ: ?"@ \ ?,p "``-0 \@hT%D ȀO @>* ` h*0  ?@KҔ`o?`Ȁ @@?h:@L=-)h-p ? @Ko@e* `< (p h?@K oD@@= @+'`-0 \a@ Ȁ H@L h`(p ? @K0@!#~ *0 @ d@$9`@eW?`@(p  * @?h$ d [!@Ȁ"O @=` h*0  P@Kc?o @. :?`@n1 1`,0 +  Y h`(p hbph+p  h"xh`*0 @ h"h`+0  hb h * hh (p  hxb!h)p hqb h`* @hj" h`,0 @hc"h)0  h\!h (p @hU" h *p hNbh`+  hGh`*0 @ h@#!` )0 (p !~h@:#9`@d{  *p h+ah+p  h$#(h (p @ h#8h`+0  hcH h`* hX h * @h#h!h)p cxXXXXYY$Y@Y\Z Z YxYYYYZZ ZtZZZZ[@;~`!+0 @dj`h .`(p h9 @ s@cƀ @dd 1-~ - \h'~`)0 @ !\ @ct')~+0 `d?@[-/+ @[!@Ȁ @9!#~ *p @!Zƀ.*Z@d8  + )p Fd<\@d5 ?H_ .0 ]@ Ȁ@hS?@08ƀ =`#1h`?(p  @Lco!! h * @oc/)- [@`ȀH?.p8>08ƀ =` !h`?(p  @LҖ#h ?3h`. @oc@cov3> `*p @cސh @c/__ωic;~) w71`* @`d@?@ ')0   `d@cD?@݀ @%'+p  D@ @c @O "OD@1+p  @+0 #< *@ Y!@`Ȁ @-08- : ?`HY !1`*p )0[@ €`)p @@c!@R @c__Ǩ"@hc-0*!4*!@<`.0wߦo7h° @To @o `+0 @co!@oڒ  ,0 @ce@oВ @ o̒ @oȒ #`.0 @Pao  *p \!@Ȁ"O % : +p * )i@8`? `@I!o : `?* = @@ao :8(p   i*p @? 0@Hop- G\/OW < .oS /-)0 @^!@`Ȁ @ChG i *p ?@  @HĔ`Ho@;  _@ @ H2 @/`+0  Ya@`Ȁ O@I ) 'i(p ?h@H o~, @ `@ q @?Oh2 ?O`8````a$a4adadaDadadadadadadaaaaaa̝@  ,p , @  sX@a"@" t@b?\ ""(@. 3 G ?@/| @=\\t&!4v h&!0&!,@=&!8\v!P"X@L  ` i*p H@LX @L  i`, @@L@L @M i (p  @M*  @M6 @MM @MR @ @^`I@ -@`` i+0 , #\!@q@`^`?q` q`!`h&? `)0  a@\sI``@6 @`?^`s s o# ^@@aΐ@ /@b  .z @b z$@ai @b ,@a\@a_  t` i* \@ \ @aL\?`?q` o!`^@@a /@a  .z@az&@@a=@a .@ )0 *p ~'i \` @a% @a!ii(p @ @aߐ!0i`)0  @aǐ8'i,p `@a! i`(p @ @aɐ!* a@a' i+ @ , !@a#i% i`(p @ax@a!i@a i`)p  @ai(p @ @a3i,p #b8@a`# i`+0 @a`@a `(p @aЛ,0 i@c(@aj1i`@ao i )0  @apc`.p @ai ,0 i@@adcH@aZ h8 ``)0 ',p i@\`s^@@`@ /@a,  .z@a'z$@` @a',\@`!@`x t` * i\`[@`f\?o`@  3@- %#.0  @ G?@-?!@\?@;#!` Hs: \"`Hf j?*p   (@F+0 Z!@`ȀH`,`HH1 j ?*p  `@F@%a!1~ + @`?"@ @`P: ?@ )p ?$ `.0  @+ a@j \# D? @Fcx\h'Da,+0 Y!@`Ȁ`"O @8h (p ?  @FM`o׊ j  (p ? o`H1j`?(p  o @  3@,%#.0  @ G?@-n?!@\@:! Hb: j *p ?  @F \ Ȁ`H ,HH1!j ?(p  ``@F@$!y1~ +p `?"@ @_ё: ?@ )p ?$ `.0  @*p @j \# D? @Ex\hDa,+0 Y!@`Ȁ"O @8&h (p ?@ @EΔ`o׊ j`?+0   o`H@95 )p a@^ Ȁ`H ȀH2j>`+p >  ? @H  Ȁ @!0H  `M@ `N@`O@`G@?!!0 +0 _!@&,h&4 j: (p >`@  @H?o^@@_z @( ?;`N\@N; "@ .@`@&O;`h; @ OH`; \@ ` ""@.@ .@ o  o`o.@ ; .@S' ``-0 %j, -p @!j! a(@?ZX7@_2.  @^3jv`H 0 j(p @!8@^j ,0 ^@@_!@  ^@_ @4?`/j^- @ @_saH  ^@^ @6?@ `/-* )p )%@ @  9j!X3j@`= +0 o@^|!P]@o@?K J`"O".@_F -`.%!j,p @_4ax`$ j )p ? o@D> @^[,pv*',p^,0 @_p^"`_@o?o"`p-`- o aX@?o\j(p =  o@^+"@.\@^>,p @^'@ Hv@^ -j,*0 @^!8@^ "O'@^}o'^ j* o!0o@? "OѤ@^S@] ҒoȐ` * * )j9@^aXa@> @H f> *p@]'#j<)0 @]v) /p /0 7j3@]aX"@> @f d  @]>, j <`(p v@@]0K `.p @\!@`؀`@{ 7`*p @*0 !jaX@\"8@>X ńV@]ߡ>,0@]ڤ@]~ H8v@]А h @]ːK?\@7`+0 * !~j,@M ^bX@]T > +p@]U)jv`,p @]F"xG>w@]G )_.p`@v!; w,  'Xw%j(p ;`@ 'b@]#o_oZ@= @]z ݮ  @_H_-^I?`\@7;`j+  @\"@ #`- > -p!@\@@]Qx@\  Hv j`\@* @x@\> (p@\/+j  *p ,p @Z@vED@\̒"+p  @\@ H @> )p@\%j\@E`H- v@@\b @\); `* *p > j,[a@C Lv@\c> +p@\9  +0 ,p j]@ A`Pv@\c )`*p @[@ Ȁ H" @\/>,p j-pvH@ j+0 X@\f-> @\h*p@8@vj /p ^@\Ucp-%-p @a@\@ ,H" !@\M>- j+0 vH)j /p c@\2"89 ~ >. (p @\\@@\, `Hjv!\@ j+p  c@\7>(p -@\@@\jZ`@\ `HEv\@`#j)0 [ Њc@[- * @]a@`H"> @[(pk`)0 v@ H ';k-0  (@[ش- @ \@b"H- >@[ѷ(pk`)0 v@ H H';k-0  h@[-+*p ^a@ H"> '@[)p k (p v@ H )k /p `@["0 -@[>,Hv` *p #. kYa@ E`@[{ @[~)> ` *p +p @#k[@,!8`v:@[d$ 3```)0 , k,0 ;k !a@<"[!X/@[>%j @[O.v* @@[@!8/- @ @  ;kX7k3j`=`*0 o@[(a(]o@; 2J"O0o@,0@[  @ Hv@[Ւ ,0 )0 ^a8@Z@o@[ao^#j+0 o0o@; "OФ@[7@Zݐ oǐ+`, 3/p !k]!@@CoF!p;k\@, ] Рo!)k, \@@o' 0@@-> ,@Z(p`HV ,@Z>.Hv\@ k+p D 4k a@ZsoA+\@`)k.p D4@l o;\@`k* C0 l oǒ"@;k`\@+ `x oshj(p   @ZL"oE^+*p`*0 ^!k@ @Z?o.@[ * @[ ?`  @[_@M@G - ~_)0  @+`-_@Z~Z`@`_*0$^@Zjv+ @ @Z !8@Z8o$ @^,@ ^ -(p j_Ǹ ] !8@Y`?`_ o'@Z̐o3k`?,0  @o@@:o@Z4L/@l@Z-I`\@e@Z H;`. `?HI!k`?,p  @ob@@`@Z `@`_*$^@Y3`/p j@!8@Yv@Z 8o$@ ~ _* ^@ `* _^+0 @7j!8@Yv`o['@@H- k* @? ob@YÐ@Yi@Y?@Z @Yo)?9-j -  @YMbo!  *p *0 ~k@@M`^o(9   *p #~)p +kN`oْH@Y> (p@Y.H#v@Y h 3@Y{J \@3%k`,0-p ^@#h@Y o!k * ^o9#k )0 oc@X/>, k,0 vc@X)`@¸ w`#~)0  @'`%k*0 ?`@o#@X/o,0  aX@9Z8@Y&2`@`.p$^@Xjv(p  @Xa8@Y'8o$`@_^ -@ _ ^ )p j@X!8`' ŀ=@X8`@(`.p$^@X!jv(p @Xxa8@Xo$ @ %~ .p)p ^@ ,@ !.p ^*0 7j@@XZ!8'`@!%`"O.p^I?`\@ /'7j/p @X?"o j- @@X5 o^.p^ +0 #k@ @X)oj^*0   @Xo7)k* @@Y #O~ ' :M "@ -';`MO:ok7o7 `?+p  Y!@o\' p:@@א!# *p @^!@!,`H1: l(p >!!,``?  @A3 * @[!@ଊ?`@$1`+p )0 `@^ . Z!@`Ȁ`@?@%X G * ^a@\!@X l`?*p  @>ol ?(p  `@@oې  * * lYa@@ ?#!4? o *  )p l[a@@?#!4? oҔ *0 +p @lY!@@?&4? oÔ@ * +p @lY!@@?&4? opl *p ?  oᐞ + @Y!@`Ȁ`"Ol *p ?  o l?(p  oal`; *0  ? @@ on>  l*p : ;`? oD!# * @lZ@)0 @> Ba,>? o1"XHH d0~`(p @! @A!~ +  @W>ZX0 w'`+0 (p ~   a@ X<`\ @W΢`'l +0 @(\`%'9` @O, xh\20w"o'@W @W2 ?o$, @ l (p @",>`@W1 h+  ` d@ @W e l` * @b@W `.0 l  f@"@W g >`f@ 0!  ;`*p `9. .p 1l-i!X@`@7#\@@+p ll(p   bb@7\@7 @ "@< ;!` .p )p @@1l-i /0 !X@\@6#@A'l3l``+p + lP0\@6/l@A#l7 `/p /0 c8#p\@65@8%l\(p  @6cx@A +0 )0 @_a@\#@6  @  \` +0 @6$a,0 @`!@ \Ea/p }@:`@A*--0  l*0 l !XȔ#@6\@@A=;3l` (p `/0 #0@6\@@AL) , m `@6\@@AM9m-  m* ,0 @@ 8@6k\@@AR'm!`*0 -0 m@ X\@@6[ @AT+m/p 9m)p P@\@`@6M)m`*0 x@6E\@@AI@A# @@@;`9m(p \@  %,\@@6e1'? %8* m }\+\@@6Y`%<\ <?@1m  *0 \@ 10 @6G`$ @\ @(H] < <#`/p 9mf@= $ @? @;  +p `)p 9m- @)a@]\X@6 & H] H $@! 8@$! *p -+ `)p X/#;ma@*0\p@5\@'?% L\ L?@- m\@+0 ;|7p @5a$ P\ P(H L L # m+ f@ <$ P? !@;-  *0 `m-  .p )@\@YaX@5ٔ %\@`Ȁ H@@> @? '-!*p ,  ;@ m*0 /0 1m@aX@!b\@5h\@6~-m% `\(p \?@5b \'``Ȁ"H`(?$``(@b9m"(p -@\"H@5y-* @+0 m $`0-\"\@5i/p 9m *  @* @@ P%4bh\\@5%!m-u`Њ\)p  "@5g\/m/p m $`\"Д @5]\)&`ܰ`\.0  \b@5Q ;m m %`* \ #9\@5C1m),p %\# \@59 ,p  &`(p \ 0@5/\1mm`%`+0 \@ \#@5  !%\m @ H@5\#m '! \.p  `@4\m`%a+p \ \c@5 %!  - c@4\ m: /0 \@\#@4ה%$\a$`&@$a$/ m- \@@4Ȓc$a(\a(`&@$a( n * \ @4 $a<\!<`&@$!< 1n` ,p \`0@41n)n n $!@(p \  @4\+n'aD`\+0  -nX@4\/n' \.p  @\@4 p $` \/p  \@4|`n' +p \ ! @4q\ &``\,0  @\ @4f '`\(p \ @4\\+p &``@X'@ @#* `)0 [@@`$`p@ )"@@)0 @* [a@$`` @ 1"@@ՠ* @+0 Z!@$``@ %@@9 *0 ,p @Za@@`$ࠀ` @ '@@$`+ Z@ `@{n4@l'+p Y!@` @`&@S.0 @Z@` $@'``@@&@<*0 ^a@` @`&@&-/p \@` @'`@ )*p  , ++ ;naX@#x\ @3\ %` n(p \!,c@3\\&a\a`@-o +p \ @3\$aHd`@ @\@> ,Zah]@R \@dZhOs(p a@\@R^ah\qah@RYap\v!p+,0 `@)0 @ Z%d ;o!X#\`ad)p `<H@RT\@3# "\\!do'!dad @e:  @RJ+p\tahEd@RE+0\upad@W-3`,p @, @9h!X% =,p `H@R>  ]@2,0,0]@@RtZh@R ]@tZah!@RsZ'o)0 @@R`h +0 ]b@2%l ]@* Yap@S"`+0 ` [@)$^@!d &O%.0 @_a@ ( @#`1 .p /0 ;*0 @o !@aX\@\@2 \ " \@@R@QĐ t@R!\@ (`@3`+.0 `/0 )+0 @%oa@X\@\@2s \ " \@@Q@Q t@Q\@ (`@q%+.0 `/0 )(p @o a@X\\@2M \a U" #@QҐ@Qx ta@QՒ#o`\)0 \@ @26\a : @Q@Qa ta@Q!o \)p \ @2S( H3+\` /p @2Ha(.H .3\` , @2=!( @ $a)0 Z!@ (`@+!# `*p )0 +p #oX@\@\!H@2  H+\)p  @2H.H .+\` (p @@2!H @ ';`, *p (p @ o@X@%!\h 3\@1`1o&ؕ/0 \!xGa\@1+#` o+0 \'aܒE\@1)7o`o)0 \@%Faؒ\@11+o \(p &aGaؒ!@1\#o \* 'aEؒa@1\)o\%,0 F؞\@191o\`&- Gaز\b @1!o \(p 'a@Eؒ"@@1\\%)p B؈@\@1"`@;`o \+ \  @1"x\&`(H?53o *0 \@1"o$b-p \@  "@13\Ē g%"h\3\` , @1Z!HoV'``/p /-0 oZX@  @1b\! "!@P@PB t!@Po!@Pot!\ +p @10(o@Pota@Pota\o)0  @0`\! "~%@Po@P t!@Pro}%@P~ot!@Pzoft\` o*  @0˒ఢ\! "~A3@PP@O t!@PSo83@P_ot!@P[o!t``* )0 o ^aX @0 \!x "}#@P,@OҐ t!x@P/o#@P;ot!x@Pߒb  \oՃf`Z9n  (p ?@@6c\ o$a`1n`?-0  @@6 o'n?+p   @5poԺ#n`?(p  @@5!o;n!`+ 8`? @5o.9n- ! @? a@5o1o` )p ! @? ob;-o`-/,0 ?@, # s  @5of1-/  o-p (p s? c  @5oC'-/ o,0 ?*p s c  @5o 9-/ 'o.p (p @s? c  @5o-/`o,0  +0 s?c  @5oږm\(p   @06b0$`,o\@: Ob'\@?o^' Ȁ@6O> #`f* %o: $ P ?o,ch9`3m* !$ L> ? @5Mo\$ H`m,p ?  @5B!(o!@6O #`* @%of;`$ @? oa* -m$ <:`? @5"`ov\@:oQ%l+ @@Oc*8{< 53`.0 - -p@?  c@5 oj<  p  +0 ? @4xo^< ?$`( @7.  @(p pa@@)0 \ Ȗ? `@jA!8 >`@4ӕ!8@4o\0`(p @!@\`Ȁ @|#``I@ `MH e > \`@@* \ࠐ   M8`@hl@* M o?`x@Od H? ? J?@ِ @:#pߔ +0 @@N)!H   p\!`! H!` * @@NaH q  `)0  @-\aX s @N{h'9  o+ #p ?)p  @4V p o*0   є!Ph p` + ? @4@ o}\@`* *p p @!x^  Ȁ`@? `LH @ ?@)^``9 @.@)o@4o^@` *  @+p [@ p@ `:  ? @!7@3o@p`?*p 1  @3a  *0 a@^Y!0 ! `M@`N@`O@`G@`H"@` Ȁ@?!!4h!!0p *p @ ? @6!o^`. ^a@ȀH 1 p ?(p   @6!0`* *p  p@ ^@"( Ȑ?`@%>   M??`L@  `MH @(d'`p)0  bh@NM ƅ@': @@o^@@3so^@@`* *p p @"p^  Ȑ?  N`@? @ @(^ऴ`9 @@( o N@3Eo^0`* *p  p@ ^@" Ȑ?`@ >  KM `?`?H 3@(d`'+ p@ "ذ@M偡 ƅ@'9 @'@3o^@@5 )p a@^ Ȁ`@J `K@`MHO e z ^``@ @(\ ^  M;@*@(R  Mo? @!@(H^   L> @`*0 @a@^`3H @ 4^ H  4 @( @() L o?p?*p   @2o^``+0 g*0 @ ~@ "[@L8!  (p  @!X?@,\`~*  @* gZ @@L# ?@,\`* + g~@ [ (@L ? @,\g + ? #@@,\ g \(p ?@  @,#`0 @Lt__ߋi#v6 @!#~ '*0 %@ `@"9`@L?@ * @?h$ `+0 Z@`Ȁ`"O @$u h  )p ?@2`o +0 \@$D@ ~  (p @ @L h@ ~  (p @ @L h@6@@@K /@L9  .z@L4z$@K @L3,  `*p )0 ~@ i@X` @L)@@@K̤  /@L  .z@L z$@Kf @L    ,,p )p i!~@@@L[ @L   i`* @@L a0#i`,0 @`@K!8i(p  @K`,0 i@!i@Kai *  @Kېa`,p #i@KӐai`+0  @Kː"x `(p @K'i@Kɐ i`+0  @Kʐ  )p @"@K#`i(p  @Kb8 i* @@K`@K ,0 i@@K"i`(p  %i@K#(@K `, @@K#i+p  @K i (p @ @K#H@K@#`!* `+0 a@j ^Ba8a8 @1 ^!d@i?>\Zh.Z@J`@ ^@!d &O>hT@Kd"?^@\.^p@`[@`\HG% p?(p    @0c p`?(p  @@0֔#0\Y!0*΀!\@ `M@`N@`O@`G@`H"@\@ Ȁ@!!4h!!07p  . ?@ @3!o\\@ ȀH p` )0 ?@ @3@ ` )0  @)YaX s @J@  *p a@^Y!0 @! `M@`N@`O@`G@`H@` Ȁ`@?!!4h!!0 p> +0 ?!@3g o^`+ Z@`ȀH 15p (p : @? @3Ta@`,p %p@!@5\ s p: &@*@Iv?.p \@ pc`?   H/  $@  @0(!p?` +0 %p@0c ? (p @@0 q *p ?  @0 @@0 O `O O@ @@ <`(p`^ @O<`@Jh@Jov@^  @I@I v@Iߑ@Iov@  *p ` (p ,0 @o!@ \X( H"@*x\@o`$(p \ \@@*  g$@ h`+  @J^ l` )0 @  [@"@JQ \ f`Z0`@ -/`)0 +0 o  b? c  @H>`s@/v  @Iϊ?_ϑ1p0_ז@j*8p# **p0+0 #@ *p30* @ j`d+2h`d @  @)0@"@@(p@(p9 hc" ?xL*`@ 9`@ )0 @ Ya@@J  ( @  1q*p @? @ xh @/# h@/!q?(p  `@/?@`+p )0 q@  ZX @)t  J * `@ h( Ya@@I ( @ q(p @ ? @ x h> @. h> @/U+p q  @.Ӑ?o? `(p ?q`HK!  1`*0 )0 2@#Y `(p qh9a (p q@h2! `(p qh+a  (p q@h$!0 `(p qha@ (p q@h!P `(p qhaX (p q@h!h `(p qap <Xtːˬȝ@q  +p ? 1ax@.\#q ` (p .p q. В!@([aX q (p @ @H! 3#q`.0 @H   * @Z@ ̀H!q  * ?@18@.%#q  `+ )0 ?@ "@@.@!qq`?*p ?  b@. 8  )0 ?b@.!qq`?*p   @-c(  )0 ?b@-!qq`?*p   @-c  )0 ?cp@-!rr`?*p   @-ה`   *0 %r?`@-!r?`*p  (@-%r ?` )0 @-`p  (p ?@-%r r`?)p @- ?` (p @- r *p ? @-!X? +p @@-@@-#%`)p a@\Y!@Y!6 H\ 䀢 @Y!@Ho H`\Y!0*ʀ `M@z`N@x`O@v`G@t/+r?-  @-Y 疒 \ Ȁ Hc` ܀`H. 8` , q,0 q@  `4aX@!P`4Hb -`3)q-p @!@@/+q- r+    ?@0 a` 8* \!@" Z!@,`) q !,  ;raX@G  (p @G4 @Gߐ  d@0 O! /r/p ? @,b`* ^!@Dah&ta r`)0  @G̒"@@GҐo``8*0 @ GX!q `9(p  oahr?*p   @,ŔoP\p)+ )p a@\Y!B}Y!l Hw\ 䀢 @hY!@G6o 2He #r 3\`]-  @GhO d   |dO35(p 7r@ 5r!@3r P@G}0@F **@F **@F * L "O  ;r`)0 @GЀ H49r  +p ? @,S" *ϐ @GA. @@\@GL\ᨀ?@  ,0 ^!@E!hu!@,%r  \)p [ᨶ@? @,-o /r (p @F 2@ @FS r: ,0 ?@ #8@,N or * @@FÒ#0 H ;r (p @Fh 2H?`*  bp@+or * @@F#p H ;r ?(p  @+ה@K o;r`+0 @Fcx @9|@'N H/r`/0 ? c@+of@19)p @Fix H(@0ґ=s *0 @ ?  @+@1GG  d]"@1/!s(p @E& H p o3(p @F:b H=@0;` s* ? oҔP`+ @@F%" H@0=/s  *0 @? o ;s`?+0  @+O`or *p ?@  oW# - @E Ot)p @Eb Ok;s * @@E @  s )p  @Eܒ!`?`+0 @EӒ @ ,0 !@Z@'`䀥H  s`?,0  (oFs`?(p   o!s`+0  @E` @ ! (p a@_@o"  s * @@EH @ 9`+ @a@Zo#` s)0 @E!X @ /0 @ !@[@o#! s (p @Eq!h @ 9; *p a@[o"s`)p  x@E^ O`/p @!@Zo! 9s`+ @@EK Od s)0 @EAH OZ9s`+ @@E7!X OP s)0 @E-h OF9s`+ @@E#!x O<9s *p ? ola *  @)0 9s_a@\a? @*K!o  @zo r?*p   @*=Ho\ -/ * @!@\ ͊`7 e `?@HJ`6!4@+!8`@#!4!D"H[!P+'s`?-0  @@*!\ ܀ H- `)0 q(p q  @ 4!X@P 4H\#q` 3,0 @@q(p @ !)#r  , ?@,  8, @[!@" Z!à ! q*p  9raX@D* @@D7`@D @ d@ O`'r, ?@ "@)htr )p @@D"@@Dhg 8-p GX;q` 9*0 ohA\!\@4H!X $!X@u!< H`@n$ <`>\ ܀ @U t $ ,p Z@\!)D  9r!@DE4  )0 @@DD"@D9 @' d@ O%9r*p ?@ @)J")0 [@a<@ `ȀH+p ;'s`:+0  ?ob;r)0 @@D@DoYD  s(p \ @? "P@)o\$ ot D E+sB H  /0 ?"@, o|\ Ȧ` @$!X!X!` @`# ܀@I!< H`@B$ <`\ ܀`@* t $ , \a@\!D  9r!@C`)p @Cb7`@C  d@ Oon%D \ `s)p  ?"P @(o\$ ot D ې H s, ?  @+bo\s`D!\)0 :@? @("+`)s(p ?@ @("\ ܀`"H-` q-0 ,0 ;q  4X@P 4HD9+q  3(p @@@ )q`* ar (p   ?@+Ua 8)0 @[a@" Z!!! ;q, 9r X@C  + @@C b7`@C ~ d@e Oov 8,p GɘaX' 9q*0  o!h\!P͒s(p \ AaX#8?@( o\ )0 `@!(!@!$\@d@#!X ܀ @r H`@k$ =`\@ ܀`@S t $ , @Za@\!)`D  9r!@B (p @Bb4 @B @% d@ O9r`,p ? @'Ĕ"`@*p Y!@ Ȁ"H's?=`)p @ oc%r*0 @Bb@@Bo‥`D 9s ?(p \  P@'o\@$ ot D !  H/p s?  @*}o\@s`C!,-0 #@ϒ!@A9`*p `+ s* 's@#aXc_@!#!s`(p _@!ܒ @h\ ܀"H-` q*0 ,0 #q @ 4aX@!P 4HD ;q` 3, @!@@+q`-0 a% r + ? @*"a 8)0 [a@" Z!#q`!(p   9rX@A4  +0 @Ab@A }V d@2 OoC 8, GɘX 9`q(p  o!h s\* ?Aa, c@&\?h$4H!4 2H+p ;s`C!,/0 #ϒ!@@k`  *p  -p -0 ssaXؒc\@@!*'s  \@+p @@!6#耢 2@i+\ ܀`H. `  q+ /0 ;q @ 4X@aP 4HD+ 3`)q(p !@@+)q`(p !#r` * ? @){ 8+0 _a@" Z!; q!)0  9raX@AF ,0 @AFb7`@A: | d@ Oo 8,p GɘX9!q  9/p @oht`\-0 @a, ?oZ0+p _!@u@%' * a@^`͊`7 e `?"H`` HA[`˒ @;^8`@@*  @^!@`@l! `* ,p +p 7q q![X@ f!#`t*  @@[)#t`?*   @% t  (p h@%ؐ?-0 @^a@`܀ H-  `q+ -0 3q`@ 4X@!P 4Ha`75q 3(p a@@5 q*0 !r (p ?@ @( 8.0 @Z@" Z!@, q`!)0  )r!X@@p +p @@p4 @@d  d@ O5* 3r? @%u+0 Za@ h$, *p r@@Sb@@@Xo 8*  GaX)1q  9.p @oh t+0  @?`!t  * ?@7t@%@ `?(p @@%8"+ Za@`܀`H- 7`)0 q+ 1q`@@ 4!X@P 4HI`!#q  3(p a@@!#q (p r`.p ?   @(! 8+0 ^!@" Z!# q`!.  )raX@?Ϣ` + @?ϒ4 @?Ð  d@` O!o` om 8-0  GĘ!Xq 9.0 @ oh+ @@2\@svP@, t`?.  @$bX@`@ -0 @\@ $@h  ܀ @Q I<$ _\@ ܀@7\@t  \$ D)r @?l )0 @?l6`@?`  d@O) r ?*0  @@$r`r(p  @?Wb@@?]D 7\ (p s? "P@$Yo\@D  I s`, @ ? @'Dbo\@ 2@(D \@ I$ $ t \\Dj)r @?* @@?"6`@? ? d@SOo)M15sI I )p @ ? @' o\@@9 OT\@ ܀`H-``q. )0 1q @@ 4!X@!P 4HD` 35q* @!@@5 q(p )#r ?*0  @&Ӕ *  8@[!@ `Xa'1q)r)0 a@ aX@>+ @@>"6@> d ?D@Oo3) 8*0 @ GɘX q  9.0 @ o!h t *p ? @#\ O^ ܀ H- `q,p (p !q  4X@aP 4HO` 3` q)p !@@ q *p a7r * ?@ @&`! 8* @[!@" Z! q`!(p  )raX@>+ +0 @>+4 @> @  d@p Oo]!5r-0 @ @>"@oː 8.p  G!Xq` 9,0 oh@#o^`2@*C`^#` Gs`#`\!4D B)r !@=+p @=b4@=ې  d@,Oo|)o#)s  G ?,   @%ߖ"o^@`@͐ 3%`)p a@\@ `"Hv`Y { @p`\@`p @\1   (p , !tt `tp@b`ܤ?@!`t!`hq`3`!t)0 ?@ @""o\@%q?+p  !@"@` t*0  @?@"#( t*p ?@ @"" t?(p  @@"|#0t  ,0 ?@@"s#x?`*  @@"kb@o\@t  (p ? @"`@8 \@?hS!a4)0 @@\C[ @F\`䀡`@2# t` *p Ò g &@\`)0 a@\ 䀤@h*q u ?*p @  @")`o\Ȁ "O`u  (p ? @"0o߈`t  (p ? @"o#@> O33@<'tϒj _" w@=''' ''''' @<' -p @(@;y@;א u`+0 *ߪ@`H @!͐??_20 %@h` @@\ 쀢`@". @@\! 2@ Y!@%S`,p ZЀ` +p Ya@NDt* Za@[A H@%Y* -@@\@@ǒ*p [a@`܀ H^`H\7q`(p 4@@P 4HB 3`#q, !@@% q,p 3* @a@^~E]`- ^uZ`ssa0 Ha#u )p !)0 s]@. ua4@ H!! u (p @a3sǖ`u*  ? @ * L@\@!0 H 䀥@ `G@$!0`H@@ *p ^a@`䀡`"H& q ,p ` 4@P 4H%5-q 3(p @!@@q`-  !3u`?)p  @͔x*p @\ `4"@H`8`3@j 7* +p @ u[!@@Cਐ? b@)p @\䀥@Dଊ`@53G-1`* .aH[ =^.p [@` 9O`䀤Hf+;u`?-  @"=Ko@x *p @@\@ O޲Y  Gز\@`p @\ ,0 *0 uu `tbЀc@`ܰ?@!`t!`oq``%t)0 ?@ @Do\@1q`?*p 7 @@83t!*0  (@/?  t(p ? @'bt`?*p   @0t  .p ? @#x ?  (p @ b@o\@@ \@?op&4@ 3 2Ooj* a@\@ Ȁ @75u` )p  dn( &@\@ $@m  ܀2@WD  K<$ \@ ܀@=\@ $ t \a";D` 7ra@9 + @9b6 @9 @ d@  O%* r ? "@o.p )p -r@9b@@9oD 1s`\ )0 ?@ @bPo\@7s︐ K  - @?@!w o\@`2@)D \@ K$ $ t \aڲD` 7ra@9B * @@9B"6 @96  d@  O#o`5s| K`)p  ? @!;o\@!u  (p ?#0@2o)u?.p @ @( o6@ - a@\@ "OY ǒ G\@`pO-3u?.  oԔc`@ 6 Oom=!oh@2 (p @@\@ `O\Y  GV\@`p @-`. . 3us`t# o#u`?*  c@˲@  o6.p @  O΂o.@- *0 a@\@ O"Y a G\@`p @-+p * v7v @`t oE @3v`?+0  oǔ`P@ ’ 2OӐo@ * ^@` OX`- G@oo.p @  Ooݲ# v`:(p ?@ oBଖ` v*0 @? @Y`o\ 3 @#\`L2O`܀ H(!5q `+p `4aP@ `4H^#%`33q* @@@q .  a -r  . ? @ #a 4+0 @\!@" Z!"΀+ q`!, 7r@  P@7 (p @7b4 @7 @ d@ 3 O-r`,0 ? @b  4 @ o@r)p @7Ӓb@@7ِo q``8* GaX! q `9(p oh@`92OoA!,  8@#\ GO ܀ H. 3`` q*0 (p #q @ 4h@P 4HW! 3 7q- @@7q)0 @ a%5r + ? @ 9* @[!@" Z!݊! q(p  7rah@7]+0 @@7]4 @7Q @ d@ O%-r,0 ? obr`*0 @ @7H@@7No%q 8*p GX 9*0 @oah q 8.p Gn!X#q` 9* o_ah@ j "@\@\@Ȁ@ e Ѱ \@ `$@v  ܀ @_` M@X$ <ڐ\@ ܀`@@t  $ *0 @\a@\!D > 7r!@6`* @64 @6א*@7 d@' O-* r? @o*p r@6˒@@6ѐo D \ ` s.p ?"P @˚o\@$ ot D -s M  * ? @"o\@`@+\@ M$ $ t \aD`٤ 7ra@6~`* @6~b4 @6r *@ - d@¤ Oo-oD 춐 Ms  (p   ?@tbo\@3v`?(p @@l o= eor$!4 ܀@)\@ G$ $ t \a{gD`썴 7ra@62`)0 @62b4 @6& *c7 d@v O7oQo Hl Gs  )p   ?@*o\@u`?,0   @""Xo \@q` 8+  Gɴ!X3q` 9. oh7q`- 4@P 4HG 3`q)p  !@@ q`+p - [!@&F`^``s* ua0 H!5u,0  -* s^@, 3u4@`H5!u(p @!3s`v)p  ? o`q 8*p GĢ!X-q 9.  oah`%v ?)p  @@!P\` O-N\X]`o#t`@oK O@\GFov>Y O޴@\:Eouu?+   @rao1u?.p  @h!o ?Ȁ`Oou?+p  @ @Xapo\1u?.p  @N!@o} %u *p ? @Da oh# v`?(p  @9oV@h doJu *p ?  @+o?"o\p  8   4`(p q@$aP 4`(p qH @ 3!@@ (p q@h! 8`(p q@ aX 9`(p q@o!h@6%r @4 )p @4b4 @4  d@O1#r  , ?@•b!r +  @4@@4@!5 *0 @Y!@`܀`HCq`4(p  @P`4H1q``3. a@@ q)p @  +0  @.0 ^@#q 4@P 4Hxq 3(p  a@@7%q.0 @ r`: * @ ?@h! * Z!@#`[av1q``4)0 @P`4H?%`3`q(p @ a@@q (p @a %r.0 Z@ !@4 +p @4b4 @4  d@dO!r?(p  @&b3`7r, @@4 @@4q`8+  G̢!Xq`9)p  o!h1q` 8. GaX 9`q* @ o!hq `8* @ Gf!X1%q `9(p @oWh@  >`(p `@  a@\`܀`@ v`h&`F`  ^`*0 3s?bP@ƚo\Y!@$ t @'))p a@\@ ܀ @Y@S$ >k\@ ܀@; t $ . \@\!WD %r !@3t)p 4@3sb@3h  d@O#3r`.0 ? @zbr ,0  @3_"@@3eD 5\ 1s.p ?bP @ao\@$ ot D 鋑>`s +0 > @ ?@I o\@@ (p  @ *p !@#q\`t?  @b@`t(p `ܘ@?? "`H7!`t@$h3\@  t *0 ?@c(t`?(p  @@ " t  * ?@c0t`?(p  @@#x? )p @b@o\!`q`@ # @  3   4)0    4Ya@ `LH "@ @  8(p    @#\ 9@ Aa,\ `GH@   `(p @( !@\ `H%QY @ 5`* *0 uu\ pbЀ`@H%@c \?h&!4@ O@! *  *p @u^@ Ƞ`? @*u`*0  d  ( u`(p ? `@#0^  K @:o?@H@  ^?h#4@@o@   `(p @0 !@\ `H-Y @(5`)p u+p u@ +0 u\c`@`p? Ѐ@#ȁ@ @ \?h&!4@5 O@   `(p @, !@\ `H)Y @$3`(p u 5\*0 * u!s@`p? в#Hc@Ͱ @@ O@   `(p @, !@\ `H)aY @$3`(p v 5\*0 * v!v@`p? P H`@P@ @k@ O@ `@`)0  Ya@``H)X` @ @ k@ O@  (p @!@\Z!x @)Z! @"Z! @Z! @Z! @ Z! T@/đ> @0o@0o\@0o\@0ސo\@0ڐo\@0֐o\03`+  Z@Ȁ`H v ?(p ? @ H7L3 . .p@Y @v(p  a `HpL1`* )0@  ^@75v(p @bs`3v. ?@; ? @"  @" `H F @0`.p v@Z@0F F F (p vs s?? @Ɩ"Php@0:  v* F   ??@o v* @ o"75v(p @ob75v(p @obv* @ o"v* @ o!7v )p ob5v.p o{"3v`+  otv`*p @omv(p  of v`* o_a v`*0 oX v ?(p ?@ @V# .//0/L/h-0///00000/0000-/000,@@0U `)0 @ @0Vb H;1 +  Z@ Ȁ`H95v ?*p @? cH@9`*0 @Y!@a@f"@YYa0Hge@v`)0 ? ? @h;v`. ?? @זG?O7~ *0 `@ @%`Ȁ@: @0 > Hg@65;w* ?? @`0 w`?*p ? @ o@ v*0 ?@ ?oc €$``M@ `N@`O@`G@w?(p   ?@ ?Œ `* @Y!@`Ȁ H"?Ɠ 87w ?*0 ?``@n `?* @Y!@@C&aHo`v(p ? ? o\㠁  @^ߨ @/  @/ @/ @/ @/ @/ @/ @e! ,p @!@\`@P5 ~`/0 9w`7w;w@V d`\ $ tH$@ o `)0+ ]@@A 4+0? `!` 0 `:+0 @L?? `!0]` )0 @? hO֚s@^oĨ@o-w?-  @۔o w  (p ?@ @є o!0.  "`)0 (`@ #*a@ ^*`+ : w9 @ w! wߐ?@  @/^`w(p   ? H a@h@o 0)' *p Y!@Z h@"X@€   +p* @!@\Y h@-[@\<X`h)ps[  )p !@\@-Zh\t`hw'  *0 a@Y@`` @I 〢 @ !w<`\@*p *_A `[@@K?〤 O `*0 < ,!@ @,\@th @$ <*@ ]Zht@ O h:`\_Y h@- [@,Ɛ \t[`h_[@-Y@oo:`_@~`(p @! H +p  @.lh @7 $@?@@.i?@#1  )p a@^a8#a, H-#a8a@-`,p   "h@.WD  @D @.Q  6@^@E#`!w(p @? "@ā@91 w. ?@ o"8 !` * + *p ~ ~ `"h&@$Ca yh@>D @,Z @|D @,S  @a^Xa*ƀ3a (p !@^Z΀@-aB8   w*0 6 @-_"X@-Tƀ!1w >`(p @@-Z`@-`hw^* [!@ ? obh@-9F@ (p 5w@-8bX4 @-, ƀ >``!w+ @-2b`@-8o 5w^* ?@ [! @5"o @ `)0 *p w?F @!bo^@5w ` *  +0 B`? @bovD3`#.0  @`Z@+0 B?z( @:`@q wo1#81w@i.p @ ?o'"1Y h7 @-kZ@Z * +0 @w@B`? @ՔX@+I 0 ~` @)0  Ɋ @-SA` "H<` @s>  ȋ;``H* ` @^?@ H[ ``HIP 1`* )0 a^1v`(p a w` `(p ?  @# 8`=hW<` v (p  ob v`* o"v)p  oۘv (p  oԘ1 v + o͘#v`.0 @oƘv(p @o#w`.0 ? @Ncxo #`+   "G@ w  (p @?@6#oz@0???@0@0@0@0@0?@0@0@0@0?D@@0@0@L ~ *  `@@۰ ް _w'_â!!@,p1&>.p - +p+~;fD@,z?`r $,3'~`7+0 9~ aI{ @2+ !? @`= ;^,@`=`o i_oז$(p ~ @*V:!\ @tdo&@*FF+?@*\ot+ !? @`=?\-\l `2OϪ`hb$+p ~<`@**!\@ @t@do$@*DD *@*\@ot@  (p @  ` @@%D,p !x@?@\ @-)~-p !? @3`#~)0 =a]+"]h `$/0 7~?`@)!\@ @t@o$@*DD)@*B\@ot@@ ~  (p  @@  #F@+! H> ` *0 (p x[@`HaH  @?`5*0 #~Z@)p  ,@Z >9 Oo>@ F@+2  6O`@^x`.0 @? @ږ`oՐ`@?@#@%`*p Y!@`Ȁ`@@+@ @w@q@+a?@\ @+c 1x  `*  @+b਀?@ @)>  @+)@)  @+$@)z @+  @6@Ȑ `+p @Y!@ Ȁ @"1@+ @ @;`*  [a@B|<`@~@` x*0  ?@x`  o`!x ?(p @l o@)>o@x(p ?@  @Z! o !@(Ȑ @ x  )0 ?@F ڐ ox?(p   @:on@ H @8^@@(ڐ @  x(p @ ?!@  hc@)[ /T*@) "H> @1 , %x@? o!` O `1+ @+0 a@ x\ Z@)a H x \*0  Y@@)a 2@ # ^@ o h#x`\* [ @)a H  x`\*0 Y@)᠀ @o  @\  O  O^@o ߙ O \'a@),p x\@Z@)X! @\b`@@  H@ H@F*p a@^@Z @t*0 @a@^@Zax @>+0 a@^@Z @ǫo@*^@@)Aa4*0 #w@@)?"X@)4@w<(p @ @):`@)@o@#`'x+p ^@\!? @;!^@oqa@)^@@)! w )0 X@)4 @) @w(p <@) b`@)o@#`^@*p 3x\x? o!@)^@@(aw (p  @(bX4 @(Ր @ w<+0 @@(ے`@(op@^^@3x+ \!? o" oGx \*0 @Y@( "O8\%x`\*p Z@("Pox?+ @  @ !@o  `)0 A`@@(65w+  X@( 4 @(z w>`)0 @ƀ"`@(~ @(@5x (p @? H@~3 ``~)0 )p   A`@(? H @ x@h` H7  1`*0 )0 T@!PY `(p vh2a `(p vh+b  (p v@h$"  (p v@h# `(p vhc  (p v@h#  (p v@h! `(p vcQPPPQQQQQPQQQQPlPQQQ0 `H1  1`*0 )0 T@"Y `(p vh$b  (p v@h" `(p vhb `(p vhb  (p v@h"  (p v@!R@R\RxRRR$@|1@'3`+p  `Za@)0 Ȋ`H2 b ?* @'ز?x   H bp x ?+ ?@  "@@N7x(p > @ fY"@ >5@'.0 .p ?@'? x x  (p ?@ `H?@b@T@R7+p ~ @ )0  G @'?? H  @ x @<`@7x1  `?(p ?@+c *0  Za@* , ~`@@Z  ?* J? x Ɉ@ ?H#@@ ܛo@7x(p > @ fܓ#@ô3`)0 *  xZ@@> Bbȓ# w@'1߳>  'ϔ @' H@ M `x(p @?? @Ȗ#@1 !*  @x[!@)p   ?@$c! +p + M@   `h @'mb H@ ` x(p <  #@ ?h @ o㾀T  )0 ߊ@  c@&w'ϒϐ @'; HP @ 1 !x(p ?#?  @j?  * @ [a@`,"H `!*0 #"hű> `@#`+0 (p M@ " h@' "H> @ x+p <  #@ 8?h x`?(p   @ .coT * @ c@&rw' @&ݔ "H@ !x`?*0  ?#o T )0 @ c@&Uw ' @& "H@ s!x`?*0  ?#o U )0 @ `@&7ww o'o @& "H@ U!x`?*0  ?#og U _)0 @ a@&wW O'O @& "H@ 7!x`?*0  ?#oI U ?)0 @ a@%w7 /'/ @&e O; @ !x`?*0  ?#o+    +p @Xa@*0 `, ~ H@[`@&5@_@&F π H?@ y (p ?@   @ fh-@&0 y`)0 ?@  H@@ y (p ?@  o __wkcj__gkcsic__ssss_o@ 9__@~`+0 ` *p !"$H9`@# ~@!\@ t@dh $@$bDD@*?@$%\@ot@@')~ (p  @#`%@%D @  ? G9?`)0 +p Ya@?]!$` ]@$o@%(D`y*0   ?`H@ #y@ J  ?, @ ʒ !#`%,0  Za@o",y` (p ? @ a o!@@#] / @ `x(p @ ?!@  h$@#x.0 @? !@)@$a H @ `*0 x? oޔ!`@ y @^" ^ \@$6^@ 4@\ \ *?\^ v` ^ *@p`vv h v`v`v` \ *@p`vt @.@N`@P9 @#Ò %F  %@#@"?9 @#@@#*}#$:eP @#-eP .@NOאh!@#l&o@@#f&o@$gP o.@@#W&o@@#o@^  *@&?)p@ @" @" v @"@< >`@ @  @? ` O^ `o*^ h+@hv @"ov !  y (p @  @#!H!+B-y5p @#`@#! **@# **L` ``?`?@ @`N@  `?`?@ O@+`;  #@@"  N@ "@q #`? H `@J`#@]@.@@ o @"n@K  `?`?"@N@+? @K   `? `?@ 2O+N@`@ 1 ?@#C hA + @@"aP"`N`N@#G@" =? * @T o @` Oܕ5p ӒZ?`o L` "O o ` @@`@o*o? `o`?o @@^" \@"ɒ @@\ *?\ \ @\ p` "v\ q @"\\ @"tt @!hov @@!ܢ@! @!אN@?  `?`?@@ @:`N@`N@   `? `? @@*o`N@  `?`?@ `" ?N@  `? `?@ 8o?" *͒@ ,@!@!B @!N?  `?`?@ @:`N`N   `? `?@@*o`N  `?`?@@ `" ?N` ` `? `?@ 8o?" * .\@ \@"  @k@\ *?\ c  HJ$ $ @!C h 39y`, @!a``7 @!4 `@!G@!Ey+p  @!!po\ @!3`@!@`@ /0 y@ @ !x@" Oy`(p  @![!o@! ?\ @ @ @`@  oۓ)p @  (rr r r @ @  @ tho@!&ox.@!!o3,@^@! .`@ ]@@@ ]` @]@ @!5=`o ]` @!+=`o ]` ``@ P\@6.` =]@ @!= "@  * o @ @ *@`]` @ = "@ ͢ *o@ @ u+@]` Ф`,@^ ^@!. @  @^ *?^ @@ (rr r r @@ f^^ @ cvv @ ` x@@@ rr @^v @ v\@@ I\`\`@ Ft@t`@ C ?@ ?@@ 1 @ .0 @ y(p @ !x@@! y H@ [!@@N?  `?`?@@ @:`N`N   `? `? @@*o`N  `?`?@ `" ?N  `?`?@ @ 8o?" `".@ @ .@}0@!= y(p  @  !!+p h?@ h @ =@  >>@ (@ @^ ^@ P 4@ @^ *?^ "Z @^ ^@ ; 4@ @^ *?^ "Z @!E@ "@v`?< @^ ^@  4@>@^ *?^  Z @!. h: > y`(p @@b @  (p )p y ybob@^ ^@ 4@  @^ *?^ " B @^!y ^`^ (p ? @b ^  ? @@ƀ @h"N @h,@@ ٔ 2H @ L`2Oh ,@@(oL,@ o`@!y +  @xy` )0 @  HD"@yy` )0   @7b@l1 y)p   @+@`  y` +0 @@T y*  @b@G  y` +p @"@;  f`@!y +  @-xy` )0 @  @P"p@ y` )0   @Cb@1 y)p   @7@  y` +0 @+@ y*  @bP@ y` +  @"@1y  * @ @"@`?@ y (p @  @ǒ"耢 @Yy  +  @ @N y (p @ @" @D y  +  @ @8 y (p @ @# @. y  +  @ @" y (p @ @# @ y  +  @z @ ` y* #(@o f`@D@   @J <@@&<  (`9 `M"@'H`k`K"@'Г9   `-e `?@O < ,@ oo'G`mOo'<,@@1 , !~ a@!J!@~ _   @\@@&<`M 8O`!_ 1 )p + Z  o`o o _@>o`ooo-/~*0 b \@ +~ (p @(\@ ` ,  b Z,Z@@@ޙ<`M `H _`1`+0 *@ !Y@?@* y ?(p @c0y(p > @@@ @ @ oϢ`y * @ @cPo@{o y`+p  oXy+  Gh@y (p @ G#p y * @#xGy (p  oђc y (p o`*p ~ )p y>` )0Ȑ[@ @1oy(p _ @%#o y`*  f`Qoc   + yG lG s9`8`G G s@ouos  l*0  `y?`; G Gs8`G G sso@_@t@o"t@t@ ~* @ otb(.0 \ z|D|D|D|D|D|D|D{<{|D|Dy{|D|D{|D|D|D|D|D|Lxxxxxxxxxxxxxxxxxxxxxxx@@r!y `(p @:c   ƀH*p @!y * @@'-`+0 c z`*0 ` `. z. @  c z +    o-@! +p 1z @ 0z  .p @v 8 z (p mHz.p  @d X o w@~__wǹhc@`ǀ@/;-~`- @!@ 6@)!~ , @@ Ho`-/)0 @Za8M@`He`!#~ *0 ` @/ߐ@t)+~ +0 @Z0*@3  + @ `H#`* )0 !@_bp\8ߖ 3;`~* +  `@ܠ p`,0 )p zb0\@@ؒ xst@̑7` ,p b0\ .+!*   -p [bp9z+@Q)p @)^8@ǐ `@)~ -  a@ HĻ> _>`@B@@_h `߭(p ;+aH@-#~_>, >? a>`ss>> 9z+ \ @``, )0 @b8ZOr\@}7 t`/0 \po,!z )0 \@@`+p +0 @!z @@Q`xo{t`+ !, @["pYa8oT -p %z'l`8`= D @`ho)  _+0 >`>>s? > s/-+*p ,0 z@``@~ )p  ! "O)@o)@V `(p   !` @ `$O%!z2`,p @]` o @~w+p w@ w@!@+ `(p   !` @ `$O)%z 2`,  @@1 # ``%~(p * ~@ b d^")v`^+ @"@_@ @ H @_@$H^ `dH: ^ dv?@M]u@ &O^h`@E dot7, > >`@=\" . 63~@ `)0 A`@@@`8H b6`+p +0  Y    `* ~*0  ~bh @gC` y >`(p @@fc@lo o o o xx㾰 ~ 5(p @"0\ 3!9/  ,p (p *0 -~7;@ߤ -z_b8a +0 <@ \\@ ;\@ @`GꀤO@ \ H `+ @ `@`@j \ !z(p @@@a@ސ @3!'+ `*p +p * +0   @ p"8 \@\@`9 *0 `@_\\ \@\@ @?4O\+0 *p  bp- ]!8\  ϸ@"\@\@ H<'-p @`@4`@2` @3`\- \@9z@ݐx@{ h!\` z, \@@@ѐ!(o@ G5\\@o.p @at+0 Zpo1*@@@$ Ha @< ,p^R@ @S&@ &O< @K HH#`z,0 @ @!@+@ @-,p@Ӑ v@0'z>)0^@@ q vO>o@ @@(^ov`* ^@@\a@ o@@ ov> @,@< )p Ot@@@ @t@  @]_@@  (p_Z r < _@ o(p@O @< +p \@ @ O< h@o@̐~)0  ```HP`!#~ + @!@1~ )p \0 @  *p @C! hMh z(p @!@@r hv*p  o@Z8 "O_1 )p `GՐ `"GӒ  z(p @oܐ!HS  ,0 @H HI~(p  b0\ 7#~)0 ! `@7#`)0 *0 @ "p!8\\@U 1`* *0  zbb \@E\\ \8`\*\h .@', t@[bpo+@ww d <`@@ @&H   @@<`o He)@ `(p   !` @ `$O#z`2`,0  @@  '~-0 ')1`@,7~ ,0 ` * ` )0 , *0 ~@@ 1;-0-0 `"@b"s$%" H%$@ $@h!$ *p +p @!`D@)0@\D@*ot > 5y,p >`z@ho`d@! +p +0 ~~ @ "b@@@E-/~-p @P@@4+)` '`* * ~*p *0  @@b"a`?;`*p*p\; @9`@9 ` H$$@O?,0 @; ``)0 *0 @ *!H@! #@?O`  (p  @!`q@?O`  @@-`> )0  (pHa!@@@  (p  @!;`(p @``O;` z`2`.0 @@$  @`@'+,  )-@!8\@+ @@["p * @Zb`@O)p @@tp@G .0 u@*@@t@* `)0 ~@!` `)0 ~A` `)0 ~@!` `*0 @!@{@ `)0 ~@!a `)0 ~Aa@ ~`)0 @ !a `)0 ~@!a `)0 ~@!a `)0 bYq@ ~  (p @ @/!@ ~  (p @ @L!@`#~+0 *p @a ~"0\ @t` )0 [p* * @)a `)0 ~@!b8@!~`+0 @a~)0  Yb0@  *p @@ `*0 @ @ߞ@ `)0 ~@!a `)0 ~Aa@N ~`)0 @ !a `)0 ~@!a `)0 ~@!a `)0 ~Aa@. ~`)0 @ !a `)0 ~@!`@ ~`)0 @ !` `*0 ~@"h@@` +p )p ~  ~~ a`!*0 f !f; @@W `)0 A`  @@ `(p   !` @ `$O!z 2`+   @ -+~- -/b+`@,)~``*p *   `-p !~)0 - )@@@:  -- `b@"p@%%%@` H$@ $@h$`,0 +0 @b!`D@)0@ \D@*ot @/`0]Y?`?@?\o@PxPF0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_set.WRAPPER_BITS=%sset.WRAPPER_ARCH=%sset.WRAPPER_OS=%sset.WRAPPER_FILE_SEPARATOR=/set.WRAPPER_PATH_SEPARATOR=:Unable to open configuration file. %sProblem loading wrapper configuration file: %sThe argument '%s' is not a valid property name-value pair.Unable to resolve the full path of the configuration file, %s: %s127.0.0.1unable to bind listener port %d, or any port in the range %d-%d. (%s)server socket close failed. (%d)unable to bind listener to any port in the range %d-%d. (%s)port %d already in use, using port %d instead.server socket listen failed. (%d)server listening on port %d.server socket ioctlsocket failed. (%s)server socket creation failed. (%s)socket ioctlsocket failed. (%s)accepted a socket from %s on port %dsocket creation failed. (%s)socket close failed. (%d)STARTSTOPRESTARTPINGSTOP_PENDINGSTART_PENDINGSTARTEDSTOPPEDKEYBADKEYLOW_LOG_LEVELPING_TIMEOUTSERVICE_CONTROL_CODEPROPERTIESUNKNOWN(%d)LOG(DEBUG)LOG(INFO)LOG(STATUS)LOG(WARN)LOG(ERROR)LOG(FATAL)(Property Values)socket send failed. (%d)send a packet %s : %sNULLsocket not open, so packet not sent %s : %sreceived unknown packet (%d:%s)read a packet %s : %ssocket read no code (closed?).socket read failed. (%s)wrapper.logLPTMLPMc%s.confWrapper (Version %s) http://wrapper.tanukisoftware.org %s [configuration properties] [...] Usage: %s [configuration properties] [...] %s ( implicitly '%s.conf') ( implicitly '-c') ( implicitly '-c' and '%s.conf') -v --version print the wrapper's version information. %s where can be one of: -c --console run as a Console application is the wrapper.conf to use. Name must be absolute or relative to the location of %s wrapper.debug=true -? --help print this help message in wrapper.conf. For example:[configuration properties] are configuration name-value pairs which override values--> Wrapper Started as Console--> Wrapper Started as DaemonUsing tick timer.Using system timer.<-- Wrapper Stopped--> Wrapper Started as ServicewrapperStopProcess(%d) called while stopping. (IGNORED)wrapperStopProcess(%d) called.wrapper.java.commandjava"%s"%sjdbjdb.exewrapper.java.additional.%d-Xdebug"-The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.wrapper.java.additional.%d.stripquoteswrapper.java.initmemory-Xms%dmwrapper.java.maxmemory-Xmx%dmwrapper.java.library.path-Djava.library.path="%s%c%s"-classpathwrapper.java.classpath.%d\"-Dwrapper.key="%s"-Dwrapper.port=%d-Dwrapper.jvm.port=%d-Dwrapper.jvm.port.min=%d-Dwrapper.jvm.port.max=%d-Dwrapper.debug="TRUE"-Dwrapper.debug=TRUE-Dwrapper.pid=%d-Dwrapper.use_system_time="TRUE"-Dwrapper.use_system_time=TRUE-Dwrapper.version="%s"-Dwrapper.native_library="%s"-Dwrapper.ignore_signals="TRUE"-Dwrapper.ignore_signals=TRUE-Dwrapper.service="TRUE"-Dwrapper.service=TRUE-Dwrapper.disable_shutdown_hook="TRUE"-Dwrapper.disable_shutdown_hook=TRUE-Dwrapper.cpu.timeout="%d"-Dwrapper.jvmid=%dMainwrapper.java.mainclasswrapper.app.parameter.%dwrapper.app.parameter.%d.stripquotes-Dwrapper.cpu.timeout=%d-Dwrapper.native_library=%s-Dwrapper.version=%s-Dwrapper.timer_fast_threshold="%d"-Dwrapper.timer_slow_threshold="%d"-Dwrapper.timer_slow_threshold=%d-Dwrapper.timer_fast_threshold=%d-Dwrapper.key=%s./Classpath element, %s, does not match any files: %sClasspath element, %s, does not exist: %sUnable to get information of classpath element: %s (%s)-Djava.library.path="%s%c%s\"-Djava.library.path=%s%c%s-Djava.library.path="%s"-Djava.library.path="%s\"-Djava.library.path=%s-Djava.library.path=wrapper.java.library.path.%dLD_LIBRARY_PATHJVM process exited with a code of %d, however the wrapper exit code was already %d.JVM process exited with a code of %d, setting the wrapper exit code to %d.JVM already down.Unable to start a JVMJVM exited while loading the application.JVM exited before starting the application.JVM exited while starting the application.JVM exited unexpectedly.JVM exited unexpectedly while stopping the application.JVM exited normally.JVM exited on its own while waiting to kill the application.Unexpected jState=%d in wrapperJVMProcessExited.JVM process exited with a code of %d, leaving the wrapper exit code set to %d.FIGNORESHUTDOWNFORWARDwrapper.logfileSIZEwrapper.logfile.rollmodeYYYYMMDDwrapper.logfile.formatINFOwrapper.logfile.maxsizewrapper.logfile.loglevel0wrapper.logfile.maxfileswrapper.logfile.inactivity.timeoutPMwrapper.console.formatwrapper.console.loglevelwrapper.console.flushNONEwrapper.syslog.facilitywrapper.syslog.loglevelwrapperUSERwrapper.ntservice.namewrapper.unix.namewrapper.portwrapper.port.minwrapper.port.min must be in the range 1-65535. Changing to %d.wrapper.port.maxwrapper.jvm.portwrapper.jvm.port must not equal wrapper.port. Changing to the default.wrapper.jvm.port.minwrapper.jvm.port.min must be in the range 1-65535. Changing to %d.wrapper.jvm.port.maxwrapper.debugwrapper.java.command.loglevelDEBUGwrapper.adviserwrapper.use_system_timewrapper.timer_fast_thresholdwrapper.native_librarywrapper.timer_slow_thresholdwrapper.java.library.path.append_system_pathwrapper.state_outputwrapper.timer_outputwrapper.sleep_outputwrapper.loop_outputwrapper.memory_outputwrapper.cpu_outputwrapper.cpu_output.intervalwrapper.memory_output.intervalwrapper.startup.delaywrapper.disable_shutdown_hookwrapper.startup.delay.consolewrapper.startup.delay.servicewrapper.restart.delaywrapper.restart.reload_configurationwrapper.cpu.timeoutwrapper.startup.timeoutwrapper.disable_restartswrapper.ping.timeoutwrapper.shutdown.timeoutwrapper.jvm_exit.timeoutwrapper.ping.intervalwrapper.ping.interval must be at less than or equal to 1 hour (3600 seconds). Changing to 3600.wrapper.ping.timeout must be at least 5 seconds longer than wrapper.ping.interval. Changing to %d.CPU timeout detection may not operate correctly during startup because wrapper.cpu.timeout is not smaller than wrapper.startup.timeout.CPU timeout detection may not operate correctly because wrapper.cpu.timeout is not smaller than wrapper.ping.timeout.CPU timeout detection may not operate correctly during shutdown because wrapper.cpu.timeout is not smaller than wrapper.shutdown.timeout.wrapper.max_failed_invocationswrapper.successful_invocation_timeThe value of wrapper.max_failed_invocations must not be smaller than 1. Changing to 1.wrapper.request_thread_dump_on_failed_jvm_exitwrapper.filter.trigger.%dwrapper.filter.action.%dwrapper.pidfilewrapper.java.pidfilewrapper.lockfilewrapper.java.idfilewrapper.statusfilewrapper.java.statusfilewrapper.commandfilewrapper.command.poll_intervalwrapper.anchor.poll_intervalwrapper.umaskwrapper.java.umaskwrapper.pidfile.umaskwrapper.lockfile.umaskwrapper.java.pidfile.umaskwrapper.java.idfile.umaskwrapper.statusfile.umaskwrapper.java.statusfile.umaskwrapper.anchorfile.umaskwrapper.logfile.umaskwrapper.ignore_signalswrapper.daemonizewrapper.signal.mode.hupwrapper.anchorfilewrapper.ping.interval must be at least 1 second. Changing to 1.%s must be in the range 0 to %d days (%d seconds). Changing to %d.wrapper.jvm.port.max must be greater than or equal to wrapper.jvm.port.min. Changing to %d.wrapper.port.max must be greater than or equal to wrapper.port.min. Changing to %d.wrapper.logfile must contain "%s" for a roll mode of DATE. Disabling log file rolling.wrapper.logfile.rollmode invalid. Disabling log file rolling.Got a log message from JVM: %sGot key from JVM: %sReceived a connection request with an incorrect key. Waiting for another connection.%dIncorrect key. Connection rejected.Got ping response from JVMJVM requested a shutdown. (%d)JVM requested a restart.wrapperRestartProcess() called.wrapperRestartProcess() called. (IGNORED)JVM signalled a stop pending with waitHint of %d millis.@@JVM signalled that it was stopped.JVM signalled a start pending with waitHint of %d millis.@@JVM signalled that it was started.Filter trigger matched. Shutting down.Filter trigger matched. Restarting JVM.------------------------------------------------------------------------The JVM is being launched with a debugger enabled and could possibly besuspended. To avoid unwanted shutdowns, timeouts will be disabled,removing the ability to detect and restart frozen JVMs.Working directory set to: %sUnable to set working directory to: %s (%s)wrapper.working.dir3.2.332x86windowsUNKNOWNDOWNLAUNCH(DELAY)LAUNCHINGLAUNCHEDSTARTINGSTARTEDSTOPPINGSTOPPEDKILLINGStartup failed: Timed out waiting for a signal from the JVM.wrapper.java.mainclassMainorg.tanukisoftware.wrapper.WrapperSimpleApporg.tanukisoftware.wrapper.WrapperStartStopApp------------------------------------------------------------------------The Wrapper consists of a native component as well as a set of classesAdvice:Wrapper must be initialized promptly after the JVM is launched or thewhich run within the JVM that it launches. The Java component of thespecified in the Wrapper configuration file is not correctly initializingWrapper will timeout, as just happened. Most likely the main class %sthe Wrapper classes:While it is possible to do so manually, the Wrapper ships with helperclasses to make this initialization processes automatic.Please review the integration section of the Wrapper's documentationwithin the Wrapper:for the various methods which can be employed to launch an application http://wrapper.tanukisoftware.org/doc/english/integrate.html Loop: check anchor fileAnchor file deleted. Shutting down. Set Wrapper State %s -> %swUnable to write to the status file: %s%s Loop: check command filer+tCommand '%s' not supported on this platform, ignoring.LOGFILE_LOGLEVELSYSLOG_LOGLEVELRESTARTSTOPCommand '%s'. Restarting JVM.Unable to delete the command file, %s: %sPAUSECommand '%s'. Shutting down with exit code %d.RESUMEDUMPCONSOLE_LOGLEVELCommand '%s'. Requesting a Thread Dump.Command '%s' is missing its log level.Command '%s' specified an unknown log level: '%'Command '%s'. Set console log level to '%s'.%dCommand '%s'. Set log file log level to '%s'.Command '%s' lead to an unexpected state.Command '%s'. Set syslog log level to '%s'.LOOP_OUTPUTSTATE_OUTPUTTRUECommand '%s'. Disable %s.Command '%s'. Enable %s.MEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTCommand '%s' is unknown, ignoring.Unable to read the command file: %swrapper.on_exit.%dJVM Restarts disabled. Shutting down.Waiting %d seconds before launching another JVM. Set Java State %s Timeout %08lx -> %08lx Set Java State %s -> %sThere were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.JVM was only running for %d seconds leading to a failed restart count of %d.Waiting %d seconds before launching the first JVM.wrapper.on_exit.defaultshutdownrestarton_exit trigger matched. Restarting the JVM. (Exit code: %d)on_exit trigger matched. Service is paused, will restart the JVM when resumed. (Exit code: %d)Reloading Wrapper configuration...com.silveregg.wrapper.WrapperSimpleAppcom.silveregg.wrapper.WrapperStartStopAppThe com.silveregg.wrapper.WrapperSimpleApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperSimpleApp class instead.The com.silveregg.wrapper.WrapperStartStopApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperStartStopApp class instead.Launching a JVM...Ping: Timed out waiting for signal from JVM.ping DebugJVM timeout. Disable current %s timeout.The JVM was launched with debug options so this may be because the JVM%sis currently suspended by a debugger. Any future timeouts during thisJVM invocation will be silently ignored.JVM appears hung: Timed out waiting for signal from JVM. Temp: Sending a ping packet. Temp: Sent a ping packet.JVM Ping Failed. Last system time tick overflow at: %s Next system time tick overflow at: %s Last tick overflow at: %s Next tick overflow at: %sEvent loop started.no Loop: %ssleep Loop: process jvm outputPause reading child output to share cycles. Loop: process socketPause reading socket data to share cycles. Loop: maintain logger(2)truefalse Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%s Loop: exit requested Loop: handle wrapper state: %sUnknown wState=%dEvent loop stopped.Startup: Timed out waiting for a signal from the JVM.startupStart Application.startUnable to send the start command to the JVM.Startup failed: Timed out waiting for signal from JVM.Shutdown: Timed out waiting for a signal from the JVM.Shutdown failed: Timed out waiting for signal from JVM.Shutdown: Timed out waiting for the JVM to terminate.JVM exitShutdown failed: Timed out waiting for the JVM to terminate.Unknown jState=%d Loop: handle jvm state: %sSending stop signal to JVM Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (N/A), Exit=%s, Restart=%sWrapper Process has not received any CPU time for %d seconds. Extending timeouts. Loop: maintain loggerSignal trapped. Details:UNKNOWNSIGALRMunknownkill, sigsend or raise signal number=%d (%s), source="%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s) signal err=%d, "%s"mesq state changedAIO completedtimer expiredsigqueueSIGHUPSIGINTSIGQUITSIGKILLSIGTERMSIGCHLDSignal trapped. No details available.%s trapped, but signals for timer thread are ignored.%s trapped. Restarting JVM.%s trapped, but ignored.%s trapped. Unable to forward signal to JVM because it is not running.%s trapped. Forwarding to JVM process.Unable to forward %s signal to JVM process. %s%s trapped. Forcing immediate shutdown.%s trapped. Shutting down.Could not mask signals for timer thread.Timer thread started.The timer fell behind the system clock by %ldms.The system clock fell behind the timer by %ldms. Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ld Sleep: nanosleep %dms Sleep: awakeCommand[%d] : %sCould not init pipe: %sUnable to set JVM's stderr: %sUnable to set JVM's stdout: %sw%d Unable to write the Java ID file: %sUnable to write the Java PID file: %sFailed to set jvm output handle to close on JVM exit: %s (%d)Failed to set jvm output handle to non blocking mode: %s (%d)Could not spawn JVM process: %sUnable to start JVM: %s (%d)WIFEXITED indicates that the JVM exited abnormally.JVM exited in response to signal %s (%d).Unable to request JVM process status: %sFailed to read console output from the JVM: %s (%d)Dumping JVM state.Could not dump JVM state: %sSpawning intermediate process.../dev/nullSpawning daemon process...Could not spawn daemon process: %ssetsid() failed: %sUnable to get the path for '%s'-%sUnable to extract path from: %sUnable to set working dir to %s : %s?-helpv-versionc-consoleWARNING: Could not write lock file %s: %sERROR: Could not write pid file %s: %sERROR: Could not write anchor file %s: %s Unrecognized option: -%s Timer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.INTTimer thread received an Quit signal. Ignoring.Received SIGCHLD, checking JVM process status.JVM process was still running after receiving a SIGCHLD signal.TERMHUPUnable to register signal handler for signal %d. %sLaunching Timer thread.Unable to create a timer thread: %d, %sCall to getrusage failed for Wrapper process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldCall to getrusage failed for Java process: %sJVM did not exit on request. Attempt to terminate process failed: %sJVM did not exit on request, terminatedrt#includeset.default.set.%s=%sUnable to set environment variable: %s The following property name value pair is too large. Need to increase the internal buffer size: %struefalse name:%s value:%sNONE DEBUG INFO STATUSWARN ERROR FATAL ADVICENONESIZEWRAPPERJVMSIZE_OR_WRAPPERSIZE_OR_JVMDATEFATALERRORWARNINFODEBUGUSERLOCAL0LOCAL1LOCAL2LOCAL3LOCAL4LOCAL5LOCAL6LOCAL7wrapper jvm %-4d | wrapperpmain srvmaintimer unknownsignal %s%c%04d/%02d/%02d %02d:%02d:%02d%04d/%02d/%02d %02d:%02d:%02d.%03dYYYYMMDDROLLNUM-ROLLNUM_ROLLNUM.ROLLNUM.%s-YYYYMMDD_YYYYMMDD.YYYYMMDD%04d%02d%02daUnable to open logfile %s: %s %s wrapper.logWARNING - Encountered an unknown thread %ld in getThreadId(). %dUnable to delete old log file: %s (%s) Unable to rename log file %s to %s. File is in use by another application. Unable to rename log file %s to %s. (%s) Unable to get the current logfile size with ftell: %s Unable to get the current logfile size with stat: %s ????????Pxp`X80o0o0o0o0o 0o@0o`0o0o0o0o0o0o 0o@0ow`0oo0og0o_0oW0oO0oG 0o?@0o7`0o/0o'0o0o0o0o 0o@0o`0o0o0o0o0o0o 0o@0o`0o0o0o0o0o0o 0o@0ow`0oo0og0o_0oW0oO0oG 0o?@0o7`0o/0o'0o0o0o0o 0o@0o`0o0o0o0o0o 0o 0o @0o `0o 0o 0o 0o 0o 0o 0o @0ow `0oo 0og 0o_ 0oW 0oO 0oG 0o? @0o7 `0o/7P\oz | x-  ` oeoAo@BBH ooMX:8@HPX`hpMXHXx `-ABHBB K |   (H0@PX`p&6 KQ L`1 LT]Hk0y@PL Lx0p`X%&.H@ $; pV8](cXoP}`  $ l0 T H@h`" [6 E <<Y p\hh |`  U8 @ lL@ " *0 C !J `Y q ʘ0@!x  ` `p\  ' ' Q9 $hO U 6b@j u  b @ pd ]\ | % fHD1h9XB Z q(Tmv@}  @ " l S8 \ @  [! $)`/B &dQV pc x +t  L| Fh `* 1 BN U@\[ H n`u n x O  lT @` W t L. `= HY [|Li Hn &| P4 ( < l`$  ] p  l . < X G  \  r Px  \  Ɉ   0, `  ~p    x,   [ 4 > L e [ ` f  | ,  O  (  @  ,  o  \X  o|  S   - 7 Ȉ$ I x _ Ƅ z W     m   <  _  e  x `    * 2 ( A , R (| ^` e w ~ @  ^  T  $`  j  dpP  p @ d  % O @ 9 O U 8X f ,h     0t    <  (   * @5= `PK cw 7t  oT@ x<4 n  m8 s$ H5 1H E lZ r~  a ` V4| Pd UP`  hx E08) DD8  F@M Ȭ` v ,  , 4P & j$ ,(h$ S3 ÈI [ n q|L}    ČH  (`  Ą Ϥ( 2< N( ] Xj8{  V &p  [P   " 1  M c XT~ A |h rd l q l" ,P- , 5 ǔlE ([ w  sx 8 '     \l _|  )$ K+ ?@EJ P @,q``g|@(  4h,../../bin/wrappercrti.svalues-Xa.ccrtstuff.ccall___do_global_dtors_auxcall_frame_dummyforce_to_data__CTOR_LIST____DTOR_LIST____EH_FRAME_BEGIN__object.2completed.1p.0__JCR_LIST__wrapper.cunknownBuffer.0seeded.1wrapperinfo.cwrappereventloop.cwrapper_unix.cjvmPidproperty.clogger.c__DTOR_END__call___do_global_ctors_aux__CTOR_END____JCR_END____FRAME_END__crtn.s_START__END_gettimeofday_lib_versionsrandqueueWrappedgetLogfileActivitydup2disposeInnerPropertysigActionChildDeathwrapperVersionBanner_edatafopenwrapperDumpCPUUsagedisposeLoggingsetConsoleLogFormatgetIntProperty_Jv_RegisterClasses_exitputsasctimevsnprintfsigActionTerminationcurrentConsoleLevelglobfreelogLevelNamesgetInnerPropertygetpwuidpthread_selfrecvwrapperVersiongetSignalModejStateStoppedprotocolStopServer_etextgetLowLogLevelwrapperStoppedSignalledwrapperGetJStatelogfileFPfprintfstrcmpthreadMessageBufferSizepthread_mutex_unlockmemcmp_environgetpidjStateLaunchevaluateEnvironmentVariablesjStateLaunchinglogTimerStatsgetSignalCodeDeschandleDebugJVMTimeoutchdirwrapperSleepsprintfgetLogFacilityForNamecurrentLogfacilityLevelpacketBufferloadPropertiesInnerputchargetBooleanPropertywrapperKillProcessNowunregisterSyslogMessageFilefgetsinet_ntoapthread_createaddPropertypipedeskeyCharswrapperJVMProcessExitedisQuotablePropertystrerrorstrdupqueueReadIndexcommandPollunlinkwrapperSetJavaStateloadPropertiessigActionInterruptcurrentLoginfoLevelwrapperReportStatuswrapperDatastrstrwrapperGetPID__iob_endftellpthread_mutex_lockwStateStoppingceilflushLogfilewrapperSetWorkingDir_PROCEDURE_LINKAGE_TABLE_strcasecmpjStateKillingsocketwrapperStartPendingSignalledstrcpyconsoleFlushwrapperLoadConfigurationPropertiesdaemonizememcpywrapperGetFileBasegetenvcheckAndRollLogswrapperBitsprotocolOpenlogFileLastNowDatesignaladdPropertyPairsetLogfileRollModewrapperGetLastError__register_frame_infopthread_equaldisposePropertieswrapperDisposesetsidsendgetsidwrapperProtocolClosewrapperKeyRegisteredmaintainLoggerlimitLogFileCountHandleFilewrapperGetTicksmainwStateStoppedgetSignalNamegetLastErrorTextwrapperLogChildOutputcreateInnerPropertystrlenprotocolSendBufferSizeensureSpaceInChildOutputBuffercurrentLogFileNamesetLogfileMaxFileSizeIntconsoleFormatpropertieswrapperPingRespondedlog_printf_queueInnerwrapperBuildKeysetSyslogFacilityIntwrapperSetWorkingDirProppipeInitializedsetSyslogLevelssdgenerateLogFileNamesetLogfileAutoClosesetSyslogFacilitylogFileMaxSizewrapperProtocolFunctionwrapperGetProcessStatusremovePropertyforkerrnowrapperGetSystemTicksreleaseProtocolMutexwritePidFilewrapperSetWrapperStatelogRegisterThreadreleaseLoggingMutexwrapperStripQuotesjStateStartedcheckPropertyEqualsigActionQuitsetLogfileUmasksigaddsetwrapperGetTickAgesetConsoleLogLevelIntwrapperBuildUnixDaemonInfowrapperInitializeRunlocaltimewrapperStartedSignalledtrimremovesetLogfileFormatsetWorkingDirwrapperParseArgumentsrollLogsnanosleepwrapperClasspathSeparatorlog_printfwaitpidjStateStartinglockLoggingMutexgetThreadIdmallocchildOutputBuffermemsetwriteStateFilewrapperProtocolReadloadConfigurationgetLogfileLevelIntlinearizePropertieswrapperInitializewrapperBuildJavaCommandArrayInnerrenamelogFileRollModewrapperRequestDumpJVMStatewrapperExecutefcntlwrapperEventLoopgetOutputFilterActionForNamewrapperGetWStatebinddisplayLaunchingTimeoutMessageputenvtimerTickssetSyslogEventSourceNamethreadMessageBufferthreadPrintBufferSizesendLoginfoMessageinet_addrforceFlushstrrchrqueueMessageswrapperRestartRequestedcurrentLogfileLevelwrapperBuildJavaCommandlogFileUmaskgetStringPropertywrapperOSopenlogpthread_sigmaskbuildPrintBufferwrapperStopProcesssetEnvgetLogLevelForNamechildOutputBufferSizelog_printf_queuesigActionCommonwrapperStopRequested__deregister_frame_infowrapperArchsetSyslogLevelIntsetInnerPropertywrapperFreeJavaCommandArrayqueueWriteIndexregisterSigActionprotocolStartServersigActionHangupstrtolinitLoggingwrapperKillProcesssendPropertieslogfileFormatlistenwrapperTickExpiredgetConsoleLogLevelIntlockProtocolMutexthreadIdssetConsoleLogLevelupdateStringValuewStateStartedwrapperRunConsolewrapperGetCurrentTimequeueLevelskillloginfoSourceNamelastLogfileActivitysigActionAlarmwrapperRestartProcessthreadPrintBufferlogFileMaxLogFilesdumpPropertiescloselogprotocolSendBuffercloseLogfilewrapperBuildJavaCommandArraylimitLogFileCountwrapperAddDefaultPropertiessetConsoleFlushcorrectWindowsPathanchorPollgetLogfileRollModesigactiongetSyslogLevelIntqueueThreadIdsgetLastErrorautoCloseLogfilerealpathsetLogfilePathstatinitializeTimerlog_printfMutexwStateStartingfclosewrapperUsagewrapperDumpMemory__dso_handlewrapperAddToTicksexecvpwrapperUpdateJavaStateTimeoutwrapperStopPendingSignalledsetLogfileMaxLogFileswrapperProtocolGetCodeNamewrapperReadChildOutput_initstrchrfflushprotocolMutexgetLogfileRollModeForNamecreatePropertiesreplaceStringLongWithShortglobtimerThreadIdwrapperRunServicedescSignalappExitvalidateTimeout_GLOBAL_OFFSET_TABLE_setLogfileMaxFileSizeatexitlogFilePathjStateLaunchedsigemptysetsetLogfileLevelIntworkLogFileNamejStateDownlog_printf_messagesyslogjvmOutgetrusageinsertInnerPropertyjStateStopping_DYNAMIC_startwrapperLogSignalledumaskpipe_finisetLogfileLevelacceptlogfileActivityCountqueueSourceIdsatoisendEventlogMessagetimerRunneras: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 @(#)SunOS 5.9 Generic May 2002as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 GCC: (GNU) 3.3.2as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 ld: Software Generation Utilities - Solaris Link Editors: 5.9-1.373 <Y4.interp.hash.dynsym.dynstr.SUNW_version.rela.got.rela.bss.rela.plt.text.init.fini.rodata.dynamic.data.ctors.dtors.eh_frame.jcr.data.rel.local.symtab.strtab.comment.stab.index.shstrtab.stab.indexstrvalues-Xa.cXa ; O ; V=3.1 ; R=Sun WorkShop 6 update 1 C 5.2 Patch 109513-05 2001/06/04/on81-builds/on81_58shwpl3/usr/src/lib/libc/sparcv9; /opt/SUNWspro.40/SC6.1/bin/../WS6U1/bin/cc -xO3 -xarch=v9 -dalign -v -Wc,-Qiselect-regsym=0 -xspace -W0,-Lt -Xa -xildoff -errtags=yes -errwarn=%%all -erroff=E_EMPTY_TRANSLATION_UNIT -D_REENTRANT -Dsparc -Iinc -I../inc -DTEXT_DOMAIN='"SUNW_OST_OSLIB"' -I/on81-builds/on81_58shwpl3/proto/root_sparc/usr/include -c -o values-Xa.o ../port/gen/values-Xa.c -W0,-xpXX xx   ` ` "--oAA-BBHBHH 7BBBHABBB@KKKSdQ||W]Kq2((PF  enHHt00{@@PPXX``<pp Qh&A  5%9$  ::mule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/wrapper-linux-ppc-640000755000175000017500000042164610567556635030503 0ustar charlescharlesELFp@@8@&#@@@nnppp*IPPP /lib64/ld64.so.1GNUSuSE CYQ.?EHC4! RN ="MGL7&K*AXPBVTJ5%8;@IS W:U+2-  ),(3#/1'>0F$9 O<6DX~NkbqH>2?bri6aP |O9&'pw,+Jy%Ewir Q  libm.so.6_Jv_RegisterClasses__gmon_start__libpthread.so.0libc.so.6stdout.__strtol_internalacceptsignalremoveexecvpstrcmpdup2gettimeofdaypthread_equalpipevsnprintfpthread_selfsocket__xstatcloselog__libc_start_maingetsidmemsetmemcpystrcpyasctimeforkglobfreeinet_addrexitsigaddsetstrerrorstrcasecmpunlinkrenamenanosleepgetpidrealpathgetenvfgetssigactionpthread_mutex_unlockstrrchrlocaltimegetpwuidmallocgetrusagebindfclosesprintfsigemptysetlisten__errno_locationstrstrreadrecvsendumaskstrchrsrandsyslogputenvkillmemcmp__strduppthread_mutex_lockinet_ntoaftellfopenglobpthread_createsetsidputcharopenlogfprintfstrlenputsfflushfcntlceilpthread_sigmaskwaitpidchdirGLIBC_2.3 ii. ii> ii&0H` x     8Ph(@Xp !"#$%&'0(H)`*x+,-./02 384P5h6789:;<=(>@?X@pABCDEFGH0IHJ`KxLMNOPQR S8TPUhVW|!H H `H`8!p|N =A(lPLX}il`N =A(lL}ilN =A(lL}ilN =A(l`Lh}ilpN =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lHLP}ilXN =A(lL}ilN =A(lhLp}ilxN =A(lL }il(N =A(lL}ilN =A(lXL`}ilhN =A(l8L@}ilHN =A(lL}ilN =A(l@LH}ilPN =A(lhLp}ilxN =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lhLp}ilxN =A(lXL`}ilhN =A(l L(}il0N =A(lpLx}ilN =A(lL}il N =A(lL}ilN =A(lL}il N =A(lL}ilN =A(l(L0}il8N =A(lL}ilN =A(lL}ilN =A(lHLP}ilXN =A(lL}ilN =A(l@LH}ilPN =A(lL}ilN =A(lL }il(N =A(lL}ilN =A(lXL`}ilhN =A(l`Lh}ilpN =A(l(L0}il8N =A(lpLx}ilN =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(l8L@}ilHN =A(lL}ilN =A(l0L8}il@N =A(lxL}ilN =A(l0L8}il@N =A(lL}ilN =A(lPLX}il`N =A(lL}ilN =A(lL }il(N =A(lxL}ilN =A(lL}ilN =A(l0L8}il@N =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lpLx}ilN =A(lL}ilN =A(lL}ilN =A(l@LH}ilPN =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lHLP}ilXN =A(lL}ilN =A(lL}ilN =A(l(L0}il8N =A(lL}ilN =A(lL}ilN =A(l L(}il0N =A(lL}ilN =A(lL}ilN =A(lL}ilN =A(lL}il N =A(lL}ilN |) xx!8!|KA( @$_start|!"/A | A(IiN!A(8!p|N |b! /@d ?I/@ HD ?9)? A(j| JN!A(?I/@b8 8!|N |b(!/A0/@8!p|N KA(8!p|N N }c P=@b daCM} }p|x"|6p|(P|N |Px8dN  ||cN |뢀8|#x8x|x!q8`=,@8i:xx袀HHa`8!a|hN 袀@H9`=i:xx袀HH`8!a|hN ,|<`^9`!@,|<`^|#x|fx88`8} CxA8!p}c[x|N 袀PH`<``k^K|h88a8`!?,@P ,@`H`8N|ex8`8|H}`8!}N 袀XH`,AH9`8N8|ex8`H}9`8!}N |h88a8`!?,@$,LA48!!}(N 袀`HI`?,L@Ԁ,@8H`8|Hd`8!!}(N HQ`8K||fx뢀88||x8`!a=,@/M,K|&TT?|x,AT}IvH8H`Ȃp||xp!p`# $K5A(x@Ax~Hc`8!a}hN 袀hH `=Kd||fx뢀88||x8`!a=,@0 ,L/MA@Ad8!!}(N 袀xH`},L/M@888M8`Hz`] ,M@|v08H`Ȃp||xp!p`# $KA(x@Ax~Hb`8!!}(N 8|(!Ax0x|2|2| N  \\\|e肁(b KA(b 8!p}N bKbKbKbKbKbKbKbKbKbKbKbKbKbKbK|bKtbKlbKdbK\bKT|袀8|x!q*KA(,8`/@T@8!|N 袁@8`x8H `8`8!|N H֍`x8袁8|gx8`H`8`K|h袁H肁Pa!e8H`9`,#A,@8!p}c[x|N K`|kx8!p}c[x|N ,#||#x|}xa!aAd;| @L;`H}?@8{$9?|*,|#xAKmA(8~*|AxKMA(8!a|N ||~x|#x!K5A(99@|@x8H(,"AX88}A||@L}~P, \@P@}R,\AH,"AT9(}A}(9j}jA88!|Aa|hN 9(8 }A| K9(8 |AK|/$|~x|#x!,%|+x@H|#xA(K!A(8cKA(x~KeA(8!a|hN KA(,?8xAKA(K|肀|}x!qK A(9 [|dxx,A,肁XKA(|ip}(x|HP|p|x9#\8!}#KxA}HN ,#||#x|#x|x!A|肁`KuA(8d|dxx,A\肀KUA(8e|fxx,A<肁XK5A(8f|gxx/A肁hKA(x,A 8!|x}N 8gK|8€8!q(,A 8!|N 뢁H肁p}H`肁x|+x8HE`8gK`8!|N |hHa!Aa!Q袁肁~H`|}xHɝ`~袁肁H`H`,|xA,ADHƭ`~袁肁Hu`H `~袁肁HY`Hq`~袁肁H=`HՕ`~8肁H`H`~8뢀8肁H`,@,肁8x~H}`8|3xT|Hƥ`~袂肁H`H`~袁肂H`Hi`~8肂H `Hƙ`~袂 肂HQ`H`~袂0肂(H5`Hy`~袂@肂8H`|ex肂H~H`H`HY`/@PH`\9`8肂P~z,He`>8}肂Xz8}#Kx<HE`y<_<9 +A~;`肂hceH`@=@9( Aԁ}<|X@8;9+c @| x=@8`8B袂pH`H8뢀8肂xH`~H<H, @|8|A@bH8y€8{肂>H]`yLL;(A肂8|{H1`P=P8+@L8`9&| @袂9@8`P8yF H`8H8h肂_H`zȀ,@Hę`/@낁HB8袂肂|H`HY`|8肂~`}c[xzHU`{́?x, A(8,A 肂= ?|a%H `cC 肂}Cx_0H` 袂@肂|;x:4H%`8肂y|3xH`肂~|+x8zH`8肂{}cxHe`|8肃}c[x:HE`8<肃y}#KxH%`8\肃~}CSxzH`8肃{}CxH`8肃 |;x:H`8肃(y|3xH`肃0~|+x8zH`8肃8{ xHi`:|x肃@|xHM`y$$/A|x肃HH%`~((,A肃P8|H`<<,A肃X8|H`8肃`~@xzH`肃h{D|+x8 H`8肃p~}cxHu`|8肃x}c[x:HU`8<肃y}#KxzH5`8\肃{}CSxH`8肃~}CxH`|gxbhK`:|fxbpK`z|exbxK`|lxbK`|kxb~K`z|/@ H,A €8/@_9:|HA , @?,@| XA p@XA H,@|XA l낁H8肃|H`肃А`|x8,>H`xy\`/@肃8|H`Hd,@8;;`{$h|~`*KA(9<}<Hdh| ~9*AB8\x}hKA(epehKA(dpH<d;d낀8|肃cd8ap8|KA(8p8H~H`/#@낀8d/@ |jyC$KA(|h;fxdKeA({pDd,@ Txx9?肃8ap};{$exK A(y88pHm`|zxhKA(8cKA(~Dx|}*h|}(*K5A(ex8ap肃KA(y8p袀H `K`{dxp|f.ld|AD뢀8=(/@ H8肃~H`=|dx8ixK`xK!`H P<9`a`9?| @9 袂`8`y& @8H`8H8~肂x_H`zH<H/ @H8|(A x~8yx肂xH`|LL;(@@袂;y8`L88yH߅`肂8|{HI`P=P8+A}L X@8;`9+c`|@| x=P8`8R袂H`肁H88d肂H`?|Ȁ,A8`H`8`Hq`K(,A肂<?|`ţHy`|c# 肂}c[x?0HU` 袂@肂}cxz4H`\8肂{}CSx:H`8肂y}CxH`8肂|;xH`8肃~|3xzH`肃{|+x8:H`8<肃y}#KxHq`|8肃}c[xHQ`8肃 ~}cxzH1`8\肃({}CSx:H`8肃0y}CxH`8肃8 xH`z|x肃@|xH`{$$/A\|x肃HH`~((,A(肃P8|Hi`<<,A肃X8|HA`8肃`~@x:H!`8 肃hyD}CxH`8肃p|;xH`肃x~|+x8zH`8肃{|3x:H`8<肃y}#KxH`|8肃}c[xHa`|lxbhK}`z|jxbp^Ka`:|hxbxKE`|gxbK)`|exbK `z|/@,AX€8,@_9:HA>i,@P ,@ XA>i,@i| A>i/ @| A낁H8肃|~H`肃А{`|x8,>H`xy\`/AP袃8`8H`9@_`肃8|H`Hd,A0낀8;<dK|8肂Hu`~,K9}袂`8`<88}Hm`KH}`K袁8`8HE`;xH`H袁肁~HY`H`~袁肁H=`HU`~袁肁H!`Hy`~8肁H`H`~8€8肁H`,@~8肁He`낀8 9H}SxW|H`H袂肁~H`H`~袁肂Hi`HI`~8肂H`Hy`~袂 肂H1`H`~袂0肂(H`HY`~袂@肂8H`|ex肂H~H`H`H9`/K8`K9袃8`8Hm`K=P8`8R袂K8=@8`8B袂`KT?8`8袃H`€8K`肁xKA(,#@8`8袁H`;K袃8`8H`€8KL袃8`8H֭`€8K袃8`8H֑`€8K08D WZ >@<8}|}@(K|~*x肀HK)A(WZ>D WZ >AxKA(K뢁H,8p} &W9 H`肅8|xx8apKA(( A 8`-@ xxKA(8cKA(W9@> ! W9>{$||x|*xA,Ax8 KʁA(,A肅xxKMA(@~:*肅@~#xKqA(@,88pKK0<`^ A@ ;??~<`^4~A,A 8`,KA(,{$|g*A ^=ffafg4p|肆hx"^p| P|KȉA(Kꂀ8t. @-;bH8肅pkH`/#|~xA ,8A KQA({u$|yxxK=A(}Y:~xK-A(|x|u*A xKA((@Xz-\A $낅xxxx肅KǽA(;A`8` {$KA(;肅r|z*KljA(@H;@8|@88|'H,@@;@L9}@B89}}/A8@X9?}?A,8`{$KA(|u*Hc`|ex肆@|u*KA(K|*x肀HKA(AxxKA(Kh;@~9;8肅X};H`-|`x@8`K€8-{$fKuA(8cKmA(|y*A^肆K1A(K†x.{$~K1A(8cK)A(|q*AH肆KA(K<8`{$KA(b8肆K|~*z89}KŹA(;A"H{$袆肆yH `|qxKA(8cKęA(~%x肀H|}*KeA(K8.8`-KqA({$|h*Aꂀ8肆tK-A(K8`{$K9A(8肆(|w*RKA(K8`{$K A(b8肆 S|y*NKA(KK`.{$€88|xKA(8cKùA(|r*A肆8xK}A(8|A8`{$KÁA(袀8肆e|~*FKEA(K-8`KQA(z\$:||*;`@8:肅:8ap~KA(8p8HxH]`.#|~xAKA(,#|xAx8*KA(,A:!x88~&xKA(/ Ap;@|:@@bx{^$|~*K}A(|yx8|@@D|x;{*cxKUA(x肀H||*K!A(xKA(?@A,@}|*;3肀H}+}*|`*|hxKA(88| @|ADHx8?KùA(,|}x@xKA(^x//A ,\A8`Dx8KA(,AA`9?/,b}?@@€8~K@|@H8;>KlH`8袉|fx8`H`8!!}(N b8 8,@,|A$袉8|8`8xHm`b8+iȓD/ @4邈8lKUA(,@|H=M`8|fx袉H8`H€88/ @H`8袉0|ix8`B:>H`H=`|dx8`Kq`K`K`8`8袀8~408!!}(N >;KH`8袉|fx8`HQ`KY`K`8!!}(N F8`8袉@H `KH`^8袉(|hx8`B>H`K}(8|}x!!a8apK)A(xP|v!p8!|@=|>t|e P}a|hN |!8apK`ap9x8!yc }it肉X|a}Ia|Bx}e yL}, yht"ye"y'|BxĀ(|d*|N |h!Aaa!1;!#xK`aA‡؀~,AX|c8p88KA(|c,A/@dx낉p;p8p88KiA(|`,A88袉p|d,@8+At"x }KJ} J} N XL@XX0XXXXXX8,@t#xK`8`9` PP},,A‡؀~,@∸,A@K`9`‡؀~/A|c8p88K%A(|c,@H9`hl hhX}p}p}Kbx|BxKPPgPy8/@(,hA "8/@K`9`8!}c[x!A(a!N !p,A(/A8}<|KxKe`8p|fx8`袉xH`Kp8`袉8H`KtK `9`,@KH8肉p|K`K@bpK`K0K=`K$K`Kbp88 8KA(|cK`Kbp88 8KuA(|cK]`KK`KKƝ`Kbp88 8K5A(|cK`Kb8,AX袉h8`8H`K@Hz}`8袉`|fx8`H`K|≐!1肉8apKIA(8p8뢁H8}Hi`8ap‰肉KA(}88p8Hi`b肉8apKA(}8p88Hi`}88肉Hiq`}88肉HiY`8!a|hN |hHa!q,#AH^E`8HY5`;HK`€8,@xHl @€8^{$8|8 |@*Hh`8,|A8`8袉 |@*H`8`8!A}HN 88`KA(~XX|KmA(,#@ Hx%`8袉|gx8`H]`8`8!A}HN €8肁HdXHl!`,A8>i/Al8`8!A}HN 9 %K`,8`Al8`8袉XH`8`KHX8`8袉H`K/4A0A,3A,bN ,8A$,9@bN bN bN bN 8c(A@肊@xe|e"|"| N ld\TLD<4,bN b8N bN bN bN bN b0N b(N b N bN N N ,|8!AHKe`ŠH|x>i,@P88!!}(N BH 8!!}(N iK`x袊P|fx8`8H`>K|ŠH|+x|}x8`|#x8!q~t,AHk8 t/@x8K`8!!}(N 袊XH`x8`袊`8H`8`8袊hH`8`8袊pH`8`8袊xH`88`袊XH`9ܑt/AH袊x8`8H]`x8K`8!!}(N |ha;a!8aKA(K`;p8b|}xx |8a;ax} PKA(ɣɃc#١فa!0C #(cxA!KA(肊`|ex8apKA(8apK-A(x8}c袊8`H-`}=P8aB} Py|K5A(ȣȃء؁#0c C(cx!aAKA(肊`|exxKqA(xKA(8|袊8`xH`肊Hd,,A(8!aN H4`|}xb|8ax|0PKIA(ɣɃcC١فaA#0# C(cx!!AKA(肊`|exxKA(xKA(x8}袊8`H`}]P8ab}*Xy KA(ȣءC0ȃ c(cxA؁aK=A(肊`|exxKA(xKA(x8袊8`H`8!aN ,||dx|x8`!@,肊H$i,@<8!|N H0]`,A肊H$i,AixK`/AH7!`8!|N ,||dx|x8`!@0ŠH>i,@@8!|N H/`,AŠH>i,AixK]`/Axp8,A,袊肊K`8!|N 袊8`H)`8`H1`8!|N ,||dx|x8`!@0ŠH>i,@@8!|N H.`,AŠH>i,AixKM`/Axp8,A,袊肊K`8!|N 袊8`H`8`H0`8!|N ,||~x!q@H?i,@fK`xKm`,AD/@(袊8`8gK`,AP?/ @8!N ixK`/A_ p,AP袊x肊Kq`8!N 8`xH,`,@Kt袊88`H`8`H/U`9 +48!N 袋8`8H]`?K 袊8`8HA`8`8g袊K`,AH?KHKd,A袋8`8H`K,||dx|x8`!@0ŠH>i,@@8!!}(N H+y`,AŠH>i,AixK1`/A8`p8,A0袋x肋K`8!!}(N 袋 H`8`H-`948!!}(N |h袋(8a8`!H`肋0袋@d肋8HW`肋H|xKuA(,#A8!}N 肋PxKIA(,#@H,A袋X8`8H`8`8袊XH`8`8袋`H`8`8袋hH`8`8袋pH`8`8袋xH`8`8袋H`8`8袋H`8`8袋Hy`x8`袋8Ha`8`8袋HM`8`8袋H9`8`8袋H%`8`8袋H`8`8袋H`8`8袋H`8`8袊XH`8`8袋XH`KT,||dx|x8`!@0ŠH>i,@@8!!}(N H(M`,AŠH>i,AixK`/Axp,A,袋肋K}`8!!}(N K%`8`H*`948!!}(N |&|뢊HA|zx!a!q=,$@<8!AAH!}@ AaN K)`,A=i,@8p8`KiA(.@H;肋gK~iA(89 |~x8`d.>A|/ A}@&UJ}(P8/@AH;;`x8PxKA(.#Ax8 K)A(,#Ațc8 xK A(,Ațc8 xKA(,|}xA}=/ A肋xK~9A(,A$肋xK~!A(,@,@HK`>,$@8!A}aN iK`|}xxK`8xŒ|hx8cxHy`~xCxKY`>,$AxiKy`|dxfK`8!A}aN |H8|~x8`!,@`袍8d8`Kͱ`/Alx8K8`,|@KA`8!!}(N 袌Hv`8d8`袍KI`/@袍8`8Hvu`8`H%`948!!}(N x8`8K8Kd|ŠH||x|#x!q>i,@4,$@t8!|N iKE`|}xxK5`x8|hx8xHw`>,$AiK`|dxfK`8!|N |뢊H|#x|x!q}8,7(|&T?LAB|&T|x,A0 /@\8!N x8`8G8K`8!N kxK|)`,A}K8,@HO`x`@@/ @肋0袋@d肋8HG9`肍 |~xKwA(,#A袍(8`8Hs`8`8袍0Hs`8`88K`9 <,KHi)`e@,@뢋0肋8袋@}HF`肍 |~xKw]A(/#Al袍(8`8HsA`8`8袍0Hs-`8`88K`H9@K,8!N 肍8xKvA(,A袍@8`8Hr`8`8袍HHr`8`88K`HhK袍8`8Hr}`K`,A8`88KA`8,KbHH`~PK`H`8`8袍PHr`H,`/@,肊H,@D|x8`8IK\8`xH`,@8`88K`Kx8`8IK|Hx|~x!Qf}e8,7(|&T?LAB|&T|x,A4/A&8;4, @FD,A`袍X8`8Hp`8`88K`H8!N / 6@ԁ&4, @.8ap肍KuUA(낋0袊肍|HC`8p|ex|HB`,A@8`8袍.Hp=`_9H4KL.8ap肍KtA(낋0袊肍|HC9`8p|ex|HB)`,A8`8袍.Ho`8H4KfPxKwy`\ @kȃX,9=+X@}&Kx `|A袍p|8`^8HoI`8`8袍xHo5`8`88K `HK@8`88K`H8!N >8`8HxKA`<8`8HXxK`?KkPxKv5`8袍h|fx8`ZHn9`X `KX,A\&8`8HxxKu`/@H,A袍x8`8Hm`HK*K|h88뢊Ha8`!q.8Ha`8`89,GA8!|N K-`8!|N |h8883a8`!H `8`肊H84,LA8!p|N K`8`8488H `8!p|N |뢊H|x!=,$@8! !}(N Kte`,A=i,@8p8`KkA(/@8ŠHxKt5`8! !}(N = 0/(@ ,MA,NA/OA,GA袍8`8Hk`8`8K=`}K8 (@d8`88KM`KP袍8`8HkQ`8p8`KjA(/K|&a|A!QHQ`H|{x?ii,iiii@,@bH;@ ,Ap.A‹X袍8`8Hj`@TH;@K, @`Hi5`,@tH m`.AK/ @H;@?, @,GAHK%`.@X뢊H}/@lHh`H5`=|x,@0x,@HE`뢎~#8@肊HxKq`/@HS5`cxxKq=`뢊H=|Aixx/@xK`xK`뢊H=x0,A<.@i;0/ GA, HA9+(A뢊H=.@)/4A@/ 8A, 9AH8`8袎PHh`ŠH,@8(AŽhx }K} } N 4  , A iK֝`||x~K`|~xxKo`0,A뢊Hp'4. A袎(|3x|jxxxx8`8xHg}`KDHQ`cxxKo=`뢊H] A=xxi/K/A8`dH5`H;@K, A袍8`8Hf`He`,A袍8`8Hf`K|8+@K`.A.@뢊H;@}/A袎8`8Hfi`He9`H`=|x ,@ŠH>i,@dHB1`bK~#PA邊HxKn5`~Kd/ 3AŠH8`8袎P|3xHe`,ATfKԝ`8袎X|fx8`He`8(@,袎`|8`8Hem`BH}KSx,9@j[.@8!A!HaA} N iKӝ`8袎H|fx8`Hd`$/4@0xKe`KTxKl`,AH `xKl`|KhKl`/A@HM`xKl`|K袍8`8HdI`?K0xcxKl `8袎|fx8`Hd`,@뢊HKKhiKҁ`^|}xjK`0.AB"H~4/ A|hx|3x袎0x8`p8xKxKk`|xK袎88`8HcM`=KL袍8`8;@Hc-`HK 뢊Hp'4. @` K\ KTB K4袍8`8;@Hb`K8`xH`,A|,@8`8e8KQ`.@88`|8MxK`KcxxKj5`}|dx{Kjy`뢊H~KK`?,Al袍8`8Hb `KT뢊H4K,袎@8`8Ha`8`8e8K`.A<8`8MHxDxK`BHK8xDxK׍`KxDxK؉`KxDxKم`KxDxK}`KxDxK`KxDxKށ`KxDxK`KpxDxKu`K\xK`KpxK=`K`xKq`KP8`8Gx8KH袎p8`8H``8!A!HaA} N (Ad肎xe|e"|"| N HxpHHHHHhHHHH`XHPbN bN bN bxN bN bN bN bN /A@A /ALA@,APbN /A A4,@bN bN bN bN bN bN bN N N |ha!K]A(8!p|N ||x!8pKcA(8/|ex8ap,%ATK_EA(8|ix8ap,)|fxA8Ka1A(,8`@T8!|N HD`x8袏|gx8`H^=`8`8!|N HC`88p袏K袏8`H]`K|ha!K_9A(8!pc|N }|ex!q|0P8|(|@ 8!N KaAA(뢏 |~x=,)}$Kx@08l8!N KbA(9@}|ZDK[A(K|&肏(|!Aa!d,A|:;~x:Kµ`aꢏ |x}x[x}YP9} a}8XP;|J,'A;b(8pxkKZ%A(,|~x@.;pb ~;;@H0KI`8|8}|||}@|x8/ @x8K`[J;{K`9}@8`HpK\A(|x. A(HA `8袏0|fx8`H[E`,@(x8K}`~uK`8`8!!~} !AaN ~xK`aKX |88|x8!H\`8袏@eK_A(,A8!a|hN H?`88H|gxxH\A`8!a|hN ||#x;袏@|x!ae8p8K[mA(/A@,A xa@P`8x8H[]`8xxK`8!x|N |cK`p88X|gxxx`HZ`8K|ha8`!18K_A(8 |ex8`,A8H>A`袏h|fx8`8HX`8!|N K^A(8,8`AH=`袏pKx!|@A(},vv8! |@!x|>t|P|v}@}Jv|>t}%XP袏|@}>t}0P| >t|PPA0pHW`8!|N |袏!d,,@⏐g8!p}N K `8!p}N |肏@|~x8!d8KXA(;,@xH,@9*}Cx|8*,@⏈;~hKTmA(h88ax8p8pxK`Bj`/Aap;,A HB{$xx8`b|*袏HUM`8ap||AB9#j}'x$KYA(p;{h/|#x@lax|Kd`8!aN ap9#j}'x$KXA(p;{h/|#xA낏;`;H }?|Kh~Q*;Ap|9?|#x@x|~@*hKR)A(8cKX!A(|~*hx|~0*|*;KVYA(p9}|#xK|=`|lx⏈ajB@8|a|fx8!q8`?p |,x@88ap8KV)A(f,@D8!N 袏HSe`88apKUA(f,A袏8`8HS1`8!N |h88뢏@a!q}KTA(8G8|gx8,8`ADK=`8d/@K`8!N }8 KWA(8,8`A袏HRa`H8`8袏|fx8`HRA`8`KI`98`뢏8G88},Kم`]9 @j(/ALKV!A(K`8!N 袏8`8HQ`Kx|h8a8`!8,@<袏8bKPA(,|x8`@L8!|N 袏HQ5`88袏bKPA(,|x8`AH6`x8袏|gx8`HP`8`8!|N |`&;|Aaa8`!HB`8apKSA(88apKOeA(88apKOUA(88apKOEA(88apKO5A(88apKO%A(8`8p8KTA(,@(⏈,@9b;@d.H9 . x8`dK`Km`[||x8 PP@邏,i6|XAP0|d|}>Alx,Axx袐8`8xHOQ`Kp|袏8`8HO5`,ADK8袐8`|8K袏8`8HN`K袏8`8HN`K||x!8axpKQA(88p8xKQA(,8`@8! |N H4 `x8|hx88`HPQ`8`8! |N |h肐a8`!K=`;,A@;,,A|98`8!N 肐 8`K`,Ad;"L,/ A(b8`kx8!N K`,A8!N 肐(8`Km`,@肐08`KU`,@t肐88`K=`/@\肐@8`K%`,AHK@||}x|#x|3x!qKOA(袏KMA(,A4d,@8!a|hN B* ,@/fAA\/eAPx8`88HN%`8!a|hN Hx8`88K,g@@,@h/@ |cxKPA(,A4H1E`x8x|hx88`HM`Ki0,@)/ MAt, NAl,OAd/ GA\hx8`88HM=`8`8K|`뢏=8 (@8`88K`K`x88`8HL`;8`袏HKu`Kp8`88xHL`KXx888`HL`8`Kz`Kx8`88K4,#||x!qA$e,@8!|N 888`HK`Kq`|}x K`x8|ix88`HK`,@`/@|KGA(,#AKF}A(?x8|hx88`HKI`K,|cKM}A(88|hx8`HK`Kx8`88HJ`K뢐Kt|||x|#x|#x!qKq`b肐xxK`8!a|hN ||#x|}x|#x!qK`xx肐8fKa`8!a|hN |ha|#x!K`888`HI`K)`|dx8`K`88,8`A8!p|N HI`8!p|N |ha|#x!K`KJA(袏KHIA(88,8`A HI-`8!p|N 8`K]`8!p|N ||#x|}x|#x!qK`xx肐8fK`8!a|hN |ha|#x!K1`KIA(,@8!p}N KG9A(88,8`A HH`8!p}N 8`88K|x a|{x|3x|#x!aKDA(肐|}cxKCAA({ |{x|#xKCA(,;|xcx8A 肑KD!A(cxKD1A(88!|xa}N |뢑!q},@ bKJYA(,A88`H `H.`KFA(,|jxA/8~8,8 8@kKBA(8뢑}KEEA(,A}8KE-A(,@PH)`8袑0|fx8`HD1`8!!}(N 袑8g낏@|xT\(H `88KEA(/Ap88KEA(,Ap>i,@ix/#AX:K`,A@8`8袑XK H(`|}xKDA(8x8`袑@HC%`88KE5A(,A>i/#AK`,@⏈?iKH^8`8袑PHB`K낏L9j}I[xU(}H`H(-`8袑 |fx8`K`8`K`K|袑8`8H>`K@mA(/@H$5`8袑h|fx8`H>u`8`K`肏d;}xU`|Hm`8!A}HN xK?A(Kp8`K)`8`KAA(||#x|x!qK`,@8`H0 `~K`,@xxK`,A뢏肑}xK;A(/A肑xK;A(,@<~K`8`K`8`8!N 肑xK;aA(,A肑xK;IA(/@K]`KK-`,AL=,A/A8`K `8`8!N KK`,@gK:A(肑xK:A(,A肑xK:A(/@T,@|H`x`@H`x`A H1`⏈K,@Lx/,@l,>@KA`K|~K9`KK`KK9A(|dxfK`,@⏈KK9A(|dxgxK`/@⏈KlK9UA(|dxhKQ`,ATH `8袑|gx8`H:`_9 *KbxK;9A(~KH m`8|gx袑8`H:`8`K`8`KXH 1`袑|gx8`x8H:i`8`K`8`K|ha8`!K>A(8!p8|N |ha8`(!K=A(8!p8| N ||#x|~x!qK7yA(8c, , 8|&TT?|x,A<$@@48}> |@, / }`&UjUk}H[x,AA|/ , &WW+x,A<| @@48c}^| @, / |&TT}x,AA}dP7@(;8!a|hN |"xxK>UA(;8!a|hN ||xx!; A|#xa!Ac,;A|xK5A(|x:K5A(H;xxK=A(,#;x@xK=A(,8cA ;xK=yA(,8c@{;=/;@l8yK;YA(8|wx|~x,9A[;=HK= A(|~;;CdxxK=A(x,P|}x8x@xxK9=A(xK4A(|;HK@y,@8!!}(!AaN ,@;K#xxx]PK8A(9K#xxx]PK8A(9K#xxx9K8A(^PyKHxK0A(|@|}x|{x@]x/=@8KP:@x@]x,=@0K#xxx]PK8A(9K#xxx]PK7A(9K |||x|#x!qc,#@,?Ax8p8@;K`8ap;pK/A(8cK5A(;|8apK/qA(x8|9@H}}|8k+@}|}j8apK/-A(x8|9A8|8!@}N 8!@}N K/A(8K|a|{x|#x!aK.A(|}xxK.qA(|8|xK4aA(exx肑|}xK5)A(xK-A(x,@ 8!aa|hN bK0A(8!aa|hN |||x|#x!q,?A,xK4)A(,A\,@<= </)@48`}8!|N K_ ] ? ,)@, 8!|N K||#x!,?A0xK3AA(/8`AA,,?@8`8!|N x8!|N |!Ka`8,#A8!p|x|N ||+x!qK`88,#|ix8xAiK2A(|c8!|N ||+x|3x!qK`,#|ixxAiK-A(x|}xK+A(,x&WK+A(8!x|N ,|!A$袑|+xKM`8!p|N ‘袑K-`8!p|N ||+x!qK`,#|ixxAi8!|N }!|;xA|3xa|{x|#x|+x|#x!QK*A(8cK0 A(|xxxK]`xK)A(8cK/A(|~xxxK1`cxxK`,#|}xAc,@lxxK`]x=K)}A(( ||x@肒xK/A(#A(<@肒xK/aA(|AxK)A(xK)A(8!!|AaN K `|}xxK(A(8cK.A(x}K-!A(cxxK`K; xK-A(/#@`xK`KL8K||3x|#x|+x|x|#x!aK(1A(xx|ex8ap8( B@@袒8`8H*!`88!B|x|N K,1A(8=8apK/A(xx,#|ix88px8A9 K9`88!B|x|N } &=|#x肒}Ha{0A|zxa|3x|+x!A!|!9jK&A(,#|}x8`A0;;!B;8ap8BxK(=A(.#A8ap8 K.A(,#A8ap8 K.A(,Ap;p, ,|+x|&T?T|x/A(,, &W?W3x/ @/+#AxK&-A(9`9|+@@l8H(}Z,#A}c[x|Y9k@@@|X,"A\/#,}@&U@UJ|P8/@9K}KSx@AxK%A(,#|iAd}+, , |`&T~Tc?|hx/A<9@KB@0}}b,, |&TT?|#x/@Ћ/A\肒 xK+AA(|A,#A<x8=K,A(/#A$8xCx88K`@xK%A(8`!!} AaN 9kiK9K|@}KSxA$9#HP|X|Z9kB}KSx8cKP8. A8, .#AT.#$x8BKm`Cx$xKK,/ AK|8!K}`8!p|N ||x!K`,#|jxA,c# ,+/)A,+ A}>xKA(|A\8!ꢒu~!AaN x:8l9| :}Z肓8K" A(8|K8Q|K!A(8|K,A/A肒x%xK!A(8K肓x~xK!uA(9|}|K/AAP,A肓(xK!AA(K’z$肓|0*xK!A(8|K,A,@肓 xK A(KX肒xK A(K@肓xK A(K(肓xK A(K肒xK A(K肓xK uA(K |ha!KA(8!pc|N |!KIA(K`8!pa|hN (|h|+xa!A8袓Xx|*|*| N ||tl;8 bKA(xx肓K9A(K A(8!|N ;K;K;K;K|ha!KA(cKA(8!p|N ||#x|dxax|+x|3x!A!QKMA(,@48!|!AaN ;|@@{$x|*,|+xAhKA(8/AA||AxKA(,AxK`x|exb`KA(8`KA(KLxKA(8cKA(x|}*K5A(K ;>>|Ad;H *8~|~AD{$|*}:, A|xAK A(,@$|z*K)A(KxKUA(KdK`|*|exb`KA(8`K=A(K||+xx$||x|+x|#x!!KA(9`| |~x@ 9@8yc$|}C*| AxKA(8cKA(x~KA(x888pKMA(p,A;?@A;8apKA(|AH@}|@4{$9} *,}CxAKA(9}|AxKA(8!N x{$xx|`*xK`9_p}_?@AKH|habh!KYA(8!p8`|N |habh!KA(8!p8`|N |ha!K`,@肓pd,#@Ke`8!p|N KA(K|ha!K]`,@ p,$|#x@ K`8!}N KmA(8ⒸK,#||~xa!aAKA(8cKA(,#|}xA;`;;xKA(|@t}^/M}ISxAA/ KA8i/ -+ OB|&TT|x,A99<x}}<}]9xKyA(|AX9x88 }8KA(,@ ֓xKA(8!ahaN 9_}_K ,kA / m@,9i/ -+ ?`K$;`K|肓x|x!KA(9 |dxx,A肓KA(9 |fxx,A肓KA(9 |gxx,A肓KA(9 |hxx/A肓KA(|ixx, 9 A肓KuA(9 |jxx,Ap肓KUA(9 |kxx/ AP肓K5A(9 |lxx, A0肓KA(8P|gp|x|8P|p| 89#8!}#Kx}N |!K`K`8!pa|hN |肓|x!KyA(8|dxx,A肓KYA(8|fxx,A肓K9A(8|gxx,A肓KA(8|hxx/Ax肓KA(8|ixx, AX肓KA(8|jxx,A8肓KA(8/xA肓KA(,|&T8!|xa}hN |!K`K`8!pa|hN |!K`K `8!pa|hN |!KY`K9`8!pa|hN |肓|x!KA(8|dxx,A肔KA(8|fxx,A肔KeA(8|gxx,A肔KEA(8|hxx/A`肔K%A(8|ixx, A@肔 KA(8 |jxx,A 肔(K A(/|`&Tcx`&8!|xa}hN |ha!KA(9@0|dxy@$8|*}CSx|/ |% A@b0KuA(8`8!p|N |!|#xA|zxa|+x!QK]`”8|x~,@뢔@BX89<bH/ 肔Pydy$=g*Q.EY.%!.@;@; ]>8!a!hAaN 뢔@낒8}xi$|i*K A(袔X9|肔HbP/ yFdyK$k*).F!.&.Kl||}x!qKA(({$A 袒0|})*8!a|hN |&!|#x|A|zx|#xa|+x;^x!QK A(,;_x|}xAcxK A(||x|<@Axz,Ad.<H(xdxx@/A8x$xxKuA(/AĈ;/@88!Cx!}(!A} aN KA(Kp||3x|+x|x!qKA(x肔`KA(,#A,>A肔`xxKe`x肔KA(/A<,A肔xxK1`8!a|hN /=AxK EA(x肔|KA(8!a|hN 肔h8xK`8x肔pK`8x肔xK`x8肔`K`肔xKA(/K肔8xKU`8x肔KA`8x肔K-`x8肔K|hpaa!,#@h;;낒b`8肔8ap|xKA(88pK`8`xK mA(,@,@AK1A(/@,@t낒’~K A(88ap|肔xK=A(88pKA`KA(/,@A’8Ⓒ8K`’KA(/@8!@a}N KA(9BKK%`,AK`,AKA`|exb`KA(8`KmA(KK A(#/ AK`|fxbKA(8`K)A(8!@a}N Ku`,AKe`,AK IA(c/ AHK}`|fxbK!A(8`K|bKA(8`K`bKA(8`KD||}x肒@a!с$q?Ad뢒X},@0袓pe,AKAA(/#A0@8!0aN y A肒(K 9A(,A낓p|,@<’`>/ @낒x8b|Ka`8뢒袔}KE`|8|K`;}K4⒰8p8`KA(,@@@AK`8!0aN K9`,At|(P|KA(,||xAPbxK| @BP|@T/A"|@(8!~!AaN 肒},A’@p@<8appK`뢓p/'A, @bKm`낒|exbKA(8`KA(K("(x xxx~Ƴxx~xK`뢔|ex肔}KA(B ,A}K5A(K~xxxKq`~xxxK`8!~!AaN b(8pK A((xx"~Ƴxxx x~xK`|ex肔}KQA(p’h,;<6A}KAA(9`邒}LjKb@[{IA뢒袒}8p8K`肒HdKyA(뢒|fx肔|}KA(/#bp{Ap{C KAA(뢓pK쁜8ap|9,l8 肔}%|KeA(8apK-`뢓pKb8ⒸgKP肕}K)A(肔bKA({KpK`|~xK |”@!Aa!Q~|AKu`,@|A"8;BHbP낔XH Ad8|g9Cx$xd}*|/,}cx|hҪ|ڪAdKQ`_8, @@K`8!a!}hAaN _K}h|#x!|yxa|+xAa!A! A(K=`,A88!~!AaN K`;A|wx•낕 ,$A뢕 exFx}K5A(/|xA~|@A肕 #x~x8xK`KI`8!~!AaN 8d8`dKA(exFx뢕 |}KA(|x/@X}KA(> A$8d|xK5A(|K88d|8A,^9 d~KA(9 / |K|lK }h|+x!|#xA|zxa;`|3x;da!Q;!AxKyA(xxx|~xKyA(8d,8cAXAd|,x@TKA(xK%A(xxx|~xK%A(8d,8c@|,xA/AH#xxxK`8!a|h!AaN 袓#xxxK`xK9A(8!a|h!AaN |b0(| P!q|t/;@ HK8?K8@K8AK8BK8CK8DK8EK8FK8GK8HK|8IKt8JKl8KKd8LK\8MKT8NKL8OKD8PK<8QK48RK,8SK$8TK|!`K`8!p|N 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_Got a log message from JVM: %s%s must be in the range 0 to %d days (%d seconds). Changing to %d.JVM signalled that it was stopped.Got ping response from JVMJVM signalled a start pending with waitHint of %d millis.JVM signalled a stop pending with waitHint of %d millis.UNKNOWN(%d)LOG(FATAL)LOG(ERROR)LOG(WARN)LOG(STATUS)LOG(INFO)LOG(DEBUG)PROPERTIESSERVICE_CONTROL_CODEPING_TIMEOUTLOW_LOG_LEVELBADKEYKEYSTOPPEDSTARTEDSTART_PENDINGSTOP_PENDINGPINGRESTARTSTOPSTARTUnable to set working directory to: %s (%s)Working directory set to: %swrapper.working.dirSHUTDOWNIGNOREFORWARDwrapper.daemonizewrapper.signal.mode.hupwrapper.logwrapper.logfileSIZEwrapper.logfile.rollmodeLPTMwrapper.logfile.formatINFOwrapper.logfile.loglevel0wrapper.logfile.maxsizewrapper.logfile.maxfileswrapper.logfile.inactivity.timeoutPMwrapper.console.formatwrapper.console.loglevelwrapper.console.flushNONEwrapper.syslog.loglevelUSERwrapper.syslog.facilitywrapperwrapper.ntservice.namewrapper.unix.namewrapper.portwrapper.port.minwrapper.port.maxwrapper.port.max must be greater than or equal to wrapper.port.min. Changing to %d.wrapper.jvm.portwrapper.jvm.port.minwrapper.jvm.port.maxwrapper.jvm.port.min must be in the range 1-65535. Changing to %d.wrapper.debugwrapper.java.command.loglevelDEBUGwrapper.adviserwrapper.timer_fast_thresholdwrapper.timer_slow_thresholdwrapper.native_librarywrapper.java.library.path.append_system_pathwrapper.state_outputwrapper.timer_outputwrapper.loop_outputwrapper.sleep_outputwrapper.memory_outputwrapper.memory_output.intervalwrapper.cpu_outputwrapper.cpu_output.intervalwrapper.disable_shutdown_hookwrapper.startup.delaywrapper.startup.delay.consolewrapper.startup.delay.servicewrapper.restart.delaywrapper.restart.reload_configurationwrapper.disable_restartswrapper.cpu.timeoutwrapper.startup.timeoutwrapper.ping.timeoutwrapper.ping.intervalwrapper.shutdown.timeoutwrapper.jvm_exit.timeoutwrapper.max_failed_invocationswrapper.successful_invocation_timewrapper.request_thread_dump_on_failed_jvm_exitwrapper.filter.trigger.%dwrapper.filter.action.%dwrapper.pidfilewrapper.port.min must be in the range 1-65535. Changing to %d.wrapper.jvm.port.max must be greater than or equal to wrapper.jvm.port.min. Changing to %d.The value of wrapper.max_failed_invocations must not be smaller than 1. Changing to 1.wrapper.use_system_timewrapper.logfile.rollmode invalid. Disabling log file rolling.wrapper.ping.interval must be at less than or equal to 1 hour (3600 seconds). Changing to 3600.wrapper.ping.timeout must be at least 5 seconds longer than wrapper.ping.interval. Changing to %d.YYYYMMDDwrapper.logfile must contain "%s" for a roll mode of DATE. Disabling log file rolling.CPU timeout detection may not operate correctly because wrapper.cpu.timeout is not smaller than wrapper.ping.timeout.CPU timeout detection may not operate correctly during startup because wrapper.cpu.timeout is not smaller than wrapper.startup.timeout.CPU timeout detection may not operate correctly during shutdown because wrapper.cpu.timeout is not smaller than wrapper.shutdown.timeout.wrapper.jvm.port must not equal wrapper.port. Changing to the default.wrapper.ping.interval must be at least 1 second. Changing to 1.wrapper.java.pidfilewrapper.java.idfilewrapper.java.statusfilewrapper.commandfilewrapper.command.poll_intervalwrapper.anchor.poll_intervalwrapper.umaskwrapper.java.umaskwrapper.pidfile.umaskwrapper.lockfile.umaskwrapper.java.pidfile.umaskwrapper.java.idfile.umaskwrapper.statusfile.umaskwrapper.java.statusfile.umaskwrapper.anchorfile.umaskwrapper.logfile.umaskwrapper.ignore_signalswrapper.anchorfilewrapper.statusfilewrapper.lockfilewrapperRestartProcess() called. (IGNORED)wrapperRestartProcess() called.JVM requested a restart.wrapperStopProcess(%d) called.wrapperStopProcess(%d) called while stopping. (IGNORED)JVM requested a shutdown. (%d)Filter trigger matched. Restarting JVM.Filter trigger matched. Shutting down.javawrapper.java.commandjdbjdb.exewrapper.java.additional.%d"-The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.-Xdebugwrapper.java.initmemorywrapper.java.maxmemorywrapper.app.parameter.%dwrapper.app.parameter.%d.stripquoteswrapper.java.additional.%d.stripquotes-Dwrapper.timer_slow_threshold="%d"wrapper.java.library.path-Djava.library.path="%s%c%s"-classpath-Dwrapper.pid=%d-Dwrapper.native_library="%s"-Dwrapper.version="%s"-Dwrapper.jvmid=%dMainwrapper.java.mainclass-Dwrapper.cpu.timeout="%d"-Dwrapper.jvm.port.max=%d-Dwrapper.jvm.port.min=%d-Dwrapper.key="%s"-Dwrapper.port=%dwrapper.java.classpath.%dClasspath element, %s, does not exist: %sClasspath element, %s, does not match any files: %s-Xms%dm-Dwrapper.jvm.port=%d-Xmx%dm-Dwrapper.ignore_signals="TRUE"-Dwrapper.debug="TRUE"LD_LIBRARY_PATH-Dwrapper.service="TRUE"-Dwrapper.disable_shutdown_hook="TRUE"-Dwrapper.use_system_time="TRUE"-Dwrapper.version=%s-Dwrapper.cpu.timeout=%d-Dwrapper.native_library=%s-Dwrapper.key=%s-Djava.library.path=%s%c%s-Dwrapper.timer_fast_threshold="%d"-Dwrapper.debug=TRUE-Dwrapper.ignore_signals=TRUE-Dwrapper.service=TRUE-Dwrapper.use_system_time=TRUE-Dwrapper.disable_shutdown_hook=TRUE-Dwrapper.timer_slow_threshold=%d-Dwrapper.timer_fast_threshold=%d./-Djava.library.path="%s"-Djava.library.path=wrapper.java.library.path.%d-Djava.library.path="%s%c%s\"-Djava.library.path=%sUnable to get information of classpath element: %s (%s)\-Djava.library.path="%s\"------------------------------------------------------------------------The JVM is being launched with a debugger enabled and could possibly besuspended. To avoid unwanted shutdowns, timeouts will be disabled,removing the ability to detect and restart frozen JVMs.Wrapper (Version %s) http://wrapper.tanukisoftware.org Usage: %s [configuration properties] [...] %s [configuration properties] [...] ( implicitly '-c') %s ( implicitly '%s.conf') %s ( implicitly '-c' and '%s.conf') where can be one of: -c --console run as a Console application -v --version print the wrapper's version information. -? --help print this help message is the wrapper.conf to use. Name must be absolute or relative to the location of %s [configuration properties] are configuration name-value pairs which override values in wrapper.conf. For example: wrapper.debug=truec%s.confLPMsocket close failed. (%d)JVM process exited with a code of %d, setting the wrapper exit code to %d.JVM process exited with a code of %d, however the wrapper exit code was already %d.Unexpected jState=%d in wrapperJVMProcessExited.JVM process exited with a code of %d, leaving the wrapper exit code set to %d.JVM exited on its own while waiting to kill the application.JVM exited unexpectedly while stopping the application.JVM exited unexpectedly.JVM exited while starting the application.JVM exited before starting the application.JVM exited while loading the application.Unable to start a JVMJVM already down.JVM exited normally.(Property Values)send a packet %s : %sNULLsocket not open, so packet not sent %s : %ssocket send failed. (%d)JVM signalled that it was started.Got key from JVM: %sReceived a connection request with an incorrect key. Waiting for another connection.Incorrect key. Connection rejected.server socket close failed. (%d)--> Wrapper Started as Service<-- Wrapper StoppedUsing tick timer.Using system timer.--> Wrapper Started as Daemon--> Wrapper Started as Consoleaccepted a socket from %s on port %dsocket ioctlsocket failed. (%s)socket creation failed. (%s)127.0.0.1server socket creation failed. (%s)port %d already in use, using port %d instead.server socket listen failed. (%d)unable to bind listener port %d, or any port in the range %d-%d. (%s)server socket ioctlsocket failed. (%s)server listening on port %d.unable to bind listener to any port in the range %d-%d. (%s)read a packet %s : %sreceived unknown packet (%d:%s)socket read no code (closed?).socket read failed. (%s)set.WRAPPER_BITS=%sset.WRAPPER_ARCH=%sset.WRAPPER_OS=%sset.WRAPPER_FILE_SEPARATOR=/set.WRAPPER_PATH_SEPARATOR=:The argument '%s' is not a valid property name-value pair.Unable to resolve the full path of the configuration file, %s: %sProblem loading wrapper configuration file: %sUnable to open configuration file. %swindowsx86323.2.3Advice:The Wrapper consists of a native component as well as a set of classeswhich run within the JVM that it launches. The Java component of theWrapper must be initialized promptly after the JVM is launched or theWrapper will timeout, as just happened. Most likely the main classspecified in the Wrapper configuration file is not correctly initializingthe Wrapper classes: %sWhile it is possible to do so manually, the Wrapper ships with helperclasses to make this initialization processes automatic.Please review the integration section of the Wrapper's documentationfor the various methods which can be employed to launch an applicationwithin the Wrapper: http://wrapper.tanukisoftware.org/doc/english/integrate.htmlUNKNOWNSTARTINGSTOPPINGKILLINGLAUNCHEDLAUNCHINGLAUNCH(DELAY)DOWN Set Java State %s Timeout %08lx -> %08lxThe JVM was launched with debug options so this may be because the JVMis currently suspended by a debugger. Any future timeouts during thisJVM invocation will be silently ignored. DebugJVM timeout. Disable current %s timeout. Last system time tick overflow at: %s Next system time tick overflow at: %s Last tick overflow at: %s Next tick overflow at: %sShutdown: Timed out waiting for the JVM to terminate.JVM exitShutdown failed: Timed out waiting for the JVM to terminate.Shutdown: Timed out waiting for a signal from the JVM.shutdownShutdown failed: Timed out waiting for signal from JVM.pingPing: Timed out waiting for signal from JVM.JVM appears hung: Timed out waiting for signal from JVM. Temp: Sent a ping packet. Temp: Sending a ping packet.JVM Ping Failed.Startup: Timed out waiting for a signal from the JVM.startupStartup failed: Timed out waiting for signal from JVM.Startup failed: Timed out waiting for a signal from the JVM.org.tanukisoftware.wrapper.WrapperSimpleApporg.tanukisoftware.wrapper.WrapperStartStopAppr+tCommand '%s'. Shutting down with exit code %d.Unable to delete the command file, %s: %s Loop: check command fileUnable to read the command file: %sPAUSERESUMEDUMPCONSOLE_LOGLEVELLOGFILE_LOGLEVELSYSLOG_LOGLEVELCommand '%s' specified an unknown log level: '%'Command '%s'. Restarting JVM.Command '%s' not supported on this platform, ignoring.Command '%s'. Requesting a Thread Dump.Command '%s'. Set syslog log level to '%s'.LOOP_OUTPUTSTATE_OUTPUTMEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTCommand '%s'. Enable %s.Command '%s'. Set console log level to '%s'.Command '%s' lead to an unexpected state.Command '%s'. Set log file log level to '%s'.Command '%s'. Disable %s.Command '%s' is unknown, ignoring.Command '%s' is missing its log level.wUnable to write to the status file: %s%s Set Java State %s -> %sUnable to send the start command to the JVM.startStart Application. Set Wrapper State %s -> %scom.silveregg.wrapper.WrapperSimpleAppThe com.silveregg.wrapper.WrapperSimpleApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperSimpleApp class instead.com.silveregg.wrapper.WrapperStartStopAppThe com.silveregg.wrapper.WrapperStartStopApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperStartStopApp class instead.Reloading Wrapper configuration...Launching a JVM...JVM Restarts disabled. Shutting down.wrapper.on_exit.%dwrapper.on_exit.defaultrestarton_exit trigger matched. Service is paused, will restart the JVM when resumed. (Exit code: %d)on_exit trigger matched. Restarting the JVM. (Exit code: %d)There were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.Waiting %d seconds before launching another JVM.JVM was only running for %d seconds leading to a failed restart count of %d.Waiting %d seconds before launching the first JVM.Anchor file deleted. Shutting down. Loop: check anchor file Loop: %ssleepUnknown wState=%d Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%s Loop: maintain logger Loop: process jvm output Loop: maintain logger(2) Loop: handle jvm state: %sUnknown jState=%d Loop: handle wrapper state: %s Loop: process socketWrapper Process has not received any CPU time for %d seconds. Extending timeouts.no Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (N/A), Exit=%s, Restart=%s Loop: exit requestedPause reading child output to share cycles.falsePause reading socket data to share cycles.Event loop started.Sending stop signal to JVMEvent loop stopped.SIGCHLDSIGTERMSIGALRMSIGKILLSIGQUITSIGINTSIGHUPunknownthe kerneltimer expiredkill, sigsend or raisemesq state changedAIO completedsigqueuequeued SIGIOUnable to get the path for '%s'-%sUnable to extract path from: %sUnable to set working dir to %s : %sFailed to read console output from the JVM: %s (%d)Dumping JVM state.Could not dump JVM state: %sUnable to request JVM process status: %sWIFEXITED indicates that the JVM exited abnormally.JVM exited in response to signal %s (%d).Call to getrusage failed for Wrapper process: %sCall to getrusage failed for Java process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldCommand[%d] : %s Sleep: awake Sleep: nanosleep %dmsJVM did not exit on request, terminatedJVM did not exit on request. Attempt to terminate process failed: %sLaunching Timer thread.Unable to create a timer thread: %d, %s Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ldThe timer fell behind the system clock by %ldms.The system clock fell behind the timer by %ldms.Timer thread started.Could not mask signals for timer thread.Unable to register signal handler for signal %d. %s%s trapped, but ignored.%s trapped, but signals for timer thread are ignored.Unable to forward %s signal to JVM process. %s%s trapped. Shutting down.%s trapped. Forcing immediate shutdown.%s trapped. Forwarding to JVM process.%s trapped. Restarting JVM.%s trapped. Unable to forward signal to JVM because it is not running.Signal trapped. Details: signal number=%d (%s), source="%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s) signal err=%d, "%s"Signal trapped. No details available.HUPTERMReceived SIGCHLD, checking JVM process status.JVM process was still running after receiving a SIGCHLD signal.Timer thread received an Quit signal. Ignoring.INTTimer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.%d Unable to set JVM's stderr: %sUnable to write the Java ID file: %sFailed to set jvm output handle to non blocking mode: %s (%d)Unable to write the Java PID file: %sCould not spawn JVM process: %sUnable to set JVM's stdout: %sCould not init pipe: %sFailed to set jvm output handle to close on JVM exit: %s (%d)Unable to start JVM: %s (%d)/dev/nullSpawning intermediate process...Could not spawn daemon process: %ssetsid() failed: %sSpawning daemon process...?-helpv-version-consoleWARNING: Could not write lock file %s: %s Unrecognized option: -%s ERROR: Could not write anchor file %s: %sERROR: Could not write pid file %s: %s name:%s value:%s%s=%sUnable to set environment variable: %s set.default.set.The following property name value pair is too large. Need to increase the internal buffer size: %srt#includeNONE DEBUG INFO STATUSWARN ERROR FATAL ADVICE%04d/%02d/%02d %02d:%02d:%02d.%03d | %04d/%02d/%02d %02d:%02d:%02d%cjvm %-4dtimer wrapper signal main wrapperpsrvmainUnable to delete old log file: %s (%s) LOCAL0LOCAL1LOCAL2LOCAL3LOCAL4LOCAL5LOCAL6LOCAL7FATALERRORWARNSIZE_OR_WRAPPERSIZE_OR_JVMDATEWARNING - Encountered an unknown thread %ld in getThreadId(). ROLLNUM.%s-YYYYMMDD_YYYYMMDD.YYYYMMDD-ROLLNUM_ROLLNUM.ROLLNUMUnable to rename log file %s to %s. (%s) Unable to rename log file %s to %s. File is in use by another application. ????????Unable to get the current logfile size with stat: %s Unable to get the current logfile size with ftell: %s Unable to open logfile %s: %s a%04d%02d%02d{ ($JxJJJ:kkk k(k0k8k@kH"|8"88$X8"8#8#8#8$,8$H8$d8%(8%8&|8'@8($8)D8*8+h8+8,8-8.D8.8/80L8J8L8M|8M8N8O8P8g<8h8h8i8k 8l8m8n8n8o$8o8r8v@8w8xT8z|8{t8|8}848P8888p8d88888888d88$848@8\8l8|8l888888p88888h88888808d8<8p8 8H8t88Ŭ8(8 8t8X8T88P88L8Ӹ88԰888՜8@88t8ۀ8 888\888h88L8 8T8 8888X88P88888L88`8t88888888<8T8l88888848H8\8l888,8$8888888h88848888 8 8 8 88 p8 8 8 ,8`88888888$88 \8!8.> q q    p! ooo8pp(0$\$%0%X%x@@%''&&&&&&&&&&&x&h&X&H&8&(&&%)t''@'`'x''''''''/00(((8(0(`(X(x(((()) ))@)8)`)X)x)).))*(2*@*p*X.****/++ +@+X+++++,, ,8,X,x,,,,--0-H-`-x--2/0P11 2 --/8..H.h.3@583X5 3p33533344 484X4x4444p805P55556 6@6p66e6666677@7H:7`: :`8ph<80;P=X<=<=p<<=P8P9x99=9H;89`:9(9:H;8`:;;p>X>>>??X????@@8@h@@A(AHAAAAAp0ABBBhDDpD@DCCCDCHBpdDDDDE E@Eh6EEp4FF(FxF`FHFFGFFGHHG8HXGGpH8G ěS(\(HHHH,pPIpHI(p@I@IXIxIIJPJ M&M&MNMMMM$N=x\N@NNOO8OhOOOPP P`PPPPQQxQQXQQQR088RpRA@JJJK0KxKLL(L0LxLMMHM`S8RSX&T'RST0SSThSSSVSU@UTUp6TTTTUU;U UUSV@VpVHVxVVVVXWW8WWXXXXXZZYZH[YY(Y@YYH[p[H^X]`[\(\H]\^(\h]A^ []h]^p\[\\^^^^^^^^M_^_H^_ _8_X^_h__pl_`pp`(`H``x`a ěSaHp`aaab b@abpzPbcchbc0bc{@{({zzzdcdddpdd@eeePepefef(f0f8fhfffg V@gHh@hh gPhghXggphhihi0iPiXi`ihAixijiij0jHjPA^ jxjjjkpp|p|pxH8txpx@8PHkkkp\kkkk^kkkPkx$k@)8l l(l0l8l@lHlPlX)kHl`lhlpk((0*'lllxlllplP0lmmlm m0m@l6mmPnmm ěSVpnxnp'nPhX`ppppGCC: (GNU) 3.3.3 (SuSE Linux)GCC: (GNU) 3.3.3 (SuSE Linux)GCC: (GNU) 3.3.3 (SuSE Linux)GCC: (GNU) 3.3.3 (SuSE Linux)GCC: (GNU) 3.3.3 (SuSE Linux)GCC: (GNU) 3.3.3 (SuSE Linux)GCC: (GNU) 3.3.3 (SuSE Linux)GCC: (GNU) 3.3.3 (SuSE Linux)GCC: (GNU) 3.3.3 (SuSE Linux)GCC: (GNU) 3.3.3 (SuSE Linux)GCC: (GNU) 3.3.3 (SuSE Linux)GCC: (GNU) 3.3.3 (SuSE Linux),"|<L$X"D,<<$p !s_IO_stdin_used6.M__libc_csu_finix__libc_csu_init"|"../sysdeps/powerpc/powerpc64/elf/start.S/usr/src/packages/BUILD/glibc-2.3/csuGNU AS 2.15.90.0.1.1""!cGLYintG| $WyV/usr/src/packages/BUILD/glibc-2.3/cc/csu/crti.S/usr/src/packages/BUILD/glibc-2.3/csuGNU AS 2.15.90.0.1.1*fU!!c?GintxJ \QiL4o, \!Q t @iA4o 4       y/usr/src/packages/BUILD/glibc-2.3/cc/csu/crtn.S/usr/src/packages/BUILD/glibc-2.3/csuGNU AS 2.15.90.0.1.1%% $ > $ > 4: ; I?  &I%% $ > : ; I$ > .? : ; ' @ 4: ; I  4: ; I &I I ! '  I4: ; I? < %]< ../sysdeps/powerpc/powerpc64/elfstart.S "|,!     init.cC /usr/src/packages/BUILD/glibc-2.3/cc/csucrti.S $X 5 "` /usr/lib64/gcc-lib/powerpc64-suse-linux/3.3.3/includeelf-init.cstddef.h -V[G1~uC /usr/src/packages/BUILD/glibc-2.3/cc/csucrtn.S $p    xA $`l~$ \Pl~short unsigned intunsigned char/usr/src/packages/BUILD/glibc-2.3/csulong unsigned intshort intGNU C 3.3.3 (SuSE Linux)_IO_stdin_usedlong int__libc_csu_finisize_t__init_array_end__init_array_startelf-init.c__fini_array_end__libc_csu_init__fini_array_startsize.symtab.strtab.shstrtab.interp.note.ABI-tag.note.SuSE.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.text.fini.rodata.data.branch_lt.eh_frame.opd.dynamic.ctors.dtors.jcr.got.sbss.bss.comment.debug_aranges.debug_pubnames.debug_info.debug_abbrev.debug_line.debug_frame.debug_str# 1<xB XJ Ro_o`nx000 $$X$X($$JppppppppxPP  0088P}pt_O=*a6`C0pNXE%v -     0 $X$ppppP 08 !"#$%5o~o~o~o~o~o8ho~osp " 0p(q8 "qP #+(8pF0R8h !8ho~opp (4F(o(T{pc (s HtP $Xzs`p8't< K P`xm{w PPtq{Xs vxy x$ $H7 @I  Q pnuXuz h0vxup .$ 7 ՜GYi{z g<LH 4  hX qh 042FX  ` PppH| ssP <    . !4G \\M ]vk0}v0 l@s <   z  5u M Ll ^ hl tw  { t  !  l  t u  P  '} 6p@ @ Qt c * yw  8d  h8 y    h  ` ~X p |0 & 4 P c nx@ }q   z  v (  Pl   dD @  I  ]| bp sP  |  "  p  !,  0 x  $  / pl  +h| 2  8 N c u @      $, ~ p  # 8'z4|xQaqz8 hzP x !{ 8#5 T=SsHcHu ( v@ n8 x $  X u@& }4K]t8jsyH r L T     8  h)q/ 8; RpP^ djp|y  L}P ($   <h pvH OP wh( ; +X@d o$zx( |yx (y0  ! n8& :L}[q 8 H xp   l0 M(+ d;}GS Lqrpx~~( y& 7JpXY ,a $dv )D` \ 4    pp` `  p8 %(* PhA Y drv k  \ 4| Ӹd~ \  xT(  4yLpS z|g }y`   8d  8}u(! * h<@r(]pu l w  N|H t\  h!w0@F Yrv ԰p Dw8s0 88 H t  $ "`/(= Z}nxtv` !|  88   r@  "|<px( DDp\z  P(x }8 P "( o D& %? tT tfxx p L   @    H.h= <CO{T Z 4h n~ x L ,z 0L| 4`$zh6S(bpswwP  x m .D`    4 B  H !P Ja u |r(phr p  #< )  1 Bv ^ L f T } w      P !q!wh!5q !;!H '@!f !y h!{@!p@!  p! T!! M|H!v"  |" @",p0"/"A{("Tp"a !d"g|"{ D"|"  h" 4" -" " ""l# l#  ,4#/ #@v#T &|#j $\#|# 4# #xX#  ,# \#  H#H$u$' $< Ŭ|$U $h $| $$$~p$8$q$ "D$$%tP%$%6v%L @%Sz%cz%x 0% % it%% ۀ% %}h%%% <4%sx&u&+ p&;q&M&a |&qp4&u&|  \&~& & d& rt&&&{'''(~'; 'H} '[ 'c't !H'}s' ' `' '' H,' l' @'  (  X(|`(1y(A (G(Z(k((z}(`(( (( ( `P(p) ) )w),w)C)T )^)r )z$) )))|) 8) X)  )*8*}*'p*9s*V X*j|*~@***rX* d*th+ ++ {t+, $+2 t+FX+\ +cy+qp+~+~+y++|+++ ,  ,,!,3,C,Tq,lx,},,, |,  , , t, -t- t - -1~@-A P-R-f -ur/usr/src/packages/BUILD/kernel-headers/asm/unistd.h/usr/src/packages/BUILD/kernel-headers/asm-ppc64/unistd.h/usr/src/packages/BUILD/glibc-2.3/cc/config.habi-note.S/usr/src/packages/BUILD/glibc-2.3/cc/csu/abi-tag.hsuse-note.Sinit.c/usr/src/packages/BUILD/glibc-2.3/cc/csu/crti.S/usr/src/packages/BUILD/glibc-2.3/cc/csu/defs.hinitfini.ccall_gmon_start.call_gmon_startcrtstuff.c__CTOR_LIST____DTOR_LIST____JCR_LIST__p.0completed.1__do_global_dtors_aux.__do_global_dtors_auxframe_dummy.frame_dummy__CTOR_END____DTOR_END____FRAME_END____JCR_END____do_global_ctors_aux.__do_global_ctors_aux/usr/src/packages/BUILD/glibc-2.3/cc/csu/crtn.Swrapper.cunknownBuffer.0seeded.1wrapperinfo.cwrappereventloop.cwrapper_unix.cjvmPidproperty.clogger.celf-init.ccrtsavres.Sinclude/ppc-asm.hcrtsavres.asmwrapperExecute.maintainLoggerwrapperData.unregisterSyslogMessageFilegetLogfileRollModeForNameconsoleFlushqueueMessageslastLogfileActivity._finiumask@@GLIBC_2.3descSignalwrapperRestartProcesskeyCharswrapperProtocolClosesetLogfilePath.wrapperSetJavaStatejStateLaunchdaemonize.getStringPropertywrapperVersionBannerwrapperLogSignalledwritePidFilewrapperStopProcess.wrapperUpdateJavaStateTimeoutwStateStartedwrapperBuildJavaCommand.anchorPoll.wrapperAddToTicks.createProperties.accept.wrapperAddDefaultPropertiesgetrusage@@GLIBC_2.3protocolStopServerwrapperGetSystemTickssigActionCommon.getSignalCodeDescsetSyslogLevelIntwStateStoppedcurrentLoginfoLevelwrapperRunService.getSignalModelogFileLastNowDate.sigActionAlarmchildOutputBufferrecv@@GLIBC_2.3createProperties.wrapperBuildJavaCommandArrayreplaceStringLongWithShortnanosleep@@GLIBC_2.3.signal.remove.execvpstrcpy@@GLIBC_2.3threadMessageBufferSizecorrectWindowsPath.wrapperGetLastErrorcloselog@@GLIBC_2.3strstr@@GLIBC_2.3.strcmp.getLowLogLevelwrapperArch.dup2getSignalModegettimeofday@@GLIBC_2.3ceil@@GLIBC_2.3wrapperBuildUnixDaemonInfo_DYNAMIC.getLastErrorText.gettimeofdaystrcmp@@GLIBC_2.3.pthread_equal.__libc_csu_fini.pipelog_printf_message.trim.jStateLaunchedjStateKillinglogRegisterThreadpthread_mutex_lock@@GLIBC_2.3wrapperLoadConfigurationProperties.setSyslogEventSourceNamewrapperBuildJavaCommandArrayInner.setLogfileAutoClose.wStateStartingwrapperKillProcessNowwrapperStartedSignalled.sigActionHangup.disposeInnerPropertyjStateStoppedsendLoginfoMessageappExitwrapperJVMProcessExited.vsnprintf.pthread_selfworkLogFileNamereleaseProtocolMutexprotocolOpen.wrapperInitializeRungetLastErrorTextdisposeLoggingwrapperOSftell@@GLIBC_2.3lockProtocolMutex.wrapperSetWorkingDirwrapperSetJavaState.getLogFacilityForName.releaseLoggingMutexwrapperKillProcess.socket.logTimerStats.getBooleanPropertysetLogfileLevelIntqueueWrappeddumpPropertiesconsoleFormatlimitLogFileCountHandleFile__xstat@@GLIBC_2.3propertieswStateStoppingvalidateTimeout.wStateStoppedwrapperInitializeRunpthread_sigmask@@GLIBC_2.3logTimerStatscloseLogfile.wrapperBuildJavaCommandArrayInnergetpid@@GLIBC_2.3.wrapperLoadConfigurationProperties.__xstat.getLogfileLevelInttrim__fini_array_endgetLastErrorfopen@@GLIBC_2.3currentLogfileLevel.closelog.descSignal.__libc_start_main.getsidgetLowLogLevel.jStateStopping.wrapperBuildUnixDaemonInfojvmOut.wrapperSetWorkingDirProp.randchildOutputBufferSizevsnprintf@@GLIBC_2.3strchr@@GLIBC_2.3.setLogfileFormatclose@@GLIBC_2.3send@@GLIBC_2.3.memset.wrapperTickExpiredsetConsoleLogLevelInt__dso_handle.correctWindowsPathcurrentLogFileNamepthread_equal@@GLIBC_2.3wrapperSleepevaluateEnvironmentVariables__libc_csu_finifork@@GLIBC_2.3initializeTimer.handleDebugJVMTimeoutstdout@@GLIBC_2.3timerRunner.printfmemcmp@@GLIBC_2.3.memcpycreateInnerPropertysprintf@@GLIBC_2.3setsid@@GLIBC_2.3.lockLoggingMutexputenv@@GLIBC_2.3.strcpystrcasecmp@@GLIBC_2.3wrapperBuildKeygetSyslogLevelIntlimitLogFileCount.asctime.wrapperStartedSignalled.releaseProtocolMutex.forkpacketBufferrollLogs.log_printf_queue.globfree.inet_addr.getSignalNamewrapperKeyRegistered.protocolOpenprotocolSendBufferSizeaccept@@GLIBC_2.3wrapperUsagewrapperLogChildOutputensureSpaceInChildOutputBuffer.exitwrapperPingResponded.removeProperty.setEnv.sigaddsetprotocolSendBuffer__errno_location@@GLIBC_2.3.setSyslogFacility.strerror_init.forceFlush.setLogfileMaxFileSizewrapperBits.strcasecmplogFileMaxSize.unlinkgetStringProperty.wrapperStopPendingSignalled.wrapperGetProcessStatusforceFlush.wrapperRequestDumpJVMStatewrapperGetWState.wrapperLogChildOutput.sendProperties.limitLogFileCount.wrapperFreeJavaCommandArraylogFilePath.wrapperProtocolClosejStateDown.commandPollwrapperRequestDumpJVMState.wrapperSleepwrapperGetLastErroropen@@GLIBC_2.3.setLogfileMaxFileSizeInt.renamefclose@@GLIBC_2.3.lockProtocolMutex.sendLoginfoMessagesignal@@GLIBC_2.3removePropertylog_printf_queueInner.setWorkingDir.wrapperGetSystemTickslocaltime@@GLIBC_2.3logfileActivityCountlisten@@GLIBC_2.3.setLogfileMaxLogFilesanchorPoll.wrapperEventLoop.wrapperDispose.wrapperStopProcess.dumpPropertiesinitLogginggetThreadId.evaluateEnvironmentVariableswrapperSetWorkingDirwrapperReportStatussetLogfileAutoClosestrlen@@GLIBC_2.3getLogfileRollMode.nanosleeppthread_mutex_unlock@@GLIBC_2.3strerror@@GLIBC_2.3wrapperDumpCPUUsage.setConsoleFlushstrrchr@@GLIBC_2.3wrapperVersion.getpid.wrapperLogSignalled.wrapperProtocolGetCodeNamesetConsoleLogLevel.displayLaunchingTimeoutMessage.jStateStarted.realpathdup2@@GLIBC_2.3.getenvtimerTicks.fgets.setLogfileLevel.validateTimeout.wrapperGetCurrentTime.wrapperSetWrapperState.sigactionupdateStringValue.wrapperParseArguments.sendEventlogMessage.closeLogfile.sigActionTerminationgetLogfileActivity.flushLogfile.jStateDown.wrapperKeyRegistered.setSyslogFacilityIntinet_ntoa@@GLIBC_2.3wrapperGetProcessStatus_start.protocolStopServer.pthread_mutex_unlockwrapperReadChildOutput.wrapperGetJStatepipe@@GLIBC_2.3.setLogfileLevelInt.sigActionInterrupt.setSyslogLevelgetIntPropertyinet_addr@@GLIBC_2.3sendProperties.strrchr.wrapperVersionBannerwrapperStartPendingSignalledfprintf@@GLIBC_2.3wrapperRunConsole.writeStateFilejStateStopping.wrapperStopRequested__strtol_internal@@GLIBC_2.3disposeInnerProperty.wrapperGetTicksopenlog@@GLIBC_2.3.wrapperGetFileBasejStateLaunchedsetLogfileMaxFileSize.wrapperDumpMemorygetOutputFilterActionForName.sigActionQuitlogFileRollModetime@@GLIBC_2.3.localtimejStateStartedloadConfiguration.wrapperProtocolRead.getpwuidpthread_create@@GLIBC_2.3wrapperGetFileBase.malloc.getrusageprotocolMutex.limitLogFileCountHandleFileloadPropertiesInnergetSignalCodeDescwrapperProtocolFunctionwrapperGetJState.bindgetInnerProperty.setConsoleLogLevel.insertInnerProperty.fclosewrapperStopPendingSignalled._startlogFileMaxLogFiles.replaceStringLongWithShortcurrentLogfacilityLevel.__strtol_internal@@GLIBC_2.3.sprintfqueueLevelssendEventlogMessagegetSignalName.getInnerPropertykill@@GLIBC_2.3getBooleanProperty.sigemptyset.listen.wrapperJVMProcessExited.checkAndRollLogs.wrapperStoppedSignalled.loadPropertiesInner.__errno_locationmalloc@@GLIBC_2.3logfileFormat__fini_array_start.linearizeProperties.strstr.setConsoleLogFormatwaitpid@@GLIBC_2.3__libc_csu_init.sigActionChildDeathrand@@GLIBC_2.3.read.createInnerPropertyqueueReadIndex.recv__bss_startmain.free.getLastError.sendpipeInitialized.initLoggingwrapperDumpMemory.wrapperRestartProcess.setLogfilePathsigActionChildDeath.loadConfigurationexit@@GLIBC_2.3.protocolStartServerthreadMessageBufferregisterSigAction__libc_start_main@@GLIBC_2.3queueThreadIds__init_array_endjStateLaunchingjStateStarting.umask.disposeProperties.wrapperInitialize.getOutputFilterActionForNamesetSyslogFacilityIntsetSyslogEventSourceName.wrapperReportStatus.getLogfileRollMode.jStateLaunch.main.strchr.wrapperBuildKey.log_printf_message.srandwrapperFreeJavaCommandArraylog_printfMutexsetConsoleFlushwrapperClasspathSeparatorremove@@GLIBC_2.3globfree@@GLIBC_2.3wrapperStripQuotesdata_start.wrapperGetTickAge.syslogcheckAndRollLogswrapperAddDefaultProperties.putenv.setConsoleLogLevelIntputchar@@GLIBC_2.3commandPollexecvp@@GLIBC_2.3sigaction@@GLIBC_2.3sigaddset@@GLIBC_2.3.log_printfthreadPrintBuffer.__data_startwrapperGetTickAgedisplayLaunchingTimeoutMessage_finiflushLogfile.wrapperStartPendingSignalled.setSyslogLevelInt.getIntPropertysigActionAlarmlogLevelNames.getThreadId.registerSigActionmaintainLogger.wrapperRestartRequestedwrapperUpdateJavaStateTimeout.wrapperExecute.jStateStartingsdsyslog@@GLIBC_2.3sigActionInterruptlogFileUmask.killinsertInnerProperty.isQuotablePropertysetEnv.wrapperKillProcessNow.loadProperties.updateStringValue.close.memcmpprintf@@GLIBC_2.3queueWriteIndex.getConsoleLogLevelInt.log_printf_queueInner.setLogfileUmaskwrapperProtocolRead.wrapperPingResponded.buildPrintBuffergetConsoleLogLevelInt.registerSyslogMessageFile.addPropertyPairwStateStarting.getLogLevelForName.__strdup.setInnerPropertythreadPrintBufferSizeprotocolStartServer.generateLogFileName.wrapperBuildJavaCommand.getSyslogLevelInt.pthread_mutex_lockthreadIdsmemcpy@@GLIBC_2.3setConsoleLogFormatgetLogfileLevelIntbuildPrintBufferwrapperTickExpired.inet_ntoasetLogfileLevelputs@@GLIBC_2.3wrapperParseArgumentsgetsid@@GLIBC_2.3handleDebugJVMTimeout.ftellsigActionHangupsigActionTermination.wrapperGetPID.fopen.wrapperUsageloginfoSourceName.daemonize.globaddPropertysocket@@GLIBC_2.3pipedes.wrapperReadChildOutputwrapperRestartRequestedwrapperGetCurrentTime.wStateStoppingwrapperAddToTicksreleaseLoggingMutex.pthread_createssd_edata.__libc_csu_initsetLogfileMaxFileSizeInt._Jv_RegisterClasses.jStateKilling.wrapperProtocolFunction_endfree@@GLIBC_2.3sigActionQuitbind@@GLIBC_2.3unlink@@GLIBC_2.3setLogfileRollMode.addPropertycheckPropertyEqual.setsidfgets@@GLIBC_2.3.putcharwrapperStopRequested.openlog.disposeLogging.fprintfsetLogfileFormat.wrapperDumpCPUUsage.jStateLaunching.writePidFile.getLogfileActivity.wrapperGetWStatedisposePropertieswrapperGetTicks.timegetLogLevelForNamefcntl@@GLIBC_2.3queueSourceIdsloadPropertiesgenerateLogFileNameregisterSyslogMessageFile.strlensetSyslogLevel.jStateStopped.logRegisterThread__init_array_start.putscurrentConsoleLevelwriteStateFilewrapperSetWrapperStatesrand@@GLIBC_2.3.rollLogs__strdup@@GLIBC_2.3.fflush_IO_stdin_used.wStateStartedlockLoggingMutexlog_printfisQuotableProperty.fcntl.timerRunner.getLogfileRollModeForNameglob@@GLIBC_2.3autoCloseLogfileaddPropertyPairsetSyslogFacilitywrapperBuildJavaCommandArray.checkPropertyEquallinearizePropertieslogfileFPunregisterSyslogMessageFileasctime@@GLIBC_2.3wrapperProtocolGetCodeName.ensureSpaceInChildOutputBufferwrapperDispose.ceilfflush@@GLIBC_2.3.wrapperRunService.open.setLogfileRollModegetLogFacilityForName._initwrapperGetPID__data_startmemset@@GLIBC_2.3setLogfileMaxLogFilessetWorkingDirrealpath@@GLIBC_2.3setInnerPropertytimerThreadIdgetenv@@GLIBC_2.3_Jv_RegisterClasses.wrapperStripQuotesrename@@GLIBC_2.3read@@GLIBC_2.3log_printf_queuewrapperStoppedSignalledwrapperEventLoopsigemptyset@@GLIBC_2.3pthread_self@@GLIBC_2.3chdir@@GLIBC_2.3.wrapperRunConsole.pthread_sigmask.waitpid.initializeTimer.chdirwrapperInitialize.appExit.wrapperKillProcesssetLogfileUmask.sigActionCommongetpwuid@@GLIBC_2.3__gmon_start__wrapperSetWorkingDirPropmule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/wrapper-freebsd-x86-320000755000175000017500000025517710553776311030606 0ustar charlescharlesELF L4*4 (444@%@%@%@@%/usr/libexec/ld-elf.so.1FreeBSD+C_\X%0B[P.GZNSEUQ]2,*RK49OAW8V1HY LCT ^MD#5  (!-$ 6"3;=><IF@?/&'+)7 :J<L*\?l1|0 ̏܏8L ",Y<&L`\u lU|"r)0 .O5̐q:ܐsAHP ;ZPb*j,o<c tLz\5l@ |m7<2'p?̑Yܑ: ,`? <LN\lV|  $+̒L1ܒ7 C> *EL,%a<Dh] jLYr\dyl|n Jtg'̓ܓH  p` 8,5<libm.so.2_DYNAMICceil_init__deregister_frame_info__error__sF_fini_GLOBAL_OFFSET_TABLE___register_frame_infolibc_r.so.4strcpyasctimewaitpidrecvpthread_createsigemptysetstrerrorgetenv__inet_addrgetpidfgetsmemcpyglobdup2mallocremovevsnprintfsocketfflushrealpathputenvsendstrtolpipeacceptrenamestrrchrnanosleepenvironfprintfkillbindchdirwaitumask__prognamestrstrsignalreadopenlogcloselogunlinkgetrusagestrcasecmpmemcmplistenfork__inet_ntoasigactionstrdupgettimeofdayfopenlocaltimememsetgetsidftellsrandfclosesyslogstrcmppthread_mutex_unlockgetpwuidsprintfatexitpthread_selfglobfreestatpthread_mutex_lockatoistrlenstrchrexecvpsetsidfcntl_edata__bss_start_end 7ȶ̶жԶضܶ      $(,048< @"D#H$L'P(T)X+\,`-d.h/l0p1t2x3|45689:;<=?@ABCDEFGķHȷI̷KзLԷMطNܷOSTUVWXYZ[]^5%Ķ%ȶh%̶h%жh%Զh%ضh %ܶh(%h0%h8p%h@`%hHP%hP@%hX0%h` %hh%hp%hx%h% h%h%h%h%h% h%$hp%(h`%,hP%0h@%4h0%8h %<h%@h%Dh%Hh%Lh%Ph%Th%Xh %\h(%`h0%dh8p%hh@`%lhHP%phP@%thX0%xh` %|hh%hp%hx%h%h%h%h%h%h%h%hp%h`%hP%h@%h0%h %h%h%ķh%ȷh%̷h%зh%Էh%طh %ܷh(%h0%h8p%h@`%hHP%hP@%hX0%h` %hh%hp%hx%hU WVSҍu^|=P~)}t#E@8t8/u H @@8ut Rhh]eWVSPU=Hu@vDD@СD8ut hjHÍvUUth(hjÐUUjjh]dP^jjh]dPGÉU=dt!dPǟdho¡`P<`PqPhajjTÉUEEUœƒbEaEaEaEaEaEaEaEaEaEbEbEbE#b{vE8bovECbcvENbWvEXbKvEdb?vEnb3vEyb'vEPhbh@E@UÉUEE}su EbE E} u EvE PPUX;E}0=\t\PEP\=TuR`t:} tEbPEPPh cjjծ `t8} tEbPEPPhLcjj腮 \U} u\@vE P\@PjEP\PTPgE}u5`tBnPhbcjj ÉU8EPEE؉EE‰UԉU܉E؋U)Љ)UԋM)Љ‰UЁ~v=Tu7=Pu=Pu1=Tu 1vjjEPTP-E}uWFmE}#t>}#t8}&t2}6t,`tPh{cjj٬1f4}t.`thcjj裬K10EEEvjjEPTPqE}u+}u E}UM EE}t뢉U`t,hEPPhcjj U›ƒdvhP C7CBhP-CChPChDah@NhEPRC@2`thEPhcjjӪ EPEEEEvE؋U)Љ)UԋM)Љ‰UЁ1 ÉU詜t hXdj辠hddjjPhid萣j解jj1ÉUEPhmdj`R蚩E`U;|v`U R`U REP%tp`U  [t\tDhdjjS-hdjj˨jj8v EÉUj dP蒗EEPjsEP%Uj3HDjjjGE`@\3pE}t U`lthdjjh ejjߧ`t6`xth?ejj貧hSejj蛧^>heejjx`ÉUj3HCjjjGD`@\3oE}t Uhejj`t6`xth?ejj֦hSejj迦]bheejj蜦`ÉU`xx5t`xx6t2`tE PhejjEP聴 `tE PhejjEPQ `u0`x|Mt%`x|Nt`x|Ot`x|Gt`ǀ`U `ǀ`@x5ÉU`u<`u.`x|Mt#`x|Nt`x|Ot `x|Gt$`thfjj@`th@fjj`ǀ`ǀÉUEPEEEE;E|vEUЀ8\EH9E}zEUЍP:\uE UЋUMʊ EEIEUЍP:"u E UЋUMʍJEEE UЋUMʊ E*vEUЀ8"uE UЋUMʊ EE-E UÍvUTSEE}h`fhefdP誐EEPPR)‰ЋU U } t(EPhzfEER&EPhmdEEREDž``@PhfhPjhPdP֏E}6EP} hfEPt;EtvhfEPY;Et[EPhPhfjj3 j‰ЋU U EE|vhPdPcd`@PhghP} t E!jhPdP轏E}t;EPPR"EEPEPvEEEPPR‰ЋU U } tHdt?j EP]t(EPhzfEER&EPhmdEERj}tEPEEE`}u svjh'gdP+E}~qE}=~E}tFj ‰ЋU U EPh?gEERE EjhGgdP萍E}~kE;E}E=~E}tFj 6‰ЋU U EPh^gEER E}`hfgN} tmDž`Dž\`Ѐ8"t&\Ћ`ʊ \`\Ѐ8u몉 DžjhvgdP艋E}?BEPÃP{PPR‰ЋU U } P7v]PB8\u9PxPEPhgEERX 7vPxPEPhgEER 6PxPEPhgEER vEPMPR‰ЋU U } EPvHEPUB8\u*EPhgEERH(vEPhhEER&EPhhEERyDžTDžPPP‰ЋU U h0hEETPT} t0hEhEETPTTDž`Dž\v`@PhGhhPjhPdPJE}JEP`XX"TXЍP;PEELPPPi‰ЋU U LPhmdEER=LPDžLQ\~'UUT xTEPhmdEETPXT\`}u _vJPXX%TXЍP;PEELPPP‰ЋU U LPhmdEERLPDžLQ\~'UUT xTPhmdEETPNXT\\u0hdhUUT PT} UUT P:\u0hghEETPThEhEETP~TE}tBj R‰ЋU U hihEER-E}QDžTDžPPP‰ЋU U } t0hEhEETPTDž`Dž\`@PhthhP|jhPdP讃E}EPXXj*EPuj?EPuvPjj(EPDž;|i􋅸RXTXЍP;PEELPPP-‰ЋU U LPhmdEERLPDžLQ\~'UUT xTRhmdEETPnXT\!EPhPhhjj\ 􍅼PJjEEEP~UB8/t EP`UB8\tfEP=PEEPPREPEPEEPUBPEPtb8ty8t$EPhPhhjjD #v4PEPh ijj E;EtEPETXЍP;PEELPPPi‰ЋU U LPhmdEER=LPDžLQ\~'UUT xTEPhmdEETPXT\`}u v\u0hdhUUT PTZ} UUT P:\u0hghEETPThEhEETPTE} `HP&PR‰ЋU U } t/`HPhXiEERT-v`HPhkiEER%E}tKj‰ЋU U `P(Rh|iEERE`x,~T}tKj‰ЋU U `P,RhiEERrE}tKjL‰ЋU U `P0RhiEERE}tKj‰ЋU U `P4RhiEERE`tv}tmj‰ЋU U } t%hiEERk#hiEERFE}tJj ‰ЋU U ]PhjEERE`xt~}tmj!‰ЋU U } t%h jEER#h`jEERrEv`x^}j,.‰ЋU U } tU`Bgfff)PhjEERSv`Zgfff)PhjEERE`x^}j,C‰ЋU U } tR`Zgfff)PhkEERP`Zgfff)Ph@kEERE}dPPRX‰ЋU U } t+dPhbkEER')dPhykEERE}`RUPR‰ЋU U } t2`RhkEER0v`RhkEERNE`htv}tmj ‰ЋU U } t%hkEER#hlEERE`ltv}tmj‰ЋU U } t%hlEERk#h7lEERFE`tv}tmj'‰ЋU U } t%h`lEER#hlEERE}j-‰ЋU U } t/`P`RhlEERd-v`P`RhlEER5E}tOj‰ЋU U `BRhlEERE}tyh mhmdPuEEP"PR‰ЋU U EPhmdEER[EDž`v`@Ph(mhP,jhPdP^tE}EPt}zhPdP|ud`@Ph`mhP} t E"vjhPdPtE}t;EPPR:EEPEPEEEPPR‰ЋU U } tHdt?j EPut(EPhzfEER&EPhmdEER}tEP]EE`}u vUUEPjU E ЍR‹EEPERMU}trEE;E |JEE<t0EEREEE묃EP\EU}u(`REPhmjjc j`u6`U`REPhnjj &`REPh`njj ÉU$S=`u%jSP(`LP1ɉUMm]E}~T`BHUMEMn}f]f f]m]MmL  E맍v`@X]ÉUE8tERE} t>E P7PR‹EE PER{ÉUjhndPp`lÉUhaEPuu [1/vhnEPuu \ ZÉU$ShXdhndP"oEEPwhnhndPnP-uE}uh ojj誁E?}u7h_oEPuh_ohojjiEEPwhddhodPQnPwhohodP(nPxh phpdPmPxjh'pdPnP:y`jh@pdPtn~jh@pdPVnv1`PyhcphfpdPGmPyhoh}pdPmPyjhpdP nPyhphpdPlPyhphpdPlPhpdPlPyy蒃Ix`ǀjhpdP m`Bh}hqdPl`B `x ~`x (`@ }`P Rh qjj~hh`qdPzl`B$`x$~`x$I``J H$P$~P$`P$Rh qjj/~Y``@$;B }D``J H$P$~P$`P$Rhqjj}jhqdPk`B,`x,~3``@,;Bu `@,hrjjs}hyhHrdP8k`B0`x0~`x0)v`@0y`P0Rh`rjj }h|hrdPj`B4`x4~`x4I``J0H4P4~P4`P4Rh`rjj|Y``@4;B0}D``J0H4P4~P4`P4Rhrjj(|jhsdP@j``tjujr_v`ǀh+sh1sdPhPp`B@jhOsdPi``t`ǀ`x u#jh_sdPRi`BhhwsdPh¡`э PhhsdPh¡`э PhphsdPg`jhsdPh`jh tdPh`jh"tdP\h`jh7tdP6h`jhKtdPh`jh`tdPg`jhtdPtg`jhtdPg`jhtdP(g`jhtdPRg`jhtdPfPhudPf``}`ǀPh udPof``}`ǀjh>udP,f``}`ǀjh`udP9f`jhudPf`j hudPe`B`jhudPze`BdjhudPWe`BhjhudP4e`BljhudPe`BpjhvdPd`Bt`xd `@d`xh `@h`xl#`@lh@vjjv/`xl~ `@lhvjjyv``Jl9Hh}.``JlHh`PhRh wjj5v`xp `@p`xt `@t`x``@`xv``@d;B`}hwjju``@h;B`}h@xjju``@p;B`}hxjjvujh`ydP>c`h,hydPc``#hyjju`ǀjh zdPc``Dž`;|Sv` R4` 뚉` R`ǀ `Rκ`ǀ`ǀ`BRhOzP蛹jPdP`t `uv떉``ЍR¡` `ЍR¡`Dž`;|4@PhOzP蠸jPdP_PPRK‰Ћ` P` R@PhizPhaPdP_Pc`v`x u1jhzdP^P`P[jhzdP^P`P*`x u1jhzdPD^P`PjhzdP^P` P`x u1jhzdP]P`$PjhzdP]P`(PPjhzdPu]P`,P`jh {dP^~#jh {dP]=~Hjh {dP]~jh {dP]0`x u1jh){dP\P`8PH`jh<{dP.]~$jh<{dP]=~Ijh<{dP\~jh<{dP\<jhY{dP\`D`DRhg{dPh\`H`DRhz{dP8\`L`DRh{dP\`P`DRh{dP[`T`DRh{dP[`X`DRh{dPx[`\`DRh{dPH[```DRh|dP[`d`DRh,|dPZPcjhB|dP[`h`@ 1U(EP芶EEMɉMUЍUE)U MQEMEUE%E% MUÉUE U)щMgfffEE)‰ÉUEU )щM}| 1ÉUU Ѝ UvÉU`P UEPGt*foPEPh`|jjQk #v}tEPh|jj,k1ÉUjh|dP!XE}t/EP;tEPB‰ v1ÉU`tE Ph|jjjE PhmdEP`RyjU`tEPh|jjNj`B|ItM'v`HPEP路jjjJLdPh|EP谯EPjp'`xh߇~jh|EP{`PhRh|EPZEPjqѹ.vh}jj[ih`}jo衹;vjje船`PpR7PjM_ÉU`th}jjh`P|Lt%`PhRD7PLvÉU`tEPh}jjvhEPjUh}jjIhÍvU`tEPh}jjh`x|LujjjMJ`x|MuY}}EE ~$}fUf fUm]EmP.6P6ÐU`th@~jjkg`PtR5PjNÐU`tEPh~jjg`x|Kt`x|Mt\v}}EE~$'}fUf fUm]EmPB5PJÐU`th~jjf`x|KuY`PhR4PjL`xx3u(j43`x\ujjj4j$7>v`x|Mu0jjeY`PpRz4PjM0ÍvUE4t&4 3t>5t6t&0E@3vEI'vEQvEZvEbvUÉUEwwEjovEocvE}WvEKvE@?vEI3vEQ'vEZvEvEbvUÉUEE} ~EP苨ЉUhEP菩EEPZ}t)E PhEPEP譩-jd-EovEPhjjdÐU`t=EP P`PxRPh jjc `UPx`$t:`\R`PxRP`$RÉU} E PEPE`t;EP`R`P|RPh`jjb `U`ǀ`ǀ`ǀU`t=EP%P`P|RPhjjbb `UP|EPE P`(t:``R`P|RP`(R4ÍvUhjjahhdPNEh EP詥uPh`EP菥u6hEPuuhEP[u~v`ih jj%ah jjahijj`hjj`hjj`h@jj`hjj`hjj`hJjj`EPh_jjp`hjj\`hjjH`h jj4`hjj `hDžjj `hjj_h jj_h jj_ÍvUx`8:`@REP`th!jjl_EP`8RaE}u`u>`u0`x|Mt%`x|Nt`x|Ot`x|GtOh@jj^jjH`xx5t`xx6tj5`<REP`@US`,Y`4REP`4`thejj^EP`,R E}Eh`,RעE}u jd&E}  }uv벉}u"`,Rhjjp]=EPjPDPӟ@@j DP蚣<<t <j DPl<<t <D8j DP244t"4448 thĆ8POu#8Ph̆jjZ\ƶh8PxOuo4uDž04PI00P8Phjj[ 0PjG/vh/8PNu+8Ph@jj[jUhh8PNtChy8PNt&h8PjN v4u8PhjjZ4PeO,,u)4P8PhjjZ /U(hh8PMu:,P/T4P8Ph jjIZ hy8PlMu7,PQ4P8Ph`jjY mh8PMu7,PS4P8PhjjY 8PhjjY T$(;$tK`$ʉSPh DPDPjpuh 8P@Lh8PLtzh&8PLt]h48PKt@h?8PKt#hL8PK1ۃ4t"hY4P}Ku h 8PUKu` h8P Ku` h&8PJu` h48PJu` ^h?8PJu` .hL8PXJu` t%8P8Ph^jjV #8P8PhwjjV 8PhjjV@u vEP`,R-u(KZP`,Rhjj.V `0REP\`4ÍvUhjj3j&`x|Luj4jjj4j&ÐUÍvUh`Rj5j&`x|Gu j6hÍvUÍvU(`xx3t`xx4t7v``ǀ``t'h jjTj5EP`R`;|m`ǀ`REPjH`~+`t`Rh`jjGTv``t>`REP`RPhjjS ``;}X`REPjH`~+`t`Rh`jjySM`R`RhjjKS h`jj7Sj5"y`ǀ`x\t`U`UEPEPjH(}~#`tEPhjjRv`RhӋEPWhhhdP?PEPdP?t1`Rh jj/R`ǀvj5`UU`xx3t`xx4tvEP`R`~U@Hƒt|V`t2h`jjmQytj5M`DhjjQ} t4;!=u&hjjPj5v`PdREPjIjEPjGÍvU} tL =u>jEPjG`ǀhjj[PCEP`R$|!6j\%`ǀU`thjjOhjd-E}}3h jjOj$`ǀ`PdREPjKU} tL=u>jEPjG`ǀh`jj+OӝUEP`R|3hjjNj$`ǀÉU} tP=uBjEPjG`ǀh׍jj{N#*EP`R@|7hjj:Nji#`ǀEP`PlR`R<P`th@jjMhajgE}}"`thfjjzM`thwjjXM`UÉU} t<_=u.jEPjGfhjjM誛DEP`R|#hjjLj!ÉU} tL=u>jEPjG`thjjdL FEP`R,|#h@jj&LjU!ÉU} tEE;ht)`REP\``REPt >v/?EPEP`;B`~pEPEPPhjjE`t;EPEPSP`R`EE``t vP`tP`t `REP1P`R`P|R4P`PxRPEPhjjmD0EPEP``thdjjD`ǀ`x|Gu`x|HujEPjG-`x|Mt`x|Nt`x|Ot v=u.h}jjCjEPjGN`thjjMCjje薓`PpREPjMq`t(`PxR'PhjjB`Bx4t.4 3t^5t/6t>PEP[vEPGvEP3vEPv`PxRhjjYB`t(`P|RPhjj!B`B|HEPEPEPEPEPEPEPEPEPEPvEPEPgvEPEP OvEPEP7vEPEP v`P|RhjjA`xx6u vv`th1jj@U`t`R`t`R`$t`$R΄`(t`(R詄` t` R脄`8t`8R_2EP ÉUكÉUEEP蒃ЉUhEP薄EEPa}t,E PhEPEP贄 v1ÉUhjjEPXMjlP豂} BPhjjEPM ÉUEw2)!œ͓Փ ݓÉUEw4v4)K!Tbu ÉU}uhjjj`L`hǔjjj6LEPRUPERPERhjjjK Ext2EPRPEPRh%jjjK ExuiEPRE}u E; EUEPEPREP RZPEP Rh`jjjAK U݂EE;u-`tEPhjjjJ `ht"EPh֕jjjJ v`u>`u0`x|Mt%`x|Nt`x|Ot`x|Gt:EPhjjjaJ `ǀj=)EPh)jjj)J jjR`xx5t`xx6tvj5ÐUE PZzE`t6E;uh`jjjIvhjjjIÍvUE PE PhŖÐUE PEE;uhjjjIjÐUE Pvh jjjHjn~h`jjjHÉUE P*E PhVÐU(E EEPRM|E@jEPEP~t,>PEPhjjj-H v1ÉU(EEjZ,`th՗jj9 jdRE|E|)щMEU)щM}t E`U;P~/UЍЍRhjj9D`PЉ9U}0UЍЍPh@jj8`t&EPEPEP|Phjj8 EE1ÉU`thØjjO8jhjhIzE}t+#<PEPhjj8 1ÉUEhjuch@j|uKhljdu3hjLuhj4uE`xtE}tU UÉUEE‰))‰E`tEPhjj6jEP^z`th"jj6ÍvUS`xDEv`U @D<uB`U @DR }`U @DE륐`PDR|`@DEEjEPEP耰`x@tNEvE;E|:EEREPh3`P@Rj5 E뿍vE@R8x¡`PDEE;E~vE;E}|EER|{PRw‰Ћ`MRDEER`U @DRv`U @DEKvEPEP舯]U=tu?hw}f8PhDjjU4tj-,-xE}u<`PU-7Ph`jj3r`ǀ`}`HRwjPHv}7Phjjy3jPv}R7PhjjA3`PDR`PDPy!wR7Phjj2 jyoElp`P,jjpP>y}&vR6Phjjr2 jjpPx}&\vRB6Ph jj12 `tN`TR|tP`R<t`Rh`jj1` tR`XR`R` Rt` Rhjju1U`xt‰|ÉUs‰vÉUÍvUEPjut 4Phjj0pPjOut4Ph jj0tlMbll)PpP|lMbll)PxPElMbll)PEPEĉlMbll)PEPh`jj/0ÉUjEPlPqE}} hjj/E}~rEEu EEhjjS/EEP譪`t`Rs vEUÉUvÉUU )9E||PqE=tFPPEP/qUЍPP>uEÐUH=pPx‰DžvE)Љ))Љ‰ EEjjpP3t}&qRx1Phjjg- EPPpPqE}Dq8#u)v0qR1Ph jj- ~?jPP DžUDž;E|< uRjPyP茂Dž}u ~;jP'HPu1ÉUjjlPtmu~j lP+ot2hTjja+Y/PhjjH+vhjj/+h`ǀjjjGOl`t`R@oxyÉUEjjlPlu$`tEPVEEPPjOÐUdPh3lh8#lEPh@lhkh8khkh khRkh8khhkÉUj""`thjjq))nE}}*Y-PhjjH)jk&}thjDoou&,Phjj(jjjmjjhoE}t{jVojEPEkj8ojEP'kjojEP k}t}t}tEPnj!`thjj (lE}}*+Phjj'j}tjm`P UPEPju#n+Phjj]'j/Pju#Ph@jj'T Pjt+*PPh`jj& 1ÉUdhpWi`hpj`Pk`@ `@\j3KjjjG``@D`ǀ`ǀ`ǀ`ǀo``ǀ]{tjj:E Rtj}.E RjshE Rju-E Rj&1`[v``UP`U Pltjwtj`DRSh`ltƒuƒuv)`8tq`dRqfP`8R1t@'P`8Rhjj# j`tr`LReP`RtA]'P`Rhjj@# jc`th`PRreP`R2t7&P`Rh jj" `ǀIzEEPUÉUEU}uDE PERgE}~1$}u UvEPU뵐1ÉUEU}upE RERgE}~BE UJHE UPExu EU EPE BEU PLEPU뉐E UJHExu EU  EPE BEU PE @ÍvUjdEEE@E@E@UÉUERgEEPRgE@EPgEU(E EEE EEHvE8u7vj%EPfj%@Pf)ЍPP@PPbPbU)щ;} ~/PEPEPbE)Pe;} ~2PPEPaE)E@E{U)Љ‰;} ~/PEPEPaE)EEEPd‰;} ~/PEPEP`E)EEvEPd‰;} ~/PEPEP `E)EEvÉU@ExtEPRcE@} uE@h@PE P4P'cPR_‹EPEEPb9E|EU<~U<EUHMEE뢉EPMÍvU8h`E P.aE}u vEPhBPh^{{<j P/b{{t {j Pb{{t {{{8 t {8t{{8#!{Pza{Dž{Dž{{;{|{{Ѐ8"u{Љ{{{Ѐ8#{{{ЍP:#uR{@{{;{~,{{B{{ʊ {{{{{{{ {PY`{{~/{{ЍP: t{{ЍP:t{{ЍP{먃{P_hc{Px];{uw{{{8t {8 t {܃} 9hB{P{P_E@P{PEPcv{8#tUj={PH_{{t0{{jj{P{PEP {u vEP]1ÉUjE PEP‰vÉUjZEEE@UÉUEUEE@v}u(EPUEPEEEѐEPh^EUE PEPE}u]EPUEPU}u EUP EUJH}u EU EUJHEPÍvUSEPN]ÃE P=]BPYEE PEPhlEP\EPYtEPhX]ÐUEP\EEEHEEUЀ8 tEUЀ8 t E;E| EύvvEUЀ8 tEUЀ8 t E;E MύvEU)ЍPU}~EPEUPE P[XE UÍvUE P[PRUXEEPE PEP[PRXEEPEPEEPEPE}u]EEPT[PRW‹EEPERVEPEPExtE}EPEPNEUPEUP EPZ vShEPZX;Eu8E PVuEPRE PLEP\Zv4hEPW;EuEPREPEPZEPsZÉUBE PYPBvE PhjjuE PPUj=PYt=EPEPPPEPD 1 vÉUE PEPFE}u UvEPÉUE PEPE}uEE EPUEPSWEEPEPVЉUEPXUÉUE PEPE}u U!vjjEPRU‰ÉU}t$h$h$E PEP ‰$"h$h)E PEP‰ÉUE PEPE}u1EP ÉUEU}u,EPRERh/jj  EPUÉU(E EEEU}uERWEEEPRVEEUEPEPVE}u vEEԋEPUvEPEPVE}u vEEEEPUGvEEPR‰ЉEEEU}uUEUEPEPCVE}uGvEU)ЍPREPEP4REU)ЍPUEUEE@E뛍vEPEP,QEPUEE=EEPUvEPEPUE}uGvEU)ЍPREPEPQEU)ЍPUEUEE@E뛍vEPEPPEP UEEUEEPUEEUÉUE PTEEEEE}tEPTE EE;E~ U~vE8u^EPE PEPRu+}~EPEPEPuPEEEEEU EE뚉EUvÉUE}~ EEۍv1ÉU1ÉUASE}|}EM ÍvU SEE}~(E;EuU EӍvEPhN1ÉUE PEP:Q‰ÉUhߡEPuhEPuvhEPouvhEPCu sqhEPu OMhEPu +)hEPu 1ÉUhߡEPuh`EP{uvhEPOuvhEP#uvh"EPu sqh|EPu OMh'EPu +)h,EPu 1ÉUEPnPE=t3PPPPPPE@PLEPPsKE PaLE P@LUEÍvUvÉUEÍvU}tEPh`JÉUEÍvUvÉUEP_PÍvU(}.EPNPR[K‰ЉEuEEEvEPN9E||EUЊUEj?EPh>ԵPh`EPE PEP EEPhrP6@=t#PAE tv?E ;|2ԵPE PEPԵPE PEPvtÉU@R>‰vÉU?ÉU1ÉU1ÉUÍvUE HwEE:vE.vE"vEvE vEjj h?EPhMEP@t?ÉU=t#P`@EEEPhأEP@EPjPP*EPP@E}u=~E;|뎉P"=tLlu>v[u- PPh;j=}PP;EHPhأEP?EPjPP1PP=tm=8 u-PPh T;jW<0KPPPh";j%<MjjPPPPX<uwuh<8 u,PPh :j;/PPPhV:jY;ÉUEPE P=~vEE;E|#vEE<uaE PB>PR:‰ЋU U E PEERp9vE PEER#=E}u ov}bEHEvE;E}vEE<EH9E}@EMAU U EEvEER9t6PEERh8j9EER3=EEME P<PR8‰ЋU U E PEER7HEE P8t)PE Ph7j8UHEPY8EEE;E|EEEۍvEP;PR8‹EEPER6EPjj(E P7}~DEE;E|.EPEPEE܋REPEʉEP:EE;E|>EE<t!EER4;vE뻍vEP;ÍvUx==tOPe9E}}+Ph5j6cvEPP9t]u EDu E/vPhg5jj6ẺEE;|6hEP8=t#Pk8=~cjEPPPNjh6PP3@PPPU=ȵt<̵P 9̵̵M ̵M ̵ M ̵=̵ ~̵ȵÐU(EdEEP\4EEEEPEPEPEPY4E}}EdE;E| E@E vE}uEP7E}t wv}tEPEPE P)EPhMEPE PEP7ÉUе;̵uqеPhMе PеPiе=е ~ е냍vÉUS=tvЃ;u[ÐUc70123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_set.WRAPPER_FILE_SEPARATOR=/set.WRAPPER_PATH_SEPARATOR=:Unable to resolve the full path of the configuration file, %s: %sThe argument '%s' is not a valid property name-value pair.Unable to open configuration file. %sProblem loading wrapper configuration file: %sserver socket close failed. (%d)server socket creation failed. (%s)server socket ioctlsocket failed. (%s)127.0.0.1unable to bind listener to any port in the range %d-%d. (%s)unable to bind listener port %d, or any port in the range %d-%d. (%s)port %d already in use, using port %d instead.server listening on port %d.server socket listen failed. (%d)socket creation failed. (%s)accepted a socket from %s on port %dsocket ioctlsocket failed. (%s)socket close failed. (%d)STARTSTOPRESTARTPINGSTOP_PENDINGSTART_PENDINGSTARTEDSTOPPEDKEYBADKEYLOW_LOG_LEVELPING_TIMEOUTSERVICE_CONTROL_CODEPROPERTIESLOG(DEBUG)LOG(INFO)LOG(STATUS)LOG(WARN)LOG(ERROR)LOG(FATAL)UNKNOWN(%d)̜؜ ,8DP\ht(Property Values)NULLsocket not open, so packet not sent %s : %ssend a packet %s : %ssocket send failed. (%d)socket read failed. (%s)socket read no code (closed?).read a packet %s : %sreceived unknown packet (%d:%s)(HPddddddwrapper.logLPTMLPM%sFilter trigger matched. Restarting JVM.Filter trigger matched. Shutting down.--> Wrapper Started as Daemon--> Wrapper Started as ConsoleUsing system timer.Using tick timer.<-- Wrapper Stopped--> Wrapper Started as ServicewrapperStopProcess(%d) called. (IGNORED)wrapperStopProcess(%d) called.wrapperRestartProcess() called. (IGNORED)wrapperRestartProcess() called.javawrapper.java.command"%s"wrapper.java.additional.%d-"-The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.wrapper.java.additional.%d.stripquoteswrapper.java.initmemory-Xms%dmwrapper.java.maxmemory-Xmx%dmLD_LIBRARY_PATHwrapper.java.library.path-Djava.library.path="%s%c%s\"-Djava.library.path="%s%c%s"-Djava.library.path=%s%c%s-Djava.library.path="%s\"-Djava.library.path="%s"-Djava.library.path=%s-Djava.library.path="wrapper.java.library.path.%d./\-classpathwrapper.java.classpath.%dClasspath element, %s, does not match any files: %sClasspath element, %s, does not exist: %sUnable to get information of classpath element: %s (%s)-Dwrapper.key="%s"-Dwrapper.key=%s-Dwrapper.port=%d-Dwrapper.jvm.port=%d-Dwrapper.jvm.port.min=%d-Dwrapper.jvm.port.max=%d-Dwrapper.debug="TRUE"-Dwrapper.debug=TRUE-Dwrapper.pid=%d-Dwrapper.use_system_time="TRUE"-Dwrapper.use_system_time=TRUE-Dwrapper.timer_fast_threshold="%d"-Dwrapper.timer_fast_threshold=%d-Dwrapper.timer_slow_threshold="%d"-Dwrapper.timer_slow_threshold=%d-Dwrapper.version="%s"-Dwrapper.version=%s-Dwrapper.native_library="%s"-Dwrapper.native_library=%s-Dwrapper.ignore_signals="TRUE"-Dwrapper.ignore_signals=TRUE-Dwrapper.service="TRUE"-Dwrapper.service=TRUE-Dwrapper.disable_shutdown_hook="TRUE"-Dwrapper.disable_shutdown_hook=TRUE-Dwrapper.cpu.timeout="%d"-Dwrapper.cpu.timeout=%d-Dwrapper.jvmid=%dMainwrapper.java.mainclasswrapper.app.parameter.%dwrapper.app.parameter.%d.stripquotesJVM process exited with a code of %d, leaving the wrapper exit code set to %d.JVM process exited with a code of %d, setting the wrapper exit code to %d.JVM process exited with a code of %d, however the wrapper exit code was already %d.Owrapper.daemonizeSHUTDOWNwrapper.logfileSIZEwrapper.logfile.rollmodewrapper.logfile.rollmode invalid. Disabling log file rolling.YYYYMMDDwrapper.logfile must contain "%s" for a roll mode of DATE. Disabling log file rolling.wrapper.logfile.formatINFOwrapper.logfile.loglevel0wrapper.logfile.maxsizewrapper.logfile.maxfileswrapper.logfile.inactivity.timeoutPMwrapper.console.formatwrapper.console.loglevelwrapper.console.flushNONEwrapper.syslog.loglevelwrapperwrapper.ntservice.namewrapper.unix.namewrapper.portwrapper.port.minwrapper.port.min must be in the range 1-65535. Changing to %d.wrapper.port.maxwrapper.port.max must be greater than or equal to wrapper.port.min. Changing to %d.wrapper.jvm.portwrapper.jvm.port must not equal wrapper.port. Changing to the default.wrapper.jvm.port.minwrapper.jvm.port.min must be in the range 1-65535. Changing to %d.wrapper.jvm.port.maxwrapper.jvm.port.max must be greater than or equal to wrapper.jvm.port.min. Changing to %d.wrapper.debugDEBUGwrapper.java.command.loglevelwrapper.adviserwrapper.use_system_timewrapper.timer_fast_thresholdwrapper.timer_slow_thresholdwrapper.native_librarywrapper.java.library.path.append_system_pathwrapper.state_outputwrapper.timer_outputwrapper.loop_outputwrapper.sleep_outputwrapper.memory_outputwrapper.memory_output.intervalwrapper.cpu_outputwrapper.cpu_output.intervalwrapper.disable_shutdown_hookwrapper.startup.delaywrapper.startup.delay.consolewrapper.startup.delay.servicewrapper.restart.delaywrapper.restart.reload_configurationwrapper.disable_restartswrapper.cpu.timeoutwrapper.startup.timeoutwrapper.ping.timeoutwrapper.ping.intervalwrapper.shutdown.timeoutwrapper.jvm_exit.timeoutwrapper.ping.interval must be at least 1 second. Changing to 1.wrapper.ping.interval must be at less than or equal to 1 hour (3600 seconds). Changing to 3600.wrapper.ping.timeout must be at least 5 seconds longer than wrapper.ping.interval. Changing to %d.CPU timeout detection may not operate correctly during startup because wrapper.cpu.timeout is not smaller than wrapper.startup.timeout.CPU timeout detection may not operate correctly because wrapper.cpu.timeout is not smaller than wrapper.ping.timeout.CPU timeout detection may not operate correctly during shutdown because wrapper.cpu.timeout is not smaller than wrapper.shutdown.timeout.wrapper.max_failed_invocationswrapper.successful_invocation_timeThe value of wrapper.max_failed_invocations must not be smaller than 1. Changing to 1.wrapper.request_thread_dump_on_failed_jvm_exitwrapper.filter.trigger.%dwrapper.filter.action.%dwrapper.pidfilewrapper.java.pidfilewrapper.lockfilewrapper.java.idfilewrapper.statusfilewrapper.java.statusfilewrapper.commandfilewrapper.command.poll_intervalwrapper.anchorfilewrapper.anchor.poll_intervalwrapper.umaskwrapper.java.umaskwrapper.pidfile.umaskwrapper.lockfile.umaskwrapper.java.pidfile.umaskwrapper.java.idfile.umaskwrapper.statusfile.umaskwrapper.java.statusfile.umaskwrapper.anchorfile.umaskwrapper.logfile.umaskwrapper.ignore_signalsUnable to set working directory to: %s (%s)Working directory set to: %swrapper.working.dirGot a log message from JVM: %sGot key from JVM: %s%dReceived a connection request with an incorrect key. Waiting for another connection.Incorrect key. Connection rejected.Got ping response from JVMJVM requested a shutdown. (%d)JVM requested a restart.JVM signalled a stop pending with waitHint of %d millis.@@JVM signalled that it was stopped.JVM signalled a start pending with waitHint of %d millis.@@JVM signalled that it was started.3.2.0STARTINGSTARTEDSTOPPINGSTOPPEDUNKNOWNDOWNLAUNCH(DELAY)LAUNCHINGLAUNCHEDKILLING0<HT`lxw%s Unable to write to the status file: %s Set Wrapper State %s -> %s Set Java State %s Timeout %08lx -> %08lx Set Java State %s -> %sStartup failed: Timed out waiting for a signal from the JVM.Mainwrapper.java.mainclassorg.tanukisoftware.wrapper.WrapperSimpleApporg.tanukisoftware.wrapper.WrapperStartStopAppcom.silveregg.wrapper.WrapperSimpleAppcom.silveregg.wrapper.WrapperStartStopApp------------------------------------------------------------------------Advice:The Wrapper consists of a native component as well as a set of classeswhich run within the JVM that it launches. The Java component of theWrapper must be initialized promptly after the JVM is launched or theWrapper will timeout, as just happened. Most likely the main classspecified in the Wrapper configuration file is not correctly initializingthe Wrapper classes: %sWhile it is possible to do so manually, the Wrapper ships with helperclasses to make this initialization processes automatic.Please review the integration section of the Wrapper's documentationfor the various methods which can be employed to launch an applicationwithin the Wrapper: http://wrapper.tanukisoftware.org/doc/english/integrate.html Loop: check anchor fileAnchor file deleted. Shutting down. Loop: check command filer+tUnable to read the command file: %sRESTARTCommand '%s'. Restarting JVM.STOPCommand '%s'. Shutting down with exit code %d.DUMPCommand '%s'. Requesting a Thread Dump.CONSOLE_LOGLEVELLOGFILE_LOGLEVELSYSLOG_LOGLEVELCommand '%s' is missing its log level.Command '%s' specified an unknown log level: '%'Command '%s'. Set console log level to '%s'.Command '%s'. Set log file log level to '%s'.Command '%s'. Set syslog log level to '%s'.Command '%s' lead to an unexpected state.%dLOOP_OUTPUTSTATE_OUTPUTMEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTTRUECommand '%s'. Enable %s.Command '%s'. Disable %s.Command '%s' is unknown, ignoring.Unable to delete the command file, %s: %sJVM Restarts disabled. Shutting down.Waiting %d seconds before launching another JVM.JVM was only running for %d seconds leading to a failed restart count of %d.There were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.Waiting %d seconds before launching the first JVM.wrapper.on_exit.%drestartshutdownwrapper.on_exit.defaulton_exit trigger matched. Restarting the JVM. (Exit code: %d)Reloading Wrapper configuration...Launching a JVM...Unable to start a JVMJVM exited while loading the application.Start Application.startUnable to send the start command to the JVM.JVM exited while starting the application.Startup failed: Timed out waiting for signal from JVM.JVM exited unexpectedly.JVM appears hung: Timed out waiting for signal from JVM. Temp: Sending a ping packet.pingJVM Ping Failed. Temp: Sent a ping packet.JVM exited unexpectedly while stopping the application.Shutdown failed: Timed out waiting for signal from JVM.JVM exited normally.Shutdown failed: Timed out waiting for the JVM to terminate.JVM exited on its own while waiting to kill the application.%s Last system time tick overflow at: %s Next system time tick overflow at: %s Last tick overflow at: %s Next tick overflow at: %sEvent loop started.no Loop: %ssleep Loop: maintain logger Loop: process jvm outputPause reading child output to share cycles. Loop: process socketPause reading socket data to share cycles. Loop: maintain logger(2)Wrapper Process has not received any CPU time for %d seconds. Extending timeouts.truefalse Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%s Loop: exit requestedJVM shut down unexpectedly.Sending stop signal to JVM Loop: handle wrapper state: %sUnknown wState=%d Loop: handle jvm state: %sUnknown jState=%dEvent loop stopped.|       $ < w%d Dumping JVM state.Could not dump JVM state: %sSIGALRMSIGINTSIGQUITSIGCHLDSIGTERMUNKNOWNkill, sigsend or raisesigqueuetimer expiredmesq state changedAIO completedunknown 0(Signal trapped. No details available.Signal trapped. Details: signal number=%d (%s), source="%s" signal err=%d, "%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s)%s trapped, but signals for timer thread are ignored.%s trapped, but ignored.%s trapped. Forcing immediate shutdown.%s trapped. Shutting down.Timer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.INTTimer thread received an Quit signal. Ignoring.Received SIGCHLD, calling wait().wait() returned, child process should be gone.TERMUnable to register signal handler for signal %d. %sTimer thread started.The timer fell behind the system clock by %ldms.The system clock fell behind the timer by %ldms. Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ldLaunching Timer thread.Unable to create a timer thread: %d, %s Sleep: nanosleep %dms Sleep: awakeCommand[%d] : %sCould not init pipe: %sCould not spawn JVM process: %sUnable to set JVM's stdout: %sUnable to set JVM's stderr: %sUnable to start JVM: %s (%d)Failed to set jvm output handle to non blocking mode: %s (%d)Failed to set jvm output handle to close on JVM exit: %s (%d)Unable to write the Java PID file: %sUnable to write the Java ID file: %sCall to getrusage failed for Wrapper process: %sCall to getrusage failed for Java process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldJVM process is gone.WIFEXITED indicates that the JVM exited abnormally.Failed to read console output from the JVM: %s (%d)JVM did not exit on request. Attempt to terminate process failed: %sJVM did not exit on request, terminatedWrapper (Version %s) http://wrapper.tanukisoftware.org Usage: %s [configuration properties] [...] is the application configuration file. [configuration properties] are configuration name-value pairs which override values in wrapper.conf. For example: wrapper.debug=true Options: --help Spawning intermediate process...Could not spawn daemon process: %ssetsid() failed: %s/dev/nullSpawning daemon process...Unable to get the path-%sUnable to extract path from: %sUnable to set working dir to %s : %s--helpERROR: Could not write anchor file %s: %sERROR: Could not write pid file %s: %sWARNING: Could not write lock file %s: %srt#include%s=%sUnable to set environment variable: %s set.default.set.The following property name value pair is too large. Need to increase the internal buffer size: %struefalse name:%s value:%sADVICEFATAL ERROR WARN STATUSINFO DEBUG NONE WARNING - Encountered an unknown thread %ld in getThreadId(). NONESIZEWRAPPERJVMSIZE_OR_WRAPPERSIZE_OR_JVMDATEFATALERRORWARNINFODEBUGwrapper wrapperpjvm %-4d%ssignal main srvmaintimer unknown%04d/%02d/%02d %02d:%02d:%02d | HHHHHHHHHHHHHHHHHlJKKKKKKK4JpKKKIKKK$KYYYYMMDD-YYYYMMDD_YYYYMMDD.YYYYMMDDROLLNUM-ROLLNUM_ROLLNUM.ROLLNUM.%s%s %04d%02d%02dawrapper.logUnable to open logfile %s: %s $RR R RRQ%dUnable to delete old log file: %s (%s) Unable to rename log file %s to %s. File is in use by another application. Unable to rename log file %s to %s. (%s) Unable to get the current logfile size with ftell: %s Unable to get the current logfile size with stat: %s ????????]] :|ung`v  h](  BRbrҏ"2BRbrҐ"2BRbr‘ґ"2BRbr’Ғ"2BRbr“ғ"2BGCC: (GNU) c 2.95.4 20020320 [FreeBSD]GCC: (GNU) c 2.95.4 20020320 [FreeBSD]GCC: (GNU) c 2.95.4 20020320 [FreeBSD]GCC: (GNU) c 2.95.4 20020320 [FreeBSD]GCC: (GNU) c 2.95.4 20020320 [FreeBSD]GCC: (GNU) c 2.95.4 20020320 [FreeBSD]GCC: (GNU) c 2.95.4 20020320 [FreeBSD]GCC: (GNU) c 2.95.4 20020320 [FreeBSD]GCC: (GNU) c 2.95.4 20020320 [FreeBSD]01.0101.0101.0101.0101.0101.0101.0101.0101.01.symtab.strtab.shstrtab.interp.note.ABI-tag.hash.dynsym.dynstr.rel.bss.rel.plt.init.text.fini.rodata.data.eh_frame.dynamic.ctors.dtors.got.comment.note#1((7 ? G  P   Y   T,, _LLeh]hk]G s@@%y%%&&&PK  (  (h)<*.= F( , L h] ] @   Д D -H 9Д Ob$ m(w, P L  8] 8] `]   X @`     .  =l D * O > X  g`s@ ĵ (<L*h D@  L ,^ LC M &# 0L D  Q\?Y l z j l1 S G     |0 0 BQ]<56 n> ص . lr  @5  ` 3:̏?! U m {Q    7 ܏8|Q& @   L"g +ȵ 8<<F GhD  Z h,U  d=  xFR "6 ,YQ  <&L` H: p \u 4@G  J]P j,n lUz ^ $,J | G Wa r lR r 4X K # X n 0|b \  O ̐q:> K! n ܐsh '.PV I  ]e ;o5 ~[ T ?B PX@b *r    , F   <c# D 6 \N J d Y q u L{ dG% | Xn \5 F" l @" @  L    |m" <* '/ \;N > ܤ@ M 8 j pq ?v  < ̑Y p,T p ܑ: D@ Z     Tt / 6 @ K D1 _ N q ԝ  *b @   ,`  < LN ( Q  J , \6 ;R I ` W lV^ е m |z     &*  ̒L t T ܒ J Ե 4r    C  -  < G" U *\ l x  G   x ,%   ,Y X6 <} #ܵ 5h2 G) fh] lF> ye   LY\  \dT @+  X+ h6 ̵  4PG JC Y o$ G" xD HH * lD% |n+ %*7  6>! VdS l ~XF P  E  lO D  : < -DD" >t5l PgU . eBJ x(5& Lw Q  G% '  t 8F #|M .<: A R9 b̓iX ܓH<r  Q  F   <  F  2% @40  Q_[ pK x4 p ,5 4D  <\^ crtstuff.cgcc2_compiled.p.3__DTOR_LIST__completed.4__do_global_dtors_aux__EH_FRAME_BEGIN__fini_dummyobject.11frame_dummyinit_dummyforce_to_data__CTOR_LIST____do_global_ctors_aux__CTOR_END____DTOR_END____FRAME_END__wrapper.cunknownBuffer.27seeded.73wrapperinfo.cwrappereventloop.cwrapper_unix.cjvmPidproperty.clogger.cwrapperExecutewrapperDatagetLogfileRollModeForNameconsoleFlushqueueMessagesstrcpyasctimelastLogfileActivitydescSignalwrapperRestartProcesskeyCharswrapperProtocolClosesetLogfilePathjStateLaunchdaemonizewrapperLogSignalledwritePidFilewaitpidwrapperStopProcesswStateStartedwrapperBuildJavaCommandprotocolStopServerprintfwrapperGetSystemTickssigActionCommonsetSyslogLevelIntwStateStoppedcurrentLoginfoLevelwrapperRunServicerecvlogFileLastNowDatechildOutputBufferpthread_createsigemptysetcreatePropertiesreplaceStringLongWithShortstrerrorthreadMessageBufferSizewrapperBuildUnixDaemonInfo_DYNAMICjStateKillinglogRegisterThreadwrapperLoadConfigurationPropertieswrapperBuildJavaCommandArrayInnergetenvceilwrapperKillProcessNowwrapperStartedSignalledjStateStoppedsendLoginfoMessageappExitwrapperJVMProcessExitedworkLogFileNameprotocolOpen__inet_addrgetLastErrorTextdisposeLogginggetpidwrapperSetJavaStatefgetswrapperKillProcessqueueWrappeddumpPropertiessetLogfileLevelIntconsoleFormatlimitLogFileCountHandleFilememcpypropertieswStateStoppinglogTimerStatscloseLogfileglobtrimdup2getLastErrorcurrentLogfileLevelmallocremovegetLowLogLeveljvmOutvsnprintfchildOutputBufferSizesetConsoleLogLevelIntcurrentLogFileNamewrapperSleepevaluateEnvironmentVariablessocketinitializeTimertimerRunnercreateInnerPropertyfflushwrapperBuildKeygetSyslogLevelIntlimitLogFileCountrealpathputenvpacketBufferrollLogswrapperKeyRegisteredprotocolSendBufferSizewrapperUsagewrapperLogChildOutputensureSpaceInChildOutputBuffersendwrapperPingRespondedprotocolSendBuffer_initstrtollogFileMaxSizepipegetStringPropertyforceFlushwrapperGetWStateacceptlogFilePathjStateDownrenamewrapperRequestDumpJVMStatewrapperGetLastErrorstrrchrnanosleepremovePropertylog_printf_queueInnerlogfileActivityCountanchorPollinitLoggingenvirongetThreadIdfprintfwrapperSetWorkingDirwrapperReportStatuskillsetLogfileAutoClosebindgetLogfileRollModewrapperDumpCPUUsagewrapperVersion__deregister_frame_infoendchdirsetConsoleLogLeveltimerTicksupdateStringValuewaitgetLogfileActivityumaskstrcmpIgnoreCase__prognamewrapperGetProcessStatus_startwrapperReadChildOutputstrstr__errorrandgetIntPropertysendPropertieswrapperStartPendingSignalledsignalreadwrapperRunConsolejStateStoppingopenlogdisposeInnerPropertyjStateLaunchedcloselogsetLogfileMaxFileSizegetOutputFilterActionForNamelogFileRollModejStateStartedloadConfigurationunlinkgetrusagestrcasecmploadPropertiesInnergetSignalCodeDescwrapperProtocolFunctionwrapperGetJStategetInnerPropertywrapperStopPendingSignalledlogFileMaxLogFilesmemcmplisten__sFfork__inet_ntoaqueueLevelssendEventlogMessagegetSignalNamesigactiongetBooleanPropertylogfileFormatstrdupqueueReadIndexgettimeofdayfopen__bss_startlocaltimememsetmaingetsidftellpipeInitializedwrapperDumpMemorysrandsigActionChildDeaththreadMessageBufferregisterSigActionfclosetimejStateLaunchingjStateStartingsetSyslogEventSourceNamesyslogwrapperFreeJavaCommandArraylog_printfMutexsetConsoleFlushstrcmpwrapperClasspathSeparatorpthread_mutex_unlockwrapperStripQuotescheckAndRollLogswrapperAddDefaultPropertiesgetpwuidcommandPollthreadPrintBufferwrapperGetTickAgedisplayLaunchingTimeoutMessage_finiflushLogfilesigActionAlarmlogLevelNamessprintfmaintainLoggerwrapperUpdateJavaStateTimeoutatexitsdsigActionInterruptlogFileUmaskinsertInnerPropertysetEnvqueueWriteIndexwrapperProtocolReadgetConsoleLogLevelIntwStateStartingthreadPrintBufferSizeprotocolStartServerthreadIdssetConsoleLogFormatgetLogfileLevelIntbuildPrintBufferwrapperTickExpiredpthread_selfsetLogfileLevelglobfreesigActionTerminationloginfoSourceNamestataddPropertypipedeswrapperRestartRequestedwrapperGetCurrentTimewrapperAddToTicksreleaseLoggingMutexssd_edatasetLogfileMaxFileSizeInt_GLOBAL_OFFSET_TABLE__endsigActionQuitsetLogfileRollModecheckPropertyEqualpthread_mutex_lockwrapperStopRequestedsetLogfileFormatdisposePropertiesexitwrapperGetTicksgetLogLevelForNamequeueSourceIdsloadPropertiesgenerateLogFileNameregisterSyslogMessageFilesetSyslogLevelatoicurrentConsoleLevelwriteStateFilewrapperSetWrapperStatelockLoggingMutexlog_printfisQuotablePropertyautoCloseLogfileaddPropertyPairstrlenwrapperBuildJavaCommandArrayopenlinearizePropertieslogfileFPunregisterSyslogMessageFilewrapperProtocolGetCodeNamewrapperInitializeLoggingstrchrexecvpwrapperGetPIDsetsidsetLogfileMaxLogFilessetWorkingDirsetInnerPropertytimerThreadIdlog_printf_queuewrapperStoppedSignalledwrapperEventLoopfcntl__register_frame_infoclosewrapperInitializesetLogfileUmaskfreewrapperSetWorkingDirPropmule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/wrapper-linux-ia-640000755000175000017500000055764010567556635030316 0ustar charlescharlesELF2)@@@8@"@@@@@@@@@wwww`w`1xx`x`@@ Qtdp8h8h@8h@/lib/ld-linux-ia64.so.2GNUCXQ= :!H;+D6<2CKLMV-8IW'U5 @O4) "0T(9RJ&.7P  %*$1 /#,3FEBG>ASN?v@p4 0k   M@wsTpgE0B ; 0 0n@`  l@ `@@e@Y @m@ P+p-p~ R 0  0 a+0 `{ MfOP.@  $; p}Z@4! libm.so.6.1_Jv_RegisterClasses__gmon_start__ceillibpthread.so.0waitpidrecvpthread_equalsendacceptnanosleepreadpthread_sigmaskforksigactionpthread_mutex_unlockpthread_selfpthread_createpthread_mutex_lock__errno_locationfcntllibc.so.6.1putcharstrcpyasctimestdoutsigemptysetstrerrorgetenv__strtol_internalgetpidfgetsmemcpyglobputsdup2mallocremovevsnprintfsocketfflushputenvsigaddsetpiperenamestrrchrfprintfkillbindinet_addrchdirumaskstrstrsignalopenlogcloselogunlinkgetrusagestrcasecmpfopen__strdupfclosememcmplistengettimeofdaylocaltimememsetgetsidftellsrandinet_ntoasyslogstrcmpgetpwuidsprintfglobfree__xstatexit__libc_start_mainstrlenstrchrexecvpsetsidrealpathGLIBC_2.2GLIBC_2.3 ii 0ii ii 5ii z`';z`GQz`GW`````Ѝ```` ` ` 0` @` P```p``````Ў````` `0`@`P```p` `!`"`#`$`%Џ`&`'`(`)`* `+0`,@`-P`.``/p`0`1`2`3`4`5А`6`7`8`9`: `<0`=@`>P`?``@p`A`B`C`D`E`FБ`G`H`I`J`K `L0`M@`NP`O``Pp`R`S`T`U`V`W 0B `?# `@!U  !H A80(``x$Hx$Hx$Hx $Hx$Hx$Hx$pHx$`Hx $PHx$$@Hx($0Hx,$ Hx0$Hx4$Hx8$Hx<$Hx@$HxD$HxH$HxL$HxP$HxT$HxX$pHx\$`Hx`$PHxd$@Hxh$0Hxl$ Hxp$Hxt$Hxx$Hx|$Hx$Hx$Hx$Hx$Hx$Hx$Hx$pHx$`Hx$PHx$@Hx$0Hx$ Hx$Hx$Hx$Hx$Hx$Hx$Hx$Hx$Hx$Hx$Hx$pHx$`Hx$PHx$@Hx$0Hx$ Hx$Hx$Hx$Hx$Hx$Hx$Hx$Hx $Hx$Hx$Hx$pHx$`Hx $PHx$$@Hx($0Hx,$ Hx0$Hx4$Hx8$Hx<$Hx@$HxD$HxH$HxL$HxP$H x%$AU @$ @<U `$ @:U $ @8U ؠ$ @6U $ @4U $ @2U $ @0U $ @.U @$ @,U `$ @*U $ @(U $ @&U $ @$U $ @"U $ @ U X $ @U P@$ @U A' BhXD!B U A' BXD!B U -  dH (!` 0  ! @ ~F05@B H !0 @ U@$H! X !, (C !@ DspB !H  P9t<089x:s@C!0CO p@ # D0 (!0aQB@ M # x`$`B@$BHPxDBHH$`B@8' HHRXPB0  U @E`?#B P $ HX8;B@@X$ H`D @ #P!XH;C a2$ xD=B ch b0¥Day!I=pCOa P0B$aX@!BH@!@@!0# 0 (HX JB E0H<)`0XPv H XA!HXh;BPC@!Px9B% C D NB $ JD`O *PcH!hP!B@ X$dH B!|0 @zByBh:p x6PR!HP X!@R!HXR!XR!(XXDBD[ PBJ # @Up 0BDB0B@ P$0#a0 (X JB E0H<)`0XPv H XA!HXh;JhDH@ X $µB `^ cj5W!(PR! xD @>BE| # `CPF HX8;BJP h! HP'*H` `FPR!XB(XR! @Up 0BhP h! HP'*H `XPBHP h! HP'*H@ `PR!XR!HX H0'PR!0 @X$ B@ 3!eB`4` p.PR!P X!@R!XR!XR!XXDBD[ (V!0 #HpH p$P' H`hPBHHIf Q P! rHX C9@ T!CA0DaD s0LP!X @ B P0@`H !0 Pph`B0`H 0 C`H!X @0# P (0$pdH  ,! #@C N ANB $@L `CF * +rFP8B<ChF  Yx!X T! G@4 CX T!@d _ HU`FB`(XhFB `J,8X T! G@4 HPJ0@D9BHX!*0 `@!O$@HbP0 PB ,!P0 *Q0 @8B<`JH `2$` x !<0  P !( $CXT! 2sCFaOPHN0O 0`\.sx!HXT! XT! 2sCFaOH(X`H!BX FBH`B!0OX!r P `@!OBHىb0 HPBH'H P!Bh' H@x4PT!XBH!dH  0A$pB`@!`0 ($0 0   ! `8@C(@!@BHXB UXP (@!  !X U )  dH @a$0b `O @PH xD @>B`{ ppPCpB @` PB0  UXPxDB HB!H ! 0 0PB0  U!dH 0$0B @O 0L0  ! =B ppC0  cC(PF!0 @ !PrH ARp$ 8N!PB UPF!0 @!0  `JxP0!B(9$pOxP U(-PdH `2$`B*! XB0O (X8!B @!@0#XDB5 8!`LB`) # 8P@$pB P'BP@DBDHPB HD@0#! %B`@K x!%B MD0# $< #  PL! 0 B BnP09B @$@  8$P8N!uP8 $BwPB 80wPL!p HXxPL!pB}PB 8.x~PL!p H~PL!pBhPL!pBHxP@!B@ (U b@(nPB U % PB``B xXJ! B@ 0@!pzHX r (pr@0@!X 09 B (D! @0B!X!B0!pBXXD B J!0 B U `H!$ Bp!00  XB U @B@PB X!BxXH!PRHXXB (.XH!`B (,X0@!B(*XB((XH!`B`(&X0B!B@($X0@!B ("xX0B!B( XXH!PRHHXB (XB (XB` (XB@ (XH!PRHXB  (xXH!`B (xXH!PRHhXB` ((XB@ (XB (JXH!PRHX U0-@AB 8!Pb@B!~F `$OpAx(x0 Ph9C a2$B @p|B  `>!\0+p6P0 h2\0#( 0U a2$<B`  h@1 ~F  @0 (!APB@$($ 0 (X !pC,0 HL0#<"PH@BXN!BP 0U@AB(XN!`0 `@ @!@X@!BX D 8HB @ATBHRP0 XN!0 @O`r @!@q< ( # & O0H`2$ H"!$0 F   @!BXN!0 @ !@PXX@!BX D 8@FB@@B@0 XN!0 @O`r @!@q< ( # &H% dH !@ B AB ppB ! O`B ! @49p:st4p9`@:sCV8!pC`C x !!< ,CH&D #  U P@*B @@$J @$0'p H@PPB U $0'p H@ P H!0 @ !ABH&D #HP H !b40O (JhP!BX U01@dH P$pB`  % PT@ @H0!B@ؠPN!0 C! p8 cCC!0, D!D0  x  <0 H!, ((090BX@ 9`C H!B 0 `J( 0U C!0P0  M"@ p$:su4@J $O 5P,xP H$ 8@!XN! ( 0U $HP*P@!BxXBH dH !bp!PJH 8[P($B@0!@BHXF!@BX U!0B  !4P !Bt0'pO ȐP F! @`B<P09B X@,B H$sb ȅj) b0 ń B!RH]1LXPF!0 @ !0  spB !D  ` yc Ȇ)dc0 Ƅ !'1L؜PF! xPF!XF!XXBPH 0LhPF!00  aMB H  U!dH !  ($XPF!pO($`OP@BPp!B  09@O4 0$8B 0L!HPF!0 @ !`%B $pBX$< ($(s 0ń  BO]1LPF! XPF!XF!8XBPH  0"HPF!0   `AB < 8B @B@PB XH! BG!p cC H, ! @ P:C `L,P@ ! &!@#  HBxH0J@X @0@BJL,`P x$B s ! Df$!pKL, )$a2 LBdP! HDQ(B a8@(J0H(! B0!`rC!cPCF!0 p8B@p,`C BJpBXL!   (UXL!0#1 1 B`JH(5dH 0!@b!C @F0`!B `s(Qd)Ag $(QTB ȄX9@!B H 0 hPL!0 `-BLX0P0 ȭ~F@}SP 5@CL@ "D@`x` @$ @' EPPL! 8@!B @$OPL!XFB 8@80C  (UXB@ (Ua2$ H @' H`0 F` B`@H H @ $80 PBHFO ,TsIdsIRK HB!@$PL!(XFB 8@8JH $ @' UP0PBHF H@ 8@!O U8!l0 h28PHxFH8'*HC{ HRt #PpHxFAH8'*HC{|0 x:HxF H8'*HC{0 x:pH Xa$pOEHVXPH`FOd 8PsIsIRpK HB!@$ؐPL!XFB 8@8PJ`H(!3~Ff 0$BdH  p@ dH @3p`C8FHXL!`@1 0$ D 0, D B@2%!XxF , 0 @0 Xt!0  H`HxEP 0 c 4HPC@H B 1 0 PC@P! h$0 @H ZDP t!1PC|B(=\0r@9< 0C@P!  B n@B hRs-!J*PC H `br@YD02$@BP ! p/9 BP"C !ȸX t!@@J!XH BI(Xt!@0#@@J!!hX t!(25@CC~F X@XPP*hp C`1$@1$@ $B(,!P0 &T (Xt! 0 C 0C0 P C0 Cn0 BP CF!  C0 p Cn0 B` &0Bh ! F! d Cxn0 B z 4!d @` sp B CF!  C0 Cn0 B t0B ! F! n@TB (\ 0B ! F! neB 0@0B0 ! F!  @C0 C@ CHB9`.s 2$` BE$ A$0 BabBX0 A!B>P  B  "r`C QVs0B C0L! `JB࿃ U 3B!B(X`H 2$` ȐHB &!@H, )$ BHXt!b$@@ F!H R V(XBpH , )$ BتXt!$@@ F!H ^ bXBHa2$s @$B s H]9!0 GB< 0H `a8>P (! A!B ~XB C D!p,(H!:$@@YXt! BX@0#@@CH!HXp/9B J!BCH8XB JH!` BxXBHx$H@ Y `Ps]\0 %IE$` B:P!B aBXt! BxX@0# !BتXt!B  ȐHB!HY$,(Xt!0 I !yB  H@ B:|0 n!XB JH, 0B9kH`Xq@ Xtn !@0# !0 @0 `qA$ 6 z8XB @JH0 `Y B9:BI(Xt! BX J msn@Is`2H@0 J80 Kz:BhXB`H0$,e F!`BILhXt! BX XŒ@)d0 @@0  LzȧXB JHp, e$0 BtIXXt!@0# P0  B ,(XxnB@ Ȑ Ȱ!d  4!J !@<@, CF! nyIF pb0% PJB9,@ 8XrnŠ@ DQfffffw0cr`2$±$!zCHr0 !  , PR P, &WR @Xt! 0 B`H,0E@ 8X n  L B $BB8 XB@H, u$0 B@IX PnB@`*B $ D 0 XB JH,W@ 8X n  j B $"Bl XBH B9@YF!X pnB %I]!Xt! BX R nP Bށ Ȑ $ B @0  $0 }!XXB JH$0,UH!PHXP!$@ rd HX(@ 0bH !1Bb Qp + X F!,BX p $ BaBX0 A!B2P!B@D!(!XB@ 2r BF!SHX9 CF!3HZ!BhX pZ  0!T`1$8>rpX8! C` ! ^1I$@"XBBp B1x!*9@hpC(J! 0 J!0*DhX@0# D! BhXD!BXXJ 8T1 B@PtV t 3H < ^P0 , @@YJ@ (Xt!00 P2MHJBXt! pJ Ty䘁$"rȑr*JRax8++zdx8+< pJ @ H` 8h0;@ hg?#@ (`]bf՞ Byf~0 (R +J J0HF!HX9BJȐF B LPz9Rs@u ! C $A!HX`9BBhX @  ^s6@t !YP!B$B $:( t! D38 !XXt! pJ@180!P+9hhpC(J!0 J!p+lhX@0# X! BXX!BؠXJ T1B@P9wbP -w <H@x8"0 yR BhXBH[HY $BH@P!@ Xt!hH` T H@0 $ЃHH  +  + !+ "+@!+  JH Ra!.P9B J D!0YhJ9Xt! B P@ ,X!B  !BXt!BȡXt! BXX@0# P BJ@ BXH0, e$0 B@5IؘX n  T B $ @Bz XBHA $@*sxhX(!B J !0B H,) $!0@@ @Q `y; LB|6X@ QVsKH,`( EJ @ @Q Zv|6X FJ  `(Pl9JH`, B9H`Y@ X(!З hQH@ ]d0 $zXBH, B9;H`i@ X!w fQCH@d0 $z(XBPH , B9H`8I@ X! NH@y0 (zXB0HP, B9H``U@ Xh!w XCH@KU0  (]z(XBH,8m@ XB% NQȄ@*d0  (!HzXB`H `a8H)P 0! A!B (2XB PC(D!@,`0iJ!"$@`8iYXt! BX@0#@ CJ!HX9B L!BCH8ȕXB JJ!`"$@Xt!0 AH >xXt!0 x0 ;BH ؀2$Ѓ0BlB 4'P9B J D!@YL9Xt! B P@ ,X!B (!BXt!BȚXt! BXX@0# ` B PJ@ B:XpH $YF!X t!s@I@0 (!@0# qHPffffft0c!9B 8X0 (hR`hYzX1_R@ SR}h XXBH $O$0B.8jPZ!BȖXH`1$B (!B(0!\0 JQX H!P,ȘX t!A0@ HX!B !@0# ՃHz CH!XX t! 65PC 9?#l h( )a d <z0C @ H <t0 XBH`1$@HH!B$!<0 "Q(XHH!X ! F!(X?#B D!BXt!BX D B@4H $OA!B8gPBPH$,E $BXt!pz$@WaŪH ( NB@8RXta0! a8B ĐrPax8#>a@#  $ BadBX0 A!BP8!B@D!!XB@ vrBb!@1H!#9xhpC H!00 H!#|h،X@0# f! B8Xf!B(XJ 8\1BppZ p `x8#2 ZGcBXt! J J9(!XXB @@ r B8 0z$@180! 9hpC H!0 H!X@0# V! BXV!BXXL 4J h\1IJ! IyPbH @`=`9R`8 8@0 #@8XXt! x\x$qraXx8+yx8+ 0J @ `@ xbP{@ k?#` (Q jU BjQ0 pX H\\ JH()dH 0!@b ! HF'BO # xXp , 0 BtHHX@0# 08!B(XFBE 8'BH@ xPF!  HRpB X,CaP"H 0pO ,H,aP"H 0pO ,H*aP"H 0pO ,H(XaP @$B0AHH&(aPL!   (U DcJ `D@cJ  p$%`P"H 0pO ,H,h`P"H 0pO ,H*8`P"H 0pO ,H(`P"H 0pO`,H&_PBH 0  ! bp`8C@B 9PB`CX(!B(X @B@0B!XH!  UHX@BpH @B0 $B bC0LXH9B @$PC H 0XX9B @$PC0H 0xX h9B @ $` 0 aH!HX H!@8q U % dH` 2$pHB  U 8N0  B @ B 8!0DP @! ( @`0 H  $0 8" BP 0! (8$X @B0  U H !b(ȇX @!B pl$p PCPH (JX F! @ 8B U1 `c@8A $@B@!yI0$0C8NB !Pм$y0C Ux[PH!yI UH=0|F Ȑ P!0H@  `0 XNP ! PX!H$PT!0 ` $BH`X0 PX!BP89B@H@/CX@!`dH%PT!0 ,@H`*P0 HPX!B%PT!0  $ H`&H0 PX!B8&PT!0   $H`"@0 PX!BX&PB XNH`PX!B)P pL PXN H` 08B `hP h1B $B@CX0 XN(PT! hL@ #@ Ȑ0dH`i  (Vp cXB*PB XN 0  $0 hB@KXPX!B*PT!0  $Hh>0 PX!B+PB XNH`<PX!B(+PT!0   $H`:p0 PX!BH+PT!0 ` $H`6h0 XPX!B+PT!0 Ƞ $H`2`0 P0 P B0`.PX!Bx+PT!h*P p1 P!8'PXF0 P h!`B@4 \!$ #`P00 P @0 @  $ B`XP B0 P x@! <  ~FHX4'C x@ $XF:J`P J0 P A!@ ?~FX"4(C @!T x8)C L 4XNB`0XPT!0 HA:B@s x x0Ch <*C $0 XNI 0bzB `>PT!0 Fa>B w~Fq#CH2$0@H} h$$B` X8P @B@ Ȑ `!0  @!D C~FhV4@#C p0!@HpP0 8P(CL0  !'!8PT! 0 H@JB $#BX$%PT! HP0 PXN 4 `2$0H `Ft0 6! PX!B@ Ȑ4!P0 P B0   $bBB`2( PT!0 @ABB0PX p.9TO8C @ $XD J`$ PB @D XF0 @ pD H D[8J<0  P T!@DpF0 H  H0 A]!H #`0  P 0 P @0  $@ B` P0 P H0 ` $P~B`Xh P0 P J0  $wB`<( P0 P @0 $"oB`8 P0 P B0  $@BgB`4 P0 P H0 @$PbcB` h P`0 P J0 `$[B`. P@0 P @0 $PB`* P 0 P B0 $@"HB`& P0 P H0 x$PEB`h P J PXDB` 8`PPFB @XD B 8")B `XP @0 PhB!0  %B` 8 !  `paP H0 PXZ!Hk h$  `XaxV0 P J0 T!0 uB 8 ;!x  `8a3<P0 P B0 ؀$"jB`6P0 P @0 Ƞ$@@B`2Pp0 P H0 $P\B`0xPP0 P J0 $TB`,8P00 P B0 U$LB`(P0 P @0  $@=B`$P0 P H0 @$ "-B`"xPT!0  D8P(BX XT!0  J8$BX\ XT!00  BH`@ 0 X@ # P`F@<@BX HXT!0  H@DjHXV XT!0 D|B p@`8chac`0 8@@C8Hx<0C pL8B`q x x0C V*BxpC xL@<BBy (`(C p*8c8C xLp<B y .0Cd `C xL=By 4`(`Cp Ѐla@B $OEh: ( T! L <XN*H`BP 0 P @0 `$@ B`XPT!0 HCB ><PC2$H`h!Bx$!D0 XP FB` Ȑ p!P80  PK!( p c CL, !!@$@ 0`!]@X,rXT!0 PABB^ X*0P V   DJxrXT!0 =!{B:p0 8rXT!0 oB h0# L! B>0 C!H`a0 h@!XnX0B PXNBhPP 9BC @L #B p B0 C!H`a0 h@!mX0B PXNBPP 9JLPB@A @BB ppXh1PCXQ (kX H00 P'! OB x$ xXXE jXT!00 D B ppCJ!@, < XA!0  PBlX0 `A!BP!00 P B@xrXX!BjX @0 PB : q@X6HlXB`aB@ <`4kX0 P0B h PX!BXLB X3!p`0 .   , V pU `J hLdH < HZ!B``9X0CXNP @B@ X2$B` XT!@0 0APB X&XXT! 0 x$!< pD 0CHXB`<8P T!0 @XA:!XXT!0 pB X6XT!0 4! @CHXB`P T!0 @X!XT!0 )B XXB XBBH`\P T!0 @XZ!(XT!0 B%B XXxX (@ PXB*H<`@BPX1BPB x$0 U`PT!y8HA0@8B $0 U`$HP T!@8H@B XBHU`B|( T! xL@ # !0P pL C$pdH| XN*H.!`0 PH1BPB $0 U` hPT!y8H`A(8B $0 U`F(P T!@0H@B $0 U`4{( T! 0 @ @0 %@vB `<PT!0  H0 nB@nBh4p0 HPT!0  B0  H gB` ` PT!`0  @0 p H P"[B`.T PT!00  J0 @ H@  BOB`(H XPT!0  D0 @ H` 0bGB`, PT!0  F0 *B @@+Bh80 P H0 P XN H m B`\$ xPT!0  B0 0B @PƒBh0 (PT!0  J0  $~B`x PX!BP L PXNB @ sB `:8PT!@ # XT!0 BNHU 0B `$ĂXDB`<P0 P J0 @@ $PAB`$PB @D XF0 @ pD H D[8J<0 xP T!@DpF0 H  H0 A]!H #`0 P 0 P @0  $@ B`xP0 P H0 ` $P~B`X8P0 P J0  $wB`<P0 P @0 $"oB`8P0 P B0  $@BgB`4xP0 P H0 @$PbcB` 8P`0 P J0 `$[B`.XP@0 P @0 $PB`*P 0 P B0 $@"HB`&P0 P H0 x$PEB`8P J PXDB` 8`hPPFB @XD B 8")B `(P @0 PhB!0  %B` 8 !  `paP H0 PXZ!Hk h$  `XaxV0 hP J0 T!0 uB 8 ;!x  `8a3<P0 P B0 ؀$"jB`6hP0 P @0 Ƞ$@@B`2Pp0 P H0 $P\B`0HPP0 P J0 $TB`,P00 P B0 U$LB`(P0 P @0  $@=B`$P0 P H0 @$ "-B`"HPT!0  D8P(BX XT!0  J8$BX\ XT!00  BH`@ 0 XX@ # P`F@<@BX XT!0  H@DjHXV XT!0 D|B p@`8chac`0 8@JX1PBHa$ H X'"Hȓ 0 1P xLB H2$0@H}@! 0 XP @B@ Ȑ `!0  @!D C~FhV4Jp1!PK@@X'"H\(0 :B*p% "( T!  $00 XNB`(PT! 0 H@JB $JP P1 PL0 hq`2O 4 `2$0H 0 h:0lBkq@:Bs<PX!B@ Ȑ4!hP0 P B0   $bBB`2xPT!0 @ABB0PX p.9TO8`J@Hp$@ H X'"H8,0 -P D PXF:J 4PB `P J0 P A!@ ?~FX"4J@!pK@X'"H&P0 :KB x.K -PBH %xPT!xPXF0 P h!`B@4 \!$ #`P00 P @0 @  $ B`P B0 P x@! <  ~FHX4PJH$x #`"H hF+PB`H$pA #`"H h&+PBpHp!pKDX'"H8 h,K H+PBHp!PK`DX'"H* hK"*PBHH@$B`XXX 9B@JP`$"H``$ Hh0 *PBH @$``$ HhH*PBH $OEh,*PB@H $OEh )PB`H$@ #``$Kh6)P L PXNI 40bzB `>P F0 P 0!@ w~FX84JH p$OUh\(P T!0 CBH0@"HXB`P T! 0 @Xa!XT!0  |B XDXBH"HXN`2P T!0 @X0!8XT!p0 @\B XHXB XBH`<P T!0 @XA:!XT!0 pB X6XT!0 4! @spJ@H"HXN`P T!0 @X!XT!0 +B XHXB XN`H`,XP @B@ X2$B` hXT!@0 0APB X&XT! 0 x$!< pD spJH@"HXN`HP T!`0 @X-!XT!0 PB X*XxLBH050dH 8! 0 `rBP 0# 8 a2$BPN!  FWX N!0 @  X` !, (cCP0 Y @FO` *!$@ & I@H"P`9C Dp`B .8J0 ` Ȑ@F 6!H2P` s 8HC HpB <ts @B"ā-A'$eHXP9B @!P xq@Т$H iA2H`pQT:K3~F !b`aUX D!a%\(1g!>`@1 @R >x"@`Dp8 l"@D d2 P`$@bS`BRPP @L( v@ $9! AR EZ)@ARx@ (@`x @ !xS@  U 0Bx@`㥛 dgp< pH1 p8"@@D0(, @ R@ R@ @ @@B0"@   X@@) dH  ! b ! 0 @ B KX09B@B9pA H $PO80C UXPH!BHxPH!B('`2H H8NPH!O U dH a$ BB HP 09 x!0 B0C H`HP 0C<B U(X D! B @!U% 3~F a2$@B@ `0  M!0`B pp`C H:sCh:s`CU 0B 8$('B8N(PH!`0 L! H:J(@!`›BIXh9BPB@'PB 0)$pOPH!Pp B P0B H0LXDXH!`H (!p0BdX PBwI  H`!p$ @DŽ H)A!1LcB$Ha1LCX(!B 0$p0BcXB{XH! U 0B x$POT8xP`zH PB` H8cXH!HQXBH (!T8!bXH! 0 $!D 8 0!~PH!@0 @(!`jH` @&U@PBHH~P8!B05$OHPHdH 0$0B @O 0L0   !`=By ppPC0 `sC UPF!0 @!<B $J@ X8!|P F!0 @ P`!P( P*BHPF!  U|P ! ('PBH% dH@ 8!$@BPO 8N0   ! `8C@!aB  hsB{P BY H!px1 HppH(PH!?Xh H!0!PH!  U(PxBBH% dH@ 8A$@BPO 8N0  !`=B ppC0  05$pO`pCP!a Hh&C UP(!0  8'O  @!0 `spJ@yP BY H!px1` HppHPH!=XhH!PB0!PB UPH!0 h0`=B!( h&sJH% dH !@  x@ @>B`z pp`C X:Cph: C U 8a$PO8NPH!0 ! X:sJ H`!$ X!hwPH!0 @(!`bH@Y( @P!HPH!0 "!@ И=sJ(!`H PH!@0 0(! L HsJ(!`H 8!BȓPH!  U (!T8!8ZXH!p0 .!PX H*1h!vPH!0 @(!`jH  2UPBPHuP8!B01$OPBB x 1{0JpHHuP8!B05$OHPPHPE3~F 0$B P1Bb(DXV! 0Jp p wpB`H 0 CGXV! 'C`HЂ0Bx!B6Xx;0B X`9>CC4 dHP 0! ap$Bh6X89BC @!@- x8`xPl`C,jq8Dx8#`HЂ0B p$B5X89Jha2$, Z!b@Qq<B0 ?!x `:yX! B P@$}S H0@$@  @`x`XOXV! #wH@! PU 1B`F!IXx!B h$$H 2$80  P V!8J@B \`Ds@!AXP0  V! @@9l6 , D d2 ``$@XJ@$PU 1B$0dH xF!OP0 &! PV! `J!@XP0  V! @@9l6 , D d2 ``$@XJ0H2$b~Fh !XZXBpHdH `!8XB@H([XB HHXBH X2$p)$B`!:XV! B(XBH 2$p)$B`@!:XV! BHXB`HXB@HxhXB H 2$p)$B`F!:XV! BWXBHcP V!@`"sJ`2$@#sK "!@0  X !, (C8@XV! BH `2$PXB *0ARB &<J $Op.T( V! ?XBpHP x! X`' HHp\8PBH0@9cX@APB`@9ȁs\AC`C0@.H @J.H @ .H @ʁ~F@.H@ H@$`}S @ @ 8@`x``.H @,@.H @.H @.H @ .H @" .H @$0,H @&@.H @(P.H @* 85 BHD!P BX/X0 B @B@ \PTh1X HF!@P!/X`r @H8!xnPP!HJ XA$H'"HXVPB` 8U `$B`P(3XHH!B0X0 @8U(50dH 0! 0 p!!@B  ! `8C 0  # <0C  (UX L!0 @H!,B8$ XB@ (U8NhX ! 08B!HX`!B XD!O 5.H PTP8B!0 L!@B`x # <rJH 1  dH 00PB``BH!XXB@ xD >Bz H!=B 8Cx$ #   U `2$0   LB@$` "!@0#0LHXH!B @DpH`@$0!B@P 0 hPJ!0 =B@{ x$)0#<H8=PdH @!`b@ 0  p!`=B z ppCBXP!0 @!b%B $0C0 8UHRX P!0 @@x!!ABH< HXB` 8UHRX ! @HB!hXp!B  hH!H@.H `XhPP!0 B@zXP!0 @!b%B $JH!0B H$  0($P F!dH`` 0!$ B(`0  P B @ B@ `(8,X @!B@P0H(J0C U+XH9BJ`2$0H ($HB 0 D0  X0!, (sJPP:H @O `0XPP:H @O` `0(PP:H @O@ `0PP:H @O `0NPP:H @O `0>PP:H @O `0<hPP:H @O `0:8PP:H @O`08P ($ 8@!@O``06PP:H @O@`04PP:H @O `02xPP:H @Od00HPP:H @Od0.PP:H @O d0,PP:H @O d0*PP:H @O `0(PP:H @O` `0&XPB U(-0dH H$`BpOEHR02H PD!0  !! BBB p8 Cx$pO5H&@ # <@C8@!OXB@ (UHP 8@! 0@'xX  0(UP @$ 0PB!pO` dHP"H 0pO@ dHP"H 0pO dHhP"H 0pO dH8P"H 0pO` `HPFB PD!pO5 p!!02HBH H&@ #<s0JPH! 3|F a2$@B@ 0  !0 `80CU 0B@!PB0X@9BJ xB ?B @@@,C P!P Ha0(%Xh9 B xB=B X X8B!PA2H 0 $D  8*`h:st$P<98:sC(P!CP 0! (!5XBB` &@J~F<@BPBXH! BPB ^B 0,(X@0# H!U 0B 8A$PO48NPxBB@H@A1|F a2$f   xF @=B pp@CW @Up 3B!B`X9BJ xF ?B @@C P! Ha`h"XH9BpB! xF2H X!0 XxX ! HX$ `CHcPHK9J$1C hH!``A$HX9B``5$!hXR!  &r` `) #8XR! r` ` #X B H rPC  B B`PPM( J$B`*hX 9 HXD! CpA2H `.(X9B BB9Bh)$ 0C!X  B H$O5pD!Bh0hP X! H`B!1XR! JXH!8XR!@0  BB XDX;BpBPFB@X'2HdAmBh8h0 PR! FB` uB `FX @Bூ @Up 3B$B`28X 9 HXD!pCA4H `4X 9 HXD!0C4H `8X 9 HXD!C4H `<xX9BpB$B`>HX 9B@B($B`JX89BB HB(yڂ4ȔE-uD!t~Fp`= B x !AB`A $`C@< #  cC P(sAdc4APB@!!pB0"HXJ!0 p#!@FB #!FB@ @<C(`` .!`XsT(CH<t HqapB"!`B @@!| 8XJ!0 !pB>B HB`H)@C 0NsAdcAP0C 8D BD U0 1Bа=sJ !`\ XJ $` @2$a88B @6 XJ!`0 $8H84d0 P 0B (@!p0BpH0XP09BpB@$0 8 $t0 `9B HP8D`0 J!࡙B@<x # D U0 1B !l 2$a(!pT0 @&XJ!`0 $8H8$D0 ؘP 0B (@!p0BpH PP9 piqDb4|APJ0!pHXJ! 8D BD U0 1B P$0'p2H@T8 P 8$BB8H @R P 8$ (0!X0H@0 !0BB8!$B # 0 ABÁ XJ!c@K XD@.B HH$Jx$B 8$<0 PB`H@#!pB06XDB @0'p H pjB@Pd 8PJ!0 FBH<t HqaJH"!0FB 0!pBHH &`H(-0dH 0! 0  !AB xh>~F 85p{PC0  0C  (UH !B8XP 0BK FAB P(c0!P0 ( L!C F NB $C 2$p0H`,!\0 H(8*P  B 0p B p@PXP 9B 8'*HCA8H H2P*H 0pO pH0hP@$BX L!0 a}B t #  (UB :H@XL!   (U Ha$pO5HRxPL!hX @9 009aHJX L!0 a}Bx:H(PL!00 '!H `DsJ0HЀ$pB@4xX` 9B 8'*HCA8H H8XP*H 0pO`pH6(P @$ 0pBH8F@= <PL!@0# HFXL!xGPBH@pHDPL!KPpB9pC PFB P P!$99aJ`JH@!pBP'@H !$@@!UPL!p! qJ8!HHXBH %  dH` (!pB`pC 8@!00  x! < C  UTP 8@!@H (p K D B @,J0LX@a (`B`K PDp:Ht H!$ 8N0  s@B(XB0  U(XJ!`B\PDO J!0  X"!@@% dH@ 8A$@B tPO 8N00   ! `8C (!D8X H 0 0$PO t8CBpB0-$O B "@cxA rB Y)bZHXB UPPB `"H t8(XH 0B 0$PO@J:H p 0 P(!BZPXBO H!  P!0< %  dH` (!pB`pC 8@!00  x! < C  UPP 8@!@H (p K D B @,J0LX ` 0 (0'p*H`K PD+B t@0  s`B@:Ht`B8N,0 (XB0  UP0!BXPDO J!0  $!@D ! `s a2$@B@ C xB0=B @,B@!`B(xX` 0BC XB/B HH<B`:H tPB0Lp0 XH!  UB`©@VB((`L HX H!@0@!X 0 0 (!`:HK Bp!cB@ t.ph0 @,y!XX 0 C xB ?B ((=C>B 0# U(!`B8MP H!a2$p K 0  ! sJH $`*H8$P(!BUPBO H!  "!0<  $PO482PPB `:H@ t84XX 0B`J`@ @$PO48PH!0 >BBPH `2$|B <AvB 84J p`$PO8PH!0 !P sJ H %  dH` (!pB`pC 8@!00  x! < C  UhJP 8@!@H (p K D B @,J0LxX ` 0 (0@!p*H`K PD8H W@0  s`Bp:H8NXJ!   UX$`O@P0!BHRPBH %  dH` (!pB`pC 8@!00  x! < C  UHP 8@!@H (p K D B @,J0LX ` 0 (0@!p*H`K PD:H W@0  s`Bp:H8NXJ!   UX$`O@P0!BhPPBH dH@ !`s@!P`C  B @,C U0@!FP H!@HH`2$p K @!0 0 x!P B @,J(JX ` 0 %VP U`I0B `?#B`p!3 gL@Մen\! P1c(!`B2BX8A!B @a!3BXPF@1@B@gHC! 0x)X BX Z!@ 0($D0@ 0(  H @ 0( J@ 0( 8LC 0( NB 0( P 0 |R8X pA! hx!XZ!0BX@!B5 p'At@x :!s~F< 6XP Z!@ Fp1 81! p1dx)tBX Z!`A 0(XDPA 0( TH@A 0( PJ0A 0( LL A 0( HNA 0( DP 0 @RX pA! hx!XZ!0BXXx@!B x $@<@ x !/~F` PB Ȑ @!0 0  ! p8 @C @!  1 0B8(P!@1 FBh`! 0 x)@0HBX pD!@ 0( h8DC 0( HB 0( JA 0( |LA 0( xNA 0( tP 0 pRX Z!ax!XpA!BxX pA!B5 \ B $!08 LZsB !@ D^sBA=B X2X R!0 @paaB X.XR!`0 @B`*XR!@0 a ! 0BX(!QB x x(!B`PH hZ (fsKv80ف xyv 8  bs v$80؁ x9v 8 PR! `2$B&!8XXD!BXxFB@{ dB !H 8v C !{   tx?#;:x0C_:H xh! C xF`!?B ,@,pC Ƞ!d 9sC9cpB9"s` CFx @tjshb x!$80ځ xd[ xv-0  86 4PBHc=B XbX p! HX'Hxh>HPR!0 ! ȹ~F 5 0J $OUhDPR!0 p!08 M6 `J 0!0 : CW @Up 0BA=B X08X p! HX'Hxh.PR!0 Ƞ!d 9PJXD!XR!0 !x `t.s JHXH!BX p! HX'H xhbXPR!0 @! VsJ XH!@!8X R! 0 @@B XHX BB0H !B`0XX9BJx.PR!0 XD!!hB `2(X BBHX! B`ؒX9B`J-PR!P0 XD!@WB`(XR!0 @p<B .JH h$O5hZhPR!8PR!P !0 H P!( $:s`JH p!$O5h\PxFBH @$O5h8PBPH `$O5h0PR!XP@B@C 4@,JpHX$POXPR!p0 `!_B Ȑ, TsPJ@H $``$PBhBPBH $O5h"xPxFB H $``$PBh 8PBHX!B-PR!0@H``$B`0@kp@9B|K P@@*B @@ sH!hXR!0 B!P  Hq*,d0a5dB0CHXR! xF`!?B ,@,`JHXD!BXR!0 p!08 M6 pJHXD!BxXR!0 p!08 M6 JHXD!BXR!0 p!08 M6 JpHXD!BXXR!0 p!08 M6 J HXD!BXR!0 p!08 M6 0JHXD!BXR!0 p!08 M6 JHXD!BXR!0 p!08 M6 J0HXD!BXR!0 p!08 M6 @JHXD!B(XR!0 p!08 M6 JHXD!(XR!0 !x `t.s J`H h$`` $POhZPB@HXXR!@0 @)!0  sJpHBhD!OXBHXD!XR!0 !x `t.s J@H ($O5hJPBூ @Up 0B h!$OhZXP`$B h!BX@B  X(,c @*,d8a5dJH dH@ ! xB?B@x ((@CP0 C `!P 0 `C @!P 0 C H@!P$0 C P!P(0 `0C8XH!PBXXXH!X(@!B(XxXH!0 P!P(0 `rJH(XH!0 H@!P$0 rJpHXH!0 @!P 0 rJpHXH!0 `!P 0 r0JpH8XH!0 !P0 rJpH b@X@B U()`BpB HXpB 00 B@|@XX 8F! 0!XL!`rHB!pBPC>H @PxX8@!B(XB 0  (U%0B 8$b0 $PO8NxP( $BA Đ Xp@ a F! CUxP@!B('`*H@8PB U`kPB H $`}S @ @ 8@`x`PA@H @* @H @$@@H @(@H @A@H @"@H @ @H @0@H @&0A;g @ABPA;g ]A@HA؃wC0@H @`s@@0H P8@8 0 BJ@H @ BH @(=dH 0!@b@!pC  @B pp$0C  (UX !$O  8'0BB@PP8@BX ! 08FXh!B XDBP@!$ HP8PL!p C @sJQ@!B8DXX r 0p 3BHF3 0 XhDB@ XBB !$O P",R( L!   (U8XXDB@ 8'O @BH PأPBH P!$@' HPTPBPH% @B@PB XH!X(!B  dH0 @!0 0   ! 0! X2$,B0xX@9B0'p H )'bO @PBHAPPB U% @B@PB XH!hX(!B@ ȐB 0X('B8$` s`BBBH 0 PB U('XB U- 3|F  ! b@aP1B xX(@! Ha H!`0B8X 09H!0C@!U 0BPP!B  ('`OdBH @PXP H!@!U 0B dH !$B  ` B p`8sp@1$@!yXB U%dH  0a!$0B@ $B ( $`0   B ppC@dH0X !F! 0C8B U}P@!B 'P2H`0P F!H @!UXP (!B 2$H`(0 (X F!@p! s0J@H0B (a$bB (JXX89C' `2$DB x `=B p8s+q2$<0CB UXP9BJ U$@H(hXH9B J$@H(8XX9BJ@@$@H(Xh9BJH$@zH(Xx9BJP$@ H(X89pJO`H% 3~F@iS a2$pBBH@! @ p0 4x) @" @$ 0 @ @ @/B@0eSX`@s8"C(A!`BhXH!P0 0 $@AWB(pX0 L0CU 0BPH!U 0BP (A! 0!XBB 0 $`BH(pX0 LsPJ`H0A0B `>#pB@3H $BhWPHA!BX N! aP=$HX N! aP $(X N! aP $X N! aP9$X N! aP$ȺXN!B H!0B(X09@C a2$ H B p@p C Hp'0bH @$ H$XN!hrX !0 8 P!B( @ (FB8 B! H$8XN!qX !0 8,B P(FJ@  HBHE 8O@%*!<0 ED x*!DH&b"@x@!B XPC< P $d0 8p` @XYpCHO@5 X8wB 6@,J`FBPBH` PHB x@!O@5 ؀;!ADH6p0 hs JpH @@"$ P $ pXPN!O$0bH@H Xa"$O@UXVPB Ȑ 00  !  8sJ@H053~F a2$pB@ F@ B pp B B rC D@z$@  '!H0  E@ @ػXN!0 Y @CB@ ȐP ")@ PH@$0  pJ F`A_B@,XXN!P0 @AWB P0# A!B@B!0+ BB+XN!0 Ȁ5!d @`sC pl cC`A!0 Y P"$B0  PTA$@H<`:PN! pq JB 0 a ! B 8,HhXB pH@0#`paC x0 YqF@;Bq9$@C B pHJA! @FXN!0UP 0BF`0B H D!@A_B,` (L0 XN! B(X @0 a N!@?B ",0 @H@ (0 @XXN! `paH(1bH 0!  p8 sPBpBdH 8XL!@a8@C8'\PL![PL!X x9 0X;C a2$ DEB`Š L # HB< B2$@FB*!pP "!HX L!8@ȱXp@ a 0C8@X H 0 0 xnP P! 08'*H H.E( L!   (U A"!AdH ĐF|B`D Đ P!tc<@ # 9$ ZPBE8B HXX X 0 0@ $ C8B(Xx 0C xDB<B 8T8C xD<B 8@8-J!a?BX$@ ,,X`9BJD DH @$LBHD P8PB@HFB?BXHVHX@9B J@DDH @$0@ BH PPL!0 P@!p(0 rJHkP P! 08'*H  HR8PB@H X`2$,B H$B  c9dsBhXPL!kP P! 08'2H@ HPBHjP P! 08'*H H,XPB`HxjP!BXXB@8'*H HRPL!0 P!!p0 `rJHiP!BXXXB@8'*HHhPp 0@ $ HHXx 0B0JH DAoB4 @2! 82XL!iP!BXXBPB!*HH0P8$BX  b@XB U12zF !bd(!@BXX 09 (@!@OpBhP 8!  'P*H0LPF!U 2BȪX 'Ba`a㥛 dg"$`p1 ! s40`BHgP 8!  'P*H`0؂P@H`!@2B@d X!@0 dHp80 e!0 pH1ORX8l0 ?RP|1`R 8:@Rp0 w ( w p w4Y! H$8! xdp)`Rx,* QD @HRz p) x\0#P,RI @ @0xPF!U 2B 1 3~F p1$PB` 8A!0X J!@!J B@0C x@!@ p`;X@ hL 9qRB;X@ @!`0@Rx!X0@!B`a @ $ BP #$, X@ HP H (`BXJ! @D! U0 0BxX  (X(`%cPP!B8'"H  HRHPBH `#$0@!pOH P@$BH% @B@PB X (' 8$`O@ @PH!xX 0! ('HXH!PO  0'p"H @#$pp q0@P!PB U() bH !1$P  DpB!p,r!HXL!00 @ 8! B@ 9`CD0# @B x #  (UHD HYXL! 8F@XX H(@ '~FXL! F@BXwPBH`B!FHH'HXBwPH% @B@PB XPB  8B!dH!`0  B@XB U% @B@PB X (@! 8B!2H0LHXB U% @B@PB xX (@! 8B!2H0LXB U% dH 1$@B@0!p HP ȘXH!`JH@(!pC @'tnX H!0 X "! # PP(@CȦXB UhXH!X U(@X0$B (' s@BpHH p0 nPH!(SP @! ('`*H@ 8nP($B Ȑ!XB @B`!B x8 #(!`:H 8'O8mX H!0 X "! # PP(rPJpH $$`*H8mP($B Ȑ!XB @B`!B<0H% dH !@PO>PH!=PBB@ p`8s!ؗXH 0 CP xXh;C($` HXB`H (JHXp; B (P!HX (@!H!XH!P HX 0$ (@!xXH!PHX 0 $ (@!HX8@5pC(!$>PH!0 X !, (PChXX 0pC A B0PB &Hc)SB<PB U 8$$PO8NkPH!ȕXH 0BJ(OP @! 0$PO 8jP($BXH!Xh;BJP@ $$PO8 XjPH!XX 0BJhNP @! 0$PO 8"iPH!P HXBB` &Hc)SB8;PB U(@!HXH!PBHH<PxBB`| PP$JHhMP @! 0$PO 8hP($BXBHPHXH! PB(X %0@F !b(A!hX A!B@(H!X($BaH9@O@ 0 C@0BX P9F!C@!U 0@BKP@!B 'P2H 0LgP B@!U 0@BKP@!B($p0B`0gPHfPF!HH - PB`xX09PB0$8)PB 0BX@9BPB0$XB  U0@!pBXX9Ka2$pBHHp0 D0@X`9B@C$$`0 8Xx9BpB0BxXBXB  U$$`0 8XX09B@C@%$`0 8(XH9B0CXXJ!`BPH?XP9BC xD<B pp4J XP!, (sJ0B(XJ! 0$HXJ!HH(FX09J DFB0 hX D (@JH8`0 ؎X@9B@B@%$`0 8$XX9BC @!0P L`C.P ( J!@BX.Pp0 ( J!0BJPJ! D`^B ,$C D{B :4PC 8DB 0T0CX` B ((XJ!BHhXBHX J!0 @X5!jB02` ȻXP9BJEPDB@@0'p2H p7!0 H(aPBHHX J!0 @XC!‡B0@| Xp9BJDPJ!0 @@0'p2H@ B@D80 x`PPHXB@X@D@@F 0 B0 XX@9BJ8DPXDB@@0'pH ,B@(0 _PJ!0 $B HX0!BH%$p0 0 ؈XB 0B(XH 0 !@`r`C(@`BXH9B XPC80 `JB UB U0) 0  8!@B` `rpC0 HB8X H1N!C 80 J @!B `B!P P 0U(@0 x B@!0#  BP  F <0 `H<0 8rŁqy@=0# ]b@0BH X ! B  ! 0# @0#" B !P0 @XH!0+ (BxXH!0#XXB U@50xFB ~F @P ,09pCP@!*HX(!@ B@$R!*HCPJ!ȅXP 9@ @@PA!BC@?#B`@X`F!ȋXR!0B`ȋX! @ R! r0C,,@ 8(DƒPpXh!؉XR!@h B@X 9pCL! B @P`8J@Up 0BPB!  @ bXF! BXBHX B X@! @xXR!BXX D 4B B@X 9 JpHP@!X R!!h`@  ‡`0CF  BHPB!B@$bX @XBHP@!X R!!h`@aBH02 @11ЂaDaB0X9`JpH %  `0" BB (!``0 `CHB9p0B 0B! B 3@Q!(X0A!BXJ!` B~X @ (0A!X,B0B!B ,C@@!`0B`p x ?~F `q(cq@" s<hX h0YJ! BYJ P@P@@ $# U0 0I `L@X@BHb@0H 8}XD! B  80+ B @@B@ @@C`B!PBxXH!`J(@!XB U @B@ 0B!hXx! B 89 AC <0 @H9@r@ `xH0#X<Q0# q8"D, H!  U ) PB``B X ! (0B!XJ! !@${X!BHB!` B L8N}X0D!B8{X09B 8D!0  0$@0L!H}XB0  U % PB` 0@!@X@?# ( x!P jr8$ƹ(!PC x!=@ H<4( 0$(`(X$ʹJ  @8D @(Z0h$9(!PC @?#@!@ H<40P  L(8$$ƹJ  0   TB@@B  C 8 @B!X J!@0  U@1B PB!XP!BxxXX!B R!P BXR!BXR! B8xXX!` B R!BX R!@XJ!(X89 B R! @C 8BPB!BxXR!B`  PJ! #XX0 5B@BX$BXVh~Xh 80CPJ!X85B@B@$BX~XH8CPJ!X|XR!BH|X8 H@UX ! HPJ!~XR! BhvX@0# HXJ! BxX P@! HXB!XBpH 1J!@X R!@8q BBJX,, R! PJ!({XR!B{X8 H@Up B!"BXXBH8A ߛ`0" &H @!B@M`b `XezXP!I@ !Pb8@@$C hH!`a`$vX9B`a`5$!(xXP!@ r`a `)d #wX P! r@a #  x`xP H9  @C B! 0<(  @ J<(`Pp!|X 85!BCA@ HHP99C@Hs ! PB !L ,(2RXB <#  CDBA`JXB!8{X P!B9 C x/?# < H(p 9<B`C ?~FG9<B@C P 09 J B@P4! hFsB $B4`8yX ($8 @XB!C 0!huX@)9BX@!B@CB@XP! JXH!vXBOpPU` J `|@  !DB "4 PCxU  @B ,T(H @?#p hHp$9 @B"!p  8BpH@B Pu s@C B Pu J "r JX!B 9 I(XP!B `J! BxXB0H!  b (@!`B8XB U(1 `0" `B8B!xwX@!B PB!BaB&H@pBHR 8'2HGP B@!(U@ 0I `L@pX 8A! 0@$qX@ 9B8@!BK BaH!hX L!@!(U@ 0I `L@ ! PB` 0@!X89@ B J!0 @B0)pB HB!XX H9@ B 8"80 @D!XvX !B HF! BXqX 09B 8 AB8rXN!BP 0U ) PB 0@!0bX0!!B@8!@CB 0LuX   B (B0  U ) &H 0D90b@PpB0@!B L8B&H@P HRHXB0  U @B@ (@!hX89B pP!B x0<B%0 ! `rpC@BL 8a@@O4`0 @CPF!0 `J U@5@0 H!pb Q B0H9PC0B P!FHrX   HPF(rXR!0  BHmX B H r@CD!BmX B H JPFBlX B H r@CD!BlX B H J p`H!@@80 `JPD!PHhXR!0 @@ B`@ 9C @B`lXR!0B @`PH! rpC! BrXXB! @ H PD! + !kXXD!B@ !D JXjXPD!B(pX @ 0@B H@ B`(kXR!0B @`PH!` rpC! B8qXXB! @ H PD!%+ !jXXD!B@ !D ` JxiXPD!BHoX P B H,0  !@J @L!p H@U@9B@XB!0Bpb nX (! R!`0!nX0(!h@B@"rP@8 sC XF!hJ!fX R! @ (  8H0BXH!0@D2`D!`C @F`@P JH @@!Wp @UnXR! 0 (P9JH  S$@H@p!0* 8#@@ @R$*  B@@@!UB 0B hXF!`k , T$  ! $@   BhXD!B T$@@0( p@8 pC<B@ 1J$@ BFeXD!B U<B UP&H !b(JHgX F!@PB$@B(gX H9BdC(fX F! s}A$C@(H (fX h9BH@d@C(hfX x9BP`0pC(8fX 89BXP@C(fX F! @  U0B ($b(JeX 89B@pC(heX H9Bd8@C(8eX F! s}A$C(H (dX h9BHd(C(dX x9BP  C(dX 89BX@pC(hdX H9Bp`d@C(8dXF! sjq$p U0B ($b(JcX 89B@C(cX H9BdpC(hcX F! s}A $@C(H ((cX h9BHdC(bX x9BP C(bX 89BX@C(bX H9Bp`d@pC(hbX X9Bx䂀@C(8bX F!@0@ U0) BdH 8!Pb` Ȑ Ȑ@@!eX ! 8 pD`8rp2AdHC@B!ZB\X@0# N! B8_XN!B\X F # N!B\X HBP 0UaX@FBaXB @HaX N!-B!\X@0# N! Bh^XN!B[X F # N!B[X HBP 0U 1$B 1$B@ 1$B@H !`r0C., F!  U 2$B 2$B@0B @B (X !BX U01`r8!BCXbX@!BYX! r 8 @@!B HD a!bXh0BC,` Px!h:st4!PBX:sCH@?# BH@ X$5h=s,JDx@Jqp<#@@!XaXh0PJx1$BY H!RH`X@F <B (bX N! c1 s 1 0q8B@ #]XN! ( 0U`X;sv$8J H@?#@H $ `@( P9YBq@@" BBq\8H H@?#@H $ `@( P9YBq@@" BBq]8PH 1$B 1$B dH p!80  ' B^XD!B U ' B[XD!B UbH !bHX09@B p@@8Bp$H !hXF!  UZX@B Ȑ ! 0 XBH 1$B  BXX09PB 1$ B p08Bp$H !hXD!  U\XD!XBH@H !`r0C\+, F!  U 2$B 2$B@0B @B hX !BX U 1$B 1$B 1$B@0B @B X !BX U 1$B0B @B X !BX U@BH !`r0C4*, F!  U @2$ dH`ĐP! B !$ x @  @<Bp8Bxe"3~F !b  @!B 0hYXH0BC,`0 P p?#`q`B @$`}S "X@@ HH(@`x`ZB`X@P! L!XXH0PJh1$ B Đ P! 0 CP0 ШCZB,0 L!XXx0BC, hL d p`(8kB a$}S b|@ :t@HiR! BHHYR! BHHR! BH N!`X@P!(WX `!@HHB`HH%R! B@HH)R! B0H `!Xq H@d5@ @Ux8+ @ L!xVXx0J@ZxU 0BP!XSXP!BMX@0#  ZB Z , @ZH P! P!XMX ZB Đ Z0PB&X# @ZpHPH!B a 0H!PAB`B 6`h T 2 B @1!P\ ,!`T (pL HNX , `!`T8 B`5qPaA Pa8+ <U8+HPH!B@  H H! B T$D @PT! <0 @ ,B`Ɔ8p HMX H PF9 TP! Be2HMX `!@XBu@H`w%BpP!`H@& $@H`V BB 9+ 9+ <  PT! `T8 B`5qPaA Pa8+ <U8+0H $@P P!`888LX , Bu@H PD950D9s0C@!CpP!0H ${Hv  u@ @8+ @9+@ HO@Y x$B@PX ! <0 P,$@ KXHpP!`H $0+H@& Hu@ 9+ 9+ 8+@0H @ $ @@! BhJX `!@XB9@HpP!0H& $HW  @ 8+ @8+ 9+@pHpP!iH  $pqH hu@ d8+ \8+@HpP!H# $iHIH @P!8+ x8+ p8+<@H JpP!`H $0qH@XaHu@ x$8+ P8+HDH()`B @B!XHX8@!B T@P8MX 09 0HD9PC AA$B0 H!HXL! P`$pB@LX P 9 0hF 9CAa$sB&APP !XL!   (U $pB @ XpB 0BT@XXpB 0BT@(XpB 0B` T@X H H$pB @XpB 0BX@XpB 0B`X@hXpB 0B@ T@8XBHpF9pB`KKXpB@ 0B  X@"xEXBH b@IX@B U0B @B JXF!X U  BxHXBGXB UBB % PB``0kPB H$`}S @ @ 8@`x`X1$`BH $,B @BX`B (B T8NKXJ!hGX ( UX1$`BH  $,B @AX`B (B T8NxJXJ!FX ( UX1$`BH $,B @HAX`B (B T8NIXJ!(FX ( UX1$`BH $,B @@X`B (B T8N8IXJ!EX ( UX1$`BH  $,B @@X`B (B T8NHXJ!DX ( U@93|F Đ 2$ BdH`Đ ! B 0 `r ȐC! @!,H@aXVB@X PB HXDBaxX H HXBBhEXH9B0C F a`(%pJPL>X`9PCcCPJ0 ?XB0B` XX?X PB HXDBaxX PB HXJCXP9B !pPJXD0 `!BXR!0 XBHCXp9`C@Up 1BX x9 HP%X 8 9 H@%HX B H XL,HPTX>XR!BCXH@1@JH(2$@1B@X @ HB Ȑ BdH`ĐpJ 0B! HX 89 HH%X H 9 HH8%@X  HhDE XyYJ0 sQT!Xh!B Ȑ2$0,H*!HB P&`(80 XH 0B@0H0C H! JPB!8X`9B@J8X B HB` XPH:XB@?XR! 8 @UPB!?XR! B7X @B@@XB!x9XBH G?#aPC ,$I HL00 `8r@Bx J!8B<80CJ 0~FHh7X@9@CPJ, R! JHxX0 H B@ XPT8XR!B=XB PJ;XBHPB!=XR! Bh5X@0# HP!B7XPH091~F8! c`YPb P e4XN!~F x!@ B0CpU @@P@!=XN! B4X@0# 8X@! B6X`!B@X$Ђ0B:X x@! 8<0 `8rB !a!08jpC@FB hD! B`@HXX N!0BY  J !  PA!h9XB@C H BP!$r`)H(JPH!8XN!G`HUP 2Bx8XN!JH013|F 1$pB p!8 `8(B1$bH$B 0  C 0 r0B3Xh 0@C BX@@`0BXXN! 0UP 0B@8(JH!S$B7Xp9BJ bH $!0 ` C 1$dH` Ȑ P@!dH`0pB 6! hB` Xc K0 H@xX X! 8H@0 ,H P28X @F 8 B HD8XN!0 0p0 .0UP 0B X 2$ H@a,B H7XN! sdAJX 89 8X!xX H 9 8HH!XH!B X@2XN!Bh7XBpH4XBB Ȑ *!0P0 &HBHXXH!B X@Px1XN!B6X`H`Y2~F h!bb x!(X0XZ!@1BcJP㥛 dgp@1 @\1R@ R(9 6X0!B HJ!p @C!dH X"!, )CdH 0!`\ YaPB @!2$ Pl h(p29 BP1$8s0C 8T! }C`U 1B`$@H`( p@!B(*B@0PBhX!B XpJx^4XBBĐ (! L HsJpJH4XBH 1$PtB JP0BC1$0B8d!XZ!0 rBpJBp4P)2d0 A! ȐyPpJXBĐ!pj-X B h pJ0,Hxf/X N hX 9C-XZ! xNPbH(*!rB 2$ BHDRX0 h BXpL,XZ!B(2XBH p@!H!XZ!B xB!BXZ!`U 1BX!B BȐ X"!, )aJH@L!pB P$aBaN| xT x a! B+XB H S$0Bp:!H+XxB!B D!B@0 T$0B 8!XX0 h B XxP/X Z!dH@ Đ6!hB hpd 0!`\sXhJpJX-XJB Ȑ `!0 <HJ0H$$H@QH$aH $@,H@ XLP0 x$( + DX+ ,P+ H+ @@+ (,X NBP)XBPHx]$A0B ``@?#B H"b 7E/   E#  X09B@CxU H* 1BP!1$"HhX B  bH P 0 @F8C00 a! 0 h+X B @a0C 0 @B @@1$0 B*X `!0 @!;BAvp0B0D 0@,Av$R B [configuration properties] [...] %s [configuration properties] [...] ( implicitly '-c') %s ( implicitly '%s.conf') %s ( implicitly '-c' and '%s.conf') where can be one of: -c --console run as a Console application -v --version print the wrapper's version information. -? --help print this help message is the wrapper.conf to use. Name must be absolute or relative to the location of %s [configuration properties] are configuration name-value pairs which override values in wrapper.conf. For example: wrapper.debug=truec%s.confwrapperRestartProcess() called. (IGNORED)wrapperRestartProcess() called.JVM requested a restart.Filter trigger matched. Shutting down.Filter trigger matched. Restarting JVM.--> Wrapper Started as Daemon--> Wrapper Started as ConsoleUsing system timer.Using tick timer.<-- Wrapper Stopped--> Wrapper Started as ServiceJVM process exited with a code of %d, setting the wrapper exit code to %d.JVM process exited with a code of %d, however the wrapper exit code was already %d.Unexpected jState=%d in wrapperJVMProcessExited.JVM process exited with a code of %d, leaving the wrapper exit code set to %d.JVM exited on its own while waiting to kill the application.JVM already down.Unable to start a JVMJVM exited while loading the application.JVM exited before starting the application.JVM exited while starting the application.JVM exited unexpectedly.JVM exited unexpectedly while stopping the application.JVM exited normally.wrapper.java.commandjavajdbjdb.exewrapper.java.additional.%d"-The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.-Xdebugwrapper.java.initmemorywrapper.java.maxmemorywrapper.java.library.path-Djava.library.path="%s%c%s"wrapper.app.parameter.%d-Xms%dm-Xmx%dmwrapper.app.parameter.%d.stripquoteswrapper.java.mainclassMain-Dwrapper.jvmid=%d-Dwrapper.cpu.timeout="%d"-Dwrapper.cpu.timeout=%d-Dwrapper.native_library="%s"-Dwrapper.native_library=%s-Dwrapper.version="%s"-Dwrapper.version=%s-Dwrapper.pid=%d-Dwrapper.timer_slow_threshold="%d"-Dwrapper.timer_slow_threshold=%d-Dwrapper.jvm.port.max=%d-Dwrapper.jvm.port.min=%d-Dwrapper.port=%d-Dwrapper.key="%s"-Dwrapper.key=%swrapper.java.classpath.%dUnable to get information of classpath element: %s (%s)-Dwrapper.jvm.port=%dLD_LIBRARY_PATH-Dwrapper.service="TRUE"-Dwrapper.service=TRUE-Dwrapper.disable_shutdown_hook="TRUE"-Dwrapper.disable_shutdown_hook=TRUE-Dwrapper.ignore_signals="TRUE"-Dwrapper.ignore_signals=TRUE-Dwrapper.debug="TRUE"-Dwrapper.debug=TRUE-Dwrapper.use_system_time="TRUE"-Dwrapper.use_system_time=TRUEwrapper.java.additional.%d.stripquotes-Dwrapper.timer_fast_threshold="%d"-Dwrapper.timer_fast_threshold=%dClasspath element, %s, does not match any files: %s-Djava.library.path=%s%c%s-Djava.library.path=%s-Djava.library.path="%s\"-Djava.library.path="%s"-Djava.library.path="%s%c%s\"Classpath element, %s, does not exist: %s-Djava.library.path=wrapper.java.library.path.%d------------------------------------------------------------------------The JVM is being launched with a debugger enabled and could possibly besuspended. To avoid unwanted shutdowns, timeouts will be disabled,removing the ability to detect and restart frozen JVMs.IGNORESHUTDOWNFORWARDwrapper.daemonizewrapper.signal.mode.hup%s must be in the range 0 to %d days (%d seconds). Changing to %d.wrapper.logfilewrapper.logfile.rollmodeSIZEwrapper.logfile.formatwrapper.logfile.loglevelINFOwrapper.logfile.maxsize0wrapper.logfile.maxfileswrapper.logfile.inactivity.timeoutwrapper.console.formatPMwrapper.console.loglevelwrapper.console.flushwrapper.syslog.loglevelNONEwrapper.syslog.facilityUSERwrapper.ntservice.namewrapperwrapper.unix.namewrapper.portwrapper.port.minwrapper.port.maxwrapper.jvm.portwrapper.jvm.port.minwrapper.jvm.port.maxwrapper.debugDEBUGwrapper.java.command.loglevelwrapper.adviserwrapper.timer_fast_thresholdwrapper.timer_slow_thresholdwrapper.native_librarywrapper.java.library.path.append_system_pathwrapper.state_outputwrapper.timer_outputwrapper.loop_outputwrapper.sleep_outputwrapper.memory_outputwrapper.memory_output.intervalwrapper.cpu_outputwrapper.cpu_output.intervalwrapper.disable_shutdown_hookwrapper.startup.delaywrapper.startup.delay.consolewrapper.startup.delay.servicewrapper.restart.delaywrapper.restart.reload_configurationwrapper.disable_restartswrapper.cpu.timeoutwrapper.startup.timeoutwrapper.ping.timeoutwrapper.ping.intervalwrapper.shutdown.timeoutwrapper.jvm_exit.timeoutwrapper.ping.interval must be at least 1 second. Changing to 1.CPU timeout detection may not operate correctly during shutdown because wrapper.cpu.timeout is not smaller than wrapper.shutdown.timeout.wrapper.max_failed_invocationswrapper.successful_invocation_timewrapper.request_thread_dump_on_failed_jvm_exitwrapper.filter.trigger.%dwrapper.filter.action.%dwrapper.java.pidfilewrapper.java.idfilewrapper.java.statusfilewrapper.commandfilewrapper.command.poll_intervalwrapper.anchor.poll_intervalwrapper.umaskwrapper.java.umaskwrapper.pidfile.umaskwrapper.lockfile.umaskwrapper.java.pidfile.umaskwrapper.java.idfile.umaskwrapper.statusfile.umaskwrapper.java.statusfile.umaskwrapper.anchorfile.umaskwrapper.logfile.umaskwrapper.ignore_signalswrapper.use_system_timewrapper.jvm.port.min must be in the range 1-65535. Changing to %d.wrapper.port.min must be in the range 1-65535. Changing to %d.wrapper.ping.interval must be at less than or equal to 1 hour (3600 seconds). Changing to 3600.wrapper.ping.timeout must be at least 5 seconds longer than wrapper.ping.interval. Changing to %d.wrapper.port.max must be greater than or equal to wrapper.port.min. Changing to %d.wrapper.jvm.port.max must be greater than or equal to wrapper.jvm.port.min. Changing to %d.YYYYMMDDwrapper.logfile must contain "%s" for a roll mode of DATE. Disabling log file rolling.wrapper.logfile.rollmode invalid. Disabling log file rolling.CPU timeout detection may not operate correctly during startup because wrapper.cpu.timeout is not smaller than wrapper.startup.timeout.CPU timeout detection may not operate correctly because wrapper.cpu.timeout is not smaller than wrapper.ping.timeout.wrapper.jvm.port must not equal wrapper.port. Changing to the default.The value of wrapper.max_failed_invocations must not be smaller than 1. Changing to 1.wrapper.statusfilewrapper.lockfilewrapper.pidfilewrapper.anchorfileUnable to open configuration file. %sUnable to resolve the full path of the configuration file, %s: %sThe argument '%s' is not a valid property name-value pair.Problem loading wrapper configuration file: %sWorking directory set to: %sUnable to set working directory to: %s (%s)wrapper.working.dirGot key from JVM: %sReceived a connection request with an incorrect key. Waiting for another connection.Incorrect key. Connection rejected.Got ping response from JVMJVM signalled a start pending with waitHint of %d millis.JVM signalled a stop pending with waitHint of %d millis.JVM signalled that it was started.read a packet %s : %sreceived unknown packet (%d:%s)socket read no code (closed?).socket read failed. (%s)p H X x X @ ( ` H99(:p:::(;P;8h@h@xp`XPH@8xphlinuxx86643.2.3Advice:The Wrapper consists of a native component as well as a set of classeswhich run within the JVM that it launches. The Java component of theWrapper must be initialized promptly after the JVM is launched or theWrapper will timeout, as just happened. Most likely the main classspecified in the Wrapper configuration file is not correctly initializingthe Wrapper classes: %sWhile it is possible to do so manually, the Wrapper ships with helperclasses to make this initialization processes automatic.Please review the integration section of the Wrapper's documentationfor the various methods which can be employed to launch an applicationwithin the Wrapper: http://wrapper.tanukisoftware.org/doc/english/integrate.htmlSTOPPINGUNKNOWNSTARTINGKILLINGDOWNLAUNCH(DELAY)LAUNCHINGLAUNCHEDwUnable to write to the status file: %s%s Set Wrapper State %s -> %s Set Java State %s Timeout %08lx -> %08lx Set Java State %s -> %sStartup failed: Timed out waiting for a signal from the JVM.org.tanukisoftware.wrapper.WrapperSimpleApporg.tanukisoftware.wrapper.WrapperStartStopApp DebugJVM timeout. Disable current %s timeout.The JVM was launched with debug options so this may be because the JVMis currently suspended by a debugger. Any future timeouts during thisJVM invocation will be silently ignored.Anchor file deleted. Shutting down. Loop: check anchor filer+tCommand '%s'. Shutting down with exit code %d.Unable to delete the command file, %s: %sPAUSERESUMEDUMPCONSOLE_LOGLEVELLOGFILE_LOGLEVELSYSLOG_LOGLEVELCommand '%s' is missing its log level.Command '%s' specified an unknown log level: '%'Command '%s'. Set syslog log level to '%s'.Command '%s'. Restarting JVM. Loop: check command fileUnable to read the command file: %sCommand '%s'. Requesting a Thread Dump.LOOP_OUTPUTSTATE_OUTPUTMEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTCommand '%s'. Disable %s.Command '%s'. Enable %s.Command '%s' not supported on this platform, ignoring.Command '%s'. Set console log level to '%s'.Command '%s' lead to an unexpected state.Command '%s'. Set log file log level to '%s'.Command '%s' is unknown, ignoring.JVM Restarts disabled. Shutting down.Waiting %d seconds before launching another JVM.wrapper.on_exit.%dwrapper.on_exit.defaultshutdownrestarton_exit trigger matched. Service is paused, will restart the JVM when resumed. (Exit code: %d)on_exit trigger matched. Restarting the JVM. (Exit code: %d)There were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.Waiting %d seconds before launching the first JVM.JVM was only running for %d seconds leading to a failed restart count of %d.com.silveregg.wrapper.WrapperSimpleAppThe com.silveregg.wrapper.WrapperSimpleApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperSimpleApp class instead.Reloading Wrapper configuration...com.silveregg.wrapper.WrapperStartStopAppThe com.silveregg.wrapper.WrapperStartStopApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperStartStopApp class instead.Launching a JVM...Startup: Timed out waiting for a signal from the JVM.startupStart Application.startUnable to send the start command to the JVM.Startup failed: Timed out waiting for signal from JVM.Ping: Timed out waiting for signal from JVM.pingJVM appears hung: Timed out waiting for signal from JVM. Temp: Sending a ping packet. Temp: Sent a ping packet.JVM Ping Failed.Shutdown: Timed out waiting for a signal from the JVM.Shutdown failed: Timed out waiting for signal from JVM.JVM exitShutdown: Timed out waiting for the JVM to terminate.Shutdown failed: Timed out waiting for the JVM to terminate. Last system time tick overflow at: %s Next system time tick overflow at: %s Last tick overflow at: %s Next tick overflow at: %s Loop: %ssleepno Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%sfalseUnknown wState=%d Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (N/A), Exit=%s, Restart=%s Loop: handle jvm state: %sUnknown jState=%d Loop: handle wrapper state: %sWrapper Process has not received any CPU time for %d seconds. Extending timeouts. Loop: maintain logger(2) Loop: process socket Loop: process jvm output Loop: maintain loggerPause reading child output to share cycles. Loop: exit requestedPause reading socket data to share cycles.Event loop started.Event loop stopped.Sending stop signal to JVMر 8Ph` 0 ( x  %d Dumping JVM state.Could not dump JVM state: %sSIGCHLDSIGHUPSIGINTSIGQUITSIGKILLSIGALRMSIGTERMtimer expiredAIO completedmesq state changedunknownkill, sigsend or raisesigqueuethe kernelqueued SIGIOSignal trapped. Details: signal number=%d (%s), source="%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s) signal err=%d, "%s"Signal trapped. No details available.Timer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.Timer thread received an Quit signal. Ignoring.Unable to register signal handler for signal %d. %sLaunching Timer thread.Unable to create a timer thread: %d, %s Sleep: nanosleep %dms Sleep: awakeThe timer fell behind the system clock by %ldms.The system clock fell behind the timer by %ldms. Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ldTimer thread started.Could not mask signals for timer thread.Command[%d] : %sUnable to set JVM's stderr: %sUnable to write the Java ID file: %sUnable to write the Java PID file: %sCould not init pipe: %sCould not spawn JVM process: %sUnable to set JVM's stdout: %sFailed to set jvm output handle to close on JVM exit: %s (%d)Failed to set jvm output handle to non blocking mode: %s (%d)Unable to start JVM: %s (%d)Call to getrusage failed for Wrapper process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldCall to getrusage failed for Java process: %sJVM exited in response to signal %s (%d).Unable to request JVM process status: %sWIFEXITED indicates that the JVM exited abnormally.Received SIGCHLD, checking JVM process status.JVM process was still running after receiving a SIGCHLD signal.Failed to read console output from the JVM: %s (%d)%s trapped, but signals for timer thread are ignored.%s trapped, but ignored.Unable to forward %s signal to JVM process. %s%s trapped. Shutting down.%s trapped. Restarting JVM.%s trapped. Forcing immediate shutdown.%s trapped. Forwarding to JVM process.%s trapped. Unable to forward signal to JVM because it is not running.HUPTERMINTJVM did not exit on request. Attempt to terminate process failed: %sJVM did not exit on request, terminated/dev/nullSpawning intermediate process...Could not spawn daemon process: %sSpawning daemon process...setsid() failed: %sUnable to extract path from: %sUnable to get the path for '%s'-%sUnable to set working dir to %s : %s?-helpv-version-consoleERROR: Could not write anchor file %s: %sERROR: Could not write pid file %s: %sWARNING: Could not write lock file %s: %s Unrecognized option: -%s 0 H ` P H ` x%s=%sUnable to set environment variable: %s set.default.set.rt#includeThe following property name value pair is too large. Need to increase the internal buffer size: %s name:%s value:%sNONE DEBUG INFO STATUSWARN ERROR FATAL ADVICEWARNING - Encountered an unknown thread %ld in getThreadId(). SIZE_OR_WRAPPERSIZE_OR_JVMDATEFATALERRORWARNLOCAL0LOCAL1LOCAL2LOCAL3LOCAL4LOCAL5LOCAL6LOCAL7%04d/%02d/%02d %02d:%02d:%02d.%03d%04d/%02d/%02d %02d:%02d:%02d%cjvm %-4dROLLNUM-ROLLNUM_ROLLNUM.ROLLNUM-YYYYMMDD_YYYYMMDD.YYYYMMDD.%sUnable to delete old log file: %s (%s) Unable to rename log file %s to %s. File is in use by another application. Unable to rename log file %s to %s. (%s) ????????Unable to get the current logfile size with stat: %s Unable to get the current logfile size with ftell: %s aUnable to open logfile %s: %s %04d%02d%02d@~8~0~(~ ~~~}}}P}}(}}}}}~h`XPH@8ph @~P~~~~~0xp@8Ѝ@z`@z`c@z`@z`Б@z`y@z`Z@z`@z`@z`0@z`0[@z`P*@z`@+@z`*@z` &F /" #" ##2!2F!  aKF!a!F"a9F!a6F"5a*acF!aF *F *F#aZF' aaZaZF(aF!a$F# a*F!aEF$axF )F#a-F -F"aF%aF"aWF 0F%ajF!6F!aiF!a]F"aQF$a)F$aF$øaC;F8aa F$aF"a"F"a1F#a-F!<F"<F( a aF%aF a7F"a4F a$F";aTa?F!aNF"a@F"amF"aF)aa3aF&a:F$aQF#aHF&aaF!aF$axF" /a`)F' 2aaF a(F!a$F#aoaEa6auF$aF#aYF"a[F#a\F"aF#aVF#aVF"a8F+aaF'aa;F"aF )F$a-F!a(F$aF"a3F"a0F" <8F :F!aLF!a^F"a!)8F%  aF%aa'F$aF )F!<afF#aEa!F"a-F$aEF, B a;F" a6F%aF";F"5F"5F"aF"aF!a"55F#aF">F%aAF 2F"5F' aQaNF# aK&F /F"8F"a'F#a3F#aNF'aF& aaEF",F$a!a!F#2F%a!F#9F# 2F"2F!;F'aF'aL5F!2F a'F!aLF!aRF!a[F%aUF!1F!/F%aF *F *F!a%F a!F!1F!/F!/F!/F!1F.aaF$aF )F!/F ,F#aF'  aoara*F'aF%  a^)F% a0aNaHF+aOaaF. 1.aZ&F'ahF,0a.a!F'aHF#a$F"a!"2" &" &PpSpg)P*PSP**hS*0+S@++S+-T-`. T`./@T/0`T0p4Tp47T78T8`8T`8`:T`:`AU`AFHUFGhUGHUHPJUPJLUL0MU0M0NV0NN VN`Q8V`Q UXV UWxVWWVWYVY`ZV`Z\V\^W^p`(W`paHWpa ghW g`iW`iWWWX8XXX`pX`XXXXYp0Yp0XY0xYYpYpY Z (ZHZhZZ Z ZZ [@[`["["#[#%[%'['p,\p,P.0\P.00P\00p1p\p1`8\`8O\OR\RR]RS(]STH]@WZh]Z0[]0[@\]@\p]]p]^]^_^_a(^acH^c`hp^`hl^l@t^@tt^t`w^`wy _yzH_z@|h_@|p_p__0_0`0 `008`0 X` Бx`Б`P`P`0`0a0(a0Papxapaaaa0b0(b0Xb0pb b bbbc0c00cPc pc0cc0c0cd d@@dPXdP0pdd@d@ d@dpeep0ePHeP`e0xe0e@ee0ePf(f@Pf@pfff@f@(gHg xggg g @S@`h S@0S@pR@@S@5 P@ @w`w`8@ @@  pz`z`X@@H o@oo@M@M@M@M@M@M@M@M@R@R@R@R@R@R@R@R@S@S@Г`(L@@@X@@@@@@@(@P@p@@@@@@@@(@8@H@X@p@@@@@@@@@@@@@@P@`@@@@(@P@@@@@@ @8 @X @`>@x @ @ @ @ @ @ @H @ @ @ @ @ @H @h @ @ @ @X @x @ @ @ @ @ @P @p @ @ @ @@(@@@X@p@@@8@p@@@@0@`@@@@@0@H@A@P@X@`@@@@@@@0@P@p@x@@@@@@@ @@@`@x@@@@@@8@P@h@@@@@@ @8@`@@@@@@ @@@h@@@@@(@H@h@@@@@@@@@@@ @(@@@X@@@@@@@@0@8@X@@@@@@@@@@0@8@P@`@x@@@@@@@@ @@@`@x@@@@@@ @@@X@x@@@@@@0@P@h@@@@@@8@@@ @@ @` @ @ @ @ @ @!@ !@0!@H!@`!@x!@!@!@!@!@"@0"@H"@`"@"@"@P#@#@$@p$@$@$@%@%@&@`&@&@&@&@&@'@8'@'@'@'@(@@(@X(@x@p(@(@(@)@P)@)@)@)@)@*@0*@*@0+@L@L@L@L@M@M@M@ @=@M@M@@@ N@0N@N@(N@8N@M@@N@HN@PN@M@@@@XN@`N@hN@pN@xN@N@N@N@N@N@N@`>@N@p$@N@O@O@ O@0O@@O@PO@`O@x@hO@O@O@P@ P@XP@/@P@P@P@ @@/@ /@(/@@8/@@/@H/@X/@h/@x/@/@/@/@/@0@(0@@@h0@0@p @@,@,@P,@,@,@(-@x-@-@-@-@ .@h.@.@.@0@`>@1@H1@1@1@1@2@@@2@@2@p2@x2@2@2@2@2@2@2@(3@x@X3@x3@3@3@3@3@4@4@(4@84@@H4@h4@4@4@4@ 5@P5@x5@5@5@5@6@6@ 6@6@6@ 7@`7@7@7@8@`8@8@8@9@X9@9@9@9@:@:@ :@P:@:@:@:@;@(;@H;@`;@;@;@;@<@X<@<@<@<@<@=@=@=@ @=@=@>@(>@@>@h>@>@>@?@ ?@@?@p?@?@?@?@?@P@Q@8R@x/@@@@@@@ /@@@@@@@@@A@A@A@A@(A@8A@PA@XA@pA@A@A@A@A@A@A@8B@PB@xB@B@B@C@HC@`C@C@C@C@C@0D@xD@D@D@D@D@ E@HE@`E@E@E@E@ F@@F@xF@F@G@8G@hG@G@G@H@HH@H@H@H@H@I@@I@hI@I@I@I@I@I@J@@J@PJ@xJ@J@J@J@J@ K@HK@PK@XK@`K@ @pK@K@K@K@L@@z`@z`@z`@z`@z` @z`0@z`@@z`P@z``@z`p@z`@z`@z`@z`@z`@z`@z`@z`@z`@z`@z` @z`0@z`@@z`P@z``@z`p@z`@z`@z`@z`@z`@z`@z`@z`@z`@z`@z` @z`0@z`@@z`P@z``@z`p@z`@z`@z`@z`@z`@z`@z`@z`@z`@z`@z` @z`0@z`@@z`P@z``@z`p@z`@z`@z`@z`@z`@z`@z`@z`@z`@z`@z` @z`0@z`@@z`P@z``@z`p@z`@z`@z`@z`@z`@z`@z`@z`@z`@z`@z``@0@@@@+@+@+@+@:GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-2)GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-2)GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-3)GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-3)GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-3)GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-3)GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-3)GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-3)GCC: (GNU) 3.4.6 20060404 (Red Hat 3.4.6-2).symtab.strtab.shstrtab.interp.note.ABI-tag.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.IA_64.pltoff.init.plt.text.fini.rodata.opd.IA_64.unwind_info.IA_64.unwind.init_array.fini_array.jcr.dynamic.data.ctors.dtors.got.sdata.sbss.bss.comment@#@ 18@8t7 @@? @ Go@To@pc@HmX@XP@P@@  )@)`  @ @`@`NpR@pRPS@PSp8h@8hw`ww`wx`xx`xz`zz`zz`zz`zr`PВ`В ȓ`ȓP`ȓXȓ]&!; @@8@@ @@@@ X@ P@ @ )@ @`@pR@PS@8h@w`w`x`x`z`z`z`z``В`ȓ`` ! P*@p p@  @@ -8z`Fz`Tx`aؒ`j *@p @+@ `ȓ`d`-z`z`!x`-@= l@Lؓ`X @r`8`P8` @W@ U@` /@@ @ @ 0@ 0N@` G@ / R@< `8@O @] `h@`u `.@P @@ @ 0@  @`  \@` .H`@ @`Q @l `0 p`@ ` @0 @x` @! 1 00@@? 0@pQ @t `i@@,   @ 0@ @p P.@@ P@2 O@: pa@Re`u 8@P 0@ @P @` 7@P @  p@P2pG`T @c @ v`  @` @ @ _@ p1@ @@ 0. @3x`D @@@Q`e @pt ``@`  p@ `` a@ @p.> @N ^@^ c@j @p~ g@@ P@  @@`00` @ @ `+  N@8  W@PN  z@m  p@ `  P@ @  (` `  @p  @`  @  ! `-  @p8 H  S@c  R@@w  @  @@@ `  @ @  @  @  @0  z@  @ &  @ 9  t@M 0`\  n  @` @ P`  @   p@0 @  `w@@  )@  @|@0 @+  @:  Y@I [  0@px  @  `Z@@   p,@  0@   #@  P@2  @O `_  '@m  `@@6 @   0M@ P z`(  0@  V@   `A@` @@" @3pG @`c`vp`  @`( 0@ T@P  @(0<` Jw`] y @`ȓ` 0 Б@\` t@ y@`* @\@0<`(Kw`\ "@l %@{ @  P@p  `@8z`( @ X` ^@" z`- @@> +@Z @f+v` @ @ @  @@ Z@ `z`@ @ @` @&`3 P@pG @ N`^ p@ rw` @  @0x` `:@(`  @p @ ) 0@ : P@ M @`]o `Q@ @ @ 0@H`  @p``  W@p" -@8R p@0d @P`ȓ` 0@ z`p` 0[@ @  @ F@2 @@pCVi p@{ p]@ 0@ H`($ @P3 @ G 0@aq p@`w`ē` @P @В`Г` @P( @3 @pFP[h`l 0@| @` @P 0@p` @@ p4@P@ # L@@2 @H @t@@Vz`c P@ y @  0@` p%w`; @L H@d@v `8@p PJ@ @   @gmon_initializer_init_fini__CTOR_LIST____DTOR_LIST____JCR_LIST__dtor_ptr__do_global_dtors_aux__do_jv_register_classeswrapper.cunknownBuffer.1seeded.0wrapperinfo.cwrappereventloop.cwrapper_unix.cjvmPidproperty.clogger.c__CTOR_END____DTOR_END____JCR_END__read@@GLIBC_2.2wrapperExecutewrapperDatagetLogfileRollModeForNameconsoleFlushqueueMessageslastLogfileActivitydescSignalwrapperRestartProcesskeyCharswrapperProtocolClosesetLogfilePathjStateLaunchdaemonizewrapperVersionBannerwrapperLogSignalledwritePidFilewrapperStopProcesswStateStartedwrapperBuildJavaCommandsigaddset@@GLIBC_2.2protocolStopServerwrapperGetSystemTicksmalloc@@GLIBC_2.2sigActionCommonsetSyslogLevelIntwStateStoppedcurrentLoginfoLevelwrapperRunServicelogFileLastNowDatechildOutputBuffercreatePropertiesreplaceStringLongWithShortsigaction@@GLIBC_2.2memcmp@@GLIBC_2.2threadMessageBufferSizeputenv@@GLIBC_2.2correctWindowsPathwrapperArchgetSignalModewrapperBuildUnixDaemonInfo_DYNAMIClog_printf_messagedup2@@GLIBC_2.2jStateKillinglogRegisterThreadwrapperLoadConfigurationPropertieswrapperBuildJavaCommandArrayInnergetrusage@@GLIBC_2.2setsid@@GLIBC_2.2__do_global_ctors_auxwrapperKillProcessNowwrapperStartedSignalledjStateStoppedrecv@@GLIBC_2.2sendLoginfoMessageappExitwrapperJVMProcessExitedopenlog@@GLIBC_2.2workLogFileNamereleaseProtocolMutexprotocolOpengetLastErrorTextdisposeLoggingremove@@GLIBC_2.2wrapperOSlockProtocolMutexwrapperSetJavaStateinet_ntoa@@GLIBC_2.2fgets@@GLIBC_2.2wrapperKillProcessinet_addr@@GLIBC_2.2queueWrappeddumpPropertiessetLogfileLevelIntconsoleFormatlimitLogFileCountHandleFileftell@@GLIBC_2.2propertieswStateStoppingvalidateTimeoutwrapperInitializeRunlogTimerStatscloseLogfilewaitpid@@GLIBC_2.2pipe@@GLIBC_2.2trim__fini_array_endgetLastErrorcurrentLogfileLevelgetLowLogLevelgettimeofday@@GLIBC_2.2sprintf@@GLIBC_2.2jvmOutchildOutputBufferSizelisten@@GLIBC_2.2setConsoleLogLevelInt__dso_handlecurrentLogFileNamewrapperSleepevaluateEnvironmentVariablesceil@@GLIBC_2.2__libc_csu_finiinitializeTimertimerRunnercreateInnerPropertystrcpy@@GLIBC_2.2wrapperBuildKeygetSyslogLevelIntlimitLogFileCountasctime@@GLIBC_2.2printf@@GLIBC_2.2packetBufferrollLogswrapperKeyRegisteredprotocolSendBufferSizewrapperUsagewrapperLogChildOutputensureSpaceInChildOutputBufferwrapperPingRespondedprotocolSendBufferumask@@GLIBC_2.2rand@@GLIBC_2.2getsid@@GLIBC_2.2wrapperBitslogFileMaxSizegetStringPropertyforceFlushwrapperGetWStatebind@@GLIBC_2.2logFilePathjStateDowntime@@GLIBC_2.2wrapperRequestDumpJVMStatewrapperGetLastErrorremovePropertylog_printf_queueInnerlogfileActivityCountanchorPollnanosleep@@GLIBC_2.2initLogginggetThreadIdwrapperSetWorkingDirwrapperReportStatussetLogfileAutoClosegetLogfileRollModewrapperDumpCPUUsagewrapperVersionstrchr@@GLIBC_2.2setConsoleLogLevelsend@@GLIBC_2.2timerTicksupdateStringValueexecvp@@GLIBC_2.2getLogfileActivityfork@@GLIBC_2.2wrapperGetProcessStatus_startwrapperReadChildOutputaccept@@GLIBC_2.2getIntPropertysendPropertiesmemset@@GLIBC_2.2wrapperStartPendingSignalledpthread_self@@GLIBC_2.2strcasecmp@@GLIBC_2.2wrapperRunConsolesrand@@GLIBC_2.2jStateStoppingdisposeInnerPropertypthread_mutex_unlock@@GLIBC_2.2jStateLaunchedsetLogfileMaxFileSizegetOutputFilterActionForNamelogFileRollModejStateStartedloadConfigurationopen@@GLIBC_2.2socket@@GLIBC_2.2wrapperGetFileBasefopen@@GLIBC_2.2protocolMutexloadPropertiesInnergetSignalCodeDescwrapperProtocolFunctionwrapperGetJStategetInnerPropertystrerror@@GLIBC_2.2wrapperStopPendingSignalledlogFileMaxLogFilesfclose@@GLIBC_2.2currentLogfacilityLevelfree@@GLIBC_2.2vsnprintf@@GLIBC_2.2__divdf3queueLevelssendEventlogMessagegetSignalNamepthread_equal@@GLIBC_2.2getBooleanPropertyglobfree@@GLIBC_2.2logfileFormat__fini_array_start__errno_location@@GLIBC_2.2__libc_csu_initqueueReadIndexcloselog@@GLIBC_2.2__bss_startchdir@@GLIBC_2.2strcmp@@GLIBC_2.2mainpipeInitializedwrapperDumpMemorysigActionChildDeaththreadMessageBufferregisterSigActionqueueThreadIds__init_array_endjStateLaunchingjStateStartingsetSyslogFacilityIntsetSyslogEventSourceNamekill@@GLIBC_2.2wrapperFreeJavaCommandArraylog_printfMutexsetConsoleFlushwrapperClasspathSeparatorwrapperStripQuotesdata_startcheckAndRollLogswrapperAddDefaultPropertiescommandPollglob@@GLIBC_2.2threadPrintBufferwrapperGetTickAgedisplayLaunchingTimeoutMessageflushLogfilesigActionAlarmlogLevelNamesmaintainLoggerwrapperUpdateJavaStateTimeoutsdsigActionInterruptlogFileUmaskinsertInnerPropertysetEnvqueueWriteIndexwrapperProtocolRead__preinit_array_endgetConsoleLogLevelIntwStateStartingexit@@GLIBC_2.2strrchr@@GLIBC_2.2threadPrintBufferSizeprotocolStartServerthreadIdssetConsoleLogFormatgetLogfileLevelIntbuildPrintBufferwrapperTickExpiredsetLogfileLevelstdout@@GLIBC_2.2wrapperParseArgumentshandleDebugJVMTimeoutsigActionHangupsigActionTerminationloginfoSourceNamerename@@GLIBC_2.2addPropertystrstr@@GLIBC_2.2pipedeswrapperRestartRequestedwrapperGetCurrentTimepthread_create@@GLIBC_2.2wrapperAddToTickspthread_sigmask@@GLIBC_2.2releaseLoggingMutexssd_edatasetLogfileMaxFileSizeInt_GLOBAL_OFFSET_TABLE__endsigActionQuitsetLogfileRollModecheckPropertyEqualwrapperStopRequestedsigemptyset@@GLIBC_2.2setLogfileFormatfprintf@@GLIBC_2.2__xstat@@GLIBC_2.2disposePropertiespthread_mutex_lock@@GLIBC_2.2signal@@GLIBC_2.2wrapperGetTicksfflush@@GLIBC_2.2getLogLevelForNamefcntl@@GLIBC_2.2strlen@@GLIBC_2.2queueSourceIdsgetpid@@GLIBC_2.2loadPropertiesgenerateLogFileNameregisterSyslogMessageFileputs@@GLIBC_2.2setSyslogLevelputchar@@GLIBC_2.2__init_array_startcurrentConsoleLevelwriteStateFilewrapperSetWrapperState_IO_stdin_used__libc_ia64_register_backing_store_baselockLoggingMutexlog_printfisQuotablePropertylocaltime@@GLIBC_2.2autoCloseLogfileaddPropertyPairsetSyslogFacilitywrapperBuildJavaCommandArraylinearizePropertieslogfileFPunregisterSyslogMessageFilewrapperProtocolGetCodeNameclose@@GLIBC_2.2unlink@@GLIBC_2.2wrapperDisposegetLogFacilityForNamewrapperGetPID__data_startsetLogfileMaxLogFilessetWorkingDirrealpath@@GLIBC_2.3__strdup@@GLIBC_2.2__strtol_internal@@GLIBC_2.2setInnerPropertytimerThreadId_Jv_RegisterClassesgetpwuid@@GLIBC_2.2syslog@@GLIBC_2.2__preinit_array_startlog_printf_queuewrapperStoppedSignalledmemcpy@@GLIBC_2.2wrapperEventLoopgetenv@@GLIBC_2.2wrapperInitializesetLogfileUmask__libc_start_main@@GLIBC_2.2__gmon_start__wrapperSetWorkingDirPropmule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/wrapper-linux-x86-640000755000175000017500000033066310567556635030344 0ustar charlescharlesELF>0@@hj@8@@@@@@@@@@ZZ``Q`Q`h(`(`Q(`Q@@ Ptd\>\>A\>AQtd/lib64/ld-linux-x86-64.so.2GNUyVA`qPoe%m#z^DtCLGgMH$xs{rd4w.!hkj vYF\_}Xf]@TIlcOK~|, uiQS   6";>&=/*)9?<B'JN80Wb[1E3U27-+aRn5p(Z:hQ^ dhQxQPgQfQ ''''"hhQV6yQ IgQM[HhQtsfQO'1Q yQs4fQ\D'`hQ@yQ hQ0lrlhQ] fQ'gQ`yQ.R P@yzhQ3gQ3gQ<FfQRgQ*'ahyQ]mpyQb!TVffQPks"fQ  gQmgQ(ZfQ@ gQ_ >'yQ(yQ XhQgQ @@d2PhQ7kFyQ(HzUhQ(efQ@hQ'' @k gQ@>fQ @AgQI g'=\hQRz'8hQ zQ l @L p@A #@zQ5xQ=fQA 0@Sp O@~Q(bJ 1.^phQ r(hQ0hQxQ ! libm.so.6_Jv_RegisterClasses__gmon_start__ceilpthread_createlibpthread.so.0waitpidrecvpthread_equalsendacceptnanosleepreadpthread_sigmaskforksigactionpthread_mutex_unlockpthread_selfpthread_mutex_lock__errno_locationfcntllibc.so.6putcharstrcpyasctimestdoutsigemptysetstrerrorgetenv__strtol_internalgetpidfgetsmemcpyglobputsdup2mallocremovevsnprintfsocketfflushfcloseputenvsigaddsetpiperenamestrrchrfprintfkillbindinet_addrchdirumaskstrstrsignalopenlogcloselogunlinkgetrusagestrcasecmp__strduplistengettimeofdaylocaltimememsetgetsidftellsrandinet_ntoasyslogstrcmpgetpwuidsprintfglobfree__xstatexitfopen__libc_start_mainstrlenstrchrexecvpsetsidrealpathwrapperDataconsoleFlushqueueMessageslastLogfileActivitykeyCharscurrentLoginfoLevellogFileLastNowDatechildOutputBufferthreadMessageBufferSizewrapperArchworkLogFileNamewrapperOSqueueWrappedconsoleFormatpropertiescurrentLogfileLeveljvmOutchildOutputBufferSizecurrentLogFileNametimerRunnerpacketBufferprotocolSendBufferSizeprotocolSendBufferwrapperBitslogFileMaxSizelogFilePathlogfileActivityCountwrapperVersiontimerTickslogFileRollModeprotocolMutexlogFileMaxLogFilescurrentLogfacilityLevelqueueLevelslogfileFormatqueueReadIndexpipeInitializedsigActionChildDeaththreadMessageBufferqueueThreadIdslog_printfMutexwrapperClasspathSeparatorthreadPrintBuffersigActionAlarmlogLevelNamessigActionInterruptlogFileUmaskqueueWriteIndexthreadPrintBufferSizethreadIdssigActionHangupsigActionTerminationloginfoSourceNamepipedesssdsigActionQuitqueueSourceIdscurrentConsoleLevelautoCloseLogfilelogfileFPtimerThreadIdGLIBC_2.2.5GLIBC_2.3 ui B ui ii ui aQaQaQaQaQ bQbQbQbQ bQ(bQ0bQ8bQ!@bQ"HbQ#PbQ'XbQ)`bQ,hbQ-pbQ/xbQ2bQ5bQ6bQ8bQ9bQ<bQ>bQDbQHbQLbQNbQPbQRbQWbQYbQZbQ[cQ]cQ^cQ`cQd cQe(cQf0cQj8cQk@cQlHcQmPcQnXcQr`cQwhcQxpcQ{xcQ|cQ~cQcQcQcQcQcQcQcQcQcQcQcQdQdQdQ dQ dQ (dQ 0dQ8dQ@dQHdQPdQXdQ`dQhdQpdQxdQdQdQ dQ$dQ%dQ&dQ(dQ*dQ+dQ.dQ0dQ1dQ3dQ4dQ7dQ:dQ;eQ=eQ?eQ@eQA eQB(eQC0eQE8eQF@eQGHeQIPeQJXeQK`eQMheQOpeQQxeQSeQTeQUeQVeQXeQ\eQ_eQaeQbeQceQgeQheQieQoeQpeQqeQsfQtfQufQvfQy fQz(fQ}0fQ8fQ@fQHfQPfQXfQ`fQhfQpfQxfQfQH{uH5 9% 9% 9h%9h%8h%8h%8h%8h%8h%8hp%8h`%8h P%8h @%8h 0%8h %8h %8h%8h%8h%8h%z8h%r8h%j8h%b8h%Z8h%R8hp%J8h`%B8hP%:8h@%28h0%*8h %"8h%8h%8h% 8h %8h!%7h"%7h#%7h$%7h%%7h&%7h'p%7h(`%7h)P%7h*@%7h+0%7h, %7h-%7h.%7h/%7h0%7h1%z7h2%r7h3%j7h4%b7h5%Z7h6%R7h7p%J7h8`%B7h9P%:7h:@%27h;0%*7h< %"7h=%7h>%7h?% 7h@%7hA%6hB%6hC%6hD%6hE%6hF%6hGp%6hH`%6hIP%6hJ@%6hK0%6hL %6hM%6hN%6hO%6hP%6hQ%z6hRH1I^HHPTI@H@H@HH3HtHÐ=6UHt$HH56H,6HHu6ffffffffUH=w/HtHt `QIAÐAT1SHHH51HHH5NL%O1H1ɺI<$TH 1H5iH1HI<$1H&H0H5OHH1I<$H1ɺI<$H561ɺI<$H5<1ɺʤHH[A\fS1HHHHL$HS㥛 H<$HH;HHH?HH)fSH[fffffffH1S8t)\t8H/H;H5w1GD[H/H;GD[fffH/H t1e|Hn1ffffffHH08ttH=0HffH5!/Ht1{H1+ffffffH\$Hl$Ld$H8H08t H-*0}tH\$ Hl$(Ld$0H8D$ 8Ht$HT$ EL%}.I $u@}1St 1hM $A1s|$DD$fAAOH0HAؾ111z +H-H1HH11虳HH1达Fffffff@HAwHHcHH5H=831H(3HHzHHyHHxHHvHHvHHtHHsHHrHH{HH|HH~HHuHHmHHiHHeHHgHH HH\HHXHHFHffffffffHH=-1HffffffHH=,1HffffffH\$Hl$HH-+HU8wDEurH\$Hl$HDE|D0Eu$MtNtOtGt ǂ0HU,ǂ4H\$Hl$HH AH\$Hl$1HH A1žHU`fffffffffAU1ҾATUSH(uH,f1H*ALl$HX8 ffffH=HD$HD$fD$H ,޺fft$LD$91wbqEH-*H}9_@}LMEA8E1L]HEK@EC$H1HǺI$I$13B(ǂFG11GHI$1uHI$1HChǃ0ǃ4ǃ,ǃ8tHPI$ǀX1ztH[A\fffffH=脟*H=Nd1}H=ע1H1[A\fffffff19ffffffH\$Hl$HLd$HHH߾/L$HPH.HEHHHIDH)H{HIHHB#LH$Hl$Ld$HfffffH)#H=ڻH01hffffffATSHHAI1 H=H=ʻH1 H=H1H=0H=fH1H=;L1H=TH1H=QL1 H=~9H=-H=!H= KH=H=H1^ $H=-H=yH=H [A\fffffffffffHl$Lt$HH\$Ld$ALl$H(HV:-tNL LRILH~HzEVHEDRHB H$Hl$Ld$Ll$Lt$ H(L-^ HBIMHzt~%HvA^HUYHQ HqH>1H>3HHMe$Hx[IMID$H5H1HyMIUB>HHtHHH>L+HIHxIEL+H5jL1I}HE^HEBDZHB fffffffffffSHPHH0uBMt7Nt2Ot-Gfft%Ht u>ǂ0ǂ4[HDEt[H r1鑲H 1yHfffHH1ԯ1H9ffffffAVI1LAUL-pATUSIU1ۋ8Hr茯IEDdE~2ImLcHhJ4>t L-HuIu9d[]A\A]A^HpB[t1\uHź1[]A\A]A^1H1[]A\A]A^1IffffffHS H81HH¾sYH[0S13@1HG;BH<Hǀ1oHH81/H HDEt!DP,EucH111_1Z1H1˭H=H7,[HmHfffS13?1HG;AH<Hǀ1nt[HkDHtH,tWH,11Q^1z1H1H5H,[HUHSHH11H9}%D@Hc<\t'"t LcA*9|Hc)H[]ÐA9~D<\t<"tLcA)\Hc(\Hc*"fffffffffffffffffLd$Ll$IH\$Hl$H(HAt(1D9}ffffHcI1EH-H]HHuH[]fffffH[]EH1荪HtHHLHAǀ4H9HLJ4H1H1dž4tHH Cǀ41fH LEEHfffAUATUSH=hHyH8iHWH*L-91Me $HcNWL< $*I0YYs,H 0BL#x~ImƅH[]A\A]1yHH8H`HWHH H*XKffAWAVAUATUSHHH|$xt$tH HH5H9蠌HHUHxHT$xHHD$tjHmH\$xH5H+HHtAHA)HI9Ht$xH.H5HHtAHA)HI9L$`AE1LD$HH|$HAT$H5K1L Ht$H1I9軋HH8H|$x-HH9H5 H%H9HL$HHIؾ1Ic)?LT$xIH|$xH5LpHvzH}HH5]pHzH}H5^1pzH}H[H5YoHzH}HYH5WoHzH}HWH5XoH}H5_HoHz1Gz 1yM4$H}H5;1Adž,oH}H5+AF8}M,$oI$AEDH1藾LD$HHI8pfH(L+IpBE9dE:HLAj(H-EH51H}fH;HHLj)L#I$H Dy(EH}H51eH;HHǐH3HVHDr(EH}H51eH;HHǠLIH}H5l1aeH;HHǨoL IH}H5MHe~!H}H51e="H}H5^eȺH-H]{(oH-H5H}e~!H}H5Хe="H}H5dȺiL5sL=H5I>M/dM'AH5I>A$dI/I>H5}A$fdII>H5sHdM/I>H5lA)dM'I>H5hAA$dI/I>H5aA$cII>H5ZcM/I>H5ZAcAIH5PI>cjM'I>H5D1cA$1I/1E(H[]A\A]A^A_H52HuHH Hޑ}~b1mHUǂBL9=LȉJPHב^B<9=LȉJ@H MHW1}HCLyy1}H]I<$H51`bC,H]HeC<}}1p}I$g1@rǂH19}H51}ǃ<Aǃ(ǃ$H}H5d1`H;HHǘL+Iq&H}H5?1`H;HHǀLI9HH51H8|`H;HHxLIx"LgH51I;>`H}HHKH]HH]MH}H5p`H}H5$W`~H)1{L%iH1{L%EH1`{L%!HM@H15{ǂHgH1{I$ǃ`fffffffffffAUATUSHHH;HXH11WHH1IZL-[IMDQEMEA9hL-1IuHcݹH~ H4I<$]tIULj HIL1!zH[]A\A]H-H]HCXHEHpXHxŶH%nHUI1HJHyL-sMMH-IqXH}\t!IEDXE]HHXHHl$H\$HHHHX(}u6u1H\$Hl$HfffH۞H1w1lHIH1wfffffHHH51H8[Ht8u 1HffHH4fffUSHHH-8HEu"ItGMH[]fffffH<1H%wHEIuffffHpxHd1HJH 1:fH5H1H1phHE]~1H5іH1òHھq141H[]ffffHa1XvHo11讵H[]fffff11eҼH]~*1 6HuH¾M1 H[]15fffffffffSHHu Lt&[H1uHLuڋ~X1x5H[m1f5HfffffffffUSHH- HEuSKƒM Шt31I*^Hs,14HHlj[]H[]ÐHQ1tHEH\$Hl$HH-sHEu!LtBMt^H\$Hl$HH+1پ`tHELuff1HMHEMu1I*^X胭,14Hl$HljH\$HSHHDEuKt4M[ffH1sHKuDE13HH1L(H)H3u14YH DEq[11Ҿ41>fff1Ҿe1¹H3~-X12[H¾M112a12fffffffAWAVAUATUSH(L|$L5Dt$Ll$H;u!H-}1V;;Ht$1ɺ7Dd$H-l1ۋ}Ht$1ɺu<L$t3ffL oLcC 1ɋ}Ht$説tLH-@HcAMDEEuuCwH Hc,HLdI8uqLLT$Dd$M)IiE)McLHH([]A\A]A^A_É葲HmHI1#qaLH0پ1pi1}jH(1[]A\A]A^A_H57{'3H=#6"1芺1 H=1ɺ 1ī-H=1ɺ 1裫11TfffH=1ɺ 1f/1+ 1Xh HH DEt:1dHH1oH=yH7DEu 1 Hω1~oڐ4Ht3t-Hfff8Ht9uHъfffffHffffffGHswHHcHHoHHdHcHhHiH7HaHHGfffffffffAWIAVIAUAATA USHffD踪H5LH蝪Hu8d/AyHLH[]A\A]A^A_1 nH5HL1HHHuRHǀH\$Hl$HfHqHHǂǂH\$Hl$HfUHHHIL1MlHsfffHl$Ld$ALl$Lt$AL|$H\$H8H-AIHEDDLHEHu)H\$Hl$Ld$Ll$ Lt$(L|$0H8ffffD~HUH\$HHl$Ll$ Lt$(L|$0HDLd$H8ffffD8HHE&H II1DmHE#fffffffffSHؗ1jH(H,H5H8NH5HH蘧Ht[ÐH5H聧HuH mHtH1jHz1hjH!1PjH18jH1 jH1jHI1iHy1iH1iHH1iH~1iH1uiH֘1]iH1EiH"1-iH1iH^y1h[H^1hfffH\$Hl$HLd$Ll$H(L%HII$DHtEtH/1f11譩H8v 81H HHHHH$H$HĨHz1qfH,ffffffHl$L|$IH\$Ld$Ll$Lt$H(H-HEHu8H$H$L$L$L$L$ H(HotHEDEHHT$`A}1fffffHEH5H9HIhà 1MuMLd$LPL蛟HI L肠Ht LmHt LXHHt HÀ; tH5L趜>H5L蟜1Ht1ɺ 1HHAL1d1VM"LH-6LeI$=u*1YLmHԕI1I,dH-LLuAIH5LǛH5L谛H5L虛H5L肛/H5ތLkH5،LTH5ьL=tcH5ʌL*tPH5ČLt=H5Lt*H5LtH5Lޚ1HtH5HAADH59L襚LMAaHZML\H_Lb1HLH.HKH7IL18bHLLbd#H1aHEH6La1:1QH5܊D$ LvH5ҊL_H5̊LH9PHIL1Ka1P9D$ L1@1I8zPH5GL17Lp1訧mHL1`MH5H1HH`yOHIL0HL1q`!ULHILHMMLH5LuHHXH5L՗uHH 0H5hL譗uH=H7H5KL腗uL rMAH5/L\LEMAffffffffff1H13*H HLtHÐ41411Ҿ41H*ffffffffffSH18H ,~*HGt[[91ffffffffffffH\$Hl$HLl$Ld$HHL-VIM^̓ƒ7 Ш48ǁ4DDEEH1^81!MEIH\$(Hl$0Ld$8Ll$@HHÃ6u׋4u͋,H5H1HHH5H;AH;H HHAoIuH9,b,H5H1蒙HHH5H;eAH;H HHpA IEH=,1]I}LJ4ffHPHAIU;\ XX;`<1HHVIE<tDEdH͐1\\GDǁXEtu$1HHL-M]EEHD\H1[H(ǂX HPHMMH1EX[IUL-9\fffffffffH\$Hl$HLd$HH AH3z̓7 Ȩt"DEuH5+HH8HtdH<1KZHt13Z817H-HEǀ,H$Hl$Ld$HH5xHHthH1YH̐H1Y1 81Hs1OHDH1rHP1贯1]H1EY1Eu#H L!A$~H!сကtALFA HzADID@HٿH1H)D4OOAHHI)IHHT$H$膊HLHT$LPLT$LHLL$ HpHt$(HH HL$0L@(LD$8Hh0Hl$@ЉHHUHfD&HA$AD!сကtALVA HyADID@HH1H)D4ONHp[]A\ffAW1AVAUATUSH(HlIHDLLLLLEAHfffHt-H:yH jEHDHy1NEHμAH DE1QH3DE1tH;DEHE1HsHDEGuDA8Av"1tL#E$EE1HHU1P16 HHHHDE1a:H ڻH;t"LHM"A${I$H5HLIJ1k:LHL-aI};IEIfHHI]Aċ%HIEIUH hH55wL ID4HELDLD$I9ID0Dd$EHDξ1HL$M)HIML$KHHJHkHD0Et:DEǀ0GtHM HDE4w3KHH9v1LAKHŹHu`AL%wAKcL1889ffuHHgHtfeHބH1jJHAwfffHuu18JHH9DEH([]A\A]A^A_fIIEsIUH qfLtH5Iˋ4H:MDL\$LA0IID1HL$LHMML,$rIHND1WIfHa18IDH8HH9DEH(H4t[]A\A]A^A_1HDHDHffDHcffDHsffsDHcDHSDHCDH3dA H H DEDH{s1DH1KH3DE-HesD1GfffHbs1GH(EHH1GH4PHpwHHB1-HHHHHDE#HH 1L+HAIHr1FfHL%H.1FI]DELHMuIHH&r1VFH1Hd=H 11ҾeʌH;DEAJHM1HHzHG1/HQHq1E4L Aǁ4$Hcq1fE11ҾeH;DEAJ>4USHHHHxHuJHHuVHHu^HHufHHurHHuz1蟐踀cHHHtfffKHHHt7HHHt#HHHtfff HHHt|fH觀HH\$Hl$HLd$HH`H5lHA辀DHCH۸tH5H1~Hn}1H$Hl$Ld$HffffffSH 1%F=|x[1H8H YI[1EfffffffwHHcHHkH1H1H0H/H/H/H/ffffffH#tD"H#t66u H ffffHt|%ǀtH$fffffHH'H*ffffHl$H\$H(HHH 7HuH\$Hl$ H(ffH ~1D}.}HH$DEH I1~D}uWuu}H~}HtH}zDEH\$}H A1<$%D>+}DEH K~I1C끾H tH\$Hl$ 1H(CHH/yH5HHuHffH=ѱH7H{H 5uH d1HeCfffHHDxHH}H0{tH =1HCHfffffffffUSHH|$H4$'y1HDŽ$y1҅u HĨ[]14H IA1BHĨ[]ffffHHp,uH Hfff1ffffffHSHuKHH=e11Dy1u[U4HI1x?[ÐH?|1X?ffffH5iS1t.HHD@,EH ͯH[H5;yuH5vduH5ɮOuH5,:zH5 !f\fff1unfffffffSi@BHH&H$HHD$HDEu 1HwHDEu:H[ÐH{1>1H|wHDEtHz1=H[fffffffffffAVAAUATU1SHH\$%HRvHUvHHvH;vH.vH!v11HxH HtfffE1Hݿd1LHII8HH)I8HH)EHuL-IULcJ4I9|NB0HH9iIUDEtH,$H-OH|IM1HM<cHAdH|Iʾ1[<HIÜH|IHTy1*< H|1 <ffffffAUATUSHL%I$H@hHtW1H8t61I<$HwhHt'fffH<$M9HLu>MuJLL;uELH\$Hl$Ld$Ll$ Lt$(L|$0H8fffHÈEHŀ;LLHRfffffffffffH1HHHyH HHy1fffffffff1fffffffffSOHwH!HcH [HOHH1H9 tH~H=l`H1zR1HffSH59H@OH58H$OtwH58_H Ot_H54HNtGH5_HNt/H5^HN tH5^HN҃[SH5P8HNH5^HtNH5^HXNtvH5^H@Nt^H5y^H(NtFH5^HNt.H5#7HMtH58HM1҅[fffSH57HMH5]HMH5]HMH5]HlMt|H5]HTMtdH5]H1X>ff;=LrI$I(EH\$Hl$؉Ld$Ll$1Lt$L|$HAH|$@AԉL$4M?HL$HIS㥛 H\$@H|$8HH\$8IHH?HHH)É\$,>EIH5s;.|L0rA;+|HtrH 9uCtH q;).H\$hHl$pLd$xL$L$L$HĘL BrAnH\$PD$PH\$H|$1HsH;|H5r HT$1LqH=qH7I;LLerA:]>LnqH5D$0I8LD$ >HrHH|$0">H;H)qL(1AEL%KqH= LH1I4$<1?LcǍGK,H-m G4G [configuration properties] [...] %s [configuration properties] [...] ( implicitly '-c') ( implicitly '%s.conf') ( implicitly '-c' and '%s.conf') where can be one of: -c --console run as a Console application -v --version print the wrapper's version information. -? --help print this help message is the wrapper.conf to use. Name must be absolute or relative[configuration properties] are configuration name-value pairs which override values in wrapper.conf. For example:wrapperRestartProcess() called. (IGNORED)wrapperRestartProcess() called.Filter trigger matched. Shutting down.Filter trigger matched. Restarting JVM.--> Wrapper Started as Console--> Wrapper Started as ServiceJVM process exited with a code of %d, setting the wrapper exit code to %d.JVM process exited with a code of %d, however the wrapper exit code was already %d.JVM process exited with a code of %d, leaving the wrapper exit code set to %d.Unexpected jState=%d in wrapperJVMProcessExited.JVM exited on its own while waiting to kill the application.JVM exited unexpectedly while stopping the application.JVM exited while starting the application.JVM exited before starting the application.JVM exited while loading the application.The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.wrapper.java.additional.%d.stripquoteswrapper.app.parameter.%d.stripquotesUnable to get information of classpath element: %s (%s)Classpath element, %s, does not match any files: %s-Dwrapper.timer_fast_threshold="%d"-Dwrapper.timer_slow_threshold="%d"-Dwrapper.timer_fast_threshold=%d-Dwrapper.timer_slow_threshold=%dClasspath element, %s, does not exist: %s------------------------------------------------------------------------The JVM is being launched with a debugger enabled and could possibly besuspended. To avoid unwanted shutdowns, timeouts will be disabled,removing the ability to detect and restart frozen JVMs.%s must be in the range 0 to %d days (%d seconds). Changing to %d.wrapper.logfile.inactivity.timeoutwrapper.port.min must be in the range 1-65535. Changing to %d.wrapper.jvm.port.min must be in the range 1-65535. Changing to %d.wrapper.java.library.path.append_system_pathwrapper.memory_output.intervalwrapper.restart.reload_configurationwrapper.max_failed_invocationswrapper.successful_invocation_timewrapper.request_thread_dump_on_failed_jvm_exitwrapper.logfile must contain "%s" for a roll mode of DATE. Disabling log file rolling.wrapper.jvm.port.max must be greater than or equal to wrapper.jvm.port.min. Changing to %d.wrapper.port.max must be greater than or equal to wrapper.port.min. Changing to %d.wrapper.logfile.rollmode invalid. Disabling log file rolling.wrapper.ping.interval must be at less than or equal to 1 hour (3600 seconds). Changing to 3600.wrapper.ping.timeout must be at least 5 seconds longer than wrapper.ping.interval. Changing to %d.CPU timeout detection may not operate correctly during shutdown because wrapper.cpu.timeout is not smaller than wrapper.shutdown.timeout.CPU timeout detection may not operate correctly during startup because wrapper.cpu.timeout is not smaller than wrapper.startup.timeout.CPU timeout detection may not operate correctly because wrapper.cpu.timeout is not smaller than wrapper.ping.timeout.wrapper.jvm.port must not equal wrapper.port. Changing to the default.wrapper.ping.interval must be at least 1 second. Changing to 1.The value of wrapper.max_failed_invocations must not be smaller than 1. Changing to 1.The argument '%s' is not a valid property name-value pair.Unable to resolve the full path of the configuration file, %s: %sUnable to open configuration file. %sProblem loading wrapper configuration file: %sUnable to set working directory to: %s (%s)Received a connection request with an incorrect key. Waiting for another connection.Incorrect key. Connection rejected.JVM signalled a start pending with waitHint of %d millis.JVM signalled a stop pending with waitHint of %d millis.JVM signalled that it was started.received unknown packet (%d:%s)socket read no code (closed?).set.WRAPPER_BITS=%sset.WRAPPER_ARCH=%sset.WRAPPER_OS=%sset.WRAPPER_FILE_SEPARATOR=/set.WRAPPER_PATH_SEPARATOR=:socket close failed. (%d)socket creation failed. (%s)UNKNOWN(%d)LOG(FATAL)LOG(ERROR)LOG(WARN)LOG(STATUS)LOG(INFO)LOG(DEBUG)PROPERTIESSERVICE_CONTROL_CODEPING_TIMEOUTLOW_LOG_LEVELBADKEYSTOPPEDSTARTEDSTART_PENDINGSTOP_PENDINGRESTARTSTOP127.0.0.1server listening on port %d.(Property Values)NULLsend a packet %s : %ssocket send failed. (%d)wrapper.logLPTMLPMUsage: %s %s to the location of %s wrapper.debug=true%s.confJVM requested a restart.Using tick timer.<-- Wrapper Stopped--> Wrapper Started as DaemonUsing system timer.JVM exited normally.JVM exited unexpectedly.Unable to start a JVMJVM already down.javawrapper.java.commandjdbjdb.exewrapper.java.additional.%d"--Xdebugwrapper.java.initmemory-Xms%dmwrapper.java.maxmemory-Xmx%dmwrapper.java.library.path-Djava.library.path="%s%c%s"wrapper.java.classpath.%d-Dwrapper.key="%s"-Dwrapper.port=%d-Dwrapper.jvm.port=%d-Dwrapper.jvm.port.min=%d-Dwrapper.jvm.port.max=%d-Dwrapper.pid=%d-Dwrapper.version="%s"-Dwrapper.native_library="%s"-Dwrapper.cpu.timeout="%d"-Dwrapper.jvmid=%dwrapper.java.mainclassMainwrapper.app.parameter.%d-Dwrapper.version=%s-Dwrapper.native_library=%s-Dwrapper.key=%s-Dwrapper.cpu.timeout=%dLD_LIBRARY_PATH-Djava.library.path=%s%c%s-Djava.library.path="%s\"-Djava.library.path="%s"wrapper.java.library.path.%d-Djava.library.path=%s-Djava.library.path="%s%c%s\"IGNORESHUTDOWNFORWARDwrapper.daemonizewrapper.signal.mode.hupwrapper.logfileSIZEwrapper.logfile.rollmodewrapper.logfile.formatINFOwrapper.logfile.loglevelwrapper.logfile.maxsizewrapper.logfile.maxfileswrapper.console.formatwrapper.console.loglevelwrapper.console.flushNONEwrapper.syslog.loglevelUSERwrapper.syslog.facilitywrapperwrapper.ntservice.namewrapper.unix.namewrapper.portwrapper.port.minwrapper.port.maxwrapper.jvm.portwrapper.jvm.port.minwrapper.jvm.port.maxwrapper.debugDEBUGwrapper.java.command.loglevelwrapper.adviserwrapper.timer_fast_thresholdwrapper.timer_slow_thresholdwrapper.native_librarywrapper.state_outputwrapper.timer_outputwrapper.loop_outputwrapper.sleep_outputwrapper.memory_outputwrapper.cpu_outputwrapper.cpu_output.intervalwrapper.disable_shutdown_hookwrapper.startup.delaywrapper.startup.delay.consolewrapper.startup.delay.servicewrapper.restart.delaywrapper.disable_restartswrapper.cpu.timeoutwrapper.startup.timeoutwrapper.ping.timeoutwrapper.ping.intervalwrapper.shutdown.timeoutwrapper.jvm_exit.timeoutwrapper.filter.trigger.%dwrapper.filter.action.%dwrapper.java.pidfilewrapper.java.idfilewrapper.java.statusfilewrapper.commandfilewrapper.command.poll_intervalwrapper.anchor.poll_intervalwrapper.umaskwrapper.java.umaskwrapper.pidfile.umaskwrapper.lockfile.umaskwrapper.java.pidfile.umaskwrapper.java.idfile.umaskwrapper.statusfile.umaskwrapper.java.statusfile.umaskwrapper.anchorfile.umaskwrapper.logfile.umaskwrapper.ignore_signalswrapper.use_system_timewrapper.statusfilewrapper.lockfilewrapper.pidfilewrapper.anchorfileWorking directory set to: %swrapper.working.dirGot key from JVM: %sGot ping response from JVMread a packet %s : %ssocket read failed. (%s) ymaUI=1h._.3..-----gggggwgkgyfyfZgyfyfyfyfyfyfFgFgFgFgFgFg0@@windowsx86323.2.3UNKNOWNSTOPPINGSTARTINGKILLINGLAUNCH(DELAY)LAUNCHINGLAUNCHEDw Set Java State %s -> %sAdvice:the Wrapper classes: %swithin the Wrapper: Loop: check anchor filer+tPAUSERESUMEDUMPCONSOLE_LOGLEVELLOGFILE_LOGLEVELSYSLOG_LOGLEVELLOOP_OUTPUTSTATE_OUTPUTMEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTTRUECommand '%s'. Enable %s.Command '%s'. Restarting JVM. Loop: check command fileCommand '%s'. Disable %s.wrapper.on_exit.%dshutdownwrapper.on_exit.defaultrestartLaunching a JVM...startupStart Application.ping Temp: Sent a ping packet.JVM Ping Failed.JVM exit Last tick overflow at: %s Next tick overflow at: %sno Loop: %ssleepfalseUnknown wState=%dUnknown jState=%dEvent loop stopped. Loop: maintain logger Loop: process jvm output Loop: process socket Loop: maintain logger(2) Loop: exit requestedEvent loop started.Sending stop signal to JVMe eee(e1e:eCediYI9&Unable to write to the status file: %s Set Wrapper State %s -> %s Set Java State %s Timeout %08lx -> %08lxStartup failed: Timed out waiting for a signal from the JVM.org.tanukisoftware.wrapper.WrapperSimpleApporg.tanukisoftware.wrapper.WrapperStartStopAppThe Wrapper consists of a native component as well as a set of classeswhich run within the JVM that it launches. The Java component of theWrapper must be initialized promptly after the JVM is launched or theWrapper will timeout, as just happened. Most likely the main classspecified in the Wrapper configuration file is not correctly initializingWhile it is possible to do so manually, the Wrapper ships with helperclasses to make this initialization processes automatic.Please review the integration section of the Wrapper's documentationfor the various methods which can be employed to launch an application http://wrapper.tanukisoftware.org/doc/english/integrate.htmlThe JVM was launched with debug options so this may be because the JVMis currently suspended by a debugger. Any future timeouts during thisJVM invocation will be silently ignored. DebugJVM timeout. Disable current %s timeout.Anchor file deleted. Shutting down.Command '%s'. Shutting down with exit code %d.Unable to delete the command file, %s: %sCommand '%s' is missing its log level.Command '%s' specified an unknown log level: '%'Command '%s' not supported on this platform, ignoring.Command '%s'. Requesting a Thread Dump.Command '%s'. Set syslog log level to '%s'.Command '%s' is unknown, ignoring.Unable to read the command file: %sCommand '%s'. Set console log level to '%s'.Command '%s' lead to an unexpected state.Command '%s'. Set log file log level to '%s'.JVM Restarts disabled. Shutting down.on_exit trigger matched. Service is paused, will restart the JVM when resumed. (Exit code: %d)on_exit trigger matched. Restarting the JVM. (Exit code: %d)Waiting %d seconds before launching another JVM.Waiting %d seconds before launching the first JVM.There were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.JVM was only running for %d seconds leading to a failed restart count of %d.com.silveregg.wrapper.WrapperSimpleAppThe com.silveregg.wrapper.WrapperSimpleApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperSimpleApp class instead.com.silveregg.wrapper.WrapperStartStopAppThe com.silveregg.wrapper.WrapperStartStopApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperStartStopApp class instead.Reloading Wrapper configuration...Startup: Timed out waiting for a signal from the JVM.Unable to send the start command to the JVM.Startup failed: Timed out waiting for signal from JVM.Ping: Timed out waiting for signal from JVM. Temp: Sending a ping packet.JVM appears hung: Timed out waiting for signal from JVM.Shutdown: Timed out waiting for a signal from the JVM.Shutdown failed: Timed out waiting for signal from JVM.Shutdown: Timed out waiting for the JVM to terminate.Shutdown failed: Timed out waiting for the JVM to terminate. Last system time tick overflow at: %s Next system time tick overflow at: %s Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%s Loop: handle jvm state: %s Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (N/A), Exit=%s, Restart=%sPause reading child output to share cycles.Pause reading socket data to share cycles. Loop: handle wrapper state: %sWrapper Process has not received any CPU time for %d seconds. Extending timeouts.%d Dumping JVM state.Could not dump JVM state: %sSIGCHLDSIGHUPSIGINTSIGQUITSIGKILLSIGALRMSIGTERMtimer expiredAIO completedqueued SIGIOkill, sigsend or raiseunknownmesq state changedthe kernelsigqueueSignal trapped. Details: signal err=%d, "%s"Launching Timer thread. Sleep: nanosleep %dms Sleep: awakeTimer thread started.Command[%d] : %sCould not init pipe: %sUnable to start JVM: %s (%d)%s trapped, but ignored.%s trapped. Restarting JVM.%s trapped. Shutting down.JVM did not exit on request./dev/nullsetsid() failed: %sSpawning daemon process...-helpv-version-console Unrecognized option: -%s c~s~{~~c~c~c~c~c~~c~c~c~c~~~c~k~ signal number=%d (%s), source="%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s)Signal trapped. No details available.Timer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.Timer thread received an Quit signal. Ignoring.Unable to register signal handler for signal %d. %sUnable to create a timer thread: %d, %s Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ldThe timer fell behind the system clock by %ldms.The system clock fell behind the timer by %ldms.Could not mask signals for timer thread.Unable to set JVM's stderr: %sCould not spawn JVM process: %sUnable to write the Java ID file: %sUnable to set JVM's stdout: %sUnable to write the Java PID file: %sFailed to set jvm output handle to close on JVM exit: %s (%d)Failed to set jvm output handle to non blocking mode: %s (%d)Call to getrusage failed for Wrapper process: %sCall to getrusage failed for Java process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldJVM exited in response to signal %s (%d).Unable to request JVM process status: %sWIFEXITED indicates that the JVM exited abnormally.Received SIGCHLD, checking JVM process status.JVM process was still running after receiving a SIGCHLD signal.Failed to read console output from the JVM: %s (%d)%s trapped, but signals for timer thread are ignored.%s trapped. Forcing immediate shutdown.Unable to forward %s signal to JVM process. %s%s trapped. Forwarding to JVM process.%s trapped. Unable to forward signal to JVM because it is not running.JVM did not exit on request, terminated Attempt to terminate process failed: %sSpawning intermediate process...Could not spawn daemon process: %sUnable to get the path for '%s'-%sUnable to set working dir to %s : %sUnable to extract path from: %sERROR: Could not write anchor file %s: %sWARNING: Could not write lock file %s: %sERROR: Could not write pid file %s: %s%s=%sset.default.set.#include name:%s value:%sUnable to set environment variable: %s The following property name value pair is too large. Need to increase the internal buffer size: %sNONE DEBUG INFO STATUSWARN ERROR FATAL ADVICESIZE_OR_WRAPPERSIZE_OR_JVMDATEFATALERRORWARNLOCAL0LOCAL1LOCAL2LOCAL3LOCAL4LOCAL5LOCAL6LOCAL7%04d/%02d/%02d %02d:%02d:%02d%cjvm %-4d.%s-YYYYMMDD_YYYYMMDD.YYYYMMDD-ROLLNUM_ROLLNUM.ROLLNUM????????%04d%02d%02dWARNING - Encountered an unknown thread %ld in getThreadId(). %04d/%02d/%02d %02d:%02d:%02d.%03dUnable to delete old log file: %s (%s) Unable to rename log file %s to %s. (%s) Unable to rename log file %s to %s. File is in use by another application. Unable to get the current logfile size with ftell: %s Unable to get the current logfile size with stat: %s Unable to open logfile %s: %s RF/z# l=ڦDKKR=;tD4T$lDdd,Tl$$D4$Tlt 4  T  t # $ t% %, &L &d 4'| 9 ; < D< T<$ d<< d? ? @ A DE, ED F\ F G tH I K M, TNL TUt U U U V TY [\,]Ld^d``a$beo,dpLtpdpTqq$rdss4tt4tLdudDv|vxdzt}},}D~\|TdĂD$ąD\dtč<ԎTlTT<\ԘD4tLdę|tĜ Ԝ$<4TlTdt4ĠLd4Tt Ģ$Ԣ<T4lDTtģԣ,D\Dtԧ4DTt,D\DtDD$DD|4dDzRx XBCD`<FAI \8HtgDgS@X5HDDN $ xBNA A(DP$40UVQ@\hEHtyJL AxVBFD JL  (ABAG <XJY0\AtP'K,hBOI A(A0(0H@A(AADG $P<HuJQ0\ADF $|BBA A(D@4PBBB B(A0A8GYJQ0qN `yAEG 4S T@7AlhQD4BPB B(A0A8G$/BBA A(D00D 1$01 ,(1D 1N \1<Dt1AAG0P3tA3AAF (4N 4&A45DBBB B(A0A8D`49HLH9t4d9BEE E(G0A8D@(:JP0:N $;$JMQ@<,A>@JQ04?7Q$TAJ^|GPFHH=A0H(HDJQPXKJL MN 4pNADD T0ON lOAAG xQN @RN SSC$PSBAA D4V BDB B(A0A8D`4 P`ACD T aDl awJN  haVA aW aj Pb@N0 xckD cSD dzACG< xd'T dzHl dH eAJ , PfBMB A(C0G$ gBBA A(D@ hiBAA  Xl4 PlL Hl9Gd pmJP0 `ndD n nS 4 0oBBB B(A0A8G  pzAJF , qwJK L xsLN d sAN | sAN  tD u=A 0wAAJ  wU  z>ADD $ zBDD D P{2D\ x{.A4t {BDE B(D0A8G$ |7BDD G ~"D (~@ADD  H~\A$~JL DBDA $dJMQ@4WBOB B(A0A8G0$(JMRЃA؃IADG <#AT &l8D@0A4XBEE B(A0A8FP$TQ@xC, AD=D\؆AtpA(AJL     x$ <x TpD,lxBEB A(A0X P HPDXD`FA, D>D\t  D   D 4DLd&4|ȊBEE B(A0C8Fp ]U `XDPDXD4`LXdPN ,|ȏNBBA A(G$Ef@,pBBB D(K0G@JT$$J_4LhBBB E(A0A8N$VQ@4,BEB E(G0A8Nb@@VJP $9ARL B *@ x@@@@@  cQ"@@ o@ooR@(`Q*@*@+@+@&+@6+@F+@V+@f+@v+@+@+@+@+@+@+@+@+@,@,@&,@6,@F,@V,@f,@v,@,@,@,@,@,@,@,@,@-@-@&-@6-@F-@V-@f-@v-@-@-@-@-@-@-@-@-@.@.@&.@6.@F.@V.@f.@v.@.@.@.@.@.@.@.@.@/@/@&/@6/@F/@V/@f/@v/@/@/@/@/@/@/@/@/@0@`Q@XA`AdAgA::A:A:A:A:A:A:A:AGCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)GCC: (GNU) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3).symtab.strtab.shstrtab.interp.note.ABI-tag.hash.dynsym.dynstr.gnu.version.gnu.version_r.rela.dyn.rela.plt.init.text.fini.rodata.eh_frame_hdr.eh_frame.ctors.dtors.jcr.dynamic.got.got.plt.data.bss.comment@#@ 1@@@h7 @ ?@GoR@R*To@pc@m"@" w*@*r*@*@}0@0hx@x@E\>A\>XDAXDD`Q``Q` `Q `(`Q(`aQacQcfQf `gQ`g `g{iq%5 X[@@@@@@R@@@ "@ *@ *@ 0@ x@@\>AXDA`Q`Q `Q(`QaQcQfQ`gQ <0@`Q*`Q8 `QEfQI`gQU `0@k 0@w`Q`QZA `Q @@gQgQfQ&/ @>hQJb^x @ dhQxQPgQ @@ B@fQ 2@g. @= @J @=Ts ?@ p<@y Ю@w 5@ @ @' '0'D 1@W'i y@ @w @  P@hhQ pE@yQ gQ M" @@"3 @NHhQf F@ytfQ c@y Pd@(`Q @'1 Q" @S0 0@ B 0x@e PJ@ @ @& @@ @ @ `G@ yQ 5@ 2@g( @9 @H4\fQf 5@xD І@$ @z'`hQ @0 @ @yQ  @hQ( @=7 0e@QG @\p @ @F @`Q @lhQ p@&  fQ'&=gQS @ ifQv`yQ @ `@ @9 @@zR P@ @2  `I@  @ '  @9 zP d hQq  @Nz    {@ gQ  ?@A  PC@  @$  @}@t9 gQL <_  *@e fQq gQ '  0@   @  @H hyQ  `@D   P@V  @.  @\=  @S pyQh  p@7s  T   @C  P@=  z@  @  @   @ 1 fE  @9Y fQh k{ "  @  fQ  Pc@q  p@  0@  0@  `@ 0  E  @#T  @D@0c  }@  pD@  `@  0@.  @  @@  d@7  gQ @* e@< >@OagQ(o @W @j 9@U @t @> P~@fQ@- gQE `t'yQ( @ @W @&yQ `Q @V#XhQ2`gQ> @CgQS @ey @@dPhQ @zkyQ(`Q 0@ @ @ & P@?Sg~ F@uhQ( @ fQ @F@ fQ @ 0@ @+@hQ= pz@$O @,n x@t 0@>' @k gQ@ @ @ fQ  @A gQ- `@A @H \'n=\hQ P@D`Q @  @P'/8hQE 6@Y zQ c p@w @  @ z@  @ @@ 0@@ @L# p@A8 K@zQ] `@ixQq C@' 1@F z@ @fQ`gQ P@ cQh~Q 0@Sp% C @ V P@Ii <@E~ @ p@@ @' @@@~Q( P@ 0@]J* @D @S e.`QphQ p@ @ @ @ @ @2(hQC `@S 0@e a@Y P@0hQ @ `4@5 >@ @$ л@2fQ? `@ U P@cw @7xQ `Q @, <@ P@  =@V  @ !3 B P{@<call_gmon_startcrtstuff.c__CTOR_LIST____DTOR_LIST____JCR_LIST__p.0completed.1__do_global_dtors_auxframe_dummy__CTOR_END____DTOR_END____FRAME_END____JCR_END____do_global_ctors_auxwrapper.cunknownBuffer.1seeded.0wrapperinfo.cwrappereventloop.cwrapper_unix.cjvmPidproperty.clogger.cwrapperExecutewrapperDatastrcasecmp@@GLIBC_2.2.5globfree@@GLIBC_2.2.5getLogfileRollModeForNamepthread_self@@GLIBC_2.2.5consoleFlushqueueMessageslastLogfileActivityexecvp@@GLIBC_2.2.5descSignalwrapperRestartProcesskeyCharswrapperProtocolClosesetLogfilePathjStateLaunchdaemonize__libc_start_main@@GLIBC_2.2.5fork@@GLIBC_2.2.5wrapperVersionBannerwrapperLogSignalledwritePidFilewrapperStopProcesswStateStartedwrapperBuildJavaCommandgetrusage@@GLIBC_2.2.5read@@GLIBC_2.2.5chdir@@GLIBC_2.2.5socket@@GLIBC_2.2.5protocolStopServerkill@@GLIBC_2.2.5wrapperGetSystemTickssigActionCommonsetSyslogLevelIntwStateStoppedcurrentLoginfoLevelftell@@GLIBC_2.2.5wrapperRunServicelogFileLastNowDatechildOutputBuffer__xstat@@GLIBC_2.2.5createPropertiesreplaceStringLongWithShortthreadMessageBufferSizecorrectWindowsPathputenv@@GLIBC_2.2.5wrapperArchgetSignalModewrapperBuildUnixDaemonInfo_DYNAMIClog_printf_messagegetsid@@GLIBC_2.2.5sigemptyset@@GLIBC_2.2.5sigaddset@@GLIBC_2.2.5jStateKillinglogRegisterThreadwrapperLoadConfigurationPropertieswrapperBuildJavaCommandArrayInnerwrapperKillProcessNowwrapperStartedSignalledjStateStoppedsendLoginfoMessageappExitwrapperJVMProcessExitedworkLogFileNamereleaseProtocolMutexprotocolOpengetLastErrorTextdisposeLoggingremove@@GLIBC_2.2.5wrapperOSlockProtocolMutexsrand@@GLIBC_2.2.5wrapperSetJavaStatewrapperKillProcesspipe@@GLIBC_2.2.5queueWrappeddumpPropertiessetLogfileLevelIntconsoleFormatlimitLogFileCountHandleFilepropertieswStateStoppingvalidateTimeoutwrapperInitializeRungetenv@@GLIBC_2.2.5malloc@@GLIBC_2.2.5logTimerStatscloseLogfileaccept@@GLIBC_2.2.5trim__fini_array_endgetLastErrorcurrentLogfileLevelgetLowLogLevelglob@@GLIBC_2.2.5jvmOutsetsid@@GLIBC_2.2.5sigaction@@GLIBC_2.2.5childOutputBufferSizesetConsoleLogLevelInt__dso_handlecurrentLogFileNamewrapperSleepevaluateEnvironmentVariables__libc_csu_finiinitializeTimerceil@@GLIBC_2.2.5timerRunnercreateInnerPropertywrapperBuildKeygetSyslogLevelIntlimitLogFileCountnanosleep@@GLIBC_2.2.5fclose@@GLIBC_2.2.5packetBufferrollLogspthread_create@@GLIBC_2.2.5pthread_mutex_lock@@GLIBC_2.2.5wrapperKeyRegisteredprotocolSendBufferSizewrapperUsagewrapperLogChildOutputensureSpaceInChildOutputBufferwrapperPingRespondedprotocolSendBufferfcntl@@GLIBC_2.2.5_initwrapperBitslogFileMaxSizelisten@@GLIBC_2.2.5getStringPropertystrlen@@GLIBC_2.2.5forceFlushwrapperGetWStatelogFilePathjStateDownrand@@GLIBC_2.2.5wrapperRequestDumpJVMStatewrapperGetLastErrorremovePropertylog_printf_queueInnerlogfileActivityCountanchorPollinet_ntoa@@GLIBC_2.2.5__strdup@@GLIBC_2.2.5strcpy@@GLIBC_2.2.5initLogginggetThreadIdwrapperSetWorkingDirwrapperReportStatussetLogfileAutoClosefprintf@@GLIBC_2.2.5getLogfileRollModememcpy@@GLIBC_2.2.5wrapperDumpCPUUsagewrapperVersionfgets@@GLIBC_2.2.5strcmp@@GLIBC_2.2.5setConsoleLogLeveltime@@GLIBC_2.2.5timerTicksupdateStringValuegetLogfileActivitywrapperGetProcessStatus_startwrapperReadChildOutputcloselog@@GLIBC_2.2.5asctime@@GLIBC_2.2.5getIntPropertysendPropertieswrapperStartPendingSignalledwrapperRunConsolejStateStoppingdisposeInnerPropertyjStateLaunchedsetLogfileMaxFileSizegetOutputFilterActionForNamefflush@@GLIBC_2.2.5logFileRollModejStateStartedloadConfigurationwrapperGetFileBasesend@@GLIBC_2.2.5protocolMutexloadPropertiesInnergetSignalCodeDescwrapperProtocolFunctionwrapperGetJStategetInnerPropertyrecv@@GLIBC_2.2.5wrapperStopPendingSignalledlogFileMaxLogFilespthread_sigmask@@GLIBC_2.2.5currentLogfacilityLevelpthread_equal@@GLIBC_2.2.5printf@@GLIBC_2.2.5localtime@@GLIBC_2.2.5rename@@GLIBC_2.2.5queueLevelssendEventlogMessageopen@@GLIBC_2.2.5getSignalNamegetBooleanPropertylogfileFormat__fini_array_start__libc_csu_initqueueReadIndex__bss_startmainpipeInitializedwrapperDumpMemorysignal@@GLIBC_2.2.5sigActionChildDeaththreadMessageBufferregisterSigAction__strtol_internal@@GLIBC_2.2.5queueThreadIds__init_array_endjStateLaunchingjStateStartingsetSyslogFacilityIntsetSyslogEventSourceNamestrchr@@GLIBC_2.2.5memset@@GLIBC_2.2.5vsnprintf@@GLIBC_2.2.5wrapperFreeJavaCommandArraylog_printfMutexsetConsoleFlushwrapperClasspathSeparatorwrapperStripQuotesdata_startcheckAndRollLogswrapperAddDefaultPropertiescommandPollthreadPrintBufferwrapperGetTickAgedisplayLaunchingTimeoutMessage_finiopenlog@@GLIBC_2.2.5flushLogfilestrerror@@GLIBC_2.2.5unlink@@GLIBC_2.2.5sigActionAlarmlogLevelNamesmaintainLoggerwrapperUpdateJavaStateTimeoutsdsigActionInterruptlogFileUmaskinsertInnerPropertysetEnvgetpid@@GLIBC_2.2.5dup2@@GLIBC_2.2.5strrchr@@GLIBC_2.2.5queueWriteIndexwrapperProtocolReadwaitpid@@GLIBC_2.2.5__preinit_array_endexit@@GLIBC_2.2.5getConsoleLogLevelIntwStateStartinggetpwuid@@GLIBC_2.2.5bind@@GLIBC_2.2.5threadPrintBufferSizeprotocolStartServerthreadIdssetConsoleLogFormatgetLogfileLevelIntbuildPrintBufferwrapperTickExpiredsetLogfileLevelsyslog@@GLIBC_2.2.5sprintf@@GLIBC_2.2.5wrapperParseArgumentshandleDebugJVMTimeoutsigActionHangupsigActionTerminationumask@@GLIBC_2.2.5loginfoSourceNameaddPropertypipedeswrapperRestartRequestedwrapperGetCurrentTimewrapperAddToTicksreleaseLoggingMutexssd_edatasetLogfileMaxFileSizeInt_GLOBAL_OFFSET_TABLE__endsigActionQuitclose@@GLIBC_2.2.5__errno_location@@GLIBC_2.2.5setLogfileRollModecheckPropertyEqualwrapperStopRequestedsetLogfileFormatpthread_mutex_unlock@@GLIBC_2.2.5disposePropertieswrapperGetTicksgetLogLevelForNamequeueSourceIdsloadPropertiesgenerateLogFileNameputs@@GLIBC_2.2.5registerSyslogMessageFilesetSyslogLevelfree@@GLIBC_2.2.5gettimeofday@@GLIBC_2.2.5__init_array_startcurrentConsoleLevelwriteStateFilewrapperSetWrapperStatefopen@@GLIBC_2.2.5putchar@@GLIBC_2.2.5_IO_stdin_usedlockLoggingMutexlog_printfisQuotablePropertyautoCloseLogfileaddPropertyPairsetSyslogFacilitywrapperBuildJavaCommandArraylinearizePropertieslogfileFPunregisterSyslogMessageFilewrapperProtocolGetCodeNamestrstr@@GLIBC_2.2.5wrapperDisposestdout@@GLIBC_2.2.5getLogFacilityForNamewrapperGetPID__data_startsetLogfileMaxLogFilessetWorkingDirrealpath@@GLIBC_2.3setInnerPropertytimerThreadId_Jv_RegisterClasses__preinit_array_startlog_printf_queuewrapperStoppedSignalledwrapperEventLoopwrapperInitializesetLogfileUmaskinet_addr@@GLIBC_2.2.5__gmon_start__wrapperSetWorkingDirPropmule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/wrapper-hpux-parisc-320000755000175000017500000056030010553776311030777 0ustar charlescharles@"K@Xx>h@G(U@0 `"H  92453-07B11.38D o 92453-07B11.16.01? D=@(#)$Revision: 92453-07 linker linker crt0.o B.11.38 031218 $@ `HX"LX H!HtX!"X  >` >`X 8UX H#cX I%eX X%e(>(0@`>(0@<>( 0@P>(0X@Xh>(1`@`t>(&1p@p >('4h0@h0>((4@>(R@ >H@>IY U? 0@> `@ $PRIVATE$$DLT$$PLT$ $SHLIB_DATA$$TEXT$ $SHLIB_INFO$ $DATA_START$ $MILLICODE$$CODE$$LIT$$UNWIND_START$$UNWIND$MILLICODE$$UNWIND$ $UNWIND_END$$RECOVER_START$$RECOVER$MILLICODE$ $RECOVER$ $RECOVER_END$ $PFA_COUNTER$$PFA_COUNTER_END$$DATA$ $SHORTDATA$$GLOBAL$ $SHORTBSS$$BSS$ $GDB_DEBUG$ $GDB_SYMBOLS$ $GDB_STRINGS$00$ 08@0D@0 T@"K0` @0 l @0>H #h "0  @0  @0  @  " #4 U@' #h  @4+U"0 0 @!0 @*0 8#0 P@#0 @*$ D#0 @#0 (@$0 8@$0 HU0 \c0 le0 e0 @0 @0 @0>80 @0  @0  @0  @0 @0, @ P`$' lp x@.s %  @p A%7 @-   Q'o0< @l0P @h0d @d0t @`0@H0@)0>X@0@) 0 @-s @- @. @- $@-@@@0=@$@04@*0>e0>,@*`0d @l0x @h0 @d0 @` 4/P H/0 X@. d@.3 p@.S |@. @. @. @/U-@ @ P`/o @ 0O A0 0 Q20@L0@0@ 3C 4  @ U(-X $@50 |@5 4@50 @50 T@* 0 d@*,0 Tt@0  @, h U> UP50 Q@0  @00 @ U@X0 Q@c ,0  @\ U (@0 Q@C0 0 @8  H 0 H@  ,3  8@ P3@ \ U`@p0 l@ h, t,0 @>+ D0 P@ #  %, %  D0  @@ ,4 + -      (0 414 @ L&x UdP8@ X5 d5 p% |%0 @0 A@@ 2  % %\ $t @<0  @( U Kp0 U@  %  % ( &  ( 4 @ L Xl d( p% |  @ % ) ) )< ) ) | * + d + $+ 0D <&$ H, T&@ `,@ l,X x&X ,l &` *  *h \ ) )t  )T ) < *   ,*  8*8 D& P&  \ h*P t'@  `   & ( & # # # #\ $ ($ & % (D (% 4#8 @# L' X' d' p$ |$ $ & $ 'X $X $8 'p ' $ ' '  # " $" 0" <! H!l T!L `!, l! x           t  L  %h ! ! ! " %8  " ,"` 8"D D%@ P& \& h( t( ( " " ! (\  ( X P (  p . / ( 408 @ L- X- d- p |/     .<  P . , .( /,   . $ 00 <1 H4@ T4H `4L l4t0 , @4 x4 4 5< 5 5 5 UHB 5 4 4 3 2  2, 2 2  2 ,2 830 A\@ D3l P3 t@  \3 h.L t1t   ,  -|     , -,  - , ( 4$ @ L0 X d- p |-` -D t P @    0 h0 @@ s UB U8K0 @>0 @0 @@I0 @+0 (@0 @@0 AX@;0 p@0 @0 @c0 A@{0 @@J0 T@  U0  @ U 7 U,B |  F| U8v0 D@0 \@0 x@c O0 @0 A@L $x 0< <H H T$ `| l} x~, }4 z z y y0 w xD l n lt n@ q c  q ,c, 8gh Dp Pn \pP hg tj o k o l r$ b rt u v v4 wh w w x (u 4u( @uT Lb\ Xj@ dr p` |s t t o  UHK :t 9 :@ 7 70 @ U8X0 @_#0 @8s U  < U#H`8 Y( V W8 V V M ND M\  N U#X5 ,J  8J40 #h@ DI\ PS \Y hQ0 #@ t\P ^l ] ^T ^$ [ PL [` Q Z Q Y I0 A#@ H  E (E 4A @B LB< XBt dA@ pB$ |A A U#@7 >P > E E E H0 #@`# G F D  F(  FP E $F 0E < < 0 #@5 < <~ <x <` 0 #@ <v H0 $@{0 A$4@0 A$L@ <~0 A$d@c0 $|@{ <}x0 $@#0 $@ <5 <8p < <>(0 @$@0 $@~0 @%@~0 %0@y0 %L@}{0 %h@GK <w0 %@H0 %@y <t <w <uh <u <sh <x0 %@B <{0 P%@~3 <z0 %@};0 &@{ <zh0 &$@z0 &D@zk <r H6 X? 60 +$@3 6\ 6h 6H 6T @> > 4> L> ; U+<(0 +H@S0 +\@ U+xX0 P+@ U+ A 70 +@0 +@ U+@ (E| = = &\Ed D &hD D &tE$ =l =x = C = <0 X; TB Bh DP B D< D  D < & 7 & ;p L;h < ;` ;\ ( C A C DC A A| At  AP ,Cx HC\ 0B Bp B lB BH B( A A A @ @ = ?( xB (>t 8E >L |> = \= ? @ p@ |@p @X @D @ ? ;< : B 8 8 8p 60 8( $7 @7 6< (7\ 74 6p 7 6x 6 6 p6  9H 9` U+p  U+80 + @H @F 4F $Fh 9 49 @9h `F H6  6 F  E :4 : :| : &\ &| & &\ &D & &@0 ,@ & &$0 ,(@0 ,D@ ' 'l ' '( '4 '@ 'L 'X 'd 'p '| '4 '4 '  <t '| 'd ' ' ' ' ', (  (  | ( D ($H (0 (< (H4 (T (`| (l  (x| (` ( ` ( (X ( ( ( ( (x ( (L ) ) )  ),  4 )8 )D8 t )P )\0 @,h@0 ,|@ף 4 )h0 @,@ )t )t ) H ) ) ) ) )| )( U,(0 ,@C0 ,@ʣ0 ,@S0 ,@0 -@S0 -,@k0 -D@0 -\@c0 U-t@0 @-@[0 -@0 -@0 -@; ) )  0 ) \L * * D  * *( @  *4p *@ *LX0 -@  *X *d *p *|P   ` * * D * * * * *x * * *H U- d +  +   +8 <x < <` < < <0 @-@0 @.@; <80 @.@0 @.0@{ <0 < <@ <X < < <P0 @.D@0 @.X@+ < < < < < <X <0 .l@[0 .@ <(0 .@0 .@# G 0 1 @d0 1 @h . @P J8 J40 1 @`0 1@ O0 1 @T U1 X L M< Mp M0 1@* @K K L M M G< U1@@ N G$ L P Ld G Gh GP GD G4 G, G G (O \N  Gx U28 U20۸ U2$( U20H0 2@@30 2L @X0 2`@# U2p0  U2|H pF |N HH( 0LH H (H N  @ @| G G LO\ J @x U2Ͱ J @H $Hl @I Kd KD K, p @t 4I  @p I J J< pJd K   @ I LK|  @l HP XL L< O$ XO( H H I I8 Il (K P0 L L P 4Q 4O N, N Pd \NT QD @O xP @P U2  U2 U2 U2ɸ .L U2pp U2h .ژ .X0 2@C 8H .< U3 0p0 @3@ . /֘ /Ҡ / /( *p /4Ќ  /@ /Lм /X /dД /p /|X /` / /H / &4 / /Հ /< / / /X 0 0 H 0 L U30x0 3<@  UX( U3L U3Xp0 P3d@ 0$p ),P U3|80 3@ Upʈ 00 U3 U3@ U3h0 3@; 0<@ U3`0 3@ U38 ) U4X8 U4 0 P4@C0 P4,@s0 P4@@ 0 0H¨ 0Tʄ 0` 0l4 0x 4 0X tܨ 0 0Ǡ 0Ǭ 0( 0nj 0 0ä  0 0δ 0, 1D 1 L 1 8 *L@ *X0 P4X@ۋ 1, ݬ 18  1D` 1P$ 1\ 1h 1t < < < < <P < <@0 A4t@0 4@܃0 @4@S0 4@0 4@0 A@ы0 Q4@0 5@0 5@ <܀ <ш < < <נ < < <p < < <ʠ <0 <  < <P < < <P < Q Q Q R, R4 Q Q pQt HQp R< 5,0 P5@0 T5@K0 Q5@ U50 58 5D 5P0 @5@K 0  5\ 5h00 @5@ 5t 5 U6 U6$h U60x0 A6<@0 6T@ <X < < < <` < < < <@ <x < <80 6h@k0 6@; <0 @6@{ < < <H <x <H0 @6@0 @6@[0 7@)0 8 @0 8@0 8$@*(0 84 @0 8H @0 8\ @0 8t @0 8 @ S0 8 @0 8 @0 8 @0 8@ 0 8 @0 9 @0 9,@*0 9<@0 9T @0 9l@x0 9@)0 9@*8 T\0 9 @0 9@P0 9 @0 9 @ U: TX R0 :@)0 :(@ S ST S LT8 0T0 :< @0 :P @0 :d @0 Q:|@+ @T T< :( 4S,0 T:@ Rp R S4 \U8 S< R R SD $S  T R R @R (R S S S U R  R XT R (TH S U:X U: S T S pS S0 : @ S @SL R Up R S 6 l0 U;@ U; h U;,p * < 6 6 0 6P . < 6  .@ 7 7 7|0 ;<@  7(00 P;T@ 74 7@ 7L` U;l 0 P;x@  U; U;X U;0 T;@ 3 7X x 7d  7p , 7| x 7 ` 7  R R Rx 8 Rh pR` 7  7 l ) 7  7 ` 7 7 \ + 0 P;@ < <8 < <p <8 <  <  <  < <@ < < <0 ;@ <0 <@0 <@C0 <8@s0 @0> @*`0> @ 5 3L !(5 5 1/l 2p 3| 3 20 5 +x0 3 ; ( 2 !5 5 `5 !5  5 4  "5 2 p 5H 2  5"H ,5 ;( +0 -0 +0 !5 +0 +<0 2 X 3  2 1 2| P5 ;( #H5 6$H 3X 60H ,5 ,0 6H 3 5 #X5 ;l( "5 2 3 H5  =`p :( 5 2$ ;,( ;( x5 5 !5  5 2 5 #5 5 d5 4 5 3 +0 30 :( :( 2 2 850 A@ш0 8@$" -+0 3@0 P4,@p[0 P3d@0 P4@@+0 P4@@0 P4X@ۈs0 =l@0 =4@s 8vmain __text_start ___stack_zero __data_startcrt0.oPA-RISC 2.0 Assembler HP92453-03 UX.11.01.24../mapdld.c /CLO/Components/LINKER/Src/csu/CRT_RELEASE ccom options = -ESlit -DA1.1 -DS1.1 -Oq02,al,ag,cn,Lm,sz,Ic,vo,lc,Mf,Po,es,rs,sp,in,vc,Pi,fa,pe,Rr,Fl,pv,pa,nf,cp,lx,st,ap,Pg,ug,Lu,lb,uj,dp,Fs,bp,wp,Ex,mp,rp,ap,dn,Sg,pt,kt,Em,pc,np! +k -AeHPC HP92453-01 W111107../maptsd.c /CLO/Components/LINKER/Src/csu/CRT_RELEASE ccom options = -ESlit -DA1.1 -DS1.1 -Oq02,al,ag,cn,Lm,sz,Ic,vo,lc,Mf,Po,es,rs,sp,in,vc,Pi,fa,pe,Rr,Fl,pv,pa,nf,cp,lx,st,ap,Pg,ug,Lu,lb,uj,dp,Fs,bp,wp,Ex,mp,rp,ap,dn,Sg,pt,kt,Em,pc,np! +k -Aeset_tpL$0007L$0002L$0004L$0001 __map_dldL$0005__do_thread_initL$0008$real_mcount_ptr_nullerrorC$16writestrlen _crt_errnoitoa__exit S$18DD$itoamemcpyC$43$__map_dld _crt_open _crt_readlseek _crt_mmap _crt_close _crt_syserrorsyserroropenclosereadlwp_setprivatelwp_getprivatemmap_utssys BS$maptsdC$10 S$12DD$itoainvoke_init_fini invoke_fini L$plab_start__set_tp__get_tp$global$$START$$ARGV_environ _fp_status _CPU_REVISION_CPU_KEYBITS_1 _FPU_MODEL_start $$dyncall __tool_init_mcount_real_mcount_ptr_clear_counters _sr4export__d_trap $UNWIND_START $UNWIND_END$RECOVER_START $RECOVER_END __dld_flags __dld_hook __dld_list __SYSTEM_ID _SYSTEM_ID _FPU_REVISIONenviron __d_trap_fptr $PFA_C_START $PFA_C_END ___init_start ___fini_start ___init_len ___fini_len__islwp__cxperf_dld_hook __profil_size __dld_loc __dld_path__ismt_ktepv_tepv__tdsize _thread_init __tls_init__tls_prealloc_dtv_etext_end __init_start __fini_start __init_len __fini_len__errno __tdata_addr __tdata_sztaddr __sys_atexitL$C0062L$C0009L$C0080L$C0022L$C0235unknownBuffer___0L$C0234L$C0061L$C0213L$C0211L$0222L$C0082L$C0050L$C0127L$C0121L$C0083L$C0203L$C0201L$C0225L$C0054L$C0053L$C0055L$C0003L$C0002L$C0158L$C0152L$C0043L$C0148L$C0259L$C0258L$C0134L$C0136L$C0228L$C0063L$C0140L$C0131L$C0077 seeded___1L$C0059L$C0139L$C0060L$C0135L$C0174L$C0147L$C0074L$C0072L$C0070L$C0069L$C0068L$C0067L$C0173L$C0138L$C0064L$C0065L$C0066L$C0137L$C0178L$C0177L$C0179L$C0184L$C0183L$C0047L$C0196L$C0197L$C0048L$C0198L$C0200L$C0049L$C0143L$C0202L$C0144L$C0205L$C0207L$C0146L$C0209L$C0145L$C0195L$C0046L$C0189L$C0057L$C0182L$C0181L$C0058L$C0180L$C0190L$C0056L$C0185L$C0052L$C0186L$C0187L$C0142L$C0141L$C0051L$C0188L$C0157L$C0091L$C0086L$C0153L$C0167L$C0151L$C0090L$C0096L$C0101L$C0103L$C0071L$C0175L$C0150L$C0122L$C0168L$C0126L$C0102L$C0100L$C0172L$C0166L$C0165L$C0081L$C0079L$C0078L$C0155L$C0076L$C0159L$C0075L$C0073L$C0161L$C0162L$C0088L$C0163L$C0164L$C0087L$C0099L$C0105L$C0107L$C0112L$C0110L$C0108L$C0106L$C0104L$C0098L$C0097L$C0095L$C0094L$C0093L$C0092L$C0089L$C0085L$C0133L$C0114L$C0116L$C0117L$C0109L$C0129L$C0111L$C0113L$C0115L$C0128L$C0156L$C0149L$C0176L$C0170L$C0171L$C0120L$C0119L$C0118L$C0169L$C0021L$C0029L$C0004L$C0018L$C0006L$C0005L$C0017L$C0212L$C0191L$C0016L$C0160L$C0019L$C0223L$C0222L$C0221L$C0001L$C0192L$C0010L$C0015L$C0014L$C0013L$C0204L$C0008L$C0011L$C0194L$C0007L$C0206L$C0193L$C0012L$C0208L$C0020L$C0154L$C0130L$C0248L$C0249L$C0251L$C0250L$C0252L$C0253L$C0254L$C0256L$C0255L$C0257L$C0260L$C0247L$C0243L$C0242L$C0226L$C0229L$C0230L$C0227L$C0231L$C0232L$C0233L$C0236L$C0237L$C0241L$C0199L$C0132L$C0084L$C0025L$C0210L$C0024L$C0220L$C0040L$C0039L$C0044L$C0023L$C0217L$C0224L$C0026L$C0215L$C0214L$C0042L$C0028L$C0027L$C0041L$C0045L$C0216L$C0038L$C0219L$C0218L$C0034L$C0032L$C0031L$C0036L$C0037L$C0035L$C0030L$C0033L$0808L$0895L$0211L$0390L$0868L$0079L$0977L$0988L$0973L$0919L$0922L$0931L$0920L$0884L$0890L$0879L$0878L$0848L$0861L$0721L$0793L$0726L$0792L$0800L$0645L$0801L$0641L$0658L$0799L$0794L$0798L$0664L$0698L$0796L$0705L$0795L$0716L$0802L$0639L$0803L$0835L$0847L$0838L$0856L$0860L$0858L$0867L$0837L$0825L$0833L$0636L$0691L$0804L$0631L$0822L$0823L$0824L$0797L$0982L$0074L$0042L$0073L$0018L$0023L$0040L$0075L$0049L$0106L$0089L$0105L$0104L$0091L$0103L$0024L$0078L$0028L$0077L$0046L$0076L$0107L$0087L$0610L$0530L$0609L$0526L$0608L$0378L$0607L$0372L$0606L$0327L$0341L$0318L$0495L$0611L$0469L$0411L$0618L$0430L$0617L$0616L$0615L$0435L$0614L$0440L$0613L$0454L$0612L$0326L$0303L$0284L$0283L$0169L$0196L$0171L$0195L$0174L$0194L$0180L$0193L$0110L$0114L$0285L$0286L$0287L$0311L$0294L$0293L$0221L$0291L$0292L$0288L$0290L$0289$CODE$L$C0000 wrapperData properties log_printfssdsprintfmallocgetIntPropertysd packetBuffergetStringPropertywrapperClasspathSeparatorfreegetBooleanPropertyprotocolSendBufferwrapperGetLastErrorstrcpygetLastErrorTextwrapperProtocolClosewrapperSetJavaStatewrapperVersionwrapperGetTickswrapperProtocolFunctionkeyCharsstrchraddPropertyPairprotocolSendBufferSize gettimeofdaystrcmpIgnoreCaseerrnowrapperUpdateJavaStateTimeoutatoistrstrwrapperProtocolGetCodeNamewrapperSetWrapperStatewrapperStopProcesssetLogfileAutoClosesetConsoleLogFormatsetLogfileFormatlinearizePropertieswrapperInitializesetLogfileLevelIntwrapperEventLoopisQuotablePropertywrapperStripQuoteslog_printf_queuechdirsetConsoleFlushfcntlrecvceilsetLogfileRollModesetConsoleLogLevelIntgetLowLogLevelsetLogfilePath!wrapperBuildJavaCommandArrayInnerstat getLastErrorlistenwrapperBuildKeyprotocolStartServeraccept inet_ntoa protocolOpensendwrapperStopRequestedbindwrapperRestartRequestedwrapperPingRespondedwrapperStopPendingSignalledsetSyslogEventSourceNamesetSyslogLevelsetConsoleLogLevelglobfreesetLogfileMaxLogFilessetLogfileMaxFileSizesetLogfileLevelgetLogfileRollModeForNamerandtimesrand wrapperGetPIDglobgetSyslogLevelIntregisterSyslogMessageFilewrapperStoppedSignalledwrapperStartPendingSignalledwrapperStartedSignalledwrapperKeyRegisteredwrapperLogSignalled initLoggingsetSyslogLevelIntgetenvwrapperReportStatusstrcmpsetLogfileUmaskgetLogLevelForName closeLogfile inet_addrrealpathcreatePropertiesdisposePropertiesloadPropertiessocketloadConfiguration"wrapperLoadConfigurationPropertieswrapperSetWorkingDirwrapperSetWorkingDirPropwrapperAddToTickswrapperTickExpiredwrapperGetTickAgewrapperGetSystemTicksgetOutputFilterActionForNamewrapperBuildUnixDaemonInfoupdateStringValuewrapperJVMProcessExitedwrapperFreeJavaCommandArraywrapperGetCurrentTimewrapperRestartProcesswrapperRunConsolewrapperRunServicewrapperAddDefaultPropertieswrapperProtocolReadwrapperBuildJavaCommandArraysendPropertieswrapperLogChildOutputwrapperInitializeLoggingprotocolStopServerL$C0124L$C0123L$C0125L$0467L$0086L$0565L$0320L$0506L$0259L$0540L$0242L$0212L$0908L$0431L$0136L$0976L$0930L$0929L$0933L$0985L$0938L$0935L$0946L$0961L$0954L$0968L$0960L$0948L$0953L$0970L$0940L$0967L$0464L$0818L$0810L$0809L$0481L$0480L$0812L$0578L$0821L$0488L$0820L$0542L$0815L$0814L$0813L$0501L$0677L$0475L$0850L$0840L$0817L$0901L$0851L$0928L$0816L$0827L$0471L$0826L$0472L$0819L$0473L$0811L$0978L$0030L$0070L$0036L$0161L$0160L$0159L$0158L$0157L$0156L$0155L$0162L$0163L$0462L$0437L$0453L$0324L$0416L$0436L$0458L$0461L$0457L$0456L$0417L$0455L$0415L$0319L$0806L$0317L$0807L$0316L$0315L$0314L$0650L$0805L$0413L$0699L$0414wrapperGetJStateumask wrapperSleepwrapperGetProcessStatusfopenwriteStateFilefclosewrapperGetWStatewrapperKillProcessfprintf localtimeasctimelastLogfileActivitymaintainLoggerwrapperKillProcessNowdisplayLaunchingTimeoutMessage jStateStartedwrapperRequestDumpJVMState jStateLaunchremove commandPollwrapperReadChildOutput logTimerStatswrapperBuildJavaCommandwrapperExecutewrapperDumpMemorywrapperDumpCPUUsagegetLogfileActivitycheckPropertyEqual jStateDowngetLogfileRollModerollLogs flushLogfile anchorPollfgetsjStateStartingjStateStopping jStateStopped jStateKillingjStateLaunchedjStateLaunchingwStateStarting wStateStartedwStateStopping wStateStoppedjvmPidL$0066L$0395L$0268L$0175L$0270L$0332L$0312L$0335L$0333L$0264L$0403L$0266L$0253L$0265L$0249L$0246L$0263L$0247L$0244L$0267L$0331L$0330L$0329L$0346L$0334L$0262L$0343L$0273L$0484L$0476L$0477L$0487L$0092L$0185L$0418L$0099L$0085L$0184L$0100L$0146L$0147L$0172L$0145L$0170L$0101L$0084L$0240L$0228L$0261L$0063L$0450L$0251L$0064L$0083L$0449L$0065L$0029L$0402childOutputBufferchildOutputBufferSize timerTicks timerThreadIdjvmOutputspipedesputcharunlink sigemptysetprintf sigactionappExitpipeInitialized descSignalgetpiddup2killexit pthread_selfforkwaitpidstrrchr__pthread_create_systemlogRegisterThread getrusagesigActionCommonmemset daemonizesignalsetsidsigActionInterruptmemcmp__maingetsidgetpwuidstrerrordisposeLoggingwait timerRunner nanosleepexecvppipe sigActionQuitsigActionAlarmsigActionChildDeathsigActionTerminationregisterSigActioninitializeTimerensureSpaceInChildOutputBuffergetSignalCodeDesc getSignalName writePidFile wrapperUsage setWorkingDirL$0060L$0125L$0188L$0190L$0276L$0215L$0214L$0124evaluateEnvironmentVariables addPropertyloadPropertiesInnerputenvinsertInnerPropertysetInnerProperty strcasecmpstrtolstrdupgetInnerPropertydumpPropertiesdisposeInnerPropertycreateInnerPropertyremovePropertytrimsetEnvL$0351L$0225L$0224L$0176L$0226L$0492L$0350L$0522L$0489L$0443L$0463L$0518L$0260L$0444L$0377L$0384L$0383L$0382L$0385L$0369L$0442L$0441L$0255L$0401currentLogFileName logfileFPworkLogFileName logFilePathqueueWriteIndexlog_printfMutexthreadMessageBuffercurrentLogfileLevelcurrentConsoleLevellogFileMaxSizecurrentLoginfoLevellogFileRollMode queueMessagesthreadMessageBufferSizethreadPrintBuffer threadIdsloginfoSourceNamelogFileMaxLogFileslogfileActivityCountlogFileLastNowDate queueLevels queueWrappedqueueSourceIdsqueueReadIndexthreadPrintBufferSizefflush consoleFormat logfileFormat logFileUmask consoleFlushautoCloseLogfilereplaceStringLongWithShort__iobgenerateLogFileNamepthread_mutex_lockpthread_mutex_unlock logLevelNamesbuildPrintBufferrename vsnprintfcheckAndRollLogssendEventlogMessageftelllimitLogFileCountopenlogsyslogcloseloglimitLogFileCountHandleFilesendLoginfoMessage forceFlushgetLogfileLevelIntsetLogfileMaxFileSizeIntlockLoggingMutexreleaseLoggingMutex getThreadIdlog_printf_queueInnerunregisterSyslogMessageFilegetConsoleLogLevelIntinitialized___0 L$text0000L$text_end0000 __CTOR_LIST____do_global_ctors__do_global_dtors __DTOR_LIST__atexit__gcc_plt_calldyncallU UX.11.01.14noshlibs$$dyncall_external$$dyncall_external_20__tdsizeetextedataend_etext_edata_end __SYSTEM_ID _fp_status __profil_sizeLXt???>/=Xt??>/?Xt?45=Xt=:⇺:⇹y ,kO4& `i hp _ pPOlƉDd˚v8v;A)hůt 4LR wkDgЯ:Ye 'VL T"f/v'6!xy=P6 e!x)D'k+!xry 4= Rg6 g mTLh ,שp,V2!=!x݌ kD!xЭ"g2XkD\΄a[kAYÎk xhŠsmT W!x'6g#e&f] ŧ<!x \T gyhg@Ԕ:6fXhևcqL ƿk"溯#xt}/5z˚v8vƉhů;AԃDdn bltD8rP.7D7%7744z#/74444@h@7D7%77+4># (P74444+H87D7%77+` 4!H6  24744447#$`74k?7+` 4?K @7K?Y@7?@@ 7K?@ @@@@k?ok? k?( 7%k?!74#4y4@04 @HK?!K?!7@4 0@@474@4 r+4?K @7?4y4@p4@7?7?7@@44y4@ 4+47@J K>K?K? @O? 44@CW?7_7?7@7 " 6@/'7?7747?'I'G9 8ࢋ1DN1dN3'2 009%G' Z0N1N3! ' 2  :7`1@1@ 9eG'Z0N1$N;J'J:K 66`9@9@9eG'Z0N1N3! ' 2  U6`1@1@ 9eG'Z0N1$N;J'J:K 6`9@9@9eG' Z0N1N3! ' 2   6s`1@1@ 9eG'Z0N1$N;J'J:K 7`9@9@9eG'Z0N1N3! ' 2  7Z`1@1@ 9eG'X0N1$N1:J'J97!`8G ' J <7=`6?@7?7\7W 7?]P6?7=6t7967Z?7_6s`j 78676@k?ok< k<k<k4`@ 5z4` @G> *( 4<47_4+4-IK>)K>A@ 0K>YK>i4ߟ444k?K>945k?5@`4 $(7 Jk?4?4k?44@4$7  k?K>Q_ k?45@4 7( 48kQ45k?4@4#h75z@ @k>I+4*k>C>+3 4k>4!k?)46+k>֓ c>44Ka?k>46Ka?k?1647k>6Ka?k>5B4=k>7+`K>k? ֠ 49k>7?@+k?!4 48k>6+` k?74"H_ hk?Ka?4<Kk?Ka?4-k?9+` 5k?Q4!4= !xk?Ypk?A( 43k<6z4_m47=( 4:k<7Z@4_%4G=( 4<kak?q ( K>1k?64"k?4A ( k? }+` k>4&4 pk?y+`4$h7>7>k>444? %7K;KK?K? @O? 44@CW?7_7?7@7 "06`/'7?7747?'I'G9 8ࢋ1DN1dN3'2 009%G' Z0N1N3! ' 2  :7`1@1@ 9eG'Z0N1$N;J'J:K 66`9@9@9eG'Z0N1N3! ' 2  U6`1@1@ 9eG'Z0N1$N;J'J:K 6`9@9@9eG' Z0N1N3! ' 2   6s`1@1@ 9eG'Z0N1$N;J'J:K 7`9@9@9eG'Z0N1N3! ' 2  7Z`1@1@ 9eG'X0N1$N1:J'J97!`8G ' J <7=`6?@7?7\7W 7?]P6?7=6t7967Z?7_6s`j 78676@k?ok? +4?+497 x74j@X@+7?4:``07_ 7_4?K?YK?@O?+47+486 p7K?YK?Y+456 `7_4c=K?Yk?7_M4K?Y@7?k?o_4+4=7 p (@+476x@+`43+48+`4#h`Xh`@74hu06wH@h8+`446hsP hwH!k?4?4k?74_4$+`46k?j!H7_u@HxP!@K?HZ_EHyHK>+44k?_UJ]+`h`P4?haHKa?4<KKa?47+` 49k 4x0>j44477K>@O?(04:k?!7Y7Z_}4K>@z@@`Ku:1Ks:9 k?KuK? K?K?K?!@O?A@  h0πK>H U4xPHf 044?  ,- +` 4G_H% H hx  0H9xC _ 9=%@F@4 H "06(4?p`k? F4B>Q@Ku>Ks> k?Ku:Ks: k?Ku1Ks>9 k?KuK?AK?IK?QK?Y@7?H& H?m4?D@4"0W6X4?F4B?F@4 #0Hs 74?Jw@JcHk?k?F4B>9H7 ̀J@H8 K8@@+` w 0#(04?78 k?F4+` H: DKW!PkCP+4C_H:>-K>DD@4 "h04?WF p6x@@@Hz_ @+` _M@ 0H 4?+h"+` eH3 K`?4?Dt@4#0W7X4?F 4B?q#0W74?4F `4B>ỳJc@F@4 (04?48F W@@+` Hz_ @C_@ 0+` C4?+h&Hs H$ H@?CD 0W4X4?4F 04B?yF@4 (0W48X4?F 4B;Y@Ku9Ks9 k?KuK?aK?iK?q@7?7?!7?A_k?A!h|+` H4 J!hEHz4_# H_ @+` _M@ 8H 4?+h?+` H" h@PK@?4?Dl@4#0W7X4?F4B?iH K @H4B>YF@4?#(0W784F 4B?_eK?)4G?%"h0W6x4?k?F4B>AD\@4샂=K>ه=+` H$ H`=mK>F 0W404?4F04B=!@k?+7H"_ 8Z_@ 0+` 4?+h4K?Y@7?H" HA ?4?D@4?"h0W6xp4F84B?i@Ku:Ks: k?X4,7?9k?قpo@@` (0p H0p 0p"0p"0p"0p"0p#0+`+`P#(0P#H0P#0P#0P (0P H0X+` 0"0"0"0"0#04<K?Y@O?4\46666(}78m7<H]7\PM7`=7-4<4\+`"h0E6y x_4:`4`46 6 6 06 H}7 `Ku=qKs=y k?Ku:Ks: k?Ku<1Ks<9 k?Ku=Ks= k?k?4ok?Dk?!Ck? #Pk?G` 4_Z7+H"F`@++H: @"E_ UZh +H%!+` H6 J!b+H7 `!0H3 Y_%6z+X4H:+_H9 @C4K>K? K?K?K?!@O?+` H< K@ _@˃K>D |@4#0W7 4?E4B?H8 _}ZS` 8W#(04?78 k?4E,4B>9 04 H4 J ϟK>_ZS` 8W 04?4 4k?E4B? h04s _54B=! (04' `Ku=1Ks=9 k?Ku;QKs;Y k?Ku=Ks= k?k?477>k?!h0k? 5j pk?k?k?!k?)k?1k?A_k?9" +`K>6K>4+ 0#I-@ 'Jk>8W'"&bg>(+H5&++7>C44_H:%ꏂ%pC>+`44' 04Hz7>4_4$C>4?Hz+` H' +`4# 0d H$24?74*+` @@P+`@@+`+`@@+` +` +`+` +` +` +` +` +` +`+`+`+`+`+`_4: 0A Z7>_U4 0K>4 pK>4 5/ B'D  k>8W! 's&Sӟ g> = ܋\E+ X4K>YK?K? K?K?K?!K?)K?1K?9K?A@7>AL4B>A4B>_=4: 0ZA4B>Y_4: 0ZAL4B>1A4B>!A\4B>4: 0A4B=H8 K=7>W4? 044 k?ED4B=4?49 0AP4B=y_Zk?"0W6 4?4E4B;y`;4[  +` H# Hb@ (0_M@πK>Y4?48 4E44B?D@4샙?@?4?4Ѓ?u+` H? K?E@E\@4"h0W6x 84?Et4B>H6 @C_ @+H884}K>Y_}@Hw?4EK>Yk?+` 4fo4?k?CC44?C@XHa D ,h%!pSHb HA؄ !Z h04x E4+` H4 J :J !"0"h04?6x E4B@_ }@+H:_ @+` _}@ +` 4?+h:+` #0C7 4?4H= EkPH| KK?Y\K?@O?H8 K?U4?D0@4?#(0W78X4E\4B?_6 0 4 8k?+` 4foCpE44?CXH Dh SK?Y\@O? H04?4X xEt4H J :J !h"0"h04?6x E4B\@_ @+H:_ @+` _@ x+` 4?+h7+` #H07X E4?4H< E\kPH KH6 J?u4?D@4?#(0W78X4E4B?!_6 k?+` ok?CH4 J4A?"hDJ h0K?YK?@O?4?4w 4k?F4B?J "h0J `+` J4 @4 24 "4 4?j+` 4jH= kkk4?6w 4Fk?%Ht k?oDk?_ %C4`44D47?B `Ҵ r`ҁ=  # 796  #  K?YK?@O?`bt 0 # b "u79]79EKu;1Ks;9 k?Ku>Ks>  k?Ku:Ks: k?Ku9Ks9 k?Ku>!Ks>) k?Ku>QKs>Y k?Ku=Ks=  k?k?7k>Rk>k>k>k>k>k>k>k?k? k?k?k?!k?)k?1k?9@ k<1+` h0 H04y P4X EH: Z_H_Y7K<1Z $D\ 04 _X446F4  074 7<_}D+` 474Z_E4B>_4@?"0"h0 6y _eZ_17ZYE_4B>7<4EH: I+` 044EH: @K4`@4  X4 @ H F4_I Q "0 |Z X_661+` "064E H: @EHE4 xE@ @4_ Q XZ #0_ 7H61@!+` H: KY0 >h4 +` 04X4E H: 9xH@8PZ_BE Z_N O  52_ y ZK<1Z 7 |_m Z@+ Z_E4 7(+!h0E5y@7hX_ik?@ @614_ Q #0 Z_7І@#61QB4k>4 _ )ZK<1K>Z D  6 \44"0767<_ik>+` 47K>`1" 4 K> F NK>jB_ 53g@LE 0K> S 4 `_ 9Z4 |Z_X_Z_4@2+@#h 5 K>#0 7 5J 5_  MK>LK>_7>==K>/K>K<1` `K>4 _  ` ./ ) !_I5@ 61@( Q +` H5 _y6_I7"K<1Z@.` <+` 4H8 _7@ X614*_ Q +` iZ4yH6 _AJP+` H% HX@@h61@ P42_I Q +` " Z6H7 _JX61@ P4:_ Q +` Z # 7H< _QK`@ X614:_y Q +` Z4PH= _Kh+` H* IK` h61@ R4._ Q K<1Z+ #7_a@61@ J42_ Q D < I 4Y_X+` H4 J (61@ R4B_ Q K<1Z(H "6_y@61@ x+ Q E_H:0_7*K<1Z' |!H05(_@@ 61+` Q H9 _!K:(_78K<1Z& <+` H3 )49X_QJx(+` H& HЇ@ p61@ R4@_Y Q K<1Z&8 |"i6y_@61+` H, I؄ xH= @ R42_ Q K<1Z% "6_9@61+` H= K b@ R4N_A Q K<1Z$ "6_@61@ b4Z_ Q K<1Z@$` +` !5`H3 _9Jx@ `614,_a Q )49 +` ZH" HI_58@ 61+` "i"6y6 Q H: D 0Z_P^74 |Z_!X+` 614 iK!!077<4y_XIz 4D$7Iz D4I\KK>K>K>K>K>K>K>K?K? K?K?K?!K?)K?1K?9@7<+` #H3 7!i 5y#m7" 6@+` H3 4!H0]5"i6y"J(6<v +` @ 4X^E Q K<1Z" +` "H4 6(J( I4_ !L'5 /8W  ' j_ ) 61+` !2H9 5:<K!0:6}@@6o614X^ Q K<1Z +` "H# 6pHv0! 5 #L'D7 ,8W '  _ 4B5y+` "iH0 6yMJ0+` #H8 7K( ) 49H+` "iH8 6yxZ49_ 15 ` 4H 5_ 4B0)4?6 47F C  h04 ^Z4y Z_!X_ Z_4@:K>+@7hX 5  K>#07X]5  M_i4B-E8@4 "k?W_]6_ Z^]ZZ_ aE7?Y_eZ_ 1Z m@!)4 59_4B) `4p@7h+"@7h6qB_ ZD70^M C K<1Z@ |_ 9Z@#_ Z4 ? (#D7X_Q4B'# `7 #7 XQB4N4 (^=Z ) N Z |_49 K<1$ k>P44!)77<59 _QK+` 47"h06yX5 _ M>M X@!2_! ZAL 53g@zE N  04 `^Z4 |Z_)X_Z_4@2N+@6h 5 v N#075  X_ M !IK<1#@ N 4 ` ә. (# !5_4B#Z7_5 `N5Y 5_4B?! `44 *4Z(_i4B;#_7 K<1!mJ44U4D Xҁ6 75 @? X+` Ɵ+` 04Ku:Ks: k?Ku=Ks= k?Ku;Ks; k?k?+o7?!k?Ck? k?,P-,P,H!( !Z+4FH:+` 0@ _E"6 0'L$ 1 H # 4c_}7'H8E8F8fD8' `~_u +` 7?!H# ``,-K>K? K?K?,,@O?_4_Z4?mha(+` k?7k?i 4 8k?y i4x Xk?qDk?!k?)k?1k?9k?Ak?Ik?Qk?Yk?aDH: CEZH  I )4X pD49 DZ$ D4 # +` ZDE!!5 5 !!i!I!)H ! D EZH 5 D5y EZH 5X XDt59 `D$Z5 4D H EZ+` 44 H DH# BH 4 D4+` h|F+` CH H8@4E@Hz ##7 DT7 EZ#I#)78 7Y HDHz EZ#47 DHz EZHz ""6 D6 EZHz ""6 D\6 Hz "iXD46y 0EZEd@@E!I45Y X H Hz i D|1Hz i<84 xDLH H i@H@4?G0Hz !!5 D5H hHJH6?gJ@~ 6+` "D6 +` 4H: DdH H iXJX@J8=p"+` #G +` 7C421H) H D1He i<`H`7\?421# H 7Dt49Hu hhJh6?J`{6+` C4+` 4H: DHf Hm hI:E4E(4+` "F +` 6C4@H DH) D ZHh "ii<4?6yPD H He i H 4?h 9# I!H 4Y5D Hg #ס!7h(5!DK?AK?IK?Q@7?4^4C@Hw YZJ6 BP4B?q79_Z!@" 4?4XB7?!D ZX^44^Y"uZ4?6X4 D 4^4^4B= ) 44?48`DWUHy +` k?4?oCH4 ) 48J p4J4b K?Y@O?C@Ht ZJ4y BX4B?D@uHt k?+` W4oCH" ) 48HA 04?Y^m4K?Y@O?D4B?@ ) k?484?+` o4DCHt J J@ J4 4 4 4 rJ 0# 4?jjK?Y@O?4?7@D4Ht +` H4 J`?K?Y"i 4?6x4Dh4B?a@Ku>Ks> k?/%0k?+` W4oDk?C`@4H5 ) 48J !4?J4?4Xb 4J4 K?YK?@O?C@" D6P'E,`8_0nZ0'A44B?YAT@%H Dp@H +` k?4?oCH" ) 48`HA X4C@4YHt JA4x K?Y@O?D4B?@k?+` W4oDk?C`@4H4 ) 48J 4?J4 *4 K?YK?@O?Cx@" D6 'E,`8_E0nZ0'A4B?YD0@H k?+` 4?oDk?H4 ) 480J !h4J4b 44ʀ| 4K?YK?@O?^Y@C@H YZK7 A4B?C 4f4YH JA6 H J?-4hA@4H 4h4K>4Cx4B>DH@}H k?+` 44oE (049CH H  (044CT49K?Y@O?k?47k?AD^7?!K?!K?)# 7# 7' t. 8W' "&  HK>K?A@7?k?+` oC+H"_ @Z]e@ H+` C4?+h4Hu jPK?Y@O?Hb HA ?4?Bl@4?"h0W6xX4D 4B?Y@k?D7 4K?Y\@7? I4Z XD \@D 4 )D 44: D t4D 4 ) DL4:D4D4D 4`-K?Yk?+` W4ok?Fk?!Dk?) h04x4k? k?H! D H:H HA`E4?GH ZԃBJt 4c hY+` H7 JdH K>K? K?K?K?!K?)@O?^@?+` H K 4  Z4?eK>" 4?6D p444^4B?#I 47XD (4?H J J J4 4 x4 h4 ZJ jUj" 4?6@D h4H H I>K> i 4?4x4D 4B=@+` k?4oCH: 4D^Y^qZK?Y@O?+` k?oCH4 J +` J J4 4 4 4 rJ 0#) 4?jjK?Y@O?4?78@D4Ht +` H4 J`?K?Y"i 4?6x4D4B?a@k?oF4k?DYk?^E ]\BY ^IZK?K?YK?@O?k?oEk?@ Xk?`8DC `4? HZ?4c^ZK?YK?K?@O?^q@ ` ) Tk?4748 @4 4?+` WH5 4? ) 4J` 848 jk?D@K?Y@7?" k?6 xW"4?+` H" HTk?oDk?C@ pZ` @Z^Q@] %7Y ^QZK?YK?@O?^@u k? )49 4o+` H$ +` C dH: hK?Y@O?k? (049oDC 4K?Y\@O? )ZD49h404K?Yk?47^7?A I K?I# 7 K?A# ӷӼ'E /@ 7 8W! 4Z 0c'Ҙ x/@ 6ӷ& 'D Ҽ8W //@E'8W/җU ҂P5 A K>@7? Y# 7 @ /דB#R 7XӔ' 8W' &@  :4 p4?@ 9 S A@\Ku9Ks9 k?k?+` ok?H" X_D bW4?` (44K?YK?@O? I 4X PC4B?D@4 ) W48 4?Ck?ϟuK?Yk? ) 49 4o+` k?CH: C` 4 ` ZK?YK?@O?+` H" X_@ HW4? 4πK?Y i 4x PCl4B?D 4 W4?4 C,k?ϟK?Y ) 7Z?sP(4< @@ ) " " " " # #) #I # @4< 0@6 @@6 `@6 x@6 @7 @7< @7\ 7 @k?4?4 ok? i 4x C|k? ) I 48 p4Y +` CH:  ) CZ^49 ( K?YK?K?@O?Z^i4?K?Y Z^94h?K?Y"i Z^ 6y?U+` H4 J ?=K?Y 4?44C 4?4C44" 4?C64" 4?C64"04?Ct6P4"04?CL64"i04?C$6xp4 I04XC4?4 )04?C484#0W7C4?4#04?C|74#04?CT7`4#I07XC,4?4?#)078hC44"04?C64"04?C6 44C4?444?Cl4B_J?K=H JH " I0Jp^ 7>!!+` H J!ZJ!4J!4!4!4!x"i04?6xC44^4H J6?+` J8@ 4j# 6?X7 @@0" # #  ) 6 A4j4 I0W4?4X0Ck?+` H6 DJH 8j+` ZH# _HyxMh|APZH YHHHA4B?7 7 4$ 4?4XC4H Ku:AKs:I k?Ku;Ks; k?Ku;qKs;y k?KuZ+` Z_DH _HX 8C+` ZH( _I`ihC 0H Z4 4 HXk?C$4B?yZD 6Џ # 0 4]ZC"04?64WCk?4Y]4B>yZD p7x H#0#)04?78WC$44B4B> ZD 7菀"#0"` )0CZ @C I04?4X4Wk?C t4B=qD@"0Z6D HI "i0DZ i0W4?4x @4C k?D @<<+` @4!)0H: DkW59 Z]EX4Y] U4B4?484WC D4B;AZD87`==#0ZD7 =# 0ZD7 ؏"8#0 04"0ZD6 04"i0ZDx6y ؏ `+` H4 jH` 0 )0 i04?4x Xk?圍4_48 "0ZD6 +` H9 mk#8 0ZD4 +` H) %i#X"0ZDX6 +` H: kCp# 0ZD7 ȏ +` H< k@#0ZD7 菀>e+` H? MkPZD7 =#0ZD`7 =}#0ZD87 =U )0ZD49 ȇ=- I04Y DZ= I0_]4X 6g7>H 04 P4?HwX4Cl4B7A 4B54?4XxC<4EH Ku;Ks; k?Ku;Ks; k?+` k?7k>k?!Ck>k>k>k?k? k?k?H7 J4A?"xJJ -:JȌIjJ" 04?4 C4Ht J8` 4jJ! 4?X5 @@0" X# X!i X# 6 A04j4"i0W4?6x0Ck?+` H= CKH@ xk+` H# hjK>YK>K>K>K>K?K? K?K?K?!@7>A@ZHh YIIHA4B?I7 5c 7 J_  YHu JcBJ84j`"JЌbjY_u ZHu J8!D4jj+` H3 JcP` pD+` H3 JwЎ^%H# Jx>hj#I07X 4?4C4B=Jz4_U! 0H IGZ_45 PZ_eKE|_Z X"0A4Ȍ_Z#0W7 `4?4C4B>Z X_}6 XZ_4B>a_5J4?#)0Hv 78 WJ4k?Ck?Hu jj_JZ_G"i0W4?6x4Clk?Hu JJ7@#jJJbjJ84!JЌajY_ ZHu J8!D4jj+` H3 JcP`<DJz4_E! 0H IG'Z_45 PK_ UZwE_Z=M"0A4Ȍ_Z#0_J4"0Hs W6 Ju4?k?C@k?Hu jjJ_!)0Z_GW4?584Ck?Hu J )048P4?k?Cp4 4j#04?7C@4 Ht J88E+` J! 4?5 @@" # !i # J Y_ 04Ha W4H"k?CH4? Hu J#0jJ+` 4H4 J8 "Cb`j Z_YHt J8!D4jj+` H3 JcP` HDV+` H: KX6H# #}7 Jz4_!)0H KG'Z_459 PZ_DEМ_mZ X"0A4Ȍ_Z!i0W5x `4?4C 4B>Z X_6 XZ_4B>_J4"0Hs 6 WJv4?k?Ck?Ht jjJ_9 0Z_!FW4?44Ck? Ht JJ+` 7> HZ]q4I  * J4XB49I #XYB7 Ht J8354jJ#) 6?7# @@" # !i # Hf "64?H4C`4?Hi i'k?+` ok?Gk?!k?1Ck? k?k?)H4 J4A?"0EJ8!4Hs jJePj HjK>K? K?K?K?!K?)K?1@O?Jz4_! 0Hx IGZ_45 PZ_DCМ_Z` RA4Ȍ_Z#I0W7X `44?C@4B> 0Z X_-4 XZ_4B>_JZ_I#)0 W784?4Ck?Ht J_Y}Hd HȌ @@+` CD@ǜEHh I،$!*+` CBH& ^hAH@"j4?6xC4A@"+` 4H4 EJ8!JȌ`ajZ_YYH J8!Cj4j+` H3 JePK? K?K?K?!K?)K?1@O?Hx K_ KY_ Z}K>Hz KYH ##4] q7菀`pHa +` H4 JH Cj"j4?6xC 4Ht H??+` J4?4X84C 4B?I4?74C 4B>CH4 J8 !4Hs jJePj Xj+` 4?! H% Z5`hC 4 ]4B=Jz4_ ! 0Hd IDZ_e45 PD_ZГC_%Z` X XA P4Ȍ_Z i0W4x `4?4C 4B>Z!)0_59 XZ_Q4B>y_ JZ_ iF I0W4?4X4C @k?Ht Ku>qKs>y k?Ku;Ks; k?k?77?Ak?7?k?a k?i7>k?qk?y^,p,_7> Fə4ZE7?I' 'VK?A:G/ҟ _k?I7>48__}ZZX])4]Z4?| #*W78C4K?A 7?I'V:G/EГ u _ek?I48 _  _EZ4X\Z]QZ4| W 4C4?+` H" HA J7?K>YK?aK?iK?qK?yK?/P,@7>B@ *4"E,@ 7?I'EK?A8W/ҟ _k?IW48__Z4X\5Z]Z4?| #* W78PC4K?A# 77?I,'D8W/Г u _ek?IA48 4_ 3 4_=Z4X\Z ]AZ4| W 44?C4B= @k?+` ok?ICk?k? k?k?!k?)k?1k?9Ak?AIHt J@jjhjhj #jJH # J4 ?+` H$ HH` B`#d 4 4?4Cp4`# 4+` 4 ?H* IHH"DC$@H JH"T"jA@ 0+` H J! Z4 +` H5 JH!DJ4!>]@ 0+` H HA j4 +` H& HH |DC@A@H JX?C+` H4 Jp?@DC@+H$@ (+` ZH& ^uHh+` ZH5 ^J>C@+`  ZD^5YH J] Z+` H4 J8!IJ#I 74?X7F @@0# # #  ) 7 +` GH( _IH J@K? K?K?K?!K?)K?1K?9K?AK?I@O?4?584B4B?y Y_4B?` +` A4 x+` YH% D^H~+` ^@Ap4H 4?uj4H4 CJ8 4?Hu jJPj Hj jZ4xj4 B@\m4B=^mJHw YJ@JPuHu ^%JZ^ H"0W6Z4Bk?Ht H8 K "XF#4\7aH 4J8@!PJȌa(jZ^]YH J8@ C4jj+` H4 JP<%C^JHd YHHP@X4B;^}J4"0H W6 J4?k?B! 0 X^5 XZ^]4B>^JZ^uG"0W4?64BLk?%H J8 H jJfPj&jJz4^!I0H LD(Z^45Y PD^ZЂZ^ME; X@|4Ȍ_ZM 0^ @Z^G#0W4?74Bk?H 4?6xB4H U64JZ^4B#%7 7 4& ^]Y4"jW6x (B4?H H"+`  Z^YH Y^I:hC`4B!YJ^=Z @A@H Z^-Hx]hJh^Z +` A @H Z^IY`i\h 4?4 4B`4BY4?4xx4B84BJ7?+` #*4?78 B4IH 4!j5x HB4B Z6x84B4B! Z5 4BX4B)@|4B44?4X4B4B1_1@Ht ) 7Z?F4< @@0 ) 0" 0" 0" @4< @6 @6 6 @k?oIk?)k?1k? Hk? 0k?k?!4Z^44 PD^ZЁC^eZ` )0@4Ȍ_Z I0W4X `4?B 4K>K? K?K?K?!K?)K?1@O?Z49 X^ XZ^U4B?@k?+` ok?1k? k?k?k?!k?)H4 J8 !(CJ I 44?X4W @@0 0 0 0 4 ! 4t?X5 @@0!) " " " 53 #)04?780k?B4+` H7 JH!Xj4z? i F`4i @@0# #I # # 7 +` 4H? ! 0GZ^45 PD^UZЁC^Z` "i0@4Ȍ_Z I0W4X `4?B4K>K? K?K?K?!K?)K?1@O?Z X^-6y XZ^4B?7I 7 u7 6 6 u6 4 4 4 k?+` ok? `C^Q@Ht J8 8D4jjK?YK?@O?^J4"0Hs 6 WJbk?k?Bx4?]Ht H$ hUhk?+` ok?Gk?Fk?!k?1Ck? k?)H4 J8 "Eb`jZ^YHt J8@!D4jj+` H3 JeP HCK>K? K?K?K?!K?)K?1@O?Jz4^! 0Ht IFZ^ 45 PD^ZГC^ EZ` X 0@p4Ȍ_Z!)0W58 `4?4B4B>Z X^ 4 XZ^u4B>J^ 04Hf W4 4?Hk?B`k?Ht jj^JZ^H )0W4?484Bk? Ht k?474f4A4+` H4 4JA 4hK?Y@7?_@44h44A 4B?@@+` k?44jo4EH4 AJH H"4A 4lK?Y@O?_4B?@@k?+` oDk? 8C@ @444? YH Y^J`@K?Y^@@4H 4?jK?YK?@O?_4?4 *H ZhCB48\4B?@k?+` 4oDk?CH" *48xHA 4?"4\ 964 "j4?`H6xHu Y4_JK?YK?@O?B@@4Hd 4?hBx4B?!@k?+` oDk? 8C@X@444? YH Y^ 1J4 "4?`86B @@4H 4?jK?YK?@O?_4?4 *H ZhCB 48 \4B?@k?o 8C@@4Y4 4?+` YH# ^ Hz4 J4?` 4X hB H@@\4K?Y@O?_@ *4?4B 48 \4B?@k?o 8C@@4Y4 4?+` YH4 ^ J4 "j4?` 6x HB @@,4K?Y@O?_ j4+` H" 4x HA 4?\y4B?B 4B?@k?o 8C@@4Y4 `4?+` H" HZ^ QY`K?YA P@K?Y@O?_}@ *4?4B 48 \a4B?@Ku<Ks<  k?Ku;Ks; k?k?+` oDk?H: KS(` C_MZHz KS0` _%ZHz KSH` _ZHz KSP` _ZHz KS@` _ZHz KZp@ _@B@_Z@Ku:Ks: k?KuaKs>i k?k?ok? @$xC+` H" HA 4?K>K? @O?"j6w Y4B04 `6?#@@p"p# #p#`#P#@#0# ####@"#J###*6H h7j"@@ *@#" J" 74?# 78Y4k?k?Bk? p@ h?=mK>_uHz( z_Hz 4H}(4?H Y jk?4wk?k?k?BH4B<#Ju7D_%@4 p4?"Y6 k?k?B4B>u43e6xU4SE6546(}78m7TX]7M74h4? *47PY4B4B;y@Ku>Ks> k?k?o_C+`H" !+` H4 JЎ!zJ!J 4?J4 4 4 4 4?#Y74Bk?4?\I4+` H3 Jb4A?"4jK?Y@O?_%4B?4?#Y74Bk?+` H# 4?h`@h4B?A4?"60Y4k?B4B?1H" HA ?K?Y4?"j6whY@ @K?@ @k?+` 4ok?IDk?14k?Qk? k?k?k?!k?)k?9Bk?AH HA@ (4 *4?48A4+IF!j!HL!J@4]@HpE4 hp d4CI4 c 4?J04Bu@P5xc J( Z 4?B  4|`5pAl@I 4?4K@?5XIpk?k?k?A 4B>@Ku=!Ks=) k?+` Xk?7"k?AWC6`H9 3 ak?! V 4?K!P4Tƌ k?)4_7?!4H| "4?KP` 6K>K?A@7?A4B?A4B?q@k?+` 7k?1Ek?!k?)k?9k?AH! H3` 7?` 44H 4cK [H փBJ  ` @?D+` DH% [=HH h`7?7?4k?]k?+` H: KY0"0K?`x4E H WK?4?K4 4cAk?K?yH YB+` 4Z4E[eH& K?h@`SF4Gs`H K 4c4y_S]UK?K?AK>K?!K?)K?1K?9@7?K?H E K8 [}  [M7H K?Ju   [U K?UYBKu:Ks: k?Ku;!Ks;) k?KuAKs>I k?k?+ok?Dk? k?H!` (+` _4: e4h`B(4?BH@_@$D+` H4 EJj6!j^F+` 44# _E h` h_%4dH A@"jW6x4?4 A,@K>K? K?K?@O?A 4(+JC+` @4H8 +hxXB`h$P4#[HzXbHzX4[4bJH HC8`!+` H8 K@`>K>G^ K"ZF^6hZ^ qC` @4"X6p^ iZ]Z4`>K>+` #*H< 78x4?(K@_@H F^ FZ jD4yh]ЅZ^ aC` @4XZ ^ Y4p]Z4`>+` H6 44?4J8A4B=A@4 *W484?Ka?H?k?A4B=QA$@Ka?#JW7X4 4?H=k?A$4B<+` H& H@4B jA@WZ,4xA\@ *M48XJ_} A@Ka?#*784?W4 H4A$k?_4@Ku=Ks= k?k?+74k?!7?4_H:P4 *4?`48ȏ@K?4A pZ] @+` H4 J8 (Z\K>K?!@7?_U4B?"j4?4A6x]44Al4B?q@Ku;Ks;  k?k?+7 k>k>k>k>k?k? k?k?k?!k?)k?1k?9k?Ak?IH"X_$7>4 Z]76K>G>NO   + 4   YH:XC A4 _ XC0H 4`+ EJL !@+CH:7A?!`h+Ix  6 5) f44]qZK>G>7Z[FHx (DHuhx6EhdHx[ZHtHx  @[ @hxH:7W?7`DI_x ? 4 ]yIZxb>4?K6YK>K>K>K>K?K? K?K?K?!K?)K?1K?9K?AK?I@76+7Z[QCHyx (FHhfx7hH[=ZHHzx & [h`xKa?H' HCA$!JW5X`4?4 HhA K? K?@O?]@<XA4 4_UHzPGH A j4 Z4w4?k?A4B>ȁH KuA T@4 "jZWAt6x 4_I4B=_}4BxA j4 W4xA4?4_4B=4?4804A4B<_4@@@@K?@ @Ku>Ks> k?Ku:Ks:  k?Ku=Ks= k?Ku<Ks< k?Ku9Ks9 k?Ku:qKs:y k?k?7 k?9Ck?!4?k?)k?1B D4+` E+` [h Z44_=h 4fH h&_ 4X_ 14H H )+H<p+` h4?H% H hhhh@)`h+H<p+` hH% ]9h& 4A77! [Y(0ZA@"jW6x 84?A04 4`%4bF# 7 p_4!X+` + " 6 H90_}4_4"6 x_MY"j_6z _U4_u4 J4Z @_U@ *_=4: _4#_7 _4\K6K?!K?)K?1K?9@77H: ED4D[C#4]@#4H ]GH J؎$A@Ǽ@A@ǜ+` A@+` H< Kp#C+` H4 J(!C+` H6 J0 0C[=@ZD_4B>9_@FH| ]G# DZ]7hЗC]eZ` @4#X7p]]Z]Z4`>+` AF J44?4X H K0Ak?H k 0_}@Hu F]mF"jZ6yh]DЅC]%Z` @4#JX7Yp]Z]Z4`=+` A +` 4 XH# 4?4 Hw(Ak?44_a4B;_5@H F]%G#7hD]mZЙC]Z` @4XZ ]4p]eZ4`<-+` A8@4 *48 +` H" _HWp_4B;Y+#*7: H90_ _ 4#Y_7 x# _7 _4"_6 "_6 @_4 _u4 j4z _4B=_4^ z]QZ 4A@4 "W4?6 k?A4B7y"M6 P]4B6]4B6)@Ka?@H<k?oEZk?C] k? *DZ]%49hЁE] Z @4XZ j] 4yp]Z4K?YK?K?@O? *k?474?o4A C+4_ H:P`K?Y@O?AP@4 *Z474?k?A 4B?@7Z?4 A`# @@"" # # # # # # # # # # @ *`"`# P# P"@4<H@6(@68@6X@7@6h *7ZJ4<x@@`"@ *P@H"H"H"@4<@6@@66@6@ @K?@ @k?Z_ A7_@+` H" HA p *4?47 4+`H4  (Y4?"j6w 4YAl@K?Y@7?@ @K?@ @k?Zo_)D *Y_ 4:HK?Y@O?@ @K?@ @k?Zo_4?_ i@ *447Z+`H"  YA @4+_=H:P`K?Y@O?A@4 Zk? jY4wA|4B? J44WPAT4B?q@@P@K?@ @Ku:QKs:Y k?k?Z_74 *4?47AY_u444? *47ATYK?Y@7?@ @K?@ @k?Zo_ D *Y_ 4:`K?Y@O?Ku=Ks= k?Ku:!Ks:) k?k?7k?C7?)_mk?!4 47?!Z_mk?i "4K>K?@7?A@4 4? *47pYk?A\k?ςK>Ku>Ks> k?k?+` 4?oH" *48HA@ 4 `(+`Hx44_M4: C` 4K?Y@O?AX@4 "j 4?6xWA pk?ςK?YA P4B?1@k? @(7HA7=k?4k?4_k=4 47=Z_k=鏀% 4`!p"(4?+` H4 J ` 8+`h \K=YK?K?@7=J@@ "#(+`K44_E4:  (C4`?e\U\AH@#* 78W4?4 A`k?44?64A(4B?7> J4_k>4 7>Z4_k>I"4`>'4?#(7>iK4_k>a4 7>aZ4_k>!4`=4? @(7>HA4$_k>4 7>Z4_k? !4`='4?"(7?)J4_k?!4 7?!Z4_k?i "4`<+` 4?A @k?4?# 7pY4 Apk?4A `@k?"j4?6wpY4 Ak?4A @k?4?#7pY4 Ak?4A @k?4?# 7pY4 APk?4A @@k?"j4?6wpY4 Ak?4k?+` H" HA (7+H<pK?Y@7?]Y4B?@k?_ 7K?Y@7?@Ku;Ks; k?k?477=k>k>k>k>k?k? k?_mk? 4?A @ * W48`4?A4 K=YK>K>K>K>K?K? K?K?@7=7>A_  4 J 44Xȇ (4?A@ * %48K= 4K=І.&'F8WӨ'E(K>Y'8WФ$ J'D '8WK>I u '<'8W& K>Q' B "ҿ& k?V&W& K=K>AK=k?k?k?k?yk?qk?i@4B=I@@k?+Bok?D+k?EH #A`(4zK?YK?K?@O?ZU@HxCZ (YHhx6}h[1HHHx Z}hx+k?44ok?CH:P+` _ 9D 44?4^X+H 4?h3PJ8 0ZZ@K?K?Y@O?^%4B?_qHzP4 * 4? 48@L@A@ * W4804?@ 4 +` 4^D4H ht J 4 4X4?@4B?@k?+"oD6 _1H90_Q4"Y_6 x "j_A6z _4_!4 J4Z @_@ *_4: _4 *_4: K?Y@O?k?7 k?!77!ZYZ x4^A@4 *W48 84?@@4K6\K?!@77_@4 *W48 P pZ\?}4A@4 JW4X 4?k?@4B?!4?k?oEk?k?@` 8D `\ @Hc `? ` h( ` :  h K?YK?K?@O?jd Ha(h h(Hs(`  hd(jd k?7k?17?k?9Gk?Qk?!k?)k?Ak?Ik?Y @ !D7;!Z[ q4J"@C74J[ AZ!I| YX[  Z  [  Z!0EhxC`@(ZYX[ hg ZMZChxC`@(ZYX[ !hg 5$  @>ZK:K?!K?)K?1K?9K?AK?IK?QK?Y@7;ChxC`@(ZYX[ Ihg - ZZȼCZZChxC`@0EZYX[hg  +k?4>k?)Fk?Ak?!k?1k?9H@!PC`!0 ^Z4A?!#> 4Y_4<4ZZZy7 ZZ|`B 6?4c     `K?!K?)K?1K?9K?A+4>K?@ ZE@ +k?4> J Ak>4YHZk>Ik?k>k>k? k?k?\k?!G"@4 46!b 46k  ^ 4*@"bZ6y\X!EZ[4 Z[a4 #<4@786 t#Cp# t4F rZ Z4`P4Z4D Ӵ#2"6WZ 5Z@0 4@St!Vp! ` # >-"b\-Z4K>K>K>K>K?K? K?K?K?!+4>K?@Z[7胃 z `4F?-Z[!4z? X"YZ4k?@4B> p4e4@t J2^5xZ_} Y58Z Y_4B>Y 098? 09~  t?U?@ `=W6_ 6˗%@(U 6 _ $ݷ046U b03t? b03? b034Fk?oFk?k?k?@` PE `Y\I4@* DHc `? `4 rH ` H(jt( zH j Z e  Z M  Z 5ZK?YK?K?K?@O? ] Ku;Ks; k?k?oIk? HZk?Fk?!Ek?1k?Zk?)Z7ZZC4@7?4  S t(r `  4@ Г t(r @   4@ZZX ZZZq7ZZ}G7?4@4  ҳ t(r `  4@  t(r @   4@ZZX   P4? \ aY@04 SH ? 4ȓ": 04? hZZZZuZK?1K>K? K?K?K?!K?)@O?_Y ZK>Ze (# ZZ7!4fZZ # ZZU7 >4f ZZZZH 7YZqZ# DZWXZ70_Z>= * Y4:@_4B>Z]Z=@ Z 40ZDk k(ZZ q7Y ZZYZ_ 54B=A@k?ok?&k?)Dk?1k? k?k?!@ 4Z   Z4%  ZZY Sb4c ZZuY Sb4cH ?54c4bZZ @ I!xD4z ZZYZ|SY 04Z6c 6Ze@Z%Z  " ZZ%YZ|Y 04Z7 6Z@ZyZ  "H >   \K>K? K?K?K?!K?)K?1@O?k?ok?@` PD `\Y@04 SHc `? `4K?Y\K?@O?k?40Z 7k k(K?Y@7?k?oDZI@ Z1  ZZK?Y@O?k?4_ 7K?Y@7?k?4Z7K?Y@7?k?oEk?k?@@` X@ `ZHd `Z h `ZZd `ZZK?K?YK?@O?k?oFk?EZk?ZZD 4AZqZ * D490ZWZX_Z (YK?YK?K?@O? 4@^4B?@k?oEk?DZk?7?4@4  3 t(r `  4@ S t(r @   4`@ZZXe K?YK?K?@O?+k?4>k?a ~k?Q4e;! Ek?IFZk?YDk?AZG * YW 4874AhZ4?@x4 4K?AK?IK?QK?YK?a+4> K?@Z@4zZuZYXW?eZ"_k?πMK?Ak?oEk?k?@` PD `[Y@04 SHc `? `4` XhK?Y\K?K?@O?KuK? K?K?K?!K?)K?1@O?Z Y^X `Z  Y@XZ @ `@?Z%  b! "4k? * 490o_C 4K?Y\@O? * Z_549@?4 J 4YP_Z?4"j Z_6y`?U4" Z_6h?%4 " Z_u6>4Z j _E4y404 K?Yk? * 490o_C 4K?Y\@O? * Z_49 ?4 J 4Y_eZ?4 "j Z_56y?U4 " Z_6Ї?%4" Z_6>4" Z_6>4Z j _u4y04K?Yk?ok?!Ek? k?k?k?)@#k?1Z @Y7#F4444D4 ZZ yZ|be 46?kgH6?@@ 46?!6?6?6?6?6?6?6?6?x6?h6?X6?H6?86?(6?6?6?6?6?6?6?6?6?6?6?x6?h6?X6?H6?86? 46?H!6? R4c=M@56? ZZi `+@@h<('D'8G'Vh$(Z ZK>K? K?K?K?!K?)K?1@O?k?oK>k?Kk?Jk?)4k?1Gk?94 k?AEk?I4k?Q4k? k?!ZZ|a A43?yf"@@@@@@@@@@@ Zh@X@@48@(@@`4,5c55Z5 4$5+4H:h@%xC+H)p$e F+4TH,h+4 4$ +` Jh4) ZZ|d* 4 6?yuh4@@@8@(@@@@@@x#J  J @@@@x@h@X@XIW(} #  z# Z7 Z X 4 * " ZZa48 c"j Z6y@Z!4B?D7^@4Y@ 4 Uն" Zu6X@@0 J 0 * 0" 0" D4YhD49xD6D6# ^ 7Π5" 7YZY4%Z 4Y4# IZ 7( X6 P7W HZ @4k?k?k?k?Y4B?A+K>K? K?K?K?!K?)K?1K?9K?AK?IK?QH<h@O?Zy@Y Zhph|hY Z+h|h}h$pk?oFk? k?Ck?YD4hZZ *!4hXZ_ @ ZZ14 PZ4X_ =@K?YK?K?K?@O?"j 6y4_ Z4_ 44Z_ 44=Z?EK?YYZX  j 4yY%4B> J Z4Y_ 4 * 49Z_ 4 * Z4_ 494hZKu>Ks> k?Ku=Ks= k?Ku=aKs=i k?Ku>Ks> k?k?7k>k>k>k>k?k? k?k?k?!k?)k?1k>!k>)k>1k>9+MEL+HKJ+7>)4I_M4:+CH` &pZH`XHzX_-W`DH``jY]HzX4H`4UV HUEh`I:`YU4?i\X+Z}47>\k>+H$dE+H)ȉa+` H+ ` @!+H4tCc>7>@Z+H8x H:x+H9yx+` XD+` H @4H9 _ +D:+\HH @4(\F"ix\Y+H:x@!`D+` H< @@+` 40X^H9 _4 +H$Ё`++_4:K?1K>YK>K>K>K>K?K? K?K?K?!K?)@7> ZH Y@H8XIX Z Y@4B?)+` YYM4: P+X Z YH&X+`k?_47 j X4yp\yHx+`_+KH=4A>5k\Hxhx+` H' @ H @!* Y59x5:x\ 4(%ixȁ4H(7>H "j 66yZ6k?Y 4B;Ka? ZC Y+X H(X+` k?_ M47 p4z X\4p+H&8:+4z _%4B:-h`Yh`ui|XKa?k?7]H:K?Y@7?@Ku=Ks= k?Ku!+` 7>AG! +F4cZ5YXH W4_eHHZ Y H0`_4csw4c\9H `Ka?H3d Jf B_@ * 4:X^H_4b@+`! F+` GIZ @4i?HY C5 XY EZH W4_HH_5IY @!xKa?م"_eIZ @+`IZ @D4+` 4_H9 IZ @_H Ka?H3d pK=نf bz IY @_ WH4 IY @^@_4K=K?!K?)K?1K?9K?AK?IK?QK?Y@7>H 4 `^4B?qH"Z *_= j H4z %IX @HIX @+` [JIA @h`x k?ok?FYZk?1Ck? Hk?k?![k?)@BK>K? K?K?K?!K?)K?1@O?`h4D Y ! Z[9@?mK>ُ`44[Z?-K>_]@ J 4ZX^aY4_ 4B>4g?`XI  ! `` `pZ s `4?4c?Y -ZY7Y ZY %4B>[@  `Y U4B?i_%@5 `^ 1X4_ 4B?@k?7k?QFXBk?AHk?Yk?aDk?IYk?i`(ESC4c?`?`ZY 7?!Y7YZY 4WZZ4 K?!` 4ZZ`8CD 4c? hZ`? Y mZK?iK>K?AK?IK?QK?YK?a@7?Y 4B?K?)ZXW C _4cK?!aK?)KuYK?K?K?K?@7>_4B?_U@ * Y4: ^ Y@4_ 4B?i7>Y}H: ?/K>Ka?H3d? 4f?+_@ J <]4Z psK>Y+` [ 49 P>+H:x@ G+H'0^}C+` XG4+` H @I+`E_I9 H" 46 _I9 H @Hu0H_6H @H`[=@hx+` H) @ k?ok? k?k?k?!k?)k?1k?9k>k>k>k>HIJG7>44YZWCZY_Xba7 ZY4B?!+GH!@ !+`E+FHH+`449PB+` 7E 8 43 x  j@hHhH4h@K>K? K?K?K?!K?)K?1K?9@O?+F+`EHH4(Y  HH     Z Y4_WZYE4B? 44+` 4` P+` 4! Ю_ @4@4k?o]Cf+` 43 c \K?Y@O?k?]-7+` Y44! (Y 8\6_ ( * ^4:4K?Y@7?k?_ 97K?Y@7?k?+` ok? F+`Gk?!+` Ck?EYk?DHa Z+` F+`G4Y 4YZYMh| Y ZZh @Y hK>K? K?K?K?!@O?Y%@YH @HY4B?@+@h:+@H<+@h:k?Y@ 7+`Y4:K?Y@7?+@h:+@H<k?_i7+K?Yh<@7?+@h:(+@h:0+`H<@h +k?7_4:K?Y4@7?+k?7_4:K?Y4@7?k?+oD+4k?_CHax 0Z_Q4K?K?Y@O?[ @h`x+` H" @ @+@h:+k?4:o_C+H"x@ (Z_q4zK?Y@O?_4B?@k?Y@ 7+` Y4: pK?Y@7?+@h:+@H<k?_ 7+K?Yh<@7?+@h:8+@h:+@H<k?_ y7+K?Yh<@7?k?Y@ 7+`Y94:K?Y@7?+H<+H3+H5 x\ x\@k?_7K?Y@7?Ka?@H<@4@4k?+oIk?!E+`k?)D+k?Gk? Hk?Fk?1H!@ !4+E+`DHH4+`B6c 4:P+` & X 4&   r@hH4hHh@K>K? K?K?K?!K?)K?1@O?HHY t HHb  k?+V+oUk? k?k?k?!k?)H!HJPA +`CH 4&P+` 4% +`4$HvP4vB _ HuPIH6P4?htPK>K? K?K?K?!K?)@O?@ @K?@ @+k?H!oDk?k? +H! ( 84#V B h0S?VK?YK?@O?Ku=QKs=Y k?k?+ok?k?H6 Du BH4 4c?!B` S++H!_ K?K?YS@O??U460?6'k?+ok?H!  CK?Y@O?4_u 4cK?Y@ @K?@ @ B@ @? /usr/lib/dld.slcrt0: errno: ERROR couldn't open ERROR reading ERROR bad magic number/system id for ERROR bad hpux aux header for ERROR: mmap failed for dld (text) (bss) (data)? crt0: errno: ERROR: mmap failed for TSD tsd0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_set.WRAPPER_FILE_SEPARATOR=/set.WRAPPER_PATH_SEPARATOR=:Unable to open configuration file. %sProblem loading wrapper configuration file: %sThe argument '%s' is not a valid property name-value pair.Unable to resolve the full path of the configuration file, %s: %s127.0.0.1unable to bind listener port %d, or any port in the range %d-%d. (%s)server socket close failed. (%d)unable to bind listener to any port in the range %d-%d. (%s)port %d already in use, using port %d instead.server socket listen failed. (%d)server listening on port %d.server socket ioctlsocket failed. (%s)server socket creation failed. (%s)socket ioctlsocket failed. (%s)accepted a socket from %s on port %dsocket creation failed. (%s)socket close failed. (%d)STARTSTOPRESTARTPINGSTOP_PENDINGSTART_PENDINGSTARTEDSTOPPEDKEYBADKEYLOW_LOG_LEVELPING_TIMEOUTSERVICE_CONTROL_CODEPROPERTIESLOG(DEBUG)LOG(INFO)LOG(STATUS)LOG(WARN)LOG(ERROR)LOG(FATAL)UNKNOWN(%d)socket send failed. (%d)send a packet %s : %sNULLsocket not open, so packet not sent %s : %s(Property Values)received unknown packet (%d:%s)read a packet %s : %ssocket read no code (closed?).socket read failed. (%s)bM--> Wrapper Started as DaemonUsing tick timer.Using system timer.<-- Wrapper Stopped--> Wrapper Started as Console--> Wrapper Started as ServicewrapperStopProcess(%d) called. (IGNORED)wrapperStopProcess(%d) called.wrapper.java.commandjava"%s"wrapper.java.additional.%d"-The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.wrapper.java.additional.%d.stripquotes%swrapper.java.initmemory-Xms%dmwrapper.java.maxmemory-Xmx%dmwrapper.java.library.path-Djava.library.path="%s%c%s"-classpathwrapper.java.classpath.%dClasspath element, %s, does not match any files: %s\"-Dwrapper.key="%s"-Dwrapper.port=%d-Dwrapper.jvm.port=%d-Dwrapper.jvm.port.min=%d-Dwrapper.jvm.port.max=%d-Dwrapper.debug="TRUE"-Dwrapper.pid=%d-Dwrapper.use_system_time="TRUE"-Dwrapper.version="%s"-Dwrapper.native_library="%s"-Dwrapper.ignore_signals="TRUE"-Dwrapper.service="TRUE"-Dwrapper.disable_shutdown_hook="TRUE"-Dwrapper.cpu.timeout="%d"-Dwrapper.jvmid=%dwrapper.java.mainclassMainwrapper.app.parameter.%dwrapper.app.parameter.%d.stripquotes-Dwrapper.cpu.timeout=%d-Dwrapper.disable_shutdown_hook=TRUE-Dwrapper.service=TRUE-Dwrapper.ignore_signals=TRUE-Dwrapper.native_library=%s-Dwrapper.version=%s-Dwrapper.use_system_time=TRUE-Dwrapper.timer_fast_threshold="%d"-Dwrapper.timer_slow_threshold="%d"-Dwrapper.timer_slow_threshold=%d-Dwrapper.timer_fast_threshold=%d-Dwrapper.debug=TRUE-Dwrapper.key=%s./Classpath element, %s, does not exist: %sUnable to get information of classpath element: %s (%s)-Djava.library.path="%s%c%s\"-Djava.library.path=%s%c%s-Djava.library.path="%s"-Djava.library.path="%s\"-Djava.library.path=%s-Djava.library.path=wrapper.java.library.path.%dLD_LIBRARY_PATHfffgFwrapper.logfilewrapper.logSIZEwrapper.logfile.rollmodeYYYYMMDDwrapper.logfile.formatLPTMINFOwrapper.logfile.loglevel0wrapper.logfile.maxsizewrapper.logfile.maxfileswrapper.logfile.inactivity.timeoutPMwrapper.console.formatwrapper.console.loglevelwrapper.console.flushNONEwrapper.syslog.loglevelwrapperwrapper.ntservice.namewrapper.unix.namewrapper.portwrapper.port.minwrapper.port.maxwrapper.jvm.portwrapper.jvm.port must not equal wrapper.port. Changing to the default.wrapper.jvm.port.minwrapper.jvm.port.maxwrapper.debugwrapper.java.command.loglevelDEBUGwrapper.adviserwrapper.use_system_timewrapper.timer_fast_thresholdwrapper.loop_outputwrapper.timer_slow_thresholdwrapper.memory_output.intervalwrapper.native_librarywrapper.java.library.path.append_system_pathwrapper.cpu_outputwrapper.state_outputwrapper.timer_outputwrapper.sleep_outputwrapper.memory_outputwrapper.cpu_output.intervalwrapper.disable_shutdown_hookwrapper.startup.delaywrapper.startup.delay.consolewrapper.startup.delay.servicewrapper.restart.delaywrapper.restart.reload_configurationwrapper.jvm_exit.timeoutwrapper.disable_restartswrapper.cpu.timeoutwrapper.startup.timeoutwrapper.ping.timeoutwrapper.ping.intervalwrapper.shutdown.timeoutCPU timeout detection may not operate correctly because wrapper.cpu.timeout is not smaller than wrapper.ping.timeout.CPU timeout detection may not operate correctly during shutdown because wrapper.cpu.timeout is not smaller than wrapper.shutdown.timeout.wrapper.max_failed_invocationswrapper.successful_invocation_timewrapper.request_thread_dump_on_failed_jvm_exitwrapper.filter.trigger.%dwrapper.filter.action.%dSHUTDOWNwrapper.java.pidfilewrapper.java.idfilewrapper.java.statusfilewrapper.commandfilewrapper.command.poll_intervalwrapper.anchor.poll_intervalwrapper.umaskwrapper.lockfile.umaskwrapper.java.umaskwrapper.pidfile.umaskwrapper.ignore_signalswrapper.java.pidfile.umaskwrapper.java.idfile.umaskwrapper.statusfile.umaskwrapper.java.statusfile.umaskwrapper.anchorfile.umaskwrapper.logfile.umaskwrapper.daemonizewrapper.anchorfilewrapper.statusfilewrapper.lockfilewrapper.pidfileThe value of wrapper.max_failed_invocations must not be smaller than 1. Changing to 1.CPU timeout detection may not operate correctly during startup because wrapper.cpu.timeout is not smaller than wrapper.startup.timeout.wrapper.ping.timeout must be at least 5 seconds longer than wrapper.ping.interval. Changing to %d.wrapper.ping.interval must be at less than or equal to 1 hour (3600 seconds). Changing to 3600.wrapper.ping.interval must be at least 1 second. Changing to 1.wrapper.jvm.port.max must be greater than or equal to wrapper.jvm.port.min. Changing to %d.wrapper.jvm.port.min must be in the range 1-65535. Changing to %d.wrapper.port.max must be greater than or equal to wrapper.port.min. Changing to %d.wrapper.port.min must be in the range 1-65535. Changing to %d.wrapper.logfile must contain "%s" for a roll mode of DATE. Disabling log file rolling.wrapper.logfile.rollmode invalid. Disabling log file rolling.Got a log message from JVM: %sReceived a connection request with an incorrect key. Waiting for another connection.%dIncorrect key. Connection rejected.Got key from JVM: %sGot ping response from JVMJVM requested a shutdown. (%d)JVM requested a restart.wrapperRestartProcess() called.wrapperRestartProcess() called. (IGNORED)JVM signalled a stop pending with waitHint of %d millis.@@JVM signalled that it was stopped.JVM signalled a start pending with waitHint of %d millis.@@JVM signalled that it was started.bMLPMFilter trigger matched. Shutting down.Filter trigger matched. Restarting JVM.JVM process exited with a code of %d, leaving the wrapper exit code set to %d.JVM process exited with a code of %d, setting the wrapper exit code to %d.JVM process exited with a code of %d, however the wrapper exit code was already %d.bMQbMWorking directory set to: %sUnable to set working directory to: %s (%s)wrapper.working.dir3.2.0UNKNOWNDOWNLAUNCH(DELAY)LAUNCHINGLAUNCHEDSTARTINGSTARTEDSTOPPINGSTOPPEDKILLINGStartup failed: Timed out waiting for a signal from the JVM.Mainwrapper.java.mainclassorg.tanukisoftware.wrapper.WrapperSimpleApporg.tanukisoftware.wrapper.WrapperStartStopAppcom.silveregg.wrapper.WrapperSimpleAppcom.silveregg.wrapper.WrapperStartStopApp------------------------------------------------------------------------Advice:The Wrapper consists of a native component as well as a set of classeswhich run within the JVM that it launches. The Java component of theWrapper must be initialized promptly after the JVM is launched or theWrapper will timeout, as just happened. Most likely the main classspecified in the Wrapper configuration file is not correctly initializingthe Wrapper classes: %sWhile it is possible to do so manually, the Wrapper ships with helperclasses to make this initialization processes automatic.Please review the integration section of the Wrapper's documentationfor the various methods which can be employed to launch an applicationwithin the Wrapper: http://wrapper.tanukisoftware.org/doc/english/integrate.html Loop: check anchor fileAnchor file deleted. Shutting down. Set Wrapper State %s -> %s Loop: check command filer+tRESTARTSTOPCommand '%s'. Restarting JVM.Unable to delete the command file, %s: %sDUMPCommand '%s'. Shutting down with exit code %d.CONSOLE_LOGLEVELCommand '%s'. Requesting a Thread Dump.LOGFILE_LOGLEVELCommand '%s' is missing its log level.Command '%s' specified an unknown log level: '%'Command '%s'. Set console log level to '%s'.%dSYSLOG_LOGLEVELCommand '%s'. Set log file log level to '%s'.Command '%s'. Set syslog log level to '%s'.Command '%s' lead to an unexpected state.LOOP_OUTPUTSTATE_OUTPUTTRUECommand '%s'. Disable %s.Command '%s'. Enable %s.MEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTCommand '%s' is unknown, ignoring.Unable to read the command file: %sJVM Restarts disabled. Shutting down.Waiting %d seconds before launching another JVM.w%s Unable to write to the status file: %s Set Java State %s Timeout %08lx -> %08lx Set Java State %s -> %sThere were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.JVM was only running for %d seconds leading to a failed restart count of %d.Waiting %d seconds before launching the first JVM.wrapper.on_exit.%dwrapper.on_exit.defaultshutdownrestarton_exit trigger matched. Restarting the JVM. (Exit code: %d)Reloading Wrapper configuration...Launching a JVM...Unable to start a JVMJVM appears hung: Timed out waiting for signal from JVM. Temp: Sending a ping packet.ping Temp: Sent a ping packet.JVM Ping Failed.JVM exited unexpectedly.%s Last system time tick overflow at: %s Next system time tick overflow at: %s Last tick overflow at: %s Next tick overflow at: %sEvent loop started.no Loop: %ssleep Loop: process jvm outputPause reading socket data to share cycles.falsetrue Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%s Loop: exit requested Loop: handle wrapper state: %sUnknown wState=%dUnknown jState=%dEvent loop stopped.JVM exited while loading the application.startUnable to send the start command to the JVM.Start Application.Startup failed: Timed out waiting for signal from JVM.JVM exited while starting the application.Shutdown failed: Timed out waiting for signal from JVM.JVM exited unexpectedly while stopping the application.Shutdown failed: Timed out waiting for the JVM to terminate.JVM exited normally.JVM exited on its own while waiting to kill the application. Loop: handle jvm state: %sSending stop signal to JVMJVM shut down unexpectedly.Wrapper Process has not received any CPU time for %d seconds. Extending timeouts. Loop: maintain logger(2) Loop: process socketPause reading child output to share cycles. Loop: maintain loggerSignal trapped. Details:UNKNOWNSIGINTSIGQUITSIGALRMSIGTERMSIGCHLDunknownsigqueuekill, sigsend or raisetimer expiredAIO completedmesq state changed signal number=%d (%s), source="%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s) signal err=%d, "%s"Signal trapped. No details available.%s trapped. Shutting down.%s trapped. Forcing immediate shutdown.%s trapped, but ignored.%s trapped, but signals for timer thread are ignored.Timer thread started.The timer fell behind the system clock by %ldms.The system clock fell behind the timer by %ldms. Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ld Sleep: nanosleep %dms Sleep: awakeCommand[%d] : %sUnable to set JVM's stderr: %sUnable to set JVM's stdout: %sw%d Unable to write the Java ID file: %sUnable to write the Java PID file: %sFailed to set jvm output handle to close on JVM exit: %s (%d)Failed to set jvm output handle to non blocking mode: %s (%d)Could not spawn JVM process: %sCould not init pipe: %sUnable to start JVM: %s (%d)JVM process is gone.WIFEXITED indicates that the JVM exited abnormally.Failed to read console output from the JVM: %s (%d)Dumping JVM state.Could not dump JVM state: %sSpawning intermediate process.../dev/nullSpawning daemon process...Could not spawn daemon process: %ssetsid() failed: %sUnable to get the path-%s--helpWrapper (Version %s) http://wrapper.tanukisoftware.org [configuration properties] are configuration name-value pairs whichUsage: %s [configuration properties] [...] is the application configuration file. override values in wrapper.conf. For example: wrapper.debug=trueOptions: --helpWARNING: Could not write lock file %s: %sERROR: Could not write pid file %s: %sERROR: Could not write anchor file %s: %sUnable to set working dir to %s : %sUnable to extract path from: %sTimer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.INTTimer thread received an Quit signal. Ignoring.Received SIGCHLD, calling wait().wait() returned, child process should be gone.TERMUnable to register signal handler for signal %d. %sLaunching Timer thread.Unable to create a timer thread: %d, %sCall to getrusage failed for Wrapper process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldCall to getrusage failed for Java process: %sbMJVM did not exit on request. Attempt to terminate process failed: %sJVM did not exit on request, terminatedrt#includeset.default.set.%s=%sUnable to set environment variable: %s The following property name value pair is too large. Need to increase the internal buffer size: %struefalse name:%s value:%sNONE DEBUG INFO STATUSWARN ERROR FATAL ADVICENONESIZEWRAPPERJVMSIZE_OR_WRAPPERSIZE_OR_JVMDATEFATALERRORWARNINFODEBUG%swrapperpjvm %-4d | wrapper unknownsignal main srvmaintimer WARNING - Encountered an unknown thread %ld in getThreadId(). %04d/%02d/%02d %02d:%02d:%02dYYYYMMDDROLLNUM-ROLLNUM_ROLLNUM.ROLLNUM.%s-YYYYMMDD_YYYYMMDD.YYYYMMDDaUnable to open logfile %s: %s %s wrapper.log%04d%02d%02d%dUnable to delete old log file: %s (%s) Unable to rename log file %s to %s. (%s) Unable to rename log file %s to %s. File is in use by another application. Unable to get the current logfile size with ftell: %s Unable to get the current logfile size with stat: %s ????????!!!""""H#######$$$$$ $ $$%%%%%0%4'h'l''- @--  @-p--------. ..,.0.L.P.l.p......../ //,/0/L/P/h/l0H0L0X0\0x0|223<3@3344 4$4(555555555578p >(>>@T@BBGD GHHHIIJJKhL^8_ `D` r 0rsHshttu`uhuuvvwwwwxxyyyyzdzhzz{x{}4}8}p}x~,~0~~~~x px\`px(0 @ (X PX%` PX (|48tx0 4 PPɰʄʠͬθшטנPp$@hۈ۴`܀(LPdhh@(HHPDHPt x,H0848`hPX\P`<@tx$( T  (  0       08<@lp <@HPX`lp (08|48\`h" "0 -( -@ 5 7 $ @X B Kp *^ sP v v  (   8  ɸ ʈ Ͱ    $X  (   p ۸ h p 0  X    p   @@"6:@*@2@:@B@J@R@*RXR`RhRpRxRRR6 @@Z@b@pK7sPͰʈ0Kp"0B@_8(p@@8<`(8X5 Lɸ8B-@@X(p8(B^@۸K7K8@8K Xhv"-(X(pp@@L@P@X@H@@@@@(@ libgcc2.c/usr/x/emechler/gcc-3.2/gcc/libgcc2.cgcc2_compiled.int:t1=r1;-2147483648;2147483647;char:t2=r2;0;127;long int:t3=r3;-2147483648;2147483647;unsigned int:t4=r4;0000000000000;0037777777777;long unsigned int:t5=r5;0000000000000;0037777777777;long long int:t6=@s64;r6;01000000000000000000000;0777777777777777777777;long long unsigned int:t7=@s64;r7;0000000000000;01777777777777777777777;short int:t8=@s16;r8;-32768;32767;short unsigned int:t9=@s16;r9;0;65535;signed char:t10=@s8;r10;-128;127;unsigned char:t11=@s8;r11;0;255;float:t12=r1;4;0;double:t13=r1;8;0;long double:t14=r1;16;0;complex int:t15=s8real:1,0,32;imag:1,32,32;;complex float:t16=r16;8;0;complex double:t17=r17;16;0;complex long double:t18=r18;32;0;__builtin_va_list:t19=*20=20_Bool:t21=@s8;-16;rtx:t22=23=*24=xsrtx_def:rtvec:t25=26=*27=xsrtvec_def:tree:t28=29=*30=xutree_node:cmp_type:T31=eCMP_SI:0,CMP_SF:1,CMP_DF:2,CMP_MAX:3,;processor_type:T32=ePROCESSOR_700:0,PROCESSOR_7100:1,PROCESSOR_7100LC:2,PROCESSOR_7200:3,PROCESSOR_8000:4,;architecture_type:T33=eARCHITECTURE_10:0,ARCHITECTURE_11:1,ARCHITECTURE_20:2,;hppa_args:T34=s12words:1,0,32;nargs_prototype:1,32,32;indirect:1,64,32;;reg_class:T35=eNO_REGS:0,R1_REGS:1,GENERAL_REGS:2,FPUPPER_REGS:3,FP_REGS:4,GENERAL_OR_FP_REGS:5,SHIFT_REGS:6,ALL_REGS:7,LIM_REG_CLASSES:8,;ptrdiff_t:t36=3size_t:t37=5wchar_t:t38=4__gnuc_va_list:t39=19va_list:t40=39int8_t:t41=2uint8_t:t42=11int16_t:t43=8uint16_t:t44=9int32_t:t45=1uint32_t:t46=4intfast_t:t47=1uintfast_t:t48=4int64_t:t49=6uint64_t:t50=7intmax_t:t51=49uintmax_t:t52=50intptr_t:t53=3uintptr_t:t54=5int_least8_t:t55=2uint_least8_t:t56=11int_fast8_t:t57=1uint_fast8_t:t58=4int_least16_t:t59=8uint_least16_t:t60=9int_fast16_t:t61=1uint_fast16_t:t62=4int_least32_t:t63=1uint_least32_t:t64=4int_fast32_t:t65=1uint_fast32_t:t66=4int_least64_t:t67=49int_fast64_t:t68=49uint_least64_t:t69=50uint_fast64_t:t70=50ptr32_t:t71=46ptr64_t:t72=50mqd_t:t73=1dev_t:t74=45ino32_t:t75=46ino64_t:t76=50ino_t:t77=5mode_t:t78=44nlink_t:t79=44fpos32_t:t80=45fpos64_t:t81=49fpos_t:t82=3fsblkcnt32_t:t83=46fsblkcnt64_t:t84=50fsblkcnt_t:t85=5off32_t:t86=45sbsize32_t:t87=45bsize32_t:t88=46off64_t:t89=49sbsize64_t:t90=49bsize64_t:t91=50off_t:t92=3sbsize_t:t93=3bsize_t:t94=5fsfilcnt32_t:t95=46fsfilcnt64_t:t96=50fsfilcnt_t:t97=5blkcnt32_t:t98=45blkcnt64_t:t99=49blkcnt_t:t100=3pid_t:t101=45lwpid_t:t102=45gid_t:t103=45uid_t:t104=45tid_t:t105=45ssize_t:t106=3__site_t:t107=44__cnode_t:t108=44time_t:t109=3clock_t:t110=46key_t:t111=45__ushort:t112=9__daddr_t:t113=45__caddr_t:t114=115=*2__swblk_t:t116=45caddr_t:t117=114id_t:t118=45useconds_t:t119=46rlim32_t:t120=46rlim64_t:t121=50rlim_t:t122=5site_t:t123=107u_char:t124=11u_short:t125=9u_int:t126=4u_long:t127=5uint:t128=4ushort:t129=9ubit8:t130=11ubit16:t131=9ubit32:t132=46sbit8:t133=2sbit16:t134=8sbit32:t135=45swblk_t:t136=116daddr_t:t137=113cnode_t:t138=108paddr_t:t139=54page_t:t140=53pgcnt_t:t141=45upgcnt_t:t142=46physpfn_t:t143=46iophyspfn_t:t144=54pgaddr_t:t145=54space_t:t146=46prot_t:t147=46ulong_t:t148=5cnt_t:t149=43cdno_t:t150=46use_t:t151=44_physadr:T152=s4r:153=ar154=r154;0000000000000;0037777777777;;0;0;53,0,32;;physadr:t155=156=*152_quad:T157=s8val:158=ar154;0;1;3,0,64;;quad:t159=157spu_t:t160=1ldom_t:t161=1cpu_t:t162=8lkinfo:T163=s16lk_name:115,0,32;lk_flags:1,32,32;lk_pad:158,64,64;;lkinfo_t:t164=163pl_t:t165=5aid_t:t166=45sid_t:t167=101__fd_mask:t168=45fd_set:T169=s256fds_bits:170=ar154;0;63;3,0,2048;;fd_set:t171=169fd_mask:t172=168dir_off_t:t173=45FILE:t174=175=s16__cnt:1,0,32;__ptr:176=*11,32,32;__base:176,64,32;__flag:9,96,16;__fileL:11,112,8;__fileH:11,120,8;;_FILEX:t177=178=s56__cnt:1,0,32;__ptr:176,32,32;__base:176,64,32;__flag:9,96,16;__fileL:11,112,8;__fileH:11,120,8;__bufendp:176,128,32;__newbase:176,160,32;__smbuf:179=ar154;0;15;11,192,128;__unused:180=*20,320,32;__filler1:1,352,32;__filler2:181=ar154;0;7;2,384,64;;__va_list:t182=183=*13__not_va_list__:t184=183div_t:t185=186=s8quot:1,0,32;rem:1,32,32;;ldiv_t:t187=188=s8quot:3,0,32;rem:3,32,32;;sigval:T189=u4__svi_int_s:190=s4__svi_int:1,0,32;;,0,32;__sival_ptr:180,0,32;;sigval_t:t191=189pthread_attr_t:t192=1sigevent:T193=s52__sigev_notify:1,0,32;__sigev_signo:1,32,32;__sigev_value:191,64,32;__sigev_notify_function:194=*195=f20,96,32;__sigev_notify_attributes:196=*192,128,32;__sigev_reserved:197=ar154;0;7;1,160,256;;sigevent_t:t198=193__sigev_types:T199=e__SIGEV_NONE:1,__SIGEV_SIGNAL:2,__SIGEV_THREAD:3,;tm:T200=s36tm_sec:1,0,32;tm_min:1,32,32;tm_hour:1,64,32;tm_mday:1,96,32;tm_mon:1,128,32;tm_year:1,160,32;tm_wday:1,192,32;tm_yday:1,224,32;tm_isdst:1,256,32;;timespec:T201=s8tv_sec:109,0,32;tv_nsec:3,32,32;;timestruc_t:t202=201itimerspec:T203=s16it_interval:201,0,64;it_value:201,64,64;;__clockid_t:T204=eCLOCK_INVALID:0,CLOCK_REALTIME:1,CLOCK_VIRTUAL:2,CLOCK_PROFILE:4,RTTIMER0:8,RTTIMER1:16,;clockid_t:t205=204timer_t:t206=5timeval:T207=s8tv_sec:109,0,32;tv_usec:3,32,32;;itimerval:T208=s16it_interval:207,0,64;it_value:207,64,64;;timezone:T209=s8tz_minuteswest:1,0,32;tz_dsttime:1,32,32;;__cycles:T210=s8hi:46,0,32;lo:46,32,32;;cycles_t:t211=210ki_timeval:T212=s8pad1:46,0,32;pad2:46,32,32;;kt_t:t213=50rlimit:T214=s8rlim_cur:122,0,32;rlim_max:122,32,32;;rusage:T215=s76ru_utime:207,0,64;ru_stime:207,64,64;ru_maxrss:3,128,32;ru_ixrss:3,160,32;ru_idrss:3,192,32;ru_isrss:3,224,32;ru_minflt:3,256,32;ru_majflt:3,288,32;ru_nswap:3,320,32;ru_inblock:3,352,32;ru_oublock:3,384,32;ru_ioch:3,416,32;ru_msgsnd:3,448,32;ru_msgrcv:3,480,32;ru_nsignals:3,512,32;ru_nvcsw:3,544,32;ru_nivcsw:3,576,32;;__si_codes:T216=eSI_QUEUE:-2,SI_USER:-1,SI_TIMER:1,SI_ASYNCIO:2,SI_MESGQ:3,;__siginfo:T217=s64si_signo:1,0,32;si_code:1,32,32;si_errno:1,64,32;si_value:191,96,32;__data:218=u12__proc:219=s8__pid:101,0,32;__pdata:220=u4__kill:221=s4__uid:104,0,32;;,0,32;__SIGCLD:222=s4__status:1,0,32;;,0,32;;,32,32;;,0,64;__fault:223=s4__addr:180,0,32;;,0,32;__file:224=s8__fd:1,0,32;__band:3,32,32;;,0,64;__gfault:225=s12__addr:180,0,32;__lockpage:180,32,32;__dev_id:3,64,32;;,0,96;;,128,96;__pad:226=ar154;0;8;3,224,288;;siginfo_t:t227=217__sigset_t:T228=s32sigset:229=ar154;0;7;4,0,256;;sigset_t:t230=228__fp_dbl_block:T231=s256ss_fp0:13,0,64;ss_fp1:13,64,64;ss_fp2:13,128,64;ss_fp3:13,192,64;ss_fp4:13,256,64;ss_fp5:13,320,64;ss_fp6:13,384,64;ss_fp7:13,448,64;ss_fp8:13,512,64;ss_fp9:13,576,64;ss_fp10:13,640,64;ss_fp11:13,704,64;ss_fp12:13,768,64;ss_fp13:13,832,64;ss_fp14:13,896,64;ss_fp15:13,960,64;ss_fp16:13,1024,64;ss_fp17:13,1088,64;ss_fp18:13,1152,64;ss_fp19:13,1216,64;ss_fp20:13,1280,64;ss_fp21:13,1344,64;ss_fp22:13,1408,64;ss_fp23:13,1472,64;ss_fp24:13,1536,64;ss_fp25:13,1600,64;ss_fp26:13,1664,64;ss_fp27:13,1728,64;ss_fp28:13,1792,64;ss_fp29:13,1856,64;ss_fp30:13,1920,64;ss_fp31:13,1984,64;;fp_dbl_block_t:t232=231__fp_int_block:T233=s256ss_fpstat:1,0,32;ss_fpexcept1:1,32,32;ss_fpexcept2:1,64,32;ss_fpexcept3:1,96,32;ss_fpexcept4:1,128,32;ss_fpexcept5:1,160,32;ss_fpexcept6:1,192,32;ss_fpexcept7:1,224,32;ss_fp4_hi:1,256,32;ss_fp4_lo:1,288,32;ss_fp5_hi:1,320,32;ss_fp5_lo:1,352,32;ss_fp6_hi:1,384,32;ss_fp6_lo:1,416,32;ss_fp7_hi:1,448,32;ss_fp7_lo:1,480,32;ss_fp8_hi:1,512,32;ss_fp8_lo:1,544,32;ss_fp9_hi:1,576,32;ss_fp9_lo:1,608,32;ss_fp10_hi:1,640,32;ss_fp10_lo:1,672,32;ss_fp11_hi:1,704,32;ss_fp11_lo:1,736,32;ss_fp12_hi:1,768,32;ss_fp12_lo:1,800,32;ss_fp13_hi:1,832,32;ss_fp13_lo:1,864,32;ss_fp14_hi:1,896,32;ss_fp14_lo:1,928,32;ss_fp15_hi:1,960,32;ss_fp15_lo:1,992,32;ss_fp16_hi:1,1024,32;ss_fp16_lo:1,1056,32;ss_fp17_hi:1,1088,32;ss_fp17_lo:1,1120,32;ss_fp18_hi:1,1152,32;ss_fp18_lo:1,1184,32;ss_fp19_hi:1,1216,32;ss_fp19_lo:1,1248,32;ss_fp20_hi:1,1280,32;ss_fp20_lo:1,1312,32;ss_fp21_hi:1,1344,32;ss_fp21_lo:1,1376,32;ss_fp22_hi:1,1408,32;ss_fp22_lo:1,1440,32;ss_fp23_hi:1,1472,32;ss_fp23_lo:1,1504,32;ss_fp24_hi:1,1536,32;ss_fp24_lo:1,1568,32;ss_fp25_hi:1,1600,32;ss_fp25_lo:1,1632,32;ss_fp26_hi:1,1664,32;ss_fp26_lo:1,1696,32;ss_fp27_hi:1,1728,32;ss_fp27_lo:1,1760,32;ss_fp28_hi:1,1792,32;ss_fp28_lo:1,1824,32;ss_fp29_hi:1,1856,32;ss_fp29_lo:1,1888,32;ss_fp30_hi:1,1920,32;ss_fp30_lo:1,1952,32;ss_fp31_hi:1,1984,32;ss_fp31_lo:1,2016,32;;fp_int_block_t:t234=233__reg64:T235=s512ss_reserved:49,0,64;ss_gr1:49,64,64;ss_rp:49,128,64;ss_gr3:49,192,64;ss_gr4:49,256,64;ss_gr5:49,320,64;ss_gr6:49,384,64;ss_gr7:49,448,64;ss_gr8:49,512,64;ss_gr9:49,576,64;ss_gr10:49,640,64;ss_gr11:49,704,64;ss_gr12:49,768,64;ss_gr13:49,832,64;ss_gr14:49,896,64;ss_gr15:49,960,64;ss_gr16:49,1024,64;ss_gr17:49,1088,64;ss_gr18:49,1152,64;ss_gr19:49,1216,64;ss_gr20:49,1280,64;ss_gr21:49,1344,64;ss_gr22:49,1408,64;ss_arg3:49,1472,64;ss_arg2:49,1536,64;ss_arg1:49,1600,64;ss_arg0:49,1664,64;ss_dp:50,1728,64;ss_ret0:50,1792,64;ss_ret1:50,1856,64;ss_sp:50,1920,64;ss_gr31:50,1984,64;ss_cr11:50,2048,64;ss_pcoq_head:50,2112,64;ss_pcsq_head:50,2176,64;ss_pcoq_tail:50,2240,64;ss_pcsq_tail:50,2304,64;ss_cr15:50,2368,64;ss_cr19:50,2432,64;ss_cr20:50,2496,64;ss_cr21:50,2560,64;ss_cr22:50,2624,64;ss_cpustate:50,2688,64;ss_sr4:50,2752,64;ss_sr0:50,2816,64;ss_sr1:50,2880,64;ss_sr2:50,2944,64;ss_sr3:50,3008,64;ss_sr5:50,3072,64;ss_sr6:50,3136,64;ss_sr7:50,3200,64;ss_cr0:50,3264,64;ss_cr8:50,3328,64;ss_cr9:50,3392,64;ss_cr10:50,3456,64;ss_cr12:50,3520,64;ss_cr13:50,3584,64;ss_cr24:50,3648,64;ss_cr25:50,3712,64;ss_cr26:50,3776,64;ss_cr27:50,3840,64;ss_reserved2:236=ar154;0;1;50,3904,128;ss_oldcksum:46,4032,32;ss_newcksum:46,4064,32;;__reg64_t:t237=235__reg32:T238=s512ss_reserved:239=ar154;0;1;46,0,64;ss_gr1_hi:46,64,32;ss_gr1_lo:46,96,32;ss_rp_hi:46,128,32;ss_rp_lo:46,160,32;ss_gr3_hi:46,192,32;ss_gr3_lo:46,224,32;ss_gr4_hi:46,256,32;ss_gr4_lo:46,288,32;ss_gr5_hi:46,320,32;ss_gr5_lo:46,352,32;ss_gr6_hi:46,384,32;ss_gr6_lo:46,416,32;ss_gr7_hi:46,448,32;ss_gr7_lo:46,480,32;ss_gr8_hi:46,512,32;ss_gr8_lo:46,544,32;ss_gr9_hi:46,576,32;ss_gr9_lo:46,608,32;ss_gr10_hi:46,640,32;ss_gr10_lo:46,672,32;ss_gr11_hi:46,704,32;ss_gr11_lo:46,736,32;ss_gr12_hi:46,768,32;ss_gr12_lo:46,800,32;ss_gr13_hi:46,832,32;ss_gr13_lo:46,864,32;ss_gr14_hi:46,896,32;ss_gr14_lo:46,928,32;ss_gr15_hi:46,960,32;ss_gr15_lo:46,992,32;ss_gr16_hi:46,1024,32;ss_gr16_lo:46,1056,32;ss_gr17_hi:46,1088,32;ss_gr17_lo:46,1120,32;ss_gr18_hi:46,1152,32;ss_gr18_lo:46,1184,32;ss_gr19_hi:46,1216,32;ss_gr19_lo:46,1248,32;ss_gr20_hi:46,1280,32;ss_gr20_lo:46,1312,32;ss_gr21_hi:46,1344,32;ss_gr21_lo:46,1376,32;ss_gr22_hi:46,1408,32;ss_gr22_lo:46,1440,32;ss_arg3_hi:46,1472,32;ss_arg3_lo:46,1504,32;ss_arg2_hi:46,1536,32;ss_arg2_lo:46,1568,32;ss_arg1_hi:46,1600,32;ss_arg1_lo:46,1632,32;ss_arg0_hi:46,1664,32;ss_arg0_lo:46,1696,32;ss_dp_hi:4,1728,32;ss_dp_lo:4,1760,32;ss_ret0_hi:4,1792,32;ss_ret0_lo:4,1824,32;ss_ret1_hi:4,1856,32;ss_ret1_lo:4,1888,32;ss_sp_hi:4,1920,32;ss_sp_lo:4,1952,32;ss_gr31_hi:4,1984,32;ss_gr31_lo:4,2016,32;ss_cr11_hi:4,2048,32;ss_cr11_lo:4,2080,32;ss_pcoq_head_hi:4,2112,32;ss_pcoq_head_lo:4,2144,32;ss_pcsq_head_hi:4,2176,32;ss_pcsq_head_lo:4,2208,32;ss_pcoq_tail_hi:4,2240,32;ss_pcoq_tail_lo:4,2272,32;ss_pcsq_tail_hi:4,2304,32;ss_pcsq_tail_lo:4,2336,32;ss_cr15_hi:4,2368,32;ss_cr15_lo:4,2400,32;ss_cr19_hi:4,2432,32;ss_cr19_lo:4,2464,32;ss_cr20_hi:4,2496,32;ss_cr20_lo:4,2528,32;ss_cr21_hi:4,2560,32;ss_cr21_lo:4,2592,32;ss_cr22_hi:4,2624,32;ss_cr22_lo:4,2656,32;ss_cpustate_hi:4,2688,32;ss_cpustate_lo:4,2720,32;ss_sr4_hi:4,2752,32;ss_sr4_lo:4,2784,32;ss_sr0_hi:4,2816,32;ss_sr0_lo:4,2848,32;ss_sr1_hi:4,2880,32;ss_sr1_lo:4,2912,32;ss_sr2_hi:4,2944,32;ss_sr2_lo:4,2976,32;ss_sr3_hi:4,3008,32;ss_sr3_lo:4,3040,32;ss_sr5_hi:4,3072,32;ss_sr5_lo:4,3104,32;ss_sr6_hi:4,3136,32;ss_sr6_lo:4,3168,32;ss_sr7_hi:4,3200,32;ss_sr7_lo:4,3232,32;ss_cr0_hi:4,3264,32;ss_cr0_lo:4,3296,32;ss_cr8_hi:4,3328,32;ss_cr8_lo:4,3360,32;ss_cr9_hi:4,3392,32;ss_cr9_lo:4,3424,32;ss_cr10_hi:4,3456,32;ss_cr10_lo:4,3488,32;ss_cr12_hi:4,3520,32;ss_cr12_lo:4,3552,32;ss_cr13_hi:4,3584,32;ss_cr13_lo:4,3616,32;ss_cr24_hi:4,3648,32;ss_cr24_lo:4,3680,32;ss_cr25_hi:4,3712,32;ss_cr25_lo:4,3744,32;ss_cr26_hi:4,3776,32;ss_cr26_lo:4,3808,32;ss_cr27_hi:4,3840,32;ss_cr27_lo:4,3872,32;ss_reserved2:240=ar154;0;3;4,3904,128;ss_oldcksum:4,4032,32;ss_newcksum:4,4064,32;;__reg32_t:t241=238__ss_narrow:T242=s248ss_gr1:1,0,32;ss_rp:1,32,32;ss_gr3:1,64,32;ss_gr4:1,96,32;ss_gr5:1,128,32;ss_gr6:1,160,32;ss_gr7:1,192,32;ss_gr8:1,224,32;ss_gr9:1,256,32;ss_gr10:1,288,32;ss_gr11:1,320,32;ss_gr12:1,352,32;ss_gr13:1,384,32;ss_gr14:1,416,32;ss_gr15:1,448,32;ss_gr16:1,480,32;ss_gr17:1,512,32;ss_gr18:1,544,32;ss_gr19:1,576,32;ss_gr20:1,608,32;ss_gr21:1,640,32;ss_gr22:1,672,32;ss_arg3:1,704,32;ss_arg2:1,736,32;ss_arg1:1,768,32;ss_arg0:1,800,32;ss_dp:4,832,32;ss_ret0:4,864,32;ss_ret1:4,896,32;ss_sp:4,928,32;ss_gr31:4,960,32;ss_cr11:4,992,32;ss_pcoq_head:4,1024,32;ss_pcsq_head:4,1056,32;ss_pcoq_tail:4,1088,32;ss_pcsq_tail:4,1120,32;ss_cr15:4,1152,32;ss_cr19:4,1184,32;ss_cr20:4,1216,32;ss_cr21:4,1248,32;ss_cr22:4,1280,32;ss_cpustate:4,1312,32;ss_sr4:4,1344,32;ss_sr0:4,1376,32;ss_sr1:4,1408,32;ss_sr2:4,1440,32;ss_sr3:4,1472,32;ss_sr5:4,1504,32;ss_sr6:4,1536,32;ss_sr7:4,1568,32;ss_cr0:4,1600,32;ss_cr8:4,1632,32;ss_cr9:4,1664,32;ss_cr10:4,1696,32;ss_cr12:4,1728,32;ss_cr13:4,1760,32;ss_cr24:4,1792,32;ss_cr25:4,1824,32;ss_cr26:4,1856,32;ss_cr27:4,1888,32;ss_mpsfu_low:4,1920,32;ss_mpsfu_ovflo:4,1952,32;;__ss_narrow_t:t243=242ssflags_t:t244=1__save_state:T245=s1152ss_flags:244,0,32;ss_narrow:243,32,1984;ss_pad:1,2016,32;ss_fpblock:246=u256fpdbl:232,0,2048;fpint:234,0,2048;;,2048,2048;ss_xor:247=ar154;0;127;2,4096,1024;ss_wide:248=u512ss_64:237,0,4096;ss_32:241,0,4096;;,5120,4096;;save_state_t:t249=245__stack:T250=s12ss_sp:180,0,32;ss_flags:1,32,32;ss_size:37,64,32;;stack_t:t251=250mcontext_t:t252=249__sub_ctxt:T253=s48__uc_link:254=*255=xs__ucontext:,0,32;__uc_sigmask:230,32,256;__uc_stack:251,288,96;;__sub_ctxt_t:t256=253__ucontext:T255=s1240uc_mcontext:252,0,9216;uc_spares:197,9216,256;uc_created_by_getcontext:4,9472,1;uc_reserved_flags:4,9473,31;uc_subcontext:253,9504,384;;ucontext_t:t257=255sig_atomic_t:t258=4sigaction:T259=s40__handler:260=u4__sa_sigaction:261=*262=f20,0,32;__sa_handler:263=*264=f20,0,32;;,0,32;sa_mask:230,32,256;sa_flags:1,288,32;;pthread_t:t265=1sigstack:T266=s8ss_sp:180,0,32;ss_onstack:1,32,32;;sigvec:T267=s12sv_handler:263,0,32;sv_mask:1,32,32;sv_flags:1,64,32;;frame_marker:T268=s32fm_edp:1,0,32;fm_esr4:1,32,32;fm_erp:1,64,32;fm_crp:1,96,32;fm_sl:1,128,32;fm_clup:1,160,32;fm_ep:1,192,32;fm_psp:1,224,32;;frame_marker_t:t269=268siglocal_misc:T270=s40sm_syscall:1,0,32;sm_onstack:1,32,32;sm_omask:1,64,32;sm_syscall_action:2,96,8;sm_eosys:2,104,8;sm_error:9,112,16;sm_rval1:3,128,32;sm_rval2:3,160,32;sm_arg:271=ar154;0;3;3,192,128;;siglocal_misc_t:t272=270siglocal:T273=s1192sl_misc:270,0,320;sl_ss:249,320,9216;;siglocalx:T274=s1344sl_misc:270,0,320;sl_uc:257,320,9920;sl_si:227,10240,512;;__xsi:T275=s116sc:253,0,384;__padding:1,384,32;si:227,416,512;;__xsi_t:t276=275sigcontext:T277=s1392sc_ctxt:278=u1344sl:273,0,9536;sx:274,0,10752;;,0,10752;sc_args:271,10752,128;sc_sfm:268,10880,256;; :T279=eP_PID:0,P_PGID:1,P_SID:2,P_UID:3,P_GID:4,P_CID:5,P_ALL:6,P_LWPID:7,;idtype_t:t280=279wait:T281=u4w_status:1,0,32;w_T:282=s4w_pad:9,0,16;w_Retcode:4,16,8;w_Coredump:4,24,1;w_Termsig:4,25,7;;,0,32;w_S:283=s4w_pad:9,0,16;w_Stopsig:4,16,8;w_Stopval:4,24,8;;,0,32;;mallinfo:T284=s40arena:45,0,32;ordblks:45,32,32;smblks:45,64,32;hblks:45,96,32;hblkhd:45,128,32;usmblks:45,160,32;fsmblks:45,192,32;uordblks:45,224,32;fordblks:45,256,32;keepcost:45,288,32;;long_double:t285=286=s16word1:46,0,32;word2:46,32,32;word3:46,64,32;word4:46,96,32;;passwd:T287=s44pw_name:115,0,32;pw_passwd:115,32,32;pw_uid:104,64,32;pw_gid:103,96,32;pw_age:115,128,32;pw_comment:115,160,32;pw_gecos:115,192,32;pw_dir:115,224,32;pw_shell:115,256,32;pw_audid:45,288,32;pw_audflg:1,320,32;;s_passwd:T288=s20pw_name:115,0,32;pw_passwd:115,32,32;pw_age:115,64,32;pw_audid:45,96,32;pw_audflg:1,128,32;;utimbuf:T289=s8actime:109,0,32;modtime:109,32,32;;hrtime_t:t290=49machine_mode:T291=eVOIDmode:0,BImode:1,QImode:2,HImode:3,SImode:4,DImode:5,TImode:6,OImode:7,PQImode:8,PHImode:9,PSImode:10,PDImode:11,QFmode:12,HFmode:13,TQFmode:14,SFmode:15,DFmode:16,XFmode:17,TFmode:18,QCmode:19,HCmode:20,SCmode:21,DCmode:22,XCmode:23,TCmode:24,CQImode:25,CHImode:26,CSImode:27,CDImode:28,CTImode:29,COImode:30,V2QImode:31,V2HImode:32,V2SImode:33,V2DImode:34,V4QImode:35,V4HImode:36,V4SImode:37,V4DImode:38,V8QImode:39,V8HImode:40,V8SImode:41,V8DImode:42,V16QImode:43,V2SFmode:44,V2DFmode:45,V4SFmode:46,V4DFmode:47,V8SFmode:48,V8DFmode:49,V16SFmode:50,BLKmode:51,CCmode:52,CCFPmode:53,MAX_MACHINE_MODE:54,;mode_class:T292=eMODE_RANDOM:0,MODE_INT:1,MODE_FLOAT:2,MODE_PARTIAL_INT:3,MODE_CC:4,MODE_COMPLEX_INT:5,MODE_COMPLEX_FLOAT:6,MODE_VECTOR_INT:7,MODE_VECTOR_FLOAT:8,MAX_MODE_CLASS:9,;QItype:t293=10UQItype:t294=11HItype:t295=8UHItype:t296=9SItype:t297=1USItype:t298=4DItype:t299=6UDItype:t300=7SFtype:t301=12DFtype:t302=13TFtype:t303=14word_type:t304=1DWstruct:T305=s8high:297,0,32;low:297,32,32;;DWunion:t306=307=u8s:305,0,64;ll:299,0,64;;func_ptr:t308=309=*310=f20__do_global_dtors:F20reference:r311=*312=f20p:r313=*308__do_global_ctors:F20nptrs:r5i:r4nptrs:r5i:r4__main:F20initialized:V1libgcc2.c/usr/x/emechler/gcc-3.2/gcc/libgcc2.cgcc2_compiled.int:t1=r1;-2147483648;2147483647;char:t2=r2;0;127;long int:t3=r3;-2147483648;2147483647;unsigned int:t4=r4;0000000000000;0037777777777;long unsigned int:t5=r5;0000000000000;0037777777777;long long int:t6=@s64;r6;01000000000000000000000;0777777777777777777777;long long unsigned int:t7=@s64;r7;0000000000000;01777777777777777777777;short int:t8=@s16;r8;-32768;32767;short unsigned int:t9=@s16;r9;0;65535;signed char:t10=@s8;r10;-128;127;unsigned char:t11=@s8;r11;0;255;float:t12=r1;4;0;double:t13=r1;8;0;long double:t14=r1;16;0;complex int:t15=s8real:1,0,32;imag:1,32,32;;complex float:t16=r16;8;0;complex double:t17=r17;16;0;complex long double:t18=r18;32;0;__builtin_va_list:t19=*20=20_Bool:t21=@s8;-16;rtx:t22=23=*24=xsrtx_def:rtvec:t25=26=*27=xsrtvec_def:tree:t28=29=*30=xutree_node:cmp_type:T31=eCMP_SI:0,CMP_SF:1,CMP_DF:2,CMP_MAX:3,;processor_type:T32=ePROCESSOR_700:0,PROCESSOR_7100:1,PROCESSOR_7100LC:2,PROCESSOR_7200:3,PROCESSOR_8000:4,;architecture_type:T33=eARCHITECTURE_10:0,ARCHITECTURE_11:1,ARCHITECTURE_20:2,;hppa_args:T34=s12words:1,0,32;nargs_prototype:1,32,32;indirect:1,64,32;;reg_class:T35=eNO_REGS:0,R1_REGS:1,GENERAL_REGS:2,FPUPPER_REGS:3,FP_REGS:4,GENERAL_OR_FP_REGS:5,SHIFT_REGS:6,ALL_REGS:7,LIM_REG_CLASSES:8,;ptrdiff_t:t36=3size_t:t37=5wchar_t:t38=4__gnuc_va_list:t39=19va_list:t40=39int8_t:t41=2uint8_t:t42=11int16_t:t43=8uint16_t:t44=9int32_t:t45=1uint32_t:t46=4intfast_t:t47=1uintfast_t:t48=4int64_t:t49=6uint64_t:t50=7intmax_t:t51=49uintmax_t:t52=50intptr_t:t53=3uintptr_t:t54=5int_least8_t:t55=2uint_least8_t:t56=11int_fast8_t:t57=1uint_fast8_t:t58=4int_least16_t:t59=8uint_least16_t:t60=9int_fast16_t:t61=1uint_fast16_t:t62=4int_least32_t:t63=1uint_least32_t:t64=4int_fast32_t:t65=1uint_fast32_t:t66=4int_least64_t:t67=49int_fast64_t:t68=49uint_least64_t:t69=50uint_fast64_t:t70=50ptr32_t:t71=46ptr64_t:t72=50mqd_t:t73=1dev_t:t74=45ino32_t:t75=46ino64_t:t76=50ino_t:t77=5mode_t:t78=44nlink_t:t79=44fpos32_t:t80=45fpos64_t:t81=49fpos_t:t82=3fsblkcnt32_t:t83=46fsblkcnt64_t:t84=50fsblkcnt_t:t85=5off32_t:t86=45sbsize32_t:t87=45bsize32_t:t88=46off64_t:t89=49sbsize64_t:t90=49bsize64_t:t91=50off_t:t92=3sbsize_t:t93=3bsize_t:t94=5fsfilcnt32_t:t95=46fsfilcnt64_t:t96=50fsfilcnt_t:t97=5blkcnt32_t:t98=45blkcnt64_t:t99=49blkcnt_t:t100=3pid_t:t101=45lwpid_t:t102=45gid_t:t103=45uid_t:t104=45tid_t:t105=45ssize_t:t106=3__site_t:t107=44__cnode_t:t108=44time_t:t109=3clock_t:t110=46key_t:t111=45__ushort:t112=9__daddr_t:t113=45__caddr_t:t114=115=*2__swblk_t:t116=45caddr_t:t117=114id_t:t118=45useconds_t:t119=46rlim32_t:t120=46rlim64_t:t121=50rlim_t:t122=5site_t:t123=107u_char:t124=11u_short:t125=9u_int:t126=4u_long:t127=5uint:t128=4ushort:t129=9ubit8:t130=11ubit16:t131=9ubit32:t132=46sbit8:t133=2sbit16:t134=8sbit32:t135=45swblk_t:t136=116daddr_t:t137=113cnode_t:t138=108paddr_t:t139=54page_t:t140=53pgcnt_t:t141=45upgcnt_t:t142=46physpfn_t:t143=46iophyspfn_t:t144=54pgaddr_t:t145=54space_t:t146=46prot_t:t147=46ulong_t:t148=5cnt_t:t149=43cdno_t:t150=46use_t:t151=44_physadr:T152=s4r:153=ar154=r154;0000000000000;0037777777777;;0;0;53,0,32;;physadr:t155=156=*152_quad:T157=s8val:158=ar154;0;1;3,0,64;;quad:t159=157spu_t:t160=1ldom_t:t161=1cpu_t:t162=8lkinfo:T163=s16lk_name:115,0,32;lk_flags:1,32,32;lk_pad:158,64,64;;lkinfo_t:t164=163pl_t:t165=5aid_t:t166=45sid_t:t167=101__fd_mask:t168=45fd_set:T169=s256fds_bits:170=ar154;0;63;3,0,2048;;fd_set:t171=169fd_mask:t172=168dir_off_t:t173=45FILE:t174=175=s16__cnt:1,0,32;__ptr:176=*11,32,32;__base:176,64,32;__flag:9,96,16;__fileL:11,112,8;__fileH:11,120,8;;_FILEX:t177=178=s56__cnt:1,0,32;__ptr:176,32,32;__base:176,64,32;__flag:9,96,16;__fileL:11,112,8;__fileH:11,120,8;__bufendp:176,128,32;__newbase:176,160,32;__smbuf:179=ar154;0;15;11,192,128;__unused:180=*20,320,32;__filler1:1,352,32;__filler2:181=ar154;0;7;2,384,64;;__va_list:t182=183=*13__not_va_list__:t184=183div_t:t185=186=s8quot:1,0,32;rem:1,32,32;;ldiv_t:t187=188=s8quot:3,0,32;rem:3,32,32;;sigval:T189=u4__svi_int_s:190=s4__svi_int:1,0,32;;,0,32;__sival_ptr:180,0,32;;sigval_t:t191=189pthread_attr_t:t192=1sigevent:T193=s52__sigev_notify:1,0,32;__sigev_signo:1,32,32;__sigev_value:191,64,32;__sigev_notify_function:194=*195=f20,96,32;__sigev_notify_attributes:196=*192,128,32;__sigev_reserved:197=ar154;0;7;1,160,256;;sigevent_t:t198=193__sigev_types:T199=e__SIGEV_NONE:1,__SIGEV_SIGNAL:2,__SIGEV_THREAD:3,;tm:T200=s36tm_sec:1,0,32;tm_min:1,32,32;tm_hour:1,64,32;tm_mday:1,96,32;tm_mon:1,128,32;tm_year:1,160,32;tm_wday:1,192,32;tm_yday:1,224,32;tm_isdst:1,256,32;;timespec:T201=s8tv_sec:109,0,32;tv_nsec:3,32,32;;timestruc_t:t202=201itimerspec:T203=s16it_interval:201,0,64;it_value:201,64,64;;__clockid_t:T204=eCLOCK_INVALID:0,CLOCK_REALTIME:1,CLOCK_VIRTUAL:2,CLOCK_PROFILE:4,RTTIMER0:8,RTTIMER1:16,;clockid_t:t205=204timer_t:t206=5timeval:T207=s8tv_sec:109,0,32;tv_usec:3,32,32;;itimerval:T208=s16it_interval:207,0,64;it_value:207,64,64;;timezone:T209=s8tz_minuteswest:1,0,32;tz_dsttime:1,32,32;;__cycles:T210=s8hi:46,0,32;lo:46,32,32;;cycles_t:t211=210ki_timeval:T212=s8pad1:46,0,32;pad2:46,32,32;;kt_t:t213=50rlimit:T214=s8rlim_cur:122,0,32;rlim_max:122,32,32;;rusage:T215=s76ru_utime:207,0,64;ru_stime:207,64,64;ru_maxrss:3,128,32;ru_ixrss:3,160,32;ru_idrss:3,192,32;ru_isrss:3,224,32;ru_minflt:3,256,32;ru_majflt:3,288,32;ru_nswap:3,320,32;ru_inblock:3,352,32;ru_oublock:3,384,32;ru_ioch:3,416,32;ru_msgsnd:3,448,32;ru_msgrcv:3,480,32;ru_nsignals:3,512,32;ru_nvcsw:3,544,32;ru_nivcsw:3,576,32;;__si_codes:T216=eSI_QUEUE:-2,SI_USER:-1,SI_TIMER:1,SI_ASYNCIO:2,SI_MESGQ:3,;__siginfo:T217=s64si_signo:1,0,32;si_code:1,32,32;si_errno:1,64,32;si_value:191,96,32;__data:218=u12__proc:219=s8__pid:101,0,32;__pdata:220=u4__kill:221=s4__uid:104,0,32;;,0,32;__SIGCLD:222=s4__status:1,0,32;;,0,32;;,32,32;;,0,64;__fault:223=s4__addr:180,0,32;;,0,32;__file:224=s8__fd:1,0,32;__band:3,32,32;;,0,64;__gfault:225=s12__addr:180,0,32;__lockpage:180,32,32;__dev_id:3,64,32;;,0,96;;,128,96;__pad:226=ar154;0;8;3,224,288;;siginfo_t:t227=217__sigset_t:T228=s32sigset:229=ar154;0;7;4,0,256;;sigset_t:t230=228__fp_dbl_block:T231=s256ss_fp0:13,0,64;ss_fp1:13,64,64;ss_fp2:13,128,64;ss_fp3:13,192,64;ss_fp4:13,256,64;ss_fp5:13,320,64;ss_fp6:13,384,64;ss_fp7:13,448,64;ss_fp8:13,512,64;ss_fp9:13,576,64;ss_fp10:13,640,64;ss_fp11:13,704,64;ss_fp12:13,768,64;ss_fp13:13,832,64;ss_fp14:13,896,64;ss_fp15:13,960,64;ss_fp16:13,1024,64;ss_fp17:13,1088,64;ss_fp18:13,1152,64;ss_fp19:13,1216,64;ss_fp20:13,1280,64;ss_fp21:13,1344,64;ss_fp22:13,1408,64;ss_fp23:13,1472,64;ss_fp24:13,1536,64;ss_fp25:13,1600,64;ss_fp26:13,1664,64;ss_fp27:13,1728,64;ss_fp28:13,1792,64;ss_fp29:13,1856,64;ss_fp30:13,1920,64;ss_fp31:13,1984,64;;fp_dbl_block_t:t232=231__fp_int_block:T233=s256ss_fpstat:1,0,32;ss_fpexcept1:1,32,32;ss_fpexcept2:1,64,32;ss_fpexcept3:1,96,32;ss_fpexcept4:1,128,32;ss_fpexcept5:1,160,32;ss_fpexcept6:1,192,32;ss_fpexcept7:1,224,32;ss_fp4_hi:1,256,32;ss_fp4_lo:1,288,32;ss_fp5_hi:1,320,32;ss_fp5_lo:1,352,32;ss_fp6_hi:1,384,32;ss_fp6_lo:1,416,32;ss_fp7_hi:1,448,32;ss_fp7_lo:1,480,32;ss_fp8_hi:1,512,32;ss_fp8_lo:1,544,32;ss_fp9_hi:1,576,32;ss_fp9_lo:1,608,32;ss_fp10_hi:1,640,32;ss_fp10_lo:1,672,32;ss_fp11_hi:1,704,32;ss_fp11_lo:1,736,32;ss_fp12_hi:1,768,32;ss_fp12_lo:1,800,32;ss_fp13_hi:1,832,32;ss_fp13_lo:1,864,32;ss_fp14_hi:1,896,32;ss_fp14_lo:1,928,32;ss_fp15_hi:1,960,32;ss_fp15_lo:1,992,32;ss_fp16_hi:1,1024,32;ss_fp16_lo:1,1056,32;ss_fp17_hi:1,1088,32;ss_fp17_lo:1,1120,32;ss_fp18_hi:1,1152,32;ss_fp18_lo:1,1184,32;ss_fp19_hi:1,1216,32;ss_fp19_lo:1,1248,32;ss_fp20_hi:1,1280,32;ss_fp20_lo:1,1312,32;ss_fp21_hi:1,1344,32;ss_fp21_lo:1,1376,32;ss_fp22_hi:1,1408,32;ss_fp22_lo:1,1440,32;ss_fp23_hi:1,1472,32;ss_fp23_lo:1,1504,32;ss_fp24_hi:1,1536,32;ss_fp24_lo:1,1568,32;ss_fp25_hi:1,1600,32;ss_fp25_lo:1,1632,32;ss_fp26_hi:1,1664,32;ss_fp26_lo:1,1696,32;ss_fp27_hi:1,1728,32;ss_fp27_lo:1,1760,32;ss_fp28_hi:1,1792,32;ss_fp28_lo:1,1824,32;ss_fp29_hi:1,1856,32;ss_fp29_lo:1,1888,32;ss_fp30_hi:1,1920,32;ss_fp30_lo:1,1952,32;ss_fp31_hi:1,1984,32;ss_fp31_lo:1,2016,32;;fp_int_block_t:t234=233__reg64:T235=s512ss_reserved:49,0,64;ss_gr1:49,64,64;ss_rp:49,128,64;ss_gr3:49,192,64;ss_gr4:49,256,64;ss_gr5:49,320,64;ss_gr6:49,384,64;ss_gr7:49,448,64;ss_gr8:49,512,64;ss_gr9:49,576,64;ss_gr10:49,640,64;ss_gr11:49,704,64;ss_gr12:49,768,64;ss_gr13:49,832,64;ss_gr14:49,896,64;ss_gr15:49,960,64;ss_gr16:49,1024,64;ss_gr17:49,1088,64;ss_gr18:49,1152,64;ss_gr19:49,1216,64;ss_gr20:49,1280,64;ss_gr21:49,1344,64;ss_gr22:49,1408,64;ss_arg3:49,1472,64;ss_arg2:49,1536,64;ss_arg1:49,1600,64;ss_arg0:49,1664,64;ss_dp:50,1728,64;ss_ret0:50,1792,64;ss_ret1:50,1856,64;ss_sp:50,1920,64;ss_gr31:50,1984,64;ss_cr11:50,2048,64;ss_pcoq_head:50,2112,64;ss_pcsq_head:50,2176,64;ss_pcoq_tail:50,2240,64;ss_pcsq_tail:50,2304,64;ss_cr15:50,2368,64;ss_cr19:50,2432,64;ss_cr20:50,2496,64;ss_cr21:50,2560,64;ss_cr22:50,2624,64;ss_cpustate:50,2688,64;ss_sr4:50,2752,64;ss_sr0:50,2816,64;ss_sr1:50,2880,64;ss_sr2:50,2944,64;ss_sr3:50,3008,64;ss_sr5:50,3072,64;ss_sr6:50,3136,64;ss_sr7:50,3200,64;ss_cr0:50,3264,64;ss_cr8:50,3328,64;ss_cr9:50,3392,64;ss_cr10:50,3456,64;ss_cr12:50,3520,64;ss_cr13:50,3584,64;ss_cr24:50,3648,64;ss_cr25:50,3712,64;ss_cr26:50,3776,64;ss_cr27:50,3840,64;ss_reserved2:236=ar154;0;1;50,3904,128;ss_oldcksum:46,4032,32;ss_newcksum:46,4064,32;;__reg64_t:t237=235__reg32:T238=s512ss_reserved:239=ar154;0;1;46,0,64;ss_gr1_hi:46,64,32;ss_gr1_lo:46,96,32;ss_rp_hi:46,128,32;ss_rp_lo:46,160,32;ss_gr3_hi:46,192,32;ss_gr3_lo:46,224,32;ss_gr4_hi:46,256,32;ss_gr4_lo:46,288,32;ss_gr5_hi:46,320,32;ss_gr5_lo:46,352,32;ss_gr6_hi:46,384,32;ss_gr6_lo:46,416,32;ss_gr7_hi:46,448,32;ss_gr7_lo:46,480,32;ss_gr8_hi:46,512,32;ss_gr8_lo:46,544,32;ss_gr9_hi:46,576,32;ss_gr9_lo:46,608,32;ss_gr10_hi:46,640,32;ss_gr10_lo:46,672,32;ss_gr11_hi:46,704,32;ss_gr11_lo:46,736,32;ss_gr12_hi:46,768,32;ss_gr12_lo:46,800,32;ss_gr13_hi:46,832,32;ss_gr13_lo:46,864,32;ss_gr14_hi:46,896,32;ss_gr14_lo:46,928,32;ss_gr15_hi:46,960,32;ss_gr15_lo:46,992,32;ss_gr16_hi:46,1024,32;ss_gr16_lo:46,1056,32;ss_gr17_hi:46,1088,32;ss_gr17_lo:46,1120,32;ss_gr18_hi:46,1152,32;ss_gr18_lo:46,1184,32;ss_gr19_hi:46,1216,32;ss_gr19_lo:46,1248,32;ss_gr20_hi:46,1280,32;ss_gr20_lo:46,1312,32;ss_gr21_hi:46,1344,32;ss_gr21_lo:46,1376,32;ss_gr22_hi:46,1408,32;ss_gr22_lo:46,1440,32;ss_arg3_hi:46,1472,32;ss_arg3_lo:46,1504,32;ss_arg2_hi:46,1536,32;ss_arg2_lo:46,1568,32;ss_arg1_hi:46,1600,32;ss_arg1_lo:46,1632,32;ss_arg0_hi:46,1664,32;ss_arg0_lo:46,1696,32;ss_dp_hi:4,1728,32;ss_dp_lo:4,1760,32;ss_ret0_hi:4,1792,32;ss_ret0_lo:4,1824,32;ss_ret1_hi:4,1856,32;ss_ret1_lo:4,1888,32;ss_sp_hi:4,1920,32;ss_sp_lo:4,1952,32;ss_gr31_hi:4,1984,32;ss_gr31_lo:4,2016,32;ss_cr11_hi:4,2048,32;ss_cr11_lo:4,2080,32;ss_pcoq_head_hi:4,2112,32;ss_pcoq_head_lo:4,2144,32;ss_pcsq_head_hi:4,2176,32;ss_pcsq_head_lo:4,2208,32;ss_pcoq_tail_hi:4,2240,32;ss_pcoq_tail_lo:4,2272,32;ss_pcsq_tail_hi:4,2304,32;ss_pcsq_tail_lo:4,2336,32;ss_cr15_hi:4,2368,32;ss_cr15_lo:4,2400,32;ss_cr19_hi:4,2432,32;ss_cr19_lo:4,2464,32;ss_cr20_hi:4,2496,32;ss_cr20_lo:4,2528,32;ss_cr21_hi:4,2560,32;ss_cr21_lo:4,2592,32;ss_cr22_hi:4,2624,32;ss_cr22_lo:4,2656,32;ss_cpustate_hi:4,2688,32;ss_cpustate_lo:4,2720,32;ss_sr4_hi:4,2752,32;ss_sr4_lo:4,2784,32;ss_sr0_hi:4,2816,32;ss_sr0_lo:4,2848,32;ss_sr1_hi:4,2880,32;ss_sr1_lo:4,2912,32;ss_sr2_hi:4,2944,32;ss_sr2_lo:4,2976,32;ss_sr3_hi:4,3008,32;ss_sr3_lo:4,3040,32;ss_sr5_hi:4,3072,32;ss_sr5_lo:4,3104,32;ss_sr6_hi:4,3136,32;ss_sr6_lo:4,3168,32;ss_sr7_hi:4,3200,32;ss_sr7_lo:4,3232,32;ss_cr0_hi:4,3264,32;ss_cr0_lo:4,3296,32;ss_cr8_hi:4,3328,32;ss_cr8_lo:4,3360,32;ss_cr9_hi:4,3392,32;ss_cr9_lo:4,3424,32;ss_cr10_hi:4,3456,32;ss_cr10_lo:4,3488,32;ss_cr12_hi:4,3520,32;ss_cr12_lo:4,3552,32;ss_cr13_hi:4,3584,32;ss_cr13_lo:4,3616,32;ss_cr24_hi:4,3648,32;ss_cr24_lo:4,3680,32;ss_cr25_hi:4,3712,32;ss_cr25_lo:4,3744,32;ss_cr26_hi:4,3776,32;ss_cr26_lo:4,3808,32;ss_cr27_hi:4,3840,32;ss_cr27_lo:4,3872,32;ss_reserved2:240=ar154;0;3;4,3904,128;ss_oldcksum:4,4032,32;ss_newcksum:4,4064,32;;__reg32_t:t241=238__ss_narrow:T242=s248ss_gr1:1,0,32;ss_rp:1,32,32;ss_gr3:1,64,32;ss_gr4:1,96,32;ss_gr5:1,128,32;ss_gr6:1,160,32;ss_gr7:1,192,32;ss_gr8:1,224,32;ss_gr9:1,256,32;ss_gr10:1,288,32;ss_gr11:1,320,32;ss_gr12:1,352,32;ss_gr13:1,384,32;ss_gr14:1,416,32;ss_gr15:1,448,32;ss_gr16:1,480,32;ss_gr17:1,512,32;ss_gr18:1,544,32;ss_gr19:1,576,32;ss_gr20:1,608,32;ss_gr21:1,640,32;ss_gr22:1,672,32;ss_arg3:1,704,32;ss_arg2:1,736,32;ss_arg1:1,768,32;ss_arg0:1,800,32;ss_dp:4,832,32;ss_ret0:4,864,32;ss_ret1:4,896,32;ss_sp:4,928,32;ss_gr31:4,960,32;ss_cr11:4,992,32;ss_pcoq_head:4,1024,32;ss_pcsq_head:4,1056,32;ss_pcoq_tail:4,1088,32;ss_pcsq_tail:4,1120,32;ss_cr15:4,1152,32;ss_cr19:4,1184,32;ss_cr20:4,1216,32;ss_cr21:4,1248,32;ss_cr22:4,1280,32;ss_cpustate:4,1312,32;ss_sr4:4,1344,32;ss_sr0:4,1376,32;ss_sr1:4,1408,32;ss_sr2:4,1440,32;ss_sr3:4,1472,32;ss_sr5:4,1504,32;ss_sr6:4,1536,32;ss_sr7:4,1568,32;ss_cr0:4,1600,32;ss_cr8:4,1632,32;ss_cr9:4,1664,32;ss_cr10:4,1696,32;ss_cr12:4,1728,32;ss_cr13:4,1760,32;ss_cr24:4,1792,32;ss_cr25:4,1824,32;ss_cr26:4,1856,32;ss_cr27:4,1888,32;ss_mpsfu_low:4,1920,32;ss_mpsfu_ovflo:4,1952,32;;__ss_narrow_t:t243=242ssflags_t:t244=1__save_state:T245=s1152ss_flags:244,0,32;ss_narrow:243,32,1984;ss_pad:1,2016,32;ss_fpblock:246=u256fpdbl:232,0,2048;fpint:234,0,2048;;,2048,2048;ss_xor:247=ar154;0;127;2,4096,1024;ss_wide:248=u512ss_64:237,0,4096;ss_32:241,0,4096;;,5120,4096;;save_state_t:t249=245__stack:T250=s12ss_sp:180,0,32;ss_flags:1,32,32;ss_size:37,64,32;;stack_t:t251=250mcontext_t:t252=249__sub_ctxt:T253=s48__uc_link:254=*255=xs__ucontext:,0,32;__uc_sigmask:230,32,256;__uc_stack:251,288,96;;__sub_ctxt_t:t256=253__ucontext:T255=s1240uc_mcontext:252,0,9216;uc_spares:197,9216,256;uc_created_by_getcontext:4,9472,1;uc_reserved_flags:4,9473,31;uc_subcontext:253,9504,384;;ucontext_t:t257=255sig_atomic_t:t258=4sigaction:T259=s40__handler:260=u4__sa_sigaction:261=*262=f20,0,32;__sa_handler:263=*264=f20,0,32;;,0,32;sa_mask:230,32,256;sa_flags:1,288,32;;pthread_t:t265=1sigstack:T266=s8ss_sp:180,0,32;ss_onstack:1,32,32;;sigvec:T267=s12sv_handler:263,0,32;sv_mask:1,32,32;sv_flags:1,64,32;;frame_marker:T268=s32fm_edp:1,0,32;fm_esr4:1,32,32;fm_erp:1,64,32;fm_crp:1,96,32;fm_sl:1,128,32;fm_clup:1,160,32;fm_ep:1,192,32;fm_psp:1,224,32;;frame_marker_t:t269=268siglocal_misc:T270=s40sm_syscall:1,0,32;sm_onstack:1,32,32;sm_omask:1,64,32;sm_syscall_action:2,96,8;sm_eosys:2,104,8;sm_error:9,112,16;sm_rval1:3,128,32;sm_rval2:3,160,32;sm_arg:271=ar154;0;3;3,192,128;;siglocal_misc_t:t272=270siglocal:T273=s1192sl_misc:270,0,320;sl_ss:249,320,9216;;siglocalx:T274=s1344sl_misc:270,0,320;sl_uc:257,320,9920;sl_si:227,10240,512;;__xsi:T275=s116sc:253,0,384;__padding:1,384,32;si:227,416,512;;__xsi_t:t276=275sigcontext:T277=s1392sc_ctxt:278=u1344sl:273,0,9536;sx:274,0,10752;;,0,10752;sc_args:271,10752,128;sc_sfm:268,10880,256;; :T279=eP_PID:0,P_PGID:1,P_SID:2,P_UID:3,P_GID:4,P_CID:5,P_ALL:6,P_LWPID:7,;idtype_t:t280=279wait:T281=u4w_status:1,0,32;w_T:282=s4w_pad:9,0,16;w_Retcode:4,16,8;w_Coredump:4,24,1;w_Termsig:4,25,7;;,0,32;w_S:283=s4w_pad:9,0,16;w_Stopsig:4,16,8;w_Stopval:4,24,8;;,0,32;;mallinfo:T284=s40arena:45,0,32;ordblks:45,32,32;smblks:45,64,32;hblks:45,96,32;hblkhd:45,128,32;usmblks:45,160,32;fsmblks:45,192,32;uordblks:45,224,32;fordblks:45,256,32;keepcost:45,288,32;;long_double:t285=286=s16word1:46,0,32;word2:46,32,32;word3:46,64,32;word4:46,96,32;;passwd:T287=s44pw_name:115,0,32;pw_passwd:115,32,32;pw_uid:104,64,32;pw_gid:103,96,32;pw_age:115,128,32;pw_comment:115,160,32;pw_gecos:115,192,32;pw_dir:115,224,32;pw_shell:115,256,32;pw_audid:45,288,32;pw_audflg:1,320,32;;s_passwd:T288=s20pw_name:115,0,32;pw_passwd:115,32,32;pw_age:115,64,32;pw_audid:45,96,32;pw_audflg:1,128,32;;utimbuf:T289=s8actime:109,0,32;modtime:109,32,32;;hrtime_t:t290=49machine_mode:T291=eVOIDmode:0,BImode:1,QImode:2,HImode:3,SImode:4,DImode:5,TImode:6,OImode:7,PQImode:8,PHImode:9,PSImode:10,PDImode:11,QFmode:12,HFmode:13,TQFmode:14,SFmode:15,DFmode:16,XFmode:17,TFmode:18,QCmode:19,HCmode:20,SCmode:21,DCmode:22,XCmode:23,TCmode:24,CQImode:25,CHImode:26,CSImode:27,CDImode:28,CTImode:29,COImode:30,V2QImode:31,V2HImode:32,V2SImode:33,V2DImode:34,V4QImode:35,V4HImode:36,V4SImode:37,V4DImode:38,V8QImode:39,V8HImode:40,V8SImode:41,V8DImode:42,V16QImode:43,V2SFmode:44,V2DFmode:45,V4SFmode:46,V4DFmode:47,V8SFmode:48,V8DFmode:49,V16SFmode:50,BLKmode:51,CCmode:52,CCFPmode:53,MAX_MACHINE_MODE:54,;mode_class:T292=eMODE_RANDOM:0,MODE_INT:1,MODE_FLOAT:2,MODE_PARTIAL_INT:3,MODE_CC:4,MODE_COMPLEX_INT:5,MODE_COMPLEX_FLOAT:6,MODE_VECTOR_INT:7,MODE_VECTOR_FLOAT:8,MAX_MODE_CLASS:9,;QItype:t293=10UQItype:t294=11HItype:t295=8UHItype:t296=9SItype:t297=1USItype:t298=4DItype:t299=6UDItype:t300=7SFtype:t301=12DFtype:t302=13TFtype:t303=14word_type:t304=1DWstruct:T305=s8high:297,0,32;low:297,32,32;;DWunion:t306=307=u8s:305,0,64;ll:299,0,64;;func_ptr:t308=309=*310=f20__CTOR_LIST__:G311=ar154;0;1;308__DTOR_LIST__:G311%C dp(dp2<AcùJ݀ 2E^À/ M j Z/?L&Z+pnVWXYZƀ[Հ]^cdj#k4tCuSf{ɀ܀,@Ui?EˀKڀRaglq"w2?Sgxˀ܀   - > P b r     ɀ ڀ * = E H (J :K PL bS s[ ` g m y À~ Ӏ      & 4 B Q ^ l {   - 9 ̀: ݀; ? @ A %C 5D D S a p ~ ʀ   # 1 >     R π]# 5;T΀IM>:Aaˀtǀ>gy:7_J|< 9> Q%0%C/C/ǀ4 474H5<5R5N5Q56#f696׀r6C67l77Ԁ88M8Ā9999:3:sk::;K;]< <̀=!>>o>%>A(A݀CADAEB FBIB'JB6MBDNBSYBbZBq`BzBB)B(C$[D[D]D[D]D[ D]C@]C4@]`C@$xDxDDxDDLCV@C_@LCd@Cm@pCr$DDDDD D,D0C}(@@dC< d(d2<AcùJ݀ 2E^À/ M j Z/?L&Z+pnVWXYZƀ[Հ]^cdj#k4tCuSf{ɀ܀,@Ui?EˀKڀRaglq"w2?Sgxˀ܀   - > P b r     ɀ ڀ * = E H (J :K PL bS s[ ` g m y À~ Ӏ      & 4 B Q ^ l {   - 9 ̀: ݀; ? @ A %C 5D D S a p ~ ʀ   # 1 >     R π]# 5;T΀IM>:Aaˀtǀ>gy:7_J|< 9> Q%0%C/C/ǀ4 474H5<5R5N5Q56#f696׀r6C67l77Ԁ88M8Ā9999:3:sk::;K;]< <̀=!>>o>%>A(A݀CADAEB FBIB'JB6MBDNBSYBbZBq`BzBB)B(C C' dmule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/wrapper-linux-x86-320000755000175000017500000030211110567556635030322 0ustar charlescharlesELF4|M4 (444FFF$tGtt /lib/ld-linux.so.2GNUCT+S/<E9$O& K5(,)42NRB%HF@LA=PI .G?QD1;J-   "'#07* >8:36CM!#Yr;k gЏ/GO'"+G8` I0*f@P`7pL,7;;А/N-\tj*@ S60@:-P5`/mp74]#"S:@*oБSAk7 c0[@P`p8h(;*fWВ>/:R;_ \y0@P P;0``}pR;[wj;T#Г7|nu[; TV0W@*EP:1`QpS  libpthread.so.0waitpidrecvpthread_equalpthread_createsendacceptnanosleepreadpthread_sigmaskforksigactionpthread_mutex_unlockpthread_selfpthread_mutex_lock__errno_locationfcntllibc.so.6strcpyasctimestdoutsigemptysetstrerrorgetenv__strtol_internalgetpidfgetsmemcpyglobdup2mallocremovevsnprintfsocketfflushrealpathputenvsigaddsetpiperenamestrrchrfprintfkillbindinet_addr__deregister_frame_infochdirumaskstrstrsignalopenlogcloselogunlinkgetrusagestrcasecmp__strduplistengettimeofdaylocaltimegetsidftellsrandinet_ntoasyslogstrcmpgetpwuidsprintffcloseglobfree__xstatexitfopen_IO_stdin_used__libc_start_mainstrchrexecvpsetsid__register_frame_info__gmon_start__GLIBC_2.1GLIBC_2.00ii ii ii ii R$`dhlptx|      !"#%&'()*+, -./01 2$3(4,5064788<9@:D;H<L=P>T?X@\A`BdChDlEpFtGxI|JKLMNOPQSUS[HD[5X%\%`h%dh%hh%lh%ph %th(%xh0%|h8p%h@`%hHP%hP@%hX0%h` %hh%hp%hx%h%h%h%h%h%h%h%hp%h`%hP%h@%h0%h %h%h%h%h%h%h%h%h %h(%h0%h8p%h@`%hHP%hP@% hX0%h` %hh%hp%hx% h%$h%(h%,h%0h%4h%8h%<hp%@h`%DhP%Hh@%Lh0%Ph %Th%Xh%\h%`h%dh%hh%lh%ph %th(%xh0%|h8p%h@`%hHP%hP@%hX0%h` %hh%hp%hx1^PTRhnhXQVhT,US[ÔCLt[ÉU=u>PС8u丐t hpmÐUUthhpÐUÍUDSuSh¡PHRp u?PphojjwP蠵n5h o]S6jjS5b 5h4oSjjS5; 5hHoSjjS5 jjhZo5jjhwo5 1'jj@45DZC;X|ՃpH5ct(xupHh@pjj<Yt&@ 2t=pHhpjj"@4hpjj1]ÍvUWVSjjju 3Phqjj{&hjP@uPh@qX( X,1 t&}EEEEfEhgqIEffEjW5诟bu!tX,1늉C;X0yx(6Pp0p,hqPp0p,p(hqjjv Pj7I2Ft=P(u"tPhpjj@4ǀǀB(~9tSr(h rjj X4tShOrjjj5uoNPhrjjwFEt=P<u"t Phpjj2@4e[^_U(J==EEPEPRu=萝  0Phrjjt&t1Ef%PuVPhrjjT hj5u,tPhsjjCSt=Pu"t袜Phpjj@4ÍvU WVS]E EhAހ}sutu ߰эy9=s&t PWI=TL"ttPE$t:s@sEsMsRs_smsus}sxsqshsasXsQsHsAs8s1s(s!EPhthPh@tjjUR :"ttPE$t&:s@sEsMsRs_smsus}sxsoshs_sXsOsHs?s8s/s(sEPhthPhltjjEP Uu @S@PjW55u}tPhtjjEPS t@Pu%t誘Ph sjjh]e[^_ÍvUы|\uPPQh}St&PPRh~E4#t&QPPh3~R Lt&эAP‹E} tkэAv1ы|\uPhN~RvRhh~E4Qh~RDžP"Mh~PDž } t*h~MPDžDžDžCSh~RjQ5蔗 ǰэY؍PA;v`U<QMWhzP W4F;w~!MAPhzMPeэY؍PA;vZU<QMWhzP WF;w~!MAPhzMP@u)h~MP} t[M|\uh~Ph~E P}t'j Mh~Ph }DžDžPBM} th~PDžDžDž@Ph~PjR5 ǰэYj*Ruj?QSjjP'19?<эYDAV;vaE<RUWhzP WD ;w~!MA4hzMP7;"RQhjj P]щ| /tр| \u_эAPƋэAPRV2шD (PVjtQtuRQh@jt&耰PPhjj ;t V>؍PA;vZU<QMWhzPi WF;w~!MAPhzMPu)h~MP} t[M|\uh~Puh~E PF}tqJ&=\эAP!‹E} t\Ph&\PhR}t1j‹Ep4hR x8~=}t1jx‹Ep8hRD }t1j;‹EpjM} th8 t&hOPr}t8jiMmzPhdU4. xtJ}_j!U} th&hPx ^}tzj,U } t,X gfff)Rh*X gfff)Rh QFx$^}ttj,+E } t&X$gfff)Rh`$X$gfff)RhQ}t\=эAPM} t5h5hفPL}tkэAP*‹E} thh R|tK}t:j M} t h@h`PtK}t:jjM} t h~hP-tM}tAj'M} th&hP}tLj-‹M} tpth%pth@Rz}t6jq‹M@PhYR8 }t\hlhq5=ǰQM RhzPDžCShQjP5趈 ǰB}Q5PhR } tDžjQ5螄QƃэY119] }V<\u3;}+D9<\u 2\&<"u 2"BGt&2\<"t2BG9|2&@эAPM} t2t)j VZtVh|U4VhzE4t V[^_US]Mujh`+uQQh RQh jjS7 B$ThtjhǀhjjSʠǀhjt&ǀh j_t&ǀhKj?t&hj.t&t>hjhjjߘRh jjS ju jGSw't@Pu%tNpPh sjjw0t P]ÐU WVSu] tPt&߰QSP;e[^_ÍvUSxjh5聀¡jh5σà thhxSudQhEsSu e5hSu ft&hSg]ÐUWVShvh5$ƃV蹉 hh5Pià uh@*u0hV}uhhjj胖S覟hvh5胂P蹉0hh5_P詟 h-h/5;P葉 jhG5袂P茟 jh`5~~jh`5b1%P蘟hh5蕁P0hh5qP軟 jh5}P貟 h̊hъ5,P躟 hh5P讟 hh5Ph%5ЀPV0J|Oǀjh75¡P(h}hD5B,H =vB,}h}h`jjhh5謀‹ Q0B=v A,=~A0Ph`"A,9}&=~A0Phjj薓jh52B8~ ;B(uB8h@jjQhyh5B&E.&EPhV辡V襤{vE™8pEEEP財ÃhW"ƃ S蔡ujd;IE} ~WhjjHqe[^_UWVS] uCwT$КʙKϙ>ݙ7.'™PwN$ʙEϙ>ݙ5.%™Phjjuw VuáSwQ$ʙHvϙ>ݙ7.'™Phjjo ǀǀǀу<wj$<ʙ_ϙXݙOH?8/(WhVʞV象{™<UtMEEPĞÃhEP1ƃ S裞ujdJFE} ~EPhjjTne[^_USh`jj4nhh5HZà hSshSПZHh/jjmh@jjm hjjmhjjm hjjxmh`jjgm hjjSmh jjBm hjjj.mShjjm hjj mhjjl h@jjlhjjl hjjlhjjl h@jjlh/jjl]ÉUxXuoh@jjblu hAjjQl h`jj=lhjj,l h jjlh@jjl @Xtuh`jjkǀǀÍvUdS]LTSthjjkkEPLjΜtsueu\MtQNtLOtGGtBhjjkjjȃ vj8jPS<¡T]ÉUWVS@HEPthjjRjEP@j赛y1ۃh@谝Tu jdAC  TtTu!@h jji X&TQjPS^Pj Stj Stj Sؘƅt F> thDS舜u!ShLjj"ij hjSRuBu1vjj jVƃVShjjh VjhSu ShhSۛu Sh_hS軛u$Sh jjUhjA 5vhHS肛t.hYSmthjSX=u ShVuXǃuVShjrLhHSuWrVSh^hYSҚuWpVSh@.hjS袚u!WqVShjj/g0Shjjgr9LqPhSܚSjpj &hStmhStXhSؙtChSÙt.hS讙th,S虙1th9VzhSauhS<ut&hSu dhSu BhSΘu  h,S謘u t SSh> SShWjj'e ShjjePQTPҗ@à u$UpP@hjSd DMQ¡H8[^_ÉU0VSuA̓v 7IǂTthjjdt&V A;|HǂVjHjL?Rh@Ht*PV Phjjic 9}BVjHjRh@t&hjjb h@jǂzptSVjHjw8&Shjjbh]SihƧhΧhק5xNPS5N thj8j6h]ShƧhΧhק5MPS5 N t.h@jjaǀt&j8jTe[^ÉUVSuA̓v 7V\}~=Bjt!bt!hjj`hh5LÃhS{th@jj`h.hSKtEh@jjS`hjjB` j8jǀ"9¡  Ghjj_} t$Vja"=uj8j-@x~PjVjIjdjVjGjTe[^ÐUS]} tSj!=-thS|RxTthhSh@jj _ja7ǀSLPthjj^hjgjٙ}"thjjc^thjjA^]ÐUlWVSEP軏E%M)щMEEP賍ƍ} EPDPhA]Ső߰шD Shjj]UE%UUMQ@ƍ} EPяPhASU߰шD Sh@jj1]x"6E%M)щMEP躌ƍ} EPNPhASҐ߰шD 0Shjjj\UE%UUMQMƍ} EPގPhASb߰шD Shjj>\e[^_ÉU WVS.5ǡTHtthjj[t t/PhĮjj[t jdh3th֮jVj[cthjVD[t#th jV[1thLjjZGuȃv-2t$thjjZ1thjjZc3át?St)3S¡t?Srt)Sn¡c;t$S=¡StYccSW¡;Pt~XSWPhjjXY t.SWzP¡ ߡ  8ʃt3Rʃt3RSPwR$ʙIt&ϙ>ݙ7.'™P4t!3t18t9t$t&™PSh@8ʃt3Rʃt3RwQ$ ʙHvϙ>ݙ7.'™P4t!3t18t9t$t&™PShjjV0S/S: th$jjVǀGHujSjG&Sj=uǀ]th=jj/Vjjejn~ PjSjMjtZ4t3t/8t9t#v™Ph`jjU4 3t8tJ9xhjj3j-Lusj4j jjj4jv- Uhj8j]-Gu0j9jhjjTttwO$0ʙEϙ>ݙ5.%™PhjjETP?$Tt&VS4VS$tSjy= SxTthh St&?j+ǀthVjjNShijdj芎}h@x~PSjKj't&jSjKjtSjh=SxTthh SvhjjoRj*ǀ tVSbtSj=H6SAxTthΧhSTvh ~tSj9=SxTthXhSz&hjj?Qj) VtSj=t=t/S:|PhjjP9thѱjjPe[^_ÉUSE Puát~SwR$xt&ʙEϙ>ݙ5.%™PhjjOǀǀǀ]UE4t3t,8t9t ™ÐUEwQ$vʙEϙ>ݙ5.%™ÉU WVS1t&EPƃhEP聂à V~tE PhS~S葁%jd}&G ~EPhjjNe[^_ÉUhjj3j&Luj4j-jjj4j&ÉUÍvUhj8jm&Gu j9jÉUÍvUS]} tSjY=tetWS|AxTthh S!v/j%ǀ]ÐUS]thVjj3Mhijdjo},hjjMj]%ǀ(@x~PSjKjvjSjKj]ÍvUS]} tSj)=tqtcS|MxTthh S-vhjj?Lj$ǀ]ÐUS]} tSj=tftXS|BxTthΧhS5"&h jjKj#]US]} tSj =tftXS|BxTthXhS"&hjjKje#]US]} tSjm =t)tS|]Í'US]uhjjjQfThjjjQCt=tF;tFMt |=t>4<&K.V'_mPPw@$7.' %,RPh jjjP Ct#PzPshEjjjP0{u?sy[tRss |Ps hjjjWP]ÉUVSu ]={5,P|t'Vh jvt&|tVhVSt&ftA etOgAVhojjjO j.u#uMtNt OtGu2VhjjjZOǀ j^ #Vhɵjjj(O jjȃj8j=~KtVhjjjN u54{tARPVh@j VhjjjNt&VhVjjjlNe[^ÐUWVSDž|DžxjbR]S.z jSxjSx jSxjSx jSxjSjz thjjFthjjgFt&jd.ǡPЉ)Ɖ+|xt Džxl;X$~Ph@ 9}PhjjEtSVW5h@jjE |DUWVS1Džt;xVxEjtSjt t,PPjh@jjjL &1Džt$<VSxEjSjot t(xPPjh@jjjL v1|DžtP<VwEjSjt t(PPjh@jjjK v1Džt<VwEjSjs t(OPjh@jjj]K v1Džt$=V3wEjSjOs t(XOPjh@jjjJ v1u`DžtP=VvEjSjr t,NPjh@jjjJ &1txt ,dthjjCjhjh,NsÃt%uNPShjjB1uX[^_ÐUWVS@Pu}tZ1ۃ8t4@P4u@PC@P<ũpPu@PEEjVW=xLt.1;]}'E4ShpLjA C;]|كE@Pr¡PP1ۃ`9}LE<Qr¡@PE4@P4uv@PCE9~uuGe[^_ÍvU WVS=u.h$ar}LPhjKJpÃu5%PJXLPh jS@[ǂ\pj5(r } KPh@"j5(r}KPh`jjB@pP@P08rp0KPhjj @0j]s$%PIhj5r }!qp02KPhjj? jj5Fr}!7p0JPhjja? 0tr=h[oƃhSrà V=otWh²SnSq 0h jj>4tllnƃhSJrà VntWh²SvnS]q4h`jjb>e[^_ÉUVSEPjnt IPh#pPjntIPhjj=ztMb)Rp|)Qxu)QuMĉ)Ruh jj=X[^ÐUVS]jEP5nu }%m8 tHPhjjSbD Eƒu%v<tlRBw@$47.' %,PhjjSC hjjSCPu Se[^ÍvU,WVS= SDž+)Ѝ+Dž= DžQP5oǃ\l tPGPhjj}; 0B9|bP]lÃt55PSmD5n 5݃19ct&< B9|bPkÃt55PSBmD5m 5 DžB9|bPjÃt55PSlD5m AF9P"=1[^_USjj5jj 5lt*hjj8gDPhjj8 h jj8E]Cethhȹjj8jShthjjU8ǀjjjGj0t Pqhݶ]USjBAth`jj7g?CPhjj7(t Pg,t Pg8t Pg<t Pg4t PgLt Pfg6jTjt&toE]Cethhȹjj6jSLfthjj6jigÃAPhþjSZ6(t Pf,t Pf8t Pif<t PNf4t P3fLt Pfjijjejjh׾hà tYjOejSg j7ejSg jejSg v Sejv?thjj4dg@Phjj4(t Pe,t Pd8t Pd<t Pd4t PdLt Pd^j|gt jng%P>]U WVS} w(t Pd,t Pc8t Pc<t Pc4t PcLt Pcajfj}>7SV`duy>PVhMj/SeuSh@jj27Sdt"*>PSh`jj2 1(t Pb,t Pb8t Pb<t Pub4t PZbLt P?bj-eWux(t Pa,t Pa8t Pa<t Pa4t PaLt PwaGjedt&h04<&K.V'_mÐUu V¡t?5,R Xthjjjy+&h jjj`+ÉUVSu] SejfShEVe[^Uu ?V5,PW th`jjj*BhƲjjj*j5PW } /Phٲjjj*ÉUu hjjj* HPj=uhjjj^*UVSu] SejfSh Ve[^UVSu] S9Sh%Ve[^ÍvUVSuE ttxPUEjSVQ t"-PVh@jjj)1X[^USthjj"jhjh,XRÃt-PShjj!1]ÐUS+E 9E|_PRÃt25PSdTD5T]ÐUVSuSVRu,PVhjj!\j/SSuSh@jj 4SRt],PSh`jj 1[^ÉUVSEu t#V3aPu t&[u1e[^U WVS}u t:63P~ CF^Cu7t&ps%[uƋGFGu7pwFe[^_ÍvU,WVSEU MƉI>}j%V=O j%@PO+xWPS9RSlO )9s t&t SVPQ)эY9st&SPPQ)F)эy9st SVP:Q)z[^_U,WVShu Q{u {{PhB{PO{j {PCMtj {P(Mt{F< t<t>#toI1Dž{9sP2<"u {Z6Z<#u/{u&|#uڍy9w 2DB9v2щ9rэQtDJt D< t<thVN9u\F{~ u{{8 t} fhB{S{PE@PSEP)4&>#t+j=VKt@jjPVEP/ {#{PN1{[^_ÍvU,@WVS] u߰QL߰1@ t u9rI t u9w)yt؃WPRKNQgL1@0 t u 9rt&I1 t u9w)ytWPRMPURÃutjK@@@ÃQKR3NSMQ t&{t1PCtPMCu Ch@PRQJC1Dž эA9}FvB<vCAFэA9|ËCECEC эA |h(RJ;u] VH[҉э PIËPVэAh5RNJ;ussϰ҉э P9IVPhSL SHtShJRQKQBKȿ[^_ÍvUBWU װсBwARWKj=WGt+@uuPWua1Rh@jjQUVSUE }tPRvPRbtPRIƃhV7J؃VCJ؍e[^ÉUWVSE E1ۋUUtyE쐍t&U2ˋzэ\ CFURVEƅuEpCFURVEƅuCE@EuCS8GEEUUEEU:+)XSWEPH]UE@E~URWIEƅuWEPIыUL M=EEx*)XSWURGH]EUBU~EPWDƅuWURIыUL MEEURUEEe[^_Uju uUjE@ÐU WVS}7Gt?t&^6HvGF VGޅuƃWGe[^_ÐUVSuu VÃtXCSu Vt&Pu  t&CB3pGs_GC SLGe[^ÐUu ut @ &EÍvUVS]u uڅtPRzFƃuVF؃VF؍e[^Uu utjjjp#EEÍvUu uTt@ 1ÍvUSEt$t&s3hjj[ u]ÍvUjC@@@ÍvUS]3EsEC SE]ÍvU@WVS] UBtPEMAuE@h@VSQBUB1DžэA9}Ev B<vMAACэA9|ċUBؿ[^_ÐU WVSu] ҉э P!BSVhWE WAtWhCe[^_ÐU WVS]u ߰1t&@ t u9rI t u9w)yt ؃WPVDC7e[^_Ð&US]h_SCu&hdSrCu hiSRCu t&hqS2Cu _t&huSCu ?t&hSBu t&hSBt1]US]h_SBu&hSBu hSbBu hSBBu t&hS"Bu _t&hSBu ?t&hSAu t&hSAt1]US]hSAhSAu hS`Au hSAAu hS"Au hSAu it&hS@u It&hS@u )t&hS@t &]ÉU WVSuӡt+Pv@5h@ 5tW@S=VP A S=S=te[^_ÐUEtPh@ÍvUWVS]߰Q]=EEE1߰эA9E}oрMt/ Kt-kt mtt&E&EA< v-u ME@EF߰эA9|UMjj jR=(~ E(EP>e[^_ÍvUEtPh?ÍvUEtPh`m?ÍvUWVS1EEfU MwP$v > 9 .)}$э\ EE} эA9E|CHuS;HL(9Ls P=Sc;HL HHE1U M}$}t}u$h&hvEPhzU 4 }t(}tN}t(}t2@h >h.hh%h-SB=ÃF& }tQPh5wt&M1qqq A@PAlPh8S<F SEPU2rrr B@PBlPh`S<F0M$Qh S<F1t;uthSw<ÃE} эA9E+He[^_ÍvU|WVSu EP,<h@UR9c}IIM]]ESE]E@9MwH;t=޿IMu1҅tjjEPr:]̊UCBU뾋E}IM]]19wM;tBދ}Mu#1tjjUR :]ΐt&UCBU뻉E}IM]]19wF;t;ދ}Mu1tjjUR9]ΊUCBUE}IM]]19;t@ދ}Mu#1tjjUR89t&]ɊUCBU뻋Et&@IM܋]]؋}IME@U9w\;tQދ}Mu2}tEPUREP8t&]܋UU뿐t&U؈CBU묉EhgURy7f}oIMЋ]]ExEEg9MwH;t=޿oMu1҅tjjEP7]̊ÜCBU뾋E}IMȋ]]19wN;tCދ}Mu$1tjjUR7]΍UĈCBU뺉E}IM]]19wF;t;ދ}Mu1tjjUR!7]ΊUCBUE}IM]]19;t@ދ}Mu#1tjjUR6t&]ɊUCBU뻋EgIM]]}IMEgU9;tMދ}Mu.}tEPUREP$6]UUÐt&UCBU밉E.}t(URh}ыUD P6x[^_ÍvU,WVSj]S5EEKMb)ƃEPk2E }}0419HB~Ph 51EE ;|WURhVEPUREPU REP Ph52=0t5P2U ;=t3Ur B@PBlPh]S5 7E]SI=PtjSjj55"5u1ǃh54P u-h5!5hh4P W1=Pu3j P5hq3j1 Shh4EPhVUREPURE PURc Ph5Pd0=Tt#5P43P} t0E ;|%URPEP URE PUR e[^_ÐU WVShX1"21ҍ}9Hu B~Ph \21&=DuDdjd0@WEP5D5@/Ã|;D|X5@2D9 dDCd9DD5D)0@T5@jVu u hX2e[^_ÐUlWVSPtP1P1ۍu} ,~9}?CShV}2Vj55t% W5tj/t5t/.880.P5th0j3. 5t52KShV1Vj55tl 55t,t2M.8 0 .P55thwvljj555t5, tz-8tpti u65t555th@/j-.0a-P5t5hW/j,e[^_ÐU WVS]uE PY,819t&UU RP%,K]9||E<tb;]} GRPQ-t/,0,P7h.j, 7A/K9}} Q,UU RP/JF9E P,t.),0+PU Rh-j+e[^_ÉU [configuration properties] [...] %s [configuration properties] [...] ( implicitly '-c') %s ( implicitly '%s.conf') %s ( implicitly '-c' and '%s.conf') where can be one of: -c --console run as a Console application -v --version print the wrapper's version information. -? --help print this help message is the wrapper.conf to use. Name must be absolute or relative to the location of %s [configuration properties] are configuration name-value pairs which override values in wrapper.conf. For example: wrapper.debug=true %s.confc%sFilter trigger matched. Restarting JVM.Filter trigger matched. Shutting down.--> Wrapper Started as Daemon--> Wrapper Started as ConsoleUsing system timer.Using tick timer.<-- Wrapper Stopped--> Wrapper Started as ServicewrapperStopProcess(%d) called while stopping. (IGNORED)wrapperStopProcess(%d) called.wrapperRestartProcess() called. (IGNORED)wrapperRestartProcess() called.javawrapper.java.command"%s"jdbjdb.exewrapper.java.additional.%d-"-The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.wrapper.java.additional.%d.stripquotes-Xdebugwrapper.java.initmemory-Xms%dmwrapper.java.maxmemory-Xmx%dmLD_LIBRARY_PATHwrapper.java.library.path-Djava.library.path="%s%c%s\"-Djava.library.path="%s%c%s"-Djava.library.path=%s%c%s-Djava.library.path="%s\"-Djava.library.path="%s"-Djava.library.path=%s-Djava.library.path="wrapper.java.library.path.%d./\-classpathwrapper.java.classpath.%dClasspath element, %s, does not match any files: %sClasspath element, %s, does not exist: %sUnable to get information of classpath element: %s (%s)-Dwrapper.key="%s"-Dwrapper.key=%s-Dwrapper.port=%d-Dwrapper.jvm.port=%d-Dwrapper.jvm.port.min=%d-Dwrapper.jvm.port.max=%d-Dwrapper.debug="TRUE"-Dwrapper.debug=TRUE-Dwrapper.pid=%d-Dwrapper.use_system_time="TRUE"-Dwrapper.use_system_time=TRUE-Dwrapper.timer_fast_threshold="%d"-Dwrapper.timer_fast_threshold=%d-Dwrapper.timer_slow_threshold="%d"-Dwrapper.timer_slow_threshold=%d-Dwrapper.version="%s"-Dwrapper.version=%s-Dwrapper.native_library="%s"-Dwrapper.native_library=%s-Dwrapper.ignore_signals="TRUE"-Dwrapper.ignore_signals=TRUE-Dwrapper.service="TRUE"-Dwrapper.service=TRUE-Dwrapper.disable_shutdown_hook="TRUE"-Dwrapper.disable_shutdown_hook=TRUE-Dwrapper.cpu.timeout="%d"-Dwrapper.cpu.timeout=%d-Dwrapper.jvmid=%dMainwrapper.java.mainclasswrapper.app.parameter.%dwrapper.app.parameter.%d.stripquotes------------------------------------------------------------------------The JVM is being launched with a debugger enabled and could possibly besuspended. To avoid unwanted shutdowns, timeouts will be disabled,removing the ability to detect and restart frozen JVMs.JVM process exited with a code of %d, leaving the wrapper exit code set to %d.JVM process exited with a code of %d, setting the wrapper exit code to %d.JVM process exited with a code of %d, however the wrapper exit code was already %d.JVM already down.Unable to start a JVMJVM exited while loading the application.JVM exited before starting the application.JVM exited while starting the application.JVM exited unexpectedly.JVM exited unexpectedly while stopping the application.JVM exited normally.JVM exited on its own while waiting to kill the application.Unexpected jState=%d in wrapperJVMProcessExited.p 0PIGNORESHUTDOWNFORWARDwrapper.daemonizewrapper.signal.mode.hup%s must be in the range 0 to %d days (%d seconds). Changing to %d.wrapper.logfileSIZEwrapper.logfile.rollmodewrapper.logfile.rollmode invalid. Disabling log file rolling.YYYYMMDDwrapper.logfile must contain "%s" for a roll mode of DATE. Disabling log file rolling.wrapper.logfile.formatINFOwrapper.logfile.loglevel0wrapper.logfile.maxsizewrapper.logfile.maxfileswrapper.logfile.inactivity.timeoutPMwrapper.console.formatwrapper.console.loglevelwrapper.console.flushNONEwrapper.syslog.loglevelUSERwrapper.syslog.facilitywrapperwrapper.ntservice.namewrapper.unix.namewrapper.portwrapper.port.minwrapper.port.min must be in the range 1-65535. Changing to %d.wrapper.port.maxwrapper.port.max must be greater than or equal to wrapper.port.min. Changing to %d.wrapper.jvm.portwrapper.jvm.port must not equal wrapper.port. Changing to the default.wrapper.jvm.port.minwrapper.jvm.port.min must be in the range 1-65535. Changing to %d.wrapper.jvm.port.maxwrapper.jvm.port.max must be greater than or equal to wrapper.jvm.port.min. Changing to %d.wrapper.debugDEBUGwrapper.java.command.loglevelwrapper.adviserwrapper.use_system_timewrapper.timer_fast_thresholdwrapper.timer_slow_thresholdwrapper.native_librarywrapper.java.library.path.append_system_pathwrapper.state_outputwrapper.timer_outputwrapper.loop_outputwrapper.sleep_outputwrapper.memory_outputwrapper.memory_output.intervalwrapper.cpu_outputwrapper.cpu_output.intervalwrapper.disable_shutdown_hookwrapper.startup.delaywrapper.startup.delay.consolewrapper.startup.delay.servicewrapper.restart.delaywrapper.restart.reload_configurationwrapper.disable_restartswrapper.cpu.timeoutwrapper.startup.timeoutwrapper.ping.timeoutwrapper.ping.intervalwrapper.shutdown.timeoutwrapper.jvm_exit.timeoutwrapper.ping.interval must be at least 1 second. Changing to 1.wrapper.ping.interval must be at less than or equal to 1 hour (3600 seconds). Changing to 3600.wrapper.ping.timeout must be at least 5 seconds longer than wrapper.ping.interval. Changing to %d.CPU timeout detection may not operate correctly during startup because wrapper.cpu.timeout is not smaller than wrapper.startup.timeout.CPU timeout detection may not operate correctly because wrapper.cpu.timeout is not smaller than wrapper.ping.timeout.CPU timeout detection may not operate correctly during shutdown because wrapper.cpu.timeout is not smaller than wrapper.shutdown.timeout.wrapper.max_failed_invocationswrapper.successful_invocation_timeThe value of wrapper.max_failed_invocations must not be smaller than 1. Changing to 1.wrapper.request_thread_dump_on_failed_jvm_exitwrapper.filter.trigger.%dwrapper.filter.action.%dwrapper.pidfilewrapper.java.pidfilewrapper.lockfilewrapper.java.idfilewrapper.statusfilewrapper.java.statusfilewrapper.commandfilewrapper.command.poll_intervalwrapper.anchorfilewrapper.anchor.poll_intervalwrapper.umaskwrapper.java.umaskwrapper.pidfile.umaskwrapper.lockfile.umaskwrapper.java.pidfile.umaskwrapper.java.idfile.umaskwrapper.statusfile.umaskwrapper.java.statusfile.umaskwrapper.anchorfile.umaskwrapper.logfile.umaskwrapper.ignore_signalsUnable to set working directory to: %s (%s)Working directory set to: %swrapper.working.dirGot a log message from JVM: %sGot key from JVM: %s%dReceived a connection request with an incorrect key. Waiting for another connection.Incorrect key. Connection rejected.Got ping response from JVMJVM requested a shutdown. (%d)JVM requested a restart.JVM signalled a stop pending with waitHint of %d millis.JVM signalled that it was stopped.JVM signalled a start pending with waitHint of %d millis.JVM signalled that it was started.0@@@@#0@P`p3.2.332x86windowsSTARTINGSTARTEDSTOPPINGSTOPPEDUNKNOWNDOWNLAUNCH(DELAY)LAUNCHINGLAUNCHEDKILLINGw%s Unable to write to the status file: %s Set Wrapper State %s -> %s Set Java State %s Timeout %08lx -> %08lx Set Java State %s -> %s3@GPW`gpwV`gpw '07@GPStartup failed: Timed out waiting for a signal from the JVM.Mainwrapper.java.mainclassorg.tanukisoftware.wrapper.WrapperSimpleApporg.tanukisoftware.wrapper.WrapperStartStopApp------------------------------------------------------------------------Advice:The Wrapper consists of a native component as well as a set of classeswhich run within the JVM that it launches. The Java component of theWrapper must be initialized promptly after the JVM is launched or theWrapper will timeout, as just happened. Most likely the main classspecified in the Wrapper configuration file is not correctly initializingthe Wrapper classes: %sWhile it is possible to do so manually, the Wrapper ships with helperclasses to make this initialization processes automatic.Please review the integration section of the Wrapper's documentationfor the various methods which can be employed to launch an applicationwithin the Wrapper: http://wrapper.tanukisoftware.org/doc/english/integrate.html%sThe JVM was launched with debug options so this may be because the JVMis currently suspended by a debugger. Any future timeouts during thisJVM invocation will be silently ignored. DebugJVM timeout. Disable current %s timeout. Loop: check anchor fileAnchor file deleted. Shutting down. Loop: check command filer+tUnable to read the command file: %sRESTARTCommand '%s'. Restarting JVM.STOPCommand '%s'. Shutting down with exit code %d.PAUSECommand '%s' not supported on this platform, ignoring.RESUMEDUMPCommand '%s'. Requesting a Thread Dump.CONSOLE_LOGLEVELLOGFILE_LOGLEVELSYSLOG_LOGLEVELCommand '%s' is missing its log level.Command '%s' specified an unknown log level: '%'Command '%s'. Set console log level to '%s'.Command '%s'. Set log file log level to '%s'.Command '%s'. Set syslog log level to '%s'.Command '%s' lead to an unexpected state.%dLOOP_OUTPUTSTATE_OUTPUTMEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTTRUECommand '%s'. Enable %s.Command '%s'. Disable %s.Command '%s' is unknown, ignoring.Unable to delete the command file, %s: %sJVM Restarts disabled. Shutting down.Waiting %d seconds before launching another JVM.JVM was only running for %d seconds leading to a failed restart count of %d.There were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.Waiting %d seconds before launching the first JVM.wrapper.on_exit.%drestartshutdownwrapper.on_exit.defaulton_exit trigger matched. Restarting the JVM. (Exit code: %d)on_exit trigger matched. Service is paused, will restart the JVM when resumed. (Exit code: %d)Reloading Wrapper configuration...com.silveregg.wrapper.WrapperSimpleAppThe com.silveregg.wrapper.WrapperSimpleApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperSimpleApp class instead.com.silveregg.wrapper.WrapperStartStopAppThe com.silveregg.wrapper.WrapperStartStopApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperStartStopApp class instead.Launching a JVM...startupStartup: Timed out waiting for a signal from the JVM.Start Application.startUnable to send the start command to the JVM.Startup failed: Timed out waiting for signal from JVM.pingPing: Timed out waiting for signal from JVM.JVM appears hung: Timed out waiting for signal from JVM. Temp: Sending a ping packet.JVM Ping Failed. Temp: Sent a ping packet.Shutdown: Timed out waiting for a signal from the JVM.Shutdown failed: Timed out waiting for signal from JVM.JVM exitShutdown: Timed out waiting for the JVM to terminate.Shutdown failed: Timed out waiting for the JVM to terminate. Last system time tick overflow at: %s Next system time tick overflow at: %s Last tick overflow at: %s Next tick overflow at: %sEvent loop started.no Loop: %ssleep Loop: maintain logger Loop: process jvm outputPause reading child output to share cycles. Loop: process socketPause reading socket data to share cycles. Loop: maintain logger(2)Wrapper Process has not received any CPU time for %d seconds. Extending timeouts.truefalse Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%s Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (N/A), Exit=%s, Restart=%s Loop: exit requestedSending stop signal to JVM Loop: handle wrapper state: %sUnknown wState=%d Loop: handle jvm state: %sUnknown jState=%dEvent loop stopped.          0 @  Q   '0 w%d Dumping JVM state.Could not dump JVM state: %sSIGALRMSIGINTSIGKILLSIGQUITSIGCHLDSIGTERMSIGHUPUNKNOWNkill, sigsend or raisethe kernelsigqueuetimer expiredmesq state changedAIO completedqueued SIGIOunknownSignal trapped. No details available.Signal trapped. Details: signal number=%d (%s), source="%s" signal err=%d, "%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s)pwg%s trapped, but signals for timer thread are ignored.%s trapped, but ignored.%s trapped. Restarting JVM.%s trapped. Forcing immediate shutdown.%s trapped. Shutting down.%s trapped. Forwarding to JVM process.Unable to forward %s signal to JVM process. %s%s trapped. Unable to forward signal to JVM because it is not running.Timer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.INTTimer thread received an Quit signal. Ignoring.Received SIGCHLD, checking JVM process status.JVM process was still running after receiving a SIGCHLD signal.TERMHUPUnable to register signal handler for signal %d. %sCould not mask signals for timer thread.Timer thread started.The timer fell behind the system clock by %ldms.The system clock fell behind the timer by %ldms. Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ldLaunching Timer thread.Unable to create a timer thread: %d, %s Sleep: nanosleep %dms Sleep: awakeCommand[%d] : %sCould not init pipe: %sCould not spawn JVM process: %sUnable to set JVM's stdout: %sUnable to set JVM's stderr: %sUnable to start JVM: %s (%d)Failed to set jvm output handle to non blocking mode: %s (%d)Failed to set jvm output handle to close on JVM exit: %s (%d)Unable to write the Java PID file: %sUnable to write the Java ID file: %sCall to getrusage failed for Wrapper process: %sCall to getrusage failed for Java process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldUnable to request JVM process status: %sJVM exited in response to signal %s (%d).WIFEXITED indicates that the JVM exited abnormally.#`#p######g#####W###w#Failed to read console output from the JVM: %s (%d)JVM did not exit on request. Attempt to terminate process failed: %sJVM did not exit on request, terminatedSpawning intermediate process...Could not spawn daemon process: %ssetsid() failed: %s/dev/nullSpawning daemon process...Unable to get the path for '%s'-%sUnable to extract path from: %sUnable to set working dir to %s : %s?-helpv-versionc-consoleERROR: Could not write anchor file %s: %sERROR: Could not write pid file %s: %sWARNING: Could not write lock file %s: %s Unrecognized option: -%s 7;; ;@;@;@;@;@;;@;@;@;@;;0;@;';rt#include%s=%sUnable to set environment variable: %s set.default.set.The following property name value pair is too large. Need to increase the internal buffer size: %struefalse name:%s value:%sADVICEFATAL ERROR WARN STATUSINFO DEBUG NONE WARNING - Encountered an unknown thread %ld in getThreadId(). NONESIZEWRAPPERJVMSIZE_OR_WRAPPERSIZE_OR_JVMDATEFATALERRORWARNINFODEBUGUSERLOCAL0LOCAL1LOCAL2LOCAL3LOCAL4LOCAL5LOCAL6LOCAL7wrapper wrapperpjvm %-4d%ssignal main srvmaintimer unknown%c%04d/%02d/%02d %02d:%02d:%02d%04d/%02d/%02d %02d:%02d:%02d.%03d | `UUUUUUUUUUUUUPUeUUUpUUUUUUuUVWWWWWWWVWWW@VWWW0WWWWWW`WYYYYMMDD-YYYYMMDD_YYYYMMDD.YYYYMMDDROLLNUM-ROLLNUM_ROLLNUM.ROLLNUM.%s%s %04d%02d%02dawrapper.logUnable to open logfile %s: %s %dUnable to delete old log file: %s (%s) Unable to rename log file %s to %s. File is in use by another application. Unable to rename log file %s to %s. (%s) Unable to get the current logfile size with ftell: %s Unable to get the current logfile size with stat: %s ????????0l'l l lllPn:  X n(̈  T،ȌohootƏ֏&6FVfvƐ֐&6FVfvƑ֑&6FVfvƒ֒&6FVfvƓ֓&6FVfvGCC: (GNU) 2.95.4 20011002 (Debian prerelease)GCC: (GNU) 2.95.4 20011002 (Debian prerelease)GCC: (GNU) 2.95.4 20011002 (Debian prerelease)GCC: (GNU) 2.95.4 20011002 (Debian prerelease)GCC: (GNU) 2.95.4 20011002 (Debian prerelease)GCC: (GNU) 2.95.4 20011002 (Debian prerelease)GCC: (GNU) 2.95.4 20011002 (Debian prerelease)GCC: (GNU) 2.95.4 20011002 (Debian prerelease)GCC: (GNU) 2.95.4 20011002 (Debian prerelease)GCC: (GNU) 2.95.4 20011002 (Debian prerelease)GCC: (GNU) 2.95.4 20011002 (Debian prerelease)01.0101.0101.0101.0101.0101.0101.0101.0101.0101.0101.01.symtab.strtab.shstrtab.interp.note.ABI-tag.hash.dynsym.dynstr.gnu.version.gnu.version_r.rel.dyn.rel.plt.init.text.fini.rodata.data.eh_frame.dynamic.ctors.dtors.got.bss.comment.note# 1((d7 @?̈Go Tohh `c Ȍ l ،  uXX%p{nnW FppGttGDDHLLHTTHPI IKLQPD kE(̈hȌ، X   n nptDLT   ' 26LDP fpy0 8 \ D'pn pn Hn pPpn p &  4  G V]? hO q~ O 0@(   O ! S 0 =<( G \H p:k }  i Y[ u ;0 j  #L 1ElK Wh j g\K hl D  P /Џ/AtJO_T] r@S k p 4 ', (  kp &9 . F'"gtw, ,a k +k   88 # I4n;4HLM9 Wi  j xcf 0*@P > B `7 p+= KjL Xr7hOp k ;@k" А/j  *=8} JH@ g=k w -M- tX j  e j  + la/ 4 SF \ [ r L  @ h>{ j 0  X  ( @:$ lL) 6 m A G R P5d p `/  9M 8 p7 K m  ]  # #"F :Z dk< f m1 r * ` 8 Tj  i   !  j  / : Y L БS_ i r A "  #0 k  L1 D7   " ] 4  C M= X 7i  x S  V   [ $5 0[p #B9 7H;o I  af r@?@  ,P(k :S 'Hz : H`[p8p<hT,  x9 <P @=t ! (0T @ Om  dT };,I Xj  |q  *W(e 9d UВi* u/:H   n Rdj: ;;j  -h < \N lo0$<, ?u No @P8P;b ``j  4B CpRSLil };HT [i  U  i ( % ;KP=5 [$=, p` ^P:pM ,gK c    `pSF i    ,, Letextgcc2_compiled.call_gmon_startcrtstuff.cp.3__DTOR_LIST__completed.4__do_global_dtors_aux__EH_FRAME_BEGIN__fini_dummyobject.11frame_dummyinit_dummyforce_to_data__CTOR_LIST____do_global_ctors_aux__CTOR_END____DTOR_END____FRAME_END__wrapper.cunknownBuffer.294seeded.364wrapperinfo.cwrappereventloop.cwrapper_unix.cjvmPidproperty.clogger.c__dso_handlewrapperExecutewrapperDatagetLogfileRollModeForNameconsoleFlushqueueMessageslastLogfileActivitydescSignalwrapperRestartProcesskeyCharswrapperProtocolClosesetLogfilePathjStateLaunchdaemonizewrapperVersionBannerwrapperLogSignalledwritePidFilewrapperStopProcesswStateStartedwrapperBuildJavaCommandglob@@GLIBC_2.0protocolStopServerwrapperGetSystemTicksrename@@GLIBC_2.0sigActionCommonsetSyslogLevelIntwStateStoppedcurrentLoginfoLevelwrapperRunServicelogFileLastNowDatesigaction@@GLIBC_2.0childOutputBufferstrchr@@GLIBC_2.0createPropertiesreplaceStringLongWithShortthreadMessageBufferSizecorrectWindowsPathwrapperArchgetSignalModewrapperBuildUnixDaemonInfogetpid@@GLIBC_2.0_DYNAMICnanosleep@@GLIBC_2.0log_printf_messagejStateKillinglogRegisterThreadwrapperLoadConfigurationPropertieswrapperBuildJavaCommandArrayInnerwrapperKillProcessNowwrapperStartedSignalledjStateStoppedsendLoginfoMessageappExitwrapperJVMProcessExited__register_frame_info@@GLIBC_2.0workLogFileNamereleaseProtocolMutexprotocolOpengetLastErrorTextlocaltime@@GLIBC_2.0disposeLoggingwrapperOSlockProtocolMutexwrapperSetJavaStatestrcmp@@GLIBC_2.0wrapperKillProcessclose@@GLIBC_2.0_fp_hwqueueWrappeddumpPropertiessetLogfileLevelIntconsoleFormatlimitLogFileCountHandleFilefprintf@@GLIBC_2.0fork@@GLIBC_2.0propertiesgetenv@@GLIBC_2.0wStateStoppingvalidateTimeoutumask@@GLIBC_2.0wrapperInitializeRunsignal@@GLIBC_2.0fflush@@GLIBC_2.0logTimerStatscloseLogfilepthread_create@@GLIBC_2.1unlink@@GLIBC_2.0trimgetLastErrorgetrusage@@GLIBC_2.0currentLogfileLevelgetLowLogLeveljvmOutchildOutputBufferSizevsnprintf@@GLIBC_2.0strerror@@GLIBC_2.0setConsoleLogLevelIntcurrentLogFileNamewrapperSleepevaluateEnvironmentVariablesinitializeTimertimerRunnergetpwuid@@GLIBC_2.0createInnerPropertyputenv@@GLIBC_2.0wrapperBuildKeygetSyslogLevelIntlimitLogFileCount__errno_location@@GLIBC_2.0ftell@@GLIBC_2.0packetBufferrollLogsaccept@@GLIBC_2.0wrapperKeyRegisteredprotocolSendBufferSizewrapperUsagewrapperLogChildOutputensureSpaceInChildOutputBufferwrapperPingRespondedinet_ntoa@@GLIBC_2.0protocolSendBuffer_initwrapperBitslogFileMaxSizelisten@@GLIBC_2.0getStringPropertyforceFlushwrapperGetWStatemalloc@@GLIBC_2.0logFilePathsetsid@@GLIBC_2.0jStateDownwrapperRequestDumpJVMStatewrapperGetLastErrorpipe@@GLIBC_2.0removePropertylog_printf_queueInnerlogfileActivityCountremove@@GLIBC_2.0anchorPoll__deregister_frame_info@@GLIBC_2.0realpath@@GLIBC_2.0initLogginggetThreadIdsyslog@@GLIBC_2.0wrapperSetWorkingDirwrapperReportStatussetLogfileAutoClosegetLogfileRollModestdout@@GLIBC_2.0wrapperDumpCPUUsagewrapperVersionsetConsoleLogLevel__xstat@@GLIBC_2.0timerTicksupdateStringValuewaitpid@@GLIBC_2.0getLogfileActivitytime@@GLIBC_2.0wrapperGetProcessStatus_startwrapperReadChildOutputpthread_mutex_lock@@GLIBC_2.0fgets@@GLIBC_2.0getIntPropertysendPropertieswrapperStartPendingSignalledwrapperRunConsolejStateStoppingdisposeInnerPropertychdir@@GLIBC_2.0jStateLaunchedsetLogfileMaxFileSizegetOutputFilterActionForNamestrstr@@GLIBC_2.0logFileRollModejStateStartedloadConfigurationsigaddset@@GLIBC_2.0wrapperGetFileBaseprotocolMutexloadPropertiesInnergetSignalCodeDescwrapperProtocolFunctionwrapperGetJState__strtol_internal@@GLIBC_2.0getInnerPropertywrapperStopPendingSignalledlogFileMaxLogFilescurrentLogfacilityLevelexecvp@@GLIBC_2.0queueLevelssendEventlogMessagegetSignalNamegetBooleanPropertylogfileFormatopenlog@@GLIBC_2.0inet_addr@@GLIBC_2.0queueReadIndex__bss_startpthread_self@@GLIBC_2.0mainpipeInitializedwrapperDumpMemorysigActionChildDeaththreadMessageBufferregisterSigAction__libc_start_main@@GLIBC_2.0queueThreadIdsjStateLaunchingjStateStartingsetSyslogFacilityIntsetSyslogEventSourceNamedup2@@GLIBC_2.0wrapperFreeJavaCommandArraylog_printfMutexsetConsoleFlushwrapperClasspathSeparatorwrapperStripQuotesdata_startasctime@@GLIBC_2.0globfree@@GLIBC_2.0checkAndRollLogswrapperAddDefaultPropertiescloselog@@GLIBC_2.0commandPollprintf@@GLIBC_2.0bind@@GLIBC_2.0threadPrintBufferwrapperGetTickAgedisplayLaunchingTimeoutMessage_finifcntl@@GLIBC_2.0flushLogfilememcpy@@GLIBC_2.0sigActionAlarmlogLevelNamesmaintainLoggerfclose@@GLIBC_2.1wrapperUpdateJavaStateTimeoutsdstrrchr@@GLIBC_2.0sigActionInterruptlogFileUmaskinsertInnerPropertysetEnv__strdup@@GLIBC_2.0queueWriteIndexgettimeofday@@GLIBC_2.0wrapperProtocolReadsrand@@GLIBC_2.0getConsoleLogLevelIntwStateStartingopen@@GLIBC_2.0threadPrintBufferSizeprotocolStartServersigemptyset@@GLIBC_2.0threadIdssetConsoleLogFormatstrcasecmp@@GLIBC_2.0getLogfileLevelIntbuildPrintBufferwrapperTickExpiredsetLogfileLevelwrapperParseArgumentshandleDebugJVMTimeoutexit@@GLIBC_2.0sigActionHangupsigActionTerminationloginfoSourceNameaddPropertypipedeswrapperRestartRequestedwrapperGetCurrentTimewrapperAddToTicksreleaseLoggingMutexssd_edatasetLogfileMaxFileSizeInt_GLOBAL_OFFSET_TABLE_free@@GLIBC_2.0_endsend@@GLIBC_2.0sigActionQuitsetLogfileRollModecheckPropertyEqualwrapperStopRequestedsetLogfileFormatdisposePropertieswrapperGetTicksgetsid@@GLIBC_2.0getLogLevelForNamequeueSourceIdsloadPropertiesgenerateLogFileNameregisterSyslogMessageFilesetSyslogLevelfopen@@GLIBC_2.1currentConsoleLevelwriteStateFilewrapperSetWrapperState_IO_stdin_usedpthread_mutex_unlock@@GLIBC_2.0lockLoggingMutexlog_printfisQuotablePropertykill@@GLIBC_2.0autoCloseLogfileaddPropertyPairsetSyslogFacilitywrapperBuildJavaCommandArraylinearizePropertieslogfileFPunregisterSyslogMessageFilewrapperProtocolGetCodeNamepthread_equal@@GLIBC_2.0recv@@GLIBC_2.0wrapperDisposepthread_sigmask@@GLIBC_2.0sprintf@@GLIBC_2.0getLogFacilityForNamewrapperGetPID__data_startsetLogfileMaxLogFilessetWorkingDirsocket@@GLIBC_2.0setInnerPropertytimerThreadIdlog_printf_queuewrapperStoppedSignalledwrapperEventLooprand@@GLIBC_2.0read@@GLIBC_2.0wrapperInitializesetLogfileUmask__gmon_start__strcpy@@GLIBC_2.0wrapperSetWorkingDirPropmule-2.0.1/distributions/server/src/main/resources/lib/boot/exec/wrapper-macosx-universal-320000755000175000017500000071020410567556635032046 0ustar charlescharles   8__PAGEZERO__TEXTpp__text__TEXT%hh__picsymbol_stub__TEXT,$__symbol_stub__TEXT,__picsymbolstub1__TEXT-  __cstring__TEXT8 G( __literal8__TEXT o__literal4__TEXTo__DATA p__data__DATAp__nl_symbol_ptr__DATApqY__la_symbol_ptr__DATAdqu__dyld__DATAr__bss__DATA(__common__DATA08__LINKEDIT@= /usr/lib/dyld 4CfX/usr/lib/libSystem.B.dylib3p P^d^(%h|: x8!T!48!z8;cW{:|=`ak%}iN!|!B||x|#x|+xH <_ZD<_ZH<_ZL<_B[\/A }N!<_B[d/A }N!H<_ZT /A }N!HH<8ch88H݀a8/AH8<_B[`}/@HD//@|Jx}"Kx 9)|u@/A8 <_ZPH <_bZP/@ xHx/@xxx8HčH |uA9+}b[x9@Kl|B}=|9}N |B}=|9@}N |B}=|9}N |B}=|9}N |B}=|9t}N |B}=|9X}N |B}=|98}N |B}=|9}N |!B<8c88H큁8}N!8!`|N |B}=|9}N |uM |bx//A 8BH 8b|bx|u@N |u@ x~x|8`8(H|`x8^8x^8|^88(8`-H)|`x^88`-8Hq!|N |B}=|9P}N |B}=|9}N |B}=|90}N |!|> x~x|888`-Hq|`x@8@ xBH<_BSD88/A^8T>+A<_8b`Ha<_8bHHu!|N |B}=|9T}N |B}=|9}N |B}=|9T}N |B!p<_<BR8 8a8?H̓R|888}8Hν<_BR<8 8a8H}8888H΍<_BR<8 8a8Hi}8888H]}<88 8HE}<88 @8H-8!|N |8|}x!8a8H A<<b!8`M8!`||Bp=|6p|P|N |B!?~PP/AXH/@Q9k9JH,/"@|Q9k9JH/"A }>Q9J9kA}BSx88!P||N N a|{y||#x!@HHX~/AH8;;@8!`cxa|H/@~x;K8!`a|N |BAۡ?!I|/@8`HH18I|?_;zF?C0H<C0<_a<8F <_ɡ8bG<_(F<_âF,hHlc@aD/@:F;(2rفHAL|H\@[88!lAˡ|N ||}x|#x!c/AH98/A0xH!8cH8!P}x|H8!P|N |~y|B|#x!A|<8TH9/@ ;dH`<x8HH/@ ;eH@<x8\H/@ ;fH <x8hH/@;g8!Px|N |B|~x!<8H/8`[A$<x8Hq/8`\A8`Z8!P|N ,|B!A 8H|Bp|cp)|6p|PcT><@Q})`B})|cU ]~U)>Tc~|cTc|cJ|N |B8!<_<B=48ЀbH |~yA|/Ap<_B=8"H]/A,H̅<|gx8x8`8Hm8`H0/A$<x88`8HE8`H8`8!P|N |B!<_:8p~x~CxH5M:t~Dx8bH|uyAHq|xy@K;xHxyH)xHA@A/@ =?Y): |:xy~x:|vvxHKX/ACxH|xy@PHt;xHMxyHxH߹@A/A~ɳxvxH =?Y): 96|~JyDx:|iHM/@(=?Y9iI |VB:A09|I/\@8\| .:98"|K.;A<8` HW:=?|q.8I) bB #cC;AL-8`W:H9|q.Q@ :H8"::`:;=:s8~ex~CxHM:t~Dx8bH||yAHU|{yAx8*H!/@x8?H |~yAx8(888Hⱀ8/A<_~ܳx::AHV:|b.H~|{x;@@0;xHAxzHߕxHݭ@A/@Z|;~AH:z:|.||HM8@@(~ܳxKh<x88`8~FxH8a8HK|\x|t//A /\@8cxHމ|}xxHx8xHxH|}x8dH/AdHޅ/AHu/@$<8`88~FxxHeH$HY<|gx88`8xHAA xHY6;@@0;xHݹxzH xH%@A/@ =?Z): |:;zx:|v6xHKX/@(=?Z9iI |VB:A0:|I/\@8\| .::8"|K.;A ?<<88T}Hi||xHy}<<88HIH=|~y@ <8`88H;HD/@<<_x;xH/@ <x88`8HÙ;x?_H<<~8X8`>HH~<88pHHE~<<88HH ~<88HaH<_;́7~x8H=/8`@~x8H!w}8`[/@8`Hq<<|88HHm|<88 ?_HH|<88(HqH|<<8@8XHH|<<8`8xH}H̓<88xHa<|ex8xHMHHa/AHH[8<8鴀|8H <}(8Ā|8}H},^,8B+@,8}<,8؀[8`8,Hm|8<`8H~0{K08+@DK,8`8B@|xK0<[88`80HHH+,H@<8@8 `B@|@x 0<[8,8`80HT<8ꄀb8Hِ}8\8/@,(@ 8<888`8HYt<8{8yH}}<^<8B+@,8y<<8\8`8H8`}x8{H<}|8x{8H8}8{H8}{?8H}t/A 8HI }.^AԀb H^b >i$H^b$7<_8i}>Kx? ^8,8a88H}888HU/A>I8BIK}/@(Tc:H}} }Tc:Hi}$^/@<_=?<_):;@;`>>_;Z8,Ex8a8H=u888HY||x Hy8cHx|{.9I |b.H98HEx8a8Hu88~ųxH]Y~ijx|}x$H8[/A x8H8\/A8Z;{YA8W|\x/@dT<8d8bH||x~(/A H(/A(xH8cHx~(HUHt<8t{8Hq|~x}0/AH980/A xH!8cHx}0H/@T{<88H ||x~,/A HՓ,/A xH8cH9x~,Ht<8{8H|~x}4/AHy84/A xHa8cHx}4H-/@T{<88HM||x~8/A H8/A xH8cHyx~8H̓<w8Ȁ|8H|~x}/w@$Hm<|fx8ތ8`8HYH88H/@hH9<|fx8ް8`8?H!}/A4HY/@ >6I/AH>H>H>;VB(/A ,;<_;!8?_;;`H;8zؓ8<@Da9Ha<$xw8:H/@@HN}/0@,/AX,KX;0@VB(/A40,H<|hx8xx8`8HH40,H<|ix8$xxx8`8HH|~x=I8B+A0 /A<|gx88`88HH /A$<8`8D88xH= /@0 /MA$/NA/OA/GA 8 v8+K?}/AHH!/@46I/A HL<|fx88`8H8w/AHH/@46I/A HL<|fx88`8HQ869@8IB4i IBHXV"|^x(/@0A$<8`8l8xHH^4^/A4<8ߜ8`8Hw8H)/@HK<|fx8߼8`8?Hy}/ADH/@0^/A HKq<|fx88`8H58w/AHHe/@46I/A HK!<|fx88`8H8V8" 48!|N |Ba!?~ /A?/@88<888H/}@HHJ/#Ah<_B" /APH5<|fx88`8H!H0?\/A(a@H<>|fx8 8`8H}88Hy/@\/A H<|fx848`8H}/AH/@0\/A HI<|fx88`8HY8H`~ /ADH/@0\/A HIE<|fx88`8H 8 [8" 48!a|N |B|@&|#x|+xA|wx>!8vxH/s@ <_;"x.@ ;HxH;<_B@@$?} /AHyxH} ?_@/@<_B$" /Ap8+Al<_T:8B}".})})N tLLL(4@\h<_8DH<_8PH<_8\H<_8dH<_8lH<_8tH<_8|H<_8⻌H<_8⻜H<_8⻤H<_8⻬H<_8⻰H<_8⻸Hx<_8Hl<_8H`<_8HT<_8HH<_8H<<_8H0<_8 H$?<;8,exxHYx@ <_;"ٌ<~x8ٔ(x88H;H?8$I/A8+Al<_T:8B}".})})N tLLL(4@\h<_8DH<_8PH<_8\H<_8dH<_8lH<_8tH<_8|H<_8⻌H<_8⻜H<_8⻤H<_8⻬H<_8⻰H<_8⻸Hx<_8Hl<_8H`<_8HT<_8HH<_8H<<_8H0<_8 H$?<;8,xexH}x@ <_;"ٌ<(x8~x88H?] b@] H} x8cHa xz@8;H/@$^/A$HDE<|gx8~x88H}z@/ALH=/@0^/A HC<|fx8(8`8H8;@H;8vH8!pxa|}p N |B!?̀^/A<8`8Ԝ8HA^/K@|/@(HF^|ex8L|8`8H%YHHF]8L|ex88`H%=̀^/3@8`84H!9^p/@8!P8`8488|HJ/M@l8`8e8K^/@$HEɀ^|ex8M8`8HHE8M|ex88`8!P|H$x8!P|N |B8 !<_BTbHo8s|}x8`xK8!Px|H|B8`83!H ?8`8G88H#у8]pH^,@d]/A<8`88H=H<8`88H%^B/A</A<8`848HH<8`8H8H?H4=}/AHH /@4>I/A H@<|fx88`8H8?} /AHH/@4>I/A H@q<|fx88`8H58 8<8`]8\84H ]b8!P|N |B8`83!H9?8`8G88H"48]pH\,@8<8`8Ѥ8H]/A</A<8`8h8HQH<8`8|8H9?H2}P/AHHi/@4>4I/A H?%<|fx888`8H8P?}T/AHH/@4>4I/A H><|fx88`8H8T48<8`]8ѐ84Hi]b8!P|N ,|B|#x|~x!@0?<\8 88"8 HuH\?\" /@,<B|+x8p88H5H<|+x8м88H\b8+A\<_T:8B}".})})N $Hd$ /A(<8`88H)H<x8$88HH8< 8<x88HaH8< 8h8`8HH8< 8є8`8HH8< 88`8HHp<8`88HqHX /AL<8`88HMH4<8`8,8H5H<x8l88Hxx?8G8HU~/AHH9/@4/@4?/@K9/AK/A|x8888H/@XH8/#A/&A/6A<_^/AXHm<|fx8H8`8HYH8/A<_^/A<8`8d8H!{/A@HY/@0^/A H8<|fx88`8H88`H8;?|tH,?_>Z8| 鮁bK/@LH{8888H/@8|t/A/AЀ^|;K8+Al<_T:8B(}".})})N tLLL(4@\h<_8«H<_8«H<_8«H<_8«H<_8«H<_8«H<_8«H<_8¬H<_8¬H<_8¬H<_8¬$H<_8¬(H<_8¬0Hx<_8¬@Hl<_8¬PH`<_8¬hHT<_8¬tHH<_8¬H<<_8¬H0<_8¬H$?<;x8xxHx<8΄8`8H8+A@<_T:8B}".})})N XP        Ѐ~H|}x< /A <8`8`8xH<I8B+A0 /A<x8Ƭ8`88H%H /A$<8`8Ƭ88xH< /@0 /MA$/NA/OA/GA 8 z8+KH<8`8t8H]/@</@0/MA$/NA/OA/GA /H@,/A<8`8ƭ88HH|/A <8`8ƭ88H]8]H@]/A<8`88H=]/L@|/@H6}]|8H HH6e8HHԀ~HK9Hă]/A<8`808H]/@(H6 ]|ex8N8`8HHhH58N|ex88`HHL~H|}x\/A <8`88xH9\/KA /M@/@<_0H$<@C0oAH<_LɡH (H5I<_"(|}x?$HxPTHHK9H~K=HZ;Z/A <8 8`8HyZb<x8,H]H4:I/A <8Μx8`8H)~x8H!@<bA<`M| |YP})p|6pB| PT>|P|/@8`H8`8!|N /4|B}H|AHA/3@$H,/8A!;??cxH8L|}xCxH9|~xW>H/A0<xx8PH8!`x|H8`dH3%/ ;@8!`<Fx8T8`|8H|B8`8!<8ļH<_B<<8b8H]<|~x8H/@<x8(H/@<_B" /A??;;\x8`8Hx8`8H<8X8`8H<8`8`8H<8Ũ8`8H<88`8H<888`8H<8|8`8Hy<88`8He<x88`8HM<88`8H9<808`8H%<8l8`8H<8Ǵ8`8H<88`8H<88`8Hx8`8H8!Px8`8|H8!P|N |B|xx!?_؀^@/AHKQ/A^/A<8`808H)^b@8H/@,x?;[8Pb@H|yy&@ 8`dH0/ ;A AH4W > W>@$[<8T8`@8HH8a88P%xHQ/AT8a88 H},A 88a88 Ha,A 88a88 HE|}yA8/ A<8a88 H/@(<88x888`H8`KmKP<8a88H}/@H/;AxHa|~x<888Ƙx8`8Hx8`K K<8a88H!/A<8a88H /@ <8`8888HAK<8a88H/@(<88888`H 8`H*Kl?8a88@H/A4<8a88TH/A<8a88hHi/@/@ <8`8x888HKxHf|~y@$<x8Ǡ8`888HiKHm%8@||x8a8H/@,xHl9<8x8`888H%H<8a88TH/@,xHi<8x8`888HH\<8a88hHy/@,xHl <84x8`888HH<8`8`888HHlIA/ZOB"|&T Hl!<|ex88a8H8p888`KaK?8a88ȌH/A|<8a88ȘH/Ad<8a88ȨH/AL<8a88ȸH/A4<8a88Hm/A<8a88HU/@\/A <x8H5;/A;8Ȍ8a8H/@:؀IH<8a88ȘH/@:؀IH<8a88ȨH/@:؀IHx<8a88ȸH/@:؀IHP<8a88Hy/@:؀IH(<8a88HQ/@:؀I/A$88<88`8|3xHqK88<88`8|3xHQK<8`8$888H5K#xHу؀^b@H/@,^@Ho<|gx8Hx8`8HZxDK}H8!|N N N /|B|~x!A8`xH./AD<_BB/A,bxK1/A8!P|H< 8!P|N |B?@cZ͐;!@8a8;\ bkI8+@ /7@ /A;^/@l/A,<8`8d8Hs8`88K A48`^8HexK^/AHI8BI^/A4b dxK^<|fx88`8Hr^@P8`8HexK%^/@/A<8`88HriH^bȁ>iԀ^b܀^/A K ^/A<8`8`8Hj ; ?;.I/A0A<_8|H <_8²t<8`8x8HiA 8`dH탻]/A<8`88HiHh]/A<8`88HiaH%; /A,]; /A<8`88Hi)]/A<8`88Hi]/G@B8B+@8Kэ/A,]; /A<8`88Hh]/A<8`8<8HhHgH ݀]||x/A,K]/AH!xKQ}ȃ]/A0xK/AH僽xK}HLA[xK~}܀[x"K~/A HTHHTCxxK~}^tx@dxCxK~Y<|fx8\8`8Hgi/A,xCxK~!|dxxK~I[~H[/AL/A/4AHA/3@$H,/8A!Hk<|}x8xHk||xW>Hj/8`A$<x8dxHaxHj8`8!P|N |B8|~x8!<8ƧH^}<c8Hl]/@4HG8!P<|gx8Ƨ|x88H^48!P|N +|B}H|A8A< /A<|fx88`8HYY8a88Hiu^/A<8`88HY)8!`|N |BA!?\\BBP/@|HPHa|\8+IP|.xKBP|b.;/@|CxH`̀\\8" P8@88a88<88A|hx|xx8ơX8`88HQ8!P|N |B|#x!K5H_<_B|" /A\<_BH_/A<8`8ƞ88H<8`8Ɵ$888!P|HQ8!P|N |B|#x!K<8ƞ8`88HP<_Bԁ" /A KlH <_b|dx8`K/@,8!P<8ƞ8`8|8HPh8!P|N |Ba|3x|#x||x!H]<_BDH^M/A8<_B$" /A<x8ƞd8`88H4?[$B|/A0<x8ƞ8`888!`a|HO/fAH/gA/e@<x8`8ƞ88HOi8!`8`a|K_\/@4/@(B/MA/NA/OA /G@<x8ƞ8`88HN۪$8?^88}xH]E/@h^/AX<8`8ƙ88HN}x8H\;/@,H8 <|gx8ƙ8`88HNmH;;$I/A KjaH <_bh|exx8`8OK H,<x8Ɵ8`88HN 8`8KZ{$+I8B+@8!`8`88a|K?~x/@t/A$<8`8Ɵ 88xHM~xxH[y/ATH78!`<|hxx|8ƟH8`88aHML<x8Ɵx8`88K8!`a|N |B|}x|#x|#x!K<_B8!P<"x|x8Kp|B|}x|#x|#x!KA8!P<xx|808fK |B|}x|#x|#x!K8!P<xx|88fK|B|#x!KHY<_BHZ/A,8!P<8ƛ8`8|8HK<8`8ƕT88HK<cD8HY/@4H5 8!P<|gx8ƕh|8`88HK\8!P|N |B|~x88!?}lHY/@p?<I/A\<x8Ɣ|88HJ}l8;HX/@0H4I<|gx8Ɣx88HJH ?;<I/AKf|exH <_\8!Pxx8O|K0|Ba8`!pH&E8`8`8888HY /A<8`88HH<_¤$^/A<8`808HH]x; ;>;<>?_>>>H x;<@8`B;8A< /A<8`888HD8a88HU^/A,<8`88HDHHS)/@(H/<|fx88`8HD8`K88`HTQ<8c88HT}/|~xAP8`HN8xHS8`HN8xHS8`HNx8HS+@ xHNe8`H) =I/A<8`88HCHR1/@,H.<|fx8l88`HC8`K%HA 8`HJՁ=8`I/@8`H(E8!`|N |B!`>/A|8a8=KM8<;@~x:aD~x: }{x|P|TP|/A:@8H :@8p~dxHS5|yyAHLɀ/#A,H-|}xHL<8x8`8HB/@Ѐo8A\8c?HL1|~x/A(HKOx|^"HJ8O؞8BOxH ?X~"ѮxKzA8`HP8A8;`|B?" ::~~x/ @}8AT8cHK||x/A$HJ]x|\HIْ؞]8B]xHX~ѮxKy/A;@Ht}8AT8cHK||x/A$HJm]x|\HIY؞]8B]xHX|;Z;{;@8a8KJ8A8`H<_8`8B888HH/A$<ex8xH?xHHH \<848`08H:z 4/AenHHa<|}x8uxHH|~xW>HHA/A0<xx8H?8!`xA|HH,[<8\8`48KH8!`A|N |BA|#x|}x!KI/@8`H~K/@pxxKU/A\?<8]bHB/A ]<8bHBm/@~KT8`K8`H]<8 bHB9/A ]<8bHB/@KJ8`K8`HK/A,]/A /@~KSHKW5/@x]bZHF]<b8U0HA/A ]<8bHA/@]/AK Hp`@Hp`AH/)\ZL/A|HIZ|{xbzHF<|}x8r,xHFq|~xW>HE/A$<ex8xH<xHEH ZLH#%<|gx8(H\Z(/AHHZ|{xbbHEy<|}x8r,xHE|~xW>HEY/A$<ex8xH<-xHEUHHD/A$<x8xH;xHDH4[,H!<|gx8|x8`8H6ـ[,KK18`H,]<8cH9̀~KQ8`K8`8!`A|N ||#x!/A(~xHBA/AA/@;8!Px|N |a|{x|#x!/AT~xHA/@0^/@ HH</@[/@ H88!`a|N |8`!H?88!P|N ||}x;!cH=A}H=58!Px|H=|;E|{x|#x:8!:8Htcx8%H=|~yA;8%xH=|yyAPx;~óxx:H=~óx~H=U||yAxP@@]x/Axdxx]PH=axH?U@|}x@]x/Axxx]PH=);yHP\x@Ax/Axdxx\PH<{Hdcx]xH>@||xA$Hcx]xH>@||xAx/Axdxx]PH<{/@8!p|N |a|{x|#x!c/AH;18/@ H|x888@;K8a8H=;88cH+@[}";;8a8H=À[8|8!@`a|N |8`!H;88!P|N |Ba|#x|{x!H=9|}xxH=-8}H;<|}x8exxH5xHB/A$8!`<x8ca|H48!`a|N ||~x|#x!H<9 |i9cH9)|H|J|t/ A8/ A0X@|IXP8B|~Z|IA /@8| HBK9k|t/ A / @ 8cB| XP7AxxH: 88!P|鮀|N |B!/A,?8`88`H0/@8!P|N ||yx|#x!c8`/A;xH;Ux;H;AH ;;xDxH9,@H ;;xDxH8,@{;/@8}H9e9|xx||x/A:=H(Pxx8H8;];xDxH8u|{y@xxH9axH:y~||;H(Pxx8H8M;];xDxH8|{y@xxH9xH:C|c9;/@888!px|N ||#x|+x!/A0~xH:q/AA/@H8!Px|N |a|#x|+x|3x!/A(}xH:/AA/@xH}H>dx||xH6|}xxH68!` |`a|N ||#x|+x!/AL~xH9y/A8A/@H$8!P~88|H>\8!Px|N ||#x!/A(~xH8/AA/@8`H~ 8!P|N |a||x8!/A<;`~H4ŀ~~H4~xH4/A xK8!`xa|H4|||x|#x!/A~xH8/AAl/@Hp\HI/@ <H ~;H4 ~H38!Px|H3>^/@K8!P|N |B|#x|yx|#x!|+x|3x|;xH68cH4|{xxH6q9 |i9cH9)|H|J|t/ A8/ A0X@|IXP8B|~Z|IA /@8| HBK9k|t/ A / @ 8cB| XP7AcxxH38x|H58cH49|zxxH59 |i9cH9)|H|J|t/ A8/ A0X@|IXP8B|}Z|IA /@8| HBK9k|t/ A / @ 8cB| XP7ACxxH3 8|/A(}dxH5/AA|/@8`H3M8|}xcxH48cH3%dx}H3y/AT~xH5=/@0^/@ HH8/@Y/]@ H8xDxK cxH3+ @@<cx8HH4@0; xH1/@@xKaH0+@(<cx8XH3@8{K1cxH08!pCx|H0h/ALK|Ba|#x|}x|#x!|+x|3xH3)8c+B@$<x8~8`8H'8`HLx8a8H18a88=H0|ey8`A(8xx8gx88K8`8!Bpa|N |BA|{x|#x<`{|+x<|!n8}H5I||y8`A 8a88BxH4/A8a88 H0,A 88a88 H/,A 8;8H;|t/ A/A/#AxH1,A8@9`|}"|t/"@ik8BHh/#@\/@T /#@@9bX@A$|]Z}i[x9)H@8B@}b[x8c9`H}b|Cx8B@AxxH15,A4|i8@|cH CB@|t/ A/A|t/A<x8}H0@L8}/ @/ A/ AX;B98BxKcxx8KK4/#A,x8=H.Y,A88xcx88KKxH28`!A|N 8K/|B|#x!AL/A(}xH0/AA/@?8~nH5e8n|}xHL/A(}xH0a/AA`/@<_8bnH5<|}x8nH, xH,]8!Px|N }?Kt}K||+x|wx|#x|#x!H/ /|{xAxH.@|zxA/Al~x~xHDx$xexH5)/@ xxExH,H;;|t/@8HT~x~x|t/@ Kܛ;;KKx$xexH4/AK8!p~x|N |B}H|8+ @ /-@ |[;;xH'A8cx|H'<_/bx@ |֐x8!`cxA|H$`8!`A|N |B}H|~/AX@~HDHE/A,H5cH x|ex8uiHU8`H!~HM;{;@xH18cHW:|z.8!px|H;9@xH/AXHcHx|ex<8ciH8!p8`|H /@z[x/@K8!p|N ||@&.aA|}xT:!p|#x|+xH||x@i8|bx8BBxH-8cHx|Hx8(888H8/A4;AHW:xx|.fxK8;@A8a8H@,;x~;/AH;@xH8!aa|}p N |B|{x|+x|3x!>Hcx81HY/A/@D~xzx?H0x8fH8 Hi/@ ; H;;Z|t/@|xyx?H0x8fT8 H/@ ; H;;9|t/@}xzx?H0x8f`8 H/@ ; H;;Z|t/@}x|xH0x818H}/@ ;H;;|t/@țHtxH+|}xA`H`Cx818H!/@ xxx;ZHH<;Z;|t/@8>cx8flH/A/@@~xzx?H0x8ft8H/@ ;H;;Z|t/@|xyx?H0x8f8HI/@ ;H;;9|t/@}x|x?_H0x8f8H/@ ;H;;|t/@}xH0x8fl8H/@ ;H;;{|t/@țHd~óxH+|~x@HLcx8fl8HU/@ x~ijxx;{HH;{;|t/@8H/AcxH8!p<|{~ųx|8fH/Azx|xK~x|x|t/@ Kț;;K;Kx818H}/AK/}x@D|t/@ K@;{;K;{Kcx8fl8H)/AK8!p|N |B! ?~dP/A$>HUd8dP" H>;??>>;aD;8?x8a8H كeWd8}88K}dxHM/@<_dt/@A}H/APH/A@H/A0HucHMx|ex<8caXH 8`H/@<_=?bd<_e;d;^;{H98?x8a8H |888Kɀ|HI/ALH݀/ ÃHŀcHx|fx<x8cb$H 8`HH;@hd8Wd8}KEe}H/AHU/AHE/AH5/ @D<8caH M8`HHX<8caH -8`HmH8H݀cHx|fx<8cb$xH 8`H58!|N |BA|{x!@<_apA?a/@<_ba/A8H,@HEcH|dx<8c_H e8`HHD<_88Bb4bH/ALH/ADH/A4HcH|dx<8c_H 8`HAHalH8`aAK=HpA<b@H/A?}a/AH-<_Bb(a"?_a/@l??b(exb48|?K{b<<{8_8Kـa|8K<[8!A|N |BA|#x8|rx!`|+x8a<|3x|;xH!@<b`MӀA<| 8a8})pA8|6p PH/|{x@HHy<_8|dxB`t;| A ;8BB<;8c[hHQ<_B`Ad=?x)`\x~fxgxx~x~CxK<_B`<|ex8<;XxHQ<_B_/A xH)<_B`A??9``I/A?_`pA0:D< 8^08l8~xH-H D:D~x?K_/@ `pA(>9``V`T~x8bKH$>9``V`T88bK<c`Tc>He`T<_|zx:^@v~xH/|_@4<_68bBc~xI iH|_WC>H_/@@V9``H EcHx|ex<8c^DHa8`HH<~xc`lH -=?)`xx~fxgxxx~x~CxK<|ex|_8 x|_xlptx|>^~h<_8bVdH|lx<_8BZ~h^>|xtpl!|}N |B|H|=9Yt/@!|> x|_xlptx|>^~h<_8bUHQ|lx<_8BYt~h^>|xtpl!|}N |B|H|=9X́/@!|> x|_xlptx|>^~h<_8bUH|lx<_8BX̑~h^>|xtpl!|}N |B|H|=9X$/@!|> x|_xlptx|>^~h<_8bTxH|lx<_8BX$~h^>|xtpl!|}N |B|H|=9W|/@!|> x|_xlptx|>^~h<_8bSHM|lx<_8BW|~h^>|xtpl!|}N ||dxB8_!p8a98He8a8|}xHy<_}]|~x9"S,BS, i|].<_x j;S8xH ,@|}xxH H !8!|N |B}h=k|T}N |B}h=k|Td}N |B}h=k|TH}N |B}h=k|T,}N |B}h=k|T}N |B}h=k|S}N |B}h=k|S}N |B}h=k|S}N |B}h=k|S}N |B}h=k|S}N |B}h=k|Sh}N |B}h=k|SL}N |B}h=k|S0}N |B}h=k|S}N |B}h=k|R}N |B}h=k|R}N |B}h=k|R}N |B}h=k|R}N |B}h=k|R}N |B}h=k|Rl}N |B}h=k|RP}N |B}h=k|R4}N |B}h=k|R}N |B}h=k|Q}N |B}h=k|Q}N |B}h=k|Q}N |B}h=k|Q}N |B}h=k|Q}N |B}h=k|Qp}N |B}h=k|QT}N |B}h=k|Q8}N |B}h=k|Q}N |B}h=k|Q}N |B}h=k|P}N |B}h=k|P}N |B}h=k|P}N |B}h=k|P}N |B}h=k|Pt}N |B}h=k|PX}N |B}h=k|P<}N |B}h=k|P }N |B}h=k|P}N |B}h=k|O}N |B}h=k|O}N |B}h=k|O}N |B}h=k|O}N |B}h=k|Ox}N |B}h=k|O\}N |B}h=k|O@}N |B}h=k|O$}N |B}h=k|O}N |B}h=k|N}N |B}h=k|N}N |B}h=k|N}N |B}h=k|N}N |B}h=k|N|}N |B}h=k|N`}N |B}h=k|ND}N |B}h=k|N(}N |B}h=k|N }N |B}h=k|M}N |B}h=k|M}N |B}h=k|M}N |B}h=k|M}N |B}h=k|M}N |B}h=k|Md}N |B}h=k|MH}N |B}h=k|M,}N |B}h=k|M}N |B}h=k|L}N |B}h=k|L}N |B}h=k|L}N |B}h=k|L}N |B}h=k|L}N |B}h=k|Lh}N |B}h=k|LL}N |B}h=k|L0}N |B}h=k|L}N |B}h=k|K}N |B}h=k|K}N |B}h=k|K}N |B}h=k|K}N |B}h=k|K}N |B}h=k|Kl}N |B}h=k|KP}N |B}h=k|K4}N |B}h=k|K}N |B}h=k|J}N |B}h=k|J}N __dyld_mod_term_funcs__dyld_make_delayed_module_initializer_calls__dyld_image_count__dyld_get_image_name__dyld_get_image_header__dyld_NSLookupSymbolInImage__dyld_NSAddressOfSymbollibobjc__objcInitThe kernel support for the dynamic linker is not present to run this program. 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_set.WRAPPER_BITS=%sset.WRAPPER_ARCH=%sset.WRAPPER_OS=%sset.WRAPPER_FILE_SEPARATOR=/set.WRAPPER_PATH_SEPARATOR=:server socket close failed. (%d)socket close failed. (%d)LOG(ERROR)LOG(FATAL)STARTSTOPRESTARTPINGSTOP_PENDINGSTART_PENDINGSTARTEDSTOPPEDKEYBADKEYLOW_LOG_LEVELPING_TIMEOUTSERVICE_CONTROL_CODEPROPERTIESLOG(DEBUG)LOG(INFO)LOG(STATUS)LOG(WARN)UNKNOWN(%d)wrapperStopProcess(%d) called while stopping. (IGNORED)wrapperStopProcess(%d) called.Got a log message from JVM: %s%sJVM signalled that it was stopped.wrapper.logLPTMLPMWrapper (Version %s) http://wrapper.tanukisoftware.org wrapperRestartProcess() called. (IGNORED)wrapperRestartProcess() called.IGNORESHUTDOWNFORWARD%s must be in the range 0 to %d days (%d seconds). Changing to %d.Unable to set working directory to: %s (%s)Working directory set to: %sGot ping response from JVMJVM signalled a start pending with waitHint of %d millis.JVM signalled a stop pending with waitHint of %d millis.Usage: %s [configuration properties] [...] %s [configuration properties] [...] ( implicitly '-c') %s ( implicitly '%s.conf') %s ( implicitly '-c' and '%s.conf') where can be one of: -c --console run as a Console application -v --version print the wrapper's version information. -? --help print this help message is the wrapper.conf to use. Name must be absolute or relative to the location of %s [configuration properties] are configuration name-value pairs which override values in wrapper.conf. For example: wrapper.debug=true%s.confcwrapper.working.dirwrapper.daemonizewrapper.signal.mode.hupJVM requested a restart.wrapper.java.commandjava"%s"jdbjdb.exewrapper.java.additional.%d"-The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.wrapper.java.additional.%d.stripquotes-Xdebugwrapper.java.initmemory-Xms%dmwrapper.java.maxmemory-Xmx%dmLD_LIBRARY_PATHwrapper.java.library.path-Djava.library.path="%s%c%s\"-Djava.library.path="%s%c%s"-Djava.library.path=%s%c%s-Djava.library.path="%s\"-Djava.library.path="%s"-Djava.library.path=%s-Djava.library.path=wrapper.java.library.path.%d./-classpathwrapper.java.classpath.%dClasspath element, %s, does not match any files: %sClasspath element, %s, does not exist: %sUnable to get information of classpath element: %s (%s)-Dwrapper.key="%s"-Dwrapper.key=%s-Dwrapper.port=%d-Dwrapper.jvm.port=%d-Dwrapper.jvm.port.min=%d-Dwrapper.jvm.port.max=%d-Dwrapper.debug="TRUE"-Dwrapper.debug=TRUE-Dwrapper.pid=%d-Dwrapper.use_system_time="TRUE"-Dwrapper.use_system_time=TRUE-Dwrapper.timer_fast_threshold="%d"-Dwrapper.timer_fast_threshold=%d-Dwrapper.timer_slow_threshold="%d"-Dwrapper.timer_slow_threshold=%d-Dwrapper.version="%s"-Dwrapper.version=%s-Dwrapper.native_library="%s"-Dwrapper.native_library=%s-Dwrapper.ignore_signals="TRUE"-Dwrapper.ignore_signals=TRUE-Dwrapper.service="TRUE"-Dwrapper.service=TRUE-Dwrapper.disable_shutdown_hook="TRUE"-Dwrapper.disable_shutdown_hook=TRUE-Dwrapper.cpu.timeout="%d"-Dwrapper.cpu.timeout=%d-Dwrapper.jvmid=%dwrapper.java.mainclassMainwrapper.app.parameter.%dwrapper.app.parameter.%d.stripquotes------------------------------------------------------------------------The JVM is being launched with a debugger enabled and could possibly besuspended. To avoid unwanted shutdowns, timeouts will be disabled,removing the ability to detect and restart frozen JVMs.Filter trigger matched. Restarting JVM.Filter trigger matched. Shutting down.JVM requested a shutdown. (%d)wrapper.logfilewrapper.logfile.rollmodeSIZEwrapper.logfile.rollmode invalid. Disabling log file rolling.YYYYMMDDwrapper.logfile must contain "%s" for a roll mode of DATE. Disabling log file rolling.wrapper.logfile.formatwrapper.logfile.loglevelINFOwrapper.logfile.maxsize0wrapper.logfile.maxfileswrapper.logfile.inactivity.timeoutwrapper.console.formatPMwrapper.console.loglevelwrapper.console.flushwrapper.syslog.loglevelNONEwrapper.syslog.facilityUSERwrapper.ntservice.namewrapperwrapper.unix.namewrapper.portwrapper.port.minwrapper.port.min must be in the range 1-65535. Changing to %d.wrapper.port.maxwrapper.port.max must be greater than or equal to wrapper.port.min. Changing to %d.wrapper.jvm.portwrapper.jvm.port must not equal wrapper.port. Changing to the default.wrapper.jvm.port.minwrapper.jvm.port.min must be in the range 1-65535. Changing to %d.wrapper.jvm.port.maxwrapper.jvm.port.max must be greater than or equal to wrapper.jvm.port.min. Changing to %d.wrapper.debugwrapper.java.command.loglevelDEBUGwrapper.adviserwrapper.use_system_timewrapper.timer_fast_thresholdwrapper.timer_slow_thresholdwrapper.native_librarywrapper.java.library.path.append_system_pathwrapper.state_outputwrapper.timer_outputwrapper.loop_outputwrapper.sleep_outputwrapper.memory_outputwrapper.memory_output.intervalwrapper.cpu_outputwrapper.cpu_output.intervalwrapper.disable_shutdown_hookwrapper.startup.delaywrapper.startup.delay.consolewrapper.startup.delay.servicewrapper.restart.delaywrapper.restart.reload_configurationwrapper.disable_restartswrapper.cpu.timeoutwrapper.startup.timeoutwrapper.ping.timeoutwrapper.ping.intervalwrapper.shutdown.timeoutwrapper.jvm_exit.timeoutwrapper.ping.interval must be at least 1 second. Changing to 1.wrapper.ping.interval must be at less than or equal to 1 hour (3600 seconds). Changing to 3600.wrapper.ping.timeout must be at least 5 seconds longer than wrapper.ping.interval. Changing to %d.CPU timeout detection may not operate correctly during startup because wrapper.cpu.timeout is not smaller than wrapper.startup.timeout.CPU timeout detection may not operate correctly because wrapper.cpu.timeout is not smaller than wrapper.ping.timeout.CPU timeout detection may not operate correctly during shutdown because wrapper.cpu.timeout is not smaller than wrapper.shutdown.timeout.wrapper.max_failed_invocationswrapper.successful_invocation_timeThe value of wrapper.max_failed_invocations must not be smaller than 1. Changing to 1.wrapper.request_thread_dump_on_failed_jvm_exitwrapper.filter.trigger.%dwrapper.filter.action.%dwrapper.pidfilewrapper.java.pidfilewrapper.lockfilewrapper.java.idfilewrapper.statusfilewrapper.java.statusfilewrapper.commandfilewrapper.command.poll_intervalwrapper.anchorfilewrapper.anchor.poll_intervalwrapper.umaskwrapper.java.umaskwrapper.pidfile.umaskwrapper.lockfile.umaskwrapper.java.pidfile.umaskwrapper.java.idfile.umaskwrapper.statusfile.umaskwrapper.java.statusfile.umaskwrapper.anchorfile.umaskwrapper.logfile.umaskwrapper.ignore_signalsUnable to resolve the full path of the configuration file, %s: %sThe argument '%s' is not a valid property name-value pair.Unable to open configuration file. %sProblem loading wrapper configuration file: %sserver socket creation failed. (%s)server socket ioctlsocket failed. (%s)127.0.0.1unable to bind listener to any port in the range %d-%d. (%s)unable to bind listener port %d, or any port in the range %d-%d. (%s)port %d already in use, using port %d instead.server listening on port %d.server socket listen failed. (%d)socket creation failed. (%s)accepted a socket from %s on port %dsocket ioctlsocket failed. (%s)(Property Values)NULLsocket not open, so packet not sent %s : %ssend a packet %s : %ssocket send failed. (%d)JVM signalled that it was started.--> Wrapper Started as Daemon--> Wrapper Started as ConsoleUsing system timer.Using tick timer.<-- Wrapper Stopped--> Wrapper Started as ServiceJVM process exited with a code of %d, leaving the wrapper exit code set to %d.JVM process exited with a code of %d, setting the wrapper exit code to %d.JVM process exited with a code of %d, however the wrapper exit code was already %d.JVM already down.Unable to start a JVMJVM exited while loading the application.JVM exited before starting the application.JVM exited while starting the application.JVM exited unexpectedly.JVM exited unexpectedly while stopping the application.JVM exited normally.JVM exited on its own while waiting to kill the application.Unexpected jState=%d in wrapperJVMProcessExited.Got key from JVM: %s%dReceived a connection request with an incorrect key. Waiting for another connection.Incorrect key. Connection rejected.socket read failed. (%s)socket read no code (closed?).read a packet %s : %sreceived unknown packet (%d:%s)windowsx86323.2.3UNKNOWNSTARTINGSTOPPINGKILLINGDOWNLAUNCH(DELAY)LAUNCHINGLAUNCHEDw%s Unable to write to the status file: %sStartup failed: Timed out waiting for a signal from the JVM.org.tanukisoftware.wrapper.WrapperSimpleApporg.tanukisoftware.wrapper.WrapperStartStopAppAdvice:The Wrapper consists of a native component as well as a set of classeswhich run within the JVM that it launches. The Java component of theWrapper must be initialized promptly after the JVM is launched or theWrapper will timeout, as just happened. Most likely the main classspecified in the Wrapper configuration file is not correctly initializingthe Wrapper classes: %sWhile it is possible to do so manually, the Wrapper ships with helperclasses to make this initialization processes automatic.Please review the integration section of the Wrapper's documentationfor the various methods which can be employed to launch an applicationwithin the Wrapper: http://wrapper.tanukisoftware.org/doc/english/integrate.html Loop: check command filer+tUnable to read the command file: %sCommand '%s'. Restarting JVM.Command '%s'. Shutting down with exit code %d.PAUSECommand '%s' not supported on this platform, ignoring.RESUMEDUMPCommand '%s'. Requesting a Thread Dump.CONSOLE_LOGLEVELLOGFILE_LOGLEVELSYSLOG_LOGLEVELCommand '%s' is missing its log level.Command '%s' specified an unknown log level: '%'Command '%s'. Set console log level to '%s'.Command '%s'. Set log file log level to '%s'.Command '%s'. Set syslog log level to '%s'.Command '%s' lead to an unexpected state.LOOP_OUTPUTSTATE_OUTPUTMEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTTRUECommand '%s'. Enable %s.Command '%s'. Disable %s.Command '%s' is unknown, ignoring.Unable to delete the command file, %s: %s Last system time tick overflow at: %s Next system time tick overflow at: %s Last tick overflow at: %s Next tick overflow at: %s Set Java State %s Timeout %08lx -> %08lx Set Wrapper State %s -> %s Loop: check anchor fileAnchor file deleted. Shutting down. Set Java State %s -> %sStart Application.startUnable to send the start command to the JVM.Reloading Wrapper configuration...com.silveregg.wrapper.WrapperSimpleAppThe com.silveregg.wrapper.WrapperSimpleApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperSimpleApp class instead.com.silveregg.wrapper.WrapperStartStopAppThe com.silveregg.wrapper.WrapperStartStopApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperStartStopApp class instead.Launching a JVM...JVM Restarts disabled. Shutting down.Waiting %d seconds before launching another JVM.JVM was only running for %d seconds leading to a failed restart count of %d.There were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.Waiting %d seconds before launching the first JVM.wrapper.on_exit.%dwrapper.on_exit.defaultshutdownrestarton_exit trigger matched. Restarting the JVM. (Exit code: %d)on_exit trigger matched. Service is paused, will restart the JVM when resumed. (Exit code: %d)The JVM was launched with debug options so this may be because the JVMis currently suspended by a debugger. Any future timeouts during thisJVM invocation will be silently ignored. DebugJVM timeout. Disable current %s timeout.Shutdown: Timed out waiting for the JVM to terminate.JVM exitShutdown failed: Timed out waiting for the JVM to terminate.Shutdown: Timed out waiting for a signal from the JVM.Shutdown failed: Timed out waiting for signal from JVM.Ping: Timed out waiting for signal from JVM.pingJVM appears hung: Timed out waiting for signal from JVM. Temp: Sending a ping packet.JVM Ping Failed. Temp: Sent a ping packet.Startup: Timed out waiting for a signal from the JVM.startupStartup failed: Timed out waiting for signal from JVM.Event loop started.no Loop: %ssleep Loop: maintain logger Loop: process jvm outputPause reading child output to share cycles. Loop: process socketPause reading socket data to share cycles. Loop: maintain logger(2)Wrapper Process has not received any CPU time for %d seconds. Extending timeouts.truefalse Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%s Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (N/A), Exit=%s, Restart=%s Loop: exit requestedSending stop signal to JVM Loop: handle wrapper state: %sUnknown wState=%d Loop: handle jvm state: %sUnknown jState=%dEvent loop stopped.%d Dumping JVM state.Could not dump JVM state: %sSIGHUPSIGALRMSIGINTSIGKILLSIGQUITSIGCHLDSIGTERMAIO completedunknownkill, sigsend or raisesigqueuetimer expiredmesq state changedUnable to register signal handler for signal %d. %sLaunching Timer thread.Unable to create a timer thread: %d, %s Sleep: nanosleep %dms Sleep: awakeCommand[%d] : %sCall to getrusage failed for Wrapper process: %sCall to getrusage failed for Java process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldUnable to get the path for '%s'-%sUnable to extract path from: %sUnable to set working dir to %s : %sUnable to request JVM process status: %sJVM exited in response to signal %s (%d).WIFEXITED indicates that the JVM exited abnormally.Signal trapped. No details available.Signal trapped. Details: signal number=%d (%s), source="%s" signal err=%d, "%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s)Timer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.Received SIGCHLD, checking JVM process status.JVM process was still running after receiving a SIGCHLD signal.%s trapped, but signals for timer thread are ignored.%s trapped, but ignored.%s trapped. Restarting JVM.%s trapped. Forcing immediate shutdown.%s trapped. Shutting down.%s trapped. Forwarding to JVM process.Unable to forward %s signal to JVM process. %s%s trapped. Unable to forward signal to JVM because it is not running.HUPTERMINTTimer thread received an Quit signal. Ignoring.Could not mask signals for timer thread.Timer thread started.The timer fell behind the system clock by %ldms.The system clock fell behind the timer by %ldms. Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ldJVM did not exit on request. Attempt to terminate process failed: %sJVM did not exit on request, terminatedSpawning intermediate process...Could not spawn daemon process: %ssetsid() failed: %s/dev/nullSpawning daemon process...Failed to read console output from the JVM: %s (%d)Could not init pipe: %sCould not spawn JVM process: %sUnable to set JVM's stdout: %sUnable to set JVM's stderr: %sUnable to start JVM: %s (%d)Failed to set jvm output handle to non blocking mode: %s (%d)Failed to set jvm output handle to close on JVM exit: %s (%d)Unable to write the Java PID file: %sUnable to write the Java ID file: %s?-helpv-version-consoleERROR: Could not write anchor file %s: %sERROR: Could not write pid file %s: %sWARNING: Could not write lock file %s: %s Unrecognized option: -%s %s=%sUnable to set environment variable: %s name:%s value:%sset.default.set.The following property name value pair is too large. Need to increase the internal buffer size: %srt#includeNONE DEBUG INFO STATUSWARN ERROR FATAL ADVICEWARNING - Encountered an unknown thread %ld in getThreadId(). WRAPPERJVMSIZE_OR_WRAPPERSIZE_OR_JVMDATEFATALERRORWARNLOCAL0LOCAL1LOCAL2LOCAL3LOCAL4LOCAL5LOCAL6LOCAL7wrapper wrapperpjvm %-4dsignal main srvmaintimer %c%04d/%02d/%02d %02d:%02d:%02d%04d/%02d/%02d %02d:%02d:%02d.%03dUnable to delete old log file: %s (%s) -YYYYMMDD_YYYYMMDD.YYYYMMDDROLLNUM-ROLLNUM_ROLLNUM.ROLLNUM.%sUnable to rename log file %s to %s. File is in use by another application. Unable to rename log file %s to %s. (%s) Unable to get the current logfile size with ftell: %s Unable to get the current logfile size with stat: %s ????????%04d%02d%02daUnable to open logfile %s: %s printfsprintffprintfsyslogvsnprintf$LDBL128libSystem.C0C0@@08 -29P]L]T]X]\:2|(|0|8|@|H|P|X|`txTX`tp\`0++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++d%hĀd%d%d%<.%D%D%D%D%D%D%D%D&D&D& D&$D&8D&@D&DD&HD&XD&dD&hD&xD&D&D&D&D&D &D&D'D' D'@D'@D'`D'`D'D'D'D'D'D'D'D'D(D(D( M$%[@g@s@@ ڀ@8 % ( ,$xN( -( .( D+( D.(8D0(HD1(TD.(hD.(C$+( _,8g( h(i$hN(j(.(D?(DC(DD(DC(DH(x$?(@>@@@A(($8N((.(DM(DQ(DR(DP(DM(DQ(DR)$M(@L@L@N"(#)$$\N)%).)DY)Dc)4De)DDg)TDi)dDk)tDp)Dq)Dr)Ds)Dt)Dw)Dx)Dz)D{)D|)D*D*D*4D*@D*HDx*XD*dD|*xD|*D{*D{*Dc*Dc*5$Y)K@ZU@Z\8]<ˀ^@_D `H())5FWhỳހ*$N*&yG -U .c /r 0d* 9  +03*E%V++@,( . ;C  5(L  )U $N*P^ (*g ,+5,T u- LC @  0 4% 8$lhK <t L% T9lx3# Hav   ('X^ @x D H L P T  X1 \=MM9p kX  ` t  1 h;;4 A$ T @ H p}   ( 0L(|9HXXg40|Pwd xa d+ 2F =QZ arQ` % 'Pg }  r$ ' p8x{  F t}$x0#/  0 ` x `Iʴ  T73\MH6KQ        (T : Kx __ v <  8  x xy \ @  $\\kը{P84ڔaL  p@f:y<8 x$$ .< X \\F9 D t  x(6ΨΤ D89 U/l6  Π 8Cd< 8 5d h& :޼vP]'4L #T<AS=i01Qd .iȨ7\E$  C,<5C XHO>0mX?$3T``48D< p@4 `74 ho%hI\{2?; TZF`fm RY*72G N? g&.8C o }   K _   dou R f |       , 3 9 E M U ] e n v |N[`K(*8:?[]4a{=TUop~'fpw}8 $ " % 8 ; R [ g i l {  A U b 1%&  ($+-",'/#0 *!2  ). FCEPM2Q/N~?=@1%&  ($+-",'/#0 *!2  ). _NXArgc_NXArgv___progname__dyld_func_lookup__dyld_init_check__start_environdyld_stub_binding_helperstart___darwin_gcc3_preregister_frame_info___keymgr_dwarf2_register_sections__cthread_init_routine__mh_execute_header_atexit_catch_exception_raise_catch_exception_raise_state_catch_exception_raise_state_identity_clock_alarm_reply_do_mach_notify_dead_name_do_mach_notify_no_senders_do_mach_notify_port_deleted_do_mach_notify_send_once_do_seqnos_mach_notify_dead_name_do_seqnos_mach_notify_no_senders_do_seqnos_mach_notify_port_deleted_do_seqnos_mach_notify_send_once_errno_exit_mach_init_routine_main_receive_samples___keymgr_global__dyld_register_func_for_add_image__dyld_register_func_for_remove_image__init_keymgr__keymgr_get_and_lock_processwide_ptr__keymgr_set_and_unlock_processwide_ptr_abort_calloc_free_correctWindowsPath_getOutputFilterActionForName_getSignalMode_keyChars_loadConfiguration_lockProtocolMutex_protocolMutex_protocolOpen_protocolSendBuffer_protocolSendBufferSize_protocolStartServer_protocolStopServer_releaseProtocolMutex_sd_sendProperties_ssd_updateStringValue_validateTimeout_wrapperAddDefaultProperties_wrapperAddToTicks_wrapperBuildJavaCommandArray_wrapperBuildJavaCommandArrayInner_wrapperBuildKey_wrapperBuildUnixDaemonInfo_wrapperDispose_wrapperFreeJavaCommandArray_wrapperGetCurrentTime_wrapperGetFileBase_wrapperGetSystemTicks_wrapperGetTickAge_wrapperInitialize_wrapperJVMProcessExited_wrapperKeyRegistered_wrapperLoadConfigurationProperties_wrapperLogChildOutput_wrapperLogSignalled_wrapperParseArguments_wrapperPingResponded_wrapperProtocolClose_wrapperProtocolFunction_wrapperProtocolGetCodeName_wrapperProtocolRead_wrapperRestartProcess_wrapperRestartRequested_wrapperRunConsole_wrapperRunService_wrapperSetWorkingDir_wrapperSetWorkingDirProp_wrapperStartPendingSignalled_wrapperStartedSignalled_wrapperStopPendingSignalled_wrapperStopProcess_wrapperStopRequested_wrapperStoppedSignalled_wrapperStripQuotes_wrapperTickExpired_wrapperUsage_wrapperVersionBanner___error_accept_addPropertyPair_atoi_bind_ceil_chdir_close_closeLogfile_createProperties_disposeLogging_disposeProperties_fcntl_getBooleanProperty_getIntProperty_getLastError_getLastErrorText_getLogLevelForName_getLogfileRollModeForName_getLowLogLevel_getStringProperty_getSyslogLevelInt_getenv_gettimeofday_glob_globfree_inet_addr_inet_ntoa_initLogging_isQuotableProperty_linearizeProperties_listen_loadProperties_log_printf_log_printf_queue_malloc_memcpy_memset_packetBuffer_printf$LDBLStub_properties_pthread_mutex_lock_pthread_mutex_unlock_putchar_puts_rand_realpath_recv_registerSyslogMessageFile_send_setConsoleFlush_setConsoleLogFormat_setConsoleLogLevel_setConsoleLogLevelInt_setLogfileAutoClose_setLogfileFormat_setLogfileLevel_setLogfileLevelInt_setLogfileMaxFileSize_setLogfileMaxLogFiles_setLogfilePath_setLogfileRollMode_setLogfileUmask_setSyslogEventSourceName_setSyslogFacility_setSyslogLevel_setSyslogLevelInt_socket_sprintf$LDBLStub_srand_stat_strcasecmp_strchr_strcmp_strcpy_strlen_strrchr_strstr_time_unlink_wrapperArch_wrapperBits_wrapperClasspathSeparator_wrapperData_wrapperEventLoop_wrapperGetLastError_wrapperGetPID_wrapperGetTicks_wrapperInitializeRun_wrapperOS_wrapperReportStatus_wrapperSetJavaState_wrapperSetWrapperState_wrapperUpdateJavaStateTimeout_wrapperVersion_anchorPoll_commandPoll_displayLaunchingTimeoutMessage_handleDebugJVMTimeout_jStateDown_jStateKilling_jStateLaunch_jStateLaunched_jStateLaunching_jStateStarted_jStateStarting_jStateStopped_jStateStopping_lastLogfileActivity_logTimerStats_wStateStarted_wStateStarting_wStateStopped_wStateStopping_wrapperGetJState_wrapperGetWState_writeStateFile_asctime_checkPropertyEqual_fclose_fgets_flushLogfile_fopen_fprintf$LDBLStub_getLogfileActivity_getLogfileRollMode_localtime_maintainLogger_remove_rollLogs_umask_wrapperBuildJavaCommand_wrapperDumpCPUUsage_wrapperDumpMemory_wrapperExecute_wrapperGetProcessStatus_wrapperKillProcess_wrapperKillProcessNow_wrapperReadChildOutput_wrapperRequestDumpJVMState_wrapperSleep_appExit_childOutputBuffer_childOutputBufferSize_daemonize_descSignal_ensureSpaceInChildOutputBuffer_getSignalCodeDesc_getSignalName_initializeTimer_jvmOut_pipeInitialized_registerSigAction_setWorkingDir_sigActionAlarm_sigActionChildDeath_sigActionCommon_sigActionHangup_sigActionInterrupt_sigActionQuit_sigActionTermination_timerRunner_timerTicks_writePidFile_dup2_execvp_fork_getpid_getpwuid_getrusage_getsid_kill_logRegisterThread_nanosleep_open_pipe_pipedes_pthread_create_pthread_equal_pthread_self_pthread_sigmask_read_setsid_sigaction_signal_strerror_timerThreadId_waitpid_addProperty_createInnerProperty_disposeInnerProperty_dumpProperties_evaluateEnvironmentVariables_getInnerProperty_insertInnerProperty_loadPropertiesInner_removeProperty_setEnv_setInnerProperty_trim_putenv_strdup_strtol_autoCloseLogfile_buildPrintBuffer_checkAndRollLogs_consoleFlush_currentConsoleLevel_currentLogfacilityLevel_currentLogfileLevel_currentLoginfoLevel_forceFlush_generateLogFileName_getConsoleLogLevelInt_getLogFacilityForName_getLogfileLevelInt_getThreadId_limitLogFileCount_limitLogFileCountHandleFile_lockLoggingMutex_logFileMaxLogFiles_logFileMaxSize_logFileRollMode_logFileUmask_logLevelNames_log_printfMutex_log_printf_message_log_printf_queueInner_logfileFP_queueReadIndex_queueWrapped_queueWriteIndex_releaseLoggingMutex_replaceStringLongWithShort_sendEventlogMessage_sendLoginfoMessage_setLogfileMaxFileSizeInt_setSyslogFacilityInt_threadMessageBuffer_threadMessageBufferSize_threadPrintBuffer_threadPrintBufferSize_unregisterSyslogMessageFile___sF_closelog_consoleFormat_currentLogFileName_fflush_ftell_logFileLastNowDate_logFilePath_logfileActivityCount_logfileFormat_loginfoSourceName_memcmp_openlog_queueLevels_queueMessages_queueSourceIds_queueThreadIds_rename_syslog$LDBLStub_threadIds_vsnprintf$LDBLStub_workLogFileName___stub_getrealaddr_NSAddressOfSymbol_NSIsSymbolNameDefinedWithHint_NSLookupAndBindSymbolWithHintstart.sint:t1=r1;-2147483648;2147483647;char:t2=r2;0;127;/SourceCache/Csu/Csu-58//SourceCache/Csu/Csu-58/crt.cgcc2_compiled._pointer_to__darwin_gcc3_preregister_frame_info_start:F(0,1)argc:P(0,2)argv:P(0,3)envp:P(0,3)p:r(0,4)char:t(0,5)=r(0,5);0;127;:t(0,1)=(0,1)int:t(0,2)=r(0,2);-2147483648;2147483647;:t(0,3)=*(0,4):t(0,4)=*(0,5)q:r(0,3)term:(0,6):t(0,6)=*(0,7):t(0,7)=f(0,1)__call_mod_init_funcs_call_mod_init_funcs:f(0,1)p:(0,6)_crt_basenamecrt_basename:f(0,8)path:P(0,8)s:r(0,8):t(0,8)=*(0,9):t(0,9)=k(0,5)last:r(0,8)_crt_strbeginswithcrt_strbeginswith:f(0,2)s1:P(0,8)s2:P(0,8)i:r(0,2)int:t(0,2)__call_objcInit_call_objcInit:f(0,1)i:r(0,10)unsigned int:t(0,10)=r(0,10);0;037777777777;count:r(0,10)_dyld_image_count_fn:(0,11)_dyld_get_image_name_fn:(0,12)_dyld_get_image_header_fn:(0,13)NSLookupSymbolInImage_fn:(0,14)NSAddressOfSymbol_fn:(0,15)void:t(0,1):t(0,11)=*(0,16):t(0,12)=*(0,17):t(0,13)=*(0,18):t(0,14)=*(0,19):t(0,15)=*(0,20):t(0,16)=f(0,10):t(0,17)=f(0,8):t(0,18)=f(0,21):t(0,19)=f(0,21):t(0,20)=f(0,22):t(0,21)=*(0,23):t(0,22)=*(0,1):t(0,23)=k(0,1)pointer_to__darwin_gcc3_preregister_frame_info:S(0,6)NXArgc:G(0,2)NXArgv:G(0,3)environ:G(0,3)__progname:G(0,4)dyld_lazy_symbol_binding_entry_pointerror_messagedyld_func_lookup_pointer_darwin_unwind_dyld_add_image_hook_darwin_unwind_dyld_remove_image_hook_unknownBuffer.4795_seeded.5428_jvmPid_funcptr_funcptr_funcptr_funcptr_funcptr p8__PAGEZEROX__TEXTpp__text__TEXTd"od__picsymbol_stub__TEXT:*__symbol_stub__TEXT:*__cstring__TEXT:D*__picsymbolstub2__TEXTKo__textcoal_nt__TEXTo __literal4__TEXTo__literal8__TEXTo__DATA p__data__DATAXp__nl_symbol_ptr__DATAX Xq__la_sym_ptr2__DATAd dq__dyld__DATAppq__bss__DATA__common__DATA__IMPORT__jump_table__IMPORT __pointers__IMPORT`Y8__LINKEDIT@0 /usr/lib/dyld 4aeCX/usr/lib/libSystem.B.dylib| PMMSVDqVPd"j]\$ML$ˉ\$UWVS,O]Ed]E h]El]^tЋ^t\ED$<$Et$\^E 8ud'/D‰vut p]p]E8t E8uD$ ED$E D$E$e$"\twUS$R\ED$W$U$[]Ðh%p%tUWVS\\}D$D$u4$|D$ D$t$}$}D$D$4$@|D$ D$t$$}D$D$4$|D$ D$t$$wD$ D$D$$SD$ D$D$$/\[^_]UV$uD$E$~{EMMb)fV$^]UVSZ:[t-$*{t6b|ǃ:[@4[^]Ëb|@4[^]Ëb|tD$ D$D$$iUS ZZt$ztǃZ[]Ë{tQD$ 5D$D$$UVSYUBwiuuu (3>T$D$Q[4$y[^]Í鍃 ፃٍэ)ɍ9A빍I뱍M멍U롍e뙍u둍뉍끍vk`UJUS[XX$x1[]US9XX$x1[]UWVS,X} y8uLtǀ,[^_]ËMtكNtԃOtσGtǂ뾉|$vD$ D$D$E$뇋t|$:D$ D$D$E$mUWVS/Wu xt"t$ D$D$$3t$ D$ED$$[^_]UVSVkxu5~U謯VT$ D$D$N$>[^]ÍcD$D$$WD$ D$D$N$[^]UWVSVw$BvwD$D$$'v@@pD$3$虇D$ D$D$G$Q>虮@Pǀǀǀǀ>S ǀ]t [^_]Í$$o$$$H$M$l$$1[^_]UUWV u1э|1D$/4$utMED$.$tƅD+uF$~tljt$ED$<$xt7 ^_]ÉuUSTuD$$t[]UVSSuu t6t%D$ D$D$E$ [^]ËMtNtOtGtHtuǀǀ븍D$ D$D$E$ UWVu1эAE1U ^_]11M<"t M 9;U},<\u;U}D<\t&<"t1M 9\;U|ԉU ^_]ËM 9\뭋E 8"U]UWV EEE E}t D$$Ta@}t)$ `}-cla@sspaf@th@ @M%U$`U aDžtDžDžDž\ (|$D$ $`D$ L$g$7;1ljуXuH(늉ƅNt$D$$ `g@TXD$*$ `[ u,t$ D$D$(<$_E9tpDžd~1gp:ptE̋<D$ pp4$$_dd9}tpd D$ $N_0\\$|Nt$$N4$QN;\wttf./@qf"Džt1у $N‹@}M 1эAv |\Bt$ D$$M@M$M-Dja@va.l@ibra@ ry.p@ath=@U DžlDžDžDž $n~+gllϋt$ll$Ml$|$D$ $LD$ L$g$膵1уtlw890$Kt$$D$7D$_D$<G8P8~ ;P(KD7D$yD$_D$F<7F<=D$|D$_D$ŨF@7N@A= F<9 KD7D$gD$_D$C $$KD7wD$D$_D$n$躴FL7D$D$_D$躰7t dž7FD$D$_D$覧F 7D$D$_D$zF$7D$D$_D$蚦7D$D$_D$7D$OD$_D$7D$gD$_D$藯7D$D$_D$m7D$D$_D$C7D$D$_D$7D$D$_D$&7D$D$_D$Ů7D$D$_D$ҥ7D$D$_D$qD$3D$_D$耥7D$KD$_D$Z76D$kD$_D$ 7D$D$_D$7D$D$_D$y7D$D$_D$O7D$ D$_D$VFt7D$D$_D$)Fx7D$D$_D$F|7D$+D$_D$գ7D$CD$_D$襣7D$_D$_D$u7Ft+=^FtKD|0Fx=^Fx|7F|`=^F||7=^|7B=^"|s=t |P| 9 |Pt~F@x~9^|B|~ ;Btw|;Bt|2D$D$_D$|0D$,3D$$С|2D$D$$a|~x14 $7KD ;|Ƌ $T7KDǀ $$27ǀ$KD|‹ǀ_D֋|||D$D$$7D$D$$躟u|7 $t6 7$[6$KD|׋PD$'D$_D$)KD00t$5dž0t21щ $50T$$5KD@SD$SD$_D$莞KD74t$>5dž4t21щ $54T$$\5KD@-D${D$_D$KD7<t$4dž<t21щ $4<T$$4D$D$_D$kKD0@t$4dž@t21щ $3@T$$94KD?D$t$_D$臝D$t$_D$b=DKD|@?D$t$_D$D$t$$=PKD7D$D$_D$螜X7XD$ D$_D$r\7XD$D$_D$F`7XD$7D$_D$d7XD$OD$_D$h7XD$kD$_D$›l7XD$D$_D$薛p7XD$D$_D$jt7XD$D$_D$>xXD$D$_D$$耪7D$D$_D$诣|7FKD@1Ĭ[^_]٬]ǀLL‰F@@@D$ D$D$${L‰F0KD@0D$ D$D$$2D$t$_D$D$t$$љD$t$_D$谙\D$t$$葙DKD|@?D$D$_D$蘘7Lt$N/džL[ 1щ $+/LT$$h/|D$[D$_D$股7D$oD$_D$ݗDžD$<$.r dKD@1Ĭ[^_]ËKD|NjP/D$D$_D$X7(t$.dž(1щ $-(T$$(.1;D$gD$_D$Ɩ78t$|-dž81щ $Y-8|$$-HD$?D$_D$;7,t$,dž,Y1щ $,,|$$ -"wY׋V,L‰F0@0D$ D$D$$XF,}@,D$ D$D$$%KD0NgD$D$$fD$D$_D$wF7V<L‰F@@@D$ D$D$$F<y@D$<$%T$ ?WD$D$$3|ǀ2ED$<$ %ues D$<$$fRUWVS<T&,$7"T&D@&x~S11T&MUUD$ D$@8D$$<'M;p|@HD$T&$論tN@&pt <[^_]Ë@HD$ D$D$$<[^_]Ë@&@ t@HD$ D$D$$蔻뀋@&7$#FHBHD$B$F#D$@D$ D$D$$/@&@D$ HUWVSLD$D$$!#DD$D$$6#l$p(IE؉EԍTEEEEEE$"E܉ffED$EԉD$D$Z"\X0tl$p,1E끃l$;p0~@(覢D$B0D$B,D$B(D$ D$D$$譹YƋl$8 6u$MtNtOtGt ǂǀ@t$v![ǃ@D$L!l$ǃD@4ǀǀL[^_]xD$ D$D$$薸L[^_]Ël$@(~*9t&t$D$ D$D$$Up4)D$D$1 uUVD$ 8D$D$$@tJ$8 u3t' VD$ ԾD$D$$賷ǃ@D$l$ǃD@4L[^_]Ël$el$lp,1t$ D$ D$D$$f@4D$ D$D$$訟D$ ,D$D$$ƶ@$l$l$6t$D$ D$D$$萷D$B0D$B,D$ `D$D$$ Zl$!TD$ D$D$$ʵl$SD$ ԾD$D$$舵cl$SD$ D$D$$FUWVSL}t ytL[^_]EEԍUT$D$ $oyu`D$D$y$:t~}t$ǃ}@4L[^_]ufE؉$t$D$ D$D$$=_y$^ǃy)R#萜D$ D$D$$讳QD$ D$D$$r(D$ D$D$$F)aQD$ D$D$$ UWVS<E EߍU؉$}sUUM1}M]E;v#t$U$=iuyU߈EHED$$D$ UT$D$=$U؉$`<[^_]ËEUߍBwj1)vk`UJ?4T$շD$]4$UT$D$ D$ D$D$E$dU߈E@E9E UwlaɷVK@5*qa YUME5% iu EUߍBIALWbmx +6 iu4=Q$vǃ=  ,(D$@$,u$d]4봍D$D$$蔒8D$@$rC,},D$D$P<$D$ <$tD$ <$tD$ <$ƅt > tϗD$<$|$ ǽD$D$$译$膅,D$D$P<$?G,$#@$zD$@D$ D$D$$!ǗD$<$ uIt 4$Ɖt$|$ D$D$$Ґt$$daD$<$tWD$<$u'|$ D$D$$o_D$<$Zti$D$<$>e34$n0t$|$ D$D$$|$ gD$D$$ɏ${.\@D$ D$D$$莏1s4$D$<$n0$rt$|$ #D$D$$01s94#1sD$OD$<$C|$D$p$sD$<$D$<$gۿ D$<$3D$4$c D$<$DX#|$|$ ;D$D$$|$ ǾD$D$$׍vD$<$u90$Aot$|$ SD$D$$舍SD$<$su90$qt$|$ D$D$$9|$ D$D$$|$|$ WD$D$$D$<$#1ZD$<$D$<$D$<$jD$<$P#D$<$6|$ sD$D$$ D$<$u#D$<$u#D$<$u#^#D$<$zD#1U]U]UVS uE u:u[^]Ét$$`x[^]V@t$$1=uUWVSE$芉ƸE)ЉEEE$WUPUPUP UPUPUPUPUP UP$U@(EEE$D$E‰|$|1D)|D$ D$D$$ָUUE$UPUPUP UPUPUPUPUP UP$U@(EE$<D$|$|1D)|D$ D$D$$IJ@{*ƸE)ЉEE$UPUPUP UPUPUPUPUP UP$U@(EE$hD$|$|1D)|D$ BD$D$$uָUUE$ UPUPUP UPUPUPUPUP UP$U@(EE$D$|$[|1D)|D$ bD$D$$軇Č[^_]UVS hE D$E$Ƌuǀ [^]ËGv_Qt$T$D$ MD$D$$뙋ǂǀ [^]Ë  +6AymbWLYA6e+ qUVS u tw43B43T$D$$D$ D$D$E$8t2p4t:&3L$D$$@ [^]Ã8tg9uٍ׍σ8tc9.)4#-8tK9 rg UVS}D$ *D$D$8$ *Gt[^]D$9$ [^]USD$ D$D$3$)Lt[]D$4$D$ D$D$4$`)[]UWVS|}<LtaTD$<$|tKED$L$pu(<0PD$<${T|[^_]Ëűu‹MtNtOtGtD$D$$D$$r8bD$8$kIȱD$D$$蟂ED$L$ /UWVS<2EEU UEE܋}tXEGRG[uЋU%|$E܉$XzNjǀ<tGvME U<[^_]'WxmbG|$T$D$ D$D$$+j_TI>3(ǀǀ<<[^_]ÍL$D$D$ D$D$U$蛁Z3C;Æ/ti#^gS[HK=Æ(/#g[KC;Æ/ #g[KC;mCK[Æ;g#/vUVSBuUD$D$d$Hxs@xD$ ED$D$K$[^]Í߬D$D$$}D$D$d$yD$D$$}$|/ǀ[^]D$ TUWVS,C}E E䋳B̓v-7t(D$ |$D$G$,[^_]Ët|$$eux؋~DF^t+,D$D$$|D$D$$MƍPD$4$ttxD$D$$h|ĬD$D$$J|D$8$ǀ,[^_]4rD$4$tN<D$D$${qD$8$hǀt0u SqحD$D$$s{;Eu0@x~RD$ |$D$I$|$$"=uE 8E,[^_]D$ |$D$I$kUWVSLEB̓76tEUL[^_]Ëu݋D$D$}͉<$ͬD$٬D$Y$rKT$ D$|$$KyED$ 9D$D$$yEǀыUL[^_]ËAǁEML$ $qE;%;D$ ED$D$H$EVHT$ iD$D$$xE!AD$D$$xD$8$=EUL[^_]ËD$D$}͉<$ͬD$٬D$Y$eIT$ D$|$$IlED$ ǀppt$ ED$D$H$@Et$ D$T$ D$D$$bwED$D$fǂUT$ $cot$D$ D$D$$vEUWVS蘾EHXtX@Xt'ED$ YD$D$$vǀǀ[^_]Ít$D$$NvE D$ 9|D$D$$)vD$D$$ vD$D$$u-D$D$$ut$D$$uUWVSguM uju[^_]Ét$$mxxTuND$D$$AuE[^_]&t$$ ={닍`D$lD$4$[^_]UWVS褼uM ujQu[^_]Ét$$lxxTuNYD$D$$~tE[^_];&t$$J={닍٦D$!D$4$Q[^_]UWVS}M ‹D$$jl|$$!lxRΨD$D$g$2[^_]É|$$k'@Tu^D$D$$3s$$ǀ[^_]É|$$=wΨD$֨D$<$[^_]ÍzD$D$$r(BD$D$$rΨD$D$g$ifD$D$$8r6UVSM uxu[^]ËUT$$9jx@Tu`ݧD$D$$q$#ǀ[^]ËED$$|=jwD$D$E$}[^]UVSM u_u[^]ËUT$$dix@Tu@$"ǀ[^]ËED$$=u뗍ȦD$ЦD$E$[^]UWVS\YcEMTHF  Et3EkBsD$ D$D$$oEo)EGu8v tEsnNjnQ;t 0D$<$wgD$<$GgCX|$E$f;BtCڧE̋ڧEЋD$<$fEԋG | q f [ P B4 3 BU؉T$ U܉T$t$L$D$|$ ND$D$$m<$<$tFzǀGtHMC4s3BD$ D$D$$l4t13D$ D$D$$ltIG4>  gыBh&=WqED$<$9t(}UT$<$#9u؋tVD$D$$vk\[^_]ËML$<$5놋ED$<$[lUT$<$~RMp*ED$<$bUT$<$ML$<$aT$ BD$D$$jT|$E$b;Bt|$E$bD$ D$D$$*joLEOD$D$$i*8{9D$<$bx 6D$<$aTD$<$a$t 6D$<$aҦD$D$$ iJD$D$$h$d fD$D$$hjڧM؋ڧM܋GoB / E : BD$ "D$D$$h89tD$D$$g_D$D$$gt:D$D$$egM̋MB4D3HBỦT$$UЉT$ UԉT$t$L$D$|$ D$D$$fAEFE!D$ D$D$3$ LD$4$ D$ D$D$4$ D$ D$D$8$ GvD$9$]|$$ =D$D$e$葲D$ |$D$M$6|$M $]2D$$]~8Z9t829#tttjrxJmtbVWtLbAD$ |$D$G$JGV<D$D$$ dǀJ JVVΨD$D$$c|$$j =Xrrg\btVtJrjjbtVtJD$ |$$ZUVS(t $,t $8t $<t $s4t $_Lt$KTE$USUWVSsE$IǍD$E$Klj$%t+E D$D$4$&4$1[^_]ø[^_]UVS uD$ D$D$4$XbD$$x [^]ID$#D$ D$D$4$ b [^]UvEw_gogggggggggggggwc]ÍÙ]Í]Í]Í˙]Íۙ]Í]Íә]UǧE-w4TLD<\]Íd]Í]ÍL]Í]Í|]UVS0buE EEE@D$ED$4$9t8&HD$t$CD$ D$D$$`0[^]U@u]]]UVS 迦lunD$ D$D$$ƅu 1 [^]lGD$t$ D$D$$^ [^]ÍؘD$D$$\^oUVS ME)ȉ)U􋳼uDD$E$(tD$D$$] [^]ÉL$ hD$D$$]UWVSLf@PtOt21$zRP@P0uՉ$O@PEED$ED$E$ }xLt E2E$FPEEEU"Ű@PUEEE9Eh9E}ًupPEUЋ<1щ $EUЋD$@PUЋ$EEE9E~D$E$QL[^_]1ED$|$ t$@LD$$[;}|ˋU]U]UVS胣ED$$t1bDD$ D$D$$[[^]ÍhD$$RlMb)‰T$(hD$$t)‰T$ pD$u)‰T$ED$u)‰T$ED$ D$D$$Z[^]jCD$ TD$D$$Z[^]U]UVS1Ң+E ;E~[^]Í$SƋ֢t9ҢD$T$4$@ҢD֢$ ǃ֢֢Ң[^]UWVS,蟡}t$<$tiD$/4$tj4$u ,[^_]NBD$t$ @D$D$$hY,[^_]BD$|$ Ét$ D$D$$!Y,[^_]UVS0ɠuD$ED$$twEƒu"D$E D$4$[0[^]Ã1v@~T$D$D$ D$D$4$Y뜰Ƀ0[^]ËeDOZeeeeeeeeeep{eeee8 @D$D$ D$D$4$ Y"2*B:D$ D$D$4$X{UWVS<}u<[^_]Í{D$ D$D$$6XG-wc.# w_O{peZD9|L$D$T$D$ D$D$$fWGuwG$DEwG $轾UT$t$D$G D$D$ D$D$$V<[^_]É${D$GD$D$ D$D$$VKSD$ D$D$$VpːeZODowGO_ygnWcדEUS^E $Gv‹ u[]Ë'D$$at,D$ D$D$$yU[]ÍUSܛE $]D$ D$D$$.U@u#D$$=t"[]qRD$$=uލD$ D$D$$T[]UWVS<#EE} u:T$$?tмur<[^_]Ëм|f geuo|$hD$ D$D$$ TE<[^_]F|$D$ D$D$$S<[^_]É|$LD$ D$D$$S<[^_]ËܛeED$ܛ$:D$|$D$ D$D$$)Sugu]MtRNtMOtHGtC|$D$ D$D$$RD$$A|$D$ D$D$$RмǀD$D$ܛ$&tk1мH̛t$ D$D$O$[м8E 8E<[^_]Kt8D$ D$D$$QD$ܛ$Vx9A|$БD$ D$D$$jQ8D$LD$ D$D$$6QN|$(VUVS胗u 4$l0D$ t$ЎD$E$[^]UVS9u 4$"D$ ft$D$E$[^]UVSu 4$D$ ft$RD$E$[^]US$躖E $ҷT$$׷t,D$ D$D$$O$[]ÍχD$ D$D$$OD$s$ay7D$D$ D$D$$zOUWVS,}D$D$$uu\1@u&t$ D$D$O<$A,[^_]qLt$ D$D$O<$,[^_]ÍD$ D$D$<$ND$$Sx `6D$D$ D$D$<$fN+UWVS\˔$7*E`D$ED$$x1E$EU܉U@EU̍ԌEȍUD$U$芵x KEЋtt})lj)֋Eԅudx;p$@ 9xt4t$|$EЉD$tD$ UĉT$D$$KEEExD$ dED$D$$sKED$D$$SKD$ ẺD$D$$&K؉D$ UȉT$D$$JD$D$$J\D$D$$JUVS dD$D$$薳tTD$ D$D$G$ǃ0t$襲7 [^]D$ $D$D$$I2D$ D$D$$IEEeupD$E$跲u/ǀ1D$D$$ZI뒍لD$D$$:ID$ D$D$$IeUVS Ð$#,3p15蒱^D$$謱D$D$$袱ƃt]$轰D$4$a$衰D$4$E$腰D$4$)$+pp$* [^]ÍD$D$$G軰S0D$ ܉D$D$$qG$40D$ D$D$$0G$j D$D$$G/D$ ܉D$D$$F$Zp$) [^]É4$oEEeuID$E$腯t8D$D$$7F$D$ D$D$$FUWVS\跍lE܉$2U܉MЉDž++=IDžD$D$l$肮sƄDž4\9? XB;$۬Ƌ\t9XD$T$4$ȬXD\$葬ǃ\\XB$&1EU++=DžXB9\\$;ezDžf8#t2\0,t$D$ 0D$D$$CXB;\\$d1\[^_]Í$LƋ\t9XD$T$4$9XD\$ǃ\\X1\[^_]Í$ժƋ\t9XD$T$4$ªXD\$苪ǃ\\X UWVS<EEE@D$u܉t$$ta*D$D${D$ D$D$$0Cǫpt_<[^_]ÍEEE@D$t$$Yt`F*D$D$gWD$ AD$D$$6ƅ<[^_]ÍTEEE@D$t$$Ʃ2EEE@D$t$$菩EEE@D$t$$XEEE@D$t$$!1e)D$t$ K|D$D$$@<[^_]Í3|D$D$$?(D$D$(D$D$|(D$D$f(D$D$UWVSFB$躔F$詔Fu ^_]锔MQ뾋UUWVS1уt+1Dž{7"#9w1уt11B< t<uB9u>{{D$D$B$讏{$莏1\[^_]Ë{i|7#T1{{=lD$4$ 9<#\D$=4$DD$D$ D$t$U${{9r>B9s{Dž{F~ tN} D$B{T$$ED${D$U$K{8 u8 t렰\[^_]UD$E D$E$UWVSmE} Mt^0t |$$ vu\$?Ɖ|$4$4$[^_]Ë0t|$$贌 tQvu䍃\$ƍ\D$4$蝌4$舌[^_]ËF\dFUWV01ы} уMMtы}уM9MrWuuEEEUt8U9ҋu} t FO)ȅu#EEUUuȋUE0^_]EUEUU떋UUUE߄tE9u} t FO)ȅu[UT$ED$U$胋EEUUEE߄hE9u} t FO)ȅtEߋUEUE[UjP9u󋁵P(9u1]U1]UVS~ju螋ƒw o[^]USVjy1G; tuL$Cg$1[]UVSjuf5D$4$93D$4$>gD$4$ttFgD$4$tbJgD$4$ىtPZgD$4$Éu [^]ÍfgD$4$褉[^]ð԰а̰ȰUVS7iu4D$4$_fD$4$EfD$4$+fD$4$txfD$4$tfeD$4$tT3D$4$ψu [^]Í7D$4$谈[^]ð԰а̰ȰİUVS?hu3D$4$gu [^]ÍeD$4$Eu [^]ÍeD$4$&u [^]ÍeD$4$u롍eD$4$u뇍eD$4$ӇujeD$4$趇uMeD$4$虇u0eD$4$|UWVS"g1}֋t($5$%$4$UT$$` 4$4$[^_]UfEg]Utfg]UdfEg]USQfEtD$R$Ԇ[]U&fEg]Uf|g]UWVS,fEE܅1щ $$E؅EE1}1у9}&}7MtpdKtrB< vD-t?9|ڋE؋U$υ.g~ E.g}؉},[^_]醅E؋}8}밀ktmuEE녃,[^_]U eE;f]UdE$f]Ud]USde$1[]USde$B1[]UdEe]USudEtD$N$[]UJdEe]U7de]U'dEPe]UdEye]Udfe]UcERe]UScEtD$Ӆ$a[]Uce e9OЋe9N]UWVSLc1} уM11E;UM DwD1}$эt1E;Ufd;ddEE1} у9M.U M D4N!!!!!!!!!!!!!!!!P E E EEEEU dD$,!D$4$ƃEE9Et  | E1} у9MdL[^_]Ã}}}unknFownE눋M$L$,!D$4$|ƃEd}}XED$@aD$4$DƃE,}σQD$LaMD$AD$AD$A D$AD$ AlD$PaD$4$؀ƃEED$ UD$BD$BD$B D$BD$ BlD$paD$4$耀ƃEh$4$ddwrapFperpFE*mainF EtimeFr EwrapFper FEsrvmFainE}signFal EU]UU$U1]U1]UWVS^E }w(33z/`D$D$ ǀ$|$sD$4$[^_]뷾밾멾US0^E$_[]US ^E$v_[]US]E$K_[]US]E$p$_[]UVS]x^4$}^t$j~ǃ^t4$ ~[^]UVSR]'^4$}W^t$~4$}[^]UE$~}UWVS\ ~1~;t uD$Y$}f1^u]^U~U~U ~~<^ ~ǃ^ǃ^[^_]Ë~^$|^UWVS,1\ED$E $C|~,[^_]ËEME1U T$$|t9utKu؋UUMu1} щ ${UM L$$$|,[^_]ËE $k|R6|$||D$U T$:Z$|$|MyMM9|PE|MGm;u/GtU9U|܉${uHG${G1} щ $zM؋UM L$$<{d{${D$GD$:Z$K{${UWVPE$zƋE~19Eu1}щ $ezUT$$zẺEĉD$ D$D$(E $\zE̅t*1UT$ t$E܋D$E$9}w؋Uĉ$azE~1t$y9}u4$yP^_]UWVSlYE D$E$yu#\T$M $y}w1}уMwwUGMPMEtNDždP\t FO)ȅPPEuUW`L$E$?yuZ1}уMwZEUỦ Mt7u`t FO)ȅu"EM MuɋUļ[^_]EÜEŰMUMPMPEPEȍWU MtHE P} t FO)ȅP P MuEUPUЍWM MtHE P} t FO)ȅP P MuEUPUԍWM MtHE P} t FO)ȅP P MuEUPUĉ MtKEP\t FO)ȅPP MuEW`L$E$vdMML$WD$1}ыEL $4vļ[^_]EUԈPUԋPEUĈPUċPEUȈPUȋPEUЈPUЋPUPU䍋WM MtHEP}t FO)ȅPP MuEUPU܍W| MtNDžxP|t FO)ȅGPP MuEUPU؍Wt MtNDžpPtt FO)ȅPP MuEUP MtJDžlP`t FO)ȅu(PP MuEļ[^_]EUPUPzEUPU䋍PEU܈PU܋PWEU؈PU؋PUUUEWEu\t FO)ȅED$UT$M $rEEE떋EE̋EW4Džhu`t FO)ȅu@ED$UT$M̉ $@rEEEWMEM WM̈EMaUWVSQRt$lrǃRhs1p.pU݉l|hR~9}el|$pT$$qlT$ D$tsD$|s$qhD$$ qt$qHWډt|sD$hs$.qt$pD$l$qlD$ D$tsD$|s$hsD$|s$qtD:9aD$ D$tsD$hs$f|sD$$^qu Ĝ[^_]p8t}p8tsp8  ep$pD$ D$Ep87p8)p$opD$D$O$p$pdo8 tPo$-pD$ hsD$|sD$lP$o$opĜ[^_]ËhsD$|sD$P$o$2pĜ[^_]ËD$UWVS|yNOtntۋ~Ot$nǃ~OJpO~D$ ED$VpD$Jp$=D$ MD$D$^p$OD$D$$|[^_]|[^_]ÍED$Vp$rmu:Em$BnD$zM$m$nm8t [configuration properties] [...] %s [configuration properties] [...] ( implicitly '-c') %s ( implicitly '%s.conf') %s ( implicitly '-c' and '%s.conf') where can be one of: -c --console run as a Console application -v --version print the wrapper's version information. -? --help print this help message is the wrapper.conf to use. Name must be absolute or relative to the location of %s [configuration properties] are configuration name-value pairs which override values in wrapper.conf. For example: wrapper.debug=true%s.confcwrapper.working.dirwrapper.daemonizewrapper.signal.mode.hupJVM requested a restart.javawrapper.java.command"%s"jdbjdb.exewrapper.java.additional.%d"-The value of property '%s', '%s' is not a valid argument to the jvm. Skipping.wrapper.java.additional.%d.stripquotes-Xdebugwrapper.java.initmemory-Xms%dmwrapper.java.maxmemory-Xmx%dmLD_LIBRARY_PATHwrapper.java.library.path-Djava.library.path="%s%c%s\"-Djava.library.path="%s%c%s"-Djava.library.path=%s%c%s-Djava.library.path="%s\"-Djava.library.path="%s"-Djava.library.path=%swrapper.java.library.path.%dwrapper.java.classpath.%dClasspath element, %s, does not match any files: %sClasspath element, %s, does not exist: %sUnable to get information of classpath element: %s (%s)-Dwrapper.key="%s"-Dwrapper.key=%s-Dwrapper.port=%d-Dwrapper.jvm.port=%d-Dwrapper.jvm.port.min=%d-Dwrapper.jvm.port.max=%d-Dwrapper.pid=%d-Dwrapper.timer_fast_threshold="%d"-Dwrapper.timer_fast_threshold=%d-Dwrapper.timer_slow_threshold="%d"-Dwrapper.timer_slow_threshold=%d-Dwrapper.version="%s"-Dwrapper.version=%s-Dwrapper.native_library="%s"-Dwrapper.native_library=%s-Dwrapper.cpu.timeout="%d"-Dwrapper.cpu.timeout=%d-Dwrapper.jvmid=%dMainwrapper.java.mainclasswrapper.app.parameter.%dwrapper.app.parameter.%d.stripquotes------------------------------------------------------------------------The JVM is being launched with a debugger enabled and could possibly besuspended. To avoid unwanted shutdowns, timeouts will be disabled,removing the ability to detect and restart frozen JVMs.Filter trigger matched. Restarting JVM.Filter trigger matched. Shutting down.JVM requested a shutdown. (%d)wrapper.logfileSIZEwrapper.logfile.rollmodewrapper.logfile.rollmode invalid. Disabling log file rolling.YYYYMMDDwrapper.logfile must contain "%s" for a roll mode of DATE. Disabling log file rolling.wrapper.logfile.formatINFOwrapper.logfile.loglevel0wrapper.logfile.maxsizewrapper.logfile.maxfileswrapper.logfile.inactivity.timeoutPMwrapper.console.formatwrapper.console.loglevelwrapper.console.flushNONEwrapper.syslog.loglevelUSERwrapper.syslog.facilitywrapperwrapper.ntservice.namewrapper.unix.namewrapper.portwrapper.port.minwrapper.port.min must be in the range 1-65535. Changing to %d.wrapper.port.maxwrapper.port.max must be greater than or equal to wrapper.port.min. Changing to %d.wrapper.jvm.portwrapper.jvm.port must not equal wrapper.port. Changing to the default.wrapper.jvm.port.minwrapper.jvm.port.min must be in the range 1-65535. Changing to %d.wrapper.jvm.port.maxwrapper.jvm.port.max must be greater than or equal to wrapper.jvm.port.min. Changing to %d.wrapper.debugDEBUGwrapper.java.command.loglevelwrapper.adviserwrapper.use_system_timewrapper.timer_fast_thresholdwrapper.timer_slow_thresholdwrapper.native_librarywrapper.java.library.path.append_system_pathwrapper.state_outputwrapper.timer_outputwrapper.loop_outputwrapper.sleep_outputwrapper.memory_outputwrapper.memory_output.intervalwrapper.cpu_outputwrapper.cpu_output.intervalwrapper.disable_shutdown_hookwrapper.startup.delaywrapper.startup.delay.consolewrapper.startup.delay.servicewrapper.restart.delaywrapper.restart.reload_configurationwrapper.disable_restartswrapper.cpu.timeoutwrapper.startup.timeoutwrapper.ping.timeoutwrapper.ping.intervalwrapper.shutdown.timeoutwrapper.jvm_exit.timeoutwrapper.ping.interval must be at least 1 second. Changing to 1.wrapper.ping.interval must be at less than or equal to 1 hour (3600 seconds). Changing to 3600.wrapper.ping.timeout must be at least 5 seconds longer than wrapper.ping.interval. Changing to %d.CPU timeout detection may not operate correctly during startup because wrapper.cpu.timeout is not smaller than wrapper.startup.timeout.CPU timeout detection may not operate correctly because wrapper.cpu.timeout is not smaller than wrapper.ping.timeout.CPU timeout detection may not operate correctly during shutdown because wrapper.cpu.timeout is not smaller than wrapper.shutdown.timeout.wrapper.max_failed_invocationswrapper.successful_invocation_timeThe value of wrapper.max_failed_invocations must not be smaller than 1. Changing to 1.wrapper.request_thread_dump_on_failed_jvm_exitwrapper.filter.trigger.%dwrapper.filter.action.%dwrapper.pidfilewrapper.java.pidfilewrapper.lockfilewrapper.java.idfilewrapper.statusfilewrapper.java.statusfilewrapper.commandfilewrapper.command.poll_intervalwrapper.anchorfilewrapper.anchor.poll_intervalwrapper.umaskwrapper.java.umaskwrapper.pidfile.umaskwrapper.lockfile.umaskwrapper.java.pidfile.umaskwrapper.java.idfile.umaskwrapper.statusfile.umaskwrapper.java.statusfile.umaskwrapper.anchorfile.umaskwrapper.logfile.umaskwrapper.ignore_signalsUnable to resolve the full path of the configuration file, %s: %sThe argument '%s' is not a valid property name-value pair.Unable to open configuration file. %sProblem loading wrapper configuration file: %sserver socket creation failed. (%s)server socket ioctlsocket failed. (%s)127.0.0.1unable to bind listener to any port in the range %d-%d. (%s)unable to bind listener port %d, or any port in the range %d-%d. (%s)port %d already in use, using port %d instead.server listening on port %d.server socket listen failed. (%d)socket creation failed. (%s)accepted a socket from %s on port %dsocket ioctlsocket failed. (%s)(Property Values)NULLsocket not open, so packet not sent %s : %ssend a packet %s : %ssocket send failed. (%d)JVM signalled that it was started.--> Wrapper Started as Daemon--> Wrapper Started as ConsoleUsing system timer.Using tick timer.<-- Wrapper Stopped--> Wrapper Started as ServiceJVM process exited with a code of %d, leaving the wrapper exit code set to %d.JVM process exited with a code of %d, setting the wrapper exit code to %d.JVM process exited with a code of %d, however the wrapper exit code was already %d.JVM already down.Unable to start a JVMJVM exited while loading the application.JVM exited before starting the application.JVM exited while starting the application.JVM exited unexpectedly.JVM exited unexpectedly while stopping the application.JVM exited normally.JVM exited on its own while waiting to kill the application.Unexpected jState=%d in wrapperJVMProcessExited.Got key from JVM: %s%dReceived a connection request with an incorrect key. Waiting for another connection.Incorrect key. Connection rejected.socket read failed. (%s)socket read no code (closed?).read a packet %s : %sreceived unknown packet (%d:%s)windowsx86323.2.3UNKNOWNSTARTINGSTOPPINGKILLINGDOWNLAUNCH(DELAY)LAUNCHINGLAUNCHEDw%s Unable to write to the status file: %sStartup failed: Timed out waiting for a signal from the JVM.org.tanukisoftware.wrapper.WrapperSimpleApporg.tanukisoftware.wrapper.WrapperStartStopAppAdvice:The Wrapper consists of a native component as well as a set of classeswhich run within the JVM that it launches. The Java component of theWrapper must be initialized promptly after the JVM is launched or theWrapper will timeout, as just happened. Most likely the main classspecified in the Wrapper configuration file is not correctly initializingthe Wrapper classes: %sWhile it is possible to do so manually, the Wrapper ships with helperclasses to make this initialization processes automatic.Please review the integration section of the Wrapper's documentationfor the various methods which can be employed to launch an applicationwithin the Wrapper: http://wrapper.tanukisoftware.org/doc/english/integrate.html Loop: check command filer+tUnable to read the command file: %sCommand '%s'. Restarting JVM.Command '%s'. Shutting down with exit code %d.PAUSECommand '%s' not supported on this platform, ignoring.RESUMEDUMPCommand '%s'. Requesting a Thread Dump.CONSOLE_LOGLEVELLOGFILE_LOGLEVELSYSLOG_LOGLEVELCommand '%s' is missing its log level.Command '%s' specified an unknown log level: '%'Command '%s'. Set console log level to '%s'.Command '%s'. Set log file log level to '%s'.Command '%s'. Set syslog log level to '%s'.Command '%s' lead to an unexpected state.LOOP_OUTPUTSTATE_OUTPUTMEMORY_OUTPUTCPU_OUTPUTTIMER_OUTPUTSLEEP_OUTPUTTRUECommand '%s'. Enable %s.Command '%s'. Disable %s.Command '%s' is unknown, ignoring.Unable to delete the command file, %s: %s Last system time tick overflow at: %s Next system time tick overflow at: %s Last tick overflow at: %s Next tick overflow at: %s Set Java State %s Timeout %08lx -> %08lx Set Wrapper State %s -> %s Loop: check anchor fileAnchor file deleted. Shutting down. Set Java State %s -> %sStart Application.startUnable to send the start command to the JVM.Reloading Wrapper configuration...com.silveregg.wrapper.WrapperSimpleAppThe com.silveregg.wrapper.WrapperSimpleApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperSimpleApp class instead.com.silveregg.wrapper.WrapperStartStopAppThe com.silveregg.wrapper.WrapperStartStopApp class is no longer supported.Please use the org.tanukisoftware.wrapper.WrapperStartStopApp class instead.Launching a JVM...JVM Restarts disabled. Shutting down.Waiting %d seconds before launching another JVM.JVM was only running for %d seconds leading to a failed restart count of %d.There were %d failed launches in a row, each lasting less than %d seconds. Giving up. There may be a configuration problem: please check the logs.Waiting %d seconds before launching the first JVM.wrapper.on_exit.%dshutdownwrapper.on_exit.defaultrestarton_exit trigger matched. Restarting the JVM. (Exit code: %d)on_exit trigger matched. Service is paused, will restart the JVM when resumed. (Exit code: %d)The JVM was launched with debug options so this may be because the JVMis currently suspended by a debugger. Any future timeouts during thisJVM invocation will be silently ignored. DebugJVM timeout. Disable current %s timeout.JVM exitShutdown: Timed out waiting for the JVM to terminate.Shutdown failed: Timed out waiting for the JVM to terminate.Shutdown: Timed out waiting for a signal from the JVM.Shutdown failed: Timed out waiting for signal from JVM.pingPing: Timed out waiting for signal from JVM.JVM appears hung: Timed out waiting for signal from JVM. Temp: Sending a ping packet.JVM Ping Failed. Temp: Sent a ping packet.startupStartup: Timed out waiting for a signal from the JVM.Startup failed: Timed out waiting for signal from JVM.Event loop started.no Loop: %ssleep Loop: maintain logger Loop: process jvm outputPause reading child output to share cycles. Loop: process socketPause reading socket data to share cycles. Loop: maintain logger(2)Wrapper Process has not received any CPU time for %d seconds. Extending timeouts.truefalse Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (%ds), Exit=%s, Restart=%s Ticks=%08lx, WrapperState=%s, JVMState=%s JVMStateTimeoutTicks=%08lx (N/A), Exit=%s, Restart=%s Loop: exit requestedSending stop signal to JVM Loop: handle wrapper state: %sUnknown wState=%d Loop: handle jvm state: %sUnknown jState=%dEvent loop stopped.%d Dumping JVM state.Could not dump JVM state: %sSIGHUPSIGALRMSIGINTSIGKILLSIGQUITSIGCHLDSIGTERMAIO completedunknownkill, sigsend or raisesigqueuetimer expiredmesq state changedUnable to register signal handler for signal %d. %sLaunching Timer thread.Unable to create a timer thread: %d, %s Sleep: nanosleep %dms Sleep: awakeCommand[%d] : %sCall to getrusage failed for Wrapper process: %sCall to getrusage failed for Java process: %sWrapper CPU: system %ld.%03ld, user %ld.%03ld Java CPU: system %ld.%03ld, user %ld.%03ldUnable to get the path for '%s'-%sUnable to extract path from: %sUnable to set working dir to %s : %sUnable to request JVM process status: %sJVM exited in response to signal %s (%d).WIFEXITED indicates that the JVM exited abnormally.Signal trapped. No details available.Signal trapped. Details: signal number=%d (%s), source="%s" signal err=%d, "%s" signal generated by PID: %d (Session PID: %d), UID: %d (%s)Timer thread received an Alarm signal. Ignoring.Received an Alarm signal. Ignoring.Received SIGCHLD, checking JVM process status.JVM process was still running after receiving a SIGCHLD signal.%s trapped, but signals for timer thread are ignored.%s trapped, but ignored.%s trapped. Restarting JVM.%s trapped. Forcing immediate shutdown.%s trapped. Shutting down.%s trapped. Forwarding to JVM process.Unable to forward %s signal to JVM process. %s%s trapped. Unable to forward signal to JVM because it is not running.HUPTERMINTTimer thread received an Quit signal. Ignoring.Could not mask signals for timer thread.Timer thread started.The timer fell behind the system clock by %ldms.The system clock fell behind the timer by %ldms. Timer: ticks=%lu, system ticks=%lu, offset=%lu, offsetDiff=%ldJVM did not exit on request. Attempt to terminate process failed: %sJVM did not exit on request, terminatedSpawning intermediate process...Could not spawn daemon process: %ssetsid() failed: %s/dev/nullSpawning daemon process...Failed to read console output from the JVM: %s (%d)Could not init pipe: %sCould not spawn JVM process: %sUnable to set JVM's stdout: %sUnable to set JVM's stderr: %sUnable to start JVM: %s (%d)Failed to set jvm output handle to non blocking mode: %s (%d)Failed to set jvm output handle to close on JVM exit: %s (%d)Unable to write the Java PID file: %sUnable to write the Java ID file: %s?-helpv-version-consoleERROR: Could not write anchor file %s: %sERROR: Could not write pid file %s: %sWARNING: Could not write lock file %s: %s Unrecognized option: -%s %s=%sUnable to set environment variable: %s name:%s value:%sset.default.set.The following property name value pair is too large. Need to increase the internal buffer size: %srt#includeNONE DEBUG INFO STATUSWARN ERROR FATAL ADVICEWARNING - Encountered an unknown thread %ld in getThreadId(). WRAPPERJVMSIZE_OR_WRAPPERSIZE_OR_JVMDATEFATALERRORWARNLOCAL0LOCAL1LOCAL2LOCAL3LOCAL4LOCAL5LOCAL6LOCAL7jvm %-4d%c%04d/%02d/%02d %02d:%02d:%02d%04d/%02d/%02d %02d:%02d:%02d.%03dUnable to delete old log file: %s (%s) -YYYYMMDD_YYYYMMDD.YYYYMMDDROLLNUM-ROLLNUM_ROLLNUM.ROLLNUM.%sUnable to rename log file %s to %s. File is in use by another application. Unable to rename log file %s to %s. (%s) Unable to get the current logfile size with ftell: %s Unable to get the current logfile size with stat: %s ????????%04d%02d%02daUnable to open logfile %s: %s FፉQ-ፉQፉQѣ $Ë$0@@:2 ;]]]]:2||||||||#|x P0p@`p+dd"3Ugd"hd"d"<."D"D"D"D"D"D"D"D"D"D"D"D"D"D#D #D#D #D*#D.#D9#D ?#DR#Dz#$" @;JY@bm"n#o~$N##.#D+#D.#D0#D1#$+#,##$*N# - . / 0d# p9 t,P#c"t#R f s    D   p N R#d1/   C;" d5 $0-"C T3PX Hq P L 7H\ Vpāȁ)́Mk ]R""n&{1  # 5pkId,/ / itS  E/nd  E Ӭ# 1 A R a q v 9@  t   %#<] ;'V`M a jpq D @ ac =$ &8 730 n9"w jk7Z H p  @ # $;}P)% @  pЁY|  5d' *C.z lF [ !~^  j !& = WR d !u  o   X {  " !) l;{[% pp      <!. 0 ɬ ɳ ά a#0  |  w+X:(-9.8   UK+XS  e-$X+ Y [ J6u0 )& Ȑ6JzJ{=mYT(<  xi4N1%!.&a#G y , 9&9Վ\ L0bm7q ϱ|1Ȋ2'\ ),'0 v;v3  I+jd"_h&"J(QCGK`0gO6>HS[ WB J R th |        < D M T Z f n v ~     ?z@(MP#$)5MT_4Bk  U X k n ' d x a . C cTYzaVcTYmkx{}|Z[sv]^rWteuS\Xdyghjcqbopw`ni~_flN1gb U_NXArgc_NXArgv___i686.get_pc_thunk.bx___i686.get_pc_thunk.cx___progname__dyld_func_lookup__start_environdyld_stub_binding_helperstart___keymgr_dwarf2_register_sections__cthread_init_routine__mh_execute_header_atexit_catch_exception_raise_catch_exception_raise_state_catch_exception_raise_state_identity_clock_alarm_reply_do_mach_notify_dead_name_do_mach_notify_no_senders_do_mach_notify_port_deleted_do_mach_notify_send_once_do_seqnos_mach_notify_dead_name_do_seqnos_mach_notify_no_senders_do_seqnos_mach_notify_port_deleted_do_seqnos_mach_notify_send_once_errno_exit_mach_init_routine_main_receive_samples_correctWindowsPath_getOutputFilterActionForName_getSignalMode_keyChars_loadConfiguration_lockProtocolMutex_protocolMutex_protocolOpen_protocolSendBuffer_protocolSendBufferSize_protocolStartServer_protocolStopServer_releaseProtocolMutex_sd_sendProperties_ssd_updateStringValue_validateTimeout_wrapperAddDefaultProperties_wrapperAddToTicks_wrapperBuildJavaCommandArray_wrapperBuildJavaCommandArrayInner_wrapperBuildKey_wrapperBuildUnixDaemonInfo_wrapperDispose_wrapperFreeJavaCommandArray_wrapperGetCurrentTime_wrapperGetFileBase_wrapperGetSystemTicks_wrapperGetTickAge_wrapperInitialize_wrapperJVMProcessExited_wrapperKeyRegistered_wrapperLoadConfigurationProperties_wrapperLogChildOutput_wrapperLogSignalled_wrapperParseArguments_wrapperPingResponded_wrapperProtocolClose_wrapperProtocolFunction_wrapperProtocolGetCodeName_wrapperProtocolRead_wrapperRestartProcess_wrapperRestartRequested_wrapperRunConsole_wrapperRunService_wrapperSetWorkingDir_wrapperSetWorkingDirProp_wrapperStartPendingSignalled_wrapperStartedSignalled_wrapperStopPendingSignalled_wrapperStopProcess_wrapperStopRequested_wrapperStoppedSignalled_wrapperStripQuotes_wrapperTickExpired_wrapperUsage_wrapperVersionBanner___error_accept_addPropertyPair_atoi_bind_ceil_chdir_close_closeLogfile_createProperties_disposeLogging_disposeProperties_fcntl_free_getBooleanProperty_getIntProperty_getLastError_getLastErrorText_getLogLevelForName_getLogfileRollModeForName_getLowLogLevel_getStringProperty_getSyslogLevelInt_getenv_gettimeofday_glob_globfree_inet_addr_inet_ntoa_initLogging_isQuotableProperty_linearizeProperties_listen_loadProperties_log_printf_log_printf_queue_malloc_memcpy_memset_packetBuffer_printf_properties_pthread_mutex_lock_pthread_mutex_unlock_putchar_puts_rand_realpath_recv_registerSyslogMessageFile_send_setConsoleFlush_setConsoleLogFormat_setConsoleLogLevel_setConsoleLogLevelInt_setLogfileAutoClose_setLogfileFormat_setLogfileLevel_setLogfileLevelInt_setLogfileMaxFileSize_setLogfileMaxLogFiles_setLogfilePath_setLogfileRollMode_setLogfileUmask_setSyslogEventSourceName_setSyslogFacility_setSyslogLevel_setSyslogLevelInt_socket_sprintf_srand_stat_strcasecmp_strchr_strcmp_strcpy_strrchr_strstr_time_unlink_wrapperArch_wrapperBits_wrapperClasspathSeparator_wrapperData_wrapperEventLoop_wrapperGetLastError_wrapperGetPID_wrapperGetTicks_wrapperInitializeRun_wrapperOS_wrapperReportStatus_wrapperSetJavaState_wrapperSetWrapperState_wrapperUpdateJavaStateTimeout_wrapperVersion_anchorPoll_commandPoll_displayLaunchingTimeoutMessage_handleDebugJVMTimeout_jStateDown_jStateKilling_jStateLaunch_jStateLaunched_jStateLaunching_jStateStarted_jStateStarting_jStateStopped_jStateStopping_lastLogfileActivity_logTimerStats_wStateStarted_wStateStarting_wStateStopped_wStateStopping_wrapperGetJState_wrapperGetWState_writeStateFile_asctime_checkPropertyEqual_fclose_fgets_flushLogfile_fopen_fprintf_getLogfileActivity_getLogfileRollMode_localtime_maintainLogger_remove_rollLogs_umask_wrapperBuildJavaCommand_wrapperDumpCPUUsage_wrapperDumpMemory_wrapperExecute_wrapperGetProcessStatus_wrapperKillProcess_wrapperKillProcessNow_wrapperReadChildOutput_wrapperRequestDumpJVMState_wrapperSleep_appExit_childOutputBuffer_childOutputBufferSize_daemonize_descSignal_ensureSpaceInChildOutputBuffer_getSignalCodeDesc_getSignalName_initializeTimer_jvmOut_pipeInitialized_registerSigAction_setWorkingDir_sigActionAlarm_sigActionChildDeath_sigActionCommon_sigActionHangup_sigActionInterrupt_sigActionQuit_sigActionTermination_timerRunner_timerTicks_writePidFile_dup2_execvp_fork_getpid_getpwuid_getrusage_getsid_kill_logRegisterThread_nanosleep_open_pipe_pipedes_pthread_create_pthread_equal_pthread_self_pthread_sigmask_read_setsid_sigaction_signal_strerror_timerThreadId_waitpid_addProperty_createInnerProperty_disposeInnerProperty_dumpProperties_evaluateEnvironmentVariables_getInnerProperty_insertInnerProperty_loadPropertiesInner_removeProperty_setEnv_setInnerProperty_trim_putenv_strdup_strtol_autoCloseLogfile_buildPrintBuffer_checkAndRollLogs_consoleFlush_currentConsoleLevel_currentLogfacilityLevel_currentLogfileLevel_currentLoginfoLevel_forceFlush_generateLogFileName_getConsoleLogLevelInt_getLogFacilityForName_getLogfileLevelInt_getThreadId_limitLogFileCount_limitLogFileCountHandleFile_lockLoggingMutex_logFileMaxLogFiles_logFileMaxSize_logFileRollMode_logFileUmask_logLevelNames_log_printfMutex_log_printf_message_log_printf_queueInner_logfileFP_queueReadIndex_queueWrapped_queueWriteIndex_releaseLoggingMutex_replaceStringLongWithShort_sendEventlogMessage_sendLoginfoMessage_setLogfileMaxFileSizeInt_setSyslogFacilityInt_threadMessageBuffer_threadMessageBufferSize_threadPrintBuffer_threadPrintBufferSize_unregisterSyslogMessageFile___sF_closelog_consoleFormat_currentLogFileName_fflush_ftell_logFileLastNowDate_logFilePath_logfileActivityCount_logfileFormat_loginfoSourceName_openlog_queueLevels_queueMessages_queueSourceIds_queueThreadIds_rename_syslog_threadIds_vsnprintf_workLogFileNamestart.sint:t1=r1;-2147483648;2147483647;char:t2=r2;0;127;/SourceCache/Csu/Csu-58//SourceCache/Csu/Csu-58/crt.cgcc2_compiled._start:F(0,1)argc:p(0,2)argv:p(0,3)envp:p(0,3)p:r(0,4)char:t(0,5)=r(0,5);0;127;:t(0,1)=(0,1)int:t(0,2)=r(0,2);-2147483648;2147483647;:t(0,3)=*(0,4):t(0,4)=*(0,5)q:r(0,3)term:(0,6):t(0,6)=*(0,7):t(0,7)=f(0,1)__call_mod_init_funcs_call_mod_init_funcs:f(0,1)p:(0,6)NXArgc:G(0,2)int:t(0,2)NXArgv:G(0,3)environ:G(0,3)__progname:G(0,4)dyld_lazy_symbol_binding_entry_pointdyld_func_lookup_pointer_unknownBuffer.5126_seeded.5760_jvmPidmule-2.0.1/distributions/server/src/main/resources/lib/boot/libwrapper-macosx-ppc-32.jnilib0000755000175000017500000003605010565334502031612 0ustar charlescharlesH__TEXT __text__TEXTd td__picsymbol_stub__TEXT$__picsymbolstub1__TEXT __cstring__TEXT`p`__DATA  __data__DATA $ __dyld__DATA $ $__la_symbol_ptr__DATA ,P ,__nl_symbol_ptr__DATA | |(__bss__DATA 8__LINKEDIT00 ( 4E0RX/usr/lib/libSystem.B.dylib0V5x P++B4*0|B}|}cx= }| x= N |B}h|=kk }iN |B8`!<8H 8!P8`Ȼ|H|B8`!<8H 8!P8`̻|H|B8`!<8H i8!P8`ͻ|Hp|B/!<_B A<8c H8`H q<8`88H <8x8`H<88`HH}8!P<_|b N H\|B!<_B l/A$?< 8c HE8`HH?~ 8H/@0HI|dx<8c H 8!P8`|H8!P|N |B!<_B Ȁ/A(<8c <x8 T~x8 `| x| N!|xyA~CxHy||yA|\HD|dxx| x| N!|{xxH|fxx| x| xdx8N!^xFxxgxx$x| x| N!^<~x8 h8 `x| x| N!|xyAHH;H%/A}/@H|\H݀D|dxx| x| N!|{xxH|fxx| x| xdx8N!^Fxgxxx$xx| x| N!H||yA KXHH; 8!#xA|N |B||x|#x|+x!<8cPH}/A$8!Pxxx|K8!P|N 8`N 8`N |!H8!Pc|H|B}H| x|_xlptx|>^~h<_8b HM|lx<_8B~h^>|xtpl!|}N ||dxB8_!p8a98H8a8|}xH<_}]|~x9"tBt i|].<_x j;xH=,@|}xxHeH8!|N |B}h=k|D}N |B}h=k|(}N |B}h=k| }N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|d}N |B}h=k|H}N |B}h=k|,}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|}N |B}h=k|h}N |B}h=k|L}N |B}h=k|0}N Inside native WrapperManager initialization methodSending SIGQUIT event to process group %d. Unable to send SIGQUIT to JVM process: %s Setting the console title not supported on UNIX platforms.org/tanukisoftware/wrapper/WrapperUNIXUser(II[B[B[B[B)VsetGroup(I[B)VaddGroupDISPLAYwindowsx86323.2.3printf$LDBL128libSystem.dddddddddddddddddddd  @ @ @ @ @ `@ \@ X@ T@ P@ L@ H@ D@ @@ <@ 8@ 4@ 0@ ,@ h@ d@ x@ t@ p@ l@ dd@R\d~ddddԄd$dDhDlDpDtDx $D ?D @ WD XDYDZ$pDqDrDsDt (DDDDdd  40x8C8  tFe d4r{ ] j 0 Ew   (MKPILJOQHFGNURETCSDBMKPILJOQHFGNURETCSDB>A__dyld_func_lookupdyld_stub_binding_helper__mh_bundle_header_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetInteractiveUser_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetJavaPID_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetUser_Java_org_tanukisoftware_wrapper_WrapperManager_nativeInit_Java_org_tanukisoftware_wrapper_WrapperManager_nativeListServices_Java_org_tanukisoftware_wrapper_WrapperManager_nativeRequestThreadDump_Java_org_tanukisoftware_wrapper_WrapperManager_nativeSendServiceControlCode_Java_org_tanukisoftware_wrapper_WrapperManager_nativeSetConsoleTitle_handleHangup_handleInterrupt_handleTermination_endgrent_fflush_getLastErrorText_getenv_geteuid_getgrent_getgrgid_getpid_getpwuid_kill_printf$LDBLStub_puts_setgrent_signal_strcmp_strlen_wrapperJNIDebugging_wrapperJNIHandleSignal_wrapperArch_wrapperBits_wrapperOS_wrapperVersion_Java_org_tanukisoftware_wrapper_WrapperManager_accessViolationInner_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetControlEvent_Java_org_tanukisoftware_wrapper_WrapperManager_nativeGetLibraryVersion_checkingControlEvent_lastControlEvent___error_strerror___stub_getrealaddr_NSAddressOfSymbol_NSIsSymbolNameDefinedWithHint_NSLookupAndBindSymbolWithHint_strcpy{standard input}int:t1=r1;-2147483648;2147483647;char:t2=r2;0;127;void:t3=3/SourceCache/Csu/Csu-58/bundle1.s/SourceCache/Csu/Csu-58///SourceCache/Csu/Csu-58/bundle1.s/SourceCache/Csu/Csu-58/bundle1.sdyld_stub_binding_helper:F3dyld_lazy_symbol_binding_entry_pointdyld__mh_bundle_header__dyld_func_lookup:F3dyld_func_lookup_pointer_wrapperProcessId_funcptrmule-2.0.1/distributions/server/src/main/resources/lib/boot/README.txt0000644000175000017500000000015510732766104025453 0ustar charlescharlesThis directory contains the libraries used by the Java Service Wrapper (http://wrapper.tanukisoftware.org). mule-2.0.1/distributions/server/src/main/resources/lib/user/0000755000175000017500000000000011351411041023750 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/lib/user/README.txt0000644000175000017500000000032510732766104025465 0ustar charlescharlesAll libraries (.jar files) in this folder will be added to the classpath before starting Mule. Therefore this is a convenient place for the user to add any additional libraries needed for his/her Mule project. mule-2.0.1/distributions/server/src/main/resources/lib/endorsed/0000755000175000017500000000000011351411041024575 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/licenses/0000755000175000017500000000000011351411015024032 5ustar charlescharlesmule-2.0.1/distributions/server/src/main/resources/licenses/jdom.license0000644000175000017500000000473010443721724026347 0ustar charlescharles Copyright (C) 2000-2002 Jason Hunter & Brett McLaughlin. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the disclaimer that follows these conditions in the documentation and/or other materials provided with the distribution. 3. The name "JDOM" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact . 4. Products derived from this software may not be called "JDOM", nor may "JDOM" appear in their name, without prior written permission from the JDOM Project Management . In addition, we request (but do not require) that you include in the end-user documentation provided with the redistribution and/or in the software itself an acknowledgement equivalent to the following: "This product includes software developed by the JDOM Project (http://www.jdom.org/)." Alternatively, the acknowledgment may be graphical using the logos available at http://www.jdom.org/images/logos. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the JDOM Project and was originally created by Jason Hunter and Brett McLaughlin . For more information on the JDOM Project, please see .mule-2.0.1/distributions/server/src/main/resources/licenses/commons-beanutils.license0000644000175000017500000002644610205047630031056 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/wss4j.license0000644000175000017500000002613510211352635026465 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/carol.license0000644000175000017500000006347310507445602026526 0ustar charlescharlesGNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vicemule-2.0.1/distributions/server/src/main/resources/licenses/axis.license0000644000175000017500000002644610205047630026363 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/backport-util-concurrent.license0000644000175000017500000000437310334143522032352 0ustar charlescharlesThe software comprising backport-util-concurrent is based in large part on the code from JSR166, and the package dl.util.concurrent. The software has been released to the public domain, as explained at: http://creativecommons.org/licenses/publicdomain, excepting portions of the class edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList, which were adapted from class java.util.ArrayList, written by Sun Microsystems, Inc, which are used with kind permission, and subject to the following: Copyright 2002-2004 Sun Microsystems, Inc. All rights reserved. Use is subject to the following license terms. "Sun hereby grants you a non-exclusive, worldwide, non-transferrable license to use and distribute the Java Software technologies as part of a larger work in source and binary forms, with or without modification, provided that the following conditions are met: -Neither the name of or trademarks of Sun may be used to endorse or promote products derived from the Java Software technology without specific prior written permission. -Redistributions of source or binary code must be accompanied by the following notice and disclaimers: Portions copyright Sun Microsystems, Inc. Used with kind permission. This software is provided AS IS, without a warranty of any kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PUPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN MICROSYSTEMS, INC. OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT,CONSQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OR LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN MICROSYSTEMS, INC. HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. You acknowledge that Software is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility." mule-2.0.1/distributions/server/src/main/resources/licenses/xpp3.license0000644000175000017500000000425610205047630026304 0ustar charlescharlesIndiana University Extreme! Lab Software License Version 1.1.1 Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Indiana University Extreme! Lab (http://www.extreme.indiana.edu/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Indiana Univeristy" and "Indiana Univeristy Extreme! Lab" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact http://www.extreme.indiana.edu/. 5. Products derived from this software may not use "Indiana Univeristy" name nor may "Indiana Univeristy" appear in their name, without prior written permission of the Indiana University. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS, COPYRIGHT HOLDERS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.mule-2.0.1/distributions/server/src/main/resources/licenses/cryptix-pki-api.license0000644000175000017500000000247210462371572030454 0ustar charlescharlesCopyright 1995-2001 The Cryptix Foundation Limited. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CRYPTIX FOUNDATION LIMITED OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.mule-2.0.1/distributions/server/src/main/resources/licenses/xmlsec.license0000644000175000017500000002613510211352635026706 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/asm.license0000644000175000017500000000313210545332216026166 0ustar charlescharles ASM: a very small and fast Java bytecode manipulation framework Copyright (c) 2000-2005 INRIA, France Telecom All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. mule-2.0.1/distributions/server/src/main/resources/licenses/geronimo-spec-jta.license0000644000175000017500000002644610462371572030754 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/cryptix-jce-api.license0000644000175000017500000000247210462371572030432 0ustar charlescharlesCopyright 1995-2001 The Cryptix Foundation Limited. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CRYPTIX FOUNDATION LIMITED OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.mule-2.0.1/distributions/server/src/main/resources/licenses/geronimo-spec-j2ee-connector.license0000644000175000017500000002644610462371572033013 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/xmlschema.license0000644000175000017500000002645010443721724027402 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/geronimo-spec-ejb.license0000644000175000017500000002644610462371572030736 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/concurrent.license0000644000175000017500000000045310205047630027567 0ustar charlescharles** Taken from Sorurce Code ** Originally written by Doug Lea and released into the public domain. This may be used for any purposes whatsoever without acknowledgment. Thanks for the assistance and support of Sun Microsystems Labs, and everyone contributing, testing, and using this code. **mule-2.0.1/distributions/server/src/main/resources/licenses/commons-id.license0000644000175000017500000002644610205047630027464 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/wsdl4j.license0000644000175000017500000002672510462371572026640 0ustar charlescharlesCommon Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. mule-2.0.1/distributions/server/src/main/resources/licenses/oro.license0000644000175000017500000000540510211352635026207 0ustar charlescharles/* ==================================================================== * The Apache Software License, Version 1.1 * * Copyright (c) 2000-2002 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation", "Jakarta-Oro" * must not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache" * or "Jakarta-Oro", nor may "Apache" or "Jakarta-Oro" appear in their * name, without prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . * * Portions of this software are based upon software originally written * by Daniel F. Savarese. We appreciate his contributions. */ mule-2.0.1/distributions/server/src/main/resources/licenses/xstream.license0000644000175000017500000000274410205047630027075 0ustar charlescharles(BSD Style License) Copyright (c) 2003-2004, Joe Walnes All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of XStream nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.mule-2.0.1/distributions/server/src/main/resources/licenses/commons-pool.license0000644000175000017500000002644610205047630030041 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/commons-discovery.license0000644000175000017500000002644610205047630031077 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/stax-api.license0000644000175000017500000002644610462371572027157 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/geronimo-spec-qname.license0000644000175000017500000002644610462371572031277 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/geronimo-spec-jaxrpc.license0000644000175000017500000002644610462371572031465 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/geronimo-spec-j2ee-management.license0000644000175000017500000002644610462371572033135 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/axis-saaj.license0000644000175000017500000002644610205047630027277 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/xfire-all.license0000644000175000017500000000206410462371572027302 0ustar charlescharlesCopyright (c) 2005 Envoi Solutions LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.mule-2.0.1/distributions/server/src/main/resources/licenses/groovy.license0000644000175000017500000000374410577411741026752 0ustar charlescharles /* $Id: LICENSE.txt 156 2003-09-26 17:36:37Z jstrachan $ Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved. Redistribution and use of this software and associated documentation ("Software"), with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain copyright statements and notices. Redistributions must also contain a copy of this document. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name "groovy" must not be used to endorse or promote products derived from this Software without prior written permission of The Codehaus. For written permission, please contact info@codehaus.org. 4. Products derived from this Software may not be called "groovy" nor may "groovy" appear in their names without prior written permission of The Codehaus. "groovy" is a registered trademark of The Codehaus. 5. Due credit should be given to The Codehaus - http://groovy.codehaus.org/ THIS SOFTWARE IS PROVIDED BY THE CODEHAUS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CODEHAUS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ mule-2.0.1/distributions/server/src/main/resources/licenses/junit.license0000644000175000017500000002743610205047630026550 0ustar charlescharlesCommon Public License Version 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.mule-2.0.1/distributions/server/src/main/resources/licenses/howl-logger.license0000644000175000017500000000253310507445602027642 0ustar charlescharles HOWL is OSI Certified Open Source Software licensed under the BSD license. Copyright (c) 2004, Bull S. A., All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. mule-2.0.1/distributions/server/src/main/resources/licenses/acegisecurity.license0000644000175000017500000002613510211352635030253 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/commons-io.license0000644000175000017500000002613610402140621027464 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/cryptix-jce-provider.license0000644000175000017500000000247210462371572031513 0ustar charlescharlesCopyright 1995-2001 The Cryptix Foundation Limited. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CRYPTIX FOUNDATION LIMITED OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.mule-2.0.1/distributions/server/src/main/resources/licenses/axis-jaxrpc.license0000644000175000017500000002644610205047630027650 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/mx4j-tools.license0000644000175000017500000000471110205047630027426 0ustar charlescharlesThe MX4J License, Version 1.0 Copyright (c) 2001-2004 by the MX4J contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the MX4J project (http://mx4j.sourceforge.net)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The name "MX4J" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact biorn_steedom [at] users [dot] sourceforge [dot] net 5. Products derived from this software may not be called "MX4J", nor may "MX4J" appear in their name, without prior written permission of Simone Bordet. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MX4J CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ====================================================================mule-2.0.1/distributions/server/src/main/resources/licenses/geronimo-spec-jms.license0000644000175000017500000002644610462371572030767 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/log4j.license0000644000175000017500000002644610205047630026436 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/dom4j.license0000644000175000017500000000360710205047630026426 0ustar charlescharlesBSD STYLE LICENSE Redistribution and use of this software and associated documentation ("Software"), with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain copyright statements and notices. Redistributions must also contain a copy of this document. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name "DOM4J" must not be used to endorse or promote products derived from this Software without prior written permission of MetaStuff, Ltd. For written permission, please contact dom4j-info@metastuff.com. 4. Products derived from this Software may not be called "DOM4J" nor may "DOM4J" appear in their names without prior written permission of MetaStuff, Ltd. DOM4J is a registered trademark of MetaStuff, Ltd. 5. Due credit should be given to the DOM4J Project (http://dom4j.org/). THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.mule-2.0.1/distributions/server/src/main/resources/licenses/quartz.license0000644000175000017500000000146110434673660026747 0ustar charlescharles All source code, binaries, documentation, and other files in this distribution are subject to the following copyright and license agreement, unless otherwise documented: /* * Copyright 2004-2005 OpenSymphony * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * */ mule-2.0.1/distributions/server/src/main/resources/licenses/jug.license0000644000175000017500000002644610434316473026214 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/mockobjects-core.license0000644000175000017500000002644610205047630030650 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/geronimo-spec.license0000644000175000017500000002644610211264034030162 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/wstx-asl.license0000644000175000017500000002644610462371572027213 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/commons-httpclient.license0000644000175000017500000002644610205047630031246 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/commons-collections.license0000644000175000017500000002644610205047630031406 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/smack.license0000644000175000017500000000110110211352635026473 0ustar charlescharlesCopyright 2002-2004 Jive Software. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.mule-2.0.1/distributions/server/src/main/resources/licenses/springframework.license0000644000175000017500000002644610211352635030640 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/cryptix-message-api.license0000644000175000017500000000247210462371572031315 0ustar charlescharlesCopyright 1995-2001 The Cryptix Foundation Limited. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CRYPTIX FOUNDATION LIMITED OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.mule-2.0.1/distributions/server/src/main/resources/licenses/retrotranslator.license0000644000175000017500000000323510545332216030657 0ustar charlescharles Retrotranslator: a Java bytecode transformer that translates Java classes compiled with JDK 5.0 into classes that can be run on JVM 1.4. Copyright (c) 2005, 2006 Taras Puchko All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. mule-2.0.1/distributions/server/src/main/resources/licenses/script-engines.license0000644000175000017500000000277110570104146030345 0ustar charlescharlesCopyright (c) 2006, Sun Microsystems, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Sun Microsystems, Inc. nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. mule-2.0.1/distributions/server/src/main/resources/licenses/xml-apis.license0000644000175000017500000002644610736154427027165 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/xmlunit.license0000644000175000017500000000305010443721724027110 0ustar charlescharlesCopyright (c) 2001, Jeff Martin, Tim Bacon All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the xmlunit.sourceforge.net nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.mule-2.0.1/distributions/server/src/main/resources/licenses/mx4j-jmx.license0000644000175000017500000000471110205047630027064 0ustar charlescharlesThe MX4J License, Version 1.0 Copyright (c) 2001-2004 by the MX4J contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the MX4J project (http://mx4j.sourceforge.net)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The name "MX4J" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact biorn_steedom [at] users [dot] sourceforge [dot] net 5. Products derived from this software may not be called "MX4J", nor may "MX4J" appear in their name, without prior written permission of Simone Bordet. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MX4J CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ====================================================================mule-2.0.1/distributions/server/src/main/resources/licenses/commons-dbutils.license0000644000175000017500000002644610211352635030537 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/xapool.license0000644000175000017500000006347310211352635026723 0ustar charlescharlesGNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vicemule-2.0.1/distributions/server/src/main/resources/licenses/commons-codec.license0000644000175000017500000002644610211352635030146 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/xalan.license0000644000175000017500000010136010736154427026523 0ustar charlescharles<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The license above applies to this Apache Xalan release of: Xalan-Java 2 - XSLT Processor Xalan-Java 2 - Serializer The license above also applies to the jar files xalan.jar and xsltc.jar - Xalan-Java 2 - XSLT Processor from Source: http://xalan.apache.org/ The license above also applies to the jar file serializer.jar - Xalan-Java 2 - Serializer Source: http://xalan.apache.org/ Used by: Xalan-Java 2 and Xerces-Java 2 The license above also applies to the jar file xercesImpl.jar - Xerces-Java 2 XML Parser. Source: http://xerces.apache.org/ Used by: Xalan-Java 2 The license above also applies to the jar file xml-apis.jar - Xerces-Java 2 XML Parser. Source: http://xerces.apache.org/ Used by: Xalan-Java 2 and release copy of Xerces-Java 2 The following license applies to the included files: tools/ant.jar tools/antRun tools/antRun.bat Source: http://ant.apache.org/ Used By: Xalan's build process: java/build.xml and test/build.xml <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< /* * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ * * Copyright (C) 1999 The Apache Software Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: "This product includes software * developed by the Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * * 4. The names "Ant" and "Apache Software Foundation" must not be used to * endorse or promote products derived from this software without prior * written permission. For written permission, please contact * apache@apache.org. * * 5. Products derived from this software may not be called "Apache", nor may * "Apache" appear in their name, without prior written permission of the * Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * on behalf of the Apache Software Foundation. For more information on the * Apache Software Foundation, please see . * */ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license, Apache Software License, Version 1.1, applies to the included BCEL.jar from Apache Jakarta (Byte Code Engineering Library). Source: http://jakarta.apache.org/bcel Used By: XSLTC component of xml-xalan/java The following license, Apache Software License, Version 1.1, also applies to the included regexp.jar, jakarta-regexp-1.2.jar from Apache Jakarta. Source: http://jakarta.apache.org/regexp Used By: BCEL.jar which is used by XSLTC component of xml-xalan/java <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< /* * * Copyright (c) 2001 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Apache" and "Apache Software Foundation" and * "Apache BCEL" must not be used to endorse or promote products * derived from this software without prior written permission. For * written permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * "Apache BCEL", nor may "Apache" appear in their name, without * prior written permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation. For more * information on the Apache Software Foundation, please see * . */ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the DOM documentation for the org.w3c.dom.* packages: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< W3C® DOCUMENT LICENSE http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231 Public documents on the W3C site are provided by the copyright holders under the following license. By using and/or copying this document, or the W3C document from which this statement is linked, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions: Permission to copy, and distribute the contents of this document, or the W3C document from which this statement is linked, in any medium for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the document, or portions thereof, that you use: 1. A link or URL to the original W3C document. 2. The pre-existing copyright notice of the original author, or if it doesn't exist, a notice (hypertext is preferred, but a textual representation is permitted) of the form: "Copyright © [$date-of-document] World Wide Web Consortium, (Massachusetts Institute of Technology, European Research Consortium for Informatics and Mathematics, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231" 3. If it exists, the STATUS of the W3C document. When space permits, inclusion of the full text of this NOTICE should be provided. We request that authorship attribution be provided in any software, documents, or other items or products that you create pursuant to the implementation of the contents of this document, or any portion thereof. No right to create modifications or derivatives of W3C documents is granted pursuant to this license. However, if additional requirements (documented in the Copyright FAQ) are satisfied, the right to create modifications or derivatives is sometimes granted by the W3C to individuals complying with those requirements. THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to this document or its contents without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders. ---------------------------------------------------------------------------- This formulation of W3C's notice and license became active on December 31 2002. This version removes the copyright ownership notice such that this license can be used with materials other than those owned by the W3C, moves information on style sheets, DTDs, and schemas to the Copyright FAQ, reflects that ERCIM is now a host of the W3C, includes references to this specific dated version of the license, and removes the ambiguous grant of "use". See the older formulation for the policy prior to this date. Please see our Copyright FAQ for common questions about using materials from our site, such as the translating or annotating specifications. Other questions about this notice can be directed to site-policy@w3.org. Joseph Reagle >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the DOM software, for the org.w3c.dom.* packages in jar file xml-apis.jar: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< W3C® SOFTWARE NOTICE AND LICENSE http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions. Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications: 1. The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code. 3. Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.) THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders. ____________________________________ This formulation of W3C's notice and license became active on December 31 2002. This version removes the copyright ownership notice such that this license can be used with materials other than those owned by the W3C, reflects that ERCIM is now a host of the W3C, includes references to this specific dated version of the license, and removes the ambiguous grant of "use". Otherwise, this version is the same as the previous version and is written so as to preserve the Free Software Foundation's assessment of GPL compatibility and OSI's certification under the Open Source Definition. Please see our Copyright FAQ for common questions about using materials from our site, including specific terms and conditions for packages like libwww, Amaya, and Jigsaw. Other questions about this notice can be directed to site-policy@w3.org. Joseph Reagle >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the SAX software, for the org.xml.sax.* packages in jar file xml-apis.jar: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the jar file java_cup.jar - LALR Parser Generator for Java(TM). Source: http://www.cs.princeton.edu/~appel/modern/java/CUP Used By: XSLTC component of xml-xalan/java <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< CUP Parser Generator Copyright Notice, License, and Disclaimer Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the names of the authors or their employers not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The authors and their employers disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the authors or their employers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the jar file runtime.jar - Component of JavaCup: LALR Parser Generator for Java(TM). Source: http://www.cs.princeton.edu/~appel/modern/java/CUP Used By: XSLTC component of xml-xalan/java <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< CUP Parser Generator Copyright Notice, License, and Disclaimer (runtime.jar component) Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the names of the authors or their employers not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The authors and their employers disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the authors or their employers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the JLEX jar file JLex.jar - A Lexical Analyzer Generator for Java(TM). Source: http://www.cs.princeton.edu/~appel/modern/java/JLex Used By: XSLTC component of xml-xalan/java <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< JLEX COPYRIGHT NOTICE, LICENSE AND DISCLAIMER. Copyright 1996-2000 by Elliot Joel Berk and C. Scott Ananian Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of the authors or their employers not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The authors and their employers disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the authors or their employers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software. Java is a trademark of Sun Microsystems, Inc. References to the Java programming language in relation to JLex are not meant to imply that Sun endorses this product. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> The following license applies to the jar file stylebook-1.0-b3_xalan-2.jar - Tool for generating Xalan documentation. Integrated with Xalan-Java 2 and Xerces 2. Source: http://svn.apache.org/viewvc/xml/stylebook/ Used by: Xalan-Java 2, Xalan-C++ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< /* * The Apache Software License, Version 1.1 * * * Copyright (c) 1999 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Xalan", "Xerces", and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation and was * originally based on software copyright (c) 1999, International * Business Machines, Inc., http://www.apache.org. For more * information on the Apache Software Foundation, please see * . */ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> mule-2.0.1/distributions/server/src/main/resources/licenses/xercesImpl.license0000644000175000017500000002644610462371572027544 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/commons-net.license0000644000175000017500000002645010443721724027660 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/ognl.license0000644000175000017500000000505610443721724026357 0ustar charlescharles* ==================================================================== * The OpenSymphony Software License, Version 1.1 * * (this license is derived and fully compatible with the Apache Software * License - see http://www.apache.org/LICENSE.txt) * * Copyright (c) 2001-2004 The OpenSymphony Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * OpenSymphony Group (http://www.opensymphony.com/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "OpenSymphony" and "The OpenSymphony Group" * must not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact license@opensymphony.com . * * 5. Products derived from this software may not be called "OpenSymphony" * or "OGNL", nor may "OpenSymphony" or "OGNL" appear in their * name, without prior written permission of the OpenSymphony Group. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ====================================================================mule-2.0.1/distributions/server/src/main/resources/licenses/axis-wsdl4j.license0000644000175000017500000002644610205047630027570 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/geronimo.license0000644000175000017500000002644610211264034027232 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/jaxen.license0000644000175000017500000000365110443721724026524 0ustar charlescharles Copyright 2003 (C) The Werken Company. All Rights Reserved. Redistribution and use of this software and associated documentation ("Software"), with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain copyright statements and notices. Redistributions must also contain a copy of this document. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name "jaxen" must not be used to endorse or promote products derived from this Software without prior written permission of The Werken Company. For written permission, please contact bob@werken.com. 4. Products derived from this Software may not be called "jaxen" nor may "jaxen" appear in their names without prior written permission of The Werken Company. "jaxen" is a registered trademark of The Werken Company. 5. Due credit should be given to The Werken Company. (http://jaxen.werken.com/). THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. mule-2.0.1/distributions/server/src/main/resources/licenses/commons-jxpath.license0000644000175000017500000002644610205047630030366 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/wrapper.license0000644000175000017500000000344210477613664027107 0ustar charlescharlesCopyright (c) 1999, 2005 Tanuki Software Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of the Java Service Wrapper and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Portions of the Software have been derived from source code developed by Silver Egg Technology under the following license: Copyright (c) 2001 Silver Egg Technology Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. mule-2.0.1/distributions/server/src/main/resources/licenses/mx4j-remote.license0000644000175000017500000000471110462371572027573 0ustar charlescharlesThe MX4J License, Version 1.0 Copyright (c) 2001-2004 by the MX4J contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the MX4J project (http://mx4j.sourceforge.net)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The name "MX4J" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact biorn_steedom [at] users [dot] sourceforge [dot] net 5. Products derived from this software may not be called "MX4J", nor may "MX4J" appear in their name, without prior written permission of Simone Bordet. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE MX4J CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ====================================================================mule-2.0.1/distributions/server/src/main/resources/licenses/geronimo-spec-servlet.license0000644000175000017500000002644610462371572031662 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/geronimo-spec-saaj.license0000644000175000017500000002644610462371572031114 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/cryptix-openpgp-provider.license0000644000175000017500000000247210462371572032422 0ustar charlescharlesCopyright 1995-2001 The Cryptix Foundation Limited. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CRYPTIX FOUNDATION LIMITED OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.mule-2.0.1/distributions/server/src/main/resources/licenses/script-api.license0000644000175000017500000003112010545332216027457 0ustar charlescharlesSun Microsystems, Inc. ("Sun") ENTITLEMENT for SOFTWARE Licensee/Company: Entity receiving Software. Effective Date: Date of delivery of the Software to You. Software: Scripting for the Java Platform Reference Implementation 1.0. License Term: Perpetual (subject to termination under the SLA). Licensed Unit: Software Copy. Licensed unit Count: Unlimited. Permitted Uses: 1. You may reproduce and use the Software for Your own Individual, Commercial and Research and Instructional Use only for the purposes of designing, developing, testing, and running Your applets and applications ("Programs"). 2. Java Technology Restrictions. You may not create, modify, or change the behavior of, or authorize Your licensees to create, modify, or change the behavior of, classes, interfaces, or subpackages that are in any way identified as "java", "javax", "sun" or similar convention as specified by Sun in any naming convention designation. Sun Microsystems, Inc. ("Sun") SOFTWARE LICENSE AGREEMENT READ THE TERMS OF THIS AGREEMENT ("AGREEMENT") CAREFULLY BEFORE OPENING SOFTWARE MEDIA PACKAGE. BY OPENING SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF THIS AGREEMENT. IF YOU ARE ACCESSING SOFTWARE ELECTRONICALLY, INDICATE YOUR ACCEPTANCE OF THESE TERMS BY SELECTING THE "ACCEPT" BUTTON AT THE END OF THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS, PROMPTLY RETURN THE UNUSED SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND OR, IF SOFTWARE IS ACCESSED ELECTRONICALLY, SELECT THE "DECLINE" (OR "EXIT") BUTTON AT THE END OF THIS AGREEMENT. IF YOU HAVE SEPARATELY AGREED TO LICENSE TERMS ("MASTER TERMS") FOR YOUR LICENSE TO THIS SOFTWARE, THEN SECTIONS 1-6 OF THIS AGREEMENT ("SUPPLEMENTAL LICENSE TERMS") SHALL SUPPLEMENT AND SUPERSEDE THE MASTER TERMS IN RELATION TO THIS SOFTWARE. 1. Definitions. (a) "Entitlement" means the collective set of applicable documents authorized by Sun evidencing your obligation to pay associated fees (if any) for the license, associated Services, and the authorized scope of use of Software under this Agreement. (b) "Licensed Unit" means the unit of measure by which your use of Software and/or Service is licensed, as described in your Entitlement. (c) "Permitted Use" means the licensed Software use(s) authorized in this Agreement as specified in your Entitlement. The Permitted Use for any bundled Sun software not specified in your Entitlement will be evaluation use as provided in Section 3. (d) "Service" means the service(s) that Sun or its delegate will provide, if any, as selected in your Entitlement and as further described in the applicable service listings at www.sun.com/service/servicelist. (e) "Software" means the Sun software described in your Entitlement. Also, certain software may be included for evaluation use under Section 3. (f) "You" and "Your" means the individual or legal entity specified in the Entitlement, or for evaluation purposes, the entity performing the evaluation. 2. License Grant and Entitlement. Subject to the terms of your Entitlement, Sun grants you a nonexclusive, nontransferable limited license to use Software for its Permitted Use for the license term. Your Entitlement will specify (a) Software licensed, (b) the Permitted Use, (c) the license term, and (d) the Licensed Units. Additionally, if your Entitlement includes Services, then it will also specify the (e) Service and (f) service term. If your rights to Software or Services are limited in duration and the date such rights begin is other than the purchase date, your Entitlement will provide that beginning date(s). The Entitlement may be delivered to you in various ways depending on the manner in which you obtain Software and Services, for example, the Entitlement may be provided in your receipt, invoice or your contract with Sun or authorized Sun reseller. It may also be in electronic format if you download Software. 3. Permitted Use. As selected in your Entitlement, one or more of the following Permitted Uses will apply to your use of Software. Unless you have an Entitlement that expressly permits it, you may not use Software for any of the other Permitted Uses. If you don't have an Entitlement, or if your Entitlement doesn't cover additional software delivered to you, then such software is for your Evaluation Use. (a) Evaluation Use. You may evaluate Software internally for a period of 90 days from your first use. (b) Research and Instructional Use. You may use Software internally to design, develop and test, and also to provide instruction on such uses. (c) Individual Use. You may use Software internally for personal, individual use. (d) Commercial Use. You may use Software internally for your own commercial purposes. (e) Service Provider Use. You may make Software functionality accessible (but not by providing Software itself or through outsourcing services) to your end users in an extranet deployment, but not to your affiliated companies or to government agencies. 4. Licensed Units. Your Permitted Use is limited to the number of Licensed Units stated in your Entitlement. If you require additional Licensed Units, you will need additional Entitlement(s). 5. Restrictions. (a) The copies of Software provided to you under this Agreement are licensed, not sold, to you by Sun. Sun reserves all rights not expressly granted. (b) You may make a single archival copy of Software, but otherwise may not copy, modify, or distribute Software. However if the Sun documentation accompanying Software lists specific portions of Software, such as header files, class libraries, reference source code, and/or redistributable files, that may be handled differently, you may do so only as provided in the Sun documentation. (c) You may not rent, lease, lend or encumber Software. (d) Unless enforcement is prohibited by applicable law, you may not decompile, or reverse engineer Software. (e) The terms and conditions of this Agreement will apply to any Software updates, provided to you at Sun's discretion, that replace and/or supplement the original Software, unless such update contains a separate license. (f) You may not publish or provide the results of any benchmark or comparison tests run on Software to any third party without the prior written consent of Sun. (g) Software is confidential and copyrighted. (h) Unless otherwise specified, if Software is delivered with embedded or bundled software that enables functionality of Software, you may not use such software on a stand-alone basis or use any portion of such software to interoperate with any program(s) other than Software. (i) Software may contain programs that perform automated collection of system data and/or automated software updating services. System data collected through such programs may be used by Sun, its subcontractors, and its service delivery partners for the purpose of providing you with remote system services and/or improving Sun's software and systems. (j) Software is not designed, licensed or intended for use in the design, construction, operation or maintenance of any nuclear facility and Sun and its licensors disclaim any express or implied warranty of fitness for such uses. (k) No right, title or interest in or to any trademark, service mark, logo or trade name of Sun or its licensors is granted under this Agreement. 6. Term and Termination. The license and service term are set forth in your Entitlement(s). Your rights under this Agreement will terminate immediately without notice from Sun if you materially breach it or take any action in derogation of Sun's and/or its licensors' rights to Software. Sun may terminate this Agreement should any Software become, or in Sun's reasonable opinion likely to become, the subject of a claim of intellectual property infringement or trade secret misappropriation. Upon termination, you will cease use of, and destroy, Software and confirm compliance in writing to Sun. Sections 1, 5, 6, 7, and 9-15 will survive termination of the Agreement. 7. Java Compatibility and Open Source. Software may contain Java technology. You may not create additional classes to, or modifications of, the Java technology, except under compatibility requirements available under a separate agreement available at www.java.net. Sun supports and benefits from the global community of open source developers, and thanks the community for its important contributions and open standards-based technology, which Sun has adopted into many of its products. Please note that portions of Software may be provided with notices and open source licenses from such communities and third parties that govern the use of those portions, and any licenses granted hereunder do not alter any rights and obligations you may have under such open source licenses, however, the disclaimer of warranty and limitation of liability provisions in this Agreement will apply to all Software in this distribution. 8. Limited Warranty. Sun warrants to you that for a period of 90 days from the date of purchase, as evidenced by a copy of the receipt, the media on which Software is furnished (if any) will be free of defects in materials and workmanship under normal use. Except for the foregoing, Software is provided "AS IS". Your exclusive remedy and Sun's entire liability under this limited warranty will be at Sun's option to replace Software media or refund the fee paid for Software. Some states do not allow limitations on certain implied warranties, so the above may not apply to you. This limited warranty gives you specific legal rights. You may have others, which vary from state to state. 9. Disclaimer of Warranty. UNLESS SPECIFIED IN THIS AGREEMENT, ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. 10. Limitation of Liability. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event will Sun's liability to you, whether in contract, tort (including negligence), or otherwise, exceed the amount paid by you for Software under this Agreement. The foregoing limitations will apply even if the above stated warranty fails of its essential purpose. Some states do not allow the exclusion of incidental or consequential damages, so some of the terms above may not be applicable to you. 11. Export Regulations. All Software, documents, technical data, and any other materials delivered under this Agreement are subject to U.S. export control laws and may be subject to export or import regulations in other countries. You agree to comply strictly with these laws and regulations and acknowledge that you have the responsibility to obtain any licenses to export, re-export, or import as may be required after delivery to you. 12. U.S. Government Restricted Rights. If Software is being acquired by or on behalf of the U.S. Government or by a U.S. Government prime contractor or subcontractor (at any tier), then the Government's rights in Software and accompanying documentation will be only as set forth in this Agreement; this is in accordance with 48 CFR 227.7201 through 227.7202-4 (for Department of Defense (DOD) acquisitions) and with 48 CFR 2.101 and 12.212 (for non-DOD acquisitions). 13. Governing Law. Any action related to this Agreement will be governed by California law and controlling U.S. federal law. No choice of law rules of any jurisdiction will apply. 14. Severability. If any provision of this Agreement is held to be unenforceable, this Agreement will remain in effect with the provision omitted, unless omission would frustrate the intent of the parties, in which case this Agreement will immediately terminate. 15. Integration. This Agreement, including any terms contained in your Entitlement, is the entire agreement between you and Sun relating to its subject matter. It supersedes all prior or contemporaneous oral or written communications, proposals, representations and warranties and prevails over any conflicting or additional terms of any quote, order, acknowledgment, or other communication between the parties relating to its subject matter during the term of this Agreement. No modification of this Agreement will be binding, unless in writing and signed by an authorized representative of each party. Please contact Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, California 95054 if you have questions. mule-2.0.1/distributions/server/src/main/resources/licenses/commons-lang.license0000644000175000017500000002613610402140621027776 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/stax.license0000644000175000017500000002644610443721724026405 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/commons-logging.license0000644000175000017500000002644610205047630030516 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/src/main/resources/licenses/commons-attributes.license0000644000175000017500000002613510211352635031252 0ustar charlescharles Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. mule-2.0.1/distributions/server/pom.xml0000644000175000017500000000121611006063605020022 0ustar charlescharles 4.0.0 org.mule.distributions mule-distributions 2.0.1 mule-server pom Stand-alone Server full custom mule-2.0.1/distributions/scripting/0000755000175000017500000000000011351411006017174 5ustar charlescharlesmule-2.0.1/distributions/scripting/assembly.xml0000644000175000017500000000130610711610354021543 0ustar charlescharles yjp zip tar.gz false lib/user runtime backport-util-concurrent:backport-util-concurrent mule-2.0.1/distributions/scripting/pom.xml0000644000175000017500000000755211006063605020527 0ustar charlescharles 4.0.0 org.mule.distributions mule-distributions 2.0.1 mule-scripting-pack pom Mule Scripting Pack Support for additional scripting languages in Mule maven-assembly-plugin 2.1 ${pom.artifactId} assembly.xml false gnu package attached org.mule.tools mule-assembly-verifier verify verify ${pom.artifactId}.zip assembly-whitelist.txt javax.script jruby-engine 1.1 jdk14 javax.script jython-engine 1.1 jdk14 javax.script js-engine 1.1 jdk14 org.jruby jruby-complete 1.0 jython jython 2.1 rhino js 1.6R5 mule-2.0.1/distributions/scripting/assembly-whitelist.txt0000644000175000017500000000015110711650062023571 0ustar charlescharlesjruby-engine-1.1-jdk14 js-engine-1.1-jdk14 jython-engine-1.1-jdk14 jruby-complete-1.0 js-1.6R5 jython-2.1mule-2.0.1/distributions/profiler/0000755000175000017500000000000011351411006017014 5ustar charlescharlesmule-2.0.1/distributions/profiler/src/0000755000175000017500000000000011351410700017603 5ustar charlescharlesmule-2.0.1/distributions/profiler/src/main/0000755000175000017500000000000011351410700020527 5ustar charlescharlesmule-2.0.1/distributions/profiler/src/main/resources/0000755000175000017500000000000011351410700022541 5ustar charlescharlesmule-2.0.1/distributions/profiler/src/main/resources/lib/0000755000175000017500000000000011351410700023307 5ustar charlescharlesmule-2.0.1/distributions/profiler/src/main/resources/lib/native/0000755000175000017500000000000011351410700024575 5ustar charlescharlesmule-2.0.1/distributions/profiler/src/main/resources/lib/native/profiler/0000755000175000017500000000000011351411006026417 5ustar charlescharlesmule-2.0.1/distributions/profiler/src/main/resources/lib/native/profiler/libyjpagent-mac.jnilib0000644000175000017500000720621010754375733032714 0ustar charlescharles  ,  l__TEXT  __text__TEXT__cstring__TEXT\__textcoal_nt__TEXTZZ __const_coal__TEXT 0  __eh_frame__TEXT h__constructor__TEXTtt__destructor__TEXTtt__StaticInit__TEXTtt__const__TEXTL|L__literal8__TEXT؏ (؏ __DATA  __data__DATA  __dyld__DATAĞ Ğ __const_coal__DATA   __gcc_except_tab__DATAl sl __const__DATA`1 `1 __mod_init_func__DATAD4 \D4  __cfstring__DATA4 4 __common__DATA4 h3__bss__DATA@h __IMPORTp @ __jump_table__IMPORTp @ __pointers__IMPORT| pL 8__LINKEDIT |P | 0 G/var/tmp//ccdINKea.out `)vD7,/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation T)vD/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit 4)vD/usr/lib/libstdc++.6.dylib 4CD/usr/lib/libgcc_s.1.dylib 4)vDX/usr/lib/libSystem.B.dylib ` " @ P [# $ aؔ l ,$ iP  [X | ϊ X UEUS$uFEEEPED$ED$$҅t E$[]US41FEEEED$ED$$EЅt E*E$E ЋEuE$E EEEE4[]US4EED$$#[ t E5EE}u)D$$Z E}u EE@D$$Z E}4D$E$Z ‹EPDD$E$uZ ‹EP E@tpE@ tfEP E@T$$E}tE}u E@.TD$E$Z ‹EPE@tE@EEED$$Y EE4[]U8$Y E}uED$$Y E]MU ABABA EPEUEBED$$VY E}u EEEEEU8E@E}E;E EEPED$$X E@E}wAMUEu E*u E@EPE@ $ҋE$X $yX E}OEU(EEEE$DX E}t-E@EE@E@EED$$X E@tEE@$EЃ}t$W E}tED$E$E}tEUPED$$W USD)B\E܃}u EgE@u E@<uED$E܉$E7E@<E@tWE܋@EE܉D$$W E}t EEPEE D$T$ $EЉEE܋@EE܉D$$V E}t EE$EЉEE܋@EE܉D$$}V E}t ES$ ZV E}u E5MUBABAE D$ED$#$EЉEԋEԃD[]U(EEEE EED$E$?US$f@EEEb D$E$ $[]UVS/@UM ucb ~x7Jr[^]ÍD$ D$D$$jU D$ D$ UVS?UM ua ~x7Jr[^]Í[D$ D$sD$$T D$ D$ UE@]ÐUE@]ÐUS0?E x UB[]ÍD$ D$D$$T UWVu} FD$<$YT FD$<$OT } u^_]UWVS<>} E$NT E܋U$OT EE܅E;GG U܋$ T E䋃a U2:|YWtUJ:H|ECu$@T ƋED$U܉T$ |$ED$4$S <[^_]Ë` 8` 8` 8t UJ8Hu$gS ƋED$ U܉T$ED$4$R <[^_]ut UJ8H_Yu$S ƋUT$ E܉D$UT$4$R <[^_]&t UJ8H u$ R ƋED$U܉T$4$tR <[^_]Ëa 8P|NtUJ:H|<:u$IR ƋUT$ E܉D$UT$4$Q F` 8P|NtUJ8H<|:u$Q ƋED$ U܉T$ED$4$Q ` 8P|NtUJ8H<|:u$Q ƋUT$ E܉D$UT$4$7Q ` :}g` 8t UJ:Hu$ Q ƋUT$E܉D$4$P tUJ8H|u$P ƋED$ U܉T$ED$4$P ` 8P|NtUJ8H<|:u$jP ƋUT$ E܉D$UT$4$FP g` 8P|NtUJ8H<|:u$ P ƋED$ U܉T$ED$4$O $O ƋED$ U܉T$ED$4$O D$ D$OD$r$4O D$ D$Pԉlj4$O <$@O UE$]ÐUED]ÐUE@ ]ÐUE@ ]UWVS,.9uDV 1,[^_]E>EU܋EE;FF U<<$/O U 83|1tJ8H"| u<$N U :}EE;F|aYJ:H|؃u=2D$ D$OED$U܉$M JD$ D$PUT$E܉$M UWVSL8E @E~1U;EuM$MyM1 ;}M M̃9u1E ;xOU B 4>1$M uM$ 1$zL uMED$E$*L ƋE$K iMЉ9MA$L EȋUыRT$ UȉT$Q T$ $MA t$L UȋEP PM8u)< D$ D$OD$$J "D$ D$PԉNjE$J <$J NjE$J <$J lj4$J UWVSL4EE@t$MK E$E@~I1UTUȋEDEċUz4UB t$UȉU܋UĉUԉ}PE;p|ыUBETE܋@~:1UDŰEx4U܋B t$ỦUԉ}PE9p׋UBEDEԋ@~91U4UЋUԋB 4t4$EЉEI 4$wI U9zҋE@U4U؋B~*1U؋B 4t4$I 4$3I E9x؋UB^W U܉B t$I ZW UԉB t$I RW U؉B t$I VW UB tEL[^_]I L[^_]ÉƋ^W UBTU܋B t$YI ZW UBDUԋB t$8I RW UB4U؋B t$I VW UB t$H 4$>H UWVSLp2EE@t$H E$Ep~I1UTUȋEDEċUz4UB t$UȉU܋UĉUԉ}PE;p|ыUBETE܋H~:1UDŰEx4U܋B t$ỦUԉ}PE9p׋UBEDEԋP~91U4UЋUԋB 4t4$EЉEyG 4$F U9zҋE@U4U؋B~*1U؋B 4t4$G 4$F E9x؋UBT U܉B t$dG T UԉB t$GG T U؉B t$*G T UB tEL[^_]G L[^_]ÉƋT UBTU܋B t$F T UBDUԋB t$F T UB4U؋B t$F T UB t$|F 4$E UWVSL/UD$E $gE UBD$E $ME UBD$E $8E U$UBD$E $E Uz~\EU܅E;x.UB 4U T$4$P 4$PE;x|UB D$E $D UBD$E $D UBD$E $yD UBD$E $dD UB}4GD$E $>D G~B1U؍Eԅ;wU T$G $D ;w|ҋ}DGD$E $C G~B1UЍE̅[;wvU T$G $(D ;w|ҋuTFD$E $|C ~2L[^_]1UBD$E $SC U9r1UȍE&;~U T$F $C ;~}y֍D$ D$OUȉT$Eĉ$B D$ D$OED$U܉$B D$ D$PUT$E܉$B D$ D$OU؉T$Eԉ$}B D$ D$PڍD$ D$OUЉT$Ẻ$EB D$ D$PڍD$ D$PUWVS~,EPx$xi;WG 44$P4$B …x3;G}XG 44$Pu[^_]A D$ D$OD$J$lA D$ D$PԍD$ D$D$J$.A D$ D$ԍD$ D$D$ D$UWVS\V+E$EM UB$MAA $(rA UB M4MM UB4AA $(:A MA EDEM UBDMAA $(@ UB MTMM UBTAA $(@ MA E $*@ UM $ @ UBM $? 12EЋEP@ U $? EąOMQ;QMA Q}U $? MA E $? UBM $n? UBM $U? UB$? MAI~=E}4E $? UB8/EM؋U;J|ʋM $> Eȃ1MA 4BA9}$> ƋED$U T$4$(? MQ;QuMA$ ? E܋UыRT$ U܉T$Q T$ $MA t$> U܋EP PMA 4BA9}\E $> ẼfMA E $= EЃ\[^_]E4$PtDEE9EE $> ƋMQ;QtIMA 4Q4$PuEP;PtwMA BAEA TA$= NjUыRT$ |$Q T$ $UB t$= My QbMA$j= ƋUыRT$ t$Q T$ $UB t$[= Mq Q11 9}$(< ƋUT$M L$$< EP;Pt+MA 4BAEx u4$< UB 뚍MA$< EUыRT$ UT$Q T$ $MA t$< UEP Pv1MA D$ D$1똍zD$ D$?넍jD$ D$9mD$ D$MVNjM UB t$: M MA t$: <$9 ׉NjM UB t$m: M MA t$P: ylj4$`9 뵉ΐUWVS\#E$E F UB$MAA $(9 UB M4MF UB4AA $(9 MA EDE$F UBDMAA $(a9 UB MTM(F UBTAA $()9 MA E $8 UM $m8 UBM $\8 12EЋEP@ U $<8 EąOMQ;QMA Q}U $7 MA E $7 UBM $7 UBM $7 UB$98 MAy~=E}4E $v7 UB48/EM؋U;J|ʋM $I7 Eȃ1MA 4BA9}$>7 ƋED$U T$4$7 MQ;QuMA$l7 E܋UыRT$ U܉T$Q T$ $MA t$Y7 U܋EP PMA 4BA9}\E $i6 ẼfMA E $?6 EЃ\[^_]E4$PtDEE9EE ${6 ƋMQ;QtIMA 4Q4$PuEP;PtwMA BAEA TA$$6 NjUыRT$ |$Q T$ $UB t$6 My QbMA$5 ƋUыRT$ t$Q T$ $UB t$5 Mq Q11 9}$(5 ƋUT$M L$$!5 EP;Pt+MA 4BAEx u4$<5 UB 뚍MA$ 5 EUыRT$ UT$Q T$ $MA t$4 UEP Pv1MA 2 ׉Nj(F UB t$2 $F MA t$2 ylj4$1 뵉ΐUWVS,E$Ex~P*UM܅M;yMA 4t 4$PtNU9z$ 1 NjM L$$02 EP;Pt0MA E;pUB D$ D$D$$) Ɖ<$) 4$* UWVSE;p UB  D$ D$U E] UWVS,vUB D$E $ UBD$E $ UBD$E $ UB}0GD$E $ G~B1U䍃BE;wU T$G $9wҋu FD$E $4 F3,[^_]1UBD$E $6 U;r|M1U܍BE";~}}U T$F $ ;~}yڍzD$ D$OU܉T$E؉$ zD$ D$OUT$E$ D$ D$PڍD$ D$PUWVS<} G 1<[^_]1U̥U܍U؍إUԅx]9}zG E$ ‹EHx~;Q# D$A $b uG9wEqED$ D$OU܉T$E؉$ UԉT$ D$PE܉D$U؉$j UT$ D$O݋EԉD$ D$PUWVS<} G 1<[^_]1UU܍xU؍ȤUԅx]9}zG E$ ‹EHx~;Q" D$A $R uG9wEqED$ D$OU܉T$E؉${ UԉT$ D$PE܉D$U؉$Z UT$ D$O݋EԉD$ D$PUWVS<U M0Au Fd<[^_]1*;Q A )u 0pp9Q~yҍD$ D$OD$h$ 1EE܍hE؍E ;~hxW;~}sF E$p ‹EHx5;Q}Q! D$A $ tE D$E$E 뙋ut$ D$OE܉D$u؉4$ EԉD$ D$Pu܉t$E؉$ D$ D$PD$ D$D$h$ $D$ D$ԐUWVS<uED$t$U$f MEA MЋN UB AA $( MЉA E0EԋR UB0MAA $( UԉB u1M $ UB M $ UBOM $ UB"=B$$ MAIE $m E؃1MԋA 4BA9}$b ƋU T$$MԋQ;QuMԉA$ EUԋыRT$ UT$Q T$ $MԋA t$ UEԉP PMԋA 4BA9}cE $ E܃/<[^_]1ExU $J M;q|1U̍M&MЋQ;QMЋA 4BA9}tED$U $ Ɖ$ ‹EH;Q2 D$A $A t4$ M)ȃD$E$ t4$PuA$ EUЋыRT$ UT$Q T$ $MЋA t$  UEЉP P D$ D$PẺD$Uȉ$ D$ D$OỦT$Mȉ $ ~D$ D$ΣD$$ ~D$ D$ԍʡD$ D$ΤD$ D$묍D$ D$$똍D$ D$넍D$ D$mD$ D$VNjR UԉB t$ N MЉA t$  U<$ lj4$ 뤉뽉UWVS<uED$t$U$ MEA MЋ~ UB AA $( MЉA E0Eԋ UB0MAA $( UԉB E1M $  UB M $ UBOM $ UB"=B$T MAyE $ E؃1MԋA 4BA9}$ ƋU T$$MԋQ;QuMԉA$ EUԋыRT$ UT$Q T$ $MԋA t$ UEԉP PMԋA 4BA9}cE $ E܃/<[^_]1ExU $z M;q|1U̍ڜM&MЋQ;QMЋA 4BA9}tED$U $ Ɖ$$ ‹EH;Qb D$A $q t4$ M)ȃD$E$ t4$PuA$N EUЋыRT$ UT$Q T$ $MЋA t$; UEЉP P *D$ D$PẺD$Uȉ$ D$ D$OỦT$Mȉ $ D$ D$D$ڜ$ D$ D$ԍD$ D$D$ D$묍FD$ D$$똍ҟD$ D$넍D$ D$mD$ D$VNj UԉB t$ ~ MЉA t$ B U<$ lj4$ 뤉뽉UWVS,>}D$ ED$<$  E GG E䋃 G UBB $(8 UB w0 G0FF $( F GG $ GG,[^_]ÉEr E$- E F t$  UB t$ 뮉EUWVS,}D$ ED$<$ E GG E䋃 G UBB $( UB w0 G0FF $( F GG $ GG,[^_]ÉER E$  E F t$  UB t$ 뮉EUWVS, UBt$X E E@~"1UB t$PE;p|UBu0FTFr F t$ n UB t$ 2 U,[^_]1F $ ;~|뒉Ƌr UB0B F t$ : UB t$  U,[^_]1F $ ;~|뒉Ƌ> UB0B ]UWVS, E䋃2  EP t=B<9t!GGNj$ E9x uGE,[^_] ,[^_]ÐU] UE D$E$y UWVS<U1у:[ E1D$; BwqNFt]|$4$t! Bt1D1 FD$4$BD$4$:D$4$2D$4$*D$4$UB< wƒ0]ÍB<wƒW]ÍB<wƒ7]ø]ÐUWVUD$U T$U$D$D$$ ƋU|$U T$U$^_]UE$ ÐUVS0-uu0[^]E  ED$t$$ED$E D$ED$ t$mD$ $ $ E$D$ D$D$$ UVS oE 1ED$ EU D$T$ $D$ߎT$$E [^]US  ED$$D$T$$[]USV D$E$R[]ÐUS* D$E$R []ÐUU  ]UU E ÐUU  UU  UWV u} tDt*t'8u\u*tP1 ^_]Ã<*tu ^_]Ë}GE|$4$uۀu1 ^_]ÉP*tUMfEUWVSdu} 8tD|$ U T$D$4$|$ U T$D$4$[^_]Ë|$ U T$D$4$[^_]ÐUWVUD$U T$U$D$D$$ ƋU|$U T$U$^_]ÐUWVSLpuE81$ EUu8u)$i E‰uMUuuMtm8tBu4$}EԋE$R U$G EԃL[^_]ËE8u+E?ME8urMyuE821ɋE8=1:9 U:/190)΋}5?r19F$Q E؅~1:M؈ 9uE0E؀81E؀81҉$ EE}S1҉9EG|ƒEЋUԋM܈D E؀8t8u+U똃8u+ME88u+E:u+U8u+EبM $Eԋu؉4$_ 8u+UEEԃL[^_]É8u)uԉ4$ E$,E렍D$ D$/D$<$ D$ D$.ԍ,D$ D$TD$ D$a묍D$ D$똍DD$ D$넍D$ D$`mƋE؉$X U$M M $B 4$g ڐU]UWV}u D$4$& GE u^_] USVE ~U;B[]ÍD$ D$RD$"$ UE@]ÐUVSM EPx&;Q}KA 44$PuLu[^]r D$ D$O D$ł$* D$ D$PԍyD$ D$#D$ł$ UVSQu4$ - E $ F~[^]ÍeD$ D$MD$$ $ UVSu4$4 E $s F~[^]ÍD$ D$׆D$$ s $2 UWVSdu} 4$ @ ~ ~[^_]Í؂D$ D$ `D$0$ $ UWVSu} 4$J г ~ ~[^_]ÍhD$ D$ D$$3 $R U]UWV}u D$4$ GD$4$ GE u^_] UWVS8u} 4$ , <$ F<$ F[^_]Ë $ UWVSu} 4$8 ֲ <$ F<$~ F[^_]Ëz $[ U ]UWV}u D$ 4$" GD$4$ GE u^_] USBME U~!~G;At1[];Qu[]ÍfD$ D$vD$$x D$ D$UWVSu} 4$ Ա <$` F~<$Q F~2[^_]Í0D$ D$D$~$ DD$ D$ԋ` $ UWVS,u} 4$ 8 <$ F~<$ F~2[^_]ÍD$ D$`D$}$T D$ D$ԋ $_ UWVSu} 4$ ~E~;~EF[^_]ÍD$ D$ ĂD$\}$ D$ D$ ԋ( $ UWVSu} 4$T ~U~;~EF[^_]Í"D$ D$ 2D$|$0 ND$ D$ ԋ $; U]UWV}u D$4$ GE u^_] UVS1u4$ U E $ F[^]Ë $ UVSu4$B E $ F[^]Ë $n U]UUE 9B]UWV}u D$4$" GE u^_] UVSQu4$ E $ F[^]Ë $ UVS u4$b E E $ F[^]Ë $ UVSu4$ E F[^]ÐUVSu4$ ϭ E F[^]ÐU ]UWV}u D$ 4$ GD$4$ GE u^_] UWVS} EPx.;W}SG 44$P uT|$4$U [^_]ÍzD$ D$O(zD$y$A 4zD$ D$PԍD$ D$4D$y$ UWVSfu} 4$ <$ F~<$ F~2[^_]Í~D$ D$:D$2y$ ~D$ D$ ԋ $ UWVSu} 4$  <$b F~<$S F~2[^_]Í2~D$ D$~D$x$ F~D$ D$ ԋb $ UWVS.} EPx.;W}SG 44$PuT|$4$f [^_]Í2xD$ D$O>xD$w$W JxD$ D$Pԍ&~D$ D$$~D$w$ UWVS|} EPx.;W}SG 44$P uT|$4$ [^_]ÍwD$ D$OwD$Hw$ wD$ D$Pԍ}D$ D$,P}D$Hw$g UWVSL}|$E $ƅ88u)$ Eu|$U $ƅ8d1$ Eu|$E $ƅ801$[ E܉uu܅U܀:1|UЃ8uUU)ЍD8$ E؉uUMuu؋}U'E؀8EE81UȍD$ EԉuUUuuԅUԀ:v1E8u+EčD$7 EЉuUMuuЋ}vEEЀ8EE8)1U̍D$ uE̍uU EЉ$ Uԉ$ E؉$ U܉$ E$ U$ EL[^_]8u)8u)16E܃8u+}E؃8u+E؉EȋE8LE8u+E;Eԃ8u+}wEЃ8u+EЉE̋E8E8u+EJ{D$ D$qN{D$v$ J{D$ D$qN{D$v$ |D$ D$-N{D$v$W |D$ D$-N{D$v$- J{D$ D$qN{D$v$ |D$ D$-N{D$v$ }D$ D$.뀍|D$ D$-N{D$v$ }D$ D$.ԉƋU$ E$t 4$ ƋE܉$_ ӉƋEԉ$P U؉$E ىƋUЉ$6 ى뭐U]UWV}u D$4$ GD$4$ GE u^_] UWVS>u} 4$ <$ F<$ F[^_]Ë $ UWVSu} 4$> T <$ F<$ F[^_]Ë $a U ]UWV}u D$ 4$( GD$4$ GE u^_] USHME U~!~G;At1[];Qu[]ÍluD$ D$ vD$p$~ uD$ D$!UWVS} EPx.;W}SG 44$P uT|$4$ [^_]ÍoD$ D$OoD$o$ oD$ D$PԍbuD$ D$BvD$o$ UWVSu} 4$r <$ F~<$ F~2[^_]ÍtD$ D$ \uD$n$D tD$ D$ ԋ $O UWVSu} 4$  <$ F~<$ F~2[^_]ÍsD$ D$ tD$Ln$ sD$ D$ ԋ $ UWVSu} 4$: h ~E~;~EF[^_]ÍsD$ D$$tD$m$ 4sD$ D$ԋ| $! UWVSRu} 4$ ֠ ~U~;~EF[^_]ÍvrD$ D$sD$m$ rD$ D$ԋ $ UWVS} EPx.;W}SG 44$PuT|$4$ [^_]ÍlD$ D$OlD$l$ lD$ D$PԍrD$ D$2sD$l$ UWVS} EPx.;W}SG 44$P uT|$4$P [^_]ÍlD$ D$OlD$k$7 *lD$ D$PԍqD$ D$:NrD$k$ UWVSL\}|$E $nƅ88u)$s Eu|$U $ƅ8d1$0 Eu|$E $ƅ801$ E܉uu܅U܀:1qUЃ8uUU)ЍD8$ E؉uUMuu؋}E'E؀8EE81UȍD$% EԉuUUuuԅUԀ:v1E8u+EčD$ EЉuUMuuЋ}vMEЀ8EE8)1U̍D$U uE̍uU EЉ$_ Uԉ$T E؉$I U܉$> E$3 U$( EL[^_]8u)8u)16E܃8u+}E؃8u+E؉EȋE8LE8u+E;Eԃ8u+}wEЃ8u+EЉE̋E8E8u+EoD$ D$qoD$(k$= oD$ D$qoD$(k$ qD$ D$-oD$(k$ qD$ D$-oD$(k$ oD$ D$qoD$(k$ qD$ D$-oD$(k$k qD$ D$.뀍qD$ D$-oD$(k$- qD$ D$.ԉƋU$ E$ 4$+ ƋE܉$ ӉƋEԉ$ U؉$ ىƋUЉ$ ى뭐U ]UWV}u D$ 4$ GD$4$w GE u^_]c USME U~!~G;At1[];Qu[]ÍFgD$ D$.lD$e$ VgD$ D$UVSYM EPx&;Q}KA 44$PuLu[^] ]eD$ D$OieD$%e$ ueD$ D$PԍkD$ D$+kD$%e$L UWVSu} 4$ L <$H F~<$9 F~2[^_]ÍiD$ D$ kD$|d$ \kD$ D$ ԋH $ UWVSu} 4$j <$ F~<$ F~2[^_]Í(iD$ D$pjD$c$< jD$ D$ ԋ $G UWVSxu} 4$  ~E~;~EF[^_]ÍdD$ D$ iD$Dc$ dD$ D$ԋ $ UWVSu} 4$< ~U~;~EF[^_]ÍZdD$ D$ BiD$b$ jdD$ D$ԋ~ $# UVSUM EPx&;Q}KA 44$PuLu[^] YbD$ D$OebD$!b$ qbD$ D$PԍbD$ D$%hD$!b$H UJ E]Uֽ2 E]ÐUWVSzu4$ ƒ w@RR`"AT$>h$ RhD$ D$VhD$Fa$z $ ljt$$T [^_]$ ljt$$: $ ljt$$ $ l ljt$$% $ P ljt$$ $4 ljt$$ g$  ljt$$ H$ ljt$$ )$ ljt$$^ $ ljt$$l $ ljt$$H Ɖ<$' 4$L U]UWV}u D$4$ GE u^_] US2E ~U;B[]Í*fD$ D$:fD$^$} UVSu4$: E $y F~[^]ÍfD$ D$eD$^$ y $8 UVSku4$  E $ F~[^]ÍeD$ D$seD$7^$  $ UWVSu} 4$J ~ ~[^_]ÍdD$ D$ dD$]$3 $R UWVS脹u} 4$ 8 ~ ~[^_]Í|dD$ D$ dD$P]$  $ U]UWV}D$E $ GD$E $l G^_]1GD$E $r 9w^_]ÐUE]ÐUEHE 88|'tJ8H'|u1]ø]ø]UWVS,<}<$  GE$h GU 9Ut:G$ E 0>uS1$8 uU E Ѐ:u 1G,[^_]Ã8u)ЉG,[^_]É8u)롉ƋU$ 4$1 UWVS<^}<$ * GE$ GU $ GuD$E D$4$ 9ut8G$ u>u81$8 uUԉ E$W e[^_]É8u)뼉ƋE$4 Uԋ$' 4$A ܉UWVSu81$D uUԉ E$c e[^_]É8u)뼉ƋE$@ Uԋ$3  4$M ܉UWVS,v}<$ B GE$ GU 9Ut:G$ E 0>uS1$r uU E Ѐ:u 1G,[^_]Ã8u)ЉG,[^_]É8u)롉ƋU$Q  4$k UE UR U E] U´j E] UVSiuED$ED$4$ M E $ F ~[^]Í_D$ D$ _D$5X$ $ UVSuED$ED$4$m ɋ E $o F ~[^]Í)_D$ D$ E_D$W$  $. UWVS]E EUcD$U$ EMmcD$ cD$ut$ $Ƌ}<$P<Xt$ED$U$ EM $P<} }Ѝ_Emb|`t`l} }EEЋ@\EƋ}t FO)ȅu"E }9}}uuЋv\}MЋD$AD$ ut$\|$E$RU$P u,[^_]) $c $<W $K $? $=3 ཋQQ녍[D$ D$V[D$K$ Ƌ $螾 4$% UWVSFFl$K uF DuQ,7Ƌ $ 4$j UWVS,蜓p $ Et x;} $ H @,$Rp8N1PH @@$$Rp8F<PH @p E,[^_] t B u<t;9:A,uU䋓t B$6 UU䋓t B$ $覨 F~1ɍ;N|$趧 >FF $S V~1ɍ;N|$c >FF|$ uF DuQ$蹧 uF DuQƋp $Q 4$ئ UVS ߳ $j 8 ˳ Qd ߳ E[^] Ƌ߳ $ 4$| UWVS|讐ED$ Z D$UT$MM $輨 $ ^ EE E$ 裦 EE EȋEE܋E€Utz 1҉ tlE z;}~W B uĀ<0 09t5A,u싋 AUĀxDu$EȉE 뛋MD$UT$ $MȉMxEED$$D$ UT$D$D$D$ML$ EȉED$Z D$U$2 D$M $e @}tyz 1҉ tfE x;}~Q A u< 09t/A,u싋 AUxDu$衦 롋UD$ ML$UT$M $| EȋE$蓦 ^ EȋEԉ$ԣ $d M $J |[^_]ËUFUXƋ^ EȋEԉ$芣 $ E$ 4$薣 Ƌ EȋU$ 뭉ʐUWVS衍- D$$;P<D$E$( EMBD$ Ct$ED$ $EY<D$E$ܤ EMaCD$ t$ED$ $EzUD$ ML$ RT$U$EEE z;}QE y;} Au< 09A,uU A 4u؅tU؋B$赡 M؋At$裡 }؃w"EW E܋4t $t F$i 4$a W EM;O|G t$ E؉$) y;} $ MUT$ $P\MUT$ $P\Eļ[^_]Ë BUр<tƃ9F,uME A UȃUBE̋UD$ ML$ỦT$M $EЅ}̅EEԅHMԋE;HcUB Mԋ4D$E$D NjFD$U$0 VT$D$D$|$ ML$ED$U$x …TMT$ UԉT$MЉL$U$EM9MHEȋ@EUȋr zBD$M $蟡 EUȋBD$M $臡 UЉT$PML$LD$HD$Dt$<|$@UT$8D$0D$4D$(D$,D$ D$$D$D$D$MȋQD$ T$ED$UT$M $e …huăMT$ UĉT$ML$U$u>UW D$ D$ICD$M $襠 ERD$ D$!CD$U$t E!D$ D$-C뜍1D$ D$O1D$m1$违 1D$ D$PD$ D$9CD$E$ BD$ D$?uAD$m1$W D$ D$AC D$ D$UCD$E$~ E+UVS oC $Ο U D$$D ED$E$ ƋE$軜 C $K e[^]ÉƋC $2 4$蹜 ƋE$ UEڃN]UWVS,ʆ}1t $P@ut$ wTt*4$[ F t$ 4$ wXt4$> 4$m 4$ w\t4$3 4$ʛ GE,[^_]鸛 E䋃 F t$| G$萛 E$貛 EE4$ UWVS,҅}1t $P@ut$ wTt*4$c ƨ F t$ 4$ wXt4$F 4$u 4$ w\t4$; 4$Қ GE,[^_] E䋃ƨ F t$脛 G$蘚 E$躚 EE4$ UWVPD$E D$UB\$I EE,}8MIU;P"EMAL$R 9EMqL}}E܉E;~|}$蔚 E~1U9EuF~1ɍ}89N$莙 EUVV}83$  @@ u1ҋF FDFD u }U;P‹EB}GP^_]Ë}wLF$ߛ U%E;V}7}8}M؉JEB}GP^_]ÃU$4 EE~1M;Eu~~1ɍ<}ċ:E8;N|$( UMNN}8W$ 趘 @@ u1ҋF  FD FD  u URUWVSLm ]EY0D$48D$}ԉ<$ }u41$ Ɖ‰uE0EL[^_]8u)UWVSuDž(Dž,E$$蚗 UBB$ MAQ $4 D$$ } wDž,Dž(G,G((,F VF$ GF~1ҋF9|F7D$G0$o Uz$8L D$ D$A)D$4$a Ep$8 D$ D$7D$4$˜ Ur$@ D$$ wG(G(@@@ @FFFFF F$͕ GF~1ҋF9|F7D$G<$; My $P D$ D$8D$4$ Ep$$L D$ D$ 8D$4$ Ur($@謔 D$ D$8D$4$託 Mq,$@v D$$ wG(G(@@@ @FFFFF F$c GF~1ҋF9|F%8D$G<$і Ex0$@讓 D$$跖 wG(G(@@@ @FFFFF F$蛓 GF~1ҋF9F58D$G<$ Ex4$0 D$$ y wG(F F$ GF~1ҋF9F=8D$G,$| Ex8$<Y D$$b wG(G(@@@ FFFF F$T GF~1ҋF9FM8D$G8$” Ex<$@蟑 D$ D$Y8D$4$葔 Ep@$<i D$ D$e8D$4$G UrD$@3 D$$< u wG(G(@@@ @FFFFF F$ GF~1ҋF9Fq8D$G<$莓 MyH$8k D$$t wG(G(@@FFF F$t GF~1ҋF9|F}8D$G4$ ExL$d迏 Nj w GFF $( F FF 1UD uwEDžxE|UUMMEEUĉ UMȉMẺEUЉUMԉME؉EU܉UMMMMG(G( @uN@F}䋃 D$<$ PU9t<@$赇 u>h1$Z u}E$y $h‡ D$D$ D$|$)D$4$蚈 [ 0$hx D$D$ D$|$)D$4$V 0 pLF$܉ M%E;N }8lMI1$"n uEt<$!n E[^_]8u)붍D$ D$qD$$l `D$ D$(D$$l UU E]ÐUU E]ÐUWV E0} V;VtF BF ^_]ÍF$7m EFD$ ED$F D$4$F t$,m MN VF BF ^_]UWVSV}E t`|1[^_]1U 2D$E$99u[^_]ÍD$ D$D$X$k D$ D$UWVu} ƉD$4$%E u^_]UWVu} D$4$%D$4$ƉD$4$n%E u^_]VUSlUD$ D$| T$$?m []UWV $`k Ɖ$jn ^_]ÉljU}t<$j ljU4$j <$,n ErGn 11뼉:n UWVut4$n u^_]Dj ^_]UV1} D$ ED$ED$E@T$m ^]Éƃt4$%j $m Em 1҉m ֐UV$ED$ED$ E$D$E D$E@X$_m $^]Éƃt4$i $.m EtIm 1҉>m UVEE$Wl ^]Éƃt4$hi $l E l 1҉l UVE@T$l ^]Éƃt4$i $l El ԉl UVE@X$zl ^]Éƃt4$h $Dl E_l ԉVl UWV Uu}tOET$UT$$Gk ,D$ED$G\$)k ƋE$)h e^_]1e^_]ÉƉ׋E$h t4$&h Ɖ4$k Ek 1뱉k UWV@UEpLEU;F})}8MIEB@^_]ÃE$+h EUԅ~1U9EuF~1ɍ}89N$"g EUԉVVe$ g @@ u1ҋF FDFD u }ƃt4$f $6j E|Qj Ej ՐUWV@UExEU;G}5uu0UЋ@D$u4$Uh @^_]ÃE$f Euԅ~1U9EuO~1ɍu09O$e EUԉWWY$Tf ƺ@uG WDTuU4Uƃt4$de $h Eh 1h ӐUWV@UEpEU;F})}8MIEB@^_]ÃE$ke EEԅ~1U9Eu~~1ɍ}89N$bd EUԉVVe$ d @@ u1ҋF FDFD u }ƃt4$d $vg Eg g ՐUWV@UEp EU;F})}8MEB @^_]ÃE$ d EEԅ~1U9EuF~1ɍ}89N$c EUԉVVe$c E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$b $e E:f f ՐUWV@UEpEU;F})}8MIEB@^_]ÃE$b EEԅ~1U9EuF~1ɍ}89N$a EUԉVVe$ b @@ u1ҋF FDFD u }ƃt4$$a $d Ed d ՐUWVPUu} u}Ep$}U;~}/}8MɍUMPH P^_]Ã}ĉ$a E~1U9EuF~1ɍ}89N$` EUĉVV`$$` E@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uu4}ƃt4$`_ $b Eb b ՐUWV@UEp(EU;F}*}8eMEB @^_]ÃE$h_ EMԅ~1U9EuV~1ɍ}89N$_^ EUԉVVd$ ^ E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËUeUUƃt4$] $*a EpEa 9a ՐUWVPUu} u}Ep,}U;~}/}8MUMP HP^_]Ã}ĉ$] E~1U9Eu~~1ɍ}89N$\ EUĉVV`$C] E@@@ @u1ɋUF FBFBFB FBuՋu4}ƃt4$(\ $_ E_ _ ՐUWV@UEp0EU;F})}8MP@ @^_]ÃE$1\ EEԅ~1U9EuF~1ɍ}89N$([ EUԉVVe$[ E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$Z $$^ Ej?^ 11/^ ѐUWV@UEp4EU;F})}8MEB@^_]ÃE$Z EEԅ~1U9EuF~1ɍ}89N$Y EUԉVVe$JZ E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$,Y $\ E\ \ ՐUWVPUu} u}Ep<}U;~}-}8eEUMPH P^_]Ã}ĉ$#Y E~1U9EuF~1ɍ}89N$X EUĉVVb$X @@@ u1ҋF FDFDFD uڋ eu1ƃt4$W $"[ Eh=[ 1[ ՐUWVPUu} u}Ep@}U;~}/}8MUMP HP^_]Ã}ĉ$W E~1U9EuF~1ɍ}89N$V EUĉVV`$;W E@@@ @u1ɋUF FBFBFB FBuՋu4}ƃt4$ V $Y EY Y ՐUWVPUu} u}EpH}U;~}/}8MUMP HP^_]Ã}ĉ$V E~1U;EuV~1ɍ}9N$U EUĉVV`$U E@@@ @u1ɋUF FBFBFB FBuՋu4}ƃt4$T $X EHX X ՐUWVPEE؁} gfffEE)9UM؋APpMM}};NjMĉ$T E}ą~1U;EuN~1ɍ}9N$S EUĉVVMM$8 T E1@ u8u1ɋUF FBFBFB FBF BF$BF(BF,B F0B$F4B(F8B,FF UWV@UEpEU;F})}8MIEB@^_]ÃE$B EEԅ~1U9EuF~1ɍ}89N$A EUԉVVe$ ZB @@ u1ҋF FDFD u }ƃt4$`A $D ED D ՐUWV@UEp,EU;F})}8MP@@^_]ÃE$iA EEԅ~1U9EuF~1ɍ}89N$`@ EUԉVVe$@ E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$? $\C EwC 11gC ѐUWV@UEp,EU;F})}8MP@ @^_]ÃE$? EMԅ~1U9EuV~1ɍ}89N$> EUԉVVe$? E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$p> $A E(A 11A ѐUWVPUu} u}Ep,}U;~}/}8MUMPHP^_]Ã}ĉ$a> E~1U9Eu~~1ɍ}89N$[= EUĉVV`$= E@@@ @u1ɋUF FBFBFB FBuՋu4}ƃt4$< $N@ Ei@ ]@ ՐUWV@UEpLEU;F}&}8MI@@^_]ÃE$< EEԅ~1U9EuF~1ɍ}89N$; EUԉVVh$ {< @@ u1ҋF FDFD u }ƃt4$; $> E9? 1? UWV@UEpLEU;F})}8MIEB@^_]ÃE$; EEԅ~1U9EuF~1ɍ}89N$: EUԉVVe$ ; @@ u1ҋF FDFD u }ƃt4$": $= E= = ՐUWV@UEpLEU;F}&}8MI@@^_]ÃE$.: EEԅ~1U9EuF~1ɍ}89N$%9 EUԉVVh$ 9 @@ u1ҋF FDFD u }ƃt4$8 $9< ET< 1F< UWV@UEp<EU;F}$}8eE@@^_]ÃE$8 EMԅ~1U9EuV~1ɍ}89N$7 EUԉVVj$g8 @@@ u1ҋF FDFDFD uڋ e}9ƃt4$^7 $: E: 1: ӐUWV@UEp<EU;F}*}8eMEB@^_]ÃE$d7 EEԅ~1U9Eu~~1ɍ}89N$[6 EUԉVVd$6 @@@ u1ҋF FDFDFD uڋ e}9 ƃt4$5 $`9 E{9 o9 ՐUWV@UEp<EU;F}'}8eEP @@^_]ÃE$5 EEԅ~1U9EuF~1ɍ}89N$4 EUԉVVg$5 @@@ u1ҋF FDFDFD uڋ e}9 ƃt4$4 $7 E;8 118 UWV@UEp@EU;F})}8MP@@^_]ÃE$4 EEԅ~1U9EuF~1ɍ}89N$3 EUԉVVe$4 E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$ 3 $|6 E6 116 ѐUWV@UEp@EU;F})}8MP@ @^_]ÃE$3 EUԅ~1U9EuF~1ɍ}89N$2 EUԉVVe$2 E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$1 $5 EH5 11 5 ѐUWVPUu} u}Ep@}U;~}/}8MUMPHP^_]Ã}ĉ$1 E~1U9EuN~1ɍ}89N${0 EUĉVV`$1 E@@@ @u1ɋUF FBFBFB FBuՋu4}ƃt4$/ $n3 E3 }3 ՐUWV@UEp0EU;F})}8MEB@^_]ÃE$0 EEԅ~1U;Eu~~1ɍ}9N$. EUԉVVe$/ E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$z. $1 E22 1 ՐUWV@UEp0EU;F})}8MEB@^_]ÃE$. EEԅ~1U;EuF~1ɍ}9N$z- EUԉVVe$. E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$, $j0 E0 y0 ՐUWVPUu} u}Ep0}U;~}/}8MUMP HP^_]Ã}ĉ$, E~1U;EuF~1ɍ}9N$+ EUĉVV`$, E@@@ @u1ɋUF FBFBFB FBuՋu4}ƃt4$h+ $. E . . ՐUWV@UEp0EU;F}&}8M@@^_]ÃE$t+ EEԅ~1U9EuF~1ɍ}89N$k* EUԉVVh$+ E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$) $g- E譾- 1t- UWV@UEp0EU;F}&}8M@@^_]ÃE$* EMԅ~1U9EuV~1ɍ}89N$( EUԉVVh$) E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$( $+ E9, 1, UWV@UEpHEU;F}&}8M@@^_]ÃE$( EEԅ~1U9Eu~~1ɍ}89N$' EUԉVVh$( E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$ ' $* EŻ* 1* UWV@UEpHEU;F}&}8M@@^_]ÃE$' EEԅ~1U9EuF~1ɍ}89N$& EUԉVVh$& E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$% $ ) EQ&) 1) UWV@UEpHEU;F})}8MP@ @^_]ÃE$% EEԅ~1U9EuF~1ɍ}89N$$ EUԉVVe$4% E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$"$ $' Eڸ' 11' ѐUWV@UEpHEU;F})}8MEB@^_]ÃE$'$ EUԅ~1U;EuF~1ɍ}9N$# EUԉVVe$# E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$" $& ET)& & ՐUWV@UEpHEU;F})}8MEB@^_]ÃE$" E}ԅ~1U;EuN~1ɍ}9N$! EUԉVVe$8" E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$! $$ Eҵ$ $ ՐUWV@UEp EU;F}&}8M@@^_]ÃE$&! EEԅ~1U;EuF~1ɍ}9N$ EUԉVVh$ E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$ $# E_4# 1&# UWV@UEp EU;F}&}8M@@^_]ÃE$ EEԅ~1U;EuF~1ɍ}9N$ EUԉVVh$E E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$3 $! E! 1! UWV@UEp EU;F}&}8M@@^_]ÃE$> EEԅ~1U;EuF~1ɍ}9N$5 EUԉVVh$ E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$ $1 EwL 1> UWV@UEp EU;F}&}8M@ @^_]ÃE$ EMԅ~1U;EuV~1ɍ}9N$ EUԉVVh$] E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$K $ E 1 UWV@UEp EU;F})}8MEB@^_]ÃE$S EEԅ~1U9Eu~~1ɍ}89N$J EUԉVVe$ E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$ $: E耮U I ՐUWV@UEp EU;F})}8MEB@^_]ÃE$ EEԅ~1U9EuF~1ɍ}89N$ EUԉVVe$d E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$F $ E  ՐUWV@UEp EU;F})}8MEB@^_]ÃE$O EEԅ~1U9EuF~1ɍ}89N$F EUԉVVe$ E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$ $6 E|Q E ՐUWV@UEp4EU;F}&}8M@@^_]ÃE$ EUԅ~1U;EuF~1ɍ}9N$ EUԉVVh$c E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$Q $ E  1 UWV@UEp4EU;F})}8MEB@^_]ÃE$Y E}ԅ~1U9EuN~1ɍ}89N$P EUԉVVe$ E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$ $@ E膨[ O ՐUWV@UEp4EU;F}&}8M@@^_]ÃE$ EEԅ~1U;EuF~1ɍ}9N$ EUԉVVh$m E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$[ $ E 1 UWV@UEp4EU;F})}8MEB@^_]ÃE$c EEԅ~1U9EuF~1ɍ}89N$Z EUԉVVe$ E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$ $J E营e Y ՐUWV@UEp4EU;F}&}8M@ @^_]ÃE$ EEԅ~1U;EuF~1ɍ}9N$ EUԉVVh$w E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$e $ E 1 UWV@UEp4EU;F})}8MEB @^_]ÃE$m EMԅ~1U9EuV~1ɍ}89N$d EUԉVVe$ E@@@ @u1ɋUF FBFBFB FBuՋUM}ƃt4$ $T E蚢o c ՐUWV@UEp4EU;F}&}8M@@^_]ÃE$ EEԅ~1U;Eu~~1ɍ}9N$ EUԉVVh$ E@@@ @u1ɋUF FBFBFB FBuՋUƃt4$o $ E' 1 UWV@UEp(EU;F}$}8eE@@^_]ÃE$| EEԅ~1U;EuF~1ɍ}9N$s EUԉVVj$  E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËUeEƃt4$ $? E腟Z 1L UWV@UEp(EU;F}$}8eE@@^_]ÃE$ EEԅ~1U;EuF~1ɍ}9N$ EUԉVVj$ m E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËUeEƃt4$+ $ E 1 UWV@UEp(EU;F}'}8eEP@@^_]ÃE$5 EUԅ~1U;EuF~1ɍ}9N$, EUԉVVg$  E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËUeEƃt4$ $ E> 11 ѐUWV@UEp(EU;F}'}8eEP@@^_]ÃE$ E}ԅ~1U;EuN~1ɍ}9N$ EUԉVVg$  E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËUeEƃt4$ $P E薚k 11[ ѐUWV@UEp(EU;F}$}8eE@ @^_]ÃE$ EEԅ~1U;EuF~1ɍ}9N$ EUԉVVj$ { E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËUeEƃt4$9 $ E 1 UWV@UEp(EU;F}*}8eMEB@^_]ÃE$@ EEԅ~1U9EuF~1ɍ}89N$7 EUԉVVd$  E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËUeUUƃt4$ $ EH  ՐUWV@UEp(EU;F}*}8eMEB@^_]ÃE$ EEԅ~1U9EuF~1ɍ}89N$ EUԉVVd$ + E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËUeUUƃt4$ $Z E蠕u i ՐUWVPUu} u}Ep(}U;~}-}8eEu}pxP^_]Ã}ĉ$ E~1U9EuV~1ɍ}89N$EUĉVVb$ u E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËM eEƃt4$3$ E  UWVPUu} u}Ep(}U;~}-}8eEu}pxP^_]Ã}ĉ$+E~1U9EuN~1ɍ}89N$%EUĉVVb$ E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËM eEƃt4$$ E7   UWV@UEp$EU;F}&}8Mɍ@@^_]ÃE$EEԅ~1U9Eu~~1ɍ}89N$EUԉVVh$$E@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uUƃt4$$KE葐f1XUWV@UEp$EU;F}&}8Mɍ@@^_]ÃE$EEԅ~1U9EuF~1ɍ}89N$EUԉVVh$$wE@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uUƃt4$1$E1UWV@UEp$EU;F}&}8Mɍ@ @^_]ÃE$<EEԅ~1U9EuF~1ɍ}89N$3EUԉVVh$$E@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uUƃt4$$EA1UWV@UEp$EU;F}&}8Mɍ@@^_]ÃE$EUԅ~1U9EuF~1ɍ}89N$EUԉVVh$$'E@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uUƃt4$$SE虋n1`UWV@UEp$EU;F})}8MɍP@@^_]ÃE$E}ԅ~1U9EuN~1ɍ}89N$EUԉVVe$$|E@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uUƃt4$6$E11ѐUWV@UEp$EU;F})}8MɍP @@^_]ÃE$;EEԅ~1U9EuF~1ɍ}89N$2EUԉVVe$$E@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uUƃt4$$E@11ѐUWV@UEp$EU;F})}8MɍEB@^_]ÃE$EEԅ~1U9EuF~1ɍ}89N$EUԉVVe$$ E@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uUMɋ}ƃt4$$@E膆[OՐUWV@UEp$EU;F})}8MɍEB@^_]ÃE$EEԅ~1U9EuF~1ɍ}89N$EUԉVVe$$jE@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uUMɋ}ƃt4$$EЄՐUWV@UEp$EU;F})}8MɍEB @^_]ÃE$!EMԅ~1U9EuV~1ɍ}89N$EUԉVVe$$E@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uUMɋ}ƃt4$b$EՐUWV@UEp$EU;F})}8MɍEB@^_]ÃE$kEEԅ~1U9Eu~~1ɍ}89N$bEUԉVVe$$E@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uUMɋ}ƃt4$$Ed9-ՐUWVPUu} u}Ep$}U;~}/}8MɍUMPHP^_]Ã}ĉ$E~1U9EuF~1ɍ}89N$EUĉVV`$$7E@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uu4}ƃt4$$ZEuiՐU]ÐU]ÐU,ذE]tUVSuED$E D$4$[Ϭ[^]ÐUVSuED$E D$4$%[^]ÐUXE]UWVS,Nu FD$E $F,[^_]1^xE䍃xE";~}EF D$E ${9~~yڍRxD$ D$OED$E$UjxD$ D$PڐUWVS,ED$ED$E$,Uփ B FF $(F M $E܃,[^_]1F M BF9}t݋E $EV;VuӍF$<EVT$ UT$V T$4$F t$1MN V녍D$ D$ D$pw$NjF t$U<$UWVS,DED$ED$E$XUփ B FF $(FF M $E܃,[^_]1F M BF9}t݋E $aEV;VuӍF$EVT$ UT$V T$4$F t$MN V녍D$ D$ D$v$NjF t$xU<$USE ~U;B[]ÍZvD$ D$/RD$t$1UWVS,uD$E $FD$E $FD$E $ FD$E $F,[^_]1tE䍃`tE";~}EE D$F $w9~~yڍtD$ D$OED$E$ftD$ D$PUWVS,}w &G FF $(F E $2U $GM $GE $E܃,[^_]1F M BF9}t݋UT$M $NEV;Vu̍F$)EVT$ UT$V T$4$F t$MN V{2D$ D$"D$s$tD$ D$ ԍbzD$ D$ xD$ D$ 묉Nj&F t$<$UWVS,}w tG FF $()F E $U $kGM $UGE $?E܃,[^_]1F M BF9}t݋UT$M $EV;Vu̍F$wEVT$ UT$V T$4$F t$lMN V{D$ D$pD$q$NK1$EԉuE܃c7E0>1$EЉuuЋ}ԅUԅUЀ:EEԀ81UD$gẺuUUuEЉ$u}Ep>1$ Eȉuuȋ}ԅEԅEȀ8EEԀ81UD$EĉuUUuEȉ$}KEp>L1$VEuu}ԅ7EԅVU:*EEԀ81UD$EuUUuE$x!$@EE̅Ẻ$UEąEĉ$UBE'E$UBEB U$Eĉ$yỦ$nEԉ$cE؋Ut6B<9t!GGNj$0E;x uG$EĜ[^_]É8u)8u)x8E`icEԃ8u+EEЃ8u+EЉE8u)/Eȃ8u+EȉEEԀ8iEԃ8u+EX8u)Eԃ8u+EE8u+EEED$UĉT$ẺD$ UT$C~D$$$1E0>A1$jEuu}ԅEԅE8bEEԀ8<1UD$ EuUUuE$x!$TEM.E$UBBEB U$OUD$_~D$$T$K18u)ED$ UT$~D$$$Eԃ8u+EE8u+EE#~D$ D$7~D$Ci$iD$ D$PiD$Ci$oD$ D$-mD$Ci$xoD$ D$.ԍiD$ D$PiD$Ci$:oD$ D$-mD$Ci$oD$ D$.ԍoD$ D$-mD$Ci$oD$ D$.ԍ#~D$ D$7~D$Ci$oD$ D$.mD$Ci$joD$ D$-ԉEE$MU$BUԉ$7E؋UB49toFljƋ$E;p tSFE룉EU$랉EU$Eĉ$Ủ$uEU$ՍF$}U$EUȉ$뺉E몉EEt- +EUx9tp$M9}uE$U$\EEE$`EEUЉ$E*UWVSMu DžDž $,d@ Dž $1uދU:E8u+E$‹uuuM䍽|$IqD$E$JE$t9B<9t$GGNj$;y uG$R$#Ee$?@$ƅ>Džt8u+D$lju񋍴utD$<$<$t$ D$D$<$nƅ@$1ɋ99uꋅ0uDž2>Dž:1D$uuE$u<$Dž|94>u1$lju}܅:#t^?+tvU܉Ѐ:t8u9$9X8u)rЍ!v 8uHVuU뤉%v8rHVuƃi?uH dD$ D$cD$_$61 8u)8u)~?19xpM19F$Dž~1ҋ 9u7E܉$?1$BuM܉<$fT8u+Y8u)1Eܺ Džtu V;V^u F <VE܉$t8u)$lj‰uE$?N1$YuM<$}$}EEE $,@ Dž $uދM؋E̍ủt$vD$E$EЅE̋U؅t9B<9t$GGNj$9z uG$QE$eĜ[^_]É8u):u)8tDž9YE؋4>uf1$uM܅[9#tDȀ9t 8u9u] $E;t8u)뎉ȍ!vpWwt8wt됍Eܺ2DžtM Q;Qu F CEMEU¸EUEEUE1ҋM MM щMEUD$T$ UԉT$4$D$*ML$$$E̺@@@ @u1ɋŰF FBFBFB FBuՋỦUEPP@]ÐUWVuN;NtF U AF^_]Í F$=NjFD$ |$F D$4$F t$6~ NF U AF^_]US蚩MAuQBAЃ[]ËA~Q AЃ[]ÍdD$ D$@MD$fM$ȾUWVS,}u 4$Ծx54$ƾGxP4$跾GxU4$訾G xZ[^_]Í$dD$ D$!@dD$L$G\dD$ D$#ԍxdD$ D$%dD$ D$'묐UWVu} D$<$FD$<$սFD$<$ƽF E }^_]鲽U]ÐU]ÐUWVS}u 4$輽x54$讽GxP4$蟽GxU4$落G xZ[^_]Í cD$ D$!(cD$K$/DcD$ D$#ԍ`cD$ D$%|cD$ D$'묐U蘧LE]UWVS,>u FD$E $誼F,[^_]1NKE䍃 KE";~}EE D$F $k9~~yڍBKD$ D$OED$E$EZKD$ D$PڐUWVS,蔦ED$ED$E$~Uփ B FF $(薼F E $E܃,[^_]EF UE؉$`EE؉<$#UWVS耣{Uփ V7FF t$輹U[^_]1F $赸;~|UWVS 6{Uփ N7FZF t$F>U[^_]1F $?;~|UWVS,蔢EE䍃zUփ ~>FF t$ʸUU,[^_]̷1F $輷;~|먐UWVS EEE@0EURUEEx;}!EU$P 9EuUUMM;V}8MЍ4ML$}$yHUMċH;N{NEUĉF V@EU$P 9E^Č[^_]ÃU$;EԋE~1};EuF~1ɍ}ԉ89N$2EԉUVV}8$Eغ@@@ @u1ɋU؋F FBFBFB FBuՋu؉4}ЍU؍4ML$}$裹1EE;NU3VE3F qEUBu܉<09B,uuVMF EUEuEU;F}ZMMuE EE D$ E܉D$|$$D$AUT$$M܅U$EƋE܉${D$t$UB$DE܉$%Ut$T$ |$U$D$IUT$$qU |$$P\EE;EE$³UD$ D$E$詳\[^_]ÍWD$ D$BED$?$[lj4$V<${UVS谙Uu MB}y@t \9t[^]Éu U[^]6UVSbUu MB}yt 9t[^]Éu U[^]UWV0uEUEUu 0^_]Ét$U$該t@UMH0^_]EEEED$t$M $nt$E$P멐UWVS<~Ƌ@$T$課F ȃ<[^_]1ҍ<}ԍJ<}9}F Mԉ BFl[^_]D$ D$t$ě$衑*F$蕍EW0FD$ ML$F D$4$F t$艍EF VpA4$FEW MAD$ ut$A D$ $UB t$4uMq AEED$ D$4 ED$4$UWVSD$@\$EE,[^_]Í>낐UWVS,DqEE}u$藉 1҉ tTtHE D$t$ |$$D$=T$$EAE,[^_]߈Ƌ$ψ4$VUWVS,puEEUfUڋT 1҉ u\E\$輈T 1҉ \$[EUU uH\,[^_]U܉T$4$P|Ep"D$ <=D$ML$4$DžUT$4$P\|$M܉L$4$E\$T 1҉ D}ڋUf‰\$膇E+,[^_]ÍL=D$ D$Z,=D$T$覄Ƌ\$94$UWVS,nEE}uƑ$D 1҉ tE‹E5ƑE,[^_]džƋƑ$跆4$>UWVS,pnEE}uD$†< 1҉ tE-‹EDE,[^_]EƋD$54$較UWVSLuE D$4$RNj4$PTẺ$3TUЉ$(TMԉ $TE$T뭉ƋE$Tv҉É봉닉롉ɐUVSE>Ƌ`x8u8u;T$ D$`$bU`$YU[^]Ét$ L$ UWVS=u HYXD$D$<$7TD$4$[UD$ |$D$4$\u Ĭ[^_]ÍSD$ D$r D$$RUE E]XUWVSL*=`8_HUЉMԋ`_yHEEfyHuEЃ1҉ u }E J D$ R D$_D$M $UMT$ L$D$D$M $Wu 4$P<D$ D$GD$_$TD$: T$$@SL[^_]ËEЃ1҉ EEEЃ1҉ tD$ D$: D$$7Q_D$ D$D$n$NS4$P@4$PD$#SUSW;E U t~E ^E[]V[]ÐUWVS, ;ut$ ED$E D$E$VVE] ED$t$$D$0 |$$Q}t,[^_]Ét$E $Vt勃^tًD$D$ t$$D$|$$Q,[^_]U]ÐUWVSG UAGD$ D$X D$$M G$NƋWT$ t$W T$<$G t$Nw Ox D$ D$늉Ƌ]$*P4$MUVS07EM􋃃[D$0L$$Rƅu>MEEEEMEL$$4DuuE0[^]ÐUWVS,`7ƉU؍D$4$ONjD$ D$|$4$E܋4$PI1Mt >BF1GMt >A1ҋ'N?M:tSECM ED$wD$$E=WM~(LON} |$WM$PD$,>Ɖ$ADkM0*DDžPDžTDžXDž\P׈PTSQQR ƈR$SGM8i@QWMyu RSπPfCtTCMPL$$4b D$t$$ ?KN8 +NNNkN‹N+N/N.?$6Bul[^_]D$D$$->}Pl{TU\XSEԍp]t3NE؋oN`WNdh/NECNE?NE;NECMD$L$$D$|$$Y=D$ D$2D$$|>D$|$$#=D$ D$9D$$F>D$|$$<D$ D$3D$$>D$|$$<D$ D$6D$$=D$|$$<D$ D$7D$$=D$|$$K<D$ D$8D$$n=D$|$$<D$ D$:D$$8=D$|$$;D$ D$;D$$=D$|$$;D$ D$SD$$<D$|$$s;D$ D$5D$$<D$|$$=;D$ D$4D$$`<D$|$$; ?WM@@ ƀ>18u+D8$9DuDuD$<D$D$$s:ƃt$:D$:D$4$$>4$a:D$<$8:#$@:D $f8CM|$$PD$|$$9WMx8 MD$D$$QxD$/T$$9KN8GM8D${D$;M$X9WMx12!J8H| u18u)rH8tzH8tzH}8t=ECM ED$OD$$D$Et$$7u>1$6@u_8u+@81KNg8u+@8IDžut gNo8u+(@8Dž<(u;; ~28u+@+ 1ɋ@<Rt19 B:S;$ ; x 8u+@<)(.<+(01ɋ@<Rtʃ90&B;4;0w@ω8;8@8)ʉ8t@ω΃$9@)ʉ8:tɉa@ω΃49@)ʉ,8tɉ&+NG8u)O _ND$$ D$|$$2|$D$;M$2;M$21E E܉D$OD$$E ED$D$$E |$wD$$SD$_D$ED$ED$ E܉D$kD$;M$#2;M$21{D$ D$Kf0D$$13D$ D$7|$$/$1D$ D$UL$$l/3D$ D$q7D$$B/NjD4$7/<$\/lj4$%/<$J/UWV}u 4$*/4$ /G^_]UWVu} D$<$.FE }^_].UWV}u 4$.4$.G^_]U]ÐU]ÐUVSu xoM A[^]1;Q}>A 09Q~y獃D$ D$OD$$. D$ D$PԍD$ D$11D$$-UE]-UWVS,&u FD$E $-V,[^_]16E䍃E";~}EE D$F $o9~~yڍ*D$ D$OED$E$--BD$ D$PڐUWVS|} tzu N[^_]1;V}HF ;V}=9V~ՅyݍD$ D$OD$H$,D$ D$PԍD$ D$*D$H$_,UWVS,ED$ED$E$J-Uփ :B FF $(,F E $,E܃,[^_]EF F6F t$(4UU,[^_]'1F $';~|먐UWVS>}u 4$'xD4$'Gx_4$'G~d4$'G ~i4$'Gxn[^_]ÍD$ D$D$ $J'D$ D$ ԍRD$ D$ D$ D$ 묍D$ D$UWVS^}u 4$'xD4$&Gx_4$&G~d4$&G ~i4$&Gxn[^_]Í>D$ D$D$*$j&D$ D$ ԍrD$ D$ D$ D$ 묍D$ D$UWVS~EU Mux6x\~l}~y}HpUP }x[^_]ÍҶD$ D$D$J$%ƶD$ D$ԍD$ D$D$ D$묍D$ D$UWVSEU Mux6x\~l}~y}HpUP }x[^_]ÍD$ D$@D$|$$D$ D$ԍ$D$ D$4D$ D$묍D$ D$UWVu} D$<$X$FD$<$I$FD$<$:$F D$<$+$FE }^_]$UE]US|E x U[]ÍдD$ D$2 D$H$#UE@]ÐUS(E x UB[]ÍpD$ D$;D$$y#US M EPx;Q}=A E[]e#D$ D$OD$$#D$ D$PԐUE ]ÐU E]"UWVS,H u FD$E $"F,[^_]1XE䍃E";~}EE D$F $(9~~yڍLD$ D$OED$E$O"dD$ D$PڐUWVS, ED$ED$E$&#Uփ b0B FF $("F E $!E܃,[^_]EF Fr+F t$)UU,[^_]1F $;~|먐UE ]ÐU`E]UWVS,u FD$E $rF,[^_]1E䍃ҪE";~}EE D$F $A"9~~yڍ D$ D$OED$E$ "D$ D$PڐUWVS,\ED$ED$E$`Uփ *B FF $(^F E $E܅,[^_]EF F&F t$$UU,[^_]1F $;~|먐UV$u4$D$4$t$E$4$$^]ÐUV$u4$D$4$t$E$q4$n$^]ÐUE$`ÐUVSu4$tPTu[^]UE$ÐUSjE$#t HX[][]ÐU1]ÐU]ÐU]ÐUE@ @$]UWVu 4$Vljt$D$$^_]UWVS<E UEUUMU؉M܋u} E#E$hD$L$ E؋U܉$T$wM$׋M(1y)EU܋E؋U܉D$T$UT$D$ D$t$$Dƒ<[^_]ÍD$ D$D$$USM EtD$ $u0[]Í>D$ D$*D$$.D$ D$UWVS,~EP tiUrE tQMA$y E MA$Vz;VF E D$D$<$4,[^_]ËEx @$D$D$D$D$ D$D$@$tWƋUr +MA$Q;QMA 4BA΃V;VtF BF11륍F$NjEPFD$ |$F D$4$F t$~ V뚍A$^NjE@D$ |$A D$ $UB t$OMy Q)D$ D$D$J$1D$ D$$8Z#F#R#T$J#T$$UWVSB}u O tB@+G$9svt$<$<$t$<$st [^_]1ڲD$ D$D$$SUWVSluU F~S11ƠEčEҠEFExn;NF E9r @9r;N|҉Ul[^_]E9HUB (9JUB <t=l[^_]ÍD$ D$OUĉT$}<$|ED$ D$P݉σ}=F9E9M+ỦUԅ~B<}EEEU~ :E8EEEU9UuۋF})ω})FUB9E+ỦU܅~8<MEEP EU9Uu}G+EЋUB};~ t$D$@D$ EȉD$4$4$ҍFD$ D$}ĉ|$E$7"D$ D$D$ D$EĉD$U$}|$ D$P݋UT$ D$UWVS>uFF $(gF ~FGG $(;G u[^_]NjF t$0<$tUWVSu~FF $(F ~vFGG $(G u[^_]Nj~F t$<$UWVpEUEUE U$EUE(U,E؉U܋u0}4U8U$@E1}D$0t$(|$,E؋U܉D$ T$$EUD$T$EUD$T$ED$ ED$ED$U$REƉ׉p^_]ÉƉ׃t4$Ɖ׋U$ 4$r11UWVut4$u^_] ^_]UEE]U(E$D$E D$ED$ ED$ED$E$Ãt$h $1ÐUED$ ED$ED$E$uÃt$ $1ÐU(1},D$E(D$E$D$E D$ED$ ED$ED$E$Ãt$ $ C1ÐU(1},D$E(D$E$D$E D$ED$ ED$ED$E$Ãt$@ $1ÐU81}0D$ 1},D$E(D$E$D$E D$ED$ ED$ED$E$#Ãt$ $7Z1UUEEEE B$UWVS<Uԉϋ 1UT$D$ $|$UԉT$$EU<[^_]UBwq|||||||||||||||||1]ø]ø]ø]ø]UVL$t$ $T$V^]U]U]UWVS<Ɖ׋B~`ډT$t$$yu}UЅu)`ǾEEЉUԋE1҉ M щMEU<[^_]É1҉ M щMUVS:EU ur13n tMV4V[^]UWVSEU *.11 t [^_]ËUREUU1E1 t׋MEUMQ[^_]UVSUM uF u"Ѓ u F[^]ÍmD$ D$^yD$M$UE@]UWVS,Ɖ׉M t&t$|$$ƅtA,[^_]$U䍃.t$|$$ƅu$U䍃(,[^_]ÐU`E]hUE]UpE]fUS~!D$$t@ []؃[]ÍD$ D$sD$$OUWVS,E E0x u ,[^_]É_E}w.UFf,UT$ֵ$,[^_]D$E $lE䙉D$T$U $D$E $7D$U $$D$E $,[^_]D$U $E䙉D$T$U $D$D$U $E䙉D$T$U $[D$ E $t$|$.$etD$?D$U $fE䙉D$T$U $D$@ʵD$ D$D$~$QUWVSE0x t Ebw [^_]D$U$$ND$T$E$$]UT$E D$U$$\@ [^_]UWVS, E֋1҉ tv~rt$$ƅtXD$E$,F D$T$M $FD$E$FD$U$Ը@ ,[^_]UWVS<|u} EUEЉUԋEHU؉M  t]}tWU܉EȉŰE؋U EE乃‹uM4z z u <[^_]D$U $&ED$T$U $E䙉D$T$U $EЋUԉD$T$U $eMȉL$u 4$ED$4$U؋M܋E -<[^_]D$E $eD$ D$ttD$H$UWVS<U M$u4*E0x t Ev"UT$$T<[^_]ËxEEkE؋E,D$$ƅt @D$U4$EؙD$T$U4$;1}D$E4$gUЉT$E4$UUԉT$E4$C<[^_]ÉT$L$~$(U܋@U(CU܉UЉE1E9~F UU09tE;~|D$E4$EؙD$T$U4$.1}D$E4$ZUЉT$E4$HUԉT$E4$6;~}JF U@D$E4$D$ D$ D$}$+~D$ D$J~D$}$~D$ D$IԉEEUԉT$^$LEԃEU9U(uӋE܉EUWVS<u} EUEЉUԋEHU؉M t u <[^_]ËU܉EȉŰE؋UEE8ƀxx x 5u~ 'NFEЋUԃ:Ƌ:U4D$M $ED$T$U$E䙉D$T$U$EЋUԉD$T$U$MȉL$}<$"t$<$;u؋}܉4Љ|B<[^_]Ë:U4D$M $ED$T$U$UE䙉D$T$U$>EЋUԉD$T$U$MȉL$}<$^F@D$<$OU؋M܋E<[^_]EЋUԃƋ:}4D$E$p$ƋD$ t$D$$>t$D$ D$D$z$D$ D$ԐUWVS\u }E U$EȉŰE,!MQ t> t8M Mt0EԋEȋUƃ} v"ML$n$"\[^_]Ë}Tiiii'D$ E,$t$T$M, $ EԙD$T$U,$ tD$ M, $Gt$|$E,$D$ ֹwEȋUE؋@D$ D$BND$ D$+U8p|t E]]UWVSLu }E U$EЉUԋE,jEH t tE Et Ev L[^_]ÉЉEEЋU}EE(E܃}tU9UM؋4|!U,$D$ E׉t$|$u,F$E䙉D$T$4$4$D$ D$D$F$zz B,u(1u(;p@ u(@E܋R@UD$ D$D$ft$wu,4$D$ D$D$F$u؉TJEA Q};13EEEUĉD$T$U,$e9u9uuȋE䙉EUʍ.D$ D$1tD$ D$JtD$ft$tD$ D$IUWVSLEUEȉŰEM(SU r~0xEԃ}tuȉ}̹/EȋUE؃}M M؃,A9| L[^_]Å19SA U܀ztԋUUЋ 4| 5U܋B ׋M( $D$ t$|$U(B$9E$BU$T$D$n$ n$M( $D$ D$D$U(B$L[^_]Àx *BU($D$ D$D$M(A$Ɖ׋ UЉ4|}E؋@LEEA QEYED$U($EM9Mu.ED$E($ED$U($wE\$E($`E\$E($IED$U($)2EU D$T$U($ED$M( $ 1}D$M( $M؋IHMD$ D$(ޤD$q$rD$ D$)ԍD$ D$*qD$ D$IqD$q$rD$ D$JԐUWVSE}(Npu$yMu [^_]ËPw4‹F [<$D$ D$D$G$Vu BwqBBE D$D$b$b$[^_]øEA QwjFv/oe[E11M$1D$<$#9uuE1U$rD$<$9uuu1M$D$<$9uuE1U$D$<$N9uuE{1U$D$<$c9uuZEO1M$TD$T$<$9uu&E1M$qD$<$9uuU1U$2D$<$9uuD$ D$rҠD$m$>D$ D$sԍFD$ D$tRD$ D$UWVS<Dž@DžDu} no8tD$D$|$ED$ E D$M AQ $T$bpD$u4$*nmc>~D$}<$$Ɖ8<$D$ D$D$G$EFVD$<$.F F$Ɖ8<$D$ D$D$G$FVD$E$F F$KƋU$D$ D$D$MA$zFVD$}<$`F FED$E$U2%$ȃ8u+x>6 1xD8$lj‹uxu}ED$D$U$d8lǃ;ǃ?M䉍|$D$$|$D$$D$ E$M؉L$ u܉ t$D$'$E؅Dž|Dž@ ||;E|u܋><$wthD$D$ t$ED$c$cUЉEԹSMЉL$ D$T$$Iu|$4$P\*|YK*M^,p 9@'t$}<$S@||;EE܉$L$ t$$4D$i|$$U!}܅E؉$EЉt$6tt19u쉃34$/tx1D9t}拃8t o:@D$U$ Dž@}|$ T$D$$D$T$$*8 @cDžD;DR@D$u4$XDž@ }|$D$ D$GD$$D$HT$$l8,XWD$M $ƋXD$D$ t$<$Ut$$P\D$ yD$D$<$EEEED$ L$t$ ED$D$<$E؅iXE܉D$X $XD$ D$D$4$@'D$(}<$Dž@(D$)E$ D$U$ M $D$ D$D$uF$1҉ uu4$D$ D$D$F$EUD$D$4$ EEEE4$D$ D$D$F$0 t$_D$ D$D$$D$T$$}Vu}u4$D$ D$T$F$EUD$T$E$u4$D$ D$D$F$BEǃ@,D$-U$Dž@-L$u4$D$}<$U$D$ D$D$MA$1҉ uEU`dt1*t{Љ+D$T$U$h )9u'*YK^,p2;@;9t|v/Ld~-!ȃbc8u)| `wʼn!ȃt+D$E$2}/8t otH E$Au$t$}|$D$ZD$ ED$U T$M $p~ p74$D$ D$D$F$pBR74$D$ D$T$F$zT$L$$74$D$ D$D$F$0G <$lML$u F\$nU ;@bD$cM $G<[^_]Ét$U$-@D<ǃ9G,u䋃ȋLDD$(U$'D$u4$D$|$4$AQ`D$t$}<$kAQD$T$<$+ЉD$<$D$D$<$wt$E$M~]1j8i4;wG TD$L$E$9u,M $D$ D$D$uF$D$4$wuԀ~t΃$FD$E$i&FD$M $V닋8Q4M19t+TD$T$}<$Ph )9u*YS*t^,x7;@~|$U$ֻ@j <Džj(<9)9G <<?tǀtGD$E$iϺGD$M $ǾW{Dž$}<$iD$ (,t$|$}G$e$D$<$R<$D$ D$D$G$)1G $\;w|1F $?;~|tmD$ D$+nD$i$#jD$ D$PjD$i$ٶ jD$ D$OjD$i$诶D$ D$L$i$腶#jD$ D$J8D$4$[ jD$ D$I8t$4<$1#jD$ D$P0D$i$ jD$ D$O0t$i<$ѵ jD$ D$O,T$i $衵#jD$ D$P,t$i<$qkD$ D$CD$i$G?pD$ D$.nD$i$D$ D$xL$i$D$ D$l|$i$ϴkD$ D$kYkD$ D$CD$i$莴7D$ D$CD$i$d#jD$ D$P(L$i4$4 jD$ D$O(D$i$#jD$ D$P$t$i<$Գ jD$ D$O$T$i $褳kD$ D$CD$i$z+D$ D$L$i$Pǀ}t%E$B<$gNjT $*ۍ7D$ D$CD$i$7D$ D$sCD$$ϲ7D$ D$sCD$$襲lj4$蠲<$Ų7D$ D$sCD$<$i7D$ D$sCD$$?ǀ}7D$ D$CD$i$XNjP$USNME U~!~G;At1[];Qu[]ÍAD$ D$NvD$@$脱AD$ D$OUS֛EP@$x;P}=@ E[]]?D$ D$O?D$?$?D$ D$PԐUE]UE@ ]ÐUE@]ÐUE]UE]ÐUE]UE]UE ]UWVS,uD$E $fFD$E $TFD$E $BFD$E $-V,[^_]1?E䍃>E";~}EE D$F $ٰ9~~yڍ>D$ D$OED$E$ȯ?D$ D$PUWVS,EP$z~I(>M=E܅xX;zB 4t4$Pt\EP$9z΍tD$ D$=tD$=$'>D$ D$OUT$M܉ $tD$4$茯u,MQ$댍4>D$ D$PED$U܉$g$@E|$UB$D$M $$uV;VtF M BFȃ,[^_]ÍF$NjFD$ |$F D$4$F t$~ V렉ƋE$4$?UWVSFF$XuF DuQTUWVS軍ljt8x1[^_]É$趧xt߃XD$ D$|$$詧|ts E؉D$ED$$D$9[hlT$$HE؋U܉ UExEU tU |MEEtUMML$T$D$ |D$7p$Džgp(F$#Nj|M̋EEȋtUċMM|$L$T$D$ |D$p$轩M%E;NUUteEED$ |L$ED$g@T$ UBtJEB @UT$<$P|Es EЉD$ED$$D$AlT$$薢E EEK D$ ED$ED$$D$DlT$$@E!$ݡƋE$蛤D$t$g@\$ZEЙUԉ4$Xs1EЋUԉD$T$ UT$ $D$LlL$$谡UT$<$P\s1EЋUԉD$T$ ED$ $D$QlT$$_MЉMM$eEE~1U;EuF~6DžDDT EDD;V|ԋ$BMEFFv$ ޟE@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËUMeUU[D$ D$ElL$1$KUWVS|讈ue[^_]Ë$Euƅt,EЉt$|$$EԋU؉EU u$xe[^_]EEEE܉D$t$<$WMD$U$UE /tZp(}M;~}f}8eEEEpx+EU׋UrzBRZ@$衟}$詝E~1U9EuN~1ɍ};N|$補EUVV)$ ?Eĺ@@@ @@@@ u1ɋUċF FBFBFB FBF BF$BF(B uËUĉeUUƋ$o4$UE]jUWVS\} du\[^_]Ë$c ED$ED$$D$b`T$$EEED$<$R\EȅvẺ$7EЅFEԉ$%utED$M $MUuU${\[^_]1UԋT$<$P\;u|1ŰT$<$P\;u|i>MM؉E܉UE؉D$ED$T$yƋ$4$yUE]UWVS藄EEE $š¹ BBB uډEE;}RLC@(PEEEt$\[^_]Ë#u<‰9tB,up uPUpuMU9NU;UEMH up}xMBEDžTU\8k``XX }XxUUԋMMЉ}̋LEȉD$|$L$ T$H$!u Ut%x;Nt8xx4FVXGWFVFVXAQFVC@@AAA AAAA؉TE9TT9TTEH MH@EMUuuĉT$L$D$ t$H<$P\%`;V4$莗d4~1d94uN~1ɍd89N$vd4VV\8$ E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËM ``X4$<|4~1|;4uF~1ɍ|;N|$$|4VVt8$ 評E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËu4xux@P$8EMMEE}܋LU؋ML$T$|$D$ }|$H$כUhMl;V}th8ll4D$ }|$LD$C@T$7FXBFB F eMp$Njp~1;puF~1ɍ89N$>p~~$ 蛓E@@@ @@@@ u1ɋUF FBFBFB FBF BF$BF(B uËM ll4u$Džt'1@@@ 9uۋED$ |$ED$E$跙Et$诒}U(D$ D$O(D$c($蔑(D$ D$PԉƋEEt$I4$荑UxUT$$Qt f}@tEȋUÐUWVSL{,$E_1}у $覑ED$ ED$8VD$Eĉ$?EYEȉŰEKEЉUEE6Ɖ׋E*EU!U1E1 E#EU3UE3E t|uy$%EVUUUEE)R9UdEƉ׋EEU!_1ɋE#Et1tD$D$E$诒L[^_]ËEĉED$D$E$膒ՐUWVS yEU EU싃 tXu})׉~t }2u}쉳 [^_]~2XG u}쉳 [^_]=WGv|w11UWV UT$D$$ED$E$衖ʚ;EƉ׋E׉4$|$ ^_]ÐUWV@E U̍ED$ T$D$E$[u5MMԾʚ;Ɖ׋EE؍׉@^_]11@^_]U$D$mÐU1ÐUWVĀED$$豕uE׹ʚ;Eiʚ;‰UuE׉EUEUEU)EUu}EUEUEUEUEU^_]EEEU^_]U]UWVS0wYYu:1$]Ɖ‰uE0E[^_]0u)빐U wE]RUWVS|vE@EEED$D$E؉D$ ED$D$Ẻ$AE$虌EEE1֓EȋEED$D$ED$ UT$D$E$ݓtCUE܉׃M9s"Exu7:uFЃ9t8tNjE܅~9r-M $8|[^_]É9t8u9rȉ}E}M91$見uMԋMQ;QMA 4BAE9t4$裊}Ԁ?uv1$LuEԉ$n1}MEE;E EE9E1E8u+E28u){EA$躊EEUPЃut,}E$艊}9u݋MQT$ UT$Q T$ $EP t6B49t!FFƋ$kU;r uF$6EMA QtQD$ D$QD$|$0D$ D$q4D$|$EEt.U)UMUx9tp$;}uM $莉EEԉ$蝈U$迈UWVS,rЀ:t8u)Ѕ~,[^_]ÍM8u)$lj‰u񋃩$?P1$览u񉋩<$ȇM$D$ݖ$ЏFD$ ٖD$LD$$ÏƅD$ D$t$$t1$߇lj‰u񋃩$?1$複u񉋩<$ņ$,[^_]É8u)4$$74$荎D$D$$Q8u)8u)0<$$24$?$UWVS\HpEE؋} UUԅXM؉ $蓈pDE܁};F}B}8eMEԉB @U؉U\[^_]E$EU~1U9EuF~1ɍ}89N$EUVVL$蓅@@@ u1ҋF FDFDFD uڋ e}9lKD$ D$NxKD$$=UWVSLnE xE$L@D$E؋pDUUM؉M;V}N}8eMM B}zL@E$BE؃L[^_]ÃUĉ$DE}ą~1}9EuN~1ɍ}89N$;EUĉVV>$׃@@@ u1ҋF  FD FD FD uڋ e}9lD$ D$ID$l$聂UWVS\lEEԋU UЅ}ԉ<$2PUpD}}EЉE;~}f}8eE@@@ ]UEЉD$@D$ UԉU\[^_]g}$tE~1U9EuF~1ɍ}89N$nEUVV)$ @@@ u1ҋF  FD FD FD uڋ e}܍9HD$ D$HD$$贀UWVSLk} vE$oč@D$R 9pDU܁};V}2}8e}48U$҂L[^_]ÃUĉ$ՀEEą~1}9EuF~1ɍ}89N$EUĉVVZ1U$GL[^_]$Q@@@ u1ҋF  FD FD FD uڋ eE4[]ÐUSgED$w$[]ÐUWVS|fuEUMUЉMԋU M$UȉM̋U(M,UMċU0M4UMM8MF D$w<$衄F D$<$荄FF D$<$xFM UT$M $:F4V8}|U1F D$$F,D$ EED$UȋM̉T$L$EЋUԉD$ T$F4V8D$T$<$F(EF$D$$FD$ UT$EUD$T$UMĉT$ L$F4V8D$T$<$蓃FEF$ L{V MHPF<|[^_]F$F(F,F0FFFFF4F8D$ D$BD$E $||[^_]Á}1zBD$ D$1BD$ $%zBD$ D$5ԐUVSuduNt.FVD$T$ L$Qu$XFF[^]US*dED$u$[]ÐUWVS,c} EtEt$PG0tD$E$谁EE;G |NjD$E$萁GD$E$~GD$E$lw(t(<$G,W0D$T$ G(D$E$LwBM؉L$E$OE$,sMЉHỦPsUȃPMHss@@@ @$@(s‹}؅MA 9EIMM؉EԉB <[^_]É$sMЉHỦPsUȃPMHst$$sUЉPM̉HsUȃPUPss@@@ $ FsUЉPM̉HsUȃPUPs@@sEE؉E+E U܉U<[^_]e$$ƋEȃsMЉNỦVsF$jFssFFF EM؉Ml+E E܉E<[^_]Jdu~$ƋEȃsUЉVM̉NsF$Fs]EE؉E*E U܉U$ }ƋEȃsUЉVM̉NsF$AFsFFs$,ƋEȃsMЉNỦVsF$FssFFF F$F(s0Njs4$<$h`UUE EBEB]ÐUE@]ÐUUE EBEB]ÐUWVS,VJu}U E$ `E‰D$ ML$E D$U$dV;VtF M BF,[^_]ÍF$%`NjFD$ |$F D$4$F t$`~ VF M BF,[^_]Í 'D$ D$"'D$"$^2'D$ D$ԐUSBIEU 9P~x:@ @[]Í.&D$ D$ &D$$^FD$ D$ORD$$]^USHEU 9P~x9@ @[]Í%D$ D$%D$$^D$ D$OD$$]USDHEU 9P~x8@ []Í0%D$ D$%D$$]HD$ D$OTD$$a]UVSGulFF $(]F [^]ÐUVSGukFF $(]F [^]ÐUWVSDGuN(FkF t@E[^_]]1F $\;~|FkF u[^_]ÐUWVSFu~(FkF t@E[^_] ]1F $\;~|FkF u[^_]ÐUWVS PF\#u t FO)ȅu}G [^_]ùd#u t FO)ȅu}G [^_]ù l#u t FO)ȅu }G댹|#u t FO)ȅu}GV #u t FO)ȅu}GG #u t FO)ȅu}G1UWVS\DE E T"u ǹ t FO)ȅuZ`"My8tu E \[^_]Ét$ } |$"D$tg$[tg$[E l"ϋu t FO)ȅu !rE x"ϋu t FO)ȅtJ@"D$ D$TH"D$$NYUSCDft!$a[]Í()$a[]UWVS1$gYuu u tP8t $jXEEU9Br\MЉuEE8uȋu~Epu܉ $X<[^_]É8u)L1D$ D$.D$>$WvD$ D$OD$>$WD$ D$Pԉύn-D$ D$)딉Ɖ<$vW4$WUWVS1$RE܉uM1<,~<-,}tXu܀>-M܉ $Qu;~n$RUE\[^_]8u)db~cE܍p'P8Q|uE넋E܍`'P8QQKuVu܀>1$QEuuuԉ>1ƃuM<1/t1҃9UA1$PEԉuuȉ4$PEԀ88u+EԉƃuUԀ<2\t 1҃;UA<\uNEԀ8Q1}9aUԀ:C19)ȉEċu>19EEă$PE̋Eą~12M̈ 9UuűEUԉ$Où><1$OEԉuủ4$NNM;QuF 4>1$gOlju<,<-<$vN;EԀ88u+EԃsEԀ81HEԀ819UԀ:19)΋}?19F$NEЅ~1:MЈ 9uE0U<-~<.1MЉ $MEԀ81ƃHEԀ819Eԅ}MԀ919F$MDž~1ҋM9u7uԉ4$M?1$MEԉu<$LuԀ>Eԃ8u+Eԃ$tMuEUԉ$LM܉ $L8u+Eo8u+E:u+U8u+E:u+U8u+E:u+U8u+E'J:H|diu1]8u+EG8u+EPUЍ'J:H}E܃8u+E;XD$ D$PLD$$BK@D$ D$OԋEԀ81ƃ?MԀ|.t 1҃9#A<.uNEԀ819UԀ:19)MԉMU:191F$FKDž~1ҋM :9u7uԉ4$`J?1$KEԉuL8u+E8u+E0:u+U>18u)318u)nẼ8u+EE؃8u+E/Eȃ8u+ElE8u+E8u)8u)_Eԃ8u+E8u)N D$ D$aD$$I<- E܍d'P8QuƋẺ$HEԉ$HU܉$H4$HXD$ D$PLD$$H@D$ D$OԉƉ<$hH똉딍 D$ D$aD$$3HnD$ D$͍D$ D$빍D$ D$`D$ D$D$ D$`tƋEȉ$GD$ D$AD$ D$OD$ D$8UWVS<1EEx~vEE+UM;QUB M4>ud1$Glju?-tE<$FEEU9BD$$JOƉ<[^_]É8u)됉6 :MurHMׄuG$cJƉ<$gF<[^_]Í^D$ D$.FD$$.FD$ D$PD$$FD$ D$OԉƉ<$E4$FUWVS,B0EE܃x 1,[^_]EEU+UE;PU܋B U4>u]1$7Flju?-t>?-tW<$DEEEU9BE,[^_]É8u)뗉 8uHVuE멉 8uHVuE냍D$ D$.D$$D^D$ D$PRD$$vDFD$ D$OԉƉ<$]D4$DUWVS\.EẼxEEEЋUԃ\[^_]EEE}܅U܋E;PŰB U܋4>uR1$Dlju?-t3<$CEU܋E;P|EЋUԃ\[^_]É8u)뢉| 8uHVuOEEw SD5u^$KK~*MT_E¸EЉUGG>EUEЉU&BЉEUEUEUċEUEUEUEUEUEU;EU EЉUEUEЉUD$ D$OD$$'BD$ D$PԍPD$ D$.8D$$AƉ<$A4$ BUWVS|7,E u t FO)ȅw} ?M 1ҍ<,t(2uƄ9,jx|$E$D$U$Nbu } ?Q}1Uzt#ztWD$$BMyt#ytWD$$tBu~t#~tWD$K$HB}UJPt z8M $1|[^_]ù t FO)ȅuRMAu ։WD$$A}<$A1|[^_]ùOt FO)ȅu MAcWt FO)ȅuMA,|[^_]Ë t FO)ȅu[MA$AMA,=WD$g$Y>u4$1:t FO)ȅu MA % t FO)ȅu6MA!D$ D$.D$$;t FO)ȅMA"8u)SF$n@UB,=819:19rF$;Dž~1ҋ:9u7<$u<uF0<$:<$:8u+jD$ D$D$$P:WD$g$;<M $4$$:1Ƌ$ :4$2:Ɖ<$9ލD$ D$qt FO)ȅu MAt FO)ȅujMA(D$ D$aD$ D$` D$ D$8u+( t FO)ȅu MAt FO)ȅuMA$dt7 t FO)ȅuF}GJx#rxtK8t돹t FO)ȅu@MAH$=MA$WD$]'t FO)ȅu MAI 7t FO)ȅuEND$ D$dD$C$p9N$8, t FO)ȅtvudMtfspitPD$WD$MAHND$ D$yD$srx8tocrxtp8t2SrxtO8t$:MA4$Q9}GDg $59uLGrxtT8te?rxt38t($F=MAP$8UB@7rxtT8t+rxt38tv$7}G<uFLED$D$$X<UVLt1~ ZWD$35U<]ÐU< ]ÐU< ]ÐUWVƁljlj^_]ÐUSt+xQ Q Q Q Ѓ[]Í D$ D$h& D$n$2ND$ D$iԐUS(tx>T Ѓ[]Í D$ D$q D$$n2D$ D$rUStx4[]Í< D$ D$yD D$$2D$ D$zUWVS;EpEnfD$ D$OẺD$Uȉ$1~D$ D$Pڍ D$ D$ D$Eȉ$0U=t'=t =t=t=t =t1]ø]UWVSlEԉUЉϋ=x8tO=p MM}ԉ};N}8M܍Hl[^_]É $00<$0t$D$ UЋD$ D$z=$1z=$1=p MM}ԉ};N\M$Q0EE~1U;EuF~1ɍ};N|$H/EUVV$/E@@@ @u1ɋUF FBFBFB FBuՋU}UWV0EUMEEE$879EED$U$67ƋED$U$08NjED$U$7EtpEq 2E + 9t1}t\=vxEt$U$6EEE$69EZE0^_]ÉE뎉UUBBJE몉U:L:E10^_]UWVSMF E' $&7EEp$6E$-EUT$t$$ .E$-EE~1M9Euu؉u4$f6EEE$MU1Euuu4$c-Et$D$$.}~1ɋEuu9MuEUz;}}"ut M $-Mt u4$-Ut E$,U$5Č[^_]1EEg0              eeeeeeeeeeeeeeeeeeeeeeeeexe  9<49uD$ GD$|$U$ 4:|$M $@4 E9}u1ҋM)9uwt uD$ t$|$E$3VEEȍVE +EȃE&ED$ t$|$U$R3EM9Muwt uD$ t$|$E$ 3VEfEED$ FD$|$U$2EM9MumD$ GD$|$E$2|$U$2E9}GM1ҋM)9uWE=`wD$ GD$|$u4$2wuF Uԉр<t49=F,uMԋMA4EVEBBJBBuL$ ]D$}D$a:$j&a:$a&D$ D$FD$ D$ID$$T$MD$ D$]D$$*$=D$ D$ԍaD$ D$ƋM $-4$$UWVS,PEU@,[^_]1`U܍U$4$[-ED$4$-UB9~x69}VUB 4t]4$,-t4$ -ED$4$,빍TD$ D$OE܉D$U؉$1#lD$ D$PڍD$ D$ D$E؉$"UWVSW 1}уdu )΅1Ĭ[^_]1UdL$UT$$+t 9uË0EEE $ $#E܋M 1}ЋMD$<$P+9u u|$u4$$,t$l`$0+`$+Ut}M8j|%t}P8WX|u1 }둸!Ƌ`$x+0EЋE܅$l"뻍sD$ D$۵D$#$P!Ƌ0EЋE܅t$"4$]!Ƌ`$*ːUWVSly $*$!Nj $P!%/0K?>+E?31UD$8!uu1uM䋽<$~)D$ D$ut$$) $)|$ t$D$$) IЃ8u+ Ȁ91ɋu M8u+(821ɋ(u QЃ8u+88E8/U8u+H8/DžLHu Lj Y8u+\8E\u }7 ]8u+l8_El Dž08u+_Dž.EEE$EЋ.EEE$cE$&EЃ8u+E MȀ9 1ɋEE819q}My619F$E~1M9u}7}uƅB{m C   E8u+(<+(01ɋ<)t1;0-B<)uy(T:49}",D:49&;0x8u)E?8u)8u+ME+MM1ɋu<)tʃ9M>B<)uqED0E9}U}:7U9q9u|뒃8u+En5D$ D$D$E$l8u+E<8uu+8@'1ɋ<)t99@B<)uM8T D9}%<}:D;D;@~8u+LH2L+HT1ɋ<)t19T/ B<)u才LHDX9}(PLD>:`;X%;Tx!}DžD$*Eĉ$!E"8u+E\CM+\d1ɋ<)t19d4B<)uM\Dh9}%`u:D>F;hu;d~r8u+El2M+ltz1ɋ<)t19t{B<)uMlDx9}%pu:D>;x9t}+ y1ɋ<)tʃ; 8B<)uyT:$9}":D$9; w?;uEhwD$Eĉ$]‰D$ $FK|$aD$.$.$iD$ D$DD$E$8u)q)E$$^D$uĉ4$ ʼnD$4$q D$4$^D$4$K4$4$gNjED$<$UT$<$CEȉ$ƋE؅Eȅ~&1҅g95EE9|܉D$t$<$4$.EԋEt$f.EċEЅt$KE$_l[^_]DžQDž:E9$\E@E)82t9}}E9URE)E8t}]DžE49E@E),:2t4$D$uĉ4$ ƉD$4$ȉ΃9D@)ʉ<8:tω΃X9@)ʉP8tɉTD$uĉ4$ME'D$Eĉ$ ‰D$ $ƅ'uED$Eĉ$‰D$ $돀EUdD$Eĉ$J‰D$ $38:E D$Mĉ $‰D$ $ƅω΃h9@)ʉ`8tɉnω΃x9@)ʉp8tɉ'D$*Eĉ$ D$+Eĉ$ED$Eĉ$‰D$ $D$ D$.D$E$^D$ D$ԍ=D$ D$D$E$ D$ D$D$uĉ4$ED$4$EED$Eĉ$‰D$ $D$uĉ4$뙍D$ D$PD$E$h}D$ D$OԍD$ D$`MD$ D$D$Eĉ$(4]D$ D$asD$Eĉ$D$ D$D$E$ D$ D$ԉƋ}<$ .EԋEt$_.EċEЅt$DE$X 4$} 볉ʉUWVSEUH`U R|D$x4$t$t$pT$}<$-D$u4$D$ |$t$t$+ƋE$ E$| t$dDž ;p @ $pD$U$D$u4$uD$ D$t$t$ƋE$ E$  ;w: G b$D$U$7D$u4$D$ T$t$t$ƋE$9 E$. t ;w G  $A pD$U$?D$}<$*ףD$u4$T$ |$t$t$E$x E$m E$b pT$E$ D$}<$ T$u4$ D$ |$t$t$!E$ E$ E$ SD$}<$! WT$u4$ D$ |$t$t$tE$w E$l T$E$ T$}<$ D$uĉ4$ T$ |$t$t$ƋEĉ$E$E$XDž\Dž`$s dhDžlDžp$> tD$X<$t։T$<$]t$<$F\l;p t4BlD$<$ D$<$D$<$D$<$D$<$D$<$ƉD$<$D$<$<$D$<$|4 \$Ƌl@ \~,1҅9d\9|։D$t$$4$D$$htt$Xdt$uXDž\Dž`$,dhDžlDžp$tD$<$3D$<$!T$<$\l;pIt4BlD$<$D$<$D$<$D$<$D$<$D$<$ƉD$<$pD$<$]<$PD$<$Ee\$Ƌl\D$t$$ 4$D$$ htt$Xdt$fD$Uȉ$D$Ẻ$T$uЉ4$D$ T$t$t$8 EЉ$Ẻ$Eȉ$T$Eԉ|$8wT$u؉4$D$ |D$t$t$ E؉$Eԉ$}D$U܉x$D$U$D$u4$xT$ D$t$t$ ƋE$E$E܉$XDž\Dž`$xdhDžlDžp$CtD$<$ ƉD$<$n ‰D$<$] \l;p t4BlD$<$# D$<$ D$<$ D$*<$ D$<$ D$<$ ƉD$<$ D$<$ D$<$ <$ D$<$ D$<$s \$Ƌl\D$t$$ 4$ D$$ htt$Xdt$E D$u4$ t$t$I t$O Ĝ[^_]1҅69Xd\9J1҅C9ed\9p$lD$ D$tD$h$htt$tlp$DlD$ D$tD$h$htt$ tlAp$lD$ D$tD$h$htt$tl}D$ D$OD$k$D$ D$PԍD$ D$OD$k$ED$ D$PԍD$ D$OD$k$D$ D$PԍD$ D$OD$k$D$ D$PԍD$ D$#D$k$D$ D$ԍD$ D$,#D$k$M+D$ D$6ԋT$ D$?D$ D$D$k$D$ D$ԍD$ D$D$k$D$ D$ԍD$ D$D$k$D$ D$ԉƋE$cE$Xt$4$oƋE$5ۉƋE$&Ƌhtt$Xdt$놉ƋE$E$iƋE$SƋE$ƋE$ƋE$#ƋEȉ$nƋẺ$\ƋEЉ$MƋEԉ$>ƋE؉$,ƋE܉$ƋE$ ƋE$ƋE$]ƋE$ƋE$oƋE$ƋE$NƋE$ƋEĉ$VUWVSLEĉU΋*EEE$EԋEEE$ED$}ȉ<$D$<$D$6<$ƉD$<$‰D$<$1D$<$uuuċ}܅U̅GE؋Et$9*EȋEԅt$L[^_]1Ʌx9}=E9|뜍ΈD$ D$OڈD$$D$ D$PԍD$ D$D$$jD$ D$ND$$ƋE؋Et$J*EȋEԅt$/4$sِUWVSLEĉ׉MEEEEE$EԋEEE$ED$uȉ4$D$4$D$64$U ƉD$4$E D$4$D$4$}ƉD$4$l‰D$4$[D$4$KD$4$:‰D$4$&D$4$UƉD$4$EĉD$4$}t1D$4$uMME܅u̅OE 9E؋Et$aEȋEԅt$FL[^_]1҅x9}=E9|딍D$ D$OD$l$D$ D$PԍD$ D$D$l$xD$ D$$D$l$ƋE؋Et$rEȋEԅt$W4$ِUWVSLEĉ։ME E(EEE$EԋEEE$ED$}ȉ<$ƉD$<$‰D$<$D$<$D$<$‰D$<$D$<$UƉD$<$~EĉD$<$n}t1D$<$VuMME܅u̅QE9E؋Et$(EȋEԅt$L[^_]1҅x9}=E9|뒍̃D$ D$O؃D$$D$ D$PԍD$ D$D$$KD$ D$yLD$$!ƋE؋Et$(EȋEԅt$4$ِUWVSL@ƉUĉU w@P~b~~~~~t$D$oD$ D$.D$ $BEEE$EԋTEEE$EM D$EȉE$1D$U$uMM E܅ru̅TE؋Et$QEȋEԅt$6L[^_]‰D$E $MU܋EąwEEE$EԋTEEE$EGD$YUȉU$D$E$D$E$U|$E$ut$U$nD$E$[UƉD$E$FEĉD$U$3D$E$ D$6U$ |$E$t$U$MM E܅wu̅~#1҅9E9|߃ D$ D$D$ $lUąEEE$EԋTEEE$ED$YEȉE$D$U$D$E$U|$E$ut$U$D$E$UƉD$E$EĉD$U$D$E$rD$6U$_|$E$Pt$U$AMM E܅u̅~#1҅9E9߃ bD$ D$D$ $1҅xT9E9| D$YEȉE$D$UȉU$~DD$ D$OPD$ $:DD$ D$OPD$ $\D$ D$P몍\D$ D$P\D$ D$PPD$ $DD$ D$OԍD$ D$9\D$ D$HD$ $iD$ D$\D$ D$HD$ $(\D$ D$HD$ $D$ D$D$ $D$ D$ԍD$ D$%ƋEȋEԅt$r4$ƋTE؋Etȉ$M븐UWVS\EUMu $EEE$EԋEEE$ED$*}ȉ<$D$<$UƉD$<$ED$<$M̉MU;U EM BED$<$xD$<$hD$<$XD$<$6D$<$&UƉD$<$ED$<$D$<$D$<$MʼnD$<$ED$<$1D$<$u!D$+<$D$<$D$:<$sMʼnD$<$aED$<$QűU;ULE4BED$<$&D$<$D$<$D$+<$D$<$MʼnD$<$ED$<$D$<$UƉD$<$ED$<$D$<$<$uuuM܅pM̅GE؋Et$$EȋEԅt$\[^_]1҅9E9|딍E$EE܉D$ ED$ED$E؉$EEt$UUU_D$*<$VE$%EċE܉D$ EĉD$ED$E؉$EEt$UĉUUyD$ D$OyD$y$yD$ D$PԍD$ D$D$y$,D$ D$HD$y$D$ D$ԉƋE؋Et$E$EȋEԅt$*4$nUWVS\EUMuEEE$EԋEEE$ED$*}ȉ<$D$<$ƉD$<$‰D$<$} UűU;UE4BED$<$gD$<$WD$<$G} ;} 1} } D$<$D$<$UƉD$<$ED$<$D$<$UƉD$<$ED$<$1D$<$u<$MMu܅u̅~#1҅z9E9|߃E؋Et$EȋEԅt$\[^_]D$<$D$<$UƉD$<$ED$<$D$<$UƉD$<$ED$<$D$<$~UƉD$<$lED$<$\1D$<$JuűU;UE4BED$<$D$<$D$<$D$Y<$D$<$D$<$UƉD$<$ED$<$D$<$UƉD$<$~ED$<$n1D$<$\uD$<$DUƉD$<$2ED$<$"<$MM}܅Zu̅~#1҅ 9-E9|߃4D$ D$: D$ht$E$EEċE܉D$ EĉD$ED$E؉$EEt$6UĉUUD$*<$G3E$EE܉D$ ED$ED$E؉$EEt$UUUtD$ D$OtD$ht$tD$ D$PԍD$ D$D$ht$phD$ D$ZD$ D$NƋE؋Et$ EȋEԅt$4$4UWVS_EHU RD$u4$t$0 $wЃ8u)Ѓ$>Ɖ‹uu8u)$lj‰u}čED$EĉD$ $Eĉ$E$8u+$Ɖ‹uuȍg8u)$Olj‰u}̍vЃ8u )Ѓ$Ɖ‹uuЍEȉD$ ẺD$EЉD$ $/ƋEЉ$Ẻ$Eȉ$EEE$EsEEE$WED$U$D$$wD$$aƉD$$J‰D$$3D$$$Dž]E$ƋEED$t$<$4$D$<$~sEEt$pEEt$U8u+$Ɖ‹uuԍۻ8u)$lj‰u}؍EԉD$E؉D$ $u$E؉$Eԉ$$ 8u+$]Ɖ‹uu܍8u)$$lj‰u}8u+ $Ɖ‹uuE܉D$ ED$ED$ $ƋE$E$E܉$EEE$eEsEEE$<ED$$uD$$_D$$IƉD$$2‰D$$D$$$$DžE$ƋEWE~&1҅9nEE9܉D$t$<$4$D$<$DsEEt$6EEt$U T$u4$.t$ $ $[^_]1҅9}sEE9_$e7uD$ D$D$+n$$-7uD$ D$ƍ{nD$ D$PonD$+n$McnD$ D$Oԍ{nD$ D$PonD$+n$cnD$ D$OԍD$ D$D$+n$D$ D$ԍ{D$ D$gD$+n$D$ D$D$+n$i{D$ D$gD$+n$?D$ D$D$+n$ƋEȉ$  $4$$ƋEЉ$Ẻ$ʼnƋE܉$뽉빉ƋsEEt$EEt$o|܉ƋE؉$xEԉ$m[ƋE$WE$LpƋEĉ$6E$+UWVS}EH U R(D$uȉ4$t$D,$m(Ѓ8u(4)Ѓ$\Ɖ‹(uuԍ8u)$#lj‰u}؍EԉD$E؉D$,$0E؉$ Eԉ$0(8u+4$Ɖ‹(uu܍a8u)$mlj‰u}l8u)$8lj‰u}ЍE܉D$ ED$EЉD$,$cNjEЉ$2E$'E܉$EEE$EEEE$ED$*u4$D$4$D$4$ƉD$4$‰D$4$D$4$u0$/DžE$ƋE}ED$t$<$4$D$<$U T$u4$t$,$EEąt$EEt$,$h[^_]1҅x9}QEE9|B$UkD$ D$D$Id$/dD$ D$PdD$Id$dD$ D$OԍD$ D$D$Id$ɱD$ D$ԍD$ D$D$Id$D$ D$D$Id$_ƋEEąt$(EEt$ ,$4$CƋEЉ$ E$E܉$ʼn뢉ƋE؉$Eԉ$룉‰ɉUWVSEUMY$Qmw<$$ D$t$$$"t$<$>g|EE $(|EglDžpDžt $(JxgEEE $(E؋gEEE $(EgEEE $(Eȍϯ8u)$lj‰u}܍ӯ8u)$wlj‰u}E܉D$ED$D$ D$T$ $`E$XE܉$M{EEE $Eu4$$Dž$E +$|NjL$D$$#~#1ɋ19uߋE`;ƅt<$t $t4$i8$ƀDž<<@$nD$L$$E ,~$<1ɋ89uꋅ@D$T$ $$t4$<$t$`<$t$<Ч3 HM;MBEEgLDžPDžT$@XUE|u(X4PUE|N HM4P;TuT$蓺NjPD$ |$XD$L$Xt$|XP[YBU;UEBET$ $t$<$t$<$ M;ME Mp;twx BpU;UEƋED$ t$ED$|$sEt$0uU E$ƋED$ t$ED$E$蓼Et$uq;_D$ D$P/_D$^$Ȳ#_D$ D$OԍE$bNjED$ |$ED$E$Et$W}UEč$NjED$ |$EȉD$E$LEȅt$ }ȋUEԍ$ƲNjEЉD$ |$E؉D$Ẻ$E؅t$軲}؋UAE$xNjED$ |$ED$|$譺Et$j}Ut$$NjpD$ |$xD$l$Sxt$ xp? E$ıNjED$ |$ED$E$Et$蹱}ME$vNjED$ |$ED$E$Et$k}UeM;M<E<Mp;tx BpU;U>EF$D$ F D$|$h$FD$ F(D$|$h $F,D$ F0D$|$h$̔FD$ F4D$|$h$覔F,D$ F8D$|$h $耔F,D$ FwJ8HK|'u1ƅb"ch$u萏t D$\`$蛓BED$u4$衒t$h$C` $bۡEUt9B<9t$GGNj$H\;y uG$h$[^_]ÉlJ8Hu1Džn9A  $pt[$Nt_87;<;xP8QuヅA9=ku֋$荈D$ D$D$M $Bˢ0t u j$mƉ$1Ivh`$9`L$|$t$D$ T$L$$hE8ltj`hUYD$|$t$T$ L$D$$hEĵFU*fu} xncuL[^_]ËEEE $ 6|EuU;UEBE;E?U؋EBE;EU؋EBE;EU؋EBE;E+U؋EBE;EU؋E[BE;EsU؋E͍BE;EU؋EBE;EU؋EBE;E_U؋EBE;EU؋EBE;EU؋EBE؉;E?U؋E BE؉;EU؋E BE؉;EmU؋E BE؉;EU؋E ru؉4$zDž~31ҍN  E;U7E9uD$ t$|$E$qt<$FzEEԋE$ zL[^_]Ë${D$D$ $T${D$ |$._D$ƈ$zƈ$zE܉$yNjE؉D$ |$ED$Eԉ$EEt$vy}E܉$>yEċE؉D$ EĉD$ED$Eԉ$EEt$/yMĉMIE܉$xEE؉D$ ED$ED$Eԉ$EEt$xMME܉$xEE؉D$ ED$ED$Eԉ$EEt$xMMwE܉$`xƋE؉D$ t$ED$Eԉ$EEt$UxuE܉$xƋE؉D$ t$ED$Eԉ$EEt$xuE܉$wƋE؉D$ t$ED$Eԉ$EEt$wu^E܉$wƋE؉D$ t$ED$Eԉ$EEt$wuE܉$TwƋE؉D$ t$ED$Eԉ$EEt$IwuE܉$wƋE؉D$ t$ED$Eԉ$EEt$wuJE܉$vƋE؉D$ t$ED$Eԉ$EEt$vuE܉$vƋE؉D$ t$ED$Eԉ$EEt$vuE܉$HvƋE؉D$ t$ED$Eԉ$EEt$=vu6E܉$vƋE؉D$ t$ED$Eԉ$EEt$uuE܉$uƋE؉D$ t$ED$Eԉ$EEt$uu~E܉$~uƋE؉D$ t$ED$Eԉ$EEt$suuU!B D$ D$OL$M $atZ D$ D$PL$E$@tR_D$ D$D^_D$ $tn_D$ D$EԉƋEԋEt$t4$tUWVS=^̀;UQ ;L$$D$ WUT$$uM|}} 1҉  vƉ׋̀ D$D$ ;D$$D$UT$$tuEU)u}$u 11҉ ug1҉ tZ̀|L$ }|$D$'$pt)D$-UT$$#tuyM $v$u 1҉ ̀ D$D$ ;D$$D$UT$$sEME};}E4Ft߉$fvExE HUЉMԋEЃ1҉ }@}EML$$ur }%E;~}8M@}|$$uEEwME};}E^1MU  T$M $P\;u|-T$WqE~1U9Tu~~1ɍ}89N$NpETVV}8$pE@@@ @u1ɋUF FBFBFB FBuՋUM@|MAQ$T$yptEpHxL VEEpt}WHOLE9E|U9Us EUEUM#UU}}8dMȍ@t}GPEUEUD$UT$M $5sEUw"r=*wEUAQ@UT$ $rEqML$<$rr }%E;~$nE̅~1U9uV~6DžDDp ẺDD9Vԋ$mM̉~~}}8$KnǺ@@@ @u1ɉF FBFBFB FBuՋU<Mȍ pt)EUD$EЋUEЉUԋEЃD$ t$U T$$ksEWD$ D$ WD$ $lƋ$o4$l}WD$ D$ 뼐UWVSD$ D$O>D$Y$YUWV }E UEUƋUT$<$Xt$<$It$<$:t$<$+UЉƉD$<$t$<$ t$<$u } ^_]UWV}u t$<$t$<$t$<$u }^_]UWV u t41уMED$E$}' ^_]EED$E$X}~1>D$E$"9}u ^_]ÐUWV U UT$U $ED$E$E~tU D$UT$U $E1E4xt$U$t$E$9}uЋU UT$UT$U $E ^_]ÐUWVE D$E$ZE ~11E4t$E$"t$E$9} uу^_]ÐUME Uyt E ]E UM]VUE D$T$E$9ÐUWV}u t$<$u }^_]U]U]UVuF~D$F D$F$\F^]UVuF~%D$ D$F D$F$>`F^]UWVS@EUptcsD$ 9cD$UT$MԉT $uXac$X} |$E$TYxddEEE $(2VEЋ1cxYc1҉ tcEecx9}}NecB u<t 09t0A,uUecBExDu$W뤋=cEEE$UEEcExME} |$UT$$~W}t$ Bt<\u/Bu}?>8u)ƃ6u<7/t >1҃;UAU]ÐU )E]h>UVS(uED$E D$4$O?C[^]ÐUVS(uED$E D$4$? [^]ÐUWVS\Z(EE؋E UEЉUԋ.K$@Kp4$a<UWVS<&UBEؙU܋E؋UE؉U܃EUUBE؋U܃<[^_]EEԍ^UЋExlEU;BUB U t0q~91Ƀ<t9uEU܃EEU;B|E؋U܃<[^_]ÍD$ D$OEԉD$UЉ$0;D$ D$PUWV E@~rEUB U4tL~~3E}8t $;8EE;F|ԋ$:4$:EUE;P|UB ^_]ÐUWVSl$E$QUB@$~=MA@$R Eȅl[^_]E}G@$*=GpEEỦU;F}88MԍI4Vu FE9P}G BGV9|uMQ;QuۍA$I:NjE@D$ |$A D$ $UB t$::My Q}G BGV9}E9PtMA <v;wE;G v U$9EE~1U;EuG~'EMMEEU;W|$8MEGGU 0`E̋U܉EM9ME$8E؋E~1M;EuF~1ɍ}؉8;N|$7E؉UVV}8$ h8@@ u1ҋF FDFD u }ԍ4k$7@ @$ 7GZGVE;PMA <$7G Du q1ҋG9|돍D$ D$PD$$6D$ D$OԉƉ<$f64$6D$ D${뮍D$ D$~뚐UWVS uEEU 9V~hE E ;F.U UF <+MM;O|G Ĝ[^_]ËMċtEׄtq;V|`F$H6NjFD$ |$F D$4$F t$A6~ VF BFM 9-V;Vu떸a}tF@E$8EEEȋUUMM;PMM̋Uȋ.MԍI E AUQF@;WM;O uv U$<5EM~1U9EuW~1ɍu;O|$34EUWWMMu 0EuE-D$ D$OD$]$3D$ D$PԀ}z$3@ @$ E4G~1ҋG9|GM ;NiF U<eU؉$3E܋E؅~1U;EuMȋA~<DžttEUȋU U܉ ttE9H΋Uȋ$2E܋MȉU؉QQ$ W3@@ u1ҋEȋ@  Eȋ@D Eȋ@D  u؋UȋỦ UԍR i$2G Du E<$1u4$2iD$ D$~UWVS3u XU;B| [^_]ÅO XE;HQ XlMA \t?QPFP APuFP`H,d@@hEEE1\vT\E9T,UЋu,EẺUԸt3u:tuЋ\;F u1u̓Ef1tƋUԋp`|pM;V|xtuvMA@BB؉d4$P 9pDžth $P 9pth|;V*xMEtMtE;N^UUu A QuF VA QAQuFVAQUB@B@FFF F؉pL$`$4UЋE9TT[ $.\$.XM;QuF l[^_]D$ ẺD$?D$U$td|;NxMEtMtE;NUUu AQuFVAQA QuF VA QUB@B@FFF F؉}|E$.EU~1U9EuF~6Dž$E;V|ԋ$,MEFF|x$ ~-@@ u1ҋF  FD FD  ux uv,1\<9t$"-\ 9\;q|ŋ _Mĉ$,EȋUą~1U;EuF~6Dž$ Eȉ9Vԋ$+MȉEĉFFU$:,EE~1M;EuN~6Dž$M9Fԋ$+UMNNHM$+EE~1U9EuF~6Dž$E9Vԋ$*MEFFM$+EE~1U9EuF~6Dž$E9Vԋ$)MEFFD$ ủt$?D$E$t$d*E@@@ @u1ɋUF FBFBFB FBuՋMU uU $)E@@@ @u1ɋUF FBFBFB FBuՋMx UE$G)Eغ@@@ @u1ɋU؋F FBFBFB FBuՋM؋x UE$(Eܺ@@@ @u1ɋU܋F FBFBFB FBuՋM܋U uU܍ D$ D$~CD$$L'7D$ D$OԍOD$ D$PUWVSE U9B ļ[^_]Å M u;NE EUB MEt‹BpuP,U@@EEE1uvuEE9EU܋u Uظt0u7tʁ‹u܋u;F u1uЃEf1tɋU؋UuUMM;VUUuvMA@BB؉u4$P 9E}[UB@EȋuM;NMku@@@ @]ȋUȉM $P 9E}[uF@EԋuE;FMu@@@ @]ԋUԉML$E$*;U܋E9ECuE $$E$$U M;QuF Uļ[^_]ËMM$3%EU~1U9EuF~6DžTTdETT;V|ԋ$$MEFFUU$ $@@ u1ҋF  FD FD  uU uv1E<t $E$U M;q|΋ ~E$#EЋE̅~1U9EuF~6DžTTdEЉTT9Vԋ$"MЉẺFF~M$e#EċE~1U9EuF~6DžTTdEĉTT9Vԋ$B"MĉEFF$"E@@@ @u1ɋUF FBFBFB FBuՋMU u$T"E@@@ @u1ɋUF FBFBFB FBuՋMU u]D$ D$~D$Q$ D$ D$OԍD$ D$PUWVS( EtDEƋ}t FO)ȅu [^_]ËM9Yt 1[^_]ÉύOPt̓8t1֐UWVSL ED$ E D$ED$N-@T$#p,E؁M;F}$}8M܍L[^_]ÃE$j EUą~1U9EuF~1ɍ}89N$aEUĉVVj1L[^_]$E@@@ @u1ɋUF FBFBFB FBuՋUUWVSL" D$ E D$ED$+@T$@"r@U%E;V}$}8M܍L[^_]ÃUĉ$E}ą~1M9EuN~1ɍ}89N$EUĉVVh$E@@@ @u1ɋUF FBFBFB FBuՋUUWVS\ED$ED$ ED$E D$b*@X$ r$U%E;V}$}8M܍ɍ\[^_]ÃUĉ$EEą~1M9EuF~1ɍ}89N$yEUĉVVh$$E@@@ @@@@@ $u1ɋUF FBFBFB FBF BF$BF(BF,B $$$uUUVSuF@FDF (@$FHFLFTFP[^]ÐUVSuFHFLF@FF\F4F$D$e(@X$ FP[^]ÐUWVSlR} uEEEEE' t$ED$$Q tl[^_]ËED$<$R\ED$<$R\EԅtӋU'rM%E;N}n}8MI4D$EԉD$'@\$;FtF@E*UBEEԉ$l[^_]ÃM$EċE~1}9EuF~1ɍ}ĉ89N$|EĉUVV$ @@ u1ҋF FDFD u }4UWVS,^}E UGWGE܋&GUBB $PqU܉B G E&G UBB $P<UB G0E䋃'G0UBB $(UB wX'GXFF@$@F <$^,[^_]ÉNj&FU܉B t$<$ Nj'F t$'UB t$&FUB t$k뉉ِUWVS,}E UGWGE܋J%GUBB $PU܉B G EJ%G UBB $PUB G0E䋃J&G0UBB $(UB wXN&GXFF@$@XF <$,[^_]ÉNjJ%FU܉B t$I<$NjN&F t$%J&UB t$J%FUB t$뉉ِUWVS\^u}EUFVFE̋#FUBB $PnM̉A F EЋ#F UBB $P9MЉA F0Eԋ$F0UBB $(MԉA FXE؋$FXUBB@$@M؉A 4$RF E -FE #pM܁U;N}8MI4U D$U T$ #@\$sFED$ED$@\$IF@\[^_]ÃM$E}~1}9EuN~1ɍ}89N$EUVVE MB$ f@@ u1ҋF  FD FD  u }4Ƌ#GM̉A t$4$TƋ#GUЉB tʉ$Ƌ$U؉B t$$MԉA t$룉ݐUWVS\"u}EUFVFE̋ FUBB $P2M̉A F EЋ F UBB $PMЉA F0Eԋ!F0UBB $(MԉA FXE؋!FXUBB@$@M؉A 4$F E FEpM܁U;N}8MI4E D$U T$@\$7FED$ED$@\$ F@\[^_]ÃM$EE~1}9EuF~1ɍ}89N$EUVVfE fMB$ *@@ u1ҋF  FD FD  u }4Ƌ GM̉A t$4$Ƌ GUЉB tʉ$Ƌ!U؉B t$!MԉA t$o룉ݐUWVSl}<$PUȋ@EփM%E;NUŰ+MԍI@@]MD$Eȃ$#VGXGdt$RG0GFF0$WF~1ɍ89N$g>FF&$uF DuQ $u1ҋF uQ UWVSl,EU p4F$EăEEĉE̋U;V}8TM̍EBMJ @}}EE;~}8M܍ @Eăl[^_]ÃU$EЋ}~1M;EuN~1ɍ}Љ8;N|$EЉUVV }$9E~1U;EuV~1ɍ}9N$3EUVV$EԺ@@@ @u1ɋUԋF FBFBFB FBuՋUԉM̍}ԍ.$HE@@@ @u1ɋUF FBFBFB FBuՋUM܍}UWVSLn r4U%E;V}$}8M܍L[^_]ÃUĉ$eEEą~1M;EuF~1ɍ}9N$\EUĉVVh$E@@@ @u1ɋUF FBFBFB FBuՋUUWVS &uE x uClj9ptc@uE ƉlpR [^_]ÉE ƋE >p R [^_]É [^_]UE @ÐUE @ ÐUE @ÐUE @ÐUWVSL6} |$ $[ƅu oEED$ED$ ED$|$ $D$]~MԉL$$EEEE E؉D$|$$D$eUԉT$$u؅ D$ E܉D$t$$D$hUԉT$$;ME؉D$ $R\U܅LED$ED$$(ƅ@E܉$nE$cE$Xt$|$  $L[^_]Ë<$Pd…t⋳ T$$*P|$ $몍rD$ D$P~D$$nD$ D$^EԉD$$zD$ D$_UԉT$$ZD$ D$fMԉL$$3JD$ D$k뉍D$ D$n뜐UWVSkEEUJ M}EEEUBMԋED$} <$E}M ED$ ED$}|$$eUO$ƋUUFV$F EEEDF }EȋMAD$ EȉD$A D$ $UB t$-EȋMA QGD$ D$UT$$UWVS,rU B<EEE܍>~U؋U BDD$$tQD$ED$U$tZUDЉUEuE,[^_]EE,[^_]ÍD$ D$E܉D$U؉$5D$ D$ڐUWVS< E E܍E䋻 D$u܉4$P}1t$E$ƋE9t$< [^_]$@^ED$(4$PUE 9E]ÐUiEmލ']UE 9E]ÐUiEmލ']UWVEU u}11 ^_]ÐUiEmލ']UE D$E$UVEt(t!1ɉ)ҍ Vu^]1ɉ^]UE@]ÐUiEmލ']UE 9E]ÐUiEmލ']UE 9E]ÐUWV}M uUE;Et1^_]9u9u^_]UE EE]UWV}u D$$t 1^_]ËFD$G$u^_]UE]U~^jt E]]UWVS,ljU܋@EEEXE9G"uW 2x E}t+}t }EU;W}_}t}uՋEU9WW x tbE묋U܋BEU܉B}t*B,[^_]À}t'}u!U܋BuɃBU܉B,[^_]ËU܋B뮋E9G~JE܉D$$htE)E;G}#E܉D$$AE,{D$ D$P {D$z$ {D$ D$OUWVSmD$ED$@\$ED$E D$@\$ED$UT$@\$EE؋MMԋ}}Љ|$L$D$ E$pEtEļ[^_]Ë@ $SEp UUMM;V}8MEE}GUWMO 6}ut FO)ȅUJ@M}}EEUU܋ML$T$D$|$ }<$EEļ[^_]ÃU$E}~1};EuN~1ɍ}8;N|$EUVVUU  8 Utrtyt8t$7Eĺ@@@ @u1ɋUċF FBFBFB FBuՋUĉ~D$ D$/}D$9y$ ~D$ D$.ԐUWVS\*E(J~B1R4t($F$F$y4$q;J|ǃJFD$E$AE@ $R 9E@ MԉL$$RtJp EEUԉU;F}O}8M܍F E@ $R 9Ex\[^_]ÃE$AEE~1M9EuF~1ɍ}89N$8EUVV}8D$E@@@ @u1ɋUF FBFBFB FBuՋUM܍}D$ D$;D$u$[UMU BA]ÐUMU BA]ÐU]ÐU]ÐUWVS,uVXx FX,[^_]FXV B~1ɍsRsE9J~Ʌx;J}3B xuFXݍsD$ D$O|$E$sD$ D$P|$E$vUVSuD$E D$@\$<EBwrCF[^]F[^]F[^]F[^]F[^]UVSuD$E D$@\$BEBwpAF[^]F[^]F[^]F[^]F[^]UWVS,u~Tx FT,[^_]FTV0J~1ɍppE9J~Ʌx;J}3B xuFTݍpD$ D$O|$E$qD$ D$P|$E$UWVS\<UBB $(e}G }UB GG $(0G }0UB0GG $(G u@UB@FF $(F E@T@XU :[tyD$T$@\$}G\u t FO)ȅ}G`UBPBBB\[^_]ËE $ED$D$@\$?UB\}ԋut FO)ȅ}G`E$ UBPBBB\[^_]ÉE܋FG t$F}G t$UB t$v}܉<$E܋붉EȉE܋F t$>uUWVS\>UBB $(}G }:UB GG $(G }0:UB0GG $(xG u@>UB@FF $(FF E@T@XU :[tyD$T$b@\$@}G\ru t FO)ȅ}G`UBPBBB\[^_]ËE $2ED$D$b@\$UB\r}ԋut FO)ȅ}G`E$UBPBBB\[^_]ÉE܋:FG t$$F}G t$ >UB t$}܉<$1E܋:붉EȉE܋>F t$uUWVS,0EE E@~"1UB t$E;p|UB}0G~1G t$c;w|GUB@BLt$7G t$E0UB t$UB tE,[^_],[^_]UWVS,8EE E@~"1UB t$E;p|UB}0G~1G t$k;w|GUB@BLt$7G t$E0UB t$UB tE,[^_],[^_]U1]ÐUS:ǃED$$Ru []1[]ÐUSUx8u;u=E D$~D$z$ z$[]ÉT$ ED$뽐UWVS<t 1<[^_]Ë MD$T$ $PUM L$$<$XG"uFE؍E܍EE1D؉D$<$nsu$8u <[^_]Ë ($RdB$* $+$.$/fD$BD$ D$$$T$HT$$1` D$ ,D$D$$$D$PD$$D؉D$ D$ D$$y$plD$D$ D$$$T$HT$$D$D$D$ D$$T$T$$M$!$"&D$$UWVS,.EU܋H Ex;}~yB u<tm9tZA,u싋A4U;ut4$P8EP;PtDMA 4BAx;},[^_]ËU䋋A4U;uuRMA$NjE@D$ |$A D$ $UB t$My QdD$ D$D$d$tUWVS,ؿ} ED$E$Ǎ@vnt51D$4$u+u u,[^_]1+u u~1;utۉ|$4$Wǃu1,[^_]UlLE]UWVS,ljUM1҉ u,[^_]ËED$$ƅtD$<$ML$<$(D$<$FD$<$E@ ,[^_]ÐUWVS,xNjP,[^_]1bE䍋DbM9}HG $уW9~ɋHuFw5+v.*o4$M_4$gH04M䋃3D$L$$RM^?~HDžDž ?fxHu01҉ yD$ yD$CD$ $ T$ L$D$D$E$jE$R<E$[^_]Ë01҉ 0DžDž +=uj0401҉ 댋?xD$MA$@'SD$D$ {$RHT$D$ {$PH|,E@ URMID$ |4$RgD$$;Ƌ[D$ D$t$ $t$$P\D$ $ؽD$ /D$D$4$9D$XL$D$ MH $pD$,4$4$D$ D$D$F$ $D$4$落ƅ4$D$ D$D$F$`84$P@NjU;UEPHuN{p}U;~}8dMI@{zU%E;W7MM~u@$_MAAA AAEtAEt uF} w Ĭ[^_]E }8MEUB {zM%E;O"MMuȍ@EMA{zu%E;wMMЋdu؍x$ 蜂ƋM AUFM $<$F}W;WZ}G 4BGEEU 9BEEU BMDD$$Q{p }M;~`$=E~1U;`uN~1ɍ}89N$4E`VV}8$迁E@@@ @u1ɋUF FBFBFB FBuՋu4}Ed$+E܅~1U;duG~1ɍu܉;O|$"E܉dWWMMЋ$誀ƺ@uG WDTu}Љ4U؍Id$GE̋d~1u;duG~1ɍủ9O$8ẺdWWMMc$ƺ@uG WDTu}4UȍMA$[NjUыRT$ |$Q T$ $UB t$LMy QNd$Ed~1M9duG~1ɍu0;O|$}EdWWI`$~E~1U9`uF~1ɍ}8;N|$|}E`VV$ ~@@ u1ҋF  FD FD  u uvB$}ƺ@uG WDTu}4U/3jD$ D$ nD$$x|nD$ D$ ԉNjMA t$+}<$o|lj4$8|ϐUWVSfEE;E ļ[^_]ËP $xl>dt0d$PHUME؅Eȅ9!uċEЅt$z|uԋEt$h|M $|{E ;E[$"|E!EEE $({E!EEE $({EЍE䉅P$Y<t2<NiD$ D$afD$] $zP$VptEEE $ 6{EpttyhD$ D$ 4$|$0{U;UxE{ UD$ D$ 4$|$|Ɖ׉ utuF$zDž7EEt$zU$y?;1$GzuM<$kyP $dP$ńP$跄h#1E<U؃9hP $踄NjU;Uu͍E܍$yEE؉D$ ED$ED$Eԉ$*Et$yUUUxP$Kƀ>G1$1yljuU$Ux?1$xuM<$xP $ɃP$軃dP$kP $]E1E 0AttributeInfo.cpp%s:%u: failed assertion `%s' attributeLength >= 0index >= 0YVector.hindex < mySizeinfoClassFile.cppConstantClassInfo::TAG == info->getTag()nameInfoConstantUtf8Info::TAG == nameInfo->getTag()constantPoolCount >= 0myThisClass > 0mySuperClass >= 0myInterfaceCount >= 0myInterfaces[i] > 0fieldCount >= 0methodCount >= 0attributeCount >= 0accessFlags >= 0classNameIndex > 0nameIndex > 0descriptorIndex > 0methodClassIndex > 0methodNameIndex > 0methodDescriptorIndex > 0myStartPc >= 0CodeAttribute.cppmyEndPc > myStartPcmyHandlerPc >= 0myCatchType >= 0codelength >= 0startPc >= 0indicescurrentExceptionCodeaddedCodeLength >= 0myMaxStack >= 0myMaxLocals >= 0myCodeLength > 0myCodeLength < 65536exceptionTableLength >= 0$$YJP$$classSignatureCommonGlobals.cppmethodNamemethodSignaturemethodIndex_capacity > 0YSet.hinitial_capacity > 0index >=0 && index < _capacitykey != 0capacity > 0threadourAllThreadInfos.contains(threadInfo)YMap.hbytechardoublefloatintlongshortbooleanERROR: JVMTI error err=%d(%s) in %s:%d falseCommonUtils.cppsYString.hYJPQUOTEDsourceprefixbeginIndex >= 0beginIndex <= endIndexendIndex <= len_length(s) >= lengthConstantClassInfo.cppmyNameIndex > 0classIndex > 0ConstantFieldRefInfo.cppnameAndTypeIndex > 0myClassIndex > 0myNameAndTypeIndex > 0ConstantNameAndTypeInfo::TAG == nameAndTypeInfoTmp->getTag()ConstantInterfaceMethodRefInfo.cppConstantClassInfo::TAG == classInfoTmp->getTag()part1|part2ConstantMethodRefInfo.cppConstantNameAndTypeInfo.cppConstantUtf8Info::TAG == descriptorInfo->getTag()myDescriptorIndex > 0Unknown tag: %d 0ConstantPoolInfoReader.cppstringIndex > 0ConstantStringInfo.cppmyStringIndex > 0ConstantValuemyConstantValueIndex > 0ConstantValueAttribute.cppcom/yourkit/Constantscom/yourkit/api/ProfilingModescom/yourkit/api/ProfilingModesExtcom/yourkit/api/TelemetryRecordcom/yourkit/runtime/Agentcom/yourkit/runtime/AgentExceptioncom/yourkit/runtime/Callbackcom/yourkit/runtime/Core$1com/yourkit/runtime/Core$2com/yourkit/runtime/Core$3com/yourkit/runtime/Core$MyProcessOutputReadercom/yourkit/runtime/Corecom/yourkit/runtime/MemoryThresholdJVMPI$1com/yourkit/runtime/MemoryThresholdJVMPIcom/yourkit/runtime/MemoryThresholdJVMTI$1com/yourkit/runtime/MemoryThresholdJVMTIcom/yourkit/runtime/OOMEDumpercom/yourkit/runtime/Packetcom/yourkit/runtime/PeriodicalCaptureSupport$1com/yourkit/runtime/PeriodicalCaptureSupportcom/yourkit/runtime/PresentableExceptioncom/yourkit/runtime/Protocolcom/yourkit/runtime/RequestProcessingcom/yourkit/runtime/StackTraceElementRescom/yourkit/runtime/TelemetryThreadJVMPIcom/yourkit/runtime/TelemetryThreadJVMTIcom/yourkit/runtime/ThreadInfoRescom/yourkit/runtime/Unquotercom/yourkit/util/Assertscom/yourkit/util/MarkerFiles$1com/yourkit/util/MarkerFilescom/yourkit/util/Stringsjava/lang/ClassLoader()Ljava/lang/ClassLoader;getSystemClassLoaderassertJNI failed: systemClassLoaderCoreInit.cpprc == 0(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIZZZZZZJZJILjava/lang/String;)Zinitmid_initaddSnapshotInfo(Ljava/lang/String;J)VcaptureSnapshot(Ljava/lang/String;IJ)IclearAllocationData()VclearCPUDataclearMonitorDatacreateMarker(II)VfindSnapshot(Ljava/lang/String;)ZgetDatabaseStatistics()Ljava/lang/String;getHostIDgetJVMPITelemetryValue(I)IgetProcessCPUTimeNs()JgetStatusgetThreadInfosJVMPI()[Lcom/yourkit/runtime/ThreadInfoRes;getUptimeMsmarkMemory(ILjava/lang/String;)VsetProperty(Ljava/lang/String;Ljava/lang/String;)VstartAllocationRecording(J)IstartCPUProfiling(JLjava/lang/String;)IstartMonitorProfiling()IstopAllocationRecordingstopCPUProfilingstopMonitorProfilingstoreTelemetryRecord([I[I)VwriteTables(II[I)VCoreNatives.cpp(mode & ProfilingModes::ALLOCATION_RECORDING_BIT) != 0jni(mode & ~ProfilingModes::ALLOCATION_RECORDING) == 0(mode & ProfilingModes::CPU_TIMES_BIT) != 0(mode & ~ProfilingModes::CPU_PROFILING) == 0mode == ProfilingModes::CPU_TIMES_BITlength == TELE_FIELD_COUNTourJVMTI != NULLourJVMPI != NULL(JLjava/lang/String;JJJJLjava/lang/String;JZZI[Lcom/yourkit/runtime/StackTraceElementRes;)VmidThreadmidElementresulttracesnewElementnewThread(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V String bodies: M TFI: Total size: DB.h%6.1f%20s records=%7d/%7d allocated= MYIntChunkMap.hstringthreadframemethodj2eemonitorcpuprofilinginstancecountsframetablegenerationsnapshotallocinfoallocatorgenerationpropertiesteleVM Starttelec.heap.memory.max.kbtelec.non.heap.memory.max.kbtelec.unloaded.class.counttelec.peak.thread.counttelec.created.thread.counttelec.deadlock.foundvalueDataInput.cppvDataOutput.cppdb::oomesecondDeprecatedExceptionsnumberOfExceptions >= 0ExceptionsAttribute.cppFieldInfo.cppmyAccessFlags >= 0 *filter: type=%d %s classNamePatternFilter.hfilter: type=%d %s %s %s [YourKit Java Profiler 7.0.10] *** WARNING! *** Invalid filter specification: %s spec != NULLFilter.cpp?s1/.yjp/config/.walltimerjava.io.RandomAccessFile readBytes ([BII)I java.io.RandomAccessFile read ()I java.io.RandomAccessFile write (I)V java.io.RandomAccessFile writeBytes ([BII)V java.net.SocketInputStream socketRead0 (Ljava/io/FileDescriptor;[BIII)I java.net.SocketOutputStream socketWrite0 (Ljava/io/FileDescriptor;[BII)V #+Generations.cppmySize > 0myInnerClassInfoIndex >= 0InnerClassesAttribute.cppmyOuterClassInfoIndex >= 0myInnerClassNameIndex >= 0myInnerClassAccessFlags >= 0InnerClassesnumberOfClasses >= 0InstanceCounting.cppsignatureInstrumentation.cppobjallocatorIndex != -1!threadInfo->myEntryTimesNs.empty()currentFrameIndex != -1threadInfo->myCurrentFrameIndex != 0L;instrumentation of class '%s' has taken %d ms ZourYJPMethodEntryExitfieldourYJPAllocclose41commitcreateStatement(III)Ljava/sql/Statement;(II)Ljava/sql/Statement;()Ljava/sql/Statement;prepareCall(Ljava/lang/String;III)Ljava/sql/CallableStatement;(Ljava/lang/String;II)Ljava/sql/CallableStatement;(Ljava/lang/String;)Ljava/sql/CallableStatement;prepareStatement(Ljava/lang/String;I)Ljava/sql/PreparedStatement;(Ljava/lang/String;[Ljava/lang/String;)Ljava/sql/PreparedStatement;(Ljava/lang/String;III)Ljava/sql/PreparedStatement;(Ljava/lang/String;)Ljava/sql/PreparedStatement;(Ljava/lang/String;II)Ljava/sql/PreparedStatement;(Ljava/lang/String;[I)Ljava/sql/PreparedStatement;rollback(Ljava/sql/Savepoint;)Vexecute(Ljava/lang/String;I)Z3(Ljava/lang/String;[I)Z(Ljava/lang/String;[Ljava/lang/String;)ZexecuteBatch()[IexecuteQuery(Ljava/lang/String;)Ljava/sql/ResultSet;executeUpdate(Ljava/lang/String;[I)I(Ljava/lang/String;)I(Ljava/lang/String;I)I(Ljava/lang/String;[Ljava/lang/String;)I()Z2()Ljava/sql/ResultSet;connect(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V5_jspServiceforward(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V6includegetRequestDispatcher(Ljava/lang/String;)Ljavax/servlet/RequestDispatcher;getNamedDispatcher(Ljava/lang/String;)V(Ljava/lang/String;Z)Vlist(Ljava/lang/String;)Ljavax/naming/NamingEnumeration;7lookup(Ljava/lang/String;)Ljava/lang/Object;bind(Ljava/lang/String;Ljava/lang/Object;)VlistBindingslookupLinkrebindunbind(Ljavax/naming/Name;)Ljavax/naming/NamingEnumeration;(Ljavax/naming/Name;)Ljava/lang/Object;rename(Ljavax/naming/Name;Ljavax/naming/Name;)V(Ljavax/naming/Name;Ljava/lang/Object;)VcomposeName(Ljavax/naming/Name;Ljavax/naming/Name;)Ljavax/naming/Name;createSubcontext(Ljavax/naming/Name;)Ljavax/naming/Context;destroySubcontext(Ljavax/naming/Name;)VgetNameParser(Ljavax/naming/Name;)Ljavax/naming/NameParser;search(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;Ljavax/naming/directory/SearchControls;)Ljavax/naming/NamingEnumeration;(Ljava/lang/String;Ljavax/naming/directory/Attributes;[Ljava/lang/String;)Ljavax/naming/NamingEnumeration;(Ljava/lang/String;Ljavax/naming/directory/Attributes;)Ljavax/naming/NamingEnumeration;(Ljava/lang/String;Ljava/lang/String;Ljavax/naming/directory/SearchControls;)Ljavax/naming/NamingEnumeration;getAttributes(Ljava/lang/String;)Ljavax/naming/directory/Attributes;(Ljava/lang/String;[Ljava/lang/String;)Ljavax/naming/directory/Attributes;(Ljava/lang/String;Ljava/lang/Object;Ljavax/naming/directory/Attributes;)V(Ljava/lang/String;Ljavax/naming/directory/Attributes;)Ljavax/naming/directory/DirContext;getSchema(Ljava/lang/String;)Ljavax/naming/directory/DirContext;getSchemaClassDefinitionmodifyAttributes(Ljava/lang/String;ILjavax/naming/directory/Attributes;)V(Ljava/lang/String;[Ljavax/naming/directory/ModificationItem;)V(Ljavax/naming/Name;Ljavax/naming/directory/Attributes;)Ljavax/naming/NamingEnumeration;(Ljavax/naming/Name;Ljava/lang/String;[Ljava/lang/Object;Ljavax/naming/directory/SearchControls;)Ljavax/naming/NamingEnumeration;(Ljavax/naming/Name;Ljava/lang/String;Ljavax/naming/directory/SearchControls;)Ljavax/naming/NamingEnumeration;(Ljavax/naming/Name;Ljavax/naming/directory/Attributes;[Ljava/lang/String;)Ljavax/naming/NamingEnumeration;(Ljavax/naming/Name;[Ljava/lang/String;)Ljavax/naming/directory/Attributes;(Ljavax/naming/Name;)Ljavax/naming/directory/Attributes;(Ljavax/naming/Name;Ljava/lang/Object;Ljavax/naming/directory/Attributes;)V(Ljavax/naming/Name;Ljavax/naming/directory/Attributes;)Ljavax/naming/directory/DirContext;(Ljavax/naming/Name;)Ljavax/naming/directory/DirContext;(Ljavax/naming/Name;ILjavax/naming/directory/Attributes;)V(Ljavax/naming/Name;[Ljavax/naming/directory/ModificationItem;)VrecordJ2EEHelper.cppgetRequestURIgetRequestURIMethodIDLjava/sql/Connection;Ljava/sql/Statement;Ljava/sql/PreparedStatement;Ljava/sql/Driver;Ljavax/servlet/http/HttpServlet;Ljavax/servlet/jsp/HttpJspPage;Ljavax/servlet/RequestDispatcher;Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletContext;Ljavax/servlet/jsp/PageContext;Ljavax/naming/Context;Ljavax/naming/directory/DirContext;classSigsigJNIRedirect.cppjava/lang/RuntimeException (, )[YourKit Java Profiler 7.0.10] %s [YourKit Java Profiler 7.0.10] %s: error code = %d yjpInit0(Ljava/lang/Object;I)IyjpMethodEntry0(SS)VyjpMethodExit0yjpSQLEntry1(Ljava/lang/Object;S)VyjpSQLEntry2yjpSQLEntry3yjpSQLExit1(Ljava/lang/Object;Ljava/lang/Object;S)VyjpSQLExit2yjpSQLExit3yjpServletEntryyjpServletExityjpIsJ2EEClass(Ljava/lang/Object;)ZJVMTI_Agent.cpp(J)VcaptureSnapshotOnExitcallback.jarrecordsStack->size() == timesStack->size()java/lang/ThreadtoIndex <= mySizeCannot start allocations recordingAllocations recording is startedrb[YourKit Java Profiler 7.0.10] *** WARNING! *** Cannot read filter definitions from %s com.sun.* java.* javax.* sun.* jrockit.*Cannot start CPU profilingCPU profiling is startedCannot start monitor profilingMonitor profiling is startedYJPAgent-CPUSamplerYJPAgent-OOMESnapshotDetectorYourKit Java Profiler 7.0.10 cannot start%s: Unable to create JVMTI environment, error=%d ourJVMTIjava.vm.vendorjava.vm.version1.5.0R27.R27.1java.vm.info%s: the JVM does not provide required profiling capabilities. This happens because garbage collector that does not support heap profiling is possibly used. Please pay attention to JVM parameters such as -XX:+UseConcMarkSweepGC and -Xincgc. %s: Unable to create JVMTI environment /tmp/yjp200801212157.jar[YourKit Java Profiler 7.0.10] Cannot open temp. jar file for reading: %s. Please consider -agentlib:yjpagent=tmpdir= option. 32 bit JVMMac OS X[YourKit Java Profiler 7.0.10] Using JVMTI (%s;%s;%s;%s;%s) yjp_jvmti_sampler_lockIBMBEAApple20070420lengthAddedAtStart >= 0LineNumberTableAttribute.cppLineNumberTablelineNumberTableLength >= 0LocalVariable.cppmyLength >= 0myIndex >= 0LocalVariableTablelocalVariablesTableLength >= 0LocalVariableTableAttribute.cppLocalVariableTypeTablehandle != -1MemAllocator.cppaddresstoIndex >= 0fromIndex <= toIndexosize > 0refIndex < refCountinitialCapacity > 0!isMarked(bitField, object)object != 0%s (%d)!*tag_ptrMemorySnapshot.cppclass_taguser_dataYourKit Java Profiler 7.0.10: heap_root_callback: JVM passed improper root kind: %d tagYourKit Java Profiler 7.0.10: stack_reference_callback: JVM passed improper root kind: %d isPrimArrayClass()myPrimArrayElementSize > 0klassprocessedClasseserror == JVMTI_ERROR_NONEfull_index >= 0full_index < allFields->size()YourKit Java Profiler 7.0.10: object_reference_callback: JVM passed improper reference kind: %d Ljava/lang/Class;interface_tagrefIndex != -1object_tag_ptrYourKit Java Profiler 7.0.10: JVM passed improper primitive type: %d tag_ptrelementsourPrimitivesOffsets[referrerIndex] == 0Captured snapshot java/lang/ClassourClassInfos.size() == 0get_tag(aClass) == newTaggetPureTag(tag)count == 1myCommitedSnapshotWriter.hjava/lang/String!myCommitedMethodInfo.cppcodeAttributeNameIndex != -1Monitors.cpp%s/java_pid%d.hprofresult->size() == 0OSSpecific.cppunknown macIOPlatformExpertDeviceIOPlatformSerialNumberpureTag > 0ObjectEnumerator.cppindex > 0index < refCountrank == 0rank >= 0rank < myRankmyRefTableToUnmapObjectStorage.cppmyOffsetTableToUnmapobjectCount > 0myOffsetTablemyRefTableparentsobjectIndex > 0parentAt >= 0parentObjectIndex > 0value == 0index == CLASS_REF_INDEXindex < myObjectCountoldObject!hasAllocatorbad type: %d rank >= 1instructionIndex >= 0OffsetTable.cppoffsetIndex > 0indexInTable < myTable.size()tracingnoj2eedisableallocdisablecountsdisablej2eemonitorsoptionOptions.cppcpu=timessamplingcpu=fullcpu=nolib[YourKit Java Profiler 7.0.10] *** WARNING! *** '%s' option is deprecated; use '%s' instead. YourKit Java Profiler 7.0.10 JVMTI agent usage: -agentlib:yjpagent=[help]|[